39 { 36, 68, 60, 92, 34, 66, 58, 90, },
40 { 100, 4, 124, 28, 98, 2, 122, 26, },
41 { 52, 84, 44, 76, 50, 82, 42, 74, },
42 { 116, 20, 108, 12, 114, 18, 106, 10, },
43 { 32, 64, 56, 88, 38, 70, 62, 94, },
44 { 96, 0, 120, 24, 102, 6, 126, 30, },
45 { 48, 80, 40, 72, 54, 86, 46, 78, },
46 { 112, 16, 104, 8, 118, 22, 110, 14, },
50 64, 64, 64, 64, 64, 64, 64, 64
57 uint8_t *ptr = plane + stride * y;
58 for (i = 0; i <
height; i++) {
59 memset(ptr, val, width);
66 const int dst_depth,
const int big_endian)
69 uint16_t *dst = (uint16_t *) (plane + stride * y);
70 #define FILL8TO9_OR_10(wfunc) \ 71 for (i = 0; i < height; i++) { \ 72 for (j = 0; j < width; j++) { \ 73 wfunc(&dst[j], (val << (dst_depth - 8)) | \ 74 (val >> (16 - dst_depth))); \ 88 const int32_t *filterPos,
int filterSize)
93 const uint16_t *
src = (
const uint16_t *) _src;
97 for (i = 0; i < dstW; i++) {
99 int srcPos = filterPos[i];
102 for (j = 0; j < filterSize; j++) {
103 val += src[srcPos + j] * filter[filterSize * i + j];
106 dst[i] =
FFMIN(val >> sh, (1 << 19) - 1);
112 const int32_t *filterPos,
int filterSize)
116 const uint16_t *
src = (
const uint16_t *) _src;
119 for (i = 0; i < dstW; i++) {
121 int srcPos = filterPos[i];
124 for (j = 0; j < filterSize; j++) {
125 val += src[srcPos + j] * filter[filterSize * i + j];
128 dst[i] =
FFMIN(val >> sh, (1 << 15) - 1);
135 const int32_t *filterPos,
int filterSize)
138 for (i = 0; i < dstW; i++) {
140 int srcPos = filterPos[i];
142 for (j = 0; j < filterSize; j++) {
143 val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
145 dst[i] =
FFMIN(val >> 7, (1 << 15) - 1);
151 const int32_t *filterPos,
int filterSize)
155 for (i = 0; i < dstW; i++) {
157 int srcPos = filterPos[i];
159 for (j = 0; j < filterSize; j++) {
160 val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
162 dst[i] =
FFMIN(val >> 3, (1 << 19) - 1);
171 for (i = 0; i <
width; i++) {
172 dstU[i] = (
FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12;
173 dstV[i] = (
FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12;
180 for (i = 0; i <
width; i++) {
181 dstU[i] = (dstU[i] * 1799 + 4081085) >> 11;
182 dstV[i] = (dstV[i] * 1799 + 4081085) >> 11;
189 for (i = 0; i <
width; i++)
190 dst[i] = (
FFMIN(dst[i], 30189) * 19077 - 39057361) >> 14;
196 for (i = 0; i <
width; i++)
197 dst[i] = (dst[i] * 14071 + 33561947) >> 14;
205 for (i = 0; i <
width; i++) {
206 dstU[i] = (
FFMIN(dstU[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12;
207 dstV[i] = (
FFMIN(dstV[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12;
216 for (i = 0; i <
width; i++) {
217 dstU[i] = (dstU[i] * 1799 + (4081085 << 4)) >> 11;
218 dstV[i] = (dstV[i] * 1799 + (4081085 << 4)) >> 11;
226 for (i = 0; i <
width; i++)
227 dst[i] = (
FFMIN(dst[i], 30189 << 4) * 4769 - (39057361 << 2)) >> 12;
234 for (i = 0; i <
width; i++)
235 dst[i] = (dst[i] * 14071 + (33561947 << 4)) >> 14;
242 unsigned int xpos = 0;
243 for (i = 0; i < dstWidth; i++) {
244 register unsigned int xx = xpos >> 16;
245 register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
246 dst[i] = (src[xx] << 7) + (src[xx + 1] - src[xx]) * xalpha;
255 const int16_t *hLumFilter,
259 uint32_t *pal,
int isAlpha)
264 const uint8_t *
src = src_in[isAlpha ? 3 : 0];
267 toYV12(formatConvBuffer,
src, srcW, pal);
268 src = formatConvBuffer;
271 src = formatConvBuffer;
274 src = formatConvBuffer;
279 hLumFilterPos, hLumFilterSize);
285 convertRange(dst, dstWidth);
290 const uint8_t *src2,
int srcW,
int xInc)
293 unsigned int xpos = 0;
294 for (i = 0; i < dstWidth; i++) {
295 register unsigned int xx = xpos >> 16;
296 register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
297 dst1[i] = (src1[xx] * (xalpha ^ 127) + src1[xx + 1] * xalpha);
298 dst2[i] = (src2[xx] * (xalpha ^ 127) + src2[xx + 1] * xalpha);
304 int16_t *dst2,
int dstWidth,
307 const int16_t *hChrFilter,
310 uint8_t *formatConvBuffer, uint32_t *pal)
312 const uint8_t *
src1 = src_in[1], *src2 = src_in[2];
314 uint8_t *buf2 = formatConvBuffer +
316 c->
chrToYV12(formatConvBuffer, buf2, src1, src2, srcW, pal);
317 src1 = formatConvBuffer;
320 uint8_t *buf2 = formatConvBuffer +
323 src1 = formatConvBuffer;
328 c->
hcScale(c, dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);
329 c->
hcScale(c, dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);
331 c->
hcscale_fast(c, dst1, dst2, dstWidth, src1, src2, srcW, xInc);
338 #define DEBUG_SWSCALE_BUFFERS 0 339 #define DEBUG_BUFFERS(...) \ 340 if (DEBUG_SWSCALE_BUFFERS) \ 341 av_log(c, AV_LOG_DEBUG, __VA_ARGS__) 344 int srcStride[],
int srcSliceY,
345 int srcSliceH,
uint8_t *dst[],
int dstStride[])
349 const int srcW = c->
srcW;
350 const int dstW = c->
dstW;
351 const int dstH = c->
dstH;
352 const int chrDstW = c->
chrDstW;
353 const int chrSrcW = c->
chrSrcW;
354 const int lumXInc = c->
lumXInc;
355 const int chrXInc = c->
chrXInc;
408 srcStride[3] = srcStride[0];
413 DEBUG_BUFFERS(
"swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
414 src[0], srcStride[0], src[1], srcStride[1],
415 src[2], srcStride[2], src[3], srcStride[3],
416 dst[0], dstStride[0], dst[1], dstStride[1],
417 dst[2], dstStride[2], dst[3], dstStride[3]);
418 DEBUG_BUFFERS(
"srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
419 srcSliceY, srcSliceH, dstY, dstH);
420 DEBUG_BUFFERS(
"vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n",
421 vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize);
423 if (dstStride[0] % 8 != 0 || dstStride[1] % 8 != 0 ||
424 dstStride[2] % 8 != 0 || dstStride[3] % 8 != 0) {
425 static int warnedAlready = 0;
428 "Warning: dstStride is not aligned!\n" 429 " ->cannot do aligned memory accesses anymore\n");
437 if (srcSliceY == 0) {
445 if (!should_dither) {
450 for (; dstY < dstH; dstY++) {
453 dst[0] + dstStride[0] * dstY,
454 dst[1] + dstStride[1] * chrDstY,
455 dst[2] + dstStride[2] * chrDstY,
460 const int firstLumSrcY =
FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]);
463 const int firstChrSrcY =
FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);
466 int lastLumSrcY =
FFMIN(c->
srcH, firstLumSrcY + vLumFilterSize) - 1;
467 int lastLumSrcY2 =
FFMIN(c->
srcH, firstLumSrcY2 + vLumFilterSize) - 1;
468 int lastChrSrcY =
FFMIN(c->
chrSrcH, firstChrSrcY + vChrFilterSize) - 1;
472 if (firstLumSrcY > lastInLumBuf)
473 lastInLumBuf = firstLumSrcY - 1;
474 if (firstChrSrcY > lastInChrBuf)
475 lastInChrBuf = firstChrSrcY - 1;
476 assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
477 assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
480 DEBUG_BUFFERS(
"\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
481 firstLumSrcY, lastLumSrcY, lastInLumBuf);
482 DEBUG_BUFFERS(
"\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n",
483 firstChrSrcY, lastChrSrcY, lastInChrBuf);
486 enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH &&
490 lastLumSrcY = srcSliceY + srcSliceH - 1;
491 lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1;
492 DEBUG_BUFFERS(
"buffering slice: lastLumSrcY %d lastChrSrcY %d\n",
493 lastLumSrcY, lastChrSrcY);
497 while (lastInLumBuf < lastLumSrcY) {
499 src[0] + (lastInLumBuf + 1 - srcSliceY) * srcStride[0],
500 src[1] + (lastInLumBuf + 1 - srcSliceY) * srcStride[1],
501 src[2] + (lastInLumBuf + 1 - srcSliceY) * srcStride[2],
502 src[3] + (lastInLumBuf + 1 - srcSliceY) * srcStride[3],
505 assert(lumBufIndex < 2 * vLumBufSize);
506 assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
507 assert(lastInLumBuf + 1 - srcSliceY >= 0);
508 hyscale(c, lumPixBuf[lumBufIndex], dstW, src1, srcW, lumXInc,
509 hLumFilter, hLumFilterPos, hLumFilterSize,
510 formatConvBuffer, pal, 0);
512 hyscale(c, alpPixBuf[lumBufIndex], dstW, src1, srcW,
513 lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize,
514 formatConvBuffer, pal, 1);
517 lumBufIndex, lastInLumBuf);
519 while (lastInChrBuf < lastChrSrcY) {
521 src[0] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[0],
522 src[1] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[1],
523 src[2] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[2],
524 src[3] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[3],
527 assert(chrBufIndex < 2 * vChrBufSize);
528 assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
529 assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
533 hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex],
534 chrDstW, src1, chrSrcW, chrXInc,
535 hChrFilter, hChrFilterPos, hChrFilterSize,
536 formatConvBuffer, pal);
539 chrBufIndex, lastInChrBuf);
542 if (lumBufIndex >= vLumBufSize)
543 lumBufIndex -= vLumBufSize;
544 if (chrBufIndex >= vChrBufSize)
545 chrBufIndex -= vChrBufSize;
551 lastInLumBuf, lastInChrBuf);
557 if (dstY >= dstH - 2) {
561 &yuv2packed1, &yuv2packed2, &yuv2packedX, &yuv2anyX);
565 const int16_t **lumSrcPtr = (
const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
566 const int16_t **chrUSrcPtr = (
const int16_t **)chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
567 const int16_t **chrVSrcPtr = (
const int16_t **)chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
569 (
const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize :
NULL;
571 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->
srcH) {
572 const int16_t **tmpY = (
const int16_t **)lumPixBuf +
574 int neg = -firstLumSrcY, i;
575 int end =
FFMIN(c->
srcH - firstLumSrcY, vLumFilterSize);
576 for (i = 0; i < neg; i++)
577 tmpY[i] = lumSrcPtr[neg];
579 tmpY[i] = lumSrcPtr[i];
580 for (; i < vLumFilterSize; i++)
581 tmpY[i] = tmpY[i - 1];
585 const int16_t **tmpA = (
const int16_t **)alpPixBuf +
587 for (i = 0; i < neg; i++)
588 tmpA[i] = alpSrcPtr[neg];
590 tmpA[i] = alpSrcPtr[i];
591 for (; i < vLumFilterSize; i++)
592 tmpA[i] = tmpA[i - 1];
596 if (firstChrSrcY < 0 ||
597 firstChrSrcY + vChrFilterSize > c->
chrSrcH) {
598 const int16_t **tmpU = (
const int16_t **)chrUPixBuf + 2 * vChrBufSize,
599 **tmpV = (
const int16_t **)chrVPixBuf + 2 * vChrBufSize;
600 int neg = -firstChrSrcY, i;
601 int end =
FFMIN(c->
chrSrcH - firstChrSrcY, vChrFilterSize);
602 for (i = 0; i < neg; i++) {
603 tmpU[i] = chrUSrcPtr[neg];
604 tmpV[i] = chrVSrcPtr[neg];
606 for (; i < end; i++) {
607 tmpU[i] = chrUSrcPtr[i];
608 tmpV[i] = chrVSrcPtr[i];
610 for (; i < vChrFilterSize; i++) {
611 tmpU[i] = tmpU[i - 1];
612 tmpV[i] = tmpV[i - 1];
622 if (vLumFilterSize == 1) {
623 yuv2plane1(lumSrcPtr[0], dest[0], dstW, c->
lumDither8, 0);
625 yuv2planeX(vLumFilter + dstY * vLumFilterSize,
626 vLumFilterSize, lumSrcPtr, dest[0],
630 if (!((dstY & chrSkipMask) ||
isGray(dstFormat))) {
632 yuv2nv12cX(c, vChrFilter + chrDstY * vChrFilterSize,
633 vChrFilterSize, chrUSrcPtr, chrVSrcPtr,
635 }
else if (vChrFilterSize == 1) {
636 yuv2plane1(chrUSrcPtr[0], dest[1], chrDstW, c->
chrDither8, 0);
637 yuv2plane1(chrVSrcPtr[0], dest[2], chrDstW, c->
chrDither8, 3);
639 yuv2planeX(vChrFilter + chrDstY * vChrFilterSize,
640 vChrFilterSize, chrUSrcPtr, dest[1],
642 yuv2planeX(vChrFilter + chrDstY * vChrFilterSize,
643 vChrFilterSize, chrVSrcPtr, dest[2],
649 if (vLumFilterSize == 1) {
650 yuv2plane1(alpSrcPtr[0], dest[3], dstW,
653 yuv2planeX(vLumFilter + dstY * vLumFilterSize,
654 vLumFilterSize, alpSrcPtr, dest[3],
658 }
else if (yuv2packedX) {
660 vChrFilterSize <= 2) {
661 int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1];
662 yuv2packed1(c, *lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
663 alpPixBuf ? *alpSrcPtr :
NULL,
664 dest[0], dstW, chrAlpha, dstY);
665 }
else if (c->
yuv2packed2 && vLumFilterSize == 2 &&
666 vChrFilterSize == 2) {
667 int lumAlpha = vLumFilter[2 * dstY + 1];
668 int chrAlpha = vChrFilter[2 * dstY + 1];
670 lumMmxFilter[3] = vLumFilter[2 * dstY] * 0x10001;
672 chrMmxFilter[3] = vChrFilter[2 * chrDstY] * 0x10001;
673 yuv2packed2(c, lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
674 alpPixBuf ? alpSrcPtr :
NULL,
675 dest[0], dstW, lumAlpha, chrAlpha, dstY);
677 yuv2packedX(c, vLumFilter + dstY * vLumFilterSize,
678 lumSrcPtr, vLumFilterSize,
679 vChrFilter + dstY * vChrFilterSize,
680 chrUSrcPtr, chrVSrcPtr, vChrFilterSize,
681 alpSrcPtr, dest[0], dstW, dstY);
684 yuv2anyX(c, vLumFilter + dstY * vLumFilterSize,
685 lumSrcPtr, vLumFilterSize,
686 vChrFilter + dstY * vChrFilterSize,
687 chrUSrcPtr, chrVSrcPtr, vChrFilterSize,
688 alpSrcPtr, dest, dstW, dstY);
695 int height = dstY - lastDstY;
704 fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255);
707 #if HAVE_MMXEXT_INLINE 709 __asm__
volatile (
"sfence" :::
"memory");
720 return dstY - lastDstY;
int16_t ** alpPixBuf
Ring buffer for scaled horizontal alpha plane lines to be fed to the vertical scaler.
void(* hcScale)(struct SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
int chrBufIndex
Index in ring buffer of the last scaled horizontal chroma line from source.
static void lumRangeToJpeg_c(int16_t *dst, int width)
static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
int chrSrcH
Height of source chroma planes.
void(* chrConvertRange)(int16_t *dst1, int16_t *dst2, int width)
Color range conversion function for chroma planes if needed.
#define AV_LOG_WARNING
Something somehow does not look correct.
void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex, int lastInLumBuf, int lastInChrBuf)
int vChrDrop
Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user...
static void lumRangeToJpeg16_c(int16_t *_dst, int width)
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
#define DECLARE_ALIGNED(n, t, v)
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
void(* hyScale)(struct SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Scale one horizontal line of input data using a filter over the input lines, to produce one (differen...
int srcRange
0 = MPG YUV range, 1 = JPG YUV range (source image).
const uint8_t * lumDither8
void(* hyscale_fast)(struct SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
Scale one horizontal line of input data using a bilinear filter to produce one line of output data...
int dstY
Last destination vertical line output from last slice.
int srcH
Height of source luma/alpha planes.
static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
int chrDstVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination i...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static void lumRangeFromJpeg_c(int16_t *dst, int width)
int vChrFilterSize
Vertical filter size for chroma pixels.
void(* readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width)
void(* chrToYV12)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *pal)
Unscaled conversion of chroma planes to YV12 for horizontal scaler.
int16_t ** lumPixBuf
Ring buffer for scaled horizontal luma plane lines to be fed to the vertical scaler.
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
av_cold void ff_sws_init_swscale_x86(SwsContext *c)
#define SWS_FAST_BILINEAR
int lastInLumBuf
Last scaled horizontal luma/alpha line from source in the ring buffer.
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
external api for the swscale stuff
enum AVPixelFormat dstFormat
Destination pixel format.
yuv2packedX_fn yuv2packedX
int32_t * vChrFilterPos
Array of vertical filter starting positions for each dst[i] for chroma planes.
#define DEBUG_BUFFERS(...)
int dstH
Height of destination luma/alpha planes.
static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
int16_t ** chrVPixBuf
Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
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.
SwsFunc ff_getSwsFunc(SwsContext *c)
Return function pointer to fastest main scaler path function depending on architecture and available ...
static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width)
yuv2packed1_fn yuv2packed1
static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
const uint8_t ff_dither_8x8_128[8][8]
int vChrBufSize
Number of vertical chroma lines allocated in the ring buffer.
void(* hcscale_fast)(struct SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
int chrDstW
Width of destination chroma planes.
static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
static av_cold void sws_init_swscale(SwsContext *c)
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)
av_cold void ff_sws_init_swscale_ppc(SwsContext *c)
int dstRange
0 = MPG YUV range, 1 = JPG YUV range (destination image).
void(* lumToYV12)(uint8_t *dst, const uint8_t *src, int width, uint32_t *pal)
Unscaled conversion of luma plane to YV12 for horizontal scaler.
uint8_t * formatConvBuffer
static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
yuv2planar1_fn yuv2plane1
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.
yuv2interleavedX_fn yuv2nv12cX
static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src_in[4], int srcW, int xInc, const int16_t *hLumFilter, const int32_t *hLumFilterPos, int hLumFilterSize, uint8_t *formatConvBuffer, uint32_t *pal, int isAlpha)
void(* lumConvertRange)(int16_t *dst, int width)
Color range conversion function for luma plane if needed.
int dstW
Width of destination luma/alpha planes.
int(* SwsFunc)(struct SwsContext *context, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
if(ac->has_optimized_func)
int needs_hcscale
Set if there are chroma planes to be converted.
int32_t * vLumFilterPos
Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
int32_t lumMmxFilter[4 *MAX_FILTER_SIZE]
void(* yuv2packedX_fn)(struct SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point ver...
static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
yuv2planarX_fn yuv2planeX
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
void(* yuv2packed1_fn)(struct SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional v...
#define FILL8TO9_OR_10(wfunc)
static av_always_inline void fillPlane(uint8_t *plane, int stride, int width, int height, int y, uint8_t val)
static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output with multi-point vertical scaling between...
int vLumFilterSize
Vertical filter size for luma/alpha pixels.
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
int16_t * vChrFilter
Array of vertical filter coefficients for chroma planes.
void(* readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
int16_t * hLumFilter
Array of horizontal filter coefficients for luma/alpha planes.
static void fill_plane9or10(uint8_t *plane, int stride, int width, int height, int y, uint8_t val, const int dst_depth, const int big_endian)
const uint8_t * chrDither8
static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
int lumBufIndex
Index in ring buffer of the last scaled horizontal luma/alpha line from source.
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
int lastInChrBuf
Last scaled horizontal chroma line from source in the ring buffer.
yuv2packed2_fn yuv2packed2
#define CONFIG_SWSCALE_ALPHA
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
void(* readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width)
Functions to read planar input, such as planar RGB, and convert internally to Y/UV/A.
void(* yuv2packed2_fn)(struct SwsContext *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scalin...
enum AVPixelFormat srcFormat
Source pixel format.
int32_t chrMmxFilter[4 *MAX_FILTER_SIZE]
av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX)
void(* yuv2interleavedX_fn)(struct SwsContext *c, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling ...
void(* yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to YUV/RGB output by doing multi-point vertical scaling...
static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
int16_t * vLumFilter
Array of vertical filter coefficients for luma/alpha planes.
static const uint8_t sws_pb_64[8]
static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src_in[4], int srcW, int xInc, const int16_t *hChrFilter, const int32_t *hChrFilterPos, int hChrFilterSize, uint8_t *formatConvBuffer, uint32_t *pal)
int16_t * hChrFilter
Array of horizontal filter coefficients for chroma planes.
static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
void(* alpToYV12)(uint8_t *dst, const uint8_t *src, int width, uint32_t *pal)
Unscaled conversion of alpha plane to YV12 for horizontal scaler.
int chrSrcW
Width of source chroma planes.
int depth
Number of bits in the component.
int srcW
Width of source luma/alpha planes.
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...
AVPixelFormat
Pixel format.
#define AV_CEIL_RSHIFT(a, b)
Fast a / (1 << b) rounded toward +inf, assuming a >= 0 and b >= 0.
static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)