FFmpeg
rgb2rgb_template.c
Go to the documentation of this file.
1 /*
2  * software RGB to RGB converter
3  * pluralize by software PAL8 to RGB converter
4  * software YUV to YUV converter
5  * software YUV to RGB converter
6  * Written by Nick Kurshev.
7  * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
8  * lot of big-endian byte order fixes by Alex Beregszaszi
9  *
10  * This file is part of FFmpeg.
11  *
12  * FFmpeg is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * FFmpeg is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with FFmpeg; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 
27 #include <stddef.h>
28 
29 #include "libavutil/attributes.h"
30 
31 static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst,
32  int src_size)
33 {
34  uint8_t *dest = dst;
35  const uint8_t *s = src;
36  const uint8_t *end = s + src_size;
37 
38  while (s < end) {
39 #if HAVE_BIGENDIAN
40  /* RGB24 (= R, G, B) -> RGB32 (= A, B, G, R) */
41  *dest++ = 255;
42  *dest++ = s[2];
43  *dest++ = s[1];
44  *dest++ = s[0];
45  s += 3;
46 #else
47  *dest++ = *s++;
48  *dest++ = *s++;
49  *dest++ = *s++;
50  *dest++ = 255;
51 #endif
52  }
53 }
54 
55 static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst,
56  int src_size)
57 {
58  uint8_t *dest = dst;
59  const uint8_t *s = src;
60  const uint8_t *end = s + src_size;
61 
62  while (s < end) {
63 #if HAVE_BIGENDIAN
64  /* RGB32 (= A, B, G, R) -> RGB24 (= R, G, B) */
65  s++;
66  dest[2] = *s++;
67  dest[1] = *s++;
68  dest[0] = *s++;
69  dest += 3;
70 #else
71  *dest++ = *s++;
72  *dest++ = *s++;
73  *dest++ = *s++;
74  s++;
75 #endif
76  }
77 }
78 
79 /*
80  * original by Strepto/Astral
81  * ported to gcc & bugfixed: A'rpi
82  * MMXEXT, 3DNOW optimization by Nick Kurshev
83  * 32-bit C version, and and&add trick by Michael Niedermayer
84  */
85 static inline void rgb15to16_c(const uint8_t *src, uint8_t *dst, int src_size)
86 {
87  register uint8_t *d = dst;
88  register const uint8_t *s = src;
89  register const uint8_t *end = s + src_size;
90  const uint8_t *mm_end = end - 3;
91 
92  while (s < mm_end) {
93  register unsigned x = *((const uint32_t *)s);
94  *((uint32_t *)d) = (x & 0x7FFF7FFF) + (x & 0x7FE07FE0);
95  d += 4;
96  s += 4;
97  }
98  if (s < end) {
99  register unsigned short x = *((const uint16_t *)s);
100  *((uint16_t *)d) = (x & 0x7FFF) + (x & 0x7FE0);
101  }
102 }
103 
104 static inline void rgb16to15_c(const uint8_t *src, uint8_t *dst, int src_size)
105 {
106  register uint8_t *d = dst;
107  register const uint8_t *s = src;
108  register const uint8_t *end = s + src_size;
109  const uint8_t *mm_end = end - 3;
110 
111  while (s < mm_end) {
112  register uint32_t x = *((const uint32_t *)s);
113  *((uint32_t *)d) = ((x >> 1) & 0x7FE07FE0) | (x & 0x001F001F);
114  s += 4;
115  d += 4;
116  }
117  if (s < end) {
118  register uint16_t x = *((const uint16_t *)s);
119  *((uint16_t *)d) = ((x >> 1) & 0x7FE0) | (x & 0x001F);
120  }
121 }
122 
123 static inline void rgb32to16_c(const uint8_t *src, uint8_t *dst, int src_size)
124 {
125  uint16_t *d = (uint16_t *)dst;
126  const uint8_t *s = src;
127  const uint8_t *end = s + src_size;
128 
129  while (s < end) {
130  register int rgb = *(const uint32_t *)s;
131  s += 4;
132  *d++ = ((rgb & 0xFF) >> 3) +
133  ((rgb & 0xFC00) >> 5) +
134  ((rgb & 0xF80000) >> 8);
135  }
136 }
137 
138 static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst,
139  int src_size)
140 {
141  uint16_t *d = (uint16_t *)dst;
142  const uint8_t *s = src;
143  const uint8_t *end = s + src_size;
144 
145  while (s < end) {
146  register int rgb = *(const uint32_t *)s;
147  s += 4;
148  *d++ = ((rgb & 0xF8) << 8) +
149  ((rgb & 0xFC00) >> 5) +
150  ((rgb & 0xF80000) >> 19);
151  }
152 }
153 
154 static inline void rgb32to15_c(const uint8_t *src, uint8_t *dst, int src_size)
155 {
156  uint16_t *d = (uint16_t *)dst;
157  const uint8_t *s = src;
158  const uint8_t *end = s + src_size;
159 
160  while (s < end) {
161  register int rgb = *(const uint32_t *)s;
162  s += 4;
163  *d++ = ((rgb & 0xFF) >> 3) +
164  ((rgb & 0xF800) >> 6) +
165  ((rgb & 0xF80000) >> 9);
166  }
167 }
168 
169 static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst,
170  int src_size)
171 {
172  uint16_t *d = (uint16_t *)dst;
173  const uint8_t *s = src;
174  const uint8_t *end = s + src_size;
175 
176  while (s < end) {
177  register int rgb = *(const uint32_t *)s;
178  s += 4;
179  *d++ = ((rgb & 0xF8) << 7) +
180  ((rgb & 0xF800) >> 6) +
181  ((rgb & 0xF80000) >> 19);
182  }
183 }
184 
185 static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst,
186  int src_size)
187 {
188  uint16_t *d = (uint16_t *)dst;
189  const uint8_t *s = src;
190  const uint8_t *end = s + src_size;
191 
192  while (s < end) {
193  const int b = *s++;
194  const int g = *s++;
195  const int r = *s++;
196  *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
197  }
198 }
199 
200 static inline void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size)
201 {
202  uint16_t *d = (uint16_t *)dst;
203  const uint8_t *s = src;
204  const uint8_t *end = s + src_size;
205 
206  while (s < end) {
207  const int r = *s++;
208  const int g = *s++;
209  const int b = *s++;
210  *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
211  }
212 }
213 
214 static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst,
215  int src_size)
216 {
217  uint16_t *d = (uint16_t *)dst;
218  const uint8_t *s = src;
219  const uint8_t *end = s + src_size;
220 
221  while (s < end) {
222  const int b = *s++;
223  const int g = *s++;
224  const int r = *s++;
225  *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
226  }
227 }
228 
229 static inline void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size)
230 {
231  uint16_t *d = (uint16_t *)dst;
232  const uint8_t *s = src;
233  const uint8_t *end = s + src_size;
234 
235  while (s < end) {
236  const int r = *s++;
237  const int g = *s++;
238  const int b = *s++;
239  *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
240  }
241 }
242 
243 static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst,
244  int src_size)
245 {
246  uint8_t *d = dst;
247  const uint16_t *s = (const uint16_t *)src;
248  const uint16_t *end = s + src_size / 2;
249 
250  while (s < end) {
251  register uint16_t bgr = *s++;
252  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
253  *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
254  *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
255  }
256 }
257 
258 static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst,
259  int src_size)
260 {
261  uint8_t *d = (uint8_t *)dst;
262  const uint16_t *s = (const uint16_t *)src;
263  const uint16_t *end = s + src_size / 2;
264 
265  while (s < end) {
266  register uint16_t bgr = *s++;
267  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
268  *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
269  *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
270  }
271 }
272 
273 static inline void rgb15to32_c(const uint8_t *src, uint8_t *dst, int src_size)
274 {
275  uint8_t *d = dst;
276  const uint16_t *s = (const uint16_t *)src;
277  const uint16_t *end = s + src_size / 2;
278 
279  while (s < end) {
280  register uint16_t bgr = *s++;
281 #if HAVE_BIGENDIAN
282  *d++ = 255;
283  *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
284  *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
285  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
286 #else
287  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
288  *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
289  *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
290  *d++ = 255;
291 #endif
292  }
293 }
294 
295 static inline void rgb16to32_c(const uint8_t *src, uint8_t *dst, int src_size)
296 {
297  uint8_t *d = dst;
298  const uint16_t *s = (const uint16_t *)src;
299  const uint16_t *end = s + src_size / 2;
300 
301  while (s < end) {
302  register uint16_t bgr = *s++;
303 #if HAVE_BIGENDIAN
304  *d++ = 255;
305  *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
306  *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
307  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
308 #else
309  *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
310  *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
311  *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
312  *d++ = 255;
313 #endif
314  }
315 }
316 
317 static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst,
318  int src_size)
319 {
320  int idx = 15 - src_size;
321  const uint8_t *s = src - idx;
322  uint8_t *d = dst - idx;
323 
324  for (; idx < 15; idx += 4) {
325  register unsigned v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
326  v &= 0xff00ff;
327  *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
328  }
329 }
330 
331 static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst,
332  int src_size)
333 {
334  int idx = 15 - src_size;
335  const uint8_t *s = src - idx;
336  uint8_t *d = dst - idx;
337 
338  for (; idx < 15; idx += 4) {
339  register unsigned v = *(const uint32_t *)&s[idx], g = v & 0x00ff00ff;
340  v &= 0xff00ff00;
341  *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
342  }
343 }
344 
345 #define DEFINE_SHUFFLE_BYTES(name, a, b, c, d) \
346 static void shuffle_bytes_##name (const uint8_t *src, \
347  uint8_t *dst, int src_size) \
348 { \
349  int i; \
350  \
351  for (i = 0; i < src_size; i += 4) { \
352  dst[i + 0] = src[i + a]; \
353  dst[i + 1] = src[i + b]; \
354  dst[i + 2] = src[i + c]; \
355  dst[i + 3] = src[i + d]; \
356  } \
357 }
358 
359 DEFINE_SHUFFLE_BYTES(1230_c, 1, 2, 3, 0)
360 DEFINE_SHUFFLE_BYTES(3012_c, 3, 0, 1, 2)
361 DEFINE_SHUFFLE_BYTES(3210_c, 3, 2, 1, 0)
362 DEFINE_SHUFFLE_BYTES(3102_c, 3, 1, 0, 2)
363 DEFINE_SHUFFLE_BYTES(2013_c, 2, 0, 1, 3)
364 DEFINE_SHUFFLE_BYTES(2130_c, 2, 1, 3, 0)
365 DEFINE_SHUFFLE_BYTES(1203_c, 1, 2, 0, 3)
366 
367 static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
368 {
369  unsigned i;
370 
371  for (i = 0; i < src_size; i += 3) {
372  register uint8_t x = src[i + 2];
373  dst[i + 1] = src[i + 1];
374  dst[i + 2] = src[i + 0];
375  dst[i + 0] = x;
376  }
377 }
378 
379 static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
380  const uint8_t *vsrc, uint8_t *dst,
381  int width, int height,
382  int lumStride, int chromStride,
383  int dstStride, int vertLumPerChroma)
384 {
385  int y, i;
386  const int chromWidth = width >> 1;
387 
388  for (y = 0; y < height; y++) {
389 #if HAVE_FAST_64BIT
390  uint64_t *ldst = (uint64_t *)dst;
391  const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
392  for (i = 0; i < chromWidth; i += 2) {
393  uint64_t k = yc[0] + (uc[0] << 8) +
394  (yc[1] << 16) + ((unsigned) vc[0] << 24);
395  uint64_t l = yc[2] + (uc[1] << 8) +
396  (yc[3] << 16) + ((unsigned) vc[1] << 24);
397  *ldst++ = k + (l << 32);
398  yc += 4;
399  uc += 2;
400  vc += 2;
401  }
402 
403 #else
404  int *idst = (int32_t *)dst;
405  const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
406 
407  for (i = 0; i < chromWidth; i++) {
408 #if HAVE_BIGENDIAN
409  *idst++ = (yc[0] << 24) + (uc[0] << 16) +
410  (yc[1] << 8) + (vc[0] << 0);
411 #else
412  *idst++ = yc[0] + (uc[0] << 8) +
413  (yc[1] << 16) + (vc[0] << 24);
414 #endif
415  yc += 2;
416  uc++;
417  vc++;
418  }
419 #endif
420  if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
421  usrc += chromStride;
422  vsrc += chromStride;
423  }
424  ysrc += lumStride;
425  dst += dstStride;
426  }
427 }
428 
429 /**
430  * Height should be a multiple of 2 and width should be a multiple of 16.
431  * (If this is a problem for anyone then tell me, and I will fix it.)
432  */
433 static inline void yv12toyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
434  const uint8_t *vsrc, uint8_t *dst,
435  int width, int height, int lumStride,
436  int chromStride, int dstStride)
437 {
438  //FIXME interpolate chroma
439  yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
440  chromStride, dstStride, 2);
441 }
442 
443 static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
444  const uint8_t *vsrc, uint8_t *dst,
445  int width, int height,
446  int lumStride, int chromStride,
447  int dstStride, int vertLumPerChroma)
448 {
449  int y, i;
450  const int chromWidth = width >> 1;
451 
452  for (y = 0; y < height; y++) {
453 #if HAVE_FAST_64BIT
454  uint64_t *ldst = (uint64_t *)dst;
455  const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
456  for (i = 0; i < chromWidth; i += 2) {
457  uint64_t k = uc[0] + (yc[0] << 8) +
458  (vc[0] << 16) + ((unsigned) yc[1] << 24);
459  uint64_t l = uc[1] + (yc[2] << 8) +
460  (vc[1] << 16) + ((unsigned) yc[3] << 24);
461  *ldst++ = k + (l << 32);
462  yc += 4;
463  uc += 2;
464  vc += 2;
465  }
466 
467 #else
468  int *idst = (int32_t *)dst;
469  const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
470 
471  for (i = 0; i < chromWidth; i++) {
472 #if HAVE_BIGENDIAN
473  *idst++ = (uc[0] << 24) + (yc[0] << 16) +
474  (vc[0] << 8) + (yc[1] << 0);
475 #else
476  *idst++ = uc[0] + (yc[0] << 8) +
477  (vc[0] << 16) + (yc[1] << 24);
478 #endif
479  yc += 2;
480  uc++;
481  vc++;
482  }
483 #endif
484  if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
485  usrc += chromStride;
486  vsrc += chromStride;
487  }
488  ysrc += lumStride;
489  dst += dstStride;
490  }
491 }
492 
493 /**
494  * Height should be a multiple of 2 and width should be a multiple of 16
495  * (If this is a problem for anyone then tell me, and I will fix it.)
496  */
497 static inline void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
498  const uint8_t *vsrc, uint8_t *dst,
499  int width, int height, int lumStride,
500  int chromStride, int dstStride)
501 {
502  //FIXME interpolate chroma
503  yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
504  chromStride, dstStride, 2);
505 }
506 
507 /**
508  * Width should be a multiple of 16.
509  */
510 static inline void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
511  const uint8_t *vsrc, uint8_t *dst,
512  int width, int height, int lumStride,
513  int chromStride, int dstStride)
514 {
515  yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
516  chromStride, dstStride, 1);
517 }
518 
519 /**
520  * Width should be a multiple of 16.
521  */
522 static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
523  const uint8_t *vsrc, uint8_t *dst,
524  int width, int height, int lumStride,
525  int chromStride, int dstStride)
526 {
527  yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
528  chromStride, dstStride, 1);
529 }
530 
531 /**
532  * Height should be a multiple of 2 and width should be a multiple of 16.
533  * (If this is a problem for anyone then tell me, and I will fix it.)
534  */
535 static inline void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst,
536  uint8_t *udst, uint8_t *vdst,
537  int width, int height, int lumStride,
538  int chromStride, int srcStride)
539 {
540  int y;
541  const int chromWidth = width >> 1;
542 
543  for (y = 0; y < height; y += 2) {
544  int i;
545  for (i = 0; i < chromWidth; i++) {
546  ydst[2 * i + 0] = src[4 * i + 0];
547  udst[i] = src[4 * i + 1];
548  ydst[2 * i + 1] = src[4 * i + 2];
549  vdst[i] = src[4 * i + 3];
550  }
551  ydst += lumStride;
552  src += srcStride;
553 
554  for (i = 0; i < chromWidth; i++) {
555  ydst[2 * i + 0] = src[4 * i + 0];
556  ydst[2 * i + 1] = src[4 * i + 2];
557  }
558  udst += chromStride;
559  vdst += chromStride;
560  ydst += lumStride;
561  src += srcStride;
562  }
563 }
564 
565 static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth,
566  int srcHeight, int srcStride, int dstStride)
567 {
568  int x, y;
569 
570  dst[0] = src[0];
571 
572  // first line
573  for (x = 0; x < srcWidth - 1; x++) {
574  dst[2 * x + 1] = (3 * src[x] + src[x + 1]) >> 2;
575  dst[2 * x + 2] = (src[x] + 3 * src[x + 1]) >> 2;
576  }
577  dst[2 * srcWidth - 1] = src[srcWidth - 1];
578 
579  dst += dstStride;
580 
581  for (y = 1; y < srcHeight; y++) {
582  const int mmxSize = 1;
583 
584  dst[0] = (src[0] * 3 + src[srcStride]) >> 2;
585  dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
586 
587  for (x = mmxSize - 1; x < srcWidth - 1; x++) {
588  dst[2 * x + 1] = (src[x + 0] * 3 + src[x + srcStride + 1]) >> 2;
589  dst[2 * x + dstStride + 2] = (src[x + 0] + 3 * src[x + srcStride + 1]) >> 2;
590  dst[2 * x + dstStride + 1] = (src[x + 1] + 3 * src[x + srcStride]) >> 2;
591  dst[2 * x + 2] = (src[x + 1] * 3 + src[x + srcStride]) >> 2;
592  }
593  dst[srcWidth * 2 - 1] = (src[srcWidth - 1] * 3 + src[srcWidth - 1 + srcStride]) >> 2;
594  dst[srcWidth * 2 - 1 + dstStride] = (src[srcWidth - 1] + 3 * src[srcWidth - 1 + srcStride]) >> 2;
595 
596  dst += dstStride * 2;
597  src += srcStride;
598  }
599 
600  // last line
601  dst[0] = src[0];
602 
603  for (x = 0; x < srcWidth - 1; x++) {
604  dst[2 * x + 1] = (src[x] * 3 + src[x + 1]) >> 2;
605  dst[2 * x + 2] = (src[x] + 3 * src[x + 1]) >> 2;
606  }
607  dst[2 * srcWidth - 1] = src[srcWidth - 1];
608 }
609 
610 /**
611  * Height should be a multiple of 2 and width should be a multiple of 16.
612  * (If this is a problem for anyone then tell me, and I will fix it.)
613  * Chrominance data is only taken from every second line, others are ignored.
614  * FIXME: Write HQ version.
615  */
616 static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst,
617  uint8_t *udst, uint8_t *vdst,
618  int width, int height, int lumStride,
619  int chromStride, int srcStride)
620 {
621  int y;
622  const int chromWidth = width >> 1;
623 
624  for (y = 0; y < height; y += 2) {
625  int i;
626  for (i = 0; i < chromWidth; i++) {
627  udst[i] = src[4 * i + 0];
628  ydst[2 * i + 0] = src[4 * i + 1];
629  vdst[i] = src[4 * i + 2];
630  ydst[2 * i + 1] = src[4 * i + 3];
631  }
632  ydst += lumStride;
633  src += srcStride;
634 
635  for (i = 0; i < chromWidth; i++) {
636  ydst[2 * i + 0] = src[4 * i + 1];
637  ydst[2 * i + 1] = src[4 * i + 3];
638  }
639  udst += chromStride;
640  vdst += chromStride;
641  ydst += lumStride;
642  src += srcStride;
643  }
644 }
645 
646 /**
647  * width should be a multiple of 2.
648  * (If this is a problem for anyone then tell me, and I will fix it.)
649  */
650 void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
651  uint8_t *vdst, int width, int height, int lumStride,
652  int chromStride, int srcStride, const int32_t *rgb2yuv)
653 {
654  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
655  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
656  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
657  int y;
658  const int chromWidth = width >> 1;
659  const uint8_t *src1 = src;
660  const uint8_t *src2 = src1 + srcStride;
661  uint8_t *ydst1 = ydst;
662  uint8_t *ydst2 = ydst + lumStride;
663 
664  for (y = 0; y < height; y += 2) {
665  int i;
666  if (y + 1 == height) {
667  ydst2 = ydst1;
668  src2 = src1;
669  }
670 
671  for (i = 0; i < chromWidth; i++) {
672  unsigned int b11 = src1[6 * i + 0];
673  unsigned int g11 = src1[6 * i + 1];
674  unsigned int r11 = src1[6 * i + 2];
675  unsigned int b12 = src1[6 * i + 3];
676  unsigned int g12 = src1[6 * i + 4];
677  unsigned int r12 = src1[6 * i + 5];
678  unsigned int b21 = src2[6 * i + 0];
679  unsigned int g21 = src2[6 * i + 1];
680  unsigned int r21 = src2[6 * i + 2];
681  unsigned int b22 = src2[6 * i + 3];
682  unsigned int g22 = src2[6 * i + 4];
683  unsigned int r22 = src2[6 * i + 5];
684 
685  unsigned int Y11 = ((ry * r11 + gy * g11 + by * b11) >> RGB2YUV_SHIFT) + 16;
686  unsigned int Y12 = ((ry * r12 + gy * g12 + by * b12) >> RGB2YUV_SHIFT) + 16;
687  unsigned int Y21 = ((ry * r21 + gy * g21 + by * b21) >> RGB2YUV_SHIFT) + 16;
688  unsigned int Y22 = ((ry * r22 + gy * g22 + by * b22) >> RGB2YUV_SHIFT) + 16;
689 
690  unsigned int bx = (b11 + b12 + b21 + b22) >> 2;
691  unsigned int gx = (g11 + g12 + g21 + g22) >> 2;
692  unsigned int rx = (r11 + r12 + r21 + r22) >> 2;
693 
694  unsigned int U = ((ru * rx + gu * gx + bu * bx) >> RGB2YUV_SHIFT) + 128;
695  unsigned int V = ((rv * rx + gv * gx + bv * bx) >> RGB2YUV_SHIFT) + 128;
696 
697  ydst1[2 * i + 0] = Y11;
698  ydst1[2 * i + 1] = Y12;
699  ydst2[2 * i + 0] = Y21;
700  ydst2[2 * i + 1] = Y22;
701  udst[i] = U;
702  vdst[i] = V;
703  }
704  src1 += srcStride * 2;
705  src2 += srcStride * 2;
706  ydst1 += lumStride * 2;
707  ydst2 += lumStride * 2;
708  udst += chromStride;
709  vdst += chromStride;
710  }
711 }
712 
713 static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2,
714  uint8_t *dest, int width, int height,
715  int src1Stride, int src2Stride, int dstStride)
716 {
717  int h;
718 
719  for (h = 0; h < height; h++) {
720  int w;
721  for (w = 0; w < width; w++) {
722  dest[2 * w + 0] = src1[w];
723  dest[2 * w + 1] = src2[w];
724  }
725  dest += dstStride;
726  src1 += src1Stride;
727  src2 += src2Stride;
728  }
729 }
730 
731 static void deinterleaveBytes_c(const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
732  int width, int height, int srcStride,
733  int dst1Stride, int dst2Stride)
734 {
735  int h;
736 
737  for (h = 0; h < height; h++) {
738  int w;
739  for (w = 0; w < width; w++) {
740  dst1[w] = src[2 * w + 0];
741  dst2[w] = src[2 * w + 1];
742  }
743  src += srcStride;
744  dst1 += dst1Stride;
745  dst2 += dst2Stride;
746  }
747 }
748 
749 static inline void vu9_to_vu12_c(const uint8_t *src1, const uint8_t *src2,
750  uint8_t *dst1, uint8_t *dst2,
751  int width, int height,
752  int srcStride1, int srcStride2,
753  int dstStride1, int dstStride2)
754 {
755  int x, y;
756  int w = width / 2;
757  int h = height / 2;
758 
759  for (y = 0; y < h; y++) {
760  const uint8_t *s1 = src1 + srcStride1 * (y >> 1);
761  uint8_t *d = dst1 + dstStride1 * y;
762  for (x = 0; x < w; x++)
763  d[2 * x] = d[2 * x + 1] = s1[x];
764  }
765  for (y = 0; y < h; y++) {
766  const uint8_t *s2 = src2 + srcStride2 * (y >> 1);
767  uint8_t *d = dst2 + dstStride2 * y;
768  for (x = 0; x < w; x++)
769  d[2 * x] = d[2 * x + 1] = s2[x];
770  }
771 }
772 
773 static inline void yvu9_to_yuy2_c(const uint8_t *src1, const uint8_t *src2,
774  const uint8_t *src3, uint8_t *dst,
775  int width, int height,
776  int srcStride1, int srcStride2,
777  int srcStride3, int dstStride)
778 {
779  int x, y;
780  int w = width / 2;
781  int h = height;
782 
783  for (y = 0; y < h; y++) {
784  const uint8_t *yp = src1 + srcStride1 * y;
785  const uint8_t *up = src2 + srcStride2 * (y >> 2);
786  const uint8_t *vp = src3 + srcStride3 * (y >> 2);
787  uint8_t *d = dst + dstStride * y;
788  for (x = 0; x < w; x++) {
789  const int x2 = x << 2;
790  d[8 * x + 0] = yp[x2];
791  d[8 * x + 1] = up[x];
792  d[8 * x + 2] = yp[x2 + 1];
793  d[8 * x + 3] = vp[x];
794  d[8 * x + 4] = yp[x2 + 2];
795  d[8 * x + 5] = up[x];
796  d[8 * x + 6] = yp[x2 + 3];
797  d[8 * x + 7] = vp[x];
798  }
799  }
800 }
801 
802 static void extract_even_c(const uint8_t *src, uint8_t *dst, int count)
803 {
804  dst += count;
805  src += count * 2;
806  count = -count;
807  while (count < 0) {
808  dst[count] = src[2 * count];
809  count++;
810  }
811 }
812 
813 static void extract_even2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
814  int count)
815 {
816  dst0 += count;
817  dst1 += count;
818  src += count * 4;
819  count = -count;
820  while (count < 0) {
821  dst0[count] = src[4 * count + 0];
822  dst1[count] = src[4 * count + 2];
823  count++;
824  }
825 }
826 
827 static void extract_even2avg_c(const uint8_t *src0, const uint8_t *src1,
828  uint8_t *dst0, uint8_t *dst1, int count)
829 {
830  dst0 += count;
831  dst1 += count;
832  src0 += count * 4;
833  src1 += count * 4;
834  count = -count;
835  while (count < 0) {
836  dst0[count] = (src0[4 * count + 0] + src1[4 * count + 0]) >> 1;
837  dst1[count] = (src0[4 * count + 2] + src1[4 * count + 2]) >> 1;
838  count++;
839  }
840 }
841 
842 static void extract_odd2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
843  int count)
844 {
845  dst0 += count;
846  dst1 += count;
847  src += count * 4;
848  count = -count;
849  src++;
850  while (count < 0) {
851  dst0[count] = src[4 * count + 0];
852  dst1[count] = src[4 * count + 2];
853  count++;
854  }
855 }
856 
857 static void extract_odd2avg_c(const uint8_t *src0, const uint8_t *src1,
858  uint8_t *dst0, uint8_t *dst1, int count)
859 {
860  dst0 += count;
861  dst1 += count;
862  src0 += count * 4;
863  src1 += count * 4;
864  count = -count;
865  src0++;
866  src1++;
867  while (count < 0) {
868  dst0[count] = (src0[4 * count + 0] + src1[4 * count + 0]) >> 1;
869  dst1[count] = (src0[4 * count + 2] + src1[4 * count + 2]) >> 1;
870  count++;
871  }
872 }
873 
874 static void yuyvtoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
875  const uint8_t *src, int width, int height,
876  int lumStride, int chromStride, int srcStride)
877 {
878  int y;
879  const int chromWidth = AV_CEIL_RSHIFT(width, 1);
880 
881  for (y = 0; y < height; y++) {
882  extract_even_c(src, ydst, width);
883  if (y & 1) {
884  extract_odd2avg_c(src - srcStride, src, udst, vdst, chromWidth);
885  udst += chromStride;
886  vdst += chromStride;
887  }
888 
889  src += srcStride;
890  ydst += lumStride;
891  }
892 }
893 
894 static void yuyvtoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
895  const uint8_t *src, int width, int height,
896  int lumStride, int chromStride, int srcStride)
897 {
898  int y;
899  const int chromWidth = AV_CEIL_RSHIFT(width, 1);
900 
901  for (y = 0; y < height; y++) {
902  extract_even_c(src, ydst, width);
903  extract_odd2_c(src, udst, vdst, chromWidth);
904 
905  src += srcStride;
906  ydst += lumStride;
907  udst += chromStride;
908  vdst += chromStride;
909  }
910 }
911 
912 static void uyvytoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
913  const uint8_t *src, int width, int height,
914  int lumStride, int chromStride, int srcStride)
915 {
916  int y;
917  const int chromWidth = AV_CEIL_RSHIFT(width, 1);
918 
919  for (y = 0; y < height; y++) {
920  extract_even_c(src + 1, ydst, width);
921  if (y & 1) {
922  extract_even2avg_c(src - srcStride, src, udst, vdst, chromWidth);
923  udst += chromStride;
924  vdst += chromStride;
925  }
926 
927  src += srcStride;
928  ydst += lumStride;
929  }
930 }
931 
932 static void uyvytoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
933  const uint8_t *src, int width, int height,
934  int lumStride, int chromStride, int srcStride)
935 {
936  int y;
937  const int chromWidth = AV_CEIL_RSHIFT(width, 1);
938 
939  for (y = 0; y < height; y++) {
940  extract_even_c(src + 1, ydst, width);
941  extract_even2_c(src, udst, vdst, chromWidth);
942 
943  src += srcStride;
944  ydst += lumStride;
945  udst += chromStride;
946  vdst += chromStride;
947  }
948 }
949 
950 static av_cold void rgb2rgb_init_c(void)
951 {
967 #if HAVE_BIGENDIAN
970 #else
973 #endif
974  shuffle_bytes_1230 = shuffle_bytes_1230_c;
975  shuffle_bytes_3012 = shuffle_bytes_3012_c;
976  shuffle_bytes_3210 = shuffle_bytes_3210_c;
977  shuffle_bytes_3102 = shuffle_bytes_3102_c;
978  shuffle_bytes_2013 = shuffle_bytes_2013_c;
979  shuffle_bytes_2130 = shuffle_bytes_2130_c;
980  shuffle_bytes_1203 = shuffle_bytes_1203_c;
994 
999 }
yuvPlanartouyvy_c
static void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
Definition: rgb2rgb_template.c:443
rgb32to15_c
static void rgb32to15_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:154
rgb32tobgr24
void(* rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:35
shuffle_bytes_3012
void(* shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:57
yuv422ptoyuy2_c
static void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
Definition: rgb2rgb_template.c:522
r
const char * r
Definition: vf_curves.c:127
extract_even2_c
static void extract_even2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, int count)
Definition: rgb2rgb_template.c:813
yv12toyuy2
void(* yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb.c:65
src1
const pixel * src1
Definition: h264pred_template.c:421
rgb16to15_c
static void rgb16to15_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:104
yv12touyvy_c
static void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16 (If this is a problem for anyon...
Definition: rgb2rgb_template.c:497
rgb24tobgr24_c
static void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:367
RV_IDX
#define RV_IDX
Definition: swscale_internal.h:455
w
uint8_t w
Definition: llviddspenc.c:38
yuy2toyv12
void(* yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb.c:81
RU_IDX
#define RU_IDX
Definition: swscale_internal.h:452
b
#define b
Definition: input.c:41
shuffle_bytes_3210
void(* shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:58
GV_IDX
#define GV_IDX
Definition: swscale_internal.h:456
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:69
BV_IDX
#define BV_IDX
Definition: swscale_internal.h:457
yuyvtoyuv422_c
static void yuyvtoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb_template.c:894
rgb32tobgr16
void(* rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:36
yuyvtoyuv422
void(* yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb.c:117
rgb24tobgr16
void(* rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:40
rgb15to32
void(* rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:52
yv12touyvy
void(* yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb.c:69
rgb32tobgr15_c
static void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:169
rgb32to16
void(* rgb32to16)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:45
rgb
Definition: rpzaenc.c:60
deinterleaveBytes_c
static void deinterleaveBytes_c(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
Definition: rgb2rgb_template.c:731
shuffle_bytes_2130
void(* shuffle_bytes_2130)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:61
rgb15to32_c
static void rgb15to32_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:273
shuffle_bytes_0321_c
static void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:331
DEFINE_SHUFFLE_BYTES
#define DEFINE_SHUFFLE_BYTES(name, a, b, c, d)
Definition: rgb2rgb_template.c:345
interleaveBytes_c
static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2, uint8_t *dest, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb_template.c:713
extract_odd2avg_c
static void extract_odd2avg_c(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, int count)
Definition: rgb2rgb_template.c:857
ff_rgb24toyv12_c
void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, const int32_t *rgb2yuv)
width should be a multiple of 2.
Definition: rgb2rgb_template.c:650
rgb32to16_c
static void rgb32to16_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:123
rgb24to15_c
static void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:229
av_cold
#define av_cold
Definition: attributes.h:90
rgb16tobgr24
void(* rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:42
rgb15to16_c
static void rgb15to16_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:85
rgb24tobgr32_c
static void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:31
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
rgb16to32_c
static void rgb16to32_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:295
g
const char * g
Definition: vf_curves.c:128
yuy2toyv12_c
static void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb_template.c:535
shuffle_bytes_1230
void(* shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:56
rgb15tobgr24
void(* rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:43
extract_odd2_c
static void extract_odd2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, int count)
Definition: rgb2rgb_template.c:842
yuv422ptoyuy2
void(* yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
Definition: rgb2rgb.c:73
shuffle_bytes_2103
void(* shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:55
rgb32tobgr15
void(* rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:37
GY_IDX
#define GY_IDX
Definition: swscale_internal.h:450
interleaveBytes
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb.c:92
yvu9_to_yuy2
void(* yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, int width, int height, int srcStride1, int srcStride2, int srcStride3, int dstStride)
Definition: rgb2rgb.c:103
rgb24to16_c
static void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:200
shuffle_bytes_3102
void(* shuffle_bytes_3102)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:59
uyvytoyuv422_c
static void uyvytoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb_template.c:932
rgb16to15
void(* rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:50
yv12toyuy2_c
static void yv12toyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb_template.c:433
V
#define V
Definition: avdct.c:31
shuffle_bytes_2103_c
static void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:317
rgb32tobgr16_c
static void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:138
yuyvtoyuv420
void(* yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb.c:114
rgb24tobgr32
void(* rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:38
RY_IDX
#define RY_IDX
Definition: swscale_internal.h:449
height
#define height
Definition: dsp.h:85
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
yvu9_to_yuy2_c
static void yvu9_to_yuy2_c(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, int width, int height, int srcStride1, int srcStride2, int srcStride3, int dstStride)
Definition: rgb2rgb_template.c:773
shuffle_bytes_0321
void(* shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:54
RGB2YUV_SHIFT
#define RGB2YUV_SHIFT
uyvytoyuv420_c
static void uyvytoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb_template.c:912
attributes.h
rgb24to16
void(* rgb24to16)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:47
rgb24tobgr16_c
static void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:185
BY_IDX
#define BY_IDX
Definition: swscale_internal.h:451
uyvytoyuv422
void(* uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb.c:111
ff_rgb24toyv12
void(* ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, const int32_t *rgb2yuv)
Height should be a multiple of 2 and width should be a multiple of 2.
Definition: rgb2rgb.c:85
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
rgb24to15
void(* rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:48
src2
const pixel * src2
Definition: h264pred_template.c:422
extract_even_c
static void extract_even_c(const uint8_t *src, uint8_t *dst, int count)
Definition: rgb2rgb_template.c:802
rgb32to15
void(* rgb32to15)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:46
rgb32tobgr24_c
static void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:55
uyvytoyv12_c
static void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride)
Height should be a multiple of 2 and width should be a multiple of 16.
Definition: rgb2rgb_template.c:616
deinterleaveBytes
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
Definition: rgb2rgb.c:95
yuv422ptouyvy_c
static void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
Definition: rgb2rgb_template.c:510
U
#define U(x)
Definition: vpx_arith.h:37
rgb2rgb_init_c
static av_cold void rgb2rgb_init_c(void)
Definition: rgb2rgb_template.c:950
uyvytoyuv420
void(* uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb.c:108
rgb16to32
void(* rgb16to32)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:49
vu9_to_vu12_c
static void vu9_to_vu12_c(const uint8_t *src1, const uint8_t *src2, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride1, int srcStride2, int dstStride1, int dstStride2)
Definition: rgb2rgb_template.c:749
rgb24tobgr15_c
static void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:214
rgb24tobgr15
void(* rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:41
shuffle_bytes_2013
void(* shuffle_bytes_2013)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:60
rgb15to16
void(* rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:51
shuffle_bytes_1203
void(* shuffle_bytes_1203)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:62
yuv422ptouyvy
void(* yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
Definition: rgb2rgb.c:77
vu9_to_vu12
void(* vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride1, int srcStride2, int dstStride1, int dstStride2)
Definition: rgb2rgb.c:98
rgb24tobgr24
void(* rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:39
src0
const pixel *const src0
Definition: h264pred_template.c:420
BU_IDX
#define BU_IDX
Definition: swscale_internal.h:454
extract_even2avg_c
static void extract_even2avg_c(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, int count)
Definition: rgb2rgb_template.c:827
int32_t
int32_t
Definition: audioconvert.c:56
yuyvtoyuv420_c
static void yuyvtoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
Definition: rgb2rgb_template.c:874
rgb15tobgr24_c
static void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:243
planar2x
void(* planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride)
Definition: rgb2rgb.c:90
planar2x_c
static void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)
Definition: rgb2rgb_template.c:565
h
h
Definition: vp9dsp_template.c:2070
GU_IDX
#define GU_IDX
Definition: swscale_internal.h:453
width
#define width
Definition: dsp.h:85
src
#define src
Definition: vp8dsp.c:248
yuvPlanartoyuy2_c
static void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
Definition: rgb2rgb_template.c:379
rgb16tobgr24_c
static void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb_template.c:258