• Question

  • This sturcture of 16-bit (USHORT) values is mostly used for Background color seems to be loosly defined.  For example the Y value is a 16-bit value, yet documentaion implies 255 is max value and 235 would represent luminance for white.


    Thru experimantaion it appears the values for the USHORTs are really 8.8 fixed-point values, for example 0x0100 represents a value of 1.0  (and not 256).


    Is this the correct inturpretation?


    In other words, if black in desired it is usually specified by Y=16, Cb=Cr=128 in 8-bit versions of this structure, but its also documented as this in DXVADDI_AYUVSAMPLE16.

    The value that produced black seems to be Y = 16<<8 and  Cb=Cr=128 << 8

    Friday, June 13, 2008 7:24 AM


  • Yes, these are 16-bit values, so the range for luma should be x1000 (16 * 0x100) to 0xEB00 (235 * 0x100).


    If you have a recent Windows SDK, take a look at the DXVA2_VideoProc sample. Here's the relevant code:


    Code Snippet




    const D3DCOLOR yuv = RGBtoYUV(BACKGROUND_COLORS[g_BackgroundColor]);


    const BYTE Y = LOBYTE(HIWORD(yuv));

    const BYTE U = HIBYTE(LOWORD(yuv));

    const BYTE V = LOBYTE(LOWORD(yuv));


    DXVA2_AYUVSample16 color;


    color.Cr = V * 0x100;

    color.Cb = U * 0x100;

    color.Y = Y * 0x100;

    color.Alpha = 0xFFFF;


    return color;




    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2008 Microsoft Corporation. All rights reserved.

    Friday, June 13, 2008 11:24 PM