static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,

                               AVFrame *p, AVPacket *avpkt)

{

    AVDictionary *metadata  = NULL;

    uint32_t tag, length;

    int decode_next_dat = 0;

    int ret;



    for (;;) {

        length = bytestream2_get_bytes_left(&s->gb);

        if (length <= 0) {

            if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {

                if (!(s->state & PNG_IDAT))

                    return 0;

                else

                    goto exit_loop;

            }

            av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length);

            if (   s->state & PNG_ALLIMAGE

                && avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)

                goto exit_loop;

            ret = AVERROR_INVALIDDATA;

            goto fail;

        }



        length = bytestream2_get_be32(&s->gb);

        if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {

            av_log(avctx, AV_LOG_ERROR, "chunk too big\n");

            ret = AVERROR_INVALIDDATA;

            goto fail;

        }

        tag = bytestream2_get_le32(&s->gb);

        if (avctx->debug & FF_DEBUG_STARTCODE)

            av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",

                (tag & 0xff),

                ((tag >> 8) & 0xff),

                ((tag >> 16) & 0xff),

                ((tag >> 24) & 0xff), length);

        switch (tag) {

        case MKTAG('I', 'H', 'D', 'R'):

            if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0)

                goto fail;

            break;

        case MKTAG('p', 'H', 'Y', 's'):

            if ((ret = decode_phys_chunk(avctx, s)) < 0)

                goto fail;

            break;

        case MKTAG('f', 'c', 'T', 'L'):

            if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if ((ret = decode_fctl_chunk(avctx, s, length)) < 0)

                goto fail;

            decode_next_dat = 1;

            break;

        case MKTAG('f', 'd', 'A', 'T'):

            if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if (!decode_next_dat) {

                ret = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_get_be32(&s->gb);

            length -= 4;

            /* fallthrough */

        case MKTAG('I', 'D', 'A', 'T'):

            if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)

                goto skip_tag;

            if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0)

                goto fail;

            break;

        case MKTAG('P', 'L', 'T', 'E'):

            if (decode_plte_chunk(avctx, s, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'R', 'N', 'S'):

            if (decode_trns_chunk(avctx, s, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'E', 'X', 't'):

            if (decode_text_chunk(s, length, 0, &metadata) < 0)

                av_log(avctx, AV_LOG_WARNING, "Broken tEXt chunk\n");

            bytestream2_skip(&s->gb, length + 4);

            break;

        case MKTAG('z', 'T', 'X', 't'):

            if (decode_text_chunk(s, length, 1, &metadata) < 0)

                av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n");

            bytestream2_skip(&s->gb, length + 4);

            break;

        case MKTAG('I', 'E', 'N', 'D'):

            if (!(s->state & PNG_ALLIMAGE))

                av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");

            if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {

                ret = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_skip(&s->gb, 4); /* crc */

            goto exit_loop;

        default:

            /* skip tag */

skip_tag:

            bytestream2_skip(&s->gb, length + 4);

            break;

        }

    }

exit_loop:



    if (s->bits_per_pixel <= 4)

        handle_small_bpp(s, p);



    /* apply transparency if needed */

    if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) {

        size_t byte_depth = s->bit_depth > 8 ? 2 : 1;

        size_t raw_bpp = s->bpp - byte_depth;

        unsigned x, y;



        for (y = 0; y < s->height; ++y) {

            uint8_t *row = &s->image_buf[s->image_linesize * y];



            /* since we're updating in-place, we have to go from right to left */

            for (x = s->width; x > 0; --x) {

                uint8_t *pixel = &row[s->bpp * (x - 1)];

                memmove(pixel, &row[raw_bpp * (x - 1)], raw_bpp);



                if (!memcmp(pixel, s->transparent_color_be, raw_bpp)) {

                    memset(&pixel[raw_bpp], 0, byte_depth);

                } else {

                    memset(&pixel[raw_bpp], 0xff, byte_depth);

                }

            }

        }

    }



    /* handle p-frames only if a predecessor frame is available */

    if (s->last_picture.f->data[0]) {

        if (   !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")

            && s->last_picture.f->width == p->width

            && s->last_picture.f->height== p->height

            && s->last_picture.f->format== p->format

         ) {

            if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)

                handle_p_frame_png(s, p);

            else if (CONFIG_APNG_DECODER &&

                     avctx->codec_id == AV_CODEC_ID_APNG &&

                     (ret = handle_p_frame_apng(avctx, s, p)) < 0)

                goto fail;

        }

    }

    ff_thread_report_progress(&s->picture, INT_MAX, 0);




    av_frame_set_metadata(p, metadata);

    metadata   = NULL;

    return 0;



