40 { 1, 3, 1, 3, 1, 3, 1, 3, },
41 { 2, 0, 2, 0, 2, 0, 2, 0, },
42 { 1, 3, 1, 3, 1, 3, 1, 3, },
46 { 6, 2, 6, 2, 6, 2, 6, 2, },
47 { 0, 4, 0, 4, 0, 4, 0, 4, },
48 { 6, 2, 6, 2, 6, 2, 6, 2, },
52 { 8, 4, 11, 7, 8, 4, 11, 7, },
53 { 2, 14, 1, 13, 2, 14, 1, 13, },
54 { 10, 6, 9, 5, 10, 6, 9, 5, },
55 { 0, 12, 3, 15, 0, 12, 3, 15, },
56 { 8, 4, 11, 7, 8, 4, 11, 7, },
60 { 17, 9, 23, 15, 16, 8, 22, 14, },
61 { 5, 29, 3, 27, 4, 28, 2, 26, },
62 { 21, 13, 19, 11, 20, 12, 18, 10, },
63 { 0, 24, 6, 30, 1, 25, 7, 31, },
64 { 16, 8, 22, 14, 17, 9, 23, 15, },
65 { 4, 28, 2, 26, 5, 29, 3, 27, },
66 { 20, 12, 18, 10, 21, 13, 19, 11, },
67 { 1, 25, 7, 31, 0, 24, 6, 30, },
68 { 17, 9, 23, 15, 16, 8, 22, 14, },
72 { 0, 55, 14, 68, 3, 58, 17, 72, },
73 { 37, 18, 50, 32, 40, 22, 54, 35, },
74 { 9, 64, 5, 59, 13, 67, 8, 63, },
75 { 46, 27, 41, 23, 49, 31, 44, 26, },
76 { 2, 57, 16, 71, 1, 56, 15, 70, },
77 { 39, 21, 52, 34, 38, 19, 51, 33, },
78 { 11, 66, 7, 62, 10, 65, 6, 60, },
79 { 48, 30, 43, 25, 47, 29, 42, 24, },
80 { 0, 55, 14, 68, 3, 58, 17, 72, },
85 {117, 62, 158, 103, 113, 58, 155, 100, },
86 { 34, 199, 21, 186, 31, 196, 17, 182, },
87 {144, 89, 131, 76, 141, 86, 127, 72, },
88 { 0, 165, 41, 206, 10, 175, 52, 217, },
89 {110, 55, 151, 96, 120, 65, 162, 107, },
90 { 28, 193, 14, 179, 38, 203, 24, 189, },
91 {138, 83, 124, 69, 148, 93, 134, 79, },
92 { 7, 172, 48, 213, 3, 168, 45, 210, },
93 {117, 62, 158, 103, 113, 58, 155, 100, },
98 { 0, 143, 18, 200, 2, 156, 25, 215, },
99 { 78, 28, 125, 64, 89, 36, 138, 74, },
100 { 10, 180, 3, 161, 16, 195, 8, 175, },
101 {109, 51, 93, 38, 121, 60, 105, 47, },
102 { 1, 152, 23, 210, 0, 147, 20, 205, },
103 { 85, 33, 134, 71, 81, 30, 130, 67, },
104 { 14, 190, 6, 171, 12, 185, 5, 166, },
105 {117, 57, 101, 44, 113, 54, 97, 41, },
106 { 0, 143, 18, 200, 2, 156, 25, 215, },
111 { 0, 124, 8, 193, 0, 140, 12, 213, },
112 { 55, 14, 104, 42, 66, 19, 119, 52, },
113 { 3, 168, 1, 145, 6, 187, 3, 162, },
114 { 86, 31, 70, 21, 99, 39, 82, 28, },
115 { 0, 134, 11, 206, 0, 129, 9, 200, },
116 { 62, 17, 114, 48, 58, 16, 109, 45, },
117 { 5, 181, 2, 157, 4, 175, 1, 151, },
118 { 95, 36, 78, 26, 90, 34, 74, 24, },
119 { 0, 124, 8, 193, 0, 140, 12, 213, },
124 { 0, 107, 3, 187, 0, 125, 6, 212, },
125 { 39, 7, 86, 28, 49, 11, 102, 36, },
126 { 1, 158, 0, 131, 3, 180, 1, 151, },
127 { 68, 19, 52, 12, 81, 25, 64, 17, },
128 { 0, 119, 5, 203, 0, 113, 4, 195, },
129 { 45, 9, 96, 33, 42, 8, 91, 30, },
130 { 2, 172, 1, 144, 2, 165, 0, 137, },
131 { 77, 23, 60, 15, 72, 21, 56, 14, },
132 { 0, 107, 3, 187, 0, 125, 6, 212, },
136 #define output_pixel(pos, val, bias, signedness) \
138 AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
140 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
145 int big_endian,
int output_bits)
151 for (
i = 0;
i < dstW;
i++) {
159 const int32_t **
src, uint16_t *dest,
int dstW,
160 int big_endian,
int output_bits)
166 for (
i = 0;
i < dstW;
i++) {
176 for (j = 0; j < filterSize; j++)
185 const int16_t *chrFilter,
int chrFilterSize,
186 const int16_t **chrUSrc,
const int16_t **chrVSrc,
187 uint8_t *dest8,
int chrDstW,
int output_bits)
189 uint16_t *dest = (uint16_t*)dest8;
196 for (
i = 0;
i < chrDstW;
i++) {
198 int v = 1 << (
shift - 1);
203 for (j = 0; j < chrFilterSize; j++) {
204 u += uSrc[j][
i] * (unsigned)chrFilter[j];
205 v += vSrc[j][
i] * (unsigned)chrFilter[j];
216 static const int big_endian = HAVE_BIGENDIAN;
217 static const int shift = 3;
218 static const float float_mult = 1.0f / 65535.0f;
222 for (
i = 0;
i < dstW; ++
i){
225 dest[
i] = float_mult * (float)val_uint;
232 static const int big_endian = HAVE_BIGENDIAN;
233 static const int shift = 3;
234 static const float float_mult = 1.0f / 65535.0f;
238 for (
i = 0;
i < dstW; ++
i){
247 float *dest,
int dstW)
249 static const int big_endian = HAVE_BIGENDIAN;
250 static const int shift = 15;
251 static const float float_mult = 1.0f / 65535.0f;
255 for (
i = 0;
i < dstW; ++
i){
256 val = (1 << (
shift - 1)) - 0x40000000;
257 for (j = 0; j < filterSize; ++j){
261 dest[
i] = float_mult * (float)val_uint;
267 uint32_t *dest,
int dstW)
269 static const int big_endian = HAVE_BIGENDIAN;
270 static const int shift = 15;
271 static const float float_mult = 1.0f / 65535.0f;
275 for (
i = 0;
i < dstW; ++
i){
276 val = (1 << (
shift - 1)) - 0x40000000;
277 for (j = 0; j < filterSize; ++j){
285 #define yuv2plane1_float(template, dest_type, BE_LE) \
286 static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
287 const uint8_t *dither, int offset) \
289 template((const int32_t *)src, (dest_type *)dest, dstW); \
292 #define yuv2planeX_float(template, dest_type, BE_LE) \
293 static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
294 const int16_t **src, uint8_t *dest, int dstW, \
295 const uint8_t *dither, int offset) \
297 template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
314 #define output_pixel(pos, val) \
316 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
318 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
322 yuv2plane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
323 int big_endian,
int output_bits)
326 int shift = 15 - output_bits;
328 for (
i = 0;
i < dstW;
i++) {
336 const int16_t **
src, uint16_t *dest,
int dstW,
337 int big_endian,
int output_bits)
340 int shift = 11 + 16 - output_bits;
342 for (
i = 0;
i < dstW;
i++) {
346 for (j = 0; j < filterSize; j++)
355 #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
356 static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
357 uint8_t *dest, int dstW, \
358 const uint8_t *dither, int offset)\
360 yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
361 (uint16_t *) dest, dstW, is_be, bits); \
363 static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
364 const int16_t **src, uint8_t *dest, int dstW, \
365 const uint8_t *dither, int offset)\
367 yuv2planeX_## template_size ## _c_template(filter, \
368 filterSize, (const typeX_t **) src, \
369 (uint16_t *) dest, dstW, is_be, bits); \
384 static void yuv2nv12cX_16LE_c(
enum AVPixelFormat dstFormat,
const uint8_t *chrDither,
385 const int16_t *chrFilter,
int chrFilterSize,
386 const int16_t **chrUSrc,
const int16_t **chrVSrc,
387 uint8_t *dest8,
int chrDstW)
393 const int16_t *chrFilter,
int chrFilterSize,
394 const int16_t **chrUSrc,
const int16_t **chrVSrc,
395 uint8_t *dest8,
int chrDstW)
401 const int16_t **
src, uint8_t *dest,
int dstW,
405 for (
i=0;
i<dstW;
i++) {
408 for (j=0; j<filterSize; j++)
419 for (
i=0;
i<dstW;
i++) {
426 const int16_t *chrFilter,
int chrFilterSize,
427 const int16_t **chrUSrc,
const int16_t **chrVSrc,
428 uint8_t *dest,
int chrDstW)
433 for (
i=0;
i<chrDstW;
i++) {
434 int u = chrDither[
i & 7] << 12;
435 int v = chrDither[(
i + 3) & 7] << 12;
437 for (j=0; j<chrFilterSize; j++) {
438 u += chrUSrc[j][
i] * chrFilter[j];
439 v += chrVSrc[j][
i] * chrFilter[j];
446 for (
i=0;
i<chrDstW;
i++) {
447 int u = chrDither[
i & 7] << 12;
448 int v = chrDither[(
i + 3) & 7] << 12;
450 for (j=0; j<chrFilterSize; j++) {
451 u += chrUSrc[j][
i] * chrFilter[j];
452 v += chrVSrc[j][
i] * chrFilter[j];
461 #define output_pixel(pos, val) \
463 AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
465 AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
469 uint16_t *dest,
int dstW,
475 for (
i = 0;
i < dstW;
i++) {
482 const int16_t **
src, uint16_t *dest,
int dstW,
488 for (
i = 0;
i < dstW;
i++) {
491 for (j = 0; j < filterSize; j++)
499 const int16_t *chrFilter,
int chrFilterSize,
500 const int16_t **chrUSrc,
const int16_t **chrVSrc,
501 uint8_t *dest8,
int chrDstW)
503 uint16_t *dest = (uint16_t*)dest8;
507 for (
i = 0;
i < chrDstW;
i++) {
509 int v = 1 << (
shift - 1);
511 for (j = 0; j < chrFilterSize; j++) {
512 u += chrUSrc[j][
i] * chrFilter[j];
513 v += chrVSrc[j][
i] * chrFilter[j];
522 uint8_t *dest,
int dstW,
529 uint8_t *dest,
int dstW,
536 const int16_t **
src, uint8_t *dest,
int dstW,
543 const int16_t **
src, uint8_t *dest,
int dstW,
550 const int16_t *chrFilter,
int chrFilterSize,
551 const int16_t **chrUSrc,
const int16_t **chrVSrc,
552 uint8_t *dest8,
int chrDstW)
554 yuv2p010cX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW);
558 const int16_t *chrFilter,
int chrFilterSize,
559 const int16_t **chrUSrc,
const int16_t **chrVSrc,
560 uint8_t *dest8,
int chrDstW)
562 yuv2p010cX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW);
568 #define accumulate_bit(acc, val) \
571 #define output_pixel(pos, acc) \
572 if (target == AV_PIX_FMT_MONOBLACK) { \
580 const int16_t **lumSrc,
int lumFilterSize,
581 const int16_t *chrFilter,
const int16_t **chrUSrc,
582 const int16_t **chrVSrc,
int chrFilterSize,
583 const int16_t **alpSrc, uint8_t *dest,
int dstW,
591 for (
i = 0;
i < dstW;
i += 2) {
596 for (j = 0; j < lumFilterSize; j++) {
597 Y1 += lumSrc[j][
i] * lumFilter[j];
598 Y2 += lumSrc[j][
i+1] * lumFilter[j];
602 if ((Y1 | Y2) & 0x100) {
607 Y1 += (7*err + 1*
c->dither_error[0][
i] + 5*
c->dither_error[0][
i+1] + 3*
c->dither_error[0][
i+2] + 8 - 256)>>4;
608 c->dither_error[0][
i] = err;
609 acc = 2*
acc + (Y1 >= 128);
612 err = Y2 + ((7*Y1 + 1*
c->dither_error[0][
i+1] + 5*
c->dither_error[0][
i+2] + 3*
c->dither_error[0][
i+3] + 8 - 256)>>4);
613 c->dither_error[0][
i+1] = Y1;
614 acc = 2*
acc + (err >= 128);
624 c->dither_error[0][
i] = err;
633 const int16_t *ubuf[2],
const int16_t *vbuf[2],
634 const int16_t *abuf[2], uint8_t *dest,
int dstW,
635 int yalpha,
int uvalpha,
int y,
638 const int16_t *buf0 = buf[0], *buf1 = buf[1];
640 int yalpha1 = 4096 - yalpha;
647 for (
i = 0;
i < dstW;
i +=2) {
650 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
651 Y += (7*err + 1*
c->dither_error[0][
i] + 5*
c->dither_error[0][
i+1] + 3*
c->dither_error[0][
i+2] + 8 - 256)>>4;
652 c->dither_error[0][
i] = err;
656 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
657 err += (7*
Y + 1*
c->dither_error[0][
i+1] + 5*
c->dither_error[0][
i+2] + 3*
c->dither_error[0][
i+3] + 8 - 256)>>4;
658 c->dither_error[0][
i+1] =
Y;
659 acc = 2*
acc + (err >= 128);
665 c->dither_error[0][
i] = err;
667 for (
i = 0;
i < dstW;
i += 8) {
670 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
672 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
674 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
676 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
678 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
680 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
682 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
684 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
694 const int16_t *ubuf[2],
const int16_t *vbuf[2],
695 const int16_t *abuf0, uint8_t *dest,
int dstW,
704 for (
i = 0;
i < dstW;
i +=2) {
707 Y = ((buf0[
i + 0] + 64) >> 7);
708 Y += (7*err + 1*
c->dither_error[0][
i] + 5*
c->dither_error[0][
i+1] + 3*
c->dither_error[0][
i+2] + 8 - 256)>>4;
709 c->dither_error[0][
i] = err;
713 err = ((buf0[
i + 1] + 64) >> 7);
714 err += (7*
Y + 1*
c->dither_error[0][
i+1] + 5*
c->dither_error[0][
i+2] + 3*
c->dither_error[0][
i+3] + 8 - 256)>>4;
715 c->dither_error[0][
i+1] =
Y;
716 acc = 2*
acc + (err >= 128);
722 c->dither_error[0][
i] = err;
724 for (
i = 0;
i < dstW;
i += 8) {
741 #undef accumulate_bit
743 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
744 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
745 const int16_t **lumSrc, int lumFilterSize, \
746 const int16_t *chrFilter, const int16_t **chrUSrc, \
747 const int16_t **chrVSrc, int chrFilterSize, \
748 const int16_t **alpSrc, uint8_t *dest, int dstW, \
751 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
752 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
753 alpSrc, dest, dstW, y, fmt); \
756 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
757 const int16_t *ubuf[2], const int16_t *vbuf[2], \
758 const int16_t *abuf[2], uint8_t *dest, int dstW, \
759 int yalpha, int uvalpha, int y) \
761 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
762 dest, dstW, yalpha, uvalpha, y, fmt); \
765 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
766 const int16_t *ubuf[2], const int16_t *vbuf[2], \
767 const int16_t *abuf0, uint8_t *dest, int dstW, \
768 int uvalpha, int y) \
770 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
771 abuf0, dest, dstW, uvalpha, \
778 #define output_pixels(pos, Y1, U, Y2, V) \
779 if (target == AV_PIX_FMT_YUYV422) { \
780 dest[pos + 0] = Y1; \
782 dest[pos + 2] = Y2; \
784 } else if (target == AV_PIX_FMT_YVYU422) { \
785 dest[pos + 0] = Y1; \
787 dest[pos + 2] = Y2; \
791 dest[pos + 1] = Y1; \
793 dest[pos + 3] = Y2; \
798 const int16_t **lumSrc,
int lumFilterSize,
799 const int16_t *chrFilter,
const int16_t **chrUSrc,
800 const int16_t **chrVSrc,
int chrFilterSize,
801 const int16_t **alpSrc, uint8_t *dest,
int dstW,
806 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
813 for (j = 0; j < lumFilterSize; j++) {
814 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
815 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
817 for (j = 0; j < chrFilterSize; j++) {
818 U += chrUSrc[j][
i] * chrFilter[j];
819 V += chrVSrc[j][
i] * chrFilter[j];
825 if ((Y1 | Y2 |
U |
V) & 0x100) {
837 const int16_t *ubuf[2],
const int16_t *vbuf[2],
838 const int16_t *abuf[2], uint8_t *dest,
int dstW,
839 int yalpha,
int uvalpha,
int y,
842 const int16_t *buf0 = buf[0], *buf1 = buf[1],
843 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
844 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
845 int yalpha1 = 4096 - yalpha;
846 int uvalpha1 = 4096 - uvalpha;
851 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
852 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
853 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
854 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
855 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
857 if ((Y1 | Y2 |
U |
V) & 0x100) {
870 const int16_t *ubuf[2],
const int16_t *vbuf[2],
871 const int16_t *abuf0, uint8_t *dest,
int dstW,
874 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
877 if (uvalpha < 2048) {
878 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
879 int Y1 = (buf0[
i * 2 ]+64) >> 7;
880 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
881 int U = (ubuf0[
i] +64) >> 7;
882 int V = (vbuf0[
i] +64) >> 7;
884 if ((Y1 | Y2 |
U |
V) & 0x100) {
894 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
895 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
896 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
897 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
898 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
899 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
901 if ((Y1 | Y2 |
U |
V) & 0x100) {
919 #define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B)
920 #define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R)
921 #define output_pixel(pos, val) \
922 if (isBE(target)) { \
930 const int32_t **lumSrc,
int lumFilterSize,
931 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
932 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
933 const int32_t **alpSrc, uint16_t *dest,
int dstW,
934 int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
936 int hasAlpha = !!alpSrc;
939 for (
i = 0;
i < dstW;
i++) {
944 for (j = 0; j < lumFilterSize; j++)
945 Y += lumSrc[j][
i] * lumFilter[j];
948 Y += (1<<3) + 0x8000;
952 A = -0x40000000 + (1<<14);
953 for (j = 0; j < lumFilterSize; j++)
954 A += alpSrc[j][
i] * lumFilter[j];
969 const int32_t *abuf[2], uint16_t *dest,
int dstW,
970 int yalpha,
int unused_uvalpha,
int y,
971 enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
973 int hasAlpha = abuf && abuf[0] && abuf[1];
974 const int32_t *buf0 = buf[0], *buf1 = buf[1],
975 *abuf0 = hasAlpha ? abuf[0] :
NULL,
976 *abuf1 = hasAlpha ? abuf[1] :
NULL;
977 int yalpha1 = 4096 - yalpha;
982 for (
i = 0;
i < dstW;
i++) {
983 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
989 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1001 const int32_t *abuf0, uint16_t *dest,
int dstW,
1002 int unused_uvalpha,
int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
1004 int hasAlpha = !!abuf0;
1007 for (
i = 0;
i < dstW;
i++) {
1008 int Y = buf0[
i] >> 3;
1026 const int32_t **lumSrc,
int lumFilterSize,
1027 const int16_t *chrFilter,
const int32_t **chrUSrc,
1028 const int32_t **chrVSrc,
int chrFilterSize,
1029 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1030 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1033 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1035 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1037 int Y1 = -0x40000000;
1038 int Y2 = -0x40000000;
1039 int U = -(128 << 23);
1040 int V = -(128 << 23);
1043 for (j = 0; j < lumFilterSize; j++) {
1044 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1045 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1047 for (j = 0; j < chrFilterSize; j++) {;
1048 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1049 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1055 for (j = 0; j < lumFilterSize; j++) {
1056 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1057 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1074 Y1 -=
c->yuv2rgb_y_offset;
1075 Y2 -=
c->yuv2rgb_y_offset;
1076 Y1 *=
c->yuv2rgb_y_coeff;
1077 Y2 *=
c->yuv2rgb_y_coeff;
1082 R =
V *
c->yuv2rgb_v2r_coeff;
1083 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1084 B =
U *
c->yuv2rgb_u2b_coeff;
1109 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1110 int yalpha,
int uvalpha,
int y,
1113 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1114 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1115 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1116 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1117 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1118 int yalpha1 = 4096 - yalpha;
1119 int uvalpha1 = 4096 - uvalpha;
1121 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1126 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1127 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1128 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1129 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1130 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1133 Y1 -=
c->yuv2rgb_y_offset;
1134 Y2 -=
c->yuv2rgb_y_offset;
1135 Y1 *=
c->yuv2rgb_y_coeff;
1136 Y2 *=
c->yuv2rgb_y_coeff;
1140 R =
V *
c->yuv2rgb_v2r_coeff;
1141 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1142 B =
U *
c->yuv2rgb_u2b_coeff;
1145 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1146 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1174 const int32_t *abuf0, uint16_t *dest,
int dstW,
1175 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1177 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1179 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1181 if (uvalpha < 2048) {
1182 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1183 int Y1 = (buf0[
i * 2] ) >> 2;
1184 int Y2 = (buf0[
i * 2 + 1]) >> 2;
1185 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1186 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1189 Y1 -=
c->yuv2rgb_y_offset;
1190 Y2 -=
c->yuv2rgb_y_offset;
1191 Y1 *=
c->yuv2rgb_y_coeff;
1192 Y2 *=
c->yuv2rgb_y_coeff;
1197 A1 = abuf0[
i * 2 ] << 11;
1198 A2 = abuf0[
i * 2 + 1] << 11;
1204 R =
V *
c->yuv2rgb_v2r_coeff;
1205 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1206 B =
U *
c->yuv2rgb_u2b_coeff;
1226 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1227 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1228 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1229 int Y1 = (buf0[
i * 2] ) >> 2;
1230 int Y2 = (buf0[
i * 2 + 1]) >> 2;
1231 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1232 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1235 Y1 -=
c->yuv2rgb_y_offset;
1236 Y2 -=
c->yuv2rgb_y_offset;
1237 Y1 *=
c->yuv2rgb_y_coeff;
1238 Y2 *=
c->yuv2rgb_y_coeff;
1243 A1 = abuf0[
i * 2 ] << 11;
1244 A2 = abuf0[
i * 2 + 1] << 11;
1250 R =
V *
c->yuv2rgb_v2r_coeff;
1251 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1252 B =
U *
c->yuv2rgb_u2b_coeff;
1276 const int32_t **lumSrc,
int lumFilterSize,
1277 const int16_t *chrFilter,
const int32_t **chrUSrc,
1278 const int32_t **chrVSrc,
int chrFilterSize,
1279 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1280 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1285 for (
i = 0;
i < dstW;
i++) {
1287 int Y = -0x40000000;
1288 int U = -(128 << 23);
1289 int V = -(128 << 23);
1292 for (j = 0; j < lumFilterSize; j++) {
1293 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1295 for (j = 0; j < chrFilterSize; j++) {;
1296 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1297 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1302 for (j = 0; j < lumFilterSize; j++) {
1303 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1316 Y -=
c->yuv2rgb_y_offset;
1317 Y *=
c->yuv2rgb_y_coeff;
1321 R =
V *
c->yuv2rgb_v2r_coeff;
1322 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1323 B =
U *
c->yuv2rgb_u2b_coeff;
1341 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1342 int yalpha,
int uvalpha,
int y,
1345 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1346 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1347 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1348 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1349 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1350 int yalpha1 = 4096 - yalpha;
1351 int uvalpha1 = 4096 - uvalpha;
1358 for (
i = 0;
i < dstW;
i++) {
1359 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1360 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1361 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1364 Y -=
c->yuv2rgb_y_offset;
1365 Y *=
c->yuv2rgb_y_coeff;
1368 R =
V *
c->yuv2rgb_v2r_coeff;
1369 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1370 B =
U *
c->yuv2rgb_u2b_coeff;
1373 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1393 const int32_t *abuf0, uint16_t *dest,
int dstW,
1394 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1396 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1400 if (uvalpha < 2048) {
1401 for (
i = 0;
i < dstW;
i++) {
1402 int Y = (buf0[
i]) >> 2;
1403 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1404 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1407 Y -=
c->yuv2rgb_y_offset;
1408 Y *=
c->yuv2rgb_y_coeff;
1417 R =
V *
c->yuv2rgb_v2r_coeff;
1418 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1419 B =
U *
c->yuv2rgb_u2b_coeff;
1432 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1434 for (
i = 0;
i < dstW;
i++) {
1435 int Y = (buf0[
i] ) >> 2;
1436 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1437 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1440 Y -=
c->yuv2rgb_y_offset;
1441 Y *=
c->yuv2rgb_y_coeff;
1450 R =
V *
c->yuv2rgb_v2r_coeff;
1451 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1452 B =
U *
c->yuv2rgb_u2b_coeff;
1471 #define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \
1472 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1473 const int16_t **_lumSrc, int lumFilterSize, \
1474 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1475 const int16_t **_chrVSrc, int chrFilterSize, \
1476 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1479 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1480 **chrUSrc = (const int32_t **) _chrUSrc, \
1481 **chrVSrc = (const int32_t **) _chrVSrc, \
1482 **alpSrc = (const int32_t **) _alpSrc; \
1483 uint16_t *dest = (uint16_t *) _dest; \
1484 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1485 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1486 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \
1489 static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
1490 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1491 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1492 int yalpha, int uvalpha, int y) \
1494 const int32_t **buf = (const int32_t **) _buf, \
1495 **ubuf = (const int32_t **) _ubuf, \
1496 **vbuf = (const int32_t **) _vbuf, \
1497 **abuf = (const int32_t **) _abuf; \
1498 uint16_t *dest = (uint16_t *) _dest; \
1499 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1500 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \
1503 static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
1504 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1505 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1506 int uvalpha, int y) \
1508 const int32_t *buf0 = (const int32_t *) _buf0, \
1509 **ubuf = (const int32_t **) _ubuf, \
1510 **vbuf = (const int32_t **) _vbuf, \
1511 *abuf0 = (const int32_t *) _abuf0; \
1512 uint16_t *dest = (uint16_t *) _dest; \
1513 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1514 dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \
1555 unsigned A1,
unsigned A2,
1556 const
void *_r, const
void *_g, const
void *_b,
int y,
1561 uint32_t *dest = (uint32_t *) _dest;
1562 const uint32_t *
r = (
const uint32_t *) _r;
1563 const uint32_t *
g = (
const uint32_t *) _g;
1564 const uint32_t *
b = (
const uint32_t *) _b;
1569 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1570 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1576 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1577 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1579 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1582 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1584 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1585 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1589 uint8_t *dest = (uint8_t *) _dest;
1590 const uint8_t *
r = (
const uint8_t *) _r;
1591 const uint8_t *
g = (
const uint8_t *) _g;
1592 const uint8_t *
b = (
const uint8_t *) _b;
1594 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1595 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1597 dest[
i * 6 + 0] =
r_b[Y1];
1598 dest[
i * 6 + 1] =
g[Y1];
1599 dest[
i * 6 + 2] =
b_r[Y1];
1600 dest[
i * 6 + 3] =
r_b[Y2];
1601 dest[
i * 6 + 4] =
g[Y2];
1602 dest[
i * 6 + 5] =
b_r[Y2];
1608 uint16_t *dest = (uint16_t *) _dest;
1609 const uint16_t *
r = (
const uint16_t *) _r;
1610 const uint16_t *
g = (
const uint16_t *) _g;
1611 const uint16_t *
b = (
const uint16_t *) _b;
1612 int dr1, dg1, db1, dr2, dg2, db2;
1637 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1638 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1640 uint32_t *dest = (uint32_t *) _dest;
1641 const uint32_t *
r = (
const uint32_t *) _r;
1642 const uint32_t *
g = (
const uint32_t *) _g;
1643 const uint32_t *
b = (
const uint32_t *) _b;
1644 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1645 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1647 uint8_t *dest = (uint8_t *) _dest;
1648 const uint8_t *
r = (
const uint8_t *) _r;
1649 const uint8_t *
g = (
const uint8_t *) _g;
1650 const uint8_t *
b = (
const uint8_t *) _b;
1651 int dr1, dg1, db1, dr2, dg2, db2;
1656 dr1 = dg1 =
d32[(
i * 2 + 0) & 7];
1657 db1 =
d64[(
i * 2 + 0) & 7];
1658 dr2 = dg2 =
d32[(
i * 2 + 1) & 7];
1659 db2 =
d64[(
i * 2 + 1) & 7];
1663 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1664 dg1 =
d64[(
i * 2 + 0) & 7];
1665 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1666 dg2 =
d64[(
i * 2 + 1) & 7];
1670 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1671 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1673 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1674 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1681 const int16_t **lumSrc,
int lumFilterSize,
1682 const int16_t *chrFilter,
const int16_t **chrUSrc,
1683 const int16_t **chrVSrc,
int chrFilterSize,
1684 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1689 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1695 const void *
r, *
g, *
b;
1697 for (j = 0; j < lumFilterSize; j++) {
1698 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1699 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1701 for (j = 0; j < chrFilterSize; j++) {
1702 U += chrUSrc[j][
i] * chrFilter[j];
1703 V += chrVSrc[j][
i] * chrFilter[j];
1712 for (j = 0; j < lumFilterSize; j++) {
1713 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1714 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1718 if ((
A1 |
A2) & 0x100) {
1729 r,
g,
b, y, target, hasAlpha);
1735 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1736 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1737 int yalpha,
int uvalpha,
int y,
1740 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1741 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1742 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1743 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1744 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1745 int yalpha1 = 4096 - yalpha;
1746 int uvalpha1 = 4096 - uvalpha;
1751 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1752 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1753 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1754 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1755 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1762 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1763 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1769 r,
g,
b, y, target, hasAlpha);
1775 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1776 const int16_t *abuf0, uint8_t *dest,
int dstW,
1780 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1783 if (uvalpha < 2048) {
1784 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1785 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1786 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1787 int U = (ubuf0[
i] + 64) >> 7;
1788 int V = (vbuf0[
i] + 64) >> 7;
1795 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1796 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1802 r,
g,
b, y, target, hasAlpha);
1805 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1806 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1807 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1808 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1809 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1810 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1817 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1818 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1824 r,
g,
b, y, target, hasAlpha);
1829 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1830 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1831 const int16_t **lumSrc, int lumFilterSize, \
1832 const int16_t *chrFilter, const int16_t **chrUSrc, \
1833 const int16_t **chrVSrc, int chrFilterSize, \
1834 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1837 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1838 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1839 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1842 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1843 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1844 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
1845 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1846 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1847 int yalpha, int uvalpha, int y) \
1849 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1850 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1853 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1854 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1855 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
1856 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1857 const int16_t *abuf0, uint8_t *dest, int dstW, \
1858 int uvalpha, int y) \
1860 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1861 dstW, uvalpha, y, fmt, hasAlpha); \
1868 #if CONFIG_SWSCALE_ALPHA
1887 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
1893 Y -=
c->yuv2rgb_y_offset;
1894 Y *=
c->yuv2rgb_y_coeff;
1896 R = (unsigned)
Y +
V*
c->yuv2rgb_v2r_coeff;
1897 G = (
unsigned)
Y +
V*
c->yuv2rgb_v2g_coeff +
U*
c->yuv2rgb_u2g_coeff;
1898 B = (unsigned)
Y +
U*
c->yuv2rgb_u2b_coeff;
1899 if ((
R |
G |
B) & 0xC0000000) {
1907 dest[0] = hasAlpha ?
A : 255;
1921 dest[3] = hasAlpha ?
A : 255;
1924 dest[0] = hasAlpha ?
A : 255;
1938 dest[3] = hasAlpha ?
A : 255;
1947 switch (
c->dither) {
1965 R += (7*err[0] + 1*
c->dither_error[0][
i] + 5*
c->dither_error[0][
i+1] + 3*
c->dither_error[0][
i+2])>>4;
1966 G += (7*err[1] + 1*
c->dither_error[1][
i] + 5*
c->dither_error[1][
i+1] + 3*
c->dither_error[1][
i+2])>>4;
1967 B += (7*err[2] + 1*
c->dither_error[2][
i] + 5*
c->dither_error[2][
i+1] + 3*
c->dither_error[2][
i+2])>>4;
1968 c->dither_error[0][
i] = err[0];
1969 c->dither_error[1][
i] = err[1];
1970 c->dither_error[2][
i] = err[2];
1971 r =
R >> (isrgb8 ? 5 : 7);
1972 g =
G >> (isrgb8 ? 5 : 6);
1973 b =
B >> (isrgb8 ? 6 : 7);
1977 err[0] =
R -
r*(isrgb8 ? 36 : 255);
1978 err[1] =
G -
g*(isrgb8 ? 36 : 85);
1979 err[2] =
B -
b*(isrgb8 ? 85 : 255);
1984 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2003 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2023 dest[0] =
r + 2*
g + 8*
b;
2025 dest[0] =
b + 2*
g + 8*
r;
2027 dest[0] =
r + 8*
g + 64*
b;
2029 dest[0] =
b + 4*
g + 32*
r;
2038 const int16_t **lumSrc,
int lumFilterSize,
2039 const int16_t *chrFilter,
const int16_t **chrUSrc,
2040 const int16_t **chrVSrc,
int chrFilterSize,
2041 const int16_t **alpSrc, uint8_t *dest,
2053 for (
i = 0;
i < dstW;
i++) {
2056 int U = (1<<9)-(128 << 19);
2057 int V = (1<<9)-(128 << 19);
2059 for (j = 0; j < lumFilterSize; j++) {
2060 Y += lumSrc[j][
i] * lumFilter[j];
2062 for (j = 0; j < chrFilterSize; j++) {
2063 U += chrUSrc[j][
i] * chrFilter[j];
2064 V += chrVSrc[j][
i] * chrFilter[j];
2071 for (j = 0; j < lumFilterSize; j++) {
2072 A += alpSrc[j][
i] * lumFilter[j];
2078 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2081 c->dither_error[0][
i] = err[0];
2082 c->dither_error[1][
i] = err[1];
2083 c->dither_error[2][
i] = err[2];
2088 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2089 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2090 int yalpha,
int uvalpha,
int y,
2093 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2094 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2095 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2096 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2097 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2098 int yalpha1 = 4096 - yalpha;
2099 int uvalpha1 = 4096 - uvalpha;
2112 for (
i = 0;
i < dstW;
i++) {
2113 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2114 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2115 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2118 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2123 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2126 c->dither_error[0][
i] = err[0];
2127 c->dither_error[1][
i] = err[1];
2128 c->dither_error[2][
i] = err[2];
2133 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2134 const int16_t *abuf0, uint8_t *dest,
int dstW,
2138 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2147 if (uvalpha < 2048) {
2149 for (
i = 0;
i < dstW;
i++) {
2150 int Y = buf0[
i] * 4;
2151 int U = (ubuf0[
i] - (128<<7)) * 4;
2152 int V = (vbuf0[
i] - (128<<7)) * 4;
2155 A = (abuf0[
i] + 64) >> 7;
2160 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2164 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2166 for (
i = 0;
i < dstW;
i++) {
2167 int Y = buf0[
i] * 4;
2168 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2169 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2172 A = (abuf0[
i] + 64) >> 7;
2177 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2182 c->dither_error[0][
i] = err[0];
2183 c->dither_error[1][
i] = err[1];
2184 c->dither_error[2][
i] = err[2];
2193 #if CONFIG_SWSCALE_ALPHA
2214 const int16_t **lumSrc,
int lumFilterSize,
2215 const int16_t *chrFilter, const int16_t **chrUSrc,
2216 const int16_t **chrVSrc,
int chrFilterSize,
2217 const int16_t **alpSrc, uint8_t **dest,
2223 uint16_t **dest16 = (uint16_t**)dest;
2224 int SH = 22 + 8 -
desc->comp[0].depth;
2227 for (
i = 0;
i < dstW;
i++) {
2230 int U = (1 << 9) - (128 << 19);
2231 int V = (1 << 9) - (128 << 19);
2234 for (j = 0; j < lumFilterSize; j++)
2235 Y += lumSrc[j][
i] * lumFilter[j];
2237 for (j = 0; j < chrFilterSize; j++) {
2238 U += chrUSrc[j][
i] * chrFilter[j];
2239 V += chrVSrc[j][
i] * chrFilter[j];
2249 for (j = 0; j < lumFilterSize; j++)
2250 A += alpSrc[j][
i] * lumFilter[j];
2256 Y -=
c->yuv2rgb_y_offset;
2257 Y *=
c->yuv2rgb_y_coeff;
2259 R =
Y +
V *
c->yuv2rgb_v2r_coeff;
2260 G =
Y +
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2261 B =
Y +
U *
c->yuv2rgb_u2b_coeff;
2263 if ((
R |
G |
B) & 0xC0000000) {
2270 dest16[0][
i] =
G >>
SH;
2271 dest16[1][
i] =
B >>
SH;
2272 dest16[2][
i] =
R >>
SH;
2274 dest16[3][
i] =
A >> (
SH - 3);
2276 dest[0][
i] =
G >> 22;
2277 dest[1][
i] =
B >> 22;
2278 dest[2][
i] =
R >> 22;
2280 dest[3][
i] =
A >> 19;
2283 if (
SH != 22 && (!
isBE(
c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2284 for (
i = 0;
i < dstW;
i++) {
2296 const int16_t **lumSrcx,
int lumFilterSize,
2297 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2298 const int16_t **chrVSrcx,
int chrFilterSize,
2299 const int16_t **alpSrcx, uint8_t **dest,
2305 uint16_t **dest16 = (uint16_t**)dest;
2311 for (
i = 0;
i < dstW;
i++) {
2313 int Y = -0x40000000;
2314 int U = -(128 << 23);
2315 int V = -(128 << 23);
2318 for (j = 0; j < lumFilterSize; j++)
2319 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2321 for (j = 0; j < chrFilterSize; j++) {
2322 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2323 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2334 for (j = 0; j < lumFilterSize; j++)
2335 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2341 Y -=
c->yuv2rgb_y_offset;
2342 Y *=
c->yuv2rgb_y_coeff;
2344 R =
V *
c->yuv2rgb_v2r_coeff;
2345 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2346 B =
U *
c->yuv2rgb_u2b_coeff;
2352 dest16[0][
i] =
G >> 14;
2353 dest16[1][
i] =
B >> 14;
2354 dest16[2][
i] =
R >> 14;
2358 if ((!
isBE(
c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2359 for (
i = 0;
i < dstW;
i++) {
2371 const int16_t **lumSrcx,
int lumFilterSize,
2372 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2373 const int16_t **chrVSrcx,
int chrFilterSize,
2374 const int16_t **alpSrcx, uint8_t **dest,
2380 uint32_t **dest32 = (uint32_t**)dest;
2385 static const float float_mult = 1.0f / 65535.0f;
2387 for (
i = 0;
i < dstW;
i++) {
2389 int Y = -0x40000000;
2390 int U = -(128 << 23);
2391 int V = -(128 << 23);
2394 for (j = 0; j < lumFilterSize; j++)
2395 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2397 for (j = 0; j < chrFilterSize; j++) {
2398 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2399 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2410 for (j = 0; j < lumFilterSize; j++)
2411 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2417 Y -=
c->yuv2rgb_y_offset;
2418 Y *=
c->yuv2rgb_y_coeff;
2420 R =
V *
c->yuv2rgb_v2r_coeff;
2421 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2422 B =
U *
c->yuv2rgb_u2b_coeff;
2434 if ((!
isBE(
c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2435 for (
i = 0;
i < dstW;
i++) {
2447 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2448 const int16_t *abuf0, uint8_t *dest,
int dstW,
2451 int hasAlpha = !!abuf0;
2454 for (
i = 0;
i < dstW;
i++) {
2455 int Y = (buf0[
i] + 64) >> 7;
2461 A = (abuf0[
i] + 64) >> 7;
2467 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2473 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2474 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2475 int yalpha,
int uvalpha,
int y)
2477 int hasAlpha = abuf && abuf[0] && abuf[1];
2478 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2479 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2480 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2481 int yalpha1 = 4096 - yalpha;
2486 for (
i = 0;
i < dstW;
i++) {
2487 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2493 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2498 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2504 const int16_t **lumSrc,
int lumFilterSize,
2505 const int16_t *chrFilter,
const int16_t **chrUSrc,
2506 const int16_t **chrVSrc,
int chrFilterSize,
2507 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2509 int hasAlpha = !!alpSrc;
2512 for (
i = 0;
i < dstW;
i++) {
2514 int Y = 1 << 18,
A = 1 << 18;
2516 for (j = 0; j < lumFilterSize; j++)
2517 Y += lumSrc[j][
i] * lumFilter[j];
2524 for (j = 0; j < lumFilterSize; j++)
2525 A += alpSrc[j][
i] * lumFilter[j];
2534 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2540 const int16_t **_lumSrc,
int lumFilterSize,
2541 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2542 const int16_t **_chrVSrc,
int chrFilterSize,
2543 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y)
2546 **chrUSrc = (
const int32_t **) _chrUSrc,
2547 **chrVSrc = (
const int32_t **) _chrVSrc,
2548 **alpSrc = (
const int32_t **) _alpSrc;
2549 int hasAlpha = !!alpSrc;
2552 for (
i = 0;
i < dstW;
i++) {
2553 int Y = 1 << 14,
U = 1 << 14;
2554 int V = 1 << 14,
A = 1 << 14;
2562 for (j = 0; j < lumFilterSize; j++)
2563 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2565 for (j = 0; j < chrFilterSize; j++)
2566 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2568 for (j = 0; j < chrFilterSize; j++)
2569 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2572 for (j = 0; j < lumFilterSize; j++)
2573 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2580 AV_WL16(dest + 8 *
i, hasAlpha ?
A : 65535);
2604 }
else if (
is16BPS(dstFormat)) {
2605 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
2606 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
2610 }
else if (
isNBPS(dstFormat)) {
2611 if (
desc->comp[0].depth == 9) {
2612 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
2613 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
2614 }
else if (
desc->comp[0].depth == 10) {
2615 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
2616 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
2617 }
else if (
desc->comp[0].depth == 12) {
2618 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
2619 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
2620 }
else if (
desc->comp[0].depth == 14) {
2621 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
2622 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
2627 *yuv2plane1 = yuv2plane1_floatBE_c;
2630 *yuv2plane1 = yuv2plane1_floatLE_c;
2639 switch (dstFormat) {
2642 *yuv2packedX = yuv2rgba32_full_X_c;
2643 *yuv2packed2 = yuv2rgba32_full_2_c;
2644 *yuv2packed1 = yuv2rgba32_full_1_c;
2646 #if CONFIG_SWSCALE_ALPHA
2648 *yuv2packedX = yuv2rgba32_full_X_c;
2649 *yuv2packed2 = yuv2rgba32_full_2_c;
2650 *yuv2packed1 = yuv2rgba32_full_1_c;
2654 *yuv2packedX = yuv2rgbx32_full_X_c;
2655 *yuv2packed2 = yuv2rgbx32_full_2_c;
2656 *yuv2packed1 = yuv2rgbx32_full_1_c;
2662 *yuv2packedX = yuv2argb32_full_X_c;
2663 *yuv2packed2 = yuv2argb32_full_2_c;
2664 *yuv2packed1 = yuv2argb32_full_1_c;
2666 #if CONFIG_SWSCALE_ALPHA
2668 *yuv2packedX = yuv2argb32_full_X_c;
2669 *yuv2packed2 = yuv2argb32_full_2_c;
2670 *yuv2packed1 = yuv2argb32_full_1_c;
2674 *yuv2packedX = yuv2xrgb32_full_X_c;
2675 *yuv2packed2 = yuv2xrgb32_full_2_c;
2676 *yuv2packed1 = yuv2xrgb32_full_1_c;
2682 *yuv2packedX = yuv2bgra32_full_X_c;
2683 *yuv2packed2 = yuv2bgra32_full_2_c;
2684 *yuv2packed1 = yuv2bgra32_full_1_c;
2686 #if CONFIG_SWSCALE_ALPHA
2688 *yuv2packedX = yuv2bgra32_full_X_c;
2689 *yuv2packed2 = yuv2bgra32_full_2_c;
2690 *yuv2packed1 = yuv2bgra32_full_1_c;
2694 *yuv2packedX = yuv2bgrx32_full_X_c;
2695 *yuv2packed2 = yuv2bgrx32_full_2_c;
2696 *yuv2packed1 = yuv2bgrx32_full_1_c;
2702 *yuv2packedX = yuv2abgr32_full_X_c;
2703 *yuv2packed2 = yuv2abgr32_full_2_c;
2704 *yuv2packed1 = yuv2abgr32_full_1_c;
2706 #if CONFIG_SWSCALE_ALPHA
2708 *yuv2packedX = yuv2abgr32_full_X_c;
2709 *yuv2packed2 = yuv2abgr32_full_2_c;
2710 *yuv2packed1 = yuv2abgr32_full_1_c;
2714 *yuv2packedX = yuv2xbgr32_full_X_c;
2715 *yuv2packed2 = yuv2xbgr32_full_2_c;
2716 *yuv2packed1 = yuv2xbgr32_full_1_c;
2721 #if CONFIG_SWSCALE_ALPHA
2723 *yuv2packedX = yuv2rgba64le_full_X_c;
2724 *yuv2packed2 = yuv2rgba64le_full_2_c;
2725 *yuv2packed1 = yuv2rgba64le_full_1_c;
2729 *yuv2packedX = yuv2rgbx64le_full_X_c;
2730 *yuv2packed2 = yuv2rgbx64le_full_2_c;
2731 *yuv2packed1 = yuv2rgbx64le_full_1_c;
2735 #if CONFIG_SWSCALE_ALPHA
2737 *yuv2packedX = yuv2rgba64be_full_X_c;
2738 *yuv2packed2 = yuv2rgba64be_full_2_c;
2739 *yuv2packed1 = yuv2rgba64be_full_1_c;
2743 *yuv2packedX = yuv2rgbx64be_full_X_c;
2744 *yuv2packed2 = yuv2rgbx64be_full_2_c;
2745 *yuv2packed1 = yuv2rgbx64be_full_1_c;
2749 #if CONFIG_SWSCALE_ALPHA
2751 *yuv2packedX = yuv2bgra64le_full_X_c;
2752 *yuv2packed2 = yuv2bgra64le_full_2_c;
2753 *yuv2packed1 = yuv2bgra64le_full_1_c;
2757 *yuv2packedX = yuv2bgrx64le_full_X_c;
2758 *yuv2packed2 = yuv2bgrx64le_full_2_c;
2759 *yuv2packed1 = yuv2bgrx64le_full_1_c;
2763 #if CONFIG_SWSCALE_ALPHA
2765 *yuv2packedX = yuv2bgra64be_full_X_c;
2766 *yuv2packed2 = yuv2bgra64be_full_2_c;
2767 *yuv2packed1 = yuv2bgra64be_full_1_c;
2771 *yuv2packedX = yuv2bgrx64be_full_X_c;
2772 *yuv2packed2 = yuv2bgrx64be_full_2_c;
2773 *yuv2packed1 = yuv2bgrx64be_full_1_c;
2778 *yuv2packedX = yuv2rgb24_full_X_c;
2779 *yuv2packed2 = yuv2rgb24_full_2_c;
2780 *yuv2packed1 = yuv2rgb24_full_1_c;
2783 *yuv2packedX = yuv2bgr24_full_X_c;
2784 *yuv2packed2 = yuv2bgr24_full_2_c;
2785 *yuv2packed1 = yuv2bgr24_full_1_c;
2788 *yuv2packedX = yuv2rgb48le_full_X_c;
2789 *yuv2packed2 = yuv2rgb48le_full_2_c;
2790 *yuv2packed1 = yuv2rgb48le_full_1_c;
2793 *yuv2packedX = yuv2bgr48le_full_X_c;
2794 *yuv2packed2 = yuv2bgr48le_full_2_c;
2795 *yuv2packed1 = yuv2bgr48le_full_1_c;
2798 *yuv2packedX = yuv2rgb48be_full_X_c;
2799 *yuv2packed2 = yuv2rgb48be_full_2_c;
2800 *yuv2packed1 = yuv2rgb48be_full_1_c;
2803 *yuv2packedX = yuv2bgr48be_full_X_c;
2804 *yuv2packed2 = yuv2bgr48be_full_2_c;
2805 *yuv2packed1 = yuv2bgr48be_full_1_c;
2808 *yuv2packedX = yuv2bgr4_byte_full_X_c;
2809 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
2810 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
2813 *yuv2packedX = yuv2rgb4_byte_full_X_c;
2814 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
2815 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
2818 *yuv2packedX = yuv2bgr8_full_X_c;
2819 *yuv2packed2 = yuv2bgr8_full_2_c;
2820 *yuv2packed1 = yuv2bgr8_full_1_c;
2823 *yuv2packedX = yuv2rgb8_full_X_c;
2824 *yuv2packed2 = yuv2rgb8_full_2_c;
2825 *yuv2packed1 = yuv2rgb8_full_1_c;
2856 if (!*yuv2packedX && !*yuv2anyX)
2860 switch (dstFormat) {
2862 #if CONFIG_SWSCALE_ALPHA
2864 *yuv2packed1 = yuv2rgba64le_1_c;
2865 *yuv2packed2 = yuv2rgba64le_2_c;
2866 *yuv2packedX = yuv2rgba64le_X_c;
2870 *yuv2packed1 = yuv2rgbx64le_1_c;
2871 *yuv2packed2 = yuv2rgbx64le_2_c;
2872 *yuv2packedX = yuv2rgbx64le_X_c;
2876 #if CONFIG_SWSCALE_ALPHA
2878 *yuv2packed1 = yuv2rgba64be_1_c;
2879 *yuv2packed2 = yuv2rgba64be_2_c;
2880 *yuv2packedX = yuv2rgba64be_X_c;
2884 *yuv2packed1 = yuv2rgbx64be_1_c;
2885 *yuv2packed2 = yuv2rgbx64be_2_c;
2886 *yuv2packedX = yuv2rgbx64be_X_c;
2890 #if CONFIG_SWSCALE_ALPHA
2892 *yuv2packed1 = yuv2bgra64le_1_c;
2893 *yuv2packed2 = yuv2bgra64le_2_c;
2894 *yuv2packedX = yuv2bgra64le_X_c;
2898 *yuv2packed1 = yuv2bgrx64le_1_c;
2899 *yuv2packed2 = yuv2bgrx64le_2_c;
2900 *yuv2packedX = yuv2bgrx64le_X_c;
2904 #if CONFIG_SWSCALE_ALPHA
2906 *yuv2packed1 = yuv2bgra64be_1_c;
2907 *yuv2packed2 = yuv2bgra64be_2_c;
2908 *yuv2packedX = yuv2bgra64be_X_c;
2912 *yuv2packed1 = yuv2bgrx64be_1_c;
2913 *yuv2packed2 = yuv2bgrx64be_2_c;
2914 *yuv2packedX = yuv2bgrx64be_X_c;
2918 *yuv2packed1 = yuv2rgb48le_1_c;
2919 *yuv2packed2 = yuv2rgb48le_2_c;
2920 *yuv2packedX = yuv2rgb48le_X_c;
2923 *yuv2packed1 = yuv2rgb48be_1_c;
2924 *yuv2packed2 = yuv2rgb48be_2_c;
2925 *yuv2packedX = yuv2rgb48be_X_c;
2928 *yuv2packed1 = yuv2bgr48le_1_c;
2929 *yuv2packed2 = yuv2bgr48le_2_c;
2930 *yuv2packedX = yuv2bgr48le_X_c;
2933 *yuv2packed1 = yuv2bgr48be_1_c;
2934 *yuv2packed2 = yuv2bgr48be_2_c;
2935 *yuv2packedX = yuv2bgr48be_X_c;
2940 *yuv2packed1 = yuv2rgb32_1_c;
2941 *yuv2packed2 = yuv2rgb32_2_c;
2942 *yuv2packedX = yuv2rgb32_X_c;
2944 #if CONFIG_SWSCALE_ALPHA
2946 *yuv2packed1 = yuv2rgba32_1_c;
2947 *yuv2packed2 = yuv2rgba32_2_c;
2948 *yuv2packedX = yuv2rgba32_X_c;
2952 *yuv2packed1 = yuv2rgbx32_1_c;
2953 *yuv2packed2 = yuv2rgbx32_2_c;
2954 *yuv2packedX = yuv2rgbx32_X_c;
2961 *yuv2packed1 = yuv2rgb32_1_1_c;
2962 *yuv2packed2 = yuv2rgb32_1_2_c;
2963 *yuv2packedX = yuv2rgb32_1_X_c;
2965 #if CONFIG_SWSCALE_ALPHA
2967 *yuv2packed1 = yuv2rgba32_1_1_c;
2968 *yuv2packed2 = yuv2rgba32_1_2_c;
2969 *yuv2packedX = yuv2rgba32_1_X_c;
2973 *yuv2packed1 = yuv2rgbx32_1_1_c;
2974 *yuv2packed2 = yuv2rgbx32_1_2_c;
2975 *yuv2packedX = yuv2rgbx32_1_X_c;
2980 *yuv2packed1 = yuv2rgb24_1_c;
2981 *yuv2packed2 = yuv2rgb24_2_c;
2982 *yuv2packedX = yuv2rgb24_X_c;
2985 *yuv2packed1 = yuv2bgr24_1_c;
2986 *yuv2packed2 = yuv2bgr24_2_c;
2987 *yuv2packedX = yuv2bgr24_X_c;
2993 *yuv2packed1 = yuv2rgb16_1_c;
2994 *yuv2packed2 = yuv2rgb16_2_c;
2995 *yuv2packedX = yuv2rgb16_X_c;
3001 *yuv2packed1 = yuv2rgb15_1_c;
3002 *yuv2packed2 = yuv2rgb15_2_c;
3003 *yuv2packedX = yuv2rgb15_X_c;
3009 *yuv2packed1 = yuv2rgb12_1_c;
3010 *yuv2packed2 = yuv2rgb12_2_c;
3011 *yuv2packedX = yuv2rgb12_X_c;
3015 *yuv2packed1 = yuv2rgb8_1_c;
3016 *yuv2packed2 = yuv2rgb8_2_c;
3017 *yuv2packedX = yuv2rgb8_X_c;
3021 *yuv2packed1 = yuv2rgb4_1_c;
3022 *yuv2packed2 = yuv2rgb4_2_c;
3023 *yuv2packedX = yuv2rgb4_X_c;
3027 *yuv2packed1 = yuv2rgb4b_1_c;
3028 *yuv2packed2 = yuv2rgb4b_2_c;
3029 *yuv2packedX = yuv2rgb4b_X_c;
3033 *yuv2packed1 = yuv2x2rgb10_1_c;
3034 *yuv2packed2 = yuv2x2rgb10_2_c;
3035 *yuv2packedX = yuv2x2rgb10_X_c;
3039 *yuv2packed1 = yuv2x2bgr10_1_c;
3040 *yuv2packed2 = yuv2x2bgr10_2_c;
3041 *yuv2packedX = yuv2x2bgr10_X_c;
3045 switch (dstFormat) {
3047 *yuv2packed1 = yuv2monowhite_1_c;
3048 *yuv2packed2 = yuv2monowhite_2_c;
3049 *yuv2packedX = yuv2monowhite_X_c;
3052 *yuv2packed1 = yuv2monoblack_1_c;
3053 *yuv2packed2 = yuv2monoblack_2_c;
3054 *yuv2packedX = yuv2monoblack_X_c;
3057 *yuv2packed1 = yuv2yuyv422_1_c;
3058 *yuv2packed2 = yuv2yuyv422_2_c;
3059 *yuv2packedX = yuv2yuyv422_X_c;
3062 *yuv2packed1 = yuv2yvyu422_1_c;
3063 *yuv2packed2 = yuv2yvyu422_2_c;
3064 *yuv2packedX = yuv2yvyu422_X_c;
3067 *yuv2packed1 = yuv2uyvy422_1_c;
3068 *yuv2packed2 = yuv2uyvy422_2_c;
3069 *yuv2packedX = yuv2uyvy422_X_c;
3077 *yuv2packed1 = yuv2ya16le_1_c;
3078 *yuv2packed2 = yuv2ya16le_2_c;
3079 *yuv2packedX = yuv2ya16le_X_c;
3082 *yuv2packed1 = yuv2ya16be_1_c;
3083 *yuv2packed2 = yuv2ya16be_2_c;
3084 *yuv2packedX = yuv2ya16be_X_c;