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 > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st November 2024, 08:32   #1  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Sdr -> hdr?

Topaz Video AI is currently doing (or attempting to do) SDR -> HDR. I know Donald A. Graft (from DGDecNV), made an HDR2SDR tool once. Has anyone tried the reverse yet, from SDR -> HDR? Would make for a very interesting tool.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 1st November 2024, 22:42   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,100
I don't really understand what all the hype around AI is for.
Instead of having a non deterministic output generated by some kind of artificial stupidity (got the joke?) I would rather have the SDR to HDR conversion done in a precise, deterministic, reliable way, which is how everyone has been doing it for years now.
Not to quote myself, but here https://forum.doom9.org/showthread.php?t=176091 you can find the LUTs I made free and open source for everyone and among those you're gonna find the options to go from BT709 to both BT2020 HLG HDR and BT2020 PQ HDR. You can do that either by using the LinearTransformation() function I wrote like this:

Quote:
#BT709 SDR to BT2020 HLG HDR 400 nits
LinearTransformation(Input="Linear_BT709", Output="BT2020_HLG")
Quote:
#BT709 SDR to BT2020 PQ HDR 400 nits
LinearTransformation(Input="Linear_BT709", Output="BT2100_PQ")
or by using Cube() and pointing to the .cube yourself like this:

