Revision 177fed4e

View differences:

libavcodec/ac3enc.c
162 162
    int loro_surround_mix_level;            ///< Lo/Ro surround mix level code
163 163

  
164 164
    int cutoff;                             ///< user-specified cutoff frequency, in Hz
165
    int bandwidth_code[AC3_MAX_CHANNELS];   ///< bandwidth code (0 to 60)               (chbwcod)
165
    int bandwidth_code;                     ///< bandwidth code (0 to 60)               (chbwcod)
166 166
    int nb_coefs[AC3_MAX_CHANNELS];
167 167

  
168 168
    int rematrixing_enabled;                ///< stereo rematrixing enabled
......
1407 1407
    /* bandwidth */
1408 1408
    for (ch = 0; ch < s->fbw_channels; ch++) {
1409 1409
        if (s->exp_strategy[ch][blk] != EXP_REUSE)
1410
            put_bits(&s->pb, 6, s->bandwidth_code[ch]);
1410
            put_bits(&s->pb, 6, s->bandwidth_code);
1411 1411
    }
1412 1412

  
1413 1413
    /* exponents */
......
2047 2047
 */
2048 2048
static av_cold void set_bandwidth(AC3EncodeContext *s)
2049 2049
{
2050
    int ch, bw_code;
2050
    int ch;
2051 2051

  
2052 2052
    if (s->cutoff) {
2053 2053
        /* calculate bandwidth based on user-specified cutoff frequency */
2054 2054
        int fbw_coeffs;
2055 2055
        fbw_coeffs     = s->cutoff * 2 * AC3_MAX_COEFS / s->sample_rate;
2056
        bw_code        = av_clip((fbw_coeffs - 73) / 3, 0, 60);
2056
        s->bandwidth_code = av_clip((fbw_coeffs - 73) / 3, 0, 60);
2057 2057
    } else {
2058 2058
        /* use default bandwidth setting */
2059
        bw_code = ac3_bandwidth_tab[s->fbw_channels-1][s->bit_alloc.sr_code][s->frame_size_code/2];
2059
        s->bandwidth_code = ac3_bandwidth_tab[s->fbw_channels-1][s->bit_alloc.sr_code][s->frame_size_code/2];
2060 2060
    }
2061 2061

  
2062 2062
    /* set number of coefficients for each channel */
2063 2063
    for (ch = 0; ch < s->fbw_channels; ch++) {
2064
        s->bandwidth_code[ch] = bw_code;
2065
        s->nb_coefs[ch]       = bw_code * 3 + 73;
2064
        s->nb_coefs[ch] = s->bandwidth_code * 3 + 73;
2066 2065
    }
2067 2066
    if (s->lfe_on)
2068 2067
        s->nb_coefs[s->lfe_channel] = 7; /* LFE channel always has 7 coefs */

Also available in: Unified diff