25 #ifndef __FIREVISION_UTILS_COLOR_YUV_H
26 #define __FIREVISION_UTILS_COLOR_YUV_H
34 #define YUV422PA_MACROPIXEL_AT(YUV, width, x, y) ((unsigned char*)YUV + (y)*(width)*2 + ((x)-((x)%2))*2)
36 #define YUV422_PLANAR_Y_AT(YUV, width, x, y) \
37 *(YUV + (y) * (width) + (x))
39 #define YUV422_PLANAR_U_AT(YUV, width, height, x, y) \
40 *(YUV + ((width) * (height)) + (((y) * (width) + (x))/ 2))
42 #define YUV422_PLANAR_V_AT(YUV, width, height, x, y) \
43 *(YUV + ((width) * (height)) + (((width) * (height) + (y) * (width) + (x)) / 2))
45 #define YUV422_PLANAR_YUV(YUV, width, height, x, y, yp, up, vp) \
47 yp = YUV422_PLANAR_Y_AT(YUV, width, x, y); \
48 up = YUV422_PLANAR_U_AT(YUV, width, height, x, y); \
49 vp = YUV422_PLANAR_V_AT(YUV, width, height, x, y); \
52 #define YUV422_PLANAR_U_PLANE(YUV, width, height) (YUV + (width) * (height))
53 #define YUV422_PLANAR_V_PLANE(YUV, width, height) (YUV + ((width) * (height)) + ((width) * (height) / 2))
66 YUV_t_struct(
unsigned char y = 127,
unsigned char u = 127,
unsigned char v = 127)
92 void iyu1_to_yuy2(
const unsigned char *src,
unsigned char *dest,
93 unsigned int width,
unsigned int height);
99 void gray8_to_yuy2(
const unsigned char *src,
unsigned char *dest,
100 unsigned int width,
unsigned int height);
105 void gray8_to_yuv422planar_plainc(
const unsigned char *src,
unsigned char *dst,
106 unsigned int width,
unsigned int height);
111 void yuv422planar_copy_uv(
const unsigned char *src,
unsigned char *dst,
112 unsigned int width,
unsigned int height,
113 unsigned int x,
unsigned int y,
114 unsigned int copy_width,
unsigned int copy_height);
120 void yuv422planar_to_yuv422packed(
const unsigned char *planar,
unsigned char *packed,
121 unsigned int width,
unsigned int height);
125 void yuv422planar_quarter_to_yuv422packed(
const unsigned char *planar,
126 unsigned char *packed,
127 const unsigned int width,
128 const unsigned int height);
131 void yuv422planar_quarter_to_yuv422planar(
const unsigned char *planar,
132 unsigned char *packed,
133 const unsigned int width,
134 const unsigned int height);
139 void yuv422packed_to_yuv422planar(
const unsigned char *packed,
unsigned char *planar,
140 unsigned int width,
unsigned int height);
144 void yuy2_to_yuv422planar(
const unsigned char *packed,
unsigned char *planar,
145 unsigned int width,
unsigned int height);
149 void yuy2_to_yuv422planar_quarter(
const unsigned char *packed,
unsigned char *planar,
150 const unsigned int width,
const unsigned int height);
154 void yvy2_to_yuv422planar(
const unsigned char *packed,
unsigned char *planar,
155 unsigned int width,
unsigned int height);
159 void yuv444packed_to_yuv422planar(
const unsigned char *yuv444,
unsigned char *yuv422,
160 unsigned int width,
unsigned int height);
162 void yuv444packed_to_yuv422packed(
const unsigned char *yuv444,
unsigned char *yuv422,
163 unsigned int width,
unsigned int height);
165 void yvu444packed_to_yuv422planar(
const unsigned char *yuv444,
unsigned char *yuv422,
166 unsigned int width,
unsigned int height);
168 void yvu444packed_to_yuv422packed(
const unsigned char *yuv444,
unsigned char *yuv422,
169 unsigned int width,
unsigned int height);
173 void yuv422planar_erase_y_plane(
unsigned char *yuv,
unsigned int width,
unsigned int height);
176 void yuv422planar_erase_u_plane(
unsigned char *yuv,
unsigned int width,
unsigned int height);
179 void yuv422planar_erase_v_plane(
unsigned char *yuv,
unsigned int width,
unsigned int height);
182 void grayscale_yuv422packed(
const unsigned char *src,
unsigned char *dst,
183 unsigned int width,
unsigned int height);
186 void grayscale_yuv422planar(
const unsigned char *src,
unsigned char *dst,
187 unsigned int width,
unsigned int height);
191 convert_line_yuv422planar_to_yuv444packed(
const unsigned char *src,
unsigned char *dst,
192 unsigned int width,
unsigned int height,
193 unsigned int src_line,
unsigned int dst_line)
195 register unsigned int i = 0;
196 register YUV_t *y1, *y2;
197 register const unsigned char *yp, *up, *vp;
199 yp = src + (width * src_line);
200 up = YUV422_PLANAR_U_PLANE(src, width, height) + (width * src_line / 2);
201 vp = YUV422_PLANAR_V_PLANE(src, width, height) + (width * src_line / 2);
203 dst += 3 * width * dst_line;
static YUV_t_struct yellow()
unsigned char V
V component.
static YUV_t_struct magenta()
static YUV_t_struct red()
YUV_t_struct(unsigned char y=127, unsigned char u=127, unsigned char v=127)
Standard constructor.
unsigned char Y
Y component.
static YUV_t_struct cyan()
static YUV_t_struct black()
static YUV_t_struct gray()
static YUV_t_struct orange()
static YUV_t_struct green()
unsigned char U
U component.
static YUV_t_struct blue()
static YUV_t_struct white()