23 #define _SVID_SOURCE // needed for MAP_ANONYMOUS
24 #define _DARWIN_C_SOURCE // needed for MAP_ANON
31 #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
32 #define MAP_ANONYMOUS MAP_ANON
36 #define WIN32_LEAN_AND_MEAN
40 #include "libavutil/attributes.h"
41 #include "libavutil/avassert.h"
42 #include "libavutil/avutil.h"
43 #include "libavutil/bswap.h"
44 #include "libavutil/cpu.h"
45 #include "libavutil/intreadwrite.h"
46 #include "libavutil/mathematics.h"
47 #include "libavutil/opt.h"
48 #include "libavutil/pixdesc.h"
71 #define LICENSE_PREFIX "libswscale license: "
75 #define RET 0xC3 // near return opcode for x86
230 #if FF_API_SWS_FORMAT_NAME
237 return "Unknown format";
245 return ((d * dist + c) * dist + b) * dist +
a;
248 b + 2.0 * c + 3.0 * d,
250 -b - 3.0 * c - 6.0 * d,
257 pos = (128 << chr_subsample) - 128;
260 return pos >> chr_subsample;
264 int *outFilterSize,
int xInc,
int srcW,
265 int dstW,
int filterAlign,
int one,
268 double param[2],
int srcPos,
int dstPos)
275 int64_t *filter2 = NULL;
276 const int64_t fone = 1LL << (54 -
FFMIN(
av_log2(srcW/dstW), 8));
284 if (
FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) {
288 dstW *
sizeof(*filter) * filterSize,
fail);
290 for (i = 0; i < dstW; i++) {
291 filter[i * filterSize] = fone;
299 dstW *
sizeof(*filter) * filterSize,
fail);
301 xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
302 for (i = 0; i < dstW; i++) {
303 int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
305 (*filterPos)[i] = xx;
309 }
else if ((xInc <= (1 << 16) && (flags &
SWS_AREA)) ||
315 dstW *
sizeof(*filter) * filterSize,
fail);
317 xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
318 for (i = 0; i < dstW; i++) {
319 int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
322 (*filterPos)[i] = xx;
324 for (j = 0; j < filterSize; j++) {
325 int64_t
coeff= fone -
FFABS(((int64_t)xx<<16) - xDstInSrc)*(fone>>16);
328 filter[i * filterSize + j] =
coeff;
339 else if (flags &
SWS_X)
358 filterSize = 1 + sizeFactor;
360 filterSize = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
362 filterSize =
FFMIN(filterSize, srcW - 2);
363 filterSize =
FFMAX(filterSize, 1);
366 dstW *
sizeof(*filter) * filterSize,
fail);
368 xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);
369 for (i = 0; i < dstW; i++) {
370 int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
372 (*filterPos)[i] = xx;
373 for (j = 0; j < filterSize; j++) {
374 int64_t d = (
FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;
380 floatd = d * (1.0 / (1 << 30));
382 if (flags & SWS_BICUBIC) {
386 if (d >= 1LL << 31) {
389 int64_t dd = (d * d) >> 30;
390 int64_t ddd = (dd * d) >> 30;
393 coeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +
394 (-18 * (1 << 24) + 12 * B + 6 * C) * dd +
395 (6 * (1 << 24) - 2 * B) * (1 << 30);
397 coeff = (-B - 6 *
C) * ddd +
398 (6 * B + 30 * C) * dd +
399 (-12 * B - 48 *
C) * d +
400 (8 * B + 24 * C) * (1 << 30);
402 coeff /= (1LL<<54)/fone;
405 else if (flags & SWS_X) {
406 double p = param ? param * 0.01 : 0.3;
407 coeff = d ? sin(d *
M_PI) / (d *
M_PI) : 1.0;
408 coeff *= pow(2.0, -p * d * d);
411 else if (flags & SWS_X) {
416 c = cos(floatd *
M_PI);
423 coeff = (c * 0.5 + 0.5) * fone;
424 }
else if (flags & SWS_AREA) {
425 int64_t d2 = d - (1 << 29);
426 if (d2 * xInc < -(1LL << (29 + 16)))
427 coeff = 1.0 * (1LL << (30 + 16));
428 else if (d2 * xInc < (1LL << (29 + 16)))
429 coeff = -d2 * xInc + (1LL << (29 + 16));
432 coeff *= fone >> (30 + 16);
433 }
else if (flags & SWS_GAUSS) {
435 coeff = (pow(2.0, -p * floatd * floatd)) * fone;
436 }
else if (flags & SWS_SINC) {
437 coeff = (d ? sin(floatd *
M_PI) / (floatd *
M_PI) : 1.0) * fone;
438 }
else if (flags & SWS_LANCZOS) {
440 coeff = (d ? sin(floatd *
M_PI) * sin(floatd * M_PI / p) /
441 (floatd * floatd * M_PI * M_PI / p) : 1.0) * fone;
444 }
else if (flags & SWS_BILINEAR) {
445 coeff = (1 << 30) - d;
449 }
else if (flags & SWS_SPLINE) {
450 double p = -2.196152422706632;
456 filter[i * filterSize + j] =
coeff;
459 xDstInSrc += 2 * xInc;
467 filter2Size = filterSize;
469 filter2Size += srcFilter->
length - 1;
471 filter2Size += dstFilter->
length - 1;
475 for (i = 0; i < dstW; i++) {
479 for (k = 0; k < srcFilter->
length; k++) {
480 for (j = 0; j < filterSize; j++)
481 filter2[i * filter2Size + k + j] +=
482 srcFilter->
coeff[k] * filter[i * filterSize + j];
485 for (j = 0; j < filterSize; j++)
486 filter2[i * filter2Size + j] = filter[i * filterSize + j];
490 (*filterPos)[i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
497 for (i = dstW - 1; i >= 0; i--) {
498 int min = filter2Size;
500 int64_t cutOff = 0.0;
503 for (j = 0; j < filter2Size; j++) {
505 cutOff +=
FFABS(filter2[i * filter2Size]);
512 if (i < dstW - 1 && (*filterPos)[i] >= (*filterPos)[i + 1])
516 for (k = 1; k < filter2Size; k++)
517 filter2[i * filter2Size + k - 1] = filter2[i * filter2Size + k];
518 filter2[i * filter2Size + k - 1] = 0;
524 for (j = filter2Size - 1; j > 0; j--) {
525 cutOff +=
FFABS(filter2[i * filter2Size + j]);
532 if (min > minFilterSize)
538 if (minFilterSize < 5)
544 if (minFilterSize < 3)
550 if (minFilterSize == 1 && filterAlign == 2)
555 filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
557 filter =
av_malloc(filterSize * dstW *
sizeof(*filter));
560 av_log(NULL,
AV_LOG_ERROR,
"sws: filterSize %d is too large, try less extreem scaling or increase MAX_FILTER_SIZE and recompile\n", filterSize);
563 *outFilterSize = filterSize;
567 "SwScaler: reducing / aligning filtersize %d -> %d\n",
568 filter2Size, filterSize);
570 for (i = 0; i < dstW; i++) {
573 for (j = 0; j < filterSize; j++) {
574 if (j >= filter2Size)
575 filter[i * filterSize + j] = 0;
577 filter[i * filterSize + j] = filter2[i * filter2Size + j];
579 filter[i * filterSize + j] = 0;
586 for (i = 0; i < dstW; i++) {
588 if ((*filterPos)[i] < 0) {
590 for (j = 1; j < filterSize; j++) {
591 int left =
FFMAX(j + (*filterPos)[i], 0);
592 filter[i * filterSize + left] += filter[i * filterSize + j];
593 filter[i * filterSize + j] = 0;
598 if ((*filterPos)[i] + filterSize > srcW) {
599 int shift = (*filterPos)[i] + filterSize - srcW;
601 for (j = filterSize - 2; j >= 0; j--) {
602 int right =
FFMIN(j + shift, filterSize - 1);
603 filter[i * filterSize + right] += filter[i * filterSize + j];
604 filter[i * filterSize + j] = 0;
606 (*filterPos)[i]= srcW - filterSize;
613 *outFilterSize * (dstW + 3) *
sizeof(int16_t),
fail);
616 for (i = 0; i < dstW; i++) {
621 for (j = 0; j < filterSize; j++) {
622 sum += filter[i * filterSize + j];
624 sum = (sum + one / 2) / one;
629 for (j = 0; j < *outFilterSize; j++) {
630 int64_t
v = filter[i * filterSize + j] + error;
632 (*outFilter)[i * (*outFilterSize) + j] = intV;
633 error = v - intV * sum;
637 (*filterPos)[dstW + 0] =
638 (*filterPos)[dstW + 1] =
639 (*filterPos)[dstW + 2] = (*filterPos)[dstW - 1];
641 for (i = 0; i < *outFilterSize; i++) {
642 int k = (dstW - 1) * (*outFilterSize) + i;
643 (*outFilter)[k + 1 * (*outFilterSize)] =
644 (*outFilter)[k + 2 * (*outFilterSize)] =
645 (*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
658 #if HAVE_MMXEXT_INLINE
659 static av_cold int init_hscaler_mmxext(
int dstW,
int xInc,
uint8_t *filterCode,
688 "movq (%%"REG_d
", %%"REG_a
"), %%mm3 \n\t"
689 "movd (%%"REG_c
", %%"REG_S
"), %%mm0 \n\t"
690 "movd 1(%%"REG_c
", %%"REG_S
"), %%mm1 \n\t"
691 "punpcklbw %%mm7, %%mm1 \n\t"
692 "punpcklbw %%mm7, %%mm0 \n\t"
693 "pshufw $0xFF, %%mm1, %%mm1 \n\t"
695 "pshufw $0xFF, %%mm0, %%mm0 \n\t"
697 "psubw %%mm1, %%mm0 \n\t"
698 "movl 8(%%"REG_b
", %%"REG_a
"), %%esi \n\t"
699 "pmullw %%mm3, %%mm0 \n\t"
700 "psllw $7, %%mm1 \n\t"
701 "paddw %%mm1, %%mm0 \n\t"
703 "movq %%mm0, (%%"REG_D
", %%"REG_a
") \n\t"
705 "add $8, %%"REG_a
" \n\t"
720 :
"=r" (fragmentA),
"=r" (imm8OfPShufW1A),
"=r" (imm8OfPShufW2A),
721 "=r" (fragmentLengthA)
728 "movq (%%"REG_d
", %%"REG_a
"), %%mm3 \n\t"
729 "movd (%%"REG_c
", %%"REG_S
"), %%mm0 \n\t"
730 "punpcklbw %%mm7, %%mm0 \n\t"
731 "pshufw $0xFF, %%mm0, %%mm1 \n\t"
733 "pshufw $0xFF, %%mm0, %%mm0 \n\t"
735 "psubw %%mm1, %%mm0 \n\t"
736 "movl 8(%%"REG_b
", %%"REG_a
"), %%esi \n\t"
737 "pmullw %%mm3, %%mm0 \n\t"
738 "psllw $7, %%mm1 \n\t"
739 "paddw %%mm1, %%mm0 \n\t"
741 "movq %%mm0, (%%"REG_D
", %%"REG_a
") \n\t"
743 "add $8, %%"REG_a
" \n\t"
758 :
"=r" (fragmentB),
"=r" (imm8OfPShufW1B),
"=r" (imm8OfPShufW2B),
759 "=r" (fragmentLengthB)
765 for (i = 0; i < dstW / numSplits; i++) {
770 int b = ((xpos + xInc) >> 16) - xx;
771 int c = ((xpos + xInc * 2) >> 16) - xx;
772 int d = ((xpos + xInc * 3) >> 16) - xx;
773 int inc = (d + 1 < 4);
774 uint8_t *fragment = (d + 1 < 4) ? fragmentB : fragmentA;
775 x86_reg imm8OfPShufW1 = (d + 1 < 4) ? imm8OfPShufW1B : imm8OfPShufW1A;
776 x86_reg imm8OfPShufW2 = (d + 1 < 4) ? imm8OfPShufW2B : imm8OfPShufW2A;
777 x86_reg fragmentLength = (d + 1 < 4) ? fragmentLengthB : fragmentLengthA;
778 int maxShift = 3 - (d + inc);
782 filter[i] = ((xpos & 0xFFFF) ^ 0xFFFF) >> 9;
783 filter[i + 1] = (((xpos + xInc) & 0xFFFF) ^ 0xFFFF) >> 9;
784 filter[i + 2] = (((xpos + xInc * 2) & 0xFFFF) ^ 0xFFFF) >> 9;
785 filter[i + 3] = (((xpos + xInc * 3) & 0xFFFF) ^ 0xFFFF) >> 9;
786 filterPos[i / 2] = xx;
788 memcpy(filterCode + fragmentPos, fragment, fragmentLength);
790 filterCode[fragmentPos + imm8OfPShufW1] = (a + inc) |
794 filterCode[fragmentPos + imm8OfPShufW2] = a | (b << 2) |
798 if (i + 4 - inc >= dstW)
800 else if ((filterPos[i / 2] & 3) <= maxShift)
801 shift = filterPos[i / 2] & 3;
803 if (shift && i >= shift) {
804 filterCode[fragmentPos + imm8OfPShufW1] += 0x55 *
shift;
805 filterCode[fragmentPos + imm8OfPShufW2] += 0x55 *
shift;
806 filterPos[i / 2] -=
shift;
810 fragmentPos += fragmentLength;
813 filterCode[fragmentPos] =
RET;
818 filterPos[((i / 2) + 1) & (~1)] = xpos >> 16;
820 return fragmentPos + 1;
826 int64_t
W,
V, Z, Cy, Cu, Cv;
827 int64_t vr = table[0];
828 int64_t ub = table[1];
829 int64_t ug = -table[2];
830 int64_t vg = -table[3];
835 static const int8_t map[] = {
860 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
861 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
862 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
863 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
864 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
865 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
866 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
867 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
915 AV_WL16(p + 16*4 + 2*i, map[i] >= 0 ? c->input_rgb2yuv_table[map[i]] : 0);
925 static const int16_t xyz2rgb_matrix[3][4] = {
926 {13270, -6295, -2041},
928 { 228, -835, 4329} };
929 static const int16_t rgb2xyz_matrix[3][4] = {
933 static int16_t xyzgamma_tab[4096], rgbgamma_tab[4096], xyzgammainv_tab[4096], rgbgammainv_tab[4096];
942 if (rgbgamma_tab[4095])
946 for (i = 0; i < 4096; i++) {
947 xyzgamma_tab[i] =
lrint(pow(i / 4095.0, xyzgamma) * 4095.0);
948 rgbgamma_tab[i] =
lrint(pow(i / 4095.0, rgbgamma) * 4095.0);
949 xyzgammainv_tab[i] =
lrint(pow(i / 4095.0, xyzgammainv) * 4095.0);
950 rgbgammainv_tab[i] =
lrint(pow(i / 4095.0, rgbgammainv) * 4095.0);
955 int srcRange,
const int table[4],
int dstRange,
956 int brightness,
int contrast,
int saturation)
988 contrast, saturation);
993 contrast, saturation);
1002 int *srcRange,
int **
table,
int *dstRange,
1003 int *brightness,
int *contrast,
int *saturation)
1088 int usesVFilter, usesHFilter;
1090 SwsFilter dummyFilter = { NULL, NULL, NULL, NULL };
1095 int dst_stride =
FFALIGN(dstW *
sizeof(int16_t) + 66, 16);
1108 unscaled = (srcW == dstW && srcH == dstH);
1119 av_log(c,
AV_LOG_WARNING,
"deprecated pixel format used, make sure you did set range correctly\n");
1154 if (dstW < srcW && dstH < srcH)
1156 else if (dstW > srcW && dstH > srcH)
1161 }
else if (i & (i - 1)) {
1163 "Exactly one scaler algorithm must be chosen, got %X\n", i);
1167 if (srcW < 1 || srcH < 1 || dstW < 1 || dstH < 1) {
1171 srcW, srcH, dstW, dstH);
1176 dstFilter = &dummyFilter;
1178 srcFilter = &dummyFilter;
1180 c->
lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW;
1181 c->
lumYInc = (((int64_t)srcH << 16) + (dstH >> 1)) / dstH;
1184 c->
vRounder = 4 * 0x0001000100010001ULL;
1186 usesVFilter = (srcFilter->
lumV && srcFilter->
lumV->
length > 1) ||
1190 usesHFilter = (srcFilter->
lumH && srcFilter->
lumH->
length > 1) ||
1210 av_log(c,
AV_LOG_DEBUG,
"Forcing full internal H chroma due to input having non subsampled chroma\n");
1227 if (!(flags & SWS_FULL_CHR_H_INT)) {
1230 "Desired dithering only supported in full chroma interpolation for destination format '%s'\n",
1236 if (flags & SWS_FULL_CHR_H_INT) {
1239 "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n",
1246 if (!(flags & SWS_FULL_CHR_H_INT)) {
1248 "%s output is not supported with half chroma resolution, switching to full\n",
1257 if (flags & SWS_FULL_CHR_H_INT &&
1272 "full chroma interpolation for destination format '%s' not yet implemented\n",
1274 flags &= ~SWS_FULL_CHR_H_INT;
1277 if (
isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT))
1309 if (unscaled && !usesHFilter && !usesVFilter &&
1316 "using unscaled %s -> %s special converter\n",
1335 (srcW & 15) == 0) ? 1 : 0;
1341 "output width is not a multiple of 32 -> no MMXEXT scaler\n");
1358 if (flags & SWS_FAST_BILINEAR) {
1365 c->
lumXInc = ((int64_t)(srcW - 2) << 16) / (dstW - 2) - 20;
1370 #define USE_MMAP (HAVE_MMAP && HAVE_MPROTECT && defined MAP_ANONYMOUS)
1374 #if HAVE_MMXEXT_INLINE
1380 NULL, NULL, NULL, 4);
1384 PROT_READ | PROT_WRITE,
1385 MAP_PRIVATE | MAP_ANONYMOUS,
1388 PROT_READ | PROT_WRITE,
1389 MAP_PRIVATE | MAP_ANONYMOUS,
1391 #elif HAVE_VIRTUALALLOC
1395 PAGE_EXECUTE_READWRITE);
1399 PAGE_EXECUTE_READWRITE);
1405 #ifdef MAP_ANONYMOUS
1435 const int filterAlign =
X86_MMX(cpu_flags) ? 4 :
1440 srcW, dstW, filterAlign, 1 << 14,
1442 cpu_flags, srcFilter->
lumH, dstFilter->
lumH,
1450 (flags & SWS_BICUBLIN) ? (flags |
SWS_BILINEAR) : flags,
1451 cpu_flags, srcFilter->
chrH, dstFilter->
chrH,
1461 const int filterAlign =
X86_MMX(cpu_flags) ? 2 :
1465 c->
lumYInc, srcH, dstH, filterAlign, (1 << 12),
1467 cpu_flags, srcFilter->
lumV, dstFilter->
lumV,
1474 filterAlign, (1 << 12),
1475 (flags & SWS_BICUBLIN) ? (flags |
SWS_BILINEAR) : flags,
1476 cpu_flags, srcFilter->
chrV, dstFilter->
chrV,
1489 short *p = (
short *)&c->vYCoeffsBank[i];
1490 for (j = 0; j < 8; j++)
1496 short *p = (
short *)&c->vCCoeffsBank[i];
1497 for (j = 0; j < 8; j++)
1506 for (i = 0; i < dstH; i++) {
1507 int chrI = (int64_t)i * c->
chrDstH / dstH;
1522 for (i = 0; i < 4; i++)
1537 dst_stride + 16,
fail);
1545 dst_stride * 2 + 32,
fail);
1553 dst_stride + 16,
fail);
1561 for(j=0; j<dst_stride/2+1; j++)
1564 for(j=0; j<dst_stride+1; j++)
1570 const char *scaler, *cpucaps;
1571 if (flags & SWS_FAST_BILINEAR)
1572 scaler =
"FAST_BILINEAR scaler";
1574 scaler =
"BILINEAR scaler";
1576 scaler =
"BICUBIC scaler";
1577 else if (flags &
SWS_X)
1578 scaler =
"Experimental scaler";
1580 scaler =
"Nearest Neighbor / POINT scaler";
1582 scaler =
"Area Averaging scaler";
1584 scaler =
"luma BICUBIC / chroma BILINEAR scaler";
1586 scaler =
"Gaussian scaler";
1588 scaler =
"Sinc scaler";
1590 scaler =
"Lanczos scaler";
1592 scaler =
"Bicubic spline scaler";
1594 scaler =
"ehh flags invalid?!";
1616 cpucaps =
"AltiVec";
1624 "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1627 "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1638 #if FF_API_SWS_GETCONTEXT
1642 SwsFilter *dstFilter,
const double *param)
1658 c->
param[0] = param[0];
1659 c->
param[1] = param[1];
1672 float lumaSharpen,
float chromaSharpen,
1673 float chromaHShift,
float chromaVShift,
1680 if (lumaGBlur != 0.0) {
1688 if (chromaGBlur != 0.0) {
1696 if (chromaSharpen != 0.0) {
1705 if (lumaSharpen != 0.0) {
1714 if (chromaHShift != 0.0)
1717 if (chromaVShift != 0.0)
1737 if(length <= 0 || length > INT_MAX/
sizeof(
double))
1752 const int length = (int)(variance * quality + 0.5) | 1;
1754 double middle = (length - 1) * 0.5;
1757 if(variance < 0 || quality < 0)
1765 for (i = 0; i <
length; i++) {
1766 double dist = i - middle;
1767 vec->
coeff[i] = exp(-dist * dist / (2 * variance * variance)) /
1768 sqrt(2 * variance *
M_PI);
1784 for (i = 0; i <
length; i++)
1800 for (i = 0; i < a->
length; i++)
1810 for (i = 0; i < a->
length; i++)
1811 a->
coeff[i] *= scalar;
1828 for (i = 0; i < a->
length; i++) {
1829 for (j = 0; j < b->
length; j++) {
1846 for (i = 0; i < a->
length; i++)
1863 for (i = 0; i < a->
length; i++)
1881 for (i = 0; i < a->
length; i++) {
1882 vec->
coeff[i + (length - 1) / 2 -
1944 for (i = 0; i < a->
length; i++)
1945 if (a->
coeff[i] > max)
1948 for (i = 0; i < a->
length; i++)
1949 if (a->
coeff[i] < min)
1954 for (i = 0; i < a->
length; i++) {
1955 int x = (int)((a->
coeff[i] - min) * 60.0 / range + 0.5);
1956 av_log(log_ctx, log_level,
"%1.3f ", a->
coeff[i]);
1958 av_log(log_ctx, log_level,
" ");
1959 av_log(log_ctx, log_level,
"|\n");
2009 for (i = 0; i < 4; i++)
2032 #elif HAVE_VIRTUALALLOC
2057 const double *
param)
2063 param = default_param;
2066 (context->
srcW != srcW ||
2067 context->
srcH != srcH ||
2069 context->
dstW != dstW ||
2070 context->
dstH != dstH ||
2072 context->
flags != flags ||
2073 context->
param[0] != param[0] ||
2074 context->
param[1] != param[1])) {
2089 context->
param[0] = param[0];
2090 context->
param[1] = param[1];
SwsVector * sws_getConstVec(double c, int length)
Allocate and return a vector with length coefficients, all with the same value c. ...
int16_t ** alpPixBuf
Ring buffer for scaled horizontal alpha plane lines to be fed to the vertical scaler.
static const FormatEntry format_entries[AV_PIX_FMT_NB]
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
void sws_freeVec(SwsVector *a)
static SwsVector * sws_sumVec(SwsVector *a, SwsVector *b)
av_cold void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
static int shift(int a, int b)
static int handle_0alpha(enum AVPixelFormat *format)
int chrSrcH
Height of source chroma planes.
SwsVector * sws_allocVec(int length)
Allocate and return an uninitialized vector with length coefficients.
static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
uint8_t * chrMmxextFilterCode
Runtime-generated MMXEXT horizontal fast bilinear scaler code for chroma planes.
static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange)
static int conv(int samples, float **pcm, char *buf, int channels)
const char * sws_format_name(enum AVPixelFormat format)
uint8_t * lumMmxextFilterCode
Runtime-generated MMXEXT horizontal fast bilinear scaler code for luma/alpha planes.
#define AV_PIX_FMT_BGR555
#define AV_LOG_WARNING
Something somehow does not look correct.
planar GBR 4:4:4 27bpp, big-endian
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 ...
static av_cold int get_local_pos(SwsContext *s, int chr_subsample, int pos, int dir)
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
static struct endianess table[]
#define SWS_SRC_V_CHR_DROP_MASK
void sws_shiftVec(SwsVector *a, int shift)
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
int vChrDrop
Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user...
packed RGB 8:8:8, 24bpp, RGBRGB...
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
#define SWS_FAST_BILINEAR
static double getSplineCoeff(double a, double b, double c, double d, double dist)
int dstFormatBpp
Number of bits per pixel of the destination pixel format.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
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.
#define SWS_FULL_CHR_H_INT
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static int handle_jpeg(enum AVPixelFormat *format)
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
int srcRange
0 = MPG YUV range, 1 = JPG YUV range (source image).
void sws_convVec(SwsVector *a, SwsVector *b)
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
packed RGB 8:8:8, 32bpp, RGB0RGB0...
packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 ...
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define LIBSWSCALE_VERSION_MICRO
packed BGR 8:8:8, 32bpp, 0BGR0BGR...
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
unsigned swscale_version(void)
Return the LIBSWSCALE_VERSION_INT constant.
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 ARGB 8:8:8:8, 32bpp, ARGBARGB...
int srcH
Height of source luma/alpha planes.
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
packed RGB 8:8:8, 24bpp, BGRBGR...
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 ...
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
const int32_t ff_yuv2rgb_coeffs[8][4]
int chrDstVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination i...
ptrdiff_t uv_off
offset (in pixels) between u and v planes
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
int length
number of coefficients in the vector
as above, but U and V bytes are swapped
int vChrFilterSize
Vertical filter size for chroma pixels.
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
int16_t ** lumPixBuf
Ring buffer for scaled horizontal luma plane lines to be fed to the vertical scaler.
int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
void sws_normalizeVec(SwsVector *a, double height)
Scale all the coefficients of a so that their sum equals height.
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
#define FF_CEIL_RSHIFT(a, b)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
void sws_scaleVec(SwsVector *a, double scalar)
Scale all the coefficients of a by the scalar value.
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_VERBOSE
Detailed information.
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
enum AVPixelFormat pix_fmt
int16_t rgb2xyz_matrix[3][4]
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
enum AVPixelFormat dstFormat
Destination pixel format.
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
planar GBRA 4:4:4:4 64bpp, big-endian
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
int chrSrcHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source imag...
static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
static SwsVector * sws_getShiftedVec(SwsVector *a, int shift)
int32_t * vChrFilterPos
Array of vertical filter starting positions for each dst[i] for chroma planes.
int dstH
Height of destination luma/alpha planes.
uint16_t depth_minus1
number of bits in the component minus 1
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int16_t ** chrVPixBuf
Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
packed BGR 8:8:8, 32bpp, BGR0BGR0...
int32_t * hChrFilterPos
Array of horizontal filter starting positions for each dst[i] for chroma planes.
int hLumFilterSize
Horizontal filter size for luma/alpha pixels.
planar GBRA 4:4:4:4 32bpp
SwsFunc ff_getSwsFunc(SwsContext *c)
Return function pointer to fastest main scaler path function depending on architecture and available ...
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
#define SWS_PARAM_DEFAULT
int vChrBufSize
Number of vertical chroma lines allocated in the ring buffer.
av_cold void sws_rgb2rgb_init(void)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
AVPixelFormat
Pixel format.
int chrDstW
Width of destination chroma planes.
#define SWS_FULL_CHR_H_INP
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
void sws_addVec(SwsVector *a, SwsVector *b)
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported input format, 0 otherwise.
int32_t * hLumFilterPos
Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
int hChrFilterSize
Horizontal filter size for chroma pixels.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
#define FF_ARRAY_ELEMS(a)
int dstRange
0 = MPG YUV range, 1 = JPG YUV range (destination image).
#define SWS_ERROR_DIFFUSION
ptrdiff_t uv_offx2
offset (in bytes) between u and v planes
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 ...
uint8_t * formatConvBuffer
int vLumBufSize
Number of vertical luma/alpha lines allocated in the ring buffer.
int16_t ** chrUPixBuf
Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
planar GBR 4:4:4 48bpp, big-endian
planar GBR 4:4:4 27bpp, little-endian
const char * swscale_configuration(void)
Return the libswscale build-time configuration.
planar GBR 4:4:4 36bpp, little-endian
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define INLINE_MMX(flags)
int srcColorspaceTable[4]
int dstW
Width of destination luma/alpha planes.
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level)
Print with av_log() a textual representation of the vector a if log_level <= av_log_level.
int32_t * vLumFilterPos
Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
planar GBR 4:4:4 42bpp, big-endian
#define AV_LOG_INFO
Standard information.
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
#define AV_CPU_FLAG_MMX
standard MMX
int dstColorspaceTable[4]
static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSize, int xInc, int srcW, int dstW, int filterAlign, int one, int flags, int cpu_flags, SwsVector *srcFilter, SwsVector *dstFilter, double param[2], int srcPos, int dstPos)
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian ...
SwsVector * sws_getGaussianVec(double variance, double quality)
Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality, lower is lower quality.
void(* rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
const AVClass * av_class
info on struct for av_log
int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported output format, 0 otherwise.
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
int16_t xyz2rgb_matrix[3][4]
packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 ...
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
#define SWS_SRC_V_CHR_DROP_SHIFT
planar GBR 4:4:4 36bpp, big-endian
int chrDstH
Height of destination chroma planes.
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 RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
struct SwsContext * sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 ...
BYTE int const BYTE int int int height
static SwsVector * sws_diffVec(SwsVector *a, SwsVector *b)
int lumMmxextFilterCodeSize
Runtime-generated MMXEXT horizontal fast bilinear scaler code size for luma/alpha planes...
Describe the class of an AVClass context structure.
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
int vLumFilterSize
Vertical filter size for luma/alpha pixels.
static void handle_formats(SwsContext *c)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static av_always_inline av_const long int lrint(double x)
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
int chrMmxextFilterCodeSize
Runtime-generated MMXEXT horizontal fast bilinear scaler code size for chroma planes.
int16_t * vChrFilter
Array of vertical filter coefficients for chroma planes.
#define LIBSWSCALE_VERSION_INT
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
int16_t * hLumFilter
Array of horizontal filter coefficients for luma/alpha planes.
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
#define ROUNDED_DIV(a, b)
#define INLINE_AMD3DNOW(flags)
planar GBR 4:4:4 30bpp, big-endian
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as lit...
planar GBRA 4:4:4:4 64bpp, little-endian
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Y , 16bpp, little-endian.
static int handle_xyz(enum AVPixelFormat *format)
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
struct SwsContext * sws_getCachedContext(struct SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Check if context can be reused, otherwise reallocate a new one.
const AVClass sws_context_class
static double sws_dcVec(SwsVector *a)
#define CONFIG_SWSCALE_ALPHA
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
double param[2]
Input parameters for scaling algorithms that need them.
double * coeff
pointer to the list of coefficients
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big...
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 ...
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
struct SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext.
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
const char * swscale_license(void)
Return the libswscale license.
enum AVPixelFormat srcFormat
Source pixel format.
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
#define FFMPEG_CONFIGURATION
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
SwsFunc swscale
Note that src, dst, srcStride, dstStride will be copied in the sws_scale() wrapper so they can be fre...
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
SwsVector * sws_getIdentityVec(void)
Allocate and return a vector with just one coefficient, with value 1.0.
#define INLINE_MMXEXT(flags)
int srcFormatBpp
Number of bits per pixel of the source pixel format.
#define SWS_MAX_REDUCE_CUTOFF
uint8_t is_supported_endianness
SwsFilter * sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
static const double coeff[2][5]
planar GBR 4:4:4 42bpp, little-endian
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
void sws_freeFilter(SwsFilter *filter)
int32_t input_rgb2yuv_table[16+40 *4]
int16_t * vLumFilter
Array of vertical filter coefficients for luma/alpha planes.
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
planar GBR 4:4:4 48bpp, little-endian
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int16_t * hChrFilter
Array of horizontal filter coefficients for chroma planes.
8 bit with PIX_FMT_RGB32 palette
planar GBR 4:4:4 30bpp, little-endian
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int chrDstHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination...
int chrSrcW
Width of source chroma planes.
#define AV_PIX_FMT_BGR565
packed RGB 8:8:8, 32bpp, 0RGB0RGB...
void ff_get_unscaled_swscale(SwsContext *c)
Set c->swscale to an unscaled converter if one exists for the specific source and destination formats...
void sws_subVec(SwsVector *a, SwsVector *b)
int srcW
Width of source luma/alpha planes.
static void fill_xyztables(struct SwsContext *c)
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
int chrSrcVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image...
int flags
Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define PPC_ALTIVEC(flags)
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
static SwsVector * sws_getConvVec(SwsVector *a, SwsVector *b)
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
SwsVector * sws_cloneVec(SwsVector *a)
Allocate and return a clone of the vector a, that is a vector with the same coefficients as a...
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian