Avisynth SmoothLevels
SmoothLevels changes black point, white point and gamma like Levels, but computes in high precision with interpolation and dithering, so that a strong stretch does not leave gaps in the histogram (banding). It can also weaken the change in dark or bright areas and protect near-black pixels. It comes from LaTo's SmoothAdjust plugin.
Filtering → Avisynth → Color → Levels

What it does
SmoothLevels maps the input range (with gamma) to the output range, then smooths the result by interpolation and dithering. Extras:
- Presets for the common range conversions: pc2tv (0–255 → 16–235), tv2pc (16–235 → 0–255) and fullrange.
- LMode fades the change out towards dark areas, bright areas or both, e.g. to lift dark scenes without touching highlights.
- Protect leaves pixels at or below a value untouched, so black borders and titles are not lifted.
- Chroma sets how much the color planes follow the luma change.
It works on YUV and gray clips (no RGB, no YUY2).
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Preset | preset | default, fullrange, pc2tv, tv2pc | default | A preset other than default fills Input, Output, Gamma and TV range and locks them. |
| Input (low/high) | input_low / input_high | 0–255 | 16 / 235 | Input levels. |
| Output (low/high) | output_low / output_high | 0–255 | 16 / 235 | Output levels. |
| Gamma | gamma | 0–10 | 1.00 | > 1 brightens the mid tones, < 1 darkens them. |
| Chroma | chroma | 0–200 | 100 | Chroma processing: 0 = none, 100 = normal, 200 = maximum. |
| Limiter | limiter | no limiter, clamp to output low/high, clamp to 16–235 (luma) / 16–240 (chroma) | no limiter | Clamps the result. |
| TV range | TVrange | on/off | on | The clip is limited range; only affects LMode (16/235 instead of 0/255 as ends). |
| LMode | Lmode | no limiting, dark, bright, dark & bright | no limiting | Weakens the change in dark areas, bright areas, or both (0 % at black and white, 100 % at ECenter). |
| Strength (bright/dark) | brightSTR / darkSTR | 0–200 | 100 / 100 | Strength of the LMode limiting. |
| ECurve | Ecurve | sine curve, linear curve | sine curve | Shape of the LMode limiting. |
| ECenter | Ecenter | 0–255 | 128 | Center of the limiting; only used with LMode dark & bright. |
| Protect | protect | -1–255 | -1 | -1 = off; otherwise pixels at or below this value stay unchanged. |
| Interpolation strength | interp | 0–200 | 100 | Strength of the interpolation; 0 switches it off (faster). |
| HQ | HQ | on/off | off | Higher quality interpolation, slower. |
| Dither | dither | -1–100 | 75 | -1 = off, 0 = ordered pattern, 100 = noise, values in between mix both. |
| Force 16bit | – | on/off | off | Uses the 16-bit function also for 8-bit clips; the value fields then take 16-bit values (0–65535). |
| Debug | debug | on/off | off | Draws the curve and the settings into the picture; not for encoding. Enables Screen (W/H) and Scale. |
| Screen (W/H) | screenW / screenH | -1–8192 | -1 / -1 | Size of the debug view. |
Example
Preset tv2pc on a 10-bit YUV 4:2:0 source (Hybrid moves to stacked 16 bit for the plugin and back):
# Converting from 10 to 16bit for SmoothLevels ConvertBits(16) ConvertToStacked() SmoothLevels16(output_low=0,output_high=65280,TVrange=false,preset="tv2pc") ConvertFromStacked(16) # Converting from 16 to 10bit for encoder ConvertBits(10)
How Hybrid calls it
- Hybrid loads SmoothAdjust.dll (and ConvertStacked.dll for the 16-bit path).
- 8-bit clips use
SmoothLevels()directly. For any other bit depth, or with Force 16bit, Hybrid converts to 16 bit, then to the stacked 16-bit layout the plugin understands (ConvertToStacked()), callsSmoothLevels16()and converts back (ConvertFromStacked(16)). The plugin predates AviSynth+'s native high bit depth and gives wrong results on it, which is why this detour is needed. - Without Force 16bit, the 8-bit values are shifted by 8 bits for the 16-bit call (255 becomes 65280).
- Only values that differ from Hybrid's defaults are written; ECenter only with LMode dark & bright.
- Accepted formats: gray, YUV 4:1:1, 4:2:0, 4:2:2 and 4:4:4 with even width and height; other formats are converted first.
- SmoothLevels also offers the common options and can be added to the filter queue several times.
Background
SmoothAdjust (last version 3.20, 2015) by LaTo contains SmoothLevels, SmoothTweak, SmoothCurve and further tools, each with a 16-bit (stacked) variant. It computes in 32-bit float and is multithreaded.
The Vapoursynth version is a script port of LaTo's older SmoothLevels function with different parameters (Smode, Mfactor, RemoveGrain kernel) and defaults.
Sources
- Doom9: SmoothAdjust thread (LaTo; parameter list and formats)
- Hybrid's tooltips
- The AviSynth+ documentation does not cover SmoothAdjust.