scharfis_brain
1st March 2005, 17:23
Some time ago I told, I would make a motion adaptive interlaced yuy2 <-> yv12 conversion.
after some little experiments, I was surprised, how easy that is:
#interlaced yuy2 to yv12
function yuy2toyv12_laced(clip i, int "th", bool "matchfields")
{ th=default(th,8)
matchfields=default(matchfields,false)
i.converttoyv12().mergechroma(
\ i.tdeint(mode=1,type=1,link=0,mthreshc=th,tryweave=matchfields,full=(matchfields==false)).converttoyv12().separatefields().selectevery(4,0,3).weave()
\)
}
#interlaced yv12 to yuy2
function yv12toyuy2_laced(clip i, int "th", bool "matchfields")
{ th=default(th,8)
matchfields=default(matchfields,false)
i.converttoyuy2().mergechroma(
\ i.tdeint(mode=1,type=1,mthreshc=th,tryweave=matchfields,full=(matchfields==false)).converttoyuy2().separatefields().selectevery(4,0,3).weave()
\)
}
yv12toyuy2_interlaced() does what its name says.
but it is better than a simple converttoyuy2(interlaced=true) in more than one reason:
- it produces better chroma detail in static areas (progressive chroma sampling!)
- it makes a ELA-based chroma-interlpolation for moving areas (the old method only does weighting)
- it produces much lesser chroma-flickering, when doing some sort of bob() afterwards.
after some little experiments, I was surprised, how easy that is:
#interlaced yuy2 to yv12
function yuy2toyv12_laced(clip i, int "th", bool "matchfields")
{ th=default(th,8)
matchfields=default(matchfields,false)
i.converttoyv12().mergechroma(
\ i.tdeint(mode=1,type=1,link=0,mthreshc=th,tryweave=matchfields,full=(matchfields==false)).converttoyv12().separatefields().selectevery(4,0,3).weave()
\)
}
#interlaced yv12 to yuy2
function yv12toyuy2_laced(clip i, int "th", bool "matchfields")
{ th=default(th,8)
matchfields=default(matchfields,false)
i.converttoyuy2().mergechroma(
\ i.tdeint(mode=1,type=1,mthreshc=th,tryweave=matchfields,full=(matchfields==false)).converttoyuy2().separatefields().selectevery(4,0,3).weave()
\)
}
yv12toyuy2_interlaced() does what its name says.
but it is better than a simple converttoyuy2(interlaced=true) in more than one reason:
- it produces better chroma detail in static areas (progressive chroma sampling!)
- it makes a ELA-based chroma-interlpolation for moving areas (the old method only does weighting)
- it produces much lesser chroma-flickering, when doing some sort of bob() afterwards.