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, },
137 #define output_pixel(pos, val, bias, signedness) \
139 AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
141 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
146 int big_endian,
int output_bits)
152 for (
i = 0;
i < dstW;
i++) {
160 const int32_t **
src, uint16_t *dest,
int dstW,
161 int big_endian,
int output_bits)
167 for (
i = 0;
i < dstW;
i++) {
177 for (j = 0; j < filterSize; j++)
185 const int16_t *chrFilter,
int chrFilterSize,
186 const int16_t **chrUSrc,
const int16_t **chrVSrc,
189 uint16_t *dest = (uint16_t*)dest8;
196 for (
i = 0;
i < chrDstW;
i++) {
198 int v = 1 << (
shift - 1);
203 for (j = 0; j < chrFilterSize; j++) {
204 u += uSrc[j][
i] * (unsigned)chrFilter[j];
205 v += vSrc[j][
i] * (unsigned)chrFilter[j];
217 static const int shift = 3;
218 static const float float_mult = 1.0f / 65535.0f;
222 for (
i = 0;
i < dstW; ++
i){
225 dest[
i] = float_mult * (float)val_uint;
233 static const int shift = 3;
234 static const float float_mult = 1.0f / 65535.0f;
238 for (
i = 0;
i < dstW; ++
i){
247 float *dest,
int dstW)
250 static const int shift = 15;
251 static const float float_mult = 1.0f / 65535.0f;
255 for (
i = 0;
i < dstW; ++
i){
256 val = (1 << (
shift - 1)) - 0x40000000;
257 for (j = 0; j < filterSize; ++j){
261 dest[
i] = float_mult * (float)val_uint;
267 uint32_t *dest,
int dstW)
270 static const int shift = 15;
271 static const float float_mult = 1.0f / 65535.0f;
275 for (
i = 0;
i < dstW; ++
i){
276 val = (1 << (
shift - 1)) - 0x40000000;
277 for (j = 0; j < filterSize; ++j){
285 #define yuv2plane1_float(template, dest_type, BE_LE) \
286 static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
287 const uint8_t *dither, int offset) \
289 template((const int32_t *)src, (dest_type *)dest, dstW); \
292 #define yuv2planeX_float(template, dest_type, BE_LE) \
293 static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
294 const int16_t **src, uint8_t *dest, int dstW, \
295 const uint8_t *dither, int offset) \
297 template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
314 #define output_pixel(pos, val) \
316 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
318 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
322 yuv2plane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
323 int big_endian,
int output_bits)
326 int shift = 15 - output_bits;
328 for (
i = 0;
i < dstW;
i++) {
336 const int16_t **
src, uint16_t *dest,
int dstW,
337 int big_endian,
int output_bits)
340 int shift = 11 + 16 - output_bits;
342 for (
i = 0;
i < dstW;
i++) {
346 for (j = 0; j < filterSize; j++)
355 #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
356 static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
357 uint8_t *dest, int dstW, \
358 const uint8_t *dither, int offset)\
360 yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
361 (uint16_t *) dest, dstW, is_be, bits); \
363 static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
364 const int16_t **src, uint8_t *dest, int dstW, \
365 const uint8_t *dither, int offset)\
367 yuv2planeX_## template_size ## _c_template(filter, \
368 filterSize, (const typeX_t **) src, \
369 (uint16_t *) dest, dstW, is_be, bits); \
382 static void yuv2planeX_8_c(
const int16_t *
filter,
int filterSize,
387 for (
i=0;
i<dstW;
i++) {
390 for (j=0; j<filterSize; j++) {
403 for (
i=0;
i<dstW;
i++) {
410 const int16_t *chrFilter,
int chrFilterSize,
411 const int16_t **chrUSrc,
const int16_t **chrVSrc,
418 for (
i=0;
i<chrDstW;
i++) {
419 int u = chrDither[
i & 7] << 12;
420 int v = chrDither[(
i + 3) & 7] << 12;
422 for (j=0; j<chrFilterSize; j++) {
423 u += chrUSrc[j][
i] * chrFilter[j];
424 v += chrVSrc[j][
i] * chrFilter[j];
431 for (
i=0;
i<chrDstW;
i++) {
432 int u = chrDither[
i & 7] << 12;
433 int v = chrDither[(
i + 3) & 7] << 12;
435 for (j=0; j<chrFilterSize; j++) {
436 u += chrUSrc[j][
i] * chrFilter[j];
437 v += chrVSrc[j][
i] * chrFilter[j];
446 #define output_pixel(pos, val) \
448 AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
450 AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
454 uint16_t *dest,
int dstW,
460 for (
i = 0;
i < dstW;
i++) {
467 const int16_t **
src, uint16_t *dest,
int dstW,
473 for (
i = 0;
i < dstW;
i++) {
476 for (j = 0; j < filterSize; j++)
484 const int16_t *chrFilter,
int chrFilterSize,
485 const int16_t **chrUSrc,
const int16_t **chrVSrc,
488 uint16_t *dest = (uint16_t*)dest8;
493 for (
i = 0;
i < chrDstW;
i++) {
495 int v = 1 << (
shift - 1);
497 for (j = 0; j < chrFilterSize; j++) {
498 u += chrUSrc[j][
i] * chrFilter[j];
499 v += chrVSrc[j][
i] * chrFilter[j];
538 #define accumulate_bit(acc, val) \
541 #define output_pixel(pos, acc) \
542 if (target == AV_PIX_FMT_MONOBLACK) { \
550 const int16_t **lumSrc,
int lumFilterSize,
551 const int16_t *chrFilter,
const int16_t **chrUSrc,
552 const int16_t **chrVSrc,
int chrFilterSize,
553 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
561 for (
i = 0;
i < dstW;
i += 2) {
566 for (j = 0; j < lumFilterSize; j++) {
567 Y1 += lumSrc[j][
i] * lumFilter[j];
568 Y2 += lumSrc[j][
i+1] * lumFilter[j];
572 if ((Y1 | Y2) & 0x100) {
577 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;
578 c->dither_error[0][
i] = err;
579 acc = 2*
acc + (Y1 >= 128);
582 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);
583 c->dither_error[0][
i+1] = Y1;
584 acc = 2*
acc + (err >= 128);
594 c->dither_error[0][
i] = err;
603 const int16_t *ubuf[2],
const int16_t *vbuf[2],
604 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
605 int yalpha,
int uvalpha,
int y,
608 const int16_t *buf0 = buf[0], *buf1 = buf[1];
610 int yalpha1 = 4096 - yalpha;
617 for (
i = 0;
i < dstW;
i +=2) {
620 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
621 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;
622 c->dither_error[0][
i] = err;
626 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
627 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;
628 c->dither_error[0][
i+1] =
Y;
629 acc = 2*
acc + (err >= 128);
635 c->dither_error[0][
i] = err;
639 for (
i = 0;
i < dstW;
i += 8) {
643 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
645 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
647 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
649 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
651 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
653 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
655 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
657 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
667 const int16_t *ubuf[2],
const int16_t *vbuf[2],
668 const int16_t *abuf0,
uint8_t *dest,
int dstW,
677 for (
i = 0;
i < dstW;
i +=2) {
680 Y = ((buf0[
i + 0] + 64) >> 7);
681 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;
682 c->dither_error[0][
i] = err;
686 err = ((buf0[
i + 1] + 64) >> 7);
687 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;
688 c->dither_error[0][
i+1] =
Y;
689 acc = 2*
acc + (err >= 128);
695 c->dither_error[0][
i] = err;
699 for (
i = 0;
i < dstW;
i += 8) {
716 #undef accumulate_bit
718 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
719 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
720 const int16_t **lumSrc, int lumFilterSize, \
721 const int16_t *chrFilter, const int16_t **chrUSrc, \
722 const int16_t **chrVSrc, int chrFilterSize, \
723 const int16_t **alpSrc, uint8_t *dest, int dstW, \
726 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
727 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
728 alpSrc, dest, dstW, y, fmt); \
731 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
732 const int16_t *ubuf[2], const int16_t *vbuf[2], \
733 const int16_t *abuf[2], uint8_t *dest, int dstW, \
734 int yalpha, int uvalpha, int y) \
736 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
737 dest, dstW, yalpha, uvalpha, y, fmt); \
740 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
741 const int16_t *ubuf[2], const int16_t *vbuf[2], \
742 const int16_t *abuf0, uint8_t *dest, int dstW, \
743 int uvalpha, int y) \
745 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
746 abuf0, dest, dstW, uvalpha, \
753 #define output_pixels(pos, Y1, U, Y2, V) \
754 if (target == AV_PIX_FMT_YUYV422) { \
755 dest[pos + 0] = Y1; \
757 dest[pos + 2] = Y2; \
759 } else if (target == AV_PIX_FMT_YVYU422) { \
760 dest[pos + 0] = Y1; \
762 dest[pos + 2] = Y2; \
766 dest[pos + 1] = Y1; \
768 dest[pos + 3] = Y2; \
773 const int16_t **lumSrc,
int lumFilterSize,
774 const int16_t *chrFilter,
const int16_t **chrUSrc,
775 const int16_t **chrVSrc,
int chrFilterSize,
776 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
781 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
788 for (j = 0; j < lumFilterSize; j++) {
789 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
790 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
792 for (j = 0; j < chrFilterSize; j++) {
793 U += chrUSrc[j][
i] * chrFilter[j];
794 V += chrVSrc[j][
i] * chrFilter[j];
800 if ((Y1 | Y2 |
U |
V) & 0x100) {
812 const int16_t *ubuf[2],
const int16_t *vbuf[2],
813 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
814 int yalpha,
int uvalpha,
int y,
817 const int16_t *buf0 = buf[0], *buf1 = buf[1],
818 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
819 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
820 int yalpha1 = 4096 - yalpha;
821 int uvalpha1 = 4096 - uvalpha;
826 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
827 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
828 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
829 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
830 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
832 if ((Y1 | Y2 |
U |
V) & 0x100) {
845 const int16_t *ubuf[2],
const int16_t *vbuf[2],
846 const int16_t *abuf0,
uint8_t *dest,
int dstW,
849 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
852 if (uvalpha < 2048) {
853 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
854 int Y1 = (buf0[
i * 2 ]+64) >> 7;
855 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
856 int U = (ubuf0[
i] +64) >> 7;
857 int V = (vbuf0[
i] +64) >> 7;
859 if ((Y1 | Y2 |
U |
V) & 0x100) {
869 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
870 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
871 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
872 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
873 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
874 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
876 if ((Y1 | Y2 |
U |
V) & 0x100) {
894 #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)
895 #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)
896 #define output_pixel(pos, val) \
897 if (isBE(target)) { \
905 const int32_t **lumSrc,
int lumFilterSize,
906 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
907 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
908 const int32_t **alpSrc, uint16_t *dest,
int dstW,
909 int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
911 int hasAlpha = !!alpSrc;
914 for (
i = 0;
i < dstW;
i++) {
919 for (j = 0; j < lumFilterSize; j++)
920 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
923 Y += (1<<3) + 0x8000;
927 A = -0x40000000 + (1<<14);
928 for (j = 0; j < lumFilterSize; j++)
929 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
944 const int32_t *abuf[2], uint16_t *dest,
int dstW,
945 int yalpha,
int unused_uvalpha,
int y,
946 enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
948 int hasAlpha = abuf && abuf[0] && abuf[1];
949 const int32_t *buf0 = buf[0], *buf1 = buf[1],
950 *abuf0 = hasAlpha ? abuf[0] :
NULL,
951 *abuf1 = hasAlpha ? abuf[1] :
NULL;
952 int yalpha1 = 4096 - yalpha;
957 for (
i = 0;
i < dstW;
i++) {
958 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
964 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
976 const int32_t *abuf0, uint16_t *dest,
int dstW,
977 int unused_uvalpha,
int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
979 int hasAlpha = !!abuf0;
982 for (
i = 0;
i < dstW;
i++) {
983 int Y = buf0[
i] >> 3;
1001 const int32_t **lumSrc,
int lumFilterSize,
1002 const int16_t *chrFilter,
const int32_t **chrUSrc,
1003 const int32_t **chrVSrc,
int chrFilterSize,
1004 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1005 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1008 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1010 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1012 unsigned Y1 = -0x40000000;
1013 unsigned Y2 = -0x40000000;
1014 unsigned U = -(128 << 23);
1015 unsigned V = -(128 << 23);
1018 for (j = 0; j < lumFilterSize; j++) {
1019 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1020 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1022 for (j = 0; j < chrFilterSize; j++) {;
1023 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1024 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1030 for (j = 0; j < lumFilterSize; j++) {
1031 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1032 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1049 Y1 -=
c->yuv2rgb_y_offset;
1050 Y2 -=
c->yuv2rgb_y_offset;
1051 Y1 *=
c->yuv2rgb_y_coeff;
1052 Y2 *=
c->yuv2rgb_y_coeff;
1053 Y1 += (1 << 13) - (1 << 29);
1054 Y2 += (1 << 13) - (1 << 29);
1057 R =
V *
c->yuv2rgb_v2r_coeff;
1058 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1059 B =
U *
c->yuv2rgb_u2b_coeff;
1084 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1085 int yalpha,
int uvalpha,
int y,
1088 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1089 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1090 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1091 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1092 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1093 int yalpha1 = 4096 - yalpha;
1094 int uvalpha1 = 4096 - uvalpha;
1096 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1101 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1102 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1103 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1104 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1105 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1108 Y1 -=
c->yuv2rgb_y_offset;
1109 Y2 -=
c->yuv2rgb_y_offset;
1110 Y1 *=
c->yuv2rgb_y_coeff;
1111 Y2 *=
c->yuv2rgb_y_coeff;
1112 Y1 += (1 << 13) - (1 << 29);
1113 Y2 += (1 << 13) - (1 << 29);
1115 R =
V *
c->yuv2rgb_v2r_coeff;
1116 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1117 B =
U *
c->yuv2rgb_u2b_coeff;
1120 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1121 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1149 const int32_t *abuf0, uint16_t *dest,
int dstW,
1150 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1152 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1156 if (uvalpha < 2048) {
1157 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1158 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1159 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1160 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1161 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1164 Y1 -=
c->yuv2rgb_y_offset;
1165 Y2 -=
c->yuv2rgb_y_offset;
1166 Y1 *=
c->yuv2rgb_y_coeff;
1167 Y2 *=
c->yuv2rgb_y_coeff;
1168 Y1 += (1 << 13) - (1 << 29);
1169 Y2 += (1 << 13) - (1 << 29);
1172 A1 = abuf0[
i * 2 ] * (
SUINT)(1 << 11);
1173 A2 = abuf0[
i * 2 + 1] * (
SUINT)(1 << 11);
1179 R =
V *
c->yuv2rgb_v2r_coeff;
1180 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1181 B =
U *
c->yuv2rgb_u2b_coeff;
1201 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1202 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1203 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1204 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1205 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1206 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1207 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1210 Y1 -=
c->yuv2rgb_y_offset;
1211 Y2 -=
c->yuv2rgb_y_offset;
1212 Y1 *=
c->yuv2rgb_y_coeff;
1213 Y2 *=
c->yuv2rgb_y_coeff;
1214 Y1 += (1 << 13) - (1 << 29);
1215 Y2 += (1 << 13) - (1 << 29);
1218 A1 = abuf0[
i * 2 ] * (1 << 11);
1219 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1225 R =
V *
c->yuv2rgb_v2r_coeff;
1226 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1227 B =
U *
c->yuv2rgb_u2b_coeff;
1251 const int32_t **lumSrc,
int lumFilterSize,
1252 const int16_t *chrFilter,
const int32_t **chrUSrc,
1253 const int32_t **chrVSrc,
int chrFilterSize,
1254 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1255 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1260 for (
i = 0;
i < dstW;
i++) {
1262 int Y = -0x40000000;
1263 int U = -(128 << 23);
1264 int V = -(128 << 23);
1267 for (j = 0; j < lumFilterSize; j++) {
1268 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1270 for (j = 0; j < chrFilterSize; j++) {;
1271 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1272 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1277 for (j = 0; j < lumFilterSize; j++) {
1278 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1291 Y -=
c->yuv2rgb_y_offset;
1292 Y *=
c->yuv2rgb_y_coeff;
1293 Y += (1 << 13) - (1<<29);
1296 R =
V *
c->yuv2rgb_v2r_coeff;
1297 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1298 B =
U *
c->yuv2rgb_u2b_coeff;
1316 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1317 int yalpha,
int uvalpha,
int y,
1320 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1321 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1322 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1323 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1324 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1325 int yalpha1 = 4096 - yalpha;
1326 int uvalpha1 = 4096 - uvalpha;
1333 for (
i = 0;
i < dstW;
i++) {
1334 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1335 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1336 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1339 Y -=
c->yuv2rgb_y_offset;
1340 Y *=
c->yuv2rgb_y_coeff;
1341 Y += (1 << 13) - (1 << 29);
1343 R =
V *
c->yuv2rgb_v2r_coeff;
1344 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1345 B =
U *
c->yuv2rgb_u2b_coeff;
1348 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1368 const int32_t *abuf0, uint16_t *dest,
int dstW,
1369 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1371 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1375 if (uvalpha < 2048) {
1376 for (
i = 0;
i < dstW;
i++) {
1378 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1379 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1382 Y -=
c->yuv2rgb_y_offset;
1383 Y *=
c->yuv2rgb_y_coeff;
1384 Y += (1 << 13) - (1 << 29);
1387 A = abuf0[
i] * (1 << 11);
1392 R =
V *
c->yuv2rgb_v2r_coeff;
1393 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1394 B =
U *
c->yuv2rgb_u2b_coeff;
1407 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1409 for (
i = 0;
i < dstW;
i++) {
1411 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1412 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1415 Y -=
c->yuv2rgb_y_offset;
1416 Y *=
c->yuv2rgb_y_coeff;
1417 Y += (1 << 13) - (1 << 29);
1420 A = abuf0[
i] * (1 << 11);
1425 R =
V *
c->yuv2rgb_v2r_coeff;
1426 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1427 B =
U *
c->yuv2rgb_u2b_coeff;
1446 #define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \
1447 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1448 const int16_t **_lumSrc, int lumFilterSize, \
1449 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1450 const int16_t **_chrVSrc, int chrFilterSize, \
1451 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1454 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1455 **chrUSrc = (const int32_t **) _chrUSrc, \
1456 **chrVSrc = (const int32_t **) _chrVSrc, \
1457 **alpSrc = (const int32_t **) _alpSrc; \
1458 uint16_t *dest = (uint16_t *) _dest; \
1459 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1460 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1461 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \
1464 static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
1465 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1466 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1467 int yalpha, int uvalpha, int y) \
1469 const int32_t **buf = (const int32_t **) _buf, \
1470 **ubuf = (const int32_t **) _ubuf, \
1471 **vbuf = (const int32_t **) _vbuf, \
1472 **abuf = (const int32_t **) _abuf; \
1473 uint16_t *dest = (uint16_t *) _dest; \
1474 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1475 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \
1478 static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
1479 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1480 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1481 int uvalpha, int y) \
1483 const int32_t *buf0 = (const int32_t *) _buf0, \
1484 **ubuf = (const int32_t **) _ubuf, \
1485 **vbuf = (const int32_t **) _vbuf, \
1486 *abuf0 = (const int32_t *) _abuf0; \
1487 uint16_t *dest = (uint16_t *) _dest; \
1488 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1489 dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \
1530 unsigned A1,
unsigned A2,
1531 const
void *_r, const
void *_g, const
void *_b,
int y,
1536 uint32_t *dest = (uint32_t *) _dest;
1537 const uint32_t *
r = (
const uint32_t *) _r;
1538 const uint32_t *
g = (
const uint32_t *) _g;
1539 const uint32_t *
b = (
const uint32_t *) _b;
1544 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1545 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1551 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1552 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1554 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1557 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1559 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1560 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1569 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1570 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1572 dest[
i * 6 + 0] =
r_b[Y1];
1573 dest[
i * 6 + 1] =
g[Y1];
1574 dest[
i * 6 + 2] =
b_r[Y1];
1575 dest[
i * 6 + 3] =
r_b[Y2];
1576 dest[
i * 6 + 4] =
g[Y2];
1577 dest[
i * 6 + 5] =
b_r[Y2];
1583 uint16_t *dest = (uint16_t *) _dest;
1584 const uint16_t *
r = (
const uint16_t *) _r;
1585 const uint16_t *
g = (
const uint16_t *) _g;
1586 const uint16_t *
b = (
const uint16_t *) _b;
1587 int dr1, dg1, db1, dr2, dg2, db2;
1612 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1615 if (
i * 2 + 1 < dstW)
1616 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1618 uint32_t *dest = (uint32_t *) _dest;
1619 const uint32_t *
r = (
const uint32_t *) _r;
1620 const uint32_t *
g = (
const uint32_t *) _g;
1621 const uint32_t *
b = (
const uint32_t *) _b;
1622 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1623 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1629 int dr1, dg1, db1, dr2, dg2, db2;
1634 dr1 = dg1 =
d32[(
i * 2 + 0) & 7];
1635 db1 =
d64[(
i * 2 + 0) & 7];
1636 dr2 = dg2 =
d32[(
i * 2 + 1) & 7];
1637 db2 =
d64[(
i * 2 + 1) & 7];
1641 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1642 dg1 =
d64[(
i * 2 + 0) & 7];
1643 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1644 dg2 =
d64[(
i * 2 + 1) & 7];
1648 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1649 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1651 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1652 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1659 const int16_t **lumSrc,
int lumFilterSize,
1660 const int16_t *chrFilter,
const int16_t **chrUSrc,
1661 const int16_t **chrVSrc,
int chrFilterSize,
1662 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
1667 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1673 const void *
r, *
g, *
b;
1675 for (j = 0; j < lumFilterSize; j++) {
1676 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1677 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1679 for (j = 0; j < chrFilterSize; j++) {
1680 U += chrUSrc[j][
i] * chrFilter[j];
1681 V += chrVSrc[j][
i] * chrFilter[j];
1690 for (j = 0; j < lumFilterSize; j++) {
1691 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1692 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1696 if ((
A1 |
A2) & 0x100) {
1707 r,
g,
b, y, target, hasAlpha);
1713 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1714 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
1715 int yalpha,
int uvalpha,
int y,
1718 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1719 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1720 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1721 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1722 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1723 int yalpha1 = 4096 - yalpha;
1724 int uvalpha1 = 4096 - uvalpha;
1729 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1730 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1731 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1732 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1733 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1740 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1741 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1747 r,
g,
b, y, target, hasAlpha);
1753 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1754 const int16_t *abuf0,
uint8_t *dest,
int dstW,
1758 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1761 if (uvalpha < 2048) {
1762 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1763 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1764 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1765 int U = (ubuf0[
i] + 64) >> 7;
1766 int V = (vbuf0[
i] + 64) >> 7;
1773 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1774 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1780 r,
g,
b, y, target, hasAlpha);
1783 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1784 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1785 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1786 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1787 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1788 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1795 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1796 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1802 r,
g,
b, y, target, hasAlpha);
1807 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1808 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1809 const int16_t **lumSrc, int lumFilterSize, \
1810 const int16_t *chrFilter, const int16_t **chrUSrc, \
1811 const int16_t **chrVSrc, int chrFilterSize, \
1812 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1815 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1816 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1817 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1820 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1821 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1822 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
1823 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1824 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1825 int yalpha, int uvalpha, int y) \
1827 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1828 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1831 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1832 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1833 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
1834 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1835 const int16_t *abuf0, uint8_t *dest, int dstW, \
1836 int uvalpha, int y) \
1838 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1839 dstW, uvalpha, y, fmt, hasAlpha); \
1846 #if CONFIG_SWSCALE_ALPHA
1870 Y -=
c->yuv2rgb_y_offset;
1871 Y *= (unsigned)
c->yuv2rgb_y_coeff;
1873 R = (
unsigned)
Y +
V*(unsigned)
c->yuv2rgb_v2r_coeff;
1874 G = (
unsigned)
Y +
V*(unsigned)
c->yuv2rgb_v2g_coeff +
U*(
unsigned)
c->yuv2rgb_u2g_coeff;
1875 B = (unsigned)
Y +
U*(
unsigned)
c->yuv2rgb_u2b_coeff;
1876 if ((
R |
G |
B) & 0xC0000000) {
1884 dest[0] = hasAlpha ?
A : 255;
1898 dest[3] = hasAlpha ?
A : 255;
1901 dest[0] = hasAlpha ?
A : 255;
1915 dest[3] = hasAlpha ?
A : 255;
1924 switch (
c->dither) {
1931 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;
1932 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;
1933 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;
1934 c->dither_error[0][
i] = err[0];
1935 c->dither_error[1][
i] = err[1];
1936 c->dither_error[2][
i] = err[2];
1937 r =
R >> (isrgb8 ? 5 : 7);
1938 g =
G >> (isrgb8 ? 5 : 6);
1939 b =
B >> (isrgb8 ? 6 : 7);
1943 err[0] =
R -
r*(isrgb8 ? 36 : 255);
1944 err[1] =
G -
g*(isrgb8 ? 36 : 85);
1945 err[2] =
B -
b*(isrgb8 ? 85 : 255);
1950 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
1969 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
1989 dest[0] =
r + 2*
g + 8*
b;
1991 dest[0] =
b + 2*
g + 8*
r;
1993 dest[0] =
r + 8*
g + 64*
b;
1995 dest[0] =
b + 4*
g + 32*
r;
2004 const int16_t **lumSrc,
int lumFilterSize,
2005 const int16_t *chrFilter,
const int16_t **chrUSrc,
2006 const int16_t **chrVSrc,
int chrFilterSize,
2007 const int16_t **alpSrc,
uint8_t *dest,
2019 for (
i = 0;
i < dstW;
i++) {
2022 int U = (1<<9)-(128 << 19);
2023 int V = (1<<9)-(128 << 19);
2025 for (j = 0; j < lumFilterSize; j++) {
2026 Y += lumSrc[j][
i] * lumFilter[j];
2028 for (j = 0; j < chrFilterSize; j++) {
2029 U += chrUSrc[j][
i] * chrFilter[j];
2030 V += chrVSrc[j][
i] * chrFilter[j];
2037 for (j = 0; j < lumFilterSize; j++) {
2038 A += alpSrc[j][
i] * lumFilter[j];
2044 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2047 c->dither_error[0][
i] = err[0];
2048 c->dither_error[1][
i] = err[1];
2049 c->dither_error[2][
i] = err[2];
2054 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2055 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2056 int yalpha,
int uvalpha,
int y,
2059 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2060 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2061 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2062 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2063 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2064 int yalpha1 = 4096 - yalpha;
2065 int uvalpha1 = 4096 - uvalpha;
2078 for (
i = 0;
i < dstW;
i++) {
2079 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2080 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2081 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2084 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2089 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2092 c->dither_error[0][
i] = err[0];
2093 c->dither_error[1][
i] = err[1];
2094 c->dither_error[2][
i] = err[2];
2099 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2100 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2104 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2113 if (uvalpha < 2048) {
2115 for (
i = 0;
i < dstW;
i++) {
2116 int Y = buf0[
i] * 4;
2117 int U = (ubuf0[
i] - (128<<7)) * 4;
2118 int V = (vbuf0[
i] - (128<<7)) * 4;
2121 A = (abuf0[
i] + 64) >> 7;
2126 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2130 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2132 for (
i = 0;
i < dstW;
i++) {
2133 int Y = buf0[
i] * 4;
2134 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2135 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2138 A = (abuf0[
i] + 64) >> 7;
2143 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2148 c->dither_error[0][
i] = err[0];
2149 c->dither_error[1][
i] = err[1];
2150 c->dither_error[2][
i] = err[2];
2159 #if CONFIG_SWSCALE_ALPHA
2180 const int16_t **lumSrc,
int lumFilterSize,
2181 const int16_t *chrFilter, const int16_t **chrUSrc,
2182 const int16_t **chrVSrc,
int chrFilterSize,
2183 const int16_t **alpSrc,
uint8_t **dest,
2189 uint16_t **dest16 = (uint16_t**)dest;
2190 int SH = 22 + 8 -
desc->comp[0].depth;
2193 for (
i = 0;
i < dstW;
i++) {
2196 int U = (1 << 9) - (128 << 19);
2197 int V = (1 << 9) - (128 << 19);
2200 for (j = 0; j < lumFilterSize; j++)
2201 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2203 for (j = 0; j < chrFilterSize; j++) {
2204 U += chrUSrc[j][
i] * chrFilter[j];
2205 V += chrVSrc[j][
i] * chrFilter[j];
2215 for (j = 0; j < lumFilterSize; j++)
2216 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2222 Y -=
c->yuv2rgb_y_offset;
2223 Y *=
c->yuv2rgb_y_coeff;
2225 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2226 G =
Y +
V * (
unsigned)
c->yuv2rgb_v2g_coeff +
U * (unsigned)
c->yuv2rgb_u2g_coeff;
2227 B =
Y +
U * (
unsigned)
c->yuv2rgb_u2b_coeff;
2229 if ((
R |
G |
B) & 0xC0000000) {
2236 dest16[0][
i] =
G >>
SH;
2237 dest16[1][
i] =
B >>
SH;
2238 dest16[2][
i] =
R >>
SH;
2240 dest16[3][
i] =
A >> (
SH - 3);
2242 dest[0][
i] =
G >> 22;
2243 dest[1][
i] =
B >> 22;
2244 dest[2][
i] =
R >> 22;
2246 dest[3][
i] =
A >> 19;
2250 for (
i = 0;
i < dstW;
i++) {
2262 const int16_t **lumSrcx,
int lumFilterSize,
2263 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2264 const int16_t **chrVSrcx,
int chrFilterSize,
2265 const int16_t **alpSrcx,
uint8_t **dest,
2271 uint16_t **dest16 = (uint16_t**)dest;
2277 for (
i = 0;
i < dstW;
i++) {
2279 int Y = -0x40000000;
2280 int U = -(128 << 23);
2281 int V = -(128 << 23);
2284 for (j = 0; j < lumFilterSize; j++)
2285 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2287 for (j = 0; j < chrFilterSize; j++) {
2288 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2289 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2300 for (j = 0; j < lumFilterSize; j++)
2301 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2307 Y -=
c->yuv2rgb_y_offset;
2308 Y *=
c->yuv2rgb_y_coeff;
2310 R =
V *
c->yuv2rgb_v2r_coeff;
2311 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2312 B =
U *
c->yuv2rgb_u2b_coeff;
2318 dest16[0][
i] =
G >> 14;
2319 dest16[1][
i] =
B >> 14;
2320 dest16[2][
i] =
R >> 14;
2325 for (
i = 0;
i < dstW;
i++) {
2337 const int16_t **lumSrcx,
int lumFilterSize,
2338 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2339 const int16_t **chrVSrcx,
int chrFilterSize,
2340 const int16_t **alpSrcx,
uint8_t **dest,
2346 uint32_t **dest32 = (uint32_t**)dest;
2351 static const float float_mult = 1.0f / 65535.0f;
2353 for (
i = 0;
i < dstW;
i++) {
2355 int Y = -0x40000000;
2356 int U = -(128 << 23);
2357 int V = -(128 << 23);
2360 for (j = 0; j < lumFilterSize; j++)
2361 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2363 for (j = 0; j < chrFilterSize; j++) {
2364 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2365 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2376 for (j = 0; j < lumFilterSize; j++)
2377 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2383 Y -=
c->yuv2rgb_y_offset;
2384 Y *=
c->yuv2rgb_y_coeff;
2386 R =
V *
c->yuv2rgb_v2r_coeff;
2387 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2388 B =
U *
c->yuv2rgb_u2b_coeff;
2401 for (
i = 0;
i < dstW;
i++) {
2413 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2414 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2417 int hasAlpha = !!abuf0;
2420 for (
i = 0;
i < dstW;
i++) {
2421 int Y = (buf0[
i] + 64) >> 7;
2427 A = (abuf0[
i] + 64) >> 7;
2433 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2439 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2440 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2441 int yalpha,
int uvalpha,
int y)
2443 int hasAlpha = abuf && abuf[0] && abuf[1];
2444 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2445 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2446 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2447 int yalpha1 = 4096 - yalpha;
2452 for (
i = 0;
i < dstW;
i++) {
2453 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2459 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2464 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2470 const int16_t **lumSrc,
int lumFilterSize,
2471 const int16_t *chrFilter,
const int16_t **chrUSrc,
2472 const int16_t **chrVSrc,
int chrFilterSize,
2473 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
int y)
2475 int hasAlpha = !!alpSrc;
2478 for (
i = 0;
i < dstW;
i++) {
2480 int Y = 1 << 18,
A = 1 << 18;
2482 for (j = 0; j < lumFilterSize; j++)
2483 Y += lumSrc[j][
i] * lumFilter[j];
2490 for (j = 0; j < lumFilterSize; j++)
2491 A += alpSrc[j][
i] * lumFilter[j];
2500 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2506 const int16_t **_lumSrc,
int lumFilterSize,
2507 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2508 const int16_t **_chrVSrc,
int chrFilterSize,
2509 const int16_t **_alpSrc,
uint8_t *dest,
int dstW,
int y)
2512 **chrUSrc = (
const int32_t **) _chrUSrc,
2513 **chrVSrc = (
const int32_t **) _chrVSrc,
2514 **alpSrc = (
const int32_t **) _alpSrc;
2515 int hasAlpha = !!alpSrc;
2518 for (
i = 0;
i < dstW;
i++) {
2519 int Y = 1 << 14,
U = 1 << 14;
2520 int V = 1 << 14,
A = 1 << 14;
2528 for (j = 0; j < lumFilterSize; j++)
2529 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2531 for (j = 0; j < chrFilterSize; j++)
2532 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2534 for (j = 0; j < chrFilterSize; j++)
2535 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2538 for (j = 0; j < lumFilterSize; j++)
2539 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2546 AV_WL16(dest + 8 *
i, hasAlpha ?
A : 65535);
2569 }
else if (
is16BPS(dstFormat)) {
2570 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
2571 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
2575 }
else if (
isNBPS(dstFormat)) {
2576 if (
desc->comp[0].depth == 9) {
2577 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
2578 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
2579 }
else if (
desc->comp[0].depth == 10) {
2580 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
2581 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
2582 }
else if (
desc->comp[0].depth == 12) {
2583 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
2584 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
2585 }
else if (
desc->comp[0].depth == 14) {
2586 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
2587 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
2592 *yuv2plane1 = yuv2plane1_floatBE_c;
2595 *yuv2plane1 = yuv2plane1_floatLE_c;
2605 switch (dstFormat) {
2608 *yuv2packedX = yuv2rgba32_full_X_c;
2609 *yuv2packed2 = yuv2rgba32_full_2_c;
2610 *yuv2packed1 = yuv2rgba32_full_1_c;
2612 #if CONFIG_SWSCALE_ALPHA
2614 *yuv2packedX = yuv2rgba32_full_X_c;
2615 *yuv2packed2 = yuv2rgba32_full_2_c;
2616 *yuv2packed1 = yuv2rgba32_full_1_c;
2620 *yuv2packedX = yuv2rgbx32_full_X_c;
2621 *yuv2packed2 = yuv2rgbx32_full_2_c;
2622 *yuv2packed1 = yuv2rgbx32_full_1_c;
2628 *yuv2packedX = yuv2argb32_full_X_c;
2629 *yuv2packed2 = yuv2argb32_full_2_c;
2630 *yuv2packed1 = yuv2argb32_full_1_c;
2632 #if CONFIG_SWSCALE_ALPHA
2634 *yuv2packedX = yuv2argb32_full_X_c;
2635 *yuv2packed2 = yuv2argb32_full_2_c;
2636 *yuv2packed1 = yuv2argb32_full_1_c;
2640 *yuv2packedX = yuv2xrgb32_full_X_c;
2641 *yuv2packed2 = yuv2xrgb32_full_2_c;
2642 *yuv2packed1 = yuv2xrgb32_full_1_c;
2648 *yuv2packedX = yuv2bgra32_full_X_c;
2649 *yuv2packed2 = yuv2bgra32_full_2_c;
2650 *yuv2packed1 = yuv2bgra32_full_1_c;
2652 #if CONFIG_SWSCALE_ALPHA
2654 *yuv2packedX = yuv2bgra32_full_X_c;
2655 *yuv2packed2 = yuv2bgra32_full_2_c;
2656 *yuv2packed1 = yuv2bgra32_full_1_c;
2660 *yuv2packedX = yuv2bgrx32_full_X_c;
2661 *yuv2packed2 = yuv2bgrx32_full_2_c;
2662 *yuv2packed1 = yuv2bgrx32_full_1_c;
2668 *yuv2packedX = yuv2abgr32_full_X_c;
2669 *yuv2packed2 = yuv2abgr32_full_2_c;
2670 *yuv2packed1 = yuv2abgr32_full_1_c;
2672 #if CONFIG_SWSCALE_ALPHA
2674 *yuv2packedX = yuv2abgr32_full_X_c;
2675 *yuv2packed2 = yuv2abgr32_full_2_c;
2676 *yuv2packed1 = yuv2abgr32_full_1_c;
2680 *yuv2packedX = yuv2xbgr32_full_X_c;
2681 *yuv2packed2 = yuv2xbgr32_full_2_c;
2682 *yuv2packed1 = yuv2xbgr32_full_1_c;
2687 #if CONFIG_SWSCALE_ALPHA
2689 *yuv2packedX = yuv2rgba64le_full_X_c;
2690 *yuv2packed2 = yuv2rgba64le_full_2_c;
2691 *yuv2packed1 = yuv2rgba64le_full_1_c;
2695 *yuv2packedX = yuv2rgbx64le_full_X_c;
2696 *yuv2packed2 = yuv2rgbx64le_full_2_c;
2697 *yuv2packed1 = yuv2rgbx64le_full_1_c;
2701 #if CONFIG_SWSCALE_ALPHA
2703 *yuv2packedX = yuv2rgba64be_full_X_c;
2704 *yuv2packed2 = yuv2rgba64be_full_2_c;
2705 *yuv2packed1 = yuv2rgba64be_full_1_c;
2709 *yuv2packedX = yuv2rgbx64be_full_X_c;
2710 *yuv2packed2 = yuv2rgbx64be_full_2_c;
2711 *yuv2packed1 = yuv2rgbx64be_full_1_c;
2715 #if CONFIG_SWSCALE_ALPHA
2717 *yuv2packedX = yuv2bgra64le_full_X_c;
2718 *yuv2packed2 = yuv2bgra64le_full_2_c;
2719 *yuv2packed1 = yuv2bgra64le_full_1_c;
2723 *yuv2packedX = yuv2bgrx64le_full_X_c;
2724 *yuv2packed2 = yuv2bgrx64le_full_2_c;
2725 *yuv2packed1 = yuv2bgrx64le_full_1_c;
2729 #if CONFIG_SWSCALE_ALPHA
2731 *yuv2packedX = yuv2bgra64be_full_X_c;
2732 *yuv2packed2 = yuv2bgra64be_full_2_c;
2733 *yuv2packed1 = yuv2bgra64be_full_1_c;
2737 *yuv2packedX = yuv2bgrx64be_full_X_c;
2738 *yuv2packed2 = yuv2bgrx64be_full_2_c;
2739 *yuv2packed1 = yuv2bgrx64be_full_1_c;
2744 *yuv2packedX = yuv2rgb24_full_X_c;
2745 *yuv2packed2 = yuv2rgb24_full_2_c;
2746 *yuv2packed1 = yuv2rgb24_full_1_c;
2749 *yuv2packedX = yuv2bgr24_full_X_c;
2750 *yuv2packed2 = yuv2bgr24_full_2_c;
2751 *yuv2packed1 = yuv2bgr24_full_1_c;
2754 *yuv2packedX = yuv2rgb48le_full_X_c;
2755 *yuv2packed2 = yuv2rgb48le_full_2_c;
2756 *yuv2packed1 = yuv2rgb48le_full_1_c;
2759 *yuv2packedX = yuv2bgr48le_full_X_c;
2760 *yuv2packed2 = yuv2bgr48le_full_2_c;
2761 *yuv2packed1 = yuv2bgr48le_full_1_c;
2764 *yuv2packedX = yuv2rgb48be_full_X_c;
2765 *yuv2packed2 = yuv2rgb48be_full_2_c;
2766 *yuv2packed1 = yuv2rgb48be_full_1_c;
2769 *yuv2packedX = yuv2bgr48be_full_X_c;
2770 *yuv2packed2 = yuv2bgr48be_full_2_c;
2771 *yuv2packed1 = yuv2bgr48be_full_1_c;
2774 *yuv2packedX = yuv2bgr4_byte_full_X_c;
2775 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
2776 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
2779 *yuv2packedX = yuv2rgb4_byte_full_X_c;
2780 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
2781 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
2784 *yuv2packedX = yuv2bgr8_full_X_c;
2785 *yuv2packed2 = yuv2bgr8_full_2_c;
2786 *yuv2packed1 = yuv2bgr8_full_1_c;
2789 *yuv2packedX = yuv2rgb8_full_X_c;
2790 *yuv2packed2 = yuv2rgb8_full_2_c;
2791 *yuv2packed1 = yuv2rgb8_full_1_c;
2822 if (!*yuv2packedX && !*yuv2anyX)
2826 switch (dstFormat) {
2828 #if CONFIG_SWSCALE_ALPHA
2830 *yuv2packed1 = yuv2rgba64le_1_c;
2831 *yuv2packed2 = yuv2rgba64le_2_c;
2832 *yuv2packedX = yuv2rgba64le_X_c;
2836 *yuv2packed1 = yuv2rgbx64le_1_c;
2837 *yuv2packed2 = yuv2rgbx64le_2_c;
2838 *yuv2packedX = yuv2rgbx64le_X_c;
2842 #if CONFIG_SWSCALE_ALPHA
2844 *yuv2packed1 = yuv2rgba64be_1_c;
2845 *yuv2packed2 = yuv2rgba64be_2_c;
2846 *yuv2packedX = yuv2rgba64be_X_c;
2850 *yuv2packed1 = yuv2rgbx64be_1_c;
2851 *yuv2packed2 = yuv2rgbx64be_2_c;
2852 *yuv2packedX = yuv2rgbx64be_X_c;
2856 #if CONFIG_SWSCALE_ALPHA
2858 *yuv2packed1 = yuv2bgra64le_1_c;
2859 *yuv2packed2 = yuv2bgra64le_2_c;
2860 *yuv2packedX = yuv2bgra64le_X_c;
2864 *yuv2packed1 = yuv2bgrx64le_1_c;
2865 *yuv2packed2 = yuv2bgrx64le_2_c;
2866 *yuv2packedX = yuv2bgrx64le_X_c;
2870 #if CONFIG_SWSCALE_ALPHA
2872 *yuv2packed1 = yuv2bgra64be_1_c;
2873 *yuv2packed2 = yuv2bgra64be_2_c;
2874 *yuv2packedX = yuv2bgra64be_X_c;
2878 *yuv2packed1 = yuv2bgrx64be_1_c;
2879 *yuv2packed2 = yuv2bgrx64be_2_c;
2880 *yuv2packedX = yuv2bgrx64be_X_c;
2884 *yuv2packed1 = yuv2rgb48le_1_c;
2885 *yuv2packed2 = yuv2rgb48le_2_c;
2886 *yuv2packedX = yuv2rgb48le_X_c;
2889 *yuv2packed1 = yuv2rgb48be_1_c;
2890 *yuv2packed2 = yuv2rgb48be_2_c;
2891 *yuv2packedX = yuv2rgb48be_X_c;
2894 *yuv2packed1 = yuv2bgr48le_1_c;
2895 *yuv2packed2 = yuv2bgr48le_2_c;
2896 *yuv2packedX = yuv2bgr48le_X_c;
2899 *yuv2packed1 = yuv2bgr48be_1_c;
2900 *yuv2packed2 = yuv2bgr48be_2_c;
2901 *yuv2packedX = yuv2bgr48be_X_c;
2906 *yuv2packed1 = yuv2rgb32_1_c;
2907 *yuv2packed2 = yuv2rgb32_2_c;
2908 *yuv2packedX = yuv2rgb32_X_c;
2910 #if CONFIG_SWSCALE_ALPHA
2912 *yuv2packed1 = yuv2rgba32_1_c;
2913 *yuv2packed2 = yuv2rgba32_2_c;
2914 *yuv2packedX = yuv2rgba32_X_c;
2918 *yuv2packed1 = yuv2rgbx32_1_c;
2919 *yuv2packed2 = yuv2rgbx32_2_c;
2920 *yuv2packedX = yuv2rgbx32_X_c;
2927 *yuv2packed1 = yuv2rgb32_1_1_c;
2928 *yuv2packed2 = yuv2rgb32_1_2_c;
2929 *yuv2packedX = yuv2rgb32_1_X_c;
2931 #if CONFIG_SWSCALE_ALPHA
2933 *yuv2packed1 = yuv2rgba32_1_1_c;
2934 *yuv2packed2 = yuv2rgba32_1_2_c;
2935 *yuv2packedX = yuv2rgba32_1_X_c;
2939 *yuv2packed1 = yuv2rgbx32_1_1_c;
2940 *yuv2packed2 = yuv2rgbx32_1_2_c;
2941 *yuv2packedX = yuv2rgbx32_1_X_c;
2946 *yuv2packed1 = yuv2rgb24_1_c;
2947 *yuv2packed2 = yuv2rgb24_2_c;
2948 *yuv2packedX = yuv2rgb24_X_c;
2951 *yuv2packed1 = yuv2bgr24_1_c;
2952 *yuv2packed2 = yuv2bgr24_2_c;
2953 *yuv2packedX = yuv2bgr24_X_c;
2959 *yuv2packed1 = yuv2rgb16_1_c;
2960 *yuv2packed2 = yuv2rgb16_2_c;
2961 *yuv2packedX = yuv2rgb16_X_c;
2967 *yuv2packed1 = yuv2rgb15_1_c;
2968 *yuv2packed2 = yuv2rgb15_2_c;
2969 *yuv2packedX = yuv2rgb15_X_c;
2975 *yuv2packed1 = yuv2rgb12_1_c;
2976 *yuv2packed2 = yuv2rgb12_2_c;
2977 *yuv2packedX = yuv2rgb12_X_c;
2981 *yuv2packed1 = yuv2rgb8_1_c;
2982 *yuv2packed2 = yuv2rgb8_2_c;
2983 *yuv2packedX = yuv2rgb8_X_c;
2987 *yuv2packed1 = yuv2rgb4_1_c;
2988 *yuv2packed2 = yuv2rgb4_2_c;
2989 *yuv2packedX = yuv2rgb4_X_c;
2993 *yuv2packed1 = yuv2rgb4b_1_c;
2994 *yuv2packed2 = yuv2rgb4b_2_c;
2995 *yuv2packedX = yuv2rgb4b_X_c;
2999 *yuv2packed1 = yuv2x2rgb10_1_c;
3000 *yuv2packed2 = yuv2x2rgb10_2_c;
3001 *yuv2packedX = yuv2x2rgb10_X_c;
3005 switch (dstFormat) {
3007 *yuv2packed1 = yuv2monowhite_1_c;
3008 *yuv2packed2 = yuv2monowhite_2_c;
3009 *yuv2packedX = yuv2monowhite_X_c;
3012 *yuv2packed1 = yuv2monoblack_1_c;
3013 *yuv2packed2 = yuv2monoblack_2_c;
3014 *yuv2packedX = yuv2monoblack_X_c;
3017 *yuv2packed1 = yuv2yuyv422_1_c;
3018 *yuv2packed2 = yuv2yuyv422_2_c;
3019 *yuv2packedX = yuv2yuyv422_X_c;
3022 *yuv2packed1 = yuv2yvyu422_1_c;
3023 *yuv2packed2 = yuv2yvyu422_2_c;
3024 *yuv2packedX = yuv2yvyu422_X_c;
3027 *yuv2packed1 = yuv2uyvy422_1_c;
3028 *yuv2packed2 = yuv2uyvy422_2_c;
3029 *yuv2packedX = yuv2uyvy422_X_c;
3037 *yuv2packed1 = yuv2ya16le_1_c;
3038 *yuv2packed2 = yuv2ya16le_2_c;
3039 *yuv2packedX = yuv2ya16le_X_c;
3042 *yuv2packed1 = yuv2ya16be_1_c;
3043 *yuv2packed2 = yuv2ya16be_2_c;
3044 *yuv2packedX = yuv2ya16be_X_c;
static double val(void *priv, double ch)
Macro definitions for various function/variable attributes.
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 u(width, name, range_min, range_max)
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
#define CONFIG_SWSCALE_ALPHA
static void yuv2rgb(uint8_t *out, int ridx, int Y, int U, int V)
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
#define SWS_FULL_CHR_H_INT
static av_always_inline uint32_t av_float2int(float f)
Reinterpret a float as a 32-bit integer.
static void yuv2p010l1_c(const int16_t *src, uint16_t *dest, int dstW, int big_endian)
const uint8_t ff_dither_8x8_73[][8]
static av_always_inline void yuv2mono_X_c_template(SwsContext *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 yuv2ya16_X_c_template(SwsContext *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)
static av_always_inline void yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW, int big_endian, int output_bits)
static void yuv2ya8_X_c(SwsContext *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 yuv2p010lX_BE_c(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
static av_always_inline void yuv2rgb_full_2_c_template(SwsContext *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 accumulate_bit(acc, val)
static void yuv2ya8_1_c(SwsContext *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 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 void yuv2p016cX_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 av_always_inline void yuv2rgb_write_full(SwsContext *c, uint8_t *dest, int i, int Y, int A, int U, int V, int y, enum AVPixelFormat target, int hasAlpha, int err[4])
static av_always_inline void yuv2rgba64_full_X_c_template(SwsContext *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)
#define yuv2plane1_float(template, dest_type, BE_LE)
static av_always_inline void yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW)
av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX)
static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
static av_always_inline void yuv2rgba64_2_c_template(SwsContext *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, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes)
static void yuv2ayuv64le_X_c(SwsContext *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 yuv2p010lX_c(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, int big_endian)
const uint8_t ff_dither_2x2_4[][8]
static av_always_inline void yuv2rgb_2_c_template(SwsContext *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 av_always_inline void yuv2rgb_full_1_c_template(SwsContext *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 void yuv2gbrp16_full_X_c(SwsContext *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)
const uint8_t ff_dither_2x2_8[][8]
const uint8_t ff_dither_4x4_16[][8]
static av_always_inline void yuv2rgba64_full_1_c_template(SwsContext *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)
static void yuv2p010cX_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 yuv2p010lX_LE_c(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
static av_always_inline void yuv2rgb_1_c_template(SwsContext *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)
#define output_pixel(pos, val, bias, signedness)
#define yuv2planeX_float(template, dest_type, BE_LE)
static av_always_inline void yuv2ya16_2_c_template(SwsContext *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, int unused_uvalpha, int y, enum AVPixelFormat target, int unused_hasAlpha, int unused_eightbytes)
static av_always_inline void yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src, float *dest, int dstW)
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 yuv2gbrp_full_X_c(SwsContext *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 yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t)
static void yuv2gbrpf32_full_X_c(SwsContext *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 yuv2rgba64_X_c_template(SwsContext *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)
static av_always_inline void yuv2422_1_c_template(SwsContext *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 yuv2rgba64_full_2_c_template(SwsContext *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, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha, int eightbytes)
static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int dstW, 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 yuv2422_2_c_template(SwsContext *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 YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha)
static av_always_inline void yuv2ya16_1_c_template(SwsContext *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)
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 yuv2rgb_full_X_c_template(SwsContext *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 void yuv2p010l1_LE_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
#define output_pixels(pos, Y1, U, Y2, V)
static av_always_inline void yuv2rgba64_1_c_template(SwsContext *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)
#define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes)
static av_always_inline void yuv2mono_1_c_template(SwsContext *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 void yuv2ya8_2_c(SwsContext *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)
const uint8_t ff_dither_8x8_32[][8]
static void yuv2p010l1_BE_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
static av_always_inline void yuv2422_X_c_template(SwsContext *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_X_c_template(SwsContext *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 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 av_always_inline void yuv2mono_2_c_template(SwsContext *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 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_X2RGB10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
@ 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_NV42
as above, but U and V bytes are swapped
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ 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_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
@ 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_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_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_P016BE
like NV12, with 16bpp per component, big-endian
@ 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)2R 3G 3B(lsb)
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ 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_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_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_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_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_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_GBRP
planar GBR 4:4:4 24bpp
@ 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_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
@ 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
#define AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB444
#define AV_PIX_FMT_RGB555
static int shift(int a, int b)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define YUVRGB_TABLE_HEADROOM
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 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 (...
void(* yuv2packed1_fn)(struct SwsContext *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(* yuv2anyX_fn)(struct SwsContext *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(* 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)
void(* yuv2packedX_fn)(struct SwsContext *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 isNBPS(enum AVPixelFormat pix_fmt)
void(* yuv2packed2_fn)(struct SwsContext *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...
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)
static const uint8_t dither[8][8]
static const uint8_t offset[127][2]