kernels/linux-2.4.0/drivers/usb/ov511.c
/*
 * fixFrameRGBoffset--
 * My camera seems to return the red channel about 1 pixel
 * low, and the blue channel about 1 pixel high. After YUV->RGB
 * conversion, we can correct this easily. OSL 2/24/2000.
 */
fixFrameRGBoffset
My camera seems to return the red channel about 1 pixel
low, and the blue channel about 1 pixel high. After YUV->RGB
conversion, we can correct this easily.
fixFrameRGBoffset My camera seems to return the red channel about 1 pixel low and the blue channel about 1 pixel high . After YUV - > RGB conversion we can correct this easily .
static void fixFrameRGBoffset(struct ov511_frame *frame)
{
	int x, y;
	int rowBytes = frame->width*3, w = frame->width;
	unsigned char *rgb = frame->data;
	const int shift = 1;  
	if (frame->width < 400) 
		return;
	for (y = shift; y < frame->height; y++)	{
		int lp = (y-shift)*rowBytes;     
		int lc = y*rowBytes;             
		for (x = 0; x < w; x++)
			rgb[lp+x*3+2] = rgb[lc+x*3+2]; 
	}
	for (y = frame->height-shift-1; y >= 0; y--) {
		int ln = (y + shift) * rowBytes;  
		int lc = y * rowBytes;            
		for (x = 0; x < w; x++)
			rgb[ln+x*3+0] = rgb[lc+x*3+0]; 
	}
}
static void fixFrameRGBoffset ( struct ov511_frame * frame ) { int x , y ; int rowBytes = frame -> width * 3 , w = frame -> width ; unsigned char * rgb = frame -> data ; const int shift = 1 ; if ( frame -> width < 400 ) return ; for ( y = shift ; y < frame -> height ; y ++ ) { int lp = ( y - shift ) * rowBytes ; int lc = y * rowBytes ; for ( x = 0 ; x < w ; x ++ ) rgb [ lp + x * 3 + 2 ] = rgb [ lc + x * 3 + 2 ] ; } for ( y = frame -> height - shift - 1 ; y >= 0 ; y -- ) { int ln = ( y + shift ) * rowBytes ; int lc = y * rowBytes ; for ( x = 0 ; x < w ; x ++ ) rgb [ ln + x * 3 + 0 ] = rgb [ lc + x * 3 + 0 ] ; } }
fixFrameRGBoffset
 My camera seems to return the red channel about 1 pixel
 low, and the blue channel about 1 pixel high.
fixFrameRGBoffset My camera seems to return the red channel about 1 pixel low and the blue channel about 1 pixel high .
/* Distance to shift pixels by, vertically */ /* Don't bother with little images */ /* Shift red channel up */ /* Previous line offset */ /* Current line offset */ /* Shift red up */ /* Shift blue channel down */ /* Next line offset */ /* Current line offset */ /* Shift blue down */