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 > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th August 2018, 14:00   #1  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Vapoursynth tonemap

I'm implementing the '"standard" tonemap functions, using vapoursynth tonemap for the formula.

Reinhard has an exposure parameter, but i don't see it in the formula. Is it normal
__________________
My github.
jpsdr is offline   Reply With Quote
Old 8th August 2018, 14:51   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
https://github.com/ifb/vapoursynth-tonemap#reinhard
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 8th August 2018, 15:05   #3  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Yes, but in the code (file tonemap.c), the exposure parameter is not used in the formula.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 8th August 2018, 15:10   #4  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Yeah, look here
https://github.com/ifb/vapoursynth-tonemap/issues/4
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 8th August 2018, 16:13   #5  |  Link
ifb
Registered User
 
Join Date: Dec 2009
Posts: 72
Quote:
Originally Posted by ChaosKing View Post
Patches welcome. I don't actually use Reinhard so motivation is low. I should have some time to look at this week, though.
ifb is offline   Reply With Quote
Old 8th August 2018, 18:20   #6  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
In fact, what i wanted to know is the correct formula (if there is such a thing) using exposure.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 8th August 2018, 20:26   #7  |  Link
ifb
Registered User
 
Join Date: Dec 2009
Posts: 72
I don't know that there is a correct formula. Exposure isn't present in vf_tonemap.c, but Reinhard's paper does talk about applying an initial gain to the image.

I kinda feel like it's a hack that shouldn't be needed. It adds yet another setting to tweak, but I guess it's helpful?

I don't use Reinhard or any of the others much except for testing. I've ended up just using a 3D LUT.
ifb is offline   Reply With Quote
Old 9th August 2018, 15:05   #8  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
A 3D LUT is still sane on 8 bits, but with 10 or 12 bits...
__________________
My github.
jpsdr is offline   Reply With Quote
Old 10th August 2018, 06:21   #9  |  Link
ifb
Registered User
 
Join Date: Dec 2009
Posts: 72
The new release on Github has working Reinhard exposure now.

Quote:
Originally Posted by jpsdr View Post
A 3D LUT is still sane on 8 bits, but with 10 or 12 bits...
A 33-point LUT is faster for me (Skylake i5-6200U). Source is 1080p XAVC Intra 100.

Code:
source       210.25 YUV422P10
source->RGBS 130.05
3D LUT        63.44 RGBS
3D LUT        61.24 RGB48
3D LUT        61.44 RGB30
3D LUT        63.26 RGB24
Hable         57.04
Mobius        58.11
Reinhard      59.21
ifb is offline   Reply With Quote
Old 10th August 2018, 08:44   #10  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
What do you call a 33-point LUT ? If input is 10 bits, the 3D LUT requires at least [1024x1024x1024]x2 (x3) => 6GB of memory ! (for 16 bits data output, x2 for RGPS data output).
__________________
My github.
jpsdr is offline   Reply With Quote
Old 10th August 2018, 13:26   #11  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
3D LUTs are subsampled and output values are interpolated from the available input points. See here:

https://www.lightillusion.com/luts.html
videoh is offline   Reply With Quote
Old 10th August 2018, 14:47   #12  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Ah... Ok.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 10th August 2018, 14:59   #13  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
The theoretical performance benefit of using a 3D LUT versus implementing the underlying math is reduced by the need for accurate interpolation. In DGHDRtoSDR performance is achieved with CUDA parallelism, so I don't need to bother with 3D LUTs. madVR supports both modes (3D LUTs and "pixel shader math").
videoh is offline   Reply With Quote
Old 10th August 2018, 17:24   #14  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
Out of curiosity, (as i've absolutely no idea) what is the average parallelism level with CUDA ? Are we talking of things about 16/32, or are we more talking of things about 64/128/256 ?
I think it's probably defined by the GPU model, and can change according GPU, but with a standard actual card ?
__________________
My github.
jpsdr is offline   Reply With Quote
Old 10th August 2018, 18:13   #15  |  Link
ifb
Registered User
 
Join Date: Dec 2009
Posts: 72
Quote:
Originally Posted by videoh View Post
The theoretical performance benefit of using a 3D LUT versus implementing the underlying math is reduced by the need for accurate interpolation. In DGHDRtoSDR performance is achieved with CUDA parallelism, so I don't need to bother with 3D LUTs. madVR supports both modes (3D LUTs and "pixel shader math").
For my use case, it's not even about performance. If the "pure" math approach could achieve the same results as the LUT, I would use it if only to avoid the .cube file dependency. As it is, I didn't create the LUT and I don't need/want to tweak a multi-step filter chain to try and match it right now.
ifb is offline   Reply With Quote
Old 10th August 2018, 18:38   #16  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
For technical conversions for luminance curves and gamut it does not make any sense to use a LUT much better to use a formula.
And those conversions are not very performance heavy.
Cary Knoop is offline   Reply With Quote
Old 10th August 2018, 19:56   #17  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by jpsdr View Post
Out of curiosity, (as i've absolutely no idea) what is the average parallelism level with CUDA ? Are we talking of things about 16/32, or are we more talking of things about 64/128/256 ?
I think it's probably defined by the GPU model, and can change according GPU, but with a standard actual card ?
It's more like multiple thousands. My 1080 Ti has 3584 CUDA cores. With well-designed code occupancy can reach 100% but is typically closer to 75%.
videoh is offline   Reply With Quote
Old 10th August 2018, 19:59   #18  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by Cary Knoop View Post
And those conversions are not very performance heavy.
Nonsense.
videoh is offline   Reply With Quote
Old 10th August 2018, 20:11   #19  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by videoh View Post
Nonsense.
It's a simple mathematical formula that won't significantly toll any decent GPU.

Out of curiosity what kind of operation would you not call performance heavy?

I would call performance heavy operations that need neighboring pixels or comparing values from prior or next frames, not single pixel/channel operations.
Cary Knoop is offline   Reply With Quote
Old 10th August 2018, 20:45   #20  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
3D LUTs are used for all kinds of transforms, e.g., full HDR to SDR, which is the context of this thread. If you think the following process is not intensive, then I'll leave you to your own world:

Convert YCbCr to normalized float RGB.
Convert to linear float RGB (undo 2084).
Convert to a perceptually uniform color space.
Tonemap.
Perform gamut mapping using one of many different designs.
Convert back to linear float RGB.
Apply SDR gamma curve.
Convert back to YCbCr for output.

Tonemapping is one small piece of the puzzle.

The point of a LUT is that you can perform this process for each color value and store the results for lookup.

Last edited by videoh; 10th August 2018 at 20:50.
videoh 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 23:14.


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