Vapoursynth BiFrost

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

BiFrost is Fredrik Mellbin's temporal derainbower: it removes rainbows (cross-color shimmer in the chroma) by comparing each block's chroma with the neighbor frames, but only where the luma stands still.

Filtering → Vapoursynth → DeRainbow

BiFrost controls in Hybrid
BiFrost controls in Hybrid

What it does

The frame is split into blocks. A block whose luma changes less than Luma threshold counts as static; inside it, chroma that flickers by more than Variation between frames is treated as rainbow and replaced by the temporally stable chroma. Moving blocks keep their chroma. Because the decision is made per block, static parts of a frame are cleaned even when something else in it moves.

Settings

Control Parameter Range / values Hybrid default Meaning
Conservative mask conservative_mask on/off off On: only pixels detected as rainbow are processed. Off: pixels with rainbow above and below them are processed too.
Luma threshold luma_thresh 0.00 – 255.00 10 Blocks whose luma changes less than this count as static (8-bit scale).
Variation variation 1 – 255 5 How big a chroma change must be to count as rainbow; higher means fewer false detections (8-bit scale).
Block (x/y) blockx / blocky 4 – 254 (even) 4 / 4 Block size of the detection. Smaller follows the artifact more closely but detects more falsely; larger is steadier but misses small patches.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# rainbow removal using BiFrost
clip = core.bifrost.Bifrost(clip, interlaced=False)

How Hybrid calls it

  • BiFrost works on 8–16-bit integer YUV except 4:1:0 and 4:1:1; other formats are converted first.
  • Luma threshold and Variation are given on the 8-bit scale; the plugin scales them to the bit depth.
  • interlaced is always written from the scan type Hybrid uses for the clip; with interlaced content the plugin separates the fields, filters them and weaves them back.
  • The frame is padded to a multiple of the block size before the filter and cropped back afterwards.
  • No alternative clip is passed, so blocks that cannot be processed keep their own chroma.
  • Values are only written when they differ from the defaults.
  • BiFrost also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Block size

A block must be a multiple of the chroma subsampling and at least two chroma samples wide and tall, so 4:2:0 needs at least 4 in both directions and 4:2:2 at least 4 horizontally. Edges that do not fill a whole block stay unprocessed.

Versions

The old AviSynth BiFrost 1.1 processed the whole frame or nothing; the VapourSynth version works block by block. The README also explains how to tell whether rainbows were added before or after telecine: look at the separated fields.

Sources