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;
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 int uvalpha1 = 4096 - uvalpha;
1259 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1260 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1261 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1262 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1263 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1266 Y1 -=
c->yuv2rgb_y_offset;
1267 Y2 -=
c->yuv2rgb_y_offset;
1268 Y1 *=
c->yuv2rgb_y_coeff;
1269 Y2 *=
c->yuv2rgb_y_coeff;
1270 Y1 += (1 << 13) - (1 << 29);
1271 Y2 += (1 << 13) - (1 << 29);
1274 A1 = abuf0[
i * 2 ] * (1 << 11);
1275 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1281 R =
V *
c->yuv2rgb_v2r_coeff;
1282 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1283 B =
U *
c->yuv2rgb_u2b_coeff;
1307 const int32_t **lumSrc,
int lumFilterSize,
1308 const int16_t *chrFilter,
const int32_t **chrUSrc,
1309 const int32_t **chrVSrc,
int chrFilterSize,
1310 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1312 int eightbytes,
int is_be)
1317 for (
i = 0;
i < dstW;
i++) {
1319 int Y = -0x40000000;
1320 int U = -(128 << 23);
1321 int V = -(128 << 23);
1324 for (j = 0; j < lumFilterSize; j++) {
1325 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1327 for (j = 0; j < chrFilterSize; j++) {;
1328 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1329 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1334 for (j = 0; j < lumFilterSize; j++) {
1335 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1348 Y -=
c->yuv2rgb_y_offset;
1349 Y *=
c->yuv2rgb_y_coeff;
1350 Y += (1 << 13) - (1<<29);
1353 R =
V *
c->yuv2rgb_v2r_coeff;
1354 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1355 B =
U *
c->yuv2rgb_u2b_coeff;
1373 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1374 int yalpha,
int uvalpha,
int y,
1378 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1379 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1380 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1381 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1382 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1383 int yalpha1 = 4096 - yalpha;
1384 int uvalpha1 = 4096 - uvalpha;
1391 for (
i = 0;
i < dstW;
i++) {
1392 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1393 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1394 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1397 Y -=
c->yuv2rgb_y_offset;
1398 Y *=
c->yuv2rgb_y_coeff;
1399 Y += (1 << 13) - (1 << 29);
1401 R =
V *
c->yuv2rgb_v2r_coeff;
1402 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1403 B =
U *
c->yuv2rgb_u2b_coeff;
1406 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1426 const int32_t *abuf0, uint16_t *dest,
int dstW,
1428 int hasAlpha,
int eightbytes,
int is_be)
1430 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1435 for (
i = 0;
i < dstW;
i++) {
1437 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1438 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1441 Y -=
c->yuv2rgb_y_offset;
1442 Y *=
c->yuv2rgb_y_coeff;
1443 Y += (1 << 13) - (1 << 29);
1446 A = abuf0[
i] * (1 << 11);
1451 R =
V *
c->yuv2rgb_v2r_coeff;
1452 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1453 B =
U *
c->yuv2rgb_u2b_coeff;
1466 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1467 int uvalpha1 = 4096 - uvalpha;
1471 for (
i = 0;
i < dstW;
i++) {
1473 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1474 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1477 Y -=
c->yuv2rgb_y_offset;
1478 Y *=
c->yuv2rgb_y_coeff;
1479 Y += (1 << 13) - (1 << 29);
1482 A = abuf0[
i] * (1 << 11);
1487 R =
V *
c->yuv2rgb_v2r_coeff;
1488 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1489 B =
U *
c->yuv2rgb_u2b_coeff;
1508 #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1509 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1510 const int16_t **_lumSrc, int lumFilterSize, \
1511 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1512 const int16_t **_chrVSrc, int chrFilterSize, \
1513 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1516 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1517 **chrUSrc = (const int32_t **) _chrUSrc, \
1518 **chrVSrc = (const int32_t **) _chrVSrc, \
1519 **alpSrc = (const int32_t **) _alpSrc; \
1520 uint16_t *dest = (uint16_t *) _dest; \
1521 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1522 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1523 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1526 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1527 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1528 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1529 int yalpha, int uvalpha, int y) \
1531 const int32_t **buf = (const int32_t **) _buf, \
1532 **ubuf = (const int32_t **) _ubuf, \
1533 **vbuf = (const int32_t **) _vbuf, \
1534 **abuf = (const int32_t **) _abuf; \
1535 uint16_t *dest = (uint16_t *) _dest; \
1536 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1537 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1540 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1541 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1542 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1543 int uvalpha, int y) \
1545 const int32_t *buf0 = (const int32_t *) _buf0, \
1546 **ubuf = (const int32_t **) _ubuf, \
1547 **vbuf = (const int32_t **) _vbuf, \
1548 *abuf0 = (const int32_t *) _abuf0; \
1549 uint16_t *dest = (uint16_t *) _dest; \
1550 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1551 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1553 #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1554 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1594 unsigned A1,
unsigned A2,
1595 const
void *_r, const
void *_g, const
void *_b,
int y,
1600 uint32_t *dest = (uint32_t *) _dest;
1601 const uint32_t *
r = (
const uint32_t *) _r;
1602 const uint32_t *
g = (
const uint32_t *) _g;
1603 const uint32_t *
b = (
const uint32_t *) _b;
1608 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1609 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1615 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1616 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1618 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1621 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1623 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1624 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1628 uint8_t *dest = (uint8_t *) _dest;
1629 const uint8_t *
r = (
const uint8_t *) _r;
1630 const uint8_t *
g = (
const uint8_t *) _g;
1631 const uint8_t *
b = (
const uint8_t *) _b;
1633 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1634 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1636 dest[
i * 6 + 0] =
r_b[Y1];
1637 dest[
i * 6 + 1] =
g[Y1];
1638 dest[
i * 6 + 2] =
b_r[Y1];
1639 dest[
i * 6 + 3] =
r_b[Y2];
1640 dest[
i * 6 + 4] =
g[Y2];
1641 dest[
i * 6 + 5] =
b_r[Y2];
1647 uint16_t *dest = (uint16_t *) _dest;
1648 const uint16_t *
r = (
const uint16_t *) _r;
1649 const uint16_t *
g = (
const uint16_t *) _g;
1650 const uint16_t *
b = (
const uint16_t *) _b;
1651 int dr1, dg1, db1, dr2, dg2, db2;
1676 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1677 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1679 uint32_t *dest = (uint32_t *) _dest;
1680 const uint32_t *
r = (
const uint32_t *) _r;
1681 const uint32_t *
g = (
const uint32_t *) _g;
1682 const uint32_t *
b = (
const uint32_t *) _b;
1683 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1684 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1686 uint8_t *dest = (uint8_t *) _dest;
1687 const uint8_t *
r = (
const uint8_t *) _r;
1688 const uint8_t *
g = (
const uint8_t *) _g;
1689 const uint8_t *
b = (
const uint8_t *) _b;
1690 int dr1, dg1, db1, dr2, dg2, db2;
1695 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1696 db1 = d64[(
i * 2 + 0) & 7];
1697 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1698 db2 = d64[(
i * 2 + 1) & 7];
1702 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1703 dg1 = d64[(
i * 2 + 0) & 7];
1704 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1705 dg2 = d64[(
i * 2 + 1) & 7];
1709 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1710 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1712 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1713 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1720 const int16_t **lumSrc,
int lumFilterSize,
1721 const int16_t *chrFilter,
const int16_t **chrUSrc,
1722 const int16_t **chrVSrc,
int chrFilterSize,
1723 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1728 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1734 const void *
r, *
g, *
b;
1736 for (j = 0; j < lumFilterSize; j++) {
1737 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1738 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1740 for (j = 0; j < chrFilterSize; j++) {
1741 U += chrUSrc[j][
i] * chrFilter[j];
1742 V += chrVSrc[j][
i] * chrFilter[j];
1751 for (j = 0; j < lumFilterSize; j++) {
1752 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1753 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1757 if ((
A1 |
A2) & 0x100) {
1768 r,
g,
b, y, target, hasAlpha);
1774 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1775 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1776 int yalpha,
int uvalpha,
int y,
1779 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1780 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1781 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1782 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1783 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1784 int yalpha1 = 4096 - yalpha;
1785 int uvalpha1 = 4096 - uvalpha;
1790 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1791 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1792 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1793 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1794 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1801 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1802 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1808 r,
g,
b, y, target, hasAlpha);
1814 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1815 const int16_t *abuf0, uint8_t *dest,
int dstW,
1819 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1823 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1824 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1825 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1826 int U = (ubuf0[
i] + 64) >> 7;
1827 int V = (vbuf0[
i] + 64) >> 7;
1834 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1835 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1841 r,
g,
b, y, target, hasAlpha);
1844 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1845 int uvalpha1 = 4096 - uvalpha;
1848 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1849 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1850 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1851 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha + (128 << 11)) >> 19;
1852 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha + (128 << 11)) >> 19;
1859 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1860 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1866 r,
g,
b, y, target, hasAlpha);
1871 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1872 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1873 const int16_t **lumSrc, int lumFilterSize, \
1874 const int16_t *chrFilter, const int16_t **chrUSrc, \
1875 const int16_t **chrVSrc, int chrFilterSize, \
1876 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1879 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1880 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1881 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1884 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1885 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1886 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1887 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1888 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1889 int yalpha, int uvalpha, int y) \
1891 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1892 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1895 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1896 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1897 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1898 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1899 const int16_t *abuf0, uint8_t *dest, int dstW, \
1900 int uvalpha, int y) \
1902 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1903 dstW, uvalpha, y, fmt, hasAlpha); \
1910 #if CONFIG_SWSCALE_ALPHA
1929 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
1935 Y -=
c->yuv2rgb_y_offset;
1936 Y *=
c->yuv2rgb_y_coeff;
1938 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
1939 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
1940 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
1941 if ((
R |
G |
B) & 0xC0000000) {
1949 dest[0] = hasAlpha ?
A : 255;
1963 dest[3] = hasAlpha ?
A : 255;
1966 dest[0] = hasAlpha ?
A : 255;
1980 dest[3] = hasAlpha ?
A : 255;
1986 AV_WL32(dest, (3
U << 30) + (
R << 20) + (
G << 10) +
B);
1992 AV_WL32(dest, (3
U << 30) + (
B << 20) + (
G << 10) +
R);
2001 switch (
c->opts.dither) {
2019 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;
2020 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;
2021 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;
2022 c->dither_error[0][
i] = err[0];
2023 c->dither_error[1][
i] = err[1];
2024 c->dither_error[2][
i] = err[2];
2025 r =
R >> (isrgb8 ? 5 : 7);
2026 g =
G >> (isrgb8 ? 5 : 6);
2027 b =
B >> (isrgb8 ? 6 : 7);
2031 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2032 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2033 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2038 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2057 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2077 dest[0] =
r + 2*
g + 8*
b;
2079 dest[0] =
b + 2*
g + 8*
r;
2081 dest[0] =
r + 8*
g + 64*
b;
2083 dest[0] =
b + 4*
g + 32*
r;
2092 const int16_t **lumSrc,
int lumFilterSize,
2093 const int16_t *chrFilter,
const int16_t **chrUSrc,
2094 const int16_t **chrVSrc,
int chrFilterSize,
2095 const int16_t **alpSrc, uint8_t *dest,
2107 for (
i = 0;
i < dstW;
i++) {
2110 int U = (1<<9)-(128 << 19);
2111 int V = (1<<9)-(128 << 19);
2113 for (j = 0; j < lumFilterSize; j++) {
2114 Y += lumSrc[j][
i] * lumFilter[j];
2116 for (j = 0; j < chrFilterSize; j++) {
2117 U += chrUSrc[j][
i] * chrFilter[j];
2118 V += chrVSrc[j][
i] * chrFilter[j];
2125 for (j = 0; j < lumFilterSize; j++) {
2126 A += alpSrc[j][
i] * lumFilter[j];
2132 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2135 c->dither_error[0][
i] = err[0];
2136 c->dither_error[1][
i] = err[1];
2137 c->dither_error[2][
i] = err[2];
2142 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2143 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2144 int yalpha,
int uvalpha,
int y,
2147 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2148 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2149 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2150 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2151 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2152 int yalpha1 = 4096 - yalpha;
2153 int uvalpha1 = 4096 - uvalpha;
2166 for (
i = 0;
i < dstW;
i++) {
2167 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2168 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2169 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2172 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2177 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2180 c->dither_error[0][
i] = err[0];
2181 c->dither_error[1][
i] = err[1];
2182 c->dither_error[2][
i] = err[2];
2187 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2188 const int16_t *abuf0, uint8_t *dest,
int dstW,
2192 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2203 for (
i = 0;
i < dstW;
i++) {
2204 int Y = buf0[
i] * 4;
2205 int U = (ubuf0[
i] - (128<<7)) * 4;
2206 int V = (vbuf0[
i] - (128<<7)) * 4;
2209 A = (abuf0[
i] + 64) >> 7;
2214 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2218 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2220 int uvalpha1 = 4096 - uvalpha;
2223 for (
i = 0;
i < dstW;
i++) {
2224 int Y = buf0[
i] * 4;
2225 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 19)) >> 10;
2226 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 19)) >> 10;
2229 A = (abuf0[
i] + 64) >> 7;
2234 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2239 c->dither_error[0][
i] = err[0];
2240 c->dither_error[1][
i] = err[1];
2241 c->dither_error[2][
i] = err[2];
2250 #if CONFIG_SWSCALE_ALPHA
2274 const int16_t **lumSrc,
int lumFilterSize,
2275 const int16_t *chrFilter, const int16_t **chrUSrc,
2276 const int16_t **chrVSrc,
int chrFilterSize,
2277 const int16_t **alpSrc, uint8_t **dest,
2283 uint16_t **dest16 = (uint16_t**)dest;
2284 int SH = 22 + 8 -
desc->comp[0].depth;
2287 for (
i = 0;
i < dstW;
i++) {
2290 int U = (1 << 9) - (128 << 19);
2291 int V = (1 << 9) - (128 << 19);
2294 for (j = 0; j < lumFilterSize; j++)
2295 Y += lumSrc[j][
i] * lumFilter[j];
2297 for (j = 0; j < chrFilterSize; j++) {
2298 U += chrUSrc[j][
i] * chrFilter[j];
2299 V += chrVSrc[j][
i] * chrFilter[j];
2309 for (j = 0; j < lumFilterSize; j++)
2310 A += alpSrc[j][
i] * lumFilter[j];
2316 Y -=
c->yuv2rgb_y_offset;
2317 Y *=
c->yuv2rgb_y_coeff;
2319 R =
Y +
V *
c->yuv2rgb_v2r_coeff;
2320 G =
Y +
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2321 B =
Y +
U *
c->yuv2rgb_u2b_coeff;
2323 if ((
R |
G |
B) & 0xC0000000) {
2330 dest16[0][
i] =
G >>
SH;
2331 dest16[1][
i] =
B >>
SH;
2332 dest16[2][
i] =
R >>
SH;
2334 dest16[3][
i] =
A >> (
SH - 3);
2336 dest[0][
i] =
G >> 22;
2337 dest[1][
i] =
B >> 22;
2338 dest[2][
i] =
R >> 22;
2340 dest[3][
i] =
A >> 19;
2343 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2344 for (
i = 0;
i < dstW;
i++) {
2356 const int16_t **lumSrcx,
int lumFilterSize,
2357 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2358 const int16_t **chrVSrcx,
int chrFilterSize,
2359 const int16_t **alpSrcx, uint8_t **dest,
2365 uint16_t **dest16 = (uint16_t**)dest;
2371 for (
i = 0;
i < dstW;
i++) {
2373 int Y = -0x40000000;
2374 int U = -(128 << 23);
2375 int V = -(128 << 23);
2378 for (j = 0; j < lumFilterSize; j++)
2379 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2381 for (j = 0; j < chrFilterSize; j++) {
2382 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2383 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2394 for (j = 0; j < lumFilterSize; j++)
2395 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2401 Y -=
c->yuv2rgb_y_offset;
2402 Y *=
c->yuv2rgb_y_coeff;
2403 Y += (1 << 13) - (1 << 29);
2404 R =
V *
c->yuv2rgb_v2r_coeff;
2405 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2406 B =
U *
c->yuv2rgb_u2b_coeff;
2415 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2416 for (
i = 0;
i < dstW;
i++) {
2428 const int16_t **lumSrcx,
int lumFilterSize,
2429 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2430 const int16_t **chrVSrcx,
int chrFilterSize,
2431 const int16_t **alpSrcx, uint8_t **dest,
2437 uint32_t **dest32 = (uint32_t**)dest;
2442 static const float float_mult = 1.0f / 65535.0f;
2444 for (
i = 0;
i < dstW;
i++) {
2446 int Y = -0x40000000;
2447 int U = -(128 << 23);
2448 int V = -(128 << 23);
2451 for (j = 0; j < lumFilterSize; j++)
2452 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2454 for (j = 0; j < chrFilterSize; j++) {
2455 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2456 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2467 for (j = 0; j < lumFilterSize; j++)
2468 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2474 Y -=
c->yuv2rgb_y_offset;
2475 Y *=
c->yuv2rgb_y_coeff;
2476 Y += (1 << 13) - (1 << 29);
2477 R =
V *
c->yuv2rgb_v2r_coeff;
2478 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2479 B =
U *
c->yuv2rgb_u2b_coeff;
2491 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2492 for (
i = 0;
i < dstW;
i++) {
2504 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2505 const int16_t *abuf0, uint8_t *dest,
int dstW,
2508 int hasAlpha = !!abuf0;
2511 for (
i = 0;
i < dstW;
i++) {
2512 int Y = (buf0[
i] + 64) >> 7;
2518 A = (abuf0[
i] + 64) >> 7;
2524 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2530 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2531 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2532 int yalpha,
int uvalpha,
int y)
2534 int hasAlpha = abuf && abuf[0] && abuf[1];
2535 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2536 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2537 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2538 int yalpha1 = 4096 - yalpha;
2543 for (
i = 0;
i < dstW;
i++) {
2544 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2550 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2555 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2561 const int16_t **lumSrc,
int lumFilterSize,
2562 const int16_t *chrFilter,
const int16_t **chrUSrc,
2563 const int16_t **chrVSrc,
int chrFilterSize,
2564 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2566 int hasAlpha = !!alpSrc;
2569 for (
i = 0;
i < dstW;
i++) {
2571 int Y = 1 << 18,
A = 1 << 18;
2573 for (j = 0; j < lumFilterSize; j++)
2574 Y += lumSrc[j][
i] * lumFilter[j];
2581 for (j = 0; j < lumFilterSize; j++)
2582 A += alpSrc[j][
i] * lumFilter[j];
2591 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2595 #define output_pixels(pos, val) \
2597 AV_WB16(pos, val); \
2599 AV_WL16(pos, val); \
2604 const int16_t **_lumSrc,
int lumFilterSize,
2605 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2606 const int16_t **_chrVSrc,
int chrFilterSize,
2607 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2608 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2611 **chrUSrc = (
const int32_t **) _chrUSrc,
2612 **chrVSrc = (
const int32_t **) _chrVSrc,
2613 **alpSrc = (
const int32_t **) _alpSrc;
2614 int hasAlpha = !!alpSrc;
2617 for (
i = 0;
i < dstW;
i++) {
2618 int Y = 1 << 14,
U = 1 << 14;
2619 int V = 1 << 14,
A = 1 << 14;
2627 for (j = 0; j < lumFilterSize; j++)
2628 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2630 for (j = 0; j < chrFilterSize; j++)
2631 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2633 for (j = 0; j < chrFilterSize; j++)
2634 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2637 for (j = 0; j < lumFilterSize; j++)
2638 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2653 #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2655 yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2656 const int16_t **lumSrc, int lumFilterSize, \
2657 const int16_t *chrFilter, const int16_t **chrUSrc, \
2658 const int16_t **chrVSrc, int chrFilterSize, \
2659 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2661 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2662 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2663 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2672 #undef output_pixels
2676 const int16_t **lumSrc,
int lumFilterSize,
2677 const int16_t *chrFilter,
const int16_t **chrUSrc,
2678 const int16_t **chrVSrc,
int chrFilterSize,
2679 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2683 for (
i = 0;
i < dstW;
i++) {
2684 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2687 for (j = 0; j < lumFilterSize; j++)
2688 Y += lumSrc[j][
i] * lumFilter[j];
2690 for (j = 0; j < chrFilterSize; j++) {
2691 U += chrUSrc[j][
i] * chrFilter[j];
2692 V += chrVSrc[j][
i] * chrFilter[j];
2701 (
unsigned)
V << (
shift + 20) |
2702 (
unsigned)
A << (
shift ? 0 : 30 ));
2706 #define V30LE_WRAPPER(name, shift) \
2707 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2708 const int16_t **lumSrc, int lumFilterSize, \
2709 const int16_t *chrFilter, const int16_t **chrUSrc, \
2710 const int16_t **chrVSrc, int chrFilterSize, \
2711 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2714 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2715 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2716 alpSrc, dest, dstW, y, shift); \
2722 #define output_pixels(pos, val, shift, bits, output_shift) \
2724 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2726 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2731 const int16_t **lumSrc,
int lumFilterSize,
2732 const int16_t *chrFilter,
const int16_t **chrUSrc,
2733 const int16_t **chrVSrc,
int chrFilterSize,
2734 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2737 for (
i = 0;
i < dstW;
i++) {
2738 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2741 for (j = 0; j < lumFilterSize; j++)
2742 Y += lumSrc[j][
i] * lumFilter[j];
2744 for (j = 0; j < chrFilterSize; j++) {
2745 U += chrUSrc[j][
i] * chrFilter[j];
2746 V += chrVSrc[j][
i] * chrFilter[j];
2756 #undef output_pixels
2758 #define YUV2XV36(BE_LE, is_be) \
2760 yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2761 const int16_t **lumSrc, int lumFilterSize, \
2762 const int16_t *chrFilter, const int16_t **chrUSrc, \
2763 const int16_t **chrVSrc, int chrFilterSize, \
2764 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2766 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2767 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2768 alpSrc, dest, dstW, y, is_be); \
2774 #define output_pixels(pos, A, Y, U, V) \
2775 if (target == AV_PIX_FMT_AYUV) { \
2776 dest[pos + 0] = A; \
2777 dest[pos + 1] = Y; \
2778 dest[pos + 2] = U; \
2779 dest[pos + 3] = V; \
2780 } else if (target == AV_PIX_FMT_UYVA) { \
2781 dest[pos + 0] = U; \
2782 dest[pos + 1] = Y; \
2783 dest[pos + 2] = V; \
2784 dest[pos + 3] = A; \
2786 dest[pos + 0] = V; \
2787 dest[pos + 1] = U; \
2788 dest[pos + 2] = Y; \
2789 dest[pos + 3] = A; \
2794 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2795 const int16_t *abuf0, uint8_t *dest,
int dstW,
2798 int hasAlpha = !!abuf0;
2801 if (uvalpha < 2048) {
2802 for (
i = 0;
i < dstW;
i++) {
2803 int Y = (buf0[
i] + 64) >> 7;
2804 int U = (ubuf[0][
i] + 64) >> 7;
2805 int V = (vbuf[0][
i] + 64) >> 7;
2816 A = (abuf0[
i] + 64) >> 7;
2824 for (
i = 0;
i < dstW;
i++) {
2825 int Y = (buf0[
i] + 64) >> 7;
2826 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2827 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2838 A = (abuf0[
i] + 64) >> 7;
2850 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2851 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2852 int yalpha,
int uvalpha,
int y,
2855 int hasAlpha = abuf && abuf[0] && abuf[1];
2856 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2857 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2858 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2859 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2860 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2861 int yalpha1 = 4096 - yalpha;
2862 int uvalpha1 = 4096 - uvalpha;
2868 for (
i = 0;
i < dstW;
i++) {
2869 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2870 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2871 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2882 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2892 const int16_t **lumSrc,
int lumFilterSize,
2893 const int16_t *chrFilter,
const int16_t **chrUSrc,
2894 const int16_t **chrVSrc,
int chrFilterSize,
2895 const int16_t **alpSrc, uint8_t *dest,
int dstW,
2900 for (
i = 0;
i < dstW;
i++) {
2902 int Y = 1 << 18,
U = 1 << 18;
2903 int V = 1 << 18,
A = 255;
2905 for (j = 0; j < lumFilterSize; j++)
2906 Y += lumSrc[j][
i] * lumFilter[j];
2908 for (j = 0; j < chrFilterSize; j++)
2909 U += chrUSrc[j][
i] * chrFilter[j];
2911 for (j = 0; j < chrFilterSize; j++)
2912 V += chrVSrc[j][
i] * chrFilter[j];
2928 for (j = 0; j < lumFilterSize; j++)
2929 A += alpSrc[j][
i] * lumFilter[j];
2941 #undef output_pixels
2943 #define AYUVPACKEDWRAPPER(name, fmt) \
2944 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2945 const int16_t **lumSrc, int lumFilterSize, \
2946 const int16_t *chrFilter, const int16_t **chrUSrc, \
2947 const int16_t **chrVSrc, int chrFilterSize, \
2948 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2951 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2952 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2953 alpSrc, dest, dstW, y, fmt); \
2956 static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
2957 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2958 const int16_t *abuf[2], uint8_t *dest, int dstW, \
2959 int yalpha, int uvalpha, int y) \
2961 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
2962 dest, dstW, yalpha, uvalpha, y, fmt); \
2965 static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
2966 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2967 const int16_t *abuf0, uint8_t *dest, int dstW, \
2968 int uvalpha, int y) \
2970 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
2971 abuf0, dest, dstW, uvalpha, \
2979 #define output_pixel(pos, val, bits) \
2980 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
2982 #define yuv2y2xx_wrapper(bits) \
2984 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
2985 const int16_t **lumSrc, int lumFilterSize, \
2986 const int16_t *chrFilter, \
2987 const int16_t **chrUSrc, \
2988 const int16_t **chrVSrc, int chrFilterSize, \
2989 const int16_t **alpSrc, \
2990 uint8_t *dest, int dstW, int y) \
2993 int shift = 11 + 16 - bits; \
2994 int output_shift = 16 - bits; \
2995 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
2996 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
2997 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
2999 for (j = 0; j < lumFilterSize; j++) { \
3000 Y1 += lumSrc[j][i * 2] * lumFilter[j]; \
3001 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \
3004 for (j = 0; j < chrFilterSize; j++) { \
3005 U += chrUSrc[j][i] * chrFilter[j]; \
3006 V += chrVSrc[j][i] * chrFilter[j]; \
3009 output_pixel(dest + 8 * i + 0, Y1, bits); \
3010 output_pixel(dest + 8 * i + 2, U, bits); \
3011 output_pixel(dest + 8 * i + 4, Y2, bits); \
3012 output_pixel(dest + 8 * i + 6, V, bits); \
3020 yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3021 const int16_t **_lumSrc,
int lumFilterSize,
3022 const int16_t *chrFilter,
3023 const int16_t **_chrUSrc,
3024 const int16_t **_chrVSrc,
int chrFilterSize,
3025 const int16_t **_alpSrc,
3026 uint8_t *dest,
int dstW,
int y)
3033 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3034 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3043 for (
int j = 0; j < lumFilterSize; j++) {
3044 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3045 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3048 for (
int j = 0; j < chrFilterSize; j++) {
3049 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3050 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3062 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3063 const int16_t *abuf0, uint8_t *dest,
int dstW,
3068 if (uvalpha < 2048) {
3069 for (
i = 0;
i < dstW;
i++) {
3070 int Y = (buf0[
i] + 64) >> 7;
3071 int U = (ubuf[0][
i] + 64) >> 7;
3072 int V = (vbuf[0][
i] + 64) >> 7;
3082 dest[3 *
i + 1] =
Y;
3083 dest[3 *
i + 2] =
U;
3086 for (
i = 0;
i < dstW;
i++) {
3087 int Y = (buf0[
i] + 64) >> 7;
3088 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3089 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3099 dest[3 *
i + 1] =
Y;
3100 dest[3 *
i + 2] =
U;
3107 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3108 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3109 int yalpha,
int uvalpha,
int y)
3111 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3112 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3113 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3114 int yalpha1 = 4096 - yalpha;
3115 int uvalpha1 = 4096 - uvalpha;
3121 for (
i = 0;
i < dstW;
i++) {
3122 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3123 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3124 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3134 dest[3 *
i + 1] =
Y;
3135 dest[3 *
i + 2] =
U;
3141 const int16_t **lumSrc,
int lumFilterSize,
3142 const int16_t *chrFilter,
const int16_t **chrUSrc,
3143 const int16_t **chrVSrc,
int chrFilterSize,
3144 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3148 for (
i = 0;
i < dstW;
i++) {
3150 int Y = 1 << 18,
U = 1 << 18;
3153 for (j = 0; j < lumFilterSize; j++)
3154 Y += lumSrc[j][
i] * lumFilter[j];
3156 for (j = 0; j < chrFilterSize; j++)
3157 U += chrUSrc[j][
i] * chrFilter[j];
3159 for (j = 0; j < chrFilterSize; j++)
3160 V += chrVSrc[j][
i] * chrFilter[j];
3174 dest[3 *
i + 1] =
Y;
3175 dest[3 *
i + 2] =
U;
3194 if (
desc->comp[0].depth == 10) {
3195 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3196 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3197 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3198 }
else if (
desc->comp[0].depth == 12) {
3199 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3200 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3201 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3204 }
else if (
is16BPS(dstFormat)) {
3205 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3206 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3210 }
else if (
isNBPS(dstFormat)) {
3211 if (
desc->comp[0].depth == 9) {
3212 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3213 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3214 }
else if (
desc->comp[0].depth == 10) {
3215 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3216 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3217 }
else if (
desc->comp[0].depth == 12) {
3218 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3219 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3220 }
else if (
desc->comp[0].depth == 14) {
3221 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3222 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3227 *yuv2plane1 = yuv2plane1_floatBE_c;
3230 *yuv2plane1 = yuv2plane1_floatLE_c;
3239 switch (dstFormat) {
3242 *yuv2packedX = yuv2rgba32_full_X_c;
3243 *yuv2packed2 = yuv2rgba32_full_2_c;
3244 *yuv2packed1 = yuv2rgba32_full_1_c;
3246 #if CONFIG_SWSCALE_ALPHA
3248 *yuv2packedX = yuv2rgba32_full_X_c;
3249 *yuv2packed2 = yuv2rgba32_full_2_c;
3250 *yuv2packed1 = yuv2rgba32_full_1_c;
3254 *yuv2packedX = yuv2rgbx32_full_X_c;
3255 *yuv2packed2 = yuv2rgbx32_full_2_c;
3256 *yuv2packed1 = yuv2rgbx32_full_1_c;
3262 *yuv2packedX = yuv2argb32_full_X_c;
3263 *yuv2packed2 = yuv2argb32_full_2_c;
3264 *yuv2packed1 = yuv2argb32_full_1_c;
3266 #if CONFIG_SWSCALE_ALPHA
3268 *yuv2packedX = yuv2argb32_full_X_c;
3269 *yuv2packed2 = yuv2argb32_full_2_c;
3270 *yuv2packed1 = yuv2argb32_full_1_c;
3274 *yuv2packedX = yuv2xrgb32_full_X_c;
3275 *yuv2packed2 = yuv2xrgb32_full_2_c;
3276 *yuv2packed1 = yuv2xrgb32_full_1_c;
3282 *yuv2packedX = yuv2bgra32_full_X_c;
3283 *yuv2packed2 = yuv2bgra32_full_2_c;
3284 *yuv2packed1 = yuv2bgra32_full_1_c;
3286 #if CONFIG_SWSCALE_ALPHA
3288 *yuv2packedX = yuv2bgra32_full_X_c;
3289 *yuv2packed2 = yuv2bgra32_full_2_c;
3290 *yuv2packed1 = yuv2bgra32_full_1_c;
3294 *yuv2packedX = yuv2bgrx32_full_X_c;
3295 *yuv2packed2 = yuv2bgrx32_full_2_c;
3296 *yuv2packed1 = yuv2bgrx32_full_1_c;
3302 *yuv2packedX = yuv2abgr32_full_X_c;
3303 *yuv2packed2 = yuv2abgr32_full_2_c;
3304 *yuv2packed1 = yuv2abgr32_full_1_c;
3306 #if CONFIG_SWSCALE_ALPHA
3308 *yuv2packedX = yuv2abgr32_full_X_c;
3309 *yuv2packed2 = yuv2abgr32_full_2_c;
3310 *yuv2packed1 = yuv2abgr32_full_1_c;
3314 *yuv2packedX = yuv2xbgr32_full_X_c;
3315 *yuv2packed2 = yuv2xbgr32_full_2_c;
3316 *yuv2packed1 = yuv2xbgr32_full_1_c;
3321 #if CONFIG_SWSCALE_ALPHA
3323 *yuv2packedX = yuv2rgba64le_full_X_c;
3324 *yuv2packed2 = yuv2rgba64le_full_2_c;
3325 *yuv2packed1 = yuv2rgba64le_full_1_c;
3329 *yuv2packedX = yuv2rgbx64le_full_X_c;
3330 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3331 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3335 #if CONFIG_SWSCALE_ALPHA
3337 *yuv2packedX = yuv2rgba64be_full_X_c;
3338 *yuv2packed2 = yuv2rgba64be_full_2_c;
3339 *yuv2packed1 = yuv2rgba64be_full_1_c;
3343 *yuv2packedX = yuv2rgbx64be_full_X_c;
3344 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3345 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3349 #if CONFIG_SWSCALE_ALPHA
3351 *yuv2packedX = yuv2bgra64le_full_X_c;
3352 *yuv2packed2 = yuv2bgra64le_full_2_c;
3353 *yuv2packed1 = yuv2bgra64le_full_1_c;
3357 *yuv2packedX = yuv2bgrx64le_full_X_c;
3358 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3359 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3363 #if CONFIG_SWSCALE_ALPHA
3365 *yuv2packedX = yuv2bgra64be_full_X_c;
3366 *yuv2packed2 = yuv2bgra64be_full_2_c;
3367 *yuv2packed1 = yuv2bgra64be_full_1_c;
3371 *yuv2packedX = yuv2bgrx64be_full_X_c;
3372 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3373 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3378 *yuv2packedX = yuv2rgb24_full_X_c;
3379 *yuv2packed2 = yuv2rgb24_full_2_c;
3380 *yuv2packed1 = yuv2rgb24_full_1_c;
3383 *yuv2packedX = yuv2bgr24_full_X_c;
3384 *yuv2packed2 = yuv2bgr24_full_2_c;
3385 *yuv2packed1 = yuv2bgr24_full_1_c;
3388 *yuv2packedX = yuv2rgb48le_full_X_c;
3389 *yuv2packed2 = yuv2rgb48le_full_2_c;
3390 *yuv2packed1 = yuv2rgb48le_full_1_c;
3393 *yuv2packedX = yuv2bgr48le_full_X_c;
3394 *yuv2packed2 = yuv2bgr48le_full_2_c;
3395 *yuv2packed1 = yuv2bgr48le_full_1_c;
3398 *yuv2packedX = yuv2rgb48be_full_X_c;
3399 *yuv2packed2 = yuv2rgb48be_full_2_c;
3400 *yuv2packed1 = yuv2rgb48be_full_1_c;
3403 *yuv2packedX = yuv2bgr48be_full_X_c;
3404 *yuv2packed2 = yuv2bgr48be_full_2_c;
3405 *yuv2packed1 = yuv2bgr48be_full_1_c;
3408 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3409 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3410 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3413 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3414 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3415 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3418 *yuv2packedX = yuv2bgr8_full_X_c;
3419 *yuv2packed2 = yuv2bgr8_full_2_c;
3420 *yuv2packed1 = yuv2bgr8_full_1_c;
3423 *yuv2packedX = yuv2rgb8_full_X_c;
3424 *yuv2packed2 = yuv2rgb8_full_2_c;
3425 *yuv2packed1 = yuv2rgb8_full_1_c;
3428 *yuv2packedX = yuv2x2rgb10_full_X_c;
3429 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3430 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3433 *yuv2packedX = yuv2x2bgr10_full_X_c;
3434 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3435 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3468 if (!*yuv2packedX && !*yuv2anyX)
3472 switch (dstFormat) {
3474 #if CONFIG_SWSCALE_ALPHA
3476 *yuv2packed1 = yuv2rgba64le_1_c;
3477 *yuv2packed2 = yuv2rgba64le_2_c;
3478 *yuv2packedX = yuv2rgba64le_X_c;
3482 *yuv2packed1 = yuv2rgbx64le_1_c;
3483 *yuv2packed2 = yuv2rgbx64le_2_c;
3484 *yuv2packedX = yuv2rgbx64le_X_c;
3488 #if CONFIG_SWSCALE_ALPHA
3490 *yuv2packed1 = yuv2rgba64be_1_c;
3491 *yuv2packed2 = yuv2rgba64be_2_c;
3492 *yuv2packedX = yuv2rgba64be_X_c;
3496 *yuv2packed1 = yuv2rgbx64be_1_c;
3497 *yuv2packed2 = yuv2rgbx64be_2_c;
3498 *yuv2packedX = yuv2rgbx64be_X_c;
3502 #if CONFIG_SWSCALE_ALPHA
3504 *yuv2packed1 = yuv2bgra64le_1_c;
3505 *yuv2packed2 = yuv2bgra64le_2_c;
3506 *yuv2packedX = yuv2bgra64le_X_c;
3510 *yuv2packed1 = yuv2bgrx64le_1_c;
3511 *yuv2packed2 = yuv2bgrx64le_2_c;
3512 *yuv2packedX = yuv2bgrx64le_X_c;
3516 #if CONFIG_SWSCALE_ALPHA
3518 *yuv2packed1 = yuv2bgra64be_1_c;
3519 *yuv2packed2 = yuv2bgra64be_2_c;
3520 *yuv2packedX = yuv2bgra64be_X_c;
3524 *yuv2packed1 = yuv2bgrx64be_1_c;
3525 *yuv2packed2 = yuv2bgrx64be_2_c;
3526 *yuv2packedX = yuv2bgrx64be_X_c;
3530 *yuv2packed1 = yuv2rgb48le_1_c;
3531 *yuv2packed2 = yuv2rgb48le_2_c;
3532 *yuv2packedX = yuv2rgb48le_X_c;
3535 *yuv2packed1 = yuv2rgb48be_1_c;
3536 *yuv2packed2 = yuv2rgb48be_2_c;
3537 *yuv2packedX = yuv2rgb48be_X_c;
3540 *yuv2packed1 = yuv2bgr48le_1_c;
3541 *yuv2packed2 = yuv2bgr48le_2_c;
3542 *yuv2packedX = yuv2bgr48le_X_c;
3545 *yuv2packed1 = yuv2bgr48be_1_c;
3546 *yuv2packed2 = yuv2bgr48be_2_c;
3547 *yuv2packedX = yuv2bgr48be_X_c;
3552 *yuv2packed1 = yuv2rgb32_1_c;
3553 *yuv2packed2 = yuv2rgb32_2_c;
3554 *yuv2packedX = yuv2rgb32_X_c;
3556 #if CONFIG_SWSCALE_ALPHA
3558 *yuv2packed1 = yuv2rgba32_1_c;
3559 *yuv2packed2 = yuv2rgba32_2_c;
3560 *yuv2packedX = yuv2rgba32_X_c;
3564 *yuv2packed1 = yuv2rgbx32_1_c;
3565 *yuv2packed2 = yuv2rgbx32_2_c;
3566 *yuv2packedX = yuv2rgbx32_X_c;
3573 *yuv2packed1 = yuv2rgb32_1_1_c;
3574 *yuv2packed2 = yuv2rgb32_1_2_c;
3575 *yuv2packedX = yuv2rgb32_1_X_c;
3577 #if CONFIG_SWSCALE_ALPHA
3579 *yuv2packed1 = yuv2rgba32_1_1_c;
3580 *yuv2packed2 = yuv2rgba32_1_2_c;
3581 *yuv2packedX = yuv2rgba32_1_X_c;
3585 *yuv2packed1 = yuv2rgbx32_1_1_c;
3586 *yuv2packed2 = yuv2rgbx32_1_2_c;
3587 *yuv2packedX = yuv2rgbx32_1_X_c;
3592 *yuv2packed1 = yuv2rgb24_1_c;
3593 *yuv2packed2 = yuv2rgb24_2_c;
3594 *yuv2packedX = yuv2rgb24_X_c;
3597 *yuv2packed1 = yuv2bgr24_1_c;
3598 *yuv2packed2 = yuv2bgr24_2_c;
3599 *yuv2packedX = yuv2bgr24_X_c;
3605 *yuv2packed1 = yuv2rgb16_1_c;
3606 *yuv2packed2 = yuv2rgb16_2_c;
3607 *yuv2packedX = yuv2rgb16_X_c;
3613 *yuv2packed1 = yuv2rgb15_1_c;
3614 *yuv2packed2 = yuv2rgb15_2_c;
3615 *yuv2packedX = yuv2rgb15_X_c;
3621 *yuv2packed1 = yuv2rgb12_1_c;
3622 *yuv2packed2 = yuv2rgb12_2_c;
3623 *yuv2packedX = yuv2rgb12_X_c;
3627 *yuv2packed1 = yuv2rgb8_1_c;
3628 *yuv2packed2 = yuv2rgb8_2_c;
3629 *yuv2packedX = yuv2rgb8_X_c;
3633 *yuv2packed1 = yuv2rgb4_1_c;
3634 *yuv2packed2 = yuv2rgb4_2_c;
3635 *yuv2packedX = yuv2rgb4_X_c;
3639 *yuv2packed1 = yuv2rgb4b_1_c;
3640 *yuv2packed2 = yuv2rgb4b_2_c;
3641 *yuv2packedX = yuv2rgb4b_X_c;
3645 *yuv2packed1 = yuv2x2rgb10_1_c;
3646 *yuv2packed2 = yuv2x2rgb10_2_c;
3647 *yuv2packedX = yuv2x2rgb10_X_c;
3651 *yuv2packed1 = yuv2x2bgr10_1_c;
3652 *yuv2packed2 = yuv2x2bgr10_2_c;
3653 *yuv2packedX = yuv2x2bgr10_X_c;
3657 switch (dstFormat) {
3659 *yuv2packed1 = yuv2monowhite_1_c;
3660 *yuv2packed2 = yuv2monowhite_2_c;
3661 *yuv2packedX = yuv2monowhite_X_c;
3664 *yuv2packed1 = yuv2monoblack_1_c;
3665 *yuv2packed2 = yuv2monoblack_2_c;
3666 *yuv2packedX = yuv2monoblack_X_c;
3669 *yuv2packed1 = yuv2yuyv422_1_c;
3670 *yuv2packed2 = yuv2yuyv422_2_c;
3671 *yuv2packedX = yuv2yuyv422_X_c;
3674 *yuv2packed1 = yuv2yvyu422_1_c;
3675 *yuv2packed2 = yuv2yvyu422_2_c;
3676 *yuv2packedX = yuv2yvyu422_X_c;
3679 *yuv2packed1 = yuv2uyvy422_1_c;
3680 *yuv2packed2 = yuv2uyvy422_2_c;
3681 *yuv2packedX = yuv2uyvy422_X_c;
3694 *yuv2packed1 = yuv2ya16le_1_c;
3695 *yuv2packed2 = yuv2ya16le_2_c;
3696 *yuv2packedX = yuv2ya16le_X_c;
3699 *yuv2packed1 = yuv2ya16be_1_c;
3700 *yuv2packed2 = yuv2ya16be_2_c;
3701 *yuv2packedX = yuv2ya16be_X_c;
3704 *yuv2packedX = yuv2v30xle_X_c;
3707 *yuv2packedX = yuv2ayuv64le_X_c;
3710 *yuv2packedX = yuv2ayuv64be_X_c;
3713 *yuv2packed1 = yuv2ayuv_1_c;
3714 *yuv2packed2 = yuv2ayuv_2_c;
3715 *yuv2packedX = yuv2ayuv_X_c;
3719 *yuv2packed1 = yuv2vuyX_1_c;
3720 *yuv2packed2 = yuv2vuyX_2_c;
3721 *yuv2packedX = yuv2vuyX_X_c;
3724 *yuv2packed1 = yuv2uyva_1_c;
3725 *yuv2packed2 = yuv2uyva_2_c;
3726 *yuv2packedX = yuv2uyva_X_c;
3729 *yuv2packedX = yuv2xv30le_X_c;
3732 *yuv2packedX = yuv2xv36le_X_c;
3735 *yuv2packedX = yuv2xv36be_X_c;
3738 *yuv2packedX = yuv2xv48le_X_c;
3741 *yuv2packedX = yuv2xv48be_X_c;
3744 *yuv2packedX = yuv2y210le_X_c;
3747 *yuv2packedX = yuv2y212le_X_c;
3750 *yuv2packedX = yuv2y216le_X_c;