View Single Post
Old 27th August 2008, 21:03   #4045  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
Quote:
Originally Posted by Casimir666 View Post
My current ITU-709 -> RGB conversion is :
R = (Y + 1.402*(Cr-128));
G = (Y - 0.34414*(Cb-128) - 0.71414*(Cr-128));
B = (Y + 1.772*(Cb-128));

Is it the correct transformation formulas ?
Hi Casimir - this is the function I use to convert Rec.709 to RGB (from my old hdsup2bdn tool):

Code:
void SupPalette::YCrCbToRGB_Rec709()
{
  double Kr = 0.2125, Kb = 0.0721;
  double Kg = 1.0 - Kr - Kb;

  double rp = Y + 2*(Cr-128)*(1.0-Kr);
  double gp = Y - 2*(Cb-128)*(1.0-Kb)*Kb/Kg - 2*(Cr-128)*(1.0-Kr)*Kr/Kg;
  double bp = Y + 2*(Cb-128)*(1.0-Kb);

  R = fabs(rp); G = fabs(gp); B = fabs(bp);

  //cout << "\tY = " << long(Y) << ", Cr = " << long(Cr) << ", Cb = " << long(Cb) << endl;
  //cout << "\tR = " << rp << ", G = " << gp << ", B = " << bp << endl;
}
The resulting coefficients are very different from yours unfortunately.

Last edited by Rectal Prolapse; 27th August 2008 at 21:08.
Rectal Prolapse is offline