[FFmpeg-devel] [PATCH] apng: Fix typos in decoder causing incorrect results

Paul B Mahol onemda at gmail.com
Sun Jul 19 22:55:55 CEST 2015


On 7/19/15, Donny Yang <work at kota.moe> wrote:
> Signed-off-by: Donny Yang <work at kota.moe>
> ---
>  libavcodec/pngdec.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index eae778b..7a5c464 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -856,13 +856,13 @@ static int decode_fctl_chunk(AVCodecContext *avctx,
> PNGDecContext *s,
>          cur_w > s->width - x_offset|| cur_h > s->height - y_offset)
>              return AVERROR_INVALIDDATA;
>
> -    if (sequence_number == 0 && s->dispose_op == APNG_DISPOSE_OP_PREVIOUS)
> {
> +    if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
>          // No previous frame to revert to for the first frame
>          // Spec says to just treat it as a APNG_DISPOSE_OP_BACKGROUND
> -        s->dispose_op = APNG_DISPOSE_OP_BACKGROUND;
> +        dispose_op = APNG_DISPOSE_OP_BACKGROUND;
>      }
>
> -    if (s->dispose_op == APNG_BLEND_OP_OVER && !s->has_trns && (
> +    if (blend_op == APNG_BLEND_OP_OVER && !s->has_trns && (
>              avctx->pix_fmt == AV_PIX_FMT_RGB24 ||
>              avctx->pix_fmt == AV_PIX_FMT_RGB48BE ||
>              avctx->pix_fmt == AV_PIX_FMT_PAL8 ||
> @@ -870,8 +870,8 @@ static int decode_fctl_chunk(AVCodecContext *avctx,
> PNGDecContext *s,
>              avctx->pix_fmt == AV_PIX_FMT_GRAY16BE ||
>              avctx->pix_fmt == AV_PIX_FMT_MONOBLACK
>          )) {
> -        // APNG_DISPOSE_OP_OVER is the same as APNG_DISPOSE_OP_SOURCE when
> there is no alpha channel
> -        s->dispose_op = APNG_BLEND_OP_SOURCE;
> +        // APNG_BLEND_OP_OVER is the same as APNG_BLEND_OP_SOURCE when
> there is no alpha channel
> +        blend_op = APNG_BLEND_OP_SOURCE;

Are you sure about this?

This silences error: Blending with pixel format rgb24 is not implemented.

such one can be created with

ffmpeg -f lavfi -i testsrc frames%3d.png
apngasm output.png frames*.png

When played back with ffplay you see black bars after 1 second.

Replacing blend_op with dispose_op put error back.

Also I sent you doom3 file with this bug.

>      }
>
>      s->cur_w      = cur_w;
> --
> 2.4.6
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list