59 int lumStride,
int chromStride,
int dstStride);
63 int lumStride,
int chromStride,
int dstStride);
67 int lumStride,
int chromStride,
int dstStride);
71 int lumStride,
int chromStride,
int dstStride);
75 int lumStride,
int chromStride,
int srcStride);
79 int lumStride,
int chromStride,
int srcStride);
81 int srcStride,
int dstStride);
84 int src2Stride,
int dstStride);
88 int srcStride1,
int srcStride2,
89 int dstStride1,
int dstStride2);
93 int srcStride1,
int srcStride2,
94 int srcStride3,
int dstStride);
97 int lumStride,
int chromStride,
int srcStride);
100 int lumStride,
int chromStride,
int srcStride);
103 int lumStride,
int chromStride,
int srcStride);
106 int lumStride,
int chromStride,
int srcStride);
108 #define RGB2YUV_SHIFT 8
109 #define BY ((int)( 0.098 * (1 << RGB2YUV_SHIFT) + 0.5))
110 #define BV ((int)(-0.071 * (1 << RGB2YUV_SHIFT) + 0.5))
111 #define BU ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
112 #define GY ((int)( 0.504 * (1 << RGB2YUV_SHIFT) + 0.5))
113 #define GV ((int)(-0.368 * (1 << RGB2YUV_SHIFT) + 0.5))
114 #define GU ((int)(-0.291 * (1 << RGB2YUV_SHIFT) + 0.5))
115 #define RY ((int)( 0.257 * (1 << RGB2YUV_SHIFT) + 0.5))
116 #define RV ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
117 #define RU ((int)(-0.148 * (1 << RGB2YUV_SHIFT) + 0.5))
138 int i, num_pixels = src_size >> 2;
140 for (i = 0; i < num_pixels; i++) {
143 dst[3 * i + 0] = src[4 * i + 1];
144 dst[3 * i + 1] = src[4 * i + 2];
145 dst[3 * i + 2] = src[4 * i + 3];
147 dst[3 * i + 0] = src[4 * i + 2];
148 dst[3 * i + 1] = src[4 * i + 1];
149 dst[3 * i + 2] = src[4 * i + 0];
158 for (i = 0; 3 * i < src_size; i++) {
161 dst[4 * i + 0] = 255;
162 dst[4 * i + 1] = src[3 * i + 0];
163 dst[4 * i + 2] = src[3 * i + 1];
164 dst[4 * i + 3] = src[3 * i + 2];
166 dst[4 * i + 0] = src[3 * i + 2];
167 dst[4 * i + 1] = src[3 * i + 1];
168 dst[4 * i + 2] = src[3 * i + 0];
169 dst[4 * i + 3] = 255;
177 const uint16_t *s = (
const uint16_t *)src;
178 const uint16_t *
end = s + src_size / 2;
181 register uint16_t bgr = *s++;
184 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
185 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
186 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
188 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
189 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
190 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
198 uint16_t rgb,
r,
g,
b;
199 uint16_t *d = (uint16_t *)dst;
200 const uint16_t *s = (
const uint16_t *)src;
201 const uint16_t *
end = s + src_size / 2;
208 r = (r << 3) | ((r & 0x800) >> 1);
209 g = (g << 2) | ((g & 0x080) >> 2);
210 b = (b << 1) | ( b >> 3);
218 const uint16_t *s = (
const uint16_t *)src;
219 const uint16_t *
end = s + src_size / 2;
222 register uint16_t bgr = *s++;
223 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
224 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
225 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
231 int i, num_pixels = src_size >> 1;
233 for (i = 0; i < num_pixels; i++) {
234 unsigned rgb = ((
const uint16_t *)src)[i];
235 ((uint16_t *)dst)[i] = (rgb >> 11) | (rgb & 0x7E0) | (rgb << 11);
241 int i, num_pixels = src_size >> 1;
243 for (i = 0; i < num_pixels; i++) {
244 unsigned rgb = ((
const uint16_t *)src)[i];
245 ((uint16_t *)dst)[i] = (rgb >> 11) | ((rgb & 0x7C0) >> 1) | ((rgb & 0x1F) << 10);
252 const uint16_t *s = (
const uint16_t *)src;
253 const uint16_t *
end = s + src_size / 2;
256 register uint16_t bgr = *s++;
259 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
260 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
261 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
263 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
264 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
265 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
274 const uint16_t *s = (
const uint16_t *)src;
275 const uint16_t *
end = s + src_size / 2;
278 register uint16_t bgr = *s++;
279 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
280 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
281 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
287 int i, num_pixels = src_size >> 1;
289 for (i = 0; i < num_pixels; i++) {
290 unsigned rgb = ((
const uint16_t *)src)[i];
291 ((uint16_t *)dst)[i] = ((rgb & 0x7C00) >> 10) | ((rgb & 0x3E0) << 1) | (rgb << 11);
297 int i, num_pixels = src_size >> 1;
299 for (i = 0; i < num_pixels; i++) {
300 unsigned rgb = ((
const uint16_t *)src)[i];
301 unsigned br = rgb & 0x7C1F;
302 ((uint16_t *)dst)[i] = (br >> 10) | (rgb & 0x3E0) | (br << 10);
308 uint16_t *d = (uint16_t *)dst;
309 uint16_t *s = (uint16_t *)src;
310 int i, num_pixels = src_size >> 1;
312 for (i = 0; i < num_pixels; i++) {
314 d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
319 #define DEFINE_SHUFFLE_BYTES(a, b, c, d) \
320 void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \
321 uint8_t *dst, int src_size) \
325 for (i = 0; i < src_size; i += 4) { \
326 dst[i + 0] = src[i + a]; \
327 dst[i + 1] = src[i + b]; \
328 dst[i + 2] = src[i + c]; \
329 dst[i + 3] = src[i + d]; \
338 #define DEFINE_RGB48TOBGR48(need_bswap, swap) \
339 void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \
340 uint8_t *dst, int src_size) \
342 uint16_t *d = (uint16_t *)dst; \
343 uint16_t *s = (uint16_t *)src; \
344 int i, num_pixels = src_size >> 1; \
346 for (i = 0; i < num_pixels; i += 3) { \
347 d[i ] = swap ? av_bswap16(s[i + 2]) : s[i + 2]; \
348 d[i + 1] = swap ? av_bswap16(s[i + 1]) : s[i + 1]; \
349 d[i + 2] = swap ? av_bswap16(s[i ]) : s[i ]; \
356 #define DEFINE_RGB64TOBGR48(need_bswap, swap) \
357 void rgb64tobgr48_ ## need_bswap(const uint8_t *src, \
358 uint8_t *dst, int src_size) \
360 uint16_t *d = (uint16_t *)dst; \
361 uint16_t *s = (uint16_t *)src; \
362 int i, num_pixels = src_size >> 3; \
364 for (i = 0; i < num_pixels; i++) { \
365 d[3 * i ] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
366 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
367 d[3 * i + 2] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
374 #define DEFINE_RGB64TO48(need_bswap, swap) \
375 void rgb64to48_ ## need_bswap(const uint8_t *src, \
376 uint8_t *dst, int src_size) \
378 uint16_t *d = (uint16_t *)dst; \
379 uint16_t *s = (uint16_t *)src; \
380 int i, num_pixels = src_size >> 3; \
382 for (i = 0; i < num_pixels; i++) { \
383 d[3 * i ] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
384 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
385 d[3 * i + 2] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \