Revision 98f6ee44

View differences:

libavcodec/ac3enc.c
1083 1083
    int v;
1084 1084
    int blk, blk1, blk2, ch, i;
1085 1085
    int16_t planar_samples[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE+AC3_FRAME_SIZE];
1086
    int16_t input_samples[AC3_WINDOW_SIZE];
1086
    int16_t windowed_samples[AC3_WINDOW_SIZE];
1087 1087
    int32_t mdct_coef[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
1088 1088
    uint8_t exp[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
1089 1089
    uint8_t exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
......
1118 1118
    for (ch = 0; ch < s->channels; ch++) {
1119 1119
        /* fixed mdct to the six sub blocks & exponent computation */
1120 1120
        for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
1121
            int16_t *src_samples = &planar_samples[ch][blk * AC3_BLOCK_SIZE];
1121
            int16_t *input_samples = &planar_samples[ch][blk * AC3_BLOCK_SIZE];
1122 1122

  
1123 1123
            /* apply the MDCT window */
1124 1124
            for (i = 0; i < AC3_BLOCK_SIZE; i++) {
1125
                input_samples[i]                   = MUL16(src_samples[i],
1125
                windowed_samples[i]                   = MUL16(input_samples[i],
1126 1126
                                                           ff_ac3_window[i]) >> 15;
1127
                input_samples[AC3_WINDOW_SIZE-i-1] = MUL16(src_samples[AC3_WINDOW_SIZE-i-1],
1127
                windowed_samples[AC3_WINDOW_SIZE-i-1] = MUL16(input_samples[AC3_WINDOW_SIZE-i-1],
1128 1128
                                                           ff_ac3_window[i]) >> 15;
1129 1129
            }
1130 1130

  
1131 1131
            /* Normalize the samples to use the maximum available precision */
1132
            v = 14 - log2_tab(input_samples, AC3_WINDOW_SIZE);
1132
            v = 14 - log2_tab(windowed_samples, AC3_WINDOW_SIZE);
1133 1133
            if (v < 0)
1134 1134
                v = 0;
1135 1135
            exp_shift[blk][ch] = v - 9;
1136
            lshift_tab(input_samples, AC3_WINDOW_SIZE, v);
1136
            lshift_tab(windowed_samples, AC3_WINDOW_SIZE, v);
1137 1137

  
1138 1138
            /* do the MDCT */
1139
            mdct512(mdct_coef[blk][ch], input_samples);
1139
            mdct512(mdct_coef[blk][ch], windowed_samples);
1140 1140

  
1141 1141
            /* compute "exponents". We take into account the normalization there */
1142 1142
            for (i = 0; i < AC3_MAX_COEFS; i++) {

Also available in: Unified diff