function PointConvertToYUY2(clip input, bool "silent", bool "subwarn") { silent = Default(silent, false) # stfu and convert anyway if input isn't YV12 subwarn = Default(subwarn, false) # Display warning on the video instead of throwing an error input.GreyScale() y1 = last try { input.UToY() u1 = last input.VToY() v1 = last } catch(err_msg) { input.ConvertToYV12.UToY() u1 = last input.ConvertToYV12.VToY() v1 = last } y1 ConvertToYUY2() y2 = last u1.PointResize(u1.width, u1.height*2) ConvertToYUY2() u2 = last v1.PointResize(v1.width, v1.height*2) ConvertToYUY2() v2 = last YToUV(u2, v2, y2) output1 = last input.ConvertToYUY2() output2 = last output2.Subtitle("Warning! input isn't YV12!") subtitled = last quiet = output2 verbose = subwarn ? subtitled : output1 silent ? Nop() : subwarn ? Nop() : Assert(input.IsYV12(), "What's the use of pointresizing \ chroma if input isn't YV12, f00") return silent ? quiet : verbose } function PointConvertToYV12(clip input, bool "silent") { silent = Default(silent, false) # stfu and convert anyway if input is YV12 input.BilinearResize(input.width*2, input.height*2) ConvertToYV12() big = last input.ConvertToYV12().GreyScale() y = last big.UToY() PointResize(input.width/2, input.height/2) u = last big.VToY() PointResize(input.width/2, input.height/2) v = last YToUV(u, v, y) converted = last isnotyv12 = input.IsYV12() ? false : true silent ? Assert(isnotyv12, "Input is YV12, you're doing a useless conversion. Set silent=true \ to get rid of this msg.") : nop() return converted }