static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) {

    uint8_t *state= &h->cabac_state[ctx_base];

    int mb_type;



    if(intra_slice){

        MpegEncContext * const s = &h->s;

        const int mba_xy = h->left_mb_xy[0];

        const int mbb_xy = h->top_mb_xy;

        int ctx=0;

        if( h->slice_table[mba_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) )

            ctx++;

        if( h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) )

            ctx++;

        if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )

            return 0;   /* I4x4 */

        state += 2;

    }else{

        if( get_cabac_noinline( &h->cabac, state ) == 0 )

            return 0;   /* I4x4 */

    }



    if( get_cabac_terminate( &h->cabac ) )

        return 25;  /* PCM */



    mb_type = 1; /* I16x16 */

    mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] ); /* cbp_luma != 0 */

    if( get_cabac_noinline( &h->cabac, &state[2] ) ) /* cbp_chroma */

        mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] );

    mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] );

    mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] );

    return mb_type;

}

static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) {

    uint8_t *state= &h->cabac_state[ctx_base];

    int mb_type;



    if(intra_slice){

        MpegEncContext * const s = &h->s;

        const int mba_xy = h->left_mb_xy[0];

        const int mbb_xy = h->top_mb_xy;

        int ctx=0;

        if( h->slice_table[mba_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) )

            ctx++;

        if( h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) )

            ctx++;

        if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )

            return 0;   

        state += 2;

    }else{

        if( get_cabac_noinline( &h->cabac, state ) == 0 )

            return 0;   

    }



    if( get_cabac_terminate( &h->cabac ) )

        return 25;  



    mb_type = 1; 

    mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] ); 

    if( get_cabac_noinline( &h->cabac, &state[2] ) ) 

        mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] );

    mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] );

    mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] );

    return mb_type;

}

static int FUNC_0(H264Context *VAR_0, int VAR_1, int VAR_2) {

    uint8_t *state= &VAR_0->cabac_state[VAR_1];

    int VAR_3;



    if(VAR_2){

        MpegEncContext * const s = &VAR_0->s;

        const int VAR_4 = VAR_0->left_mb_xy[0];

        const int VAR_5 = VAR_0->top_mb_xy;

        int VAR_6=0;

        if( VAR_0->slice_table[VAR_4] == VAR_0->slice_num && !IS_INTRA4x4( s->current_picture.VAR_3[VAR_4] ) )

            VAR_6++;

        if( VAR_0->slice_table[VAR_5] == VAR_0->slice_num && !IS_INTRA4x4( s->current_picture.VAR_3[VAR_5] ) )

            VAR_6++;

        if( get_cabac_noinline( &VAR_0->cabac, &state[VAR_6] ) == 0 )

            return 0;   

        state += 2;

    }else{

        if( get_cabac_noinline( &VAR_0->cabac, state ) == 0 )

            return 0;   

    }



    if( get_cabac_terminate( &VAR_0->cabac ) )

        return 25;  



    VAR_3 = 1; 

    VAR_3 += 12 * get_cabac_noinline( &VAR_0->cabac, &state[1] ); 

    if( get_cabac_noinline( &VAR_0->cabac, &state[2] ) ) 

        VAR_3 += 4 + 4 * get_cabac_noinline( &VAR_0->cabac, &state[2+VAR_2] );

    VAR_3 += 2 * get_cabac_noinline( &VAR_0->cabac, &state[3+VAR_2] );

    VAR_3 += 1 * get_cabac_noinline( &VAR_0->cabac, &state[3+2*VAR_2] );

    return VAR_3;

}

static int FUNC_0(H264Context *VAR_0, int VAR_1, int VAR_2) { uint8_t *state= &VAR_0->cabac_state[VAR_1]; int VAR_3; if(VAR_2){ MpegEncContext * const s = &VAR_0->s; const int VAR_4 = VAR_0->left_mb_xy[0]; const int VAR_5 = VAR_0->top_mb_xy; int VAR_6=0; if( VAR_0->slice_table[VAR_4] == VAR_0->slice_num && !IS_INTRA4x4( s->current_picture.VAR_3[VAR_4] ) )
VAR_6++; if( VAR_0->slice_table[VAR_5] == VAR_0->slice_num && !IS_INTRA4x4( s->current_picture.VAR_3[VAR_5] ) )
VAR_6++; if( get_cabac_noinline( &VAR_0->cabac, &state[VAR_6] ) == 0 )
return 0; state += 2; }else{ if( get_cabac_noinline( &VAR_0->cabac, state ) == 0 )
return 0; } if( get_cabac_terminate( &VAR_0->cabac ) )
return 25; VAR_3 = 1; VAR_3 += 12 * get_cabac_noinline( &VAR_0->cabac, &state[1] ); if( get_cabac_noinline( &VAR_0->cabac, &state[2] ) )
VAR_3 += 4 + 4 * get_cabac_noinline( &VAR_0->cabac, &state[2+VAR_2] ); VAR_3 += 2 * get_cabac_noinline( &VAR_0->cabac, &state[3+VAR_2] ); VAR_3 += 1 * get_cabac_noinline( &VAR_0->cabac, &state[3+2*VAR_2] ); return VAR_3; }