[FFmpeg-cvslog] utvideodec: Fix gradient prediction when stride does not match width
Paul B Mahol
git at videolan.org
Mon Oct 30 19:33:51 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Apr 21 21:44:28 2017 +0200| [b812db66af160bfac2f64aef2ade4aed7eb76b12] | committer: Luca Barbato
utvideodec: Fix gradient prediction when stride does not match width
Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b812db66af160bfac2f64aef2ade4aed7eb76b12
---
libavcodec/utvideodec.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 0f58c83979..ed6368e4cd 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -686,7 +686,11 @@ static void restore_gradient_planar_il(UtvideoContext *c, uint8_t *src, ptrdiff_
C = bsrc[i - 1];
bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
}
- for (i = 0; i < width; i++) {
+ A = bsrc[-stride];
+ B = bsrc[-(1 + stride + stride - width)];
+ C = bsrc[width - 1];
+ bsrc[stride] = (A - B + C + bsrc[stride]) & 0xFF;
+ for (i = 1; i < width; i++) {
A = bsrc[i - stride];
B = bsrc[i - (1 + stride)];
C = bsrc[i - 1 + stride];
@@ -784,7 +788,11 @@ static void restore_gradient_packed_il(uint8_t *src, int step, ptrdiff_t stride,
C = bsrc[i - step];
bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
}
- for (i = 0; i < width * step; i += step) {
+ A = bsrc[-stride];
+ B = bsrc[-(step + stride + stride - width * step)];
+ C = bsrc[width * step - step];
+ bsrc[stride] = (A - B + C + bsrc[stride]) & 0xFF;
+ for (i = step; i < width * step; i += step) {
A = bsrc[i - stride];
B = bsrc[i - (step + stride)];
C = bsrc[i - step + stride];
More information about the ffmpeg-cvslog
mailing list