23void convertYUYVtoRGB24(
unsigned int w,
unsigned int h,
unsigned char const * srcptr,
unsigned char * dstptr)
26 const int K1 = (int)(1.402f * (1 << 16));
27 const int K2 = (int)(0.714f * (1 << 16));
28 const int K3 = (int)(0.334f * (1 << 16));
29 const int K4 = (int)(1.772f * (1 << 16));
30 const unsigned int pitch = w * 2;
35 for (y = 0; y <
h; ++y)
37 for (x = 0; x < pitch; x += 4)
39 Y1 = *srcptr++; uf = *srcptr++ - 128; Y2 = *srcptr++; vf = *srcptr++ - 128;
41 R = Y1 + (K1 * vf >> 16);
42 G = Y1 - (K2 * vf >> 16) - (K3 * uf >> 16);
43 B = Y1 + (K4 * uf >> 16);
45 *dstptr++ = (
unsigned char)(R); *dstptr++ = (
unsigned char)(
G); *dstptr++ = (
unsigned char)(B);
47 R = Y2 + (K1 * vf >> 16);
48 G = Y2 - (K2 * vf >> 16) - (K3 * uf >> 16);
49 B = Y2 + (K4 * uf >> 16);
51 *dstptr++ = (
unsigned char)(R); *dstptr++ = (
unsigned char)(
G); *dstptr++ = (
unsigned char)(B);
90 int * dstby,
int * dstlum,
int thresh,
int inputbits)
93 const int K1 = (int)(1.402f * (1 << 16));
94 const int K2 = (int)(0.714f * (1 << 16));
95 const int K3 = (int)(0.334f * (1 << 16));
96 const int K4 = (int)(1.772f * (1 << 16));
97 const unsigned int pitch = w * 2;
98 const int lshift = inputbits - 3;
99 const int lumlshift = inputbits - 8;
102 unsigned char Y1, Y2;
105 for (y = 0; y <
h; ++y)
107 for (x = 0; x < pitch; x += 4)
109 Y1 = *srcptr++; uf = *srcptr++ - 128; Y2 = *srcptr++; vf = *srcptr++ - 128;
111 R = Y1 + (K1 * vf >> 16);
112 G = Y1 - (K2 * vf >> 16) - (K3 * uf >> 16);
113 B = Y1 + (K4 * uf >> 16);
117 ++dstrg; ++dstby; ++dstlum;
119 R = Y2 + (K1 * vf >> 16);
120 G = Y2 - (K2 * vf >> 16) - (K3 * uf >> 16);
121 B = Y2 + (K4 * uf >> 16);
125 ++dstrg; ++dstby; ++dstlum;
void convertYUYVtoRGBYLinternal(int R, int G, int B, int *dstrg, int *dstby, int *dstlum, int thresh, int lshift, int lumlshift)
void convertYUYVtoRGB24(unsigned int w, unsigned int h, unsigned char const *srcptr, unsigned char *dstptr)
Convert from YUYV to RGB, mostly intended for internal use. Use RawImage functions instead in most ca...
void convertYUYVtoRGBYL(unsigned int w, unsigned int h, unsigned char const *srcptr, int *dstrg, int *dstby, int *dstlum, int thresh, int inputbits)
Convert from YUYV to RG, BY, and luminance for use by Saliency module in jevoisbase....