Avisynth maa2

From wiki.selur.net
Jump to navigation Jump to search

maa2 is an edge-masked anti-aliasing script built on SangNom2. It smooths jagged lines and leaves the rest of the picture alone.

Filtering → Avisynth → Line → AntiAliasing

maa2 controls in Hybrid
maa2 controls in Hybrid

What it does

maa2 enlarges the picture (supersampling), runs SangNom2 in both directions on the enlarged copy, scales it back and merges the result into the source. An edge mask decides where the merge happens, so only lines and edges are smoothed; textures and flat areas stay untouched. By default only luma is processed and chroma is copied.

Typical uses:

  • Remove stair-steps from lines in anime, cartoons or badly upscaled video.
  • Raise SuperSampling for stronger smoothing, at the cost of speed.
  • Use Show to see where the mask acts while tuning Mask/-Threshold.

maa2 is not meant for interlaced material.

Settings

Control Parameter Range Hybrid default Meaning
Mask/-Threshold mask −30–1 1 0: no mask, the whole picture is processed. 1: edge mask with the default threshold (7). −i: edge mask with threshold i (useful values 0–30).
Chroma chroma on/off off Also anti-alias the U and V planes instead of copying them.
SuperSampling ss 1.1–20 2.0 Enlargement factor used for the SangNom2 passes.
Strength luma aa 0–100 48 SangNom2 strength for luma.
Strength chroma aac 0–100 40 SangNom2 strength for chroma. Only used when Chroma is on.
Threads threads 1–16 4 Threads used by each SangNom2 instance.
Show show 0–2 0 0: normal output. 1: overlay the mask only. 2: overlay the mask and run the anti-aliasing on luma only (debug views).

Example

Default settings on a 10-bit YUV 4:2:0 source (no conversion is needed):

maa2()

How Hybrid calls it

  • The maa2 script is loaded together with SangNom2, masktools2 and the RemoveGrain helper functions it needs.
  • Only parameters that differ from the defaults are written. Strength chroma is written whenever it differs from Strength luma minus 8, so the value in the dialog always reaches the script.
  • maa2 accepts gray and planar YUV clips with 8–16 bit integer samples; it does not accept float, RGB or YUY2.
  • maa2 also offers the common options and can be added to the filter queue several times.

Background

  • The script is "MAA2 v0.435 mod by A.SONY", an update of the MAA script from AnimeIVTC that uses tp7's SangNom2 instead of SangNom.
  • SangNom2 is a rewrite of SangNom with better border handling and its own thread pool; more than four threads bring no gain.
  • The script also has parameters for the mask type, an external anti-aliasing function and a separate vertical supersampling factor. Hybrid does not offer them.

Sources

See also: Vapoursynth MAA, Vapoursynth SangNom