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) \
292static 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) \
299static 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)); \
328yuv2plane1_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) \
362static 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); \
369static 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)); \
397yuv2msbplane1_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) \
429static 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); \
436static 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); \
452static 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) { \
665yuv2mono_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;
755 for (
i = 0;
i < dstW;
i += 8) {
759 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
761 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
763 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
765 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
767 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
769 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
771 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
773 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
783 const int16_t *ubuf[2],
const int16_t *vbuf[2],
784 const int16_t *abuf0, uint8_t *dest,
int dstW,
793 for (
i = 0;
i < dstW;
i +=2) {
796 Y = ((buf0[
i + 0] + 64) >> 7);
797 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;
798 c->dither_error[0][
i] = err;
799 acc = 2*acc + (
Y >= 128);
802 err = ((buf0[
i + 1] + 64) >> 7);
803 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;
804 c->dither_error[0][
i+1] =
Y;
805 acc = 2*acc + (err >= 128);
811 c->dither_error[0][
i] = err;
815 for (
i = 0;
i < dstW;
i += 8) {
834#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
835static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
836 const int16_t **lumSrc, int lumFilterSize, \
837 const int16_t *chrFilter, const int16_t **chrUSrc, \
838 const int16_t **chrVSrc, int chrFilterSize, \
839 const int16_t **alpSrc, uint8_t *dest, int dstW, \
842 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
843 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
844 alpSrc, dest, dstW, y, fmt); \
847static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
848 const int16_t *ubuf[2], const int16_t *vbuf[2], \
849 const int16_t *abuf[2], uint8_t *dest, int dstW, \
850 int yalpha, int uvalpha, int y) \
852 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
853 dest, dstW, yalpha, uvalpha, y, fmt); \
856static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
857 const int16_t *ubuf[2], const int16_t *vbuf[2], \
858 const int16_t *abuf0, uint8_t *dest, int dstW, \
859 int uvalpha, int y) \
861 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
862 abuf0, dest, dstW, uvalpha, \
869#define output_pixels(pos, Y1, U, Y2, V) \
870 if (target == AV_PIX_FMT_YUYV422) { \
871 dest[pos + 0] = Y1; \
873 dest[pos + 2] = Y2; \
875 } else if (target == AV_PIX_FMT_YVYU422) { \
876 dest[pos + 0] = Y1; \
878 dest[pos + 2] = Y2; \
882 dest[pos + 1] = Y1; \
884 dest[pos + 3] = Y2; \
889 const int16_t **lumSrc,
int lumFilterSize,
890 const int16_t *chrFilter,
const int16_t **chrUSrc,
891 const int16_t **chrVSrc,
int chrFilterSize,
892 const int16_t **alpSrc, uint8_t *dest,
int dstW,
897 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
904 for (j = 0; j < lumFilterSize; j++) {
905 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
906 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
908 for (j = 0; j < chrFilterSize; j++) {
909 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
910 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
916 if ((Y1 | Y2 |
U |
V) & 0x100) {
928 const int16_t *ubuf[2],
const int16_t *vbuf[2],
929 const int16_t *abuf[2], uint8_t *dest,
int dstW,
930 int yalpha,
int uvalpha,
int y,
933 const int16_t *buf0 = buf[0], *buf1 = buf[1],
934 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
935 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
936 int yalpha1 = 4096 - yalpha;
937 int uvalpha1 = 4096 - uvalpha;
942 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
943 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
944 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
945 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
946 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
948 if ((Y1 | Y2 |
U |
V) & 0x100) {
961 const int16_t *ubuf[2],
const int16_t *vbuf[2],
962 const int16_t *abuf0, uint8_t *dest,
int dstW,
965 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
968 if (uvalpha < 2048) {
969 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
970 int Y1 = (buf0[
i * 2 ]+64) >> 7;
971 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
972 int U = (ubuf0[
i] +64) >> 7;
973 int V = (vbuf0[
i] +64) >> 7;
975 if ((Y1 | Y2 |
U |
V) & 0x100) {
985 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
986 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
987 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
988 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
989 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
990 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
992 if ((Y1 | Y2 |
U |
V) & 0x100) {
1010#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)
1011#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)
1012#define output_pixel(pos, val) \
1014 AV_WB16(pos, val); \
1016 AV_WL16(pos, val); \
1021 const int32_t **lumSrc,
int lumFilterSize,
1022 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
1023 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
1024 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1026 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1028 int hasAlpha = !!alpSrc;
1031 for (
i = 0;
i < dstW;
i++) {
1033 int Y = -0x40000000;
1036 for (j = 0; j < lumFilterSize; j++)
1037 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
1040 Y += (1<<3) + 0x8000;
1044 A = -0x40000000 + (1<<14);
1045 for (j = 0; j < lumFilterSize; j++)
1046 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
1061 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1062 int yalpha_param,
int unused_uvalpha,
int y,
1064 int unused_eightbytes,
int is_be)
1066 unsigned yalpha = yalpha_param;
1067 int hasAlpha = abuf && abuf[0] && abuf[1];
1068 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1069 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1070 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1071 unsigned yalpha1 = 4096 - yalpha;
1076 for (
i = 0;
i < dstW;
i++) {
1077 int Y = (int)(buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
1083 A = (int)(abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
1095 const int32_t *abuf0, uint16_t *dest,
int dstW,
1097 int unused_hasAlpha,
int unused_eightbytes,
int is_be)
1099 int hasAlpha = !!abuf0;
1102 for (
i = 0;
i < dstW;
i++) {
1103 int Y = buf0[
i] >> 3;
1121 const int32_t **lumSrc,
int lumFilterSize,
1122 const int16_t *chrFilter,
const int32_t **chrUSrc,
1123 const int32_t **chrVSrc,
int chrFilterSize,
1124 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1125 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes,
1129 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1131 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1133 unsigned Y1 = -0x40000000;
1134 unsigned Y2 = -0x40000000;
1135 unsigned U = -(128 << 23);
1136 unsigned V = -(128 << 23);
1139 for (j = 0; j < lumFilterSize; j++) {
1140 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1141 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1143 for (j = 0; j < chrFilterSize; j++) {;
1144 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1145 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1151 for (j = 0; j < lumFilterSize; j++) {
1152 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1153 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1170 Y1 -=
c->yuv2rgb_y_offset;
1171 Y2 -=
c->yuv2rgb_y_offset;
1172 Y1 *=
c->yuv2rgb_y_coeff;
1173 Y2 *=
c->yuv2rgb_y_coeff;
1174 Y1 += (1 << 13) - (1 << 29);
1175 Y2 += (1 << 13) - (1 << 29);
1178 R =
V *
c->yuv2rgb_v2r_coeff;
1179 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1180 B =
U *
c->yuv2rgb_u2b_coeff;
1205 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1206 int yalpha_param,
int uvalpha_param,
int y,
1210 unsigned yalpha = yalpha_param;
1211 unsigned uvalpha = uvalpha_param;
1212 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1213 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1214 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1215 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1216 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1217 unsigned yalpha1 = 4096 - yalpha;
1218 unsigned uvalpha1 = 4096 - uvalpha;
1220 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1225 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1226 unsigned Y1 = (int)(buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1227 unsigned Y2 = (int)(buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1228 int U = (int)(ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1229 int V = (int)(vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1232 Y1 -=
c->yuv2rgb_y_offset;
1233 Y2 -=
c->yuv2rgb_y_offset;
1234 Y1 *=
c->yuv2rgb_y_coeff;
1235 Y2 *=
c->yuv2rgb_y_coeff;
1236 Y1 += (1 << 13) - (1 << 29);
1237 Y2 += (1 << 13) - (1 << 29);
1239 R = (
SUINT)
V *
c->yuv2rgb_v2r_coeff;
1240 G = (
SUINT)
V *
c->yuv2rgb_v2g_coeff + (
SUINT)
U *
c->yuv2rgb_u2g_coeff;
1241 B = (
SUINT)
U *
c->yuv2rgb_u2b_coeff;
1244 A1 = (int)(abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1245 A2 = (int)(abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1273 const int32_t *abuf0, uint16_t *dest,
int dstW,
1275 int hasAlpha,
int eightbytes,
int is_be)
1277 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1282 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1283 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1284 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1285 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1286 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1289 Y1 -=
c->yuv2rgb_y_offset;
1290 Y2 -=
c->yuv2rgb_y_offset;
1291 Y1 *=
c->yuv2rgb_y_coeff;
1292 Y2 *=
c->yuv2rgb_y_coeff;
1293 Y1 += (1 << 13) - (1 << 29);
1294 Y2 += (1 << 13) - (1 << 29);
1297 A1 = abuf0[
i * 2 ] * (
SUINT)(1 << 11);
1298 A2 = abuf0[
i * 2 + 1] * (
SUINT)(1 << 11);
1304 R =
V *
c->yuv2rgb_v2r_coeff;
1305 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1306 B =
U *
c->yuv2rgb_u2b_coeff;
1326 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1328 unsigned uvalpha1 = 4096 - uvalpha;
1331 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1332 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1333 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1334 SUINT U = (int)((
SUINT)ubuf0[
i] * uvalpha1 + (
SUINT)ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1335 SUINT V = (int)((
SUINT)vbuf0[
i] * uvalpha1 + (
SUINT)vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1338 Y1 -=
c->yuv2rgb_y_offset;
1339 Y2 -=
c->yuv2rgb_y_offset;
1340 Y1 *=
c->yuv2rgb_y_coeff;
1341 Y2 *=
c->yuv2rgb_y_coeff;
1342 Y1 += (1 << 13) - (1 << 29);
1343 Y2 += (1 << 13) - (1 << 29);
1346 A1 = abuf0[
i * 2 ] * (
SUINT)(1 << 11);
1347 A2 = abuf0[
i * 2 + 1] * (
SUINT)(1 << 11);
1353 R =
V *
c->yuv2rgb_v2r_coeff;
1354 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1355 B =
U *
c->yuv2rgb_u2b_coeff;
1379 const int32_t **lumSrc,
int lumFilterSize,
1380 const int16_t *chrFilter,
const int32_t **chrUSrc,
1381 const int32_t **chrVSrc,
int chrFilterSize,
1382 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1384 int eightbytes,
int is_be)
1389 for (
i = 0;
i < dstW;
i++) {
1391 int Y = -0x40000000;
1392 int U = -(128 << 23);
1393 int V = -(128 << 23);
1396 for (j = 0; j < lumFilterSize; j++) {
1397 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1399 for (j = 0; j < chrFilterSize; j++) {;
1400 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1401 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1406 for (j = 0; j < lumFilterSize; j++) {
1407 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1420 Y -=
c->yuv2rgb_y_offset;
1421 Y *=
c->yuv2rgb_y_coeff;
1422 Y += (1 << 13) - (1<<29);
1425 R = (unsigned)
V *
c->yuv2rgb_v2r_coeff;
1426 G = (unsigned)
V *
c->yuv2rgb_v2g_coeff + (
unsigned)
U *
c->yuv2rgb_u2g_coeff;
1427 B = (unsigned)
U *
c->yuv2rgb_u2b_coeff;
1445 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1446 int yalpha_param,
int uvalpha_param,
int y,
1450 unsigned yalpha = yalpha_param;
1451 unsigned uvalpha = uvalpha_param;
1452 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1453 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1454 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1455 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1456 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1457 unsigned yalpha1 = 4096 - yalpha;
1458 unsigned uvalpha1 = 4096 - uvalpha;
1465 for (
i = 0;
i < dstW;
i++) {
1466 unsigned Y = (int)(buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1467 unsigned U = (int)(ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1468 unsigned V = (int)(vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1471 Y -=
c->yuv2rgb_y_offset;
1472 Y *=
c->yuv2rgb_y_coeff;
1473 Y += (1 << 13) - (1 << 29);
1475 R =
V *
c->yuv2rgb_v2r_coeff;
1476 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1477 B =
U *
c->yuv2rgb_u2b_coeff;
1480 A = (int)(abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1500 const int32_t *abuf0, uint16_t *dest,
int dstW,
1502 int hasAlpha,
int eightbytes,
int is_be)
1504 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1509 for (
i = 0;
i < dstW;
i++) {
1511 SUINT U = (ubuf0[
i] - (128 << 11)) >> 2;
1512 SUINT V = (vbuf0[
i] - (128 << 11)) >> 2;
1515 Y -=
c->yuv2rgb_y_offset;
1516 Y *=
c->yuv2rgb_y_coeff;
1517 Y += (1 << 13) - (1 << 29);
1520 A = abuf0[
i] * (
SUINT)(1 << 11);
1525 R =
V *
c->yuv2rgb_v2r_coeff;
1526 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1527 B =
U *
c->yuv2rgb_u2b_coeff;
1540 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1541 unsigned uvalpha1 = 4096 - uvalpha;
1545 for (
i = 0;
i < dstW;
i++) {
1547 SUINT U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1548 SUINT V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1551 Y -=
c->yuv2rgb_y_offset;
1552 Y *=
c->yuv2rgb_y_coeff;
1553 Y += (1 << 13) - (1 << 29);
1556 A = abuf0[
i] * (
SUINT)(1 << 11);
1561 R =
V *
c->yuv2rgb_v2r_coeff;
1562 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1563 B =
U *
c->yuv2rgb_u2b_coeff;
1582#define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1583static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1584 const int16_t **_lumSrc, int lumFilterSize, \
1585 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1586 const int16_t **_chrVSrc, int chrFilterSize, \
1587 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1590 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1591 **chrUSrc = (const int32_t **) _chrUSrc, \
1592 **chrVSrc = (const int32_t **) _chrVSrc, \
1593 **alpSrc = (const int32_t **) _alpSrc; \
1594 uint16_t *dest = (uint16_t *) _dest; \
1595 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1596 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1597 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1600static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1601 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1602 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1603 int yalpha, int uvalpha, int y) \
1605 const int32_t **buf = (const int32_t **) _buf, \
1606 **ubuf = (const int32_t **) _ubuf, \
1607 **vbuf = (const int32_t **) _vbuf, \
1608 **abuf = (const int32_t **) _abuf; \
1609 uint16_t *dest = (uint16_t *) _dest; \
1610 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1611 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1614static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1615 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1616 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1617 int uvalpha, int y) \
1619 const int32_t *buf0 = (const int32_t *) _buf0, \
1620 **ubuf = (const int32_t **) _ubuf, \
1621 **vbuf = (const int32_t **) _vbuf, \
1622 *abuf0 = (const int32_t *) _abuf0; \
1623 uint16_t *dest = (uint16_t *) _dest; \
1624 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1625 dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1627#define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1628 YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1668 unsigned A1,
unsigned A2,
1669 const
void *_r, const
void *_g, const
void *_b,
int y,
1674 uint32_t *dest = (uint32_t *) _dest;
1675 const uint32_t *
r = (
const uint32_t *) _r;
1676 const uint32_t *
g = (
const uint32_t *) _g;
1677 const uint32_t *
b = (
const uint32_t *) _b;
1682 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1683 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1689 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1690 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1692#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1695 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1697 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1698 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1702 uint8_t *dest = (uint8_t *) _dest;
1703 const uint8_t *
r = (
const uint8_t *) _r;
1704 const uint8_t *
g = (
const uint8_t *) _g;
1705 const uint8_t *
b = (
const uint8_t *) _b;
1707#define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1708#define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1710 dest[
i * 6 + 0] =
r_b[Y1];
1711 dest[
i * 6 + 1] =
g[Y1];
1712 dest[
i * 6 + 2] =
b_r[Y1];
1713 dest[
i * 6 + 3] =
r_b[Y2];
1714 dest[
i * 6 + 4] =
g[Y2];
1715 dest[
i * 6 + 5] =
b_r[Y2];
1721 uint16_t *dest = (uint16_t *) _dest;
1722 const uint16_t *
r = (
const uint16_t *) _r;
1723 const uint16_t *
g = (
const uint16_t *) _g;
1724 const uint16_t *
b = (
const uint16_t *) _b;
1725 int dr1, dg1, db1, dr2, dg2, db2;
1750 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1751 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1753 uint32_t *dest = (uint32_t *) _dest;
1754 const uint32_t *
r = (
const uint32_t *) _r;
1755 const uint32_t *
g = (
const uint32_t *) _g;
1756 const uint32_t *
b = (
const uint32_t *) _b;
1757 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1758 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1760 uint8_t *dest = (uint8_t *) _dest;
1761 const uint8_t *
r = (
const uint8_t *) _r;
1762 const uint8_t *
g = (
const uint8_t *) _g;
1763 const uint8_t *
b = (
const uint8_t *) _b;
1764 int dr1, dg1, db1, dr2, dg2, db2;
1769 dr1 = dg1 = d32[(
i * 2 + 0) & 7];
1770 db1 = d64[(
i * 2 + 0) & 7];
1771 dr2 = dg2 = d32[(
i * 2 + 1) & 7];
1772 db2 = d64[(
i * 2 + 1) & 7];
1776 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1777 dg1 = d64[(
i * 2 + 0) & 7];
1778 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1779 dg2 = d64[(
i * 2 + 1) & 7];
1783 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1784 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1786 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1787 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1794 const int16_t **lumSrc,
int lumFilterSize,
1795 const int16_t *chrFilter,
const int16_t **chrUSrc,
1796 const int16_t **chrVSrc,
int chrFilterSize,
1797 const int16_t **alpSrc, uint8_t *dest,
int dstW,
1802 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1808 const void *
r, *
g, *
b;
1810 for (j = 0; j < lumFilterSize; j++) {
1811 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1812 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1814 for (j = 0; j < chrFilterSize; j++) {
1815 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1816 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1825 for (j = 0; j < lumFilterSize; j++) {
1826 A1 += alpSrc[j][
i * 2 ] * (unsigned)lumFilter[j];
1827 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1831 if ((
A1 |
A2) & 0x100) {
1842 r,
g,
b, y, target, hasAlpha);
1848 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1849 const int16_t *abuf[2], uint8_t *dest,
int dstW,
1850 int yalpha,
int uvalpha,
int y,
1853 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1854 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1855 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1856 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1857 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1858 int yalpha1 = 4096 - yalpha;
1859 int uvalpha1 = 4096 - uvalpha;
1864 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1865 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1866 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1867 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1868 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1875 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1876 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1882 r,
g,
b, y, target, hasAlpha);
1888 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1889 const int16_t *abuf0, uint8_t *dest,
int dstW,
1893 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1897 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1898 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1899 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1900 int U = (ubuf0[
i] + 64) >> 7;
1901 int V = (vbuf0[
i] + 64) >> 7;
1908 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1909 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1915 r,
g,
b, y, target, hasAlpha);
1918 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1919 int uvalpha1 = 4096 - uvalpha;
1922 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1923 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1924 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1925 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha + (128 << 11)) >> 19;
1926 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha + (128 << 11)) >> 19;
1933 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1934 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1940 r,
g,
b, y, target, hasAlpha);
1945#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1946static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1947 const int16_t **lumSrc, int lumFilterSize, \
1948 const int16_t *chrFilter, const int16_t **chrUSrc, \
1949 const int16_t **chrVSrc, int chrFilterSize, \
1950 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1953 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1954 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1955 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1958#define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1959YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1960static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1961 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1962 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1963 int yalpha, int uvalpha, int y) \
1965 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1966 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1969#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1970YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1971static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1972 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1973 const int16_t *abuf0, uint8_t *dest, int dstW, \
1974 int uvalpha, int y) \
1976 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1977 dstW, uvalpha, y, fmt, hasAlpha); \
1984#if CONFIG_SWSCALE_ALPHA
2003 uint8_t *dest,
int i,
int Y,
int A,
int U,
int V,
2009 Y -=
c->yuv2rgb_y_offset;
2010 Y *= (unsigned)
c->yuv2rgb_y_coeff;
2012 R = (unsigned)
Y +
V*(unsigned)
c->yuv2rgb_v2r_coeff;
2013 G = (unsigned)
Y +
V*(unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
2014 B = (unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
2015 if ((
R |
G |
B) & 0xC0000000) {
2023 dest[0] = hasAlpha ?
A : 255;
2037 dest[3] = hasAlpha ?
A : 255;
2040 dest[0] = hasAlpha ?
A : 255;
2054 dest[3] = hasAlpha ?
A : 255;
2060 AV_WL32(dest, (3U << 30) + (
R << 20) + (
G << 10) +
B);
2066 AV_WL32(dest, (3U << 30) + (
B << 20) + (
G << 10) +
R);
2075 switch (
c->opts.dither) {
2093 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;
2094 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;
2095 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;
2096 c->dither_error[0][
i] = err[0];
2097 c->dither_error[1][
i] = err[1];
2098 c->dither_error[2][
i] = err[2];
2099 r =
R >> (isrgb8 ? 5 : 7);
2100 g =
G >> (isrgb8 ? 5 : 6);
2101 b =
B >> (isrgb8 ? 6 : 7);
2105 err[0] =
R -
r*(isrgb8 ? 36 : 255);
2106 err[1] =
G -
g*(isrgb8 ? 36 : 85);
2107 err[2] =
B -
b*(isrgb8 ? 85 : 255);
2112#define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
2131#define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
2151 dest[0] =
r + 2*
g + 8*
b;
2153 dest[0] =
b + 2*
g + 8*
r;
2155 dest[0] =
r + 8*
g + 64*
b;
2157 dest[0] =
b + 4*
g + 32*
r;
2166 const int16_t **lumSrc,
int lumFilterSize,
2167 const int16_t *chrFilter,
const int16_t **chrUSrc,
2168 const int16_t **chrVSrc,
int chrFilterSize,
2169 const int16_t **alpSrc, uint8_t *dest,
2181 for (
i = 0;
i < dstW;
i++) {
2184 int U = (1<<9)-(128 << 19);
2185 int V = (1<<9)-(128 << 19);
2187 for (j = 0; j < lumFilterSize; j++) {
2188 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
2190 for (j = 0; j < chrFilterSize; j++) {
2191 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2192 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2199 for (j = 0; j < lumFilterSize; j++) {
2200 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
2206 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2209 c->dither_error[0][
i] = err[0];
2210 c->dither_error[1][
i] = err[1];
2211 c->dither_error[2][
i] = err[2];
2216 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2217 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2218 int yalpha,
int uvalpha,
int y,
2221 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2222 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2223 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2224 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2225 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2226 int yalpha1 = 4096 - yalpha;
2227 int uvalpha1 = 4096 - uvalpha;
2240 for (
i = 0;
i < dstW;
i++) {
2241 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2242 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2243 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2246 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2251 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2254 c->dither_error[0][
i] = err[0];
2255 c->dither_error[1][
i] = err[1];
2256 c->dither_error[2][
i] = err[2];
2261 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2262 const int16_t *abuf0, uint8_t *dest,
int dstW,
2266 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2277 for (
i = 0;
i < dstW;
i++) {
2278 int Y = buf0[
i] * 4;
2279 int U = (ubuf0[
i] - (128<<7)) * 4;
2280 int V = (vbuf0[
i] - (128<<7)) * 4;
2283 A = (abuf0[
i] + 64) >> 7;
2288 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2292 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2294 int uvalpha1 = 4096 - uvalpha;
2297 for (
i = 0;
i < dstW;
i++) {
2298 int Y = buf0[
i] * 4;
2299 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 19)) >> 10;
2300 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 19)) >> 10;
2303 A = (abuf0[
i] + 64) >> 7;
2308 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2313 c->dither_error[0][
i] = err[0];
2314 c->dither_error[1][
i] = err[1];
2315 c->dither_error[2][
i] = err[2];
2324#if CONFIG_SWSCALE_ALPHA
2348 const int16_t **lumSrc,
int lumFilterSize,
2349 const int16_t *chrFilter, const int16_t **chrUSrc,
2350 const int16_t **chrVSrc,
int chrFilterSize,
2351 const int16_t **alpSrc, uint8_t **dest,
2357 uint16_t **dest16 = (uint16_t**)dest;
2358 int SH = 22 + 8 -
desc->comp[0].depth;
2361 for (
i = 0;
i < dstW;
i++) {
2364 int U = (1 << 9) - (128 << 19);
2365 int V = (1 << 9) - (128 << 19);
2368 for (j = 0; j < lumFilterSize; j++)
2369 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2371 for (j = 0; j < chrFilterSize; j++) {
2372 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2373 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2383 for (j = 0; j < lumFilterSize; j++)
2384 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2390 Y -=
c->yuv2rgb_y_offset;
2391 Y *=
c->yuv2rgb_y_coeff;
2393 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2394 G =
Y +
V * (unsigned)
c->yuv2rgb_v2g_coeff +
U * (
unsigned)
c->yuv2rgb_u2g_coeff;
2395 B =
Y +
U * (unsigned)
c->yuv2rgb_u2b_coeff;
2397 if ((
R |
G |
B) & 0xC0000000) {
2404 dest16[0][
i] =
G >>
SH;
2405 dest16[1][
i] =
B >>
SH;
2406 dest16[2][
i] =
R >>
SH;
2408 dest16[3][
i] =
A >> (
SH - 3);
2410 dest[0][
i] =
G >> 22;
2411 dest[1][
i] =
B >> 22;
2412 dest[2][
i] =
R >> 22;
2414 dest[3][
i] =
A >> 19;
2417 if (
SH != 22 && (!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2418 for (
i = 0;
i < dstW;
i++) {
2430 const int16_t **lumSrc,
int lumFilterSize,
2431 const int16_t *chrFilter,
const int16_t **chrUSrc,
2432 const int16_t **chrVSrc,
int chrFilterSize,
2433 const int16_t **alpSrc, uint8_t **dest,
2438 uint16_t **dest16 = (uint16_t**)dest;
2443 chrFilter, chrUSrc, chrVSrc, chrFilterSize,
2444 alpSrc, dest, dstW, y);
2446 if (
desc->comp[0].depth <= 8)
2449 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2450 for (
i = 0;
i < dstW;
i++) {
2458 for (
i = 0;
i < dstW;
i++) {
2459 dest16[0][
i] = dest16[0][
i] <<
shift;
2460 dest16[1][
i] = dest16[1][
i] <<
shift;
2461 dest16[2][
i] = dest16[2][
i] <<
shift;
2463 dest16[3][
i] = dest16[3][
i] <<
shift;
2470 const int16_t **lumSrcx,
int lumFilterSize,
2471 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2472 const int16_t **chrVSrcx,
int chrFilterSize,
2473 const int16_t **alpSrcx, uint8_t **dest,
2479 uint16_t **dest16 = (uint16_t**)dest;
2485 for (
i = 0;
i < dstW;
i++) {
2487 int Y = -0x40000000;
2488 int U = -(128 << 23);
2489 int V = -(128 << 23);
2492 for (j = 0; j < lumFilterSize; j++)
2493 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2495 for (j = 0; j < chrFilterSize; j++) {
2496 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2497 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2508 for (j = 0; j < lumFilterSize; j++)
2509 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2515 Y -=
c->yuv2rgb_y_offset;
2516 Y *=
c->yuv2rgb_y_coeff;
2517 Y += (1 << 13) - (1 << 29);
2518 R =
V *
c->yuv2rgb_v2r_coeff;
2519 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2520 B =
U *
c->yuv2rgb_u2b_coeff;
2529 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2530 for (
i = 0;
i < dstW;
i++) {
2542 const int16_t **lumSrcx,
int lumFilterSize,
2543 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2544 const int16_t **chrVSrcx,
int chrFilterSize,
2545 const int16_t **alpSrcx, uint8_t **dest,
2551 uint32_t **dest32 = (uint32_t**)dest;
2556 static const float float_mult = 1.0f / 65535.0f;
2558 for (
i = 0;
i < dstW;
i++) {
2560 int Y = -0x40000000;
2561 int U = -(128 << 23);
2562 int V = -(128 << 23);
2565 for (j = 0; j < lumFilterSize; j++)
2566 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2568 for (j = 0; j < chrFilterSize; j++) {
2569 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2570 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2581 for (j = 0; j < lumFilterSize; j++)
2582 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2588 Y -=
c->yuv2rgb_y_offset;
2589 Y *=
c->yuv2rgb_y_coeff;
2590 Y += (1 << 13) - (1 << 29);
2591 R =
V *
c->yuv2rgb_v2r_coeff;
2592 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2593 B =
U *
c->yuv2rgb_u2b_coeff;
2605 if ((!
isBE(
c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2606 for (
i = 0;
i < dstW;
i++) {
2618 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2619 const int16_t *abuf0, uint8_t *dest,
int dstW,
2622 int hasAlpha = !!abuf0;
2625 for (
i = 0;
i < dstW;
i++) {
2626 int Y = (buf0[
i] + 64) >> 7;
2632 A = (abuf0[
i] + 64) >> 7;
2638 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2644 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2645 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2646 int yalpha,
int uvalpha,
int y)
2648 int hasAlpha = abuf && abuf[0] && abuf[1];
2649 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2650 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2651 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2652 int yalpha1 = 4096 - yalpha;
2657 for (
i = 0;
i < dstW;
i++) {
2658 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2664 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2669 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2675 const int16_t **lumSrc,
int lumFilterSize,
2676 const int16_t *chrFilter,
const int16_t **chrUSrc,
2677 const int16_t **chrVSrc,
int chrFilterSize,
2678 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
2680 int hasAlpha = !!alpSrc;
2683 for (
i = 0;
i < dstW;
i++) {
2685 int Y = 1 << 18,
A = 1 << 18;
2687 for (j = 0; j < lumFilterSize; j++)
2688 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2695 for (j = 0; j < lumFilterSize; j++)
2696 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2705 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2709#define output_pixels(pos, val) \
2711 AV_WB16(pos, val); \
2713 AV_WL16(pos, val); \
2718 const int16_t **_lumSrc,
int lumFilterSize,
2719 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2720 const int16_t **_chrVSrc,
int chrFilterSize,
2721 const int16_t **_alpSrc, uint8_t *dest,
int dstW,
int y,
2722 int A_offset,
int Y_offset,
int U_offset,
int V_offset,
int is_be)
2725 **chrUSrc = (
const int32_t **) _chrUSrc,
2726 **chrVSrc = (
const int32_t **) _chrVSrc,
2727 **alpSrc = (
const int32_t **) _alpSrc;
2728 int hasAlpha = !!alpSrc;
2731 for (
i = 0;
i < dstW;
i++) {
2732 int Y = 1 << 14,
U = 1 << 14;
2733 int V = 1 << 14,
A = 1 << 14;
2741 for (j = 0; j < lumFilterSize; j++)
2742 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2744 for (j = 0; j < chrFilterSize; j++)
2745 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2747 for (j = 0; j < chrFilterSize; j++)
2748 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2751 for (j = 0; j < lumFilterSize; j++)
2752 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2767#define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2769yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2770 const int16_t **lumSrc, int lumFilterSize, \
2771 const int16_t *chrFilter, const int16_t **chrUSrc, \
2772 const int16_t **chrVSrc, int chrFilterSize, \
2773 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2775 yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2776 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2777 alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2790 const int16_t **lumSrc,
int lumFilterSize,
2791 const int16_t *chrFilter,
const int16_t **chrUSrc,
2792 const int16_t **chrVSrc,
int chrFilterSize,
2793 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
2797 for (
i = 0;
i < dstW;
i++) {
2798 int Y = 1 << 16,
U = 1 << 16,
V = 1 << 16,
A = 0x3;
2801 for (j = 0; j < lumFilterSize; j++)
2802 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2804 for (j = 0; j < chrFilterSize; j++) {
2805 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2806 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2815 (
unsigned)
V << (
shift + 20) |
2816 (
unsigned)
A << (
shift ? 0 : 30 ));
2820#define V30LE_WRAPPER(name, shift) \
2821static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2822 const int16_t **lumSrc, int lumFilterSize, \
2823 const int16_t *chrFilter, const int16_t **chrUSrc, \
2824 const int16_t **chrVSrc, int chrFilterSize, \
2825 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2828 yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2829 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2830 alpSrc, dest, dstW, y, shift); \
2836#define output_pixels(pos, val, shift, bits, output_shift) \
2838 AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2840 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2845 const int16_t **lumSrc,
int lumFilterSize,
2846 const int16_t *chrFilter,
const int16_t **chrUSrc,
2847 const int16_t **chrVSrc,
int chrFilterSize,
2848 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y,
int is_be)
2851 for (
i = 0;
i < dstW;
i++) {
2852 int Y = 1 << 14,
U = 1 << 14,
V = 1 << 14,
A = 65535;
2855 for (j = 0; j < lumFilterSize; j++)
2856 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2858 for (j = 0; j < chrFilterSize; j++) {
2859 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2860 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2872#define YUV2XV36(BE_LE, is_be) \
2874yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2875 const int16_t **lumSrc, int lumFilterSize, \
2876 const int16_t *chrFilter, const int16_t **chrUSrc, \
2877 const int16_t **chrVSrc, int chrFilterSize, \
2878 const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2880 yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2881 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2882 alpSrc, dest, dstW, y, is_be); \
2888#define output_pixels(pos, A, Y, U, V) \
2889 if (target == AV_PIX_FMT_AYUV) { \
2890 dest[pos + 0] = A; \
2891 dest[pos + 1] = Y; \
2892 dest[pos + 2] = U; \
2893 dest[pos + 3] = V; \
2894 } else if (target == AV_PIX_FMT_UYVA) { \
2895 dest[pos + 0] = U; \
2896 dest[pos + 1] = Y; \
2897 dest[pos + 2] = V; \
2898 dest[pos + 3] = A; \
2900 dest[pos + 0] = V; \
2901 dest[pos + 1] = U; \
2902 dest[pos + 2] = Y; \
2903 dest[pos + 3] = A; \
2908 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2909 const int16_t *abuf0, uint8_t *dest,
int dstW,
2912 int hasAlpha = !!abuf0;
2915 if (uvalpha < 2048) {
2916 for (
i = 0;
i < dstW;
i++) {
2917 int Y = (buf0[
i] + 64) >> 7;
2918 int U = (ubuf[0][
i] + 64) >> 7;
2919 int V = (vbuf[0][
i] + 64) >> 7;
2930 A = (abuf0[
i] + 64) >> 7;
2938 for (
i = 0;
i < dstW;
i++) {
2939 int Y = (buf0[
i] + 64) >> 7;
2940 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
2941 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
2952 A = (abuf0[
i] + 64) >> 7;
2964 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2965 const int16_t *abuf[2], uint8_t *dest,
int dstW,
2966 int yalpha,
int uvalpha,
int y,
2969 int hasAlpha = abuf && abuf[0] && abuf[1];
2970 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2971 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2972 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2973 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2974 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2975 int yalpha1 = 4096 - yalpha;
2976 int uvalpha1 = 4096 - uvalpha;
2982 for (
i = 0;
i < dstW;
i++) {
2983 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2984 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
2985 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
2996 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
3006 const int16_t **lumSrc,
int lumFilterSize,
3007 const int16_t *chrFilter,
const int16_t **chrUSrc,
3008 const int16_t **chrVSrc,
int chrFilterSize,
3009 const int16_t **alpSrc, uint8_t *dest,
int dstW,
3014 for (
i = 0;
i < dstW;
i++) {
3016 int Y = 1 << 18,
U = 1 << 18;
3017 int V = 1 << 18,
A = 255;
3019 for (j = 0; j < lumFilterSize; j++)
3020 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
3022 for (j = 0; j < chrFilterSize; j++)
3023 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
3025 for (j = 0; j < chrFilterSize; j++)
3026 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
3042 for (j = 0; j < lumFilterSize; j++)
3043 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
3057#define AYUVPACKEDWRAPPER(name, fmt) \
3058static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
3059 const int16_t **lumSrc, int lumFilterSize, \
3060 const int16_t *chrFilter, const int16_t **chrUSrc, \
3061 const int16_t **chrVSrc, int chrFilterSize, \
3062 const int16_t **alpSrc, uint8_t *dest, int dstW, \
3065 yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3066 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3067 alpSrc, dest, dstW, y, fmt); \
3070static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
3071 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3072 const int16_t *abuf[2], uint8_t *dest, int dstW, \
3073 int yalpha, int uvalpha, int y) \
3075 yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3076 dest, dstW, yalpha, uvalpha, y, fmt); \
3079static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
3080 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3081 const int16_t *abuf0, uint8_t *dest, int dstW, \
3082 int uvalpha, int y) \
3084 yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3085 abuf0, dest, dstW, uvalpha, \
3093#define output_pixel(pos, val, bits) \
3094 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
3096#define yuv2y2xx_wrapper(bits) \
3098 yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \
3099 const int16_t **lumSrc, int lumFilterSize, \
3100 const int16_t *chrFilter, \
3101 const int16_t **chrUSrc, \
3102 const int16_t **chrVSrc, int chrFilterSize, \
3103 const int16_t **alpSrc, \
3104 uint8_t *dest, int dstW, int y) \
3107 int shift = 11 + 16 - bits; \
3108 int output_shift = 16 - bits; \
3109 for (i = 0; i < ((dstW + 1) >> 1); i++) { \
3110 int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
3111 int U = 1 << (shift - 1), V = 1 << (shift - 1); \
3113 for (j = 0; j < lumFilterSize; j++) { \
3114 Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; \
3115 Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; \
3118 for (j = 0; j < chrFilterSize; j++) { \
3119 U += chrUSrc[j][i] * (unsigned)chrFilter[j]; \
3120 V += chrVSrc[j][i] * (unsigned)chrFilter[j]; \
3123 output_pixel(dest + 8 * i + 0, Y1, bits); \
3124 output_pixel(dest + 8 * i + 2, U, bits); \
3125 output_pixel(dest + 8 * i + 4, Y2, bits); \
3126 output_pixel(dest + 8 * i + 6, V, bits); \
3134yuv2y216le_X_c(
SwsInternal *
c, const int16_t *lumFilter,
3135 const int16_t **_lumSrc,
int lumFilterSize,
3136 const int16_t *chrFilter,
3137 const int16_t **_chrUSrc,
3138 const int16_t **_chrVSrc,
int chrFilterSize,
3139 const int16_t **_alpSrc,
3140 uint8_t *dest,
int dstW,
int y)
3147 for (
int i = 0;
i < ((dstW + 1) >> 1);
i++) {
3148 int Y1 = 1 << (
shift - 1), Y2 = 1 << (
shift - 1);
3157 for (
int j = 0; j < lumFilterSize; j++) {
3158 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
3159 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
3162 for (
int j = 0; j < chrFilterSize; j++) {
3163 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
3164 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
3176 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3177 const int16_t *abuf0, uint8_t *dest,
int dstW,
3182 if (uvalpha < 2048) {
3183 for (
i = 0;
i < dstW;
i++) {
3184 int Y = (buf0[
i] + 64) >> 7;
3185 int U = (ubuf[0][
i] + 64) >> 7;
3186 int V = (vbuf[0][
i] + 64) >> 7;
3196 dest[3 *
i + 1] =
Y;
3197 dest[3 *
i + 2] =
U;
3200 for (
i = 0;
i < dstW;
i++) {
3201 int Y = (buf0[
i] + 64) >> 7;
3202 int U = (ubuf[0][
i] + ubuf[1][
i] + 128) >> 8;
3203 int V = (vbuf[0][
i] + vbuf[1][
i] + 128) >> 8;
3213 dest[3 *
i + 1] =
Y;
3214 dest[3 *
i + 2] =
U;
3221 const int16_t *ubuf[2],
const int16_t *vbuf[2],
3222 const int16_t *abuf[2], uint8_t *dest,
int dstW,
3223 int yalpha,
int uvalpha,
int y)
3225 const int16_t *buf0 = buf[0], *buf1 = buf[1],
3226 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3227 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3228 int yalpha1 = 4096 - yalpha;
3229 int uvalpha1 = 4096 - uvalpha;
3235 for (
i = 0;
i < dstW;
i++) {
3236 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
3237 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
3238 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
3248 dest[3 *
i + 1] =
Y;
3249 dest[3 *
i + 2] =
U;
3255 const int16_t **lumSrc,
int lumFilterSize,
3256 const int16_t *chrFilter,
const int16_t **chrUSrc,
3257 const int16_t **chrVSrc,
int chrFilterSize,
3258 const int16_t **alpSrc, uint8_t *dest,
int dstW,
int y)
3262 for (
i = 0;
i < dstW;
i++) {
3264 int Y = 1 << 18,
U = 1 << 18;
3267 for (j = 0; j < lumFilterSize; j++)
3268 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
3270 for (j = 0; j < chrFilterSize; j++)
3271 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
3273 for (j = 0; j < chrFilterSize; j++)
3274 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
3288 dest[3 *
i + 1] =
Y;
3289 dest[3 *
i + 2] =
U;
3308 if (
desc->comp[0].depth == 10) {
3309 *yuv2plane1 =
isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3310 *
yuv2planeX =
isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3311 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3312 }
else if (
desc->comp[0].depth == 12) {
3313 *yuv2plane1 =
isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3314 *
yuv2planeX =
isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3315 *yuv2nv12cX =
isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3319 if (
desc->comp[0].depth == 10) {
3320 *yuv2plane1 =
isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3321 *
yuv2planeX =
isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3322 *yuv2nv12cX =
isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3325 }
else if (
is16BPS(dstFormat)) {
3326 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3327 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
3332 if (
desc->comp[0].depth == 10) {
3333 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_10BE_c : yuv2msbplaneX_10LE_c;
3334 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_10BE_c : yuv2msbplane1_10LE_c;
3335 }
else if (
desc->comp[0].depth == 12) {
3336 *
yuv2planeX =
isBE(dstFormat) ? yuv2msbplaneX_12BE_c : yuv2msbplaneX_12LE_c;
3337 *yuv2plane1 =
isBE(dstFormat) ? yuv2msbplane1_12BE_c : yuv2msbplane1_12LE_c;
3340 }
else if (
isNBPS(dstFormat)) {
3341 if (
desc->comp[0].depth == 9) {
3342 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
3343 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
3344 }
else if (
desc->comp[0].depth == 10) {
3345 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
3346 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
3347 }
else if (
desc->comp[0].depth == 12) {
3348 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
3349 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
3350 }
else if (
desc->comp[0].depth == 14) {
3351 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
3352 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
3357 *yuv2plane1 = yuv2plane1_floatBE_c;
3360 *yuv2plane1 = yuv2plane1_floatLE_c;
3369 switch (dstFormat) {
3372 *yuv2packedX = yuv2rgba32_full_X_c;
3373 *yuv2packed2 = yuv2rgba32_full_2_c;
3374 *yuv2packed1 = yuv2rgba32_full_1_c;
3376#if CONFIG_SWSCALE_ALPHA
3378 *yuv2packedX = yuv2rgba32_full_X_c;
3379 *yuv2packed2 = yuv2rgba32_full_2_c;
3380 *yuv2packed1 = yuv2rgba32_full_1_c;
3384 *yuv2packedX = yuv2rgbx32_full_X_c;
3385 *yuv2packed2 = yuv2rgbx32_full_2_c;
3386 *yuv2packed1 = yuv2rgbx32_full_1_c;
3392 *yuv2packedX = yuv2argb32_full_X_c;
3393 *yuv2packed2 = yuv2argb32_full_2_c;
3394 *yuv2packed1 = yuv2argb32_full_1_c;
3396#if CONFIG_SWSCALE_ALPHA
3398 *yuv2packedX = yuv2argb32_full_X_c;
3399 *yuv2packed2 = yuv2argb32_full_2_c;
3400 *yuv2packed1 = yuv2argb32_full_1_c;
3404 *yuv2packedX = yuv2xrgb32_full_X_c;
3405 *yuv2packed2 = yuv2xrgb32_full_2_c;
3406 *yuv2packed1 = yuv2xrgb32_full_1_c;
3412 *yuv2packedX = yuv2bgra32_full_X_c;
3413 *yuv2packed2 = yuv2bgra32_full_2_c;
3414 *yuv2packed1 = yuv2bgra32_full_1_c;
3416#if CONFIG_SWSCALE_ALPHA
3418 *yuv2packedX = yuv2bgra32_full_X_c;
3419 *yuv2packed2 = yuv2bgra32_full_2_c;
3420 *yuv2packed1 = yuv2bgra32_full_1_c;
3424 *yuv2packedX = yuv2bgrx32_full_X_c;
3425 *yuv2packed2 = yuv2bgrx32_full_2_c;
3426 *yuv2packed1 = yuv2bgrx32_full_1_c;
3432 *yuv2packedX = yuv2abgr32_full_X_c;
3433 *yuv2packed2 = yuv2abgr32_full_2_c;
3434 *yuv2packed1 = yuv2abgr32_full_1_c;
3436#if CONFIG_SWSCALE_ALPHA
3438 *yuv2packedX = yuv2abgr32_full_X_c;
3439 *yuv2packed2 = yuv2abgr32_full_2_c;
3440 *yuv2packed1 = yuv2abgr32_full_1_c;
3444 *yuv2packedX = yuv2xbgr32_full_X_c;
3445 *yuv2packed2 = yuv2xbgr32_full_2_c;
3446 *yuv2packed1 = yuv2xbgr32_full_1_c;
3451#if CONFIG_SWSCALE_ALPHA
3453 *yuv2packedX = yuv2rgba64le_full_X_c;
3454 *yuv2packed2 = yuv2rgba64le_full_2_c;
3455 *yuv2packed1 = yuv2rgba64le_full_1_c;
3459 *yuv2packedX = yuv2rgbx64le_full_X_c;
3460 *yuv2packed2 = yuv2rgbx64le_full_2_c;
3461 *yuv2packed1 = yuv2rgbx64le_full_1_c;
3465#if CONFIG_SWSCALE_ALPHA
3467 *yuv2packedX = yuv2rgba64be_full_X_c;
3468 *yuv2packed2 = yuv2rgba64be_full_2_c;
3469 *yuv2packed1 = yuv2rgba64be_full_1_c;
3473 *yuv2packedX = yuv2rgbx64be_full_X_c;
3474 *yuv2packed2 = yuv2rgbx64be_full_2_c;
3475 *yuv2packed1 = yuv2rgbx64be_full_1_c;
3479#if CONFIG_SWSCALE_ALPHA
3481 *yuv2packedX = yuv2bgra64le_full_X_c;
3482 *yuv2packed2 = yuv2bgra64le_full_2_c;
3483 *yuv2packed1 = yuv2bgra64le_full_1_c;
3487 *yuv2packedX = yuv2bgrx64le_full_X_c;
3488 *yuv2packed2 = yuv2bgrx64le_full_2_c;
3489 *yuv2packed1 = yuv2bgrx64le_full_1_c;
3493#if CONFIG_SWSCALE_ALPHA
3495 *yuv2packedX = yuv2bgra64be_full_X_c;
3496 *yuv2packed2 = yuv2bgra64be_full_2_c;
3497 *yuv2packed1 = yuv2bgra64be_full_1_c;
3501 *yuv2packedX = yuv2bgrx64be_full_X_c;
3502 *yuv2packed2 = yuv2bgrx64be_full_2_c;
3503 *yuv2packed1 = yuv2bgrx64be_full_1_c;
3508 *yuv2packedX = yuv2rgb24_full_X_c;
3509 *yuv2packed2 = yuv2rgb24_full_2_c;
3510 *yuv2packed1 = yuv2rgb24_full_1_c;
3513 *yuv2packedX = yuv2bgr24_full_X_c;
3514 *yuv2packed2 = yuv2bgr24_full_2_c;
3515 *yuv2packed1 = yuv2bgr24_full_1_c;
3518 *yuv2packedX = yuv2rgb48le_full_X_c;
3519 *yuv2packed2 = yuv2rgb48le_full_2_c;
3520 *yuv2packed1 = yuv2rgb48le_full_1_c;
3523 *yuv2packedX = yuv2bgr48le_full_X_c;
3524 *yuv2packed2 = yuv2bgr48le_full_2_c;
3525 *yuv2packed1 = yuv2bgr48le_full_1_c;
3528 *yuv2packedX = yuv2rgb48be_full_X_c;
3529 *yuv2packed2 = yuv2rgb48be_full_2_c;
3530 *yuv2packed1 = yuv2rgb48be_full_1_c;
3533 *yuv2packedX = yuv2bgr48be_full_X_c;
3534 *yuv2packed2 = yuv2bgr48be_full_2_c;
3535 *yuv2packed1 = yuv2bgr48be_full_1_c;
3538 *yuv2packedX = yuv2bgr4_byte_full_X_c;
3539 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3540 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3543 *yuv2packedX = yuv2rgb4_byte_full_X_c;
3544 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3545 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3548 *yuv2packedX = yuv2bgr8_full_X_c;
3549 *yuv2packed2 = yuv2bgr8_full_2_c;
3550 *yuv2packed1 = yuv2bgr8_full_1_c;
3553 *yuv2packedX = yuv2rgb8_full_X_c;
3554 *yuv2packed2 = yuv2rgb8_full_2_c;
3555 *yuv2packed1 = yuv2rgb8_full_1_c;
3558 *yuv2packedX = yuv2x2rgb10_full_X_c;
3559 *yuv2packed2 = yuv2x2rgb10_full_2_c;
3560 *yuv2packed1 = yuv2x2rgb10_full_1_c;
3563 *yuv2packedX = yuv2x2bgr10_full_X_c;
3564 *yuv2packed2 = yuv2x2bgr10_full_2_c;
3565 *yuv2packed1 = yuv2x2bgr10_full_1_c;
3604 if (!*yuv2packedX && !*yuv2anyX)
3608 switch (dstFormat) {
3610#if CONFIG_SWSCALE_ALPHA
3612 *yuv2packed1 = yuv2rgba64le_1_c;
3613 *yuv2packed2 = yuv2rgba64le_2_c;
3614 *yuv2packedX = yuv2rgba64le_X_c;
3618 *yuv2packed1 = yuv2rgbx64le_1_c;
3619 *yuv2packed2 = yuv2rgbx64le_2_c;
3620 *yuv2packedX = yuv2rgbx64le_X_c;
3624#if CONFIG_SWSCALE_ALPHA
3626 *yuv2packed1 = yuv2rgba64be_1_c;
3627 *yuv2packed2 = yuv2rgba64be_2_c;
3628 *yuv2packedX = yuv2rgba64be_X_c;
3632 *yuv2packed1 = yuv2rgbx64be_1_c;
3633 *yuv2packed2 = yuv2rgbx64be_2_c;
3634 *yuv2packedX = yuv2rgbx64be_X_c;
3638#if CONFIG_SWSCALE_ALPHA
3640 *yuv2packed1 = yuv2bgra64le_1_c;
3641 *yuv2packed2 = yuv2bgra64le_2_c;
3642 *yuv2packedX = yuv2bgra64le_X_c;
3646 *yuv2packed1 = yuv2bgrx64le_1_c;
3647 *yuv2packed2 = yuv2bgrx64le_2_c;
3648 *yuv2packedX = yuv2bgrx64le_X_c;
3652#if CONFIG_SWSCALE_ALPHA
3654 *yuv2packed1 = yuv2bgra64be_1_c;
3655 *yuv2packed2 = yuv2bgra64be_2_c;
3656 *yuv2packedX = yuv2bgra64be_X_c;
3660 *yuv2packed1 = yuv2bgrx64be_1_c;
3661 *yuv2packed2 = yuv2bgrx64be_2_c;
3662 *yuv2packedX = yuv2bgrx64be_X_c;
3666 *yuv2packed1 = yuv2rgb48le_1_c;
3667 *yuv2packed2 = yuv2rgb48le_2_c;
3668 *yuv2packedX = yuv2rgb48le_X_c;
3671 *yuv2packed1 = yuv2rgb48be_1_c;
3672 *yuv2packed2 = yuv2rgb48be_2_c;
3673 *yuv2packedX = yuv2rgb48be_X_c;
3676 *yuv2packed1 = yuv2bgr48le_1_c;
3677 *yuv2packed2 = yuv2bgr48le_2_c;
3678 *yuv2packedX = yuv2bgr48le_X_c;
3681 *yuv2packed1 = yuv2bgr48be_1_c;
3682 *yuv2packed2 = yuv2bgr48be_2_c;
3683 *yuv2packedX = yuv2bgr48be_X_c;
3688 *yuv2packed1 = yuv2rgb32_1_c;
3689 *yuv2packed2 = yuv2rgb32_2_c;
3690 *yuv2packedX = yuv2rgb32_X_c;
3692#if CONFIG_SWSCALE_ALPHA
3694 *yuv2packed1 = yuv2rgba32_1_c;
3695 *yuv2packed2 = yuv2rgba32_2_c;
3696 *yuv2packedX = yuv2rgba32_X_c;
3700 *yuv2packed1 = yuv2rgbx32_1_c;
3701 *yuv2packed2 = yuv2rgbx32_2_c;
3702 *yuv2packedX = yuv2rgbx32_X_c;
3709 *yuv2packed1 = yuv2rgb32_1_1_c;
3710 *yuv2packed2 = yuv2rgb32_1_2_c;
3711 *yuv2packedX = yuv2rgb32_1_X_c;
3713#if CONFIG_SWSCALE_ALPHA
3715 *yuv2packed1 = yuv2rgba32_1_1_c;
3716 *yuv2packed2 = yuv2rgba32_1_2_c;
3717 *yuv2packedX = yuv2rgba32_1_X_c;
3721 *yuv2packed1 = yuv2rgbx32_1_1_c;
3722 *yuv2packed2 = yuv2rgbx32_1_2_c;
3723 *yuv2packedX = yuv2rgbx32_1_X_c;
3728 *yuv2packed1 = yuv2rgb24_1_c;
3729 *yuv2packed2 = yuv2rgb24_2_c;
3730 *yuv2packedX = yuv2rgb24_X_c;
3733 *yuv2packed1 = yuv2bgr24_1_c;
3734 *yuv2packed2 = yuv2bgr24_2_c;
3735 *yuv2packedX = yuv2bgr24_X_c;
3741 *yuv2packed1 = yuv2rgb16_1_c;
3742 *yuv2packed2 = yuv2rgb16_2_c;
3743 *yuv2packedX = yuv2rgb16_X_c;
3749 *yuv2packed1 = yuv2rgb15_1_c;
3750 *yuv2packed2 = yuv2rgb15_2_c;
3751 *yuv2packedX = yuv2rgb15_X_c;
3757 *yuv2packed1 = yuv2rgb12_1_c;
3758 *yuv2packed2 = yuv2rgb12_2_c;
3759 *yuv2packedX = yuv2rgb12_X_c;
3763 *yuv2packed1 = yuv2rgb8_1_c;
3764 *yuv2packed2 = yuv2rgb8_2_c;
3765 *yuv2packedX = yuv2rgb8_X_c;
3769 *yuv2packed1 = yuv2rgb4_1_c;
3770 *yuv2packed2 = yuv2rgb4_2_c;
3771 *yuv2packedX = yuv2rgb4_X_c;
3775 *yuv2packed1 = yuv2rgb4b_1_c;
3776 *yuv2packed2 = yuv2rgb4b_2_c;
3777 *yuv2packedX = yuv2rgb4b_X_c;
3781 *yuv2packed1 = yuv2x2rgb10_1_c;
3782 *yuv2packed2 = yuv2x2rgb10_2_c;
3783 *yuv2packedX = yuv2x2rgb10_X_c;
3787 *yuv2packed1 = yuv2x2bgr10_1_c;
3788 *yuv2packed2 = yuv2x2bgr10_2_c;
3789 *yuv2packedX = yuv2x2bgr10_X_c;
3793 switch (dstFormat) {
3795 *yuv2packed1 = yuv2monowhite_1_c;
3796 *yuv2packed2 = yuv2monowhite_2_c;
3797 *yuv2packedX = yuv2monowhite_X_c;
3800 *yuv2packed1 = yuv2monoblack_1_c;
3801 *yuv2packed2 = yuv2monoblack_2_c;
3802 *yuv2packedX = yuv2monoblack_X_c;
3805 *yuv2packed1 = yuv2yuyv422_1_c;
3806 *yuv2packed2 = yuv2yuyv422_2_c;
3807 *yuv2packedX = yuv2yuyv422_X_c;
3810 *yuv2packed1 = yuv2yvyu422_1_c;
3811 *yuv2packed2 = yuv2yvyu422_2_c;
3812 *yuv2packedX = yuv2yvyu422_X_c;
3815 *yuv2packed1 = yuv2uyvy422_1_c;
3816 *yuv2packed2 = yuv2uyvy422_2_c;
3817 *yuv2packedX = yuv2uyvy422_X_c;
3830 *yuv2packed1 = yuv2ya16le_1_c;
3831 *yuv2packed2 = yuv2ya16le_2_c;
3832 *yuv2packedX = yuv2ya16le_X_c;
3835 *yuv2packed1 = yuv2ya16be_1_c;
3836 *yuv2packed2 = yuv2ya16be_2_c;
3837 *yuv2packedX = yuv2ya16be_X_c;
3840 *yuv2packedX = yuv2v30xle_X_c;
3843 *yuv2packedX = yuv2ayuv64le_X_c;
3846 *yuv2packedX = yuv2ayuv64be_X_c;
3849 *yuv2packed1 = yuv2ayuv_1_c;
3850 *yuv2packed2 = yuv2ayuv_2_c;
3851 *yuv2packedX = yuv2ayuv_X_c;
3855 *yuv2packed1 = yuv2vuyX_1_c;
3856 *yuv2packed2 = yuv2vuyX_2_c;
3857 *yuv2packedX = yuv2vuyX_X_c;
3860 *yuv2packed1 = yuv2uyva_1_c;
3861 *yuv2packed2 = yuv2uyva_2_c;
3862 *yuv2packedX = yuv2uyva_X_c;
3865 *yuv2packedX = yuv2xv30le_X_c;
3868 *yuv2packedX = yuv2xv36le_X_c;
3871 *yuv2packedX = yuv2xv36be_X_c;
3874 *yuv2packedX = yuv2xv48le_X_c;
3877 *yuv2packedX = yuv2xv48be_X_c;
3880 *yuv2packedX = yuv2y210le_X_c;
3883 *yuv2packedX = yuv2y212le_X_c;
3886 *yuv2packedX = yuv2y216le_X_c;
static double val(void *priv, double ch)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Convenience header that includes libavutil's core.
#define i(width, name, range_min, range_max)
static void yuv2rgb(uint8_t *out, int ridx, int Y, int U, int V)
@ SWS_FULL_CHR_H_INT
Perform full chroma upsampling when upscaling to RGB.
static av_always_inline uint32_t av_float2int(float f)
Reinterpret a float as a 32-bit integer.
static int shift(int a, int b)
#define u(width, name, range_min, range_max)
Macro definitions for various function/variable attributes.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
#define yuv2MSBNBPS(bits, BE_LE, is_be, template_size, typeX_t)
const uint8_t ff_dither_8x8_73[][8]
static av_always_inline void yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW, int big_endian, int output_bits)
#define YUV2XV36(BE_LE, is_be)
#define accumulate_bit(acc, val)
static av_always_inline void yuv2planeX_10_c_template(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, int big_endian, int output_bits)
static av_always_inline void yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
#define yuv2plane1_float(template, dest_type, BE_LE)
static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum AVPixelFormat target, int hasAlpha)
static av_always_inline void yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW)
static av_always_inline void yuv2rgb_full_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
static void yuv2ya8_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
static void yuv2vyu444_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
static void yuv2ya8_1_c(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
const uint8_t ff_dither_2x2_4[][8]
static void yuv2nv12cX_16BE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest8, int chrDstW)
static void yuv2p01xl1_c(const int16_t *src, uint16_t *dest, int dstW, int big_endian, int output_bits, int output_shift)
static av_always_inline void yuv2ayuv_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target)
static av_always_inline void yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int unused_uvalpha, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes, int is_be)
static av_always_inline void yuv2rgba64_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
static void yuv2vyu444_1_c(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y)
static av_always_inline void yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
#define yuv2p01x_wrapper(fmt, bits, shift)
static av_always_inline void yuv2ayuv_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target)
static av_always_inline void yuv2rgb_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha)
const uint8_t ff_dither_2x2_8[][8]
#define V30LE_WRAPPER(name, shift)
const uint8_t ff_dither_4x4_16[][8]
static void yuv2gbrpmsb_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
static av_always_inline void yuv2ya16_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha_param, int unused_uvalpha, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes, int is_be)
static av_always_inline void yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **unused_chrUSrc, const int32_t **unused_chrVSrc, int unused_chrFilterSize, const int32_t **alpSrc, uint16_t *dest, int dstW, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes, int is_be)
static av_always_inline void yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha)
static av_always_inline void yuv2rgb_write_full(SwsInternal *c, uint8_t *dest, int i, int Y, int A, int U, int V, int y, enum AVPixelFormat target, int hasAlpha, int err[4])
#define output_pixel(pos, val, bias, signedness)
static av_always_inline void yuv2ayuv_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target)
#define yuv2planeX_float(template, dest_type, BE_LE)
static av_always_inline void yuv2rgba64_full_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha_param, int uvalpha_param, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
static av_always_inline void yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src, float *dest, int dstW)
static av_always_inline void yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target)
static av_always_inline void yuv2nv12cX_16_c_template(int big_endian, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest8, int chrDstW, int output_bits)
static av_always_inline void yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target)
static av_always_inline void yuv2rgb_full_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
static av_always_inline void yuv2422_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target)
const uint8_t ff_dither_8x8_220[][8]
static av_always_inline void yuv2plane1_float_bswap_c_template(const int32_t *src, uint32_t *dest, int dstW)
static void yuv2ya8_2_c(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
static void yuv2vyu444_2_c(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
static av_always_inline void yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha)
av_cold void ff_sws_init_output_funcs(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX)
#define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t)
static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest8, int chrDstW, int output_bits, int output_shift)
static av_always_inline void yuv2rgba64_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha_param, int uvalpha_param, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
static void yuv2planeX_8_c(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
#define AYUVPACKEDWRAPPER(name, fmt)
static av_always_inline void yuv2rgba64_full_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
static void yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
#define yuv2y2xx_wrapper(bits)
static av_always_inline void yuv2msbplaneX_10_c_template(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, int big_endian, int output_bits)
#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha)
static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int chrDstW)
static av_always_inline void yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **_lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **_chrUSrc, const int16_t **_chrVSrc, int chrFilterSize, const int16_t **_alpSrc, uint8_t *dest, int dstW, int y, int A_offset, int Y_offset, int U_offset, int V_offset, int is_be)
static av_always_inline void yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, int is_be)
static av_always_inline void yuv2422_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target)
#define output_pixels(pos, Y1, U, Y2, V)
static void yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrcx, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrcx, const int16_t **chrVSrcx, int chrFilterSize, const int16_t **alpSrcx, uint8_t **dest, int dstW, int y)
#define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes)
const uint8_t ff_dither_8x8_32[][8]
#define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be)
static void yuv2p01xlX_c(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, int big_endian, int output_bits, int output_shift)
static av_always_inline void yuv2422_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target)
static av_always_inline void yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, int shift)
static void yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrcx, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrcx, const int16_t **chrVSrcx, int chrFilterSize, const int16_t **alpSrcx, uint8_t **dest, int dstW, int y)
static av_always_inline void yuv2planeX_float_bswap_c_template(const int16_t *filter, int filterSize, const int32_t **src, uint32_t *dest, int dstW)
static av_always_inline void yuv2planeX_16_c_template(const int16_t *filter, int filterSize, const int32_t **src, uint16_t *dest, int dstW, int big_endian, int output_bits)
#define YUV2PACKEDWRAPPER(name, base, ext, fmt)
static void yuv2xv36_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, int is_be)
static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum AVPixelFormat target, int hasAlpha)
static av_always_inline void yuv2rgb_write_full(SwsInternal *c, uint8_t *dest, int i, int R, int A, int G, int B, int y, enum AVPixelFormat target, int hasAlpha, int err[4])
#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_BGR444
#define AV_PIX_FMT_BGR555
#define AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_X2RGB10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_UYVA
packed UYVA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
@ AV_PIX_FMT_V30XLE
packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
@ AV_PIX_FMT_AYUV64BE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
@ AV_PIX_FMT_XV36LE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian,...
@ AV_PIX_FMT_XV30LE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channe...
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
@ AV_PIX_FMT_GBRP10MSBBE
planar GBR 4:4:4 30bpp, lowest bits zero, big-endian
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_X2BGR10LE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
@ AV_PIX_FMT_GBRAP14BE
planar GBR 4:4:4:4 56bpp, big-endian
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP10MSBLE
planar GBR 4:4:4 30bpp, lowest bits zero, little-endian
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
@ AV_PIX_FMT_AYUV
packed AYUV 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
@ AV_PIX_FMT_XV36BE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian,...
@ AV_PIX_FMT_GBRP12MSBLE
planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
@ AV_PIX_FMT_Y212LE
packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_Y216LE
packed YUV 4:2:2 like YUYV422, 32bpp, little-endian
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_X2RGB10LE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
@ AV_PIX_FMT_XV48LE
packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_VUYA
packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_XV48BE
packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
@ AV_PIX_FMT_X2BGR10BE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
@ AV_PIX_FMT_VYU444
packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_BGR4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
@ AV_PIX_FMT_X2RGB10BE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP12MSBBE
planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
#define AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_X2BGR10
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_RGB444
#define AV_PIX_FMT_RGB555
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define YUVRGB_TABLE_HEADROOM
void(* yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional v...
void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output with multi-point vertical scaling between...
static av_always_inline int isSwappedChroma(enum AVPixelFormat pix_fmt)
void(* yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point ver...
static av_always_inline int isDataInHighBits(enum AVPixelFormat pix_fmt)
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt)
void(* yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to YUV/RGB output by doing multi-point vertical scaling...
void(* yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scalin...
void(* yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling ...
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
static void FUNC yuv2planeX(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static const uint16_t dither[8][8]