Vapoursynth AAF
AAF is a VapourSynth port of MOmonster's AviSynth anti-aliasing script aaf. It upscales the picture, lets SangNom rebuild the lines in both directions and scales back, then limits SangNom's side effects with Repair or an edge mask.
Filtering → Vapoursynth → Line

What it does
The clip is upscaled with Lanczos, SangNom interpolates vertically, the picture is transposed, SangNom interpolates horizontally, and the result is transposed and scaled back to the source size. A post-processing step then keeps the result close to the source: in repair mode Repair limits the luma against the source, in edge mode only the edges are taken from the anti-aliased picture. Because of this post-processing AAF can use small scaling factors and stays fast. Use it against stair-stepped diagonals (jaggies).
Settings
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Mode | mode | repair, edge | repair | repair: Repair (mode 18) against the source on the luma; the chroma is anti-aliased but not repaired. edge: an edge mask from the luma decides where the result is used; keeps detail sharper and uses Strength (edge/flat). |
| Scaling | aas | −2 – 2 | −0.7 | Quality versus speed. A larger absolute value means a larger internal upscale: better quality, slower, weaker anti-aliasing. Negative values resize only the direction being processed (faster, more artifacts without repair). 1 behaves like the classic aa()/aaa(). |
| Resizing | aar | 0.01 – 2 | 0.7 | Internal resize factor. |
| Strength (y/x) | aay / aax | 0 – 64 | 28 / 28 | SangNom strength of the vertical (y) and horizontal (x) pass; 0 skips that pass. |
| Strength (edge/flat) | estr / bstr | 0 – 255 | 255 / 40 | Edge mode only: strength on hard edges and on flat areas, softer edges in between. Edge should be larger than flat. 8-bit scale. |
| Tools: Expr | – | akarin, cranexpr, std | akarin (std without AVX2) | Expression evaluator. |
| Tools: RG | – | zsmooth, neo_smo | zsmooth | Repair implementation. |
Example
Default settings on a 10-bit YUV 4:2:0 source (640x356):
# Anti Aliasing using AAF
clip = antiAliasing.aaf(clip, aar=0.7, aax=28, tools={'expr': 'akarin', 'rg': 'zsmooth'})
How Hybrid calls it
- AAF works on 8–16-bit integer YUV and gray clips; other formats are converted first.
- Mode, Scaling and the edge/flat strengths are only written when they differ from the defaults. Resizing and the x strength are always written, the y strength when it differs from 28 (the script default), so each control acts on its own.
- SangNom is loaded whenever one of the two strengths is above 0.
- Strength (edge/flat) is given on the 8-bit scale; the script scales it to the bit depth (255 = format maximum).
- AAF also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
Origin
aaf is one of many variations of the classic aaa() idea (upscale, SangNom, downscale). According to the script's notes its repair post-processing allows smaller sampling values without artifacts, which makes it much faster than its predecessors. Internally Scaling is converted to (aas − 1) × 0.25 for negative and (aas + 1) × 0.25 for positive values. In edge mode an extra Repair runs unless Scaling is above 0.84.
SangNom strength
SangNom's aa parameter is given as if the clip were 8 bit (0–128); the plugin scales it itself.
Sources
- VapourSynth-SangNom README
- VapoursynthScriptsInHybrid (the script collection Hybrid uses)
- Hybrid's tooltips