static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {

    MpegEncContext * const s = &h->s;

    int mba_xy, mbb_xy;

    int ctx = 0;



    if(FRAME_MBAFF){ //FIXME merge with the stuff in fill_caches?

        int mb_xy = mb_x + (mb_y&~1)*s->mb_stride;

        mba_xy = mb_xy - 1;

        if( (mb_y&1)

            && h->slice_table[mba_xy] == h->slice_num

            && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) )

            mba_xy += s->mb_stride;

        if( MB_FIELD ){

            mbb_xy = mb_xy - s->mb_stride;

            if( !(mb_y&1)

                && h->slice_table[mbb_xy] == h->slice_num

                && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) )

                mbb_xy -= s->mb_stride;

        }else

            mbb_xy = mb_x + (mb_y-1)*s->mb_stride;

    }else{

        int mb_xy = mb_x + mb_y*s->mb_stride;

        mba_xy = mb_xy - 1;

        mbb_xy = mb_xy - s->mb_stride;

    }



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

        ctx++;

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

        ctx++;



    if( h->slice_type == B_TYPE )

        ctx += 13;

    return get_cabac( &h->cabac, &h->cabac_state[11+ctx] );

}

static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {

    MpegEncContext * const s = &h->s;

    int mba_xy, mbb_xy;

    int ctx = 0;



    if(FRAME_MBAFF){ 

        int mb_xy = mb_x + (mb_y&~1)*s->mb_stride;

        mba_xy = mb_xy - 1;

        if( (mb_y&1)

            && h->slice_table[mba_xy] == h->slice_num

            && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) )

            mba_xy += s->mb_stride;

        if( MB_FIELD ){

            mbb_xy = mb_xy - s->mb_stride;

            if( !(mb_y&1)

                && h->slice_table[mbb_xy] == h->slice_num

                && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) )

                mbb_xy -= s->mb_stride;

        }else

            mbb_xy = mb_x + (mb_y-1)*s->mb_stride;

    }else{

        int mb_xy = mb_x + mb_y*s->mb_stride;

        mba_xy = mb_xy - 1;

        mbb_xy = mb_xy - s->mb_stride;

    }



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

        ctx++;

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

        ctx++;



    if( h->slice_type == B_TYPE )

        ctx += 13;

    return get_cabac( &h->cabac, &h->cabac_state[11+ctx] );

}

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

    MpegEncContext * const s = &VAR_0->s;

    int VAR_3, VAR_4;

    int VAR_5 = 0;



    if(FRAME_MBAFF){ 

        int VAR_7 = VAR_1 + (VAR_2&~1)*s->mb_stride;

        VAR_3 = VAR_7 - 1;

        if( (VAR_2&1)

            && VAR_0->slice_table[VAR_3] == VAR_0->slice_num

            && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[VAR_3] ) )

            VAR_3 += s->mb_stride;

        if( MB_FIELD ){

            VAR_4 = VAR_7 - s->mb_stride;

            if( !(VAR_2&1)

                && VAR_0->slice_table[VAR_4] == VAR_0->slice_num

                && IS_INTERLACED( s->current_picture.mb_type[VAR_4] ) )

                VAR_4 -= s->mb_stride;

        }else

            VAR_4 = VAR_1 + (VAR_2-1)*s->mb_stride;

    }else{

        int VAR_7 = VAR_1 + VAR_2*s->mb_stride;

        VAR_3 = VAR_7 - 1;

        VAR_4 = VAR_7 - s->mb_stride;

    }



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

        VAR_5++;

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

        VAR_5++;



    if( VAR_0->slice_type == B_TYPE )

        VAR_5 += 13;

    return get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[11+VAR_5] );

}

static int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) { MpegEncContext * const s = &VAR_0->s; int VAR_3, VAR_4; int VAR_5 = 0; if(FRAME_MBAFF){ int VAR_7 = VAR_1 + (VAR_2&~1)*s->mb_stride; VAR_3 = VAR_7 - 1; if( (VAR_2&1)
&& VAR_0->slice_table[VAR_3] == VAR_0->slice_num
&& MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[VAR_3] ) )
VAR_3 += s->mb_stride; if( MB_FIELD ){ VAR_4 = VAR_7 - s->mb_stride; if( !(VAR_2&1)
&& VAR_0->slice_table[VAR_4] == VAR_0->slice_num
&& IS_INTERLACED( s->current_picture.mb_type[VAR_4] ) )
VAR_4 -= s->mb_stride; }else VAR_4 = VAR_1 + (VAR_2-1)*s->mb_stride; }else{ int VAR_7 = VAR_1 + VAR_2*s->mb_stride; VAR_3 = VAR_7 - 1; VAR_4 = VAR_7 - s->mb_stride; } if( VAR_0->slice_table[VAR_3] == VAR_0->slice_num && !IS_SKIP( s->current_picture.mb_type[VAR_3] ))
VAR_5++; if( VAR_0->slice_table[VAR_4] == VAR_0->slice_num && !IS_SKIP( s->current_picture.mb_type[VAR_4] ))
VAR_5++; if( VAR_0->slice_type == B_TYPE )
VAR_5 += 13; return get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[11+VAR_5] ); }