35#if defined(HAVE_LINUX_VIDEODEV_H) || defined(HAVE_LIBV4L1_H)
39static int yuv_xy[256];
40static int yuv_gu[256];
41static int yuv_bu[256];
42static int yuv_rv[256];
43static int yuv_gv[256];
46static inline int ValidRange(
int in) {
47 if (
in > 255)
in = 255;
54 unsigned char r,
g,
b;
56 unsigned char b,
g,
r;
60static inline void YUV2RGB(
const unsigned char y_,
const unsigned char cb,
const unsigned char cr,
RGB* retval) {
61 retval->r = ValidRange(yuv_xy[y_] + yuv_rv[cr]);
62 retval->g = ValidRange(yuv_xy[y_] + yuv_gu[
cb] + yuv_gv[cr]);
63 retval->b = ValidRange(yuv_xy[y_] + yuv_bu[
cb]);
70 if (initialised)
return;
73 for (y_ = 0; y_ <= 255; y_++)
75 y = ((
float) 255 / 219) * (y_ - 16);
79 for (
cb = 0;
cb <= 255;
cb++)
81 u = ((
float) 255 / 224) * (
cb - 128);
82 yuv_gu[
cb] = -0.344 *
u;
83 yuv_bu[
cb] = 1.772 *
u;
86 for (cr = 0; cr <= 255; cr++)
88 v = ((
float) 255 / 224) * (cr - 128);
89 yuv_rv[cr] = 1.402 *
v;
90 yuv_gv[cr] = -0.714 *
v;
92 TRACE(
"Filled hash table\n");
95static void Parse_YUYV(
unsigned char *destbuffer,
const unsigned char *
input,
int width,
int height)
97 const unsigned char *pY, *pCb, *pCr;
103 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
104 pY += 2; destbuffer += 3;
105 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
106 pY += 2; pCb += 4; pCr += 4; destbuffer += 3;
110static void Parse_UYVY(
unsigned char *destbuffer,
const unsigned char *
input,
int width,
int height)
112 const unsigned char *pY, *pCb, *pCr;
118 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
119 pY += 2; destbuffer += 3;
120 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
121 pY += 2; pCb += 4; pCr += 4; destbuffer += 3;
125static void Parse_UYYVYY(
unsigned char *destbuffer,
const unsigned char *
input,
int width,
int height)
127 const unsigned char *pY, *pCb, *pCr;
133 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
134 destbuffer += 3; pY++;
135 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
136 pY += 2; destbuffer += 3;
137 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
138 destbuffer += 3; pY++;
139 YUV2RGB(*pY, *pCb, *pCr, (
RGB *)destbuffer);
140 pY += 2; pCb += 6; pCr += 6; destbuffer += 3;
144static void Parse_PYUV(
unsigned char *destbuffer,
const unsigned char *
input,
int width,
int height,
int wstep,
int hstep)
150 const unsigned char *pY, *pCb, *pCr;
151 int swstep = 0, shstep = 0;
152 int ypos = 0, xpos = 0;
153 int indexUV = 0, cUv;
165 for (xpos = 0; xpos <
width; xpos++) {
166 YUV2RGB(*(pY++), pCb[cUv], pCr[cUv], (
RGB *)destbuffer);
168 if (++swstep == wstep) {
173 if (++shstep == hstep) {
177 }
while (++ypos <
height);
184 case YUVP_421: wstep = 2; hstep = 1;
break;
185 case YUVP_422: wstep = 2; hstep = 2;
break;
186 case YUVP_441: wstep = 4; hstep = 1;
break;
187 case YUVP_444: wstep = 4; hstep = 4;
break;
188 default:
ERR(
"Unhandled format \"%d\"\n",
format);
return;
196 default:
ERR(
"Unhandled format \"%d\"\n",
format);
return;
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
static HMODULE MODULEINFO DWORD cb
static float(__cdecl *square_half_float)(float x
void YUV_Init(void) DECLSPEC_HIDDEN
void YUV_To_RGB24(enum YUV_Format format, unsigned char *target, const unsigned char *source, int width, int height) DECLSPEC_HIDDEN