Darker than black

05.01.2010 21:54

For some reason (which will perhaps be a topic of some other post), I've been trying to extract raw data from a video stream using GStreamer this afternoon. I got to the point where I though I understood how a raw YUV stream looks like, but I kept getting non-zero luminance values for the completely black screen produced by the videotestsrc with pattern=black.

So I went and asked a stupid question on #gstreamer if their idea of black is different than mine.

Interestingly, the answer was that digital YUV video traditionally has an 8-bit luma value scaled to the 16-235 range (i.e. 16 being black and 235 being white). Some searching around the web turned up a lot of questions and confusion about this, but no definite answer why is this a good thing.

I was told by GStreamer guys that this convention remains from analog video. There is some logic in this. YUV is the way how color analog signal is encoded and black level there is above reference 0 V (that level being used for signal synchronization). However, I'm not convinced by this explanation. If you scale analog reference voltages to 8-bits, you get a different range. And also, why would someone want to encode synchronization signals in digital video?

Wikipedia gives a little different, but also cryptic answer. It mentions this is because of MPEG standards and that this scale is convenient when doing fixed-point arithmetic with the value.

Anyone out there that can explain what was that significant benefit that justified this additional complication in digital video (as if the topic itself wasn't complicated enough)?

Posted by Tomaž | Categories: Code

Add a new comment

(No HTML tags allowed. Separate paragraphs with a blank line.)