static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){

    MpegEncContext * const s = &h->s;

    static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};

    int level[16];

    int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before;



    //FIXME put trailing_onex into the context



    if(n == CHROMA_DC_BLOCK_INDEX){

        coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);

        total_coeff= coeff_token>>2;

    }else{

        if(n == LUMA_DC_BLOCK_INDEX){

            total_coeff= pred_non_zero_count(h, 0);

            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);

            total_coeff= coeff_token>>2;

        }else{

            total_coeff= pred_non_zero_count(h, n);

            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);

            total_coeff= coeff_token>>2;

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

        }

    }



    //FIXME set last_non_zero?



    if(total_coeff==0)

        return 0;

    if(total_coeff > (unsigned)max_coeff) {

        av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);

        return -1;

    }



    trailing_ones= coeff_token&3;

    tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);

    assert(total_coeff<=16);



    i = show_bits(gb, 3);

    skip_bits(gb, trailing_ones);

    level[0] = 1-((i&4)>>1);

    level[1] = 1-((i&2)   );

    level[2] = 1-((i&1)<<1);



    if(trailing_ones<total_coeff) {

        int mask, prefix;

        int suffix_length = total_coeff > 10 & trailing_ones < 3;

        int bitsi= show_bits(gb, LEVEL_TAB_BITS);

        int level_code= cavlc_level_tab[suffix_length][bitsi][0];



        skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);

        if(level_code >= 100){

            prefix= level_code - 100;

            if(prefix == LEVEL_TAB_BITS)

                prefix += get_level_prefix(gb);



            //first coefficient has suffix_length equal to 0 or 1

            if(prefix<14){ //FIXME try to build a large unified VLC table for all this

                if(suffix_length)

                    level_code= (prefix<<1) + get_bits1(gb); //part

                else

                    level_code= prefix; //part

            }else if(prefix==14){

                if(suffix_length)

                    level_code= (prefix<<1) + get_bits1(gb); //part

                else

                    level_code= prefix + get_bits(gb, 4); //part

            }else{

                level_code= 30 + get_bits(gb, prefix-3); //part

                if(prefix>=16)

                    level_code += (1<<(prefix-3))-4096;

            }



            if(trailing_ones < 3) level_code += 2;



            suffix_length = 2;

            mask= -(level_code&1);

            level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;

        }else{

            level_code += ((level_code>>31)|1) & -(trailing_ones < 3);



            suffix_length = 1 + (level_code + 3U > 6U);

            level[trailing_ones]= level_code;

        }



        //remaining coefficients have suffix_length > 0

        for(i=trailing_ones+1;i<total_coeff;i++) {

            static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX };

            int bitsi= show_bits(gb, LEVEL_TAB_BITS);

            level_code= cavlc_level_tab[suffix_length][bitsi][0];



            skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);

            if(level_code >= 100){

                prefix= level_code - 100;

                if(prefix == LEVEL_TAB_BITS){

                    prefix += get_level_prefix(gb);

                }

                if(prefix<15){

                    level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);

                }else{

                    level_code = (15<<suffix_length) + get_bits(gb, prefix-3);

                    if(prefix>=16)

                        level_code += (1<<(prefix-3))-4096;

                }

                mask= -(level_code&1);

                level_code= (((2+level_code)>>1) ^ mask) - mask;

            }

            level[i]= level_code;

            suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length];

        }

    }



    if(total_coeff == max_coeff)

        zeros_left=0;

    else{

        if(n == CHROMA_DC_BLOCK_INDEX)

            zeros_left= get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[ total_coeff ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);

        else

            zeros_left= get_vlc2(gb, (total_zeros_vlc-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);

    }



    coeff_num = zeros_left + total_coeff - 1;

    j = scantable[coeff_num];

    if(n > 24){

        block[j] = level[0];

        for(i=1;i<total_coeff;i++) {

            if(zeros_left <= 0)

                run_before = 0;

            else if(zeros_left < 7){

                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);

            }else{

                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            zeros_left -= run_before;

            coeff_num -= 1 + run_before;

            j= scantable[ coeff_num ];



            block[j]= level[i];

        }

    }else{

        block[j] = (level[0] * qmul[j] + 32)>>6;

        for(i=1;i<total_coeff;i++) {

            if(zeros_left <= 0)

                run_before = 0;

            else if(zeros_left < 7){

                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);

            }else{

                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            zeros_left -= run_before;

            coeff_num -= 1 + run_before;

            j= scantable[ coeff_num ];



            block[j]= (level[i] * qmul[j] + 32)>>6;

        }

    }



    if(zeros_left<0){

        av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);

        return -1;

    }



    return 0;

}

