Log in

View Full Version : Wrong 'U' Plane Row Size


MysteryX
9th July 2015, 06:07
I'm opening up a video like this
AviSource("Preview.avi", audio=false, pixel_type="YV12")

Then I'm debugging a filter. With a 288x352 video, in GetFrame, after calling
PVideoFrame src = child->GetFrame(n, env);

int Y = src->GetRowSize(0);
int U = src->GetRowSize(1);
int V = src->GetRowSize(2);

Y should be 252, U should be 176 and V should be 176, right?

It's actually returning Y=252, U=252, V=176!

Similarly, GetRowHeight gives Y=288, U=288, V=144

vi.pixel_type = -1610612728

Why does the U plane have the same size as the Y plane?

Gavino
9th July 2015, 08:29
int Y = src->GetRowSize(0);
int U = src->GetRowSize(1);
int V = src->GetRowSize(2);
As arguments to GetRowSize(), you should be using the named constants PLANAR_Y, PLANAR_U and PLANAR_V (whose values are actually 1, 2 and 4 - not 0, 1 and 2).

StainlessS
9th July 2015, 12:00
Perhaps the error is down to me, I wrote somewhere that PLANAR_Y equates to 0 instead of (1<<0), either way you should use PLANAR_Y etc as Gavino said.
Also, 252/2 == 126 not 176, presume typo.

vi.pixel_type = -1610612728

vi.pixel_type are bitflags, makes more sense if viewed as Hex.

MysteryX
9th July 2015, 18:29
Great that works