VsTTempSmooth

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(v1.1.2)
(vsTTempSmooth 1.2.3)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
{{FilterCat5|External_filters|Plugins|Plugins_x64|Denoisers|Temporal_denoisers}}
+
{{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Temporal_denoisers|Deep_color_tools}}
 
{{Filter3
 
{{Filter3
 
|1=[https://github.com/Asd-g Asd-g]
 
|1=[https://github.com/Asd-g Asd-g]
|2=v1.1.2
+
|2=v1.2.3
|3=[https://github.com/Asd-g/AviSynth-vsTTempSmooth/releases vsTTempSmooth-1.1.2.7z]
+
|3=[https://github.com/Asd-g/AviSynth-vsTTempSmooth/releases vsTTempSmooth-1.2.3.7z]
 
|4=Temporal Denoisers
 
|4=Temporal Denoisers
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
Line 19: Line 19:
 
* [[FAQ_different_types_content#How_do_I_recognize_progressive.2C_interlaced.2C_telecined.2C_hybrid_and_blended_content.3F|Progressive]] input only  
 
* [[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]]
 
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]]
**AviSynth+: all planar Y/YUV/YUVA formats (8/10/12/14/16bit and float) are supported.
+
**AviSynth+: all planar Y/YUV/YUVA formats (8/10/12/14/16/32-bit) are supported.
 
<br>
 
<br>
 
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)]
 
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)]
Line 26: Line 26:
 
<br>
 
<br>
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
:{{Template:FuncDef|vsTTempSmooth (clip, int "maxr", int "ythresh", int "uthresh", int "vthresh", int "ymdiff", int "umdiff", int "vmdiff", int "strength", float "scthresh", bool "fp", bool "y", bool "u", bool "v", clip "pfclip") }}
+
:{{Template:FuncDef|vsTTempSmooth (clip, int "maxr", int "ythresh", int "uthresh", int "vthresh", int "ymdiff", int "umdiff", int "vmdiff", int "strength", float "scthresh", bool "fp", int "y", int "u", int "v", clip "pfclip", int "opt") }}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
Line 78: Line 78:
 
:::When true will add any weight not given to the outer pixels back onto the center pixel when computing the final value and it's much better for reducing artifacts in motion areas and usually produces overall better results. When false will just do a normal weighted average.
 
:::When true will add any weight not given to the outer pixels back onto the center pixel when computing the final value and it's much better for reducing artifacts in motion areas and usually produces overall better results. When false will just do a normal weighted average.
 
<br>
 
<br>
::{{Par2|y|bool|true}}
+
::{{Par2|y|int|3}}
::{{Par2|u|bool|true}}
+
::{{Par2|u|int|3}}
::{{Par2|v|bool|true}}
+
::{{Par2|v|int|3}}
 
:::Planes to process.
 
:::Planes to process.
 +
:::*1: Return garbage.
 +
:::*2: Copy plane.
 +
:::*3: Process plane.
 
<br>
 
<br>
 
::{{Par2|pfclip|clip| }}
 
::{{Par2|pfclip|clip| }}
 
:::This allows you to specify a separate clip for vsTTempSmooth to use when calculating pixel differences. This applies to checking the motion thresholds, calculating inverse difference weights, and detecting scenechanges. Basically, the <code>pfclip</code> will be used to determine the weights in the average but the weights will be applied to the original input clip's pixel values.
 
:::This allows you to specify a separate clip for vsTTempSmooth to use when calculating pixel differences. This applies to checking the motion thresholds, calculating inverse difference weights, and detecting scenechanges. Basically, the <code>pfclip</code> will be used to determine the weights in the average but the weights will be applied to the original input clip's pixel values.
 +
<br>
 +
::{{Par2|opt|int|-1}}
 +
:::Sets which cpu optimizations to use.
 +
:::*-1: Auto-detect.
 +
:::*0: Use C++ code.
 +
:::*1: Use SSE2 code.
 +
:::*2: Use AVX2 code.
 +
:::*3: Use AVX-512 code.
 
<br>
 
<br>
  
Line 90: Line 101:
 
vsTTempSmooth with default settings:
 
vsTTempSmooth with default settings:
 
  [[AviSource]]("Blah.avi")
 
  [[AviSource]]("Blah.avi")
  vsTTempSmooth(maxr=3, ythresh=4, uthresh=5, vthresh=5, ymdiff=2, umdiff=3, vmdiff=3, strength=2, scthresh=12.0, fp=true, y=true, u=true, v=true)
+
  vsTTempSmooth(maxr=3, ythresh=4, uthresh=5, vthresh=5, ymdiff=2, umdiff=3, vmdiff=3, strength=2, scthresh=12.0, fp=true, y=3, u=3, v=3)
 
<br>
 
<br>
 
== Changelog ==
 
== Changelog ==
 
  Version      Date            Changes<br>
 
  Version      Date            Changes<br>
 +
v1.2.3      2023/03/04      - Improved SIMD code. (@DTL2020).
 +
v1.2.2      2023/03/02      - Fixed used frames for scene change detection.
 +
                              - Fixed memory allocation for inverse pixel difference weighting.
 +
                              - Fixed inverse pixel difference weighting to work properly for every processed plane.
 +
v1.2.1      2023/02/28      - Fixed processing with float clips. (regression from 1.2.0)
 +
                              - Added parameter opt.
 +
                              - Added SSE2, AVX2, AVX-512 code.
 +
                              - Fixed earlier exit of the scene change detection.
 +
                              - Fixed memory misalignment.
 +
v1.2.0      2023/02/27      - Fixed crash when releasing memory.
 +
                              - Changed the type of parameters y, u, v to int.
 +
v1.1.3      2020/08/24      - Throw error for non-planar formats.
 
  v1.1.2      2020/06/11      - Fixed memory leak.
 
  v1.1.2      2020/06/11      - Fixed memory leak.
 
  v1.1.1      2020/05/31      - Fixed memory misalignment for AviSynth 2.6.
 
  v1.1.1      2020/05/31      - Fixed memory misalignment for AviSynth 2.6.

Latest revision as of 10:52, 18 May 2023

Abstract
Author Asd-g
Version v1.2.3
Download vsTTempSmooth-1.2.3.7z
Category Temporal Denoisers
License GPLv2
Discussion

Contents

[edit] Description

vsTTempSmooth is a motion adaptive (it only works on stationary parts of the picture), temporal smoothing filter.

vsTTempSmooth is a port of the VapourSynth plugin TTempSmooth.

[edit] Requirements


*** vcredist_x86.exe is required for vsTTempSmooth-x86
*** vcredist_x64.exe is required for vsTTempSmooth-x64


[edit] Syntax and Parameters

vsTTempSmooth (clip, int "maxr", int "ythresh", int "uthresh", int "vthresh", int "ymdiff", int "umdiff", int "vmdiff", int "strength", float "scthresh", bool "fp", int "y", int "u", int "v", clip "pfclip", int "opt")


clip   =
A clip to process. It must be Y/YUV(A) 8..32-bit format.


int  maxr = 3
This sets the maximum temporal radius. By the way it works vsTTempSmooth automatically varies the radius used... This sets the maximum boundary.
Must be between 1 and 7. At 1 vsTTempSmooth will be (at max) including pixels from 1 frame away in the average (3 frames total will be considered counting the current frame). At 7 it would be including pixels from up to 7 frames away (15 frames total will be considered). With the way it checks motion there isn't much danger in setting this high, it's basically a quality vs. speed option. Lower settings are faster while larger values tend to create a more stable image.


int  ythresh = 4
Luma threshold for differences of pixels between frames. vsTTempSmooth checks 2 frame distance as well as single frame, so these can usually be set slightly higher than with most other temporal smoothers and still avoid artifacts.
Must be between 1 and 256.
Also important is the fact that as long as ymdiff is less than the threshold value then pixels with larger differences from the original will have less weight in the average. Thus, even with rather large thresholds pixels just under the threshold wont have much weight, helping to reduce artifacts.


int  uthresh = 5
int  vthresh = 5
Same as ythresh but for the chroma planes (u, v).
Must be between 1 and 256.


int  ymdiff = 2
Any pixels with differences less than or equal to ymdiff will be blurred at maximum. Usually, the larger the difference to the center pixel the smaller the weight in the average. ymdiff makes vsTTempSmooth treat pixels that have a difference of less than or equal to ymdiff as though they have a difference of 0. In other words, it shifts the zero difference point outwards. Set ymdiff to a value equal to or greater than ythresh-1 to completely disable inverse pixel difference weighting.
Applied only to the luma plane.
Must be between 0 and 255.


int  umdiff = 3
int  vmdiff = 3
Same as ymdiff but for the chroma planes (u, v).
Must be between 0 and 255.


int  strength = 2
vsTTempSmooth uses inverse distance weighting when deciding how much weight to give to each pixel value. The strength option lets you shift the drop off point away from the center to give a stronger smoothing effect and add weight to the outer pixels. It does for the spatial weights what mdiff does for the difference weights.
  • 1 = 0.13 0.14 0.16 0.20 0.25 0.33 0.50 1.00 0.50 0.33 0.25 0.20 0.16 0.14 0.13
  • 2 = 0.14 0.16 0.20 0.25 0.33 0.50 1.00 1.00 1.00 0.50 0.33 0.25 0.20 0.16 0.14
  • 3 = 0.16 0.20 0.25 0.33 0.50 1.00 1.00 1.00 1.00 1.00 0.50 0.33 0.25 0.20 0.16
  • 4 = 0.20 0.25 0.33 0.50 1.00 1.00 1.00 1.00 1.00 1.00 1.00 0.50 0.33 0.25 0.20
  • 5 = 0.25 0.33 0.50 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 0.50 0.33 0.25
  • 6 = 0.33 0.50 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 0.50 0.33
  • 7 = 0.50 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 0.50
  • 8 = 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
The values shown are for maxr=7, when using smaller radius values the weights outside of the range are simply dropped. Thus, setting strength to a value of maxr+1 or higher will give you equal spatial weighting of all pixels in the kernel.
Must be between 1 and 8.


float  scthresh = 12.0
The standard scenechange threshold as a percentage of maximum possible change of the luma plane. A good range of values is between 8 and 15.
Set to 0 to disable scenechange detection.
Must be between 0.0 and 100.0.


bool  fp = true
When true will add any weight not given to the outer pixels back onto the center pixel when computing the final value and it's much better for reducing artifacts in motion areas and usually produces overall better results. When false will just do a normal weighted average.


int  y = 3
int  u = 3
int  v = 3
Planes to process.
  • 1: Return garbage.
  • 2: Copy plane.
  • 3: Process plane.


clip  pfclip =
This allows you to specify a separate clip for vsTTempSmooth to use when calculating pixel differences. This applies to checking the motion thresholds, calculating inverse difference weights, and detecting scenechanges. Basically, the pfclip will be used to determine the weights in the average but the weights will be applied to the original input clip's pixel values.


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


[edit] Examples

vsTTempSmooth with default settings:

AviSource("Blah.avi")
vsTTempSmooth(maxr=3, ythresh=4, uthresh=5, vthresh=5, ymdiff=2, umdiff=3, vmdiff=3, strength=2, scthresh=12.0, fp=true, y=3, u=3, v=3)


[edit] Changelog

Version      Date            Changes
v1.2.3 2023/03/04 - Improved SIMD code. (@DTL2020). v1.2.2 2023/03/02 - Fixed used frames for scene change detection. - Fixed memory allocation for inverse pixel difference weighting. - Fixed inverse pixel difference weighting to work properly for every processed plane. v1.2.1 2023/02/28 - Fixed processing with float clips. (regression from 1.2.0) - Added parameter opt. - Added SSE2, AVX2, AVX-512 code. - Fixed earlier exit of the scene change detection. - Fixed memory misalignment. v1.2.0 2023/02/27 - Fixed crash when releasing memory. - Changed the type of parameters y, u, v to int. v1.1.3 2020/08/24 - Throw error for non-planar formats. v1.1.2 2020/06/11 - Fixed memory leak. v1.1.1 2020/05/31 - Fixed memory misalignment for AviSynth 2.6. v1.1.0 2020/05/30 - Added scthresh paramter. v1.0.0 2020/05/28 - Initial release - Port of the VapourSynth plugin TTempSmooth.


[edit] External Links

  • GitHub - Source code repository.
  • GitHub - Source code repository (VapourSynth version).




Back to External Filters


Personal tools