Revision eddf8f41

View differences:

libavcodec/ac3enc.c
161 161

  
162 162
static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in);
163 163

  
164
static void apply_window(SampleType *output, const SampleType *input,
164
static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input,
165 165
                         const SampleType *window, int n);
166 166

  
167 167
static int normalize_samples(AC3EncodeContext *s);
......
262 262
            AC3Block *block = &s->blocks[blk];
263 263
            const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];
264 264

  
265
            apply_window(s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
265
            apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
266 266

  
267 267
            block->exp_shift[ch] = normalize_samples(s);
268 268

  
libavcodec/ac3enc_fixed.c
251 251
/**
252 252
 * Apply KBD window to input samples prior to MDCT.
253 253
 */
254
static void apply_window(int16_t *output, const int16_t *input,
254
static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
255 255
                         const int16_t *window, int n)
256 256
{
257 257
    int i;
libavcodec/ac3enc_float.c
48 48
                             int nbits)
49 49
{
50 50
    float *window;
51
    int n, n2;
51
    int i, n, n2;
52 52

  
53 53
    n  = 1 << nbits;
54 54
    n2 = n >> 1;
55 55

  
56
    window = av_malloc(n2 * sizeof(*window));
56
    window = av_malloc(n * sizeof(*window));
57 57
    if (!window) {
58 58
        av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory.\n");
59 59
        return AVERROR(ENOMEM);
60 60
    }
61 61
    ff_kbd_window_init(window, 5.0, n2);
62
    for (i = 0; i < n2; i++)
63
        window[n-1-i] = window[i];
62 64
    mdct->window = window;
63 65

  
64 66
    return ff_mdct_init(&mdct->fft, nbits, 0, -2.0 / n);
......
79 81
/**
80 82
 * Apply KBD window to input samples prior to MDCT.
81 83
 */
82
static void apply_window(float *output, const float *input,
84
static void apply_window(DSPContext *dsp, float *output, const float *input,
83 85
                         const float *window, int n)
84 86
{
85
    int i;
86
    int n2 = n >> 1;
87

  
88
    for (i = 0; i < n2; i++) {
89
        output[i]     = input[i]     * window[i];
90
        output[n-i-1] = input[n-i-1] * window[i];
91
    }
87
    dsp->vector_fmul(output, input, window, n);
92 88
}
93 89

  
94 90

  

Also available in: Unified diff