1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/deshake: fix deshake crash issue.

Fixes ticket #7441.

for block contrast calculate, the block is like this:

|<---------------- stride-----------------------|
+----------------------------------------------->  X
|
|            w = 16
|    (cx,cy)+------+
|           |      |
|h=blocksize|      |
|           |      |
|           +------+
V

Y

so we calc the block contrast use:
   (cy + y) * stride + (cx + x)

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
This commit is contained in:
Jun Zhao 2018-09-18 14:57:49 +08:00 committed by Jun Zhao
parent 6ff4473012
commit 5a3ce4a92b

View File

@ -196,7 +196,7 @@ static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize)
for (i = 0; i <= blocksize * 2; i++) {
// We use a width of 16 here to match the sad function
for (j = 0; j <= 15; j++) {
pos = (y - i) * stride + (x - j);
pos = (y + i) * stride + (x + j);
if (src[pos] < lowest)
lowest = src[pos];
else if (src[pos] > highest) {