static int smc_decode_frame(AVCodecContext *avctx,

                             void *data, int *got_frame,

                             AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    SmcContext *s = avctx->priv_data;

    const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);

    int ret;



    bytestream2_init(&s->gb, buf, buf_size);



    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)

        return ret;



    if (pal) {

        s->frame->palette_has_changed = 1;

        memcpy(s->pal, pal, AVPALETTE_SIZE);

    }



    smc_decode_stream(s);



    *got_frame      = 1;

    if ((ret = av_frame_ref(data, s->frame)) < 0)

        return ret;



    /* always report that the buffer was completely consumed */

    return buf_size;

}

static int smc_decode_frame(AVCodecContext *avctx,

                             void *data, int *got_frame,

                             AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    SmcContext *s = avctx->priv_data;

    const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);

    int ret;



    bytestream2_init(&s->gb, buf, buf_size);



    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)

        return ret;



    if (pal) {

        s->frame->palette_has_changed = 1;

        memcpy(s->pal, pal, AVPALETTE_SIZE);

    }



    smc_decode_stream(s);



    *got_frame      = 1;

    if ((ret = av_frame_ref(data, s->frame)) < 0)

        return ret;



    

    return buf_size;

}

static int FUNC_0(AVCodecContext *VAR_0,

                             void *VAR_1, int *VAR_2,

                             AVPacket *VAR_3)

{

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    SmcContext *s = VAR_0->priv_data;

    const uint8_t *VAR_6 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL);

    int VAR_7;



    bytestream2_init(&s->gb, VAR_4, VAR_5);



    if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0)

        return VAR_7;



    if (VAR_6) {

        s->frame->palette_has_changed = 1;

        memcpy(s->VAR_6, VAR_6, AVPALETTE_SIZE);

    }



    smc_decode_stream(s);



    *VAR_2      = 1;

    if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0)

        return VAR_7;



    

    return VAR_5;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; SmcContext *s = VAR_0->priv_data; const uint8_t *VAR_6 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); int VAR_7; bytestream2_init(&s->gb, VAR_4, VAR_5); if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0)
return VAR_7; if (VAR_6) { s->frame->palette_has_changed = 1; memcpy(s->VAR_6, VAR_6, AVPALETTE_SIZE); } smc_decode_stream(s); *VAR_2      = 1; if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0)
return VAR_7; return VAR_5; }