Vapoursynth ChubbyRain2: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
New filter page (via create-page on MediaWiki MCP Server)
 
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
Line 7: Line 7:


== What it does ==
== What it does ==
The U and V planes are checked for vertical ripple; where the summed response exceeds ''Threshold'', the pixel counts as rainbow, and the mask is grown a little. A cleaned clip is built by a vertical blur, [[Vapoursynth BiFrost|BiFrost]], [[Vapoursynth Cnr4|Cnr4]] chroma noise reduction and a temporal chroma softening that respects scene changes. Only inside the mask is the cleaned clip used; everything outside stays untouched.
The U and V planes are checked for vertical ripple; where the summed response exceeds ''Threshold'', the pixel counts as rainbow, and the mask is grown a little. A cleaned clip is built by a vertical blur, [[Vapoursynth BiFrost|BiFrost]], [[Vapoursynth Cnr4|Cnr4]] chroma noise reduction and a temporal chroma softening that respects scene changes. Only inside the mask the chroma of the cleaned clip is used; luma stays untouched everywhere, and so does the chroma outside the mask.


== Settings ==
== Settings ==
Line 32: Line 32:
== Example ==
== Example ==
Default settings on a 10-bit YUV 4:2:0 source (640x356):
Default settings on a 10-bit YUV 4:2:0 source (640x356):
<syntaxhighlight lang="python">
<pre>
# rainbow removal using ChubbyRain2
# rainbow removal using ChubbyRain2
clip = derainbow.ChubbyRain2(clip, interlaced=False, tools={'expr': 'akarin', 'rg': 'zsmooth', 'temporalsoften': 'zsmooth', 'scd': 'scd', 'cnr': 'zsmooth'})
clip = derainbow.ChubbyRain2(clip, interlaced=False, tools={'expr': 'akarin', 'rg': 'zsmooth', 'temporalsoften': 'zsmooth', 'scd': 'scd', 'cnr': 'zsmooth'})
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:48, 16 November 2026

ChubbyRain2 is a mask-based rainbow remover: it finds vertical chroma ripple and replaces the chroma only there with a cleaned version.

Filtering → Vapoursynth → DeRainbow

ChubbyRain2 controls in Hybrid
ChubbyRain2 controls in Hybrid

What it does

The U and V planes are checked for vertical ripple; where the summed response exceeds Threshold, the pixel counts as rainbow, and the mask is grown a little. A cleaned clip is built by a vertical blur, BiFrost, Cnr4 chroma noise reduction and a temporal chroma softening that respects scene changes. Only inside the mask the chroma of the cleaned clip is used; luma stays untouched everywhere, and so does the chroma outside the mask.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold th 0 – 255 10 How strong the vertical U+V ripple must be before a pixel counts as rainbow; lower treats more pixels (8-bit scale).
Radius radius 1 – 10 10 Frames on each side used by the temporal chroma softening.
Soft threshold sft 1 – 255 10 Largest chroma difference the temporal softening still averages over.
Show mask show on/off off Outputs the detection mask instead of the result, to tune the threshold.
Tools: Expr – akarin, std akarin Expression evaluator; akarin needs an AVX2 CPU.
Tools: Cnr – zsmooth, neo_smo zsmooth Implementation of the chroma noise reduction.
Tools: SCD – scd, misc, std, mv scd Scene change detection for Cnr4 and the softening; misc is Windows only.
Tools: TemporalSoften – zsmooth, focus2 zsmooth Implementation of the temporal softening; focus2 is offered only while Radius is 7 or less.

Example

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

# rainbow removal using ChubbyRain2
clip = derainbow.ChubbyRain2(clip, interlaced=False, tools={'expr': 'akarin', 'rg': 'zsmooth', 'temporalsoften': 'zsmooth', 'scd': 'scd', 'cnr': 'zsmooth'})

How Hybrid calls it

  • ChubbyRain2 works on 8, 10, 12 and 16-bit integer YUV except 4:1:0 and 4:1:1; other formats are converted first.
  • interlaced is always written from the scan type; interlaced content is split into fields, filtered and woven back.
  • Threshold is scaled to the bit depth by the script; with zsmooth the soft threshold is scaled by the plugin.
  • Values are only written when they differ from the defaults.
  • ChubbyRain2 also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

ChubbyRain2 is a VapourSynth port of the AviSynth script of the same name. The Cnr4 settings reproduce the Cnr2 defaults of the original; the old Cnr2 and TemporalSoften plugins are only used as fallbacks when zsmooth is missing.

Sources