Avisynth DFM DeRainbow

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

DFM DeRainbow removes rainbows, the shimmering colour artefacts over fine patterns. It is a fairly slow script by Scintilla.

Filtering → Avisynth → DeRainbow

DFM DeRainbow controls in Hybrid
DFM DeRainbow controls in Hybrid

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, mc and use_Flux5framesT are only written when they differ from the defaults. less_Temporal is only written when Flux5 is on and the box is ticked.
  • interlaced is 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.

See also: DeRainbow, BiFrost

Sources

  • The AviSynth+ documentation does not cover DFMDeRainbow.
  • Header of the script DFMDeRainbow.avsi
  • Hybrid's tooltips