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++)
487 for (
i=0;
i<dstW;
i++) {
494 const int16_t *chrFilter,
int chrFilterSize,
495 const int16_t **chrUSrc,
const int16_t **chrVSrc,
496 uint8_t *dest,
int chrDstW)
501 for (
i=0;
i<chrDstW;
i++) {
502 int u = chrDither[
i & 7] << 12;
503 int v = chrDither[(
i + 3) & 7] << 12;
505 for (j=0; j<chrFilterSize; j++) {
506 u += chrUSrc[j][
i] * chrFilter[j];
507 v += chrVSrc[j][
i] * chrFilter[j];
514 for (
i=0;
i<chrDstW;
i++) {
515 int u = chrDither[
i & 7] << 12;
516 int v = chrDither[(
i + 3) & 7] << 12;
518 for (j=0; j<chrFilterSize; j++) {
519 u += chrUSrc[j][
i] * chrFilter[j];
520 v += chrVSrc[j][
i] * chrFilter[j];
529 #define output_pixel(pos, val) \
531 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
533 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
537 uint16_t *dest,
int dstW,
538 int big_endian,
int output_bits,
int output_shift)
541 int shift = 15 - output_bits;
543 for (
i = 0;
i < dstW;
i++) {
550 const int16_t **
src, uint16_t *dest,
int dstW,
551 int big_endian,
int output_bits,
int output_shift)
554 int shift = 11 + 16 - output_bits;
556 for (
i = 0;
i < dstW;
i++) {
559 for (j = 0; j < filterSize; j++)
567 const int16_t *chrFilter,
int chrFilterSize,
568 const int16_t **chrUSrc,
const int16_t **chrVSrc,
569 uint8_t *dest8,
int chrDstW,
int output_bits,
int output_shift)
571 uint16_t *dest = (uint16_t*)dest8;
573 int shift = 11 + 16 - output_bits;
575 for (
i = 0;
i < chrDstW;
i++) {
577 int v = 1 << (
shift - 1);
579 for (j = 0; j < chrFilterSize; j++) {
580 u += chrUSrc[j][
i] * chrFilter[j];
581 v += chrVSrc[j][
i] * chrFilter[j];
591 #define yuv2p01x_wrapper(fmt, bits, shift) \
592 static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \
593 uint8_t *dest, int dstW, \
594 const uint8_t *dither, int offset) \
596 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \
599 static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \
600 uint8_t *dest, int dstW, \
601 const uint8_t *dither, int offset) \
603 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \
606 static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \
607 int filterSize, const int16_t **src, \
608 uint8_t *dest, int dstW, \
609 const uint8_t *dither, int offset) \
611 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \
615 static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \
616 int filterSize, const int16_t **src, \
617 uint8_t *dest, int dstW, \
618 const uint8_t *dither, int offset) \
620 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \
624 static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat, \
625 const uint8_t *chrDither, \
626 const int16_t *chrFilter, \
628 const int16_t **chrUSrc, \
629 const int16_t **chrVSrc, \
630 uint8_t *dest8, int chrDstW) \
632 yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
633 dest8, chrDstW, bits, shift); \
636 static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat, \
637 const uint8_t *chrDither, \
638 const int16_t *chrFilter, \
640 const int16_t **chrUSrc, \
641 const int16_t **chrVSrc, \
642 uint8_t *dest8, int chrDstW) \
644 yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
645 dest8, chrDstW, bits, shift); \
652 #define accumulate_bit(acc, val) \
655 #define output_pixel(pos, acc) \
656 if (target == AV_PIX_FMT_MONOBLACK) { \
663 yuv2mono_X_c_template(
SwsInternal *
c,
const int16_t *lumFilter,
664 const int16_t **lumSrc,
int lumFilterSize,
665 const int16_t *chrFilter,
const int16_t **chrUSrc,
666 const int16_t **chrVSrc,
int chrFilterSize,
667 const int16_t **alpSrc, uint8_t *dest,
int dstW,
675 for (
i = 0;
i < dstW;
i += 2) {
680 for (j = 0; j < lumFilterSize; j++) {
681 Y1 += lumSrc[j][
i] * lumFilter[j];
682 Y2 += lumSrc[j][
i+1] * lumFilter[j];
686 if ((Y1 | Y2) & 0x100) {
691 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;
692 c->dither_error[0][
i] = err;
693 acc = 2*acc + (Y1 >= 128);
696 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);
697 c->dither_error[0][
i+1] = Y1;
698 acc = 2*acc + (err >= 128);
708 c->dither_error[0][
i] = err;
717 const int16_t *ubuf[2],
const int16_t *vbuf[2],
718 const int16_t *abuf[2], uint8_t *dest,
int dstW,
719 int yalpha,
int uvalpha,
int y,
722 const int16_t *buf0 = buf[0], *buf1 = buf[1];
724 int yalpha1 = 4096 - yalpha;
731 for (
i = 0;
i < dstW;
i +=2) {
734 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
735 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;
736 c->dither_error[0][
i] = err;
737 acc = 2*acc + (
Y >= 128);
740 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
741 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;
742 c->dither_error[0][
i+1] =
Y;
743 acc = 2*acc + (err >= 128);
749 c->dither_error[0][
i] = err;
751 for (
i = 0;
i < dstW;
i += 8) {
755 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
757 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
759 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
761 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
763 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
765 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
767 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
769 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
779 const int16_t *ubuf[2],
const int16_t *vbuf[2],
780 const int16_t *abuf0, uint8_t *dest,
int dstW,
789 for (
i = 0;
i < dstW;
i +=2) {
792 Y = ((buf0[
i + 0] + 64) >> 7);
793 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;
794 c->dither_error[0][
i] = err;
795 acc = 2*acc + (
Y >= 128);
798 err = ((buf0[
i + 1] + 64) >> 7);
799 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;
800 c->dither_error[0][
i+1] =
Y;
801 acc = 2*acc + (err >= 128);
807 c->dither_error[0][
i] = err;
809 for (
i = 0;
i < dstW;
i += 8) {
826 #undef accumulate_bit
828 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
829 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
830 const int16_t **lumSrc, int lumFilterSize, \
831 const int16_t *chrFilter, const int16_t **chrUSrc, \
832 const int16_t **chrVSrc, int chrFilterSize, \
833 const int16_t **alpSrc, uint8_t *dest, int dstW, \
836 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
837 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
838 alpSrc, dest, dstW, y, fmt); \
841 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
842 const int16_t *ubuf[2], const int16_t *vbuf[2], \
843 const int16_t *abuf[2], uint8_t *dest, int dstW, \
844 int yalpha, int uvalpha, int y) \
846 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
847 dest, dstW, yalpha, uvalpha, y, fmt); \
850 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
851 const int16_t *ubuf[2], const int16_t *vbuf[2], \
852 const int16_t *abuf0, uint8_t *dest, int dstW, \
853 int uvalpha, int y) \
855 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
856 abuf0, dest, dstW, uvalpha, \
863 #define output_pixels(pos, Y1, U, Y2, V) \
864 if (target == AV_PIX_FMT_YUYV422) { \
865 dest[pos + 0] = Y1; \
867 dest[pos + 2] = Y2; \
869 } else if (target == AV_PIX_FMT_YVYU422) { \
870 dest[pos + 0] = Y1; \
872 dest[pos + 2] = Y2; \
876 dest[pos + 1] = Y1; \
878 dest[pos + 3] = Y2; \
883 const int16_t **lumSrc,
int lumFilterSize,
884 const int16_t *chrFilter,
const int16_t **chrUSrc,
885 const int16_t **chrVSrc,
int chrFilterSize,
886 const int16_t **alpSrc, uint8_t *dest,
int dstW,
891 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
898 for (j = 0; j < lumFilterSize; j++) {
899 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
900 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
902 for (j = 0; j < chrFilterSize; j++) {
903 U += chrUSrc[j][
i] * chrFilter[j];
904 V += chrVSrc[j][
i] * chrFilter[j];
910 if ((Y1 | Y2 |
U |
V) & 0x100) {
922 const int16_t *ubuf[2],
const int16_t *vbuf[2],
923 const int16_t *abuf[2], uint8_t *dest,
int dstW,
924 int yalpha,
int uvalpha,
int y,
927 const int16_t *buf0 = buf[0], *buf1 = buf[1],
928 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
929 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
930 int yalpha1 = 4096 - yalpha;
931 int uvalpha1 = 4096 - uvalpha;
936 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
937 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
938 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
939 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
940 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
942 if ((Y1 | Y2 |
U |
V) & 0x100) {
955 const int16_t *ubuf[2],
const int16_t *vbuf[2],
956 const int16_t *abuf0, uint8_t *dest,
int dstW,
959 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
962 if (uvalpha < 2048) {
963 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
964 int Y1 = (buf0[
i * 2 ]+64) >> 7;
965 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
966 int U = (ubuf0[
i] +64) >> 7;
967 int V = (vbuf0[
i] +64) >> 7;
969 if ((Y1 | Y2 |
U |
V) & 0x100) {
979 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
980 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
981 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
982 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
983 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
984 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
986 if ((Y1 | Y2 |
U |
V) & 0x100) {
1004 #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)
1005 #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)
1006 #define output_pixel(pos, val) \
1008 AV_WB16(pos, val); \
1010 AV_WL16(pos, val); \
1015 const int32_t **lumSrc,
int lumFilterSize,
1016 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
1017 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
1018 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1020 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1022 int hasAlpha = !!alpSrc;
1025 for (
i = 0;
i < dstW;
i++) {
1027 int Y = -0x40000000;
1030 for (j = 0; j < lumFilterSize; j++)
1031 Y += lumSrc[j][
i] * lumFilter[j];
1034 Y += (1<<3) + 0x8000;
1038 A = -0x40000000 + (1<<14);
1039 for (j = 0; j < lumFilterSize; j++)
1040 A += alpSrc[j][
i] * lumFilter[j];
1055 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1056 int yalpha,
int unused_uvalpha,
int y,
1058 int unused_eightbytes,
int is_be)
1060 int hasAlpha = abuf && abuf[0] && abuf[1];
1061 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1062 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1063 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1064 int yalpha1 = 4096 - yalpha;
1069 for (
i = 0;
i < dstW;
i++) {
1070 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
1076 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1088 const int32_t *abuf0, uint16_t *dest,
int dstW,
1090 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1092 int hasAlpha = !!abuf0;
1095 for (
i = 0;
i < dstW;
i++) {
1096 int Y = buf0[
i] >> 3;
1114 const int32_t **lumSrc,
int lumFilterSize,
1115 const int16_t *chrFilter,
const int32_t **chrUSrc,
1116 const int32_t **chrVSrc,
int chrFilterSize,
1117 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1118 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes,
1122 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1124 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1126 unsigned Y1 = -0x40000000;
1127 unsigned Y2 = -0x40000000;
1128 int U = -(128 << 23);
1129 int V = -(128 << 23);
1132 for (j = 0; j < lumFilterSize; j++) {
1133 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1134 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1136 for (j = 0; j < chrFilterSize; j++) {;
1137 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1138 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1144 for (j = 0; j < lumFilterSize; j++) {
1145 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1146 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1163 Y1 -=
c->yuv2rgb_y_offset;
1164 Y2 -=
c->yuv2rgb_y_offset;
1165 Y1 *=
c->yuv2rgb_y_coeff;
1166 Y2 *=
c->yuv2rgb_y_coeff;
1167 Y1 += (1 << 13) - (1 << 29);
1168 Y2 += (1 << 13) - (1 << 29);
1171 R =
V *
c->yuv2rgb_v2r_coeff;
1172 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1173 B =
U *
c->yuv2rgb_u2b_coeff;
1198 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1199 int yalpha,
int uvalpha,
int y,
1203 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1204 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1205 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1206 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1207 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1208 int yalpha1 = 4096 - yalpha;
1209 int uvalpha1 = 4096 - uvalpha;
1211 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1216 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1217 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1218 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1219 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1220 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1223 Y1 -=
c->yuv2rgb_y_offset;
1224 Y2 -=
c->yuv2rgb_y_offset;
1225 Y1 *=
c->yuv2rgb_y_coeff;
1226 Y2 *=
c->yuv2rgb_y_coeff;
1227 Y1 += (1 << 13) - (1 << 29);
1228 Y2 += (1 << 13) - (1 << 29);
1230 R =
V *
c->yuv2rgb_v2r_coeff;
1231 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1232 B =
U *
c->yuv2rgb_u2b_coeff;
1235 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1236 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1264 const int32_t *abuf0, uint16_t *dest,
int dstW,
1266 int hasAlpha,
int eightbytes,
int is_be)
1268 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1270 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1273 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1274 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1275 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1276 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1277 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1280 Y1 -=
c->yuv2rgb_y_offset;
1281 Y2 -=
c->yuv2rgb_y_offset;
1282 Y1 *=
c->yuv2rgb_y_coeff;
1283 Y2 *=
c->yuv2rgb_y_coeff;
1284 Y1 += (1 << 13) - (1 << 29);
1285 Y2 += (1 << 13) - (1 << 29);
1288 A1 = abuf0[
i * 2 ] * (1 << 11);
1289 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1295 R =
V *
c->yuv2rgb_v2r_coeff;
1296 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1297 B =
U *
c->yuv2rgb_u2b_coeff;
1317 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1318 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1319 int uvalpha1 = 4096 - uvalpha;
1322 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1323 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1324 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1325 SUINT U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1326 SUINT V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1329 Y1 -=
c->yuv2rgb_y_offset;
1330 Y2 -=
c->yuv2rgb_y_offset;
1331 Y1 *=
c->yuv2rgb_y_coeff;
1332 Y2 *=
c->yuv2rgb_y_coeff;
1333 Y1 += (1 << 13) - (1 << 29);
1334 Y2 += (1 << 13) - (1 << 29);
1337 A1 = abuf0[
i * 2 ] * (1 << 11);
1338 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1344 R =
V *
c->yuv2rgb_v2r_coeff;
1345 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1346 B =
U *
c->yuv2rgb_u2b_coeff;
1370 const int32_t **lumSrc,
int lumFilterSize,
1371 const int16_t *chrFilter,
const int32_t **chrUSrc,
1372 const int32_t **chrVSrc,
int chrFilterSize,
1373 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1375 int eightbytes,
int is_be)
1380 for (
i = 0;
i < dstW;
i++) {
1382 int Y = -0x40000000;
1383 int U = -(128 << 23);
1384 int V = -(128 << 23);
1387 for (j = 0; j < lumFilterSize; j++) {
1388 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1390 for (j = 0; j < chrFilterSize; j++) {;
1391 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1392 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1397 for (j = 0; j < lumFilterSize; j++) {
1398 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1411 Y -=
c->yuv2rgb_y_offset;
1412 Y *=
c->yuv2rgb_y_coeff;
1413 Y += (1 << 13) - (1<<29);
1416 R =
V *
c->yuv2rgb_v2r_coeff;
1417 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1418 B =
U *
c->yuv2rgb_u2b_coeff;
1436 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1437 int yalpha,
int uvalpha,
int y,
1441 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1442 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1443 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1444 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1445 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1446 int yalpha1 = 4096 - yalpha;
1447 int uvalpha1 = 4096 - uvalpha;
1454 for (
i = 0;
i < dstW;
i++) {
1455 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1456 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1457 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1460 Y -=
c->yuv2rgb_y_offset;
1461 Y *=
c->yuv2rgb_y_coeff;
1462 Y += (1 << 13) - (1 << 29);
1464 R =
V *
c->yuv2rgb_v2r_coeff;
1465 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1466 B =
U *
c->yuv2rgb_u2b_coeff;
1469 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1489 const int32_t *abuf0, uint16_t *dest,
int dstW,
1491 int hasAlpha,
int eightbytes,
int is_be)
1493 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1498 for (
i = 0;
i < dstW;
i++) {
1500 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1501 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1504 Y -=
c->yuv2rgb_y_offset;
1505 Y *=
c->yuv2rgb_y_coeff;
1506 Y += (1 << 13) - (1 << 29);
1509 A = abuf0[
i] * (1 << 11);
1514 R =
V *
c->yuv2rgb_v2r_coeff;
1515 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1516 B =
U *
c->yuv2rgb_u2b_coeff;
1529 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1530 int uvalpha1 = 4096 - uvalpha;
1534 for (
i = 0;
i < dstW;
i++) {
1536 SUINT U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1537 SUINT V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1540 Y -=
c->yuv2rgb_y_offset;
1541 Y *=
c->yuv2rgb_y_coeff;
1542 Y += (1 << 13) - (1 << 29);
1545 A = abuf0[
i] * (1 << 11);
1550 R =
V *
c->yuv2rgb_v2r_coeff;
1551 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1552 B =
U *
c->yuv2rgb_u2b_coeff;
1571 #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1572 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1573 const int16_t **_lumSrc, int lumFilterSize, \
1574 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1575 const int16_t **_chrVSrc, int chrFilterSize, \
1576 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1579 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1580 **chrUSrc = (const int32_t **) _chrUSrc, \
1581 **chrVSrc = (const int32_t **) _chrVSrc, \
1582 **alpSrc = (const int32_t **) _alpSrc; \
1583 uint16_t *dest = (uint16_t *) _dest; \
1584 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1585 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1586 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1589 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1590 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1591 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1592 int yalpha, int uvalpha, int y) \
1594 const int32_t **buf = (const int32_t **) _buf, \
1595 **ubuf = (const int32_t **) _ubuf, \
1596 **vbuf = (const int32_t **) _vbuf, \
1597 **abuf = (const int32_t **) _abuf; \
1598 uint16_t *dest = (uint16_t *) _dest; \
1599 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1600 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1603 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1604 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1605 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1606 int uvalpha, int y) \
1608 const int32_t *buf0 = (const int32_t *) _buf0, \
1609 **ubuf = (const int32_t **) _ubuf, \
1610 **vbuf = (const int32_t **) _vbuf, \
1611 *abuf0 = (const int32_t *) _abuf0; \
1612 uint16_t *dest = (uint16_t *) _dest; \
1613 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1614 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1616 #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1617 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1657 unsigned A1,
unsigned A2,
1658 const
void *_r, const
void *_g, const
void *_b,
int y,
1663 uint32_t *dest = (uint32_t *) _dest;
1664 const uint32_t *
r = (
const uint32_t *) _r;
1665 const uint32_t *
g = (
const uint32_t *) _g;
1666 const uint32_t *
b = (
const uint32_t *) _b;
1671 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1672 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1678 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1679 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1681 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1684 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1686 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1687 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1691 uint8_t *dest = (uint8_t *) _dest;
1692 const uint8_t *
r = (
const uint8_t *) _r;
1693 const uint8_t *
g = (
const uint8_t *) _g;
1694 const uint8_t *
b = (
const uint8_t *) _b;
1696 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1697 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1699 dest[
i * 6 + 0] =
r_b[Y1];
1700 dest[
i * 6 + 1] =
g[Y1];
1701 dest[
i * 6 + 2] =
b_r[Y1];
1702 dest[
i * 6 + 3] =
r_b[Y2];
1703 dest[
i * 6 + 4] =
g[Y2];
1704 dest[
i * 6 + 5] =
b_r[Y2];
1710 uint16_t *dest = (uint16_t *) _dest;
1711 const uint16_t *
r = (
const uint16_t *) _r;
1712 const uint16_t *
g = (
const uint16_t *) _g;
1713 const uint16_t *
b = (
const uint16_t *) _b;
1714 int dr1, dg1, db1, dr2, dg2, db2;
1739 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1740 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1742 uint32_t *dest = (uint32_t *) _dest;
1743 const uint32_t *
r = (
const uint32_t *) _r;
1744 const uint32_t *
g = (
const uint32_t *) _g;
1745 const uint32_t *
b = (
const uint32_t *) _b;
1746 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1747 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1749 uint8_t *dest = (uint8_t *) _dest;
1750 const uint8_t *
r = (
const uint8_t *) _r;
1751 const uint8_t *
g = (
const uint8_t *) _g;
1752 const uint8_t *
b = (
const uint8_t *) _b;
1753 int dr1, dg1, db1, dr2, dg2, db2;
1758 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1759 db1 = d64[(
i * 2 + 0) & 7];
1760 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1761 db2 = d64[(
i * 2 + 1) & 7];
1765 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1766 dg1 = d64[(
i * 2 + 0) & 7];
1767 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1768 dg2 = d64[(
i * 2 + 1) & 7];
1772 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1773 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1775 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1776 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1783 const int16_t **lumSrc,
int lumFilterSize,
1784 const int16_t *chrFilter,
const int16_t **chrUSrc,
1785 const int16_t **chrVSrc,
int chrFilterSize,
1786 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1791 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1797 const void *
r, *
g, *
b;
1799 for (j = 0; j < lumFilterSize; j++) {
1800 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1801 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1803 for (j = 0; j < chrFilterSize; j++) {
1804 U += chrUSrc[j][
i] * chrFilter[j];
1805 V += chrVSrc[j][
i] * chrFilter[j];
1814 for (j = 0; j < lumFilterSize; j++) {
1815 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1816 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1820 if ((
A1 |
A2) & 0x100) {
1831 r,
g,
b, y, target, hasAlpha);
1837 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1838 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1839 int yalpha,
int uvalpha,
int y,
1842 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1843 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1844 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1845 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1846 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1847 int yalpha1 = 4096 - yalpha;
1848 int uvalpha1 = 4096 - uvalpha;
1853 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1854 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1855 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1856 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1857 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1864 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1865 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1871 r,
g,
b, y, target, hasAlpha);
1877 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1878 const int16_t *abuf0, uint8_t *dest,
int dstW,
1882 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1886 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1887 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1888 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1889 int U = (ubuf0[
i] + 64) >> 7;
1890 int V = (vbuf0[
i] + 64) >> 7;
1897 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1898 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1904 r,
g,
b, y, target, hasAlpha);
1907 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1908 int uvalpha1 = 4096 - uvalpha;
1911 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1912 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1913 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1914 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha + (128 << 11)) >> 19;
1915 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha + (128 << 11)) >> 19;
1922 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1923 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1929 r,
g,
b, y, target, hasAlpha);
1934 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1935 static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1936 const int16_t **lumSrc, int lumFilterSize, \
1937 const int16_t *chrFilter, const int16_t **chrUSrc, \
1938 const int16_t **chrVSrc, int chrFilterSize, \
1939 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1942 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1943 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1944 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1947 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1948 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1949 static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1950 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1951 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1952 int yalpha, int uvalpha, int y) \
1954 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1955 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1958 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1959 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1960 static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1961 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1962 const int16_t *abuf0, uint8_t *dest, int dstW, \
1963 int uvalpha, int y) \
1965 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1966 dstW, uvalpha, y, fmt, hasAlpha); \
1973 #if CONFIG_SWSCALE_ALPHA
1992 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
1998 Y -=
c->yuv2rgb_y_offset;
1999 Y *=
c->yuv2rgb_y_coeff;
2001 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
2002 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
2003 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
2004 if ((
R |
G |
B) & 0xC0000000) {
2012 dest[0] = hasAlpha ?
A : 255;
2026 dest[3] = hasAlpha ?
A : 255;
2029 dest[0] = hasAlpha ?
A : 255;
2043 dest[3] = hasAlpha ?
A : 255;
2049 AV_WL32(dest, (3
U << 30) + (
R << 20) + (
G << 10) +
B);
2055 AV_WL32(dest, (3
U << 30) + (
B << 20) + (
G << 10) +
R);
2064 switch (
c->opts.dither) {
2082 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;
2083 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;
2084 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;
2085 c->dither_error[0][
i] = err[0];
2086 c->dither_error[1][
i] = err[1];
2087 c->dither_error[2][
i] = err[2];
2088 r =
R >> (isrgb8 ? 5 : 7);
2089 g =
G >> (isrgb8 ? 5 : 6);
2090 b =
B >> (isrgb8 ? 6 : 7);
2094 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2095 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2096 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2101 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2120 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2140 dest[0] =
r + 2*
g + 8*
b;
2142 dest[0] =
b + 2*
g + 8*
r;
2144 dest[0] =
r + 8*
g + 64*
b;
2146 dest[0] =
b + 4*
g + 32*
r;
2155 const int16_t **lumSrc,
int lumFilterSize,
2156 const int16_t *chrFilter,
const int16_t **chrUSrc,
2157 const int16_t **chrVSrc,
int chrFilterSize,
2158 const int16_t **alpSrc, uint8_t *dest,
2170 for (
i = 0;
i < dstW;
i++) {
2173 int U = (1<<9)-(128 << 19);
2174 int V = (1<<9)-(128 << 19);
2176 for (j = 0; j < lumFilterSize; j++) {
2177 Y += lumSrc[j][
i] * lumFilter[j];
2179 for (j = 0; j < chrFilterSize; j++) {
2180 U += chrUSrc[j][
i] * chrFilter[j];
2181 V += chrVSrc[j][
i] * chrFilter[j];
2188 for (j = 0; j < lumFilterSize; j++) {
2189 A += alpSrc[j][
i] * lumFilter[j];
2195 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2198 c->dither_error[0][
i] = err[0];
2199 c->dither_error[1][
i] = err[1];
2200 c->dither_error[2][
i] = err[2];
2205 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2206 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2207 int yalpha,
int uvalpha,
int y,
2210 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2211 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2212 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2213 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2214 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2215 int yalpha1 = 4096 - yalpha;
2216 int uvalpha1 = 4096 - uvalpha;
2229 for (
i = 0;
i < dstW;
i++) {
2230 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2231 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2232 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2235 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2240 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2243 c->dither_error[0][
i] = err[0];
2244 c->dither_error[1][
i] = err[1];
2245 c->dither_error[2][
i] = err[2];
2250 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2251 const int16_t *abuf0, uint8_t *dest,
int dstW,
2255 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2266 for (
i = 0;
i < dstW;
i++) {
2267 int Y = buf0[
i] * 4;
2268 int U = (ubuf0[
i] - (128<<7)) * 4;
2269 int V = (vbuf0[
i] - (128<<7)) * 4;
2272 A = (abuf0[
i] + 64) >> 7;
2277 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2281 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2283 int uvalpha1 = 4096 - uvalpha;
2286 for (
i = 0;
i < dstW;
i++) {
2287 int Y = buf0[
i] * 4;
2288 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 19)) >> 10;
2289 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 19)) >> 10;
2292 A = (abuf0[
i] + 64) >> 7;
2297 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2302 c->dither_error[0][
i] = err[0];
2303 c->dither_error[1][
i] = err[1];
2304 c->dither_error[2][
i] = err[2];
2313 #if CONFIG_SWSCALE_ALPHA
2337 const int16_t **lumSrc,
int lumFilterSize,
2338 const int16_t *chrFilter, const int16_t **chrUSrc,
2339 const int16_t **chrVSrc,
int chrFilterSize,
2340 const int16_t **alpSrc, uint8_t **dest,
2346 uint16_t **dest16 = (uint16_t**)dest;
2347 int SH = 22 + 8 -
desc->comp[0].depth;
2350 for (
i = 0;
i < dstW;
i++) {
2353 int U = (1 << 9) - (128 << 19);
2354 int V = (1 << 9) - (128 << 19);
2357 for (j = 0; j < lumFilterSize; j++)
2358 Y += lumSrc[j][
i] * lumFilter[j];
2360 for (j = 0; j < chrFilterSize; j++) {
2361 U += chrUSrc[j][
i] * chrFilter[j];
2362 V += chrVSrc[j][
i] * chrFilter[j];
2372 for (j = 0; j < lumFilterSize; j++)
2373 A += alpSrc[j][
i] * lumFilter[j];
2379 Y -=
c->yuv2rgb_y_offset;
2380 Y *=
c->yuv2rgb_y_coeff;
2382 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2383 G =
Y +
V * (
unsigned)
c->yuv2rgb_v2g_coeff +
U * (unsigned)
c->yuv2rgb_u2g_coeff;
2384 B =
Y +
U * (
unsigned)
c->yuv2rgb_u2b_coeff;
2386 if ((
R |
G |
B) & 0xC0000000) {
2393 dest16[0][
i] =
G >>
SH;
2394 dest16[1][
i] =
B >>
SH;
2395 dest16[2][
i] =
R >>
SH;
2397 dest16[3][
i] =
A >> (
SH - 3);
2399 dest[0][
i] =
G >> 22;
2400 dest[1][
i] =
B >> 22;
2401 dest[2][
i] =
R >> 22;
2403 dest[3][
i] =
A >> 19;
2406 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2407 for (
i = 0;
i < dstW;
i++) {
2419 const int16_t **lumSrc,
int lumFilterSize,
2420 const int16_t *chrFilter,
const int16_t **chrUSrc,
2421 const int16_t **chrVSrc,
int chrFilterSize,
2422 const int16_t **alpSrc, uint8_t **dest,
2427 uint16_t **dest16 = (uint16_t**)dest;
2432 chrFilter, chrUSrc, chrVSrc, chrFilterSize,
2433 alpSrc, dest, dstW, y);
2435 if (
desc->comp[0].depth <= 8)
2438 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2439 for (
i = 0;
i < dstW;
i++) {
2447 for (
i = 0;
i < dstW;
i++) {
2448 dest16[0][
i] = dest16[0][
i] <<
shift;
2449 dest16[1][
i] = dest16[1][
i] <<
shift;
2450 dest16[2][
i] = dest16[2][
i] <<
shift;
2452 dest16[3][
i] = dest16[3][
i] <<
shift;
2459 const int16_t **lumSrcx,
int lumFilterSize,
2460 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2461 const int16_t **chrVSrcx,
int chrFilterSize,
2462 const int16_t **alpSrcx, uint8_t **dest,
2468 uint16_t **dest16 = (uint16_t**)dest;
2474 for (
i = 0;
i < dstW;
i++) {
2476 int Y = -0x40000000;
2477 int U = -(128 << 23);
2478 int V = -(128 << 23);
2481 for (j = 0; j < lumFilterSize; j++)
2482 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2484 for (j = 0; j < chrFilterSize; j++) {
2485 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2486 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2497 for (j = 0; j < lumFilterSize; j++)
2498 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2504 Y -=
c->yuv2rgb_y_offset;
2505 Y *=
c->yuv2rgb_y_coeff;
2506 Y += (1 << 13) - (1 << 29);
2507 R =
V *
c->yuv2rgb_v2r_coeff;
2508 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2509 B =
U *
c->yuv2rgb_u2b_coeff;
2518 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2519 for (
i = 0;
i < dstW;
i++) {
2531 const int16_t **lumSrcx,
int lumFilterSize,
2532 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2533 const int16_t **chrVSrcx,
int chrFilterSize,
2534 const int16_t **alpSrcx, uint8_t **dest,
2540 uint32_t **dest32 = (uint32_t**)dest;
2545 static const float float_mult = 1.0f / 65535.0f;
2547 for (
i = 0;
i < dstW;
i++) {
2549 int Y = -0x40000000;
2550 int U = -(128 << 23);
2551 int V = -(128 << 23);
2554 for (j = 0; j < lumFilterSize; j++)
2555 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2557 for (j = 0; j < chrFilterSize; j++) {
2558 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2559 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2570 for (j = 0; j < lumFilterSize; j++)
2571 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2577 Y -=
c->yuv2rgb_y_offset;
2578 Y *=
c->yuv2rgb_y_coeff;
2579 Y += (1 << 13) - (1 << 29);
2580 R =
V *
c->yuv2rgb_v2r_coeff;
2581 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2582 B =
U *
c->yuv2rgb_u2b_coeff;
2594 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2595 for (
i = 0;
i < dstW;
i++) {
2607 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2608 const int16_t *abuf0, uint8_t *dest,
int dstW,
2611 int hasAlpha = !!abuf0;
2614 for (
i = 0;
i < dstW;
i++) {
2615 int Y = (buf0[
i] + 64) >> 7;
2621 A = (abuf0[
i] + 64) >> 7;
2627 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2633 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2634 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2635 int yalpha,
int uvalpha,
int y)
2637 int hasAlpha = abuf && abuf[0] && abuf[1];
2638 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2639 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2640 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2641 int yalpha1 = 4096 - yalpha;
2646 for (
i = 0;
i < dstW;
i++) {
2647 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2653 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2658 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2664 const int16_t **lumSrc,
int lumFilterSize,
2665 const int16_t *chrFilter,
const int16_t **chrUSrc,
2666 const int16_t **chrVSrc,
int chrFilterSize,
2667 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2669 int hasAlpha = !!alpSrc;
2672 for (
i = 0;
i < dstW;
i++) {
2674 int Y = 1 << 18,
A = 1 << 18;
2676 for (j = 0; j < lumFilterSize; j++)
2677 Y += lumSrc[j][
i] * lumFilter[j];
2684 for (j = 0; j < lumFilterSize; j++)
2685 A += alpSrc[j][
i] * lumFilter[j];
2694 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2698 #define output_pixels(pos, val) \
2700 AV_WB16(pos, val); \
2702 AV_WL16(pos, val); \
2707 const int16_t **_lumSrc,
int lumFilterSize,
2708 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2709 const int16_t **_chrVSrc,
int chrFilterSize,
2710 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2711 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2714 **chrUSrc = (
const int32_t **) _chrUSrc,
2715 **chrVSrc = (
const int32_t **) _chrVSrc,
2716 **alpSrc = (
const int32_t **) _alpSrc;
2717 int hasAlpha = !!alpSrc;
2720 for (
i = 0;
i < dstW;
i++) {
2721 int Y = 1 << 14,
U = 1 << 14;
2722 int V = 1 << 14,
A = 1 << 14;
2730 for (j = 0; j < lumFilterSize; j++)
2731 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2733 for (j = 0; j < chrFilterSize; j++)
2734 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2736 for (j = 0; j < chrFilterSize; j++)
2737 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2740 for (j = 0; j < lumFilterSize; j++)
2741 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2756 #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2758 yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2759 const int16_t **lumSrc, int lumFilterSize, \
2760 const int16_t *chrFilter, const int16_t **chrUSrc, \
2761 const int16_t **chrVSrc, int chrFilterSize, \
2762 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2764 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2765 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2766 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2775 #undef output_pixels
2779 const int16_t **lumSrc,
int lumFilterSize,
2780 const int16_t *chrFilter,
const int16_t **chrUSrc,
2781 const int16_t **chrVSrc,
int chrFilterSize,
2782 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2786 for (
i = 0;
i < dstW;
i++) {
2787 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2790 for (j = 0; j < lumFilterSize; j++)
2791 Y += lumSrc[j][
i] * lumFilter[j];
2793 for (j = 0; j < chrFilterSize; j++) {
2794 U += chrUSrc[j][
i] * chrFilter[j];
2795 V += chrVSrc[j][
i] * chrFilter[j];
2804 (
unsigned)
V << (
shift + 20) |
2805 (
unsigned)
A << (
shift ? 0 : 30 ));
2809 #define V30LE_WRAPPER(name, shift) \
2810 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2811 const int16_t **lumSrc, int lumFilterSize, \
2812 const int16_t *chrFilter, const int16_t **chrUSrc, \
2813 const int16_t **chrVSrc, int chrFilterSize, \
2814 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2817 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2818 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2819 alpSrc, dest, dstW, y, shift); \
2825 #define output_pixels(pos, val, shift, bits, output_shift) \
2827 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2829 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2834 const int16_t **lumSrc,
int lumFilterSize,
2835 const int16_t *chrFilter,
const int16_t **chrUSrc,
2836 const int16_t **chrVSrc,
int chrFilterSize,
2837 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2840 for (
i = 0;
i < dstW;
i++) {
2841 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2844 for (j = 0; j < lumFilterSize; j++)
2845 Y += lumSrc[j][
i] * lumFilter[j];
2847 for (j = 0; j < chrFilterSize; j++) {
2848 U += chrUSrc[j][
i] * chrFilter[j];
2849 V += chrVSrc[j][
i] * chrFilter[j];
2859 #undef output_pixels
2861 #define YUV2XV36(BE_LE, is_be) \
2863 yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2864 const int16_t **lumSrc, int lumFilterSize, \
2865 const int16_t *chrFilter, const int16_t **chrUSrc, \
2866 const int16_t **chrVSrc, int chrFilterSize, \
2867 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2869 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2870 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2871 alpSrc, dest, dstW, y, is_be); \
2877 #define output_pixels(pos, A, Y, U, V) \
2878 if (target == AV_PIX_FMT_AYUV) { \
2879 dest[pos + 0] = A; \
2880 dest[pos + 1] = Y; \
2881 dest[pos + 2] = U; \
2882 dest[pos + 3] = V; \
2883 } else if (target == AV_PIX_FMT_UYVA) { \
2884 dest[pos + 0] = U; \
2885 dest[pos + 1] = Y; \
2886 dest[pos + 2] = V; \
2887 dest[pos + 3] = A; \
2889 dest[pos + 0] = V; \
2890 dest[pos + 1] = U; \
2891 dest[pos + 2] = Y; \
2892 dest[pos + 3] = A; \
2897 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2898 const int16_t *abuf0, uint8_t *dest,
int dstW,
2901 int hasAlpha = !!abuf0;
2904 if (uvalpha < 2048) {
2905 for (
i = 0;
i < dstW;
i++) {
2906 int Y = (buf0[
i] + 64) >> 7;
2907 int U = (ubuf[0][
i] + 64) >> 7;
2908 int V = (vbuf[0][
i] + 64) >> 7;
2919 A = (abuf0[
i] + 64) >> 7;
2927 for (
i = 0;
i < dstW;
i++) {
2928 int Y = (buf0[
i] + 64) >> 7;
2929 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2930 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2941 A = (abuf0[
i] + 64) >> 7;
2953 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2954 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2955 int yalpha,
int uvalpha,
int y,
2958 int hasAlpha = abuf && abuf[0] && abuf[1];
2959 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2960 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2961 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2962 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2963 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2964 int yalpha1 = 4096 - yalpha;
2965 int uvalpha1 = 4096 - uvalpha;
2971 for (
i = 0;
i < dstW;
i++) {
2972 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2973 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2974 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2985 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2995 const int16_t **lumSrc,
int lumFilterSize,
2996 const int16_t *chrFilter,
const int16_t **chrUSrc,
2997 const int16_t **chrVSrc,
int chrFilterSize,
2998 const int16_t **alpSrc, uint8_t *dest,
int dstW,
3003 for (
i = 0;
i < dstW;
i++) {
3005 int Y = 1 << 18,
U = 1 << 18;
3006 int V = 1 << 18,
A = 255;
3008 for (j = 0; j < lumFilterSize; j++)
3009 Y += lumSrc[j][
i] * lumFilter[j];
3011 for (j = 0; j < chrFilterSize; j++)
3012 U += chrUSrc[j][
i] * chrFilter[j];
3014 for (j = 0; j < chrFilterSize; j++)
3015 V += chrVSrc[j][
i] * chrFilter[j];
3031 for (j = 0; j < lumFilterSize; j++)
3032 A += alpSrc[j][
i] * lumFilter[j];
3044 #undef output_pixels
3046 #define AYUVPACKEDWRAPPER(name, fmt) \
3047 static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
3048 const int16_t **lumSrc, int lumFilterSize, \
3049 const int16_t *chrFilter, const int16_t **chrUSrc, \
3050 const int16_t **chrVSrc, int chrFilterSize, \
3051 const int16_t **alpSrc, uint8_t *dest, int dstW, \
3054 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3055 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3056 alpSrc, dest, dstW, y, fmt); \
3059 static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
3060 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3061 const int16_t *abuf[2], uint8_t *dest, int dstW, \
3062 int yalpha, int uvalpha, int y) \
3064 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3065 dest, dstW, yalpha, uvalpha, y, fmt); \
3068 static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
3069 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3070 const int16_t *abuf0, uint8_t *dest, int dstW, \
3071 int uvalpha, int y) \
3073 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3074 abuf0, dest, dstW, uvalpha, \
3082 #define output_pixel(pos, val, bits) \
3083 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
3085 #define yuv2y2xx_wrapper(bits) \
3087 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
3088 const int16_t **lumSrc, int lumFilterSize, \
3089 const int16_t *chrFilter, \
3090 const int16_t **chrUSrc, \
3091 const int16_t **chrVSrc, int chrFilterSize, \
3092 const int16_t **alpSrc, \
3093 uint8_t *dest, int dstW, int y) \
3096 int shift = 11 + 16 - bits; \
3097 int output_shift = 16 - bits; \
3098 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
3099 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
3100 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
3102 for (j = 0; j < lumFilterSize; j++) { \
3103 Y1 += lumSrc[j][i * 2] * lumFilter[j]; \
3104 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \
3107 for (j = 0; j < chrFilterSize; j++) { \
3108 U += chrUSrc[j][i] * chrFilter[j]; \
3109 V += chrVSrc[j][i] * chrFilter[j]; \
3112 output_pixel(dest + 8 * i + 0, Y1, bits); \
3113 output_pixel(dest + 8 * i + 2, U, bits); \
3114 output_pixel(dest + 8 * i + 4, Y2, bits); \
3115 output_pixel(dest + 8 * i + 6, V, bits); \
3123 yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3124 const int16_t **_lumSrc,
int lumFilterSize,
3125 const int16_t *chrFilter,
3126 const int16_t **_chrUSrc,
3127 const int16_t **_chrVSrc,
int chrFilterSize,
3128 const int16_t **_alpSrc,
3129 uint8_t *dest,
int dstW,
int y)
3136 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3137 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3146 for (
int j = 0; j < lumFilterSize; j++) {
3147 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3148 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3151 for (
int j = 0; j < chrFilterSize; j++) {
3152 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3153 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3165 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3166 const int16_t *abuf0, uint8_t *dest,
int dstW,
3171 if (uvalpha < 2048) {
3172 for (
i = 0;
i < dstW;
i++) {
3173 int Y = (buf0[
i] + 64) >> 7;
3174 int U = (ubuf[0][
i] + 64) >> 7;
3175 int V = (vbuf[0][
i] + 64) >> 7;
3185 dest[3 *
i + 1] =
Y;
3186 dest[3 *
i + 2] =
U;
3189 for (
i = 0;
i < dstW;
i++) {
3190 int Y = (buf0[
i] + 64) >> 7;
3191 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3192 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3202 dest[3 *
i + 1] =
Y;
3203 dest[3 *
i + 2] =
U;
3210 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3211 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3212 int yalpha,
int uvalpha,
int y)
3214 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3215 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3216 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3217 int yalpha1 = 4096 - yalpha;
3218 int uvalpha1 = 4096 - uvalpha;
3224 for (
i = 0;
i < dstW;
i++) {
3225 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3226 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3227 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3237 dest[3 *
i + 1] =
Y;
3238 dest[3 *
i + 2] =
U;
3244 const int16_t **lumSrc,
int lumFilterSize,
3245 const int16_t *chrFilter,
const int16_t **chrUSrc,
3246 const int16_t **chrVSrc,
int chrFilterSize,
3247 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3251 for (
i = 0;
i < dstW;
i++) {
3253 int Y = 1 << 18,
U = 1 << 18;
3256 for (j = 0; j < lumFilterSize; j++)
3257 Y += lumSrc[j][
i] * lumFilter[j];
3259 for (j = 0; j < chrFilterSize; j++)
3260 U += chrUSrc[j][
i] * chrFilter[j];
3262 for (j = 0; j < chrFilterSize; j++)
3263 V += chrVSrc[j][
i] * chrFilter[j];
3277 dest[3 *
i + 1] =
Y;
3278 dest[3 *
i + 2] =
U;
3297 if (
desc->comp[0].depth == 10) {
3298 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3299 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3300 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3301 }
else if (
desc->comp[0].depth == 12) {
3302 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3303 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3304 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3308 if (
desc->comp[0].depth == 10) {
3309 *yuv2plane1 =
isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3310 *
yuv2planeX =
isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3311 *yuv2nv12cX =
isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3314 }
else if (
is16BPS(dstFormat)) {
3315 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3316 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3321 if (
desc->comp[0].depth == 10) {
3322 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_10BE_c : yuv2msbplaneX_10LE_c;
3323 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_10BE_c : yuv2msbplane1_10LE_c;
3324 }
else if (
desc->comp[0].depth == 12) {
3325 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_12BE_c : yuv2msbplaneX_12LE_c;
3326 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_12BE_c : yuv2msbplane1_12LE_c;
3329 }
else if (
isNBPS(dstFormat)) {
3330 if (
desc->comp[0].depth == 9) {
3331 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3332 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3333 }
else if (
desc->comp[0].depth == 10) {
3334 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3335 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3336 }
else if (
desc->comp[0].depth == 12) {
3337 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3338 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3339 }
else if (
desc->comp[0].depth == 14) {
3340 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3341 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3346 *yuv2plane1 = yuv2plane1_floatBE_c;
3349 *yuv2plane1 = yuv2plane1_floatLE_c;
3358 switch (dstFormat) {
3361 *yuv2packedX = yuv2rgba32_full_X_c;
3362 *yuv2packed2 = yuv2rgba32_full_2_c;
3363 *yuv2packed1 = yuv2rgba32_full_1_c;
3365 #if CONFIG_SWSCALE_ALPHA
3367 *yuv2packedX = yuv2rgba32_full_X_c;
3368 *yuv2packed2 = yuv2rgba32_full_2_c;
3369 *yuv2packed1 = yuv2rgba32_full_1_c;
3373 *yuv2packedX = yuv2rgbx32_full_X_c;
3374 *yuv2packed2 = yuv2rgbx32_full_2_c;
3375 *yuv2packed1 = yuv2rgbx32_full_1_c;
3381 *yuv2packedX = yuv2argb32_full_X_c;
3382 *yuv2packed2 = yuv2argb32_full_2_c;
3383 *yuv2packed1 = yuv2argb32_full_1_c;
3385 #if CONFIG_SWSCALE_ALPHA
3387 *yuv2packedX = yuv2argb32_full_X_c;
3388 *yuv2packed2 = yuv2argb32_full_2_c;
3389 *yuv2packed1 = yuv2argb32_full_1_c;
3393 *yuv2packedX = yuv2xrgb32_full_X_c;
3394 *yuv2packed2 = yuv2xrgb32_full_2_c;
3395 *yuv2packed1 = yuv2xrgb32_full_1_c;
3401 *yuv2packedX = yuv2bgra32_full_X_c;
3402 *yuv2packed2 = yuv2bgra32_full_2_c;
3403 *yuv2packed1 = yuv2bgra32_full_1_c;
3405 #if CONFIG_SWSCALE_ALPHA
3407 *yuv2packedX = yuv2bgra32_full_X_c;
3408 *yuv2packed2 = yuv2bgra32_full_2_c;
3409 *yuv2packed1 = yuv2bgra32_full_1_c;
3413 *yuv2packedX = yuv2bgrx32_full_X_c;
3414 *yuv2packed2 = yuv2bgrx32_full_2_c;
3415 *yuv2packed1 = yuv2bgrx32_full_1_c;
3421 *yuv2packedX = yuv2abgr32_full_X_c;
3422 *yuv2packed2 = yuv2abgr32_full_2_c;
3423 *yuv2packed1 = yuv2abgr32_full_1_c;
3425 #if CONFIG_SWSCALE_ALPHA
3427 *yuv2packedX = yuv2abgr32_full_X_c;
3428 *yuv2packed2 = yuv2abgr32_full_2_c;
3429 *yuv2packed1 = yuv2abgr32_full_1_c;
3433 *yuv2packedX = yuv2xbgr32_full_X_c;
3434 *yuv2packed2 = yuv2xbgr32_full_2_c;
3435 *yuv2packed1 = yuv2xbgr32_full_1_c;
3440 #if CONFIG_SWSCALE_ALPHA
3442 *yuv2packedX = yuv2rgba64le_full_X_c;
3443 *yuv2packed2 = yuv2rgba64le_full_2_c;
3444 *yuv2packed1 = yuv2rgba64le_full_1_c;
3448 *yuv2packedX = yuv2rgbx64le_full_X_c;
3449 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3450 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3454 #if CONFIG_SWSCALE_ALPHA
3456 *yuv2packedX = yuv2rgba64be_full_X_c;
3457 *yuv2packed2 = yuv2rgba64be_full_2_c;
3458 *yuv2packed1 = yuv2rgba64be_full_1_c;
3462 *yuv2packedX = yuv2rgbx64be_full_X_c;
3463 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3464 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3468 #if CONFIG_SWSCALE_ALPHA
3470 *yuv2packedX = yuv2bgra64le_full_X_c;
3471 *yuv2packed2 = yuv2bgra64le_full_2_c;
3472 *yuv2packed1 = yuv2bgra64le_full_1_c;
3476 *yuv2packedX = yuv2bgrx64le_full_X_c;
3477 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3478 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3482 #if CONFIG_SWSCALE_ALPHA
3484 *yuv2packedX = yuv2bgra64be_full_X_c;
3485 *yuv2packed2 = yuv2bgra64be_full_2_c;
3486 *yuv2packed1 = yuv2bgra64be_full_1_c;
3490 *yuv2packedX = yuv2bgrx64be_full_X_c;
3491 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3492 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3497 *yuv2packedX = yuv2rgb24_full_X_c;
3498 *yuv2packed2 = yuv2rgb24_full_2_c;
3499 *yuv2packed1 = yuv2rgb24_full_1_c;
3502 *yuv2packedX = yuv2bgr24_full_X_c;
3503 *yuv2packed2 = yuv2bgr24_full_2_c;
3504 *yuv2packed1 = yuv2bgr24_full_1_c;
3507 *yuv2packedX = yuv2rgb48le_full_X_c;
3508 *yuv2packed2 = yuv2rgb48le_full_2_c;
3509 *yuv2packed1 = yuv2rgb48le_full_1_c;
3512 *yuv2packedX = yuv2bgr48le_full_X_c;
3513 *yuv2packed2 = yuv2bgr48le_full_2_c;
3514 *yuv2packed1 = yuv2bgr48le_full_1_c;
3517 *yuv2packedX = yuv2rgb48be_full_X_c;
3518 *yuv2packed2 = yuv2rgb48be_full_2_c;
3519 *yuv2packed1 = yuv2rgb48be_full_1_c;
3522 *yuv2packedX = yuv2bgr48be_full_X_c;
3523 *yuv2packed2 = yuv2bgr48be_full_2_c;
3524 *yuv2packed1 = yuv2bgr48be_full_1_c;
3527 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3528 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3529 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3532 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3533 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3534 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3537 *yuv2packedX = yuv2bgr8_full_X_c;
3538 *yuv2packed2 = yuv2bgr8_full_2_c;
3539 *yuv2packed1 = yuv2bgr8_full_1_c;
3542 *yuv2packedX = yuv2rgb8_full_X_c;
3543 *yuv2packed2 = yuv2rgb8_full_2_c;
3544 *yuv2packed1 = yuv2rgb8_full_1_c;
3547 *yuv2packedX = yuv2x2rgb10_full_X_c;
3548 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3549 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3552 *yuv2packedX = yuv2x2bgr10_full_X_c;
3553 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3554 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3593 if (!*yuv2packedX && !*yuv2anyX)
3597 switch (dstFormat) {
3599 #if CONFIG_SWSCALE_ALPHA
3601 *yuv2packed1 = yuv2rgba64le_1_c;
3602 *yuv2packed2 = yuv2rgba64le_2_c;
3603 *yuv2packedX = yuv2rgba64le_X_c;
3607 *yuv2packed1 = yuv2rgbx64le_1_c;
3608 *yuv2packed2 = yuv2rgbx64le_2_c;
3609 *yuv2packedX = yuv2rgbx64le_X_c;
3613 #if CONFIG_SWSCALE_ALPHA
3615 *yuv2packed1 = yuv2rgba64be_1_c;
3616 *yuv2packed2 = yuv2rgba64be_2_c;
3617 *yuv2packedX = yuv2rgba64be_X_c;
3621 *yuv2packed1 = yuv2rgbx64be_1_c;
3622 *yuv2packed2 = yuv2rgbx64be_2_c;
3623 *yuv2packedX = yuv2rgbx64be_X_c;
3627 #if CONFIG_SWSCALE_ALPHA
3629 *yuv2packed1 = yuv2bgra64le_1_c;
3630 *yuv2packed2 = yuv2bgra64le_2_c;
3631 *yuv2packedX = yuv2bgra64le_X_c;
3635 *yuv2packed1 = yuv2bgrx64le_1_c;
3636 *yuv2packed2 = yuv2bgrx64le_2_c;
3637 *yuv2packedX = yuv2bgrx64le_X_c;
3641 #if CONFIG_SWSCALE_ALPHA
3643 *yuv2packed1 = yuv2bgra64be_1_c;
3644 *yuv2packed2 = yuv2bgra64be_2_c;
3645 *yuv2packedX = yuv2bgra64be_X_c;
3649 *yuv2packed1 = yuv2bgrx64be_1_c;
3650 *yuv2packed2 = yuv2bgrx64be_2_c;
3651 *yuv2packedX = yuv2bgrx64be_X_c;
3655 *yuv2packed1 = yuv2rgb48le_1_c;
3656 *yuv2packed2 = yuv2rgb48le_2_c;
3657 *yuv2packedX = yuv2rgb48le_X_c;
3660 *yuv2packed1 = yuv2rgb48be_1_c;
3661 *yuv2packed2 = yuv2rgb48be_2_c;
3662 *yuv2packedX = yuv2rgb48be_X_c;
3665 *yuv2packed1 = yuv2bgr48le_1_c;
3666 *yuv2packed2 = yuv2bgr48le_2_c;
3667 *yuv2packedX = yuv2bgr48le_X_c;
3670 *yuv2packed1 = yuv2bgr48be_1_c;
3671 *yuv2packed2 = yuv2bgr48be_2_c;
3672 *yuv2packedX = yuv2bgr48be_X_c;
3677 *yuv2packed1 = yuv2rgb32_1_c;
3678 *yuv2packed2 = yuv2rgb32_2_c;
3679 *yuv2packedX = yuv2rgb32_X_c;
3681 #if CONFIG_SWSCALE_ALPHA
3683 *yuv2packed1 = yuv2rgba32_1_c;
3684 *yuv2packed2 = yuv2rgba32_2_c;
3685 *yuv2packedX = yuv2rgba32_X_c;
3689 *yuv2packed1 = yuv2rgbx32_1_c;
3690 *yuv2packed2 = yuv2rgbx32_2_c;
3691 *yuv2packedX = yuv2rgbx32_X_c;
3698 *yuv2packed1 = yuv2rgb32_1_1_c;
3699 *yuv2packed2 = yuv2rgb32_1_2_c;
3700 *yuv2packedX = yuv2rgb32_1_X_c;
3702 #if CONFIG_SWSCALE_ALPHA
3704 *yuv2packed1 = yuv2rgba32_1_1_c;
3705 *yuv2packed2 = yuv2rgba32_1_2_c;
3706 *yuv2packedX = yuv2rgba32_1_X_c;
3710 *yuv2packed1 = yuv2rgbx32_1_1_c;
3711 *yuv2packed2 = yuv2rgbx32_1_2_c;
3712 *yuv2packedX = yuv2rgbx32_1_X_c;
3717 *yuv2packed1 = yuv2rgb24_1_c;
3718 *yuv2packed2 = yuv2rgb24_2_c;
3719 *yuv2packedX = yuv2rgb24_X_c;
3722 *yuv2packed1 = yuv2bgr24_1_c;
3723 *yuv2packed2 = yuv2bgr24_2_c;
3724 *yuv2packedX = yuv2bgr24_X_c;
3730 *yuv2packed1 = yuv2rgb16_1_c;
3731 *yuv2packed2 = yuv2rgb16_2_c;
3732 *yuv2packedX = yuv2rgb16_X_c;
3738 *yuv2packed1 = yuv2rgb15_1_c;
3739 *yuv2packed2 = yuv2rgb15_2_c;
3740 *yuv2packedX = yuv2rgb15_X_c;
3746 *yuv2packed1 = yuv2rgb12_1_c;
3747 *yuv2packed2 = yuv2rgb12_2_c;
3748 *yuv2packedX = yuv2rgb12_X_c;
3752 *yuv2packed1 = yuv2rgb8_1_c;
3753 *yuv2packed2 = yuv2rgb8_2_c;
3754 *yuv2packedX = yuv2rgb8_X_c;
3758 *yuv2packed1 = yuv2rgb4_1_c;
3759 *yuv2packed2 = yuv2rgb4_2_c;
3760 *yuv2packedX = yuv2rgb4_X_c;
3764 *yuv2packed1 = yuv2rgb4b_1_c;
3765 *yuv2packed2 = yuv2rgb4b_2_c;
3766 *yuv2packedX = yuv2rgb4b_X_c;
3770 *yuv2packed1 = yuv2x2rgb10_1_c;
3771 *yuv2packed2 = yuv2x2rgb10_2_c;
3772 *yuv2packedX = yuv2x2rgb10_X_c;
3776 *yuv2packed1 = yuv2x2bgr10_1_c;
3777 *yuv2packed2 = yuv2x2bgr10_2_c;
3778 *yuv2packedX = yuv2x2bgr10_X_c;
3782 switch (dstFormat) {
3784 *yuv2packed1 = yuv2monowhite_1_c;
3785 *yuv2packed2 = yuv2monowhite_2_c;
3786 *yuv2packedX = yuv2monowhite_X_c;
3789 *yuv2packed1 = yuv2monoblack_1_c;
3790 *yuv2packed2 = yuv2monoblack_2_c;
3791 *yuv2packedX = yuv2monoblack_X_c;
3794 *yuv2packed1 = yuv2yuyv422_1_c;
3795 *yuv2packed2 = yuv2yuyv422_2_c;
3796 *yuv2packedX = yuv2yuyv422_X_c;
3799 *yuv2packed1 = yuv2yvyu422_1_c;
3800 *yuv2packed2 = yuv2yvyu422_2_c;
3801 *yuv2packedX = yuv2yvyu422_X_c;
3804 *yuv2packed1 = yuv2uyvy422_1_c;
3805 *yuv2packed2 = yuv2uyvy422_2_c;
3806 *yuv2packedX = yuv2uyvy422_X_c;
3819 *yuv2packed1 = yuv2ya16le_1_c;
3820 *yuv2packed2 = yuv2ya16le_2_c;
3821 *yuv2packedX = yuv2ya16le_X_c;
3824 *yuv2packed1 = yuv2ya16be_1_c;
3825 *yuv2packed2 = yuv2ya16be_2_c;
3826 *yuv2packedX = yuv2ya16be_X_c;
3829 *yuv2packedX = yuv2v30xle_X_c;
3832 *yuv2packedX = yuv2ayuv64le_X_c;
3835 *yuv2packedX = yuv2ayuv64be_X_c;
3838 *yuv2packed1 = yuv2ayuv_1_c;
3839 *yuv2packed2 = yuv2ayuv_2_c;
3840 *yuv2packedX = yuv2ayuv_X_c;
3844 *yuv2packed1 = yuv2vuyX_1_c;
3845 *yuv2packed2 = yuv2vuyX_2_c;
3846 *yuv2packedX = yuv2vuyX_X_c;
3849 *yuv2packed1 = yuv2uyva_1_c;
3850 *yuv2packed2 = yuv2uyva_2_c;
3851 *yuv2packedX = yuv2uyva_X_c;
3854 *yuv2packedX = yuv2xv30le_X_c;
3857 *yuv2packedX = yuv2xv36le_X_c;
3860 *yuv2packedX = yuv2xv36be_X_c;
3863 *yuv2packedX = yuv2xv48le_X_c;
3866 *yuv2packedX = yuv2xv48be_X_c;
3869 *yuv2packedX = yuv2y210le_X_c;
3872 *yuv2packedX = yuv2y212le_X_c;
3875 *yuv2packedX = yuv2y216le_X_c;