Log in

View Full Version : Finding and Decoding xvYCC HDMI metadata in AVCHD


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.

Yellow_
6th December 2010, 14:53
This thread discusses Gamut conversion. i too am interested in xvYCC.

http://forum.doom9.org/showthread.php?p=1460687#post1460687

zcream
25th September 2011, 11:27
Just wondering if anyone figured out how we could use or edit with the data that comes with a xv.ycc enabled camera ?

Acid_Reign
26th September 2011, 10:08
An update on this since people keep asking about it:

I obtained the HDMI 1.3 specification but I couldn’t find the extended gamut bits anywhere in my sample file. This is probably because HDMI is a transport protocol, not a storage format (duh), so that data is just added to the video signal by the transmitting device while being sent over the wire so that the receiver knows what to do with it. Unfortunately, there is no information about the actual gamut data itself; it only references other standards since this stuff is all patented and the engineers are assumed to have a copy already if that tech relates to their specific product.

So, I now believe the answer lies in the AVCHD spec, which I currently lack. If anybody knows anything, I’m still very interested.