Vapoursynth CAS

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

CAS (Contrast Adaptive Sharpening) is a CPU port of AMD FidelityFX CAS. It sharpens low-contrast detail more than edges that already have high contrast.

Filtering → Vapoursynth → Sharpen

CAS controls in Hybrid
CAS controls in Hybrid

What it does

For each pixel CAS looks at its 3×3 neighborhood and measures how close the local minimum and maximum are to the signal limits. The closer they are, the less it sharpens. Flat areas stay calm and strong halos are avoided. CAS does not create new detail, and at higher strength it brings up grain.

Settings

Control Parameter Range / values Hybrid default Meaning
Sharpness sharpness 0 – 1 0.5 Strength; above about 0.7 grain comes up.
Planes planes all, chroma only, luma only luma only Planes that are sharpened; the others are copied.

Example

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

# contrast sharpening using CAS
clip = core.cas.CAS(clip)

How Hybrid calls it

  • CAS works on 8–16-bit integer YUV, gray and RGB clips and on 32-bit float RGB; other formats are converted first.
  • Sharpness is only written when it differs from 0.5. Planes is only written when it is not luma only, which is the plugin's own default for YUV; all is written as all three planes and also sharpens chroma.
  • For RGB clips chroma only and luma only simply mean planes 1–2 and plane 0.
  • Sharpness has no unit; the plugin derives its limits from the format, so no bit-depth scaling is needed.
  • CAS also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Plugin

VapourSynth-CAS comes from HomeOfVapourSynthEvolution. Without a planes setting it processes only luma on non-RGB clips and all planes on RGB. Each plane must be at least 3×3 pixels. Internally Sharpness maps to the weight of the negative lobe, from −1/16 (0) to −1/5 (1). A GPU version of the same algorithm is Vapoursynth CAS (GLSL).

Sources