From Avisynth wiki
Jump to: navigation, search

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()
       \ offset==1 ?
       \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields()
       \ offset==2 ?
       \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields()
       \ offset==3 ?
       \ interleave(clip.duplicateframe(0),clip.duplicateframe(0).layer(clip,"fast"))
       \ interleave(clip,clip.layer(clip.trim(1,0),"fast")).separatefields()
Personal tools