X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libswscale%2Fswscale.c;h=9cb7e8f6acd065ce7838ec54a1f475f5dd35dbec;hb=7c8ad72f1ce2ae747edd5c3f49bb052b1586c90f;hp=40695503ad20479f255123cb36e923a447f2df8f;hpb=4069096dd535ee99175c2a29c1a1f59c3fc110c1;p=ffmpeg diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 40695503ad2..9cb7e8f6acd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -266,12 +266,9 @@ static int swscale(SwsContext *c, const uint8_t *src[], /* vars which will change and which we need to store back in the context */ int dstY = c->dstY; - int lumBufIndex = c->lumBufIndex; - int chrBufIndex = c->chrBufIndex; int lastInLumBuf = c->lastInLumBuf; int lastInChrBuf = c->lastInChrBuf; - int lumStart = 0; int lumEnd = c->descIndex[0]; int chrStart = lumEnd; @@ -283,25 +280,21 @@ static int swscale(SwsContext *c, const uint8_t *src[], SwsSlice *vout_slice = &c->slice[c->numSlice-1]; SwsFilterDescriptor *desc = c->desc; - int needAlpha = c->needAlpha; int hasLumHoles = 1; int hasChrHoles = 1; - if (isPacked(c->srcFormat)) { - src[0] = src[1] = src[2] = src[3] = src[0]; - srcStride[0] = srcStride[1] = srcStride[2] = srcStride[3] = srcStride[0]; } - srcStride[1] <<= c->vChrDrop; - srcStride[2] <<= c->vChrDrop; + srcStride[1] *= 1 << c->vChrDrop; + srcStride[2] *= 1 << c->vChrDrop; DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n", src[0], srcStride[0], src[1], srcStride[1], @@ -341,8 +334,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], * will not get executed. This is not really intended but works * currently, so people might do it. */ if (srcSliceY == 0) { - lumBufIndex = -1; - chrBufIndex = -1; dstY = 0; lastInLumBuf = -1; lastInChrBuf = -1; @@ -466,7 +457,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], desc[i].process(c, &desc[i], firstPosY, lastPosY - firstPosY + 1); } - lumBufIndex += lastLumSrcY - lastInLumBuf; lastInLumBuf = lastLumSrcY; if (cPosY < lastChrSrcY + 1) { @@ -474,20 +464,13 @@ static int swscale(SwsContext *c, const uint8_t *src[], desc[i].process(c, &desc[i], firstCPosY, lastCPosY - firstCPosY + 1); } - chrBufIndex += lastChrSrcY - lastInChrBuf; lastInChrBuf = lastChrSrcY; - // wrap buf index around to stay inside the ring buffer - if (lumBufIndex >= vLumFilterSize) - lumBufIndex -= vLumFilterSize; - if (chrBufIndex >= vChrFilterSize) - chrBufIndex -= vChrFilterSize; if (!enough_lines) break; // we can't output a dstY line so let's try with the next slice #if HAVE_MMX_INLINE - ff_updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex, - lastInLumBuf, lastInChrBuf); + ff_updateMMXDitherTables(c, dstY); #endif if (should_dither) { c->chrDither8 = ff_dither_8x8_128[chrDstY & 7]; @@ -517,6 +500,11 @@ static int swscale(SwsContext *c, const uint8_t *src[], fillPlane16(dst[3], dstStride[3], length, height, lastDstY, 1, desc->comp[3].depth, isBE(dstFormat)); + } else if (is32BPS(dstFormat)) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); + fillPlane32(dst[3], dstStride[3], length, height, lastDstY, + 1, desc->comp[3].depth, + isBE(dstFormat), desc->flags & AV_PIX_FMT_FLAG_FLOAT); } else fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255); } @@ -529,8 +517,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], /* store changed local vars back in the context */ c->dstY = dstY; - c->lumBufIndex = lumBufIndex; - c->chrBufIndex = chrBufIndex; c->lastInLumBuf = lastInLumBuf; c->lastInChrBuf = lastInChrBuf; @@ -572,7 +558,6 @@ static av_cold void sws_init_swscale(SwsContext *c) ff_sws_init_input_funcs(c); - if (c->srcBpc == 8) { if (c->dstBpc <= 14) { c->hyScale = c->hcScale = hScale8To15_c; @@ -790,8 +775,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c, } if (c->gamma_flag && c->cascaded_context[0]) { - - ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); @@ -985,7 +968,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c, c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2); - if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH; uint16_t *dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[0]);