41 { 1, 3, 1, 3, 1, 3, 1, 3, },
42 { 2, 0, 2, 0, 2, 0, 2, 0, },
43 { 1, 3, 1, 3, 1, 3, 1, 3, },
47 { 6, 2, 6, 2, 6, 2, 6, 2, },
48 { 0, 4, 0, 4, 0, 4, 0, 4, },
49 { 6, 2, 6, 2, 6, 2, 6, 2, },
53 { 8, 4, 11, 7, 8, 4, 11, 7, },
54 { 2, 14, 1, 13, 2, 14, 1, 13, },
55 { 10, 6, 9, 5, 10, 6, 9, 5, },
56 { 0, 12, 3, 15, 0, 12, 3, 15, },
57 { 8, 4, 11, 7, 8, 4, 11, 7, },
61 { 17, 9, 23, 15, 16, 8, 22, 14, },
62 { 5, 29, 3, 27, 4, 28, 2, 26, },
63 { 21, 13, 19, 11, 20, 12, 18, 10, },
64 { 0, 24, 6, 30, 1, 25, 7, 31, },
65 { 16, 8, 22, 14, 17, 9, 23, 15, },
66 { 4, 28, 2, 26, 5, 29, 3, 27, },
67 { 20, 12, 18, 10, 21, 13, 19, 11, },
68 { 1, 25, 7, 31, 0, 24, 6, 30, },
69 { 17, 9, 23, 15, 16, 8, 22, 14, },
73 { 0, 55, 14, 68, 3, 58, 17, 72, },
74 { 37, 18, 50, 32, 40, 22, 54, 35, },
75 { 9, 64, 5, 59, 13, 67, 8, 63, },
76 { 46, 27, 41, 23, 49, 31, 44, 26, },
77 { 2, 57, 16, 71, 1, 56, 15, 70, },
78 { 39, 21, 52, 34, 38, 19, 51, 33, },
79 { 11, 66, 7, 62, 10, 65, 6, 60, },
80 { 48, 30, 43, 25, 47, 29, 42, 24, },
81 { 0, 55, 14, 68, 3, 58, 17, 72, },
86 {117, 62, 158, 103, 113, 58, 155, 100, },
87 { 34, 199, 21, 186, 31, 196, 17, 182, },
88 {144, 89, 131, 76, 141, 86, 127, 72, },
89 { 0, 165, 41, 206, 10, 175, 52, 217, },
90 {110, 55, 151, 96, 120, 65, 162, 107, },
91 { 28, 193, 14, 179, 38, 203, 24, 189, },
92 {138, 83, 124, 69, 148, 93, 134, 79, },
93 { 7, 172, 48, 213, 3, 168, 45, 210, },
94 {117, 62, 158, 103, 113, 58, 155, 100, },
99 { 0, 143, 18, 200, 2, 156, 25, 215, },
100 { 78, 28, 125, 64, 89, 36, 138, 74, },
101 { 10, 180, 3, 161, 16, 195, 8, 175, },
102 {109, 51, 93, 38, 121, 60, 105, 47, },
103 { 1, 152, 23, 210, 0, 147, 20, 205, },
104 { 85, 33, 134, 71, 81, 30, 130, 67, },
105 { 14, 190, 6, 171, 12, 185, 5, 166, },
106 {117, 57, 101, 44, 113, 54, 97, 41, },
107 { 0, 143, 18, 200, 2, 156, 25, 215, },
112 { 0, 124, 8, 193, 0, 140, 12, 213, },
113 { 55, 14, 104, 42, 66, 19, 119, 52, },
114 { 3, 168, 1, 145, 6, 187, 3, 162, },
115 { 86, 31, 70, 21, 99, 39, 82, 28, },
116 { 0, 134, 11, 206, 0, 129, 9, 200, },
117 { 62, 17, 114, 48, 58, 16, 109, 45, },
118 { 5, 181, 2, 157, 4, 175, 1, 151, },
119 { 95, 36, 78, 26, 90, 34, 74, 24, },
120 { 0, 124, 8, 193, 0, 140, 12, 213, },
125 { 0, 107, 3, 187, 0, 125, 6, 212, },
126 { 39, 7, 86, 28, 49, 11, 102, 36, },
127 { 1, 158, 0, 131, 3, 180, 1, 151, },
128 { 68, 19, 52, 12, 81, 25, 64, 17, },
129 { 0, 119, 5, 203, 0, 113, 4, 195, },
130 { 45, 9, 96, 33, 42, 8, 91, 30, },
131 { 2, 172, 1, 144, 2, 165, 0, 137, },
132 { 77, 23, 60, 15, 72, 21, 56, 14, },
133 { 0, 107, 3, 187, 0, 125, 6, 212, },
140 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
142 #define output_pixel(pos, val, bias, signedness) \
144 AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
146 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
151 int big_endian,
int output_bits)
157 for (
i = 0;
i < dstW;
i++) {
165 const int32_t **
src, uint16_t *dest,
int dstW,
166 int big_endian,
int output_bits)
172 for (
i = 0;
i < dstW;
i++) {
182 for (j = 0; j < filterSize; j++)
191 const int16_t *chrFilter,
int chrFilterSize,
192 const int16_t **chrUSrc,
const int16_t **chrVSrc,
193 uint8_t *dest8,
int chrDstW,
int output_bits)
195 uint16_t *dest = (uint16_t*)dest8;
202 for (
i = 0;
i < chrDstW;
i++) {
204 int v = 1 << (
shift - 1);
209 for (j = 0; j < chrFilterSize; j++) {
210 u += uSrc[j][
i] * (unsigned)chrFilter[j];
211 v += vSrc[j][
i] * (unsigned)chrFilter[j];
222 static const int big_endian = HAVE_BIGENDIAN;
223 static const int shift = 3;
224 static const float float_mult = 1.0f / 65535.0f;
228 for (
i = 0;
i < dstW; ++
i){
231 dest[
i] = float_mult * (
float)val_uint;
238 static const int big_endian = HAVE_BIGENDIAN;
239 static const int shift = 3;
240 static const float float_mult = 1.0f / 65535.0f;
244 for (
i = 0;
i < dstW; ++
i){
253 float *dest,
int dstW)
255 static const int big_endian = HAVE_BIGENDIAN;
256 static const int shift = 15;
257 static const float float_mult = 1.0f / 65535.0f;
261 for (
i = 0;
i < dstW; ++
i){
262 val = (1 << (
shift - 1)) - 0x40000000;
263 for (j = 0; j < filterSize; ++j){
267 dest[
i] = float_mult * (
float)val_uint;
273 uint32_t *dest,
int dstW)
275 static const int big_endian = HAVE_BIGENDIAN;
276 static const int shift = 15;
277 static const float float_mult = 1.0f / 65535.0f;
281 for (
i = 0;
i < dstW; ++
i){
282 val = (1 << (
shift - 1)) - 0x40000000;
283 for (j = 0; j < filterSize; ++j){
291 #define yuv2plane1_float(template, dest_type, BE_LE) \
292 static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
293 const uint8_t *dither, int offset) \
295 template((const int32_t *)src, (dest_type *)dest, dstW); \
298 #define yuv2planeX_float(template, dest_type, BE_LE) \
299 static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
300 const int16_t **src, uint8_t *dest, int dstW, \
301 const uint8_t *dither, int offset) \
303 template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
320 #define output_pixel(pos, val) \
322 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
324 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
328 yuv2plane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
329 int big_endian,
int output_bits)
332 int shift = 15 - output_bits;
334 for (
i = 0;
i < dstW;
i++) {
342 const int16_t **
src, uint16_t *dest,
int dstW,
343 int big_endian,
int output_bits)
346 int shift = 11 + 16 - output_bits;
348 for (
i = 0;
i < dstW;
i++) {
352 for (j = 0; j < filterSize; j++)
361 #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
362 static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
363 uint8_t *dest, int dstW, \
364 const uint8_t *dither, int offset)\
366 yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367 (uint16_t *) dest, dstW, is_be, bits); \
369 static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
370 const int16_t **src, uint8_t *dest, int dstW, \
371 const uint8_t *dither, int offset)\
373 yuv2planeX_## template_size ## _c_template(filter, \
374 filterSize, (const typeX_t **) src, \
375 (uint16_t *) dest, dstW, is_be, bits); \
390 static void yuv2nv12cX_16LE_c(
enum AVPixelFormat dstFormat,
const uint8_t *chrDither,
391 const int16_t *chrFilter,
int chrFilterSize,
392 const int16_t **chrUSrc,
const int16_t **chrVSrc,
393 uint8_t *dest8,
int chrDstW)
399 const int16_t *chrFilter,
int chrFilterSize,
400 const int16_t **chrUSrc,
const int16_t **chrVSrc,
401 uint8_t *dest8,
int chrDstW)
407 const int16_t **
src, uint8_t *dest,
int dstW,
411 for (
i=0;
i<dstW;
i++) {
414 for (j=0; j<filterSize; j++)
425 for (
i=0;
i<dstW;
i++) {
432 const int16_t *chrFilter,
int chrFilterSize,
433 const int16_t **chrUSrc,
const int16_t **chrVSrc,
434 uint8_t *dest,
int chrDstW)
439 for (
i=0;
i<chrDstW;
i++) {
440 int u = chrDither[
i & 7] << 12;
441 int v = chrDither[(
i + 3) & 7] << 12;
443 for (j=0; j<chrFilterSize; j++) {
444 u += chrUSrc[j][
i] * chrFilter[j];
445 v += chrVSrc[j][
i] * chrFilter[j];
452 for (
i=0;
i<chrDstW;
i++) {
453 int u = chrDither[
i & 7] << 12;
454 int v = chrDither[(
i + 3) & 7] << 12;
456 for (j=0; j<chrFilterSize; j++) {
457 u += chrUSrc[j][
i] * chrFilter[j];
458 v += chrVSrc[j][
i] * chrFilter[j];
467 #define output_pixel(pos, val) \
469 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
471 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
475 uint16_t *dest,
int dstW,
476 int big_endian,
int output_bits,
int output_shift)
479 int shift = 15 - 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,
int output_shift)
492 int shift = 11 + 16 - output_bits;
494 for (
i = 0;
i < dstW;
i++) {
497 for (j = 0; j < filterSize; j++)
505 const int16_t *chrFilter,
int chrFilterSize,
506 const int16_t **chrUSrc,
const int16_t **chrVSrc,
507 uint8_t *dest8,
int chrDstW,
int output_bits,
int output_shift)
509 uint16_t *dest = (uint16_t*)dest8;
511 int shift = 11 + 16 - output_bits;
513 for (
i = 0;
i < chrDstW;
i++) {
515 int v = 1 << (
shift - 1);
517 for (j = 0; j < chrFilterSize; j++) {
518 u += chrUSrc[j][
i] * chrFilter[j];
519 v += chrVSrc[j][
i] * chrFilter[j];
529 #define yuv2p01x_wrapper(fmt, bits, shift) \
530 static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \
531 uint8_t *dest, int dstW, \
532 const uint8_t *dither, int offset) \
534 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \
537 static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \
538 uint8_t *dest, int dstW, \
539 const uint8_t *dither, int offset) \
541 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \
544 static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \
545 int filterSize, const int16_t **src, \
546 uint8_t *dest, int dstW, \
547 const uint8_t *dither, int offset) \
549 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \
553 static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \
554 int filterSize, const int16_t **src, \
555 uint8_t *dest, int dstW, \
556 const uint8_t *dither, int offset) \
558 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \
562 static void yuv2 ## fmt ## 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, shift); \
574 static void yuv2 ## fmt ## 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, shift); \
590 #define accumulate_bit(acc, val) \
593 #define output_pixel(pos, acc) \
594 if (target == AV_PIX_FMT_MONOBLACK) { \
601 yuv2mono_X_c_template(
SwsInternal *
c,
const int16_t *lumFilter,
602 const int16_t **lumSrc,
int lumFilterSize,
603 const int16_t *chrFilter,
const int16_t **chrUSrc,
604 const int16_t **chrVSrc,
int chrFilterSize,
605 const int16_t **alpSrc, uint8_t *dest,
int dstW,
613 for (
i = 0;
i < dstW;
i += 2) {
618 for (j = 0; j < lumFilterSize; j++) {
619 Y1 += lumSrc[j][
i] * lumFilter[j];
620 Y2 += lumSrc[j][
i+1] * lumFilter[j];
624 if ((Y1 | Y2) & 0x100) {
629 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;
630 c->dither_error[0][
i] = err;
631 acc = 2*acc + (Y1 >= 128);
634 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);
635 c->dither_error[0][
i+1] = Y1;
636 acc = 2*acc + (err >= 128);
646 c->dither_error[0][
i] = err;
655 const int16_t *ubuf[2],
const int16_t *vbuf[2],
656 const int16_t *abuf[2], uint8_t *dest,
int dstW,
657 int yalpha,
int uvalpha,
int y,
660 const int16_t *buf0 = buf[0], *buf1 = buf[1];
662 int yalpha1 = 4096 - yalpha;
669 for (
i = 0;
i < dstW;
i +=2) {
672 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
673 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;
674 c->dither_error[0][
i] = err;
675 acc = 2*acc + (
Y >= 128);
678 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
679 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;
680 c->dither_error[0][
i+1] =
Y;
681 acc = 2*acc + (err >= 128);
687 c->dither_error[0][
i] = err;
689 for (
i = 0;
i < dstW;
i += 8) {
693 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
695 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
697 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
699 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
701 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
703 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
705 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
707 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
717 const int16_t *ubuf[2],
const int16_t *vbuf[2],
718 const int16_t *abuf0, uint8_t *dest,
int dstW,
727 for (
i = 0;
i < dstW;
i +=2) {
730 Y = ((buf0[
i + 0] + 64) >> 7);
731 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;
732 c->dither_error[0][
i] = err;
733 acc = 2*acc + (
Y >= 128);
736 err = ((buf0[
i + 1] + 64) >> 7);
737 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;
738 c->dither_error[0][
i+1] =
Y;
739 acc = 2*acc + (err >= 128);
745 c->dither_error[0][
i] = err;
747 for (
i = 0;
i < dstW;
i += 8) {
764 #undef accumulate_bit
766 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
767 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
768 const int16_t **lumSrc, int lumFilterSize, \
769 const int16_t *chrFilter, const int16_t **chrUSrc, \
770 const int16_t **chrVSrc, int chrFilterSize, \
771 const int16_t **alpSrc, uint8_t *dest, int dstW, \
774 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
775 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
776 alpSrc, dest, dstW, y, fmt); \
779 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
780 const int16_t *ubuf[2], const int16_t *vbuf[2], \
781 const int16_t *abuf[2], uint8_t *dest, int dstW, \
782 int yalpha, int uvalpha, int y) \
784 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
785 dest, dstW, yalpha, uvalpha, y, fmt); \
788 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
789 const int16_t *ubuf[2], const int16_t *vbuf[2], \
790 const int16_t *abuf0, uint8_t *dest, int dstW, \
791 int uvalpha, int y) \
793 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
794 abuf0, dest, dstW, uvalpha, \
801 #define output_pixels(pos, Y1, U, Y2, V) \
802 if (target == AV_PIX_FMT_YUYV422) { \
803 dest[pos + 0] = Y1; \
805 dest[pos + 2] = Y2; \
807 } else if (target == AV_PIX_FMT_YVYU422) { \
808 dest[pos + 0] = Y1; \
810 dest[pos + 2] = Y2; \
814 dest[pos + 1] = Y1; \
816 dest[pos + 3] = Y2; \
821 const int16_t **lumSrc,
int lumFilterSize,
822 const int16_t *chrFilter,
const int16_t **chrUSrc,
823 const int16_t **chrVSrc,
int chrFilterSize,
824 const int16_t **alpSrc, uint8_t *dest,
int dstW,
829 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
836 for (j = 0; j < lumFilterSize; j++) {
837 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
838 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
840 for (j = 0; j < chrFilterSize; j++) {
841 U += chrUSrc[j][
i] * chrFilter[j];
842 V += chrVSrc[j][
i] * chrFilter[j];
848 if ((Y1 | Y2 |
U |
V) & 0x100) {
860 const int16_t *ubuf[2],
const int16_t *vbuf[2],
861 const int16_t *abuf[2], uint8_t *dest,
int dstW,
862 int yalpha,
int uvalpha,
int y,
865 const int16_t *buf0 = buf[0], *buf1 = buf[1],
866 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
867 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
868 int yalpha1 = 4096 - yalpha;
869 int uvalpha1 = 4096 - uvalpha;
874 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
875 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
876 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
877 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
878 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
880 if ((Y1 | Y2 |
U |
V) & 0x100) {
893 const int16_t *ubuf[2],
const int16_t *vbuf[2],
894 const int16_t *abuf0, uint8_t *dest,
int dstW,
897 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
900 if (uvalpha < 2048) {
901 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
902 int Y1 = (buf0[
i * 2 ]+64) >> 7;
903 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
904 int U = (ubuf0[
i] +64) >> 7;
905 int V = (vbuf0[
i] +64) >> 7;
907 if ((Y1 | Y2 |
U |
V) & 0x100) {
917 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
918 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
919 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
920 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
921 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
922 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
924 if ((Y1 | Y2 |
U |
V) & 0x100) {
942 #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)
943 #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)
944 #define output_pixel(pos, val) \
953 const int32_t **lumSrc,
int lumFilterSize,
954 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
955 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
956 const int32_t **alpSrc, uint16_t *dest,
int dstW,
958 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
960 int hasAlpha = !!alpSrc;
963 for (
i = 0;
i < dstW;
i++) {
968 for (j = 0; j < lumFilterSize; j++)
969 Y += lumSrc[j][
i] * lumFilter[j];
972 Y += (1<<3) + 0x8000;
976 A = -0x40000000 + (1<<14);
977 for (j = 0; j < lumFilterSize; j++)
978 A += alpSrc[j][
i] * lumFilter[j];
993 const int32_t *abuf[2], uint16_t *dest,
int dstW,
994 int yalpha,
int unused_uvalpha,
int y,
996 int unused_eightbytes,
int is_be)
998 int hasAlpha = abuf && abuf[0] && abuf[1];
999 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1000 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1001 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1002 int yalpha1 = 4096 - yalpha;
1007 for (
i = 0;
i < dstW;
i++) {
1008 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
1014 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1026 const int32_t *abuf0, uint16_t *dest,
int dstW,
1028 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1030 int hasAlpha = !!abuf0;
1033 for (
i = 0;
i < dstW;
i++) {
1034 int Y = buf0[
i] >> 3;
1052 const int32_t **lumSrc,
int lumFilterSize,
1053 const int16_t *chrFilter,
const int32_t **chrUSrc,
1054 const int32_t **chrVSrc,
int chrFilterSize,
1055 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1056 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes,
1060 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1062 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1064 unsigned Y1 = -0x40000000;
1065 unsigned Y2 = -0x40000000;
1066 int U = -(128 << 23);
1067 int V = -(128 << 23);
1070 for (j = 0; j < lumFilterSize; j++) {
1071 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1072 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1074 for (j = 0; j < chrFilterSize; j++) {;
1075 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1076 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1082 for (j = 0; j < lumFilterSize; j++) {
1083 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1084 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1101 Y1 -=
c->yuv2rgb_y_offset;
1102 Y2 -=
c->yuv2rgb_y_offset;
1103 Y1 *=
c->yuv2rgb_y_coeff;
1104 Y2 *=
c->yuv2rgb_y_coeff;
1105 Y1 += (1 << 13) - (1 << 29);
1106 Y2 += (1 << 13) - (1 << 29);
1109 R =
V *
c->yuv2rgb_v2r_coeff;
1110 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1111 B =
U *
c->yuv2rgb_u2b_coeff;
1136 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1137 int yalpha,
int uvalpha,
int y,
1141 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1142 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1143 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1144 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1145 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1146 int yalpha1 = 4096 - yalpha;
1147 int uvalpha1 = 4096 - uvalpha;
1149 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1154 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1155 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1156 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1157 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1158 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1161 Y1 -=
c->yuv2rgb_y_offset;
1162 Y2 -=
c->yuv2rgb_y_offset;
1163 Y1 *=
c->yuv2rgb_y_coeff;
1164 Y2 *=
c->yuv2rgb_y_coeff;
1165 Y1 += (1 << 13) - (1 << 29);
1166 Y2 += (1 << 13) - (1 << 29);
1168 R =
V *
c->yuv2rgb_v2r_coeff;
1169 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1170 B =
U *
c->yuv2rgb_u2b_coeff;
1173 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1174 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1202 const int32_t *abuf0, uint16_t *dest,
int dstW,
1204 int hasAlpha,
int eightbytes,
int is_be)
1206 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1208 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1211 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1212 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1213 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1214 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1215 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1218 Y1 -=
c->yuv2rgb_y_offset;
1219 Y2 -=
c->yuv2rgb_y_offset;
1220 Y1 *=
c->yuv2rgb_y_coeff;
1221 Y2 *=
c->yuv2rgb_y_coeff;
1222 Y1 += (1 << 13) - (1 << 29);
1223 Y2 += (1 << 13) - (1 << 29);
1226 A1 = abuf0[
i * 2 ] * (1 << 11);
1227 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1233 R =
V *
c->yuv2rgb_v2r_coeff;
1234 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1235 B =
U *
c->yuv2rgb_u2b_coeff;
1255 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1256 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1257 int uvalpha1 = 4096 - uvalpha;
1260 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1261 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1262 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1263 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1264 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1267 Y1 -=
c->yuv2rgb_y_offset;
1268 Y2 -=
c->yuv2rgb_y_offset;
1269 Y1 *=
c->yuv2rgb_y_coeff;
1270 Y2 *=
c->yuv2rgb_y_coeff;
1271 Y1 += (1 << 13) - (1 << 29);
1272 Y2 += (1 << 13) - (1 << 29);
1275 A1 = abuf0[
i * 2 ] * (1 << 11);
1276 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1282 R =
V *
c->yuv2rgb_v2r_coeff;
1283 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1284 B =
U *
c->yuv2rgb_u2b_coeff;
1308 const int32_t **lumSrc,
int lumFilterSize,
1309 const int16_t *chrFilter,
const int32_t **chrUSrc,
1310 const int32_t **chrVSrc,
int chrFilterSize,
1311 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1313 int eightbytes,
int is_be)
1318 for (
i = 0;
i < dstW;
i++) {
1320 int Y = -0x40000000;
1321 int U = -(128 << 23);
1322 int V = -(128 << 23);
1325 for (j = 0; j < lumFilterSize; j++) {
1326 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1328 for (j = 0; j < chrFilterSize; j++) {;
1329 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1330 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1335 for (j = 0; j < lumFilterSize; j++) {
1336 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1349 Y -=
c->yuv2rgb_y_offset;
1350 Y *=
c->yuv2rgb_y_coeff;
1351 Y += (1 << 13) - (1<<29);
1354 R =
V *
c->yuv2rgb_v2r_coeff;
1355 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1356 B =
U *
c->yuv2rgb_u2b_coeff;
1374 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1375 int yalpha,
int uvalpha,
int y,
1379 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1380 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1381 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1382 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1383 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1384 int yalpha1 = 4096 - yalpha;
1385 int uvalpha1 = 4096 - uvalpha;
1392 for (
i = 0;
i < dstW;
i++) {
1393 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1394 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1395 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1398 Y -=
c->yuv2rgb_y_offset;
1399 Y *=
c->yuv2rgb_y_coeff;
1400 Y += (1 << 13) - (1 << 29);
1402 R =
V *
c->yuv2rgb_v2r_coeff;
1403 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1404 B =
U *
c->yuv2rgb_u2b_coeff;
1407 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1427 const int32_t *abuf0, uint16_t *dest,
int dstW,
1429 int hasAlpha,
int eightbytes,
int is_be)
1431 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1436 for (
i = 0;
i < dstW;
i++) {
1438 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1439 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1442 Y -=
c->yuv2rgb_y_offset;
1443 Y *=
c->yuv2rgb_y_coeff;
1444 Y += (1 << 13) - (1 << 29);
1447 A = abuf0[
i] * (1 << 11);
1452 R =
V *
c->yuv2rgb_v2r_coeff;
1453 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1454 B =
U *
c->yuv2rgb_u2b_coeff;
1467 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1468 int uvalpha1 = 4096 - uvalpha;
1472 for (
i = 0;
i < dstW;
i++) {
1474 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1475 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1478 Y -=
c->yuv2rgb_y_offset;
1479 Y *=
c->yuv2rgb_y_coeff;
1480 Y += (1 << 13) - (1 << 29);
1483 A = abuf0[
i] * (1 << 11);
1488 R =
V *
c->yuv2rgb_v2r_coeff;
1489 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1490 B =
U *
c->yuv2rgb_u2b_coeff;
1509 #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1510 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1511 const int16_t **_lumSrc, int lumFilterSize, \
1512 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1513 const int16_t **_chrVSrc, int chrFilterSize, \
1514 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1517 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1518 **chrUSrc = (const int32_t **) _chrUSrc, \
1519 **chrVSrc = (const int32_t **) _chrVSrc, \
1520 **alpSrc = (const int32_t **) _alpSrc; \
1521 uint16_t *dest = (uint16_t *) _dest; \
1522 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1523 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1524 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1527 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1528 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1529 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1530 int yalpha, int uvalpha, int y) \
1532 const int32_t **buf = (const int32_t **) _buf, \
1533 **ubuf = (const int32_t **) _ubuf, \
1534 **vbuf = (const int32_t **) _vbuf, \
1535 **abuf = (const int32_t **) _abuf; \
1536 uint16_t *dest = (uint16_t *) _dest; \
1537 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1538 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1541 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1542 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1543 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1544 int uvalpha, int y) \
1546 const int32_t *buf0 = (const int32_t *) _buf0, \
1547 **ubuf = (const int32_t **) _ubuf, \
1548 **vbuf = (const int32_t **) _vbuf, \
1549 *abuf0 = (const int32_t *) _abuf0; \
1550 uint16_t *dest = (uint16_t *) _dest; \
1551 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1552 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1554 #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1555 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1595 unsigned A1,
unsigned A2,
1596 const
void *_r, const
void *_g, const
void *_b,
int y,
1601 uint32_t *dest = (uint32_t *) _dest;
1602 const uint32_t *
r = (
const uint32_t *) _r;
1603 const uint32_t *
g = (
const uint32_t *) _g;
1604 const uint32_t *
b = (
const uint32_t *) _b;
1609 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1610 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1616 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1617 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1619 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1622 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1624 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1625 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1629 uint8_t *dest = (uint8_t *) _dest;
1630 const uint8_t *
r = (
const uint8_t *) _r;
1631 const uint8_t *
g = (
const uint8_t *) _g;
1632 const uint8_t *
b = (
const uint8_t *) _b;
1634 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1635 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1637 dest[
i * 6 + 0] =
r_b[Y1];
1638 dest[
i * 6 + 1] =
g[Y1];
1639 dest[
i * 6 + 2] =
b_r[Y1];
1640 dest[
i * 6 + 3] =
r_b[Y2];
1641 dest[
i * 6 + 4] =
g[Y2];
1642 dest[
i * 6 + 5] =
b_r[Y2];
1648 uint16_t *dest = (uint16_t *) _dest;
1649 const uint16_t *
r = (
const uint16_t *) _r;
1650 const uint16_t *
g = (
const uint16_t *) _g;
1651 const uint16_t *
b = (
const uint16_t *) _b;
1652 int dr1, dg1, db1, dr2, dg2, db2;
1677 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1678 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1680 uint32_t *dest = (uint32_t *) _dest;
1681 const uint32_t *
r = (
const uint32_t *) _r;
1682 const uint32_t *
g = (
const uint32_t *) _g;
1683 const uint32_t *
b = (
const uint32_t *) _b;
1684 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1685 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1687 uint8_t *dest = (uint8_t *) _dest;
1688 const uint8_t *
r = (
const uint8_t *) _r;
1689 const uint8_t *
g = (
const uint8_t *) _g;
1690 const uint8_t *
b = (
const uint8_t *) _b;
1691 int dr1, dg1, db1, dr2, dg2, db2;
1696 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1697 db1 = d64[(
i * 2 + 0) & 7];
1698 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1699 db2 = d64[(
i * 2 + 1) & 7];
1703 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1704 dg1 = d64[(
i * 2 + 0) & 7];
1705 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1706 dg2 = d64[(
i * 2 + 1) & 7];
1710 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1711 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1713 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1714 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1721 const int16_t **lumSrc,
int lumFilterSize,
1722 const int16_t *chrFilter,
const int16_t **chrUSrc,
1723 const int16_t **chrVSrc,
int chrFilterSize,
1724 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1729 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1735 const void *
r, *
g, *
b;
1737 for (j = 0; j < lumFilterSize; j++) {
1738 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1739 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1741 for (j = 0; j < chrFilterSize; j++) {
1742 U += chrUSrc[j][
i] * chrFilter[j];
1743 V += chrVSrc[j][
i] * chrFilter[j];
1752 for (j = 0; j < lumFilterSize; j++) {
1753 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1754 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1758 if ((
A1 |
A2) & 0x100) {
1769 r,
g,
b, y, target, hasAlpha);
1775 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1776 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1777 int yalpha,
int uvalpha,
int y,
1780 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1781 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1782 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1783 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1784 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1785 int yalpha1 = 4096 - yalpha;
1786 int uvalpha1 = 4096 - uvalpha;
1791 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1792 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1793 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1794 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1795 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1802 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1803 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1809 r,
g,
b, y, target, hasAlpha);
1815 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1816 const int16_t *abuf0, uint8_t *dest,
int dstW,
1820 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1824 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1825 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1826 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1827 int U = (ubuf0[
i] + 64) >> 7;
1828 int V = (vbuf0[
i] + 64) >> 7;
1835 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1836 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1842 r,
g,
b, y, target, hasAlpha);
1845 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1846 int uvalpha1 = 4096 - uvalpha;
1849 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1850 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1851 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1852 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha + (128 << 11)) >> 19;
1853 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha + (128 << 11)) >> 19;
1860 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1861 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1867 r,
g,
b, y, target, hasAlpha);
1872 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1873 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1874 const int16_t **lumSrc, int lumFilterSize, \
1875 const int16_t *chrFilter, const int16_t **chrUSrc, \
1876 const int16_t **chrVSrc, int chrFilterSize, \
1877 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1880 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1881 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1882 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1885 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1886 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1887 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1888 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1889 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1890 int yalpha, int uvalpha, int y) \
1892 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1893 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1896 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1897 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1898 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1899 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1900 const int16_t *abuf0, uint8_t *dest, int dstW, \
1901 int uvalpha, int y) \
1903 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1904 dstW, uvalpha, y, fmt, hasAlpha); \
1911 #if CONFIG_SWSCALE_ALPHA
1930 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
1936 Y -=
c->yuv2rgb_y_offset;
1937 Y *=
c->yuv2rgb_y_coeff;
1939 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
1940 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
1941 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
1942 if ((
R |
G |
B) & 0xC0000000) {
1950 dest[0] = hasAlpha ?
A : 255;
1964 dest[3] = hasAlpha ?
A : 255;
1967 dest[0] = hasAlpha ?
A : 255;
1981 dest[3] = hasAlpha ?
A : 255;
1987 AV_WL32(dest, (3
U << 30) + (
R << 20) + (
G << 10) +
B);
1993 AV_WL32(dest, (3
U << 30) + (
B << 20) + (
G << 10) +
R);
2002 switch (
c->opts.dither) {
2020 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;
2021 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;
2022 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;
2023 c->dither_error[0][
i] = err[0];
2024 c->dither_error[1][
i] = err[1];
2025 c->dither_error[2][
i] = err[2];
2026 r =
R >> (isrgb8 ? 5 : 7);
2027 g =
G >> (isrgb8 ? 5 : 6);
2028 b =
B >> (isrgb8 ? 6 : 7);
2032 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2033 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2034 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2039 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2058 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2078 dest[0] =
r + 2*
g + 8*
b;
2080 dest[0] =
b + 2*
g + 8*
r;
2082 dest[0] =
r + 8*
g + 64*
b;
2084 dest[0] =
b + 4*
g + 32*
r;
2093 const int16_t **lumSrc,
int lumFilterSize,
2094 const int16_t *chrFilter,
const int16_t **chrUSrc,
2095 const int16_t **chrVSrc,
int chrFilterSize,
2096 const int16_t **alpSrc, uint8_t *dest,
2108 for (
i = 0;
i < dstW;
i++) {
2111 int U = (1<<9)-(128 << 19);
2112 int V = (1<<9)-(128 << 19);
2114 for (j = 0; j < lumFilterSize; j++) {
2115 Y += lumSrc[j][
i] * lumFilter[j];
2117 for (j = 0; j < chrFilterSize; j++) {
2118 U += chrUSrc[j][
i] * chrFilter[j];
2119 V += chrVSrc[j][
i] * chrFilter[j];
2126 for (j = 0; j < lumFilterSize; j++) {
2127 A += alpSrc[j][
i] * lumFilter[j];
2133 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2136 c->dither_error[0][
i] = err[0];
2137 c->dither_error[1][
i] = err[1];
2138 c->dither_error[2][
i] = err[2];
2143 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2144 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2145 int yalpha,
int uvalpha,
int y,
2148 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2149 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2150 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2151 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2152 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2153 int yalpha1 = 4096 - yalpha;
2154 int uvalpha1 = 4096 - uvalpha;
2167 for (
i = 0;
i < dstW;
i++) {
2168 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2169 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2170 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2173 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2178 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2181 c->dither_error[0][
i] = err[0];
2182 c->dither_error[1][
i] = err[1];
2183 c->dither_error[2][
i] = err[2];
2188 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2189 const int16_t *abuf0, uint8_t *dest,
int dstW,
2193 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2204 for (
i = 0;
i < dstW;
i++) {
2205 int Y = buf0[
i] * 4;
2206 int U = (ubuf0[
i] - (128<<7)) * 4;
2207 int V = (vbuf0[
i] - (128<<7)) * 4;
2210 A = (abuf0[
i] + 64) >> 7;
2215 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2219 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2221 int uvalpha1 = 4096 - uvalpha;
2224 for (
i = 0;
i < dstW;
i++) {
2225 int Y = buf0[
i] * 4;
2226 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 19)) >> 10;
2227 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 19)) >> 10;
2230 A = (abuf0[
i] + 64) >> 7;
2235 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2240 c->dither_error[0][
i] = err[0];
2241 c->dither_error[1][
i] = err[1];
2242 c->dither_error[2][
i] = err[2];
2251 #if CONFIG_SWSCALE_ALPHA
2275 const int16_t **lumSrc,
int lumFilterSize,
2276 const int16_t *chrFilter, const int16_t **chrUSrc,
2277 const int16_t **chrVSrc,
int chrFilterSize,
2278 const int16_t **alpSrc, uint8_t **dest,
2284 uint16_t **dest16 = (uint16_t**)dest;
2285 int SH = 22 + 8 -
desc->comp[0].depth;
2288 for (
i = 0;
i < dstW;
i++) {
2291 int U = (1 << 9) - (128 << 19);
2292 int V = (1 << 9) - (128 << 19);
2295 for (j = 0; j < lumFilterSize; j++)
2296 Y += lumSrc[j][
i] * lumFilter[j];
2298 for (j = 0; j < chrFilterSize; j++) {
2299 U += chrUSrc[j][
i] * chrFilter[j];
2300 V += chrVSrc[j][
i] * chrFilter[j];
2310 for (j = 0; j < lumFilterSize; j++)
2311 A += alpSrc[j][
i] * lumFilter[j];
2317 Y -=
c->yuv2rgb_y_offset;
2318 Y *=
c->yuv2rgb_y_coeff;
2320 R =
Y +
V *
c->yuv2rgb_v2r_coeff;
2321 G =
Y +
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2322 B =
Y +
U *
c->yuv2rgb_u2b_coeff;
2324 if ((
R |
G |
B) & 0xC0000000) {
2331 dest16[0][
i] =
G >>
SH;
2332 dest16[1][
i] =
B >>
SH;
2333 dest16[2][
i] =
R >>
SH;
2335 dest16[3][
i] =
A >> (
SH - 3);
2337 dest[0][
i] =
G >> 22;
2338 dest[1][
i] =
B >> 22;
2339 dest[2][
i] =
R >> 22;
2341 dest[3][
i] =
A >> 19;
2344 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2345 for (
i = 0;
i < dstW;
i++) {
2357 const int16_t **lumSrcx,
int lumFilterSize,
2358 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2359 const int16_t **chrVSrcx,
int chrFilterSize,
2360 const int16_t **alpSrcx, uint8_t **dest,
2366 uint16_t **dest16 = (uint16_t**)dest;
2372 for (
i = 0;
i < dstW;
i++) {
2374 int Y = -0x40000000;
2375 int U = -(128 << 23);
2376 int V = -(128 << 23);
2379 for (j = 0; j < lumFilterSize; j++)
2380 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2382 for (j = 0; j < chrFilterSize; j++) {
2383 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2384 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2395 for (j = 0; j < lumFilterSize; j++)
2396 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2402 Y -=
c->yuv2rgb_y_offset;
2403 Y *=
c->yuv2rgb_y_coeff;
2404 Y += (1 << 13) - (1 << 29);
2405 R =
V *
c->yuv2rgb_v2r_coeff;
2406 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2407 B =
U *
c->yuv2rgb_u2b_coeff;
2416 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2417 for (
i = 0;
i < dstW;
i++) {
2429 const int16_t **lumSrcx,
int lumFilterSize,
2430 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2431 const int16_t **chrVSrcx,
int chrFilterSize,
2432 const int16_t **alpSrcx, uint8_t **dest,
2438 uint32_t **dest32 = (uint32_t**)dest;
2443 static const float float_mult = 1.0f / 65535.0f;
2445 for (
i = 0;
i < dstW;
i++) {
2447 int Y = -0x40000000;
2448 int U = -(128 << 23);
2449 int V = -(128 << 23);
2452 for (j = 0; j < lumFilterSize; j++)
2453 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2455 for (j = 0; j < chrFilterSize; j++) {
2456 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2457 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2468 for (j = 0; j < lumFilterSize; j++)
2469 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2475 Y -=
c->yuv2rgb_y_offset;
2476 Y *=
c->yuv2rgb_y_coeff;
2477 Y += (1 << 13) - (1 << 29);
2478 R =
V *
c->yuv2rgb_v2r_coeff;
2479 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2480 B =
U *
c->yuv2rgb_u2b_coeff;
2492 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2493 for (
i = 0;
i < dstW;
i++) {
2505 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2506 const int16_t *abuf0, uint8_t *dest,
int dstW,
2509 int hasAlpha = !!abuf0;
2512 for (
i = 0;
i < dstW;
i++) {
2513 int Y = (buf0[
i] + 64) >> 7;
2519 A = (abuf0[
i] + 64) >> 7;
2525 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2531 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2532 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2533 int yalpha,
int uvalpha,
int y)
2535 int hasAlpha = abuf && abuf[0] && abuf[1];
2536 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2537 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2538 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2539 int yalpha1 = 4096 - yalpha;
2544 for (
i = 0;
i < dstW;
i++) {
2545 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2551 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2556 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2562 const int16_t **lumSrc,
int lumFilterSize,
2563 const int16_t *chrFilter,
const int16_t **chrUSrc,
2564 const int16_t **chrVSrc,
int chrFilterSize,
2565 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2567 int hasAlpha = !!alpSrc;
2570 for (
i = 0;
i < dstW;
i++) {
2572 int Y = 1 << 18,
A = 1 << 18;
2574 for (j = 0; j < lumFilterSize; j++)
2575 Y += lumSrc[j][
i] * lumFilter[j];
2582 for (j = 0; j < lumFilterSize; j++)
2583 A += alpSrc[j][
i] * lumFilter[j];
2592 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2596 #define output_pixels(pos, val) \
2598 AV_WB16(pos, val); \
2600 AV_WL16(pos, val); \
2605 const int16_t **_lumSrc,
int lumFilterSize,
2606 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2607 const int16_t **_chrVSrc,
int chrFilterSize,
2608 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2609 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2612 **chrUSrc = (
const int32_t **) _chrUSrc,
2613 **chrVSrc = (
const int32_t **) _chrVSrc,
2614 **alpSrc = (
const int32_t **) _alpSrc;
2615 int hasAlpha = !!alpSrc;
2618 for (
i = 0;
i < dstW;
i++) {
2619 int Y = 1 << 14,
U = 1 << 14;
2620 int V = 1 << 14,
A = 1 << 14;
2628 for (j = 0; j < lumFilterSize; j++)
2629 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2631 for (j = 0; j < chrFilterSize; j++)
2632 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2634 for (j = 0; j < chrFilterSize; j++)
2635 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2638 for (j = 0; j < lumFilterSize; j++)
2639 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2654 #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2656 yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2657 const int16_t **lumSrc, int lumFilterSize, \
2658 const int16_t *chrFilter, const int16_t **chrUSrc, \
2659 const int16_t **chrVSrc, int chrFilterSize, \
2660 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2662 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2663 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2664 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2673 #undef output_pixels
2677 const int16_t **lumSrc,
int lumFilterSize,
2678 const int16_t *chrFilter,
const int16_t **chrUSrc,
2679 const int16_t **chrVSrc,
int chrFilterSize,
2680 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2684 for (
i = 0;
i < dstW;
i++) {
2685 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2688 for (j = 0; j < lumFilterSize; j++)
2689 Y += lumSrc[j][
i] * lumFilter[j];
2691 for (j = 0; j < chrFilterSize; j++) {
2692 U += chrUSrc[j][
i] * chrFilter[j];
2693 V += chrVSrc[j][
i] * chrFilter[j];
2702 (
unsigned)
V << (
shift + 20) |
2703 (
unsigned)
A << (
shift ? 0 : 30 ));
2707 #define V30LE_WRAPPER(name, shift) \
2708 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2709 const int16_t **lumSrc, int lumFilterSize, \
2710 const int16_t *chrFilter, const int16_t **chrUSrc, \
2711 const int16_t **chrVSrc, int chrFilterSize, \
2712 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2715 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2716 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2717 alpSrc, dest, dstW, y, shift); \
2723 #define output_pixels(pos, val, shift, bits, output_shift) \
2725 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2727 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2732 const int16_t **lumSrc,
int lumFilterSize,
2733 const int16_t *chrFilter,
const int16_t **chrUSrc,
2734 const int16_t **chrVSrc,
int chrFilterSize,
2735 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2738 for (
i = 0;
i < dstW;
i++) {
2739 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2742 for (j = 0; j < lumFilterSize; j++)
2743 Y += lumSrc[j][
i] * lumFilter[j];
2745 for (j = 0; j < chrFilterSize; j++) {
2746 U += chrUSrc[j][
i] * chrFilter[j];
2747 V += chrVSrc[j][
i] * chrFilter[j];
2757 #undef output_pixels
2759 #define YUV2XV36(BE_LE, is_be) \
2761 yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2762 const int16_t **lumSrc, int lumFilterSize, \
2763 const int16_t *chrFilter, const int16_t **chrUSrc, \
2764 const int16_t **chrVSrc, int chrFilterSize, \
2765 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2767 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2768 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2769 alpSrc, dest, dstW, y, is_be); \
2775 #define output_pixels(pos, A, Y, U, V) \
2776 if (target == AV_PIX_FMT_AYUV) { \
2777 dest[pos + 0] = A; \
2778 dest[pos + 1] = Y; \
2779 dest[pos + 2] = U; \
2780 dest[pos + 3] = V; \
2781 } else if (target == AV_PIX_FMT_UYVA) { \
2782 dest[pos + 0] = U; \
2783 dest[pos + 1] = Y; \
2784 dest[pos + 2] = V; \
2785 dest[pos + 3] = A; \
2787 dest[pos + 0] = V; \
2788 dest[pos + 1] = U; \
2789 dest[pos + 2] = Y; \
2790 dest[pos + 3] = A; \
2795 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2796 const int16_t *abuf0, uint8_t *dest,
int dstW,
2799 int hasAlpha = !!abuf0;
2802 if (uvalpha < 2048) {
2803 for (
i = 0;
i < dstW;
i++) {
2804 int Y = (buf0[
i] + 64) >> 7;
2805 int U = (ubuf[0][
i] + 64) >> 7;
2806 int V = (vbuf[0][
i] + 64) >> 7;
2817 A = (abuf0[
i] + 64) >> 7;
2825 for (
i = 0;
i < dstW;
i++) {
2826 int Y = (buf0[
i] + 64) >> 7;
2827 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2828 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2839 A = (abuf0[
i] + 64) >> 7;
2851 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2852 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2853 int yalpha,
int uvalpha,
int y,
2856 int hasAlpha = abuf && abuf[0] && abuf[1];
2857 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2858 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2859 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2860 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2861 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2862 int yalpha1 = 4096 - yalpha;
2863 int uvalpha1 = 4096 - uvalpha;
2869 for (
i = 0;
i < dstW;
i++) {
2870 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2871 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2872 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2883 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2893 const int16_t **lumSrc,
int lumFilterSize,
2894 const int16_t *chrFilter,
const int16_t **chrUSrc,
2895 const int16_t **chrVSrc,
int chrFilterSize,
2896 const int16_t **alpSrc, uint8_t *dest,
int dstW,
2901 for (
i = 0;
i < dstW;
i++) {
2903 int Y = 1 << 18,
U = 1 << 18;
2904 int V = 1 << 18,
A = 255;
2906 for (j = 0; j < lumFilterSize; j++)
2907 Y += lumSrc[j][
i] * lumFilter[j];
2909 for (j = 0; j < chrFilterSize; j++)
2910 U += chrUSrc[j][
i] * chrFilter[j];
2912 for (j = 0; j < chrFilterSize; j++)
2913 V += chrVSrc[j][
i] * chrFilter[j];
2929 for (j = 0; j < lumFilterSize; j++)
2930 A += alpSrc[j][
i] * lumFilter[j];
2942 #undef output_pixels
2944 #define AYUVPACKEDWRAPPER(name, fmt) \
2945 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2946 const int16_t **lumSrc, int lumFilterSize, \
2947 const int16_t *chrFilter, const int16_t **chrUSrc, \
2948 const int16_t **chrVSrc, int chrFilterSize, \
2949 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2952 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2953 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2954 alpSrc, dest, dstW, y, fmt); \
2957 static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
2958 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2959 const int16_t *abuf[2], uint8_t *dest, int dstW, \
2960 int yalpha, int uvalpha, int y) \
2962 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
2963 dest, dstW, yalpha, uvalpha, y, fmt); \
2966 static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
2967 const int16_t *ubuf[2], const int16_t *vbuf[2], \
2968 const int16_t *abuf0, uint8_t *dest, int dstW, \
2969 int uvalpha, int y) \
2971 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
2972 abuf0, dest, dstW, uvalpha, \
2980 #define output_pixel(pos, val, bits) \
2981 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
2983 #define yuv2y2xx_wrapper(bits) \
2985 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
2986 const int16_t **lumSrc, int lumFilterSize, \
2987 const int16_t *chrFilter, \
2988 const int16_t **chrUSrc, \
2989 const int16_t **chrVSrc, int chrFilterSize, \
2990 const int16_t **alpSrc, \
2991 uint8_t *dest, int dstW, int y) \
2994 int shift = 11 + 16 - bits; \
2995 int output_shift = 16 - bits; \
2996 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
2997 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
2998 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
3000 for (j = 0; j < lumFilterSize; j++) { \
3001 Y1 += lumSrc[j][i * 2] * lumFilter[j]; \
3002 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \
3005 for (j = 0; j < chrFilterSize; j++) { \
3006 U += chrUSrc[j][i] * chrFilter[j]; \
3007 V += chrVSrc[j][i] * chrFilter[j]; \
3010 output_pixel(dest + 8 * i + 0, Y1, bits); \
3011 output_pixel(dest + 8 * i + 2, U, bits); \
3012 output_pixel(dest + 8 * i + 4, Y2, bits); \
3013 output_pixel(dest + 8 * i + 6, V, bits); \
3021 yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3022 const int16_t **_lumSrc,
int lumFilterSize,
3023 const int16_t *chrFilter,
3024 const int16_t **_chrUSrc,
3025 const int16_t **_chrVSrc,
int chrFilterSize,
3026 const int16_t **_alpSrc,
3027 uint8_t *dest,
int dstW,
int y)
3034 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3035 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3044 for (
int j = 0; j < lumFilterSize; j++) {
3045 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3046 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3049 for (
int j = 0; j < chrFilterSize; j++) {
3050 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3051 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3063 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3064 const int16_t *abuf0, uint8_t *dest,
int dstW,
3069 if (uvalpha < 2048) {
3070 for (
i = 0;
i < dstW;
i++) {
3071 int Y = (buf0[
i] + 64) >> 7;
3072 int U = (ubuf[0][
i] + 64) >> 7;
3073 int V = (vbuf[0][
i] + 64) >> 7;
3083 dest[3 *
i + 1] =
Y;
3084 dest[3 *
i + 2] =
U;
3087 for (
i = 0;
i < dstW;
i++) {
3088 int Y = (buf0[
i] + 64) >> 7;
3089 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3090 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3100 dest[3 *
i + 1] =
Y;
3101 dest[3 *
i + 2] =
U;
3108 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3109 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3110 int yalpha,
int uvalpha,
int y)
3112 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3113 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3114 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3115 int yalpha1 = 4096 - yalpha;
3116 int uvalpha1 = 4096 - uvalpha;
3122 for (
i = 0;
i < dstW;
i++) {
3123 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3124 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3125 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3135 dest[3 *
i + 1] =
Y;
3136 dest[3 *
i + 2] =
U;
3142 const int16_t **lumSrc,
int lumFilterSize,
3143 const int16_t *chrFilter,
const int16_t **chrUSrc,
3144 const int16_t **chrVSrc,
int chrFilterSize,
3145 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3149 for (
i = 0;
i < dstW;
i++) {
3151 int Y = 1 << 18,
U = 1 << 18;
3154 for (j = 0; j < lumFilterSize; j++)
3155 Y += lumSrc[j][
i] * lumFilter[j];
3157 for (j = 0; j < chrFilterSize; j++)
3158 U += chrUSrc[j][
i] * chrFilter[j];
3160 for (j = 0; j < chrFilterSize; j++)
3161 V += chrVSrc[j][
i] * chrFilter[j];
3175 dest[3 *
i + 1] =
Y;
3176 dest[3 *
i + 2] =
U;
3195 if (
desc->comp[0].depth == 10) {
3196 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3197 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3198 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3199 }
else if (
desc->comp[0].depth == 12) {
3200 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3201 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3202 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3206 if (
desc->comp[0].depth == 10) {
3207 *yuv2plane1 =
isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3208 *
yuv2planeX =
isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3209 *yuv2nv12cX =
isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3212 }
else if (
is16BPS(dstFormat)) {
3213 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3214 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3218 }
else if (
isNBPS(dstFormat)) {
3219 if (
desc->comp[0].depth == 9) {
3220 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3221 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3222 }
else if (
desc->comp[0].depth == 10) {
3223 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3224 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3225 }
else if (
desc->comp[0].depth == 12) {
3226 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3227 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3228 }
else if (
desc->comp[0].depth == 14) {
3229 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3230 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3235 *yuv2plane1 = yuv2plane1_floatBE_c;
3238 *yuv2plane1 = yuv2plane1_floatLE_c;
3247 switch (dstFormat) {
3250 *yuv2packedX = yuv2rgba32_full_X_c;
3251 *yuv2packed2 = yuv2rgba32_full_2_c;
3252 *yuv2packed1 = yuv2rgba32_full_1_c;
3254 #if CONFIG_SWSCALE_ALPHA
3256 *yuv2packedX = yuv2rgba32_full_X_c;
3257 *yuv2packed2 = yuv2rgba32_full_2_c;
3258 *yuv2packed1 = yuv2rgba32_full_1_c;
3262 *yuv2packedX = yuv2rgbx32_full_X_c;
3263 *yuv2packed2 = yuv2rgbx32_full_2_c;
3264 *yuv2packed1 = yuv2rgbx32_full_1_c;
3270 *yuv2packedX = yuv2argb32_full_X_c;
3271 *yuv2packed2 = yuv2argb32_full_2_c;
3272 *yuv2packed1 = yuv2argb32_full_1_c;
3274 #if CONFIG_SWSCALE_ALPHA
3276 *yuv2packedX = yuv2argb32_full_X_c;
3277 *yuv2packed2 = yuv2argb32_full_2_c;
3278 *yuv2packed1 = yuv2argb32_full_1_c;
3282 *yuv2packedX = yuv2xrgb32_full_X_c;
3283 *yuv2packed2 = yuv2xrgb32_full_2_c;
3284 *yuv2packed1 = yuv2xrgb32_full_1_c;
3290 *yuv2packedX = yuv2bgra32_full_X_c;
3291 *yuv2packed2 = yuv2bgra32_full_2_c;
3292 *yuv2packed1 = yuv2bgra32_full_1_c;
3294 #if CONFIG_SWSCALE_ALPHA
3296 *yuv2packedX = yuv2bgra32_full_X_c;
3297 *yuv2packed2 = yuv2bgra32_full_2_c;
3298 *yuv2packed1 = yuv2bgra32_full_1_c;
3302 *yuv2packedX = yuv2bgrx32_full_X_c;
3303 *yuv2packed2 = yuv2bgrx32_full_2_c;
3304 *yuv2packed1 = yuv2bgrx32_full_1_c;
3310 *yuv2packedX = yuv2abgr32_full_X_c;
3311 *yuv2packed2 = yuv2abgr32_full_2_c;
3312 *yuv2packed1 = yuv2abgr32_full_1_c;
3314 #if CONFIG_SWSCALE_ALPHA
3316 *yuv2packedX = yuv2abgr32_full_X_c;
3317 *yuv2packed2 = yuv2abgr32_full_2_c;
3318 *yuv2packed1 = yuv2abgr32_full_1_c;
3322 *yuv2packedX = yuv2xbgr32_full_X_c;
3323 *yuv2packed2 = yuv2xbgr32_full_2_c;
3324 *yuv2packed1 = yuv2xbgr32_full_1_c;
3329 #if CONFIG_SWSCALE_ALPHA
3331 *yuv2packedX = yuv2rgba64le_full_X_c;
3332 *yuv2packed2 = yuv2rgba64le_full_2_c;
3333 *yuv2packed1 = yuv2rgba64le_full_1_c;
3337 *yuv2packedX = yuv2rgbx64le_full_X_c;
3338 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3339 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3343 #if CONFIG_SWSCALE_ALPHA
3345 *yuv2packedX = yuv2rgba64be_full_X_c;
3346 *yuv2packed2 = yuv2rgba64be_full_2_c;
3347 *yuv2packed1 = yuv2rgba64be_full_1_c;
3351 *yuv2packedX = yuv2rgbx64be_full_X_c;
3352 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3353 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3357 #if CONFIG_SWSCALE_ALPHA
3359 *yuv2packedX = yuv2bgra64le_full_X_c;
3360 *yuv2packed2 = yuv2bgra64le_full_2_c;
3361 *yuv2packed1 = yuv2bgra64le_full_1_c;
3365 *yuv2packedX = yuv2bgrx64le_full_X_c;
3366 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3367 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3371 #if CONFIG_SWSCALE_ALPHA
3373 *yuv2packedX = yuv2bgra64be_full_X_c;
3374 *yuv2packed2 = yuv2bgra64be_full_2_c;
3375 *yuv2packed1 = yuv2bgra64be_full_1_c;
3379 *yuv2packedX = yuv2bgrx64be_full_X_c;
3380 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3381 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3386 *yuv2packedX = yuv2rgb24_full_X_c;
3387 *yuv2packed2 = yuv2rgb24_full_2_c;
3388 *yuv2packed1 = yuv2rgb24_full_1_c;
3391 *yuv2packedX = yuv2bgr24_full_X_c;
3392 *yuv2packed2 = yuv2bgr24_full_2_c;
3393 *yuv2packed1 = yuv2bgr24_full_1_c;
3396 *yuv2packedX = yuv2rgb48le_full_X_c;
3397 *yuv2packed2 = yuv2rgb48le_full_2_c;
3398 *yuv2packed1 = yuv2rgb48le_full_1_c;
3401 *yuv2packedX = yuv2bgr48le_full_X_c;
3402 *yuv2packed2 = yuv2bgr48le_full_2_c;
3403 *yuv2packed1 = yuv2bgr48le_full_1_c;
3406 *yuv2packedX = yuv2rgb48be_full_X_c;
3407 *yuv2packed2 = yuv2rgb48be_full_2_c;
3408 *yuv2packed1 = yuv2rgb48be_full_1_c;
3411 *yuv2packedX = yuv2bgr48be_full_X_c;
3412 *yuv2packed2 = yuv2bgr48be_full_2_c;
3413 *yuv2packed1 = yuv2bgr48be_full_1_c;
3416 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3417 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3418 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3421 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3422 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3423 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3426 *yuv2packedX = yuv2bgr8_full_X_c;
3427 *yuv2packed2 = yuv2bgr8_full_2_c;
3428 *yuv2packed1 = yuv2bgr8_full_1_c;
3431 *yuv2packedX = yuv2rgb8_full_X_c;
3432 *yuv2packed2 = yuv2rgb8_full_2_c;
3433 *yuv2packed1 = yuv2rgb8_full_1_c;
3436 *yuv2packedX = yuv2x2rgb10_full_X_c;
3437 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3438 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3441 *yuv2packedX = yuv2x2bgr10_full_X_c;
3442 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3443 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3476 if (!*yuv2packedX && !*yuv2anyX)
3480 switch (dstFormat) {
3482 #if CONFIG_SWSCALE_ALPHA
3484 *yuv2packed1 = yuv2rgba64le_1_c;
3485 *yuv2packed2 = yuv2rgba64le_2_c;
3486 *yuv2packedX = yuv2rgba64le_X_c;
3490 *yuv2packed1 = yuv2rgbx64le_1_c;
3491 *yuv2packed2 = yuv2rgbx64le_2_c;
3492 *yuv2packedX = yuv2rgbx64le_X_c;
3496 #if CONFIG_SWSCALE_ALPHA
3498 *yuv2packed1 = yuv2rgba64be_1_c;
3499 *yuv2packed2 = yuv2rgba64be_2_c;
3500 *yuv2packedX = yuv2rgba64be_X_c;
3504 *yuv2packed1 = yuv2rgbx64be_1_c;
3505 *yuv2packed2 = yuv2rgbx64be_2_c;
3506 *yuv2packedX = yuv2rgbx64be_X_c;
3510 #if CONFIG_SWSCALE_ALPHA
3512 *yuv2packed1 = yuv2bgra64le_1_c;
3513 *yuv2packed2 = yuv2bgra64le_2_c;
3514 *yuv2packedX = yuv2bgra64le_X_c;
3518 *yuv2packed1 = yuv2bgrx64le_1_c;
3519 *yuv2packed2 = yuv2bgrx64le_2_c;
3520 *yuv2packedX = yuv2bgrx64le_X_c;
3524 #if CONFIG_SWSCALE_ALPHA
3526 *yuv2packed1 = yuv2bgra64be_1_c;
3527 *yuv2packed2 = yuv2bgra64be_2_c;
3528 *yuv2packedX = yuv2bgra64be_X_c;
3532 *yuv2packed1 = yuv2bgrx64be_1_c;
3533 *yuv2packed2 = yuv2bgrx64be_2_c;
3534 *yuv2packedX = yuv2bgrx64be_X_c;
3538 *yuv2packed1 = yuv2rgb48le_1_c;
3539 *yuv2packed2 = yuv2rgb48le_2_c;
3540 *yuv2packedX = yuv2rgb48le_X_c;
3543 *yuv2packed1 = yuv2rgb48be_1_c;
3544 *yuv2packed2 = yuv2rgb48be_2_c;
3545 *yuv2packedX = yuv2rgb48be_X_c;
3548 *yuv2packed1 = yuv2bgr48le_1_c;
3549 *yuv2packed2 = yuv2bgr48le_2_c;
3550 *yuv2packedX = yuv2bgr48le_X_c;
3553 *yuv2packed1 = yuv2bgr48be_1_c;
3554 *yuv2packed2 = yuv2bgr48be_2_c;
3555 *yuv2packedX = yuv2bgr48be_X_c;
3560 *yuv2packed1 = yuv2rgb32_1_c;
3561 *yuv2packed2 = yuv2rgb32_2_c;
3562 *yuv2packedX = yuv2rgb32_X_c;
3564 #if CONFIG_SWSCALE_ALPHA
3566 *yuv2packed1 = yuv2rgba32_1_c;
3567 *yuv2packed2 = yuv2rgba32_2_c;
3568 *yuv2packedX = yuv2rgba32_X_c;
3572 *yuv2packed1 = yuv2rgbx32_1_c;
3573 *yuv2packed2 = yuv2rgbx32_2_c;
3574 *yuv2packedX = yuv2rgbx32_X_c;
3581 *yuv2packed1 = yuv2rgb32_1_1_c;
3582 *yuv2packed2 = yuv2rgb32_1_2_c;
3583 *yuv2packedX = yuv2rgb32_1_X_c;
3585 #if CONFIG_SWSCALE_ALPHA
3587 *yuv2packed1 = yuv2rgba32_1_1_c;
3588 *yuv2packed2 = yuv2rgba32_1_2_c;
3589 *yuv2packedX = yuv2rgba32_1_X_c;
3593 *yuv2packed1 = yuv2rgbx32_1_1_c;
3594 *yuv2packed2 = yuv2rgbx32_1_2_c;
3595 *yuv2packedX = yuv2rgbx32_1_X_c;
3600 *yuv2packed1 = yuv2rgb24_1_c;
3601 *yuv2packed2 = yuv2rgb24_2_c;
3602 *yuv2packedX = yuv2rgb24_X_c;
3605 *yuv2packed1 = yuv2bgr24_1_c;
3606 *yuv2packed2 = yuv2bgr24_2_c;
3607 *yuv2packedX = yuv2bgr24_X_c;
3613 *yuv2packed1 = yuv2rgb16_1_c;
3614 *yuv2packed2 = yuv2rgb16_2_c;
3615 *yuv2packedX = yuv2rgb16_X_c;
3621 *yuv2packed1 = yuv2rgb15_1_c;
3622 *yuv2packed2 = yuv2rgb15_2_c;
3623 *yuv2packedX = yuv2rgb15_X_c;
3629 *yuv2packed1 = yuv2rgb12_1_c;
3630 *yuv2packed2 = yuv2rgb12_2_c;
3631 *yuv2packedX = yuv2rgb12_X_c;
3635 *yuv2packed1 = yuv2rgb8_1_c;
3636 *yuv2packed2 = yuv2rgb8_2_c;
3637 *yuv2packedX = yuv2rgb8_X_c;
3641 *yuv2packed1 = yuv2rgb4_1_c;
3642 *yuv2packed2 = yuv2rgb4_2_c;
3643 *yuv2packedX = yuv2rgb4_X_c;
3647 *yuv2packed1 = yuv2rgb4b_1_c;
3648 *yuv2packed2 = yuv2rgb4b_2_c;
3649 *yuv2packedX = yuv2rgb4b_X_c;
3653 *yuv2packed1 = yuv2x2rgb10_1_c;
3654 *yuv2packed2 = yuv2x2rgb10_2_c;
3655 *yuv2packedX = yuv2x2rgb10_X_c;
3659 *yuv2packed1 = yuv2x2bgr10_1_c;
3660 *yuv2packed2 = yuv2x2bgr10_2_c;
3661 *yuv2packedX = yuv2x2bgr10_X_c;
3665 switch (dstFormat) {
3667 *yuv2packed1 = yuv2monowhite_1_c;
3668 *yuv2packed2 = yuv2monowhite_2_c;
3669 *yuv2packedX = yuv2monowhite_X_c;
3672 *yuv2packed1 = yuv2monoblack_1_c;
3673 *yuv2packed2 = yuv2monoblack_2_c;
3674 *yuv2packedX = yuv2monoblack_X_c;
3677 *yuv2packed1 = yuv2yuyv422_1_c;
3678 *yuv2packed2 = yuv2yuyv422_2_c;
3679 *yuv2packedX = yuv2yuyv422_X_c;
3682 *yuv2packed1 = yuv2yvyu422_1_c;
3683 *yuv2packed2 = yuv2yvyu422_2_c;
3684 *yuv2packedX = yuv2yvyu422_X_c;
3687 *yuv2packed1 = yuv2uyvy422_1_c;
3688 *yuv2packed2 = yuv2uyvy422_2_c;
3689 *yuv2packedX = yuv2uyvy422_X_c;
3702 *yuv2packed1 = yuv2ya16le_1_c;
3703 *yuv2packed2 = yuv2ya16le_2_c;
3704 *yuv2packedX = yuv2ya16le_X_c;
3707 *yuv2packed1 = yuv2ya16be_1_c;
3708 *yuv2packed2 = yuv2ya16be_2_c;
3709 *yuv2packedX = yuv2ya16be_X_c;
3712 *yuv2packedX = yuv2v30xle_X_c;
3715 *yuv2packedX = yuv2ayuv64le_X_c;
3718 *yuv2packedX = yuv2ayuv64be_X_c;
3721 *yuv2packed1 = yuv2ayuv_1_c;
3722 *yuv2packed2 = yuv2ayuv_2_c;
3723 *yuv2packedX = yuv2ayuv_X_c;
3727 *yuv2packed1 = yuv2vuyX_1_c;
3728 *yuv2packed2 = yuv2vuyX_2_c;
3729 *yuv2packedX = yuv2vuyX_X_c;
3732 *yuv2packed1 = yuv2uyva_1_c;
3733 *yuv2packed2 = yuv2uyva_2_c;
3734 *yuv2packedX = yuv2uyva_X_c;
3737 *yuv2packedX = yuv2xv30le_X_c;
3740 *yuv2packedX = yuv2xv36le_X_c;
3743 *yuv2packedX = yuv2xv36be_X_c;
3746 *yuv2packedX = yuv2xv48le_X_c;
3749 *yuv2packedX = yuv2xv48be_X_c;
3752 *yuv2packedX = yuv2y210le_X_c;
3755 *yuv2packedX = yuv2y212le_X_c;
3758 *yuv2packedX = yuv2y216le_X_c;