decode_cabac_residual_internal(H264Context *h, int16_t *block,

                               int cat, int n, const uint8_t *scantable,

                               const uint32_t *qmul, int max_coeff,

                               int is_dc, int chroma422)

{

    static const int significant_coeff_flag_offset[2][14] = {

      { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 },

      { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 }

    };

    static const int last_coeff_flag_offset[2][14] = {

      { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 },

      { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 }

    };

    static const int coeff_abs_level_m1_offset[14] = {

        227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766

    };

    static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {

      { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,

        4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,

        7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,

       12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },

      { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,

        6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,

        9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,

        9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }

    };

    static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 };

    /* node ctx: 0..3: abslevel1 (with abslevelgt1 == 0).

     * 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter).

     * map node ctx => cabac ctx for level=1 */

    static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };

    /* map node ctx => cabac ctx for level>1 */

    static const uint8_t coeff_abs_levelgt1_ctx[2][8] = {

        { 5, 5, 5, 5, 6, 7, 8, 9 },

        { 5, 5, 5, 5, 6, 7, 8, 8 }, // 422/dc case

    };

    static const uint8_t coeff_abs_level_transition[2][8] = {

    /* update node ctx after decoding a level=1 */

        { 1, 2, 3, 3, 4, 5, 6, 7 },

    /* update node ctx after decoding a level>1 */

        { 4, 4, 4, 4, 5, 6, 7, 7 }

    };



    int index[64];



    int av_unused last;

    int coeff_count = 0;

    int node_ctx = 0;



    uint8_t *significant_coeff_ctx_base;

    uint8_t *last_coeff_ctx_base;

    uint8_t *abs_level_m1_ctx_base;



#if !ARCH_X86

#define CABAC_ON_STACK

#endif

#ifdef CABAC_ON_STACK

#define CC &cc

    CABACContext cc;

    cc.range     = h->cabac.range;

    cc.low       = h->cabac.low;

    cc.bytestream= h->cabac.bytestream;

#else

#define CC &h->cabac

#endif



    significant_coeff_ctx_base = h->cabac_state

        + significant_coeff_flag_offset[MB_FIELD][cat];

    last_coeff_ctx_base = h->cabac_state

        + last_coeff_flag_offset[MB_FIELD][cat];

    abs_level_m1_ctx_base = h->cabac_state

        + coeff_abs_level_m1_offset[cat];



    if( !is_dc && max_coeff == 64 ) {

#define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \

        for(last= 0; last < coefs; last++) { \

            uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \

            if( get_cabac( CC, sig_ctx )) { \

                uint8_t *last_ctx = last_coeff_ctx_base + last_off; \

                index[coeff_count++] = last; \

                if( get_cabac( CC, last_ctx ) ) { \

                    last= max_coeff; \

                    break; \

                } \

            } \

        }\

        if( last == max_coeff -1 ) {\

            index[coeff_count++] = last;\

        }

        const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];

#ifdef decode_significance

        coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,

                                                 last_coeff_ctx_base, sig_off);

    } else {

        if (is_dc && chroma422) { // dc 422

            DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);

        } else {

            coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,

                                                 last_coeff_ctx_base-significant_coeff_ctx_base);

        }

#else

        DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] );

    } else {

        if (is_dc && chroma422) { // dc 422

            DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);

        } else {

            DECODE_SIGNIFICANCE(max_coeff - 1, last, last);

        }

#endif

    }

    av_assert2(coeff_count > 0);



    if( is_dc ) {

        if( cat == 3 )

            h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);

        else

            h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);

        h->non_zero_count_cache[scan8[n]] = coeff_count;

    } else {

        if( max_coeff == 64 )

            fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);

        else {

            av_assert2( cat == 1 || cat ==  2 || cat ==  4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );

            h->non_zero_count_cache[scan8[n]] = coeff_count;

        }

    }





#define STORE_BLOCK(type) \

    do { \

        uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \

 \

        int j= scantable[index[--coeff_count]]; \

 \

        if( get_cabac( CC, ctx ) == 0 ) { \

            node_ctx = coeff_abs_level_transition[0][node_ctx]; \

            if( is_dc ) { \

                ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \

            }else{ \

                ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \

            } \

        } else { \

            int coeff_abs = 2; \

            ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \

            node_ctx = coeff_abs_level_transition[1][node_ctx]; \

\

            while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \

                coeff_abs++; \

            } \

\

            if( coeff_abs >= 15 ) { \

                int j = 0; \

                while( get_cabac_bypass( CC ) ) { \

                    j++; \

                } \

\

                coeff_abs=1; \

                while( j-- ) { \

                    coeff_abs += coeff_abs + get_cabac_bypass( CC ); \

                } \

                coeff_abs+= 14; \

            } \

\

            if( is_dc ) { \

                ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \

            }else{ \

                ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \

            } \

        } \

    } while ( coeff_count );



        if (h->pixel_shift) {

            STORE_BLOCK(int32_t)

        } else {

            STORE_BLOCK(int16_t)

        }

