Vapoursynth Retinex
Retinex imitates the color constancy of human vision: it separates the light of each pixel into illumination and reflectance and keeps the reflectance. Uses are dynamic range compression, local contrast enhancement, de-fogging and removing color casts. Hybrid uses the Retinex plugin with its two modes MSRCP and MSRCR.
Filtering → Vapoursynth → Color → Auto

What it does
The illumination is estimated by blurring the picture with Gaussian filters at several scales (Sigma); dividing it out leaves the reflectance, which is then stretched to the output range.
- MSRCP (multi-scale Retinex with chromaticity preservation) works on the intensity and keeps the hue. It is the recommended mode for most material, but does not remove a color cast.
- MSRCR (multi-scale Retinex with color restoration) works on each RGB channel and does remove a color cast. It is slower, and on footage with good color balance it can look desaturated.
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| MSRCP | – | on/off | on | On: MSRCP, off: MSRCR. |
| Sigma | sigma | 0 – 16000 each | 25 / 80 / 250 | Gaussian scales; small values give stronger range compression and local contrast, large values better color rendition. |
| Threshold (lower/upper) | lower_thr / upper_thr | 0 – 0.998 | 0.001 / 0.001 | Share of the darkest/brightest pixels ignored when stretching to the output range; raise lower for more global contrast, raise upper if bright outliers make the picture dark. Hybrid keeps their sum below 1. |
| PC scale (out) | fulld | on/off | on | Whether the output is full (PC) range. |
| Chroma protect | chroma_protect | 1 – 100000 | 1.2 | Damps the chroma change for YUV input (1 = no damping). MSRCP only. |
| Restore | restore | 0 – 100000 | 125 | Strength of the color restoration; it works logarithmically, so change it in powers of 10. MSRCR only. |
Example
Default settings (MSRCP) on a 10-bit YUV 4:2:0 source:
# adjusting color space from YUV420P10 to YUV444P10 for vsRetinex clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P10) # color adjustment using Retinex clip = core.retinex.MSRCP(clip, sigma=[25,80,250], fulls=False, fulld=True) # adjusting output color from YUV444P10 to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_in_s="full")
How Hybrid calls it
- MSRCP works on gray, RGB or YUV without chroma subsampling; MSRCR on RGB only. Hybrid converts other formats first (4:2:0 to 4:4:4, or to RGB for MSRCR).
- The input range (fulls) is set automatically from the clip at the filter's position: limited-range YUV and gray sources are passed as limited, RGB (which Hybrid always converts to full range) and full-range sources as full.
- Sigma, the input range and PC scale (out) are always written; the thresholds, Chroma protect and Restore only when they differ from the defaults.
- Hybrid takes the output range from PC scale (out), so later filters see the right range.
- Retinex also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
VapourSynth-Retinex
The plugin offers MSRCP(input, sigma=[25,80,250], lower_thr=0.001, upper_thr=0.001, fulls, fulld=fulls, chroma_protect=1.2) and MSRCR(input, sigma, lower_thr, upper_thr, fulls=True, fulld=fulls, restore=125). Both thresholds must lie in [0, 1) and add up to less than 1. Without an explicit fulls, MSRCP assumes full range for RGB and limited range for YUV and gray; if fulld differs from fulls, the range is converted. restore = 0 gives a plain multi-scale Retinex. MSRCP accepts 8–16 bit integer gray, YUV, RGB and YCoCg without subsampling, MSRCR 8–16 bit integer RGB.
Sources
- VapourSynth-Retinex README
- Hybrid's tooltips