SmoothUV2

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(v4.2.0 update)
(SmoothUV2 4.4.1)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
{{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Spatial_denoisers|Deep_color_tools}}
 
{{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Spatial_denoisers|Deep_color_tools}}
 
{{Filter3
 
{{Filter3
|1=[https://github.com/dubhater dubhater], [https://github.com/Asd-g asd-g]
+
|1={{Author/dubhater}}, {{Author/Asd-g}}
|2=v4.2.0
+
|2=v4.4.1
|3=[https://github.com/Asd-g/AviSynth-SmoothUV2/releases SmoothUV2-4.2.0.7z]
+
|3=[https://github.com/Asd-g/AviSynth-SmoothUV2/releases SmoothUV2]
 
|4=Spatial Denoisers
 
|4=Spatial Denoisers
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
Line 10: Line 10:
 
== Description ==
 
== Description ==
 
[[SmoothUV2]] is a modern replacement for the old [[SmoothUV]] plugin. It includes two filters:
 
[[SmoothUV2]] is a modern replacement for the old [[SmoothUV]] plugin. It includes two filters:
*[[#SSHiQ2|SSHiQ2]] - a general purpose spatial denoising filter.  
+
*[[#SSHiQ2|SSHiQ2]] - a general purpose spatial denoising filter.
*[[#SmoothUV2|SmoothUV2]] - a spatial derainbow filter.  
+
*[[#SmoothUV2|SmoothUV2]] - a spatial derainbow filter.
 
<br>
 
<br>
 
Key differences to the original [[SmoothUV]]:
 
Key differences to the original [[SmoothUV]]:
Line 18: Line 18:
 
* Additional colorspace support, including [[HBD]].
 
* Additional colorspace support, including [[HBD]].
 
* x64 bit version.
 
* x64 bit version.
* Version 4.2.0; dropped support for AviSynth 2.6.  
+
* Version 4.2.0; dropped support for AviSynth 2.6.
 
<br>
 
<br>
  
Line 34: Line 34:
  
 
===SSHiQ2===
 
===SSHiQ2===
A general purpose spatial denoiser. SSHiQ has independent parameters for both luma and chroma, meaning that you can process the luma only and leave the chroma intact or vice versa.  
+
A general purpose spatial denoiser. SSHiQ has independent parameters for both luma and chroma, meaning that you can process the luma only and leave the chroma intact or vice versa.
 
<br>
 
<br>
 
<br>
 
<br>
:{{Template:FuncDef|SSHiQ2 (clip, int "rY", int "rC", int "tY", int tC, bool "HQY", bool "HQC", int "interlaced", int "opt", int "dither")}}
+
:{{Template:FuncDef|SSHiQ2 (clip, int "rY", int "rC", int "tY", int "tC", int "strY", int "strC",  bool "HQY", bool "HQC", int "interlaced", int "opt", int "dither")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
Line 49: Line 49:
 
:::rC Must be between 1 and 7 for 4:2:0 subsampling and between 1 and 3 for 4:2:2/4:4:4 subsampling.
 
:::rC Must be between 1 and 7 for 4:2:0 subsampling and between 1 and 3 for 4:2:2/4:4:4 subsampling.
 
:::Larger values smooth more.
 
:::Larger values smooth more.
:::Default: rY = 5; rC = 3.
 
 
<br>
 
<br>
 
::{{Par2|tY|int|20}}
 
::{{Par2|tY|int|20}}
Line 57: Line 56:
 
:::Set to 0 for copying the plane.
 
:::Set to 0 for copying the plane.
 
:::Larger values smooth more.
 
:::Larger values smooth more.
:::Default: tY = 20; tC =30.
 
 
<br>
 
<br>
::{{Par2|str|int|240}}
+
::{{Par2|strY|int|240}}
:::Strength is only used for HiQ mode and it controls how much of the smoothed version should be used at best for calculating the new pixel.
+
::{{Par2|strC|int|strY}}
 +
:::Strength respectively for luma and chroma planes.
 +
:::It is only used for HiQ mode and it controls how much of the smoothed version should be used at best for calculating the new pixel.
 
:::Must be between 0 and 255.
 
:::Must be between 0 and 255.
:::Default: 240.
 
 
<br>
 
<br>
 
::{{Par2|HQY|bool|true}}
 
::{{Par2|HQY|bool|true}}
Line 68: Line 67:
 
:::Enables HiQ mode.
 
:::Enables HiQ mode.
 
:::Edge processing strength gets automatically reduced.
 
:::Edge processing strength gets automatically reduced.
:::Default: HQY = HQC = true.
 
 
<br>
 
<br>
 
::{{Par2|interlaced|int|-1}}
 
::{{Par2|interlaced|int|-1}}
 
:::Whether the frame is interlaced.
 
:::Whether the frame is interlaced.
:::-1: If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
+
:::-1 : If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
 
:::If frame properties aren't supported or there is no property "_FieldBased" - 0.
 
:::If frame properties aren't supported or there is no property "_FieldBased" - 0.
:::0: Progressive frame.
+
:::0 : Progressive frame.
:::1: Interlaced frame.
+
:::1 : Interlaced frame.
:::Default: -1.
+
 
<br>
 
<br>
 
::{{Par2|opt|int|-1}}
 
::{{Par2|opt|int|-1}}
 
:::Sets which cpu optimizations to use.
 
:::Sets which cpu optimizations to use.
:::*-1: Auto-detect.
+
:::*-1 : Auto-detect.
:::*0: Use C++ code.
+
:::*0 : Use C++ code.
:::*1: Use SSE4.1 code.
+
:::*1 : Use SSE2 code.
:::Default: -1.
+
:::*2 : Use SSSE3 code.
 +
:::*3 : Use SSE4.1 code.
 +
:::*4 : Use AVX2 code.
 +
:::*5 : Use AVX-512 code.
 
<br>
 
<br>
 
::{{Par2|dither|int|-1}}
 
::{{Par2|dither|int|-1}}
 
:::How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
 
:::How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
:::*-1: Rounding.
+
:::*-1 : Rounding.
:::*0: Ordered dither.
+
:::*0 : Ordered dither.
:::*1: Error diffusion (Floyd-Steinberg).
+
:::*1 : Error diffusion (Floyd-Steinberg).
:::Default: -1.
+
 
<br>
 
<br>
  
Line 103: Line 102:
 
<br>
 
<br>
 
::{{Par2|radius|int|3}}
 
::{{Par2|radius|int|3}}
:::Radius. Must be between 1 and 7.
+
:::Must be between 1 and 7 for 4:2:0 subsampling and between 1 and 3 for 4:2:2/4:4:4 subsampling.
 
:::Larger values smooth more.
 
:::Larger values smooth more.
:::Default: 3
 
 
<br>
 
<br>
 
::{{Par2|threshold|int|270}}
 
::{{Par2|threshold|int|270}}
 
:::Threshold. Must be between 0 and 450.
 
:::Threshold. Must be between 0 and 450.
 
:::Larger values smooth more.
 
:::Larger values smooth more.
:::Default: 270
 
 
<br>
 
<br>
 
::{{Par2|interlaced|int|-1}}
 
::{{Par2|interlaced|int|-1}}
 
:::Whether the frame is interlaced.
 
:::Whether the frame is interlaced.
:::-1: If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
+
:::-1 : If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
 
:::If frame properties aren't supported or there is no property "_FieldBased" - 0.
 
:::If frame properties aren't supported or there is no property "_FieldBased" - 0.
:::0: Progressive frame.
+
:::0 : Progressive frame.
:::1: Interlaced frame.
+
:::1 : Interlaced frame.
:::Default: -1.
+
 
<br>
 
<br>
 
::{{Par2|opt|int|-1}}
 
::{{Par2|opt|int|-1}}
 
:::Sets which cpu optimizations to use.
 
:::Sets which cpu optimizations to use.
:::*-1: Auto-detect.
+
:::*-1 : Auto-detect.
:::*0: Use C++ code.
+
:::*0 : Use C++ code.
:::*1: Use SSE4.1 code.
+
:::*1 : Use SSE2 code.
:::Default: -1.
+
:::*2 : Use SSSE3 code.
 +
:::*3 : Use SSE4.1 code.
 +
:::*4 : Use AVX2 code.
 +
:::*5 : Use AVX-512 code.
 
<br>
 
<br>
 
::{{Par2|dither|int|-1}}
 
::{{Par2|dither|int|-1}}
 
:::How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
 
:::How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
:::*-1: Rounding.
+
:::*-1 : Rounding.
:::*0: Ordered dither.
+
:::*0 : Ordered dither.
:::*1: Error diffusion (Floyd-Steinberg).
+
:::*1 : Error diffusion (Floyd-Steinberg).
:::Default: -1.
+
 
<br>
 
<br>
 
== Examples ==
 
== Examples ==
 
SSHiQ2 with default settings:
 
SSHiQ2 with default settings:
 
  [[AviSource]]("Blah.avi")
 
  [[AviSource]]("Blah.avi")
  SSSHiQ2(rY=5, rC=3, tY=20, tC=30, str=240, HQY=true, HQC=true, interlaced=-1, opt=-1, dither=-1)
+
  SSSHiQ2(rY=5, rC=3, tY=20, tC=30, strY=240, strC=240, HQY=true, HQC=true, interlaced=-1, opt=-1, dither=-1)
  
 
SmoothUV2 with default settings:
 
SmoothUV2 with default settings:
Line 145: Line 143:
 
== Changelog ==
 
== Changelog ==
 
  Version      Date            Changes<br>
 
  Version      Date            Changes<br>
 +
v4.4.1      2022/06/12      - Fixed a left shift of pixel count. (dubhater)<br>
 +
v4.4.0      2021/08/10      - Added AVX2 and AVX512 code.<br>
 +
v4.3.0      2021/07/04      - Added SSE2 code.
 +
                              - Parameter str replaced by strY and strC.<br>
 +
v4.2.1      2021/06/29      - Improved speed for opt=0.<br>
 
  v4.2.0      2021/06/24      - Added C++ code.
 
  v4.2.0      2021/06/24      - Added C++ code.
 
                               - Added parameters opt and dither.
 
                               - Added parameters opt and dither.

Latest revision as of 18:45, 17 May 2023

Abstract
Author dubhater , Asd-g
Version v4.4.1
Download SmoothUV2
Category Spatial Denoisers
License GPLv2
Discussion

Contents

[edit] Description

SmoothUV2 is a modern replacement for the old SmoothUV plugin. It includes two filters:

  • SSHiQ2 - a general purpose spatial denoising filter.
  • SmoothUV2 - a spatial derainbow filter.


Key differences to the original SmoothUV:

  • Filters renamed to SSHiQ2 and SmoothUV2.
  • "fields" parameter renamed to "interlaced" and changed from a boolean to an integer.
  • Additional colorspace support, including HBD.
  • x64 bit version.
  • Version 4.2.0; dropped support for AviSynth 2.6.


[edit] Requirements


*** vc_redist.x86.exe is required for SmoothUV2-x86
*** vc_redist.x64.exe is required for SmoothUV2-x64


[edit] Syntax and Parameters

[edit] SSHiQ2

A general purpose spatial denoiser. SSHiQ has independent parameters for both luma and chroma, meaning that you can process the luma only and leave the chroma intact or vice versa.

SSHiQ2 (clip, int "rY", int "rC", int "tY", int "tC", int "strY", int "strC", bool "HQY", bool "HQC", int "interlaced", int "opt", int "dither")


clip   =
A clip to process. It must be in YUV 8..16-bit planar format and must have at least three planes.


int  rY = 5
int  rC = 3
Radius respectively for luma and chroma planes.
Controls how far from the current pixel neighbors are used.
rY Must be between 1 and 7.
rC Must be between 1 and 7 for 4:2:0 subsampling and between 1 and 3 for 4:2:2/4:4:4 subsampling.
Larger values smooth more.


int  tY = 20
int  tC = 30
Threshold respectively for luma and chroma planes.
Must be between 0 and 450.
Set to 0 for copying the plane.
Larger values smooth more.


int  strY = 240
int  strC = strY
Strength respectively for luma and chroma planes.
It is only used for HiQ mode and it controls how much of the smoothed version should be used at best for calculating the new pixel.
Must be between 0 and 255.


bool  HQY = true
bool  HQC = true
Enables HiQ mode.
Edge processing strength gets automatically reduced.


int  interlaced = -1
Whether the frame is interlaced.
-1 : If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
If frame properties aren't supported or there is no property "_FieldBased" - 0.
0 : Progressive frame.
1 : Interlaced frame.


int  opt = -1
Sets which cpu optimizations to use.
  • -1 : Auto-detect.
  • 0 : Use C++ code.
  • 1 : Use SSE2 code.
  • 2 : Use SSSE3 code.
  • 3 : Use SSE4.1 code.
  • 4 : Use AVX2 code.
  • 5 : Use AVX-512 code.


int  dither = -1
How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
  • -1 : Rounding.
  • 0 : Ordered dither.
  • 1 : Error diffusion (Floyd-Steinberg).


[edit] SmoothUV2

This filter performs structure-preserving smoothing (blurring) on the U/V (chrominance or colour) information of the image, leaving Y (luminance) intact. It was created in an attempt to reduce the appearance of "rainbows" (cross-colour artifacts) near lines in some cel animation.

SmoothUV2 (clip, int "radius", int "threshold", int "interlaced", int "opt", int "dither")


clip   =
A clip to process. It must be in YUV 8..16-bit planar format and must have at least three planes.


int  radius = 3
Must be between 1 and 7 for 4:2:0 subsampling and between 1 and 3 for 4:2:2/4:4:4 subsampling.
Larger values smooth more.


int  threshold = 270
Threshold. Must be between 0 and 450.
Larger values smooth more.


int  interlaced = -1
Whether the frame is interlaced.
-1 : If frame properties are supported and frame property "_FieldBased" exists - "_FieldBased" value is used.
If frame properties aren't supported or there is no property "_FieldBased" - 0.
0 : Progressive frame.
1 : Interlaced frame.


int  opt = -1
Sets which cpu optimizations to use.
  • -1 : Auto-detect.
  • 0 : Use C++ code.
  • 1 : Use SSE2 code.
  • 2 : Use SSSE3 code.
  • 3 : Use SSE4.1 code.
  • 4 : Use AVX2 code.
  • 5 : Use AVX-512 code.


int  dither = -1
How to convert the internal 16-bit calculation to the clip depth (when clip depth < 16-bit).
  • -1 : Rounding.
  • 0 : Ordered dither.
  • 1 : Error diffusion (Floyd-Steinberg).


[edit] Examples

SSHiQ2 with default settings:

AviSource("Blah.avi")
SSSHiQ2(rY=5, rC=3, tY=20, tC=30, strY=240, strC=240, HQY=true, HQC=true, interlaced=-1, opt=-1, dither=-1)

SmoothUV2 with default settings:

AviSource("Blah.avi")
SmoothUV2(radius=3, threshold=270, interlaced=-1, opt=-1, dither=-1)


[edit] Changelog

Version      Date            Changes
v4.4.1 2022/06/12 - Fixed a left shift of pixel count. (dubhater)
v4.4.0 2021/08/10 - Added AVX2 and AVX512 code.
v4.3.0 2021/07/04 - Added SSE2 code. - Parameter str replaced by strY and strC.
v4.2.1 2021/06/29 - Improved speed for opt=0.
v4.2.0 2021/06/24 - Added C++ code. - Added parameters opt and dither. - Changed internal calculation to 16-bit. - Dropped support for AviSynth 2.x.
v4.1.0 2021/06/08 - SmoothUV2 threshold changed back to 0..450 range. - A bit improved calculation for 8-bit. - Added SSHiQ2 function: updated version of SSHiQ from SmoothUV v1.4.0: * replaced MMX asm code with SSE4.1 intrinsics; * fixed planes shift; * added support for 10..16-bit; * added support for 422/444 chroma subsampling; * more precise 8-bit calculation.
v4.0.0 2021/04/29 - Function name changed to SmoothUV2. - Fixed horizontal planes shift. - Fixed vertical planes shift for interlaced frames. - Fixed output for 422/444 subsampling. - Additional limit radius for 422/444.
v3.0.1 2021/04/27 - Another attempt to fix last columns processing. - Removed redundant interlaced value 2.
v3.0.0 2021/04/25 - Fixed not processed edges. - Added support for 10..16-bit. - Set MT mode: MT_NICE_FILTER. - Changed the range of parameter threshold from 0..450 to 0..255. - Changed the type of parameter interlaced from bool to int. - Changed the minimum CPU instructions support from SSE2 to SSE4.1. - Added Linux building option.
v2.1.1 2020/06/03 - Fixed memory misalignment for AviSynth 2.6. - Fixed processing when interlaced and h % 2.
v2.1.0 2020/05/17 - Move project to GitHub - Update to AviSynth+'s v8 interface - Rename files to SmoothUV2
2019/04/02 - Backport SmoothUV from VapourSynth port by Dubhater - Add YV16 and YV24 support - x64 version - Compiled with Microsoft Visual Studio C++ 2019 - Author: Asd


[edit] External Links

  • GitHub - Source code repository.




Back to External Filters

Personal tools