static int decode_frame(AVCodecContext *avctx,

                        void *data, int *got_frame,

                        AVPacket *avpkt)

{

    PicContext *s = avctx->priv_data;

    AVFrame *frame = data;

    uint32_t *palette;

    int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;

    int i, x, y, plane, tmp, ret, val;



    bytestream2_init(&s->g, avpkt->data, avpkt->size);



    if (bytestream2_get_bytes_left(&s->g) < 11)

        return AVERROR_INVALIDDATA;



    if (bytestream2_get_le16u(&s->g) != 0x1234)

        return AVERROR_INVALIDDATA;



    s->width       = bytestream2_get_le16u(&s->g);

    s->height      = bytestream2_get_le16u(&s->g);

    bytestream2_skip(&s->g, 4);

    tmp            = bytestream2_get_byteu(&s->g);

    bits_per_plane = tmp & 0xF;

    s->nb_planes   = (tmp >> 4) + 1;

    bpp            = bits_per_plane * s->nb_planes;

    if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {

        avpriv_request_sample(avctx, "Unsupported bit depth");

        return AVERROR_PATCHWELCOME;

    }



    if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {

        bytestream2_skip(&s->g, 2);

        etype = bytestream2_get_le16(&s->g);

        esize = bytestream2_get_le16(&s->g);

        if (bytestream2_get_bytes_left(&s->g) < esize)

            return AVERROR_INVALIDDATA;

    } else {

        etype = -1;

        esize = 0;

    }



    avctx->pix_fmt = AV_PIX_FMT_PAL8;



    if (s->width != avctx->width && s->height != avctx->height) {

        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)

            return -1;

        avcodec_set_dimensions(avctx, s->width, s->height);

    }



    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)

        return ret;

    memset(frame->data[0], 0, s->height * frame->linesize[0]);

    frame->pict_type           = AV_PICTURE_TYPE_I;

    frame->palette_has_changed = 1;



    pos_after_pal = bytestream2_tell(&s->g) + esize;

    palette = (uint32_t*)frame->data[1];

    if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {

        int idx = bytestream2_get_byte(&s->g);

        npal = 4;

        for (i = 0; i < npal; i++)

            palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];

    } else if (etype == 2) {

        npal = FFMIN(esize, 16);

        for (i = 0; i < npal; i++) {

            int pal_idx = bytestream2_get_byte(&s->g);

            palette[i]  = ff_cga_palette[FFMIN(pal_idx, 15)];

        }

    } else if (etype == 3) {

        npal = FFMIN(esize, 16);

        for (i = 0; i < npal; i++) {

            int pal_idx = bytestream2_get_byte(&s->g);

            palette[i]  = ff_ega_palette[FFMIN(pal_idx, 63)];

        }

    } else if (etype == 4 || etype == 5) {

        npal = FFMIN(esize / 3, 256);

        for (i = 0; i < npal; i++) {

            palette[i] = bytestream2_get_be24(&s->g) << 2;

            palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;

        }

    } else {

        if (bpp == 1) {

            npal = 2;

            palette[0] = 0xFF000000;

            palette[1] = 0xFFFFFFFF;

        } else if (bpp == 2) {

            npal = 4;

            for (i = 0; i < npal; i++)

                palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];

        } else {

            npal = 16;

            memcpy(palette, ff_cga_palette, npal * 4);

        }

    }

    // fill remaining palette entries

    memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);

    // skip remaining palette bytes

    bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);



    val = 0;

    y = s->height - 1;

    if (bytestream2_get_le16(&s->g)) {

        x = 0;

        plane = 0;

        while (y >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) {

            int stop_size, marker, t1, t2;



            t1        = bytestream2_get_bytes_left(&s->g);

            t2        = bytestream2_get_le16(&s->g);

            stop_size = t1 - FFMIN(t1, t2);

            // ignore uncompressed block size

            bytestream2_skip(&s->g, 2);

            marker    = bytestream2_get_byte(&s->g);



            while (plane < s->nb_planes && y >= 0 &&

                   bytestream2_get_bytes_left(&s->g) > stop_size) {

                int run = 1;

                val = bytestream2_get_byte(&s->g);

                if (val == marker) {

                    run = bytestream2_get_byte(&s->g);

                    if (run == 0)

                        run = bytestream2_get_le16(&s->g);

                    val = bytestream2_get_byte(&s->g);

                }

                if (!bytestream2_get_bytes_left(&s->g))

                    break;



                if (bits_per_plane == 8) {

                    picmemset_8bpp(s, frame, val, run, &x, &y);

                    if (y < 0)

                        goto finish;

                } else {

                    picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);

                }

            }

        }



        if (x < avctx->width && y >= 0) {

            int run = (y + 1) * avctx->width - x;

            if (bits_per_plane == 8)

                picmemset_8bpp(s, frame, val, run, &x, &y);

            else

                picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);

        }

    } else {

        while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {

            memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));

            bytestream2_skip(&s->g, avctx->width);

            y--;

        }

    }

