[FFmpeg-devel] Fixpoint FFT optimization, with MDCT and IMDCT wrappers for audio optimization
Marc Hoffman
mmhoffm
Sun Jul 29 04:17:53 CEST 2007
On 7/27/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> Hi
>
> On Fri, Jul 27, 2007 at 05:40:14PM -0400, mmh wrote:
> [...]
>
> > +static FFTComplex16 *stwids (FFTComplex *w, int n) {
> > + int i;
> > + FFTComplex16 *v = av_malloc (sizeof (short)*n);
> > + for (i = 0; i < n/2; i++) {
> > + v[i].re = w[i].re*32767;
> > + v[i].im = w[i].im*32767;
> > + }
>
> this should be 32768 with proper cliping
>
Sorry, to make this so much work for you. I guess if you look at this
what your asking for is reasonable but you do realize that because of
overflow 32767 doesn't overflow like 32768 would. If you multiply
1*32768 you get -1 here which is not right not sure how proper
clipping would help either unless you determine the sign prior to the
computation which is a mess in C. So I think it should be left alone
otherwise this code becomes fairly complex when its not needed.
So the proper way to do this is to multiply by almost 1 which is
0x7fff and not -1. BTW because of the way I truncate the result
0x7fff or 0x8000 produces the identical values except for the case
1*0x8000 which is -1.
Thoughts?
Thanks
Marc
More information about the ffmpeg-devel
mailing list