Revision 2790d7a9

View differences:

libavcodec/aacenc.c
225 225
    const float * lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
226 226
    const float * swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
227 227
    const float * pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
228
    float *output = sce->ret;
228 229

  
229 230
    if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
230
        memcpy(s->output, sce->saved, sizeof(float)*1024);
231
        memcpy(output, sce->saved, sizeof(float)*1024);
231 232
        if (sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE) {
232
            memset(s->output, 0, sizeof(s->output[0]) * 448);
233
            memset(output, 0, sizeof(output[0]) * 448);
233 234
            for (i = 448; i < 576; i++)
234
                s->output[i] = sce->saved[i] * pwindow[i - 448];
235
                output[i] = sce->saved[i] * pwindow[i - 448];
235 236
            for (i = 576; i < 704; i++)
236
                s->output[i] = sce->saved[i];
237
                output[i] = sce->saved[i];
237 238
        }
238 239
        if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) {
239 240
            for (i = 0; i < 1024; i++) {
240
                s->output[i+1024]         = audio[i * chans] * lwindow[1024 - i - 1];
241
                output[i+1024]         = audio[i * chans] * lwindow[1024 - i - 1];
241 242
                sce->saved[i] = audio[i * chans] * lwindow[i];
242 243
            }
243 244
        } else {
244 245
            for (i = 0; i < 448; i++)
245
                s->output[i+1024]         = audio[i * chans];
246
                output[i+1024]         = audio[i * chans];
246 247
            for (; i < 576; i++)
247
                s->output[i+1024]         = audio[i * chans] * swindow[576 - i - 1];
248
            memset(s->output+1024+576, 0, sizeof(s->output[0]) * 448);
248
                output[i+1024]         = audio[i * chans] * swindow[576 - i - 1];
249
            memset(output+1024+576, 0, sizeof(output[0]) * 448);
249 250
            for (i = 0; i < 1024; i++)
250 251
                sce->saved[i] = audio[i * chans];
251 252
        }
252
        ff_mdct_calc(&s->mdct1024, sce->coeffs, s->output);
253
        ff_mdct_calc(&s->mdct1024, sce->coeffs, output);
253 254
    } else {
254 255
        for (k = 0; k < 1024; k += 128) {
255 256
            for (i = 448 + k; i < 448 + k + 256; i++)
256
                s->output[i - 448 - k] = (i < 1024)
257
                output[i - 448 - k] = (i < 1024)
257 258
                                         ? sce->saved[i]
258 259
                                         : audio[(i-1024)*chans];
259
            s->dsp.vector_fmul        (s->output,     s->output, k ?  swindow : pwindow, 128);
260
            s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128);
261
            ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output);
260
            s->dsp.vector_fmul        (output,     output, k ?  swindow : pwindow, 128);
261
            s->dsp.vector_fmul_reverse(output+128, output+128, swindow, 128);
262
            ff_mdct_calc(&s->mdct128, sce->coeffs + k, output);
262 263
        }
263 264
        for (i = 0; i < 1024; i++)
264 265
            sce->saved[i] = audio[i * chans];
......
597 598
            }
598 599
            for (j = 0; j < chans; j++) {
599 600
                s->cur_channel = start_ch + j;
601
                s->scoefs = cpe->ch[j].ret;
600 602
                encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window);
601 603
            }
602 604
            start_ch += chans;
libavcodec/aacenc.h
52 52
    FFTContext mdct1024;                         ///< long (1024 samples) frame transform context
53 53
    FFTContext mdct128;                          ///< short (128 samples) frame transform context
54 54
    DSPContext  dsp;
55
    DECLARE_ALIGNED(16, FFTSample, output)[2048]; ///< temporary buffer for MDCT input coefficients
56
    int16_t* samples;                            ///< saved preprocessed input
55
    int16_t *samples;                            ///< saved preprocessed input
57 56

  
58 57
    int samplerate_index;                        ///< MPEG-4 samplerate index
59 58

  
......
64 63
    int cur_channel;
65 64
    int last_frame;
66 65
    float lambda;
66
    float *scoefs;                               ///< scaled coefficients
67 67
    DECLARE_ALIGNED(16, int,   qcoefs)[96];      ///< quantized coefficients
68
    DECLARE_ALIGNED(16, float, scoefs)[1024];    ///< scaled coefficients
69 68
} AACEncContext;
70 69

  
71 70
#endif /* AVCODEC_AACENC_H */

Also available in: Unified diff