[FFmpeg-cvslog] avcodec/screenpresso: Optimize sum_delta_flipped()

Michael Niedermayer git at videolan.org
Thu Jan 30 20:34:21 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 29 19:20:29 2020 +0100| [20916f9bc4534678a87684994377c181d8aa16bc] | committer: Michael Niedermayer

avcodec/screenpresso: Optimize sum_delta_flipped()

553 -> 332 sec

Testcase: 20280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCREENPRESSO_fuzzer-6238663432470528

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/screenpresso.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/screenpresso.c b/libavcodec/screenpresso.c
index 5fac100897..d73c24df83 100644
--- a/libavcodec/screenpresso.c
+++ b/libavcodec/screenpresso.c
@@ -94,8 +94,9 @@ static void sum_delta_flipped(uint8_t       *dst, int dst_linesize,
 {
     int i;
     for (; height > 0; height--) {
+        const uint8_t *src1 = &src[(height - 1) * src_linesize];
         for (i = 0; i < bytewidth; i++)
-            dst[i] += src[(height - 1) * src_linesize + i];
+            dst[i] += src1[i];
         dst += dst_linesize;
     }
 }



More information about the ffmpeg-cvslog mailing list