Log in

View Full Version : Overlay and YV24


TheSkiller
22nd February 2012, 20:57
Hey guys,

I'm having a problem with Overlay when using YV24 color space.
Instead of a clean overlay without any transparency I get a half-opaque overlay and weird colors.
This behaviour only arises if the base clip is YV24, if it is in any other color space it works as expected, even with YV24 overlay clips.

I'm using 2.6, build Sep 13 2011 and SEt's MT.


Here's a script to recreate the problem:


Colorbars(pixel_type="YUY2").ConverttoYV24()

b=Colorbars(pixel_type="YUY2", width=320, height=240).ConverttoYV24()


Overlay(last, b, x=160, y=32, opacity=1)

ConverttoRGB() #for viewing

Also, as a side note, generating the color bars in YV24 via pixel_type crashes on me without an error message.

IanB
22nd February 2012, 23:05
Oops, Overlay does not ensure the input frame is writeable. Colorbars uses a single static frame, which of course is always in use, so the "frame->GetWritePtr(PLANAR_Y)" will return NULL....
196 PVideoFrame __stdcall Overlay::GetFrame(int n, IScriptEnvironment *env) {
197
198 FetchConditionals(env);
199
200 // Fetch current frame and convert it.
201 PVideoFrame frame = child->GetFrame(n, env);
202 if (vi.IsYV24() && inputCS == vi.pixel_type) { // Fast path
203 // This will be used to avoid two unneeded blits if input and output is yv24
204 // Note however, that this will break, if for some reason AviSynth in the future
205 // will choose different alignment on YV24 planes.
206 if (img)
207 delete img;
208 img = new Image444(frame->GetWritePtr(PLANAR_Y), frame->GetWritePtr(PLANAR_U), frame->GetWritePtr(PLANAR_U),
209 frame->GetRowSize(PLANAR_Y), frame->GetHeight(PLANAR_Y), frame->GetPitch(PLANAR_Y));
210 } else {
...Fix scheduled.