I recently added a pattern to GStreamer’s videotestsrc that can be used to check YCbCr to RGB conversion is being done correctly as part of video output. It is the result of a clever hack — some YCbCr values, when converted to RGB, are out of range, so as part of the conversion process, they are clamped to the nearest RGB value. The pattern generator creates a checkerboard pattern of a color (say, red) and a YCbCr value that upon correct conversion will result in the same color. Thus the pattern should be invisible. Usefully, these out-of-gamut YCbCr values are preserved by video codecs, so I can present to you a Theora video demonstrating this:
Firefox does the conversion correctly, so it’s unlikely you’ll see the pattern. However, some video display drivers still get this wrong, so you might see the pattern when playing the video in a standalone program that uses XV. For those of you with working kit, I created a demonstration video that simulates a bad conversion:
Sometimes it’s possible to see the pattern very faintly due to rounding in even a correct conversion. This is unavoidable because the RGB->YCbCr->RGB round trip is lossy.
Both videos only show completely green here
Do I need a recent Theora decoder for this?
No, these are pretty typical Ogg/Theora videos.
The first video does indeed appear to have a checkerboard pattern in the white and red sections, in Firefox 3.5. Possibly the rounding error you mentioned, though it seems fairly pronounced.
Thanks for providing these samples, very useful. Could you say something about gamut-theora-bt709.ogv? As far as I can tell it’s not in a different colorspace, but converting it to PNG (through ffmpegcolorspace) still shows a checkerboard pattern.
Ah, that would be http://en.wikipedia.org/wiki/Rec._709 which has a slightly different gamut. It seems Theora header can only represent BT.470, so it’s no surprise the results are off. http://www.theora.org/doc/libtheora-1.1/codec_8h.html#a4ce7a695ce353b1582d29b6c1ddf31a0
Philip: The bt709 video is for checking if applications/drivers are actually using the BT.709 matrix instead of BT.470 matrix. Of course, it would be displayed with a visible pattern if the entire display path was honoring the color information in the video, but most don’t.
[...] information related to your search David Schleef: YCbCr Gamut Checking is now available in this link…: News [...]
It would be really handy to have 4:2:2 and 4:4:4 versions of these test clips because in some applications the different subsampling rates trigger entirely distinct code paths.
It would also be interesting to have a set of 4:2:0 test cases that sweep offset and make sure the correct chroma row and column are being selected. I expect many applications would fail this when offset x or y is odd.