[FFmpeg-devel] [PATCH] AAC decoder

Michael Niedermayer michaelni
Sat Jun 7 03:44:00 CEST 2008


On Fri, Jun 06, 2008 at 02:11:13PM +0100, Robert Swain wrote:
> 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.

I dont remember what i had in mind when i wrote that comment ...

Anyway something unrelated, the output of our imdct() is 50% redundant aka
identical (iam mentioning that because that is not optimal speedwise and
iam still searching for a volunteer to clean that up) ... the more often
i mention it the more likely someone will fix it ;)


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

many patches, many flames, too little time ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080607/d8bda915/attachment.pgp>



More information about the ffmpeg-devel mailing list