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;
637 for (
i = 0;
i < dstW;
i += 8) {
641 Y = (buf0[
i + 0] * yalpha1 + buf1[
i + 0] * yalpha) >> 19;
643 Y = (buf0[
i + 1] * yalpha1 + buf1[
i + 1] * yalpha) >> 19;
645 Y = (buf0[
i + 2] * yalpha1 + buf1[
i + 2] * yalpha) >> 19;
647 Y = (buf0[
i + 3] * yalpha1 + buf1[
i + 3] * yalpha) >> 19;
649 Y = (buf0[
i + 4] * yalpha1 + buf1[
i + 4] * yalpha) >> 19;
651 Y = (buf0[
i + 5] * yalpha1 + buf1[
i + 5] * yalpha) >> 19;
653 Y = (buf0[
i + 6] * yalpha1 + buf1[
i + 6] * yalpha) >> 19;
655 Y = (buf0[
i + 7] * yalpha1 + buf1[
i + 7] * yalpha) >> 19;
665 const int16_t *ubuf[2],
const int16_t *vbuf[2],
666 const int16_t *abuf0,
uint8_t *dest,
int dstW,
675 for (
i = 0;
i < dstW;
i +=2) {
678 Y = ((buf0[
i + 0] + 64) >> 7);
679 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;
680 c->dither_error[0][
i] = err;
684 err = ((buf0[
i + 1] + 64) >> 7);
685 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;
686 c->dither_error[0][
i+1] =
Y;
687 acc = 2*
acc + (err >= 128);
693 c->dither_error[0][
i] = err;
695 for (
i = 0;
i < dstW;
i += 8) {
712 #undef accumulate_bit
714 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
715 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
716 const int16_t **lumSrc, int lumFilterSize, \
717 const int16_t *chrFilter, const int16_t **chrUSrc, \
718 const int16_t **chrVSrc, int chrFilterSize, \
719 const int16_t **alpSrc, uint8_t *dest, int dstW, \
722 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
723 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
724 alpSrc, dest, dstW, y, fmt); \
727 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
728 const int16_t *ubuf[2], const int16_t *vbuf[2], \
729 const int16_t *abuf[2], uint8_t *dest, int dstW, \
730 int yalpha, int uvalpha, int y) \
732 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
733 dest, dstW, yalpha, uvalpha, y, fmt); \
736 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
737 const int16_t *ubuf[2], const int16_t *vbuf[2], \
738 const int16_t *abuf0, uint8_t *dest, int dstW, \
739 int uvalpha, int y) \
741 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
742 abuf0, dest, dstW, uvalpha, \
749 #define output_pixels(pos, Y1, U, Y2, V) \
750 if (target == AV_PIX_FMT_YUYV422) { \
751 dest[pos + 0] = Y1; \
753 dest[pos + 2] = Y2; \
755 } else if (target == AV_PIX_FMT_YVYU422) { \
756 dest[pos + 0] = Y1; \
758 dest[pos + 2] = Y2; \
762 dest[pos + 1] = Y1; \
764 dest[pos + 3] = Y2; \
769 const int16_t **lumSrc,
int lumFilterSize,
770 const int16_t *chrFilter,
const int16_t **chrUSrc,
771 const int16_t **chrVSrc,
int chrFilterSize,
772 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
777 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
784 for (j = 0; j < lumFilterSize; j++) {
785 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
786 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
788 for (j = 0; j < chrFilterSize; j++) {
789 U += chrUSrc[j][
i] * chrFilter[j];
790 V += chrVSrc[j][
i] * chrFilter[j];
796 if ((Y1 | Y2 |
U |
V) & 0x100) {
808 const int16_t *ubuf[2],
const int16_t *vbuf[2],
809 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
810 int yalpha,
int uvalpha,
int y,
813 const int16_t *buf0 = buf[0], *buf1 = buf[1],
814 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
815 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
816 int yalpha1 = 4096 - yalpha;
817 int uvalpha1 = 4096 - uvalpha;
822 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
823 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
824 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
825 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
826 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
828 if ((Y1 | Y2 |
U |
V) & 0x100) {
841 const int16_t *ubuf[2],
const int16_t *vbuf[2],
842 const int16_t *abuf0,
uint8_t *dest,
int dstW,
845 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
848 if (uvalpha < 2048) {
849 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
850 int Y1 = (buf0[
i * 2 ]+64) >> 7;
851 int Y2 = (buf0[
i * 2 + 1]+64) >> 7;
852 int U = (ubuf0[
i] +64) >> 7;
853 int V = (vbuf0[
i] +64) >> 7;
855 if ((Y1 | Y2 |
U |
V) & 0x100) {
865 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
866 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
867 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
868 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
869 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
870 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
872 if ((Y1 | Y2 |
U |
V) & 0x100) {
890 #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)
891 #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)
892 #define output_pixel(pos, val) \
893 if (isBE(target)) { \
901 const int32_t **lumSrc,
int lumFilterSize,
902 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
903 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
904 const int32_t **alpSrc, uint16_t *dest,
int dstW,
905 int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
907 int hasAlpha = !!alpSrc;
910 for (
i = 0;
i < dstW;
i++) {
915 for (j = 0; j < lumFilterSize; j++)
916 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
919 Y += (1<<3) + 0x8000;
923 A = -0x40000000 + (1<<14);
924 for (j = 0; j < lumFilterSize; j++)
925 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
940 const int32_t *abuf[2], uint16_t *dest,
int dstW,
941 int yalpha,
int unused_uvalpha,
int y,
942 enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
944 int hasAlpha = abuf && abuf[0] && abuf[1];
945 const int32_t *buf0 = buf[0], *buf1 = buf[1],
946 *abuf0 = hasAlpha ? abuf[0] :
NULL,
947 *abuf1 = hasAlpha ? abuf[1] :
NULL;
948 int yalpha1 = 4096 - yalpha;
953 for (
i = 0;
i < dstW;
i++) {
954 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
960 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
972 const int32_t *abuf0, uint16_t *dest,
int dstW,
973 int unused_uvalpha,
int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
975 int hasAlpha = !!abuf0;
978 for (
i = 0;
i < dstW;
i++) {
979 int Y = buf0[
i] >> 3;
997 const int32_t **lumSrc,
int lumFilterSize,
998 const int16_t *chrFilter,
const int32_t **chrUSrc,
999 const int32_t **chrVSrc,
int chrFilterSize,
1000 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1001 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1004 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1006 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1008 unsigned Y1 = -0x40000000;
1009 unsigned Y2 = -0x40000000;
1010 unsigned U = -(128 << 23);
1011 unsigned V = -(128 << 23);
1014 for (j = 0; j < lumFilterSize; j++) {
1015 Y1 += lumSrc[j][
i * 2] * (unsigned)lumFilter[j];
1016 Y2 += lumSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1018 for (j = 0; j < chrFilterSize; j++) {;
1019 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1020 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1026 for (j = 0; j < lumFilterSize; j++) {
1027 A1 += alpSrc[j][
i * 2] * (unsigned)lumFilter[j];
1028 A2 += alpSrc[j][
i * 2 + 1] * (unsigned)lumFilter[j];
1045 Y1 -=
c->yuv2rgb_y_offset;
1046 Y2 -=
c->yuv2rgb_y_offset;
1047 Y1 *=
c->yuv2rgb_y_coeff;
1048 Y2 *=
c->yuv2rgb_y_coeff;
1049 Y1 += (1 << 13) - (1 << 29);
1050 Y2 += (1 << 13) - (1 << 29);
1053 R =
V *
c->yuv2rgb_v2r_coeff;
1054 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1055 B =
U *
c->yuv2rgb_u2b_coeff;
1080 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1081 int yalpha,
int uvalpha,
int y,
1084 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1085 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1086 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1087 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1088 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1089 int yalpha1 = 4096 - yalpha;
1090 int uvalpha1 = 4096 - uvalpha;
1092 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1097 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1098 unsigned Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 14;
1099 unsigned Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 14;
1100 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1101 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1104 Y1 -=
c->yuv2rgb_y_offset;
1105 Y2 -=
c->yuv2rgb_y_offset;
1106 Y1 *=
c->yuv2rgb_y_coeff;
1107 Y2 *=
c->yuv2rgb_y_coeff;
1108 Y1 += (1 << 13) - (1 << 29);
1109 Y2 += (1 << 13) - (1 << 29);
1111 R =
V *
c->yuv2rgb_v2r_coeff;
1112 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1113 B =
U *
c->yuv2rgb_u2b_coeff;
1116 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 1;
1117 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 1;
1145 const int32_t *abuf0, uint16_t *dest,
int dstW,
1146 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1148 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1152 if (uvalpha < 2048) {
1153 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1154 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1155 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1156 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1157 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1160 Y1 -=
c->yuv2rgb_y_offset;
1161 Y2 -=
c->yuv2rgb_y_offset;
1162 Y1 *=
c->yuv2rgb_y_coeff;
1163 Y2 *=
c->yuv2rgb_y_coeff;
1164 Y1 += (1 << 13) - (1 << 29);
1165 Y2 += (1 << 13) - (1 << 29);
1168 A1 = abuf0[
i * 2 ] * (
SUINT)(1 << 11);
1169 A2 = abuf0[
i * 2 + 1] * (
SUINT)(1 << 11);
1175 R =
V *
c->yuv2rgb_v2r_coeff;
1176 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1177 B =
U *
c->yuv2rgb_u2b_coeff;
1197 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1198 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1199 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1200 SUINT Y1 = (buf0[
i * 2] ) >> 2;
1201 SUINT Y2 = (buf0[
i * 2 + 1]) >> 2;
1202 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1203 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1206 Y1 -=
c->yuv2rgb_y_offset;
1207 Y2 -=
c->yuv2rgb_y_offset;
1208 Y1 *=
c->yuv2rgb_y_coeff;
1209 Y2 *=
c->yuv2rgb_y_coeff;
1210 Y1 += (1 << 13) - (1 << 29);
1211 Y2 += (1 << 13) - (1 << 29);
1214 A1 = abuf0[
i * 2 ] * (1 << 11);
1215 A2 = abuf0[
i * 2 + 1] * (1 << 11);
1221 R =
V *
c->yuv2rgb_v2r_coeff;
1222 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1223 B =
U *
c->yuv2rgb_u2b_coeff;
1247 const int32_t **lumSrc,
int lumFilterSize,
1248 const int16_t *chrFilter,
const int32_t **chrUSrc,
1249 const int32_t **chrVSrc,
int chrFilterSize,
1250 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1251 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1256 for (
i = 0;
i < dstW;
i++) {
1258 int Y = -0x40000000;
1259 int U = -(128 << 23);
1260 int V = -(128 << 23);
1263 for (j = 0; j < lumFilterSize; j++) {
1264 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1266 for (j = 0; j < chrFilterSize; j++) {;
1267 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1268 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1273 for (j = 0; j < lumFilterSize; j++) {
1274 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1287 Y -=
c->yuv2rgb_y_offset;
1288 Y *=
c->yuv2rgb_y_coeff;
1289 Y += (1 << 13) - (1<<29);
1292 R =
V *
c->yuv2rgb_v2r_coeff;
1293 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1294 B =
U *
c->yuv2rgb_u2b_coeff;
1312 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1313 int yalpha,
int uvalpha,
int y,
1316 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1317 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1318 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1319 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1320 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1321 int yalpha1 = 4096 - yalpha;
1322 int uvalpha1 = 4096 - uvalpha;
1329 for (
i = 0;
i < dstW;
i++) {
1330 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1331 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1332 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1335 Y -=
c->yuv2rgb_y_offset;
1336 Y *=
c->yuv2rgb_y_coeff;
1337 Y += (1 << 13) - (1 << 29);
1339 R =
V *
c->yuv2rgb_v2r_coeff;
1340 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1341 B =
U *
c->yuv2rgb_u2b_coeff;
1344 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1364 const int32_t *abuf0, uint16_t *dest,
int dstW,
1365 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1367 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1371 if (uvalpha < 2048) {
1372 for (
i = 0;
i < dstW;
i++) {
1374 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1375 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1378 Y -=
c->yuv2rgb_y_offset;
1379 Y *=
c->yuv2rgb_y_coeff;
1380 Y += (1 << 13) - (1 << 29);
1383 A = abuf0[
i] * (1 << 11);
1388 R =
V *
c->yuv2rgb_v2r_coeff;
1389 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1390 B =
U *
c->yuv2rgb_u2b_coeff;
1403 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1405 for (
i = 0;
i < dstW;
i++) {
1407 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1408 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1411 Y -=
c->yuv2rgb_y_offset;
1412 Y *=
c->yuv2rgb_y_coeff;
1413 Y += (1 << 13) - (1 << 29);
1416 A = abuf0[
i] * (1 << 11);
1421 R =
V *
c->yuv2rgb_v2r_coeff;
1422 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
1423 B =
U *
c->yuv2rgb_u2b_coeff;
1442 #define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \
1443 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1444 const int16_t **_lumSrc, int lumFilterSize, \
1445 const int16_t *chrFilter, const int16_t **_chrUSrc, \
1446 const int16_t **_chrVSrc, int chrFilterSize, \
1447 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1450 const int32_t **lumSrc = (const int32_t **) _lumSrc, \
1451 **chrUSrc = (const int32_t **) _chrUSrc, \
1452 **chrVSrc = (const int32_t **) _chrVSrc, \
1453 **alpSrc = (const int32_t **) _alpSrc; \
1454 uint16_t *dest = (uint16_t *) _dest; \
1455 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1456 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1457 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \
1460 static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
1461 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1462 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1463 int yalpha, int uvalpha, int y) \
1465 const int32_t **buf = (const int32_t **) _buf, \
1466 **ubuf = (const int32_t **) _ubuf, \
1467 **vbuf = (const int32_t **) _vbuf, \
1468 **abuf = (const int32_t **) _abuf; \
1469 uint16_t *dest = (uint16_t *) _dest; \
1470 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1471 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \
1474 static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
1475 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1476 const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1477 int uvalpha, int y) \
1479 const int32_t *buf0 = (const int32_t *) _buf0, \
1480 **ubuf = (const int32_t **) _ubuf, \
1481 **vbuf = (const int32_t **) _vbuf, \
1482 *abuf0 = (const int32_t *) _abuf0; \
1483 uint16_t *dest = (uint16_t *) _dest; \
1484 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1485 dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \
1526 unsigned A1,
unsigned A2,
1527 const
void *_r, const
void *_g, const
void *_b,
int y,
1532 uint32_t *dest = (uint32_t *) _dest;
1533 const uint32_t *
r = (
const uint32_t *) _r;
1534 const uint32_t *
g = (
const uint32_t *) _g;
1535 const uint32_t *
b = (
const uint32_t *) _b;
1540 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (hasAlpha ?
A1 << sh : 0);
1541 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (hasAlpha ?
A2 << sh : 0);
1547 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1] + (
A1 << sh);
1548 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2] + (
A2 << sh);
1550 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1553 av_assert2((((
r[Y1] +
g[Y1] +
b[Y1]) >> sh) & 0xFF) == 0xFF);
1555 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1556 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1565 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1566 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1568 dest[
i * 6 + 0] =
r_b[Y1];
1569 dest[
i * 6 + 1] =
g[Y1];
1570 dest[
i * 6 + 2] =
b_r[Y1];
1571 dest[
i * 6 + 3] =
r_b[Y2];
1572 dest[
i * 6 + 4] =
g[Y2];
1573 dest[
i * 6 + 5] =
b_r[Y2];
1579 uint16_t *dest = (uint16_t *) _dest;
1580 const uint16_t *
r = (
const uint16_t *) _r;
1581 const uint16_t *
g = (
const uint16_t *) _g;
1582 const uint16_t *
b = (
const uint16_t *) _b;
1583 int dr1, dg1, db1, dr2, dg2, db2;
1608 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1609 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1611 uint32_t *dest = (uint32_t *) _dest;
1612 const uint32_t *
r = (
const uint32_t *) _r;
1613 const uint32_t *
g = (
const uint32_t *) _g;
1614 const uint32_t *
b = (
const uint32_t *) _b;
1615 dest[
i * 2 + 0] =
r[Y1] +
g[Y1] +
b[Y1];
1616 dest[
i * 2 + 1] =
r[Y2] +
g[Y2] +
b[Y2];
1622 int dr1, dg1, db1, dr2, dg2, db2;
1627 dr1 = dg1 =
d32[(
i * 2 + 0) & 7];
1628 db1 =
d64[(
i * 2 + 0) & 7];
1629 dr2 = dg2 =
d32[(
i * 2 + 1) & 7];
1630 db2 =
d64[(
i * 2 + 1) & 7];
1634 dr1 = db1 =
d128[(
i * 2 + 0) & 7];
1635 dg1 =
d64[(
i * 2 + 0) & 7];
1636 dr2 = db2 =
d128[(
i * 2 + 1) & 7];
1637 dg2 =
d64[(
i * 2 + 1) & 7];
1641 dest[
i] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1] +
1642 ((
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2]) << 4);
1644 dest[
i * 2 + 0] =
r[Y1 + dr1] +
g[Y1 + dg1] +
b[Y1 + db1];
1645 dest[
i * 2 + 1] =
r[Y2 + dr2] +
g[Y2 + dg2] +
b[Y2 + db2];
1652 const int16_t **lumSrc,
int lumFilterSize,
1653 const int16_t *chrFilter,
const int16_t **chrUSrc,
1654 const int16_t **chrVSrc,
int chrFilterSize,
1655 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
1660 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1666 const void *
r, *
g, *
b;
1668 for (j = 0; j < lumFilterSize; j++) {
1669 Y1 += lumSrc[j][
i * 2] * lumFilter[j];
1670 Y2 += lumSrc[j][
i * 2 + 1] * lumFilter[j];
1672 for (j = 0; j < chrFilterSize; j++) {
1673 U += chrUSrc[j][
i] * chrFilter[j];
1674 V += chrVSrc[j][
i] * chrFilter[j];
1683 for (j = 0; j < lumFilterSize; j++) {
1684 A1 += alpSrc[j][
i * 2 ] * lumFilter[j];
1685 A2 += alpSrc[j][
i * 2 + 1] * lumFilter[j];
1689 if ((
A1 |
A2) & 0x100) {
1700 r,
g,
b, y, target, hasAlpha);
1706 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1707 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
1708 int yalpha,
int uvalpha,
int y,
1711 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1712 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1713 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1714 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1715 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1716 int yalpha1 = 4096 - yalpha;
1717 int uvalpha1 = 4096 - uvalpha;
1722 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1723 int Y1 = (buf0[
i * 2] * yalpha1 + buf1[
i * 2] * yalpha) >> 19;
1724 int Y2 = (buf0[
i * 2 + 1] * yalpha1 + buf1[
i * 2 + 1] * yalpha) >> 19;
1725 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1726 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1733 A1 = (abuf0[
i * 2 ] * yalpha1 + abuf1[
i * 2 ] * yalpha) >> 19;
1734 A2 = (abuf0[
i * 2 + 1] * yalpha1 + abuf1[
i * 2 + 1] * yalpha) >> 19;
1740 r,
g,
b, y, target, hasAlpha);
1746 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1747 const int16_t *abuf0,
uint8_t *dest,
int dstW,
1751 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1754 if (uvalpha < 2048) {
1755 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1756 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1757 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1758 int U = (ubuf0[
i] + 64) >> 7;
1759 int V = (vbuf0[
i] + 64) >> 7;
1766 A1 = abuf0[
i * 2 ] * 255 + 16384 >> 15;
1767 A2 = abuf0[
i * 2 + 1] * 255 + 16384 >> 15;
1773 r,
g,
b, y, target, hasAlpha);
1776 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1777 for (
i = 0;
i < ((dstW + 1) >> 1);
i++) {
1778 int Y1 = (buf0[
i * 2 ] + 64) >> 7;
1779 int Y2 = (buf0[
i * 2 + 1] + 64) >> 7;
1780 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1781 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1788 A1 = (abuf0[
i * 2 ] + 64) >> 7;
1789 A2 = (abuf0[
i * 2 + 1] + 64) >> 7;
1795 r,
g,
b, y, target, hasAlpha);
1800 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1801 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
1802 const int16_t **lumSrc, int lumFilterSize, \
1803 const int16_t *chrFilter, const int16_t **chrUSrc, \
1804 const int16_t **chrVSrc, int chrFilterSize, \
1805 const int16_t **alpSrc, uint8_t *dest, int dstW, \
1808 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1809 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1810 alpSrc, dest, dstW, y, fmt, hasAlpha); \
1813 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1814 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1815 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
1816 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1817 const int16_t *abuf[2], uint8_t *dest, int dstW, \
1818 int yalpha, int uvalpha, int y) \
1820 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1821 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1824 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1825 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1826 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
1827 const int16_t *ubuf[2], const int16_t *vbuf[2], \
1828 const int16_t *abuf0, uint8_t *dest, int dstW, \
1829 int uvalpha, int y) \
1831 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1832 dstW, uvalpha, y, fmt, hasAlpha); \
1839 #if CONFIG_SWSCALE_ALPHA
1863 Y -=
c->yuv2rgb_y_offset;
1864 Y *=
c->yuv2rgb_y_coeff;
1866 R = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2r_coeff;
1867 G = (unsigned)
Y +
V*(
unsigned)
c->yuv2rgb_v2g_coeff +
U*(unsigned)
c->yuv2rgb_u2g_coeff;
1868 B = (
unsigned)
Y +
U*(unsigned)
c->yuv2rgb_u2b_coeff;
1869 if ((
R |
G |
B) & 0xC0000000) {
1877 dest[0] = hasAlpha ?
A : 255;
1891 dest[3] = hasAlpha ?
A : 255;
1894 dest[0] = hasAlpha ?
A : 255;
1908 dest[3] = hasAlpha ?
A : 255;
1917 switch (
c->dither) {
1924 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;
1925 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;
1926 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;
1927 c->dither_error[0][
i] = err[0];
1928 c->dither_error[1][
i] = err[1];
1929 c->dither_error[2][
i] = err[2];
1930 r =
R >> (isrgb8 ? 5 : 7);
1931 g =
G >> (isrgb8 ? 5 : 6);
1932 b =
B >> (isrgb8 ? 6 : 7);
1936 err[0] =
R -
r*(isrgb8 ? 36 : 255);
1937 err[1] =
G -
g*(isrgb8 ? 36 : 85);
1938 err[2] =
B -
b*(isrgb8 ? 85 : 255);
1943 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff))
1962 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2)
1982 dest[0] =
r + 2*
g + 8*
b;
1984 dest[0] =
b + 2*
g + 8*
r;
1986 dest[0] =
r + 8*
g + 64*
b;
1988 dest[0] =
b + 4*
g + 32*
r;
1997 const int16_t **lumSrc,
int lumFilterSize,
1998 const int16_t *chrFilter,
const int16_t **chrUSrc,
1999 const int16_t **chrVSrc,
int chrFilterSize,
2000 const int16_t **alpSrc,
uint8_t *dest,
2012 for (
i = 0;
i < dstW;
i++) {
2015 int U = (1<<9)-(128 << 19);
2016 int V = (1<<9)-(128 << 19);
2018 for (j = 0; j < lumFilterSize; j++) {
2019 Y += lumSrc[j][
i] * lumFilter[j];
2021 for (j = 0; j < chrFilterSize; j++) {
2022 U += chrUSrc[j][
i] * chrFilter[j];
2023 V += chrVSrc[j][
i] * chrFilter[j];
2030 for (j = 0; j < lumFilterSize; j++) {
2031 A += alpSrc[j][
i] * lumFilter[j];
2037 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2040 c->dither_error[0][
i] = err[0];
2041 c->dither_error[1][
i] = err[1];
2042 c->dither_error[2][
i] = err[2];
2047 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2048 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2049 int yalpha,
int uvalpha,
int y,
2052 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2053 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2054 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2055 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2056 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2057 int yalpha1 = 4096 - yalpha;
2058 int uvalpha1 = 4096 - uvalpha;
2071 for (
i = 0;
i < dstW;
i++) {
2072 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2073 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2074 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2077 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2082 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2085 c->dither_error[0][
i] = err[0];
2086 c->dither_error[1][
i] = err[1];
2087 c->dither_error[2][
i] = err[2];
2092 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2093 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2097 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2106 if (uvalpha < 2048) {
2108 for (
i = 0;
i < dstW;
i++) {
2109 int Y = buf0[
i] * 4;
2110 int U = (ubuf0[
i] - (128<<7)) * 4;
2111 int V = (vbuf0[
i] - (128<<7)) * 4;
2114 A = (abuf0[
i] + 64) >> 7;
2119 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2123 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2125 for (
i = 0;
i < dstW;
i++) {
2126 int Y = buf0[
i] * 4;
2127 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2128 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2131 A = (abuf0[
i] + 64) >> 7;
2136 yuv2rgb_write_full(
c, dest,
i,
Y,
A,
U,
V, y, target, hasAlpha, err);
2141 c->dither_error[0][
i] = err[0];
2142 c->dither_error[1][
i] = err[1];
2143 c->dither_error[2][
i] = err[2];
2152 #if CONFIG_SWSCALE_ALPHA
2173 const int16_t **lumSrc,
int lumFilterSize,
2174 const int16_t *chrFilter, const int16_t **chrUSrc,
2175 const int16_t **chrVSrc,
int chrFilterSize,
2176 const int16_t **alpSrc,
uint8_t **dest,
2182 uint16_t **dest16 = (uint16_t**)dest;
2183 int SH = 22 + 8 -
desc->comp[0].depth;
2186 for (
i = 0;
i < dstW;
i++) {
2189 int U = (1 << 9) - (128 << 19);
2190 int V = (1 << 9) - (128 << 19);
2193 for (j = 0; j < lumFilterSize; j++)
2194 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2196 for (j = 0; j < chrFilterSize; j++) {
2197 U += chrUSrc[j][
i] * chrFilter[j];
2198 V += chrVSrc[j][
i] * chrFilter[j];
2208 for (j = 0; j < lumFilterSize; j++)
2209 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2215 Y -=
c->yuv2rgb_y_offset;
2216 Y *=
c->yuv2rgb_y_coeff;
2218 R =
Y +
V * (unsigned)
c->yuv2rgb_v2r_coeff;
2219 G =
Y +
V * (
unsigned)
c->yuv2rgb_v2g_coeff +
U * (unsigned)
c->yuv2rgb_u2g_coeff;
2220 B =
Y +
U * (
unsigned)
c->yuv2rgb_u2b_coeff;
2222 if ((
R |
G |
B) & 0xC0000000) {
2229 dest16[0][
i] =
G >>
SH;
2230 dest16[1][
i] =
B >>
SH;
2231 dest16[2][
i] =
R >>
SH;
2233 dest16[3][
i] =
A >> (
SH - 3);
2235 dest[0][
i] =
G >> 22;
2236 dest[1][
i] =
B >> 22;
2237 dest[2][
i] =
R >> 22;
2239 dest[3][
i] =
A >> 19;
2243 for (
i = 0;
i < dstW;
i++) {
2255 const int16_t **lumSrcx,
int lumFilterSize,
2256 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2257 const int16_t **chrVSrcx,
int chrFilterSize,
2258 const int16_t **alpSrcx,
uint8_t **dest,
2264 uint16_t **dest16 = (uint16_t**)dest;
2270 for (
i = 0;
i < dstW;
i++) {
2272 int Y = -0x40000000;
2273 int U = -(128 << 23);
2274 int V = -(128 << 23);
2277 for (j = 0; j < lumFilterSize; j++)
2278 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2280 for (j = 0; j < chrFilterSize; j++) {
2281 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2282 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2293 for (j = 0; j < lumFilterSize; j++)
2294 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2300 Y -=
c->yuv2rgb_y_offset;
2301 Y *=
c->yuv2rgb_y_coeff;
2303 R =
V *
c->yuv2rgb_v2r_coeff;
2304 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2305 B =
U *
c->yuv2rgb_u2b_coeff;
2311 dest16[0][
i] =
G >> 14;
2312 dest16[1][
i] =
B >> 14;
2313 dest16[2][
i] =
R >> 14;
2318 for (
i = 0;
i < dstW;
i++) {
2330 const int16_t **lumSrcx,
int lumFilterSize,
2331 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2332 const int16_t **chrVSrcx,
int chrFilterSize,
2333 const int16_t **alpSrcx,
uint8_t **dest,
2339 uint32_t **dest32 = (uint32_t**)dest;
2344 static const float float_mult = 1.0f / 65535.0f;
2346 for (
i = 0;
i < dstW;
i++) {
2348 int Y = -0x40000000;
2349 int U = -(128 << 23);
2350 int V = -(128 << 23);
2353 for (j = 0; j < lumFilterSize; j++)
2354 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2356 for (j = 0; j < chrFilterSize; j++) {
2357 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2358 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2369 for (j = 0; j < lumFilterSize; j++)
2370 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2376 Y -=
c->yuv2rgb_y_offset;
2377 Y *=
c->yuv2rgb_y_coeff;
2379 R =
V *
c->yuv2rgb_v2r_coeff;
2380 G =
V *
c->yuv2rgb_v2g_coeff +
U *
c->yuv2rgb_u2g_coeff;
2381 B =
U *
c->yuv2rgb_u2b_coeff;
2394 for (
i = 0;
i < dstW;
i++) {
2406 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2407 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2410 int hasAlpha = !!abuf0;
2413 for (
i = 0;
i < dstW;
i++) {
2414 int Y = (buf0[
i] + 64) >> 7;
2420 A = (abuf0[
i] + 64) >> 7;
2426 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2432 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2433 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2434 int yalpha,
int uvalpha,
int y)
2436 int hasAlpha = abuf && abuf[0] && abuf[1];
2437 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2438 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2439 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2440 int yalpha1 = 4096 - yalpha;
2445 for (
i = 0;
i < dstW;
i++) {
2446 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2452 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2457 dest[
i * 2 + 1] = hasAlpha ?
A : 255;
2463 const int16_t **lumSrc,
int lumFilterSize,
2464 const int16_t *chrFilter,
const int16_t **chrUSrc,
2465 const int16_t **chrVSrc,
int chrFilterSize,
2466 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
int y)
2468 int hasAlpha = !!alpSrc;
2471 for (
i = 0;
i < dstW;
i++) {
2473 int Y = 1 << 18,
A = 1 << 18;
2475 for (j = 0; j < lumFilterSize; j++)
2476 Y += lumSrc[j][
i] * lumFilter[j];
2483 for (j = 0; j < lumFilterSize; j++)
2484 A += alpSrc[j][
i] * lumFilter[j];
2493 dest[2 *
i + 1] = hasAlpha ?
A : 255;
2499 const int16_t **_lumSrc,
int lumFilterSize,
2500 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2501 const int16_t **_chrVSrc,
int chrFilterSize,
2502 const int16_t **_alpSrc,
uint8_t *dest,
int dstW,
int y)
2505 **chrUSrc = (
const int32_t **) _chrUSrc,
2506 **chrVSrc = (
const int32_t **) _chrVSrc,
2507 **alpSrc = (
const int32_t **) _alpSrc;
2508 int hasAlpha = !!alpSrc;
2511 for (
i = 0;
i < dstW;
i++) {
2512 int Y = 1 << 14,
U = 1 << 14;
2513 int V = 1 << 14,
A = 1 << 14;
2521 for (j = 0; j < lumFilterSize; j++)
2522 Y += lumSrc[j][
i] * (
unsigned)lumFilter[j];
2524 for (j = 0; j < chrFilterSize; j++)
2525 U += chrUSrc[j][
i] * (
unsigned)chrFilter[j];
2527 for (j = 0; j < chrFilterSize; j++)
2528 V += chrVSrc[j][
i] * (
unsigned)chrFilter[j];
2531 for (j = 0; j < lumFilterSize; j++)
2532 A += alpSrc[j][
i] * (
unsigned)lumFilter[j];
2539 AV_WL16(dest + 8 *
i, hasAlpha ?
A : 65535);
2562 }
else if (
is16BPS(dstFormat)) {
2563 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
2564 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
2568 }
else if (
isNBPS(dstFormat)) {
2569 if (
desc->comp[0].depth == 9) {
2570 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
2571 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
2572 }
else if (
desc->comp[0].depth == 10) {
2573 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
2574 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
2575 }
else if (
desc->comp[0].depth == 12) {
2576 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
2577 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
2578 }
else if (
desc->comp[0].depth == 14) {
2579 *
yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
2580 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
2585 *yuv2plane1 = yuv2plane1_floatBE_c;
2588 *yuv2plane1 = yuv2plane1_floatLE_c;
2598 switch (dstFormat) {
2601 *yuv2packedX = yuv2rgba32_full_X_c;
2602 *yuv2packed2 = yuv2rgba32_full_2_c;
2603 *yuv2packed1 = yuv2rgba32_full_1_c;
2605 #if CONFIG_SWSCALE_ALPHA
2607 *yuv2packedX = yuv2rgba32_full_X_c;
2608 *yuv2packed2 = yuv2rgba32_full_2_c;
2609 *yuv2packed1 = yuv2rgba32_full_1_c;
2613 *yuv2packedX = yuv2rgbx32_full_X_c;
2614 *yuv2packed2 = yuv2rgbx32_full_2_c;
2615 *yuv2packed1 = yuv2rgbx32_full_1_c;
2621 *yuv2packedX = yuv2argb32_full_X_c;
2622 *yuv2packed2 = yuv2argb32_full_2_c;
2623 *yuv2packed1 = yuv2argb32_full_1_c;
2625 #if CONFIG_SWSCALE_ALPHA
2627 *yuv2packedX = yuv2argb32_full_X_c;
2628 *yuv2packed2 = yuv2argb32_full_2_c;
2629 *yuv2packed1 = yuv2argb32_full_1_c;
2633 *yuv2packedX = yuv2xrgb32_full_X_c;
2634 *yuv2packed2 = yuv2xrgb32_full_2_c;
2635 *yuv2packed1 = yuv2xrgb32_full_1_c;
2641 *yuv2packedX = yuv2bgra32_full_X_c;
2642 *yuv2packed2 = yuv2bgra32_full_2_c;
2643 *yuv2packed1 = yuv2bgra32_full_1_c;
2645 #if CONFIG_SWSCALE_ALPHA
2647 *yuv2packedX = yuv2bgra32_full_X_c;
2648 *yuv2packed2 = yuv2bgra32_full_2_c;
2649 *yuv2packed1 = yuv2bgra32_full_1_c;
2653 *yuv2packedX = yuv2bgrx32_full_X_c;
2654 *yuv2packed2 = yuv2bgrx32_full_2_c;
2655 *yuv2packed1 = yuv2bgrx32_full_1_c;
2661 *yuv2packedX = yuv2abgr32_full_X_c;
2662 *yuv2packed2 = yuv2abgr32_full_2_c;
2663 *yuv2packed1 = yuv2abgr32_full_1_c;
2665 #if CONFIG_SWSCALE_ALPHA
2667 *yuv2packedX = yuv2abgr32_full_X_c;
2668 *yuv2packed2 = yuv2abgr32_full_2_c;
2669 *yuv2packed1 = yuv2abgr32_full_1_c;
2673 *yuv2packedX = yuv2xbgr32_full_X_c;
2674 *yuv2packed2 = yuv2xbgr32_full_2_c;
2675 *yuv2packed1 = yuv2xbgr32_full_1_c;
2680 #if CONFIG_SWSCALE_ALPHA
2682 *yuv2packedX = yuv2rgba64le_full_X_c;
2683 *yuv2packed2 = yuv2rgba64le_full_2_c;
2684 *yuv2packed1 = yuv2rgba64le_full_1_c;
2688 *yuv2packedX = yuv2rgbx64le_full_X_c;
2689 *yuv2packed2 = yuv2rgbx64le_full_2_c;
2690 *yuv2packed1 = yuv2rgbx64le_full_1_c;
2694 #if CONFIG_SWSCALE_ALPHA
2696 *yuv2packedX = yuv2rgba64be_full_X_c;
2697 *yuv2packed2 = yuv2rgba64be_full_2_c;
2698 *yuv2packed1 = yuv2rgba64be_full_1_c;
2702 *yuv2packedX = yuv2rgbx64be_full_X_c;
2703 *yuv2packed2 = yuv2rgbx64be_full_2_c;
2704 *yuv2packed1 = yuv2rgbx64be_full_1_c;
2708 #if CONFIG_SWSCALE_ALPHA
2710 *yuv2packedX = yuv2bgra64le_full_X_c;
2711 *yuv2packed2 = yuv2bgra64le_full_2_c;
2712 *yuv2packed1 = yuv2bgra64le_full_1_c;
2716 *yuv2packedX = yuv2bgrx64le_full_X_c;
2717 *yuv2packed2 = yuv2bgrx64le_full_2_c;
2718 *yuv2packed1 = yuv2bgrx64le_full_1_c;
2722 #if CONFIG_SWSCALE_ALPHA
2724 *yuv2packedX = yuv2bgra64be_full_X_c;
2725 *yuv2packed2 = yuv2bgra64be_full_2_c;
2726 *yuv2packed1 = yuv2bgra64be_full_1_c;
2730 *yuv2packedX = yuv2bgrx64be_full_X_c;
2731 *yuv2packed2 = yuv2bgrx64be_full_2_c;
2732 *yuv2packed1 = yuv2bgrx64be_full_1_c;
2737 *yuv2packedX = yuv2rgb24_full_X_c;
2738 *yuv2packed2 = yuv2rgb24_full_2_c;
2739 *yuv2packed1 = yuv2rgb24_full_1_c;
2742 *yuv2packedX = yuv2bgr24_full_X_c;
2743 *yuv2packed2 = yuv2bgr24_full_2_c;
2744 *yuv2packed1 = yuv2bgr24_full_1_c;
2747 *yuv2packedX = yuv2rgb48le_full_X_c;
2748 *yuv2packed2 = yuv2rgb48le_full_2_c;
2749 *yuv2packed1 = yuv2rgb48le_full_1_c;
2752 *yuv2packedX = yuv2bgr48le_full_X_c;
2753 *yuv2packed2 = yuv2bgr48le_full_2_c;
2754 *yuv2packed1 = yuv2bgr48le_full_1_c;
2757 *yuv2packedX = yuv2rgb48be_full_X_c;
2758 *yuv2packed2 = yuv2rgb48be_full_2_c;
2759 *yuv2packed1 = yuv2rgb48be_full_1_c;
2762 *yuv2packedX = yuv2bgr48be_full_X_c;
2763 *yuv2packed2 = yuv2bgr48be_full_2_c;
2764 *yuv2packed1 = yuv2bgr48be_full_1_c;
2767 *yuv2packedX = yuv2bgr4_byte_full_X_c;
2768 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
2769 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
2772 *yuv2packedX = yuv2rgb4_byte_full_X_c;
2773 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
2774 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
2777 *yuv2packedX = yuv2bgr8_full_X_c;
2778 *yuv2packed2 = yuv2bgr8_full_2_c;
2779 *yuv2packed1 = yuv2bgr8_full_1_c;
2782 *yuv2packedX = yuv2rgb8_full_X_c;
2783 *yuv2packed2 = yuv2rgb8_full_2_c;
2784 *yuv2packed1 = yuv2rgb8_full_1_c;
2815 if (!*yuv2packedX && !*yuv2anyX)
2819 switch (dstFormat) {
2821 #if CONFIG_SWSCALE_ALPHA
2823 *yuv2packed1 = yuv2rgba64le_1_c;
2824 *yuv2packed2 = yuv2rgba64le_2_c;
2825 *yuv2packedX = yuv2rgba64le_X_c;
2829 *yuv2packed1 = yuv2rgbx64le_1_c;
2830 *yuv2packed2 = yuv2rgbx64le_2_c;
2831 *yuv2packedX = yuv2rgbx64le_X_c;
2835 #if CONFIG_SWSCALE_ALPHA
2837 *yuv2packed1 = yuv2rgba64be_1_c;
2838 *yuv2packed2 = yuv2rgba64be_2_c;
2839 *yuv2packedX = yuv2rgba64be_X_c;
2843 *yuv2packed1 = yuv2rgbx64be_1_c;
2844 *yuv2packed2 = yuv2rgbx64be_2_c;
2845 *yuv2packedX = yuv2rgbx64be_X_c;
2849 #if CONFIG_SWSCALE_ALPHA
2851 *yuv2packed1 = yuv2bgra64le_1_c;
2852 *yuv2packed2 = yuv2bgra64le_2_c;
2853 *yuv2packedX = yuv2bgra64le_X_c;
2857 *yuv2packed1 = yuv2bgrx64le_1_c;
2858 *yuv2packed2 = yuv2bgrx64le_2_c;
2859 *yuv2packedX = yuv2bgrx64le_X_c;
2863 #if CONFIG_SWSCALE_ALPHA
2865 *yuv2packed1 = yuv2bgra64be_1_c;
2866 *yuv2packed2 = yuv2bgra64be_2_c;
2867 *yuv2packedX = yuv2bgra64be_X_c;
2871 *yuv2packed1 = yuv2bgrx64be_1_c;
2872 *yuv2packed2 = yuv2bgrx64be_2_c;
2873 *yuv2packedX = yuv2bgrx64be_X_c;
2877 *yuv2packed1 = yuv2rgb48le_1_c;
2878 *yuv2packed2 = yuv2rgb48le_2_c;
2879 *yuv2packedX = yuv2rgb48le_X_c;
2882 *yuv2packed1 = yuv2rgb48be_1_c;
2883 *yuv2packed2 = yuv2rgb48be_2_c;
2884 *yuv2packedX = yuv2rgb48be_X_c;
2887 *yuv2packed1 = yuv2bgr48le_1_c;
2888 *yuv2packed2 = yuv2bgr48le_2_c;
2889 *yuv2packedX = yuv2bgr48le_X_c;
2892 *yuv2packed1 = yuv2bgr48be_1_c;
2893 *yuv2packed2 = yuv2bgr48be_2_c;
2894 *yuv2packedX = yuv2bgr48be_X_c;
2899 *yuv2packed1 = yuv2rgb32_1_c;
2900 *yuv2packed2 = yuv2rgb32_2_c;
2901 *yuv2packedX = yuv2rgb32_X_c;
2903 #if CONFIG_SWSCALE_ALPHA
2905 *yuv2packed1 = yuv2rgba32_1_c;
2906 *yuv2packed2 = yuv2rgba32_2_c;
2907 *yuv2packedX = yuv2rgba32_X_c;
2911 *yuv2packed1 = yuv2rgbx32_1_c;
2912 *yuv2packed2 = yuv2rgbx32_2_c;
2913 *yuv2packedX = yuv2rgbx32_X_c;
2920 *yuv2packed1 = yuv2rgb32_1_1_c;
2921 *yuv2packed2 = yuv2rgb32_1_2_c;
2922 *yuv2packedX = yuv2rgb32_1_X_c;
2924 #if CONFIG_SWSCALE_ALPHA
2926 *yuv2packed1 = yuv2rgba32_1_1_c;
2927 *yuv2packed2 = yuv2rgba32_1_2_c;
2928 *yuv2packedX = yuv2rgba32_1_X_c;
2932 *yuv2packed1 = yuv2rgbx32_1_1_c;
2933 *yuv2packed2 = yuv2rgbx32_1_2_c;
2934 *yuv2packedX = yuv2rgbx32_1_X_c;
2939 *yuv2packed1 = yuv2rgb24_1_c;
2940 *yuv2packed2 = yuv2rgb24_2_c;
2941 *yuv2packedX = yuv2rgb24_X_c;
2944 *yuv2packed1 = yuv2bgr24_1_c;
2945 *yuv2packed2 = yuv2bgr24_2_c;
2946 *yuv2packedX = yuv2bgr24_X_c;
2952 *yuv2packed1 = yuv2rgb16_1_c;
2953 *yuv2packed2 = yuv2rgb16_2_c;
2954 *yuv2packedX = yuv2rgb16_X_c;
2960 *yuv2packed1 = yuv2rgb15_1_c;
2961 *yuv2packed2 = yuv2rgb15_2_c;
2962 *yuv2packedX = yuv2rgb15_X_c;
2968 *yuv2packed1 = yuv2rgb12_1_c;
2969 *yuv2packed2 = yuv2rgb12_2_c;
2970 *yuv2packedX = yuv2rgb12_X_c;
2974 *yuv2packed1 = yuv2rgb8_1_c;
2975 *yuv2packed2 = yuv2rgb8_2_c;
2976 *yuv2packedX = yuv2rgb8_X_c;
2980 *yuv2packed1 = yuv2rgb4_1_c;
2981 *yuv2packed2 = yuv2rgb4_2_c;
2982 *yuv2packedX = yuv2rgb4_X_c;
2986 *yuv2packed1 = yuv2rgb4b_1_c;
2987 *yuv2packed2 = yuv2rgb4b_2_c;
2988 *yuv2packedX = yuv2rgb4b_X_c;
2992 *yuv2packed1 = yuv2x2rgb10_1_c;
2993 *yuv2packed2 = yuv2x2rgb10_2_c;
2994 *yuv2packedX = yuv2x2rgb10_X_c;
2998 switch (dstFormat) {
3000 *yuv2packed1 = yuv2monowhite_1_c;
3001 *yuv2packed2 = yuv2monowhite_2_c;
3002 *yuv2packedX = yuv2monowhite_X_c;
3005 *yuv2packed1 = yuv2monoblack_1_c;
3006 *yuv2packed2 = yuv2monoblack_2_c;
3007 *yuv2packedX = yuv2monoblack_X_c;
3010 *yuv2packed1 = yuv2yuyv422_1_c;
3011 *yuv2packed2 = yuv2yuyv422_2_c;
3012 *yuv2packedX = yuv2yuyv422_X_c;
3015 *yuv2packed1 = yuv2yvyu422_1_c;
3016 *yuv2packed2 = yuv2yvyu422_2_c;
3017 *yuv2packedX = yuv2yvyu422_X_c;
3020 *yuv2packed1 = yuv2uyvy422_1_c;
3021 *yuv2packed2 = yuv2uyvy422_2_c;
3022 *yuv2packedX = yuv2uyvy422_X_c;
3030 *yuv2packed1 = yuv2ya16le_1_c;
3031 *yuv2packed2 = yuv2ya16le_2_c;
3032 *yuv2packedX = yuv2ya16le_X_c;
3035 *yuv2packed1 = yuv2ya16be_1_c;
3036 *yuv2packed2 = yuv2ya16be_2_c;
3037 *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]