http://bugs.winehq.org/show_bug.cgi?id=25807
--- Comment #3 from Ludio ljerabek@cox.net 2011-01-23 22:40:19 CST --- (In reply to comment #1)
Take a look at convert_yuy2_x8r8g8b8(), YV12 is conceptually similar, but the location of the YUV components within the surface is different.
I was able to display Y (black and white) however U and V since I am unfamiliar with the YV12 byte stream I am unsure of where U and V are within the stream.
unsigned int x, y;
int C; // Y' - 16 = C int D; // U - 128 = D int E; // V - 128 = E
int R = 0; // Red int G = 0; // Green int B = 0; // Blue
for (y = 0; y < h; ++y) { const BYTE *src_line = src + y * pitch_in; DWORD *dst_line = (DWORD *)(dst + y * pitch_out); for (x = 0; x < w; ++x) { C = (int)src_line[0] - 16; // Y' - 16 = C // Set E and D 0 E = 0;//(int)src_line[(pitch_in)>>2] - 128; D = 0;//(int)src_line[(pitch_in)>>2] - 128; // Red R = 298 * C + 409 * E + 128; // Green G = 298 * C - 100 * D - 208 * E + 128; // Blue B = 298 * C + 516 * D + 128;
dst_line[x] = 0xFF000000 | cliptobyte(R >> 8) << 16 | cliptobyte(G >> 8) << 8 | cliptobyte(B >> 8);
src_line += 1; } }