summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-04-21 21:44:28 +0200
committerPaul B Mahol <onemda@gmail.com>2017-04-21 21:46:00 +0200
commit49255370044cf4a58c81a88cb8206aee62086346 (patch)
tree97376b5c24b063834eae134bdf9cd45954226a83
parent9ef21a897c64417a0575cbc6fad6222f3163d103 (diff)
downloadffmpeg-49255370044cf4a58c81a88cb8206aee62086346.tar.gz
avcodec/utvideodec: fix gradient prediction when stride does not match width
Fixes #6340. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/utvideodec.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 25e32a6055..7979618f42 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -676,7 +676,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];
@@ -774,7 +778,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];