static int msvideo1_decode_frame(AVCodecContext *avctx,
                                void *data, int *got_frame,
                                AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    Msvideo1Context *s = avctx->priv_data;
    int ret;
    s->buf = buf;
    s->size = buf_size;
    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
        return ret;
    if (s->mode_8bit) {
        int size;
        const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
        if (pal && size == AVPALETTE_SIZE) {
            memcpy(s->pal, pal, AVPALETTE_SIZE);
            s->frame->palette_has_changed = 1;
        } else if (pal) {
            av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
    if (s->mode_8bit)
        msvideo1_decode_8bit(s);
    else
        msvideo1_decode_16bit(s);
    if ((ret = av_frame_ref(data, s->frame)) < 0)
        return ret;
    *got_frame      = 1;
    /* report that the buffer was completely consumed */
    return buf_size;
static int msvideo1_decode_frame(AVCodecContext *avctx,
                                void *data, int *got_frame,
                                AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    Msvideo1Context *s = avctx->priv_data;
    int ret;
    s->buf = buf;
    s->size = buf_size;
    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
        return ret;
    if (s->mode_8bit) {
        int size;
        const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
        if (pal && size == AVPALETTE_SIZE) {
            memcpy(s->pal, pal, AVPALETTE_SIZE);
            s->frame->palette_has_changed = 1;
        } else if (pal) {
            av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
    if (s->mode_8bit)
        msvideo1_decode_8bit(s);
    else
        msvideo1_decode_16bit(s);
    if ((ret = av_frame_ref(data, s->frame)) < 0)
        return ret;
    *got_frame      = 1;
    
    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->VAR_7;
    Msvideo1Context *s = VAR_0->priv_data;
    int VAR_6;
    s->VAR_4 = VAR_4;
    s->VAR_7 = VAR_5;
    if ((VAR_6 = ff_reget_buffer(VAR_0, s->frame)) < 0)
        return VAR_6;
    if (s->mode_8bit) {
        int VAR_7;
        const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, &VAR_7);
        if (VAR_8 && VAR_7 == AVPALETTE_SIZE) {
            memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE);
            s->frame->palette_has_changed = 1;
        } else if (VAR_8) {
            av_log(VAR_0, AV_LOG_ERROR, "Palette VAR_7 %d is wrong\n", VAR_7);
    if (s->mode_8bit)
        msvideo1_decode_8bit(s);
    else
        msvideo1_decode_16bit(s);
    if ((VAR_6 = av_frame_ref(VAR_1, s->frame)) < 0)
        return VAR_6;
    *VAR_2      = 1;
    
    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->VAR_7; Msvideo1Context *s = VAR_0->priv_data; int VAR_6; s->VAR_4 = VAR_4; s->VAR_7 = VAR_5; if ((VAR_6 = ff_reget_buffer(VAR_0, s->frame)) < 0)
return VAR_6; if (s->mode_8bit) { int VAR_7; const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, &VAR_7); if (VAR_8 && VAR_7 == AVPALETTE_SIZE) { memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE); s->frame->palette_has_changed = 1; } else if (VAR_8) { av_log(VAR_0, AV_LOG_ERROR, "Palette VAR_7 %d is wrong\n", VAR_7); if (s->mode_8bit)
msvideo1_decode_8bit(s); else
msvideo1_decode_16bit(s); if ((VAR_6 = av_frame_ref(VAR_1, s->frame)) < 0)
return VAR_6; *VAR_2      = 1; return VAR_5;