ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Mon 
Aug 13 00:19:55 2018 +0200| [dbac849c4db9c9378ab6e55f4f489debf2659b04] | 
committer: Michael Niedermayer

avcodec/lagarith: Optimize FRAME_SOLID_RGBA

Changes 5466110 decicycles to 1798072 decicycles (tested with 
fate-suite/lagarith/lag-rgb32.avi)

Fixes: Timeout
Fixes: 
9484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5707859156271104

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

 libavcodec/lagarith.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 510a6ff2d6..3d3b4d41f4 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -572,8 +572,14 @@ static int lag_decode_frame(AVCodecContext *avctx,
 
         dst = p->data[0];
         if (frametype == FRAME_SOLID_RGBA) {
+            int qwidth = avctx->width>>2;
+            uint64_t c = ((uint64_t)offset_gu << 32) | offset_gu;
         for (j = 0; j < avctx->height; j++) {
-            for (i = 0; i < avctx->width; i++)
+            for (i = 0; i < qwidth; i++) {
+                AV_WN64(dst + i * 16    , c);
+                AV_WN64(dst + i * 16 + 8, c);
+            }
+            for (i = 4*qwidth; i < avctx->width; i++)
                 AV_WN32(dst + i * 4, offset_gu);
             dst += p->linesize[0];
         }

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to