diff mbox series

[FFmpeg-devel,1/3] avcodec/screenpresso: Optimize sum_delta_flipped()

Message ID 20200129215529.17410-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/3] avcodec/screenpresso: Optimize sum_delta_flipped()
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 29, 2020, 9:55 p.m. UTC
553 -> 332 sec

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/screenpresso.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Jan. 30, 2020, 8:22 a.m. UTC | #1
lgtm

On 1/29/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 553 -> 332 sec
>
> Testcase:
> 20280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCREENPRESSO_fuzzer-6238663432470528
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  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;
>      }
>  }
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Jan. 30, 2020, 5:46 p.m. UTC | #2
On Thu, Jan 30, 2020 at 09:22:53AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

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;
     }
 }