IvtcBlend
From Avisynth wiki
When a film clip is converted to 29.97fps video for NTSC broadcast, some of the fields are repeated. The "fast" mode of Layer allows for a very simple blend of two supposedly-identical sources, raising the effective S/N ratio. Put these two facts together and you have an IvtcBlend function; the effect is subtle at best on clean sources, and its method deserves a properly generalized plugin for dirty ones, but in the meantime it provides an interesting look at the power of AviSynth.
(of course, one could also argue it demonstrates the necessity for a proper if/then construct :))
function ivtcblend(clip clip, int offset, int "parity") { assert(offset>=0 && offset<=4, "Offset must be 0 - 4") clip=(default(parity,0)==1 ? clip.complementparity():clip) return(offset==0 ? \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields() \.selectevery(20,4,1,8,7,12,13,18,17).weave(): \ offset==1 ? \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields() \.selectevery(20,2,1,8,5,12,11,16,17).weave(): \ offset==2 ? \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields() \.selectevery(20,0,1,6,5,12,9,16,15).weave(): \ offset==3 ? \ interleave(clip.duplicateframe(0),clip.duplicateframe(0).layer(clip,"fast")) \.separatefields().selectevery(20,4,3,8,9,14,13,17,20).weave(): \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields() \.selectevery(20,4,3,8,9,14,13,17,20).weave()) }