diff mbox series

[FFmpeg-devel] avcodec/pngdec: use correct frame for none disposition

Message ID 20210214161019.5002-1-onemda@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/pngdec: use correct frame for none disposition | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Paul B Mahol Feb. 14, 2021, 4:10 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/pngdec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos Feb. 14, 2021, 4:53 p.m. UTC | #1
Am So., 14. Feb. 2021 um 17:10 Uhr schrieb Paul B Mahol <onemda@gmail.com>:
>
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/pngdec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 61642b7cbe..f0e2a0cad4 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -1090,8 +1090,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
>
>
>      // Do the disposal operation specified by the last frame on the frame
> +    ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
>      if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
> -        ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
>          memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
>
>          if (s->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)
> @@ -1101,8 +1101,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
>          memcpy(s->previous_picture.f->data[0], buffer, s->image_linesize * s->height);
>          ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
>      } else {
> -        ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
> -        memcpy(buffer, s->previous_picture.f->data[0], s->image_linesize * s->height);
> +        memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);

Please mention ticket #9017, there is no way to understand where this
comes from.

Thank you for looking into this, Carl Eugen
Anton Khirnov Feb. 16, 2021, 4:37 p.m. UTC | #2
Quoting Paul B Mahol (2021-02-14 17:10:19)
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/pngdec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 61642b7cbe..f0e2a0cad4 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -1090,8 +1090,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
>  
>  
>      // Do the disposal operation specified by the last frame on the frame
> +    ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
>      if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
> -        ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
>          memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
>  
>          if (s->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)
> @@ -1101,8 +1101,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
>          memcpy(s->previous_picture.f->data[0], buffer, s->image_linesize * s->height);
>          ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
>      } else {
> -        ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
> -        memcpy(buffer, s->previous_picture.f->data[0], s->image_linesize * s->height);
> +        memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
>      }

At least the commit message seems to be wrong, since the source changes
for DISPOSE_OP_PREVIOUS
diff mbox series

Patch

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 61642b7cbe..f0e2a0cad4 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1090,8 +1090,8 @@  static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
 
 
     // Do the disposal operation specified by the last frame on the frame
+    ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
     if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
-        ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
         memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
 
         if (s->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)
@@ -1101,8 +1101,7 @@  static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
         memcpy(s->previous_picture.f->data[0], buffer, s->image_linesize * s->height);
         ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
     } else {
-        ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
-        memcpy(buffer, s->previous_picture.f->data[0], s->image_linesize * s->height);
+        memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
     }
 
     // Perform blending