CombMask
From Avisynth wiki
(Difference between revisions)
Raffriff42 (Talk | contribs) (redirect for convenient searching) |
(CombMask: add documentation (WIP)) |
||
Line 1: | Line 1: | ||
− | + | {{FilterCat5|External_filters|Plugins|Plugins_x64|Adjustment_filters|Averaging}} | |
− | {{ | + | {{Filter3 |
+ | | {{Author/Chikuzen}} | ||
+ | | v1.1.1 | ||
+ | |[https://github.com/Asd-g/CombMask/releases CombMask-1.1.1.7z] | ||
+ | | Masking | ||
+ | | | ||
+ | |}} | ||
+ | <br> | ||
+ | == Description == | ||
+ | A filter to create and process comb masks. These filters were written from scratch, but most of logic comes from tritical's [[TIVTC]] plugin. | ||
+ | <br> | ||
+ | <br> | ||
+ | == Requirements == | ||
+ | * [x86]: [[AviSynth+]] or [http://forum.doom9.org/showthread.php?t=168764 AviSynth 2.6] | ||
+ | * [x64]: [[AviSynth+]] | ||
+ | * Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]] | ||
+ | <br> | ||
+ | * [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)] | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>CombMask-x86</tt> | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>CombMask-x64</tt> | ||
+ | <br> | ||
+ | |||
+ | == [[Script variables|Syntax and Parameters]] == | ||
+ | |||
+ | ===CombMask=== | ||
+ | CombMask is a simple filter that creates a comb mask that can (could) be used by other filters like MaskTools2.<br> | ||
+ | The mask consists of binaries of 0(not combed) and 255(combed). | ||
+ | <br> | ||
+ | <br> | ||
+ | :{{Template:FuncDef|CombMask (clip, int "cthresh", int "mthresh", bool "chroma", bool "expand", int "metric", int opt) }} | ||
+ | <br> | ||
+ | ::{{Par2| |clip| }} | ||
+ | :::Input clip. | ||
+ | <br> | ||
+ | ::{{Par2|cthresh|int| }} | ||
+ | :::Spatial combing threshold. | ||
+ | :::* 0 to 255, default is 6 (metric=0) | ||
+ | :::* 0 to 65025, default is 10 (metric=1 | ||
+ | <br> | ||
+ | ::{{Par2|mthresh|int|9}} | ||
+ | :::Motion adaptive threshold. | ||
+ | :::*0 to 255, default is 9. | ||
+ | <br> | ||
+ | ::{{Par2|chroma|bool|true}} | ||
+ | :::Whether processing is performed to UV planes or not. | ||
+ | :::*Default is true. | ||
+ | <br> | ||
+ | ::{{Par2|exapnd|bool|true}} | ||
+ | :::When set this to true, left and right pixels of combed pixel also assumed to combed. | ||
+ | :::*Default is true. | ||
+ | <br> | ||
+ | ::{{Par2|metric|int|0}} | ||
+ | :::Sets which spatial combing metric is used to detect combed pixels. | ||
+ | :::Possible options: | ||
+ | <div style="margin-left: 6em; max-width: 67em"> | ||
+ | <pre> | ||
+ | Assume 5 neighboring pixels (a,b,c,d,e) positioned vertically. | ||
+ | |||
+ | a | ||
+ | b | ||
+ | c | ||
+ | d | ||
+ | e | ||
+ | |||
+ | 0: d1 = c - b; | ||
+ | d2 = c - d; | ||
+ | if ((d1 > cthresh && d2 > cthresh) || (d1 < -cthresh && d2 < -cthresh)) | ||
+ | { | ||
+ | if (abs(a+4*c+e-3*(b+d)) > cthresh*6) it's combed; | ||
+ | } | ||
+ | |||
+ | 1: val = (b - c) * (d - c); | ||
+ | if (val > cthresh) it's combed; | ||
+ | |||
+ | default is 0. | ||
+ | </pre> | ||
+ | </div> | ||
+ | <br> | ||
+ | ::{{Par2|opt|int| }} | ||
+ | :::Specify which CPU optimization are used. | ||
+ | :::*0 : Use C++ routine. | ||
+ | :::*1 : Use SSE2 routin if possible. When SSE2 can't be used, fallback to 0. | ||
+ | :::*Others(default) : Use AVX2 routine if possible. When AVX2 can't be used, fallback to 1. | ||
+ | <br> | ||
+ | ------------------ | ||
+ | ===MaskedMerge=== | ||
+ | MaskedMerge is an exclusive masking filter for CombMask. This is often faster than MaskTools2's mt_merge(). | ||
+ | <br> | ||
+ | <br> | ||
+ | :{{Template:FuncDef|MaskedMerge (clip base, clip alt, clip mask, int "MI", int "blockx", int "blocky", bool "chroma", int opt)}} | ||
+ | <br> | ||
+ | ::{{Par2| |clip| }} | ||
+ | :::Input clip. | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ------------------ | ||
+ | ===IsCombed=== | ||
+ | IsCombed is a is a utility function that can be used within AviSynth's [[ConditionalFilter]] to test whether or not a frame is combed and returns true if it is and false if it isn't. | ||
+ | <br> | ||
+ | <br> | ||
+ | :{{Template:FuncDef|IsCombed (clip, int "cthresh", int "mthresh", int "MI", int "blockx", int "blocky", int "metric", int "opt")}} | ||
+ | <br> | ||
+ | ::{{Par2| |clip| }} | ||
+ | :::Input clip. | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | ::{{Par2|||}} | ||
+ | ::: | ||
+ | <br> | ||
+ | |||
+ | == Examples == | ||
+ | TODO: | ||
+ | [[AviSource]]("blah.avi") | ||
+ | <br> | ||
+ | == Changelog == | ||
+ | Version Date Changes<br> | ||
+ | v1.1.1 2020/05/13 - Changes by asd-g | ||
+ | - Update to AviSynth+'s v8 interface | ||
+ | <br> | ||
+ | == External Links == | ||
+ | *[https://github.com/chikuzen/CombMask/tree/master/avisynth GitHub] - Source code repository. | ||
+ | *[https://github.com/Asd-g/CombMask/tree/v8_interface/avisynth GitHub] - Source code repository (update). | ||
+ | <br> | ||
+ | <br> | ||
+ | ----------------------------------------------- | ||
+ | '''Back to [[External_filters#Averaging.2FLayering.2FMasking|External Filters]] ←''' |
Revision as of 04:10, 17 May 2020
Abstract | |
---|---|
Author | Chikuzen |
Version | v1.1.1 |
Download | CombMask-1.1.1.7z |
Category | Masking |
License | |
Discussion |
Contents |
Description
A filter to create and process comb masks. These filters were written from scratch, but most of logic comes from tritical's TIVTC plugin.
Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: Y8, YV12, YV16, YV24, YV411
- *** vcredist_x86.exe is required for CombMask-x86
- *** vcredist_x64.exe is required for CombMask-x64
Syntax and Parameters
CombMask
CombMask is a simple filter that creates a comb mask that can (could) be used by other filters like MaskTools2.
The mask consists of binaries of 0(not combed) and 255(combed).
- CombMask (clip, int "cthresh", int "mthresh", bool "chroma", bool "expand", int "metric", int opt)
- clip =
- Input clip.
- clip =
- int cthresh =
- Spatial combing threshold.
- 0 to 255, default is 6 (metric=0)
- 0 to 65025, default is 10 (metric=1
- Spatial combing threshold.
- int cthresh =
- int mthresh = 9
- Motion adaptive threshold.
- 0 to 255, default is 9.
- Motion adaptive threshold.
- int mthresh = 9
- bool chroma = true
- Whether processing is performed to UV planes or not.
- Default is true.
- Whether processing is performed to UV planes or not.
- bool chroma = true
- bool exapnd = true
- When set this to true, left and right pixels of combed pixel also assumed to combed.
- Default is true.
- When set this to true, left and right pixels of combed pixel also assumed to combed.
- bool exapnd = true
- int metric = 0
- Sets which spatial combing metric is used to detect combed pixels.
- Possible options:
- int metric = 0
Assume 5 neighboring pixels (a,b,c,d,e) positioned vertically. a b c d e 0: d1 = c - b; d2 = c - d; if ((d1 > cthresh && d2 > cthresh) || (d1 < -cthresh && d2 < -cthresh)) { if (abs(a+4*c+e-3*(b+d)) > cthresh*6) it's combed; } 1: val = (b - c) * (d - c); if (val > cthresh) it's combed; default is 0.
- int opt =
- Specify which CPU optimization are used.
- 0 : Use C++ routine.
- 1 : Use SSE2 routin if possible. When SSE2 can't be used, fallback to 0.
- Others(default) : Use AVX2 routine if possible. When AVX2 can't be used, fallback to 1.
- Specify which CPU optimization are used.
- int opt =
MaskedMerge
MaskedMerge is an exclusive masking filter for CombMask. This is often faster than MaskTools2's mt_merge().
- MaskedMerge (clip base, clip alt, clip mask, int "MI", int "blockx", int "blocky", bool "chroma", int opt)
- clip =
- Input clip.
- clip =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
IsCombed
IsCombed is a is a utility function that can be used within AviSynth's ConditionalFilter to test whether or not a frame is combed and returns true if it is and false if it isn't.
- IsCombed (clip, int "cthresh", int "mthresh", int "MI", int "blockx", int "blocky", int "metric", int "opt")
- clip =
- Input clip.
- clip =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
- =
Examples
TODO:
AviSource("blah.avi")
Changelog
Version Date Changes
v1.1.1 2020/05/13 - Changes by asd-g - Update to AviSynth+'s v8 interface
External Links
Back to External Filters ←