finish:



    *got_frame      = 1;

    return avpkt->size;

}

static int decode_frame(AVCodecContext *avctx,

                        void *data, int *got_frame,

                        AVPacket *avpkt)

{

    PicContext *s = avctx->priv_data;

    AVFrame *frame = data;

    uint32_t *palette;

    int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;

    int i, x, y, plane, tmp, ret, val;



    bytestream2_init(&s->g, avpkt->data, avpkt->size);



    if (bytestream2_get_bytes_left(&s->g) < 11)

        return AVERROR_INVALIDDATA;



    if (bytestream2_get_le16u(&s->g) != 0x1234)

        return AVERROR_INVALIDDATA;



    s->width       = bytestream2_get_le16u(&s->g);

    s->height      = bytestream2_get_le16u(&s->g);

    bytestream2_skip(&s->g, 4);

    tmp            = bytestream2_get_byteu(&s->g);

    bits_per_plane = tmp & 0xF;

    s->nb_planes   = (tmp >> 4) + 1;

    bpp            = bits_per_plane * s->nb_planes;

    if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {

        avpriv_request_sample(avctx, "Unsupported bit depth");

        return AVERROR_PATCHWELCOME;

    }



    if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {

        bytestream2_skip(&s->g, 2);

        etype = bytestream2_get_le16(&s->g);

        esize = bytestream2_get_le16(&s->g);

        if (bytestream2_get_bytes_left(&s->g) < esize)

            return AVERROR_INVALIDDATA;

    } else {

        etype = -1;

        esize = 0;

    }



    avctx->pix_fmt = AV_PIX_FMT_PAL8;



    if (s->width != avctx->width && s->height != avctx->height) {

        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)

            return -1;

        avcodec_set_dimensions(avctx, s->width, s->height);

    }



    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)

        return ret;

    memset(frame->data[0], 0, s->height * frame->linesize[0]);

    frame->pict_type           = AV_PICTURE_TYPE_I;

    frame->palette_has_changed = 1;



    pos_after_pal = bytestream2_tell(&s->g) + esize;

    palette = (uint32_t*)frame->data[1];

    if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {

        int idx = bytestream2_get_byte(&s->g);

        npal = 4;

        for (i = 0; i < npal; i++)

            palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];

    } else if (etype == 2) {

        npal = FFMIN(esize, 16);

        for (i = 0; i < npal; i++) {

            int pal_idx = bytestream2_get_byte(&s->g);

            palette[i]  = ff_cga_palette[FFMIN(pal_idx, 15)];

        }

    } else if (etype == 3) {

        npal = FFMIN(esize, 16);

        for (i = 0; i < npal; i++) {

            int pal_idx = bytestream2_get_byte(&s->g);

            palette[i]  = ff_ega_palette[FFMIN(pal_idx, 63)];

        }

    } else if (etype == 4 || etype == 5) {

        npal = FFMIN(esize / 3, 256);

        for (i = 0; i < npal; i++) {

            palette[i] = bytestream2_get_be24(&s->g) << 2;

            palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;

        }

    } else {

        if (bpp == 1) {

            npal = 2;

            palette[0] = 0xFF000000;

            palette[1] = 0xFFFFFFFF;

        } else if (bpp == 2) {

            npal = 4;

            for (i = 0; i < npal; i++)

                palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];

        } else {

            npal = 16;

            memcpy(palette, ff_cga_palette, npal * 4);

        }

    }

    

    memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);

    

    bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);



    val = 0;

    y = s->height - 1;

    if (bytestream2_get_le16(&s->g)) {

        x = 0;

        plane = 0;

        while (y >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) {

            int stop_size, marker, t1, t2;



            t1        = bytestream2_get_bytes_left(&s->g);

            t2        = bytestream2_get_le16(&s->g);

            stop_size = t1 - FFMIN(t1, t2);

            

            bytestream2_skip(&s->g, 2);

            marker    = bytestream2_get_byte(&s->g);



            while (plane < s->nb_planes && y >= 0 &&

                   bytestream2_get_bytes_left(&s->g) > stop_size) {

                int run = 1;

                val = bytestream2_get_byte(&s->g);

                if (val == marker) {

                    run = bytestream2_get_byte(&s->g);

                    if (run == 0)

                        run = bytestream2_get_le16(&s->g);

                    val = bytestream2_get_byte(&s->g);

                }

                if (!bytestream2_get_bytes_left(&s->g))

                    break;



                if (bits_per_plane == 8) {

                    picmemset_8bpp(s, frame, val, run, &x, &y);

                    if (y < 0)

                        goto finish;

                } else {

                    picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);

                }

            }

        }



        if (x < avctx->width && y >= 0) {

            int run = (y + 1) * avctx->width - x;

            if (bits_per_plane == 8)

                picmemset_8bpp(s, frame, val, run, &x, &y);

            else

                picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);

        }

    } else {

        while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {

            memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));

            bytestream2_skip(&s->g, avctx->width);

            y--;

        }

    }

