iOS/buildlibs/armv7/allegro-4.4.2/addons/jpgalleg/src/encode.c
/* _jpeg_c_rgb2ycbcr:
 *  C version of the RGB -> YCbCr color conversion routine. Converts 2 pixels
 *  at a time.
 */
C version of the RGB -> YCbCr color conversion routine. Converts 2 pixels
at a time.
C version of the RGB - > YCbCr color conversion routine . Converts 2 pixels at a time .
static void
_jpeg_c_rgb2ycbcr(intptr_t addr, short *y1, short *cb1, short *cr1, short *y2, short *cb2, short *cr2)
{
	int r, g, b;
	unsigned int *ptr = (unsigned int *)addr;
	r = getr32(ptr[0]);
	g = getg32(ptr[0]);
	b = getb32(ptr[0]);
	*y1 = (((r * 76) + (g * 151) + (b * 29)) >> 8) - 128;
	*cb1 = (((r * -43) + (g * -85) + (b * 128)) >> 8);
	*cr1 = (((r * 128) + (g * -107) + (b * -21)) >> 8);
	r = getr32(ptr[1]);
	g = getg32(ptr[1]);
	b = getb32(ptr[1]);
	*y2 = (((r * 76) + (g * 151) + (b * 29)) >> 8) - 128;
	*cb2 = (((r * -43) + (g * -85) + (b * 128)) >> 8);
	*cr2 = (((r * 128) + (g * -107) + (b * -21)) >> 8);
}
static void _jpeg_c_rgb2ycbcr ( intptr_t addr , short * y1 , short * cb1 , short * cr1 , short * y2 , short * cb2 , short * cr2 ) { int r , g , b ; unsigned int * ptr = ( unsigned int * ) addr ; r = getr32 ( ptr [ 0 ] ) ; g = getg32 ( ptr [ 0 ] ) ; b = getb32 ( ptr [ 0 ] ) ; * y1 = ( ( ( r * 76 ) + ( g * 151 ) + ( b * 29 ) ) >> 8 ) - 128 ; * cb1 = ( ( ( r * -43 ) + ( g * -85 ) + ( b * 128 ) ) >> 8 ) ; * cr1 = ( ( ( r * 128 ) + ( g * -107 ) + ( b * -21 ) ) >> 8 ) ; r = getr32 ( ptr [ 1 ] ) ; g = getg32 ( ptr [ 1 ] ) ; b = getb32 ( ptr [ 1 ] ) ; * y2 = ( ( ( r * 76 ) + ( g * 151 ) + ( b * 29 ) ) >> 8 ) - 128 ; * cb2 = ( ( ( r * -43 ) + ( g * -85 ) + ( b * 128 ) ) >> 8 ) ; * cr2 = ( ( ( r * 128 ) + ( g * -107 ) + ( b * -21 ) ) >> 8 ) ; }
_jpeg_c_rgb2ycbcr:
  C version of the RGB -> YCbCr color conversion routine.
_jpeg_c_rgb2ycbcr : C version of the RGB - > YCbCr color conversion routine .