libavcodec/vp8: Do not compute line pointers per pixel in fade()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 24 Jun 2018 00:50:16 +0000 (02:50 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 7 Jul 2018 10:09:34 +0000 (12:09 +0200)
72->60 seconds
Testcase: 8680/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5861504418054144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vp8.c

index 62b9f8b..3adfeac 100644 (file)
@@ -492,9 +492,11 @@ static void fade(uint8_t *dst, ptrdiff_t dst_linesize,
 {
     int i, j;
     for (j = 0; j < height; j++) {
+        const uint8_t *src2 = src + j * src_linesize;
+        uint8_t *dst2 = dst + j * dst_linesize;
         for (i = 0; i < width; i++) {
-            uint8_t y = src[j * src_linesize + i];
-            dst[j * dst_linesize + i] = av_clip_uint8(y + ((y * beta) >> 8) + alpha);
+            uint8_t y = src2[i];
+            dst2[i] = av_clip_uint8(y + ((y * beta) >> 8) + alpha);
         }
     }
 }