static inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) {

    int nza, nzb;

    int ctx = 0;



    if( cat == 0 ) {

        nza = h->left_cbp&0x100;

        nzb = h-> top_cbp&0x100;

    } else if( cat == 1 || cat == 2 ) {

        nza = h->non_zero_count_cache[scan8[idx] - 1];

        nzb = h->non_zero_count_cache[scan8[idx] - 8];

    } else if( cat == 3 ) {

        nza = (h->left_cbp>>(6+idx))&0x01;

        nzb = (h-> top_cbp>>(6+idx))&0x01;

    } else {

        assert(cat == 4);

        nza = h->non_zero_count_cache[scan8[16+idx] - 1];

        nzb = h->non_zero_count_cache[scan8[16+idx] - 8];

    }



    if( nza > 0 )

        ctx++;



    if( nzb > 0 )

        ctx += 2;



    return ctx + 4 * cat;

}

static inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) {

    int nza, nzb;

    int ctx = 0;



    if( cat == 0 ) {

        nza = h->left_cbp&0x100;

        nzb = h-> top_cbp&0x100;

    } else if( cat == 1 || cat == 2 ) {

        nza = h->non_zero_count_cache[scan8[idx] - 1];

        nzb = h->non_zero_count_cache[scan8[idx] - 8];

    } else if( cat == 3 ) {

        nza = (h->left_cbp>>(6+idx))&0x01;

        nzb = (h-> top_cbp>>(6+idx))&0x01;

    } else {

        assert(cat == 4);

        nza = h->non_zero_count_cache[scan8[16+idx] - 1];

        nzb = h->non_zero_count_cache[scan8[16+idx] - 8];

    }



    if( nza > 0 )

        ctx++;



    if( nzb > 0 )

        ctx += 2;



    return ctx + 4 * cat;

}

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

    int VAR_3, VAR_4;

    int VAR_5 = 0;



    if( VAR_1 == 0 ) {

        VAR_3 = VAR_0->left_cbp&0x100;

        VAR_4 = VAR_0-> top_cbp&0x100;

    } else if( VAR_1 == 1 || VAR_1 == 2 ) {

        VAR_3 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 1];

        VAR_4 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 8];

    } else if( VAR_1 == 3 ) {

        VAR_3 = (VAR_0->left_cbp>>(6+VAR_2))&0x01;

        VAR_4 = (VAR_0-> top_cbp>>(6+VAR_2))&0x01;

    } else {

        assert(VAR_1 == 4);

        VAR_3 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 1];

        VAR_4 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 8];

    }



    if( VAR_3 > 0 )

        VAR_5++;



    if( VAR_4 > 0 )

        VAR_5 += 2;



    return VAR_5 + 4 * VAR_1;

}

static inline int FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2 ) { int VAR_3, VAR_4; int VAR_5 = 0; if( VAR_1 == 0 ) { VAR_3 = VAR_0->left_cbp&0x100; VAR_4 = VAR_0-> top_cbp&0x100; } else if( VAR_1 == 1 || VAR_1 == 2 ) { VAR_3 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 1]; VAR_4 = VAR_0->non_zero_count_cache[scan8[VAR_2] - 8]; } else if( VAR_1 == 3 ) { VAR_3 = (VAR_0->left_cbp>>(6+VAR_2))&0x01; VAR_4 = (VAR_0-> top_cbp>>(6+VAR_2))&0x01; } else { assert(VAR_1 == 4); VAR_3 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 1]; VAR_4 = VAR_0->non_zero_count_cache[scan8[16+VAR_2] - 8]; } if( VAR_3 > 0 )
VAR_5++; if( VAR_4 > 0 )
VAR_5 += 2; return VAR_5 + 4 * VAR_1; }