CombMask

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(v2.0.0)
m (Requirements)
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
 
{{Filter3
 
{{Filter3
 
| {{Author/Chikuzen}}
 
| {{Author/Chikuzen}}
| v1.1.1
+
| v2.0.0
|[https://github.com/Asd-g/CombMask/releases CombMask-1.1.1.7z]
+
|[https://github.com/Asd-g/CombMask/releases CombMask-2.0.0.7z]
 
| Masking
 
| Masking
 
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
Line 13: Line 13:
 
<br>
 
<br>
 
== Requirements ==
 
== Requirements ==
* [x86]: [[AviSynth+]] or [http://forum.doom9.org/showthread.php?t=168764 AviSynth 2.6]
+
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
 
* [x64]: [[AviSynth+]]
 
* [x64]: [[AviSynth+]]
 
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]

Latest revision as of 00:45, 22 May 2020

Abstract
Author Chikuzen
Version v2.0.0
Download CombMask-2.0.0.7z
Category Masking
License GPLv2
Discussion


Contents

[edit] 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.

[edit] Requirements


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


[edit] Syntax and Parameters

[edit] 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.


int  cthresh =
Spatial combing threshold.
  • 0 to 255, default is 6 (metric=0)
  • 0 to 65025, default is 10 (metric=1


int  mthresh = 9
Motion adaptive threshold.
  • 0 to 255, default is 9.


bool  chroma = true
Whether processing is performed to UV planes or not.
  • Default is true.


bool  exapnd = true
When set this to true, left and right pixels of combed pixel also assumed to combed.
  • Default is true.


int  metric = 0
Sets which spatial combing metric is used to detect combed pixels.
Possible options:
             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.



[edit] 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   =
alt: alternate clip which will be merged to base.


clip   =
mask: mask 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


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.


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.


bool  chroma = true
Whether processing is performed to UV planes or not.
  • Default is true.


int  opt =
Same as CombMask.



[edit] 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.


int  cthresh =
Same as CombMask


int  mthresh = 9
Same as CombMask


int  MI = 80
Same as MaskedMerge.


int  blockx = 16
Same as MaskedMerge.


int  blocky = 16
Same as MaskedMerge.


int  metric = 0
Same as CombMask.


int  opt =
Same as CombMask.


[edit] 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")


[edit] 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).


[edit] 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


[edit] External Links

  • GitHub - Source code repository.
  • GitHub - Source code repository (update).




Back to External Filters

Personal tools