Go to the documentation of this file.
23 #define _DEFAULT_SOURCE
24 #define _SVID_SOURCE // needed for MAP_ANONYMOUS
25 #define _DARWIN_C_SOURCE // needed for MAP_ANON
32 #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
33 #define MAP_ANONYMOUS MAP_ANON
37 #define WIN32_LEAN_AND_MEAN
59 #undef attribute_deprecated
60 #define attribute_deprecated
66 #if !FF_API_SWS_VECTOR
83 return FFMPEG_CONFIGURATION;
88 #define LICENSE_PREFIX "libswscale license: "
298 return ((d * dist +
c) * dist +
b) * dist +
a;
301 b + 2.0 *
c + 3.0 * d,
303 -
b - 3.0 *
c - 6.0 * d,
309 if (
pos == -1 ||
pos <= -513) {
310 pos = (128 << chr_subsample) - 128;
313 return pos >> chr_subsample;
330 {
SWS_POINT,
"nearest neighbor / point", -1 },
333 {
SWS_X,
"experimental", 8 },
337 int *outFilterSize,
int xInc,
int srcW,
338 int dstW,
int filterAlign,
int one,
341 double param[2],
int srcPos,
int dstPos)
348 int64_t *filter2 =
NULL;
349 const int64_t fone = 1LL << (54 -
FFMIN(
av_log2(srcW/dstW), 8));
357 if (
FFABS(xInc - 0x10000) < 10 && srcPos == dstPos) {
363 for (
i = 0;
i < dstW;
i++) {
374 xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
375 for (
i = 0;
i < dstW;
i++) {
376 int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
378 (*filterPos)[
i] = xx;
390 xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000LL)>>7);
391 for (
i = 0;
i < dstW;
i++) {
392 int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
395 (*filterPos)[
i] = xx;
397 for (j = 0; j < filterSize; j++) {
398 int64_t
coeff = fone -
FFABS((int64_t)xx * (1 << 16) - xDstInSrc) * (fone >> 16);
421 filterSize = 1 + sizeFactor;
423 filterSize = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
425 filterSize =
FFMIN(filterSize, srcW - 2);
426 filterSize =
FFMAX(filterSize, 1);
431 xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000LL)>>7);
432 for (
i = 0;
i < dstW;
i++) {
433 int xx = (xDstInSrc - (filterSize - 2) * (1LL<<16)) / (1 << 17);
435 (*filterPos)[
i] = xx;
436 for (j = 0; j < filterSize; j++) {
437 int64_t d = (
FFABS(((int64_t)xx * (1 << 17)) - xDstInSrc)) << 13;
443 floatd = d * (1.0 / (1 << 30));
449 if (d >= 1LL << 31) {
452 int64_t dd = (d * d) >> 30;
453 int64_t ddd = (dd * d) >> 30;
456 coeff = (12 * (1 << 24) - 9 *
B - 6 *
C) * ddd +
457 (-18 * (1 << 24) + 12 *
B + 6 *
C) * dd +
458 (6 * (1 << 24) - 2 *
B) * (1 << 30);
461 (6 *
B + 30 *
C) * dd +
462 (-12 *
B - 48 *
C) * d +
463 (8 *
B + 24 *
C) * (1 << 30);
465 coeff /= (1LL<<54)/fone;
471 c = cos(floatd *
M_PI);
478 coeff = (
c * 0.5 + 0.5) * fone;
480 int64_t d2 = d - (1 << 29);
481 if (d2 * xInc < -(1LL << (29 + 16)))
482 coeff = 1.0 * (1LL << (30 + 16));
483 else if (d2 * xInc < (1LL << (29 + 16)))
484 coeff = -d2 * xInc + (1LL << (29 + 16));
487 coeff *= fone >> (30 + 16);
490 coeff =
exp2(-p * floatd * floatd) * fone;
492 coeff = (d ? sin(floatd *
M_PI) / (floatd *
M_PI) : 1.0) * fone;
496 (floatd * floatd *
M_PI *
M_PI / p) : 1.0) * fone;
500 coeff = (1 << 30) - d;
505 double p = -2.196152422706632;
514 xDstInSrc += 2 * xInc;
522 filter2Size = filterSize;
524 filter2Size += srcFilter->
length - 1;
526 filter2Size += dstFilter->
length - 1;
530 for (
i = 0;
i < dstW;
i++) {
534 for (k = 0; k < srcFilter->
length; k++) {
535 for (j = 0; j < filterSize; j++)
536 filter2[
i * filter2Size + k + j] +=
540 for (j = 0; j < filterSize; j++)
541 filter2[
i * filter2Size + j] =
filter[
i * filterSize + j];
545 (*filterPos)[
i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
552 for (
i = dstW - 1;
i >= 0;
i--) {
553 int min = filter2Size;
555 int64_t cutOff = 0.0;
558 for (j = 0; j < filter2Size; j++) {
560 cutOff +=
FFABS(filter2[
i * filter2Size]);
567 if (
i < dstW - 1 && (*filterPos)[
i] >= (*filterPos)[
i + 1])
571 for (k = 1; k < filter2Size; k++)
572 filter2[
i * filter2Size + k - 1] = filter2[
i * filter2Size + k];
573 filter2[
i * filter2Size + k - 1] = 0;
579 for (j = filter2Size - 1; j > 0; j--) {
580 cutOff +=
FFABS(filter2[
i * filter2Size + j]);
587 if (
min > minFilterSize)
593 if (minFilterSize < 5)
599 if (minFilterSize < 3)
605 if (minFilterSize == 1 && filterAlign == 2)
610 filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
620 *outFilterSize = filterSize;
624 "SwScaler: reducing / aligning filtersize %d -> %d\n",
625 filter2Size, filterSize);
627 for (
i = 0;
i < dstW;
i++) {
630 for (j = 0; j < filterSize; j++) {
631 if (j >= filter2Size)
632 filter[
i * filterSize + j] = 0;
634 filter[
i * filterSize + j] = filter2[
i * filter2Size + j];
636 filter[
i * filterSize + j] = 0;
643 for (
i = 0;
i < dstW;
i++) {
645 if ((*filterPos)[
i] < 0) {
647 for (j = 1; j < filterSize; j++) {
650 filter[
i * filterSize + j] = 0;
655 if ((*filterPos)[
i] + filterSize > srcW) {
656 int shift = (*filterPos)[
i] +
FFMIN(filterSize - srcW, 0);
659 for (j = filterSize - 1; j >= 0; j--) {
660 if ((*filterPos)[
i] + j >= srcW) {
662 filter[
i * filterSize + j] = 0;
665 for (j = filterSize - 1; j >= 0; j--) {
667 filter[
i * filterSize + j] = 0;
674 filter[
i * filterSize + srcW - 1 - (*filterPos)[
i]] +=
acc;
678 if ((*filterPos)[
i] + filterSize > srcW) {
679 for (j = 0; j < filterSize; j++) {
688 (dstW + 3), *outFilterSize *
sizeof(int16_t),
fail);
691 for (
i = 0;
i < dstW;
i++) {
696 for (j = 0; j < filterSize; j++) {
697 sum +=
filter[
i * filterSize + j];
699 sum = (sum + one / 2) / one;
704 for (j = 0; j < *outFilterSize; j++) {
707 (*outFilter)[
i * (*outFilterSize) + j] = intV;
708 error = v - intV * sum;
712 (*filterPos)[dstW + 0] =
713 (*filterPos)[dstW + 1] =
714 (*filterPos)[dstW + 2] = (*filterPos)[dstW - 1];
716 for (
i = 0;
i < *outFilterSize;
i++) {
717 int k = (dstW - 1) * (*outFilterSize) +
i;
718 (*outFilter)[k + 1 * (*outFilterSize)] =
719 (*outFilter)[k + 2 * (*outFilterSize)] =
720 (*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
735 int64_t
W,
V, Z, Cy, Cu, Cv;
736 int64_t vr =
table[0];
738 int64_t ug = -
table[2];
739 int64_t vg = -
table[3];
744 static const int8_t
map[] = {
769 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
770 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
771 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
772 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
773 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
774 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
775 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
776 -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
834 static const int16_t xyz2rgb_matrix[3][4] = {
835 {13270, -6295, -2041},
837 { 228, -835, 4329} };
838 static const int16_t rgb2xyz_matrix[3][4] = {
842 static int16_t xyzgamma_tab[4096], rgbgamma_tab[4096], xyzgammainv_tab[4096], rgbgammainv_tab[4096];
844 memcpy(
c->xyz2rgb_matrix, xyz2rgb_matrix,
sizeof(
c->xyz2rgb_matrix));
845 memcpy(
c->rgb2xyz_matrix, rgb2xyz_matrix,
sizeof(
c->rgb2xyz_matrix));
846 c->xyzgamma = xyzgamma_tab;
847 c->rgbgamma = rgbgamma_tab;
848 c->xyzgammainv = xyzgammainv_tab;
849 c->rgbgammainv = rgbgammainv_tab;
851 if (rgbgamma_tab[4095])
855 for (
i = 0;
i < 4096;
i++) {
856 xyzgamma_tab[
i] =
lrint(pow(
i / 4095.0, xyzgamma) * 4095.0);
857 rgbgamma_tab[
i] =
lrint(pow(
i / 4095.0, rgbgamma) * 4095.0);
858 xyzgammainv_tab[
i] =
lrint(pow(
i / 4095.0, xyzgammainv) * 4095.0);
859 rgbgammainv_tab[
i] =
lrint(pow(
i / 4095.0, rgbgammainv) * 4095.0);
864 int srcRange,
const int table[4],
int dstRange,
865 int brightness,
int contrast,
int saturation)
880 if (
c->srcRange != srcRange ||
881 c->dstRange != dstRange ||
882 c->brightness != brightness ||
883 c->contrast != contrast ||
884 c->saturation != saturation ||
885 memcmp(
c->srcColorspaceTable, inv_table,
sizeof(
int) * 4) ||
886 memcmp(
c->dstColorspaceTable,
table,
sizeof(
int) * 4)
890 memmove(
c->srcColorspaceTable, inv_table,
sizeof(
int) * 4);
891 memmove(
c->dstColorspaceTable,
table,
sizeof(
int) * 4);
895 c->brightness = brightness;
896 c->contrast = contrast;
897 c->saturation = saturation;
898 c->srcRange = srcRange;
899 c->dstRange = dstRange;
903 if (need_reinit && (
c->srcBpc == 8 || !
isYUV(
c->srcFormat)))
909 if (
c->cascaded_context[
c->cascaded_mainindex])
916 if (!
c->cascaded_context[0] &&
917 memcmp(
c->dstColorspaceTable,
c->srcColorspaceTable,
sizeof(
int) * 4) &&
918 c->srcW &&
c->srcH &&
c->dstW &&
c->dstH) {
920 int tmp_width, tmp_height;
926 av_log(
c,
AV_LOG_VERBOSE,
"YUV color matrix differs for YUV->YUV, using intermediate RGB to convert\n");
942 if (srcW*srcH > dstW*dstH) {
951 tmp_width, tmp_height, tmp_format, 64);
956 tmp_width, tmp_height, tmp_format,
958 if (!
c->cascaded_context[0])
961 c->cascaded_context[0]->alphablend =
c->alphablend;
967 srcRange,
table, dstRange,
968 brightness, contrast, saturation);
970 c->cascaded_context[1] =
sws_getContext(tmp_width, tmp_height, tmp_format,
971 dstW, dstH,
c->dstFormat,
973 if (!
c->cascaded_context[1])
976 srcRange,
table, dstRange,
977 0, 1 << 16, 1 << 16);
985 contrast, saturation);
990 contrast, saturation);
999 int *srcRange,
int **
table,
int *dstRange,
1000 int *brightness,
int *contrast,
int *saturation)
1005 *inv_table =
c->srcColorspaceTable;
1006 *
table =
c->dstColorspaceTable;
1007 *srcRange =
c->srcRange;
1008 *dstRange =
c->dstRange;
1009 *brightness =
c->brightness;
1010 *contrast =
c->contrast;
1011 *saturation =
c->saturation;
1080 if (
c->srcXYZ ||
c->dstXYZ)
1102 tbl = (uint16_t*)
av_malloc(
sizeof(uint16_t) * 1 << 16);
1106 for (
i = 0;
i < 65536; ++
i) {
1107 tbl[
i] = pow(
i / 65535.0, e) * 65535.0;
1174 int usesVFilter, usesHFilter;
1181 int dst_stride =
FFALIGN(dstW *
sizeof(int16_t) + 66, 16);
1189 static const float float_mult = 1.0f / 255.0f;
1197 unscaled = (srcW == dstW && srcH == dstH);
1202 if(srcFormat!=
c->srcFormat || dstFormat!=
c->dstFormat)
1205 if (!
c->contrast && !
c->saturation && !
c->dstFormatBpp)
1208 c->dstRange, 0, 1 << 16, 1 << 16);
1211 srcFormat =
c->srcFormat;
1212 dstFormat =
c->dstFormat;
1249 if (dstW < srcW && dstH < srcH)
1251 else if (dstW > srcW && dstH > srcH)
1256 }
else if (
i & (
i - 1)) {
1258 "Exactly one scaler algorithm must be chosen, got %X\n",
i);
1262 if (srcW < 1 || srcH < 1 || dstW < 1 || dstH < 1) {
1266 srcW, srcH, dstW, dstH);
1270 if (srcW < 8 || dstW < 8) {
1277 dstFilter = &dummyFilter;
1279 srcFilter = &dummyFilter;
1281 c->lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW;
1282 c->lumYInc = (((int64_t)srcH << 16) + (dstH >> 1)) / dstH;
1285 c->vRounder = 4 * 0x0001000100010001ULL;
1287 usesVFilter = (srcFilter->
lumV && srcFilter->
lumV->
length > 1) ||
1291 usesHFilter = (srcFilter->
lumH && srcFilter->
lumH->
length > 1) ||
1306 if (
c->chrSrcHSubSample == 0
1307 &&
c->chrSrcVSubSample == 0
1311 av_log(
c,
AV_LOG_DEBUG,
"Forcing full internal H chroma due to input having non subsampled chroma\n");
1331 "Desired dithering only supported in full chroma interpolation for destination format '%s'\n",
1340 "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n",
1349 "%s output is not supported with half chroma resolution, switching to full\n",
1381 "full chroma interpolation for destination format '%s' not yet implemented\n",
1387 c->chrDstHSubSample = 1;
1392 c->chrSrcVSubSample +=
c->vChrDrop;
1410 ((dstW >>
c->chrDstHSubSample) <= (srcW >> 1) ||
1412 c->chrSrcHSubSample = 1;
1430 if (
c->dstBpc == 16)
1434 c->canMMXEXTBeUsed = dstW >= srcW && (dstW & 31) == 0 &&
1435 c->chrDstW >=
c->chrSrcW &&
1437 if (!
c->canMMXEXTBeUsed && dstW >= srcW &&
c->chrDstW >=
c->chrSrcW && (srcW & 15) == 0
1442 "output width is not a multiple of 32 -> no MMXEXT scaler\n");
1445 c->canMMXEXTBeUsed = 0;
1447 c->canMMXEXTBeUsed = 0;
1449 c->chrXInc = (((int64_t)
c->chrSrcW << 16) + (
c->chrDstW >> 1)) /
c->chrDstW;
1450 c->chrYInc = (((int64_t)
c->chrSrcH << 16) + (
c->chrDstH >> 1)) /
c->chrDstH;
1460 if (
c->canMMXEXTBeUsed) {
1466 c->lumXInc = ((int64_t)(srcW - 2) << 16) / (dstW - 2) - 20;
1467 c->chrXInc = ((int64_t)(
c->chrSrcW - 2) << 16) / (
c->chrDstW - 2) - 20;
1472 c->gamma_value = 2.2;
1476 if (!unscaled &&
c->gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {
1478 c->cascaded_context[0] =
NULL;
1481 srcW, srcH, tmpFmt, 64);
1488 if (!
c->cascaded_context[0]) {
1494 flags, srcFilter, dstFilter,
c->param);
1496 if (!
c->cascaded_context[1])
1499 c2 =
c->cascaded_context[1];
1500 c2->is_internal_gamma = 1;
1503 if (!
c2->gamma || !
c2->inv_gamma)
1512 c->cascaded_context[1] =
NULL;
1516 c->cascaded_context[2] =
NULL;
1517 if (dstFormat != tmpFmt) {
1519 dstW, dstH, tmpFmt, 64);
1524 dstW, dstH, dstFormat,
1526 if (!
c->cascaded_context[2])
1538 srcW, srcH, tmpFormat, 64);
1543 srcW, srcH, tmpFormat,
1545 if (!
c->cascaded_context[0])
1549 dstW, dstH, dstFormat,
1551 if (!
c->cascaded_context[1])
1558 for (
i = 0;
i < 256; ++
i){
1559 c->uint2float_lut[
i] = (float)
i * float_mult;
1565 (!unscaled || unscaled && dstFormat != srcFormat && (srcFormat !=
AV_PIX_FMT_GRAYF32 ||
1570 if (CONFIG_SWSCALE_ALPHA &&
isALPHA(srcFormat) && !
isALPHA(dstFormat)) {
1575 dstFormat != tmpFormat ||
1576 usesHFilter || usesVFilter ||
1577 c->srcRange !=
c->dstRange
1579 c->cascaded_mainindex = 1;
1581 srcW, srcH, tmpFormat, 64);
1586 srcW, srcH, tmpFormat,
1588 if (!
c->cascaded_context[0])
1590 c->cascaded_context[0]->alphablend =
c->alphablend;
1596 dstW, dstH, dstFormat,
1598 if (!
c->cascaded_context[1])
1601 c->cascaded_context[1]->srcRange =
c->srcRange;
1602 c->cascaded_context[1]->dstRange =
c->dstRange;
1611 #if HAVE_MMAP && HAVE_MPROTECT && defined(MAP_ANONYMOUS)
1619 #if HAVE_MMXEXT_INLINE
1628 c->lumMmxextFilterCode = mmap(
NULL,
c->lumMmxextFilterCodeSize,
1629 PROT_READ | PROT_WRITE,
1630 MAP_PRIVATE | MAP_ANONYMOUS,
1632 c->chrMmxextFilterCode = mmap(
NULL,
c->chrMmxextFilterCodeSize,
1633 PROT_READ | PROT_WRITE,
1634 MAP_PRIVATE | MAP_ANONYMOUS,
1636 #elif HAVE_VIRTUALALLOC
1637 c->lumMmxextFilterCode = VirtualAlloc(
NULL,
1638 c->lumMmxextFilterCodeSize,
1640 PAGE_EXECUTE_READWRITE);
1641 c->chrMmxextFilterCode = VirtualAlloc(
NULL,
1642 c->chrMmxextFilterCodeSize,
1644 PAGE_EXECUTE_READWRITE);
1646 c->lumMmxextFilterCode =
av_malloc(
c->lumMmxextFilterCodeSize);
1647 c->chrMmxextFilterCode =
av_malloc(
c->chrMmxextFilterCodeSize);
1650 #ifdef MAP_ANONYMOUS
1651 if (
c->lumMmxextFilterCode == MAP_FAILED ||
c->chrMmxextFilterCode == MAP_FAILED)
1653 if (!
c->lumMmxextFilterCode || !
c->chrMmxextFilterCode)
1666 c->hLumFilter, (uint32_t*)
c->hLumFilterPos, 8);
1668 c->hChrFilter, (uint32_t*)
c->hChrFilterPos, 4);
1671 if ( mprotect(
c->lumMmxextFilterCode,
c->lumMmxextFilterCodeSize, PROT_EXEC | PROT_READ) == -1
1672 || mprotect(
c->chrMmxextFilterCode,
c->chrMmxextFilterCodeSize, PROT_EXEC | PROT_READ) == -1) {
1685 &
c->hLumFilterSize,
c->lumXInc,
1686 srcW, dstW, filterAlign, 1 << 14,
1694 &
c->hChrFilterSize,
c->chrXInc,
1695 c->chrSrcW,
c->chrDstW, filterAlign, 1 << 14,
1711 if ((
ret =
initFilter(&
c->vLumFilter, &
c->vLumFilterPos, &
c->vLumFilterSize,
1712 c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
1719 if ((
ret =
initFilter(&
c->vChrFilter, &
c->vChrFilterPos, &
c->vChrFilterSize,
1720 c->chrYInc,
c->chrSrcH,
c->chrDstH,
1721 filterAlign, (1 << 12),
1734 for (
i = 0;
i <
c->vLumFilterSize *
c->dstH;
i++) {
1736 short *p = (
short *)&
c->vYCoeffsBank[
i];
1737 for (j = 0; j < 8; j++)
1738 p[j] =
c->vLumFilter[
i];
1741 for (
i = 0;
i <
c->vChrFilterSize *
c->chrDstH;
i++) {
1743 short *p = (
short *)&
c->vCCoeffsBank[
i];
1744 for (j = 0; j < 8; j++)
1745 p[j] =
c->vChrFilter[
i];
1750 for (
i = 0;
i < 4;
i++)
1753 c->needAlpha = (CONFIG_SWSCALE_ALPHA &&
isALPHA(
c->srcFormat) &&
isALPHA(
c->dstFormat)) ? 1 : 0;
1756 c->uv_off = (dst_stride>>1) + 64 / (
c->dstBpc &~ 7);
1757 c->uv_offx2 = dst_stride + 16;
1762 const char *scaler =
NULL, *cpucaps;
1771 scaler =
"ehh flags invalid?!";
1792 cpucaps =
"AltiVec";
1800 "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1801 c->srcW,
c->srcH,
c->dstW,
c->dstH,
c->lumXInc,
c->lumYInc);
1803 "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1804 c->chrSrcW,
c->chrSrcH,
c->chrDstW,
c->chrDstH,
1805 c->chrXInc,
c->chrYInc);
1809 if (unscaled && !usesHFilter && !usesVFilter &&
1812 (
c->srcRange ==
c->dstRange ||
isAnyRGB(dstFormat)) &&
1819 "using alpha blendaway %s -> %s special converter\n",
1825 if (unscaled && !usesHFilter && !usesVFilter &&
1826 (
c->srcRange ==
c->dstRange ||
isAnyRGB(dstFormat) ||
1833 "using unscaled %s -> %s special converter\n",
1843 int tmpW = sqrt(srcW * (int64_t)dstW);
1844 int tmpH = sqrt(srcH * (int64_t)dstH);
1850 if (srcW*(int64_t)srcH <= 4LL*dstW*dstH)
1854 tmpW, tmpH, tmpFormat, 64);
1859 tmpW, tmpH, tmpFormat,
1861 if (!
c->cascaded_context[0])
1865 dstW, dstH, dstFormat,
1867 if (!
c->cascaded_context[1])
1876 int flags,
const double *param)
1888 c->srcFormat = srcFormat;
1889 c->dstFormat = dstFormat;
1892 c->param[0] = param[0];
1893 c->param[1] = param[1];
1902 SwsFilter *dstFilter,
const double *param)
1907 dstW, dstH, dstFormat,
1923 for (
i=0;
i<
a->length;
i++)
1932 for (
i=0;
i<
a->length;
i++)
1937 float lumaSharpen,
float chromaSharpen,
1938 float chromaHShift,
float chromaVShift,
1945 if (lumaGBlur != 0.0) {
1953 if (chromaGBlur != 0.0) {
1964 if (chromaSharpen != 0.0) {
1975 if (lumaSharpen != 0.0) {
1986 if (chromaHShift != 0.0)
1989 if (chromaVShift != 0.0)
2023 if(length <= 0 || length > INT_MAX/
sizeof(
double))
2038 const int length = (
int)(variance *
quality + 0.5) | 1;
2040 double middle = (length - 1) * 0.5;
2043 if(variance < 0 ||
quality < 0)
2051 for (
i = 0;
i < length;
i++) {
2052 double dist =
i - middle;
2053 vec->
coeff[
i] =
exp(-dist * dist / (2 * variance * variance)) /
2054 sqrt(2 * variance *
M_PI);
2066 #if !FF_API_SWS_VECTOR
2077 for (
i = 0;
i < length;
i++)
2087 #if !FF_API_SWS_VECTOR
2100 for (
i = 0;
i <
a->length;
i++)
2110 for (
i = 0;
i <
a->length;
i++)
2111 a->coeff[
i] *= scalar;
2119 #if FF_API_SWS_VECTOR
2122 int length =
a->length +
b->length - 1;
2129 for (
i = 0;
i <
a->length;
i++) {
2130 for (j = 0; j <
b->length; j++) {
2131 vec->
coeff[
i + j] +=
a->coeff[
i] *
b->coeff[j];
2141 int length =
FFMAX(
a->length,
b->length);
2148 for (
i = 0;
i <
a->length;
i++)
2149 vec->
coeff[
i + (length - 1) / 2 - (
a->length - 1) / 2] +=
a->coeff[
i];
2150 for (
i = 0;
i <
b->length;
i++)
2151 vec->
coeff[
i + (length - 1) / 2 - (
b->length - 1) / 2] +=
b->coeff[
i];
2156 #if FF_API_SWS_VECTOR
2159 int length =
FFMAX(
a->length,
b->length);
2166 for (
i = 0;
i <
a->length;
i++)
2167 vec->
coeff[
i + (length - 1) / 2 - (
a->length - 1) / 2] +=
a->coeff[
i];
2168 for (
i = 0;
i <
b->length;
i++)
2169 vec->
coeff[
i + (length - 1) / 2 - (
b->length - 1) / 2] -=
b->coeff[
i];
2185 for (
i = 0;
i <
a->length;
i++) {
2186 vec->
coeff[
i + (length - 1) / 2 -
2187 (
a->length - 1) / 2 -
shift] =
a->coeff[
i];
2193 #if !FF_API_SWS_VECTOR
2204 a->coeff = shifted->
coeff;
2209 #if !FF_API_SWS_VECTOR
2225 #if FF_API_SWS_VECTOR
2234 a->coeff =
diff->coeff;
2235 a->length =
diff->length;
2247 a->coeff =
conv->coeff;
2248 a->length =
conv->length;
2259 memcpy(vec->
coeff,
a->coeff,
a->length *
sizeof(*
a->coeff));
2269 #if !FF_API_SWS_VECTOR
2279 for (
i = 0;
i <
a->length;
i++)
2280 if (
a->coeff[
i] >
max)
2283 for (
i = 0;
i <
a->length;
i++)
2284 if (
a->coeff[
i] <
min)
2289 for (
i = 0;
i <
a->length;
i++) {
2290 int x = (
int)((
a->coeff[
i] -
min) * 60.0 / range + 0.5);
2291 av_log(log_ctx, log_level,
"%1.3f ",
a->coeff[
i]);
2293 av_log(log_ctx, log_level,
" ");
2294 av_log(log_ctx, log_level,
"|\n");
2325 for (
i = 0;
i < 4;
i++)
2344 if (
c->lumMmxextFilterCode)
2345 munmap(
c->lumMmxextFilterCode,
c->lumMmxextFilterCodeSize);
2346 if (
c->chrMmxextFilterCode)
2347 munmap(
c->chrMmxextFilterCode,
c->chrMmxextFilterCodeSize);
2348 #elif HAVE_VIRTUALALLOC
2349 if (
c->lumMmxextFilterCode)
2350 VirtualFree(
c->lumMmxextFilterCode, 0, MEM_RELEASE);
2351 if (
c->chrMmxextFilterCode)
2352 VirtualFree(
c->chrMmxextFilterCode, 0, MEM_RELEASE);
2357 c->lumMmxextFilterCode =
NULL;
2358 c->chrMmxextFilterCode =
NULL;
2367 memset(
c->cascaded_context, 0,
sizeof(
c->cascaded_context));
2385 const double *
param)
2393 param = default_param;
static void error(const char *err)
static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
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.
#define INLINE_MMX(flags)
@ AV_PIX_FMT_XYZ12LE
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...
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_BAYER_GBRG16LE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
int dstW
Width of destination luma/alpha planes.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static void fill_xyztables(struct SwsContext *c)
#define LIBSWSCALE_VERSION_INT
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
void sws_addVec(SwsVector *a, SwsVector *b)
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
static enum AVPixelFormat alphaless_fmt(enum AVPixelFormat fmt)
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
static int handle_0alpha(enum AVPixelFormat *format)
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
int depth
Number of bits in the component.
static const uint16_t table[]
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
#define AV_PIX_FMT_YUV420P10
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
static SwsVector * sws_getShiftedVec(SwsVector *a, int shift)
@ AV_PIX_FMT_BAYER_GRBG16BE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
static atomic_int cpu_flags
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
void sws_freeVec(SwsVector *a)
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_BAYER_GBRG16BE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
static int isnan_vec(SwsVector *a)
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
#define SWS_FAST_BILINEAR
static int handle_jpeg(enum AVPixelFormat *format)
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
SwsVector * sws_getConstVec(double c, int length)
Allocate and return a vector with length coefficients, all with the same value c.
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P9
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
const char * swscale_license(void)
Return the libswscale license.
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.
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GRAY16
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
static SwsVector * sws_diffVec(SwsVector *a, SwsVector *b)
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
#define AV_PIX_FMT_YUV444P10
int ff_init_filters(SwsContext *c)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
uint8_t is_supported_endianness
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.
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PIX_FMT_BAYER_RGGB16BE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
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)
enum AVPixelFormat srcFormat
Source pixel format.
#define AV_PIX_FMT_YUV422P16
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define SWS_MAX_REDUCE_CUTOFF
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_BAYER_RGGB16LE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
#define AV_PIX_FMT_YUV444P16
#define AV_CEIL_RSHIFT(a, b)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
@ AV_PIX_FMT_BAYER_BGGR8
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
#define SWS_FULL_CHR_H_INP
int length
number of coefficients in the vector
SwsVector * sws_allocVec(int length)
Allocate and return an uninitialized vector with length coefficients.
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
static av_cold int get_local_pos(SwsContext *s, int chr_subsample, int pos, int dir)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_PIX_FMT_YUV420P9
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_PIX_FMT_YUV420P16
static const ScaleAlgorithm scale_algorithms[]
int flag
flag associated to the algorithm
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
static enum AVPixelFormat pix_fmt
static const FormatEntry format_entries[]
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
SwsVector * sws_getGaussianVec(double variance, double quality)
Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality,...
#define AV_PIX_FMT_GRAYF32
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
enum AVPixelFormat dstFormat
Destination pixel format.
static int conv(int samples, float **pcm, char *buf, int channels)
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_BAYER_RGGB8
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
av_cold void ff_sws_init_range_convert(SwsContext *c)
@ AV_PIX_FMT_BAYER_GRBG16LE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
static uint16_t * alloc_gamma_tbl(double e)
#define AV_PIX_FMT_GBRP16
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
void ff_get_unscaled_swscale(SwsContext *c)
Set c->swscale to an unscaled converter if one exists for the specific source and destination formats...
#define SWS_SRC_V_CHR_DROP_SHIFT
Describe the class of an AVClass context structure.
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
#define RETCODE_USE_CASCADE
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
SwsFilter * sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
@ 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_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
#define ROUNDED_DIV(a, b)
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext.
static void makenan_vec(SwsVector *a)
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange)
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
av_cold void ff_sws_rgb2rgb_init(void)
static SwsVector * sws_getConvVec(SwsVector *a, SwsVector *b)
@ AV_PIX_FMT_BGR4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
double * coeff
pointer to the list of coefficients
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static void handle_formats(SwsContext *c)
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)
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
const AVClass ff_sws_context_class
SwsVector * sws_cloneVec(SwsVector *a)
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
void sws_scaleVec(SwsVector *a, double scalar)
Scale all the coefficients of a by the scalar value.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
void sws_subVec(SwsVector *a, SwsVector *b)
void sws_convVec(SwsVector *a, SwsVector *b)
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
#define SWS_PARAM_DEFAULT
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
SwsFunc ff_getSwsFunc(SwsContext *c)
Return function pointer to fastest main scaler path function depending on architecture and available ...
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
#define PPC_ALTIVEC(flags)
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.
@ AV_PIX_FMT_BAYER_BGGR16LE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
#define SWS_FULL_CHR_H_INT
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
#define AV_PIX_FMT_BGR555
int srcH
Height of source luma/alpha planes.
static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
const char * swscale_configuration(void)
Return the libswscale build-time configuration.
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported input format, 0 otherwise.
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
#define AV_LOG_INFO
Standard information.
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
static int handle_xyz(enum AVPixelFormat *format)
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define AV_PIX_FMT_BGRA64
int srcW
Width of source luma/alpha planes.
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
const int32_t ff_yuv2rgb_coeffs[11][4]
#define i(width, name, range_min, range_max)
#define AV_PIX_FMT_GBRP12
#define av_malloc_array(a, b)
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
int ff_free_filters(SwsContext *c)
@ AV_PIX_FMT_BAYER_GBRG8
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
static double getSplineCoeff(double a, double b, double c, double d, double dist)
int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported output format, 0 otherwise.
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_XYZ12BE
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...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
#define AV_PIX_FMT_BGR565
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
#define AV_PIX_FMT_YUV444P9
void sws_freeFilter(SwsFilter *filter)
static av_always_inline int isFloat(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_BAYER_BGGR16BE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
#define FF_ARRAY_ELEMS(a)
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
#define AV_CPU_FLAG_MMX
standard MMX
void sws_freeContext(SwsContext *c)
Free the swscaler context swsContext.
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
void(* rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
const char * description
human-readable description
#define INLINE_MMXEXT(flags)
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
static int shift(int a, int b)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
const VDPAUPixFmtMap * map
int size_factor
size factor used when initing the filters
static av_always_inline int diff(const uint32_t a, const uint32_t b)
unsigned swscale_version(void)
SwsContext * sws_alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, const double *param)
Allocate and return an SwsContext.
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
static SwsVector * sws_sumVec(SwsVector *a, SwsVector *b)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
av_cold void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
#define flags(name, subs,...)
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const double coeff[2][5]
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
#define INLINE_AMD3DNOW(flags)
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
#define SWS_SRC_V_CHR_DROP_MASK
static double sws_dcVec(SwsVector *a)
int dstH
Height of destination luma/alpha planes.
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
void sws_normalizeVec(SwsVector *a, double height)
Scale all the coefficients of a so that their sum equals height.
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)
@ AV_PIX_FMT_BAYER_GRBG8
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
SwsVector * sws_getIdentityVec(void)
Allocate and return a vector with just one coefficient, with value 1.0.
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define LIBSWSCALE_VERSION_MICRO
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.
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
#define SWS_ERROR_DIFFUSION
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
double param[2]
Input parameters for scaling algorithms that need them.
void sws_shiftVec(SwsVector *a, int shift)