YCoCg: Difference between revisions
mNo edit summary |
(general English edits) |
||
Line 1: | Line 1: | ||
Some modern video codecs (e.g. [[ | Some modern video codecs (e.g. [[Dirac]], [[H.264|H.264 FRExt]]) support the YCoCg colorspace. The correct written expression for this colorspace is YC<sub>o</sub>C<sub>g</sub>, with the 'o' and 'g' characters as subscripts. | ||
== Technical Details == | |||
The various components of the name represent: | |||
== | |||
* Y = pseudo luminance, or intensity | * Y = pseudo luminance, or intensity | ||
Line 11: | Line 8: | ||
* C<sub>g</sub> = "green chrominance" | * C<sub>g</sub> = "green chrominance" | ||
In contrast to [[YCbCr]] this | In contrast to [[YCbCr]], this colorspace isn't based on the human vision model. This colorspace was invented to use similar encoding techniques as [[YCbCr|YC<sub>b</sub>C<sub>r</sub>]] but with frames in [[RGB]] colorspace. It is possible to losslessly transform from [[RGB]] to YCoCg when using 2 more bits for YCoCg representation than for RGB. E.g., it is possible to losslessly transform a pixel from a 30-bit RGB frame into a pixel in a 32-bit YCoCg 4:4:4 frame and back. This assumes that each R, G, and B component will have 10 bits of information which Y will have 10 bits and Co and Cg will each have 11 bits. | ||
This colorspace | |||
It is possible to losslessly transform from [[RGB]] to YCoCg when | |||
Sometimes this colorspace is called YCoCg-R because of the lossless reversible transformation. The original and outdated algorithm could not restore the RGB value exactly but used as many bits for the YCoCg version as the RGB version. The latter algorithm isn't widely used anymore. | |||
Like with [[:Category:YCbCr Formats|YCbCr]] it is also possible to use different plane sizes for each component. Thus, every pixel in an image of a YCoCg encoded frame is associated with one Y sample, but possibly groups of pixels share C<sub>o</sub> and C<sub>g</sub> samples. | |||
== | == Possible Formats == | ||
Possible encodings include: | |||
* YCoCg 4:4:4 | * YCoCg 4:4:4, analogous to [[YCbCr 4:4:4]] | ||
* YCoCg 4:2:2 | * YCoCg 4:2:2, analogous to [[YCbCr 4:2:2]] | ||
* ... | * ... | ||
Line 47: | Line 38: | ||
B = t - (Co >> 1) | B = t - (Co >> 1) | ||
R = Co + B | R = Co + B | ||
[[Category:Compression Theory]] |
Revision as of 15:59, 16 March 2009
Some modern video codecs (e.g. Dirac, H.264 FRExt) support the YCoCg colorspace. The correct written expression for this colorspace is YCoCg, with the 'o' and 'g' characters as subscripts.
Technical Details
The various components of the name represent:
* Y = pseudo luminance, or intensity * Co = "orange chrominance" * Cg = "green chrominance"
In contrast to YCbCr, this colorspace isn't based on the human vision model. This colorspace was invented to use similar encoding techniques as YCbCr but with frames in RGB colorspace. It is possible to losslessly transform from RGB to YCoCg when using 2 more bits for YCoCg representation than for RGB. E.g., it is possible to losslessly transform a pixel from a 30-bit RGB frame into a pixel in a 32-bit YCoCg 4:4:4 frame and back. This assumes that each R, G, and B component will have 10 bits of information which Y will have 10 bits and Co and Cg will each have 11 bits.
Sometimes this colorspace is called YCoCg-R because of the lossless reversible transformation. The original and outdated algorithm could not restore the RGB value exactly but used as many bits for the YCoCg version as the RGB version. The latter algorithm isn't widely used anymore.
Like with YCbCr it is also possible to use different plane sizes for each component. Thus, every pixel in an image of a YCoCg encoded frame is associated with one Y sample, but possibly groups of pixels share Co and Cg samples.
Possible Formats
Possible encodings include:
- YCoCg 4:4:4, analogous to YCbCr 4:4:4
- YCoCg 4:2:2, analogous to YCbCr 4:2:2
- ...
Algorithm
The algorithm is described in this paper: YCoCg(-R) Color Space Conversion on the GPU.
And in the dirac spec in section F.1.5.2.
From RGB to YCoCg:
Co = R - B t = B + (Co >> 1) Cg = G - t Y = t + (Cg >> 1)
and back from YCoCg to RGB:
t = Y - (Cg >> 1) G = Cg + t B = t - (Co >> 1) R = Co + B