HDR -> SDR conversion

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

HDR -> SDR conversion

Post by Guest 2 »

Rocky wrote:
Mon Jul 04, 2022 8:27 am
Can you please explain the use case and justification for this request?
AFAIK you can recover full chroma from double the required resolution, such as per post https://forum.doom9.org/showthread.php? ... ost1938846

I was asking myself if all that procedure could be ported inside some of the DGTools libraries.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

HDR -> SDR conversion

Post by Bullwinkle »

Why do you want to make 1920x1080 4:4:4 material? What players will support it?
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

HDR -> SDR conversion

Post by Guest 2 »

Bullwinkle wrote:
Mon Jul 04, 2022 6:39 pm
Why do you want to make 1920x1080 4:4:4 material? What players will support it?
Any nVidia based PC, as last 2 generations of cards support HEVC 4:4:4.

Anyway, it's not a priority. Many other things are needed first :)
DAE avatar
Dion
Posts: 28
Joined: Sun Dec 04, 2016 12:30 am

HDR -> SDR conversion

Post by Dion »

Did DGHDRtoSDR_1.15 get a different tonemap algorithm vs DGHDRtoSDR_1.14? Results seem very different.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

HDR -> SDR conversion

Post by Bullwinkle »

No change to the tonemapping. All changes are documented in the Binaries Notification thread.

* HDRtoSDR white parameter (PQ) was made nonlinear to better represent the interesting parameter range.
* HDRtoSDR white parameter (PQ) range was widened and the default is now 2000.
DAE avatar
Dion
Posts: 28
Joined: Sun Dec 04, 2016 12:30 am

HDR -> SDR conversion

Post by Dion »

Mega late reply but I found the reason. Seems the "default" values for .14 and .15 are different.. I just had to adjust .15 back to .14's default values and the results are now identical.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

HDR -> SDR conversion

Post by Guest 2 »

Dion wrote:
Thu Jul 21, 2022 11:39 pm
Did DGHDRtoSDR_1.15 get a different tonemap algorithm vs DGHDRtoSDR_1.14? Results seem very different.
It's way better to use a proper LUT and DGCube. At least for me and my results.
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

HDR -> SDR conversion

Post by hydra3333 »

OK, Looking at the new cudasynth approach, I have 3 dummy's queries:

Code: Select all

DGHDRtoSDR 1.15 by Donald A. Graft
---------------------------------
mode="pq" Source stream is HDR Perceptual Quantizer (PQ)
mode="hlg" Source stream is HDR Hybrid Log Gamma (HLG)
So, I have a samsung S22 phone with HDR+ video settings newly turned on.
I also have a PC with a 1050Ti and another with 2060 Super.

mediainfo says this of a 1 sec video:

Code: Select all

Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format/Url                               : http://www.itu.int
Commercial name                          : HEVC
Format profile                           : Main 10@L5@High
HDR format                               : SMPTE ST 2094 App 4
HDR format                               : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
HDR_Format_Commercial                    : HDR10+
HDR_Format_Version                       : 1
HDR_Format_Compatibility                 : HDR10+ Profile B
Internet media type                      : video/H265
Codec profile                            : Main 10@L5@High
Real frame rate                          : 30.000 FPS
Resolution                               : 10 bits
Colorimetry                              : 4:2:0
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Source duration                          : 00:00:01.800 (00:00:01:24)
Bit rate                                 : 105 Mb/s
Width                                    : 3840
Height                                   : 2160
Pixel aspect ratio                       : 1.000
Display aspect ratio                     : 16:9
Rotation                                 : 90.000
colour_description_present               : Yes
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 1000 cd/m2
Maximum Frame-Average Light Level        : 200 cd/m2
1. Since mediainfo Transfer characteristics = PQ, does this mean that I use resize_w=1920,resize_h=1080,h2s_enable=1,h2s_mode="pq" for the S22's videos ?
2. Will DGHDRtoSDR pick up what it needs from the metadata of the incoming clip ?
3. Will DGHDRtoSDR successfully decode this using the 1050Ti and with the 2060 Super ?

