[PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
Peter Meerwald <[email protected]> Tue, 15 Apr 2014 18:33:49 +0200
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <[email protected]> |
Signed-off-by: Peter Meerwald <[email protected]> --- libspeexdsp/resample.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c index e32ca45..a19b997 100644 --- a/libspeexdsp/resample.c +++ b/libspeexdsp/resample.c @@ -85,7 +85,7 @@ static void speex_free (void *ptr) {free(ptr);} #ifdef FIXED_POINT #define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) #else -#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) +#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floorf(.5+(x)))) #endif #define IMAX(a,b) ((a) > (b) ? (a) : (b)) @@ -273,12 +273,12 @@ static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_fu { /*fprintf (stderr, "%f ", x);*/ float xx = x * cutoff; - if (fabs(x)<1e-6f) + if (fabsf(x)<1e-6f) return WORD2INT(32768.*cutoff); - else if (fabs(x) > .5f*N) + else if (fabsf(x) > .5f*N) return 0; /*FIXME: Can it really be any slower than this? */ - return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func)); + return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabsf(2.*x/N), window_func)); } #else /* The slow way of computing a sinc for the table. Should improve that some day */ @@ -286,12 +286,12 @@ static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_fu { /*fprintf (stderr, "%f ", x);*/ float xx = x * cutoff; - if (fabs(x)<1e-6) + if (fabsf(x)<1e-6f) return cutoff; - else if (fabs(x) > .5*N) + else if (fabsf(x) > .5f*N) return 0; /*FIXME: Can it really be any slower than this? */ - return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func); + return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabsf(2.*x/N), window_func); } #endif -- 1.9.1