fail:

    av_dict_free(&metadata);

    ff_thread_report_progress(&s->picture, INT_MAX, 0);


    return ret;

}
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,

                               AVFrame *p, AVPacket *avpkt)

{

    AVDictionary *metadata  = NULL;

    uint32_t tag, length;

    int decode_next_dat = 0;

    int ret;



    for (;;) {

        length = bytestream2_get_bytes_left(&s->gb);

        if (length <= 0) {

            if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {

                if (!(s->state & PNG_IDAT))

                    return 0;

                else

                    goto exit_loop;

            }

            av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length);

            if (   s->state & PNG_ALLIMAGE

                && avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)

                goto exit_loop;

            ret = AVERROR_INVALIDDATA;

            goto fail;

        }



        length = bytestream2_get_be32(&s->gb);

        if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {

            av_log(avctx, AV_LOG_ERROR, "chunk too big\n");

            ret = AVERROR_INVALIDDATA;

            goto fail;

        }

        tag = bytestream2_get_le32(&s->gb);

        if (avctx->debug & FF_DEBUG_STARTCODE)

            av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",

                (tag & 0xff),

                ((tag >> 8) & 0xff),

                ((tag >> 16) & 0xff),

                ((tag >> 24) & 0xff), length);

        switch (tag) {

        case MKTAG('I', 'H', 'D', 'R'):

            if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0)

                goto fail;

            break;

        case MKTAG('p', 'H', 'Y', 's'):

            if ((ret = decode_phys_chunk(avctx, s)) < 0)

                goto fail;

            break;

        case MKTAG('f', 'c', 'T', 'L'):

            if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if ((ret = decode_fctl_chunk(avctx, s, length)) < 0)

                goto fail;

            decode_next_dat = 1;

            break;

        case MKTAG('f', 'd', 'A', 'T'):

            if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if (!decode_next_dat) {

                ret = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_get_be32(&s->gb);

            length -= 4;

            

        case MKTAG('I', 'D', 'A', 'T'):

            if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)

                goto skip_tag;

            if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0)

                goto fail;

            break;

        case MKTAG('P', 'L', 'T', 'E'):

            if (decode_plte_chunk(avctx, s, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'R', 'N', 'S'):

            if (decode_trns_chunk(avctx, s, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'E', 'X', 't'):

            if (decode_text_chunk(s, length, 0, &metadata) < 0)

                av_log(avctx, AV_LOG_WARNING, "Broken tEXt chunk\n");

            bytestream2_skip(&s->gb, length + 4);

            break;

        case MKTAG('z', 'T', 'X', 't'):

            if (decode_text_chunk(s, length, 1, &metadata) < 0)

                av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n");

            bytestream2_skip(&s->gb, length + 4);

            break;

        case MKTAG('I', 'E', 'N', 'D'):

            if (!(s->state & PNG_ALLIMAGE))

                av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");

            if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {

                ret = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_skip(&s->gb, 4); 

            goto exit_loop;

        default:

            

skip_tag:

            bytestream2_skip(&s->gb, length + 4);

            break;

        }

    }

exit_loop:



    if (s->bits_per_pixel <= 4)

        handle_small_bpp(s, p);



    

    if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) {

        size_t byte_depth = s->bit_depth > 8 ? 2 : 1;

        size_t raw_bpp = s->bpp - byte_depth;

        unsigned x, y;



        for (y = 0; y < s->height; ++y) {

            uint8_t *row = &s->image_buf[s->image_linesize * y];



            

            for (x = s->width; x > 0; --x) {

                uint8_t *pixel = &row[s->bpp * (x - 1)];

                memmove(pixel, &row[raw_bpp * (x - 1)], raw_bpp);



                if (!memcmp(pixel, s->transparent_color_be, raw_bpp)) {

                    memset(&pixel[raw_bpp], 0, byte_depth);

                } else {

                    memset(&pixel[raw_bpp], 0xff, byte_depth);

                }

            }

        }

    }



    

    if (s->last_picture.f->data[0]) {

        if (   !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")

            && s->last_picture.f->width == p->width

            && s->last_picture.f->height== p->height

            && s->last_picture.f->format== p->format

         ) {

            if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)

                handle_p_frame_png(s, p);

            else if (CONFIG_APNG_DECODER &&

                     avctx->codec_id == AV_CODEC_ID_APNG &&

                     (ret = handle_p_frame_apng(avctx, s, p)) < 0)

                goto fail;

        }

    }

    ff_thread_report_progress(&s->picture, INT_MAX, 0);




    av_frame_set_metadata(p, metadata);

    metadata   = NULL;

    return 0;



