lvsfunc.aa

Warning

This entire module will see a complete overhaul at some point in the future.

Anti-aliasing functions and wrappers.

lvsfunc.aa.based_aa(clip[, shader_file, ...])

Based anti-aliaser written by the based Zastin.

lvsfunc.aa.clamp_aa(src, weak, strong[, ...])

Clamp stronger AAs to weaker AAs.

lvsfunc.aa.eedi3([opencl])

Generate eedi3 antialiaser.

lvsfunc.aa.nnedi3([opencl])

Generate nnedi3 antialiaser.

lvsfunc.aa.nneedi3_clamp(clip[, strength, ...])

Clamp eedi3 to nnedi3 for the purpose of reducing eedi3 artifacts.

lvsfunc.aa.taa(clip, aafun)

Perform transpose AA.

lvsfunc.aa.transpose_aa(clip[, eedi3, rep])

Tranpose and aa a clip multiple times using nnedi3/eedi3.

lvsfunc.aa.upscaled_sraa(clip[, rfactor, ...])

Super-sampled single-rate AA for heavy aliasing and broken line-art.

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)

Based anti-aliaser written by the based Zastin.

This function relies on FSRCNNX being very sharp, and as such it very much acts like the main “AA” here.

Original function written by Zastin, modified by LightArrowsEXE.

Dependencies:

Parameters
  • clip (vs.VideoNode) – Clip to process.

  • 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.

Raises

ValueErrorl_mask is passed and ‘mask_thr is higher than 255.

lvsfunc.aa.clamp_aa(src, weak, strong, strength=1)

Clamp stronger AAs to weaker AAs.

Warning

This function has been deprecated in favor of vsaa.clamp_aa!

Useful for clamping lvsfunc.aa.upscaled_sraa() or lvsfunc.aa.eedi3() to lvsfunc.aa.nnedi3() for a strong but more precise AA.

Original function written by Zastin, modified by LightArrowsEXE.

Parameters
  • src (VideoNode) – Non-AA’d source clip.

  • weak (VideoNode) – Weakly-AA’d clip (eg: lvsfunc.aa.nnedi3()).

  • strong (VideoNode) – Strongly-AA’d clip (eg: lvsfunc.aa.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.

Warning

This function has been deprecated in favor of vsaa.Eedi3!

Dependencies:

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.

Warning

This function has been deprecated in favor of vsaa.Nnedi3!

Dependencies:

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)

Clamp eedi3 to nnedi3 for the purpose of reducing eedi3 artifacts.

Warning

This function has been deprecated in favor of vsaa.masked_clamp_aa!

This should fix every issue created by eedi3.

Original function written by Zastin, modified by LightArrowsEXE.

Parameters
  • clip (vs.VideoNode) – Clip to process.

  • 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.

Warning

This function has been deprecated in favor of vsaa.transpose_aa!

Example for nnedi3cl: taa(clip, nnedi3(opencl=True))

Parameters
  • clip (VideoNode) – Clip to process.

  • aafun (Union[Callable[[VideoNode], VideoNode], SingleRater]) – Antialiasing function.

Return type

VideoNode

Returns

Antialiased clip.

lvsfunc.aa.transpose_aa(clip, eedi3=False, rep=13)

Tranpose and aa a clip multiple times using nnedi3/eedi3.

Warning

This function has been deprecated in favor of vsaa.fine_aa!

This results in overall stronger anti-aliasing. Useful for shows like Yuru Camp with bad line-art problems.

Original function written by Zastin, modified by LightArrowsEXE.

Dependencies:

Parameters
  • clip (VideoNode) – Clip to process.

  • eedi3 (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=vsaa.Nnedi3SS, downscaler=vskernels.Bicubic.scale, aafun=vsaa.Eedi3SR)

Super-sampled single-rate AA for heavy aliasing and broken line-art.

Warning

This function has been deprecated! It will be removed in a future commit.

It works by super-sampling the clip, performing AA, and then downscaling again. Downscaling can be disabled by setting downscaler to None, returning the super-sampled 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, modified by LightArrowsEXE.

Alias for this function is lvsfunc.sraa.

Dependencies:

Parameters
  • clip (VideoNode) – Clip to process.

  • rfactor (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 height.

  • height (Optional[int]) – Target resolution height (Default: clip.height).

  • supersampler (Union[Callable[[VideoNode, int, int], VideoNode], SuperSampler]) – Super-sampler used for upscaling before AA (Default: nnedi3 super-sampler).

  • downscaler (Optional[Callable[[VideoNode, int, int], VideoNode]]) – Downscaler to use after super-sampling (Default: Bicubic(b=0, c=1/2).

  • aafun (Union[Callable[[VideoNode], VideoNode], SingleRater]) – Function used to antialias after super-sampling (Default: eedi3 with nnedi3 sclip).

Return type

VideoNode

Returns

Antialiased clip.

Raises

ValueErrorrfactor is not above 1.