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++)
401 for (
i=0;
i<dstW;
i++) {
408 const int16_t *chrFilter,
int chrFilterSize,
409 const int16_t **chrUSrc,
const int16_t **chrVSrc,
416 for (
i=0;
i<chrDstW;
i++) {
417 int u = chrDither[
i & 7] << 12;
418 int v = chrDither[(
i + 3) & 7] << 12;
420 for (j=0; j<chrFilterSize; j++) {
421 u += chrUSrc[j][
i] * chrFilter[j];
422 v += chrVSrc[j][
i] * chrFilter[j];
429 for (
i=0;
i<chrDstW;
i++) {
430 int u = chrDither[
i & 7] << 12;
431 int v = chrDither[(
i + 3) & 7] << 12;
433 for (j=0; j<chrFilterSize; j++) {
434 u += chrUSrc[j][
i] * chrFilter[j];
435 v += chrVSrc[j][
i] * chrFilter[j];
444 #define output_pixel(pos, val) \
446 AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
448 AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \
452 uint16_t *dest,
int dstW,
458 for (
i = 0;
i < dstW;
i++) {
465 const int16_t **
src, uint16_t *dest,
int dstW,
471 for (
i = 0;
i < dstW;
i++) {
474 for (j = 0; j < filterSize; j++)
482 const int16_t *chrFilter,
int chrFilterSize,
483 const int16_t **chrUSrc,
const int16_t **chrVSrc,
486 uint16_t *dest = (uint16_t*)dest8;
491 for (
i = 0;
i < chrDstW;
i++) {
493 int v = 1 << (
shift - 1);
495 for (j = 0; j < chrFilterSize; j++) {
496 u += chrUSrc[j][
i] * chrFilter[j];
497 v += chrVSrc[j][
i] * chrFilter[j];
536 #define accumulate_bit(acc, val) \
539 #define output_pixel(pos, acc) \
540 if (target == AV_PIX_FMT_MONOBLACK) { \
548 const int16_t **lumSrc,
int lumFilterSize,
549 const int16_t *chrFilter,
const int16_t **chrUSrc,
550 const int16_t **chrVSrc,
int chrFilterSize,
551 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
559 for (
i = 0;
i < dstW;
i += 2) {
564 for (j = 0; j < lumFilterSize; j++) {
565 Y1 += lumSrc[j][
i] * lumFilter[j];
566 Y2 += lumSrc[j][
i+1] * lumFilter[j];
570 if ((Y1 | Y2) & 0x100) {
575 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;
576 c->dither_error[0][
i] = err;
577 acc = 2*
acc + (Y1 >= 128);
580 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);
581 c->dither_error[0][
i+1] = Y1;
582 acc = 2*
acc + (err >= 128);
592 c->dither_error[0][
i] = err;
601 const int16_t *ubuf[2],
const int16_t *vbuf[2],
602 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
603 int yalpha,
int uvalpha,
int y,
606 const int16_t *buf0 = buf[0], *buf1 = buf[1];
608 int yalpha1 = 4096 - yalpha;
615 for (
i = 0;
i < dstW;
i +=2) {
618 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
619 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;
620 c->dither_error[0][
i] = err;
624 err = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
625 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;
626 c->dither_error[0][
i+1] =
Y;
627 acc = 2*
acc + (err >= 128);
633 c->dither_error[0][
i] = err;
635 for (
i = 0;
i < dstW;
i += 8) {
639 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
641 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
643 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
645 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
647 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
649 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
651 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
653 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
663 const int16_t *ubuf[2],
const int16_t *vbuf[2],
664 const int16_t *abuf0,
uint8_t *dest,
int dstW,
673 for (
i = 0;
i < dstW;
i +=2) {
676 Y = ((buf0[
i + 0] + 64) >> 7);
677 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;
678 c->dither_error[0][
i] = err;
682 err = ((buf0[
i + 1] + 64) >> 7);
683 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;
684 c->dither_error[0][
i+1] =
Y;
685 acc = 2*
acc + (err >= 128);
691 c->dither_error[0][
i] = err;
693 for (
i = 0;
i < dstW;
i += 8) {
710 #undef accumulate_bit
712 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
713 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
714 const int16_t **lumSrc, int lumFilterSize, \
715 const int16_t *chrFilter, const int16_t **chrUSrc, \
716 const int16_t **chrVSrc, int chrFilterSize, \
717 const int16_t **alpSrc, uint8_t *dest, int dstW, \
720 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
721 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
722 alpSrc, dest, dstW, y, fmt); \
725 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
726 const int16_t *ubuf[2], const int16_t *vbuf[2], \
727 const int16_t *abuf[2], uint8_t *dest, int dstW, \
728 int yalpha, int uvalpha, int y) \
730 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
731 dest, dstW, yalpha, uvalpha, y, fmt); \
734 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
735 const int16_t *ubuf[2], const int16_t *vbuf[2], \
736 const int16_t *abuf0, uint8_t *dest, int dstW, \
737 int uvalpha, int y) \
739 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
740 abuf0, dest, dstW, uvalpha, \
747 #define output_pixels(pos, Y1, U, Y2, V) \
748 if (target == AV_PIX_FMT_YUYV422) { \
749 dest[pos + 0] = Y1; \
751 dest[pos + 2] = Y2; \
753 } else if (target == AV_PIX_FMT_YVYU422) { \
754 dest[pos + 0] = Y1; \
756 dest[pos + 2] = Y2; \
760 dest[pos + 1] = Y1; \
762 dest[pos + 3] = Y2; \
767 const int16_t **lumSrc,
int lumFilterSize,
768 const int16_t *chrFilter,
const int16_t **chrUSrc,
769 const int16_t **chrVSrc,
int chrFilterSize,
770 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
775 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
782 for (j = 0; j < lumFilterSize; j++) {
783 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
784 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
786 for (j = 0; j < chrFilterSize; j++) {
787 U += chrUSrc[j][
i] * chrFilter[j];
788 V += chrVSrc[j][
i] * chrFilter[j];
794 if ((Y1 | Y2 |
U |
V) & 0x100) {
806 const int16_t *ubuf[2],
const int16_t *vbuf[2],
807 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
808 int yalpha,
int uvalpha,
int y,
811 const int16_t *buf0 = buf[0], *buf1 = buf[1],
812 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
813 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
814 int yalpha1 = 4096 - yalpha;
815 int uvalpha1 = 4096 - uvalpha;
820 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
821 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
822 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
823 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
824 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
826 if ((Y1 | Y2 |
U |
V) & 0x100) {
839 const int16_t *ubuf[2],
const int16_t *vbuf[2],
840 const int16_t *abuf0,
uint8_t *dest,
int dstW,
843 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
846 if (uvalpha < 2048) {
847 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
848 int Y1 = (buf0[
i * 2 ]+64) >> 7;
849 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
850 int U = (ubuf0[
i] +64) >> 7;
851 int V = (vbuf0[
i] +64) >> 7;
853 if ((Y1 | Y2 |
U |
V) & 0x100) {
863 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
864 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
865 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
866 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
867 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
868 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
870 if ((Y1 | Y2 |
U |
V) & 0x100) {
888 #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)
889 #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)
890 #define output_pixel(pos, val) \
891 if (isBE(target)) { \
899 const int32_t **lumSrc,
int lumFilterSize,
900 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
901 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
902 const int32_t **alpSrc, uint16_t *dest,
int dstW,
903 int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
905 int hasAlpha = !!alpSrc;
908 for (
i = 0;
i < dstW;
i++) {
913 for (j = 0; j < lumFilterSize; j++)
914 Y += lumSrc[j][
i] * lumFilter[j];
917 Y += (1<<3) + 0x8000;
921 A = -0x40000000 + (1<<14);
922 for (j = 0; j < lumFilterSize; j++)
923 A += alpSrc[j][
i] * lumFilter[j];
938 const int32_t *abuf[2], uint16_t *dest,
int dstW,
939 int yalpha,
int unused_uvalpha,
int y,
940 enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
942 int hasAlpha = abuf && abuf[0] && abuf[1];
943 const int32_t *buf0 = buf[0], *buf1 = buf[1],
944 *abuf0 = hasAlpha ? abuf[0] :
NULL,
945 *abuf1 = hasAlpha ? abuf[1] :
NULL;
946 int yalpha1 = 4096 - yalpha;
951 for (
i = 0;
i < dstW;
i++) {
952 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
958 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
970 const int32_t *abuf0, uint16_t *dest,
int dstW,
971 int unused_uvalpha,
int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
973 int hasAlpha = !!abuf0;
976 for (
i = 0;
i < dstW;
i++) {
977 int Y = buf0[
i] >> 3;
995 const int32_t **lumSrc,
int lumFilterSize,
996 const int16_t *chrFilter,
const int32_t **chrUSrc,
997 const int32_t **chrVSrc,
int chrFilterSize,
998 const int32_t **alpSrc, uint16_t *dest,
int dstW,
999 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1002 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1004 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1006 unsigned Y1 = -0x40000000;
1007 unsigned Y2 = -0x40000000;
1008 int U = -(128 << 23);
1009 int V = -(128 << 23);
1012 for (j = 0; j < lumFilterSize; j++) {
1013 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1014 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1016 for (j = 0; j < chrFilterSize; j++) {;
1017 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1018 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1024 for (j = 0; j < lumFilterSize; j++) {
1025 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1026 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1043 Y1 -=
c->yuv2rgb_y_offset;
1044 Y2 -=
c->yuv2rgb_y_offset;
1045 Y1 *=
c->yuv2rgb_y_coeff;
1046 Y2 *=
c->yuv2rgb_y_coeff;
1047 Y1 += (1 << 13) - (1 << 29);
1048 Y2 += (1 << 13) - (1 << 29);
1051 R =
V *
c->yuv2rgb_v2r_coeff;
1052 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1053 B =
U *
c->yuv2rgb_u2b_coeff;
1078 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1079 int yalpha,
int uvalpha,
int y,
1082 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1083 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1084 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1085 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1086 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1087 int yalpha1 = 4096 - yalpha;
1088 int uvalpha1 = 4096 - uvalpha;
1090 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1095 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1096 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1097 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1098 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1099 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1102 Y1 -=
c->yuv2rgb_y_offset;
1103 Y2 -=
c->yuv2rgb_y_offset;
1104 Y1 *=
c->yuv2rgb_y_coeff;
1105 Y2 *=
c->yuv2rgb_y_coeff;
1106 Y1 += (1 << 13) - (1 << 29);
1107 Y2 += (1 << 13) - (1 << 29);
1109 R =
V *
c->yuv2rgb_v2r_coeff;
1110 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1111 B =
U *
c->yuv2rgb_u2b_coeff;
1114 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1115 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1143 const int32_t *abuf0, uint16_t *dest,
int dstW,
1144 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1146 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1148 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1150 if (uvalpha < 2048) {
1151 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1152 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1153 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1154 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1155 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1158 Y1 -=
c->yuv2rgb_y_offset;
1159 Y2 -=
c->yuv2rgb_y_offset;
1160 Y1 *=
c->yuv2rgb_y_coeff;
1161 Y2 *=
c->yuv2rgb_y_coeff;
1162 Y1 += (1 << 13) - (1 << 29);
1163 Y2 += (1 << 13) - (1 << 29);
1166 A1 = abuf0[
i * 2 ] * (1 << 11);
1167 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1173 R =
V *
c->yuv2rgb_v2r_coeff;
1174 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1175 B =
U *
c->yuv2rgb_u2b_coeff;
1195 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1196 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1197 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1198 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1199 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1200 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1201 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1204 Y1 -=
c->yuv2rgb_y_offset;
1205 Y2 -=
c->yuv2rgb_y_offset;
1206 Y1 *=
c->yuv2rgb_y_coeff;
1207 Y2 *=
c->yuv2rgb_y_coeff;
1208 Y1 += (1 << 13) - (1 << 29);
1209 Y2 += (1 << 13) - (1 << 29);
1212 A1 = abuf0[
i * 2 ] * (1 << 11);
1213 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1219 R =
V *
c->yuv2rgb_v2r_coeff;
1220 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1221 B =
U *
c->yuv2rgb_u2b_coeff;
1245 const int32_t **lumSrc,
int lumFilterSize,
1246 const int16_t *chrFilter,
const int32_t **chrUSrc,
1247 const int32_t **chrVSrc,
int chrFilterSize,
1248 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1249 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1254 for (
i = 0;
i < dstW;
i++) {
1256 int Y = -0x40000000;
1257 int U = -(128 << 23);
1258 int V = -(128 << 23);
1261 for (j = 0; j < lumFilterSize; j++) {
1262 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1264 for (j = 0; j < chrFilterSize; j++) {;
1265 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1266 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1271 for (j = 0; j < lumFilterSize; j++) {
1272 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1285 Y -=
c->yuv2rgb_y_offset;
1286 Y *=
c->yuv2rgb_y_coeff;
1287 Y += (1 << 13) - (1<<29);
1290 R =
V *
c->yuv2rgb_v2r_coeff;
1291 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1292 B =
U *
c->yuv2rgb_u2b_coeff;
1310 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1311 int yalpha,
int uvalpha,
int y,
1314 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1315 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1316 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1317 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1318 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1319 int yalpha1 = 4096 - yalpha;
1320 int uvalpha1 = 4096 - uvalpha;
1327 for (
i = 0;
i < dstW;
i++) {
1328 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1329 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1330 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1333 Y -=
c->yuv2rgb_y_offset;
1334 Y *=
c->yuv2rgb_y_coeff;
1335 Y += (1 << 13) - (1 << 29);
1337 R =
V *
c->yuv2rgb_v2r_coeff;
1338 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1339 B =
U *
c->yuv2rgb_u2b_coeff;
1342 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1362 const int32_t *abuf0, uint16_t *dest,
int dstW,
1363 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1365 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1369 if (uvalpha < 2048) {
1370 for (
i = 0;
i < dstW;
i++) {
1372 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1373 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1376 Y -=
c->yuv2rgb_y_offset;
1377 Y *=
c->yuv2rgb_y_coeff;
1378 Y += (1 << 13) - (1 << 29);
1381 A = abuf0[
i] * (1 << 11);
1386 R =
V *
c->yuv2rgb_v2r_coeff;
1387 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1388 B =
U *
c->yuv2rgb_u2b_coeff;
1401 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1403 for (
i = 0;
i < dstW;
i++) {
1405 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1406 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1409 Y -=
c->yuv2rgb_y_offset;
1410 Y *=
c->yuv2rgb_y_coeff;
1411 Y += (1 << 13) - (1 << 29);
1414 A = abuf0[
i] * (1 << 11);
1419 R =
V *
c->yuv2rgb_v2r_coeff;
1420 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1421 B =
U *
c->yuv2rgb_u2b_coeff;
1440 #define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \
1441 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1442 const int16_t **_lumSrc, int lumFilterSize, \
1443 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1444 const int16_t **_chrVSrc, int chrFilterSize, \
1445 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1448 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1449 **chrUSrc = (const int32_t **) _chrUSrc, \
1450 **chrVSrc = (const int32_t **) _chrVSrc, \
1451 **alpSrc = (const int32_t **) _alpSrc; \
1452 uint16_t *dest = (uint16_t *) _dest; \
1453 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1454 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1455 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \
1458 static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
1459 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1460 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1461 int yalpha, int uvalpha, int y) \
1463 const int32_t **buf = (const int32_t **) _buf, \
1464 **ubuf = (const int32_t **) _ubuf, \
1465 **vbuf = (const int32_t **) _vbuf, \
1466 **abuf = (const int32_t **) _abuf; \
1467 uint16_t *dest = (uint16_t *) _dest; \
1468 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1469 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \
1472 static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
1473 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1474 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1475 int uvalpha, int y) \
1477 const int32_t *buf0 = (const int32_t *) _buf0, \
1478 **ubuf = (const int32_t **) _ubuf, \
1479 **vbuf = (const int32_t **) _vbuf, \
1480 *abuf0 = (const int32_t *) _abuf0; \
1481 uint16_t *dest = (uint16_t *) _dest; \
1482 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1483 dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \
1524 unsigned A1,
unsigned A2,
1525 const
void *_r, const
void *_g, const
void *_b,
int y,
1530 uint32_t *dest = (uint32_t *) _dest;
1531 const uint32_t *
r = (
const uint32_t *) _r;
1532 const uint32_t *
g = (
const uint32_t *) _g;
1533 const uint32_t *
b = (
const uint32_t *) _b;
1538 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1539 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1545 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1546 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1548 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1551 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1553 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1554 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1563 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1564 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1566 dest[
i * 6 + 0] =
r_b[Y1];
1567 dest[
i * 6 + 1] =
g[Y1];
1568 dest[
i * 6 + 2] =
b_r[Y1];
1569 dest[
i * 6 + 3] =
r_b[Y2];
1570 dest[
i * 6 + 4] =
g[Y2];
1571 dest[
i * 6 + 5] =
b_r[Y2];
1577 uint16_t *dest = (uint16_t *) _dest;
1578 const uint16_t *
r = (
const uint16_t *) _r;
1579 const uint16_t *
g = (
const uint16_t *) _g;
1580 const uint16_t *
b = (
const uint16_t *) _b;
1581 int dr1, dg1, db1, dr2, dg2, db2;
1606 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1607 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1609 uint32_t *dest = (uint32_t *) _dest;
1610 const uint32_t *
r = (
const uint32_t *) _r;
1611 const uint32_t *
g = (
const uint32_t *) _g;
1612 const uint32_t *
b = (
const uint32_t *) _b;
1613 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1614 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1620 int dr1, dg1, db1, dr2, dg2, db2;
1625 dr1 = dg1 =
d32[(
i * 2 + 0) & 7];
1626 db1 =
d64[(
i * 2 + 0) & 7];
1627 dr2 = dg2 =
d32[(
i * 2 + 1) & 7];
1628 db2 =
d64[(
i * 2 + 1) & 7];
1632 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1633 dg1 =
d64[(
i * 2 + 0) & 7];
1634 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1635 dg2 =
d64[(
i * 2 + 1) & 7];
1639 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1640 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1642 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1643 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1650 const int16_t **lumSrc,
int lumFilterSize,
1651 const int16_t *chrFilter,
const int16_t **chrUSrc,
1652 const int16_t **chrVSrc,
int chrFilterSize,
1653 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
1658 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1664 const void *
r, *
g, *
b;
1666 for (j = 0; j < lumFilterSize; j++) {
1667 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1668 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1670 for (j = 0; j < chrFilterSize; j++) {
1671 U += chrUSrc[j][
i] * chrFilter[j];
1672 V += chrVSrc[j][
i] * chrFilter[j];
1681 for (j = 0; j < lumFilterSize; j++) {
1682 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1683 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1687 if ((
A1 |
A2) & 0x100) {
1698 r,
g,
b, y, target, hasAlpha);
1704 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1705 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
1706 int yalpha,
int uvalpha,
int y,
1709 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1710 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1711 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1712 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1713 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1714 int yalpha1 = 4096 - yalpha;
1715 int uvalpha1 = 4096 - uvalpha;
1720 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1721 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1722 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1723 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1724 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1731 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1732 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1738 r,
g,
b, y, target, hasAlpha);
1744 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1745 const int16_t *abuf0,
uint8_t *dest,
int dstW,
1749 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1752 if (uvalpha < 2048) {
1753 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1754 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1755 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1756 int U = (ubuf0[
i] + 64) >> 7;
1757 int V = (vbuf0[
i] + 64) >> 7;
1764 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1765 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1771 r,
g,
b, y, target, hasAlpha);
1774 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1775 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1776 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1777 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1778 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1779 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1786 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1787 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1793 r,
g,
b, y, target, hasAlpha);
1798 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1799 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1800 const int16_t **lumSrc, int lumFilterSize, \
1801 const int16_t *chrFilter, const int16_t **chrUSrc, \
1802 const int16_t **chrVSrc, int chrFilterSize, \
1803 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1806 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1807 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1808 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1811 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1812 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1813 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
1814 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1815 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1816 int yalpha, int uvalpha, int y) \
1818 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1819 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1822 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1823 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1824 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
1825 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1826 const int16_t *abuf0, uint8_t *dest, int dstW, \
1827 int uvalpha, int y) \
1829 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1830 dstW, uvalpha, y, fmt, hasAlpha); \
1837 #if CONFIG_SWSCALE_ALPHA
1861 Y -=
c->yuv2rgb_y_offset;
1862 Y *=
c->yuv2rgb_y_coeff;
1864 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
1865 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
1866 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
1867 if ((
R |
G |
B) & 0xC0000000) {
1875 dest[0] = hasAlpha ?
A : 255;
1889 dest[3] = hasAlpha ?
A : 255;
1892 dest[0] = hasAlpha ?
A : 255;
1906 dest[3] = hasAlpha ?
A : 255;
1915 switch (
c->dither) {
1922 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;
1923 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;
1924 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;
1925 c->dither_error[0][
i] = err[0];
1926 c->dither_error[1][
i] = err[1];
1927 c->dither_error[2][
i] = err[2];
1928 r =
R >> (isrgb8 ? 5 : 7);
1929 g =
G >> (isrgb8 ? 5 : 6);
1930 b =
B >> (isrgb8 ? 6 : 7);
1934 err[0] =
R -
r*(isrgb8 ? 36 : 255);
1935 err[1] =
G -
g*(isrgb8 ? 36 : 85);
1936 err[2] =
B -
b*(isrgb8 ? 85 : 255);
1941 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
1960 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
1980 dest[0] =
r + 2*
g + 8*
b;
1982 dest[0] =
b + 2*
g + 8*
r;
1984 dest[0] =
r + 8*
g + 64*
b;
1986 dest[0] =
b + 4*
g + 32*
r;
1995 const int16_t **lumSrc,
int lumFilterSize,
1996 const int16_t *chrFilter,
const int16_t **chrUSrc,
1997 const int16_t **chrVSrc,
int chrFilterSize,
1998 const int16_t **alpSrc,
uint8_t *dest,
2010 for (
i = 0;
i < dstW;
i++) {
2013 int U = (1<<9)-(128 << 19);
2014 int V = (1<<9)-(128 << 19);
2016 for (j = 0; j < lumFilterSize; j++) {
2017 Y += lumSrc[j][
i] * lumFilter[j];
2019 for (j = 0; j < chrFilterSize; j++) {
2020 U += chrUSrc[j][
i] * chrFilter[j];
2021 V += chrVSrc[j][
i] * chrFilter[j];
2028 for (j = 0; j < lumFilterSize; j++) {
2029 A += alpSrc[j][
i] * lumFilter[j];
2035 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2038 c->dither_error[0][
i] = err[0];
2039 c->dither_error[1][
i] = err[1];
2040 c->dither_error[2][
i] = err[2];
2045 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2046 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2047 int yalpha,
int uvalpha,
int y,
2050 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2051 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2052 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2053 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2054 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2055 int yalpha1 = 4096 - yalpha;
2056 int uvalpha1 = 4096 - uvalpha;
2069 for (
i = 0;
i < dstW;
i++) {
2070 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2071 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2072 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2075 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2080 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2083 c->dither_error[0][
i] = err[0];
2084 c->dither_error[1][
i] = err[1];
2085 c->dither_error[2][
i] = err[2];
2090 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2091 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2095 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2104 if (uvalpha < 2048) {
2106 for (
i = 0;
i < dstW;
i++) {
2107 int Y = buf0[
i] * 4;
2108 int U = (ubuf0[
i] - (128<<7)) * 4;
2109 int V = (vbuf0[
i] - (128<<7)) * 4;
2112 A = (abuf0[
i] + 64) >> 7;
2117 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2121 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2123 for (
i = 0;
i < dstW;
i++) {
2124 int Y = buf0[
i] * 4;
2125 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2126 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2129 A = (abuf0[
i] + 64) >> 7;
2134 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2139 c->dither_error[0][
i] = err[0];
2140 c->dither_error[1][
i] = err[1];
2141 c->dither_error[2][
i] = err[2];
2150 #if CONFIG_SWSCALE_ALPHA
2171 const int16_t **lumSrc,
int lumFilterSize,
2172 const int16_t *chrFilter, const int16_t **chrUSrc,
2173 const int16_t **chrVSrc,
int chrFilterSize,
2174 const int16_t **alpSrc,
uint8_t **dest,
2180 uint16_t **dest16 = (uint16_t**)dest;
2181 int SH = 22 + 8 -
desc->comp[0].depth;
2184 for (
i = 0;
i < dstW;
i++) {
2187 int U = (1 << 9) - (128 << 19);
2188 int V = (1 << 9) - (128 << 19);
2191 for (j = 0; j < lumFilterSize; j++)
2192 Y += lumSrc[j][
i] * lumFilter[j];
2194 for (j = 0; j < chrFilterSize; j++) {
2195 U += chrUSrc[j][
i] * chrFilter[j];
2196 V += chrVSrc[j][
i] * chrFilter[j];
2206 for (j = 0; j < lumFilterSize; j++)
2207 A += alpSrc[j][
i] * lumFilter[j];
2213 Y -=
c->yuv2rgb_y_offset;
2214 Y *=
c->yuv2rgb_y_coeff;
2216 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2217 G =
Y +
V * (
unsigned)
c->yuv2rgb_v2g_coeff +
U * (unsigned)
c->yuv2rgb_u2g_coeff;
2218 B =
Y +
U * (
unsigned)
c->yuv2rgb_u2b_coeff;
2220 if ((
R |
G |
B) & 0xC0000000) {
2227 dest16[0][
i] =
G >>
SH;
2228 dest16[1][
i] =
B >>
SH;
2229 dest16[2][
i] =
R >>
SH;
2231 dest16[3][
i] =
A >> (
SH - 3);
2233 dest[0][
i] =
G >> 22;
2234 dest[1][
i] =
B >> 22;
2235 dest[2][
i] =
R >> 22;
2237 dest[3][
i] =
A >> 19;
2241 for (
i = 0;
i < dstW;
i++) {
2253 const int16_t **lumSrcx,
int lumFilterSize,
2254 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2255 const int16_t **chrVSrcx,
int chrFilterSize,
2256 const int16_t **alpSrcx,
uint8_t **dest,
2262 uint16_t **dest16 = (uint16_t**)dest;
2268 for (
i = 0;
i < dstW;
i++) {
2270 int Y = -0x40000000;
2271 int U = -(128 << 23);
2272 int V = -(128 << 23);
2275 for (j = 0; j < lumFilterSize; j++)
2276 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2278 for (j = 0; j < chrFilterSize; j++) {
2279 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2280 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2291 for (j = 0; j < lumFilterSize; j++)
2292 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2298 Y -=
c->yuv2rgb_y_offset;
2299 Y *=
c->yuv2rgb_y_coeff;
2301 R =
V *
c->yuv2rgb_v2r_coeff;
2302 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2303 B =
U *
c->yuv2rgb_u2b_coeff;
2309 dest16[0][
i] =
G >> 14;
2310 dest16[1][
i] =
B >> 14;
2311 dest16[2][
i] =
R >> 14;
2316 for (
i = 0;
i < dstW;
i++) {
2328 const int16_t **lumSrcx,
int lumFilterSize,
2329 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2330 const int16_t **chrVSrcx,
int chrFilterSize,
2331 const int16_t **alpSrcx,
uint8_t **dest,
2337 uint32_t **dest32 = (uint32_t**)dest;
2342 static const float float_mult = 1.0f / 65535.0f;
2344 for (
i = 0;
i < dstW;
i++) {
2346 int Y = -0x40000000;
2347 int U = -(128 << 23);
2348 int V = -(128 << 23);
2351 for (j = 0; j < lumFilterSize; j++)
2352 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2354 for (j = 0; j < chrFilterSize; j++) {
2355 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2356 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2367 for (j = 0; j < lumFilterSize; j++)
2368 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2374 Y -=
c->yuv2rgb_y_offset;
2375 Y *=
c->yuv2rgb_y_coeff;
2377 R =
V *
c->yuv2rgb_v2r_coeff;
2378 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2379 B =
U *
c->yuv2rgb_u2b_coeff;
2392 for (
i = 0;
i < dstW;
i++) {
2404 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2405 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2408 int hasAlpha = !!abuf0;
2411 for (
i = 0;
i < dstW;
i++) {
2412 int Y = (buf0[
i] + 64) >> 7;
2418 A = (abuf0[
i] + 64) >> 7;
2424 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2430 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2431 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2432 int yalpha,
int uvalpha,
int y)
2434 int hasAlpha = abuf && abuf[0] && abuf[1];
2435 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2436 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2437 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2438 int yalpha1 = 4096 - yalpha;
2443 for (
i = 0;
i < dstW;
i++) {
2444 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2450 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2455 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2461 const int16_t **lumSrc,
int lumFilterSize,
2462 const int16_t *chrFilter,
const int16_t **chrUSrc,
2463 const int16_t **chrVSrc,
int chrFilterSize,
2464 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
int y)
2466 int hasAlpha = !!alpSrc;
2469 for (
i = 0;
i < dstW;
i++) {
2471 int Y = 1 << 18,
A = 1 << 18;
2473 for (j = 0; j < lumFilterSize; j++)
2474 Y += lumSrc[j][
i] * lumFilter[j];
2481 for (j = 0; j < lumFilterSize; j++)
2482 A += alpSrc[j][
i] * lumFilter[j];
2491 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2497 const int16_t **_lumSrc,
int lumFilterSize,
2498 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2499 const int16_t **_chrVSrc,
int chrFilterSize,
2500 const int16_t **_alpSrc,
uint8_t *dest,
int dstW,
int y)
2503 **chrUSrc = (
const int32_t **) _chrUSrc,
2504 **chrVSrc = (
const int32_t **) _chrVSrc,
2505 **alpSrc = (
const int32_t **) _alpSrc;
2506 int hasAlpha = !!alpSrc;
2509 for (
i = 0;
i < dstW;
i++) {
2510 int Y = 1 << 14,
U = 1 << 14;
2511 int V = 1 << 14,
A = 1 << 14;
2519 for (j = 0; j < lumFilterSize; j++)
2520 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2522 for (j = 0; j < chrFilterSize; j++)
2523 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2525 for (j = 0; j < chrFilterSize; j++)
2526 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2529 for (j = 0; j < lumFilterSize; j++)
2530 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2537 AV_WL16(dest + 8 *
i, hasAlpha ?
A : 65535);
2560 }
else if (
is16BPS(dstFormat)) {
2561 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
2562 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
2566 }
else if (
isNBPS(dstFormat)) {
2567 if (
desc->comp[0].depth == 9) {
2568 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
2569 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
2570 }
else if (
desc->comp[0].depth == 10) {
2571 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
2572 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
2573 }
else if (
desc->comp[0].depth == 12) {
2574 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
2575 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
2576 }
else if (
desc->comp[0].depth == 14) {
2577 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
2578 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
2583 *yuv2plane1 = yuv2plane1_floatBE_c;
2586 *yuv2plane1 = yuv2plane1_floatLE_c;
2596 switch (dstFormat) {
2599 *yuv2packedX = yuv2rgba32_full_X_c;
2600 *yuv2packed2 = yuv2rgba32_full_2_c;
2601 *yuv2packed1 = yuv2rgba32_full_1_c;
2603 #if CONFIG_SWSCALE_ALPHA
2605 *yuv2packedX = yuv2rgba32_full_X_c;
2606 *yuv2packed2 = yuv2rgba32_full_2_c;
2607 *yuv2packed1 = yuv2rgba32_full_1_c;
2611 *yuv2packedX = yuv2rgbx32_full_X_c;
2612 *yuv2packed2 = yuv2rgbx32_full_2_c;
2613 *yuv2packed1 = yuv2rgbx32_full_1_c;
2619 *yuv2packedX = yuv2argb32_full_X_c;
2620 *yuv2packed2 = yuv2argb32_full_2_c;
2621 *yuv2packed1 = yuv2argb32_full_1_c;
2623 #if CONFIG_SWSCALE_ALPHA
2625 *yuv2packedX = yuv2argb32_full_X_c;
2626 *yuv2packed2 = yuv2argb32_full_2_c;
2627 *yuv2packed1 = yuv2argb32_full_1_c;
2631 *yuv2packedX = yuv2xrgb32_full_X_c;
2632 *yuv2packed2 = yuv2xrgb32_full_2_c;
2633 *yuv2packed1 = yuv2xrgb32_full_1_c;
2639 *yuv2packedX = yuv2bgra32_full_X_c;
2640 *yuv2packed2 = yuv2bgra32_full_2_c;
2641 *yuv2packed1 = yuv2bgra32_full_1_c;
2643 #if CONFIG_SWSCALE_ALPHA
2645 *yuv2packedX = yuv2bgra32_full_X_c;
2646 *yuv2packed2 = yuv2bgra32_full_2_c;
2647 *yuv2packed1 = yuv2bgra32_full_1_c;
2651 *yuv2packedX = yuv2bgrx32_full_X_c;
2652 *yuv2packed2 = yuv2bgrx32_full_2_c;
2653 *yuv2packed1 = yuv2bgrx32_full_1_c;
2659 *yuv2packedX = yuv2abgr32_full_X_c;
2660 *yuv2packed2 = yuv2abgr32_full_2_c;
2661 *yuv2packed1 = yuv2abgr32_full_1_c;
2663 #if CONFIG_SWSCALE_ALPHA
2665 *yuv2packedX = yuv2abgr32_full_X_c;
2666 *yuv2packed2 = yuv2abgr32_full_2_c;
2667 *yuv2packed1 = yuv2abgr32_full_1_c;
2671 *yuv2packedX = yuv2xbgr32_full_X_c;
2672 *yuv2packed2 = yuv2xbgr32_full_2_c;
2673 *yuv2packed1 = yuv2xbgr32_full_1_c;
2678 #if CONFIG_SWSCALE_ALPHA
2680 *yuv2packedX = yuv2rgba64le_full_X_c;
2681 *yuv2packed2 = yuv2rgba64le_full_2_c;
2682 *yuv2packed1 = yuv2rgba64le_full_1_c;
2686 *yuv2packedX = yuv2rgbx64le_full_X_c;
2687 *yuv2packed2 = yuv2rgbx64le_full_2_c;
2688 *yuv2packed1 = yuv2rgbx64le_full_1_c;
2692 #if CONFIG_SWSCALE_ALPHA
2694 *yuv2packedX = yuv2rgba64be_full_X_c;
2695 *yuv2packed2 = yuv2rgba64be_full_2_c;
2696 *yuv2packed1 = yuv2rgba64be_full_1_c;
2700 *yuv2packedX = yuv2rgbx64be_full_X_c;
2701 *yuv2packed2 = yuv2rgbx64be_full_2_c;
2702 *yuv2packed1 = yuv2rgbx64be_full_1_c;
2706 #if CONFIG_SWSCALE_ALPHA
2708 *yuv2packedX = yuv2bgra64le_full_X_c;
2709 *yuv2packed2 = yuv2bgra64le_full_2_c;
2710 *yuv2packed1 = yuv2bgra64le_full_1_c;
2714 *yuv2packedX = yuv2bgrx64le_full_X_c;
2715 *yuv2packed2 = yuv2bgrx64le_full_2_c;
2716 *yuv2packed1 = yuv2bgrx64le_full_1_c;
2720 #if CONFIG_SWSCALE_ALPHA
2722 *yuv2packedX = yuv2bgra64be_full_X_c;
2723 *yuv2packed2 = yuv2bgra64be_full_2_c;
2724 *yuv2packed1 = yuv2bgra64be_full_1_c;
2728 *yuv2packedX = yuv2bgrx64be_full_X_c;
2729 *yuv2packed2 = yuv2bgrx64be_full_2_c;
2730 *yuv2packed1 = yuv2bgrx64be_full_1_c;
2735 *yuv2packedX = yuv2rgb24_full_X_c;
2736 *yuv2packed2 = yuv2rgb24_full_2_c;
2737 *yuv2packed1 = yuv2rgb24_full_1_c;
2740 *yuv2packedX = yuv2bgr24_full_X_c;
2741 *yuv2packed2 = yuv2bgr24_full_2_c;
2742 *yuv2packed1 = yuv2bgr24_full_1_c;
2745 *yuv2packedX = yuv2rgb48le_full_X_c;
2746 *yuv2packed2 = yuv2rgb48le_full_2_c;
2747 *yuv2packed1 = yuv2rgb48le_full_1_c;
2750 *yuv2packedX = yuv2bgr48le_full_X_c;
2751 *yuv2packed2 = yuv2bgr48le_full_2_c;
2752 *yuv2packed1 = yuv2bgr48le_full_1_c;
2755 *yuv2packedX = yuv2rgb48be_full_X_c;
2756 *yuv2packed2 = yuv2rgb48be_full_2_c;
2757 *yuv2packed1 = yuv2rgb48be_full_1_c;
2760 *yuv2packedX = yuv2bgr48be_full_X_c;
2761 *yuv2packed2 = yuv2bgr48be_full_2_c;
2762 *yuv2packed1 = yuv2bgr48be_full_1_c;
2765 *yuv2packedX = yuv2bgr4_byte_full_X_c;
2766 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
2767 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
2770 *yuv2packedX = yuv2rgb4_byte_full_X_c;
2771 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
2772 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
2775 *yuv2packedX = yuv2bgr8_full_X_c;
2776 *yuv2packed2 = yuv2bgr8_full_2_c;
2777 *yuv2packed1 = yuv2bgr8_full_1_c;
2780 *yuv2packedX = yuv2rgb8_full_X_c;
2781 *yuv2packed2 = yuv2rgb8_full_2_c;
2782 *yuv2packed1 = yuv2rgb8_full_1_c;
2813 if (!*yuv2packedX && !*yuv2anyX)
2817 switch (dstFormat) {
2819 #if CONFIG_SWSCALE_ALPHA
2821 *yuv2packed1 = yuv2rgba64le_1_c;
2822 *yuv2packed2 = yuv2rgba64le_2_c;
2823 *yuv2packedX = yuv2rgba64le_X_c;
2827 *yuv2packed1 = yuv2rgbx64le_1_c;
2828 *yuv2packed2 = yuv2rgbx64le_2_c;
2829 *yuv2packedX = yuv2rgbx64le_X_c;
2833 #if CONFIG_SWSCALE_ALPHA
2835 *yuv2packed1 = yuv2rgba64be_1_c;
2836 *yuv2packed2 = yuv2rgba64be_2_c;
2837 *yuv2packedX = yuv2rgba64be_X_c;
2841 *yuv2packed1 = yuv2rgbx64be_1_c;
2842 *yuv2packed2 = yuv2rgbx64be_2_c;
2843 *yuv2packedX = yuv2rgbx64be_X_c;
2847 #if CONFIG_SWSCALE_ALPHA
2849 *yuv2packed1 = yuv2bgra64le_1_c;
2850 *yuv2packed2 = yuv2bgra64le_2_c;
2851 *yuv2packedX = yuv2bgra64le_X_c;
2855 *yuv2packed1 = yuv2bgrx64le_1_c;
2856 *yuv2packed2 = yuv2bgrx64le_2_c;
2857 *yuv2packedX = yuv2bgrx64le_X_c;
2861 #if CONFIG_SWSCALE_ALPHA
2863 *yuv2packed1 = yuv2bgra64be_1_c;
2864 *yuv2packed2 = yuv2bgra64be_2_c;
2865 *yuv2packedX = yuv2bgra64be_X_c;
2869 *yuv2packed1 = yuv2bgrx64be_1_c;
2870 *yuv2packed2 = yuv2bgrx64be_2_c;
2871 *yuv2packedX = yuv2bgrx64be_X_c;
2875 *yuv2packed1 = yuv2rgb48le_1_c;
2876 *yuv2packed2 = yuv2rgb48le_2_c;
2877 *yuv2packedX = yuv2rgb48le_X_c;
2880 *yuv2packed1 = yuv2rgb48be_1_c;
2881 *yuv2packed2 = yuv2rgb48be_2_c;
2882 *yuv2packedX = yuv2rgb48be_X_c;
2885 *yuv2packed1 = yuv2bgr48le_1_c;
2886 *yuv2packed2 = yuv2bgr48le_2_c;
2887 *yuv2packedX = yuv2bgr48le_X_c;
2890 *yuv2packed1 = yuv2bgr48be_1_c;
2891 *yuv2packed2 = yuv2bgr48be_2_c;
2892 *yuv2packedX = yuv2bgr48be_X_c;
2897 *yuv2packed1 = yuv2rgb32_1_c;
2898 *yuv2packed2 = yuv2rgb32_2_c;
2899 *yuv2packedX = yuv2rgb32_X_c;
2901 #if CONFIG_SWSCALE_ALPHA
2903 *yuv2packed1 = yuv2rgba32_1_c;
2904 *yuv2packed2 = yuv2rgba32_2_c;
2905 *yuv2packedX = yuv2rgba32_X_c;
2909 *yuv2packed1 = yuv2rgbx32_1_c;
2910 *yuv2packed2 = yuv2rgbx32_2_c;
2911 *yuv2packedX = yuv2rgbx32_X_c;
2918 *yuv2packed1 = yuv2rgb32_1_1_c;
2919 *yuv2packed2 = yuv2rgb32_1_2_c;
2920 *yuv2packedX = yuv2rgb32_1_X_c;
2922 #if CONFIG_SWSCALE_ALPHA
2924 *yuv2packed1 = yuv2rgba32_1_1_c;
2925 *yuv2packed2 = yuv2rgba32_1_2_c;
2926 *yuv2packedX = yuv2rgba32_1_X_c;
2930 *yuv2packed1 = yuv2rgbx32_1_1_c;
2931 *yuv2packed2 = yuv2rgbx32_1_2_c;
2932 *yuv2packedX = yuv2rgbx32_1_X_c;
2937 *yuv2packed1 = yuv2rgb24_1_c;
2938 *yuv2packed2 = yuv2rgb24_2_c;
2939 *yuv2packedX = yuv2rgb24_X_c;
2942 *yuv2packed1 = yuv2bgr24_1_c;
2943 *yuv2packed2 = yuv2bgr24_2_c;
2944 *yuv2packedX = yuv2bgr24_X_c;
2950 *yuv2packed1 = yuv2rgb16_1_c;
2951 *yuv2packed2 = yuv2rgb16_2_c;
2952 *yuv2packedX = yuv2rgb16_X_c;
2958 *yuv2packed1 = yuv2rgb15_1_c;
2959 *yuv2packed2 = yuv2rgb15_2_c;
2960 *yuv2packedX = yuv2rgb15_X_c;
2966 *yuv2packed1 = yuv2rgb12_1_c;
2967 *yuv2packed2 = yuv2rgb12_2_c;
2968 *yuv2packedX = yuv2rgb12_X_c;
2972 *yuv2packed1 = yuv2rgb8_1_c;
2973 *yuv2packed2 = yuv2rgb8_2_c;
2974 *yuv2packedX = yuv2rgb8_X_c;
2978 *yuv2packed1 = yuv2rgb4_1_c;
2979 *yuv2packed2 = yuv2rgb4_2_c;
2980 *yuv2packedX = yuv2rgb4_X_c;
2984 *yuv2packed1 = yuv2rgb4b_1_c;
2985 *yuv2packed2 = yuv2rgb4b_2_c;
2986 *yuv2packedX = yuv2rgb4b_X_c;
2990 *yuv2packed1 = yuv2x2rgb10_1_c;
2991 *yuv2packed2 = yuv2x2rgb10_2_c;
2992 *yuv2packedX = yuv2x2rgb10_X_c;
2996 switch (dstFormat) {
2998 *yuv2packed1 = yuv2monowhite_1_c;
2999 *yuv2packed2 = yuv2monowhite_2_c;
3000 *yuv2packedX = yuv2monowhite_X_c;
3003 *yuv2packed1 = yuv2monoblack_1_c;
3004 *yuv2packed2 = yuv2monoblack_2_c;
3005 *yuv2packedX = yuv2monoblack_X_c;
3008 *yuv2packed1 = yuv2yuyv422_1_c;
3009 *yuv2packed2 = yuv2yuyv422_2_c;
3010 *yuv2packedX = yuv2yuyv422_X_c;
3013 *yuv2packed1 = yuv2yvyu422_1_c;
3014 *yuv2packed2 = yuv2yvyu422_2_c;
3015 *yuv2packedX = yuv2yvyu422_X_c;
3018 *yuv2packed1 = yuv2uyvy422_1_c;
3019 *yuv2packed2 = yuv2uyvy422_2_c;
3020 *yuv2packedX = yuv2uyvy422_X_c;
3028 *yuv2packed1 = yuv2ya16le_1_c;
3029 *yuv2packed2 = yuv2ya16le_2_c;
3030 *yuv2packedX = yuv2ya16le_X_c;
3033 *yuv2packed1 = yuv2ya16be_1_c;
3034 *yuv2packed2 = yuv2ya16be_2_c;
3035 *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 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)
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 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]