home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Kasumi / source / uberblit_ycbcr_x86.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  1.5 KB  |  36 lines

  1. #include "uberblit_ycbcr_x86.h"
  2.  
  3. extern "C" void vdasm_pixblt_XRGB8888_to_YUV444Planar_scan_SSE2(void *dstY, void *dstCb, void *dstCr, const void *srcRGB, uint32 count, const void *coeffs);
  4.  
  5. void VDPixmapGenRGB32ToYCbCr601_SSE2::Compute(void *dst0, sint32 y) {
  6.     uint8 *dstCb = (uint8 *)dst0;
  7.     uint8 *dstY = dstCb + mWindowPitch;
  8.     uint8 *dstCr = dstY + mWindowPitch;
  9.     const uint8 *srcRGB = (const uint8 *)mpSrc->GetRow(y, mSrcIndex);
  10.  
  11.     static const __declspec(align(16)) struct {
  12.         sint16 rb_to_y[8];
  13.         sint16 rb_to_cb[8];
  14.         sint16 rb_to_cr[8];
  15.         sint16 g_to_y[8];
  16.         sint16 g_to_cb[8];
  17.         sint16 g_to_cr[8];
  18.         sint32 y_bias[4];
  19.         sint32 c_bias[4];
  20.     } kCoeffs={
  21.     //    Cb = (28784*r - 24103*g -  4681*b + 8388608 + 32768) >> 16;
  22.     //    Y  = (16829*r + 33039*g +  6416*b + 1048576 + 32768) >> 16;
  23.     //    Cr = (-9714*r - 19071*g + 28784*b + 8388608 + 32768) >> 16;
  24.         {   3208,  8414,   3208,  8414,   3208,  8414,   3208,  8414, },        // rb to y
  25.         {  -2340, 14392,  -2340, 14392,  -2340, 14392,  -2340, 14392, },        // rb to cb
  26.         {  16519,     0,  16519,     0,  16519,     0,  16519,     0, },        // g to y
  27.         { -12050,     0, -12050,     0, -12050,     0, -12050,     0, },        // g to cb
  28.         {  14392, -4857,  14392, -4857,  14392, -4857,  14392, -4857, },        // rb to cr
  29.         {  -9535,     0,  -9535,     0,  -9535,     0,  -9535,     0, },        // g to cr
  30.         { 0x084000, 0x084000, 0x084000, 0x084000, },    // y bias
  31.         { 0x404000, 0x404000, 0x404000, 0x404000, },    // c bias
  32.     };
  33.  
  34.     vdasm_pixblt_XRGB8888_to_YUV444Planar_scan_SSE2(dstY, dstCb, dstCr, srcRGB, mWidth, &kCoeffs);
  35. }
  36.