wined3d: Add surface conversion function from WINED3DFMT_YUY2 to WINED3DFMT_B8G8R8X8_UNORM
Stefan Dösinger
stefandoesinger at gmx.at
Wed Feb 10 04:18:37 CST 2010
Am 09.02.2010 um 18:11 schrieb Sandijs Ribaks:
> This is a patch for http://bugs.winehq.org/show_bug.cgi?id=21629 .
It seems ok in concept, just a few points:
> +static void convert_yuy2_x8r8g8b8(const BYTE *src, BYTE *dst,
> + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
> ...
> + const BYTE *src_line = (const BYTE *)(src + y * pitch_in);
The cast here is redundant
> + if (!(x & 1)) { /* for every even pixel, read new U and V */
The placement of the { is inconsistent with the rest of the patch.
> + dst_line[x] = 0xff000000
> + | cliptobyte((c2 + r2) >> 8) << 16 /* red */
> + | cliptobyte((c2 + g2) >> 8) << 8 /* green */
> + | cliptobyte((c2 + b2) >> 8); /* blue */
I recommend to add a comment explaining that (x >> 8) << 8 is not redundant but in used to mask out lower bits.
Just to make sure I understand this correctly:
> + r2 = 409 * e + 128;
> + g2 = - 100 * d - 208 * e + 128;
> + b2 = 516 * d + 128;
The +128 here is for proper rounding in the right shift step afterwards?
More information about the wine-devel
mailing list