DGHDRtoSDR

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(touchup)
Line 2: Line 2:
 
{{Filter3
 
{{Filter3
 
|1={{Author/Donald Graft}}
 
|1={{Author/Donald Graft}}
|2=v1.14
+
|2=v1.15
|3=[http://rationalqm.us/hdr/DGHDRtoSDR_1.14.rar DGHDRtoSDR_1.14.rar]
+
|3=[http://rationalqm.us/hdr/DGHDRtoSDR_1.15.rar DGHDRtoSDR_1.15.rar]
 
|4=Adjustment Filters
 
|4=Adjustment Filters
 
|5=Closed source
 
|5=Closed source

Revision as of 15:39, 31 October 2021

Abstract
Author Donald Graft
Version v1.15
Download DGHDRtoSDR_1.15.rar
Category Adjustment Filters
License Closed source
Discussion Doom9 Forum

Contents

Description

This AviSynth+/VapourSynth filter converts HDR10 PQ or HLG from UHD blurays to 8-bit SDR YV12 or 10-bit SDR stored in YUV420P16. The input must be YUV420P16, e.g., from DGSource() with a HDR10 source stream.

This filter runs on both CUDA and in software mode. If you try to run in CUDA mode without an nVidia card and driver installed, you will get an error. Use the parameter impl="sw" to run in software mode.

Requirements


Syntax and Parameters

DGHDRtoSDR (clip, int "white", int "black", float "gamma", float "hue", float "r", float "g", float "b", float tm", float "roll", bool "fulldepth", string "impl", string "mode")


clip   =
Input clip; must be YUV420P16 colospace.


int  white = 400
This is an integer (with arbitrary scale) that controls the overall brightness of the output. Higher values increase the resulting output brightness.
For mode="pq", the valid range for white is 1-2000. For mode="hlg", the valid range is 1-10000.


int  black = 0
This is an integer (with arbitrary scale) that controls the black level of the output. Higher values increase the resulting black level.
This parameter is relevant only for mode="hlg". The valid range is 0-1000.


float  gamma = 0.42
Final gamma for the output. The default is 0.42, standard for Rec.709.


float  hue = 0.0
Hue adjustment used to correct hue shift. Values above 0.0 shift toward red. Values below 0.0 shift toward green. The default value is 0.0.


float  r = 1.0
Saturation adjustment used to desaturate or resaturate red in the output. Do not overdo it; 0.5 to 1.5 is probably the most you can get away with without ruining colors.
Values below 1.0 reduce saturation and values above 1.0 increase saturation. The default is 1.0.


float  g = 1.0
Saturation adjustment used to desaturate or resaturate green in the output. Do not overdo it; 0.5 to 1.5 is probably the most you can get away with without ruining colors.
Values below 1.0 reduce saturation and values above 1.0 increase saturation. The default is 1.0.


float  b = 1.15
Saturation adjustment used to desaturate or resaturate blue in the output. Do not overdo it; 0.5 to 1.5 is probably the most you can get away with without ruining colors.
Values below 1.0 reduce saturation and values above 1.0 increase saturation. The default is 1.15.


float  tm = 0.9
Strength of tonemapping. Reduce this towards 0.0 to smoothly transition to blowout (clipping) of highlights.
This value controls a LERP between Reinhard tonemapping and no tonemapping. Default is 0.9.


float  roll =
Rolloff strength of the tonemapping. Increase this towards 1.0 to soften and desaturate the result. The default value of 0.7 is effective at retaining saturation and contrast.
This parameter also affects overall brightness so you may have to adjust the light parameter as needed when changing the rolloff.


bool  fulldepth = false
When set to false, 8-bit YV12 is output. When set to true, 10-bit stored in YUV420P16 is output.
Use fulldepth=true if you intend to a 10-bit encoding. The default is false.


string  impl = "255"
  • impl="sw" - Software mode (very slow).
  • impl="255" - Use CUDA, device is chosen automatically.
  • impl="0" - Use CUDA on device 0 (use desired device number).


string  mode = "pq"
  • mode="pq" - Source stream is HDR Perceptual Quantizer (PQ)
  • mode="hlg" - Source stream is HDR Hybrid Log Gamma (HLG)


Examples

Here is a typical AviSynth+ script:

loadplugin("dgdecodenv.dll")
loadplugin("dghdrtosdr.dll")
DGSource("hdr_sample.dgi")
DGHDRtoSDR(mode="pq",white=400)


Cropping and Resizing

Often the goal is to convert to HD bluray with a size of 1920 x 1080. And sometimes one wants to crop as well. The fastest way to do this is to use DGSource() cropping and resizing. Following is a typical script:

dgsource("hdr sample.dgi",crop_t=276,crop_b=276,resize_w=1920,resize_h=804)
dghdrtosdr(...)

Alternatively, the cropping and resizing can be done in Avisynth. Do it before calling dghdrtosdr() for best performance. Here is a script corresponding to the one above:

dgsource("hdr sample.dgi")
crop(0,276,-0,-276)
spline36resize(1920,804)
dghdrtosdr(...)


Changelog

Version         Date              Changes
v1.14           2020/08/10        - Make the PQ white parameter somewhat more relative (like HLG), 
                                    so that the good values of the white parameter are not all 
                                    bunched up at the very high end of the scale. Fixed a bug in 
                                    HLG parameter checking for Avisynth.
v1.13           2019/09/22      


Archived Downloads

Version Download Mirror
v1.14 DGHDRtoSDR_1.14.rar DGHDRtoSDR_1.14.rar
v1.13 DGHDRtoSDR_1.13.rar DGHDRtoSDR_1.13.rar


External Links




Back to External Filters

Personal tools