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); \
389 #define output_pixel(pos, val) \
391 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \
393 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \
397 yuv2msbplane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
398 int big_endian,
int output_bits)
401 int shift = 15 - output_bits;
403 for (
i = 0;
i < dstW;
i++) {
411 const int16_t **
src, uint16_t *dest,
int dstW,
412 int big_endian,
int output_bits)
415 int shift = 11 + 16 - output_bits;
417 for (
i = 0;
i < dstW;
i++) {
421 for (j = 0; j < filterSize; j++)
428 #define yuv2MSBNBPS(bits, BE_LE, is_be, template_size, typeX_t) \
429 static void yuv2msbplane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
430 uint8_t *dest, int dstW, \
431 const uint8_t *dither, int offset)\
433 yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434 (uint16_t *) dest, dstW, is_be, bits); \
436 static void yuv2msbplaneX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
437 const int16_t **src, uint8_t *dest, int dstW, \
438 const uint8_t *dither, int offset)\
440 yuv2msbplaneX_## template_size ## _c_template(filter, \
441 filterSize, (const typeX_t **) src, \
442 (uint16_t *) dest, dstW, is_be, bits); \
452 static void yuv2nv12cX_16LE_c(
enum AVPixelFormat dstFormat,
const uint8_t *chrDither,
453 const int16_t *chrFilter,
int chrFilterSize,
454 const int16_t **chrUSrc,
const int16_t **chrVSrc,
455 uint8_t *dest8,
int chrDstW)
461 const int16_t *chrFilter,
int chrFilterSize,
462 const int16_t **chrUSrc,
const int16_t **chrVSrc,
463 uint8_t *dest8,
int chrDstW)
469 const int16_t **
src, uint8_t *dest,
int dstW,
473 for (
i=0;
i<dstW;
i++) {
476 for (j=0; j<filterSize; j++) {
489 for (
i=0;
i<dstW;
i++) {
496 const int16_t *chrFilter,
int chrFilterSize,
497 const int16_t **chrUSrc,
const int16_t **chrVSrc,
498 uint8_t *dest,
int chrDstW)
503 for (
i=0;
i<chrDstW;
i++) {
504 int u = chrDither[
i & 7] << 12;
505 int v = chrDither[(
i + 3) & 7] << 12;
507 for (j=0; j<chrFilterSize; j++) {
508 u += chrUSrc[j][
i] * (unsigned)chrFilter[j];
509 v += chrVSrc[j][
i] * (unsigned)chrFilter[j];
516 for (
i=0;
i<chrDstW;
i++) {
517 int u = chrDither[
i & 7] << 12;
518 int v = chrDither[(
i + 3) & 7] << 12;
520 for (j=0; j<chrFilterSize; j++) {
521 u += chrUSrc[j][
i] * (unsigned)chrFilter[j];
522 v += chrVSrc[j][
i] * (unsigned)chrFilter[j];
531 #define output_pixel(pos, val) \
533 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
535 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
539 uint16_t *dest,
int dstW,
540 int big_endian,
int output_bits,
int output_shift)
543 int shift = 15 - output_bits;
545 for (
i = 0;
i < dstW;
i++) {
552 const int16_t **
src, uint16_t *dest,
int dstW,
553 int big_endian,
int output_bits,
int output_shift)
556 int shift = 11 + 16 - output_bits;
558 for (
i = 0;
i < dstW;
i++) {
561 for (j = 0; j < filterSize; j++)
569 const int16_t *chrFilter,
int chrFilterSize,
570 const int16_t **chrUSrc,
const int16_t **chrVSrc,
571 uint8_t *dest8,
int chrDstW,
int output_bits,
int output_shift)
573 uint16_t *dest = (uint16_t*)dest8;
575 int shift = 11 + 16 - output_bits;
577 for (
i = 0;
i < chrDstW;
i++) {
579 int v = 1 << (
shift - 1);
581 for (j = 0; j < chrFilterSize; j++) {
582 u += chrUSrc[j][
i] * (unsigned)chrFilter[j];
583 v += chrVSrc[j][
i] * (unsigned)chrFilter[j];
593 #define yuv2p01x_wrapper(fmt, bits, shift) \
594 static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \
595 uint8_t *dest, int dstW, \
596 const uint8_t *dither, int offset) \
598 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \
601 static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \
602 uint8_t *dest, int dstW, \
603 const uint8_t *dither, int offset) \
605 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \
608 static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \
609 int filterSize, const int16_t **src, \
610 uint8_t *dest, int dstW, \
611 const uint8_t *dither, int offset) \
613 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \
617 static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \
618 int filterSize, const int16_t **src, \
619 uint8_t *dest, int dstW, \
620 const uint8_t *dither, int offset) \
622 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \
626 static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat, \
627 const uint8_t *chrDither, \
628 const int16_t *chrFilter, \
630 const int16_t **chrUSrc, \
631 const int16_t **chrVSrc, \
632 uint8_t *dest8, int chrDstW) \
634 yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
635 dest8, chrDstW, bits, shift); \
638 static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat, \
639 const uint8_t *chrDither, \
640 const int16_t *chrFilter, \
642 const int16_t **chrUSrc, \
643 const int16_t **chrVSrc, \
644 uint8_t *dest8, int chrDstW) \
646 yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
647 dest8, chrDstW, bits, shift); \
654 #define accumulate_bit(acc, val) \
657 #define output_pixel(pos, acc) \
658 if (target == AV_PIX_FMT_MONOBLACK) { \
665 yuv2mono_X_c_template(
SwsInternal *
c,
const int16_t *lumFilter,
666 const int16_t **lumSrc,
int lumFilterSize,
667 const int16_t *chrFilter,
const int16_t **chrUSrc,
668 const int16_t **chrVSrc,
int chrFilterSize,
669 const int16_t **alpSrc, uint8_t *dest,
int dstW,
677 for (
i = 0;
i < dstW;
i += 2) {
682 for (j = 0; j < lumFilterSize; j++) {
683 Y1 += lumSrc[j][
i] * (unsigned)lumFilter[j];
684 Y2 += lumSrc[j][
i+1] * (unsigned)lumFilter[j];
688 if ((Y1 | Y2) & 0x100) {
693 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;
694 c->dither_error[0][
i] = err;
695 acc = 2*acc + (Y1 >= 128);
698 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);
699 c->dither_error[0][
i+1] = Y1;
700 acc = 2*acc + (err >= 128);
710 c->dither_error[0][
i] = err;
719 const int16_t *ubuf[2],
const int16_t *vbuf[2],
720 const int16_t *abuf[2], uint8_t *dest,
int dstW,
721 int yalpha,
int uvalpha,
int y,
724 const int16_t *buf0 = buf[0], *buf1 = buf[1];
726 int yalpha1 = 4096 - yalpha;
733 for (
i = 0;
i < dstW;
i +=2) {
736 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
737 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;
738 c->dither_error[0][
i] = err;
739 acc = 2*acc + (
Y >= 128);
742 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
743 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;
744 c->dither_error[0][
i+1] =
Y;
745 acc = 2*acc + (err >= 128);
751 c->dither_error[0][
i] = err;
753 for (
i = 0;
i < dstW;
i += 8) {
757 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
759 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
761 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
763 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
765 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
767 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
769 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
771 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
781 const int16_t *ubuf[2],
const int16_t *vbuf[2],
782 const int16_t *abuf0, uint8_t *dest,
int dstW,
791 for (
i = 0;
i < dstW;
i +=2) {
794 Y = ((buf0[
i + 0] + 64) >> 7);
795 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;
796 c->dither_error[0][
i] = err;
797 acc = 2*acc + (
Y >= 128);
800 err = ((buf0[
i + 1] + 64) >> 7);
801 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;
802 c->dither_error[0][
i+1] =
Y;
803 acc = 2*acc + (err >= 128);
809 c->dither_error[0][
i] = err;
811 for (
i = 0;
i < dstW;
i += 8) {
828 #undef accumulate_bit
830 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
831 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
832 const int16_t **lumSrc, int lumFilterSize, \
833 const int16_t *chrFilter, const int16_t **chrUSrc, \
834 const int16_t **chrVSrc, int chrFilterSize, \
835 const int16_t **alpSrc, uint8_t *dest, int dstW, \
838 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840 alpSrc, dest, dstW, y, fmt); \
843 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
844 const int16_t *ubuf[2], const int16_t *vbuf[2], \
845 const int16_t *abuf[2], uint8_t *dest, int dstW, \
846 int yalpha, int uvalpha, int y) \
848 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849 dest, dstW, yalpha, uvalpha, y, fmt); \
852 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
853 const int16_t *ubuf[2], const int16_t *vbuf[2], \
854 const int16_t *abuf0, uint8_t *dest, int dstW, \
855 int uvalpha, int y) \
857 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858 abuf0, dest, dstW, uvalpha, \
865 #define output_pixels(pos, Y1, U, Y2, V) \
866 if (target == AV_PIX_FMT_YUYV422) { \
867 dest[pos + 0] = Y1; \
869 dest[pos + 2] = Y2; \
871 } else if (target == AV_PIX_FMT_YVYU422) { \
872 dest[pos + 0] = Y1; \
874 dest[pos + 2] = Y2; \
878 dest[pos + 1] = Y1; \
880 dest[pos + 3] = Y2; \
885 const int16_t **lumSrc,
int lumFilterSize,
886 const int16_t *chrFilter,
const int16_t **chrUSrc,
887 const int16_t **chrVSrc,
int chrFilterSize,
888 const int16_t **alpSrc, uint8_t *dest,
int dstW,
893 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
900 for (j = 0; j < lumFilterSize; j++) {
901 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
902 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
904 for (j = 0; j < chrFilterSize; j++) {
905 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
906 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
912 if ((Y1 | Y2 |
U |
V) & 0x100) {
924 const int16_t *ubuf[2],
const int16_t *vbuf[2],
925 const int16_t *abuf[2], uint8_t *dest,
int dstW,
926 int yalpha,
int uvalpha,
int y,
929 const int16_t *buf0 = buf[0], *buf1 = buf[1],
930 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
931 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
932 int yalpha1 = 4096 - yalpha;
933 int uvalpha1 = 4096 - uvalpha;
938 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
939 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
940 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
941 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
942 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
944 if ((Y1 | Y2 |
U |
V) & 0x100) {
957 const int16_t *ubuf[2],
const int16_t *vbuf[2],
958 const int16_t *abuf0, uint8_t *dest,
int dstW,
961 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
964 if (uvalpha < 2048) {
965 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
966 int Y1 = (buf0[
i * 2 ]+64) >> 7;
967 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
968 int U = (ubuf0[
i] +64) >> 7;
969 int V = (vbuf0[
i] +64) >> 7;
971 if ((Y1 | Y2 |
U |
V) & 0x100) {
981 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
982 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
983 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
984 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
985 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
986 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
988 if ((Y1 | Y2 |
U |
V) & 0x100) {
1000 #undef output_pixels
1006 #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)
1007 #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)
1008 #define output_pixel(pos, val) \
1010 AV_WB16(pos, val); \
1012 AV_WL16(pos, val); \
1017 const int32_t **lumSrc,
int lumFilterSize,
1018 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
1019 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
1020 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1022 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1024 int hasAlpha = !!alpSrc;
1027 for (
i = 0;
i < dstW;
i++) {
1029 int Y = -0x40000000;
1032 for (j = 0; j < lumFilterSize; j++)
1033 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
1036 Y += (1<<3) + 0x8000;
1040 A = -0x40000000 + (1<<14);
1041 for (j = 0; j < lumFilterSize; j++)
1042 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
1057 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1058 int yalpha_param,
int unused_uvalpha,
int y,
1060 int unused_eightbytes,
int is_be)
1062 unsigned yalpha = yalpha_param;
1063 int hasAlpha = abuf && abuf[0] && abuf[1];
1064 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1065 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1066 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1067 unsigned yalpha1 = 4096 - yalpha;
1072 for (
i = 0;
i < dstW;
i++) {
1073 int Y = (int)(buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
1079 A = (int)(abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1091 const int32_t *abuf0, uint16_t *dest,
int dstW,
1093 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1095 int hasAlpha = !!abuf0;
1098 for (
i = 0;
i < dstW;
i++) {
1099 int Y = buf0[
i] >> 3;
1117 const int32_t **lumSrc,
int lumFilterSize,
1118 const int16_t *chrFilter,
const int32_t **chrUSrc,
1119 const int32_t **chrVSrc,
int chrFilterSize,
1120 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1121 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes,
1125 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1127 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1129 unsigned Y1 = -0x40000000;
1130 unsigned Y2 = -0x40000000;
1131 int U = -(128 << 23);
1132 int V = -(128 << 23);
1135 for (j = 0; j < lumFilterSize; j++) {
1136 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1137 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1139 for (j = 0; j < chrFilterSize; j++) {;
1140 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1141 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1147 for (j = 0; j < lumFilterSize; j++) {
1148 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1149 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1166 Y1 -=
c->yuv2rgb_y_offset;
1167 Y2 -=
c->yuv2rgb_y_offset;
1168 Y1 *=
c->yuv2rgb_y_coeff;
1169 Y2 *=
c->yuv2rgb_y_coeff;
1170 Y1 += (1 << 13) - (1 << 29);
1171 Y2 += (1 << 13) - (1 << 29);
1174 R =
V *
c->yuv2rgb_v2r_coeff;
1175 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1176 B =
U *
c->yuv2rgb_u2b_coeff;
1201 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1202 int yalpha_param,
int uvalpha_param,
int y,
1206 unsigned yalpha = yalpha_param;
1207 unsigned uvalpha = uvalpha_param;
1208 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1209 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1210 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1211 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1212 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1213 unsigned yalpha1 = 4096 - yalpha;
1214 unsigned uvalpha1 = 4096 - uvalpha;
1216 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1221 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1222 unsigned Y1 = (int)(buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1223 unsigned Y2 = (int)(buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1224 int U = (int)(ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1225 int V = (int)(vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1228 Y1 -=
c->yuv2rgb_y_offset;
1229 Y2 -=
c->yuv2rgb_y_offset;
1230 Y1 *=
c->yuv2rgb_y_coeff;
1231 Y2 *=
c->yuv2rgb_y_coeff;
1232 Y1 += (1 << 13) - (1 << 29);
1233 Y2 += (1 << 13) - (1 << 29);
1235 R =
V *
c->yuv2rgb_v2r_coeff;
1236 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1237 B =
U *
c->yuv2rgb_u2b_coeff;
1240 A1 = (int)(abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1241 A2 = (int)(abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1269 const int32_t *abuf0, uint16_t *dest,
int dstW,
1271 int hasAlpha,
int eightbytes,
int is_be)
1273 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1278 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1279 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1280 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1281 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1282 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1285 Y1 -=
c->yuv2rgb_y_offset;
1286 Y2 -=
c->yuv2rgb_y_offset;
1287 Y1 *=
c->yuv2rgb_y_coeff;
1288 Y2 *=
c->yuv2rgb_y_coeff;
1289 Y1 += (1 << 13) - (1 << 29);
1290 Y2 += (1 << 13) - (1 << 29);
1293 A1 = abuf0[
i * 2 ] * (
SUINT)(1 << 11);
1294 A2 = abuf0[
i * 2 + 1] * (
SUINT)(1 << 11);
1300 R =
V *
c->yuv2rgb_v2r_coeff;
1301 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1302 B =
U *
c->yuv2rgb_u2b_coeff;
1322 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1323 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1324 unsigned uvalpha1 = 4096 - uvalpha;
1327 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1328 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1329 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1330 SUINT U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1331 SUINT V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1334 Y1 -=
c->yuv2rgb_y_offset;
1335 Y2 -=
c->yuv2rgb_y_offset;
1336 Y1 *=
c->yuv2rgb_y_coeff;
1337 Y2 *=
c->yuv2rgb_y_coeff;
1338 Y1 += (1 << 13) - (1 << 29);
1339 Y2 += (1 << 13) - (1 << 29);
1342 A1 = abuf0[
i * 2 ] * (1 << 11);
1343 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1349 R =
V *
c->yuv2rgb_v2r_coeff;
1350 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1351 B =
U *
c->yuv2rgb_u2b_coeff;
1375 const int32_t **lumSrc,
int lumFilterSize,
1376 const int16_t *chrFilter,
const int32_t **chrUSrc,
1377 const int32_t **chrVSrc,
int chrFilterSize,
1378 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1380 int eightbytes,
int is_be)
1385 for (
i = 0;
i < dstW;
i++) {
1387 int Y = -0x40000000;
1388 int U = -(128 << 23);
1389 int V = -(128 << 23);
1392 for (j = 0; j < lumFilterSize; j++) {
1393 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1395 for (j = 0; j < chrFilterSize; j++) {;
1396 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1397 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1402 for (j = 0; j < lumFilterSize; j++) {
1403 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1416 Y -=
c->yuv2rgb_y_offset;
1417 Y *=
c->yuv2rgb_y_coeff;
1418 Y += (1 << 13) - (1<<29);
1421 R = (unsigned)
V *
c->yuv2rgb_v2r_coeff;
1422 G = (
unsigned)
V *
c->yuv2rgb_v2g_coeff + (unsigned)
U *
c->yuv2rgb_u2g_coeff;
1423 B = (
unsigned)
U *
c->yuv2rgb_u2b_coeff;
1441 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1442 int yalpha_param,
int uvalpha_param,
int y,
1446 unsigned yalpha = yalpha_param;
1447 unsigned uvalpha = uvalpha_param;
1448 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1449 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1450 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1451 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1452 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1453 unsigned yalpha1 = 4096 - yalpha;
1454 unsigned uvalpha1 = 4096 - uvalpha;
1461 for (
i = 0;
i < dstW;
i++) {
1462 unsigned Y = (int)(buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1463 unsigned U = (int)(ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1464 unsigned V = (int)(vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1467 Y -=
c->yuv2rgb_y_offset;
1468 Y *=
c->yuv2rgb_y_coeff;
1469 Y += (1 << 13) - (1 << 29);
1471 R =
V *
c->yuv2rgb_v2r_coeff;
1472 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1473 B =
U *
c->yuv2rgb_u2b_coeff;
1476 A = (int)(abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1496 const int32_t *abuf0, uint16_t *dest,
int dstW,
1498 int hasAlpha,
int eightbytes,
int is_be)
1500 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1505 for (
i = 0;
i < dstW;
i++) {
1507 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1508 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1511 Y -=
c->yuv2rgb_y_offset;
1512 Y *=
c->yuv2rgb_y_coeff;
1513 Y += (1 << 13) - (1 << 29);
1516 A = abuf0[
i] * (1 << 11);
1521 R =
V *
c->yuv2rgb_v2r_coeff;
1522 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1523 B =
U *
c->yuv2rgb_u2b_coeff;
1536 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1537 unsigned uvalpha1 = 4096 - uvalpha;
1541 for (
i = 0;
i < dstW;
i++) {
1543 SUINT U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1544 SUINT V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1547 Y -=
c->yuv2rgb_y_offset;
1548 Y *=
c->yuv2rgb_y_coeff;
1549 Y += (1 << 13) - (1 << 29);
1552 A = abuf0[
i] * (1 << 11);
1557 R =
V *
c->yuv2rgb_v2r_coeff;
1558 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1559 B =
U *
c->yuv2rgb_u2b_coeff;
1578 #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1579 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1580 const int16_t **_lumSrc, int lumFilterSize, \
1581 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1582 const int16_t **_chrVSrc, int chrFilterSize, \
1583 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1586 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1587 **chrUSrc = (const int32_t **) _chrUSrc, \
1588 **chrVSrc = (const int32_t **) _chrVSrc, \
1589 **alpSrc = (const int32_t **) _alpSrc; \
1590 uint16_t *dest = (uint16_t *) _dest; \
1591 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1596 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1597 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1598 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1599 int yalpha, int uvalpha, int y) \
1601 const int32_t **buf = (const int32_t **) _buf, \
1602 **ubuf = (const int32_t **) _ubuf, \
1603 **vbuf = (const int32_t **) _vbuf, \
1604 **abuf = (const int32_t **) _abuf; \
1605 uint16_t *dest = (uint16_t *) _dest; \
1606 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1610 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1611 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1612 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1613 int uvalpha, int y) \
1615 const int32_t *buf0 = (const int32_t *) _buf0, \
1616 **ubuf = (const int32_t **) _ubuf, \
1617 **vbuf = (const int32_t **) _vbuf, \
1618 *abuf0 = (const int32_t *) _abuf0; \
1619 uint16_t *dest = (uint16_t *) _dest; \
1620 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1623 #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1624 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1664 unsigned A1,
unsigned A2,
1665 const
void *_r, const
void *_g, const
void *_b,
int y,
1670 uint32_t *dest = (uint32_t *) _dest;
1671 const uint32_t *
r = (
const uint32_t *) _r;
1672 const uint32_t *
g = (
const uint32_t *) _g;
1673 const uint32_t *
b = (
const uint32_t *) _b;
1678 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1679 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1685 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1686 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1688 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1691 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1693 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1694 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1698 uint8_t *dest = (uint8_t *) _dest;
1699 const uint8_t *
r = (
const uint8_t *) _r;
1700 const uint8_t *
g = (
const uint8_t *) _g;
1701 const uint8_t *
b = (
const uint8_t *) _b;
1703 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1704 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1706 dest[
i * 6 + 0] =
r_b[Y1];
1707 dest[
i * 6 + 1] =
g[Y1];
1708 dest[
i * 6 + 2] =
b_r[Y1];
1709 dest[
i * 6 + 3] =
r_b[Y2];
1710 dest[
i * 6 + 4] =
g[Y2];
1711 dest[
i * 6 + 5] =
b_r[Y2];
1717 uint16_t *dest = (uint16_t *) _dest;
1718 const uint16_t *
r = (
const uint16_t *) _r;
1719 const uint16_t *
g = (
const uint16_t *) _g;
1720 const uint16_t *
b = (
const uint16_t *) _b;
1721 int dr1, dg1, db1, dr2, dg2, db2;
1746 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1747 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1749 uint32_t *dest = (uint32_t *) _dest;
1750 const uint32_t *
r = (
const uint32_t *) _r;
1751 const uint32_t *
g = (
const uint32_t *) _g;
1752 const uint32_t *
b = (
const uint32_t *) _b;
1753 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1754 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1756 uint8_t *dest = (uint8_t *) _dest;
1757 const uint8_t *
r = (
const uint8_t *) _r;
1758 const uint8_t *
g = (
const uint8_t *) _g;
1759 const uint8_t *
b = (
const uint8_t *) _b;
1760 int dr1, dg1, db1, dr2, dg2, db2;
1765 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1766 db1 = d64[(
i * 2 + 0) & 7];
1767 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1768 db2 = d64[(
i * 2 + 1) & 7];
1772 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1773 dg1 = d64[(
i * 2 + 0) & 7];
1774 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1775 dg2 = d64[(
i * 2 + 1) & 7];
1779 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1780 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1782 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1783 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1790 const int16_t **lumSrc,
int lumFilterSize,
1791 const int16_t *chrFilter,
const int16_t **chrUSrc,
1792 const int16_t **chrVSrc,
int chrFilterSize,
1793 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1798 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1804 const void *
r, *
g, *
b;
1806 for (j = 0; j < lumFilterSize; j++) {
1807 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1808 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1810 for (j = 0; j < chrFilterSize; j++) {
1811 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1812 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1821 for (j = 0; j < lumFilterSize; j++) {
1822 A1 += alpSrc[j][
i * 2 ] * (unsigned)lumFilter[j];
1823 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1827 if ((
A1 |
A2) & 0x100) {
1838 r,
g,
b, y, target, hasAlpha);
1844 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1845 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1846 int yalpha,
int uvalpha,
int y,
1849 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1850 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1851 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1852 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1853 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1854 int yalpha1 = 4096 - yalpha;
1855 int uvalpha1 = 4096 - uvalpha;
1860 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1861 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1862 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1863 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1864 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1871 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1872 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1878 r,
g,
b, y, target, hasAlpha);
1884 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1885 const int16_t *abuf0, uint8_t *dest,
int dstW,
1889 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1893 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1894 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1895 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1896 int U = (ubuf0[
i] + 64) >> 7;
1897 int V = (vbuf0[
i] + 64) >> 7;
1904 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1905 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1911 r,
g,
b, y, target, hasAlpha);
1914 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1915 int uvalpha1 = 4096 - uvalpha;
1918 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1919 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1920 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1921 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha + (128 << 11)) >> 19;
1922 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha + (128 << 11)) >> 19;
1929 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1930 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1936 r,
g,
b, y, target, hasAlpha);
1941 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1942 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1943 const int16_t **lumSrc, int lumFilterSize, \
1944 const int16_t *chrFilter, const int16_t **chrUSrc, \
1945 const int16_t **chrVSrc, int chrFilterSize, \
1946 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1949 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1954 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1955 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1956 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1957 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1958 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1959 int yalpha, int uvalpha, int y) \
1961 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1965 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1966 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1967 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1968 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1969 const int16_t *abuf0, uint8_t *dest, int dstW, \
1970 int uvalpha, int y) \
1972 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973 dstW, uvalpha, y, fmt, hasAlpha); \
1980 #if CONFIG_SWSCALE_ALPHA
1999 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
2005 Y -=
c->yuv2rgb_y_offset;
2006 Y *=
c->yuv2rgb_y_coeff;
2008 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
2009 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
2010 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
2011 if ((
R |
G |
B) & 0xC0000000) {
2019 dest[0] = hasAlpha ?
A : 255;
2033 dest[3] = hasAlpha ?
A : 255;
2036 dest[0] = hasAlpha ?
A : 255;
2050 dest[3] = hasAlpha ?
A : 255;
2056 AV_WL32(dest, (3
U << 30) + (
R << 20) + (
G << 10) +
B);
2062 AV_WL32(dest, (3
U << 30) + (
B << 20) + (
G << 10) +
R);
2071 switch (
c->opts.dither) {
2089 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;
2090 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;
2091 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;
2092 c->dither_error[0][
i] = err[0];
2093 c->dither_error[1][
i] = err[1];
2094 c->dither_error[2][
i] = err[2];
2095 r =
R >> (isrgb8 ? 5 : 7);
2096 g =
G >> (isrgb8 ? 5 : 6);
2097 b =
B >> (isrgb8 ? 6 : 7);
2101 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2102 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2103 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2108 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2127 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2147 dest[0] =
r + 2*
g + 8*
b;
2149 dest[0] =
b + 2*
g + 8*
r;
2151 dest[0] =
r + 8*
g + 64*
b;
2153 dest[0] =
b + 4*
g + 32*
r;
2162 const int16_t **lumSrc,
int lumFilterSize,
2163 const int16_t *chrFilter,
const int16_t **chrUSrc,
2164 const int16_t **chrVSrc,
int chrFilterSize,
2165 const int16_t **alpSrc, uint8_t *dest,
2177 for (
i = 0;
i < dstW;
i++) {
2180 int U = (1<<9)-(128 << 19);
2181 int V = (1<<9)-(128 << 19);
2183 for (j = 0; j < lumFilterSize; j++) {
2184 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
2186 for (j = 0; j < chrFilterSize; j++) {
2187 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2188 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2195 for (j = 0; j < lumFilterSize; j++) {
2196 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
2202 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2205 c->dither_error[0][
i] = err[0];
2206 c->dither_error[1][
i] = err[1];
2207 c->dither_error[2][
i] = err[2];
2212 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2213 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2214 int yalpha,
int uvalpha,
int y,
2217 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2218 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2219 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2220 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2221 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2222 int yalpha1 = 4096 - yalpha;
2223 int uvalpha1 = 4096 - uvalpha;
2236 for (
i = 0;
i < dstW;
i++) {
2237 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2238 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2239 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2242 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2247 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2250 c->dither_error[0][
i] = err[0];
2251 c->dither_error[1][
i] = err[1];
2252 c->dither_error[2][
i] = err[2];
2257 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2258 const int16_t *abuf0, uint8_t *dest,
int dstW,
2262 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2273 for (
i = 0;
i < dstW;
i++) {
2274 int Y = buf0[
i] * 4;
2275 int U = (ubuf0[
i] - (128<<7)) * 4;
2276 int V = (vbuf0[
i] - (128<<7)) * 4;
2279 A = (abuf0[
i] + 64) >> 7;
2284 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2288 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2290 int uvalpha1 = 4096 - uvalpha;
2293 for (
i = 0;
i < dstW;
i++) {
2294 int Y = buf0[
i] * 4;
2295 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 19)) >> 10;
2296 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 19)) >> 10;
2299 A = (abuf0[
i] + 64) >> 7;
2304 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2309 c->dither_error[0][
i] = err[0];
2310 c->dither_error[1][
i] = err[1];
2311 c->dither_error[2][
i] = err[2];
2320 #if CONFIG_SWSCALE_ALPHA
2344 const int16_t **lumSrc,
int lumFilterSize,
2345 const int16_t *chrFilter, const int16_t **chrUSrc,
2346 const int16_t **chrVSrc,
int chrFilterSize,
2347 const int16_t **alpSrc, uint8_t **dest,
2353 uint16_t **dest16 = (uint16_t**)dest;
2354 int SH = 22 + 8 -
desc->comp[0].depth;
2357 for (
i = 0;
i < dstW;
i++) {
2360 int U = (1 << 9) - (128 << 19);
2361 int V = (1 << 9) - (128 << 19);
2364 for (j = 0; j < lumFilterSize; j++)
2365 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2367 for (j = 0; j < chrFilterSize; j++) {
2368 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2369 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2379 for (j = 0; j < lumFilterSize; j++)
2380 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2386 Y -=
c->yuv2rgb_y_offset;
2387 Y *=
c->yuv2rgb_y_coeff;
2389 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2390 G =
Y +
V * (
unsigned)
c->yuv2rgb_v2g_coeff +
U * (unsigned)
c->yuv2rgb_u2g_coeff;
2391 B =
Y +
U * (
unsigned)
c->yuv2rgb_u2b_coeff;
2393 if ((
R |
G |
B) & 0xC0000000) {
2400 dest16[0][
i] =
G >>
SH;
2401 dest16[1][
i] =
B >>
SH;
2402 dest16[2][
i] =
R >>
SH;
2404 dest16[3][
i] =
A >> (
SH - 3);
2406 dest[0][
i] =
G >> 22;
2407 dest[1][
i] =
B >> 22;
2408 dest[2][
i] =
R >> 22;
2410 dest[3][
i] =
A >> 19;
2413 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2414 for (
i = 0;
i < dstW;
i++) {
2426 const int16_t **lumSrc,
int lumFilterSize,
2427 const int16_t *chrFilter,
const int16_t **chrUSrc,
2428 const int16_t **chrVSrc,
int chrFilterSize,
2429 const int16_t **alpSrc, uint8_t **dest,
2434 uint16_t **dest16 = (uint16_t**)dest;
2439 chrFilter, chrUSrc, chrVSrc, chrFilterSize,
2440 alpSrc, dest, dstW, y);
2442 if (
desc->comp[0].depth <= 8)
2445 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2446 for (
i = 0;
i < dstW;
i++) {
2454 for (
i = 0;
i < dstW;
i++) {
2455 dest16[0][
i] = dest16[0][
i] <<
shift;
2456 dest16[1][
i] = dest16[1][
i] <<
shift;
2457 dest16[2][
i] = dest16[2][
i] <<
shift;
2459 dest16[3][
i] = dest16[3][
i] <<
shift;
2466 const int16_t **lumSrcx,
int lumFilterSize,
2467 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2468 const int16_t **chrVSrcx,
int chrFilterSize,
2469 const int16_t **alpSrcx, uint8_t **dest,
2475 uint16_t **dest16 = (uint16_t**)dest;
2481 for (
i = 0;
i < dstW;
i++) {
2483 int Y = -0x40000000;
2484 int U = -(128 << 23);
2485 int V = -(128 << 23);
2488 for (j = 0; j < lumFilterSize; j++)
2489 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2491 for (j = 0; j < chrFilterSize; j++) {
2492 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2493 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2504 for (j = 0; j < lumFilterSize; j++)
2505 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2511 Y -=
c->yuv2rgb_y_offset;
2512 Y *=
c->yuv2rgb_y_coeff;
2513 Y += (1 << 13) - (1 << 29);
2514 R =
V *
c->yuv2rgb_v2r_coeff;
2515 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2516 B =
U *
c->yuv2rgb_u2b_coeff;
2525 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2526 for (
i = 0;
i < dstW;
i++) {
2538 const int16_t **lumSrcx,
int lumFilterSize,
2539 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2540 const int16_t **chrVSrcx,
int chrFilterSize,
2541 const int16_t **alpSrcx, uint8_t **dest,
2547 uint32_t **dest32 = (uint32_t**)dest;
2552 static const float float_mult = 1.0f / 65535.0f;
2554 for (
i = 0;
i < dstW;
i++) {
2556 int Y = -0x40000000;
2557 int U = -(128 << 23);
2558 int V = -(128 << 23);
2561 for (j = 0; j < lumFilterSize; j++)
2562 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2564 for (j = 0; j < chrFilterSize; j++) {
2565 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2566 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2577 for (j = 0; j < lumFilterSize; j++)
2578 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2584 Y -=
c->yuv2rgb_y_offset;
2585 Y *=
c->yuv2rgb_y_coeff;
2586 Y += (1 << 13) - (1 << 29);
2587 R =
V *
c->yuv2rgb_v2r_coeff;
2588 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2589 B =
U *
c->yuv2rgb_u2b_coeff;
2601 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2602 for (
i = 0;
i < dstW;
i++) {
2614 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2615 const int16_t *abuf0, uint8_t *dest,
int dstW,
2618 int hasAlpha = !!abuf0;
2621 for (
i = 0;
i < dstW;
i++) {
2622 int Y = (buf0[
i] + 64) >> 7;
2628 A = (abuf0[
i] + 64) >> 7;
2634 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2640 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2641 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2642 int yalpha,
int uvalpha,
int y)
2644 int hasAlpha = abuf && abuf[0] && abuf[1];
2645 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2646 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2647 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2648 int yalpha1 = 4096 - yalpha;
2653 for (
i = 0;
i < dstW;
i++) {
2654 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2660 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2665 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2671 const int16_t **lumSrc,
int lumFilterSize,
2672 const int16_t *chrFilter,
const int16_t **chrUSrc,
2673 const int16_t **chrVSrc,
int chrFilterSize,
2674 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2676 int hasAlpha = !!alpSrc;
2679 for (
i = 0;
i < dstW;
i++) {
2681 int Y = 1 << 18,
A = 1 << 18;
2683 for (j = 0; j < lumFilterSize; j++)
2684 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2691 for (j = 0; j < lumFilterSize; j++)
2692 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2701 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2705 #define output_pixels(pos, val) \
2707 AV_WB16(pos, val); \
2709 AV_WL16(pos, val); \
2714 const int16_t **_lumSrc,
int lumFilterSize,
2715 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2716 const int16_t **_chrVSrc,
int chrFilterSize,
2717 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2718 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2721 **chrUSrc = (
const int32_t **) _chrUSrc,
2722 **chrVSrc = (
const int32_t **) _chrVSrc,
2723 **alpSrc = (
const int32_t **) _alpSrc;
2724 int hasAlpha = !!alpSrc;
2727 for (
i = 0;
i < dstW;
i++) {
2728 int Y = 1 << 14,
U = 1 << 14;
2729 int V = 1 << 14,
A = 1 << 14;
2737 for (j = 0; j < lumFilterSize; j++)
2738 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2740 for (j = 0; j < chrFilterSize; j++)
2741 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2743 for (j = 0; j < chrFilterSize; j++)
2744 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2747 for (j = 0; j < lumFilterSize; j++)
2748 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2763 #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2765 yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2766 const int16_t **lumSrc, int lumFilterSize, \
2767 const int16_t *chrFilter, const int16_t **chrUSrc, \
2768 const int16_t **chrVSrc, int chrFilterSize, \
2769 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2771 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2782 #undef output_pixels
2786 const int16_t **lumSrc,
int lumFilterSize,
2787 const int16_t *chrFilter,
const int16_t **chrUSrc,
2788 const int16_t **chrVSrc,
int chrFilterSize,
2789 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2793 for (
i = 0;
i < dstW;
i++) {
2794 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2797 for (j = 0; j < lumFilterSize; j++)
2798 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2800 for (j = 0; j < chrFilterSize; j++) {
2801 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2802 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2811 (
unsigned)
V << (
shift + 20) |
2812 (
unsigned)
A << (
shift ? 0 : 30 ));
2816 #define V30LE_WRAPPER(name, shift) \
2817 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2818 const int16_t **lumSrc, int lumFilterSize, \
2819 const int16_t *chrFilter, const int16_t **chrUSrc, \
2820 const int16_t **chrVSrc, int chrFilterSize, \
2821 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2824 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2825 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2826 alpSrc, dest, dstW, y, shift); \
2832 #define output_pixels(pos, val, shift, bits, output_shift) \
2834 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2836 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2841 const int16_t **lumSrc,
int lumFilterSize,
2842 const int16_t *chrFilter,
const int16_t **chrUSrc,
2843 const int16_t **chrVSrc,
int chrFilterSize,
2844 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2847 for (
i = 0;
i < dstW;
i++) {
2848 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2851 for (j = 0; j < lumFilterSize; j++)
2852 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2854 for (j = 0; j < chrFilterSize; j++) {
2855 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2856 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2866 #undef output_pixels
2868 #define YUV2XV36(BE_LE, is_be) \
2870 yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2871 const int16_t **lumSrc, int lumFilterSize, \
2872 const int16_t *chrFilter, const int16_t **chrUSrc, \
2873 const int16_t **chrVSrc, int chrFilterSize, \
2874 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2876 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2877 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2878 alpSrc, dest, dstW, y, is_be); \
2884 #define output_pixels(pos, A, Y, U, V) \
2885 if (target == AV_PIX_FMT_AYUV) { \
2886 dest[pos + 0] = A; \
2887 dest[pos + 1] = Y; \
2888 dest[pos + 2] = U; \
2889 dest[pos + 3] = V; \
2890 } else if (target == AV_PIX_FMT_UYVA) { \
2891 dest[pos + 0] = U; \
2892 dest[pos + 1] = Y; \
2893 dest[pos + 2] = V; \
2894 dest[pos + 3] = A; \
2896 dest[pos + 0] = V; \
2897 dest[pos + 1] = U; \
2898 dest[pos + 2] = Y; \
2899 dest[pos + 3] = A; \
2904 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2905 const int16_t *abuf0, uint8_t *dest,
int dstW,
2908 int hasAlpha = !!abuf0;
2911 if (uvalpha < 2048) {
2912 for (
i = 0;
i < dstW;
i++) {
2913 int Y = (buf0[
i] + 64) >> 7;
2914 int U = (ubuf[0][
i] + 64) >> 7;
2915 int V = (vbuf[0][
i] + 64) >> 7;
2926 A = (abuf0[
i] + 64) >> 7;
2934 for (
i = 0;
i < dstW;
i++) {
2935 int Y = (buf0[
i] + 64) >> 7;
2936 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2937 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2948 A = (abuf0[
i] + 64) >> 7;
2960 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2961 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2962 int yalpha,
int uvalpha,
int y,
2965 int hasAlpha = abuf && abuf[0] && abuf[1];
2966 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2967 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2968 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2969 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2970 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2971 int yalpha1 = 4096 - yalpha;
2972 int uvalpha1 = 4096 - uvalpha;
2978 for (
i = 0;
i < dstW;
i++) {
2979 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2980 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2981 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2992 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
3002 const int16_t **lumSrc,
int lumFilterSize,
3003 const int16_t *chrFilter,
const int16_t **chrUSrc,
3004 const int16_t **chrVSrc,
int chrFilterSize,
3005 const int16_t **alpSrc, uint8_t *dest,
int dstW,
3010 for (
i = 0;
i < dstW;
i++) {
3012 int Y = 1 << 18,
U = 1 << 18;
3013 int V = 1 << 18,
A = 255;
3015 for (j = 0; j < lumFilterSize; j++)
3016 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
3018 for (j = 0; j < chrFilterSize; j++)
3019 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
3021 for (j = 0; j < chrFilterSize; j++)
3022 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
3038 for (j = 0; j < lumFilterSize; j++)
3039 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
3051 #undef output_pixels
3053 #define AYUVPACKEDWRAPPER(name, fmt) \
3054 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
3055 const int16_t **lumSrc, int lumFilterSize, \
3056 const int16_t *chrFilter, const int16_t **chrUSrc, \
3057 const int16_t **chrVSrc, int chrFilterSize, \
3058 const int16_t **alpSrc, uint8_t *dest, int dstW, \
3061 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3062 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3063 alpSrc, dest, dstW, y, fmt); \
3066 static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
3067 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3068 const int16_t *abuf[2], uint8_t *dest, int dstW, \
3069 int yalpha, int uvalpha, int y) \
3071 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3072 dest, dstW, yalpha, uvalpha, y, fmt); \
3075 static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
3076 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3077 const int16_t *abuf0, uint8_t *dest, int dstW, \
3078 int uvalpha, int y) \
3080 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3081 abuf0, dest, dstW, uvalpha, \
3089 #define output_pixel(pos, val, bits) \
3090 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
3092 #define yuv2y2xx_wrapper(bits) \
3094 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
3095 const int16_t **lumSrc, int lumFilterSize, \
3096 const int16_t *chrFilter, \
3097 const int16_t **chrUSrc, \
3098 const int16_t **chrVSrc, int chrFilterSize, \
3099 const int16_t **alpSrc, \
3100 uint8_t *dest, int dstW, int y) \
3103 int shift = 11 + 16 - bits; \
3104 int output_shift = 16 - bits; \
3105 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
3106 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
3107 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
3109 for (j = 0; j < lumFilterSize; j++) { \
3110 Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; \
3111 Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; \
3114 for (j = 0; j < chrFilterSize; j++) { \
3115 U += chrUSrc[j][i] * (unsigned)chrFilter[j]; \
3116 V += chrVSrc[j][i] * (unsigned)chrFilter[j]; \
3119 output_pixel(dest + 8 * i + 0, Y1, bits); \
3120 output_pixel(dest + 8 * i + 2, U, bits); \
3121 output_pixel(dest + 8 * i + 4, Y2, bits); \
3122 output_pixel(dest + 8 * i + 6, V, bits); \
3130 yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3131 const int16_t **_lumSrc,
int lumFilterSize,
3132 const int16_t *chrFilter,
3133 const int16_t **_chrUSrc,
3134 const int16_t **_chrVSrc,
int chrFilterSize,
3135 const int16_t **_alpSrc,
3136 uint8_t *dest,
int dstW,
int y)
3143 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3144 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3153 for (
int j = 0; j < lumFilterSize; j++) {
3154 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3155 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3158 for (
int j = 0; j < chrFilterSize; j++) {
3159 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3160 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3172 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3173 const int16_t *abuf0, uint8_t *dest,
int dstW,
3178 if (uvalpha < 2048) {
3179 for (
i = 0;
i < dstW;
i++) {
3180 int Y = (buf0[
i] + 64) >> 7;
3181 int U = (ubuf[0][
i] + 64) >> 7;
3182 int V = (vbuf[0][
i] + 64) >> 7;
3192 dest[3 *
i + 1] =
Y;
3193 dest[3 *
i + 2] =
U;
3196 for (
i = 0;
i < dstW;
i++) {
3197 int Y = (buf0[
i] + 64) >> 7;
3198 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3199 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3209 dest[3 *
i + 1] =
Y;
3210 dest[3 *
i + 2] =
U;
3217 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3218 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3219 int yalpha,
int uvalpha,
int y)
3221 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3222 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3223 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3224 int yalpha1 = 4096 - yalpha;
3225 int uvalpha1 = 4096 - uvalpha;
3231 for (
i = 0;
i < dstW;
i++) {
3232 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3233 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3234 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3244 dest[3 *
i + 1] =
Y;
3245 dest[3 *
i + 2] =
U;
3251 const int16_t **lumSrc,
int lumFilterSize,
3252 const int16_t *chrFilter,
const int16_t **chrUSrc,
3253 const int16_t **chrVSrc,
int chrFilterSize,
3254 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3258 for (
i = 0;
i < dstW;
i++) {
3260 int Y = 1 << 18,
U = 1 << 18;
3263 for (j = 0; j < lumFilterSize; j++)
3264 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
3266 for (j = 0; j < chrFilterSize; j++)
3267 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
3269 for (j = 0; j < chrFilterSize; j++)
3270 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
3284 dest[3 *
i + 1] =
Y;
3285 dest[3 *
i + 2] =
U;
3304 if (
desc->comp[0].depth == 10) {
3305 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3306 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3307 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3308 }
else if (
desc->comp[0].depth == 12) {
3309 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3310 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3311 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3315 if (
desc->comp[0].depth == 10) {
3316 *yuv2plane1 =
isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3317 *
yuv2planeX =
isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3318 *yuv2nv12cX =
isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3321 }
else if (
is16BPS(dstFormat)) {
3322 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3323 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3328 if (
desc->comp[0].depth == 10) {
3329 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_10BE_c : yuv2msbplaneX_10LE_c;
3330 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_10BE_c : yuv2msbplane1_10LE_c;
3331 }
else if (
desc->comp[0].depth == 12) {
3332 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_12BE_c : yuv2msbplaneX_12LE_c;
3333 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_12BE_c : yuv2msbplane1_12LE_c;
3336 }
else if (
isNBPS(dstFormat)) {
3337 if (
desc->comp[0].depth == 9) {
3338 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3339 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3340 }
else if (
desc->comp[0].depth == 10) {
3341 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3342 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3343 }
else if (
desc->comp[0].depth == 12) {
3344 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3345 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3346 }
else if (
desc->comp[0].depth == 14) {
3347 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3348 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3353 *yuv2plane1 = yuv2plane1_floatBE_c;
3356 *yuv2plane1 = yuv2plane1_floatLE_c;
3365 switch (dstFormat) {
3368 *yuv2packedX = yuv2rgba32_full_X_c;
3369 *yuv2packed2 = yuv2rgba32_full_2_c;
3370 *yuv2packed1 = yuv2rgba32_full_1_c;
3372 #if CONFIG_SWSCALE_ALPHA
3374 *yuv2packedX = yuv2rgba32_full_X_c;
3375 *yuv2packed2 = yuv2rgba32_full_2_c;
3376 *yuv2packed1 = yuv2rgba32_full_1_c;
3380 *yuv2packedX = yuv2rgbx32_full_X_c;
3381 *yuv2packed2 = yuv2rgbx32_full_2_c;
3382 *yuv2packed1 = yuv2rgbx32_full_1_c;
3388 *yuv2packedX = yuv2argb32_full_X_c;
3389 *yuv2packed2 = yuv2argb32_full_2_c;
3390 *yuv2packed1 = yuv2argb32_full_1_c;
3392 #if CONFIG_SWSCALE_ALPHA
3394 *yuv2packedX = yuv2argb32_full_X_c;
3395 *yuv2packed2 = yuv2argb32_full_2_c;
3396 *yuv2packed1 = yuv2argb32_full_1_c;
3400 *yuv2packedX = yuv2xrgb32_full_X_c;
3401 *yuv2packed2 = yuv2xrgb32_full_2_c;
3402 *yuv2packed1 = yuv2xrgb32_full_1_c;
3408 *yuv2packedX = yuv2bgra32_full_X_c;
3409 *yuv2packed2 = yuv2bgra32_full_2_c;
3410 *yuv2packed1 = yuv2bgra32_full_1_c;
3412 #if CONFIG_SWSCALE_ALPHA
3414 *yuv2packedX = yuv2bgra32_full_X_c;
3415 *yuv2packed2 = yuv2bgra32_full_2_c;
3416 *yuv2packed1 = yuv2bgra32_full_1_c;
3420 *yuv2packedX = yuv2bgrx32_full_X_c;
3421 *yuv2packed2 = yuv2bgrx32_full_2_c;
3422 *yuv2packed1 = yuv2bgrx32_full_1_c;
3428 *yuv2packedX = yuv2abgr32_full_X_c;
3429 *yuv2packed2 = yuv2abgr32_full_2_c;
3430 *yuv2packed1 = yuv2abgr32_full_1_c;
3432 #if CONFIG_SWSCALE_ALPHA
3434 *yuv2packedX = yuv2abgr32_full_X_c;
3435 *yuv2packed2 = yuv2abgr32_full_2_c;
3436 *yuv2packed1 = yuv2abgr32_full_1_c;
3440 *yuv2packedX = yuv2xbgr32_full_X_c;
3441 *yuv2packed2 = yuv2xbgr32_full_2_c;
3442 *yuv2packed1 = yuv2xbgr32_full_1_c;
3447 #if CONFIG_SWSCALE_ALPHA
3449 *yuv2packedX = yuv2rgba64le_full_X_c;
3450 *yuv2packed2 = yuv2rgba64le_full_2_c;
3451 *yuv2packed1 = yuv2rgba64le_full_1_c;
3455 *yuv2packedX = yuv2rgbx64le_full_X_c;
3456 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3457 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3461 #if CONFIG_SWSCALE_ALPHA
3463 *yuv2packedX = yuv2rgba64be_full_X_c;
3464 *yuv2packed2 = yuv2rgba64be_full_2_c;
3465 *yuv2packed1 = yuv2rgba64be_full_1_c;
3469 *yuv2packedX = yuv2rgbx64be_full_X_c;
3470 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3471 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3475 #if CONFIG_SWSCALE_ALPHA
3477 *yuv2packedX = yuv2bgra64le_full_X_c;
3478 *yuv2packed2 = yuv2bgra64le_full_2_c;
3479 *yuv2packed1 = yuv2bgra64le_full_1_c;
3483 *yuv2packedX = yuv2bgrx64le_full_X_c;
3484 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3485 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3489 #if CONFIG_SWSCALE_ALPHA
3491 *yuv2packedX = yuv2bgra64be_full_X_c;
3492 *yuv2packed2 = yuv2bgra64be_full_2_c;
3493 *yuv2packed1 = yuv2bgra64be_full_1_c;
3497 *yuv2packedX = yuv2bgrx64be_full_X_c;
3498 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3499 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3504 *yuv2packedX = yuv2rgb24_full_X_c;
3505 *yuv2packed2 = yuv2rgb24_full_2_c;
3506 *yuv2packed1 = yuv2rgb24_full_1_c;
3509 *yuv2packedX = yuv2bgr24_full_X_c;
3510 *yuv2packed2 = yuv2bgr24_full_2_c;
3511 *yuv2packed1 = yuv2bgr24_full_1_c;
3514 *yuv2packedX = yuv2rgb48le_full_X_c;
3515 *yuv2packed2 = yuv2rgb48le_full_2_c;
3516 *yuv2packed1 = yuv2rgb48le_full_1_c;
3519 *yuv2packedX = yuv2bgr48le_full_X_c;
3520 *yuv2packed2 = yuv2bgr48le_full_2_c;
3521 *yuv2packed1 = yuv2bgr48le_full_1_c;
3524 *yuv2packedX = yuv2rgb48be_full_X_c;
3525 *yuv2packed2 = yuv2rgb48be_full_2_c;
3526 *yuv2packed1 = yuv2rgb48be_full_1_c;
3529 *yuv2packedX = yuv2bgr48be_full_X_c;
3530 *yuv2packed2 = yuv2bgr48be_full_2_c;
3531 *yuv2packed1 = yuv2bgr48be_full_1_c;
3534 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3535 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3536 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3539 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3540 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3541 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3544 *yuv2packedX = yuv2bgr8_full_X_c;
3545 *yuv2packed2 = yuv2bgr8_full_2_c;
3546 *yuv2packed1 = yuv2bgr8_full_1_c;
3549 *yuv2packedX = yuv2rgb8_full_X_c;
3550 *yuv2packed2 = yuv2rgb8_full_2_c;
3551 *yuv2packed1 = yuv2rgb8_full_1_c;
3554 *yuv2packedX = yuv2x2rgb10_full_X_c;
3555 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3556 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3559 *yuv2packedX = yuv2x2bgr10_full_X_c;
3560 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3561 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3600 if (!*yuv2packedX && !*yuv2anyX)
3604 switch (dstFormat) {
3606 #if CONFIG_SWSCALE_ALPHA
3608 *yuv2packed1 = yuv2rgba64le_1_c;
3609 *yuv2packed2 = yuv2rgba64le_2_c;
3610 *yuv2packedX = yuv2rgba64le_X_c;
3614 *yuv2packed1 = yuv2rgbx64le_1_c;
3615 *yuv2packed2 = yuv2rgbx64le_2_c;
3616 *yuv2packedX = yuv2rgbx64le_X_c;
3620 #if CONFIG_SWSCALE_ALPHA
3622 *yuv2packed1 = yuv2rgba64be_1_c;
3623 *yuv2packed2 = yuv2rgba64be_2_c;
3624 *yuv2packedX = yuv2rgba64be_X_c;
3628 *yuv2packed1 = yuv2rgbx64be_1_c;
3629 *yuv2packed2 = yuv2rgbx64be_2_c;
3630 *yuv2packedX = yuv2rgbx64be_X_c;
3634 #if CONFIG_SWSCALE_ALPHA
3636 *yuv2packed1 = yuv2bgra64le_1_c;
3637 *yuv2packed2 = yuv2bgra64le_2_c;
3638 *yuv2packedX = yuv2bgra64le_X_c;
3642 *yuv2packed1 = yuv2bgrx64le_1_c;
3643 *yuv2packed2 = yuv2bgrx64le_2_c;
3644 *yuv2packedX = yuv2bgrx64le_X_c;
3648 #if CONFIG_SWSCALE_ALPHA
3650 *yuv2packed1 = yuv2bgra64be_1_c;
3651 *yuv2packed2 = yuv2bgra64be_2_c;
3652 *yuv2packedX = yuv2bgra64be_X_c;
3656 *yuv2packed1 = yuv2bgrx64be_1_c;
3657 *yuv2packed2 = yuv2bgrx64be_2_c;
3658 *yuv2packedX = yuv2bgrx64be_X_c;
3662 *yuv2packed1 = yuv2rgb48le_1_c;
3663 *yuv2packed2 = yuv2rgb48le_2_c;
3664 *yuv2packedX = yuv2rgb48le_X_c;
3667 *yuv2packed1 = yuv2rgb48be_1_c;
3668 *yuv2packed2 = yuv2rgb48be_2_c;
3669 *yuv2packedX = yuv2rgb48be_X_c;
3672 *yuv2packed1 = yuv2bgr48le_1_c;
3673 *yuv2packed2 = yuv2bgr48le_2_c;
3674 *yuv2packedX = yuv2bgr48le_X_c;
3677 *yuv2packed1 = yuv2bgr48be_1_c;
3678 *yuv2packed2 = yuv2bgr48be_2_c;
3679 *yuv2packedX = yuv2bgr48be_X_c;
3684 *yuv2packed1 = yuv2rgb32_1_c;
3685 *yuv2packed2 = yuv2rgb32_2_c;
3686 *yuv2packedX = yuv2rgb32_X_c;
3688 #if CONFIG_SWSCALE_ALPHA
3690 *yuv2packed1 = yuv2rgba32_1_c;
3691 *yuv2packed2 = yuv2rgba32_2_c;
3692 *yuv2packedX = yuv2rgba32_X_c;
3696 *yuv2packed1 = yuv2rgbx32_1_c;
3697 *yuv2packed2 = yuv2rgbx32_2_c;
3698 *yuv2packedX = yuv2rgbx32_X_c;
3705 *yuv2packed1 = yuv2rgb32_1_1_c;
3706 *yuv2packed2 = yuv2rgb32_1_2_c;
3707 *yuv2packedX = yuv2rgb32_1_X_c;
3709 #if CONFIG_SWSCALE_ALPHA
3711 *yuv2packed1 = yuv2rgba32_1_1_c;
3712 *yuv2packed2 = yuv2rgba32_1_2_c;
3713 *yuv2packedX = yuv2rgba32_1_X_c;
3717 *yuv2packed1 = yuv2rgbx32_1_1_c;
3718 *yuv2packed2 = yuv2rgbx32_1_2_c;
3719 *yuv2packedX = yuv2rgbx32_1_X_c;
3724 *yuv2packed1 = yuv2rgb24_1_c;
3725 *yuv2packed2 = yuv2rgb24_2_c;
3726 *yuv2packedX = yuv2rgb24_X_c;
3729 *yuv2packed1 = yuv2bgr24_1_c;
3730 *yuv2packed2 = yuv2bgr24_2_c;
3731 *yuv2packedX = yuv2bgr24_X_c;
3737 *yuv2packed1 = yuv2rgb16_1_c;
3738 *yuv2packed2 = yuv2rgb16_2_c;
3739 *yuv2packedX = yuv2rgb16_X_c;
3745 *yuv2packed1 = yuv2rgb15_1_c;
3746 *yuv2packed2 = yuv2rgb15_2_c;
3747 *yuv2packedX = yuv2rgb15_X_c;
3753 *yuv2packed1 = yuv2rgb12_1_c;
3754 *yuv2packed2 = yuv2rgb12_2_c;
3755 *yuv2packedX = yuv2rgb12_X_c;
3759 *yuv2packed1 = yuv2rgb8_1_c;
3760 *yuv2packed2 = yuv2rgb8_2_c;
3761 *yuv2packedX = yuv2rgb8_X_c;
3765 *yuv2packed1 = yuv2rgb4_1_c;
3766 *yuv2packed2 = yuv2rgb4_2_c;
3767 *yuv2packedX = yuv2rgb4_X_c;
3771 *yuv2packed1 = yuv2rgb4b_1_c;
3772 *yuv2packed2 = yuv2rgb4b_2_c;
3773 *yuv2packedX = yuv2rgb4b_X_c;
3777 *yuv2packed1 = yuv2x2rgb10_1_c;
3778 *yuv2packed2 = yuv2x2rgb10_2_c;
3779 *yuv2packedX = yuv2x2rgb10_X_c;
3783 *yuv2packed1 = yuv2x2bgr10_1_c;
3784 *yuv2packed2 = yuv2x2bgr10_2_c;
3785 *yuv2packedX = yuv2x2bgr10_X_c;
3789 switch (dstFormat) {
3791 *yuv2packed1 = yuv2monowhite_1_c;
3792 *yuv2packed2 = yuv2monowhite_2_c;
3793 *yuv2packedX = yuv2monowhite_X_c;
3796 *yuv2packed1 = yuv2monoblack_1_c;
3797 *yuv2packed2 = yuv2monoblack_2_c;
3798 *yuv2packedX = yuv2monoblack_X_c;
3801 *yuv2packed1 = yuv2yuyv422_1_c;
3802 *yuv2packed2 = yuv2yuyv422_2_c;
3803 *yuv2packedX = yuv2yuyv422_X_c;
3806 *yuv2packed1 = yuv2yvyu422_1_c;
3807 *yuv2packed2 = yuv2yvyu422_2_c;
3808 *yuv2packedX = yuv2yvyu422_X_c;
3811 *yuv2packed1 = yuv2uyvy422_1_c;
3812 *yuv2packed2 = yuv2uyvy422_2_c;
3813 *yuv2packedX = yuv2uyvy422_X_c;
3826 *yuv2packed1 = yuv2ya16le_1_c;
3827 *yuv2packed2 = yuv2ya16le_2_c;
3828 *yuv2packedX = yuv2ya16le_X_c;
3831 *yuv2packed1 = yuv2ya16be_1_c;
3832 *yuv2packed2 = yuv2ya16be_2_c;
3833 *yuv2packedX = yuv2ya16be_X_c;
3836 *yuv2packedX = yuv2v30xle_X_c;
3839 *yuv2packedX = yuv2ayuv64le_X_c;
3842 *yuv2packedX = yuv2ayuv64be_X_c;
3845 *yuv2packed1 = yuv2ayuv_1_c;
3846 *yuv2packed2 = yuv2ayuv_2_c;
3847 *yuv2packedX = yuv2ayuv_X_c;
3851 *yuv2packed1 = yuv2vuyX_1_c;
3852 *yuv2packed2 = yuv2vuyX_2_c;
3853 *yuv2packedX = yuv2vuyX_X_c;
3856 *yuv2packed1 = yuv2uyva_1_c;
3857 *yuv2packed2 = yuv2uyva_2_c;
3858 *yuv2packedX = yuv2uyva_X_c;
3861 *yuv2packedX = yuv2xv30le_X_c;
3864 *yuv2packedX = yuv2xv36le_X_c;
3867 *yuv2packedX = yuv2xv36be_X_c;
3870 *yuv2packedX = yuv2xv48le_X_c;
3873 *yuv2packedX = yuv2xv48be_X_c;
3876 *yuv2packedX = yuv2y210le_X_c;
3879 *yuv2packedX = yuv2y212le_X_c;
3882 *yuv2packedX = yuv2y216le_X_c;