[Bug 25807] Cant convert from WINED3DFMT_YV12 to WINED3DFMT_B8G8R8X8_UNORM

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Jan 23 22:40:20 CST 2011


http://bugs.winehq.org/show_bug.cgi?id=25807

--- Comment #3 from Ludio <ljerabek at 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;
    }
    }

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list