38#if CONFIG_SWSCALE_VULKAN
43 { 36, 68, 60, 92, 34, 66, 58, 90, },
44 { 100, 4, 124, 28, 98, 2, 122, 26, },
45 { 52, 84, 44, 76, 50, 82, 42, 74, },
46 { 116, 20, 108, 12, 114, 18, 106, 10, },
47 { 32, 64, 56, 88, 38, 70, 62, 94, },
48 { 96, 0, 120, 24, 102, 6, 126, 30, },
49 { 48, 80, 40, 72, 54, 86, 46, 78, },
50 { 112, 16, 104, 8, 118, 22, 110, 14, },
51 { 36, 68, 60, 92, 34, 66, 58, 90, },
55 64, 64, 64, 64, 64, 64, 64, 64
62 uint8_t *ptr = plane +
stride * y;
71 const int32_t *filterPos,
int filterSize)
76 const uint16_t *
src = (
const uint16_t *)
_src;
86 for (
i = 0;
i < dstW;
i++) {
88 int srcPos = filterPos[
i];
91 for (j = 0; j < filterSize; j++) {
101 const int32_t *filterPos,
int filterSize)
105 const uint16_t *
src = (
const uint16_t *)
_src;
106 int sh =
desc->comp[0].depth - 1;
114 for (
i = 0;
i < dstW;
i++) {
116 int srcPos = filterPos[
i];
119 for (j = 0; j < filterSize; j++) {
129 const uint8_t *
src,
const int16_t *
filter,
130 const int32_t *filterPos,
int filterSize)
133 for (
i = 0;
i < dstW;
i++) {
135 int srcPos = filterPos[
i];
137 for (j = 0; j < filterSize; j++) {
145 const uint8_t *
src,
const int16_t *
filter,
146 const int32_t *filterPos,
int filterSize)
150 for (
i = 0;
i < dstW;
i++) {
152 int srcPos = filterPos[
i];
154 for (j = 0; j < filterSize; j++) {
164 uint32_t _coeff,
int64_t _offset)
166 uint16_t coeff = _coeff;
170 int U = (dstU[
i] * coeff +
offset) >> 14;
171 int V = (dstV[
i] * coeff +
offset) >> 14;
172 dstU[
i] =
FFMIN(
U, (1 << 15) - 1);
173 dstV[
i] =
FFMIN(
V, (1 << 15) - 1);
178 uint32_t _coeff,
int64_t _offset)
180 uint16_t coeff = _coeff;
184 dstU[
i] = (dstU[
i] * coeff +
offset) >> 14;
185 dstV[
i] = (dstV[
i] * coeff +
offset) >> 14;
190 uint32_t _coeff,
int64_t _offset)
192 uint16_t coeff = _coeff;
202 uint32_t _coeff,
int64_t _offset)
204 uint16_t coeff = _coeff;
220 dstU[
i] =
FFMIN(
U, (1 << 19) - 1);
221 dstV[
i] =
FFMIN(
V, (1 << 19) - 1);
260 uint8_t *ptr = plane +
stride * y;
262 for (
int j = 0; j < 3 *
width; j++) {
263 unsigned v = big_endian ?
AV_RB16(ptr + 2 * j) :
AV_RL16(ptr + 2 * j);
264 v =
FFMIN(v + 8, UINT16_MAX) & 0xFFF0;
275#define DEBUG_SWSCALE_BUFFERS 0
276#define DEBUG_BUFFERS(...) \
277 if (DEBUG_SWSCALE_BUFFERS) \
278 av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
281 int srcSliceY,
int srcSliceH, uint8_t *
const dst[],
282 const int dstStride[],
int dstSliceY,
int dstSliceH)
284 const int scale_dst = dstSliceY > 0 || dstSliceH <
c->opts.dst_h;
288 const int dstW =
c->opts.dst_w;
289 int dstH =
c->opts.dst_h;
292 const int flags =
c->opts.flags;
293 int32_t *vLumFilterPos =
c->vLumFilterPos;
294 int32_t *vChrFilterPos =
c->vChrFilterPos;
296 const int vLumFilterSize =
c->vLumFilterSize;
297 const int vChrFilterSize =
c->vChrFilterSize;
306 const int chrSrcSliceY = srcSliceY >>
c->chrSrcVSubSample;
307 const int chrSrcSliceH =
AV_CEIL_RSHIFT(srcSliceH,
c->chrSrcVSubSample);
308 int should_dither =
isNBPS(
c->opts.src_format) ||
314 int lastInLumBuf =
c->lastInLumBuf;
315 int lastInChrBuf =
c->lastInChrBuf;
318 int lumEnd =
c->descIndex[0];
319 int chrStart = lumEnd;
320 int chrEnd =
c->descIndex[1];
322 int vEnd =
c->numDesc;
323 SwsSlice *src_slice = &
c->slice[lumStart];
324 SwsSlice *hout_slice = &
c->slice[
c->numSlice-2];
325 SwsSlice *vout_slice = &
c->slice[
c->numSlice-1];
328 int needAlpha =
c->needAlpha;
333 const uint8_t *
src2[4];
344 srcStride2[3] = srcStride[0];
347 memcpy(srcStride2, srcStride,
sizeof(srcStride2));
350 srcStride2[1] *= 1 <<
c->vChrDrop;
351 srcStride2[2] *= 1 <<
c->vChrDrop;
353 DEBUG_BUFFERS(
"swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
354 src2[0], srcStride2[0],
src2[1], srcStride2[1],
355 src2[2], srcStride2[2],
src2[3], srcStride2[3],
356 dst[0], dstStride[0],
dst[1], dstStride[1],
357 dst[2], dstStride[2],
dst[3], dstStride[3]);
358 DEBUG_BUFFERS(
"srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
359 srcSliceY, srcSliceH, dstY, dstH);
361 vLumFilterSize, vChrFilterSize);
363 if (dstStride[0]&15 || dstStride[1]&15 ||
364 dstStride[2]&15 || dstStride[3]&15) {
369 "Warning: dstStride is not aligned!\n"
370 " ->cannot do aligned memory accesses anymore\n");
375 if ( (uintptr_t)
dst[0]&15 || (uintptr_t)
dst[1]&15 || (uintptr_t)
dst[2]&15
376 || (uintptr_t)
src2[0]&15 || (uintptr_t)
src2[1]&15 || (uintptr_t)
src2[2]&15
377 || srcStride2[0]&15 || srcStride2[1]&15 || srcStride2[2]&15 || srcStride2[3]&15
390 dstH = dstY + dstSliceH;
393 }
else if (srcSliceY == 0) {
402 if (!should_dither) {
408 yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX,
c->use_mmx_vfilter);
411 srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1);
414 dstY, dstSliceH, dstY >>
c->chrDstVSubSample,
416 if (srcSliceY == 0) {
426 hout_slice->
width = dstW;
429 for (; dstY < dstH; dstY++) {
430 const int chrDstY = dstY >>
c->chrDstVSubSample;
431 int use_mmx_vfilter=
c->use_mmx_vfilter;
434 const int firstLumSrcY =
FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]);
435 const int firstLumSrcY2 =
FFMAX(1 - vLumFilterSize, vLumFilterPos[
FFMIN(dstY | ((1 <<
c->chrDstVSubSample) - 1),
c->opts.dst_h - 1)]);
437 const int firstChrSrcY =
FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);
440 int lastLumSrcY =
FFMIN(
c->opts.src_h, firstLumSrcY + vLumFilterSize) - 1;
441 int lastLumSrcY2 =
FFMIN(
c->opts.src_h, firstLumSrcY2 + vLumFilterSize) - 1;
442 int lastChrSrcY =
FFMIN(
c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1;
446 int posY, cPosY, firstPosY, lastPosY, firstCPosY, lastCPosY;
449 if (firstLumSrcY > lastInLumBuf) {
451 hasLumHoles = lastInLumBuf != firstLumSrcY - 1;
459 lastInLumBuf = firstLumSrcY - 1;
461 if (firstChrSrcY > lastInChrBuf) {
463 hasChrHoles = lastInChrBuf != firstChrSrcY - 1;
471 lastInChrBuf = firstChrSrcY - 1;
475 DEBUG_BUFFERS(
"\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
476 firstLumSrcY, lastLumSrcY, lastInLumBuf);
477 DEBUG_BUFFERS(
"\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n",
478 firstChrSrcY, lastChrSrcY, lastInChrBuf);
481 enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH &&
482 lastChrSrcY <
AV_CEIL_RSHIFT(srcSliceY + srcSliceH,
c->chrSrcVSubSample);
485 lastLumSrcY = srcSliceY + srcSliceH - 1;
486 lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1;
487 DEBUG_BUFFERS(
"buffering slice: lastLumSrcY %d lastChrSrcY %d\n",
488 lastLumSrcY, lastChrSrcY);
496 if (posY <= lastLumSrcY && !hasLumHoles) {
497 firstPosY =
FFMAX(firstLumSrcY, posY);
501 lastPosY = lastLumSrcY;
505 if (cPosY <= lastChrSrcY && !hasChrHoles) {
506 firstCPosY =
FFMAX(firstChrSrcY, cPosY);
510 lastCPosY = lastChrSrcY;
515 if (posY < lastLumSrcY + 1) {
516 for (
i = lumStart;
i < lumEnd; ++
i)
520 lastInLumBuf = lastLumSrcY;
522 if (cPosY < lastChrSrcY + 1) {
523 for (
i = chrStart;
i < chrEnd; ++
i)
527 lastInChrBuf = lastChrSrcY;
532#if ARCH_X86 && HAVE_MMX
534 c->dstW_mmx =
c->opts.dst_w;
540 if (dstY >=
c->opts.dst_h - 2) {
544 &yuv2packed1, &yuv2packed2, &yuv2packedX, &yuv2anyX);
547 yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, use_mmx_vfilter);
550 for (
i = vStart;
i < vEnd; ++
i)
554 int offset = lastDstY - dstSliceY;
556 int height = dstY - lastDstY;
561 1,
desc->comp[3].depth,
563 }
else if (
is32BPS(dstFormat)) {
566 1,
desc->comp[3].depth,
573 if (
c->srcXYZ &&
c->dstXYZ)
574 round_xyz12(
dst[0], dstStride[0], dstW, dstY - lastDstY, lastDstY - dstSliceY,
577#if HAVE_MMXEXT_INLINE
579 __asm__ volatile (
"sfence" :::
"memory");
585 c->lastInLumBuf = lastInLumBuf;
586 c->lastInChrBuf = lastInChrBuf;
588 return dstY - lastDstY;
600 uint16_t dst_min, uint16_t dst_max,
601 uint16_t src_ref, uint16_t dst_ref,
602 int src_bits,
int src_shift,
int mult_shift,
605 uint16_t src_range = src_max - src_min;
606 uint16_t dst_range = dst_max - dst_min;
607 int total_shift = mult_shift + src_shift;
608 *coeff =
AV_CEIL_RSHIFT(((uint64_t) dst_range << total_shift) / src_range, src_shift);
610 ((
int64_t) src_ref << src_shift) * *coeff +
611 (1U << (mult_shift - 1));
617 const int src_bits =
bit_depth <= 14 ? 15 : 19;
618 const int src_shift = src_bits -
bit_depth;
619 const int mult_shift =
bit_depth <= 14 ? 14 : 18;
620 const uint16_t mpeg_min = 16U << (
bit_depth - 8);
621 const uint16_t mpeg_max_lum = 235U << (
bit_depth - 8);
622 const uint16_t mpeg_max_chr = 240U << (
bit_depth - 8);
623 const uint16_t chr_center = 128U << (
bit_depth - 8);
624 const uint16_t jpeg_max = (1U <<
bit_depth) - 1;
625 uint16_t src_min, src_max_lum, src_max_chr;
626 uint16_t dst_min, dst_max_lum, dst_max_chr;
627 if (
c->opts.src_range) {
629 src_max_lum = jpeg_max;
630 src_max_chr = jpeg_max;
632 dst_max_lum = mpeg_max_lum;
633 dst_max_chr = mpeg_max_chr;
636 src_max_lum = mpeg_max_lum;
637 src_max_chr = mpeg_max_chr;
639 dst_max_lum = jpeg_max;
640 dst_max_chr = jpeg_max;
643 src_max_lum, dst_max_lum,
644 src_bits, src_shift, mult_shift,
645 &
c->lumConvertRange_coeff, &
c->lumConvertRange_offset);
647 chr_center, chr_center,
648 src_bits, src_shift, mult_shift,
649 &
c->chrConvertRange_coeff, &
c->chrConvertRange_offset);
654 c->lumConvertRange =
NULL;
655 c->chrConvertRange =
NULL;
656 if (
c->opts.src_range !=
c->opts.dst_range && !
isAnyRGB(
c->opts.dst_format)) {
658 if (
c->dstBpc <= 14) {
659 if (
c->opts.src_range) {
667 if (
c->opts.src_range) {
678#elif ARCH_LOONGARCH64
695 &
c->yuv2nv12cX, &
c->yuv2packed1,
696 &
c->yuv2packed2, &
c->yuv2packedX, &
c->yuv2anyX);
699 &
c->readLumPlanar, &
c->readAlpPlanar, &
c->readChrPlanar);
701 if (
c->srcBpc == 8) {
702 if (
c->dstBpc <= 14) {
720 c->needs_hcscale = 1;
735#elif ARCH_LOONGARCH64
755 const int linesizes[4],
int h)
762 for (
i = 0;
i < 4;
i++) {
763 int plane =
desc->comp[
i].plane;
764 if (!
data[plane] || !linesizes[plane] ||
FFABS((
int64_t)linesizes[plane]) *
h > INT_MAX)
772 const uint8_t *
src,
int src_stride,
int w,
int h)
776 for (
int yp = 0; yp <
h; yp++) {
777 const uint16_t *src16 = (
const uint16_t *)
src;
778 uint16_t *dst16 = (uint16_t *)
dst;
780 for (
int xp = 0; xp < 3 *
w; xp += 3) {
781 int x, y, z,
r,
g,
b;
793 x =
c->xyz2rgb.gamma.in[x >> 4];
794 y =
c->xyz2rgb.gamma.in[y >> 4];
795 z =
c->xyz2rgb.gamma.in[z >> 4];
798 r =
c->xyz2rgb.mat[0][0] * x +
799 c->xyz2rgb.mat[0][1] * y +
800 c->xyz2rgb.mat[0][2] * z >> 12;
801 g =
c->xyz2rgb.mat[1][0] * x +
802 c->xyz2rgb.mat[1][1] * y +
803 c->xyz2rgb.mat[1][2] * z >> 12;
804 b =
c->xyz2rgb.mat[2][0] * x +
805 c->xyz2rgb.mat[2][1] * y +
806 c->xyz2rgb.mat[2][2] * z >> 12;
815 AV_WB16(dst16 + xp + 0,
c->xyz2rgb.gamma.out[
r] << 4);
816 AV_WB16(dst16 + xp + 1,
c->xyz2rgb.gamma.out[
g] << 4);
817 AV_WB16(dst16 + xp + 2,
c->xyz2rgb.gamma.out[
b] << 4);
819 AV_WL16(dst16 + xp + 0,
c->xyz2rgb.gamma.out[
r] << 4);
820 AV_WL16(dst16 + xp + 1,
c->xyz2rgb.gamma.out[
g] << 4);
821 AV_WL16(dst16 + xp + 2,
c->xyz2rgb.gamma.out[
b] << 4);
831 const uint8_t *
src,
int src_stride,
int w,
int h)
835 for (
int yp = 0; yp <
h; yp++) {
836 uint16_t *src16 = (uint16_t *)
src;
837 uint16_t *dst16 = (uint16_t *)
dst;
839 for (
int xp = 0; xp < 3 *
w; xp += 3) {
840 int x, y, z,
r,
g,
b;
852 r =
c->rgb2xyz.gamma.in[
r >> 4];
853 g =
c->rgb2xyz.gamma.in[
g >> 4];
854 b =
c->rgb2xyz.gamma.in[
b >> 4];
857 x =
c->rgb2xyz.mat[0][0] *
r +
858 c->rgb2xyz.mat[0][1] *
g +
859 c->rgb2xyz.mat[0][2] *
b >> 12;
860 y =
c->rgb2xyz.mat[1][0] *
r +
861 c->rgb2xyz.mat[1][1] *
g +
862 c->rgb2xyz.mat[1][2] *
b >> 12;
863 z =
c->rgb2xyz.mat[2][0] *
r +
864 c->rgb2xyz.mat[2][1] *
g +
865 c->rgb2xyz.mat[2][2] *
b >> 12;
874 AV_WB16(dst16 + xp + 0,
c->rgb2xyz.gamma.out[x] << 4);
875 AV_WB16(dst16 + xp + 1,
c->rgb2xyz.gamma.out[y] << 4);
876 AV_WB16(dst16 + xp + 2,
c->rgb2xyz.gamma.out[z] << 4);
878 AV_WL16(dst16 + xp + 0,
c->rgb2xyz.gamma.out[x] << 4);
879 AV_WL16(dst16 + xp + 1,
c->rgb2xyz.gamma.out[y] << 4);
880 AV_WL16(dst16 + xp + 2,
c->rgb2xyz.gamma.out[z] << 4);
901 uint32_t *
rgb2yuv =
c->input_rgb2yuv_table;
907 for (
int i = 0;
i < 256;
i++) {
908 int r,
g,
b, y,
u, v,
a = 0xff;
911 a = (p >> 24) & 0xFF;
912 r = (p >> 16) & 0xFF;
917 g = ((
i >> 2) & 7) * 36;
921 g = ((
i >> 3) & 7) * 36;
924 r = (
i >> 3 ) * 255;
925 g = ((
i >> 1) & 3) * 85;
931 b = (
i >> 3 ) * 255;
932 g = ((
i >> 1) & 3) * 85;
940 c->pal_yuv[
i]= y + (
u<<8) + (v<<16) + ((unsigned)
a<<24);
942 switch (
c->opts.dst_format) {
947 c->pal_rgb[
i]=
r + (
g<<8) + (
b<<16) + ((unsigned)
a<<24);
953 c->pal_rgb[
i]=
a + (
r<<8) + (
g<<16) + ((unsigned)
b<<24);
959 c->pal_rgb[
i]=
a + (
b<<8) + (
g<<16) + ((unsigned)
r<<24);
964 c->pal_rgb[
i]=
a + (
r<<8) + (
b<<16) + ((unsigned)
g<<24);
966 c->pal_rgb[
i]=
g + (
b<<8) + (
r<<16) + ((unsigned)
a<<24);
974 c->pal_rgb[
i]=
b + (
g<<8) + (
r<<16) + ((unsigned)
a<<24);
980 const uint8_t *
const srcSlice[],
const int srcStride[],
981 int srcSliceY,
int srcSliceH,
982 uint8_t *
const dstSlice[],
const int dstStride[],
983 int dstSliceY,
int dstSliceH);
986 const uint8_t *
const srcSlice[],
const int srcStride[],
987 int srcSliceY,
int srcSliceH,
988 uint8_t *
const dstSlice[],
const int dstStride[],
989 int dstSliceY,
int dstSliceH)
992 srcSlice, srcStride, srcSliceY, srcSliceH,
993 c->cascaded_tmp[0],
c->cascaded_tmpStride[0], 0,
c->opts.src_h);
998 if (
c->cascaded_context[2])
1000 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
1001 c->cascaded_tmp[1],
c->cascaded_tmpStride[1], 0,
c->opts.dst_h);
1004 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
1005 dstSlice, dstStride, dstSliceY, dstSliceH);
1010 if (
c->cascaded_context[2]) {
1013 c->cascaded_tmpStride[1], dstY1 -
ret, dstY1,
1014 dstSlice, dstStride, dstSliceY, dstSliceH);
1020 const uint8_t *
const srcSlice[],
const int srcStride[],
1021 int srcSliceY,
int srcSliceH,
1022 uint8_t *
const dstSlice[],
const int dstStride[],
1023 int dstSliceY,
int dstSliceH)
1025 const int dstH0 =
c->cascaded_context[0]->dst_h;
1027 srcSlice, srcStride, srcSliceY, srcSliceH,
1028 c->cascaded_tmp[0],
c->cascaded_tmpStride[0],
1043 (
const uint8_t *
const * )
c->cascaded_tmp[0],
c->cascaded_tmpStride[0],
1044 0, dstH0, dstSlice, dstStride, dstSliceY, dstSliceH);
1049 const uint8_t *
const srcSlice[],
const int srcStride[],
1050 int srcSliceY,
int srcSliceH,
1051 uint8_t *
const dstSlice[],
const int dstStride[],
1052 int dstSliceY,
int dstSliceH)
1055 const int scale_dst = dstSliceY > 0 || dstSliceH < sws->
dst_h;
1058 const uint8_t *
src2[4];
1065 int srcSliceY_internal = srcSliceY;
1067 if (!srcStride || !dstStride || !dstSlice || !srcSlice) {
1068 av_log(
c,
AV_LOG_ERROR,
"One of the input parameters to sws_scale() is NULL, please check the calling code\n");
1072 if ((srcSliceY & (macro_height_src - 1)) ||
1073 ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != sws->
src_h) ||
1074 srcSliceY + srcSliceH > sws->
src_h ||
1082 if ((dstSliceY & (macro_height_dst - 1)) ||
1083 ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != sws->
dst_h) ||
1084 dstSliceY + dstSliceH > sws->
dst_h) {
1103 return scale_gamma(
c, srcSlice, srcStride, srcSliceY, srcSliceH,
1104 dstSlice, dstStride, dstSliceY, dstSliceH);
1106 if (
c->cascaded_context[0])
1108 dstSlice, dstStride, dstSliceY, dstSliceH);
1111 for (
i = 0;
i < 4;
i++)
1112 memset(
c->dither_error[
i], 0,
sizeof(
c->dither_error[0][0]) * (sws->
dst_w+2));
1117 memcpy(
src2, srcSlice,
sizeof(
src2));
1118 memcpy(dst2, dstSlice,
sizeof(dst2));
1119 memcpy(srcStride2, srcStride,
sizeof(srcStride2));
1120 memcpy(dstStride2, dstStride,
sizeof(dstStride2));
1123 if (srcSliceY != 0 && srcSliceY + srcSliceH != sws->
src_h) {
1128 c->sliceDir = (srcSliceY == 0) ? 1 : -1;
1129 }
else if (scale_dst)
1138 if (!
c->rgb0_scratch)
1141 base = srcStride[0] < 0 ?
c->rgb0_scratch - srcStride[0] * (srcSliceH-1) :
1143 for (y=0; y<srcSliceH; y++){
1144 memcpy(
base + srcStride[0]*y,
src2[0] + srcStride[0]*y, 4*sws->
src_w);
1145 for (x=
c->src0Alpha-1; x<4*sws->src_w; x+=4) {
1146 base[ srcStride[0]*y + x] = 0xFF;
1152 if (
c->srcXYZ && !
c->dstXYZ) {
1157 if (!
c->xyz_scratch)
1160 base = srcStride[0] < 0 ?
c->xyz_scratch - srcStride[0] * (srcSliceH-1) :
1163 c->xyz12Torgb48(
c,
base, srcStride[0],
src2[0], srcStride[0], sws->
src_w, srcSliceH);
1167 if (
c->sliceDir != 1) {
1169 for (
i=0;
i<4;
i++) {
1170 srcStride2[
i] *= -1;
1171 dstStride2[
i] *= -1;
1174 src2[0] += (srcSliceH - 1) * srcStride[0];
1176 src2[1] += ((srcSliceH >>
c->chrSrcVSubSample) - 1) * srcStride[1];
1177 src2[2] += ((srcSliceH >>
c->chrSrcVSubSample) - 1) * srcStride[2];
1178 src2[3] += (srcSliceH - 1) * srcStride[3];
1179 dst2[0] += ( sws->
dst_h - 1) * dstStride[0];
1180 dst2[1] += ((sws->
dst_h >>
c->chrDstVSubSample) - 1) * dstStride[1];
1181 dst2[2] += ((sws->
dst_h >>
c->chrDstVSubSample) - 1) * dstStride[2];
1182 dst2[3] += ( sws->
dst_h - 1) * dstStride[3];
1184 srcSliceY_internal = sws->
src_h-srcSliceY-srcSliceH;
1189 if (
c->convert_unscaled) {
1190 int offset = srcSliceY_internal;
1191 int slice_h = srcSliceH;
1196 for (
i = 0;
i < 4 &&
src2[
i];
i++) {
1199 src2[
i] += (dstSliceY >> ((
i == 1 ||
i == 2) ?
c->chrSrcVSubSample : 0)) * srcStride2[
i];
1202 for (
i = 0;
i < 4 && dst2[
i];
i++) {
1205 dst2[
i] -= (dstSliceY >> ((
i == 1 ||
i == 2) ?
c->chrDstVSubSample : 0)) * dstStride2[
i];
1208 slice_h = dstSliceH;
1214 dst2[0] += dstSliceY * dstStride2[0];
1217 dst2, dstStride2, dstSliceY, dstSliceH);
1220 if (
c->dstXYZ && !
c->srcXYZ) {
1226 int dstY =
c->dstY ?
c->dstY : srcSliceY + srcSliceH;
1231 dst = dst2[0] + (dstY -
ret) * dstStride2[0];
1235 c->rgb48Toxyz12(
c,
dst, dstStride2[0],
dst, dstStride2[0], sws->
dst_w,
ret);
1239 if ((srcSliceY_internal + srcSliceH == sws->
src_h) || scale_dst)
1248 if (!
c->is_legacy_init)
1252 c->src_ranges.nb_ranges = 0;
1257 uintptr_t ptr_val = (uintptr_t) ptr;
1258 uintptr_t buf_start = (uintptr_t) buf->
data;
1259 return ptr_val >= buf_start && ptr_val < buf_start + buf->
size;
1268 for (
int i = 0;
i < 4;
i++) {
1269 const int idx = plane_copy[
i];
1273 uint8_t *src_data =
src->data[idx];
1286 dst->buf[nb_copied++] =
ref;
1289 dst->data[
i] = src_data;
1290 dst->linesize[
i] =
src->linesize[idx];
1307 while (
frame->buf[buf_start])
1311 for (
int i = 0;
i < 4 && pool->
pools[
i];
i++) {
1315 const int idx = buf_start + nb_bufs++;
1318 if (!
frame->buf[idx]) {
1332 int ret, allocated = 0;
1333 if (!
c->is_legacy_init)
1363 unsigned int slice_height)
1367 if (!
c->is_legacy_init)
1383 return c->dst_slice_align;
1387 unsigned int slice_height)
1392 if (!
c->is_legacy_init)
1396 if (!(
c->src_ranges.nb_ranges == 1 &&
1397 c->src_ranges.ranges[0].start == 0 &&
1398 c->src_ranges.ranges[0].len == sws->
src_h))
1401 if ((
slice_start > 0 || slice_height < sws->dst_h) &&
1404 "Incorrectly aligned output: %u/%u not multiples of %u\n",
1409 if (
c->slicethread) {
1410 int nb_jobs =
c->nb_slice_ctx;
1415 c->dst_slice_height = slice_height;
1421 ptrdiff_t
offset =
c->frame_dst->linesize[
i] * (ptrdiff_t)(
slice_start >>
c->chrDstVSubSample);
1425 return scale_internal(sws, (
const uint8_t *
const *)
c->frame_src->data,
1426 c->frame_src->linesize, 0, sws->
src_h,
1440 int ret, allocated = 0;
1445 if (
c->is_legacy_init) {
1469 av_log(sws,
AV_LOG_ERROR,
"Frame planes larger than INT_MAX bytes are not supported\n");
1479 memset(
dst->buf, 0,
sizeof(
dst->buf));
1480 memset(
dst->data, 0,
sizeof(
dst->data));
1481 memset(
dst->linesize, 0,
sizeof(
dst->linesize));
1482 dst->extended_data =
dst->data;
1487 memcpy(plane_copy, top->
plane_copy,
sizeof(plane_copy));
1508 for (
int field = 0; field < (bot ? 2 : 1); field++) {
1522#define VALIDATE(field, min, max) \
1523 if (ctx->field < min || ctx->field > max) { \
1524 av_log(ctx, AV_LOG_ERROR, "'%s' (%d) out of range [%d, %d]\n", \
1525 #field, (int) ctx->field, min, max); \
1526 return AVERROR(EINVAL); \
1547 const char *err_msg;
1562 if (src_is_hwaccel && !
src->hw_frames_ctx)
1564 if (dst_is_hwaccel && !
dst->hw_frames_ctx)
1568 if (src_is_hwaccel ^ dst_is_hwaccel) {
1570 }
else if (src_is_hwaccel) {
1572 if (!
src->data[0] || !
dst->data[0])
1589#if CONFIG_SWSCALE_VULKAN
1596 int dst_width =
dst->width;
1598 for (
int field = 0; field < 2; field++) {
1604 err_msg =
"Cannot convert interlaced to progressive frames or vice versa.\n";
1610 err_msg =
"Interlaced frames need at least two lines";
1617 err_msg =
"The bottom field has fewer chroma rows than its height requires";
1624 if ((!src_ok || !dst_ok) && !
ff_fmt_equal(&src_fmt, &dst_fmt)) {
1625 err_msg = src_ok ?
"Unsupported output" :
"Unsupported input";
1630 if (!
s->graph[field]) {
1632 if (!
s->graph[field]) {
1633 err_msg =
"Failed allocating scaling graph";
1641 err_msg =
"Failed initializing scaling graph";
1645 const SwsGraph *graph =
s->graph[field];
1647 err_msg =
"Incomplete scaling graph";
1656 dst_width =
FFMAX(dst_width, aligned_w);
1668 " fmt:%s csp:%s prim:%s trc:%s\n",
1681 if (!
dst->hw_frames_ctx) {
1696 const uint8_t *
const srcSlice[],
1697 const int srcStride[],
int srcSliceY,
1698 int srcSliceH, uint8_t *
const dst[],
1699 const int dstStride[])
1702 if (!
c->is_legacy_init)
1705 if (
c->nb_slice_ctx) {
1706 sws =
c->slice_ctx[0];
1710 return scale_internal(sws, srcSlice, srcStride, srcSliceY, srcSliceH,
1715 int nb_jobs,
int nb_threads)
1722 c->dst_slice_align);
1731 const int vshift = (
i == 1 ||
i == 2) ?
c->chrDstVSubSample : 0;
uint8_t ptrdiff_t const uint8_t * _src
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
av_cold void ff_sws_init_xyzdsp_aarch64(SwsInternal *c)
av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)
av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
static double val(void *priv, double ch)
static const char *const format[]
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
static AVFormatContext * ctx
av_cold void ff_sws_init_swscale_arm(SwsInternal *c)
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
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_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const uint8_t *BS_FUNC align(BSCTX *bc)
Skip bits to a byte boundary.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static void fn rgb2yuv(uint8_t *_yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t s, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static enum AVPixelFormat pix_fmt
static const uint8_t bits[8]
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
#define AV_NUM_DATA_POINTERS
int ff_sws_graph_run(SwsGraph *graph, const AVFrame *dst, const AVFrame *src)
Dispatch the filter graph on a single field of the given frames.
SwsGraph * ff_sws_graph_alloc(void)
Allocate an empty SwsGraph.
int ff_sws_pass_aligned_width(const SwsPass *pass, int width)
Align width to the optimal size for pass.
int ff_sws_graph_reinit(SwsGraph *graph, SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src)
Wrapper around ff_sws_graph_init() that reuses the existing graph if the format is compatible.
void ff_sws_graph_free(SwsGraph **pgraph)
Uninitialize any state associate with this filter graph and free it.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int sws_receive_slice(SwsContext *sws, unsigned int slice_start, unsigned int slice_height)
Request a horizontal slice of the output data to be written into the frame previously provided to sws...
int sws_scale_frame(SwsContext *sws, AVFrame *dst, const AVFrame *src)
Scale source data from src and write the output to dst.
int sws_send_slice(SwsContext *sws, unsigned int slice_start, unsigned int slice_height)
Indicate that a horizontal slice of input data is available in the source frame previously provided t...
unsigned int sws_receive_slice_alignment(const SwsContext *sws)
Get the alignment required for slices.
int attribute_align_arg sws_scale(SwsContext *sws, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
swscale wrapper, so we don't need to export the SwsContext.
int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
Like sws_scale_frame, but without actually scaling.
void sws_frame_end(SwsContext *sws)
Finish the scaling process for a pair of source/destination frames previously submitted with sws_fram...
int sws_frame_start(SwsContext *sws, AVFrame *dst, const AVFrame *src)
Initialize the scaling process for a given pair of source/destination frames.
@ SWS_INTENT_NB
not part of the ABI
@ SWS_SCALE_NB
not part of the ABI
@ SWS_PRINT_INFO
Emit verbose log of scaling parameters.
@ SWS_STRICT
Return an error on underspecified conversions.
@ SWS_FAST_BILINEAR
Scaler selection options.
void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
@ AV_HWDEVICE_TYPE_VULKAN
#define u(width, name, range_min, range_max)
size_t av_cpu_max_align(void)
Get the maximum data alignment that may be required by FFmpeg.
static atomic_int cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define AV_CPU_FLAG_SSE2
PIV SSE2 functions.
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
int ff_frame_pool_video_reinit(FFFramePool *pool, int width, int height, enum AVPixelFormat format, int align)
Recreate the video frame pool if its current configuration differs from the provided configuration.
#define FF_PTR_ADD(ptr, off)
#define attribute_align_arg
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
static void frame_start(MPVMainEncContext *const m)
av_cold void ff_sws_init_output_funcs(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX)
const char * av_color_space_name(enum AVColorSpace space)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ 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_GRAY8A
alias for AV_PIX_FMT_YA8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
@ 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_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
#define AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_BGR32_1
av_cold void ff_sws_init_swscale_ppc(SwsInternal *c)
av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
av_cold void ff_sws_init_swscale_riscv(SwsInternal *c)
#define FF_ARRAY_ELEMS(a)
int ff_rotate_slice(SwsSlice *s, int lum, int chr)
int ff_init_slice_from_src(SwsSlice *s, uint8_t *const src[4], const int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative)
int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
Execute slice threading.
#define atomic_exchange_explicit(object, desired, order)
A reference to a data buffer.
uint8_t * data
The data buffer.
size_t size
Size of data in bytes.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
This struct describes a set or pool of "hardware" frames (i.e.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... flags.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
enum AVColorPrimaries prim
enum AVColorTransferCharacteristic trc
Main external API structure.
int src_h
Width and height of the source frame.
int dst_format
Destination pixel format.
int gamma_flag
Use gamma correct scaling.
int dst_h
Width and height of the destination frame.
int src_w
Deprecated frame property overrides, for the legacy API only.
int src_format
Source pixel format.
SwsDither dither
Dither mode.
unsigned flags
Bitmask of SWS_*.
Struct which holds all necessary data for processing a slice.
Filter graph, which represents a 'baked' pixel format conversion.
SwsPass ** passes
Sorted sequence of filter passes to apply.
int plane_copy[4]
Map of planes which directly copied from the input.
int dstY
Last destination vertical line output from last slice.
int sliceDir
Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
unsigned int dst_slice_align
Represents a single filter pass in the scaling graph.
int available_lines
max number of lines that can be hold by this plane
int sliceY
index of first line
int sliceH
number of lines
Struct which defines a slice of an image to be scaled or an output for a scaled slice.
SwsPlane plane[MAX_SLICE_PLANES]
color planes
int width
Slice line width.
#define VALIDATE(field, min, max)
static void xyz12Torgb48_c(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h)
static int validate_params(SwsContext *ctx)
const uint8_t ff_dither_8x8_128[9][8]
static void hScale8To15_c(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
static av_cold void sws_init_swscale(SwsInternal *c)
void ff_sws_init_scale(SwsInternal *c)
static void lumRangeFromJpeg16_c(int16_t *_dst, int width, uint32_t coeff, int64_t offset)
int ff_sws_slice_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
static int check_image_pointers(const uint8_t *const data[4], enum AVPixelFormat pix_fmt, const int linesizes[4], int h)
int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[], int dstSliceY, int dstSliceH)
static int frame_alloc_buffers(SwsContext *sws, AVFrame *frame)
static int frame_strides_fit(const AVFrame *frame)
static void init_range_convert_constants(SwsInternal *c)
static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width, uint32_t _coeff, int64_t _offset)
static int frame_ref(AVFrame *dst, const AVFrame *src, const int plane_copy[4])
#define DEBUG_BUFFERS(...)
static void reset_ptr(const uint8_t *src[], enum AVPixelFormat format)
static void hScale8To19_c(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
static int scale_gamma(SwsInternal *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH)
static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width, uint32_t _coeff, int64_t _offset)
static int scale_internal(SwsContext *sws, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH)
static void lumRangeToJpeg16_c(int16_t *_dst, int width, uint32_t coeff, int64_t offset)
static av_always_inline void fillPlane(uint8_t *plane, int stride, int width, int height, int y, uint8_t val)
static void hScale16To19_c(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width, uint32_t coeff, int64_t offset)
static int scale_cascaded(SwsInternal *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH)
av_cold void ff_sws_init_range_convert(SwsInternal *c)
static int bottom_field_fits(const AVFrame *frame, const SwsFormat *field)
static void hScale16To15_c(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
av_cold void ff_sws_init_xyzdsp(SwsInternal *c)
static void rgb48Toxyz12_c(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h)
static void solve_range_convert(uint16_t src_min, uint16_t src_max, uint16_t dst_min, uint16_t dst_max, uint16_t src_ref, uint16_t dst_ref, int src_bits, int src_shift, int mult_shift, uint32_t *coeff, int64_t *offset)
static int ptr_in_buf(const uint8_t *ptr, const AVBufferRef *buf)
static void round_xyz12(uint8_t *plane, int stride, int width, int height, int y, int big_endian)
static const uint8_t sws_pb_64[8]
void ff_update_palette(SwsInternal *c, const uint32_t *pal)
static void lumRangeToJpeg_c(int16_t *dst, int width, uint32_t _coeff, int64_t _offset)
static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width, uint32_t coeff, int64_t offset)
static void lumRangeFromJpeg_c(int16_t *dst, int width, uint32_t _coeff, int64_t _offset)
av_cold void ff_sws_init_swscale_loongarch(SwsInternal *c)
av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2, yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx)
setup vertical scaler functions
void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
void(* yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional v...
void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output with multi-point vertical scaling between...
int ff_range_add(RangeList *r, unsigned int start, unsigned int len)
static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y, int alpha, int bits, const int big_endian)
static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
void(* yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point ver...
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
void ff_sws_init_swscale_x86(SwsInternal *c)
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
SwsBackend ff_sws_enabled_backends(const SwsContext *ctx)
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
static av_always_inline int isGray(enum AVPixelFormat pix_fmt)
static SwsInternal * sws_internal(const SwsContext *sws)
static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
av_cold void ff_sws_init_range_convert_x86(SwsInternal *c)
void(* yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to YUV/RGB output by doing multi-point vertical scaling...
static void fillPlane32(uint8_t *plane, int stride, int width, int height, int y, int alpha, int bits, const int big_endian, int is_float)
static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
void ff_sws_init_input_funcs(SwsInternal *c, planar1_YV12_fn *lumToYV12, planar1_YV12_fn *alpToYV12, planar2_YV12_fn *chrToYV12, planarX_YV12_fn *readLumPlanar, planarX_YV12_fn *readAlpPlanar, planarX2_YV12_fn *readChrPlanar)
void(* yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scalin...
void(* yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling ...
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
static av_always_inline int is32BPS(enum AVPixelFormat pix_fmt)
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
static void FUNC yuv2planeX(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static int ref[MAX_W *MAX_W]
static const Backend backends[]
static const uint16_t dither[8][8]
static void process(NormalizeContext *s, AVFrame *in, AVFrame *out)
int ff_sws_vk_init(SwsContext *sws, AVBufferRef *dev_ref)
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)