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, },
139 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
141 #define output_pixel(pos, val, bias, signedness) \
143 AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
145 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
150 int big_endian,
int output_bits)
156 for (
i = 0;
i < dstW;
i++) {
164 const int32_t **
src, uint16_t *dest,
int dstW,
165 int big_endian,
int output_bits)
171 for (
i = 0;
i < dstW;
i++) {
181 for (j = 0; j < filterSize; j++)
190 const int16_t *chrFilter,
int chrFilterSize,
191 const int16_t **chrUSrc,
const int16_t **chrVSrc,
192 uint8_t *dest8,
int chrDstW,
int output_bits)
194 uint16_t *dest = (uint16_t*)dest8;
201 for (
i = 0;
i < chrDstW;
i++) {
203 int v = 1 << (
shift - 1);
208 for (j = 0; j < chrFilterSize; j++) {
209 u += uSrc[j][
i] * (unsigned)chrFilter[j];
210 v += vSrc[j][
i] * (unsigned)chrFilter[j];
221 static const int big_endian = HAVE_BIGENDIAN;
222 static const int shift = 3;
223 static const float float_mult = 1.0f / 65535.0f;
227 for (
i = 0;
i < dstW; ++
i){
230 dest[
i] = float_mult * (
float)val_uint;
237 static const int big_endian = HAVE_BIGENDIAN;
238 static const int shift = 3;
239 static const float float_mult = 1.0f / 65535.0f;
243 for (
i = 0;
i < dstW; ++
i){
252 float *dest,
int dstW)
254 static const int big_endian = HAVE_BIGENDIAN;
255 static const int shift = 15;
256 static const float float_mult = 1.0f / 65535.0f;
260 for (
i = 0;
i < dstW; ++
i){
261 val = (1 << (
shift - 1)) - 0x40000000;
262 for (j = 0; j < filterSize; ++j){
266 dest[
i] = float_mult * (
float)val_uint;
272 uint32_t *dest,
int dstW)
274 static const int big_endian = HAVE_BIGENDIAN;
275 static const int shift = 15;
276 static const float float_mult = 1.0f / 65535.0f;
280 for (
i = 0;
i < dstW; ++
i){
281 val = (1 << (
shift - 1)) - 0x40000000;
282 for (j = 0; j < filterSize; ++j){
290 #define yuv2plane1_float(template, dest_type, BE_LE) \
291 static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
292 const uint8_t *dither, int offset) \
294 template((const int32_t *)src, (dest_type *)dest, dstW); \
297 #define yuv2planeX_float(template, dest_type, BE_LE) \
298 static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
299 const int16_t **src, uint8_t *dest, int dstW, \
300 const uint8_t *dither, int offset) \
302 template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
319 #define output_pixel(pos, val) \
321 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
323 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
327 yuv2plane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
328 int big_endian,
int output_bits)
331 int shift = 15 - output_bits;
333 for (
i = 0;
i < dstW;
i++) {
341 const int16_t **
src, uint16_t *dest,
int dstW,
342 int big_endian,
int output_bits)
345 int shift = 11 + 16 - output_bits;
347 for (
i = 0;
i < dstW;
i++) {
351 for (j = 0; j < filterSize; j++)
360 #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
361 static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
362 uint8_t *dest, int dstW, \
363 const uint8_t *dither, int offset)\
365 yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
366 (uint16_t *) dest, dstW, is_be, bits); \
368 static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
369 const int16_t **src, uint8_t *dest, int dstW, \
370 const uint8_t *dither, int offset)\
372 yuv2planeX_## template_size ## _c_template(filter, \
373 filterSize, (const typeX_t **) src, \
374 (uint16_t *) dest, dstW, is_be, bits); \
389 static void yuv2nv12cX_16LE_c(
enum AVPixelFormat dstFormat,
const uint8_t *chrDither,
390 const int16_t *chrFilter,
int chrFilterSize,
391 const int16_t **chrUSrc,
const int16_t **chrVSrc,
392 uint8_t *dest8,
int chrDstW)
398 const int16_t *chrFilter,
int chrFilterSize,
399 const int16_t **chrUSrc,
const int16_t **chrVSrc,
400 uint8_t *dest8,
int chrDstW)
406 const int16_t **
src, uint8_t *dest,
int dstW,
410 for (
i=0;
i<dstW;
i++) {
413 for (j=0; j<filterSize; j++)
424 for (
i=0;
i<dstW;
i++) {
431 const int16_t *chrFilter,
int chrFilterSize,
432 const int16_t **chrUSrc,
const int16_t **chrVSrc,
433 uint8_t *dest,
int chrDstW)
438 for (
i=0;
i<chrDstW;
i++) {
439 int u = chrDither[
i & 7] << 12;
440 int v = chrDither[(
i + 3) & 7] << 12;
442 for (j=0; j<chrFilterSize; j++) {
443 u += chrUSrc[j][
i] * chrFilter[j];
444 v += chrVSrc[j][
i] * chrFilter[j];
451 for (
i=0;
i<chrDstW;
i++) {
452 int u = chrDither[
i & 7] << 12;
453 int v = chrDither[(
i + 3) & 7] << 12;
455 for (j=0; j<chrFilterSize; j++) {
456 u += chrUSrc[j][
i] * chrFilter[j];
457 v += chrVSrc[j][
i] * chrFilter[j];
466 #define output_pixel(pos, val) \
468 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
470 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
474 uint16_t *dest,
int dstW,
475 int big_endian,
int output_bits)
478 int shift = 15 - output_bits;
479 int output_shift = 16 - output_bits;
481 for (
i = 0;
i < dstW;
i++) {
488 const int16_t **
src, uint16_t *dest,
int dstW,
489 int big_endian,
int output_bits)
492 int shift = 11 + 16 - output_bits;
493 int output_shift = 16 - output_bits;
495 for (
i = 0;
i < dstW;
i++) {
498 for (j = 0; j < filterSize; j++)
506 const int16_t *chrFilter,
int chrFilterSize,
507 const int16_t **chrUSrc,
const int16_t **chrVSrc,
508 uint8_t *dest8,
int chrDstW,
int output_bits)
510 uint16_t *dest = (uint16_t*)dest8;
512 int shift = 11 + 16 - output_bits;
513 int output_shift = 16 - output_bits;
515 for (
i = 0;
i < chrDstW;
i++) {
517 int v = 1 << (
shift - 1);
519 for (j = 0; j < chrFilterSize; j++) {
520 u += chrUSrc[j][
i] * chrFilter[j];
521 v += chrVSrc[j][
i] * chrFilter[j];
531 #define yuv2p01x_wrapper(bits) \
532 static void yuv2p0 ## bits ## l1_LE_c(const int16_t *src, \
533 uint8_t *dest, int dstW, \
534 const uint8_t *dither, int offset) \
536 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits); \
539 static void yuv2p0 ## bits ## l1_BE_c(const int16_t *src, \
540 uint8_t *dest, int dstW, \
541 const uint8_t *dither, int offset) \
543 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits); \
546 static void yuv2p0 ## bits ## lX_LE_c(const int16_t *filter, \
547 int filterSize, const int16_t **src, \
548 uint8_t *dest, int dstW, \
549 const uint8_t *dither, int offset) \
551 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, bits); \
554 static void yuv2p0 ## bits ## lX_BE_c(const int16_t *filter, \
555 int filterSize, const int16_t **src, \
556 uint8_t *dest, int dstW, \
557 const uint8_t *dither, int offset) \
559 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, bits); \
562 static void yuv2p0 ## bits ## cX_LE_c(enum AVPixelFormat dstFormat, \
563 const uint8_t *chrDither, \
564 const int16_t *chrFilter, \
566 const int16_t **chrUSrc, \
567 const int16_t **chrVSrc, \
568 uint8_t *dest8, int chrDstW) \
570 yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
571 dest8, chrDstW, bits); \
574 static void yuv2p0 ## bits ## cX_BE_c(enum AVPixelFormat dstFormat, \
575 const uint8_t *chrDither, \
576 const int16_t *chrFilter, \
578 const int16_t **chrUSrc, \
579 const int16_t **chrVSrc, \
580 uint8_t *dest8, int chrDstW) \
582 yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
583 dest8, chrDstW, bits); \
589 #define accumulate_bit(acc, val) \
592 #define output_pixel(pos, acc) \
593 if (target == AV_PIX_FMT_MONOBLACK) { \
600 yuv2mono_X_c_template(
SwsInternal *
c,
const int16_t *lumFilter,
601 const int16_t **lumSrc,
int lumFilterSize,
602 const int16_t *chrFilter,
const int16_t **chrUSrc,
603 const int16_t **chrVSrc,
int chrFilterSize,
604 const int16_t **alpSrc, uint8_t *dest,
int dstW,
612 for (
i = 0;
i < dstW;
i += 2) {
617 for (j = 0; j < lumFilterSize; j++) {
618 Y1 += lumSrc[j][
i] * lumFilter[j];
619 Y2 += lumSrc[j][
i+1] * lumFilter[j];
623 if ((Y1 | Y2) & 0x100) {
628 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;
629 c->dither_error[0][
i] = err;
630 acc = 2*acc + (Y1 >= 128);
633 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);
634 c->dither_error[0][
i+1] = Y1;
635 acc = 2*acc + (err >= 128);
645 c->dither_error[0][
i] = err;
654 const int16_t *ubuf[2],
const int16_t *vbuf[2],
655 const int16_t *abuf[2], uint8_t *dest,
int dstW,
656 int yalpha,
int uvalpha,
int y,
659 const int16_t *buf0 = buf[0], *buf1 = buf[1];
661 int yalpha1 = 4096 - yalpha;
668 for (
i = 0;
i < dstW;
i +=2) {
671 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
672 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;
673 c->dither_error[0][
i] = err;
674 acc = 2*acc + (
Y >= 128);
677 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
678 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;
679 c->dither_error[0][
i+1] =
Y;
680 acc = 2*acc + (err >= 128);
686 c->dither_error[0][
i] = err;
688 for (
i = 0;
i < dstW;
i += 8) {
692 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
694 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
696 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
698 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
700 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
702 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
704 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
706 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
716 const int16_t *ubuf[2],
const int16_t *vbuf[2],
717 const int16_t *abuf0, uint8_t *dest,
int dstW,
726 for (
i = 0;
i < dstW;
i +=2) {
729 Y = ((buf0[
i + 0] + 64) >> 7);
730 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;
731 c->dither_error[0][
i] = err;
732 acc = 2*acc + (
Y >= 128);
735 err = ((buf0[
i + 1] + 64) >> 7);
736 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;
737 c->dither_error[0][
i+1] =
Y;
738 acc = 2*acc + (err >= 128);
744 c->dither_error[0][
i] = err;
746 for (
i = 0;
i < dstW;
i += 8) {
763 #undef accumulate_bit
765 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
766 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
767 const int16_t **lumSrc, int lumFilterSize, \
768 const int16_t *chrFilter, const int16_t **chrUSrc, \
769 const int16_t **chrVSrc, int chrFilterSize, \
770 const int16_t **alpSrc, uint8_t *dest, int dstW, \
773 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
774 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
775 alpSrc, dest, dstW, y, fmt); \
778 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
779 const int16_t *ubuf[2], const int16_t *vbuf[2], \
780 const int16_t *abuf[2], uint8_t *dest, int dstW, \
781 int yalpha, int uvalpha, int y) \
783 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
784 dest, dstW, yalpha, uvalpha, y, fmt); \
787 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
788 const int16_t *ubuf[2], const int16_t *vbuf[2], \
789 const int16_t *abuf0, uint8_t *dest, int dstW, \
790 int uvalpha, int y) \
792 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
793 abuf0, dest, dstW, uvalpha, \
800 #define output_pixels(pos, Y1, U, Y2, V) \
801 if (target == AV_PIX_FMT_YUYV422) { \
802 dest[pos + 0] = Y1; \
804 dest[pos + 2] = Y2; \
806 } else if (target == AV_PIX_FMT_YVYU422) { \
807 dest[pos + 0] = Y1; \
809 dest[pos + 2] = Y2; \
813 dest[pos + 1] = Y1; \
815 dest[pos + 3] = Y2; \
820 const int16_t **lumSrc,
int lumFilterSize,
821 const int16_t *chrFilter,
const int16_t **chrUSrc,
822 const int16_t **chrVSrc,
int chrFilterSize,
823 const int16_t **alpSrc, uint8_t *dest,
int dstW,
828 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
835 for (j = 0; j < lumFilterSize; j++) {
836 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
837 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
839 for (j = 0; j < chrFilterSize; j++) {
840 U += chrUSrc[j][
i] * chrFilter[j];
841 V += chrVSrc[j][
i] * chrFilter[j];
847 if ((Y1 | Y2 |
U |
V) & 0x100) {
859 const int16_t *ubuf[2],
const int16_t *vbuf[2],
860 const int16_t *abuf[2], uint8_t *dest,
int dstW,
861 int yalpha,
int uvalpha,
int y,
864 const int16_t *buf0 = buf[0], *buf1 = buf[1],
865 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
866 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
867 int yalpha1 = 4096 - yalpha;
868 int uvalpha1 = 4096 - uvalpha;
873 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
874 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
875 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
876 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
877 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
879 if ((Y1 | Y2 |
U |
V) & 0x100) {
892 const int16_t *ubuf[2],
const int16_t *vbuf[2],
893 const int16_t *abuf0, uint8_t *dest,
int dstW,
896 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
899 if (uvalpha < 2048) {
900 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
901 int Y1 = (buf0[
i * 2 ]+64) >> 7;
902 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
903 int U = (ubuf0[
i] +64) >> 7;
904 int V = (vbuf0[
i] +64) >> 7;
906 if ((Y1 | Y2 |
U |
V) & 0x100) {
916 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
917 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
918 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
919 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
920 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
921 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
923 if ((Y1 | Y2 |
U |
V) & 0x100) {
941 #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)
942 #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)
943 #define output_pixel(pos, val) \
952 const int32_t **lumSrc,
int lumFilterSize,
953 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
954 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
955 const int32_t **alpSrc, uint16_t *dest,
int dstW,
957 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
959 int hasAlpha = !!alpSrc;
962 for (
i = 0;
i < dstW;
i++) {
967 for (j = 0; j < lumFilterSize; j++)
968 Y += lumSrc[j][
i] * lumFilter[j];
971 Y += (1<<3) + 0x8000;
975 A = -0x40000000 + (1<<14);
976 for (j = 0; j < lumFilterSize; j++)
977 A += alpSrc[j][
i] * lumFilter[j];
992 const int32_t *abuf[2], uint16_t *dest,
int dstW,
993 int yalpha,
int unused_uvalpha,
int y,
995 int unused_eightbytes,
int is_be)
997 int hasAlpha = abuf && abuf[0] && abuf[1];
998 const int32_t *buf0 = buf[0], *buf1 = buf[1],
999 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1000 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1001 int yalpha1 = 4096 - yalpha;
1006 for (
i = 0;
i < dstW;
i++) {
1007 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
1013 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1025 const int32_t *abuf0, uint16_t *dest,
int dstW,
1027 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1029 int hasAlpha = !!abuf0;
1032 for (
i = 0;
i < dstW;
i++) {
1033 int Y = buf0[
i] >> 3;
1051 const int32_t **lumSrc,
int lumFilterSize,
1052 const int16_t *chrFilter,
const int32_t **chrUSrc,
1053 const int32_t **chrVSrc,
int chrFilterSize,
1054 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1055 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes,
1059 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1061 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1063 unsigned Y1 = -0x40000000;
1064 unsigned Y2 = -0x40000000;
1065 int U = -(128 << 23);
1066 int V = -(128 << 23);
1069 for (j = 0; j < lumFilterSize; j++) {
1070 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1071 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1073 for (j = 0; j < chrFilterSize; j++) {;
1074 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1075 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1081 for (j = 0; j < lumFilterSize; j++) {
1082 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1083 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1100 Y1 -=
c->yuv2rgb_y_offset;
1101 Y2 -=
c->yuv2rgb_y_offset;
1102 Y1 *=
c->yuv2rgb_y_coeff;
1103 Y2 *=
c->yuv2rgb_y_coeff;
1104 Y1 += (1 << 13) - (1 << 29);
1105 Y2 += (1 << 13) - (1 << 29);
1108 R =
V *
c->yuv2rgb_v2r_coeff;
1109 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1110 B =
U *
c->yuv2rgb_u2b_coeff;
1135 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1136 int yalpha,
int uvalpha,
int y,
1140 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1141 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1142 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1143 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1144 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1145 int yalpha1 = 4096 - yalpha;
1146 int uvalpha1 = 4096 - uvalpha;
1148 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1153 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1154 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1155 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1156 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1157 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1160 Y1 -=
c->yuv2rgb_y_offset;
1161 Y2 -=
c->yuv2rgb_y_offset;
1162 Y1 *=
c->yuv2rgb_y_coeff;
1163 Y2 *=
c->yuv2rgb_y_coeff;
1164 Y1 += (1 << 13) - (1 << 29);
1165 Y2 += (1 << 13) - (1 << 29);
1167 R =
V *
c->yuv2rgb_v2r_coeff;
1168 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1169 B =
U *
c->yuv2rgb_u2b_coeff;
1172 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1173 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1201 const int32_t *abuf0, uint16_t *dest,
int dstW,
1203 int hasAlpha,
int eightbytes,
int is_be)
1205 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1207 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1209 if (uvalpha < 2048) {
1210 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1211 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1212 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1213 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1214 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1217 Y1 -=
c->yuv2rgb_y_offset;
1218 Y2 -=
c->yuv2rgb_y_offset;
1219 Y1 *=
c->yuv2rgb_y_coeff;
1220 Y2 *=
c->yuv2rgb_y_coeff;
1221 Y1 += (1 << 13) - (1 << 29);
1222 Y2 += (1 << 13) - (1 << 29);
1225 A1 = abuf0[
i * 2 ] * (1 << 11);
1226 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1232 R =
V *
c->yuv2rgb_v2r_coeff;
1233 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1234 B =
U *
c->yuv2rgb_u2b_coeff;
1254 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1255 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1256 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1257 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1258 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1259 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1260 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1263 Y1 -=
c->yuv2rgb_y_offset;
1264 Y2 -=
c->yuv2rgb_y_offset;
1265 Y1 *=
c->yuv2rgb_y_coeff;
1266 Y2 *=
c->yuv2rgb_y_coeff;
1267 Y1 += (1 << 13) - (1 << 29);
1268 Y2 += (1 << 13) - (1 << 29);
1271 A1 = abuf0[
i * 2 ] * (1 << 11);
1272 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1278 R =
V *
c->yuv2rgb_v2r_coeff;
1279 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1280 B =
U *
c->yuv2rgb_u2b_coeff;
1304 const int32_t **lumSrc,
int lumFilterSize,
1305 const int16_t *chrFilter,
const int32_t **chrUSrc,
1306 const int32_t **chrVSrc,
int chrFilterSize,
1307 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1309 int eightbytes,
int is_be)
1314 for (
i = 0;
i < dstW;
i++) {
1316 int Y = -0x40000000;
1317 int U = -(128 << 23);
1318 int V = -(128 << 23);
1321 for (j = 0; j < lumFilterSize; j++) {
1322 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1324 for (j = 0; j < chrFilterSize; j++) {;
1325 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1326 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1331 for (j = 0; j < lumFilterSize; j++) {
1332 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1345 Y -=
c->yuv2rgb_y_offset;
1346 Y *=
c->yuv2rgb_y_coeff;
1347 Y += (1 << 13) - (1<<29);
1350 R =
V *
c->yuv2rgb_v2r_coeff;
1351 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1352 B =
U *
c->yuv2rgb_u2b_coeff;
1370 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1371 int yalpha,
int uvalpha,
int y,
1375 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1376 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1377 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1378 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1379 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1380 int yalpha1 = 4096 - yalpha;
1381 int uvalpha1 = 4096 - uvalpha;
1388 for (
i = 0;
i < dstW;
i++) {
1389 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1390 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1391 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1394 Y -=
c->yuv2rgb_y_offset;
1395 Y *=
c->yuv2rgb_y_coeff;
1396 Y += (1 << 13) - (1 << 29);
1398 R =
V *
c->yuv2rgb_v2r_coeff;
1399 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1400 B =
U *
c->yuv2rgb_u2b_coeff;
1403 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1423 const int32_t *abuf0, uint16_t *dest,
int dstW,
1425 int hasAlpha,
int eightbytes,
int is_be)
1427 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1431 if (uvalpha < 2048) {
1432 for (
i = 0;
i < dstW;
i++) {
1434 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1435 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1438 Y -=
c->yuv2rgb_y_offset;
1439 Y *=
c->yuv2rgb_y_coeff;
1440 Y += (1 << 13) - (1 << 29);
1443 A = abuf0[
i] * (1 << 11);
1448 R =
V *
c->yuv2rgb_v2r_coeff;
1449 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1450 B =
U *
c->yuv2rgb_u2b_coeff;
1463 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1465 for (
i = 0;
i < dstW;
i++) {
1467 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1468 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1471 Y -=
c->yuv2rgb_y_offset;
1472 Y *=
c->yuv2rgb_y_coeff;
1473 Y += (1 << 13) - (1 << 29);
1476 A = abuf0[
i] * (1 << 11);
1481 R =
V *
c->yuv2rgb_v2r_coeff;
1482 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1483 B =
U *
c->yuv2rgb_u2b_coeff;
1502 #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1503 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1504 const int16_t **_lumSrc, int lumFilterSize, \
1505 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1506 const int16_t **_chrVSrc, int chrFilterSize, \
1507 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1510 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1511 **chrUSrc = (const int32_t **) _chrUSrc, \
1512 **chrVSrc = (const int32_t **) _chrVSrc, \
1513 **alpSrc = (const int32_t **) _alpSrc; \
1514 uint16_t *dest = (uint16_t *) _dest; \
1515 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1516 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1517 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1520 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1521 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1522 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1523 int yalpha, int uvalpha, int y) \
1525 const int32_t **buf = (const int32_t **) _buf, \
1526 **ubuf = (const int32_t **) _ubuf, \
1527 **vbuf = (const int32_t **) _vbuf, \
1528 **abuf = (const int32_t **) _abuf; \
1529 uint16_t *dest = (uint16_t *) _dest; \
1530 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1531 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1534 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1535 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1536 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1537 int uvalpha, int y) \
1539 const int32_t *buf0 = (const int32_t *) _buf0, \
1540 **ubuf = (const int32_t **) _ubuf, \
1541 **vbuf = (const int32_t **) _vbuf, \
1542 *abuf0 = (const int32_t *) _abuf0; \
1543 uint16_t *dest = (uint16_t *) _dest; \
1544 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1545 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1547 #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1548 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1588 unsigned A1,
unsigned A2,
1589 const
void *_r, const
void *_g, const
void *_b,
int y,
1594 uint32_t *dest = (uint32_t *) _dest;
1595 const uint32_t *
r = (
const uint32_t *) _r;
1596 const uint32_t *
g = (
const uint32_t *) _g;
1597 const uint32_t *
b = (
const uint32_t *) _b;
1602 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1603 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1609 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1610 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1612 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1615 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1617 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1618 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1622 uint8_t *dest = (uint8_t *) _dest;
1623 const uint8_t *
r = (
const uint8_t *) _r;
1624 const uint8_t *
g = (
const uint8_t *) _g;
1625 const uint8_t *
b = (
const uint8_t *) _b;
1627 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1628 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1630 dest[
i * 6 + 0] =
r_b[Y1];
1631 dest[
i * 6 + 1] =
g[Y1];
1632 dest[
i * 6 + 2] =
b_r[Y1];
1633 dest[
i * 6 + 3] =
r_b[Y2];
1634 dest[
i * 6 + 4] =
g[Y2];
1635 dest[
i * 6 + 5] =
b_r[Y2];
1641 uint16_t *dest = (uint16_t *) _dest;
1642 const uint16_t *
r = (
const uint16_t *) _r;
1643 const uint16_t *
g = (
const uint16_t *) _g;
1644 const uint16_t *
b = (
const uint16_t *) _b;
1645 int dr1, dg1, db1, dr2, dg2, db2;
1670 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1671 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1673 uint32_t *dest = (uint32_t *) _dest;
1674 const uint32_t *
r = (
const uint32_t *) _r;
1675 const uint32_t *
g = (
const uint32_t *) _g;
1676 const uint32_t *
b = (
const uint32_t *) _b;
1677 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1678 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1680 uint8_t *dest = (uint8_t *) _dest;
1681 const uint8_t *
r = (
const uint8_t *) _r;
1682 const uint8_t *
g = (
const uint8_t *) _g;
1683 const uint8_t *
b = (
const uint8_t *) _b;
1684 int dr1, dg1, db1, dr2, dg2, db2;
1689 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1690 db1 = d64[(
i * 2 + 0) & 7];
1691 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1692 db2 = d64[(
i * 2 + 1) & 7];
1696 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1697 dg1 = d64[(
i * 2 + 0) & 7];
1698 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1699 dg2 = d64[(
i * 2 + 1) & 7];
1703 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1704 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1706 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1707 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1714 const int16_t **lumSrc,
int lumFilterSize,
1715 const int16_t *chrFilter,
const int16_t **chrUSrc,
1716 const int16_t **chrVSrc,
int chrFilterSize,
1717 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1722 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1728 const void *
r, *
g, *
b;
1730 for (j = 0; j < lumFilterSize; j++) {
1731 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1732 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1734 for (j = 0; j < chrFilterSize; j++) {
1735 U += chrUSrc[j][
i] * chrFilter[j];
1736 V += chrVSrc[j][
i] * chrFilter[j];
1745 for (j = 0; j < lumFilterSize; j++) {
1746 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1747 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1751 if ((
A1 |
A2) & 0x100) {
1762 r,
g,
b, y, target, hasAlpha);
1768 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1769 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1770 int yalpha,
int uvalpha,
int y,
1773 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1774 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1775 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1776 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1777 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1778 int yalpha1 = 4096 - yalpha;
1779 int uvalpha1 = 4096 - uvalpha;
1784 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1785 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1786 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1787 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1788 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1795 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1796 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1802 r,
g,
b, y, target, hasAlpha);
1808 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1809 const int16_t *abuf0, uint8_t *dest,
int dstW,
1813 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1816 if (uvalpha < 2048) {
1817 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1818 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1819 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1820 int U = (ubuf0[
i] + 64) >> 7;
1821 int V = (vbuf0[
i] + 64) >> 7;
1828 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1829 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1835 r,
g,
b, y, target, hasAlpha);
1838 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1839 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1840 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1841 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1842 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1843 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1850 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1851 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1857 r,
g,
b, y, target, hasAlpha);
1862 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1863 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1864 const int16_t **lumSrc, int lumFilterSize, \
1865 const int16_t *chrFilter, const int16_t **chrUSrc, \
1866 const int16_t **chrVSrc, int chrFilterSize, \
1867 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1870 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1871 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1872 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1875 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1876 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1877 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1878 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1879 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1880 int yalpha, int uvalpha, int y) \
1882 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1883 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1886 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1887 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1888 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1889 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1890 const int16_t *abuf0, uint8_t *dest, int dstW, \
1891 int uvalpha, int y) \
1893 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1894 dstW, uvalpha, y, fmt, hasAlpha); \
1901 #if CONFIG_SWSCALE_ALPHA
1920 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
1926 Y -=
c->yuv2rgb_y_offset;
1927 Y *=
c->yuv2rgb_y_coeff;
1929 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
1930 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
1931 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
1932 if ((
R |
G |
B) & 0xC0000000) {
1940 dest[0] = hasAlpha ?
A : 255;
1954 dest[3] = hasAlpha ?
A : 255;
1957 dest[0] = hasAlpha ?
A : 255;
1971 dest[3] = hasAlpha ?
A : 255;
1977 AV_WL32(dest, (3
U << 30) + (
R << 20) + (
G << 10) +
B);
1983 AV_WL32(dest, (3
U << 30) + (
B << 20) + (
G << 10) +
R);
1992 switch (
c->opts.dither) {
2010 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;
2011 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;
2012 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;
2013 c->dither_error[0][
i] = err[0];
2014 c->dither_error[1][
i] = err[1];
2015 c->dither_error[2][
i] = err[2];
2016 r =
R >> (isrgb8 ? 5 : 7);
2017 g =
G >> (isrgb8 ? 5 : 6);
2018 b =
B >> (isrgb8 ? 6 : 7);
2022 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2023 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2024 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2029 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2048 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2068 dest[0] =
r + 2*
g + 8*
b;
2070 dest[0] =
b + 2*
g + 8*
r;
2072 dest[0] =
r + 8*
g + 64*
b;
2074 dest[0] =
b + 4*
g + 32*
r;
2083 const int16_t **lumSrc,
int lumFilterSize,
2084 const int16_t *chrFilter,
const int16_t **chrUSrc,
2085 const int16_t **chrVSrc,
int chrFilterSize,
2086 const int16_t **alpSrc, uint8_t *dest,
2098 for (
i = 0;
i < dstW;
i++) {
2101 int U = (1<<9)-(128 << 19);
2102 int V = (1<<9)-(128 << 19);
2104 for (j = 0; j < lumFilterSize; j++) {
2105 Y += lumSrc[j][
i] * lumFilter[j];
2107 for (j = 0; j < chrFilterSize; j++) {
2108 U += chrUSrc[j][
i] * chrFilter[j];
2109 V += chrVSrc[j][
i] * chrFilter[j];
2116 for (j = 0; j < lumFilterSize; j++) {
2117 A += alpSrc[j][
i] * lumFilter[j];
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 *abuf[2], uint8_t *dest,
int dstW,
2135 int yalpha,
int uvalpha,
int y,
2138 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2139 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2140 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2141 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2142 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2143 int yalpha1 = 4096 - yalpha;
2144 int uvalpha1 = 4096 - uvalpha;
2157 for (
i = 0;
i < dstW;
i++) {
2158 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2159 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2160 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2163 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2168 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2171 c->dither_error[0][
i] = err[0];
2172 c->dither_error[1][
i] = err[1];
2173 c->dither_error[2][
i] = err[2];
2178 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2179 const int16_t *abuf0, uint8_t *dest,
int dstW,
2183 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2192 if (uvalpha < 2048) {
2194 for (
i = 0;
i < dstW;
i++) {
2195 int Y = buf0[
i] * 4;
2196 int U = (ubuf0[
i] - (128<<7)) * 4;
2197 int V = (vbuf0[
i] - (128<<7)) * 4;
2200 A = (abuf0[
i] + 64) >> 7;
2205 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2209 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2211 for (
i = 0;
i < dstW;
i++) {
2212 int Y = buf0[
i] * 4;
2213 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2214 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2217 A = (abuf0[
i] + 64) >> 7;
2222 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2227 c->dither_error[0][
i] = err[0];
2228 c->dither_error[1][
i] = err[1];
2229 c->dither_error[2][
i] = err[2];
2238 #if CONFIG_SWSCALE_ALPHA
2262 const int16_t **lumSrc,
int lumFilterSize,
2263 const int16_t *chrFilter, const int16_t **chrUSrc,
2264 const int16_t **chrVSrc,
int chrFilterSize,
2265 const int16_t **alpSrc, uint8_t **dest,
2271 uint16_t **dest16 = (uint16_t**)dest;
2272 int SH = 22 + 8 -
desc->comp[0].depth;
2275 for (
i = 0;
i < dstW;
i++) {
2278 int U = (1 << 9) - (128 << 19);
2279 int V = (1 << 9) - (128 << 19);
2282 for (j = 0; j < lumFilterSize; j++)
2283 Y += lumSrc[j][
i] * lumFilter[j];
2285 for (j = 0; j < chrFilterSize; j++) {
2286 U += chrUSrc[j][
i] * chrFilter[j];
2287 V += chrVSrc[j][
i] * chrFilter[j];
2297 for (j = 0; j < lumFilterSize; j++)
2298 A += alpSrc[j][
i] * lumFilter[j];
2304 Y -=
c->yuv2rgb_y_offset;
2305 Y *=
c->yuv2rgb_y_coeff;
2307 R =
Y +
V *
c->yuv2rgb_v2r_coeff;
2308 G =
Y +
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2309 B =
Y +
U *
c->yuv2rgb_u2b_coeff;
2311 if ((
R |
G |
B) & 0xC0000000) {
2318 dest16[0][
i] =
G >>
SH;
2319 dest16[1][
i] =
B >>
SH;
2320 dest16[2][
i] =
R >>
SH;
2322 dest16[3][
i] =
A >> (
SH - 3);
2324 dest[0][
i] =
G >> 22;
2325 dest[1][
i] =
B >> 22;
2326 dest[2][
i] =
R >> 22;
2328 dest[3][
i] =
A >> 19;
2331 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2332 for (
i = 0;
i < dstW;
i++) {
2344 const int16_t **lumSrcx,
int lumFilterSize,
2345 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2346 const int16_t **chrVSrcx,
int chrFilterSize,
2347 const int16_t **alpSrcx, uint8_t **dest,
2353 uint16_t **dest16 = (uint16_t**)dest;
2359 for (
i = 0;
i < dstW;
i++) {
2361 int Y = -0x40000000;
2362 int U = -(128 << 23);
2363 int V = -(128 << 23);
2366 for (j = 0; j < lumFilterSize; j++)
2367 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2369 for (j = 0; j < chrFilterSize; j++) {
2370 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2371 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2382 for (j = 0; j < lumFilterSize; j++)
2383 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2389 Y -=
c->yuv2rgb_y_offset;
2390 Y *=
c->yuv2rgb_y_coeff;
2391 Y += (1 << 13) - (1 << 29);
2392 R =
V *
c->yuv2rgb_v2r_coeff;
2393 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2394 B =
U *
c->yuv2rgb_u2b_coeff;
2403 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2404 for (
i = 0;
i < dstW;
i++) {
2416 const int16_t **lumSrcx,
int lumFilterSize,
2417 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2418 const int16_t **chrVSrcx,
int chrFilterSize,
2419 const int16_t **alpSrcx, uint8_t **dest,
2425 uint32_t **dest32 = (uint32_t**)dest;
2430 static const float float_mult = 1.0f / 65535.0f;
2432 for (
i = 0;
i < dstW;
i++) {
2434 int Y = -0x40000000;
2435 int U = -(128 << 23);
2436 int V = -(128 << 23);
2439 for (j = 0; j < lumFilterSize; j++)
2440 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2442 for (j = 0; j < chrFilterSize; j++) {
2443 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2444 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2455 for (j = 0; j < lumFilterSize; j++)
2456 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2462 Y -=
c->yuv2rgb_y_offset;
2463 Y *=
c->yuv2rgb_y_coeff;
2464 Y += (1 << 13) - (1 << 29);
2465 R =
V *
c->yuv2rgb_v2r_coeff;
2466 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2467 B =
U *
c->yuv2rgb_u2b_coeff;
2479 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2480 for (
i = 0;
i < dstW;
i++) {
2492 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2493 const int16_t *abuf0, uint8_t *dest,
int dstW,
2496 int hasAlpha = !!abuf0;
2499 for (
i = 0;
i < dstW;
i++) {
2500 int Y = (buf0[
i] + 64) >> 7;
2506 A = (abuf0[
i] + 64) >> 7;
2512 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2518 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2519 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2520 int yalpha,
int uvalpha,
int y)
2522 int hasAlpha = abuf && abuf[0] && abuf[1];
2523 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2524 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2525 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2526 int yalpha1 = 4096 - yalpha;
2531 for (
i = 0;
i < dstW;
i++) {
2532 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2538 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2543 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2549 const int16_t **lumSrc,
int lumFilterSize,
2550 const int16_t *chrFilter,
const int16_t **chrUSrc,
2551 const int16_t **chrVSrc,
int chrFilterSize,
2552 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2554 int hasAlpha = !!alpSrc;
2557 for (
i = 0;
i < dstW;
i++) {
2559 int Y = 1 << 18,
A = 1 << 18;
2561 for (j = 0; j < lumFilterSize; j++)
2562 Y += lumSrc[j][
i] * lumFilter[j];
2569 for (j = 0; j < lumFilterSize; j++)
2570 A += alpSrc[j][
i] * lumFilter[j];
2579 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2583 #define output_pixels(pos, val) \
2585 AV_WB16(pos, val); \
2587 AV_WL16(pos, val); \
2592 const int16_t **_lumSrc,
int lumFilterSize,
2593 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2594 const int16_t **_chrVSrc,
int chrFilterSize,
2595 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2596 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2599 **chrUSrc = (
const int32_t **) _chrUSrc,
2600 **chrVSrc = (
const int32_t **) _chrVSrc,
2601 **alpSrc = (
const int32_t **) _alpSrc;
2602 int hasAlpha = !!alpSrc;
2605 for (
i = 0;
i < dstW;
i++) {
2606 int Y = 1 << 14,
U = 1 << 14;
2607 int V = 1 << 14,
A = 1 << 14;
2615 for (j = 0; j < lumFilterSize; j++)
2616 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2618 for (j = 0; j < chrFilterSize; j++)
2619 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2621 for (j = 0; j < chrFilterSize; j++)
2622 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2625 for (j = 0; j < lumFilterSize; j++)
2626 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2641 #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2643 yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2644 const int16_t **lumSrc, int lumFilterSize, \
2645 const int16_t *chrFilter, const int16_t **chrUSrc, \
2646 const int16_t **chrVSrc, int chrFilterSize, \
2647 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2649 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2650 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2651 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2660 #undef output_pixels
2664 const int16_t **lumSrc,
int lumFilterSize,
2665 const int16_t *chrFilter,
const int16_t **chrUSrc,
2666 const int16_t **chrVSrc,
int chrFilterSize,
2667 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2671 for (
i = 0;
i < dstW;
i++) {
2672 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2675 for (j = 0; j < lumFilterSize; j++)
2676 Y += lumSrc[j][
i] * lumFilter[j];
2678 for (j = 0; j < chrFilterSize; j++) {
2679 U += chrUSrc[j][
i] * chrFilter[j];
2680 V += chrVSrc[j][
i] * chrFilter[j];
2689 (
unsigned)
V << (
shift + 20) |
2690 (
unsigned)
A << (
shift ? 0 : 30 ));
2694 #define V30LE_WRAPPER(name, shift) \
2695 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2696 const int16_t **lumSrc, int lumFilterSize, \
2697 const int16_t *chrFilter, const int16_t **chrUSrc, \
2698 const int16_t **chrVSrc, int chrFilterSize, \
2699 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2702 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2703 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2704 alpSrc, dest, dstW, y, shift); \
2710 #define output_pixels(pos, val, shift, bits, output_shift) \
2712 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2714 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2719 const int16_t **lumSrc,
int lumFilterSize,
2720 const int16_t *chrFilter,
const int16_t **chrUSrc,
2721 const int16_t **chrVSrc,
int chrFilterSize,
2722 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2725 for (
i = 0;
i < dstW;
i++) {
2726 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2729 for (j = 0; j < lumFilterSize; j++)
2730 Y += lumSrc[j][
i] * lumFilter[j];
2732 for (j = 0; j < chrFilterSize; j++) {
2733 U += chrUSrc[j][
i] * chrFilter[j];
2734 V += chrVSrc[j][
i] * chrFilter[j];
2744 #undef output_pixels
2746 #define YUV2XV36(BE_LE, is_be) \
2748 yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2749 const int16_t **lumSrc, int lumFilterSize, \
2750 const int16_t *chrFilter, const int16_t **chrUSrc, \
2751 const int16_t **chrVSrc, int chrFilterSize, \
2752 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2754 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2755 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2756 alpSrc, dest, dstW, y, is_be); \
2762 #define output_pixels(pos, A, Y, U, V) \
2763 if (target == AV_PIX_FMT_AYUV) { \
2764 dest[pos + 0] = A; \
2765 dest[pos + 1] = Y; \
2766 dest[pos + 2] = U; \
2767 dest[pos + 3] = V; \
2768 } else if (target == AV_PIX_FMT_UYVA) { \
2769 dest[pos + 0] = U; \
2770 dest[pos + 1] = Y; \
2771 dest[pos + 2] = V; \
2772 dest[pos + 3] = A; \
2774 dest[pos + 0] = V; \
2775 dest[pos + 1] = U; \
2776 dest[pos + 2] = Y; \
2777 dest[pos + 3] = A; \
2782 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2783 const int16_t *abuf0, uint8_t *dest,
int dstW,
2786 int hasAlpha = !!abuf0;
2789 if (uvalpha < 2048) {
2790 for (
i = 0;
i < dstW;
i++) {
2791 int Y = (buf0[
i] + 64) >> 7;
2792 int U = (ubuf[0][
i] + 64) >> 7;
2793 int V = (vbuf[0][
i] + 64) >> 7;
2804 A = (abuf0[
i] + 64) >> 7;
2812 for (
i = 0;
i < dstW;
i++) {
2813 int Y = (buf0[
i] + 64) >> 7;
2814 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2815 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2826 A = (abuf0[
i] + 64) >> 7;
2838 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2839 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2840 int yalpha,
int uvalpha,
int y,
2843 int hasAlpha = abuf && abuf[0] && abuf[1];
2844 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2845 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2846 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2847 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2848 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2849 int yalpha1 = 4096 - yalpha;
2850 int uvalpha1 = 4096 - uvalpha;
2856 for (
i = 0;
i < dstW;
i++) {
2857 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2858 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2859 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2870 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2880 const int16_t **lumSrc,
int lumFilterSize,
2881 const int16_t *chrFilter,
const int16_t **chrUSrc,
2882 const int16_t **chrVSrc,
int chrFilterSize,
2883 const int16_t **alpSrc, uint8_t *dest,
int dstW,
2888 for (
i = 0;
i < dstW;
i++) {
2890 int Y = 1 << 18,
U = 1 << 18;
2891 int V = 1 << 18,
A = 255;
2893 for (j = 0; j < lumFilterSize; j++)
2894 Y += lumSrc[j][
i] * lumFilter[j];
2896 for (j = 0; j < chrFilterSize; j++)
2897 U += chrUSrc[j][
i] * chrFilter[j];
2899 for (j = 0; j < chrFilterSize; j++)
2900 V += chrVSrc[j][
i] * chrFilter[j];
2916 for (j = 0; j < lumFilterSize; j++)
2917 A += alpSrc[j][
i] * lumFilter[j];
2929 #undef output_pixels
2931 #define AYUVPACKEDWRAPPER(name, fmt) \
2932 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2933 const int16_t **lumSrc, int lumFilterSize, \
2934 const int16_t *chrFilter, const int16_t **chrUSrc, \
2935 const int16_t **chrVSrc, int chrFilterSize, \
2936 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2939 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2940 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2941 alpSrc, dest, dstW, y, fmt); \
2944 static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
2945 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2946 const int16_t *abuf[2], uint8_t *dest, int dstW, \
2947 int yalpha, int uvalpha, int y) \
2949 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
2950 dest, dstW, yalpha, uvalpha, y, fmt); \
2953 static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
2954 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2955 const int16_t *abuf0, uint8_t *dest, int dstW, \
2956 int uvalpha, int y) \
2958 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
2959 abuf0, dest, dstW, uvalpha, \
2967 #define output_pixel(pos, val, bits) \
2968 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
2970 #define yuv2y2xx_wrapper(bits) \
2972 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
2973 const int16_t **lumSrc, int lumFilterSize, \
2974 const int16_t *chrFilter, \
2975 const int16_t **chrUSrc, \
2976 const int16_t **chrVSrc, int chrFilterSize, \
2977 const int16_t **alpSrc, \
2978 uint8_t *dest, int dstW, int y) \
2981 int shift = 11 + 16 - bits; \
2982 int output_shift = 16 - bits; \
2983 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
2984 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
2985 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
2987 for (j = 0; j < lumFilterSize; j++) { \
2988 Y1 += lumSrc[j][i * 2] * lumFilter[j]; \
2989 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \
2992 for (j = 0; j < chrFilterSize; j++) { \
2993 U += chrUSrc[j][i] * chrFilter[j]; \
2994 V += chrVSrc[j][i] * chrFilter[j]; \
2997 output_pixel(dest + 8 * i + 0, Y1, bits); \
2998 output_pixel(dest + 8 * i + 2, U, bits); \
2999 output_pixel(dest + 8 * i + 4, Y2, bits); \
3000 output_pixel(dest + 8 * i + 6, V, bits); \
3008 yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3009 const int16_t **_lumSrc,
int lumFilterSize,
3010 const int16_t *chrFilter,
3011 const int16_t **_chrUSrc,
3012 const int16_t **_chrVSrc,
int chrFilterSize,
3013 const int16_t **_alpSrc,
3014 uint8_t *dest,
int dstW,
int y)
3021 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3022 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3031 for (
int j = 0; j < lumFilterSize; j++) {
3032 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3033 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3036 for (
int j = 0; j < chrFilterSize; j++) {
3037 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3038 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3050 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3051 const int16_t *abuf0, uint8_t *dest,
int dstW,
3056 if (uvalpha < 2048) {
3057 for (
i = 0;
i < dstW;
i++) {
3058 int Y = (buf0[
i] + 64) >> 7;
3059 int U = (ubuf[0][
i] + 64) >> 7;
3060 int V = (vbuf[0][
i] + 64) >> 7;
3070 dest[3 *
i + 1] =
Y;
3071 dest[3 *
i + 2] =
U;
3074 for (
i = 0;
i < dstW;
i++) {
3075 int Y = (buf0[
i] + 64) >> 7;
3076 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3077 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3087 dest[3 *
i + 1] =
Y;
3088 dest[3 *
i + 2] =
U;
3095 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3096 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3097 int yalpha,
int uvalpha,
int y)
3099 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3100 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3101 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3102 int yalpha1 = 4096 - yalpha;
3103 int uvalpha1 = 4096 - uvalpha;
3109 for (
i = 0;
i < dstW;
i++) {
3110 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3111 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3112 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3122 dest[3 *
i + 1] =
Y;
3123 dest[3 *
i + 2] =
U;
3129 const int16_t **lumSrc,
int lumFilterSize,
3130 const int16_t *chrFilter,
const int16_t **chrUSrc,
3131 const int16_t **chrVSrc,
int chrFilterSize,
3132 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3136 for (
i = 0;
i < dstW;
i++) {
3138 int Y = 1 << 18,
U = 1 << 18;
3141 for (j = 0; j < lumFilterSize; j++)
3142 Y += lumSrc[j][
i] * lumFilter[j];
3144 for (j = 0; j < chrFilterSize; j++)
3145 U += chrUSrc[j][
i] * chrFilter[j];
3147 for (j = 0; j < chrFilterSize; j++)
3148 V += chrVSrc[j][
i] * chrFilter[j];
3162 dest[3 *
i + 1] =
Y;
3163 dest[3 *
i + 2] =
U;
3182 if (
desc->comp[0].depth == 10) {
3183 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3184 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3185 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3186 }
else if (
desc->comp[0].depth == 12) {
3187 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3188 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3189 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3192 }
else if (
is16BPS(dstFormat)) {
3193 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3194 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3198 }
else if (
isNBPS(dstFormat)) {
3199 if (
desc->comp[0].depth == 9) {
3200 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3201 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3202 }
else if (
desc->comp[0].depth == 10) {
3203 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3204 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3205 }
else if (
desc->comp[0].depth == 12) {
3206 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3207 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3208 }
else if (
desc->comp[0].depth == 14) {
3209 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3210 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3215 *yuv2plane1 = yuv2plane1_floatBE_c;
3218 *yuv2plane1 = yuv2plane1_floatLE_c;
3227 switch (dstFormat) {
3230 *yuv2packedX = yuv2rgba32_full_X_c;
3231 *yuv2packed2 = yuv2rgba32_full_2_c;
3232 *yuv2packed1 = yuv2rgba32_full_1_c;
3234 #if CONFIG_SWSCALE_ALPHA
3236 *yuv2packedX = yuv2rgba32_full_X_c;
3237 *yuv2packed2 = yuv2rgba32_full_2_c;
3238 *yuv2packed1 = yuv2rgba32_full_1_c;
3242 *yuv2packedX = yuv2rgbx32_full_X_c;
3243 *yuv2packed2 = yuv2rgbx32_full_2_c;
3244 *yuv2packed1 = yuv2rgbx32_full_1_c;
3250 *yuv2packedX = yuv2argb32_full_X_c;
3251 *yuv2packed2 = yuv2argb32_full_2_c;
3252 *yuv2packed1 = yuv2argb32_full_1_c;
3254 #if CONFIG_SWSCALE_ALPHA
3256 *yuv2packedX = yuv2argb32_full_X_c;
3257 *yuv2packed2 = yuv2argb32_full_2_c;
3258 *yuv2packed1 = yuv2argb32_full_1_c;
3262 *yuv2packedX = yuv2xrgb32_full_X_c;
3263 *yuv2packed2 = yuv2xrgb32_full_2_c;
3264 *yuv2packed1 = yuv2xrgb32_full_1_c;
3270 *yuv2packedX = yuv2bgra32_full_X_c;
3271 *yuv2packed2 = yuv2bgra32_full_2_c;
3272 *yuv2packed1 = yuv2bgra32_full_1_c;
3274 #if CONFIG_SWSCALE_ALPHA
3276 *yuv2packedX = yuv2bgra32_full_X_c;
3277 *yuv2packed2 = yuv2bgra32_full_2_c;
3278 *yuv2packed1 = yuv2bgra32_full_1_c;
3282 *yuv2packedX = yuv2bgrx32_full_X_c;
3283 *yuv2packed2 = yuv2bgrx32_full_2_c;
3284 *yuv2packed1 = yuv2bgrx32_full_1_c;
3290 *yuv2packedX = yuv2abgr32_full_X_c;
3291 *yuv2packed2 = yuv2abgr32_full_2_c;
3292 *yuv2packed1 = yuv2abgr32_full_1_c;
3294 #if CONFIG_SWSCALE_ALPHA
3296 *yuv2packedX = yuv2abgr32_full_X_c;
3297 *yuv2packed2 = yuv2abgr32_full_2_c;
3298 *yuv2packed1 = yuv2abgr32_full_1_c;
3302 *yuv2packedX = yuv2xbgr32_full_X_c;
3303 *yuv2packed2 = yuv2xbgr32_full_2_c;
3304 *yuv2packed1 = yuv2xbgr32_full_1_c;
3309 #if CONFIG_SWSCALE_ALPHA
3311 *yuv2packedX = yuv2rgba64le_full_X_c;
3312 *yuv2packed2 = yuv2rgba64le_full_2_c;
3313 *yuv2packed1 = yuv2rgba64le_full_1_c;
3317 *yuv2packedX = yuv2rgbx64le_full_X_c;
3318 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3319 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3323 #if CONFIG_SWSCALE_ALPHA
3325 *yuv2packedX = yuv2rgba64be_full_X_c;
3326 *yuv2packed2 = yuv2rgba64be_full_2_c;
3327 *yuv2packed1 = yuv2rgba64be_full_1_c;
3331 *yuv2packedX = yuv2rgbx64be_full_X_c;
3332 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3333 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3337 #if CONFIG_SWSCALE_ALPHA
3339 *yuv2packedX = yuv2bgra64le_full_X_c;
3340 *yuv2packed2 = yuv2bgra64le_full_2_c;
3341 *yuv2packed1 = yuv2bgra64le_full_1_c;
3345 *yuv2packedX = yuv2bgrx64le_full_X_c;
3346 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3347 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3351 #if CONFIG_SWSCALE_ALPHA
3353 *yuv2packedX = yuv2bgra64be_full_X_c;
3354 *yuv2packed2 = yuv2bgra64be_full_2_c;
3355 *yuv2packed1 = yuv2bgra64be_full_1_c;
3359 *yuv2packedX = yuv2bgrx64be_full_X_c;
3360 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3361 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3366 *yuv2packedX = yuv2rgb24_full_X_c;
3367 *yuv2packed2 = yuv2rgb24_full_2_c;
3368 *yuv2packed1 = yuv2rgb24_full_1_c;
3371 *yuv2packedX = yuv2bgr24_full_X_c;
3372 *yuv2packed2 = yuv2bgr24_full_2_c;
3373 *yuv2packed1 = yuv2bgr24_full_1_c;
3376 *yuv2packedX = yuv2rgb48le_full_X_c;
3377 *yuv2packed2 = yuv2rgb48le_full_2_c;
3378 *yuv2packed1 = yuv2rgb48le_full_1_c;
3381 *yuv2packedX = yuv2bgr48le_full_X_c;
3382 *yuv2packed2 = yuv2bgr48le_full_2_c;
3383 *yuv2packed1 = yuv2bgr48le_full_1_c;
3386 *yuv2packedX = yuv2rgb48be_full_X_c;
3387 *yuv2packed2 = yuv2rgb48be_full_2_c;
3388 *yuv2packed1 = yuv2rgb48be_full_1_c;
3391 *yuv2packedX = yuv2bgr48be_full_X_c;
3392 *yuv2packed2 = yuv2bgr48be_full_2_c;
3393 *yuv2packed1 = yuv2bgr48be_full_1_c;
3396 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3397 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3398 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3401 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3402 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3403 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3406 *yuv2packedX = yuv2bgr8_full_X_c;
3407 *yuv2packed2 = yuv2bgr8_full_2_c;
3408 *yuv2packed1 = yuv2bgr8_full_1_c;
3411 *yuv2packedX = yuv2rgb8_full_X_c;
3412 *yuv2packed2 = yuv2rgb8_full_2_c;
3413 *yuv2packed1 = yuv2rgb8_full_1_c;
3416 *yuv2packedX = yuv2x2rgb10_full_X_c;
3417 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3418 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3421 *yuv2packedX = yuv2x2bgr10_full_X_c;
3422 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3423 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3456 if (!*yuv2packedX && !*yuv2anyX)
3460 switch (dstFormat) {
3462 #if CONFIG_SWSCALE_ALPHA
3464 *yuv2packed1 = yuv2rgba64le_1_c;
3465 *yuv2packed2 = yuv2rgba64le_2_c;
3466 *yuv2packedX = yuv2rgba64le_X_c;
3470 *yuv2packed1 = yuv2rgbx64le_1_c;
3471 *yuv2packed2 = yuv2rgbx64le_2_c;
3472 *yuv2packedX = yuv2rgbx64le_X_c;
3476 #if CONFIG_SWSCALE_ALPHA
3478 *yuv2packed1 = yuv2rgba64be_1_c;
3479 *yuv2packed2 = yuv2rgba64be_2_c;
3480 *yuv2packedX = yuv2rgba64be_X_c;
3484 *yuv2packed1 = yuv2rgbx64be_1_c;
3485 *yuv2packed2 = yuv2rgbx64be_2_c;
3486 *yuv2packedX = yuv2rgbx64be_X_c;
3490 #if CONFIG_SWSCALE_ALPHA
3492 *yuv2packed1 = yuv2bgra64le_1_c;
3493 *yuv2packed2 = yuv2bgra64le_2_c;
3494 *yuv2packedX = yuv2bgra64le_X_c;
3498 *yuv2packed1 = yuv2bgrx64le_1_c;
3499 *yuv2packed2 = yuv2bgrx64le_2_c;
3500 *yuv2packedX = yuv2bgrx64le_X_c;
3504 #if CONFIG_SWSCALE_ALPHA
3506 *yuv2packed1 = yuv2bgra64be_1_c;
3507 *yuv2packed2 = yuv2bgra64be_2_c;
3508 *yuv2packedX = yuv2bgra64be_X_c;
3512 *yuv2packed1 = yuv2bgrx64be_1_c;
3513 *yuv2packed2 = yuv2bgrx64be_2_c;
3514 *yuv2packedX = yuv2bgrx64be_X_c;
3518 *yuv2packed1 = yuv2rgb48le_1_c;
3519 *yuv2packed2 = yuv2rgb48le_2_c;
3520 *yuv2packedX = yuv2rgb48le_X_c;
3523 *yuv2packed1 = yuv2rgb48be_1_c;
3524 *yuv2packed2 = yuv2rgb48be_2_c;
3525 *yuv2packedX = yuv2rgb48be_X_c;
3528 *yuv2packed1 = yuv2bgr48le_1_c;
3529 *yuv2packed2 = yuv2bgr48le_2_c;
3530 *yuv2packedX = yuv2bgr48le_X_c;
3533 *yuv2packed1 = yuv2bgr48be_1_c;
3534 *yuv2packed2 = yuv2bgr48be_2_c;
3535 *yuv2packedX = yuv2bgr48be_X_c;
3540 *yuv2packed1 = yuv2rgb32_1_c;
3541 *yuv2packed2 = yuv2rgb32_2_c;
3542 *yuv2packedX = yuv2rgb32_X_c;
3544 #if CONFIG_SWSCALE_ALPHA
3546 *yuv2packed1 = yuv2rgba32_1_c;
3547 *yuv2packed2 = yuv2rgba32_2_c;
3548 *yuv2packedX = yuv2rgba32_X_c;
3552 *yuv2packed1 = yuv2rgbx32_1_c;
3553 *yuv2packed2 = yuv2rgbx32_2_c;
3554 *yuv2packedX = yuv2rgbx32_X_c;
3561 *yuv2packed1 = yuv2rgb32_1_1_c;
3562 *yuv2packed2 = yuv2rgb32_1_2_c;
3563 *yuv2packedX = yuv2rgb32_1_X_c;
3565 #if CONFIG_SWSCALE_ALPHA
3567 *yuv2packed1 = yuv2rgba32_1_1_c;
3568 *yuv2packed2 = yuv2rgba32_1_2_c;
3569 *yuv2packedX = yuv2rgba32_1_X_c;
3573 *yuv2packed1 = yuv2rgbx32_1_1_c;
3574 *yuv2packed2 = yuv2rgbx32_1_2_c;
3575 *yuv2packedX = yuv2rgbx32_1_X_c;
3580 *yuv2packed1 = yuv2rgb24_1_c;
3581 *yuv2packed2 = yuv2rgb24_2_c;
3582 *yuv2packedX = yuv2rgb24_X_c;
3585 *yuv2packed1 = yuv2bgr24_1_c;
3586 *yuv2packed2 = yuv2bgr24_2_c;
3587 *yuv2packedX = yuv2bgr24_X_c;
3593 *yuv2packed1 = yuv2rgb16_1_c;
3594 *yuv2packed2 = yuv2rgb16_2_c;
3595 *yuv2packedX = yuv2rgb16_X_c;
3601 *yuv2packed1 = yuv2rgb15_1_c;
3602 *yuv2packed2 = yuv2rgb15_2_c;
3603 *yuv2packedX = yuv2rgb15_X_c;
3609 *yuv2packed1 = yuv2rgb12_1_c;
3610 *yuv2packed2 = yuv2rgb12_2_c;
3611 *yuv2packedX = yuv2rgb12_X_c;
3615 *yuv2packed1 = yuv2rgb8_1_c;
3616 *yuv2packed2 = yuv2rgb8_2_c;
3617 *yuv2packedX = yuv2rgb8_X_c;
3621 *yuv2packed1 = yuv2rgb4_1_c;
3622 *yuv2packed2 = yuv2rgb4_2_c;
3623 *yuv2packedX = yuv2rgb4_X_c;
3627 *yuv2packed1 = yuv2rgb4b_1_c;
3628 *yuv2packed2 = yuv2rgb4b_2_c;
3629 *yuv2packedX = yuv2rgb4b_X_c;
3633 *yuv2packed1 = yuv2x2rgb10_1_c;
3634 *yuv2packed2 = yuv2x2rgb10_2_c;
3635 *yuv2packedX = yuv2x2rgb10_X_c;
3639 *yuv2packed1 = yuv2x2bgr10_1_c;
3640 *yuv2packed2 = yuv2x2bgr10_2_c;
3641 *yuv2packedX = yuv2x2bgr10_X_c;
3645 switch (dstFormat) {
3647 *yuv2packed1 = yuv2monowhite_1_c;
3648 *yuv2packed2 = yuv2monowhite_2_c;
3649 *yuv2packedX = yuv2monowhite_X_c;
3652 *yuv2packed1 = yuv2monoblack_1_c;
3653 *yuv2packed2 = yuv2monoblack_2_c;
3654 *yuv2packedX = yuv2monoblack_X_c;
3657 *yuv2packed1 = yuv2yuyv422_1_c;
3658 *yuv2packed2 = yuv2yuyv422_2_c;
3659 *yuv2packedX = yuv2yuyv422_X_c;
3662 *yuv2packed1 = yuv2yvyu422_1_c;
3663 *yuv2packed2 = yuv2yvyu422_2_c;
3664 *yuv2packedX = yuv2yvyu422_X_c;
3667 *yuv2packed1 = yuv2uyvy422_1_c;
3668 *yuv2packed2 = yuv2uyvy422_2_c;
3669 *yuv2packedX = yuv2uyvy422_X_c;
3682 *yuv2packed1 = yuv2ya16le_1_c;
3683 *yuv2packed2 = yuv2ya16le_2_c;
3684 *yuv2packedX = yuv2ya16le_X_c;
3687 *yuv2packed1 = yuv2ya16be_1_c;
3688 *yuv2packed2 = yuv2ya16be_2_c;
3689 *yuv2packedX = yuv2ya16be_X_c;
3692 *yuv2packedX = yuv2v30xle_X_c;
3695 *yuv2packedX = yuv2ayuv64le_X_c;
3698 *yuv2packedX = yuv2ayuv64be_X_c;
3701 *yuv2packed1 = yuv2ayuv_1_c;
3702 *yuv2packed2 = yuv2ayuv_2_c;
3703 *yuv2packedX = yuv2ayuv_X_c;
3707 *yuv2packed1 = yuv2vuyX_1_c;
3708 *yuv2packed2 = yuv2vuyX_2_c;
3709 *yuv2packedX = yuv2vuyX_X_c;
3712 *yuv2packed1 = yuv2uyva_1_c;
3713 *yuv2packed2 = yuv2uyva_2_c;
3714 *yuv2packedX = yuv2uyva_X_c;
3717 *yuv2packedX = yuv2xv30le_X_c;
3720 *yuv2packedX = yuv2xv36le_X_c;
3723 *yuv2packedX = yuv2xv36be_X_c;
3726 *yuv2packedX = yuv2xv48le_X_c;
3729 *yuv2packedX = yuv2xv48be_X_c;
3732 *yuv2packedX = yuv2y210le_X_c;
3735 *yuv2packedX = yuv2y212le_X_c;
3738 *yuv2packedX = yuv2y216le_X_c;