finish:



    *got_frame      = 1;

    return avpkt->size;

}

        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)             return -1;
static int FUNC_0(AVCodecContext *VAR_0,

                        void *VAR_1, int *VAR_2,

                        AVPacket *VAR_3)

{

    PicContext *s = VAR_0->priv_data;

    AVFrame *frame = VAR_1;

    uint32_t *palette;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;

    int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;



    bytestream2_init(&s->g, VAR_3->VAR_1, VAR_3->size);



    if (bytestream2_get_bytes_left(&s->g) < 11)

        return AVERROR_INVALIDDATA;



    if (bytestream2_get_le16u(&s->g) != 0x1234)

        return AVERROR_INVALIDDATA;



    s->width       = bytestream2_get_le16u(&s->g);

    s->height      = bytestream2_get_le16u(&s->g);

    bytestream2_skip(&s->g, 4);

    VAR_14            = bytestream2_get_byteu(&s->g);

    VAR_4 = VAR_14 & 0xF;

    s->nb_planes   = (VAR_14 >> 4) + 1;

    VAR_5            = VAR_4 * s->nb_planes;

    if (VAR_4 > 8 || VAR_5 < 1 || VAR_5 > 32) {

        avpriv_request_sample(VAR_0, "Unsupported bit depth");

        return AVERROR_PATCHWELCOME;

    }



    if (bytestream2_peek_byte(&s->g) == 0xFF || VAR_5 == 1 || VAR_5 == 4 || VAR_5 == 8) {

        bytestream2_skip(&s->g, 2);

        VAR_6 = bytestream2_get_le16(&s->g);

        VAR_7 = bytestream2_get_le16(&s->g);

        if (bytestream2_get_bytes_left(&s->g) < VAR_7)

            return AVERROR_INVALIDDATA;

    } else {

        VAR_6 = -1;

        VAR_7 = 0;

    }



    VAR_0->pix_fmt = AV_PIX_FMT_PAL8;



    if (s->width != VAR_0->width && s->height != VAR_0->height) {

        if (av_image_check_size(s->width, s->height, 0, VAR_0) < 0)

            return -1;

        avcodec_set_dimensions(VAR_0, s->width, s->height);

    }



    if ((VAR_15 = ff_get_buffer(VAR_0, frame, 0)) < 0)

        return VAR_15;

    memset(frame->VAR_1[0], 0, s->height * frame->linesize[0]);

    frame->pict_type           = AV_PICTURE_TYPE_I;

    frame->palette_has_changed = 1;



    VAR_9 = bytestream2_tell(&s->g) + VAR_7;

    palette = (uint32_t*)frame->VAR_1[1];

    if (VAR_6 == 1 && VAR_7 > 1 && bytestream2_peek_byte(&s->g) < 6) {

        int VAR_17 = bytestream2_get_byte(&s->g);

        VAR_8 = 4;

        for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++)

            palette[VAR_10] = ff_cga_palette[ cga_mode45_index[VAR_17][VAR_10] ];

    } else if (VAR_6 == 2) {

        VAR_8 = FFMIN(VAR_7, 16);

        for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {

            int VAR_19 = bytestream2_get_byte(&s->g);

            palette[VAR_10]  = ff_cga_palette[FFMIN(VAR_19, 15)];

        }

    } else if (VAR_6 == 3) {

        VAR_8 = FFMIN(VAR_7, 16);

        for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {

            int VAR_19 = bytestream2_get_byte(&s->g);

            palette[VAR_10]  = ff_ega_palette[FFMIN(VAR_19, 63)];

        }

    } else if (VAR_6 == 4 || VAR_6 == 5) {

        VAR_8 = FFMIN(VAR_7 / 3, 256);

        for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) {

            palette[VAR_10] = bytestream2_get_be24(&s->g) << 2;

            palette[VAR_10] |= 0xFFU << 24 | palette[VAR_10] >> 6 & 0x30303;

        }

    } else {

        if (VAR_5 == 1) {

            VAR_8 = 2;

            palette[0] = 0xFF000000;

            palette[1] = 0xFFFFFFFF;

        } else if (VAR_5 == 2) {

            VAR_8 = 4;

            for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++)

                palette[VAR_10] = ff_cga_palette[ cga_mode45_index[0][VAR_10] ];

        } else {

            VAR_8 = 16;

            memcpy(palette, ff_cga_palette, VAR_8 * 4);

        }

    }

    

    memset(palette + VAR_8, 0, AVPALETTE_SIZE - VAR_8 * 4);

    

    bytestream2_seek(&s->g, VAR_9, SEEK_SET);



    VAR_16 = 0;

    VAR_12 = s->height - 1;

    if (bytestream2_get_le16(&s->g)) {

        VAR_11 = 0;

        VAR_13 = 0;

        while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) {

            int VAR_19, VAR_20, VAR_21, VAR_22;



            VAR_21        = bytestream2_get_bytes_left(&s->g);

            VAR_22        = bytestream2_get_le16(&s->g);

            VAR_19 = VAR_21 - FFMIN(VAR_21, VAR_22);

            

            bytestream2_skip(&s->g, 2);

            VAR_20    = bytestream2_get_byte(&s->g);



            while (VAR_13 < s->nb_planes && VAR_12 >= 0 &&

                   bytestream2_get_bytes_left(&s->g) > VAR_19) {

                int VAR_24 = 1;

                VAR_16 = bytestream2_get_byte(&s->g);

                if (VAR_16 == VAR_20) {

                    VAR_24 = bytestream2_get_byte(&s->g);

                    if (VAR_24 == 0)

                        VAR_24 = bytestream2_get_le16(&s->g);

                    VAR_16 = bytestream2_get_byte(&s->g);

                }

                if (!bytestream2_get_bytes_left(&s->g))

                    break;



                if (VAR_4 == 8) {

                    picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12);

                    if (VAR_12 < 0)

                        goto finish;

                } else {

                    picmemset(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12, &VAR_13, VAR_4);

                }

            }

        }



        if (VAR_11 < VAR_0->width && VAR_12 >= 0) {

            int VAR_24 = (VAR_12 + 1) * VAR_0->width - VAR_11;

            if (VAR_4 == 8)

                picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12);

            else

                picmemset(s, frame, VAR_16, VAR_24 / (8 / VAR_4), &VAR_11, &VAR_12, &VAR_13, VAR_4);

        }

    } else {

        while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {

            memcpy(frame->VAR_1[0] + VAR_12 * frame->linesize[0], s->g.buffer, FFMIN(VAR_0->width, bytestream2_get_bytes_left(&s->g)));

            bytestream2_skip(&s->g, VAR_0->width);

            VAR_12--;

        }

    }

