summaryrefslogtreecommitdiff
path: root/libswscale/swscale.c
diff options
context:
space:
mode:
authorPedro Arthur <bygrandao@gmail.com>2016-06-08 21:38:49 -0300
committerPedro Arthur <bygrandao@gmail.com>2016-06-10 09:45:24 -0300
commite616e9a4b8fde2686fcd283be3929eee3fb2be91 (patch)
tree13482750833a40d52d37532e53321977999bc046 /libswscale/swscale.c
parentb5deacfb1fece3406ef0bb790c1614a7096513b4 (diff)
swscale: fix ring buffer size when scaling slices of a frame
The ring buffer size should be able to store input lines when there is not enough lines to output a single line.
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r--libswscale/swscale.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 2e246d9997..bbea0feeab 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;