View Full Version : Conditional Filter with YUY2?


rec
15th July 2012, 22:42
I'm using the function 'YDifferenceFromPrevious' in the conditional filter, and I would like to keep the YUY2 color space of the original clip. But 'YDifferenceFromPrevious' will only work with YV12. Is there any way around this?

Thanks!

StainlessS
16th July 2012, 03:24
Find here a temp plugin YDiffRelative:
EDIT: LINK DELETED

It has not undergone much testing, only knocked it up in about 20 mins, based on
"Simple Runtime Filter" in development forum.


YDiffRelative(clip, int "n"=current_frame, int "delta"=1,int "matrix"=0)

Planar, YUY2, RGB24, RGB32



As for YDifferenceToNext, YDifferenceFromPrevious

int n, defaults to 'current_frame' but could supply frame direct.

int delta, default 1, relative to arg n frame (as YDifferenceToNext,
use eg -1 for YDifferenceFromPrevious)

int matrix, default=0
0=rec601, 1=rec709, 2=pc601, 3=pc709
Used for RGB to convert internally to luma.

EDIT: A delta of 0 will immediately return 0.0, you would be comparing from 'n' with frame 'n'.


So now you can continue to keep you exact requirements and script a secret
and nobody on Doom9 need ever know what is was that you actually wanted. :)

jmac698
16th July 2012, 04:27
Or the easy way is to double the height, and convert to yv12.

pointresize(last.width,last.height*2).converttoyv12

and convert back again when done

IanB
16th July 2012, 22:55
Seeing rec just wants YDifferenceFromPrevious there is no need for any frame contortions, the luma data is the same in all yuv formats.

And as YDifferenceFromPrevious does not return any clip data only the difference value. You do not need to convert the original clip, just the comparison.
clip = AviSource("c:\file.avi") # YUY2 source
ScriptClip(clip, "Subtitle(String(ConvertToY8().YDifferenceFromPrevious))")
# Subtitled YUY2 return clipor ConvertToYV12() for a 2.5 version. Use UtoY8().YDifferenceFromPrevious to simulate UDifferenceFromPrevious with YUY2 data and similarly VtoY8.....