Revision d42fc4a8 libavcodec/h264.c

View differences:

libavcodec/h264.c
4142 4142
    level[2] = 1-((i&1)<<1);
4143 4143

  
4144 4144
    if(trailing_ones<total_coeff) {
4145
        int level_code, mask;
4145
        int mask, prefix;
4146 4146
        int suffix_length = total_coeff > 10 && trailing_ones < 3;
4147
        int prefix= get_level_prefix(gb);
4147
        int bitsi= show_bits(gb, LEVEL_TAB_BITS);
4148
        int level_code= cavlc_level_tab[suffix_length][bitsi][0];
4149

  
4150
        skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
4151
        if(level_code >= 100){
4152
            prefix= level_code - 100;
4153
            if(prefix == LEVEL_TAB_BITS)
4154
                prefix += get_level_prefix(gb);
4148 4155

  
4149 4156
        //first coefficient has suffix_length equal to 0 or 1
4150 4157
        if(prefix<14){ //FIXME try to build a large unified VLC table for all this
......
4166 4173

  
4167 4174
        if(trailing_ones < 3) level_code += 2;
4168 4175

  
4169
        suffix_length = 1;
4170
        if(level_code > 5)
4171
            suffix_length++;
4176
        suffix_length = 2;
4172 4177
        mask= -(level_code&1);
4173 4178
        level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;
4179
        }else{
4180
            if(trailing_ones < 3) level_code += (level_code>>31)|1;
4181

  
4182
            suffix_length = 1;
4183
            if(level_code + 3U > 6U)
4184
                suffix_length++;
4185
            level[trailing_ones]= level_code;
4186
        }
4174 4187

  
4175 4188
        //remaining coefficients have suffix_length > 0
4176 4189
        for(i=trailing_ones+1;i<total_coeff;i++) {

Also available in: Unified diff