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,
82 int srcStride,
int dstStride);
85 int src2Stride,
int dstStride);
88 int dst1Stride,
int dst2Stride);
92 int srcStride1,
int srcStride2,
93 int dstStride1,
int dstStride2);
97 int srcStride1,
int srcStride2,
98 int srcStride3,
int dstStride);
101 int lumStride,
int chromStride,
int srcStride);
104 int lumStride,
int chromStride,
int srcStride);
107 int lumStride,
int chromStride,
int srcStride);
110 int lumStride,
int chromStride,
int srcStride);
112 #define BY ((int)( 0.098 * (1 << RGB2YUV_SHIFT) + 0.5))
113 #define BV ((int)(-0.071 * (1 << RGB2YUV_SHIFT) + 0.5))
114 #define BU ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
115 #define GY ((int)( 0.504 * (1 << RGB2YUV_SHIFT) + 0.5))
116 #define GV ((int)(-0.368 * (1 << RGB2YUV_SHIFT) + 0.5))
117 #define GU ((int)(-0.291 * (1 << RGB2YUV_SHIFT) + 0.5))
118 #define RY ((int)( 0.257 * (1 << RGB2YUV_SHIFT) + 0.5))
119 #define RV ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
120 #define RU ((int)(-0.148 * (1 << RGB2YUV_SHIFT) + 0.5))
141 int i, num_pixels = src_size >> 2;
143 for (i = 0; i < num_pixels; i++) {
146 dst[3 * i + 0] = src[4 * i + 1];
147 dst[3 * i + 1] = src[4 * i + 2];
148 dst[3 * i + 2] = src[4 * i + 3];
150 dst[3 * i + 0] = src[4 * i + 2];
151 dst[3 * i + 1] = src[4 * i + 1];
152 dst[3 * i + 2] = src[4 * i + 0];
161 for (i = 0; 3 * i < src_size; i++) {
164 dst[4 * i + 0] = 255;
165 dst[4 * i + 1] = src[3 * i + 0];
166 dst[4 * i + 2] = src[3 * i + 1];
167 dst[4 * i + 3] = src[3 * i + 2];
169 dst[4 * i + 0] = src[3 * i + 2];
170 dst[4 * i + 1] = src[3 * i + 1];
171 dst[4 * i + 2] = src[3 * i + 0];
172 dst[4 * i + 3] = 255;
180 const uint16_t *
s = (
const uint16_t *)src;
181 const uint16_t *
end = s + src_size / 2;
184 register uint16_t bgr = *s++;
187 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
188 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
189 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
191 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
192 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
193 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
201 uint16_t rgb,
r,
g,
b;
202 uint16_t *d = (uint16_t *)dst;
203 const uint16_t *
s = (
const uint16_t *)src;
204 const uint16_t *
end = s + src_size / 2;
211 r = (r << 3) | ((r & 0x800) >> 1);
212 g = (g << 2) | ((g & 0x080) >> 2);
213 b = (b << 1) | ( b >> 3);
221 const uint16_t *
s = (
const uint16_t *)src;
222 const uint16_t *
end = s + src_size / 2;
225 register uint16_t bgr = *s++;
226 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
227 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
228 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
234 int i, num_pixels = src_size >> 1;
236 for (i = 0; i < num_pixels; i++) {
237 unsigned rgb = ((
const uint16_t *)src)[i];
238 ((uint16_t *)dst)[i] = (rgb >> 11) | (rgb & 0x7E0) | (rgb << 11);
244 int i, num_pixels = src_size >> 1;
246 for (i = 0; i < num_pixels; i++) {
247 unsigned rgb = ((
const uint16_t *)src)[i];
248 ((uint16_t *)dst)[i] = (rgb >> 11) | ((rgb & 0x7C0) >> 1) | ((rgb & 0x1F) << 10);
255 const uint16_t *
s = (
const uint16_t *)src;
256 const uint16_t *
end = s + src_size / 2;
259 register uint16_t bgr = *s++;
262 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
263 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
264 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
266 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
267 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
268 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
277 const uint16_t *
s = (
const uint16_t *)src;
278 const uint16_t *
end = s + src_size / 2;
281 register uint16_t bgr = *s++;
282 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
283 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
284 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
290 int i, num_pixels = src_size >> 1;
292 for (i = 0; i < num_pixels; i++) {
293 unsigned rgb = ((
const uint16_t *)src)[i];
294 ((uint16_t *)dst)[i] = ((rgb & 0x7C00) >> 10) | ((rgb & 0x3E0) << 1) | (rgb << 11);
300 int i, num_pixels = src_size >> 1;
302 for (i = 0; i < num_pixels; i++) {
303 unsigned rgb = ((
const uint16_t *)src)[i];
304 unsigned br = rgb & 0x7C1F;
305 ((uint16_t *)dst)[i] = (br >> 10) | (rgb & 0x3E0) | (br << 10);
311 uint16_t *d = (uint16_t *)dst;
312 uint16_t *
s = (uint16_t *)src;
313 int i, num_pixels = src_size >> 1;
315 for (i = 0; i < num_pixels; i++) {
317 d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
322 #define DEFINE_SHUFFLE_BYTES(a, b, c, d) \
323 void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \
324 uint8_t *dst, int src_size) \
328 for (i = 0; i < src_size; i += 4) { \
329 dst[i + 0] = src[i + a]; \
330 dst[i + 1] = src[i + b]; \
331 dst[i + 2] = src[i + c]; \
332 dst[i + 3] = src[i + d]; \
341 #define DEFINE_RGB48TOBGR48(need_bswap, swap) \
342 void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \
343 uint8_t *dst, int src_size) \
345 uint16_t *d = (uint16_t *)dst; \
346 uint16_t *s = (uint16_t *)src; \
347 int i, num_pixels = src_size >> 1; \
349 for (i = 0; i < num_pixels; i += 3) { \
350 d[i ] = swap ? av_bswap16(s[i + 2]) : s[i + 2]; \
351 d[i + 1] = swap ? av_bswap16(s[i + 1]) : s[i + 1]; \
352 d[i + 2] = swap ? av_bswap16(s[i ]) : s[i ]; \
359 #define DEFINE_RGB64TOBGR48(need_bswap, swap) \
360 void rgb64tobgr48_ ## need_bswap(const uint8_t *src, \
361 uint8_t *dst, int src_size) \
363 uint16_t *d = (uint16_t *)dst; \
364 uint16_t *s = (uint16_t *)src; \
365 int i, num_pixels = src_size >> 3; \
367 for (i = 0; i < num_pixels; i++) { \
368 d[3 * i ] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
369 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
370 d[3 * i + 2] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
377 #define DEFINE_RGB64TO48(need_bswap, swap) \
378 void rgb64to48_ ## need_bswap(const uint8_t *src, \
379 uint8_t *dst, int src_size) \
381 uint16_t *d = (uint16_t *)dst; \
382 uint16_t *s = (uint16_t *)src; \
383 int i, num_pixels = src_size >> 3; \
385 for (i = 0; i < num_pixels; i++) { \
386 d[3 * i ] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
387 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
388 d[3 * i + 2] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \