Avisynth Unsharp

From wiki.selur.net
Revision as of 19:49, 21 November 2026 by Selur (talk | contribs) (Avisynth filter documentation (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Unsharp (shown as UnSharpen in Hybrid) is classic unsharp masking from the VariableBlur plugin. A Gaussian-blurred copy of the picture is subtracted from the original to boost fine detail.

Filtering → Avisynth → Sharpen

UnSharpen controls in Hybrid
UnSharpen controls in Hybrid

What it does

The filter blurs the picture with a Gaussian whose width is set by the Variance, then adds the difference between original and blur back, scaled by Strength. Edges and fine texture become more pronounced. A larger variance sharpens coarser structures. By default only luma is sharpened; the chroma planes are copied.

Typical uses:

  • Add a bit of crispness to a soft source.
  • Sharpen only luma, or also chroma, by changing the plane handling.

Settings

Control Parameter Range Hybrid default Meaning
Strength strength 0–1 0.70 Amount of sharpening. 0 means no sharpening; values outside 0–1 give odd results.
Variance (Y/C) varY / varC 0–100 1.50 / 1.50 Variance of the Gaussian blur for luma and chroma (variance = standard deviation²). Larger values affect wider structures.
Border border wrap around, don't process, replicate, mirror mirror How the filter treats the picture borders.
Threads nthreads 1–64 1 Number of threads.
Handling (Y/U/V) Y / U / V ignore, copy, filter filter / copy / copy What happens to each plane: filter it, copy it from the source, or leave it unprocessed.
Integrate integrate on/off off Uses the mean over the pixel area when computing the coefficients.
Gamma function (Y/C) gfunc / gfuncc no gamma correction, sRGB, BT.709/SMPTE 170M, SMPTE 240M, BT.470-2 System M, BT.470-2 System B,G, straight 2.22222, straight 1.8, linear no gamma correction Filter in linear light: the gamma curve is removed before and re-applied after filtering.
Pixel range (Y/C) pcr / pcrc [0, 255], [16, 235], [16, 240] [0, 255] / [0, 255] Value range of the plane. Used only when a gamma function is selected.

Example

Default settings on a 10-bit YUV 4:2:0 source. Hybrid converts to 8 bit before the filter and back to 10 bit afterwards; with all defaults no argument is written:

# Converting from 10 to 8bit for Unsharp
ConvertBits(8)
Unsharp()
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Loads the VariableBlur plugin (with the FFTW library it needs).
  • The plugin works on 8-bit YV12, YUY2, RGB24 and RGB32. Hybrid converts other formats and bit depths and converts back afterwards.
  • Only arguments that differ from the defaults are written. The Gamma function entries are written as the plugin's numbers (0 = sRGB up to 7 = linear).
  • Unsharp also offers the common options and can be added to the filter queue several times.

Background

  • Unsharp is one of several filters in the VariableBlur plugin; the same plugin provides GaussianBlur, AverageBlur and BinomialBlur.
  • A call like Unsharp(varY=15, varC=15, strength=1.0) is typical usage seen on Doom9.

Sources