An Anti-aliasing script ported from Avisynth
For more details NMM-HD:https://www.nmm-hd.org/newbbs/viewtopic.php?f=23&t=1666
VapourSynth R28 or newer
- EEDI2
- nnedi3
- RemoveGrain/Repair
- fmtconv
- MVTools
- sangnom
- eedi3
- eedi3_092 (opt)
- HAvsFunc r22 or newer (and its requirements)
- Mvsfunc (and its requirements)
import vsTAAmbk as taa
aa = taa.TAAmbk(clip, aatype=1, aatypeu=None, aatypev=None, preaa=0, strength=0.0, cycle=0, mtype=None, mclip=None,
mthr=None, mthr2=None, mlthresh=None, mpand=(1, 0), txtmask=0, txtfade=0, thin=0, dark=0.0, sharp=0,
aarepair=0, postaa=None, src=None, stabilize=0, down8=True, showmask=0, eedi3m=True, **pn)
For more details please visit our threads in NMM-HD Forum.
-
clip:
clip to process.
supported format: Gray and YUV with any subsampling whose bits depth is 8bit, 10bit or 16bit. -
aatype: (Default: 1)
Select main AA kernel for Y plane.
Value can be integer whose meaning is same with original TAA script.
Value can also be name of particular AA kernel.
For more details about AA kernel please visit the thread in NMM-HD. -
aatypeu: (Default: same as aatype)
Select main AA kernel for U plane if clip is YUV. -
aatypev: (Default: same as aatype)
Select main AA kernel for V plane if clip is YUV. -
strength: (Default: 0)
The strength of predown. Valid range is 0~0.5
Before applying main AA kernel, the clip is downscale to (1-strength)*clip_resolution first and then upscale to original resolution by main AA kernel. This may help with dealing clip with terrible aliasing which commonly caused by poor upscaling.
Automatically disabled when using an AA kernel which is not suitable for upscaling. -
preaa: (Default: 0)
Select the preaa mode. 0: No preaa; 1: Vertical; 2: Horizontal; -1: Both.
Perform a preaa before applying main AA kernel.
Preaa is basically an simplified version of daa.
Pretty useful to against residual comb caused by poor deinterlace. -
cycle: (Default: 0)
Set times of loop of main AA kernel.
Use for very very terrible aliasing and 3D aliasing. -
mtype: (Default: 1)
Select type of edge mask to use.
Mask always be built under 8bit scale. -
mclip: (Default: None)
Use your own mask clip instead of building one.
If mclip is set, script won't build another one. And you should take care of mask resolution, bitdepth, format, etc by yourself. -
mthr, mthr2:
Paraments of mask.
Meaning of them depends on particular mtype. -
mlthresh: (Default None)
Set luma thresh for n-pass mask.
Use a list or tuple to specify the sections of luma. -
mpand: (Default: (1, 0))
Use a list or tuple to specify the loop of mask expanding and mask inpanding. -
txtmask: (Default: 0)
Create a mask to protect white captions on screen.
Value is the thresh of luma. Valid range is 0~255.
When a area whose luma is greater than thresh and chroma is 128±2, it will be considered as a caption. -
txtfade: (Default: 0)
Set the length of fading. Useful for fading text. -
thin: (Default: 0)
Warp the line by aWarpSharp2 before applying main AA kernel. -
dark: (Default: 0.0)
Darken the line by Toon before applying main AA kernel. -
sharp: (Default: 0)
Sharpen the clip after applying main AA kernel.
0: No sharpen. -
aarepair: (Default: 0)
Use repair to remove artifacts introduced by main AA kernel.
According to different repair mode, the pixel in src clip will be replaced by the median or average in 3x3 neighbour of processed clip.
It's highly recommend to use repair when main AA kernel contain SangNom. -
postaa: (Default: False)
Whether use soothe to counter the aliasing introduced by sharpening. -
src: (Default: clip)
Use your own src clip for sharp, repair, mask merge, etc. -
stabilize: (Default: 0)
Stabilize the temporal changes by MVTools.
Value is the temporal radius. Valid range is 0~3. -
down8: (Default: True)
If you set this to True, the clip will be down to 8bit before applying main AA kernel and up it back to original bitdepth after applying main AA kernel.
LimitFilter will be used to reduce the loss in depth conversion. -
showmask: (Default: 0)
Output the mask instead of processed clip if you set it to not 0.
0: Normal output; 1: Mask only; 2: tack mask and clip; 3: Interleave mask and clip; -1: Text mask only -
eedi3m: (Default: True)
Use nnedi3 to create a mask for eedi3's mclip. Effective when you have eedi3_092. -
other paraments:
Will be collected into a dict for particular aatype.