Avisynth DFM DeRainbow
Jump to navigation
Jump to search
DFM DeRainbow removes rainbows, the shimmering colour artefacts over fine patterns. It is a fairly slow script by Scintilla.
Filtering → Avisynth → DeRainbow

What it does
The script smooths the chroma over time (FluxSmooth) and blurs it. The result is blended into the picture only where an edge-sparing mask allows. The mask comes from the difference between the original and the smoothed chroma, combined with an MSharpen edge mask. Edges therefore keep their colour while the rainbow areas are cleaned.
Requirements
- Windows, CPU only.
- With Motion compensation on, the script also uses MVTools (shipped with Hybrid).
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Threshold | maskthresh | 0–255 | 10 | MSharpen threshold of the mask. Lower values enlarge the area where blurred chroma comes through (more edges are caught, but chroma can bleed or lose saturation). Set it as high as still catches the edges. |
| Motion compensation | mc | on/off | off | Smooths temporally along the motion (MVTools). Better on moving material, much slower. |
| Flux5 | use_Flux5framesT | on/off | off | Smooths over 5 frames instead of 3. |
| lower temporal influence | less_Temporal | on/off | off | Weaker temporal smoother on the Flux5 path: less rainbow is removed, less smearing occurs. Only available while Flux5 is on. |
| Show mask | mask | on/off | off | Shows the mask instead of the output. |
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:
# chroma denoising using DFM-DeRainbow # Converting from 10 to 8bit for DFMDeRainbow ConvertBits(8) DFMDeRainbow(interlaced=false) # Converting from 8 to 10bit for encoder ConvertBits(10)
How Hybrid calls it
- Hybrid loads masktools2, MSharpen (or vsMSharpen), the RemoveGrain family, a shared helper script and
DFMDeRainbow.avsi. MVTools is loaded only with Motion compensation. - The script works on 8-bit YV12, YV16, YV24 and YV411 only (no gray, no YUY2). Other bit depths are converted to 8 bit before the filter and back afterwards.
maskthresh,mask,mcanduse_Flux5framesTare only written when they differ from the defaults.less_Temporalis only written when Flux5 is on and the box is ticked.interlacedis always written: true unless the source is progressive. Interlaced sources are processed field by field.- DFM DeRainbow also offers the common options and can be added to the filter queue several times.
Background
- DFMDeRainbow.avsi was last updated on 2020-06-02. The third mask line is borrowed from Shodan's derainbower.
- The script lists MSharpen, MaskTools, FluxSmooth and Deen as requirements. Hybrid's copy adds the options for motion compensation, Flux5 and less temporal influence. Where available it prefers vsMSharpen (see vsMSharpen) over MSharpen (MSharpen).
- Users on Doom9 describe the script as old and recommend using it with a mask and motion compensation.
Sources
- The AviSynth+ documentation does not cover DFMDeRainbow.
- Header of the script
DFMDeRainbow.avsi - Hybrid's tooltips