[FFmpeg-devel] [PATCH] AAC decoder

Robert Swain robert.swain
Fri Jun 6 15:11:13 CEST 2008


2008/4/2 Michael Niedermayer <michaelni at gmx.at>:
> On Tue, Apr 01, 2008 at 04:56:48PM +0200, Andreas ?man wrote:
>> Andreas ?man wrote:
>> +static void window_trans(AACContext * ac, sce_struct * sce) {
>> +    ics_struct * ics = &sce->ics;
>> +    float * in = sce->coeffs;
>> +    float * out = sce->ret;
>> +    float * saved = sce->saved;
>> +    const float * lwindow      = ics->window_shape      ? ac->kbd_long_1024 : ac->sine_long_1024;
>> +    const float * swindow      = ics->window_shape      ? ac->kbd_short_128 : ac->sine_short_128;
>> +    const float * lwindow_prev = ics->window_shape_prev ? ac->kbd_long_1024 : ac->sine_long_1024;
>> +    const float * swindow_prev = ics->window_shape_prev ? ac->kbd_short_128 : ac->sine_short_128;
>> +    float * buf = ac->buf_mdct;
>> +    int i;
>> +
>> +    if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) {
>> +        ff_imdct_calc(&ac->mdct, buf, in, out); // out can be abused for now as a temp buffer
>> +        if (ac->is_saved) {
>> +            if (ics->window_sequence != LONG_STOP_SEQUENCE) {
>> +                ac->dsp.vector_fmul_add_add(out, buf, lwindow_prev, saved, ac->add_bias, 1024, 1);
>> +            } else {
>
>> +                for (i = 0; i < 448; i++) out[i] = saved[i] + ac->add_bias;
>> +                for (i = 448; i < 576; i++) buf[i] *= 0.125; // normalize
>> +                ac->dsp.vector_fmul_add_add(out + 448, buf + 448, swindow_prev, saved + 448, ac->add_bias, 128, 1);
>> +                for (i = 576; i < 1024; i++)   out[i] = buf[i] + saved[i] + ac->add_bias;
>> +            }
>> +        }
>> +        if (ics->window_sequence != LONG_START_SEQUENCE) {
>> +            ac->dsp.vector_fmul_reverse(saved, buf + 1024, lwindow, 1024);
>> +        } else {
>> +            memcpy(saved, buf + 1024, 448 * sizeof(float));
>> +            for (i = 448; i < 576; i++) buf[i + 1024] *= 0.125; // normalize
>> +            ac->dsp.vector_fmul_reverse(saved + 448, buf + 1024 + 448, swindow, 128);
>> +            memset(saved + 576, 0, 448 * sizeof(float));
>
> thats alot of copying around, cant that be avoided?

I don't think the memset() can be avoided. I think that maybe with a
larger buffer and some pointer swapping that memcpy() can be but the
one a little further down in the function cannot. I'll work on a patch
for the pointer swapping idea unless you have any better suggestion.

Also, ping on the fairly large patch refactoring the channel elements
that I sent at the beginning of the week. :)

Thanks,
Rob



More information about the ffmpeg-devel mailing list