static int decode_cabac_mb_dqp( H264Context *h) {

    MpegEncContext * const s = &h->s;

    int mbn_xy;

    int   ctx = 0;

    int   val = 0;



    if( s->mb_x > 0 )

        mbn_xy = s->mb_x + s->mb_y*s->mb_stride - 1;

    else

        mbn_xy = s->mb_width - 1 + (s->mb_y-1)*s->mb_stride;



    if( h->last_qscale_diff != 0 )

        ctx++;



    while( get_cabac( &h->cabac, &h->cabac_state[60 + ctx] ) ) {

        if( ctx < 2 )

            ctx = 2;

        else

            ctx = 3;

        val++;

        if(val > 102) //prevent infinite loop

            return INT_MIN;

    }



    if( val&0x01 )

        return (val + 1)/2;

    else

        return -(val + 1)/2;

}

static int decode_cabac_mb_dqp( H264Context *h) {

    MpegEncContext * const s = &h->s;

    int mbn_xy;

    int   ctx = 0;

    int   val = 0;



    if( s->mb_x > 0 )

        mbn_xy = s->mb_x + s->mb_y*s->mb_stride - 1;

    else

        mbn_xy = s->mb_width - 1 + (s->mb_y-1)*s->mb_stride;



    if( h->last_qscale_diff != 0 )

        ctx++;



    while( get_cabac( &h->cabac, &h->cabac_state[60 + ctx] ) ) {

        if( ctx < 2 )

            ctx = 2;

        else

            ctx = 3;

        val++;

        if(val > 102) 

            return INT_MIN;

    }



    if( val&0x01 )

        return (val + 1)/2;

    else

        return -(val + 1)/2;

}

static int FUNC_0( H264Context *VAR_0) {

    MpegEncContext * const s = &VAR_0->s;

    int VAR_1;

    int   VAR_2 = 0;

    int   VAR_3 = 0;



    if( s->mb_x > 0 )

        VAR_1 = s->mb_x + s->mb_y*s->mb_stride - 1;

    else

        VAR_1 = s->mb_width - 1 + (s->mb_y-1)*s->mb_stride;



    if( VAR_0->last_qscale_diff != 0 )

        VAR_2++;



    while( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[60 + VAR_2] ) ) {

        if( VAR_2 < 2 )

            VAR_2 = 2;

        else

            VAR_2 = 3;

        VAR_3++;

        if(VAR_3 > 102) 

            return INT_MIN;

    }



    if( VAR_3&0x01 )

        return (VAR_3 + 1)/2;

    else

        return -(VAR_3 + 1)/2;

}

static int FUNC_0( H264Context *VAR_0) { MpegEncContext * const s = &VAR_0->s; int VAR_1; int   VAR_2 = 0; int   VAR_3 = 0; if( s->mb_x > 0 )
VAR_1 = s->mb_x + s->mb_y*s->mb_stride - 1; else
VAR_1 = s->mb_width - 1 + (s->mb_y-1)*s->mb_stride; if( VAR_0->last_qscale_diff != 0 )
VAR_2++; while( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[60 + VAR_2] ) ) { if( VAR_2 < 2 )
VAR_2 = 2; else
VAR_2 = 3; VAR_3++; if(VAR_3 > 102)
return INT_MIN; } if( VAR_3&0x01 )
return (VAR_3 + 1)/2; else
return -(VAR_3 + 1)/2; }