#ifdef CABAC_ON_STACK

            h->cabac.range     = cc.range     ;

            h->cabac.low       = cc.low       ;

            h->cabac.bytestream= cc.bytestream;

#endif



}

decode_cabac_residual_internal(H264Context *h, int16_t *block,

                               int cat, int n, const uint8_t *scantable,

                               const uint32_t *qmul, int max_coeff,

                               int is_dc, int chroma422)

{

    static const int significant_coeff_flag_offset[2][14] = {

      { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 },

      { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 }

    };

    static const int last_coeff_flag_offset[2][14] = {

      { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 },

      { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 }

    };

    static const int coeff_abs_level_m1_offset[14] = {

        227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766

    };

    static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {

      { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,

        4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,

        7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,

       12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },

      { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,

        6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,

        9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,

        9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }

    };

    static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 };

    





    static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };

    

    static const uint8_t coeff_abs_levelgt1_ctx[2][8] = {

        { 5, 5, 5, 5, 6, 7, 8, 9 },

        { 5, 5, 5, 5, 6, 7, 8, 8 }, 

    };

    static const uint8_t coeff_abs_level_transition[2][8] = {

    

        { 1, 2, 3, 3, 4, 5, 6, 7 },

    

        { 4, 4, 4, 4, 5, 6, 7, 7 }

    };



    int index[64];



    int av_unused last;

    int coeff_count = 0;

    int node_ctx = 0;



    uint8_t *significant_coeff_ctx_base;

    uint8_t *last_coeff_ctx_base;

    uint8_t *abs_level_m1_ctx_base;



#if !ARCH_X86

#define CABAC_ON_STACK

#endif

#ifdef CABAC_ON_STACK

#define CC &cc

    CABACContext cc;

    cc.range     = h->cabac.range;

    cc.low       = h->cabac.low;

    cc.bytestream= h->cabac.bytestream;

#else

#define CC &h->cabac

#endif



    significant_coeff_ctx_base = h->cabac_state

        + significant_coeff_flag_offset[MB_FIELD][cat];

    last_coeff_ctx_base = h->cabac_state

        + last_coeff_flag_offset[MB_FIELD][cat];

    abs_level_m1_ctx_base = h->cabac_state

        + coeff_abs_level_m1_offset[cat];



    if( !is_dc && max_coeff == 64 ) {

#define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \

        for(last= 0; last < coefs; last++) { \

            uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \

            if( get_cabac( CC, sig_ctx )) { \

                uint8_t *last_ctx = last_coeff_ctx_base + last_off; \

                index[coeff_count++] = last; \

                if( get_cabac( CC, last_ctx ) ) { \

                    last= max_coeff; \

                    break; \

                } \

            } \

        }\

        if( last == max_coeff -1 ) {\

            index[coeff_count++] = last;\

        }

        const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];

#ifdef decode_significance

        coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,

                                                 last_coeff_ctx_base, sig_off);

    } else {

        if (is_dc && chroma422) { 

            DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);

        } else {

            coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,

                                                 last_coeff_ctx_base-significant_coeff_ctx_base);

        }

#else

        DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] );

    } else {

        if (is_dc && chroma422) { 

            DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);

        } else {

            DECODE_SIGNIFICANCE(max_coeff - 1, last, last);

        }

#endif

    }

    av_assert2(coeff_count > 0);



    if( is_dc ) {

        if( cat == 3 )

            h->cbp_table[h->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX);

        else

            h->cbp_table[h->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX);

        h->non_zero_count_cache[scan8[n]] = coeff_count;

    } else {

        if( max_coeff == 64 )

            fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);

        else {

            av_assert2( cat == 1 || cat ==  2 || cat ==  4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 );

            h->non_zero_count_cache[scan8[n]] = coeff_count;

        }

    }





