Revision eddf8f41 libavcodec/ac3enc_float.c

View differences:

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