PDA

View Full Version : YV12 channel order


everwicked
10th September 2004, 19:00
Hey everyone,

I did some changes in VQStudio so that it can process YV12 directly but the channels seem to be ordered differently than in compareyv12().

It would seem that the U and V channels are swapped specifically. Now, I tried to do some testing to make sure that my methods are correct:
- YV12 is processed Y - U - V
- I converted to RGB and blitted - the image seems to be correct

Is there any chance there is a mixup in compareyv12()?

The version of VQStudio that produces this is at http://www.everwicked.com/tmp/objective-20040910.zip if you wanted to have a test.

Thanks,
everwicked

Wilbert
10th September 2004, 21:23
Dunno whether compareyv12() is doing something wrong. But the planes in YV12 are stored in the following order: Y, V and U.

everwicked
11th September 2004, 00:50
In that case i am reading it wrong.

Which also means that my YUV -> RGB coeffs are wrong. Weird.

everwicked
11th September 2004, 01:16
I use

R = 1.164(Y - 16) + 1.596(V - 128)
B = 1.164(Y - 16) + 2.018(U - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)

to do the conversion and with YVU order assumed (as fourcc.org suggests).

Decoded image at http://www.everwicked.com/tmp/Image1.jpg

everwicked
11th September 2004, 01:41
Nevermind, Win32 assumes BGR order which I had forgotten.

Thanks.

IanB
13th September 2004, 02:46
Dear all,

When coding up plugins don't forget Avisynth also supports I420 format as YV12 with a pointer flip to swap the U and V planes. Always use GetReadPtr/GetWritePtr(PLANAR_U/PLANAR_V) to get the chroma planes never assume memory layout.

IanB