fail:

    av_dict_free(&metadata);

    ff_thread_report_progress(&s->picture, INT_MAX, 0);


    return ret;

}
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,

                               AVFrame *VAR_2, AVPacket *VAR_3)

{

    AVDictionary *metadata  = NULL;

    uint32_t tag, length;

    int VAR_4 = 0;

    int VAR_5;



    for (;;) {

        length = bytestream2_get_bytes_left(&VAR_1->gb);

        if (length <= 0) {

            if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && length == 0) {

                if (!(VAR_1->state & PNG_IDAT))

                    return 0;

                else

                    goto exit_loop;

            }

            av_log(VAR_0, AV_LOG_ERROR, "%d bytes left\n", length);

            if (   VAR_1->state & PNG_ALLIMAGE

                && VAR_0->strict_std_compliance <= FF_COMPLIANCE_NORMAL)

                goto exit_loop;

            VAR_5 = AVERROR_INVALIDDATA;

            goto fail;

        }



        length = bytestream2_get_be32(&VAR_1->gb);

        if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&VAR_1->gb)) {

            av_log(VAR_0, AV_LOG_ERROR, "chunk too big\n");

            VAR_5 = AVERROR_INVALIDDATA;

            goto fail;

        }

        tag = bytestream2_get_le32(&VAR_1->gb);

        if (VAR_0->debug & FF_DEBUG_STARTCODE)

            av_log(VAR_0, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",

                (tag & 0xff),

                ((tag >> 8) & 0xff),

                ((tag >> 16) & 0xff),

                ((tag >> 24) & 0xff), length);

        switch (tag) {

        case MKTAG('I', 'H', 'D', 'R'):

            if ((VAR_5 = decode_ihdr_chunk(VAR_0, VAR_1, length)) < 0)

                goto fail;

            break;

        case MKTAG('VAR_2', 'H', 'Y', 'VAR_1'):

            if ((VAR_5 = decode_phys_chunk(VAR_0, VAR_1)) < 0)

                goto fail;

            break;

        case MKTAG('f', 'c', 'T', 'L'):

            if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if ((VAR_5 = decode_fctl_chunk(VAR_0, VAR_1, length)) < 0)

                goto fail;

            VAR_4 = 1;

            break;

        case MKTAG('f', 'd', 'A', 'T'):

            if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)

                goto skip_tag;

            if (!VAR_4) {

                VAR_5 = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_get_be32(&VAR_1->gb);

            length -= 4;

            

        case MKTAG('I', 'D', 'A', 'T'):

            if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && !VAR_4)

                goto skip_tag;

            if ((VAR_5 = decode_idat_chunk(VAR_0, VAR_1, length, VAR_2)) < 0)

                goto fail;

            break;

        case MKTAG('P', 'L', 'T', 'E'):

            if (decode_plte_chunk(VAR_0, VAR_1, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'R', 'N', 'S'):

            if (decode_trns_chunk(VAR_0, VAR_1, length) < 0)

                goto skip_tag;

            break;

        case MKTAG('t', 'E', 'X', 't'):

            if (decode_text_chunk(VAR_1, length, 0, &metadata) < 0)

                av_log(VAR_0, AV_LOG_WARNING, "Broken tEXt chunk\n");

            bytestream2_skip(&VAR_1->gb, length + 4);

            break;

        case MKTAG('z', 'T', 'X', 't'):

            if (decode_text_chunk(VAR_1, length, 1, &metadata) < 0)

                av_log(VAR_0, AV_LOG_WARNING, "Broken zTXt chunk\n");

            bytestream2_skip(&VAR_1->gb, length + 4);

            break;

        case MKTAG('I', 'E', 'N', 'D'):

            if (!(VAR_1->state & PNG_ALLIMAGE))

                av_log(VAR_0, AV_LOG_ERROR, "IEND without all image\n");

            if (!(VAR_1->state & (PNG_ALLIMAGE|PNG_IDAT))) {

                VAR_5 = AVERROR_INVALIDDATA;

                goto fail;

            }

            bytestream2_skip(&VAR_1->gb, 4); 

            goto exit_loop;

        default:

            

skip_tag:

            bytestream2_skip(&VAR_1->gb, length + 4);

            break;

        }

    }

