View Single Post
Old 17th April 2020, 13:23   #6  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by wswartzendruber View Post
My motivation was that I wanted to rip my 4K UltraHD library, but wanted to do so in a viewing format that is as universal as possible, even if that entails some amount of compromise. I quickly settled on HLG after reading about it, but couldn't find a conversion utility to do this. I learned that ffmpeg supports the use of lookup tables, but couldn't find any such thing for cheaper than a couple hundred dollars. Others were available from the BBC under license.
Oh, really...? *coff coff* Link *coff coff*

By the way, the fact that people were charging a lot of money for those matrices of linear transformation is exactly what made me want to share them for free...
Of course, as I always said, the ones made by AVID, BlackMagic, BBC and so on have had a lot of engineers working on them, while I made mine together with my boss in a studio room and they have been tested against a single professional monitor by Sony and not a wide range of them, but still...

Quote:
Originally Posted by wswartzendruber View Post
All in all, I got quite fed up with the situation and started researching PQ, HLG, metadata, gamma curves, etc. until I got nauseated and started work. Then I studied some more and then went back to coding. Wash, rinse, and repeat a few times. I'm at the point where I'm comfortable with releasing my work to the public. Principally, it uses, to the best of my understanding, the algorithm published by BBC Research & Development.
Yep, starting with the BBC Whitepaper is always a good starting point as it basically explains how the conversion should be done.


Quote:
Originally Posted by wswartzendruber View Post
This is also the first thing I've written in Rust, so it's probably not going to be as idiomatic or as proper as it could be.
I don't actually know rust as programming language as I never studied it, but still hats off for researching and implementing your own converter.

Quote:
Originally Posted by Blue_MiSfit View Post
Fun project!

Here's one thing I've been trying to wrap my mind around regarding HLG: I get that one of the big appeals is "backwards compatibility", and I totally see how, from an EOTF standpoint it's somewhat backwards compatible with SDR. In other words, you could feed an HLG signal to a dumb SDR display and the luminance would look mostly correct.
Correct.

Quote:
Originally Posted by Blue_MiSfit View Post
However, I don't understand how (without some other component) it can be backwards compatible from a color gamut standpoint.
In fact, it isn't.

Quote:
Originally Posted by Blue_MiSfit View Post
If you're doing HLG with Rec2020 or P3, from what I understand that will NOT look correct on a non wide-gamut display. Gamut conversion is not trivial.

So... how does that work?
It's not converted. Let me clarify that.
The whole reason why we want to air with HLG, as broadcasters, is that we wanna have both HDR and SDR on the same channel, BUT (and here's the catch) most people tend to think that when we say "SDR" we're actually referring to Linear BT709 100 nits, but we are not.

When we air a 4K UHD stream via satellite it has two things mainly: the colormatrix and the color curve.
If you have a new 4K UHD TV, it's gonna read the stream, understand the BT2020nc, understand the HLG curve and display the color curve correctly, thus showing you the right amount of nits (up to 1000) that the content has. You're definitely watching an HDR content.
If you have an old 4K UHD TV, however, when it's gonna read the stream, it's gonna correctly interpret the BT2020nc, but it's just gonna ignore any information relative to the color curve, thus displaying the content as BT2020nc SDR 100 nits. The more a content is graded towards HDR, the worse it's gonna look on BT2020nc SDR panels, the more is graded towards SDR, the less you're gonna have dynamic range on HDR monitors, hence the compromise and the 1000 nits limit.
For quite some time I had to grade live sports events to 400 nits maximum 'cause many people didn't have HDR panels at the very beginning.

For the records, the reason why you can't do that with something like PQ is that if you ignore the color curve information on a PQ stream, then everything is gonna look very dull, as PQ is a proper logarithmic curve, while HLG is indeed Hybrid and compromises details in the shadows to make it SDR compatible but still has room for the peak brightness to be way higher than 100 nits.

Out of curiosity, this is how you're gonna see the very same HDR HLG signal on two different monitors: one BT2020nc SDR which ignores the color curve and the other that reads and interprets the color curve:




As you can clearly see, it's a compromise and it's never gonna look exactly as we intended it to look, which is something that kinda pisses us all off (broadcast encoders), but hey, we barely have the bandwidth to have 25 Mbit/s H.265 on all our 4K channels, so it would be madness to have two 4K channels for everything...

Last edited by FranceBB; 17th April 2020 at 13:30.
FranceBB is offline   Reply With Quote