Revision a7c6e117 libavcodec/ac3enc.c

View differences:

libavcodec/ac3enc.c
36 36
    int nb_channels;
37 37
    int nb_all_channels;
38 38
    int lfe_channel;
39
    const uint8_t *channel_map;
39 40
    int bit_rate;
40 41
    unsigned int sample_rate;
41 42
    unsigned int bitstream_id;
......
638 639
    s->nb_all_channels = channels;
639 640
    s->nb_channels = channels > 5 ? 5 : channels;
640 641
    s->lfe_channel = s->lfe ? 5 : -1;
642
    s->channel_map = ff_ac3_enc_channel_map[s->channel_mode][s->lfe];
641 643

  
642 644
    /* frequency */
643 645
    for(i=0;i<3;i++) {
......
1158 1160

  
1159 1161
    frame_bits = 0;
1160 1162
    for(ch=0;ch<s->nb_all_channels;ch++) {
1163
        int ich = s->channel_map[ch];
1161 1164
        /* fixed mdct to the six sub blocks & exponent computation */
1162 1165
        for(i=0;i<NB_BLOCKS;i++) {
1163 1166
            int16_t *sptr;
1164 1167
            int sinc;
1165 1168

  
1166 1169
            /* compute input samples */
1167
            memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(int16_t));
1170
            memcpy(input_samples, s->last_samples[ich], N/2 * sizeof(int16_t));
1168 1171
            sinc = s->nb_all_channels;
1169
            sptr = samples + (sinc * (N/2) * i) + ch;
1172
            sptr = samples + (sinc * (N/2) * i) + ich;
1170 1173
            for(j=0;j<N/2;j++) {
1171 1174
                v = *sptr;
1172 1175
                input_samples[j + N/2] = v;
1173
                s->last_samples[ch][j] = v;
1176
                s->last_samples[ich][j] = v;
1174 1177
                sptr += sinc;
1175 1178
            }
1176 1179

  

Also available in: Unified diff