static int decode_ext_header(Wmv2Context *w){

    MpegEncContext * const s= &w->s;

    GetBitContext gb;

    int fps;

    int code;



    if(s->avctx->extradata_size<4) return -1;



    init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);



    fps                = get_bits(&gb, 5);

    s->bit_rate        = get_bits(&gb, 11)*1024;

    w->mspel_bit       = get_bits1(&gb);

    w->flag3           = get_bits1(&gb);

    w->abt_flag        = get_bits1(&gb);

    w->j_type_bit      = get_bits1(&gb);

    w->top_left_mv_flag= get_bits1(&gb);

    w->per_mb_rl_bit   = get_bits1(&gb);

    code               = get_bits(&gb, 3);



    if(code==0) return -1;



    s->slice_height = s->mb_height / code;



    if(s->avctx->debug&FF_DEBUG_PICT_INFO){

        av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n",

        fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3,

        code);

    }

    return 0;

}

static int decode_ext_header(Wmv2Context *w){

    MpegEncContext * const s= &w->s;

    GetBitContext gb;

    int fps;

    int code;



    if(s->avctx->extradata_size<4) return -1;



    init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);



    fps                = get_bits(&gb, 5);

    s->bit_rate        = get_bits(&gb, 11)*1024;

    w->mspel_bit       = get_bits1(&gb);

    w->flag3           = get_bits1(&gb);

    w->abt_flag        = get_bits1(&gb);

    w->j_type_bit      = get_bits1(&gb);

    w->top_left_mv_flag= get_bits1(&gb);

    w->per_mb_rl_bit   = get_bits1(&gb);

    code               = get_bits(&gb, 3);



    if(code==0) return -1;



    s->slice_height = s->mb_height / code;



    if(s->avctx->debug&FF_DEBUG_PICT_INFO){

        av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n",

        fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3,

        code);

    }

    return 0;

}

static int FUNC_0(Wmv2Context *VAR_0){

    MpegEncContext * const s= &VAR_0->s;

    GetBitContext gb;

    int VAR_1;

    int VAR_2;



    if(s->avctx->extradata_size<4) return -1;



    init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);



    VAR_1                = get_bits(&gb, 5);

    s->bit_rate        = get_bits(&gb, 11)*1024;

    VAR_0->mspel_bit       = get_bits1(&gb);

    VAR_0->flag3           = get_bits1(&gb);

    VAR_0->abt_flag        = get_bits1(&gb);

    VAR_0->j_type_bit      = get_bits1(&gb);

    VAR_0->top_left_mv_flag= get_bits1(&gb);

    VAR_0->per_mb_rl_bit   = get_bits1(&gb);

    VAR_2               = get_bits(&gb, 3);



    if(VAR_2==0) return -1;



    s->slice_height = s->mb_height / VAR_2;



    if(s->avctx->debug&FF_DEBUG_PICT_INFO){

        av_log(s->avctx, AV_LOG_DEBUG, "VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, flag3:%d, slices:%d\n",

        VAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, VAR_0->flag3,

        VAR_2);

    }

    return 0;

}

static int FUNC_0(Wmv2Context *VAR_0){ MpegEncContext * const s= &VAR_0->s; GetBitContext gb; int VAR_1; int VAR_2; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); VAR_1                = get_bits(&gb, 5); s->bit_rate        = get_bits(&gb, 11)*1024; VAR_0->mspel_bit       = get_bits1(&gb); VAR_0->flag3           = get_bits1(&gb); VAR_0->abt_flag        = get_bits1(&gb); VAR_0->j_type_bit      = get_bits1(&gb); VAR_0->top_left_mv_flag= get_bits1(&gb); VAR_0->per_mb_rl_bit   = get_bits1(&gb); VAR_2               = get_bits(&gb, 3); if(VAR_2==0) return -1; s->slice_height = s->mb_height / VAR_2; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, flag3:%d, slices:%d\n",
VAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, VAR_0->flag3,
VAR_2); } return 0; }