Hello, some misc. cleanup patches for speexdsp, nothing big I'm not sure about how to submit patches, so this is a test balloon :) ultimately, I'd like to fix the FIXED_POINT issue, see http://lists.xiph.org/pipermail/speex-dev/2013-December/008465.html currently, I think the only way to find out how speexdsp has been compiled is to resample some bytes and observe the output; which is awkard I plan to post some patches in this direction shortly... thanks, regards, p. Peter Meerwald (3): Resampler buffer_size is always 160, drop FIXED_POINT #ifdef Use fabsf() instead of fabs() since we have floats, not double Fix file permission of libspeexdsp/scal.c libspeexdsp/resample.c | 18 +++++++----------- libspeexdsp/scal.c | 0 2 files changed, 7 insertions(+), 11 deletions(-) mode change 100755 => 100644 libspeexdsp/scal.c -- 1.9.1
Peter Meerwald
2014-Apr-15 16:33 UTC
[Speex-dev] [PATCH 1/3] Resampler buffer_size is always 160, drop FIXED_POINT #ifdef
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> --- libspeexdsp/resample.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c index 7121445..e32ca45 100644 --- a/libspeexdsp/resample.c +++ b/libspeexdsp/resample.c @@ -755,11 +755,7 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, st->in_stride = 1; st->out_stride = 1; -#ifdef FIXED_POINT - st->buffer_size = 160; -#else st->buffer_size = 160; -#endif /* Per channel data */ st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(spx_int32_t)); -- 1.9.1
Peter Meerwald
2014-Apr-15 16:33 UTC
[Speex-dev] [PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> --- 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
Peter Meerwald
2014-Apr-15 16:33 UTC
[Speex-dev] [PATCH 3/3] Fix file permission of libspeexdsp/scal.c
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> --- libspeexdsp/scal.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 libspeexdsp/scal.c diff --git a/libspeexdsp/scal.c b/libspeexdsp/scal.c old mode 100755 new mode 100644 -- 1.9.1
Tristan Matthews
2014-Apr-15 19:42 UTC
[Speex-dev] [PATCH 1/3] Resampler buffer_size is always 160, drop FIXED_POINT #ifdef
On Tue, Apr 15, 2014 at 12:33 PM, Peter Meerwald <pmeerw at pmeerw.net> wrote:> Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> > --- > libspeexdsp/resample.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c > index 7121445..e32ca45 100644 > --- a/libspeexdsp/resample.c > +++ b/libspeexdsp/resample.c > @@ -755,11 +755,7 @@ EXPORT SpeexResamplerState > *speex_resampler_init_frac(spx_uint32_t nb_channels, > st->in_stride = 1; > st->out_stride = 1; > > -#ifdef FIXED_POINT > - st->buffer_size = 160; > -#else > st->buffer_size = 160; > -#endif >LGTM. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20140415/7ccc4acf/attachment.htm
Tristan Matthews
2014-Apr-15 19:44 UTC
[Speex-dev] [PATCH 3/3] Fix file permission of libspeexdsp/scal.c
On Tue, Apr 15, 2014 at 12:33 PM, Peter Meerwald <pmeerw at pmeerw.net> wrote:> Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> > --- > libspeexdsp/scal.c | 0 > 1 file changed, 0 insertions(+), 0 deletions(-) > mode change 100755 => 100644 libspeexdsp/scal.c > > diff --git a/libspeexdsp/scal.c b/libspeexdsp/scal.c > old mode 100755 > new mode 100644 >Looks good. -t -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20140415/b807e733/attachment.htm
Tristan Matthews
2014-Apr-15 19:45 UTC
[Speex-dev] [PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
On Tue, Apr 15, 2014 at 12:33 PM, Peter Meerwald <pmeerw at pmeerw.net> wrote:> Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> > --- > 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 >Seems fine, fabsf is supported everywhere fabs is? Best, Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20140415/14518979/attachment.htm
Reasonably Related Threads
- [PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
- [PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
- Echo cancellation with different sound card for speaker and microphone
- Scaling fix for float input
- [PATCH v2 0/3] ARB_viewport_array for nvc0