#define STORE_BLOCK(type) \

    do { \

        uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \

 \

        int j= scantable[index[--coeff_count]]; \

 \

        if( get_cabac( CC, ctx ) == 0 ) { \

            node_ctx = coeff_abs_level_transition[0][node_ctx]; \

            if( is_dc ) { \

                ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \

            }else{ \

                ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \

            } \

        } else { \

            int coeff_abs = 2; \

            ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \

            node_ctx = coeff_abs_level_transition[1][node_ctx]; \

\

            while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \

                coeff_abs++; \

            } \

\

            if( coeff_abs >= 15 ) { \

                int j = 0; \

                while( get_cabac_bypass( CC ) ) { \

                    j++; \

                } \

\

                coeff_abs=1; \

                while( j-- ) { \

                    coeff_abs += coeff_abs + get_cabac_bypass( CC ); \

                } \

                coeff_abs+= 14; \

            } \

\

            if( is_dc ) { \

                ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \

            }else{ \

                ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \

            } \

        } \

    } while ( coeff_count );



        if (h->pixel_shift) {

            STORE_BLOCK(int32_t)

        } else {

            STORE_BLOCK(int16_t)

        }

#ifdef CABAC_ON_STACK

            h->cabac.range     = cc.range     ;

            h->cabac.low       = cc.low       ;

            h->cabac.bytestream= cc.bytestream;

#endif



}

FUNC_0(H264Context *VAR_0, int16_t *VAR_1,

                               int VAR_2, int VAR_3, const uint8_t *VAR_4,

                               const uint32_t *VAR_5, int VAR_6,

                               int VAR_7, int VAR_8)

{

    static const int VAR_9[2][14] = {

      { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 },

      { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 }

    };

    static const int VAR_10[2][14] = {

      { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 },

      { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 }

    };

    static const int VAR_11[14] = {

        227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766

    };

    static const uint8_t VAR_12[2][63] = {

      { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,

        4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,

        7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,

       12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },

      { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,

        6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,

        9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,

        9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }

    };

    static const uint8_t VAR_13[7] = { 0, 0, 1, 1, 2, 2, 2 };

    





    static const uint8_t VAR_14[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };

    

    static const uint8_t VAR_15[2][8] = {

        { 5, 5, 5, 5, 6, 7, 8, 9 },

        { 5, 5, 5, 5, 6, 7, 8, 8 }, 

    };

    static const uint8_t VAR_16[2][8] = {

    

        { 1, 2, 3, 3, 4, 5, 6, 7 },

    

        { 4, 4, 4, 4, 5, 6, 7, 7 }

    };



    int VAR_17[64];



    int VAR_18 last;

    int VAR_19 = 0;

    int VAR_20 = 0;



    uint8_t *significant_coeff_ctx_base;

    uint8_t *last_coeff_ctx_base;

    uint8_t *abs_level_m1_ctx_base;



#if !ARCH_X86

#define CABAC_ON_STACK

#endif

#ifdef CABAC_ON_STACK

#define CC &cc

    CABACContext cc;

    cc.range     = VAR_0->cabac.range;

    cc.low       = VAR_0->cabac.low;

    cc.bytestream= VAR_0->cabac.bytestream;

#else

#define CC &VAR_0->cabac

#endif



    significant_coeff_ctx_base = VAR_0->cabac_state

        + VAR_9[MB_FIELD][VAR_2];

    last_coeff_ctx_base = VAR_0->cabac_state

        + VAR_10[MB_FIELD][VAR_2];

    abs_level_m1_ctx_base = VAR_0->cabac_state

        + VAR_11[VAR_2];



    if( !VAR_7 && VAR_6 == 64 ) {

#define DECODE_SIGNIFICANCE( coefs, VAR_21, last_off ) \

        for(last= 0; last < coefs; last++) { \

            uint8_t *sig_ctx = significant_coeff_ctx_base + VAR_21; \

            if( get_cabac( CC, sig_ctx )) { \

                uint8_t *last_ctx = last_coeff_ctx_base + last_off; \

                VAR_17[VAR_19++] = last; \

                if( get_cabac( CC, last_ctx ) ) { \

                    last= VAR_6; \

                    break; \

                } \

            } \

        }\

        if( last == VAR_6 -1 ) {\

            VAR_17[VAR_19++] = last;\

        }

        const uint8_t *VAR_21 = VAR_12[MB_FIELD];

#ifdef decode_significance

        VAR_19 = decode_significance_8x8(CC, significant_coeff_ctx_base, VAR_17,

                                                 last_coeff_ctx_base, VAR_21);

    } else {

        if (VAR_7 && VAR_8) { 

            DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]);

        } else {

            VAR_19 = decode_significance(CC, VAR_6, significant_coeff_ctx_base, VAR_17,

                                                 last_coeff_ctx_base-significant_coeff_ctx_base);

        }

#else

        DECODE_SIGNIFICANCE( 63, VAR_21[last], ff_h264_last_coeff_flag_offset_8x8[last] );

    } else {

        if (VAR_7 && VAR_8) { 

            DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]);

        } else {

            DECODE_SIGNIFICANCE(VAR_6 - 1, last, last);

        }