static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){

    MpegEncContext * const s = &h->s;

    static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};

    int level[16];

    int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before;



    



    if(n == CHROMA_DC_BLOCK_INDEX){

        coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);

        total_coeff= coeff_token>>2;

    }else{

        if(n == LUMA_DC_BLOCK_INDEX){

            total_coeff= pred_non_zero_count(h, 0);

            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);

            total_coeff= coeff_token>>2;

        }else{

            total_coeff= pred_non_zero_count(h, n);

            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);

            total_coeff= coeff_token>>2;

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

        }

    }



    



    if(total_coeff==0)

        return 0;

    if(total_coeff > (unsigned)max_coeff) {

        av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);

        return -1;

    }



    trailing_ones= coeff_token&3;

    tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);

    assert(total_coeff<=16);



    i = show_bits(gb, 3);

    skip_bits(gb, trailing_ones);

    level[0] = 1-((i&4)>>1);

    level[1] = 1-((i&2)   );

    level[2] = 1-((i&1)<<1);



    if(trailing_ones<total_coeff) {

        int mask, prefix;

        int suffix_length = total_coeff > 10 & trailing_ones < 3;

        int bitsi= show_bits(gb, LEVEL_TAB_BITS);

        int level_code= cavlc_level_tab[suffix_length][bitsi][0];



        skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);

        if(level_code >= 100){

            prefix= level_code - 100;

            if(prefix == LEVEL_TAB_BITS)

                prefix += get_level_prefix(gb);



            

            if(prefix<14){ 

                if(suffix_length)

                    level_code= (prefix<<1) + get_bits1(gb); 

                else

                    level_code= prefix; 

            }else if(prefix==14){

                if(suffix_length)

                    level_code= (prefix<<1) + get_bits1(gb); 

                else

                    level_code= prefix + get_bits(gb, 4); 

            }else{

                level_code= 30 + get_bits(gb, prefix-3); 

                if(prefix>=16)

                    level_code += (1<<(prefix-3))-4096;

            }



            if(trailing_ones < 3) level_code += 2;



            suffix_length = 2;

            mask= -(level_code&1);

            level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;

        }else{

            level_code += ((level_code>>31)|1) & -(trailing_ones < 3);



            suffix_length = 1 + (level_code + 3U > 6U);

            level[trailing_ones]= level_code;

        }



        

        for(i=trailing_ones+1;i<total_coeff;i++) {

            static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX };

            int bitsi= show_bits(gb, LEVEL_TAB_BITS);

            level_code= cavlc_level_tab[suffix_length][bitsi][0];



            skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);

            if(level_code >= 100){

                prefix= level_code - 100;

                if(prefix == LEVEL_TAB_BITS){

                    prefix += get_level_prefix(gb);

                }

                if(prefix<15){

                    level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);

                }else{

                    level_code = (15<<suffix_length) + get_bits(gb, prefix-3);

                    if(prefix>=16)

                        level_code += (1<<(prefix-3))-4096;

                }

                mask= -(level_code&1);

                level_code= (((2+level_code)>>1) ^ mask) - mask;

            }

            level[i]= level_code;

            suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length];

        }

    }



    if(total_coeff == max_coeff)

        zeros_left=0;

    else{

        if(n == CHROMA_DC_BLOCK_INDEX)

            zeros_left= get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[ total_coeff ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);

        else

            zeros_left= get_vlc2(gb, (total_zeros_vlc-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);

    }



    coeff_num = zeros_left + total_coeff - 1;

    j = scantable[coeff_num];

    if(n > 24){

        block[j] = level[0];

        for(i=1;i<total_coeff;i++) {

            if(zeros_left <= 0)

                run_before = 0;

            else if(zeros_left < 7){

                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);

            }else{

                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            zeros_left -= run_before;

            coeff_num -= 1 + run_before;

            j= scantable[ coeff_num ];



            block[j]= level[i];

        }

    }else{

        block[j] = (level[0] * qmul[j] + 32)>>6;

        for(i=1;i<total_coeff;i++) {

            if(zeros_left <= 0)

                run_before = 0;

            else if(zeros_left < 7){

                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);

            }else{

                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            zeros_left -= run_before;

            coeff_num -= 1 + run_before;

            j= scantable[ coeff_num ];



            block[j]= (level[i] * qmul[j] + 32)>>6;

        }

    }



    if(zeros_left<0){

        av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);

        return -1;

    }



    return 0;

}

