Commit 49255370 authored by Paul B Mahol's avatar Paul B Mahol

avcodec/utvideodec: fix gradient prediction when stride does not match width

Fixes #6340.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 9ef21a89
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment