lvsfunc.aa
Warning
This entire module will see a complete overhaul at some point in the future.
Anti-aliasing functions and wrappers.
|
As the name implies, this is a based anti-aliaser. |
|
Clamp stronger AAs to weaker AAs. |
|
Generate eedi3 antialiaser. |
|
Generate nnedi3 antialiaser. |
|
A function that clamps eedi3 to nnedi3 for the purpose of reducing eedi3 artifacts. |
|
Perform transpose AA. |
|
Function that performs anti-aliasing over a clip by using nnedi3/eedi3 and transposing multiple times. |
|
A function that performs a supersampled single-rate AA to deal with heavy aliasing and broken-up lineart. |
- lvsfunc.aa.based_aa(clip, shader_file='FSRCNNX_x2_56-16-4-1.glsl', rfactor=2.0, tff=True, mask_thr=60, show_mask=False, lmask=None, **eedi3_args)
As the name implies, this is a based anti-aliaser. Thank you, based Zastin. This relies on FSRCNNX being very sharp, and as such it very much acts like the main “AA” here.
Original function by Zastin, modified by LightArrowsEXE.
Dependencies:
vapoursynth-eedi3
vs-placebo
- Parameters
clip (vs.VideoNode) – Input clip
shader_file (str) – Path to FSRCNNX shader file
rfactor (float) – Image enlargement factor
tff (bool) – Top-Field-First if true, Bottom-Field-First if false
mask_thr (float) – Threshold for the edge mask binarisation. Scaled internally to match bitdepth of clip.
show_mask (bool) – Output mask
eedi3_args (Any) – Additional args to pass to eedi3
lmask (vs.VideoNode | None) – Line mask clip to use for eedi3
- Return type
vs.VideoNode
- Returns
AA’d clip or mask clip
- lvsfunc.aa.clamp_aa(src, weak, strong, strength=1)
Clamp stronger AAs to weaker AAs. Useful for clamping upscaled_sraa or eedi3 to nnedi3 for a strong but precise AA.
Stolen from Zastin.
- Parameters
src (
VideoNode
) – Non-AA’d source clip.weak (
VideoNode
) – Weakly-AA’d clip (eg: nnedi3)strong (
VideoNode
) – Strongly-AA’d clip (eg: eedi3)strength (
float
) – Clamping strength (Default: 1)
- Return type
VideoNode
- Returns
Clip with clamped anti-aliasing.
- lvsfunc.aa.eedi3(opencl=False, **override)
Generate eedi3 antialiaser.
Dependencies:
vapoursynth-EEDI3
- Parameters
opencl (
bool
) – Use OpenCL (Default: False)override (
Any
) – eedi3 parameter overrides
- Return type
Callable
[[VideoNode
],VideoNode
]- Returns
Configured eedi3 function
- lvsfunc.aa.nnedi3(opencl=False, **override)
Generate nnedi3 antialiaser.
Dependencies:
vapoursynth-nnedi3
vapoursynth-NNEDI3CL (Optional: opencl)
- Parameters
opencl (
bool
) – Use OpenCL (Default: False)override (
Any
) – nnedi3 parameter overrides
- Return type
Callable
[[VideoNode
],VideoNode
]- Returns
Configured nnedi3 function
- lvsfunc.aa.nneedi3_clamp(clip, strength=1, mask=None, mthr=0.25, opencl=False)
A function that clamps eedi3 to nnedi3 for the purpose of reducing eedi3 artifacts. This should fix every issue created by eedi3. For example, see this image.
Original function written by Zastin, modified by LightArrowsEXE.
- Parameters
clip (vs.VideoNode) – Input clip
strength (float) – Set threshold strength for over/underflow value for clamping eedi3’s result to nnedi3 +/- strength * 256 scaled to 8 bit (Default: 1)
mask (vs.VideoNode | None) – Clip to use for custom mask (Default: None)
mthr (float) – Binarize threshold for the mask, scaled to float (Default: 0.25)
opencl (bool) – OpenCL acceleration (Default: False)
- Return type
vs.VideoNode
- Returns
Antialiased clip
- lvsfunc.aa.taa(clip, aafun)
Perform transpose AA. Example for nnedi3cl: taa(clip, nnedi3(opencl=True))
- Parameters
clip (
VideoNode
) – Input clip.aafun (
Callable
[[VideoNode
],VideoNode
]) – Antialiasing function
- Return type
VideoNode
- Returns
Antialiased clip
- lvsfunc.aa.transpose_aa(clip, eedi3=False, rep=13)
Function that performs anti-aliasing over a clip by using nnedi3/eedi3 and transposing multiple times. This results in overall stronger anti-aliasing. Useful for shows like Yuru Camp with bad lineart problems.
Original function written by Zastin, modified by LightArrowsEXE.
Dependencies:
RGSF (optional: 32 bit clip)
vapoursynth-EEDI3
vapoursynth-nnedi3
znedi3
- Parameters
clip (
VideoNode
) – Input clipeedi3 (
bool
) – Use eedi3 for the interpolation (Default: False)rep (
int
) – Repair mode. Pass it 0 to not repair (Default: 13)
- Return type
VideoNode
- Returns
Antialiased clip
- lvsfunc.aa.upscaled_sraa(clip, rfactor=1.5, width=None, height=None, supersampler=<function _nnedi3_supersample>, downscaler=<bound method Bicubic.scale of <lvsfunc.kernels.Bicubic object>>, aafun=<function _eedi3_singlerate>)
A function that performs a supersampled single-rate AA to deal with heavy aliasing and broken-up lineart. Useful for heavy antialiasing.
It works by supersampling the clip, performing AA, and then downscaling again. Downscaling can be disabled by setting downscaler to None, returning the supersampled luma clip. The dimensions of the downscaled clip can also be adjusted by setting height or width. Setting either height or width will also scale the chroma accordingly.
Original function written by Zastin, heavily modified by LightArrowsEXE.
Alias for this function is lvsfunc.sraa.
Dependencies:
vapoursynth-eedi3 (default aafun)
vapoursynth-nnedi3 (default supersampler and aafun)
- Parameters
clip (
VideoNode
) – Input cliprfactor (
float
) – Image enlargement factor. 1.3..2 makes it comparable in strength to vsTAAmbk It is not recommended to go below 1.3 (Default: 1.5)width (
Optional
[int
]) – Target resolution width. If None, determined from heightheight (
Optional
[int
]) – Target resolution height (Default:clip.height
)supersampler (
Callable
[[VideoNode
,int
,int
],VideoNode
]) – Supersampler used for upscaling before AA (Default: nnedi3 supersampler)downscaler (
Optional
[Callable
[[VideoNode
,int
,int
],VideoNode
]]) – Downscaler to use after supersampling (Default: Bicubic(b=0, c=1/2)aafun (
Callable
[[VideoNode
],VideoNode
]) – Function used to antialias after supersampling (Default: eedi3 with nnedi3 sclip)
- Return type
VideoNode
- Returns
Antialiased clip