[FFmpeg-cvslog] lavfi/deshake: fix deshake crash issue.

Jun Zhao git at videolan.org
Sat Oct 6 16:30:56 EEST 2018


ffmpeg | branch: master | Jun Zhao <mypopydev at gmail.com> | Tue Sep 18 14:57:49 2018 +0800| [5a3ce4a92b84cded3aab7ffd7fb80e0c9130e74c] | committer: Jun Zhao

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a3ce4a92b84cded3aab7ffd7fb80e0c9130e74c
---

 libavfilter/vf_deshake.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 55ce5e18a1..c8480e74dd 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list