40 { 1, 3, 1, 3, 1, 3, 1, 3, },
41 { 2, 0, 2, 0, 2, 0, 2, 0, },
42 { 1, 3, 1, 3, 1, 3, 1, 3, },
46 { 6, 2, 6, 2, 6, 2, 6, 2, },
47 { 0, 4, 0, 4, 0, 4, 0, 4, },
48 { 6, 2, 6, 2, 6, 2, 6, 2, },
52 { 8, 4, 11, 7, 8, 4, 11, 7, },
53 { 2, 14, 1, 13, 2, 14, 1, 13, },
54 { 10, 6, 9, 5, 10, 6, 9, 5, },
55 { 0, 12, 3, 15, 0, 12, 3, 15, },
56 { 8, 4, 11, 7, 8, 4, 11, 7, },
60 { 17, 9, 23, 15, 16, 8, 22, 14, },
61 { 5, 29, 3, 27, 4, 28, 2, 26, },
62 { 21, 13, 19, 11, 20, 12, 18, 10, },
63 { 0, 24, 6, 30, 1, 25, 7, 31, },
64 { 16, 8, 22, 14, 17, 9, 23, 15, },
65 { 4, 28, 2, 26, 5, 29, 3, 27, },
66 { 20, 12, 18, 10, 21, 13, 19, 11, },
67 { 1, 25, 7, 31, 0, 24, 6, 30, },
68 { 17, 9, 23, 15, 16, 8, 22, 14, },
72 { 0, 55, 14, 68, 3, 58, 17, 72, },
73 { 37, 18, 50, 32, 40, 22, 54, 35, },
74 { 9, 64, 5, 59, 13, 67, 8, 63, },
75 { 46, 27, 41, 23, 49, 31, 44, 26, },
76 { 2, 57, 16, 71, 1, 56, 15, 70, },
77 { 39, 21, 52, 34, 38, 19, 51, 33, },
78 { 11, 66, 7, 62, 10, 65, 6, 60, },
79 { 48, 30, 43, 25, 47, 29, 42, 24, },
80 { 0, 55, 14, 68, 3, 58, 17, 72, },
85 {117, 62, 158, 103, 113, 58, 155, 100, },
86 { 34, 199, 21, 186, 31, 196, 17, 182, },
87 {144, 89, 131, 76, 141, 86, 127, 72, },
88 { 0, 165, 41, 206, 10, 175, 52, 217, },
89 {110, 55, 151, 96, 120, 65, 162, 107, },
90 { 28, 193, 14, 179, 38, 203, 24, 189, },
91 {138, 83, 124, 69, 148, 93, 134, 79, },
92 { 7, 172, 48, 213, 3, 168, 45, 210, },
93 {117, 62, 158, 103, 113, 58, 155, 100, },
98 { 0, 143, 18, 200, 2, 156, 25, 215, },
99 { 78, 28, 125, 64, 89, 36, 138, 74, },
100 { 10, 180, 3, 161, 16, 195, 8, 175, },
101 {109, 51, 93, 38, 121, 60, 105, 47, },
102 { 1, 152, 23, 210, 0, 147, 20, 205, },
103 { 85, 33, 134, 71, 81, 30, 130, 67, },
104 { 14, 190, 6, 171, 12, 185, 5, 166, },
105 {117, 57, 101, 44, 113, 54, 97, 41, },
106 { 0, 143, 18, 200, 2, 156, 25, 215, },
111 { 0, 124, 8, 193, 0, 140, 12, 213, },
112 { 55, 14, 104, 42, 66, 19, 119, 52, },
113 { 3, 168, 1, 145, 6, 187, 3, 162, },
114 { 86, 31, 70, 21, 99, 39, 82, 28, },
115 { 0, 134, 11, 206, 0, 129, 9, 200, },
116 { 62, 17, 114, 48, 58, 16, 109, 45, },
117 { 5, 181, 2, 157, 4, 175, 1, 151, },
118 { 95, 36, 78, 26, 90, 34, 74, 24, },
119 { 0, 124, 8, 193, 0, 140, 12, 213, },
124 { 0, 107, 3, 187, 0, 125, 6, 212, },
125 { 39, 7, 86, 28, 49, 11, 102, 36, },
126 { 1, 158, 0, 131, 3, 180, 1, 151, },
127 { 68, 19, 52, 12, 81, 25, 64, 17, },
128 { 0, 119, 5, 203, 0, 113, 4, 195, },
129 { 45, 9, 96, 33, 42, 8, 91, 30, },
130 { 2, 172, 1, 144, 2, 165, 0, 137, },
131 { 77, 23, 60, 15, 72, 21, 56, 14, },
132 { 0, 107, 3, 187, 0, 125, 6, 212, },
136 #define output_pixel(pos, val, bias, signedness) \ 138 AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \ 140 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \ 145 int big_endian,
int output_bits)
151 for (i = 0; i < dstW; i++) {
152 int val = src[
i] + (1 << (shift - 1));
159 const int32_t **
src, uint16_t *dest,
int dstW,
160 int big_endian,
int output_bits)
166 for (i = 0; i < dstW; i++) {
167 int val = 1 << (shift - 1);
176 for (j = 0; j < filterSize; j++)
177 val += src[j][i] * (
unsigned)filter[j];
184 const int16_t **chrUSrc,
const int16_t **chrVSrc,
187 uint16_t *dest = (uint16_t*)dest8;
194 for (i = 0; i < chrDstW; i++) {
195 int u = 1 << (shift - 1);
196 int v = 1 << (shift - 1);
201 for (j = 0; j < chrFilterSize; j++) {
202 u += uSrc[j][
i] * (unsigned)chrFilter[j];
203 v += vSrc[j][
i] * (unsigned)chrFilter[j];
215 static const int shift = 3;
216 static const float float_mult = 1.0f / 65535.0f;
220 for (i = 0; i < dstW; ++
i){
221 val = src[
i] + (1 << (shift - 1));
223 dest[
i] = float_mult * (float)val_uint;
231 static const int shift = 3;
232 static const float float_mult = 1.0f / 65535.0f;
236 for (i = 0; i < dstW; ++
i){
237 val = src[
i] + (1 << (shift - 1));
245 float *dest,
int dstW)
248 static const int shift = 15;
249 static const float float_mult = 1.0f / 65535.0f;
253 for (i = 0; i < dstW; ++
i){
254 val = (1 << (shift - 1)) - 0x40000000;
255 for (j = 0; j < filterSize; ++j){
256 val += src[j][
i] * (unsigned)filter[j];
259 dest[
i] = float_mult * (float)val_uint;
265 uint32_t *dest,
int dstW)
268 static const int shift = 15;
269 static const float float_mult = 1.0f / 65535.0f;
273 for (i = 0; i < dstW; ++
i){
274 val = (1 << (shift - 1)) - 0x40000000;
275 for (j = 0; j < filterSize; ++j){
276 val += src[j][
i] * (unsigned)filter[j];
283 #define yuv2plane1_float(template, dest_type, BE_LE) \ 284 static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \ 285 const uint8_t *dither, int offset) \ 287 template((const int32_t *)src, (dest_type *)dest, dstW); \ 290 #define yuv2planeX_float(template, dest_type, BE_LE) \ 291 static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \ 292 const int16_t **src, uint8_t *dest, int dstW, \ 293 const uint8_t *dither, int offset) \ 295 template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \ 312 #define output_pixel(pos, val) \ 314 AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \ 316 AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \ 320 yuv2plane1_10_c_template(
const int16_t *
src, uint16_t *dest,
int dstW,
321 int big_endian,
int output_bits)
324 int shift = 15 - output_bits;
326 for (i = 0; i < dstW; i++) {
327 int val = src[
i] + (1 << (shift - 1));
334 const int16_t **
src, uint16_t *dest,
int dstW,
335 int big_endian,
int output_bits)
338 int shift = 11 + 16 - output_bits;
340 for (i = 0; i < dstW; i++) {
341 int val = 1 << (shift - 1);
344 for (j = 0; j < filterSize; j++)
345 val += src[j][i] * filter[j];
353 #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \ 354 static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \ 355 uint8_t *dest, int dstW, \ 356 const uint8_t *dither, int offset)\ 358 yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \ 359 (uint16_t *) dest, dstW, is_be, bits); \ 361 static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \ 362 const int16_t **src, uint8_t *dest, int dstW, \ 363 const uint8_t *dither, int offset)\ 365 yuv2planeX_## template_size ## _c_template(filter, \ 366 filterSize, (const typeX_t **) src, \ 367 (uint16_t *) dest, dstW, is_be, bits); \ 380 static void yuv2planeX_8_c(
const int16_t *
filter,
int filterSize,
385 for (i=0; i<dstW; i++) {
386 int val = dither[(i +
offset) & 7] << 12;
388 for (j=0; j<filterSize; j++)
389 val += src[j][i] * filter[j];
391 dest[
i]= av_clip_uint8(val>>19);
399 for (i=0; i<dstW; i++) {
400 int val = (src[
i] + dither[(i +
offset) & 7]) >> 7;
401 dest[
i]= av_clip_uint8(val);
406 const int16_t **chrUSrc,
const int16_t **chrVSrc,
415 for (i=0; i<chrDstW; i++) {
416 int u = chrDither[i & 7] << 12;
417 int v = chrDither[(i + 3) & 7] << 12;
419 for (j=0; j<chrFilterSize; j++) {
420 u += chrUSrc[j][
i] * chrFilter[j];
421 v += chrVSrc[j][
i] * chrFilter[j];
424 dest[2*
i]= av_clip_uint8(u>>19);
425 dest[2*i+1]= av_clip_uint8(v>>19);
428 for (i=0; i<chrDstW; i++) {
429 int u = chrDither[i & 7] << 12;
430 int v = chrDither[(i + 3) & 7] << 12;
432 for (j=0; j<chrFilterSize; j++) {
433 u += chrUSrc[j][
i] * chrFilter[j];
434 v += chrVSrc[j][
i] * chrFilter[j];
437 dest[2*
i]= av_clip_uint8(v>>19);
438 dest[2*i+1]= av_clip_uint8(u>>19);
443 #define output_pixel(pos, val) \ 445 AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ 447 AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ 451 uint16_t *dest,
int dstW,
457 for (i = 0; i < dstW; i++) {
458 int val = src[
i] + (1 << (shift - 1));
464 const int16_t **
src, uint16_t *dest,
int dstW,
470 for (i = 0; i < dstW; i++) {
471 int val = 1 << (shift - 1);
473 for (j = 0; j < filterSize; j++)
474 val += src[j][i] * filter[j];
481 const int16_t **chrUSrc,
const int16_t **chrVSrc,
484 uint16_t *dest = (uint16_t*)dest8;
489 for (i = 0; i < chrDstW; i++) {
490 int u = 1 << (shift - 1);
491 int v = 1 << (shift - 1);
493 for (j = 0; j < chrFilterSize; j++) {
494 u += chrUSrc[j][
i] * chrFilter[j];
495 v += chrVSrc[j][
i] * chrFilter[j];
521 yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0);
528 yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1);
534 #define accumulate_bit(acc, val) \ 537 #define output_pixel(pos, acc) \ 538 if (target == AV_PIX_FMT_MONOBLACK) { \ 546 const int16_t **lumSrc,
int lumFilterSize,
547 const int16_t *chrFilter,
const int16_t **chrUSrc,
548 const int16_t **chrVSrc,
int chrFilterSize,
549 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
557 for (i = 0; i < dstW; i += 2) {
562 for (j = 0; j < lumFilterSize; j++) {
563 Y1 += lumSrc[j][
i] * lumFilter[j];
564 Y2 += lumSrc[j][i+1] * lumFilter[j];
568 if ((Y1 | Y2) & 0x100) {
569 Y1 = av_clip_uint8(Y1);
570 Y2 = av_clip_uint8(Y2);
575 acc = 2*acc + (Y1 >= 128);
580 acc = 2*acc + (err >= 128);
599 const int16_t *ubuf[2],
const int16_t *vbuf[2],
600 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
601 int yalpha,
int uvalpha,
int y,
604 const int16_t *buf0 = buf[0], *buf1 = buf[1];
606 int yalpha1 = 4096 - yalpha;
613 for (i = 0; i < dstW; i +=2) {
616 Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
619 acc = 2*acc + (Y >= 128);
622 err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;
625 acc = 2*acc + (err >= 128);
633 for (i = 0; i < dstW; i += 8) {
636 Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
638 Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;
640 Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19;
642 Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19;
644 Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19;
646 Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19;
648 Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19;
650 Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19;
660 const int16_t *ubuf[2],
const int16_t *vbuf[2],
661 const int16_t *abuf0,
uint8_t *dest,
int dstW,
670 for (i = 0; i < dstW; i +=2) {
673 Y = ((buf0[i + 0] + 64) >> 7);
676 acc = 2*acc + (Y >= 128);
679 err = ((buf0[i + 1] + 64) >> 7);
682 acc = 2*acc + (err >= 128);
690 for (i = 0; i < dstW; i += 8) {
707 #undef accumulate_bit 709 #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \ 710 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ 711 const int16_t **lumSrc, int lumFilterSize, \ 712 const int16_t *chrFilter, const int16_t **chrUSrc, \ 713 const int16_t **chrVSrc, int chrFilterSize, \ 714 const int16_t **alpSrc, uint8_t *dest, int dstW, \ 717 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ 718 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ 719 alpSrc, dest, dstW, y, fmt); \ 722 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ 723 const int16_t *ubuf[2], const int16_t *vbuf[2], \ 724 const int16_t *abuf[2], uint8_t *dest, int dstW, \ 725 int yalpha, int uvalpha, int y) \ 727 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ 728 dest, dstW, yalpha, uvalpha, y, fmt); \ 731 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \ 732 const int16_t *ubuf[2], const int16_t *vbuf[2], \ 733 const int16_t *abuf0, uint8_t *dest, int dstW, \ 734 int uvalpha, int y) \ 736 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \ 737 abuf0, dest, dstW, uvalpha, \ 744 #define output_pixels(pos, Y1, U, Y2, V) \ 745 if (target == AV_PIX_FMT_YUYV422) { \ 746 dest[pos + 0] = Y1; \ 748 dest[pos + 2] = Y2; \ 750 } else if (target == AV_PIX_FMT_YVYU422) { \ 751 dest[pos + 0] = Y1; \ 753 dest[pos + 2] = Y2; \ 757 dest[pos + 1] = Y1; \ 759 dest[pos + 3] = Y2; \ 764 const int16_t **lumSrc,
int lumFilterSize,
765 const int16_t *chrFilter,
const int16_t **chrUSrc,
766 const int16_t **chrVSrc,
int chrFilterSize,
767 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
772 for (i = 0; i < ((dstW + 1) >> 1); i++) {
779 for (j = 0; j < lumFilterSize; j++) {
780 Y1 += lumSrc[j][i * 2] * lumFilter[j];
781 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
783 for (j = 0; j < chrFilterSize; j++) {
784 U += chrUSrc[j][
i] * chrFilter[j];
785 V += chrVSrc[j][
i] * chrFilter[j];
791 if ((Y1 | Y2 | U | V) & 0x100) {
792 Y1 = av_clip_uint8(Y1);
793 Y2 = av_clip_uint8(Y2);
794 U = av_clip_uint8(U);
795 V = av_clip_uint8(V);
803 const int16_t *ubuf[2],
const int16_t *vbuf[2],
804 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
805 int yalpha,
int uvalpha,
int y,
808 const int16_t *buf0 = buf[0], *buf1 = buf[1],
809 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
810 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
811 int yalpha1 = 4096 - yalpha;
812 int uvalpha1 = 4096 - uvalpha;
817 for (i = 0; i < ((dstW + 1) >> 1); i++) {
818 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
819 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
820 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
821 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
823 if ((Y1 | Y2 | U | V) & 0x100) {
824 Y1 = av_clip_uint8(Y1);
825 Y2 = av_clip_uint8(Y2);
826 U = av_clip_uint8(U);
827 V = av_clip_uint8(V);
836 const int16_t *ubuf[2],
const int16_t *vbuf[2],
837 const int16_t *abuf0,
uint8_t *dest,
int dstW,
840 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
843 if (uvalpha < 2048) {
844 for (i = 0; i < ((dstW + 1) >> 1); i++) {
845 int Y1 = (buf0[i * 2 ]+64) >> 7;
846 int Y2 = (buf0[i * 2 + 1]+64) >> 7;
847 int U = (ubuf0[
i] +64) >> 7;
848 int V = (vbuf0[
i] +64) >> 7;
850 if ((Y1 | Y2 | U | V) & 0x100) {
851 Y1 = av_clip_uint8(Y1);
852 Y2 = av_clip_uint8(Y2);
853 U = av_clip_uint8(U);
854 V = av_clip_uint8(V);
860 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
861 for (i = 0; i < ((dstW + 1) >> 1); i++) {
862 int Y1 = (buf0[i * 2 ] + 64) >> 7;
863 int Y2 = (buf0[i * 2 + 1] + 64) >> 7;
864 int U = (ubuf0[
i] + ubuf1[
i]+128) >> 8;
865 int V = (vbuf0[
i] + vbuf1[
i]+128) >> 8;
867 if ((Y1 | Y2 | U | V) & 0x100) {
868 Y1 = av_clip_uint8(Y1);
869 Y2 = av_clip_uint8(Y2);
870 U = av_clip_uint8(U);
871 V = av_clip_uint8(V);
885 #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) 886 #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) 887 #define output_pixel(pos, val) \ 888 if (isBE(target)) { \ 896 const int32_t **lumSrc,
int lumFilterSize,
897 const int16_t *chrFilter,
const int32_t **unused_chrUSrc,
898 const int32_t **unused_chrVSrc,
int unused_chrFilterSize,
899 const int32_t **alpSrc, uint16_t *dest,
int dstW,
900 int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
902 int hasAlpha = !!alpSrc;
905 for (i = 0; i < dstW; i++) {
910 for (j = 0; j < lumFilterSize; j++)
911 Y += lumSrc[j][i] * lumFilter[j];
914 Y += (1<<3) + 0x8000;
915 Y = av_clip_uint16(Y);
918 A = -0x40000000 + (1<<14);
919 for (j = 0; j < lumFilterSize; j++)
920 A += alpSrc[j][i] * lumFilter[j];
924 A = av_clip_uint16(A);
935 const int32_t *abuf[2], uint16_t *dest,
int dstW,
936 int yalpha,
int unused_uvalpha,
int y,
937 enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
939 int hasAlpha = abuf && abuf[0] && abuf[1];
940 const int32_t *buf0 = buf[0], *buf1 = buf[1],
941 *abuf0 = hasAlpha ? abuf[0] :
NULL,
942 *abuf1 = hasAlpha ? abuf[1] :
NULL;
943 int yalpha1 = 4096 - yalpha;
948 for (i = 0; i < dstW; i++) {
949 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 15;
952 Y = av_clip_uint16(Y);
955 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 15;
956 A = av_clip_uint16(A);
967 const int32_t *abuf0, uint16_t *dest,
int dstW,
968 int unused_uvalpha,
int y,
enum AVPixelFormat target,
int unused_hasAlpha,
int unused_eightbytes)
970 int hasAlpha = !!abuf0;
973 for (i = 0; i < dstW; i++) {
974 int Y = buf0[
i] >> 3;
977 Y = av_clip_uint16(Y);
982 A = av_clip_uint16(A);
992 const int32_t **lumSrc,
int lumFilterSize,
993 const int16_t *chrFilter,
const int32_t **chrUSrc,
994 const int32_t **chrVSrc,
int chrFilterSize,
995 const int32_t **alpSrc, uint16_t *dest,
int dstW,
996 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
999 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1001 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1003 int Y1 = -0x40000000;
1004 int Y2 = -0x40000000;
1005 int U = -(128 << 23);
1006 int V = -(128 << 23);
1009 for (j = 0; j < lumFilterSize; j++) {
1010 Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j];
1011 Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1013 for (j = 0; j < chrFilterSize; j++) {;
1014 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1015 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1021 for (j = 0; j < lumFilterSize; j++) {
1022 A1 += alpSrc[j][i * 2] * (unsigned)lumFilter[j];
1023 A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1044 Y1 += (1 << 13) - (1 << 29);
1045 Y2 += (1 << 13) - (1 << 29);
1053 output_pixel(&dest[0], av_clip_uintp2(((
R_B + Y1) >> 14) + (1<<15), 16));
1054 output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
1055 output_pixel(&dest[2], av_clip_uintp2(((
B_R + Y1) >> 14) + (1<<15), 16));
1058 output_pixel(&dest[4], av_clip_uintp2(((
R_B + Y2) >> 14) + (1<<15), 16));
1059 output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
1060 output_pixel(&dest[6], av_clip_uintp2(((
B_R + Y2) >> 14) + (1<<15), 16));
1064 output_pixel(&dest[3], av_clip_uintp2(((
R_B + Y2) >> 14) + (1<<15), 16));
1065 output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
1066 output_pixel(&dest[5], av_clip_uintp2(((
B_R + Y2) >> 14) + (1<<15), 16));
1075 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1076 int yalpha,
int uvalpha,
int y,
1079 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1080 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1081 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1082 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1083 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1084 int yalpha1 = 4096 - yalpha;
1085 int uvalpha1 = 4096 - uvalpha;
1087 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1092 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1093 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
1094 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
1095 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1096 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1103 Y1 += (1 << 13) - (1 << 29);
1104 Y2 += (1 << 13) - (1 << 29);
1111 A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 1;
1112 A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1;
1118 output_pixel(&dest[0], av_clip_uintp2(((
R_B + Y1) >> 14) + (1<<15), 16));
1119 output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
1120 output_pixel(&dest[2], av_clip_uintp2(((
B_R + Y1) >> 14) + (1<<15), 16));
1123 output_pixel(&dest[4], av_clip_uintp2(((
R_B + Y2) >> 14) + (1<<15), 16));
1124 output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
1125 output_pixel(&dest[6], av_clip_uintp2(((
B_R + Y2) >> 14) + (1<<15), 16));
1129 output_pixel(&dest[3], av_clip_uintp2(((
R_B + Y2) >> 14) + (1<<15), 16));
1130 output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
1131 output_pixel(&dest[5], av_clip_uintp2(((
B_R + Y2) >> 14) + (1<<15), 16));
1140 const int32_t *abuf0, uint16_t *dest,
int dstW,
1141 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1143 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1145 int A1 = 0xffff<<14,
A2= 0xffff<<14;
1147 if (uvalpha < 2048) {
1148 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1149 SUINT Y1 = (buf0[i * 2] ) >> 2;
1150 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1151 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1152 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1159 Y1 += (1 << 13) - (1 << 29);
1160 Y2 += (1 << 13) - (1 << 29);
1163 A1 = abuf0[i * 2 ] << 11;
1164 A2 = abuf0[i * 2 + 1] << 11;
1174 output_pixel(&dest[0], av_clip_uintp2(((
int)(
R_B + Y1) >> 14) + (1<<15), 16));
1175 output_pixel(&dest[1], av_clip_uintp2(((
int)( G + Y1) >> 14) + (1<<15), 16));
1176 output_pixel(&dest[2], av_clip_uintp2(((
int)(
B_R + Y1) >> 14) + (1<<15), 16));
1179 output_pixel(&dest[4], av_clip_uintp2(((
int)(
R_B + Y2) >> 14) + (1<<15), 16));
1180 output_pixel(&dest[5], av_clip_uintp2(((
int)( G + Y2) >> 14) + (1<<15), 16));
1181 output_pixel(&dest[6], av_clip_uintp2(((
int)(
B_R + Y2) >> 14) + (1<<15), 16));
1185 output_pixel(&dest[3], av_clip_uintp2(((
int)(
R_B + Y2) >> 14) + (1<<15), 16));
1186 output_pixel(&dest[4], av_clip_uintp2(((
int)( G + Y2) >> 14) + (1<<15), 16));
1187 output_pixel(&dest[5], av_clip_uintp2(((
int)(
B_R + Y2) >> 14) + (1<<15), 16));
1192 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1193 int A1 = 0xffff<<14,
A2 = 0xffff<<14;
1194 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1195 SUINT Y1 = (buf0[i * 2] ) >> 2;
1196 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1197 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1198 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1205 Y1 += (1 << 13) - (1 << 29);
1206 Y2 += (1 << 13) - (1 << 29);
1209 A1 = abuf0[i * 2 ] << 11;
1210 A2 = abuf0[i * 2 + 1] << 11;
1220 output_pixel(&dest[0], av_clip_uintp2(((
int)(
R_B + Y1) >> 14) + (1<<15), 16));
1221 output_pixel(&dest[1], av_clip_uintp2(((
int)( G + Y1) >> 14) + (1<<15), 16));
1222 output_pixel(&dest[2], av_clip_uintp2(((
int)(
B_R + Y1) >> 14) + (1<<15), 16));
1225 output_pixel(&dest[4], av_clip_uintp2(((
int)(
R_B + Y2) >> 14) + (1<<15), 16));
1226 output_pixel(&dest[5], av_clip_uintp2(((
int)( G + Y2) >> 14) + (1<<15), 16));
1227 output_pixel(&dest[6], av_clip_uintp2(((
int)(
B_R + Y2) >> 14) + (1<<15), 16));
1231 output_pixel(&dest[3], av_clip_uintp2(((
int)(
R_B + Y2) >> 14) + (1<<15), 16));
1232 output_pixel(&dest[4], av_clip_uintp2(((
int)( G + Y2) >> 14) + (1<<15), 16));
1233 output_pixel(&dest[5], av_clip_uintp2(((
int)(
B_R + Y2) >> 14) + (1<<15), 16));
1242 const int32_t **lumSrc,
int lumFilterSize,
1243 const int16_t *chrFilter,
const int32_t **chrUSrc,
1244 const int32_t **chrVSrc,
int chrFilterSize,
1245 const int32_t **alpSrc, uint16_t *dest,
int dstW,
1246 int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1251 for (i = 0; i < dstW; i++) {
1253 int Y = -0x40000000;
1254 int U = -(128 << 23);
1255 int V = -(128 << 23);
1258 for (j = 0; j < lumFilterSize; j++) {
1259 Y += lumSrc[j][
i] * (unsigned)lumFilter[j];
1261 for (j = 0; j < chrFilterSize; j++) {;
1262 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
1263 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
1268 for (j = 0; j < lumFilterSize; j++) {
1269 A += alpSrc[j][
i] * (unsigned)lumFilter[j];
1284 Y += (1 << 13) - (1<<29);
1292 output_pixel(&dest[0], av_clip_uintp2(((
R_B + Y)>>14) + (1<<15), 16));
1293 output_pixel(&dest[1], av_clip_uintp2((( G + Y)>>14) + (1<<15), 16));
1294 output_pixel(&dest[2], av_clip_uintp2(((
B_R + Y)>>14) + (1<<15), 16));
1307 const int32_t *abuf[2], uint16_t *dest,
int dstW,
1308 int yalpha,
int uvalpha,
int y,
1311 const int32_t *buf0 = buf[0], *buf1 = buf[1],
1312 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1313 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1314 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1315 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1316 int yalpha1 = 4096 - yalpha;
1317 int uvalpha1 = 4096 - uvalpha;
1324 for (i = 0; i < dstW; i++) {
1325 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 14;
1326 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha - (128 << 23)) >> 14;
1327 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha - (128 << 23)) >> 14;
1332 Y += (1 << 13) - (1 << 29);
1339 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 1;
1344 output_pixel(&dest[0], av_clip_uintp2(((
R_B + Y) >> 14) + (1<<15), 16));
1345 output_pixel(&dest[1], av_clip_uintp2((( G + Y) >> 14) + (1<<15), 16));
1346 output_pixel(&dest[2], av_clip_uintp2(((
B_R + Y) >> 14) + (1<<15), 16));
1359 const int32_t *abuf0, uint16_t *dest,
int dstW,
1360 int uvalpha,
int y,
enum AVPixelFormat target,
int hasAlpha,
int eightbytes)
1362 const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1366 if (uvalpha < 2048) {
1367 for (i = 0; i < dstW; i++) {
1369 int U = (ubuf0[
i] - (128 << 11)) >> 2;
1370 int V = (vbuf0[
i] - (128 << 11)) >> 2;
1375 Y += (1 << 13) - (1 << 29);
1387 output_pixel(&dest[0], av_clip_uintp2(((
int)(
R_B + Y) >> 14) + (1<<15), 16));
1388 output_pixel(&dest[1], av_clip_uintp2(((
int)( G + Y) >> 14) + (1<<15), 16));
1389 output_pixel(&dest[2], av_clip_uintp2(((
int)(
B_R + Y) >> 14) + (1<<15), 16));
1398 const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1400 for (i = 0; i < dstW; i++) {
1402 int U = (ubuf0[
i] + ubuf1[
i] - (128 << 12)) >> 3;
1403 int V = (vbuf0[
i] + vbuf1[
i] - (128 << 12)) >> 3;
1408 Y += (1 << 13) - (1 << 29);
1420 output_pixel(&dest[0], av_clip_uintp2(((
int)(
R_B + Y) >> 14) + (1<<15), 16));
1421 output_pixel(&dest[1], av_clip_uintp2(((
int)( G + Y) >> 14) + (1<<15), 16));
1422 output_pixel(&dest[2], av_clip_uintp2(((
int)(
B_R + Y) >> 14) + (1<<15), 16));
1437 #define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes) \ 1438 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ 1439 const int16_t **_lumSrc, int lumFilterSize, \ 1440 const int16_t *chrFilter, const int16_t **_chrUSrc, \ 1441 const int16_t **_chrVSrc, int chrFilterSize, \ 1442 const int16_t **_alpSrc, uint8_t *_dest, int dstW, \ 1445 const int32_t **lumSrc = (const int32_t **) _lumSrc, \ 1446 **chrUSrc = (const int32_t **) _chrUSrc, \ 1447 **chrVSrc = (const int32_t **) _chrVSrc, \ 1448 **alpSrc = (const int32_t **) _alpSrc; \ 1449 uint16_t *dest = (uint16_t *) _dest; \ 1450 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ 1451 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ 1452 alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes); \ 1455 static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ 1456 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ 1457 const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ 1458 int yalpha, int uvalpha, int y) \ 1460 const int32_t **buf = (const int32_t **) _buf, \ 1461 **ubuf = (const int32_t **) _ubuf, \ 1462 **vbuf = (const int32_t **) _vbuf, \ 1463 **abuf = (const int32_t **) _abuf; \ 1464 uint16_t *dest = (uint16_t *) _dest; \ 1465 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ 1466 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes); \ 1469 static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ 1470 const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ 1471 const int16_t *_abuf0, uint8_t *_dest, int dstW, \ 1472 int uvalpha, int y) \ 1474 const int32_t *buf0 = (const int32_t *) _buf0, \ 1475 **ubuf = (const int32_t **) _ubuf, \ 1476 **vbuf = (const int32_t **) _vbuf, \ 1477 *abuf0 = (const int32_t *) _abuf0; \ 1478 uint16_t *dest = (uint16_t *) _dest; \ 1479 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ 1480 dstW, uvalpha, y, fmt, hasAlpha, eightbytes); \ 1521 unsigned A1,
unsigned A2,
1522 const
void *_r, const
void *_g, const
void *_b,
int y,
1527 uint32_t *dest = (uint32_t *) _dest;
1528 const uint32_t *
r = (
const uint32_t *) _r;
1529 const uint32_t *
g = (
const uint32_t *) _g;
1530 const uint32_t *
b = (
const uint32_t *) _b;
1535 dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);
1536 dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);
1541 av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0);
1542 dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);
1543 dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);
1545 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 1548 av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0xFF);
1550 dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
1551 dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
1560 #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b) 1561 #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r) 1563 dest[i * 6 + 0] =
r_b[Y1];
1564 dest[i * 6 + 1] = g[Y1];
1565 dest[i * 6 + 2] =
b_r[Y1];
1566 dest[i * 6 + 3] =
r_b[Y2];
1567 dest[i * 6 + 4] = g[Y2];
1568 dest[i * 6 + 5] =
b_r[Y2];
1574 uint16_t *dest = (uint16_t *) _dest;
1575 const uint16_t *
r = (
const uint16_t *) _r;
1576 const uint16_t *
g = (
const uint16_t *) _g;
1577 const uint16_t *
b = (
const uint16_t *) _b;
1578 int dr1, dg1, db1, dr2, dg2, db2;
1603 dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
1604 dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
1610 int dr1, dg1, db1, dr2, dg2, db2;
1615 dr1 = dg1 = d32[(i * 2 + 0) & 7];
1616 db1 = d64[(i * 2 + 0) & 7];
1617 dr2 = dg2 = d32[(i * 2 + 1) & 7];
1618 db2 = d64[(i * 2 + 1) & 7];
1622 dr1 = db1 = d128[(i * 2 + 0) & 7];
1623 dg1 = d64[(i * 2 + 0) & 7];
1624 dr2 = db2 = d128[(i * 2 + 1) & 7];
1625 dg2 = d64[(i * 2 + 1) & 7];
1629 dest[
i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +
1630 ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);
1632 dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
1633 dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
1640 const int16_t **lumSrc,
int lumFilterSize,
1641 const int16_t *chrFilter,
const int16_t **chrUSrc,
1642 const int16_t **chrVSrc,
int chrFilterSize,
1643 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
1648 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1654 const void *
r, *
g, *
b;
1656 for (j = 0; j < lumFilterSize; j++) {
1657 Y1 += lumSrc[j][i * 2] * lumFilter[j];
1658 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
1660 for (j = 0; j < chrFilterSize; j++) {
1661 U += chrUSrc[j][
i] * chrFilter[j];
1662 V += chrVSrc[j][
i] * chrFilter[j];
1671 for (j = 0; j < lumFilterSize; j++) {
1672 A1 += alpSrc[j][i * 2 ] * lumFilter[j];
1673 A2 += alpSrc[j][i * 2 + 1] * lumFilter[j];
1677 if ((A1 | A2) & 0x100) {
1678 A1 = av_clip_uint8(A1);
1679 A2 = av_clip_uint8(A2);
1687 yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1688 r, g, b, y, target, hasAlpha);
1694 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1695 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
1696 int yalpha,
int uvalpha,
int y,
1699 const int16_t *buf0 = buf[0], *buf1 = buf[1],
1700 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1701 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1702 *abuf0 = hasAlpha ? abuf[0] :
NULL,
1703 *abuf1 = hasAlpha ? abuf[1] :
NULL;
1704 int yalpha1 = 4096 - yalpha;
1705 int uvalpha1 = 4096 - uvalpha;
1710 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1711 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
1712 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
1713 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha) >> 19;
1714 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha) >> 19;
1721 A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19;
1722 A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;
1723 A1 = av_clip_uint8(A1);
1724 A2 = av_clip_uint8(A2);
1727 yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1728 r,
g,
b, y, target, hasAlpha);
1734 const int16_t *ubuf[2],
const int16_t *vbuf[2],
1735 const int16_t *abuf0,
uint8_t *dest,
int dstW,
1739 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1742 if (uvalpha < 2048) {
1743 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1744 int Y1 = (buf0[i * 2 ] + 64) >> 7;
1745 int Y2 = (buf0[i * 2 + 1] + 64) >> 7;
1746 int U = (ubuf0[
i] + 64) >> 7;
1747 int V = (vbuf0[
i] + 64) >> 7;
1754 A1 = abuf0[i * 2 ] * 255 + 16384 >> 15;
1755 A2 = abuf0[i * 2 + 1] * 255 + 16384 >> 15;
1756 A1 = av_clip_uint8(A1);
1757 A2 = av_clip_uint8(A2);
1760 yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1761 r,
g,
b, y, target, hasAlpha);
1764 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1765 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1766 int Y1 = (buf0[i * 2 ] + 64) >> 7;
1767 int Y2 = (buf0[i * 2 + 1] + 64) >> 7;
1768 int U = (ubuf0[
i] + ubuf1[
i] + 128) >> 8;
1769 int V = (vbuf0[
i] + vbuf1[
i] + 128) >> 8;
1776 A1 = (abuf0[i * 2 ] + 64) >> 7;
1777 A2 = (abuf0[i * 2 + 1] + 64) >> 7;
1778 A1 = av_clip_uint8(A1);
1779 A2 = av_clip_uint8(A2);
1782 yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1783 r,
g,
b, y, target, hasAlpha);
1788 #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ 1789 static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ 1790 const int16_t **lumSrc, int lumFilterSize, \ 1791 const int16_t *chrFilter, const int16_t **chrUSrc, \ 1792 const int16_t **chrVSrc, int chrFilterSize, \ 1793 const int16_t **alpSrc, uint8_t *dest, int dstW, \ 1796 name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ 1797 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ 1798 alpSrc, dest, dstW, y, fmt, hasAlpha); \ 1801 #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ 1802 YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ 1803 static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ 1804 const int16_t *ubuf[2], const int16_t *vbuf[2], \ 1805 const int16_t *abuf[2], uint8_t *dest, int dstW, \ 1806 int yalpha, int uvalpha, int y) \ 1808 name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ 1809 dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \ 1812 #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ 1813 YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ 1814 static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \ 1815 const int16_t *ubuf[2], const int16_t *vbuf[2], \ 1816 const int16_t *abuf0, uint8_t *dest, int dstW, \ 1817 int uvalpha, int y) \ 1819 name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ 1820 dstW, uvalpha, y, fmt, hasAlpha); \ 1827 #if CONFIG_SWSCALE_ALPHA 1850 Y -= c->yuv2rgb_y_offset;
1851 Y *= c->yuv2rgb_y_coeff;
1853 R = (unsigned)Y + V*c->yuv2rgb_v2r_coeff;
1854 G = (
unsigned)Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
1855 B = (unsigned)Y + U*c->yuv2rgb_u2b_coeff;
1856 if ((R | G | B) & 0xC0000000) {
1857 R = av_clip_uintp2(R, 30);
1858 G = av_clip_uintp2(G, 30);
1859 B = av_clip_uintp2(B, 30);
1864 dest[0] = hasAlpha ?
A : 255;
1878 dest[3] = hasAlpha ?
A : 255;
1881 dest[0] = hasAlpha ?
A : 255;
1895 dest[3] = hasAlpha ?
A : 255;
1904 switch (c->dither) {
1911 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;
1912 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;
1913 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;
1914 c->dither_error[0][
i] = err[0];
1915 c->dither_error[1][
i] = err[1];
1916 c->dither_error[2][
i] = err[2];
1917 r = R >> (isrgb8 ? 5 : 7);
1918 g = G >> (isrgb8 ? 5 : 6);
1919 b = B >> (isrgb8 ? 6 : 7);
1920 r = av_clip(r, 0, isrgb8 ? 7 : 1);
1921 g = av_clip(g, 0, isrgb8 ? 7 : 3);
1922 b = av_clip(b, 0, isrgb8 ? 3 : 1);
1923 err[0] = R - r*(isrgb8 ? 36 : 255);
1924 err[1] = G - g*(isrgb8 ? 36 : 85);
1925 err[2] = B - b*(isrgb8 ? 85 : 255);
1930 #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff)) 1931 r = (((R >> 19) +
A_DITHER(i,y) -96)>>8);
1932 g = (((G >> 19) +
A_DITHER(i + 17,y) - 96)>>8);
1933 b = (((B >> 20) +
A_DITHER(i + 17*2,y) -96)>>8);
1934 r = av_clip_uintp2(r, 3);
1935 g = av_clip_uintp2(g, 3);
1936 b = av_clip_uintp2(b, 2);
1938 r = (((R >> 21) +
A_DITHER(i,y)-256)>>8);
1939 g = (((G >> 19) +
A_DITHER(i + 17,y)-256)>>8);
1940 b = (((B >> 21) +
A_DITHER(i + 17*2,y)-256)>>8);
1941 r = av_clip_uintp2(r, 1);
1942 g = av_clip_uintp2(g, 2);
1943 b = av_clip_uintp2(b, 1);
1949 #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2) 1950 r = (((R >> 19) +
X_DITHER(i,y) - 96)>>8);
1951 g = (((G >> 19) +
X_DITHER(i + 17,y) - 96)>>8);
1952 b = (((B >> 20) +
X_DITHER(i + 17*2,y) - 96)>>8);
1953 r = av_clip_uintp2(r, 3);
1954 g = av_clip_uintp2(g, 3);
1955 b = av_clip_uintp2(b, 2);
1957 r = (((R >> 21) +
X_DITHER(i,y)-256)>>8);
1958 g = (((G >> 19) +
X_DITHER(i + 17,y)-256)>>8);
1959 b = (((B >> 21) +
X_DITHER(i + 17*2,y)-256)>>8);
1960 r = av_clip_uintp2(r, 1);
1961 g = av_clip_uintp2(g, 2);
1962 b = av_clip_uintp2(b, 1);
1969 dest[0] = r + 2*g + 8*
b;
1970 }
else if(target == AV_PIX_FMT_RGB4_BYTE) {
1971 dest[0] = b + 2*g + 8*
r;
1973 dest[0] = r + 8*g + 64*
b;
1974 }
else if(target == AV_PIX_FMT_RGB8) {
1975 dest[0] = b + 4*g + 32*
r;
1984 const int16_t **lumSrc,
int lumFilterSize,
1985 const int16_t *chrFilter,
const int16_t **chrUSrc,
1986 const int16_t **chrVSrc,
int chrFilterSize,
1987 const int16_t **alpSrc,
uint8_t *dest,
1999 for (i = 0; i < dstW; i++) {
2002 int U = (1<<9)-(128 << 19);
2003 int V = (1<<9)-(128 << 19);
2005 for (j = 0; j < lumFilterSize; j++) {
2006 Y += lumSrc[j][
i] * lumFilter[j];
2008 for (j = 0; j < chrFilterSize; j++) {
2009 U += chrUSrc[j][
i] * chrFilter[j];
2010 V += chrVSrc[j][
i] * chrFilter[j];
2017 for (j = 0; j < lumFilterSize; j++) {
2018 A += alpSrc[j][
i] * lumFilter[j];
2022 A = av_clip_uint8(A);
2024 yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2034 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2035 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2036 int yalpha,
int uvalpha,
int y,
2039 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2040 *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2041 *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2042 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2043 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2044 int yalpha1 = 4096 - yalpha;
2045 int uvalpha1 = 4096 - uvalpha;
2058 for (i = 0; i < dstW; i++) {
2059 int Y = ( buf0[
i] * yalpha1 + buf1[
i] * yalpha ) >> 10;
2060 int U = (ubuf0[
i] * uvalpha1 + ubuf1[
i] * uvalpha-(128 << 19)) >> 10;
2061 int V = (vbuf0[
i] * uvalpha1 + vbuf1[
i] * uvalpha-(128 << 19)) >> 10;
2064 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha + (1<<18)) >> 19;
2066 A = av_clip_uint8(A);
2069 yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2079 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2080 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2084 const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2093 if (uvalpha < 2048) {
2095 for (i = 0; i < dstW; i++) {
2096 int Y = buf0[
i] * 4;
2097 int U = (ubuf0[
i] - (128<<7)) * 4;
2098 int V = (vbuf0[
i] - (128<<7)) * 4;
2101 A = (abuf0[
i] + 64) >> 7;
2103 A = av_clip_uint8(A);
2106 yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2110 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2112 for (i = 0; i < dstW; i++) {
2113 int Y = buf0[
i] * 4;
2114 int U = (ubuf0[
i] + ubuf1[
i] - (128<<8)) * 2;
2115 int V = (vbuf0[
i] + vbuf1[
i] - (128<<8)) * 2;
2118 A = (abuf0[
i] + 64) >> 7;
2120 A = av_clip_uint8(A);
2123 yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2139 #if CONFIG_SWSCALE_ALPHA 2160 const int16_t **lumSrc,
int lumFilterSize,
2161 const int16_t *chrFilter,
const int16_t **chrUSrc,
2162 const int16_t **chrVSrc,
int chrFilterSize,
2163 const int16_t **alpSrc,
uint8_t **dest,
2169 uint16_t **dest16 = (uint16_t**)dest;
2173 for (i = 0; i < dstW; i++) {
2176 int U = (1 << 9) - (128 << 19);
2177 int V = (1 << 9) - (128 << 19);
2180 for (j = 0; j < lumFilterSize; j++)
2181 Y += lumSrc[j][i] * lumFilter[j];
2183 for (j = 0; j < chrFilterSize; j++) {
2184 U += chrUSrc[j][
i] * chrFilter[j];
2185 V += chrVSrc[j][
i] * chrFilter[j];
2195 for (j = 0; j < lumFilterSize; j++)
2196 A += alpSrc[j][i] * lumFilter[j];
2199 A = av_clip_uintp2(A, 27);
2209 if ((R | G | B) & 0xC0000000) {
2210 R = av_clip_uintp2(R, 30);
2211 G = av_clip_uintp2(G, 30);
2212 B = av_clip_uintp2(B, 30);
2216 dest16[0][
i] = G >>
SH;
2217 dest16[1][
i] = B >>
SH;
2218 dest16[2][
i] = R >>
SH;
2220 dest16[3][
i] = A >> (SH - 3);
2222 dest[0][
i] = G >> 22;
2223 dest[1][
i] = B >> 22;
2224 dest[2][
i] = R >> 22;
2226 dest[3][
i] = A >> 19;
2230 for (i = 0; i < dstW; i++) {
2242 const int16_t **lumSrcx,
int lumFilterSize,
2243 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2244 const int16_t **chrVSrcx,
int chrFilterSize,
2245 const int16_t **alpSrcx,
uint8_t **dest,
2251 uint16_t **dest16 = (uint16_t**)dest;
2257 for (i = 0; i < dstW; i++) {
2259 int Y = -0x40000000;
2260 int U = -(128 << 23);
2261 int V = -(128 << 23);
2264 for (j = 0; j < lumFilterSize; j++)
2265 Y += lumSrc[j][i] * (
unsigned)lumFilter[j];
2267 for (j = 0; j < chrFilterSize; j++) {
2268 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2269 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2280 for (j = 0; j < lumFilterSize; j++)
2281 A += alpSrc[j][i] * (
unsigned)lumFilter[j];
2294 R = av_clip_uintp2(Y + R, 30);
2295 G = av_clip_uintp2(Y + G, 30);
2296 B = av_clip_uintp2(Y + B, 30);
2298 dest16[0][
i] = G >> 14;
2299 dest16[1][
i] = B >> 14;
2300 dest16[2][
i] = R >> 14;
2302 dest16[3][
i] = av_clip_uintp2(A, 30) >> 14;
2305 for (i = 0; i < dstW; i++) {
2317 const int16_t **lumSrcx,
int lumFilterSize,
2318 const int16_t *chrFilter,
const int16_t **chrUSrcx,
2319 const int16_t **chrVSrcx,
int chrFilterSize,
2320 const int16_t **alpSrcx,
uint8_t **dest,
2326 uint32_t **dest32 = (uint32_t**)dest;
2331 static const float float_mult = 1.0f / 65535.0f;
2333 for (i = 0; i < dstW; i++) {
2335 int Y = -0x40000000;
2336 int U = -(128 << 23);
2337 int V = -(128 << 23);
2340 for (j = 0; j < lumFilterSize; j++)
2341 Y += lumSrc[j][i] * (
unsigned)lumFilter[j];
2343 for (j = 0; j < chrFilterSize; j++) {
2344 U += chrUSrc[j][
i] * (unsigned)chrFilter[j];
2345 V += chrVSrc[j][
i] * (unsigned)chrFilter[j];
2356 for (j = 0; j < lumFilterSize; j++)
2357 A += alpSrc[j][i] * (
unsigned)lumFilter[j];
2370 R = av_clip_uintp2(Y + R, 30);
2371 G = av_clip_uintp2(Y + G, 30);
2372 B = av_clip_uintp2(Y + B, 30);
2378 dest32[3][
i] =
av_float2int(float_mult * (
float)(av_clip_uintp2(A, 30) >> 14));
2381 for (i = 0; i < dstW; i++) {
2393 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2394 const int16_t *abuf0,
uint8_t *dest,
int dstW,
2397 int hasAlpha = !!abuf0;
2400 for (i = 0; i < dstW; i++) {
2401 int Y = (buf0[
i] + 64) >> 7;
2404 Y = av_clip_uint8(Y);
2407 A = (abuf0[
i] + 64) >> 7;
2409 A = av_clip_uint8(A);
2413 dest[i * 2 + 1] = hasAlpha ?
A : 255;
2419 const int16_t *ubuf[2],
const int16_t *vbuf[2],
2420 const int16_t *abuf[2],
uint8_t *dest,
int dstW,
2421 int yalpha,
int uvalpha,
int y)
2423 int hasAlpha = abuf && abuf[0] && abuf[1];
2424 const int16_t *buf0 = buf[0], *buf1 = buf[1],
2425 *abuf0 = hasAlpha ? abuf[0] :
NULL,
2426 *abuf1 = hasAlpha ? abuf[1] :
NULL;
2427 int yalpha1 = 4096 - yalpha;
2432 for (i = 0; i < dstW; i++) {
2433 int Y = (buf0[
i] * yalpha1 + buf1[
i] * yalpha) >> 19;
2436 Y = av_clip_uint8(Y);
2439 A = (abuf0[
i] * yalpha1 + abuf1[
i] * yalpha) >> 19;
2440 A = av_clip_uint8(A);
2444 dest[i * 2 + 1] = hasAlpha ?
A : 255;
2450 const int16_t **lumSrc,
int lumFilterSize,
2451 const int16_t *chrFilter,
const int16_t **chrUSrc,
2452 const int16_t **chrVSrc,
int chrFilterSize,
2453 const int16_t **alpSrc,
uint8_t *dest,
int dstW,
int y)
2455 int hasAlpha = !!alpSrc;
2458 for (i = 0; i < dstW; i++) {
2460 int Y = 1 << 18,
A = 1 << 18;
2462 for (j = 0; j < lumFilterSize; j++)
2463 Y += lumSrc[j][i] * lumFilter[j];
2467 Y = av_clip_uint8(Y);
2470 for (j = 0; j < lumFilterSize; j++)
2471 A += alpSrc[j][i] * lumFilter[j];
2476 A = av_clip_uint8(
A);
2480 dest[2 * i + 1] = hasAlpha ?
A : 255;
2486 const int16_t **_lumSrc,
int lumFilterSize,
2487 const int16_t *chrFilter,
const int16_t **_chrUSrc,
2488 const int16_t **_chrVSrc,
int chrFilterSize,
2489 const int16_t **_alpSrc,
uint8_t *dest,
int dstW,
int y)
2492 **chrUSrc = (
const int32_t **) _chrUSrc,
2493 **chrVSrc = (
const int32_t **) _chrVSrc,
2494 **alpSrc = (
const int32_t **) _alpSrc;
2495 int hasAlpha = !!alpSrc;
2498 for (i = 0; i < dstW; i++) {
2499 int Y = 1 << 14,
U = 1 << 14;
2500 int V = 1 << 14,
A = 1 << 14;
2508 for (j = 0; j < lumFilterSize; j++)
2509 Y += lumSrc[j][i] * (
unsigned)lumFilter[j];
2511 for (j = 0; j < chrFilterSize; j++)
2512 U += chrUSrc[j][i] * (
unsigned)chrFilter[j];
2514 for (j = 0; j < chrFilterSize; j++)
2515 V += chrVSrc[j][i] * (
unsigned)chrFilter[j];
2518 for (j = 0; j < lumFilterSize; j++)
2519 A += alpSrc[j][i] * (
unsigned)lumFilter[j];
2521 Y = 0x8000 + av_clip_int16(Y >> 15);
2522 U = 0x8000 + av_clip_int16(
U >> 15);
2523 V = 0x8000 + av_clip_int16(V >> 15);
2524 A = 0x8000 + av_clip_int16(
A >> 15);
2526 AV_WL16(dest + 8 * i, hasAlpha ?
A : 65535);
2549 }
else if (
is16BPS(dstFormat)) {
2550 *yuv2planeX =
isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
2551 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
2555 }
else if (
isNBPS(dstFormat)) {
2557 *yuv2planeX =
isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
2558 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
2560 *yuv2planeX =
isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
2561 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
2563 *yuv2planeX =
isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c;
2564 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c;
2566 *yuv2planeX =
isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c;
2567 *yuv2plane1 =
isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
2571 *yuv2planeX = yuv2planeX_floatBE_c;
2572 *yuv2plane1 = yuv2plane1_floatBE_c;
2574 *yuv2planeX = yuv2planeX_floatLE_c;
2575 *yuv2plane1 = yuv2plane1_floatLE_c;
2578 *yuv2planeX = yuv2planeX_8_c;
2585 switch (dstFormat) {
2588 *yuv2packedX = yuv2rgba32_full_X_c;
2589 *yuv2packed2 = yuv2rgba32_full_2_c;
2590 *yuv2packed1 = yuv2rgba32_full_1_c;
2592 #if CONFIG_SWSCALE_ALPHA 2594 *yuv2packedX = yuv2rgba32_full_X_c;
2595 *yuv2packed2 = yuv2rgba32_full_2_c;
2596 *yuv2packed1 = yuv2rgba32_full_1_c;
2600 *yuv2packedX = yuv2rgbx32_full_X_c;
2601 *yuv2packed2 = yuv2rgbx32_full_2_c;
2602 *yuv2packed1 = yuv2rgbx32_full_1_c;
2608 *yuv2packedX = yuv2argb32_full_X_c;
2609 *yuv2packed2 = yuv2argb32_full_2_c;
2610 *yuv2packed1 = yuv2argb32_full_1_c;
2612 #if CONFIG_SWSCALE_ALPHA 2614 *yuv2packedX = yuv2argb32_full_X_c;
2615 *yuv2packed2 = yuv2argb32_full_2_c;
2616 *yuv2packed1 = yuv2argb32_full_1_c;
2620 *yuv2packedX = yuv2xrgb32_full_X_c;
2621 *yuv2packed2 = yuv2xrgb32_full_2_c;
2622 *yuv2packed1 = yuv2xrgb32_full_1_c;
2628 *yuv2packedX = yuv2bgra32_full_X_c;
2629 *yuv2packed2 = yuv2bgra32_full_2_c;
2630 *yuv2packed1 = yuv2bgra32_full_1_c;
2632 #if CONFIG_SWSCALE_ALPHA 2634 *yuv2packedX = yuv2bgra32_full_X_c;
2635 *yuv2packed2 = yuv2bgra32_full_2_c;
2636 *yuv2packed1 = yuv2bgra32_full_1_c;
2640 *yuv2packedX = yuv2bgrx32_full_X_c;
2641 *yuv2packed2 = yuv2bgrx32_full_2_c;
2642 *yuv2packed1 = yuv2bgrx32_full_1_c;
2648 *yuv2packedX = yuv2abgr32_full_X_c;
2649 *yuv2packed2 = yuv2abgr32_full_2_c;
2650 *yuv2packed1 = yuv2abgr32_full_1_c;
2652 #if CONFIG_SWSCALE_ALPHA 2654 *yuv2packedX = yuv2abgr32_full_X_c;
2655 *yuv2packed2 = yuv2abgr32_full_2_c;
2656 *yuv2packed1 = yuv2abgr32_full_1_c;
2660 *yuv2packedX = yuv2xbgr32_full_X_c;
2661 *yuv2packed2 = yuv2xbgr32_full_2_c;
2662 *yuv2packed1 = yuv2xbgr32_full_1_c;
2667 #if CONFIG_SWSCALE_ALPHA 2669 *yuv2packedX = yuv2rgba64le_full_X_c;
2670 *yuv2packed2 = yuv2rgba64le_full_2_c;
2671 *yuv2packed1 = yuv2rgba64le_full_1_c;
2675 *yuv2packedX = yuv2rgbx64le_full_X_c;
2676 *yuv2packed2 = yuv2rgbx64le_full_2_c;
2677 *yuv2packed1 = yuv2rgbx64le_full_1_c;
2681 #if CONFIG_SWSCALE_ALPHA 2683 *yuv2packedX = yuv2rgba64be_full_X_c;
2684 *yuv2packed2 = yuv2rgba64be_full_2_c;
2685 *yuv2packed1 = yuv2rgba64be_full_1_c;
2689 *yuv2packedX = yuv2rgbx64be_full_X_c;
2690 *yuv2packed2 = yuv2rgbx64be_full_2_c;
2691 *yuv2packed1 = yuv2rgbx64be_full_1_c;
2695 #if CONFIG_SWSCALE_ALPHA 2697 *yuv2packedX = yuv2bgra64le_full_X_c;
2698 *yuv2packed2 = yuv2bgra64le_full_2_c;
2699 *yuv2packed1 = yuv2bgra64le_full_1_c;
2703 *yuv2packedX = yuv2bgrx64le_full_X_c;
2704 *yuv2packed2 = yuv2bgrx64le_full_2_c;
2705 *yuv2packed1 = yuv2bgrx64le_full_1_c;
2709 #if CONFIG_SWSCALE_ALPHA 2711 *yuv2packedX = yuv2bgra64be_full_X_c;
2712 *yuv2packed2 = yuv2bgra64be_full_2_c;
2713 *yuv2packed1 = yuv2bgra64be_full_1_c;
2717 *yuv2packedX = yuv2bgrx64be_full_X_c;
2718 *yuv2packed2 = yuv2bgrx64be_full_2_c;
2719 *yuv2packed1 = yuv2bgrx64be_full_1_c;
2724 *yuv2packedX = yuv2rgb24_full_X_c;
2725 *yuv2packed2 = yuv2rgb24_full_2_c;
2726 *yuv2packed1 = yuv2rgb24_full_1_c;
2729 *yuv2packedX = yuv2bgr24_full_X_c;
2730 *yuv2packed2 = yuv2bgr24_full_2_c;
2731 *yuv2packed1 = yuv2bgr24_full_1_c;
2734 *yuv2packedX = yuv2rgb48le_full_X_c;
2735 *yuv2packed2 = yuv2rgb48le_full_2_c;
2736 *yuv2packed1 = yuv2rgb48le_full_1_c;
2739 *yuv2packedX = yuv2bgr48le_full_X_c;
2740 *yuv2packed2 = yuv2bgr48le_full_2_c;
2741 *yuv2packed1 = yuv2bgr48le_full_1_c;
2744 *yuv2packedX = yuv2rgb48be_full_X_c;
2745 *yuv2packed2 = yuv2rgb48be_full_2_c;
2746 *yuv2packed1 = yuv2rgb48be_full_1_c;
2749 *yuv2packedX = yuv2bgr48be_full_X_c;
2750 *yuv2packed2 = yuv2bgr48be_full_2_c;
2751 *yuv2packed1 = yuv2bgr48be_full_1_c;
2754 *yuv2packedX = yuv2bgr4_byte_full_X_c;
2755 *yuv2packed2 = yuv2bgr4_byte_full_2_c;
2756 *yuv2packed1 = yuv2bgr4_byte_full_1_c;
2759 *yuv2packedX = yuv2rgb4_byte_full_X_c;
2760 *yuv2packed2 = yuv2rgb4_byte_full_2_c;
2761 *yuv2packed1 = yuv2rgb4_byte_full_1_c;
2764 *yuv2packedX = yuv2bgr8_full_X_c;
2765 *yuv2packed2 = yuv2bgr8_full_2_c;
2766 *yuv2packed1 = yuv2bgr8_full_1_c;
2769 *yuv2packedX = yuv2rgb8_full_X_c;
2770 *yuv2packed2 = yuv2rgb8_full_2_c;
2771 *yuv2packed1 = yuv2rgb8_full_1_c;
2802 if (!*yuv2packedX && !*yuv2anyX)
2806 switch (dstFormat) {
2808 #if CONFIG_SWSCALE_ALPHA 2810 *yuv2packed1 = yuv2rgba64le_1_c;
2811 *yuv2packed2 = yuv2rgba64le_2_c;
2812 *yuv2packedX = yuv2rgba64le_X_c;
2816 *yuv2packed1 = yuv2rgbx64le_1_c;
2817 *yuv2packed2 = yuv2rgbx64le_2_c;
2818 *yuv2packedX = yuv2rgbx64le_X_c;
2822 #if CONFIG_SWSCALE_ALPHA 2824 *yuv2packed1 = yuv2rgba64be_1_c;
2825 *yuv2packed2 = yuv2rgba64be_2_c;
2826 *yuv2packedX = yuv2rgba64be_X_c;
2830 *yuv2packed1 = yuv2rgbx64be_1_c;
2831 *yuv2packed2 = yuv2rgbx64be_2_c;
2832 *yuv2packedX = yuv2rgbx64be_X_c;
2836 #if CONFIG_SWSCALE_ALPHA 2838 *yuv2packed1 = yuv2bgra64le_1_c;
2839 *yuv2packed2 = yuv2bgra64le_2_c;
2840 *yuv2packedX = yuv2bgra64le_X_c;
2844 *yuv2packed1 = yuv2bgrx64le_1_c;
2845 *yuv2packed2 = yuv2bgrx64le_2_c;
2846 *yuv2packedX = yuv2bgrx64le_X_c;
2850 #if CONFIG_SWSCALE_ALPHA 2852 *yuv2packed1 = yuv2bgra64be_1_c;
2853 *yuv2packed2 = yuv2bgra64be_2_c;
2854 *yuv2packedX = yuv2bgra64be_X_c;
2858 *yuv2packed1 = yuv2bgrx64be_1_c;
2859 *yuv2packed2 = yuv2bgrx64be_2_c;
2860 *yuv2packedX = yuv2bgrx64be_X_c;
2864 *yuv2packed1 = yuv2rgb48le_1_c;
2865 *yuv2packed2 = yuv2rgb48le_2_c;
2866 *yuv2packedX = yuv2rgb48le_X_c;
2869 *yuv2packed1 = yuv2rgb48be_1_c;
2870 *yuv2packed2 = yuv2rgb48be_2_c;
2871 *yuv2packedX = yuv2rgb48be_X_c;
2874 *yuv2packed1 = yuv2bgr48le_1_c;
2875 *yuv2packed2 = yuv2bgr48le_2_c;
2876 *yuv2packedX = yuv2bgr48le_X_c;
2879 *yuv2packed1 = yuv2bgr48be_1_c;
2880 *yuv2packed2 = yuv2bgr48be_2_c;
2881 *yuv2packedX = yuv2bgr48be_X_c;
2886 *yuv2packed1 = yuv2rgb32_1_c;
2887 *yuv2packed2 = yuv2rgb32_2_c;
2888 *yuv2packedX = yuv2rgb32_X_c;
2890 #if CONFIG_SWSCALE_ALPHA 2892 *yuv2packed1 = yuv2rgba32_1_c;
2893 *yuv2packed2 = yuv2rgba32_2_c;
2894 *yuv2packedX = yuv2rgba32_X_c;
2898 *yuv2packed1 = yuv2rgbx32_1_c;
2899 *yuv2packed2 = yuv2rgbx32_2_c;
2900 *yuv2packedX = yuv2rgbx32_X_c;
2907 *yuv2packed1 = yuv2rgb32_1_1_c;
2908 *yuv2packed2 = yuv2rgb32_1_2_c;
2909 *yuv2packedX = yuv2rgb32_1_X_c;
2911 #if CONFIG_SWSCALE_ALPHA 2913 *yuv2packed1 = yuv2rgba32_1_1_c;
2914 *yuv2packed2 = yuv2rgba32_1_2_c;
2915 *yuv2packedX = yuv2rgba32_1_X_c;
2919 *yuv2packed1 = yuv2rgbx32_1_1_c;
2920 *yuv2packed2 = yuv2rgbx32_1_2_c;
2921 *yuv2packedX = yuv2rgbx32_1_X_c;
2926 *yuv2packed1 = yuv2rgb24_1_c;
2927 *yuv2packed2 = yuv2rgb24_2_c;
2928 *yuv2packedX = yuv2rgb24_X_c;
2931 *yuv2packed1 = yuv2bgr24_1_c;
2932 *yuv2packed2 = yuv2bgr24_2_c;
2933 *yuv2packedX = yuv2bgr24_X_c;
2939 *yuv2packed1 = yuv2rgb16_1_c;
2940 *yuv2packed2 = yuv2rgb16_2_c;
2941 *yuv2packedX = yuv2rgb16_X_c;
2947 *yuv2packed1 = yuv2rgb15_1_c;
2948 *yuv2packed2 = yuv2rgb15_2_c;
2949 *yuv2packedX = yuv2rgb15_X_c;
2955 *yuv2packed1 = yuv2rgb12_1_c;
2956 *yuv2packed2 = yuv2rgb12_2_c;
2957 *yuv2packedX = yuv2rgb12_X_c;
2961 *yuv2packed1 = yuv2rgb8_1_c;
2962 *yuv2packed2 = yuv2rgb8_2_c;
2963 *yuv2packedX = yuv2rgb8_X_c;
2967 *yuv2packed1 = yuv2rgb4_1_c;
2968 *yuv2packed2 = yuv2rgb4_2_c;
2969 *yuv2packedX = yuv2rgb4_X_c;
2973 *yuv2packed1 = yuv2rgb4b_1_c;
2974 *yuv2packed2 = yuv2rgb4b_2_c;
2975 *yuv2packedX = yuv2rgb4b_X_c;
2979 switch (dstFormat) {
2981 *yuv2packed1 = yuv2monowhite_1_c;
2982 *yuv2packed2 = yuv2monowhite_2_c;
2983 *yuv2packedX = yuv2monowhite_X_c;
2986 *yuv2packed1 = yuv2monoblack_1_c;
2987 *yuv2packed2 = yuv2monoblack_2_c;
2988 *yuv2packedX = yuv2monoblack_X_c;
2991 *yuv2packed1 = yuv2yuyv422_1_c;
2992 *yuv2packed2 = yuv2yuyv422_2_c;
2993 *yuv2packedX = yuv2yuyv422_X_c;
2996 *yuv2packed1 = yuv2yvyu422_1_c;
2997 *yuv2packed2 = yuv2yvyu422_2_c;
2998 *yuv2packedX = yuv2yvyu422_X_c;
3001 *yuv2packed1 = yuv2uyvy422_1_c;
3002 *yuv2packed2 = yuv2uyvy422_2_c;
3003 *yuv2packedX = yuv2uyvy422_X_c;
3011 *yuv2packed1 = yuv2ya16le_1_c;
3012 *yuv2packed2 = yuv2ya16le_2_c;
3013 *yuv2packedX = yuv2ya16le_X_c;
3016 *yuv2packed1 = yuv2ya16be_1_c;
3017 *yuv2packed2 = yuv2ya16be_2_c;
3018 *yuv2packedX = yuv2ya16be_X_c;
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
IEEE-754 single precision Y, 32bpp, big-endian.
planar GBR 4:4:4:4 40bpp, little-endian
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)
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)
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 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)
static int shift(int a, int b)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define YUVRGB_TABLE_HEADROOM
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)
8 bits gray, 8 bits alpha
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
packed RGB 8:8:8, 24bpp, RGBRGB...
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
#define accumulate_bit(acc, val)
static void yuv2rgb(uint8_t *out, int ridx, int Y, int U, int V)
const uint8_t ff_dither_2x2_8[][8]
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)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
static void yuv2p010l1_LE_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
uint8_t * table_bU[256+2 *YUVRGB_TABLE_HEADROOM]
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
Convenience header that includes libavutil's core.
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
planar GBR 4:4:4 36bpp, little-endian
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
#define AV_PIX_FMT_RGB444
planar GBR 4:4:4 36bpp, big-endian
const uint8_t ff_dither_8x8_220[][8]
static av_always_inline void yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW, int big_endian, int output_bits)
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)
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
#define output_pixels(pos, Y1, U, Y2, V)
Macro definitions for various function/variable attributes.
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
const uint8_t ff_dither_8x8_32[][8]
planar GBRA 4:4:4:4 64bpp, big-endian
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const uint8_t ff_dither_2x2_4[][8]
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
const uint8_t ff_dither_4x4_16[][8]
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
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)
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
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)
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined ...
#define SWS_FULL_CHR_H_INT
#define u(width, name, range_min, range_max)
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
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)
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 DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
planar GBR 4:4:4 48bpp, big-endian
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
static av_always_inline 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)
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)
enum AVPixelFormat dstFormat
Destination pixel format.
uint8_t * table_gU[256+2 *YUVRGB_TABLE_HEADROOM]
static void yuv2p010cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest8, int chrDstW)
static void yuv2p010l1_c(const int16_t *src, uint16_t *dest, int dstW, int big_endian)
#define yuv2planeX_float(template, dest_type, BE_LE)
planar GBR 4:4:4 27bpp, big-endian
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_BGR32_1
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)
16 bits gray, 16 bits alpha (big-endian)
like NV12, with 16bpp per component, big-endian
static void yuv2p010l1_BE_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
static const uint8_t dither[8][8]
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 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)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
simple assert() macros that are a bit more flexible than ISO C assert().
like NV12, with 16bpp per component, little-endian
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
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 const uint8_t offset[127][2]
static av_always_inline void yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW)
#define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t)
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
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)
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)
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
as above, but U and V bytes are swapped
planar GBR 4:4:4:4 48bpp, big-endian
static av_always_inline void yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src, float *dest, int dstW)
planar GBR 4:4:4:4 40bpp, big-endian
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
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)
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
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 av_always_inline void yuv2plane1_float_bswap_c_template(const int32_t *src, uint32_t *dest, int dstW)
static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
int table_gV[256+2 *YUVRGB_TABLE_HEADROOM]
packed RGB 8:8:8, 24bpp, BGRBGR...
uint8_t * table_rV[256+2 *YUVRGB_TABLE_HEADROOM]
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
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)
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
planar GBR 4:4:4:4 48bpp, little-endian
#define AV_PIX_FMT_BGR555
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
#define YUV2PACKED16WRAPPER(name, base, ext, fmt, hasAlpha, eightbytes)
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
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 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)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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)
planar GBR 4:4:4 30bpp, big-endian
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...
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)
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
planar GBR 4:4:4 42bpp, little-endian
const uint8_t ff_dither_8x8_73[][8]
as above, but U and V bytes are swapped
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
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)
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...
planar GBR 4:4:4 42bpp, big-endian
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)
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined ...
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)
static void yuv2p010lX_c(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, int big_endian)
static av_always_inline uint32_t av_float2int(float f)
Reinterpret a float as a 32-bit integer.
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)
#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha)
#define AV_PIX_FMT_BGR565
const uint8_t * chrDither8
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)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
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)
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
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)
#define CONFIG_SWSCALE_ALPHA
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
planar GBRA 4:4:4:4 32bpp
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)
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
planar GBR 4:4:4 27bpp, little-endian
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
#define AV_PIX_FMT_BGR444
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...
#define output_pixel(pos, val, bias, signedness)
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
#define AV_PIX_FMT_RGB555
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])
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
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 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 AV_PIX_FMT_RGB32_1
void(* yuv2interleavedX_fn)(struct SwsContext *c, 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 void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int chrDstW)
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)
16 bits gray, 16 bits alpha (little-endian)
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...
#define AV_PIX_FMT_RGB565
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
planar GBR 4:4:4 48bpp, little-endian
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined ...
#define yuv2plane1_float(template, dest_type, BE_LE)
static void yuv2p016cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest8, int chrDstW)
int depth
Number of bits in the component.
IEEE-754 single precision Y, 32bpp, little-endian.
planar GBRA 4:4:4:4 64bpp, little-endian
#define YUV2PACKEDWRAPPER(name, base, ext, fmt)
int flags
Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
AVPixelFormat
Pixel format.
static double val(void *priv, double ch)
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
planar GBR 4:4:4 30bpp, little-endian
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian