HDR -> SDR conversion

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR conversion

Post by admin »

Guys, I have added a 'HDR' field to the HEVC Info dialog. This will show "PQ" for HDR10, "HLG" for HLG, and is blank for SDR.

I also figured out how to properly detect HDR. There are two ways to signal it: 1) through the transfer_characteristics (16 is PQ, 18 is HLG), and 2) through SEI messages. Previously I was looking only at the presence/absence of SEI messages. Now I look at both. You have to look at both because a HLG stream can signal 709 via transfer_characteristics together with a preferred_transfer_characteristics SEI specifying HLG. This allows for backward compatibility of HLG with 709 displays. Refer to T-REC-H.Sup18-201710-I!!PDF-E.pdf for details:

https://www.itu.int/rec/T-REC-H.Sup18-201710-I

Will slipstream it after some regression testing.
User avatar
zys4416
Posts: 9
Joined: Fri Jul 29, 2011 9:04 pm

Re: HDR -> SDR conversion

Post by zys4416 »

I found the official HD version here:

https://www.youtube.com/watch?v=ih1l6wb7LhU

for these clips:

trim_187.ts at 35:03
trim_203.ts at 38:02

I can't find trim_162.ts in HD version, I think SDR ver. and HDR ver. are different editions.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR conversion

Post by admin »

Thanks but I don't know how to download youtube videos.
User avatar
Bullwinkle
Posts: 337
Joined: Thu Sep 05, 2019 6:37 pm

Re: HDR -> SDR conversion

Post by Bullwinkle »

Hello there culture lovers. Today we take a look at the modern day HLG to SDR known as The Good Stuff. Here is one fetching picture. They call me fetching. Fetching all the pixels ain't saving whoa! Ooh. Okay that is all for today next week the meaning of Randomness and Beauty.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR conversion

Post by admin »

Whee!
User avatar
zys4416
Posts: 9
Joined: Fri Jul 29, 2011 9:04 pm

Re: HDR -> SDR conversion

Post by zys4416 »

admin wrote:
Thu Sep 05, 2019 1:27 pm
Thanks but I don't know how to download youtube videos.
https://www.vidpaw.com/

or

https://www.findyoutube.net/
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Thank you, zys4416.

I have the HLG EOTF coded and apparently working. I want to compare the results to the HD versions you linked, and also to the results of some other conversion filters. If things look good, I'll implement it fully into DGHDRtoSDR (with a mode parameter for PQ or HLG) and add it to DGIndexNV as well.
User avatar
Bullwinkle
Posts: 337
Joined: Thu Sep 05, 2019 6:37 pm

Re: HDR -> SDR conversion

Post by Bullwinkle »

Sure but watch me pull a rabbit out of a hat... Ooh not what I had in mind randomness is beautiful.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Just discovered there is a BT.2100-2 while I was coding off of BT.2100-1. The HLG EOTF is a bit different in BT.2100-2 so I'll have to revise the implementation accordingly. No big deal.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

I tried both of these. Each simply brought up a player and played the stream. I could not see how to download the stream.
User avatar
zys4416
Posts: 9
Joined: Fri Jul 29, 2011 9:04 pm

Re: HDR -> SDR conversion

Post by zys4416 »

Rocky wrote:
Mon Sep 09, 2019 8:21 pm
I tried both of these. Each simply brought up a player and played the stream. I could not see how to download the stream.
Just one step, right-click on the player and select "Save video as..." :D
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Great, thank you. You are so kind.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

I've got the HLG EOTF re-coded and working. And I have DGHDRtoSDR() modified to support both PQ and HLG via a mode parameter. I'll add the HLG support to DGIndexNV and then give y'all both of them. Whee!
User avatar
hydra3333
Posts: 393
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: HDR -> SDR conversion

Post by hydra3333 »

Whoopee :)
I really do like it here.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

I've got HLG to SDR working in DGIndexNV. It's kinda nice. You can set up the HLG conversion and then just click and unclick 'Enable HDR to SDR' to see the difference between real HLG conversion and backwards compatible display. The color shifts from backwards compatible handling become very obvious.

Now I have to do code reviews, regression testing, and documentation.
User avatar
hydra3333
Posts: 393
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: HDR -> SDR conversion

Post by hydra3333 »

Nice work. Looking forward to seeing demos :salute:
I really do like it here.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Thanks. Gonna be a few days as I have to complete some coaching certification renewal training first.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Finished all my certs, concussion protocol and doping stuff was new this year. Good to go until end of 2020. :)

Back to work...
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

OK, girls and boys, I have stuff ready for your testing. I want to wait for your feedback before releasing formally. The package is here:

http://rationalqm.us/misc/hlg_test.rar

Please read the docs carefully as the parameters have changed. This was quite a non-trivial revision so your careful testing under Avisynth+ and Vapoursynth (native), as well as checking the docs, would be very helpful. Thank you and have fun. :P

Delete your INI file first and then open and close DGIndexNV! Then begin testing.
User avatar
Bullwinkle
Posts: 337
Joined: Thu Sep 05, 2019 6:37 pm

Re: HDR -> SDR conversion

Post by Bullwinkle »

Sure, sure, thanks Rocky, but why bother when UHD is useless? People call me useful. Whoo. Look at the last figure on this page and tell me I am a foolish Moose.

https://www.lightillusion.com/uhdtv.html

Also, while we're pointing out the insanity remember that HDR10 PQ (absolute brightness) requires a very controlled viewing environment, and horrors metadata. But HLG is relative and a simple control can scale things very well for different environmental brightness. Just google up some PQ versus HLG action. PQ should be sent to Siberia!

https://www.smpte.org/sites/default/fil ... andout.pdf

Finally, this may enlighten you:

https://www.youtube.com/watch?v=--PyKhohVcY
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Umm, OK.

I fixed a small bug in DGIndexNV in the test package, so please re-download and update for testing.
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Found some more bugs. Temporarily withdrawing. Standby...
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

OK, hlg_test.rar is back online so re-download and update DGIndexNV. Have at it!
User avatar
DJATOM
Posts: 176
Joined: Fri Oct 16, 2015 6:14 pm

Re: HDR -> SDR conversion

Post by DJATOM »

I've tuned Meari sample to match mpv's output (slightly brighter, but looks better for me)
Image
PC: RTX 2070 | Ryzen R9 5950X (no OC) | 64 GB RAM
Notebook: RTX 4060 | Ryzen R9 7945HX | 32 GB RAM
User avatar
Rocky
Posts: 3525
Joined: Fri Sep 06, 2019 12:57 pm

Re: HDR -> SDR conversion

Post by Rocky »

Ah, good to hear. Thank you.

You probably noticed most of the goodness for PQ is at the top end of the range for white and it is nonlinear. HLG in contrast works much better and feels linear. I'm going to try linearizing the PQ parameter range, it's a GUI issue and a functional one, because we are lacking granularity at the top end.
Post Reply