From 273a12a013339d4b1c337a5ad8332ff97afa2022 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Mon, 5 Dec 2011 08:37:55 -0800 Subject: [PATCH] fix off-by-1 diff in case cropping and simple filtering Change-Id: I6dea172d0cf129f9986b8a3e1eea85fa97a70402 --- src/dec/frame.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dec/frame.c b/src/dec/frame.c index 1bf3e070..00c735af 100644 --- a/src/dec/frame.c +++ b/src/dec/frame.c @@ -480,8 +480,13 @@ VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) { dec->tl_mb_y_ = 0; } else { // For simple filter, we can filter only the cropped region. - dec->tl_mb_y_ = io->crop_top >> 4; - dec->tl_mb_x_ = io->crop_left >> 4; + // We include 'extra_pixels' on the other side of the boundary, since + // vertical or horizontal filtering of the previous macroblock can + // modify some abutting pixels. + dec->tl_mb_x_ = (io->crop_left - extra_pixels) >> 4; + dec->tl_mb_y_ = (io->crop_top - extra_pixels) >> 4; + if (dec->tl_mb_x_ < 0) dec->tl_mb_x_ = 0; + if (dec->tl_mb_y_ < 0) dec->tl_mb_y_ = 0; } // We need some 'extra' pixels on the right/bottom. dec->br_mb_y_ = (io->crop_bottom + 15 + extra_pixels) >> 4;