#endif

    }

    av_assert2(VAR_19 > 0);



    if( VAR_7 ) {

        if( VAR_2 == 3 )

            VAR_0->cbp_table[VAR_0->mb_xy] |= 0x40 << (VAR_3 - CHROMA_DC_BLOCK_INDEX);

        else

            VAR_0->cbp_table[VAR_0->mb_xy] |= 0x100 << (VAR_3 - LUMA_DC_BLOCK_INDEX);

        VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19;

    } else {

        if( VAR_6 == 64 )

            fill_rectangle(&VAR_0->non_zero_count_cache[scan8[VAR_3]], 2, 2, 8, VAR_19, 1);

        else {

            av_assert2( VAR_2 == 1 || VAR_2 ==  2 || VAR_2 ==  4 || VAR_2 == 7 || VAR_2 == 8 || VAR_2 == 11 || VAR_2 == 12 );

            VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19;

        }

    }





#define STORE_BLOCK(type) \

    do { \

        uint8_t *ctx = VAR_14[VAR_20] + abs_level_m1_ctx_base; \

 \

        int VAR_24= VAR_4[VAR_17[--VAR_19]]; \

 \

        if( get_cabac( CC, ctx ) == 0 ) { \

            VAR_20 = VAR_16[0][VAR_20]; \

            if( VAR_7 ) { \

                ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -1); \

            }else{ \

                ((type*)VAR_1)[VAR_24] = (get_cabac_bypass_sign( CC, -VAR_5[VAR_24]) + 32) >> 6; \

            } \

        } else { \

            int VAR_23 = 2; \

            ctx = VAR_15[VAR_7 && VAR_8][VAR_20] + abs_level_m1_ctx_base; \

            VAR_20 = VAR_16[1][VAR_20]; \

\

            while( VAR_23 < 15 && get_cabac( CC, ctx ) ) { \

                VAR_23++; \

            } \

\

            if( VAR_23 >= 15 ) { \

                int VAR_24 = 0; \

                while( get_cabac_bypass( CC ) ) { \

                    VAR_24++; \

                } \

\

                VAR_23=1; \

                while( VAR_24-- ) { \

                    VAR_23 += VAR_23 + get_cabac_bypass( CC ); \

                } \

                VAR_23+= 14; \

            } \

\

            if( VAR_7 ) { \

                ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -VAR_23 ); \

            }else{ \

                ((type*)VAR_1)[VAR_24] = ((int)(get_cabac_bypass_sign( CC, -VAR_23 ) * VAR_5[VAR_24] + 32)) >> 6; \

            } \

        } \

    } while ( VAR_19 );



        if (VAR_0->pixel_shift) {

            STORE_BLOCK(int32_t)

        } else {

            STORE_BLOCK(int16_t)

        }

#ifdef CABAC_ON_STACK

            VAR_0->cabac.range     = cc.range     ;

            VAR_0->cabac.low       = cc.low       ;

            VAR_0->cabac.bytestream= cc.bytestream;

#endif



}

