[MPlayer-cvslog] CVS: main/libaf af_ladspa.c, NONE, 1.1 .cvsignore, 1.1, 1.2 Makefile, 1.18, 1.19 af.c, 1.34, 1.35

Reimar =?UTF8?Q?D=F6ffinger?= Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Dec 23 10:03:33 CET 2004


Hi,
>     /* 2004-12-07: Also check if the buffersize has to be changed!
>      *             data->len is not constant per se! re-init buffers.
>      */
> 
>     if ( (setup->bufsize != nsamples/nch) || (setup->nch != nch) ) {

It actually might be a good idea to only check if  nsamples/nch > setup->bufsize. Same for nch (you might even go with MAX_NCH always).
But it would require changing some loops, so better after the release...

>     for (p=0; p<setup->bufsize; p++) {
>         for (i=0; i<nch; i++) {
>             setup->inbufs[i][p] = ( (float) audio[p*nch + i] ) / 32768.0f;

I just don't think that is what you want. It will give you values in between -1 and (1 - 1/32768), thus scaling positive values a bit smaller than
negative ones. This will produce inaccuracies with almost any filter that does anything useful..
I really think you should use unsigned as input format and multiply (faster than division) by (2.0f / 65535.0f) and then subtract 1.0f.
And for converting back add 1.0f and multiply by (65535.0f / 2.0f). You can of course write the numbers out, if you don't want to rely on the compiler
optimizing it...

>     for (p=0; p<setup->bufsize; p++) {
>         for (i=0; i<nch; i++) {
>             v = setup->outbufs[i][p];
>             v *= 32768.0f;
>             v = (v > 32767.0f ? 32767.0f : v);
>             v = (v < -32768.0f ? -32768.0f : v);
>             audio[p*nch + i] = (int16_t) v;

I also forgot to say that as v is only used here it might be a good idea to declare it here and make it a register variable.

Greetings,
Reimar Döffinger




More information about the MPlayer-cvslog mailing list