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
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, opencl=False, opencl_device=0, **args)
For more details please visit our threads in NMM-HD Forum.
A clip to be processed.
Supported format: Gray and YUV with any subsampling whose bit-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 when clip's format is YUV.
aatypev: (Default: same as aatype)
Select main AA kernel for V plane when clip's format is YUV.
strength: (Default: 0)
The strength of predown. Valid range is 0~0.5
Before applying main AA kernel, the clip will be downscaled to (1-strength)*clip_resolution first and then be upscaled to original resolution by main AA kernel. This may be benefit for clip which has terrible aliasing 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 a simplified version of daa.
Pretty useful for dealing with residual comb caused by poor deinterlacing.
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 be used.
Currently there are three mask types:
- 0: No mask
- 1: Canny mask
- 2: Sobel mask
- 3: Prewitt mask
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's resolution, bit-depth, format, etc by yourself.
Size of the mask.
The smaller value you give, the bigger mask you will get.
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 threshold of luma. Valid range is 0~255.
When a area whose luma is greater than threshold 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.
- 1~inf: LSFmod(defaults='old')
- 0~1: Simlar to Avisynth's sharpen()
- -1~0: LSFmod(defaults='fast')
- -1: Contra-Sharpen
Whatever type of sharpen, larger absolute value of sharp means larger strength of sharpen.
- 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 bit-depth 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
opencl: (Default: False)
Whether use opencl version of some plugins.
Currently there are three plugins can use opencl:
opencl_device: (Default: 0)
Select an opencl device.
Will be collected into a dict for particular aatype.