HQDering mod
From Avisynth wiki
(Difference between revisions)
m (→Syntax and Parameters) |
(add Deep_color_tools category and other minor changes) |
||
(13 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{FilterCat5|External_filters|Scripts|Restoration_filters|Deringing & Mosquito Noise|Deep_color_tools}} |
− | {{ | + | {{Filter3 |
| mawen1250 | | mawen1250 | ||
− | | v1. | + | | v1.8 |
− | | [http://www.nmm-hd.org/upload/get~ | + | | [http://web.archive.org/web/20140711173345/http://www.nmm-hd.org/upload/get~08CusazVphU/HQDeringmod_v1.8.avsi HQDeringmod_v1.8.avsi] |
|Deringing & Mosquito Noise | |Deringing & Mosquito Noise | ||
| | | | ||
− | + | |6=[http://www.nmm-hd.org/newbbs/viewtopic.php?f=7&t=914 NMM-HD Thread] - [Chinese] | |
− | + | }} | |
== Description == | == Description == | ||
− | + | Applies deringing by using a smart smoother near edges (where ringing occurs) only.<br> | |
<br> | <br> | ||
− | == | + | == Requirements == |
− | + | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] | |
− | :* | + | * [x64]: [[AviSynth+]] |
− | :*[[MaskTools2]] | + | * [[FAQ_different_types_content#How_do_I_recognize_progressive.2C_interlaced.2C_telecined.2C_hybrid_and_blended_content.3F|Progressive]] input only |
− | + | * Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]] | |
− | + | ||
+ | === Required Plugins === | ||
+ | Latest version of the following plugins are recommended unless stated otherwise.<br> | ||
+ | *[[dfttest]] | ||
+ | *[[Dither_tools|Dither]] | ||
+ | *[[MaskTools2]] | ||
+ | *[[MedianBlur2]] | ||
+ | *[[RgTools]] | ||
+ | *[[SmoothAdjust]] | ||
<br> | <br> | ||
− | == Syntax and Parameters == | + | |
− | :{{Template:FuncDef|HQDeringmod(clip input, clip "smoothed", clip "ringmask",int "mrad", int "msmooth", bool "incedge", int "mthr", int "minp", int "nrmode", int "nrmodec", float "sigma", float "sigma2", int "sbsize", int "sosize", | + | == [[Script variables|Syntax and Parameters]] == |
+ | :{| | ||
+ | |- | ||
+ | |{{Template:FuncDef|HQDeringmod}} | ||
+ | |{{Template:FuncDef| (clip input, clip "smoothed", clip "ringmask", }} | ||
+ | |- | ||
+ | | | ||
+ | |{{Template:FuncDef|int "mrad", int "msmooth", bool "incedge", int "mthr", int "minp",}} | ||
+ | |- | ||
+ | | | ||
+ | |{{Template:FuncDef|int "nrmode", int "nrmodec", float "sigma", float "sigma2", int "sbsize", int "sosize", }} | ||
+ | |- | ||
+ | | | ||
+ | |{{Template:FuncDef|int "sharp", int "drrep", float "thr", float "elast", float "darkthr", }} | ||
+ | |- | ||
+ | | | ||
+ | |{{Template:FuncDef|int "Y", int "U", int "V", bool "lsb_in", bool "lsb", bool "lsb_out", bool "tv_range", int "dither", bool "show")}} | ||
+ | |} | ||
<br> | <br> | ||
− | ==== | + | ==== Input Clips ==== |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ::{{ | + | ::{{Par2|input|clip| }} |
− | :::Input | + | :::Input clip to be processed. |
− | ::{{ | + | ::{{Par2|smoothed|clip| }} |
− | ::: | + | :::Optional preprocessed smoothed clip. |
− | ::{{ | + | ::{{Par2|ringmask|clip| }} |
− | ::: | + | :::Optional preprocessed ring mask. |
− | ::{{ | + | ====Input/Output==== |
+ | |||
+ | ::{{Par2|Y|int|3}} | ||
+ | ::{{Par2|U|int|2}} | ||
+ | ::{{Par2|V|int|2}} | ||
+ | :::Choose what planes to process; works just like [[MaskTools2#Common_parameters|MaskTools2]]. | ||
+ | |||
+ | ::::*2 : copy from input clip | ||
+ | ::::*3 : process | ||
+ | |||
+ | ::{{Par2|lsb_in|bool|false}} | ||
+ | :::{{Template:FuncDef|input}} clip is 16-bit stacked or not. | ||
+ | |||
+ | ::{{Par2|lsb|bool|false}} | ||
+ | :::{{Template:FuncDef|smoothed}} clip is 16-bit stacked or not, processing precision is 16-bit or not. | ||
+ | |||
+ | ::{{Par2|lsb_out|bool|lsb}} | ||
+ | :::Output clip is 16-bit stacked or not. The default is dictated by {{Template:FuncDef|lsb}}. | ||
+ | |||
+ | ::{{Par2|tv_range|bool|true}} | ||
+ | :::Input clip is TV-range (16-235) or PC-range (0-255). | ||
+ | |||
+ | ::{{Par2|dither|int|6}} | ||
+ | :::Dither mode for 16-bit to 8-bit conversion. | ||
+ | |||
+ | ::{{Par2|show|bool|false}} | ||
:::Whether to output mask clip instead of filtered clip. | :::Whether to output mask clip instead of filtered clip. | ||
− | ==== | + | ====Ring Mask==== |
− | ::{{ | + | ::{{Par2|mthr|int|60}} |
− | :::Threshold of prewitt edge mask, lower | + | :::Threshold of prewitt edge mask, lower value means more aggressive processing but for strong ringing, |
+ | :::lower value will treat some ringing as edge, which protects this ringing from being processed. | ||
− | ::{{ | + | ::{{Par2|minp|int|1}} |
:::Inpanding of prewitt edge mask, higher value means more aggressive processing. | :::Inpanding of prewitt edge mask, higher value means more aggressive processing. | ||
− | ::{{ | + | ::{{Par2|mrad|int|1}} |
:::Expanding of edge mask, higher value means more aggressive processing. | :::Expanding of edge mask, higher value means more aggressive processing. | ||
− | ::{{ | + | ::{{Par2|msmooth|int|1}} |
:::Inflate of edge mask, smooth boundaries of mask. | :::Inflate of edge mask, smooth boundaries of mask. | ||
− | ::{{ | + | ::{{Par2|incedge|bool|false}} |
:::Whether to include edge in ring mask, by default ring mask only include area near edges. | :::Whether to include edge in ring mask, by default ring mask only include area near edges. | ||
− | ==== | + | ====Deringing Kernel==== |
− | ::{{ | + | ::{{Par2|nrmode|int| }} |
− | ::: | + | :::Deringing kernel: |
::::* 0: dfttest | ::::* 0: dfttest | ||
::::* 1: MinBlur(radius=1) | ::::* 1: MinBlur(radius=1) | ||
::::* 2: MinBlur(radius=2) | ::::* 2: MinBlur(radius=2) | ||
::::* 3: MinBlur(radius=3) | ::::* 3: MinBlur(radius=3) | ||
+ | :::By default, 2 is set for HD(Width>=1280 or Height>=720) and 1 is set for non-HD. | ||
− | ::{{ | + | ::{{Par2|nrmodec|int|nrmode}} |
− | ::: | + | :::Deringing kernel for chroma. The default for {{Template:FuncDef|nrmodec}} is the value of {{Template:FuncDef|nrmode}}. |
− | ::{{ | + | ::{{Par2|sigma|float|128.0}} |
− | :::dfttest: sigma for medium | + | :::dfttest: sigma for medium frequencies. |
− | ::{{ | + | ::{{Par2|sigma2|float|sigma/16.0}} |
− | :::dfttest: sigma for low&high | + | :::dfttest: sigma for low&high frequencies. The default value is {{Template:FuncDef|sigma}}/16.0, so by default {{Template:FuncDef|sigma2}}=8. |
− | ::{{ | + | ::{{Par2|sbsize|int| }} |
− | :::dfttest: length of the sides of the spatial window | + | :::dfttest: length of the sides of the spatial window. |
+ | :::By default, 8 is set for HD(Width>=1280 or Height>=720) and 6 is set for non-HD. | ||
− | ::{{ | + | ::{{Par2|sosize|int| }} |
− | :::dfttest: spatial overlap amount | + | :::dfttest: spatial overlap amount. |
+ | :::By default, 6 is set for HD(Width>=1280 or Height>=720) and 4 is set for non-HD. | ||
− | ==== | + | ====Post-Processing==== |
− | ::{{ | + | ::{{Par2|sharp|int|1}} |
− | :::Whether to use contra-sharpening to | + | :::Whether to use contra-sharpening to resharpen the deringed clip; 1-3 represents radius, 0 means no sharpening. |
− | ::{{ | + | ::{{Par2|drrep|int| }} |
− | :::Use repair for details retention, recommended values are 24/23 | + | :::Use repair for details retention, recommended values are 24/23 for {{Template:FuncDef|lsb}}=False and 13/12/1 for {{Template:FuncDef|lsb}}=True. |
+ | :::The default is set by this logic: | ||
+ | ::::If {{Template:FuncDef|nrmode}} is greater than 0 and {{Template:FuncDef|lsb}}=True then set to 13. | ||
+ | ::::If {{Template:FuncDef|nrmode}} is greater than 0 and {{Template:FuncDef|lsb}}=False then set to 24. | ||
+ | ::::If {{Template:FuncDef|nrmode}} is not greater than 0 and {{Template:FuncDef|lsb}}=false then set to 0. | ||
− | ::{{ | + | ::{{Par2|thr|float|12.0}} |
− | :::The same with "thr" in Dither_limit_dif16, valid value range is [0, | + | :::The same meaning with "thr" in Dither_limit_dif16, valid value range is [0, 128.0] {{Template:FuncDef|lsb}}=True and [0, 255.0] for {{Template:FuncDef|lsb}}=False. |
+ | :::Set to 0 to disable the limiting process. | ||
− | ::{{ | + | ::{{Par2|elast|float|2.0}} |
− | :::The same with "elast" in Dither_limit_dif16, valid value range is [1, | + | :::The same meaning with "{{Template:FuncDef|elast}}" in Dither_limit_dif16, valid value range is [1, inf ). |
+ | :::PDiff: pixel value diff between processed clip and input clip. | ||
+ | :::ODiff: pixel value diff between output clip and input clip. | ||
+ | :::PDiff, {{Template:FuncDef|thr}} and {{Template:FuncDef|elast}} is used to calculate ODiff: | ||
+ | ::::ODiff = PDiff when [PDiff <= {{Template:FuncDef|thr}}] | ||
+ | ::::ODiff gradually smooths from {{Template:FuncDef|thr}} to 0 when [{{Template:FuncDef|thr}} <= PDiff <= {{Template:FuncDef|thr}} * {{Template:FuncDef|elast}}] | ||
+ | ::::For {{Template:FuncDef|elast}}>2.0, ODiff reaches maximum when [PDiff == {{Template:FuncDef|thr}} * {{Template:FuncDef|elast}} / 2] | ||
+ | ::::ODiff = 0 when [PDiff >= {{Template:FuncDef|thr}} * {{Template:FuncDef|elast}}] | ||
+ | |||
+ | :::Larger "{{Template:FuncDef|thr}}" will result in more pixels being taken from processed clip. | ||
+ | :::Larger "{{Template:FuncDef|thr}}" will result in less pixels being taken from input clip. | ||
+ | :::Larger "{{Template:FuncDef|elast}}" will result in more pixels being blended from processed&input clip, for smoother merging. | ||
+ | |||
+ | ::{{Par2|darkthr|float| }} | ||
+ | :::Threshold for darker area near edges, by default {{Template:FuncDef|darkthr}} equals to {{Template:FuncDef|thr}}/4. | ||
+ | :::Set it lower if you think de-ringing destroys too much lines, etc. | ||
+ | :::When "{{Template:FuncDef|darkthr}}" is not equal to "{{Template:FuncDef|thr}}", "{{Template:FuncDef|thr}}" limits darkening while "{{Template:FuncDef|darkthr}}" limits brightening. | ||
+ | |||
+ | <blockquote style="width: 80%;"><pre> Example: | ||
+ | |||
+ | "thr=0, darkthr=0 " - no limiting | ||
+ | "thr=255, darkthr=255" - no limiting | ||
+ | "thr=8, darkthr=2 " - limit darkening with 8 , brightening is limited to 2 | ||
+ | "thr=8, darkthr=0 " - limit darkening with 8 , brightening is limited to 0(stays unchanged) | ||
+ | "thr=255, darkthr=0 " - limit darkening with 255(no limiting), brightening is limited to 0(stays unchanged)</pre></blockquote> | ||
<br> | <br> | ||
== Examples == | == Examples == | ||
− | + | HQDeringmod with default values: | |
[[AviSource]]("Blah.avi") | [[AviSource]]("Blah.avi") | ||
HQDeringmod() | HQDeringmod() | ||
<br> | <br> | ||
− | |||
− | |||
− | |||
− | |||
== External Links == | == External Links == | ||
+ | *[http://www.nmm-hd.org/newbbs/viewtopic.php?f=7&t=914 NMM-HD Forum] - HQDering mod discussion [Chinese]. | ||
+ | <br> | ||
+ | <br> | ||
+ | ----------------------------------------------- | ||
+ | '''Back to [[External_filters#Deringing_.26_Mosquito_Noise|External Filters]] ←''' |
Latest revision as of 08:29, 6 July 2020
Abstract | |
---|---|
Author | mawen1250 |
Version | v1.8 |
Download | HQDeringmod_v1.8.avsi |
Category | Deringing & Mosquito Noise |
License | |
Discussion | NMM-HD Thread - [Chinese] |
Contents |
[edit] Description
Applies deringing by using a smart smoother near edges (where ringing occurs) only.
[edit] Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Progressive input only
- Supported color formats: Y8, YV12, YV16, YV24
[edit] Required Plugins
Latest version of the following plugins are recommended unless stated otherwise.
[edit] Syntax and Parameters
HQDeringmod (clip input, clip "smoothed", clip "ringmask", int "mrad", int "msmooth", bool "incedge", int "mthr", int "minp", int "nrmode", int "nrmodec", float "sigma", float "sigma2", int "sbsize", int "sosize", int "sharp", int "drrep", float "thr", float "elast", float "darkthr", int "Y", int "U", int "V", bool "lsb_in", bool "lsb", bool "lsb_out", bool "tv_range", int "dither", bool "show")
[edit] Input Clips
- clip input =
- Input clip to be processed.
- clip input =
- clip smoothed =
- Optional preprocessed smoothed clip.
- clip smoothed =
- clip ringmask =
- Optional preprocessed ring mask.
- clip ringmask =
[edit] Input/Output
- int Y = 3
- int U = 2
- int V = 2
- Choose what planes to process; works just like MaskTools2.
- int Y = 3
- 2 : copy from input clip
- 3 : process
- bool lsb_in = false
- input clip is 16-bit stacked or not.
- bool lsb_in = false
- bool lsb = false
- smoothed clip is 16-bit stacked or not, processing precision is 16-bit or not.
- bool lsb = false
- bool lsb_out = lsb
- Output clip is 16-bit stacked or not. The default is dictated by lsb.
- bool lsb_out = lsb
- bool tv_range = true
- Input clip is TV-range (16-235) or PC-range (0-255).
- bool tv_range = true
- int dither = 6
- Dither mode for 16-bit to 8-bit conversion.
- int dither = 6
- bool show = false
- Whether to output mask clip instead of filtered clip.
- bool show = false
[edit] Ring Mask
- int mthr = 60
- Threshold of prewitt edge mask, lower value means more aggressive processing but for strong ringing,
- lower value will treat some ringing as edge, which protects this ringing from being processed.
- int mthr = 60
- int minp = 1
- Inpanding of prewitt edge mask, higher value means more aggressive processing.
- int minp = 1
- int mrad = 1
- Expanding of edge mask, higher value means more aggressive processing.
- int mrad = 1
- int msmooth = 1
- Inflate of edge mask, smooth boundaries of mask.
- int msmooth = 1
- bool incedge = false
- Whether to include edge in ring mask, by default ring mask only include area near edges.
- bool incedge = false
[edit] Deringing Kernel
- int nrmode =
- Deringing kernel:
- 0: dfttest
- 1: MinBlur(radius=1)
- 2: MinBlur(radius=2)
- 3: MinBlur(radius=3)
- By default, 2 is set for HD(Width>=1280 or Height>=720) and 1 is set for non-HD.
- Deringing kernel:
- int nrmode =
- int nrmodec = nrmode
- Deringing kernel for chroma. The default for nrmodec is the value of nrmode.
- int nrmodec = nrmode
- float sigma = 128.0
- dfttest: sigma for medium frequencies.
- float sigma = 128.0
- float sigma2 = sigma/16.0
- dfttest: sigma for low&high frequencies. The default value is sigma/16.0, so by default sigma2=8.
- float sigma2 = sigma/16.0
- int sbsize =
- dfttest: length of the sides of the spatial window.
- By default, 8 is set for HD(Width>=1280 or Height>=720) and 6 is set for non-HD.
- int sbsize =
- int sosize =
- dfttest: spatial overlap amount.
- By default, 6 is set for HD(Width>=1280 or Height>=720) and 4 is set for non-HD.
- int sosize =
[edit] Post-Processing
- int sharp = 1
- Whether to use contra-sharpening to resharpen the deringed clip; 1-3 represents radius, 0 means no sharpening.
- int sharp = 1
- int drrep =
- Use repair for details retention, recommended values are 24/23 for lsb=False and 13/12/1 for lsb=True.
- The default is set by this logic:
- If nrmode is greater than 0 and lsb=True then set to 13.
- If nrmode is greater than 0 and lsb=False then set to 24.
- If nrmode is not greater than 0 and lsb=false then set to 0.
- int drrep =
- float thr = 12.0
- The same meaning with "thr" in Dither_limit_dif16, valid value range is [0, 128.0] lsb=True and [0, 255.0] for lsb=False.
- Set to 0 to disable the limiting process.
- float thr = 12.0
- float elast = 2.0
- The same meaning with "elast" in Dither_limit_dif16, valid value range is [1, inf ).
- PDiff: pixel value diff between processed clip and input clip.
- ODiff: pixel value diff between output clip and input clip.
- PDiff, thr and elast is used to calculate ODiff:
- ODiff = PDiff when [PDiff <= thr]
- ODiff gradually smooths from thr to 0 when [thr <= PDiff <= thr * elast]
- For elast>2.0, ODiff reaches maximum when [PDiff == thr * elast / 2]
- ODiff = 0 when [PDiff >= thr * elast]
- float elast = 2.0
- Larger "thr" will result in more pixels being taken from processed clip.
- Larger "thr" will result in less pixels being taken from input clip.
- Larger "elast" will result in more pixels being blended from processed&input clip, for smoother merging.
- float darkthr =
- Threshold for darker area near edges, by default darkthr equals to thr/4.
- Set it lower if you think de-ringing destroys too much lines, etc.
- When "darkthr" is not equal to "thr", "thr" limits darkening while "darkthr" limits brightening.
- float darkthr =
Example: "thr=0, darkthr=0 " - no limiting "thr=255, darkthr=255" - no limiting "thr=8, darkthr=2 " - limit darkening with 8 , brightening is limited to 2 "thr=8, darkthr=0 " - limit darkening with 8 , brightening is limited to 0(stays unchanged) "thr=255, darkthr=0 " - limit darkening with 255(no limiting), brightening is limited to 0(stays unchanged)
[edit] Examples
HQDeringmod with default values:
AviSource("Blah.avi") HQDeringmod()
[edit] External Links
- NMM-HD Forum - HQDering mod discussion [Chinese].
Back to External Filters ←