Soften: Difference between revisions
Raffriff42 (talk | contribs) m added category |
add link to avs+ documentation |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
<div style="max-width:68em" > | |||
<div {{BlueBox2|40|0|3px solid purple}} > | |||
{{AvsPlusFullname}}<br> | |||
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/soften.html https://avisynthplus.readthedocs.io] | |||
</div> | |||
'''SpatialSoften''' and '''TemporalSoften''' remove noise from a video clip by selectively blending pixels. | |||
== Syntax and Parameters == | |||
{{FuncDefH4|SpatialSoften}} | |||
{{FuncDef | |||
|SpatialSoften(clip ''clip'', int ''radius'', int ''luma_threshold'', int ''chroma_threshold'') | |||
}} | |||
Like '''[[Blur]]''', '''SpatialSoften''' blends neighboring pixels in the frame – but with a wider possible {{FuncArg|radius}}, and only if neighboring pixels are within {{FuncArg|luma_threshold}} and {{FuncArg|chroma_threshold}}, as explained below. | |||
:{{Par2|clip|clip|}} | |||
:: Source clip. Must be [[YUY2]] color format. | |||
:{{Par2|radius|int|}} | |||
::Filter radius – defines which pixels are processed. | |||
::Range 0-32; {{FuncArg|radius}}=0 results in no smoothing. Values > 32 may cause AviSynth to crash. | |||
:{{Par2|luma_threshold, chroma_threshold|int|}} | |||
::When smoothing a given pixel {{Serif|P}}, '''SpatialSoften''' ignores any neighbor pixel {{Serif|P<sub>''n''</sub>}} where: | |||
::*{{Serif|P<sub>''n''</sub>}} luma differs from {{Serif|P}} luma by more than {{FuncArg|luma_threshold}}, OR | |||
::*{{Serif|P<sub>''n''</sub>}} chroma differs from {{Serif|P}} chroma by more than {{FuncArg|chroma_threshold}}. | |||
{{FuncDefH4|TemporalSoften}} | |||
{{FuncDef | |||
|TemporalSoften(clip ''clip'', int ''radius'', int ''luma_threshold'', int ''chroma_threshold'' [, int ''scenechange''] [, int ''mode'' ] ) | |||
}} | |||
Blends corresponding pixels in neighboring frames. All frames no more than {{FuncArg|radius}} away are examined. Blending occurs only if corresponding pixels are within {{FuncArg|luma_threshold}} or {{FuncArg|chroma_threshold}}, as explained below. | |||
{{AvsPluscon}} arguments are [[Autoscale_parameter|autoscaling]] – they are always 0-255 at all bit depths. | |||
:{{Par2|clip|clip|}} | |||
:: Source clip. Supported color formats: all except [[RGB24]] and [[Avisynthplus_color_formats|RGB48]] | |||
:{{Par2|radius|int|}} | |||
::Filter radius. All frames no more than {{FuncArg|radius}} from the current frame are examined. | |||
::(for {{FuncArg|radius}}=2, FIVE frames are processed: the current frame, two ahead and two behind) | |||
::Range 0-7; {{FuncArg|radius}}=0 results in no smoothing. | |||
:{{Par2|luma_threshold|int|}} | |||
::When smoothing a given luma pixel {{Serif|Y}}, the corresponding pixel in neighboring frame {{Serif|Y<sub>''n''</sub>}} | |||
::is ignored where {{Serif|Y<sub>''n''</sub>}} differs from {{Serif|Y}} by more than {{FuncArg|luma_threshold}}. | |||
:{{Par2|chroma_threshold|int|}} | |||
::When smoothing a given chroma pixel {{Serif|C}}, the corresponding pixel in neighboring frame {{Serif|C<sub>''n''</sub>}} | |||
::is ignored where {{Serif|C<sub>''n''</sub>}} differs from {{Serif|C}} by more than {{FuncArg|chroma_threshold}}. | |||
::*Good starting values are around 1 or 2 times {{FuncArg|luma_threshold}}. | |||
:{{Par2|scenechange|int|0}} | |||
::Defines the maximum average pixel change between frames; set properly, this will avoid blending across scene changes. | |||
::*Good values are between 5 and 30, somewhat higher than {{FuncArg|luma_threshold}}. | |||
::*{{FuncArg|scenechange}} not supported in RGB modes. | |||
:{{Par2|mode|int|1}} | |||
::New scripts should specify {{FuncArg|mode}}=2 to enable [[ISSE]] processing. For backward compatibility, {{FuncArg|mode}}=1 by default. | |||
</div> | |||
== Examples == | |||
* Good initial values: | |||
<div {{BoxWidthIndent|56|1}} > | |||
TemporalSoften(3, 4, 8, scenechange=15, mode=2) | |||
</div> | |||
== Changes == | |||
{| border="1" | {| border="1" | ||
|- | |- | ||
Latest revision as of 19:15, 17 September 2022
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
SpatialSoften and TemporalSoften remove noise from a video clip by selectively blending pixels.
Syntax and Parameters
SpatialSoften(clip clip, int radius, int luma_threshold, int chroma_threshold)
Like Blur, SpatialSoften blends neighboring pixels in the frame – but with a wider possible radius, and only if neighboring pixels are within luma_threshold and chroma_threshold, as explained below.
- clip clip =
- Source clip. Must be YUY2 color format.
- int radius =
- Filter radius – defines which pixels are processed.
- Range 0-32; radius=0 results in no smoothing. Values > 32 may cause AviSynth to crash.
- int luma_threshold, chroma_threshold =
- When smoothing a given pixel P, SpatialSoften ignores any neighbor pixel Pn where:
- Pn luma differs from P luma by more than luma_threshold, OR
- Pn chroma differs from P chroma by more than chroma_threshold.
- When smoothing a given pixel P, SpatialSoften ignores any neighbor pixel Pn where:
TemporalSoften(clip clip, int radius, int luma_threshold, int chroma_threshold [, int scenechange] [, int mode ] )
Blends corresponding pixels in neighboring frames. All frames no more than radius away are examined. Blending occurs only if corresponding pixels are within luma_threshold or chroma_threshold, as explained below.
AVS+ arguments are autoscaling – they are always 0-255 at all bit depths.
- int radius =
- Filter radius. All frames no more than radius from the current frame are examined.
- (for radius=2, FIVE frames are processed: the current frame, two ahead and two behind)
- Range 0-7; radius=0 results in no smoothing.
- int luma_threshold =
- When smoothing a given luma pixel Y, the corresponding pixel in neighboring frame Yn
- is ignored where Yn differs from Y by more than luma_threshold.
- int chroma_threshold =
- When smoothing a given chroma pixel C, the corresponding pixel in neighboring frame Cn
- is ignored where Cn differs from C by more than chroma_threshold.
- Good starting values are around 1 or 2 times luma_threshold.
- int scenechange = 0
- Defines the maximum average pixel change between frames; set properly, this will avoid blending across scene changes.
- Good values are between 5 and 30, somewhat higher than luma_threshold.
- scenechange not supported in RGB modes.
- Defines the maximum average pixel change between frames; set properly, this will avoid blending across scene changes.
- int mode = 1
- New scripts should specify mode=2 to enable ISSE processing. For backward compatibility, mode=1 by default.
Examples
- Good initial values:
TemporalSoften(3, 4, 8, scenechange=15, mode=2)
Changes
| v2.56 | TemporalSoften working also with RGB32 input (as well as YV12, YUY2) |