X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libswscale%2Fswscale.c;h=bbea0feeab0abf07253559dd018d3f55def68236;hb=b5f9f16582d9785ed6659d6bf8777cd004908cc2;hp=2e246d9997790ac2b712ca5ef89cdff80de7638d;hpb=dd2d26dc82b8f0fcbcad3104cbee03e7ec80b263;p=ffmpeg diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 2e246d99977..bbea0feeab0 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -413,8 +413,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], lastInChrBuf = firstChrSrcY - 1; } - av_assert0(firstLumSrcY >= lastInLumBuf - vLumFilterSize + 1); - av_assert0(firstChrSrcY >= lastInChrBuf - vChrFilterSize + 1); DEBUG_BUFFERS("dstY: %d\n", dstY); DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n", @@ -433,10 +431,14 @@ static int swscale(SwsContext *c, const uint8_t *src[], lastLumSrcY, lastChrSrcY); } + av_assert0((lastLumSrcY - firstLumSrcY + 1) <= hout_slice->plane[0].available_lines); + av_assert0((lastChrSrcY - firstChrSrcY + 1) <= hout_slice->plane[1].available_lines); + + posY = hout_slice->plane[0].sliceY + hout_slice->plane[0].sliceH; if (posY <= lastLumSrcY && !hasLumHoles) { firstPosY = FFMAX(firstLumSrcY, posY); - lastPosY = FFMIN(lastLumSrcY + MAX_LINES_AHEAD, srcSliceY + srcSliceH - 1); + lastPosY = FFMIN(firstLumSrcY + hout_slice->plane[0].available_lines - 1, srcSliceY + srcSliceH - 1); } else { firstPosY = lastInLumBuf + 1; lastPosY = lastLumSrcY; @@ -445,7 +447,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], cPosY = hout_slice->plane[1].sliceY + hout_slice->plane[1].sliceH; if (cPosY <= lastChrSrcY && !hasChrHoles) { firstCPosY = FFMAX(firstChrSrcY, cPosY); - lastCPosY = FFMIN(lastChrSrcY + MAX_LINES_AHEAD, AV_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample) - 1); + lastCPosY = FFMIN(firstChrSrcY + hout_slice->plane[1].available_lines - 1, AV_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample) - 1); } else { firstCPosY = lastInChrBuf + 1; lastCPosY = lastChrSrcY;