CombMask
From Avisynth wiki
Abstract | |
---|---|
Author | Chikuzen |
Version | v1.1.1 |
Download | CombMask-1.1.1.7z |
Category | Masking |
License | GPLv2 |
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
CombMask2
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).
- CombMask2 (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 =
MaskedMerge2
MaskedMerge is an exclusive masking filter for CombMask. This is often faster than MaskTools2's mt_merge().
- MaskedMerge2 (clip base, clip alt, clip mask, int "MI", int "blockx", int "blocky", bool "chroma", int opt)
- clip =
- base: base clip.
- clip =
- clip =
- alt: alternate clip which will be merged to base.
- clip =
- clip =
- mask: mask clip.
- clip =
- int MI = 80
- The number of combed pixels inside any of
blockx
*blocky
size blocks on the Y-plane for the frame to be detected as combed. If the frame is not combed, merge process will be skipped.- Range: 0 to
blockx*blocky
, default is 80
- Range: 0 to
- The number of combed pixels inside any of
- int MI = 80
- int blockx = 16
- Sets the x-axis size of the window used during combed frame detection. This has to do with the size of the area in which MI number of pixels are required to be detected as combed for a frame to be declared combed.
- Possible values are 8, 16(default) or 32.
- Sets the x-axis size of the window used during combed frame detection. This has to do with the size of the area in which MI number of pixels are required to be detected as combed for a frame to be declared combed.
- int blockx = 16
- int blocky = 16
- Sets the x-axis size of the window used during combed frame detection. This has to do with the size of the area in which MI number of pixels are required to be detected as combed for a frame to be declared combed.
- Possible values are 8, 16(default) or 32.
- Sets the x-axis size of the window used during combed frame detection. This has to do with the size of the area in which MI number of pixels are required to be detected as combed for a frame to be declared combed.
- int blocky = 16
- 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
- int opt =
- Same as CombMask.
- int opt =
IsCombed2
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.
- IsCombed2 (clip, int "cthresh", int "mthresh", int "MI", int "blockx", int "blocky", int "metric", int "opt")
- clip =
- Input clip.
- clip =
- int cthresh =
- Same as CombMask
- int cthresh =
- int mthresh = 9
- Same as CombMask
- int mthresh = 9
- int MI = 80
- Same as MaskedMerge.
- int MI = 80
- int blockx = 16
- Same as MaskedMerge.
- int blockx = 16
- int blocky = 16
- Same as MaskedMerge.
- int blocky = 16
- int metric = 0
- Same as CombMask.
- int metric = 0
- int opt =
- Same as CombMask.
- int opt =
Examples
src = SourceFilter("foo\bar\fizz\buzz") deint = src.some_deinterlace_filter() deint2 = src.another_filter() mask = deint.CombMask2() last = deint.MaskedMerge2(deint2, mask) return last
src = a_YV12_clip combed = src.ConvertToYV16(interlaced=true) nocomb = src.ConvertToYV16(interlaced=false) ConditionalFilter(src, combed, nocomb, "IsCombed2", "=", "true")
Notes
- On AviSynth+, CombMask2 and MaskedMerge2 are set as MT_NICE_FILTER automatically.
- This plugin's filters require appropriate memory alignments. Thus, if you want to crop the left side of your source clip before these filters, you have to set crop(align=true).
Changelog
Version Date Changes
v2.0.0 2020/05/20 - Change funtion names to CombMask2, MaskedMerge2, IsCombed2 v1.1.1 2020/05/13 - Changes by asd-g - Update to AviSynth+'s v8 interface
External Links
Back to External Filters ←