The Kodak PhotoYCC colour space was designed for encoding images with the PhotoCD system. It is based on both CCIR Recommendations 709 and 601-1, having a colour gamut defined by the CCIR 709 primaries and a luminance - chrominance representation of colour like CCIR 601-1's YCbCr. To encode data, a transfer function (gamma correction) is first applied;
For R,G,B > 0.018
R' = 1.099*R ^0.45 - 0.099 G' = 1.099*G ^0.45 - 0.099 B' = 1.099*B ^0.45 - 0.099For R,G,B, <= 0.018
R' = 4.5*R G' = 4.5*G B' = 4.5*BSecondly the R'G'B' data is transformed into PhotoYCC data,
Luma = 0.299R' + 0.587G' + 0.114B' Chroma1 = -0.299R' - 0.587G' + 0.886B' Chroma2 = 0.701R' - 0.587G' - 0.114B'Finally the floating point values are stored as 8 bit integers;
Luma_8bit = (255 / 1.402)Luma Chroma1_8bit = 111.40*Chroma1 + 156 Chroma2_8bit = 135.64*Chroma2 + 137The unbalanced scale difference between Chroma1 and Chroma2 is designed, according to Kodak, to follow the typical distribution of colours in real scenes.
Kodak YCC can store more information than current display devices can cope with (it allows negative RGB values), the transforms from YCC to RGB are therefore not simply the inverse of RGB to YCC, they depend on the target display system.
Converting PhotoYCC data to RGB 24bit data for display by computers on CRT's is achieved as follows;
Firstly normal Luma and Chroma data are recovered;
Luma = 1.3584 * Luma_8bit Chroma1 = 2.2179 * (Chroma1_8bit - 156) Chroma2 = 1.8215 * (Chroma2_8bit - 137)For display primaries that are, or are very close to, CCIR Recommendation 709 primaries in their chromaticities, then
R' = L + Chroma2 G' = L - 0.194Chroma1 - 0.509Chroma2 B' = L + Chroma1Two things to watch are;
a) this results in RGB values from 0 to 346 (instead of the more usual 0 to 255) a look-up-table is usually used to convert these through a non-linear function to 8 bit data. For example;
Y = (255/1.402)*Y'
C1 = 111.40*C1'+156
C2 = 135.64*C2'+137
b) if the display phosphors differ from CCIR 709 primaries then further
conversion will be necessary, possibly through an intermediate device
independent colour space such as CIE XYZ.Converting stored PhotoYCC data to RGB signal voltages for display on television's is achieved as follows;
Firstly normal Luma and Chroma data are recovered;
Luma = 1.3584 * Luma_8bit Chroma1 = 2.2179 * (Chroma1_8bit - 156) Chroma2 = 1.8215 * (Chroma2_8bit - 137)the RGB display voltages are then as follows;
R' = (L + Chroma2) / 353.2 G' = (L - 0.194Chroma1 - 0.509Chroma2) / 353.2 B' = (L + Chroma1) / 353.2Note, the gamma corrected RGB values (R'G'B') are fine so long as you haven't done anything silly - like calibrate you CRT for linear luminance :)