Quote:
#BT709 SDR to BT2020 HLG HDR 400 nits
ConvertBits(16)
ConvertToPlanarRGB()
Cube("C:\Programmi\AviSynth+\LUTs\BT709_to_HLG.cube")
Converttoyuv420()
Quote:
#BT709 SDR to BT2020 PQ HDR 400 nits
ConvertBits(16)
ConvertToPlanarRGB()
Cube("C:\Programmi\AviSynth+\LUTs\BT709_to_PQ.cube")
Converttoyuv420()
This is a BT709 SDR FULL HD source upscaled to UHD and converted to BT2020 PQ using the method mentioned above (the graph is produced by VideoTek in Avisynth https://forum.doom9.org/showthread.php?p=1832846):



The advantage of having the LUTs available is that you can use them directly in other software as well, like another frameserver instead of Avisynth (i.e VapourSynth if you want), or FFmpeg or even inside your own preferred NLE like AVID Media Composer, Adobe Premiere, Davinci Resolve etc.

If you wanna use something different and stay within Avisynth, there's also avsresize that can perform the same kind of conversion, albeit in a different way.

Quote:
#BT709 SDR to HDR HLG
z_ConvertFormat(pixel_type="YUV422P16", colorspace_op="709:709:709:limited=>2020ncl:std-b67:2020:limited", resample_filter_uv="spline64", dither_type="error_diffusion")
Quote:
#BT709 SDR to HDR PQ
z_ConvertFormat(pixel_type="YUV422P16", colorspace_op="709:709:709:limited=>2020:st2084:2020:limited", resample_filter_uv="spline64", dither_type="error_diffusion")
however I tend to prefer my own implementation (but hey, I'm biased, obviously eheheheheh).

The reason behind this is simple: use legacy SDR footage when you're editing new HDR one. For instance, suppose you're shooting a documentary and you have a bunch of interviews that were shot in UHD HLG with a Sony A7 IV in HLG and then you have a bunch of legacy FULL HD BT709 footage that you need to add about the person you're interviewing, then you would upscale them and convert them to BT2020 HLG so that you can use them within the same timeline to create the final output file. Sure, those legacy footage will be "fake" HDR, but at least you're gonna be able to use them.

Last edited by FranceBB; 1st November 2024 at 22:45.
FranceBB is offline   Reply With Quote
Old 2nd November 2024, 00:13   #3  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by FranceBB View Post
I don't really understand what all the hype around AI is for.
Instead of having a non deterministic output generated by some kind of artificial stupidity (got the joke?) I would rather have the SDR to HDR conversion done in a precise, deterministic, reliable way, which is how everyone has been doing it for years now.
Not to quote myself, but here https://forum.doom9.org/showthread.php?t=176091 you can find the LUTs I made free and open source for everyone and among those you're gonna find the options to go from BT709 to both BT2020 HLG HDR and BT2020 PQ HDR. You can do that either by using the LinearTransformation() function I wrote like this:.
Brother, this is pure gold you provided here! I will start using this.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 2nd November 2024, 04:24   #4  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 180
One advantage of using zimg: you can specify the "nomial luminance" of you sdr clip to any valid value you want
Z2697 is offline   Reply With Quote
Old 2nd November 2024, 13:21   #5  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by FranceBB View Post
Instead of having a non deterministic output generated by some kind of artificial stupidity (got the joke?) I would rather have the SDR to HDR conversion done in a precise, deterministic, reliable way, which is how everyone has been doing it for years now
For the record, Topaz Video Ai is not using A.i. for SDR2HDR, but for upscaling rather. Their attempts at SDR2HDR is just the latest bandwagon they jumped on, as an added bonus.

Quote:
The advantage of having the LUTs available is that you can use them directly in other software as well, like another frameserver instead of Avisynth (i.e VapourSynth if you want), or FFmpeg or even inside your own preferred
Yeah, I think I'm going to try this is VapourSynth first, as my AviSynth is rather old (but 64-bit nonetheless).
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 2nd November 2024, 13:55   #6  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 180
Then that's typically more stupid than artificial stupidity
The common situation of these "AI" video software companies is they know basically nothing about "real" video technologies, they just use neuro net as like cyber fortune teller and the rest is let's f*ckin YOLO it.
Remember the time topaz used mpeg4 (not part 10!) to output video? (for quite a few major versions) I remember.

Last edited by Z2697; 2nd November 2024 at 18:42. Reason: typo
Z2697 is offline   Reply With Quote
Old 2nd November 2024, 14:27   #7  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,519
Quote:
Originally Posted by Z2697 View Post
Then that's typically more stupid than artificial stupidity
The common situation of these "AI" video software companies is they know basically nothing about "real" video technonoly, they just use neuro net as like cyber fortune teller and the rest is let's f*ckin YOLO it.
Remember the time topaz used mpeg4 (not part 10!) to output video? (for quite a few major versions) I remember.
Well I don't think that. DLSS for Nvidia or FSR for AMD produce really good results.

Never forget that these technology don't upresize 2D matrice to 2D matrice but 3D matrice to 3D matrice with vector reconstruction and prediction (AI is for that).
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9
Sagittaire is offline   Reply With Quote
Old 2nd November 2024, 15:50   #8  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 180
Quote:
Originally Posted by Sagittaire View Post
Well I don't think that. DLSS for Nvidia or FSR for AMD produce really good results.

Never forget that these technology don't upresize 2D matrice to 2D matrice but 3D matrice to 3D matrice with vector reconstruction and prediction (AI is for that).
Well first of all I think they are chip company not "AI video software company".
Secondly I don't mean that the result of AI is bad, I mean the rest part is bad.
Finally DLSS and FSR are not for video (the early pure spatial version may be "useable" but far from good), I think them as "advanced TAA" with smart temporal reference technique powered by AI or hand tuned algorithm.
Z2697 is offline   Reply With Quote
Old 2nd November 2024, 18:49   #9  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by Z2697 View Post
Then that's typically more stupid than artificial stupidity
The common situation of these "AI" video software companies is they know basically nothing about "real" video technonoly, they just use neuro net as like cyber fortune teller and the rest is let's f*ckin YOLO it.
Remember the time topaz used mpeg4 (not part 10!) to output video? (for quite a few major versions) I remember.
Sadly, I have to agree. These companies should be forbidden to use the term "A.i." Nothing about it uses intelligence (real or otherwise). A violin player with a bow glued to her face, that's not 'I' in any universe. It's all neural net learning, sans true understanding of the real world. It's, at the end of the day, just statistics. Now, all A.i uses statistics, but not all statistics are A.i.

But we digress.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 2nd November 2024, 19:16   #10  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,519
Quote:
Originally Posted by asarian View Post
Sadly, I have to agree. These companies should be forbidden to use the term "A.i." Nothing about it uses intelligence (real or otherwise). A violin player with a bow glued to her face, that's not 'I' in any universe. It's all neural net learning, sans true understanding of the real world. It's, at the end of the day, just statistics. Now, all A.i uses statistics, but not all statistics are A.i.

But we digress.
Well ChatGPT is just prediction with databases to use good words near initial words. And that work very well.

AI for video is just a prediction to choose the good pixel near other pixel with databases. And that work very well for video too.
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9
Sagittaire is offline   Reply With Quote
Old 2nd November 2024, 19:36   #11  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by Sagittaire View Post
Well ChatGPT is just prediction with databases to use good words near initial words. And that work very well.

AI for video is just a prediction to choose the good pixel near other pixel with databases. And that work very well for video too.
It works well for grass and such; for (far-away) faces with things in front of them, not so much.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 3rd November 2024, 16:01   #12  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by FranceBB View Post
LinearTransformation(Input="Linear_BT709", Output="BT2020_HLG")

So, dumb question no doubt, but how can I use in VapourSynth?

I tried

Code:
 core.avs.LoadPlugin ("C:/VS/plugins/LinearTransformation/LinearTransformation.avsi")
That gives me all kinds of errors.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 3rd November 2024, 17:08   #13  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,100
For VapourSynth you have to check the instructions here: https://forum.doom9.org/showthread.php?t=173361
The plugin you need is vscube which is here: https://github.com/sekrit-twc/timecube

I would write an example script, but I don't personally use VapourSynth, so I wouldn't be able to test it or verify if it works or not. In that thread, though, plenty of people have been able to use the .cube files via vscube, so hopefully you're gonna find your answer there. I'm sure there are plenty of people who know how to use VapourSynth who are better placed to help you than me.

All you need to do is to go to RGBPS and then use the cube function to point to either BT709_to_HLG.cube or BT709_to_PQ.cube according to whether you wanna go to HDR HLG or HDR PQ.
FranceBB is offline   Reply With Quote
Old 3rd November 2024, 17:14   #14  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by FranceBB View Post
For VapourSynth you have to check the instructions here: https://forum.doom9.org/showthread.php?t=173361
The plugin you need is vscube which is here: https://github.com/sekrit-twc/timecube

I would write an example script, but I don't personally use VapourSynth, so I wouldn't be able to test it or verify if it works or not. In that thread, though, plenty of people have been able to use the .cube files via vscube, so hopefully you're gonna find your answer there. I'm sure there are plenty of people who know how to use VapourSynth who are better placed to help you than me.
Again, thank you kindly!

I reinstalled a new AviSynth+ (as mine has really old), tried

"LinearTransformation(Input="Linear_BT709", Output="BT2100_PQ")

But it gave me a script error:

Code:
Cube does not have a named argument 'interp'
But let me use VapourSynth again first.


EDIT: Just want to let you know, I got the vapoursyth version to work! Again, thank you!
__________________
Gorgeous, delicious, deculture!

Last edited by asarian; 3rd November 2024 at 17:44. Reason: Update
asarian is offline   Reply With Quote
Old 3rd November 2024, 20:35   #15  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,100
Quote:
Originally Posted by asarian View Post
Code:
Cube does not have a named argument 'interp'
by default I use interp=1 which is tetrahedral interpolation.
I wrote a paragraph in the AVS Cube section about Trilinear vs Tetrahedral interpolation and why the latter is better: http://avisynth.nl/index.php/AVSCube
Anyway, the "interp" parameter was added later in version 1.4 of Cube so if you update your version with the one you find in the wiki download link you're gonna be able to run it in Avisynth as well.

Quote:
Originally Posted by asarian View Post
Just want to let you know, I got the vapoursyth version to work! Again, thank you!
Great. Happy to hear that
FranceBB is offline   Reply With Quote
Old 4th November 2024, 02:20   #16  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by FranceBB View Post
by default I use interp=1 which is tetrahedral interpolation.
I wrote a paragraph in the AVS Cube section about Trilinear vs Tetrahedral interpolation and why the latter is better: http://avisynth.nl/index.php/AVSCube
Anyway, the "interp" parameter was added later in version 1.4 of Cube so if you update your version with the one you find in the wiki download link you're gonna be able to run it in Avisynth as well.

Great. Happy to hear that
Got it. Updated to v1.4 (on the wiki), which conveniently is a backported vscube from VapourSynth, and now it even works in AviSynth.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 4th November 2024, 05:09   #17  |  Link
Leo 69
Registered User
 
Join Date: Nov 2004
Posts: 236
In the latest Davinci Resolve Studio 19 you can do SDR to HDR conversion using RTX HDR.
Leo 69 is offline   Reply With Quote
Old 4th November 2024, 05:25   #18  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by Leo 69 View Post
In the latest Davinci Resolve Studio 19 you can do SDR to HDR conversion using RTX HDR.
I don't have thousand of dollars available for professional software like that. Instead I rely in the generosity of people like FranceBB, to make these LUTs available for free!
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 4th November 2024, 05:56   #19  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 180
If I'm not somehow creating false memories myself, there's method(s) to use "RTX HDR" in open source tools, don't need professional software.
However you do need a RTX card (maybe even a newer one 30- or 40-, I'm not sure), and "RTX HDR" uses "AI" and the result is, well let's say I don't appreciate that.
I'd even consider its addition to a professional software a questionable choice. It's not professional at all IMO. It may impress to the eyes at first glance but something's off if you look more closely.
Z2697 is offline   Reply With Quote
Old 4th November 2024, 09:22   #20  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,531
Quote:
Originally Posted by Z2697 View Post
If I'm not somehow creating false memories myself, there's method(s) to use "RTX HDR" in open source tools, don't need professional software.
However you do need a RTX card (maybe even a newer one 30- or 40-, I'm not sure), and "RTX HDR" uses "AI" and the result is, well let's say I don't appreciate that.
I'd even consider its addition to a professional software a questionable choice. It's not professional at all IMO. It may impress to the eyes at first glance but something's off if you look more closely.
I have an RTX 4090, so I'm good on that front.

As for A.i, yeah, I already made my position on that clear in this thread. In fact, I truly rather rely in people like FranceBB, who possess the mathematical wherewithal to actually know what they're doing. The best stuff (like x265 et al.) still comes from this forum (and I've been a member since 2005),
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Reply

Tags
hdr, sdr

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:10.


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