Revision e8c7f81c libavcodec/wma.c

View differences:

libavcodec/wma.c
75 75

  
76 76
    int frame_len_bits;
77 77

  
78
    if (sample_rate <= 16000)
78
    if (sample_rate <= 16000) {
79 79
        frame_len_bits = 9;
80
    else if (sample_rate <= 22050 ||
81
             (sample_rate <= 32000 && version == 1))
80
    } else if (sample_rate <= 22050 ||
81
             (sample_rate <= 32000 && version == 1)) {
82 82
        frame_len_bits = 10;
83
    else if (sample_rate <= 48000) {
83
    } else if (sample_rate <= 48000) {
84 84
        frame_len_bits = 11;
85 85
    } else if (sample_rate <= 96000) {
86 86
        frame_len_bits = 12;
......
153 153
    /* if version 2, then the rates are normalized */
154 154
    sample_rate1 = s->sample_rate;
155 155
    if (s->version == 2) {
156
        if (sample_rate1 >= 44100)
156
        if (sample_rate1 >= 44100) {
157 157
            sample_rate1 = 44100;
158
        else if (sample_rate1 >= 22050)
158
        } else if (sample_rate1 >= 22050) {
159 159
            sample_rate1 = 22050;
160
        else if (sample_rate1 >= 16000)
160
        } else if (sample_rate1 >= 16000) {
161 161
            sample_rate1 = 16000;
162
        else if (sample_rate1 >= 11025)
162
        } else if (sample_rate1 >= 11025) {
163 163
            sample_rate1 = 11025;
164
        else if (sample_rate1 >= 8000)
164
        } else if (sample_rate1 >= 8000) {
165 165
            sample_rate1 = 8000;
166
        }
166 167
    }
167 168

  
168 169
    bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate);
......
174 175
    if (s->nb_channels == 2)
175 176
        bps1 = bps * 1.6;
176 177
    if (sample_rate1 == 44100) {
177
        if (bps1 >= 0.61)
178
        if (bps1 >= 0.61) {
178 179
            s->use_noise_coding = 0;
179
        else
180
        } else {
180 181
            high_freq = high_freq * 0.4;
182
        }
181 183
    } else if (sample_rate1 == 22050) {
182
        if (bps1 >= 1.16)
184
        if (bps1 >= 1.16) {
183 185
            s->use_noise_coding = 0;
184
        else if (bps1 >= 0.72)
186
        } else if (bps1 >= 0.72) {
185 187
            high_freq = high_freq * 0.7;
186
        else
188
        } else {
187 189
            high_freq = high_freq * 0.6;
190
        }
188 191
    } else if (sample_rate1 == 16000) {
189
        if (bps > 0.5)
192
        if (bps > 0.5) {
190 193
            high_freq = high_freq * 0.5;
191
        else
194
        } else {
192 195
            high_freq = high_freq * 0.3;
196
        }
193 197
    } else if (sample_rate1 == 11025) {
194 198
        high_freq = high_freq * 0.7;
195 199
    } else if (sample_rate1 == 8000) {
......
252 256
                table = NULL;
253 257
                a = s->frame_len_bits - BLOCK_MIN_BITS - k;
254 258
                if (a < 3) {
255
                    if (s->sample_rate >= 44100)
259
                    if (s->sample_rate >= 44100) {
256 260
                        table = exponent_band_44100[a];
257
                    else if (s->sample_rate >= 32000)
261
                    } else if (s->sample_rate >= 32000) {
258 262
                        table = exponent_band_32000[a];
259
                    else if (s->sample_rate >= 22050)
263
                    } else if (s->sample_rate >= 22050) {
260 264
                        table = exponent_band_22050[a];
265
                    }
261 266
                }
262 267
                if (table) {
263 268
                    n = *table++;
......
345 350
    if (s->use_noise_coding) {
346 351

  
347 352
        /* init the noise generator */
348
        if (s->use_exp_vlc)
353
        if (s->use_exp_vlc) {
349 354
            s->noise_mult = 0.02;
350
        else
355
        } else {
351 356
            s->noise_mult = 0.04;
357
        }
352 358

  
353 359
#ifdef TRACE
354 360
        for (i = 0; i < NOISE_TAB_SIZE; i++)
......
370 376
    /* choose the VLC tables for the coefficients */
371 377
    coef_vlc_table = 2;
372 378
    if (s->sample_rate >= 32000) {
373
        if (bps1 < 0.72)
379
        if (bps1 < 0.72) {
374 380
            coef_vlc_table = 0;
375
        else if (bps1 < 1.16)
381
        } else if (bps1 < 1.16) {
376 382
            coef_vlc_table = 1;
383
        }
377 384
    }
378 385
    s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2    ];
379 386
    s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1];

Also available in: Unified diff