I hope to use a simple defaults-driven way to convert to 8-bit SDR downsized to 1080 and encoded into h.264 (ffmpeg/vapoursynth) for display on dumber devices.

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

HDR -> SDR conversion

Post by Rocky »

Can you give me a sample source file please?
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

HDR -> SDR conversion

Post by hydra3333 »

Sure !
In this folder
https://drive.google.com/drive/folders/ ... sp=sharing

I suspect newer Samsung phones are likely producing this as well if they have HDR+ turned on.

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

HDR -> SDR conversion

Post by Rocky »

hydra3333 wrote:
Mon Jan 29, 2024 11:56 pm
1. Since mediainfo Transfer characteristics = PQ, does this mean that I use resize_w=1920,resize_h=1080,h2s_enable=1,h2s_mode="pq" for the S22's videos ?
Yes, as long as you want to resize to HD from UHD. You'll probably have to tweak the settings for your liking.
2. Will DGHDRtoSDR pick up what it needs from the metadata of the incoming clip ?
DGHDRtoSDR is a quick-and-dirty method designed for absolute speed. You can do UHD in real time through an Avisynth script for example. As such, it does not honor (or need) any metadata and you just pick parameters that look good. It's unlikely HDR+ is going to be that relevant for cell phone video, unless you walk from a dim room into the sunlight, etc.
3. Will DGHDRtoSDR successfully decode this using the 1050Ti and with the 2060 Super ?
Sure, why wouldn't it?
I hope to use a simple defaults-driven way to convert to 8-bit SDR downsized to 1080 and encoded into h.264 (ffmpeg/vapoursynth) for display on dumber devices.
Should be fine for that. You may need to tweak white= on a per clip basis if you shoot in very different light situations. You can open a clip in DGIndexNV and play around with Video/HDR to SDR to see what you will get for various settings. It opened your test clip just fine.
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

HDR -> SDR conversion

Post by hydra3333 »

Rocky wrote:
Tue Jan 30, 2024 6:40 pm
Should be fine for that. You may need to tweak white= on a per clip basis if you shoot in very different light situations.
Cool. Thanks !
Rocky wrote:
Tue Jan 30, 2024 6:40 pm
You can open a clip in DGIndexNV and play around with Video/HDR to SDR to see what you will get for various settings. It opened your test clip just fine.
Even cooler :bravo: :salute:
Rocky wrote:
Tue Jan 30, 2024 6:40 pm
you just pick parameters that look good
OK, I guess I'll have to play with them. I'm sort of hoping the defaults are "close enough" on average for what is likely to the the use cases for a phone camera.
I really do like it here.
User avatar
Rocky
Posts: 3556
Joined: Fri Sep 06, 2019 12:57 pm

HDR -> SDR conversion

Post by Rocky »

hydra3333 wrote:
Wed Jan 31, 2024 3:19 am
I'm sort of hoping the defaults are "close enough" on average for what is likely to the the use cases for a phone camera.
They may be but it's so easy to play around with it in DGIndeNV.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

HDR -> SDR conversion

Post by Guest 2 »

Rocky wrote:
Wed Jan 31, 2024 5:13 am
They may be but it's so easy to play around with it in DGIndeNV.
I am curious. :)

Does the DGIndex preview use the same CUDA internal engine from, like, always and you never told us? :scratch: :mrgreen:
User avatar
Rocky
Posts: 3556
Joined: Fri Sep 06, 2019 12:57 pm

HDR -> SDR conversion

Post by Rocky »

Of course it uses the same engine. I may be a busy squirrel but I don't eat the same acorn twice.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

HDR -> SDR conversion

Post by Guest 2 »

Rocky wrote:
Wed Jan 31, 2024 6:28 am
Of course it uses the same engine. I may be a busy squirrel but I don't eat the same acorn twice.
Sure not to have some rascal blood? :wow:

You are a very smart squirrel. :mrgreen:
User avatar
Rocky
Posts: 3556
Joined: Fri Sep 06, 2019 12:57 pm

HDR -> SDR conversion

Post by Rocky »

Thank you. Pure-bred squirrel.
Post Reply