finish:



    *VAR_2      = 1;

    return VAR_3->size;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ PicContext *s = VAR_0->priv_data; AVFrame *frame = VAR_1; uint32_t *palette; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16; bytestream2_init(&s->g, VAR_3->VAR_1, VAR_3->size); if (bytestream2_get_bytes_left(&s->g) < 11)
return AVERROR_INVALIDDATA; if (bytestream2_get_le16u(&s->g) != 0x1234)
return AVERROR_INVALIDDATA; s->width       = bytestream2_get_le16u(&s->g); s->height      = bytestream2_get_le16u(&s->g); bytestream2_skip(&s->g, 4); VAR_14            = bytestream2_get_byteu(&s->g); VAR_4 = VAR_14 & 0xF; s->nb_planes   = (VAR_14 >> 4) + 1; VAR_5            = VAR_4 * s->nb_planes; if (VAR_4 > 8 || VAR_5 < 1 || VAR_5 > 32) { avpriv_request_sample(VAR_0, "Unsupported bit depth"); return AVERROR_PATCHWELCOME; } if (bytestream2_peek_byte(&s->g) == 0xFF || VAR_5 == 1 || VAR_5 == 4 || VAR_5 == 8) { bytestream2_skip(&s->g, 2); VAR_6 = bytestream2_get_le16(&s->g); VAR_7 = bytestream2_get_le16(&s->g); if (bytestream2_get_bytes_left(&s->g) < VAR_7)
return AVERROR_INVALIDDATA; } else { VAR_6 = -1; VAR_7 = 0; } VAR_0->pix_fmt = AV_PIX_FMT_PAL8; if (s->width != VAR_0->width && s->height != VAR_0->height) { if (av_image_check_size(s->width, s->height, 0, VAR_0) < 0)
return -1; avcodec_set_dimensions(VAR_0, s->width, s->height); } if ((VAR_15 = ff_get_buffer(VAR_0, frame, 0)) < 0)
return VAR_15; memset(frame->VAR_1[0], 0, s->height * frame->linesize[0]); frame->pict_type           = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; VAR_9 = bytestream2_tell(&s->g) + VAR_7; palette = (uint32_t*)frame->VAR_1[1]; if (VAR_6 == 1 && VAR_7 > 1 && bytestream2_peek_byte(&s->g) < 6) { int VAR_17 = bytestream2_get_byte(&s->g); VAR_8 = 4; for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) palette[VAR_10] = ff_cga_palette[ cga_mode45_index[VAR_17][VAR_10] ]; } else if (VAR_6 == 2) { VAR_8 = FFMIN(VAR_7, 16); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { int VAR_19 = bytestream2_get_byte(&s->g); palette[VAR_10]  = ff_cga_palette[FFMIN(VAR_19, 15)]; } } else if (VAR_6 == 3) { VAR_8 = FFMIN(VAR_7, 16); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { int VAR_19 = bytestream2_get_byte(&s->g); palette[VAR_10]  = ff_ega_palette[FFMIN(VAR_19, 63)]; } } else if (VAR_6 == 4 || VAR_6 == 5) { VAR_8 = FFMIN(VAR_7 / 3, 256); for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) { palette[VAR_10] = bytestream2_get_be24(&s->g) << 2; palette[VAR_10] |= 0xFFU << 24 | palette[VAR_10] >> 6 & 0x30303; } } else { if (VAR_5 == 1) { VAR_8 = 2; palette[0] = 0xFF000000; palette[1] = 0xFFFFFFFF; } else if (VAR_5 == 2) { VAR_8 = 4; for (VAR_10 = 0; VAR_10 < VAR_8; VAR_10++) palette[VAR_10] = ff_cga_palette[ cga_mode45_index[0][VAR_10] ]; } else { VAR_8 = 16; memcpy(palette, ff_cga_palette, VAR_8 * 4); } } memset(palette + VAR_8, 0, AVPALETTE_SIZE - VAR_8 * 4); bytestream2_seek(&s->g, VAR_9, SEEK_SET); VAR_16 = 0; VAR_12 = s->height - 1; if (bytestream2_get_le16(&s->g)) { VAR_11 = 0; VAR_13 = 0; while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) >= 6) { int VAR_19, VAR_20, VAR_21, VAR_22; VAR_21        = bytestream2_get_bytes_left(&s->g); VAR_22        = bytestream2_get_le16(&s->g); VAR_19 = VAR_21 - FFMIN(VAR_21, VAR_22); bytestream2_skip(&s->g, 2); VAR_20    = bytestream2_get_byte(&s->g); while (VAR_13 < s->nb_planes && VAR_12 >= 0 &&
bytestream2_get_bytes_left(&s->g) > VAR_19) { int VAR_24 = 1; VAR_16 = bytestream2_get_byte(&s->g); if (VAR_16 == VAR_20) { VAR_24 = bytestream2_get_byte(&s->g); if (VAR_24 == 0)
VAR_24 = bytestream2_get_le16(&s->g); VAR_16 = bytestream2_get_byte(&s->g); } if (!bytestream2_get_bytes_left(&s->g))
break; if (VAR_4 == 8) { picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12); if (VAR_12 < 0)
goto finish; } else { picmemset(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12, &VAR_13, VAR_4); } } } if (VAR_11 < VAR_0->width && VAR_12 >= 0) { int VAR_24 = (VAR_12 + 1) * VAR_0->width - VAR_11; if (VAR_4 == 8)
picmemset_8bpp(s, frame, VAR_16, VAR_24, &VAR_11, &VAR_12); else
picmemset(s, frame, VAR_16, VAR_24 / (8 / VAR_4), &VAR_11, &VAR_12, &VAR_13, VAR_4); } } else { while (VAR_12 >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { memcpy(frame->VAR_1[0] + VAR_12 * frame->linesize[0], s->g.buffer, FFMIN(VAR_0->width, bytestream2_get_bytes_left(&s->g))); bytestream2_skip(&s->g, VAR_0->width); VAR_12--; } } finish:
*VAR_2      = 1; return VAR_3->size; }