static int FUNC_0(H264Context *VAR_0, GetBitContext *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t *VAR_4, const uint32_t *VAR_5, int VAR_6){

    MpegEncContext * const s = &VAR_0->s;

    static const int VAR_7[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};

    int VAR_8[16];

    int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;



    



    if(VAR_3 == CHROMA_DC_BLOCK_INDEX){

        VAR_11= get_vlc2(VAR_1, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);

        VAR_12= VAR_11>>2;

    }else{

        if(VAR_3 == LUMA_DC_BLOCK_INDEX){

            VAR_12= pred_non_zero_count(VAR_0, 0);

            VAR_11= get_vlc2(VAR_1, coeff_token_vlc[ VAR_7[VAR_12] ].table, COEFF_TOKEN_VLC_BITS, 2);

            VAR_12= VAR_11>>2;

        }else{

            VAR_12= pred_non_zero_count(VAR_0, VAR_3);

            VAR_11= get_vlc2(VAR_1, coeff_token_vlc[ VAR_7[VAR_12] ].table, COEFF_TOKEN_VLC_BITS, 2);

            VAR_12= VAR_11>>2;

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

        }

    }



    



    if(VAR_12==0)

        return 0;

    if(VAR_12 > (unsigned)VAR_6) {

        av_log(VAR_0->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (VAR_12=%d)\VAR_3", s->mb_x, s->mb_y, VAR_12);

        return -1;

    }



    VAR_15= VAR_11&3;

    tprintf(VAR_0->s.avctx, "trailing:%d, total:%d\VAR_3", VAR_15, VAR_12);

    assert(VAR_12<=16);



    VAR_13 = show_bits(VAR_1, 3);

    skip_bits(VAR_1, VAR_15);

    VAR_8[0] = 1-((VAR_13&4)>>1);

    VAR_8[1] = 1-((VAR_13&2)   );

    VAR_8[2] = 1-((VAR_13&1)<<1);



    if(VAR_15<VAR_12) {

        int VAR_17, VAR_18;

        int VAR_19 = VAR_12 > 10 & VAR_15 < 3;

        int VAR_23= show_bits(VAR_1, LEVEL_TAB_BITS);

        int VAR_21= cavlc_level_tab[VAR_19][VAR_23][0];



        skip_bits(VAR_1, cavlc_level_tab[VAR_19][VAR_23][1]);

        if(VAR_21 >= 100){

            VAR_18= VAR_21 - 100;

            if(VAR_18 == LEVEL_TAB_BITS)

                VAR_18 += get_level_prefix(VAR_1);



            

            if(VAR_18<14){ 

                if(VAR_19)

                    VAR_21= (VAR_18<<1) + get_bits1(VAR_1); 

                else

                    VAR_21= VAR_18; 

            }else if(VAR_18==14){

                if(VAR_19)

                    VAR_21= (VAR_18<<1) + get_bits1(VAR_1); 

                else

                    VAR_21= VAR_18 + get_bits(VAR_1, 4); 

            }else{

                VAR_21= 30 + get_bits(VAR_1, VAR_18-3); 

                if(VAR_18>=16)

                    VAR_21 += (1<<(VAR_18-3))-4096;

            }



            if(VAR_15 < 3) VAR_21 += 2;



            VAR_19 = 2;

            VAR_17= -(VAR_21&1);

            VAR_8[VAR_15]= (((2+VAR_21)>>1) ^ VAR_17) - VAR_17;

        }else{

            VAR_21 += ((VAR_21>>31)|1) & -(VAR_15 < 3);



            VAR_19 = 1 + (VAR_21 + 3U > 6U);

            VAR_8[VAR_15]= VAR_21;

        }



        

        for(VAR_13=VAR_15+1;VAR_13<VAR_12;VAR_13++) {

            static const unsigned int VAR_22[7] = {0,3,6,12,24,48,INT_MAX };

            int VAR_23= show_bits(VAR_1, LEVEL_TAB_BITS);

            VAR_21= cavlc_level_tab[VAR_19][VAR_23][0];



            skip_bits(VAR_1, cavlc_level_tab[VAR_19][VAR_23][1]);

            if(VAR_21 >= 100){

                VAR_18= VAR_21 - 100;

                if(VAR_18 == LEVEL_TAB_BITS){

                    VAR_18 += get_level_prefix(VAR_1);

                }

                if(VAR_18<15){

                    VAR_21 = (VAR_18<<VAR_19) + get_bits(VAR_1, VAR_19);

                }else{

                    VAR_21 = (15<<VAR_19) + get_bits(VAR_1, VAR_18-3);

                    if(VAR_18>=16)

                        VAR_21 += (1<<(VAR_18-3))-4096;

                }

                VAR_17= -(VAR_21&1);

                VAR_21= (((2+VAR_21)>>1) ^ VAR_17) - VAR_17;

            }

            VAR_8[VAR_13]= VAR_21;

            VAR_19+= VAR_22[VAR_19] + VAR_21 > 2U*VAR_22[VAR_19];

        }

    }



    if(VAR_12 == VAR_6)

        VAR_9=0;

    else{

        if(VAR_3 == CHROMA_DC_BLOCK_INDEX)

            VAR_9= get_vlc2(VAR_1, (chroma_dc_total_zeros_vlc-1)[ VAR_12 ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);

        else

            VAR_9= get_vlc2(VAR_1, (total_zeros_vlc-1)[ VAR_12 ].table, TOTAL_ZEROS_VLC_BITS, 1);

    }



    VAR_10 = VAR_9 + VAR_12 - 1;

    VAR_14 = VAR_4[VAR_10];

    if(VAR_3 > 24){

        VAR_2[VAR_14] = VAR_8[0];

        for(VAR_13=1;VAR_13<VAR_12;VAR_13++) {

            if(VAR_9 <= 0)

                VAR_16 = 0;

            else if(VAR_9 < 7){

                VAR_16= get_vlc2(VAR_1, (run_vlc-1)[VAR_9].table, RUN_VLC_BITS, 1);

            }else{

                VAR_16= get_vlc2(VAR_1, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            VAR_9 -= VAR_16;

            VAR_10 -= 1 + VAR_16;

            VAR_14= VAR_4[ VAR_10 ];



            VAR_2[VAR_14]= VAR_8[VAR_13];

        }

    }else{

        VAR_2[VAR_14] = (VAR_8[0] * VAR_5[VAR_14] + 32)>>6;

        for(VAR_13=1;VAR_13<VAR_12;VAR_13++) {

            if(VAR_9 <= 0)

                VAR_16 = 0;

            else if(VAR_9 < 7){

                VAR_16= get_vlc2(VAR_1, (run_vlc-1)[VAR_9].table, RUN_VLC_BITS, 1);

            }else{

                VAR_16= get_vlc2(VAR_1, run7_vlc.table, RUN7_VLC_BITS, 2);

            }

            VAR_9 -= VAR_16;

            VAR_10 -= 1 + VAR_16;

            VAR_14= VAR_4[ VAR_10 ];



            VAR_2[VAR_14]= (VAR_8[VAR_13] * VAR_5[VAR_14] + 32)>>6;

        }

    }



    if(VAR_9<0){

        av_log(VAR_0->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\VAR_3", s->mb_x, s->mb_y);

        return -1;

    }



    return 0;

}

static int FUNC_0(H264Context *VAR_0, GetBitContext *VAR_1, DCTELEM *VAR_2, int VAR_3, const uint8_t *VAR_4, const uint32_t *VAR_5, int VAR_6){ MpegEncContext * const s = &VAR_0->s; static const int VAR_7[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; int VAR_8[16]; int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16; if(VAR_3 == CHROMA_DC_BLOCK_INDEX){ VAR_11= get_vlc2(VAR_1, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1); VAR_12= VAR_11>>2; }else{ if(VAR_3 == LUMA_DC_BLOCK_INDEX){ VAR_12= pred_non_zero_count(VAR_0, 0); VAR_11= get_vlc2(VAR_1, coeff_token_vlc[ VAR_7[VAR_12] ].table, COEFF_TOKEN_VLC_BITS, 2); VAR_12= VAR_11>>2; }else{ VAR_12= pred_non_zero_count(VAR_0, VAR_3); VAR_11= get_vlc2(VAR_1, coeff_token_vlc[ VAR_7[VAR_12] ].table, COEFF_TOKEN_VLC_BITS, 2); VAR_12= VAR_11>>2; VAR_0->non_zero_count_cache[ scan8[VAR_3] ]= VAR_12; } } if(VAR_12==0)
return 0; if(VAR_12 > (unsigned)VAR_6) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (VAR_12=%d)\VAR_3", s->mb_x, s->mb_y, VAR_12); return -1; } VAR_15= VAR_11&3; tprintf(VAR_0->s.avctx, "trailing:%d, total:%d\VAR_3", VAR_15, VAR_12); assert(VAR_12<=16); VAR_13 = show_bits(VAR_1, 3); skip_bits(VAR_1, VAR_15); VAR_8[0] = 1-((VAR_13&4)>>1); VAR_8[1] = 1-((VAR_13&2)   ); VAR_8[2] = 1-((VAR_13&1)<<1); if(VAR_15<VAR_12) { int VAR_17, VAR_18; int VAR_19 = VAR_12 > 10 & VAR_15 < 3; int VAR_23= show_bits(VAR_1, LEVEL_TAB_BITS); int VAR_21= cavlc_level_tab[VAR_19][VAR_23][0]; skip_bits(VAR_1, cavlc_level_tab[VAR_19][VAR_23][1]); if(VAR_21 >= 100){ VAR_18= VAR_21 - 100; if(VAR_18 == LEVEL_TAB_BITS)
VAR_18 += get_level_prefix(VAR_1); if(VAR_18<14){ if(VAR_19)
VAR_21= (VAR_18<<1) + get_bits1(VAR_1); else
VAR_21= VAR_18; }else if(VAR_18==14){ if(VAR_19)
VAR_21= (VAR_18<<1) + get_bits1(VAR_1); else
VAR_21= VAR_18 + get_bits(VAR_1, 4); }else{ VAR_21= 30 + get_bits(VAR_1, VAR_18-3); if(VAR_18>=16)
VAR_21 += (1<<(VAR_18-3))-4096; } if(VAR_15 < 3) VAR_21 += 2; VAR_19 = 2; VAR_17= -(VAR_21&1); VAR_8[VAR_15]= (((2+VAR_21)>>1) ^ VAR_17) - VAR_17; }else{ VAR_21 += ((VAR_21>>31)|1) & -(VAR_15 < 3); VAR_19 = 1 + (VAR_21 + 3U > 6U); VAR_8[VAR_15]= VAR_21; } for(VAR_13=VAR_15+1;VAR_13<VAR_12;VAR_13++) { static const unsigned int VAR_22[7] = {0,3,6,12,24,48,INT_MAX }; int VAR_23= show_bits(VAR_1, LEVEL_TAB_BITS); VAR_21= cavlc_level_tab[VAR_19][VAR_23][0]; skip_bits(VAR_1, cavlc_level_tab[VAR_19][VAR_23][1]); if(VAR_21 >= 100){ VAR_18= VAR_21 - 100; if(VAR_18 == LEVEL_TAB_BITS){ VAR_18 += get_level_prefix(VAR_1); } if(VAR_18<15){ VAR_21 = (VAR_18<<VAR_19) + get_bits(VAR_1, VAR_19); }else{ VAR_21 = (15<<VAR_19) + get_bits(VAR_1, VAR_18-3); if(VAR_18>=16)
VAR_21 += (1<<(VAR_18-3))-4096; } VAR_17= -(VAR_21&1); VAR_21= (((2+VAR_21)>>1) ^ VAR_17) - VAR_17; } VAR_8[VAR_13]= VAR_21; VAR_19+= VAR_22[VAR_19] + VAR_21 > 2U*VAR_22[VAR_19]; } } if(VAR_12 == VAR_6)
VAR_9=0; else{ if(VAR_3 == CHROMA_DC_BLOCK_INDEX)
VAR_9= get_vlc2(VAR_1, (chroma_dc_total_zeros_vlc-1)[ VAR_12 ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1); else
VAR_9= get_vlc2(VAR_1, (total_zeros_vlc-1)[ VAR_12 ].table, TOTAL_ZEROS_VLC_BITS, 1); } VAR_10 = VAR_9 + VAR_12 - 1; VAR_14 = VAR_4[VAR_10]; if(VAR_3 > 24){ VAR_2[VAR_14] = VAR_8[0]; for(VAR_13=1;VAR_13<VAR_12;VAR_13++) { if(VAR_9 <= 0)
VAR_16 = 0; else if(VAR_9 < 7){ VAR_16= get_vlc2(VAR_1, (run_vlc-1)[VAR_9].table, RUN_VLC_BITS, 1); }else{ VAR_16= get_vlc2(VAR_1, run7_vlc.table, RUN7_VLC_BITS, 2); } VAR_9 -= VAR_16; VAR_10 -= 1 + VAR_16; VAR_14= VAR_4[ VAR_10 ]; VAR_2[VAR_14]= VAR_8[VAR_13]; } }else{ VAR_2[VAR_14] = (VAR_8[0] * VAR_5[VAR_14] + 32)>>6; for(VAR_13=1;VAR_13<VAR_12;VAR_13++) { if(VAR_9 <= 0)
VAR_16 = 0; else if(VAR_9 < 7){ VAR_16= get_vlc2(VAR_1, (run_vlc-1)[VAR_9].table, RUN_VLC_BITS, 1); }else{ VAR_16= get_vlc2(VAR_1, run7_vlc.table, RUN7_VLC_BITS, 2); } VAR_9 -= VAR_16; VAR_10 -= 1 + VAR_16; VAR_14= VAR_4[ VAR_10 ]; VAR_2[VAR_14]= (VAR_8[VAR_13] * VAR_5[VAR_14] + 32)>>6; } } if(VAR_9<0){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\VAR_3", s->mb_x, s->mb_y); return -1; } return 0; }