Vapoursynth SRFComb2

From wiki.selur.net
Jump to navigation Jump to search

SRFComb2 is real.finder's filter against dot crawl and rainbowing in composite captures. It combines spatial cleaning inside comb masks with a motion-compensated degrain step.

Filtering → Vapoursynth → DeCrawl

SRFComb2 controls in Hybrid
SRFComb2 controls in Hybrid

What it does

Edge and comb masks are built from luma and chroma activity. Luma and chroma are cleaned spatially (FFT3D, bilateral smoothing, warp sharpening) and merged with a motion-compensated MDegrain1 result through a motion mask: still areas keep the degrain result, moving areas take the spatial result. Only pixels inside the comb masks change. With de-dot on, ContraSharpening can afterwards bring back detail lost in the degrain step. Interlaced sources are split into fields and woven back at the end.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold (Y/C) thsad / thsadc 0 – 64000 0 / 0 SAD thresholds of the degrain step for luma and chroma; higher cleans stronger over time with more risk of ghosting. 0 = script default: 700 for progressive, 500 for interlaced sources.
de-dot dedot on/off on Luma part: in moving areas use the spatially cleaned luma instead of the degrained one. Off keeps the degrained luma.
de-rainbow derainbow on/off on The same for chroma.
ContraSharp contrasharp on/off on ContraSharpening after the merge, to restore detail removed by degraining; only used (and enabled) with de-dot on.

Tools: MV (mvgpu, mvutensils, mv), Expr, Bilateral (vszip, vszipcl, vszipcu, vsfeel), Warp, RG, BoxBlur and FFT3D; TemporalSoften with de-dot or de-rainbow, and Median when de-dot and ContraSharp are both on.

Example

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

# adjusting color space from YUV420P10 to YUV444P8 for vsSRFComb2
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, dither_type="error_diffusion")
# anti decrawling / derainbow using SRFComb2
clip = derainbow.SRFComb2(clip, dedot=True, derainbow=True, progressive=True, tools={'mv': 'mvutensils', 'expr': 'akarin', 'bilateral': 'vszip', 'warp': 'awarp', 'rg': 'zsmooth', 'median': 'zsmooth', 'temporalsoften': 'zsmooth', 'boxblur': 'vszip', 'fft3d': 'neo_fft'})

How Hybrid calls it

  • SRFComb2 works on 8-bit YUV only; other formats are converted first.
  • The scan type Hybrid detected (or the one you set) tells the script whether the source is progressive.
  • de-dot and de-rainbow are always written, because the script's own defaults depend on the scan type; the thresholds are only written when not 0, ContraSharp only when off.
  • PAL is detected by the script from 25 fps.
  • With mvgpu (Vulkan) or the GPU bilateral backends parts of the work move to the GPU; otherwise it is a CPU filter.
  • SRFComb2 also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The original

real.finder wrote SRFComb2 for AviSynth (version 1.01, Doom9) as a successor of his SRFComb, with the same goal but a different approach; both live in SRFComb.avsi. In the original the spatial de-dot and de-rainbow switches default to on for progressive and off for interlaced sources. Hybrid uses a VapourSynth port.

Sources