static int decode_frame_ilbm(AVCodecContext *avctx,

                            void *data, int *data_size,

                            AVPacket *avpkt)

{

    IffContext *s = avctx->priv_data;

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    const uint8_t *buf_end = buf+buf_size;

    int y, plane;



    if (avctx->reget_buffer(avctx, &s->frame) < 0){

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }



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

        uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];

        memset(row, 0, avctx->pix_fmt == PIX_FMT_PAL8 ? avctx->width : (avctx->width * 4));

        for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {

            if (avctx->pix_fmt == PIX_FMT_PAL8) {

                decodeplane8(row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);

            } else { // PIX_FMT_BGR32

                decodeplane32(row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);

            }

            buf += s->planesize;

        }

    }



    *data_size = sizeof(AVFrame);

    *(AVFrame*)data = s->frame;

    return buf_size;

}

static int decode_frame_ilbm(AVCodecContext *avctx,

                            void *data, int *data_size,

                            AVPacket *avpkt)

{

    IffContext *s = avctx->priv_data;

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    const uint8_t *buf_end = buf+buf_size;

    int y, plane;



    if (avctx->reget_buffer(avctx, &s->frame) < 0){

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }



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

        uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];

        memset(row, 0, avctx->pix_fmt == PIX_FMT_PAL8 ? avctx->width : (avctx->width * 4));

        for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {

            if (avctx->pix_fmt == PIX_FMT_PAL8) {

                decodeplane8(row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);

            } else { 

                decodeplane32(row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);

            }

            buf += s->planesize;

        }

    }



    *data_size = sizeof(AVFrame);

    *(AVFrame*)data = s->frame;

    return buf_size;

}

static int FUNC_0(AVCodecContext *VAR_0,

                            void *VAR_1, int *VAR_2,

                            AVPacket *VAR_3)

{

    IffContext *s = VAR_0->priv_data;

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    const uint8_t *VAR_6 = VAR_4+VAR_5;

    int VAR_7, VAR_8;



    if (VAR_0->reget_buffer(VAR_0, &s->frame) < 0){

        av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }



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

        uint8_t *row = &s->frame.VAR_1[0][ VAR_7*s->frame.linesize[0] ];

        memset(row, 0, VAR_0->pix_fmt == PIX_FMT_PAL8 ? VAR_0->width : (VAR_0->width * 4));

        for (VAR_8 = 0; VAR_8 < VAR_0->bits_per_coded_sample && VAR_4 < VAR_6; VAR_8++) {

            if (VAR_0->pix_fmt == PIX_FMT_PAL8) {

                decodeplane8(row, VAR_4, FFMIN(s->planesize, VAR_6 - VAR_4), VAR_0->bits_per_coded_sample, VAR_8);

            } else { 

                decodeplane32(row, VAR_4, FFMIN(s->planesize, VAR_6 - VAR_4), VAR_0->bits_per_coded_sample, VAR_8);

            }

            VAR_4 += s->planesize;

        }

    }



    *VAR_2 = sizeof(AVFrame);

    *(AVFrame*)VAR_1 = s->frame;

    return VAR_5;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ IffContext *s = VAR_0->priv_data; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; const uint8_t *VAR_6 = VAR_4+VAR_5; int VAR_7, VAR_8; if (VAR_0->reget_buffer(VAR_0, &s->frame) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } for(VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++ ) { uint8_t *row = &s->frame.VAR_1[0][ VAR_7*s->frame.linesize[0] ]; memset(row, 0, VAR_0->pix_fmt == PIX_FMT_PAL8 ? VAR_0->width : (VAR_0->width * 4)); for (VAR_8 = 0; VAR_8 < VAR_0->bits_per_coded_sample && VAR_4 < VAR_6; VAR_8++) { if (VAR_0->pix_fmt == PIX_FMT_PAL8) { decodeplane8(row, VAR_4, FFMIN(s->planesize, VAR_6 - VAR_4), VAR_0->bits_per_coded_sample, VAR_8); } else { decodeplane32(row, VAR_4, FFMIN(s->planesize, VAR_6 - VAR_4), VAR_0->bits_per_coded_sample, VAR_8); } VAR_4 += s->planesize; } } *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = s->frame; return VAR_5; }