fixed: RGBtoYUV switched red and blue

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@251 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2007-12-31 13:20:01 +00:00
parent 7d1d78cd9a
commit 2ef7d60489
1 changed files with 5 additions and 5 deletions

View File

@ -239,18 +239,18 @@ inline unsigned int RGBtoYUV_32( unsigned int c )
// Division through 3 slows down the emulation about 10% !!! // Division through 3 slows down the emulation about 10% !!!
register unsigned char r, g, b; register unsigned char r, g, b;
r = ( c & 0x000000FF ); b = c & 0x0000FF;
g = ( c & 0x0000FF00 ) >> 8; g = ( c & 0x00FF00 ) >> 8;
b = ( c & 0x00FF0000 ) >> 16; r = c & >> 16;
return ( (r + g + b) << 14 ) + return ( (r + g + b) << 14 ) +
( ( r - b + 512 ) << 4 ) + ( ( r - b + 512 ) << 4 ) +
( ( 2*g - r - b ) >> 3 ) + 128; ( ( 2*g - r - b ) >> 3 ) + 128;
// unoptimized: // unoptimized:
//unsigned char r, g, b, Y, u, v; //unsigned char r, g, b, Y, u, v;
//r = (c & 0x000000FF); //b = (c & 0x000000FF);
//g = (c & 0x0000FF00) >> 8; //g = (c & 0x0000FF00) >> 8;
//b = (c & 0x00FF0000) >> 16; //r = (c & 0x00FF0000) >> 16;
//Y = (r + g + b) >> 2; //Y = (r + g + b) >> 2;
//u = 128 + ((r - b) >> 2); //u = 128 + ((r - b) >> 2);
//v = 128 + ((-r + 2*g -b)>>3); //v = 128 + ((-r + 2*g -b)>>3);