Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th February 2024, 20:44   #421  |  Link
ErazorTT
Registered User
 
Join Date: Mar 2003
Location: Germany
Posts: 209
@wswartzendruber, yeah sorry I was all over the place with my thoughts.

In the meantime I have sorted my thoughts and came to the following conclusion: Having one LUT for the process of tonemapping the PQ down to 1000 nits AND converting to HLG is proably not the most optimal way of doing it.
The main argument here is that all the different maxcll and lumascales are part of the tonemapping, which can be done with a 1D-LUT (one for each combination of maxcll and lumascale) while the conversion to HLG can be done with a static 3D-LUT, which absolutely never changes.
Since that 1D-LUT can be generated extremenly fast for each combination of maxcll and lumascale, this opens the possibility for dynamic tonemapping.

So I went and implemented exactly that in DoViBaker. It now provides the possibility to have dynamic tonemapping, based on a 1D-LUT generated in memory on the fly. And then on top of that the user can apply the conversion to HLG with a static 3D-LUT. Of course there is also the possibility to have static tonemapping in case the input is just PQ without DolbyVision.

I think that this is an impoved workflow since on top of the addition of dynamic tonemapping, I can also circument the issue with the maximal output brightness of the HLG conversion, by allowing the intermediate output after the tonemapping to be scaled such that it fills the whole singal range. The then adjusted HLG conversion 3D-LUT uses the whole input range, which solves that problem. And also that adjusted 3D-LUT can be much smaller since now all LUT-points are used, and not only those below maxcll.
So instead of having a 65x65x65 LUT where only the lower 50x50x50 points are used, I can now directly use an adjusted 50x50x50 LUT, which has the same fidelity as the usual 65x65x65 LUT but now also hits the absolute max output brightness perfectly, while being less than half the file size (and CPU cache size).

Last edited by ErazorTT; 19th February 2024 at 21:10.
ErazorTT is offline   Reply With Quote
Old 20th February 2024, 00:25   #422  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 406
hlg-tools inherently can't handle dynamic metedata because it generates static LUTs. If something else comes along and is a better way to do things, that won't bother me none.
wswartzendruber is offline   Reply With Quote
Old 20th February 2024, 15:27   #423  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Quote:
Originally Posted by ErazorTT View Post
@wswartzendruber, yeah sorry I was all over the place with my thoughts.

In the meantime I have sorted my thoughts and came to the following conclusion: Having one LUT for the process of tonemapping the PQ down to 1000 nits AND converting to HLG is proably not the most optimal way of doing it.
The main argument here is that all the different maxcll and lumascales are part of the tonemapping, which can be done with a 1D-LUT (one for each combination of maxcll and lumascale) while the conversion to HLG can be done with a static 3D-LUT, which absolutely never changes.
Since that 1D-LUT can be generated extremenly fast for each combination of maxcll and lumascale, this opens the possibility for dynamic tonemapping.
.
This is an idea behind Dolby tone mapping. It's done per shot or even per frame (eg. for live content) with some 'smoothing'.
2 pass mapping sounds like most optimal.

Last edited by kolak; 20th February 2024 at 15:30.
kolak is offline   Reply With Quote
Old 27th February 2024, 22:47   #424  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 406
I actually don't know that I'm as done with this as I thought I was...

If can I figure out how to efficiently calculate a device-dependent color space's maximum C value in OKLCH, I can quickly do gamut reduction without impacting perceptual brightness. This would let me efficiently:

1. Perform Y-based tonemapping which is not commonly done as it can produce out-of-gamut results.
2. Deal with maximum saturation on a single color channel which causes HLG to clip on that channel.
wswartzendruber is offline   Reply With Quote
Old 28th February 2024, 11:35   #425  |  Link
ErazorTT
Registered User
 
Join Date: Mar 2003
Location: Germany
Posts: 209
Quote:
Originally Posted by kolak View Post
This is an idea behind Dolby tone mapping. It's done per shot or even per frame (eg. for live content) with some 'smoothing'.
2 pass mapping sounds like most optimal.
This is exactly what DoViBaker does. If a DolbyVision substream is available it reads it and steers the tonemapping accordingly. And if no DolbyVision substream is available, the stream can be scanned which creates the necessary information which is then again used for the tonemapping.
ErazorTT is offline   Reply With Quote
Old 28th February 2024, 11:40   #426  |  Link
ErazorTT
Registered User
 
Join Date: Mar 2003
Location: Germany
Posts: 209
Quote:
Originally Posted by wswartzendruber View Post
I actually don't know that I'm as done with this as I thought I was...

If can I figure out how to efficiently calculate a device-dependent color space's maximum C value in OKLCH, I can quickly do gamut reduction without impacting perceptual brightness.
That sound interesting, however looking at https://oklch.com/ it appears to me that the numerical range of the C varialbe has a complicated functional form depeding on the other two variables (this "mountain range" on the top right of the page). How do you plan to use this for gamut reduction?

Last edited by ErazorTT; 28th February 2024 at 12:12.
ErazorTT is offline   Reply With Quote
Old 28th February 2024, 17:31   #427  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 406
Quote:
Originally Posted by ErazorTT View Post
That sound interesting, however looking at https://oklch.com/ it appears to me that the numerical range of the C varialbe has a complicated functional form depeding on the other two variables (this "mountain range" on the top right of the page). How do you plan to use this for gamut reduction?
Right now, I am using brute force to reduce C by an incredibly small amount until converting to RGB has everything in the 0.0-1.0 range. I have generated an experimental BT.2020-to-BT.709 LUT with this method and sent that off to FranceBB for evaluation.

Example Screenshot of Joker HLG

The OKLAB author mentions elsewhere a far more efficient method that I may implement. It relies on color gamut being the shape of a triangle.
wswartzendruber is offline   Reply With Quote
Old 29th February 2024, 16:00   #428  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,850
Quote:
Originally Posted by wswartzendruber View Post
Right now, I am using brute force to reduce C by an incredibly small amount until converting to RGB has everything in the 0.0-1.0 range. I have generated an experimental BT.2020-to-BT.709 LUT with this method and sent that off to FranceBB for evaluation.
Yes and I'm really really really sorry, but I'm still "having fun" with generating DolbyE 5.1 20bit big endian muxed in aiff...
Once that one is sorted, I'll take a very close look at it.
Apologies for the delay...
FranceBB is offline   Reply With Quote
Old 29th February 2024, 18:29   #429  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 406
Well, I threw the LUT your direction without speaking to you about it prior. You have every right to simply ignore it.

With that said, I am quite thankful that you are willing to review it.
wswartzendruber is offline   Reply With Quote
Old 29th February 2024, 22:37   #430  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,850
I would never do that, I consider you my friend, we even did a video call together, I would never ignore you.
Unfortunately spare time project thingies are piling up. I also still have to review a pull request by frank for videotek which is still there pending...
It's not easy when you clock in at 08.30AM and you leave your desk at 09.37PM...
FranceBB is offline   Reply With Quote
Old Yesterday, 03:32   #431  |  Link
wswartzendruber
hlg-tools Maintainer
 
wswartzendruber's Avatar
 
Join Date: Feb 2008
Posts: 406
Quote:
Originally Posted by FranceBB View Post
I would never do that, I consider you my friend, we even did a video call together, I would never ignore you.
Unfortunately spare time project thingies are piling up. I also still have to review a pull request by frank for videotek which is still there pending...
It's not easy when you clock in at 08.30AM and you leave your desk at 09.37PM...
The priority for you might be some rest and relaxation before looking at the LUT.
wswartzendruber is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.