FUNC_0(H264Context *VAR_0, int16_t *VAR_1,
int VAR_2, int VAR_3, const uint8_t *VAR_4,
const uint32_t *VAR_5, int VAR_6,
int VAR_7, int VAR_8)
{ static const int VAR_9[2][14] = { { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 }, { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 } }; static const int VAR_10[2][14] = { { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 }, { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 } }; static const int VAR_11[14] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766
}; static const uint8_t VAR_12[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 }, { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; static const uint8_t VAR_13[7] = { 0, 0, 1, 1, 2, 2, 2 }; static const uint8_t VAR_14[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; static const uint8_t VAR_15[2][8] = { { 5, 5, 5, 5, 6, 7, 8, 9 }, { 5, 5, 5, 5, 6, 7, 8, 8 }, }; static const uint8_t VAR_16[2][8] = { { 1, 2, 3, 3, 4, 5, 6, 7 }, { 4, 4, 4, 4, 5, 6, 7, 7 } }; int VAR_17[64]; int VAR_18 last; int VAR_19 = 0; int VAR_20 = 0; uint8_t *significant_coeff_ctx_base; uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; #if !ARCH_X86
#define CABAC_ON_STACK
#endif
#ifdef CABAC_ON_STACK
#define CC &cc
CABACContext cc; cc.range     = VAR_0->cabac.range; cc.low       = VAR_0->cabac.low; cc.bytestream= VAR_0->cabac.bytestream; #else
#define CC &VAR_0->cabac
#endif
significant_coeff_ctx_base = VAR_0->cabac_state
+ VAR_9[MB_FIELD][VAR_2]; last_coeff_ctx_base = VAR_0->cabac_state
+ VAR_10[MB_FIELD][VAR_2]; abs_level_m1_ctx_base = VAR_0->cabac_state
+ VAR_11[VAR_2]; if( !VAR_7 && VAR_6 == 64 ) { #define DECODE_SIGNIFICANCE( coefs, VAR_21, last_off ) \
for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + VAR_21; \ if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ VAR_17[VAR_19++] = last; \ if( get_cabac( CC, last_ctx ) ) { \ last= VAR_6; \ break; \ } \ } \ }\ if( last == VAR_6 -1 ) {\ VAR_17[VAR_19++] = last;\ } const uint8_t *VAR_21 = VAR_12[MB_FIELD]; #ifdef decode_significance
VAR_19 = decode_significance_8x8(CC, significant_coeff_ctx_base, VAR_17,
last_coeff_ctx_base, VAR_21); } else { if (VAR_7 && VAR_8) { DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]); } else { VAR_19 = decode_significance(CC, VAR_6, significant_coeff_ctx_base, VAR_17,
last_coeff_ctx_base-significant_coeff_ctx_base); } #else
DECODE_SIGNIFICANCE( 63, VAR_21[last], ff_h264_last_coeff_flag_offset_8x8[last] ); } else { if (VAR_7 && VAR_8) { DECODE_SIGNIFICANCE(7, VAR_13[last], VAR_13[last]); } else { DECODE_SIGNIFICANCE(VAR_6 - 1, last, last); } #endif
} av_assert2(VAR_19 > 0); if( VAR_7 ) { if( VAR_2 == 3 )
VAR_0->cbp_table[VAR_0->mb_xy] |= 0x40 << (VAR_3 - CHROMA_DC_BLOCK_INDEX); else
VAR_0->cbp_table[VAR_0->mb_xy] |= 0x100 << (VAR_3 - LUMA_DC_BLOCK_INDEX); VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19; } else { if( VAR_6 == 64 )
fill_rectangle(&VAR_0->non_zero_count_cache[scan8[VAR_3]], 2, 2, 8, VAR_19, 1); else { av_assert2( VAR_2 == 1 || VAR_2 ==  2 || VAR_2 ==  4 || VAR_2 == 7 || VAR_2 == 8 || VAR_2 == 11 || VAR_2 == 12 ); VAR_0->non_zero_count_cache[scan8[VAR_3]] = VAR_19; } } #define STORE_BLOCK(type) \
do { \ uint8_t *ctx = VAR_14[VAR_20] + abs_level_m1_ctx_base; \ \
int VAR_24= VAR_4[VAR_17[--VAR_19]]; \ \
if( get_cabac( CC, ctx ) == 0 ) { \ VAR_20 = VAR_16[0][VAR_20]; \ if( VAR_7 ) { \ ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -1); \ }else{ \ ((type*)VAR_1)[VAR_24] = (get_cabac_bypass_sign( CC, -VAR_5[VAR_24]) + 32) >> 6; \ } \ } else { \ int VAR_23 = 2; \ ctx = VAR_15[VAR_7 && VAR_8][VAR_20] + abs_level_m1_ctx_base; \ VAR_20 = VAR_16[1][VAR_20]; \ \
while( VAR_23 < 15 && get_cabac( CC, ctx ) ) { \ VAR_23++; \ } \ \
if( VAR_23 >= 15 ) { \ int VAR_24 = 0; \ while( get_cabac_bypass( CC ) ) { \ VAR_24++; \ } \ \
VAR_23=1; \ while( VAR_24-- ) { \ VAR_23 += VAR_23 + get_cabac_bypass( CC ); \ } \ VAR_23+= 14; \ } \ \
if( VAR_7 ) { \ ((type*)VAR_1)[VAR_24] = get_cabac_bypass_sign( CC, -VAR_23 ); \ }else{ \ ((type*)VAR_1)[VAR_24] = ((int)(get_cabac_bypass_sign( CC, -VAR_23 ) * VAR_5[VAR_24] + 32)) >> 6; \ } \ } \ } while ( VAR_19 ); if (VAR_0->pixel_shift) { STORE_BLOCK(int32_t)
} else { STORE_BLOCK(int16_t)
} #ifdef CABAC_ON_STACK
VAR_0->cabac.range     = cc.range     ; VAR_0->cabac.low       = cc.low       ; VAR_0->cabac.bytestream= cc.bytestream; #endif
}