Revision 1fda2c10

View differences:

libavcodec/ac3.h
36 36
#define AC3_BLOCK_SIZE  256
37 37
#define AC3_MAX_BLOCKS    6
38 38
#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
39
#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
39 40

  
40 41
/* exponent encoding strategy */
41 42
#define EXP_REUSE 0
libavcodec/ac3enc.c
1187 1187
    AC3EncodeContext *s = avctx->priv_data;
1188 1188
    const int16_t *samples = data;
1189 1189
    int i, j, k, v, ch;
1190
    int16_t input_samples[AC3_BLOCK_SIZE*2];
1190
    int16_t input_samples[AC3_WINDOW_SIZE];
1191 1191
    int32_t mdct_coef[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
1192 1192
    uint8_t exp[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
1193 1193
    uint8_t exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
......
1219 1219
            for(j=0;j<AC3_BLOCK_SIZE;j++) {
1220 1220
                input_samples[j] = MUL16(input_samples[j],
1221 1221
                                         ff_ac3_window[j]) >> 15;
1222
                input_samples[AC3_BLOCK_SIZE*2-j-1] = MUL16(input_samples[AC3_BLOCK_SIZE*2-j-1],
1222
                input_samples[AC3_WINDOW_SIZE-j-1] = MUL16(input_samples[AC3_WINDOW_SIZE-j-1],
1223 1223
                                             ff_ac3_window[j]) >> 15;
1224 1224
            }
1225 1225

  
1226 1226
            /* Normalize the samples to use the maximum available
1227 1227
               precision */
1228
            v = 14 - log2_tab(input_samples, AC3_BLOCK_SIZE*2);
1228
            v = 14 - log2_tab(input_samples, AC3_WINDOW_SIZE);
1229 1229
            if (v < 0)
1230 1230
                v = 0;
1231 1231
            exp_samples[i][ch] = v - 9;
1232
            lshift_tab(input_samples, AC3_BLOCK_SIZE*2, v);
1232
            lshift_tab(input_samples, AC3_WINDOW_SIZE, v);
1233 1233

  
1234 1234
            /* do the MDCT */
1235 1235
            mdct512(mdct_coef[i][ch], input_samples);

Also available in: Unified diff