Removing Rainbow effects and dot crawls

1. Preface

Rainbows are caused by imperfect separation of the luma and chroma components of a composite video signal. This effect is called color crosstalk, and is a special case of signal aliasing. It is most noticeable on computer generated images like subtitles, weather maps, and stationary logos. Whenever you have an edge (= high frequencies) in luma, you have rainbows, even faint. Whenever you have a great change in chroma (typically logos), you have dot crawls. Have a look at the following snapshots:

There are two kinds of chroma noise in this picture. The first one is some bright coloring around the text of the book and around the time (chroma noise around edges). These are typical examples of rainbows. The second one is the ugly thick red/yellow horizontal lines on the skin of the girl. Although this is also chroma noise (I have no idea what caused it), it is not a rainbow effect. In the following section we will see what AviSynth has to offer to remove those examples of chroma noise.

This is a typical example of dot crawls, i.e. dots/pixels which are crawling over your picture. But here, there is motion in the area of the dot crawls (of course, you can only see that when looking at the complete clip). There is no filter known to me which can get rid of those dot crawls in this case. There is an AviSynth plugin called GuavaComb which can get rid of dot crawls in static scenes (since it only uses temporal information).

A bit more techanical explanation (if you don't care, please proceed with the next section):
The NTSC system uses the YIQ format (PAL: YUV), where "Y" is the luma (or brightness) component and "IQ"/"UV" the chroma (or color) component (also denoted as "C"). The IQ plane is just a rotation of the UV plane. Whether you might experience rainbow effects or dot crawls depends on the video signal format you use:

PAL and NTSC should be treaten differently when reducing rainbows, because NTSC has a 4 field period, and PAL an 8 field period. But I don't understand this yet, so I can't give an explanantion :(

References:
TV Comb Filters: For a general presentation of comb filters.
Video Color Resolution: Semitechnical explanation of I and Q versus U and V.
Charles Poyton's ColorFAQ: ColorFAQ including the conversion formulas between IQ and UV (page 17).
Bt868/Bt869 digital video encoders: Look up page 17 of datasheet 100119a.pdf (which handles Y/C separation and chroma demodulation for cards with the Bt868/9 chip).
Composite, S-video and Component signals: A few words about the differences between the video signals formats.

2. AviSynth v2.0x / AviSynth v2.5x / GordianKnot Usage

At the moment of writing there is only one good filter which can get rid of rainbow effects: GuavaComb. But the limitation is, that it only does so in static scenes.

Let's have a look again at the first picture. The following script is used:

LoadPlugin("c:\Program Files\AviSynth2_temp\plugins\guavacomb.dll")
Import("e:\Guides\AnalogCaptureGuide\Rainbow\mfRainbow.avs")

AviSource("e:\Guides\AnalogCaptureGuide\Rainbow\xvid.avi")
ConvertToYUY2(interlaced=true)
GuavaComb(Mode = "PAL", Recall = 83, MaxVariation = 25, Activation = 40)  # requires YUY2
ComplementParity()  # deinterlacing process
FieldDeinterlace(full=false, threshold=15, dthreshold=9, blend=false)  # deinterlacing process
ConvertToYV12()
mfRainbow()  # requires YV12

The result is as follows

The ugly thick red/yellow horizontal lines are completely smoothed out using the mfRainbow filter. This filter procudes better results than other plugins which smooth the chroma, like Cnr2 and SmoothUV. The rainbow on the timer is removed using GuavaComb (the rainbow on the book is still there, as can be checked by subtracting the filtered clip from the original clip). Removal of rainbows and dot crawls should happen before any deinterlacing (because it can mess up the interlace patterns).

Let's consider a different example:

The following script is used to reduce the rainbows:

LoadPlugin("C:\Program Files\AviSynth2_temp\plugins\guavacomb.dll")
AviSource("e:\Guides\AnalogCaptureGuide\Rainbow\devils_advocate_pal_2.avi")
GuavaComb(Mode = "PAL", Recall = 75, MaxVariation = 25, Activation = 40)

The result is as follows (the Recall value is lowered a bit, since this decides just how far back into the past the Guava will look in order to confirm that there’s really some shimmering going on).

In this example the rainbows started to disappear at frame 17 (the picture above is frame 21).

Proceed with the AviSynth post processing guide.

References:
mfRainbow script: at avisynth.org. It used the external plugins: Deen, MaskTools and MSmooth.


Back to VirtualDub postprocessing: <BACK>

Back to AviSynth postprocessing: <BACK>

Back to the Index: <HOME>


Last edited on: 09/18/2003 | First release: n/a | Author: Wilbert | Content by doom9.org