exit_loop:



    if (VAR_1->bits_per_pixel <= 4)

        handle_small_bpp(VAR_1, VAR_2);



    

    if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) {

        size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1;

        size_t raw_bpp = VAR_1->bpp - byte_depth;

        unsigned VAR_6, VAR_7;



        for (VAR_7 = 0; VAR_7 < VAR_1->height; ++VAR_7) {

            uint8_t *row = &VAR_1->image_buf[VAR_1->image_linesize * VAR_7];



            

            for (VAR_6 = VAR_1->width; VAR_6 > 0; --VAR_6) {

                uint8_t *pixel = &row[VAR_1->bpp * (VAR_6 - 1)];

                memmove(pixel, &row[raw_bpp * (VAR_6 - 1)], raw_bpp);



                if (!memcmp(pixel, VAR_1->transparent_color_be, raw_bpp)) {

                    memset(&pixel[raw_bpp], 0, byte_depth);

                } else {

                    memset(&pixel[raw_bpp], 0xff, byte_depth);

                }

            }

        }

    }



    

    if (VAR_1->last_picture.f->data[0]) {

        if (   !(VAR_3->flags & AV_PKT_FLAG_KEY) && VAR_0->codec_tag != AV_RL32("MPNG")

            && VAR_1->last_picture.f->width == VAR_2->width

            && VAR_1->last_picture.f->height== VAR_2->height

            && VAR_1->last_picture.f->format== VAR_2->format

         ) {

            if (CONFIG_PNG_DECODER && VAR_0->codec_id != AV_CODEC_ID_APNG)

                handle_p_frame_png(VAR_1, VAR_2);

            else if (CONFIG_APNG_DECODER &&

                     VAR_0->codec_id == AV_CODEC_ID_APNG &&

                     (VAR_5 = handle_p_frame_apng(VAR_0, VAR_1, VAR_2)) < 0)

                goto fail;

        }

    }

    ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0);




    av_frame_set_metadata(VAR_2, metadata);

    metadata   = NULL;

    return 0;



