39 { 0, 1, 0, 1, 0, 1, 0, 1,},
40 { 1, 0, 1, 0, 1, 0, 1, 0,},
41 { 0, 1, 0, 1, 0, 1, 0, 1,},
42 { 1, 0, 1, 0, 1, 0, 1, 0,},
43 { 0, 1, 0, 1, 0, 1, 0, 1,},
44 { 1, 0, 1, 0, 1, 0, 1, 0,},
45 { 0, 1, 0, 1, 0, 1, 0, 1,},
46 { 1, 0, 1, 0, 1, 0, 1, 0,},
48 { 1, 2, 1, 2, 1, 2, 1, 2,},
49 { 3, 0, 3, 0, 3, 0, 3, 0,},
50 { 1, 2, 1, 2, 1, 2, 1, 2,},
51 { 3, 0, 3, 0, 3, 0, 3, 0,},
52 { 1, 2, 1, 2, 1, 2, 1, 2,},
53 { 3, 0, 3, 0, 3, 0, 3, 0,},
54 { 1, 2, 1, 2, 1, 2, 1, 2,},
55 { 3, 0, 3, 0, 3, 0, 3, 0,},
57 { 2, 4, 3, 5, 2, 4, 3, 5,},
58 { 6, 0, 7, 1, 6, 0, 7, 1,},
59 { 3, 5, 2, 4, 3, 5, 2, 4,},
60 { 7, 1, 6, 0, 7, 1, 6, 0,},
61 { 2, 4, 3, 5, 2, 4, 3, 5,},
62 { 6, 0, 7, 1, 6, 0, 7, 1,},
63 { 3, 5, 2, 4, 3, 5, 2, 4,},
64 { 7, 1, 6, 0, 7, 1, 6, 0,},
66 { 4, 8, 7, 11, 4, 8, 7, 11,},
67 { 12, 0, 15, 3, 12, 0, 15, 3,},
68 { 6, 10, 5, 9, 6, 10, 5, 9,},
69 { 14, 2, 13, 1, 14, 2, 13, 1,},
70 { 4, 8, 7, 11, 4, 8, 7, 11,},
71 { 12, 0, 15, 3, 12, 0, 15, 3,},
72 { 6, 10, 5, 9, 6, 10, 5, 9,},
73 { 14, 2, 13, 1, 14, 2, 13, 1,},
75 { 9, 17, 15, 23, 8, 16, 14, 22,},
76 { 25, 1, 31, 7, 24, 0, 30, 6,},
77 { 13, 21, 11, 19, 12, 20, 10, 18,},
78 { 29, 5, 27, 3, 28, 4, 26, 2,},
79 { 8, 16, 14, 22, 9, 17, 15, 23,},
80 { 24, 0, 30, 6, 25, 1, 31, 7,},
81 { 12, 20, 10, 18, 13, 21, 11, 19,},
82 { 28, 4, 26, 2, 29, 5, 27, 3,},
84 { 18, 34, 30, 46, 17, 33, 29, 45,},
85 { 50, 2, 62, 14, 49, 1, 61, 13,},
86 { 26, 42, 22, 38, 25, 41, 21, 37,},
87 { 58, 10, 54, 6, 57, 9, 53, 5,},
88 { 16, 32, 28, 44, 19, 35, 31, 47,},
89 { 48, 0, 60, 12, 51, 3, 63, 15,},
90 { 24, 40, 20, 36, 27, 43, 23, 39,},
91 { 56, 8, 52, 4, 59, 11, 55, 7,},
93 { 18, 34, 30, 46, 17, 33, 29, 45,},
94 { 50, 2, 62, 14, 49, 1, 61, 13,},
95 { 26, 42, 22, 38, 25, 41, 21, 37,},
96 { 58, 10, 54, 6, 57, 9, 53, 5,},
97 { 16, 32, 28, 44, 19, 35, 31, 47,},
98 { 48, 0, 60, 12, 51, 3, 63, 15,},
99 { 24, 40, 20, 36, 27, 43, 23, 39,},
100 { 56, 8, 52, 4, 59, 11, 55, 7,},
102 { 36, 68, 60, 92, 34, 66, 58, 90,},
103 { 100, 4,124, 28, 98, 2,122, 26,},
104 { 52, 84, 44, 76, 50, 82, 42, 74,},
105 { 116, 20,108, 12,114, 18,106, 10,},
106 { 32, 64, 56, 88, 38, 70, 62, 94,},
107 { 96, 0,120, 24,102, 6,126, 30,},
108 { 48, 80, 40, 72, 54, 86, 46, 78,},
109 { 112, 16,104, 8,118, 22,110, 14,},
113 { 2, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,},
114 { 2, 3, 7, 7, 13, 13, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,},
115 { 3, 3, 4, 15, 15, 29, 57, 57, 57, 113, 113, 113, 113, 113, 113, 113,},
116 { 3, 4, 4, 5, 31, 31, 61, 121, 241, 241, 241, 241, 481, 481, 481, 481,},
117 { 3, 4, 5, 5, 6, 63, 63, 125, 249, 497, 993, 993, 993, 993, 993, 1985,},
118 { 3, 5, 6, 6, 6, 7, 127, 127, 253, 505, 1009, 2017, 4033, 4033, 4033, 4033,},
119 { 3, 5, 6, 7, 7, 7, 8, 255, 255, 509, 1017, 2033, 4065, 8129,16257,16257,},
120 { 3, 5, 6, 8, 8, 8, 8, 9, 511, 511, 1021, 2041, 4081, 8161,16321,32641,},
121 { 3, 5, 7, 8, 9, 9, 9, 9, 10, 1023, 1023, 2045, 4089, 8177,16353,32705,},
122 { 3, 5, 7, 8, 10, 10, 10, 10, 10, 11, 2047, 2047, 4093, 8185,16369,32737,},
123 { 3, 5, 7, 8, 10, 11, 11, 11, 11, 11, 12, 4095, 4095, 8189,16377,32753,},
124 { 3, 5, 7, 9, 10, 12, 12, 12, 12, 12, 12, 13, 8191, 8191,16381,32761,},
125 { 3, 5, 7, 9, 10, 12, 13, 13, 13, 13, 13, 13, 14,16383,16383,32765,},
126 { 3, 5, 7, 9, 10, 12, 14, 14, 14, 14, 14, 14, 14, 15,32767,32767,},
127 { 3, 5, 7, 9, 11, 12, 14, 15, 15, 15, 15, 15, 15, 15, 16,65535,},
136 for (i = 0; i <
height; i++) {
137 memset(ptr, val, width);
143 int srcSliceY,
int srcSliceH,
int width,
146 dst += dstStride * srcSliceY;
147 if (dstStride == srcStride && srcStride > 0) {
148 memcpy(dst, src, srcSliceH * dstStride);
151 for (i = 0; i < srcSliceH; i++) {
152 memcpy(dst, src, width);
160 int srcStride[],
int srcSliceY,
161 int srcSliceH,
uint8_t *dstParam[],
164 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2;
166 copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->
srcW,
167 dstParam[0], dstStride[0]);
171 srcStride[1], srcStride[2], dstStride[1]);
174 srcStride[2], srcStride[1], dstStride[1]);
180 int srcStride[],
int srcSliceY,
181 int srcSliceH,
uint8_t *dstParam[],
184 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
185 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
187 copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->
srcW,
188 dstParam[0], dstStride[0]);
192 srcStride[1], dstStride[1], dstStride[2]);
195 srcStride[1], dstStride[2], dstStride[1]);
201 int srcStride[],
int srcSliceY,
int srcSliceH,
202 uint8_t *dstParam[],
int dstStride[])
204 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
206 yv12toyuy2(src[0], src[1], src[2], dst, c->
srcW, srcSliceH, srcStride[0],
207 srcStride[1], dstStride[0]);
213 int srcStride[],
int srcSliceY,
int srcSliceH,
214 uint8_t *dstParam[],
int dstStride[])
216 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
218 yv12touyvy(src[0], src[1], src[2], dst, c->
srcW, srcSliceH, srcStride[0],
219 srcStride[1], dstStride[0]);
225 int srcStride[],
int srcSliceY,
int srcSliceH,
226 uint8_t *dstParam[],
int dstStride[])
228 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
231 srcStride[1], dstStride[0]);
237 int srcStride[],
int srcSliceY,
int srcSliceH,
238 uint8_t *dstParam[],
int dstStride[])
240 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
243 srcStride[1], dstStride[0]);
249 int srcStride[],
int srcSliceY,
int srcSliceH,
250 uint8_t *dstParam[],
int dstStride[])
252 uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY;
253 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
254 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
257 dstStride[1], srcStride[0]);
260 fillPlane(dstParam[3], dstStride[3], c->
srcW, srcSliceH, srcSliceY, 255);
266 int srcStride[],
int srcSliceY,
int srcSliceH,
267 uint8_t *dstParam[],
int dstStride[])
269 uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY;
270 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
271 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
274 dstStride[1], srcStride[0]);
280 int srcStride[],
int srcSliceY,
int srcSliceH,
281 uint8_t *dstParam[],
int dstStride[])
283 uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY;
284 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
285 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
288 dstStride[1], srcStride[0]);
291 fillPlane(dstParam[3], dstStride[3], c->
srcW, srcSliceH, srcSliceY, 255);
297 int srcStride[],
int srcSliceY,
int srcSliceH,
298 uint8_t *dstParam[],
int dstStride[])
300 uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY;
301 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
302 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
305 dstStride[1], srcStride[0]);
314 for (i = 0; i < num_pixels; i++)
315 ((uint32_t *) dst)[i] = ((
const uint32_t *) palette)[src[i << 1]] | (src[(i << 1) + 1] << 24);
323 for (i = 0; i < num_pixels; i++)
324 ((uint32_t *) dst)[i] = ((
const uint32_t *) palette)[src[i << 1]] | src[(i << 1) + 1];
332 for (i = 0; i < num_pixels; i++) {
334 dst[0] = palette[src[i << 1] * 4 + 0];
335 dst[1] = palette[src[i << 1] * 4 + 1];
336 dst[2] = palette[src[i << 1] * 4 + 2];
342 int srcStride[],
int srcSliceY,
int srcSliceH,
343 uint8_t *dst[],
int dstStride[])
347 for (p = 0; p < 4; p++) {
348 int srcstr = srcStride[p] / 2;
349 int dststr = dstStride[p] / 2;
350 uint16_t *dstPtr = (uint16_t *) dst[p];
351 const uint16_t *srcPtr = (
const uint16_t *) src[p];
353 if(!dstPtr || !srcPtr)
356 for (j = 0; j < min_stride; j++) {
368 int srcSliceY,
int srcSliceH,
uint8_t *dst[],
376 uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
377 const uint8_t *srcPtr = src[0];
388 }
else if (
usePal(srcFormat)) {
403 for (i = 0; i < srcSliceH; i++) {
405 srcPtr += srcStride[0];
406 dstPtr += dstStride[0];
414 uint16_t *dst[],
int dstStride[],
int srcSliceH,
415 int src_alpha,
int swap,
int shift,
int width)
418 int dst_alpha = dst[3] !=
NULL;
419 for (h = 0; h < srcSliceH; h++) {
420 uint16_t *src_line = (uint16_t *)(src + srcStride * h);
423 if (src_alpha && dst_alpha) {
424 for (x = 0; x <
width; x++) {
430 }
else if (dst_alpha) {
431 for (x = 0; x <
width; x++) {
437 }
else if (src_alpha) {
438 for (x = 0; x <
width; x++) {
445 for (x = 0; x <
width; x++) {
453 if (src_alpha && dst_alpha) {
454 for (x = 0; x <
width; x++) {
460 }
else if (dst_alpha) {
461 for (x = 0; x <
width; x++) {
467 }
else if (src_alpha) {
468 for (x = 0; x <
width; x++) {
475 for (x = 0; x <
width; x++) {
483 if (src_alpha && dst_alpha) {
484 for (x = 0; x <
width; x++) {
490 }
else if (dst_alpha) {
491 for (x = 0; x <
width; x++) {
497 }
else if (src_alpha) {
498 for (x = 0; x <
width; x++) {
505 for (x = 0; x <
width; x++) {
513 if (src_alpha && dst_alpha) {
514 for (x = 0; x <
width; x++) {
515 dst[0][x] = *src_line++ >>
shift;
516 dst[1][x] = *src_line++ >>
shift;
517 dst[2][x] = *src_line++ >>
shift;
518 dst[3][x] = *src_line++ >>
shift;
520 }
else if (dst_alpha) {
521 for (x = 0; x <
width; x++) {
522 dst[0][x] = *src_line++ >>
shift;
523 dst[1][x] = *src_line++ >>
shift;
524 dst[2][x] = *src_line++ >>
shift;
527 }
else if (src_alpha) {
528 for (x = 0; x <
width; x++) {
529 dst[0][x] = *src_line++ >>
shift;
530 dst[1][x] = *src_line++ >>
shift;
531 dst[2][x] = *src_line++ >>
shift;
535 for (x = 0; x <
width; x++) {
536 dst[0][x] = *src_line++ >>
shift;
537 dst[1][x] = *src_line++ >>
shift;
538 dst[2][x] = *src_line++ >>
shift;
542 for (i = 0; i < 4; i++)
543 dst[i] += dstStride[i] >> 1;
548 int srcStride[],
int srcSliceY,
int srcSliceH,
549 uint8_t *dst[],
int dstStride[])
551 uint16_t *dst2013[] = { (uint16_t *)dst[2], (uint16_t *)dst[0], (uint16_t *)dst[1], (uint16_t *)dst[3] };
552 uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] };
553 int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] };
554 int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] };
570 src_format->
name, dst_format->
name);
579 dst2013, stride2013, srcSliceH, alpha, swap,
587 dst1023, stride1023, srcSliceH, alpha, swap,
592 "unsupported conversion to planar RGB %s -> %s\n",
593 src_format->
name, dst_format->
name);
600 uint8_t *dst,
int dstStride,
int srcSliceH,
604 int src_alpha = src[3] !=
NULL;
605 int scale_high = 16 - bpp, scale_low = (bpp - 8) * 2;
606 for (h = 0; h < srcSliceH; h++) {
607 uint16_t *dest = (uint16_t *)(dst + dstStride * h);
612 if (alpha && !src_alpha) {
613 for (x = 0; x <
width; x++) {
615 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
617 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
619 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
622 }
else if (alpha && src_alpha) {
623 for (x = 0; x <
width; x++) {
625 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
627 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
629 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
631 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
634 for (x = 0; x <
width; x++) {
636 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
638 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
640 *dest++ =
av_bswap16(component << scale_high | component >> scale_low);
645 if (alpha && !src_alpha) {
646 for (x = 0; x <
width; x++) {
647 *dest++ =
av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low);
648 *dest++ =
av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low);
649 *dest++ =
av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low);
652 }
else if (alpha && src_alpha) {
653 for (x = 0; x <
width; x++) {
654 *dest++ =
av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low);
655 *dest++ =
av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low);
656 *dest++ =
av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low);
657 *dest++ =
av_bswap16(src[3][x] << scale_high | src[3][x] >> scale_low);
660 for (x = 0; x <
width; x++) {
661 *dest++ =
av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low);
662 *dest++ =
av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low);
663 *dest++ =
av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low);
668 if (alpha && !src_alpha) {
669 for (x = 0; x <
width; x++) {
675 }
else if (alpha && src_alpha) {
676 for (x = 0; x <
width; x++) {
683 for (x = 0; x <
width; x++) {
691 if (alpha && !src_alpha) {
692 for (x = 0; x <
width; x++) {
693 *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low;
694 *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low;
695 *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low;
698 }
else if (alpha && src_alpha) {
699 for (x = 0; x <
width; x++) {
700 *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low;
701 *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low;
702 *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low;
703 *dest++ = src[3][x] << scale_high | src[3][x] >> scale_low;
706 for (x = 0; x <
width; x++) {
707 *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low;
708 *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low;
709 *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low;
713 for (i = 0; i < 3 + src_alpha; i++)
714 src[i] += srcStride[i] >> 1;
719 int srcStride[],
int srcSliceY,
int srcSliceH,
720 uint8_t *dst[],
int dstStride[])
722 const uint16_t *src102[] = { (uint16_t *)src[1], (uint16_t *)src[0], (uint16_t *)src[2], (uint16_t *)src[3] };
723 const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] };
724 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };
725 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
739 bits_per_sample <= 8) {
741 src_format->
name, dst_format->
name);
748 dst[0] + srcSliceY * dstStride[0], dstStride[0],
749 srcSliceH, 0, swap, bits_per_sample, c->
srcW);
754 dst[0] + srcSliceY * dstStride[0], dstStride[0],
755 srcSliceH, 0, swap, bits_per_sample, c->
srcW);
760 dst[0] + srcSliceY * dstStride[0], dstStride[0],
761 srcSliceH, 1, swap, bits_per_sample, c->
srcW);
766 dst[0] + srcSliceY * dstStride[0], dstStride[0],
767 srcSliceH, 1, swap, bits_per_sample, c->
srcW);
771 "unsupported planar RGB conversion %s -> %s\n",
772 src_format->
name, dst_format->
name);
779 uint8_t *dst,
int dstStride,
int srcSliceH,
783 for (h = 0; h < srcSliceH; h++) {
784 uint8_t *dest = dst + dstStride *
h;
785 for (x = 0; x <
width; x++) {
791 for (i = 0; i < 3; i++)
792 src[i] += srcStride[i];
797 uint8_t *dst,
int dstStride,
int srcSliceH,
798 int alpha_first,
int width)
801 for (h = 0; h < srcSliceH; h++) {
802 uint8_t *dest = dst + dstStride *
h;
805 for (x = 0; x <
width; x++) {
812 for (x = 0; x <
width; x++) {
820 for (i = 0; i < 3; i++)
821 src[i] += srcStride[i];
826 int srcStride[],
int srcSliceY,
int srcSliceH,
827 uint8_t *dst[],
int dstStride[])
830 const uint8_t *src102[] = { src[1], src[0], src[2] };
831 const uint8_t *src201[] = { src[2], src[0], src[1] };
832 int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };
833 int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };
845 dst[0] + srcSliceY * dstStride[0], dstStride[0],
851 dst[0] + srcSliceY * dstStride[0], dstStride[0],
859 dst[0] + srcSliceY * dstStride[0], dstStride[0],
860 srcSliceH, alpha_first, c->
srcW);
867 dst[0] + srcSliceY * dstStride[0], dstStride[0],
868 srcSliceH, alpha_first, c->
srcW);
873 "unsupported planar RGB conversion %s -> %s\n",
883 int srcSliceY,
int srcSliceH,
884 uint8_t *dst[],
int dstStride[])
886 copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->
srcW,
887 dst[0], dstStride[0]);
888 copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->
srcW,
889 dst[1], dstStride[1]);
890 copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->
srcW,
891 dst[2], dstStride[2]);
893 fillPlane(dst[3], dstStride[3], c->
srcW, srcSliceH, srcSliceY, 255);
899 uint8_t *dst[],
int dstStride[],
int srcSliceH,
900 int alpha_first,
int inc_size,
int width)
912 for (h = 0; h < srcSliceH; h++) {
913 for (x = 0; x <
width; x++) {
920 src += srcStride - width * inc_size;
921 dest[0] += dstStride[0];
922 dest[1] += dstStride[1];
923 dest[2] += dstStride[2];
928 int srcStride[],
int srcSliceY,
int srcSliceH,
929 uint8_t *dst[],
int dstStride[])
932 int stride102[] = { dstStride[1], dstStride[0], dstStride[2] };
933 int stride201[] = { dstStride[2], dstStride[0], dstStride[1] };
934 uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1],
935 dst[0] + srcSliceY * dstStride[0],
936 dst[2] + srcSliceY * dstStride[2] };
937 uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2],
938 dst[0] + srcSliceY * dstStride[0],
939 dst[1] + srcSliceY * dstStride[1] };
944 stride201, srcSliceH, alpha_first, 3, c->
srcW);
948 stride102, srcSliceH, alpha_first, 3, c->
srcW);
954 stride201, srcSliceH, alpha_first, 4, c->
srcW);
960 stride102, srcSliceH, alpha_first, 4, c->
srcW);
964 "unsupported planar RGB conversion %s -> %s\n",
974 #define BAYER_RENAME(x) bayer_gbrg8_to_##x
979 #define BAYER_RENAME(x) bayer_gbrg16le_to_##x
984 #define BAYER_RENAME(x) bayer_gbrg16be_to_##x
989 #define BAYER_RENAME(x) bayer_grbg8_to_##x
994 #define BAYER_RENAME(x) bayer_grbg16le_to_##x
999 #define BAYER_RENAME(x) bayer_grbg16be_to_##x
1004 #define BAYER_RENAME(x) bayer_bggr8_to_##x
1009 #define BAYER_RENAME(x) bayer_bggr16le_to_##x
1014 #define BAYER_RENAME(x) bayer_bggr16be_to_##x
1019 #define BAYER_RENAME(x) bayer_rggb8_to_##x
1024 #define BAYER_RENAME(x) bayer_rggb16le_to_##x
1029 #define BAYER_RENAME(x) bayer_rggb16be_to_##x
1033 int srcSliceH,
uint8_t* dst[],
int dstStride[])
1036 const uint8_t *srcPtr= src[0];
1042 #define CASE(pixfmt, prefix) \
1043 case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \
1044 interpolate = bayer_##prefix##_to_rgb24_interpolate; \
1062 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->
srcW);
1063 srcPtr += 2 * srcStride[0];
1064 dstPtr += 2 * dstStride[0];
1066 for (i = 2; i < srcSliceH - 2; i += 2) {
1068 srcPtr += 2 * srcStride[0];
1069 dstPtr += 2 * dstStride[0];
1072 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->
srcW);
1077 int srcSliceH,
uint8_t* dst[],
int dstStride[])
1079 const uint8_t *srcPtr= src[0];
1088 #define CASE(pixfmt, prefix) \
1089 case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \
1090 interpolate = bayer_##prefix##_to_yv12_interpolate; \
1109 srcPtr += 2 * srcStride[0];
1110 dstY += 2 * dstStride[0];
1111 dstU += dstStride[1];
1112 dstV += dstStride[1];
1114 for (i = 2; i < srcSliceH - 2; i += 2) {
1116 srcPtr += 2 * srcStride[0];
1117 dstY += 2 * dstStride[0];
1118 dstU += dstStride[1];
1119 dstV += dstStride[1];
1126 #define isRGBA32(x) ( \
1127 (x) == AV_PIX_FMT_ARGB \
1128 || (x) == AV_PIX_FMT_RGBA \
1129 || (x) == AV_PIX_FMT_BGRA \
1130 || (x) == AV_PIX_FMT_ABGR \
1133 #define isRGBA64(x) ( \
1134 (x) == AV_PIX_FMT_RGBA64LE \
1135 || (x) == AV_PIX_FMT_RGBA64BE \
1136 || (x) == AV_PIX_FMT_BGRA64LE \
1137 || (x) == AV_PIX_FMT_BGRA64BE \
1140 #define isRGB48(x) ( \
1141 (x) == AV_PIX_FMT_RGB48LE \
1142 || (x) == AV_PIX_FMT_RGB48BE \
1143 || (x) == AV_PIX_FMT_BGR48LE \
1144 || (x) == AV_PIX_FMT_BGR48BE \
1157 #define IS_NOT_NE(bpp, desc) \
1158 (((bpp + 7) >> 3) == 2 && \
1159 (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN))
1161 #define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst)
1181 else if (
CONV_IS(RGB48LE, BGR48BE)
1186 if (
CONV_IS(RGBA64LE, BGR48LE)
1190 else if (
CONV_IS(RGBA64LE, BGR48BE)
1194 else if (
CONV_IS(RGBA64LE, RGB48LE)
1198 else if (
CONV_IS(RGBA64LE, RGB48BE)
1206 switch (srcId | (dstId << 16)) {
1207 case 0x000F000C: conv =
rgb12to15;
break;
1208 case 0x000F0010: conv =
rgb16to15;
break;
1209 case 0x000F0018: conv =
rgb24to15;
break;
1210 case 0x000F0020: conv =
rgb32to15;
break;
1211 case 0x0010000F: conv =
rgb15to16;
break;
1212 case 0x00100018: conv =
rgb24to16;
break;
1213 case 0x00100020: conv =
rgb32to16;
break;
1214 case 0x0018000F: conv =
rgb15to24;
break;
1215 case 0x00180010: conv =
rgb16to24;
break;
1216 case 0x00180020: conv =
rgb32to24;
break;
1217 case 0x0020000F: conv =
rgb15to32;
break;
1218 case 0x00200010: conv =
rgb16to32;
break;
1219 case 0x00200018: conv =
rgb24to32;
break;
1223 switch (srcId | (dstId << 16)) {
1256 int srcSliceY,
int srcSliceH,
uint8_t *dst[],
1272 const uint8_t *srcPtr = src[0];
1285 for (i = 0; i < srcSliceH; i++)
1286 dstPtr[dstStride[0] * (srcSliceY + i)] = 255;
1290 if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&
1291 !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap)
1292 conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,
1293 (srcSliceH - 1) * srcStride[0] + c->
srcW * srcBpp);
1296 dstPtr += dstStride[0] * srcSliceY;
1298 for (i = 0; i < srcSliceH; i++) {
1300 for(j=0; j<c->
srcW; j++)
1304 conv(srcPtr, dstPtr, c->
srcW * srcBpp);
1306 for(j=0; j<c->
srcW; j++)
1307 ((uint16_t*)dstPtr)[j] =
av_bswap16(((uint16_t*)dstPtr)[j]);
1308 srcPtr += srcStride[0];
1309 dstPtr += dstStride[0];
1317 int srcStride[],
int srcSliceY,
int srcSliceH,
1318 uint8_t *dst[],
int dstStride[])
1322 dst[0] + srcSliceY * dstStride[0],
1323 dst[1] + (srcSliceY >> 1) * dstStride[1],
1324 dst[2] + (srcSliceY >> 1) * dstStride[2],
1326 dstStride[0], dstStride[1], srcStride[0],
1329 fillPlane(dst[3], dstStride[3], c->
srcW, srcSliceH, srcSliceY, 255);
1334 int srcStride[],
int srcSliceY,
int srcSliceH,
1335 uint8_t *dst[],
int dstStride[])
1337 copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->
srcW,
1338 dst[0], dstStride[0]);
1340 planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->
chrSrcW,
1341 srcSliceH >> 2, srcStride[1], dstStride[1]);
1342 planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->
chrSrcW,
1343 srcSliceH >> 2, srcStride[2], dstStride[2]);
1345 fillPlane(dst[3], dstStride[3], c->
srcW, srcSliceH, srcSliceY, 255);
1351 int srcStride[],
int srcSliceY,
int srcSliceH,
1352 uint8_t *dst[],
int dstStride[])
1354 if (dstStride[0] == srcStride[0] && srcStride[0] > 0)
1355 memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], srcSliceH * dstStride[0]);
1358 const uint8_t *srcPtr = src[0];
1359 uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
1363 while (length + c->
srcW <=
FFABS(dstStride[0]) &&
1364 length + c->
srcW <=
FFABS(srcStride[0]))
1368 for (i = 0; i < srcSliceH; i++) {
1369 memcpy(dstPtr, srcPtr, length);
1370 srcPtr += srcStride[0];
1371 dstPtr += dstStride[0];
1377 #define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\
1378 uint16_t scale= dither_scale[dst_depth-1][src_depth-1];\
1379 int shift= src_depth-dst_depth + dither_scale[src_depth-2][dst_depth-1];\
1380 for (i = 0; i < height; i++) {\
1381 const uint8_t *dither= dithers[src_depth-9][i&7];\
1382 for (j = 0; j < length-7; j+=8){\
1383 dst[j+0] = dbswap((bswap(src[j+0]) + dither[0])*scale>>shift);\
1384 dst[j+1] = dbswap((bswap(src[j+1]) + dither[1])*scale>>shift);\
1385 dst[j+2] = dbswap((bswap(src[j+2]) + dither[2])*scale>>shift);\
1386 dst[j+3] = dbswap((bswap(src[j+3]) + dither[3])*scale>>shift);\
1387 dst[j+4] = dbswap((bswap(src[j+4]) + dither[4])*scale>>shift);\
1388 dst[j+5] = dbswap((bswap(src[j+5]) + dither[5])*scale>>shift);\
1389 dst[j+6] = dbswap((bswap(src[j+6]) + dither[6])*scale>>shift);\
1390 dst[j+7] = dbswap((bswap(src[j+7]) + dither[7])*scale>>shift);\
1392 for (; j < length; j++)\
1393 dst[j] = dbswap((bswap(src[j]) + dither[j&7])*scale>>shift);\
1399 int srcStride[],
int srcSliceY,
int srcSliceH,
1400 uint8_t *dst[],
int dstStride[])
1405 for (plane = 0; plane < 4; plane++) {
1411 int shiftonly = plane == 1 || plane == 2 || (!c->
srcRange && plane == 0);
1416 if (plane == 1 && !dst[2])
continue;
1417 if (!src[plane] || (plane == 1 && !src[2])) {
1419 fillPlane16(dst[plane], dstStride[plane], length, height, y,
1423 fillPlane(dst[plane], dstStride[plane], length, height, y,
1424 (plane == 3) ? 255 : 128);
1432 const uint16_t *srcPtr2 = (
const uint16_t *) srcPtr;
1433 uint16_t *dstPtr2 = (uint16_t*)dstPtr;
1435 if (dst_depth == 8) {
1437 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , )
1441 }
else if (src_depth == 8) {
1442 for (i = 0; i <
height; i++) {
1445 for (j = 0; j < length; j++)\
1446 w(&dstPtr2[j], srcPtr[j]<<(dst_depth-8));\
1448 for (j = 0; j < length; j++)\
1449 w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\
1450 (srcPtr[j]>>(2*8-dst_depth)));\
1457 dstPtr2 += dstStride[
plane]/2;
1458 srcPtr += srcStride[
plane];
1460 }
else if (src_depth <= dst_depth) {
1461 for (i = 0; i <
height; i++) {
1466 unsigned shift = dst_depth - src_depth;
1468 #define FAST_COPY_UP(shift) \
1469 for (; j < length - 3; j += 4) { \
1470 uint64_t v = AV_RN64A(srcPtr2 + j); \
1471 AV_WN64A(dstPtr2 + j, v << shift); \
1474 #define FAST_COPY_UP(shift) \
1475 for (; j < length - 1; j += 2) { \
1476 uint32_t v = AV_RN32A(srcPtr2 + j); \
1477 AV_WN32A(dstPtr2 + j, v << shift); \
1486 #define COPY_UP(r,w) \
1488 for (; j < length; j++){ \
1489 unsigned int v= r(&srcPtr2[j]);\
1490 w(&dstPtr2[j], v<<(dst_depth-src_depth));\
1493 for (; j < length; j++){ \
1494 unsigned int v= r(&srcPtr2[j]);\
1495 w(&dstPtr2[j], (v<<(dst_depth-src_depth)) | \
1496 (v>>(2*src_depth-dst_depth)));\
1512 dstPtr2 += dstStride[
plane]/2;
1513 srcPtr2 += srcStride[
plane]/2;
1518 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , )
1533 for (i = 0; i <
height; i++) {
1534 for (j = 0; j <
length; j++)
1535 ((uint16_t *) dstPtr)[j] =
av_bswap16(((
const uint16_t *) srcPtr)[j]);
1536 srcPtr += srcStride[
plane];
1537 dstPtr += dstStride[
plane];
1539 }
else if (dstStride[plane] == srcStride[plane] &&
1540 srcStride[plane] > 0 && srcStride[plane] == length) {
1541 memcpy(dst[plane] + dstStride[plane] * y, src[plane],
1542 height * dstStride[plane]);
1548 for (i = 0; i <
height; i++) {
1549 memcpy(dstPtr, srcPtr, length);
1550 srcPtr += srcStride[
plane];
1551 dstPtr += dstStride[
plane];
1560 #define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) \
1561 ((src_fmt == pix_fmt ## BE && dst_fmt == pix_fmt ## LE) || \
1562 (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE))
1570 const int dstH = c->
dstH;
1573 needsDither =
isAnyRGB(dstFormat) &&
1616 #define isByteRGB(f) ( \
1617 f == AV_PIX_FMT_RGB32 || \
1618 f == AV_PIX_FMT_RGB32_1 || \
1619 f == AV_PIX_FMT_RGB24 || \
1620 f == AV_PIX_FMT_BGR32 || \
1621 f == AV_PIX_FMT_BGR32_1 || \
1622 f == AV_PIX_FMT_BGR24)
1660 else if (!
isBayer(dstFormat)) {
1743 #define isPlanarGray(x) (isGray(x) && (x) != AV_PIX_FMT_YA8 && (x) != AV_PIX_FMT_YA16LE && (x) != AV_PIX_FMT_YA16BE)
1745 if ( srcFormat == dstFormat ||
1775 for (i = 0; i < num_pixels; i++)
1776 ((uint32_t *) dst)[i] = ((
const uint32_t *) palette)[src[i]];
1785 for (i = 0; i < num_pixels; i++) {
1787 dst[0] = palette[src[i] * 4 + 0];
1788 dst[1] = palette[src[i] * 4 + 1];
1789 dst[2] = palette[src[i] * 4 + 2];
#define IS_NOT_NE(bpp, desc)
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size)
static const uint16_t dither_scale[15][16]
const char const char void * val
static int shift(int a, int b)
#define AV_PIX_FMT_YUV440P10
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
static int conv(int samples, float **pcm, char *buf, int channels)
void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
#define AV_PIX_FMT_YUV444P14
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
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, int32_t *rgb2yuv)
Height should be a multiple of 2 and width should be a multiple of 2.
void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size)
packed RGB 8:8:8, 24bpp, RGBRGB...
void(* planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride)
static void packed16togbra16(const uint8_t *src, int srcStride, uint16_t *dst[], int dstStride[], int srcSliceH, int src_alpha, int swap, int shift, int width)
#define AV_PIX_FMT_RGBA64
void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size)
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_GBRP10
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
static void gbr24ptopacked32(const uint8_t *src[], int srcStride[], uint8_t *dst, int dstStride, int srcSliceH, int alpha_first, int width)
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)
int dstFormatBpp
Number of bits per pixel of the destination pixel format.
#define DECLARE_ALIGNED(n, t, v)
#define AV_PIX_FMT_BGRA64
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.
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
planar GBR 4:4:4 36bpp, little-endian
static void gbr24ptopacked24(const uint8_t *src[], int srcStride[], uint8_t *dst, int dstStride, int srcSliceH, int width)
#define AV_PIX_FMT_YUV420P12
int srcRange
0 = MPG YUV range, 1 = JPG YUV range (source image).
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
void(* rgb32to16)(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_RGB444
#define CASE(pixfmt, prefix)
planar GBR 4:4:4 36bpp, big-endian
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
void rgb48tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size)
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)
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)
planar GBRA 4:4:4:4 64bpp, big-endian
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
int chrDstVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination i...
static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
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.
static int rgbToPlanarRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static void interpolate(float *out, float v1, float v2, int size)
void(* rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
#define SWS_FAST_BILINEAR
static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
planar GBR 4:4:4 48bpp, big-endian
static int planarRgbToplanarRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define AV_PIX_FMT_YUV444P16
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
enum AVPixelFormat dstFormat
Destination pixel format.
#define AV_PIX_FMT_YUV422P12
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
int chrSrcHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source imag...
#define AV_PIX_FMT_BAYER_GRBG16
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.
int dstH
Height of destination luma/alpha planes.
void ff_get_unscaled_swscale(SwsContext *c)
Set c->swscale to an unscaled converter if one exists for the specific source and destination formats...
static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
planar GBR 4:4:4 27bpp, big-endian
void rgb64to48_nobswap(const uint8_t *src, uint8_t *dst, int src_size)
#define CONV_IS(src, dst)
uint16_t depth_minus1
Number of bits in the component minus 1.
static double alpha(void *priv, double x, double y)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PIX_FMT_BGR32_1
static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
static rgbConvFn findRgbConvFn(SwsContext *c)
static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void(* rgb16to32)(const uint8_t *src, uint8_t *dst, int src_size)
#define FAST_COPY_UP(shift)
static int planarRgb16ToRgb16Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void(* rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
simple assert() macros that are a bit more flexible than ISO C assert().
static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, uint8_t val)
#define AV_PIX_FMT_YUV444P10
static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
static const uint8_t dithers[8][8][8]
#define AV_PIX_FMT_GBRAP16
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define AV_PIX_FMT_YUV422P9
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
as above, but U and V bytes are swapped
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GRAY16
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
uint8_t * formatConvBuffer
void(* rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
#define FF_CEIL_RSHIFT(a, b)
void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void(* rgbConvFn)(const uint8_t *, uint8_t *, int)
packed RGB 8:8:8, 24bpp, BGRBGR...
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
void rgb64tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_BAYER_BGGR16
#define AV_PIX_FMT_YUV444P9
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
#define AV_PIX_FMT_GBRP14
static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_BGR555
#define AV_PIX_FMT_BAYER_GBRG16
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
void(* rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_YUV420P14
void(* rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt)
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
planar GBR 4:4:4 30bpp, big-endian
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
planar GBR 4:4:4 42bpp, little-endian
static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], uint8_t *dst, int dstStride, int srcSliceH, int alpha, int swap, int bpp, int width)
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb32to15)(const uint8_t *src, uint8_t *dst, int src_size)
BYTE int const BYTE int int int height
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
void(* shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size)
SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
#define AV_PIX_FMT_YUV440P12
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
planar GBR 4:4:4 42bpp, big-endian
static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
#define AV_PIX_FMT_YUV420P9
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size)
#define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)
void(* shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size)
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y, int alpha, int bits, const int big_endian)
static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_AYUV64
void(* rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV422P10
static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define AV_PIX_FMT_YUV444P12
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_BAYER_RGGB16
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.
GLint GLenum GLboolean GLsizei stride
static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar GBRA 4:4:4:4 32bpp
planar GBR 4:4:4 27bpp, little-endian
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
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)
void(* rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_BGR444
enum AVPixelFormat srcFormat
Source pixel format.
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
static void packedtogbr24p(const uint8_t *src, int srcStride, uint8_t *dst[], int dstStride[], int srcSliceH, int alpha_first, int inc_size, int width)
#define AV_PIX_FMT_RGB555
void rgb48tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
static void copyPlane(const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride)
void(* rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
SwsFunc swscale
Note that src, dst, srcStride, dstStride will be copied in the sws_scale() wrapper so they can be fre...
void(* rgb24to16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
static int planarToUyvyWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
void(* rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
#define AV_PIX_FMT_RGB32_1
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[])
int srcFormatBpp
Number of bits per pixel of the source pixel format.
void rgb64to48_bswap(const uint8_t *src, uint8_t *dst, int src_size)
av_cold void ff_get_unscaled_swscale_ppc(SwsContext *c)
static int packedCopyWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
#define AV_PIX_FMT_RGB565
static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
int32_t input_rgb2yuv_table[16+40 *4]
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
planar GBR 4:4:4 48bpp, little-endian
static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int chrDstHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination...
int chrSrcW
Width of source chroma planes.
planar GBRA 4:4:4:4 64bpp, little-endian
int srcW
Width of source luma/alpha planes.
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
int chrSrcVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image...
int flags
Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
static av_always_inline uint32_t rgb2yuv(const uint32_t *r2y, uint32_t c)
#define AV_PIX_FMT_YUV422P16
void(* rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
planar GBR 4:4:4 30bpp, little-endian
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)