Vapoursynth Santiag

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

Santiag ("simple antialiasing", v1.6) re-interpolates the picture horizontally and vertically with an edge-directed interpolator – NNEDI3, EEDI2, EEDI3 or SangNom – and scales it back with Spline36.

Filtering → Vapoursynth → Line

Santiag controls in Hybrid
Santiag controls in Hybrid

What it does

For each direction Santiag keeps one field and rebuilds the other with the chosen interpolator, then resizes back to the source size. Higher strength chains more passes, each with the other field, which smooths jaggies further at the cost of detail and speed. The interpolator can be set for both directions together or, with selectHV, separately.

Settings

Control Parameter Range / values Hybrid default Meaning
Type type nnedi3, eedi2, eedi3, sangnom, selectHV nnedi3 Interpolator for both directions. selectHV enables the two direction boxes next to it.
Type (horizontal / vertical) typeh / typev nnedi3, eedi2, eedi3, sangnom nnedi3 / nnedi3 Interpolator per direction; only with selectHV.
Strength (h/v/aa) – h, v strh / strv −1 – 3 1 / 1 Passes per direction: −1 skips the direction, a value n runs n + 1 interpolations.
Strength (h/v/aa) – aa aa 0 – 128 48 SangNom strength (8-bit scale); only used by sangnom.
Neurons nns 16, 32, 64, 128, 256 32 NNEDI3 neurons in the predictor network.
Neighborhood nsize 8x6, 16x6, 32x6, 48x6, 8x4, 16x4, 32x4 32x4 NNEDI3 neighborhood the predictor looks at.
Quality qual 1 – 2 1 Number of blended NNEDI3 predictions.
PScrn pscrn no, old, level 0, level 1, level 2 level 0 NNEDI3 prescreener; for float clips the old one is used.
PreScreener (int16) int16_prescreener on/off on NNEDI3 prescreener in 16-bit integer arithmetic; znedi3 only.
Predictor (int16) int16_predictor on/off on NNEDI3 predictor in 16-bit integer arithmetic; znedi3 only.
Exp exp 0 – 2 0 Accuracy of the exp approximation in the NNEDI3 predictor (0 fastest, 2 most accurate); znedi3 only.
Trade off (a/b/g) alpha / beta / gamma 0 – 1 / 0 – 1 / 0 – 10000 0.2 / 0.25 / 20 EEDI3 cost weights: alpha and beta balance connecting edges against artifacts, gamma penalizes changes of the interpolation direction.
NRadius nrad 0 – 3 2 EEDI3 radius for the direction smoothness check.
MDistance mdis 1 – 40 20 EEDI3 maximum connection distance.
eedi3 helper: Neurons / Neighborhood / Quality / PScrn sclip_nns, sclip_nsize, sclip_qual, sclip_pscrn as the NNEDI3 controls 32 / 32x4 / 1 / level 0 NNEDI3 settings of the helper clip (sclip) that EEDI3 uses as a guide; independent of the NNEDI3 settings above and of other filters. Enabled only while a direction uses eedi3.
Tools: NNEDI3 – znedi3, sneedif, nnedi3vk, vszipcu znedi3 NNEDI3 implementation: znedi3 (CPU), sneedif (OpenCL), nnedi3vk (Vulkan), vszipcu (NVIDIA CUDA); a Device field appears for the GPU ones.
Tools: EEDI3 – vszip, eedi3m, eedi3vk2, vszipcl, vszipcu – EEDI3 implementation (CPU, Vulkan, OpenCL or CUDA).
Tools: EEDI2 – eedi2 eedi2 EEDI2 implementation.

The NNEDI3 controls are enabled while a direction uses nnedi3 (the int16 boxes and Exp also need znedi3), the EEDI3 controls while a direction uses eedi3.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# applying anti aliasing using santiag
clip = antiAliasing.santiag(clip, pscrn=2, tools={'nnedi3': 'znedi3', 'eedi3': 'vszip', 'eedi2': 'eedi2'})

How Hybrid calls it

  • Santiag works on 8–16-bit integer YUV and RGB clips and on 32-bit float RGB and YUV 4:4:4; with eedi2 float is not accepted. Other formats are converted first.
  • Values are only written when they differ from the defaults. With selectHV both direction types are always written. NNEDI3 settings are only written when a direction uses nnedi3, EEDI3 settings and the eedi3 helper settings only when one uses eedi3. PScrn (and the helper's PScrn with eedi3) is always written; for float clips the old prescreener is used.
  • List values such as Neurons are passed as the plugin's index numbers.
  • Santiag also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The VapourSynth version comes from the old havsfunc collection. EEDI3 gets an NNEDI3 interpolation as its helper clip; that helper runs with NNEDI3's defaults, not with the settings on the page. With sangnom the picture is upsized first and SangNom keeps the field the pass works on.

Sources