fail:

    av_dict_free(&metadata);

    ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0);


    return VAR_5;

}
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,
AVFrame *VAR_2, AVPacket *VAR_3)
{ AVDictionary *metadata  = NULL; uint32_t tag, length; int VAR_4 = 0; int VAR_5; for (;;) { length = bytestream2_get_bytes_left(&VAR_1->gb); if (length <= 0) { if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && length == 0) { if (!(VAR_1->state & PNG_IDAT))
return 0; else
goto exit_loop; } av_log(VAR_0, AV_LOG_ERROR, "%d bytes left\n", length); if (   VAR_1->state & PNG_ALLIMAGE
&& VAR_0->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
goto exit_loop; VAR_5 = AVERROR_INVALIDDATA; goto fail; } length = bytestream2_get_be32(&VAR_1->gb); if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&VAR_1->gb)) { av_log(VAR_0, AV_LOG_ERROR, "chunk too big\n"); VAR_5 = AVERROR_INVALIDDATA; goto fail; } tag = bytestream2_get_le32(&VAR_1->gb); if (VAR_0->debug & FF_DEBUG_STARTCODE)
av_log(VAR_0, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",
(tag & 0xff),
((tag >> 8) & 0xff),
((tag >> 16) & 0xff),
((tag >> 24) & 0xff), length); switch (tag) { case MKTAG('I', 'H', 'D', 'R'):
if ((VAR_5 = decode_ihdr_chunk(VAR_0, VAR_1, length)) < 0)
goto fail; break; case MKTAG('VAR_2', 'H', 'Y', 'VAR_1'):
if ((VAR_5 = decode_phys_chunk(VAR_0, VAR_1)) < 0)
goto fail; break; case MKTAG('f', 'c', 'T', 'L'):
if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)
goto skip_tag; if ((VAR_5 = decode_fctl_chunk(VAR_0, VAR_1, length)) < 0)
goto fail; VAR_4 = 1; break; case MKTAG('f', 'd', 'A', 'T'):
if (!CONFIG_APNG_DECODER || VAR_0->codec_id != AV_CODEC_ID_APNG)
goto skip_tag; if (!VAR_4) { VAR_5 = AVERROR_INVALIDDATA; goto fail; } bytestream2_get_be32(&VAR_1->gb); length -= 4; case MKTAG('I', 'D', 'A', 'T'):
if (CONFIG_APNG_DECODER && VAR_0->codec_id == AV_CODEC_ID_APNG && !VAR_4)
goto skip_tag; if ((VAR_5 = decode_idat_chunk(VAR_0, VAR_1, length, VAR_2)) < 0)
goto fail; break; case MKTAG('P', 'L', 'T', 'E'):
if (decode_plte_chunk(VAR_0, VAR_1, length) < 0)
goto skip_tag; break; case MKTAG('t', 'R', 'N', 'S'):
if (decode_trns_chunk(VAR_0, VAR_1, length) < 0)
goto skip_tag; break; case MKTAG('t', 'E', 'X', 't'):
if (decode_text_chunk(VAR_1, length, 0, &metadata) < 0)
av_log(VAR_0, AV_LOG_WARNING, "Broken tEXt chunk\n"); bytestream2_skip(&VAR_1->gb, length + 4); break; case MKTAG('z', 'T', 'X', 't'):
if (decode_text_chunk(VAR_1, length, 1, &metadata) < 0)
av_log(VAR_0, AV_LOG_WARNING, "Broken zTXt chunk\n"); bytestream2_skip(&VAR_1->gb, length + 4); break; case MKTAG('I', 'E', 'N', 'D'):
if (!(VAR_1->state & PNG_ALLIMAGE))
av_log(VAR_0, AV_LOG_ERROR, "IEND without all image\n"); if (!(VAR_1->state & (PNG_ALLIMAGE|PNG_IDAT))) { VAR_5 = AVERROR_INVALIDDATA; goto fail; } bytestream2_skip(&VAR_1->gb, 4); goto exit_loop; default:
skip_tag:
bytestream2_skip(&VAR_1->gb, length + 4); break; } } exit_loop:
if (VAR_1->bits_per_pixel <= 4)
handle_small_bpp(VAR_1, VAR_2); if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) { size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1; size_t raw_bpp = VAR_1->bpp - byte_depth; unsigned VAR_6, VAR_7; for (VAR_7 = 0; VAR_7 < VAR_1->height; ++VAR_7) { uint8_t *row = &VAR_1->image_buf[VAR_1->image_linesize * VAR_7]; for (VAR_6 = VAR_1->width; VAR_6 > 0; --VAR_6) { uint8_t *pixel = &row[VAR_1->bpp * (VAR_6 - 1)]; memmove(pixel, &row[raw_bpp * (VAR_6 - 1)], raw_bpp); if (!memcmp(pixel, VAR_1->transparent_color_be, raw_bpp)) { memset(&pixel[raw_bpp], 0, byte_depth); } else { memset(&pixel[raw_bpp], 0xff, byte_depth); } } } } if (VAR_1->last_picture.f->data[0]) { if (   !(VAR_3->flags & AV_PKT_FLAG_KEY) && VAR_0->codec_tag != AV_RL32("MPNG")
&& VAR_1->last_picture.f->width == VAR_2->width
&& VAR_1->last_picture.f->height== VAR_2->height
&& VAR_1->last_picture.f->format== VAR_2->format
) { if (CONFIG_PNG_DECODER && VAR_0->codec_id != AV_CODEC_ID_APNG)
handle_p_frame_png(VAR_1, VAR_2); else if (CONFIG_APNG_DECODER &&
VAR_0->codec_id == AV_CODEC_ID_APNG &&
(VAR_5 = handle_p_frame_apng(VAR_0, VAR_1, VAR_2)) < 0)
goto fail; } } ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0); av_frame_set_metadata(VAR_2, metadata); metadata   = NULL; return 0; fail:
av_dict_free(&metadata); ff_thread_report_progress(&VAR_1->picture, INT_MAX, 0); return VAR_5; }