[Speex-dev] Scaling fix for float input

Jean-Marc Valin jmvalin at jmvalin.ca
Fri Dec 20 19:04:47 PST 2013


On 20/12/13 08:06 AM, Arslan, Fahad wrote:
> Need to adjust scale for floating input.
> diff -NaurbB a/libspeex/resample.c b/libspeex/resample.c
> --- a/libspeex/resample.c    2013-12-20 17:40:27.326576921 +0500
> +++ b/libspeex/resample.c    2013-12-20 17:40:16.918577087 +0500
> @@ -915,7 +915,7 @@
>         if (in) {
>           for(j=0;j<ichunk;++j)
>  #ifdef FIXED_POINT
> -       x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
> +       x[j+st->filt_len-1]=WORD2INT(32768.*in[j*istride_save]);
>  #else
>             x[j+st->filt_len-1]=in[j*istride_save];
>  #endif

You realize that applying this patch would break every application
currently using this code? Not using a range of +/-1 in the float API
was a mistake, but breaking the API would be worse.

	Jean-Marc



More information about the Speex-dev mailing list