Difference between revisions of "YCoCg"

From MultimediaWiki
Jump to navigation Jump to search
Line 6: Line 6:


This colorspace is invented to use similar encoding techniques as for [[YCbCr|YC<sub>b</sub>C<sub>r</sub>]] but with frames in [[RGB]] colorspace.
This colorspace is invented to use similar encoding techniques as for [[YCbCr|YC<sub>b</sub>C<sub>r</sub>]] but with frames in [[RGB]] colorspace.
It is possible to transform lossless from [[RGB]] to YCoCg when two more bits than used for RGB are available for the YCoCg represantation. This way it is possible to lesslessly transform a 30-bit RGB (10 bits for each color) frame into 32 bits in YCoCg and back.
It is possible to transform lossless from [[RGB]] to YCoCg when two more bits than used for RGB are available for the YCoCg represantation. This way it is possible to losslessly transform a 30-bit RGB (10 bits for each color) frame into 32 bits in YCoCg and back.


Sometimes it is called YCoCg-R because of the lossless reversable transformation. The original and outdated algorithm could not restore the RGB value exactly but used only as much bits as the RGB version. The latter algorithm isn't used anymore.
Sometimes this colorspace is called YCoCg-R because of the lossless reversable transformation. The original and outdated algorithm could not restore the RGB value exactly but used only as much bits as the RGB version. The latter algorithm isn't used anymore.


Like with [[:Category:YCbCr Formats|YCbCr]] it is also possible to use different sized planes for each component. Thus, every pixel in an image of a YCoCg encodec frame is associated with one Y sample, but possibly groups of pixels share C<sub>o</sub> and C<sub>g</sub> samples.
Like with [[:Category:YCbCr Formats|YCbCr]] it is also possible to use different sized planes 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.


So this encodings are possible for instance
So this encodings are possible for instance
Line 16: Line 16:
     * YCoCg 4:2:2
     * YCoCg 4:2:2
     * ...
     * ...
The algorithm is described in this paper: [http://escher.elis.ugent.be/publ/Edocs/DOC/P105_213.pdf YCoCg(-R) Color Space Conversion on the GPU].
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

Revision as of 03:12, 16 March 2009

Some modern video codecs (e.g. dirac) support the YCoCg colorspace. More correctly written this is YCoCg, with the 'o' and 'g' characters as subscripts. This is what the components represent:

   * Y = pseudo luminance, or intensity
   * Co = "orange chrominance"
   * Cg = "green chrominance"

This colorspace is invented to use similar encoding techniques as for YCbCr but with frames in RGB colorspace. It is possible to transform lossless from RGB to YCoCg when two more bits than used for RGB are available for the YCoCg represantation. This way it is possible to losslessly transform a 30-bit RGB (10 bits for each color) frame into 32 bits in YCoCg and back.

Sometimes this colorspace is called YCoCg-R because of the lossless reversable transformation. The original and outdated algorithm could not restore the RGB value exactly but used only as much bits as the RGB version. The latter algorithm isn't used anymore.

Like with YCbCr it is also possible to use different sized planes 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.

So this encodings are possible for instance

   * YCoCg 4:4:4
   * YCoCg 4:2:2
   * ...

The algorithm is described in this paper: YCoCg(-R) Color Space Conversion on the GPU.

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