I think I found a better approach to this, using something more like stickboy's suggestion. When input is YV12, the function converts to YUY2. When input is YUY2 it converts back to YV12.
Code:
function TogglePlanar(clip c) {
c
wasYV12 = isYV12()
y = ConvertToYUY2()
u = UtoY()
u = Interleave(u,u).AssumeFieldBased().Weave().ConvertToYUY2()
v = VtoY()
v = Interleave(v,v).AssumeFieldBased().Weave().ConvertToYUY2()
(wasYV12) ? YToUV(u,v,y) : c.ConvertToYV12()
(GetParity(c)) ? AssumeTFF() : AssumeBFF()
}
So, in my case of GrapeSmoother (though it could be any YUY2-only filter)...
Code:
# usage example:
(isYV12) ? TogglePlanar().GrapeSmoother(30).TogglePlanar()
\ : GrapeSmoother(30)
I was surprised to see that Interleave(v,v).AssumeFieldBased().Weave() was a tiny bit faster than PointResize() ?? Thanks!