camera/yuv2rgb.c
static int yuyv_to_rgbmodel(VidFrame *src,VidFrame *dest,unsigned int rgbModel[]) {
	int w=vidFrameGetWidth(src);
	int h=vidFrameGetHeight(src);
	
	unsigned int channel[3];
	unsigned char *s,*d;
	unsigned char y,u,v;
	int i,j;
	
	dest->bytesperline = w * 3;
	
	d = vidFrameGetImageData(dest);
	s = vidFrameGetImageData(src);
	
	for (i=0;i<h;i++) {
		for (j=0;j<w;j+=2) {
			y = s[0]; u=s[1]; v= s[3];
			
			channel[0] = R( y , v);
			channel[1] = G( y,u,v);
			channel[2] = B(y,u);
			
			*(d++) = channel[ rgbModel[0] ];
			*(d++) = channel[ rgbModel[1]];
			*(d++)  = channel[rgbModel[2]];
			
			y = s[2];
			
			channel[0] = R( y , v);
			channel[1] = G( y,u,v);
			channel[2] = B(y,u);
			
			*(d++) = channel[ rgbModel[0] ];
			*(d++) = channel[ rgbModel[1]];
			*(d++)  = channel[rgbModel[2]];
			s+=4;
		}
		
	}
	
	return 0;
}
/**
 * yuyv_to_rgbmodel:
 * @param frame The source video frame
 * @param dest The destination buffer. (It must be large enough to hold the final image)
 * @param rgbModel: An array to describe the order of 'R','G','B" color model.
 *  Convert a YUV420/YU12 pixel into RGB24|BGR24
 *
 *  YUYV Pixel Format: [Y0 U0 Y1 V0 ] [ Y2 U2 Y3 V2 ] .... 
 */
@param frame The source video frame
@param dest The destination buffer.


@param frame The source video frame @param dest The destination buffer .
static int yuyv_to_rgbmodel(VidFrame *src,VidFrame *dest,unsigned int rgbModel[]) {
	int w=vidFrameGetWidth(src);
	int h=vidFrameGetHeight(src);
	unsigned int channel[3];
	unsigned char *s,*d;
	unsigned char y,u,v;
	int i,j;
	dest->bytesperline = w * 3;
	d = vidFrameGetImageData(dest);
	s = vidFrameGetImageData(src);
	for (i=0;i<h;i++) {
		for (j=0;j<w;j+=2) {
			y = s[0]; u=s[1]; v= s[3];
			channel[0] = R( y , v);
			channel[1] = G( y,u,v);
			channel[2] = B(y,u);
			*(d++) = channel[ rgbModel[0] ];
			*(d++) = channel[ rgbModel[1]];
			*(d++)  = channel[rgbModel[2]];
			y = s[2];
			channel[0] = R( y , v);
			channel[1] = G( y,u,v);
			channel[2] = B(y,u);
			*(d++) = channel[ rgbModel[0] ];
			*(d++) = channel[ rgbModel[1]];
			*(d++)  = channel[rgbModel[2]];
			s+=4;
		}
	}
	return 0;
}
static int yuyv_to_rgbmodel ( VidFrame * src , VidFrame * dest , unsigned int rgbModel [ ] ) { int w = vidFrameGetWidth ( src ) ; int h = vidFrameGetHeight ( src ) ; unsigned int channel [ 3 ] ; unsigned char * s , * d ; unsigned char y , u , v ; int i , j ; dest -> bytesperline = w * 3 ; d = vidFrameGetImageData ( dest ) ; s = vidFrameGetImageData ( src ) ; for ( i = 0 ; i < h ; i ++ ) { for ( j = 0 ; j < w ; j += 2 ) { y = s [ 0 ] ; u = s [ 1 ] ; v = s [ 3 ] ; channel [ 0 ] = R ( y , v ) ; channel [ 1 ] = G ( y , u , v ) ; channel [ 2 ] = B ( y , u ) ; * ( d ++ ) = channel [ rgbModel [ 0 ] ] ; * ( d ++ ) = channel [ rgbModel [ 1 ] ] ; * ( d ++ ) = channel [ rgbModel [ 2 ] ] ; y = s [ 2 ] ; channel [ 0 ] = R ( y , v ) ; channel [ 1 ] = G ( y , u , v ) ; channel [ 2 ] = B ( y , u ) ; * ( d ++ ) = channel [ rgbModel [ 0 ] ] ; * ( d ++ ) = channel [ rgbModel [ 1 ] ] ; * ( d ++ ) = channel [ rgbModel [ 2 ] ] ; s += 4 ; } } return 0 ; }
yuyv_to_rgbmodel:
 @param frame The source video frame
 @param dest The destination buffer.
yuyv_to_rgbmodel : @param frame The source video frame @param dest The destination buffer .