Acid_Reign
5th March 2010, 22:55
I have a camera, the Panasonic HDC-SD9, that locks in to shooting in the xvYCC colorspace when in 24p mode—now normally I’m all for wider gamuts, but this will only display on “Digital Cinema Color” (Panny's name for xvYCC color) devices, which means that until it achieves widespread market penetration, it’s functionally useless. I can get standard YV12 out of 60i mode, but I don’t want 60i, so I’m stuck with it. As a result, whenever I’m editing my videos, I notice a significant decrease in color fidelity; it is not nearly as vibrant as it was on the camcorder’s inbuilt LCD.
As you may know, xvYCC extends the standard YCbCr gamut by using a color value range of 0–255 rather than 16–235 (Specifically, it uses negative RGB, such that Y is -15/219 to +238/219 [-0.068493 to +1.086758], and CbCr is -15/224 to +238/224 [-0.066964 to +1.062500]*). So if you were to feed raw xvYCC data to a regular YV12 device there’s no guarantee that it would faithfully reproduce the colors.**
But since xvYCC data starts with valid 16–235 values, camera manufacturers are able to maintain backward-compatibility through a proprietary extension to AVC via the HDMI 1.3 spec called “Gamut Boundary Description” (GBD) metadata* that instructs compliant devices to utilize the extra color information, but is ignored by everything else.
I want to overcome this ignorance by extracting the full range values from that metadata and intelligently mapping them to YV12 limited range with a colorspace conversion filter in AviSynth. Devices like PS3 that understand xvYCC but aren’t always hooked up to xvYCC TVs must already do this conversion internally, because whenever I watch my footage through that, I’ve got the same vividness I see on the camera LCD, even though my HDTV is 5 years old, connected through component cables, and set to “Normal” color settings.
The only problem is I can’t find any kind of documentation about HDMI GBD metadata, or how it is specifically encoded in AVCHD.
However I was able to find out (from this guy burkhard’s blog (http://hirntier.blogspot.com), which is really good) that AVC metadata is stored in SEI (Supplemental Enhancement Information) messages, and AVCHD uses “type 5” SEIs, meaning “user data unregistered”—i.e., proprietary extensions.
I asked him if he could help out, and after analyzing an MTS file (http://www.nospoon.tv/test/avchd/00001.MTS) (44.8 MiB) I put up, he came up with this:
But there is another SEI type 5 message:
GUID:
a7 46 02 bb f8 a1 4c c0 a9 36 48 e3 91 dc e7 61
Then 4 bytes "CLID"
Then 12 bytes:
92 9b 52 f4 8d 72 96 8c c2 92 00 00
This could be where the color information is stored.
But I have no idea what these bytes are supposed to mean. Any ideas? Maybe someone with a copy of the HDMI spec? If we can figure this out, we can start doing something with the extended-gamut colors that our cameras are recording today, rather than waiting years for the world to upgrade and making us remaster all our old videos again just so that they can look the way they were supposed to in the first place.
Thanks.
* I got this information from Video Demystified, p.26; see: Google Books (http://books.google.com/books?id=BtCOgrpzbz4C&lpg=PA26&ots=W7OWmMbOZz&dq=converting%20color%20spaces%20xvycc&pg=PA26#v=onepage&q=xvycc&f=false).
** There was a discussion about this on AVS Forum. I found this post (http://www.avsforum.com/avs-vb/showpost.php?p=17040904&postcount=11) on there particularly informative, but the poster gets one small detail wrong, in that there is a “‘super-colour’ extension”, and that is GBD.
As you may know, xvYCC extends the standard YCbCr gamut by using a color value range of 0–255 rather than 16–235 (Specifically, it uses negative RGB, such that Y is -15/219 to +238/219 [-0.068493 to +1.086758], and CbCr is -15/224 to +238/224 [-0.066964 to +1.062500]*). So if you were to feed raw xvYCC data to a regular YV12 device there’s no guarantee that it would faithfully reproduce the colors.**
But since xvYCC data starts with valid 16–235 values, camera manufacturers are able to maintain backward-compatibility through a proprietary extension to AVC via the HDMI 1.3 spec called “Gamut Boundary Description” (GBD) metadata* that instructs compliant devices to utilize the extra color information, but is ignored by everything else.
I want to overcome this ignorance by extracting the full range values from that metadata and intelligently mapping them to YV12 limited range with a colorspace conversion filter in AviSynth. Devices like PS3 that understand xvYCC but aren’t always hooked up to xvYCC TVs must already do this conversion internally, because whenever I watch my footage through that, I’ve got the same vividness I see on the camera LCD, even though my HDTV is 5 years old, connected through component cables, and set to “Normal” color settings.
The only problem is I can’t find any kind of documentation about HDMI GBD metadata, or how it is specifically encoded in AVCHD.
However I was able to find out (from this guy burkhard’s blog (http://hirntier.blogspot.com), which is really good) that AVC metadata is stored in SEI (Supplemental Enhancement Information) messages, and AVCHD uses “type 5” SEIs, meaning “user data unregistered”—i.e., proprietary extensions.
I asked him if he could help out, and after analyzing an MTS file (http://www.nospoon.tv/test/avchd/00001.MTS) (44.8 MiB) I put up, he came up with this:
But there is another SEI type 5 message:
GUID:
a7 46 02 bb f8 a1 4c c0 a9 36 48 e3 91 dc e7 61
Then 4 bytes "CLID"
Then 12 bytes:
92 9b 52 f4 8d 72 96 8c c2 92 00 00
This could be where the color information is stored.
But I have no idea what these bytes are supposed to mean. Any ideas? Maybe someone with a copy of the HDMI spec? If we can figure this out, we can start doing something with the extended-gamut colors that our cameras are recording today, rather than waiting years for the world to upgrade and making us remaster all our old videos again just so that they can look the way they were supposed to in the first place.
Thanks.
* I got this information from Video Demystified, p.26; see: Google Books (http://books.google.com/books?id=BtCOgrpzbz4C&lpg=PA26&ots=W7OWmMbOZz&dq=converting%20color%20spaces%20xvycc&pg=PA26#v=onepage&q=xvycc&f=false).
** There was a discussion about this on AVS Forum. I found this post (http://www.avsforum.com/avs-vb/showpost.php?p=17040904&postcount=11) on there particularly informative, but the poster gets one small detail wrong, in that there is a “‘super-colour’ extension”, and that is GBD.