From 6548e76d00bb7d1821becd476241f5a477626d06 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Wed, 15 Oct 2014 20:06:52 +0000 Subject: [PATCH] single prec float changes, thatnls Steve git-svn-id: https://svn.code.sf.net/p/freetel/code@1895 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/kiss_fft.c | 2 +- codec2-dev/src/lsp.c | 4 ++-- codec2-dev/src/nlp.c | 10 +++++----- codec2-dev/src/quantise.c | 6 +++--- codec2-dev/src/sine.c | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codec2-dev/src/kiss_fft.c b/codec2-dev/src/kiss_fft.c index 465d6c97..3d1d4831 100644 --- a/codec2-dev/src/kiss_fft.c +++ b/codec2-dev/src/kiss_fft.c @@ -310,7 +310,7 @@ void kf_factor(int n,int * facbuf) { int p=4; double floor_sqrt; - floor_sqrt = floor( sqrt((double)n) ); + floor_sqrt = floorf( sqrtf((double)n) ); /*factor out powers of 4, powers of 2, then any remaining primes */ do { diff --git a/codec2-dev/src/lsp.c b/codec2-dev/src/lsp.c index e47a5636..192fbbdb 100644 --- a/codec2-dev/src/lsp.c +++ b/codec2-dev/src/lsp.c @@ -241,7 +241,7 @@ int lpc_to_lsp (float *a, int order, float *freq, int nb, float delta) /* convert from x domain to radians */ for(i=0; i 0) && (bin < F0_MAX)); + bin = floorf(f0); assert((bin > 0) && (bin < F0_MAX)); #endif #ifdef DUMP e_hz[bin] = e; @@ -503,7 +503,7 @@ float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP Sw[], COM for(f0=f0_start; f0<=f0_end; f0+= 2.5) { e = test_candidate_mbe(Sw, W, f0); #if !defined(NDEBUG) || defined(DUMP) - bin = floor(f0); assert((bin > 0) && (bin < F0_MAX)); + bin = floorf(f0); assert((bin > 0) && (bin < F0_MAX)); #endif #ifdef DUMP e_hz[bin] = e; @@ -547,7 +547,7 @@ float test_candidate_mbe( float Wo; /* current "test" fundamental freq. */ int L; - L = floor((SAMPLE_RATE/2.0)/f0); + L = floorf((SAMPLE_RATE/2.0)/f0); Wo = f0*(2*PI/SAMPLE_RATE); error = 0.0; @@ -558,8 +558,8 @@ float test_candidate_mbe( Am.real = 0.0; Am.imag = 0.0; den = 0.0; - al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI); - bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI); + al = ceilf((l - 0.5)*Wo*FFT_ENC/TWO_PI); + bl = ceilf((l + 0.5)*Wo*FFT_ENC/TWO_PI); /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index acf2a1a5..03b9812e 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -442,7 +442,7 @@ void compute_weights_anssi_mode2(const float *x, float *w, int ndim) else w[i]=1.0/(0.01+d[i]); - w[i]=pow(w[i]+0.3, 0.66); + w[i]=powf(w[i]+0.3, 0.66); } } #endif @@ -638,7 +638,7 @@ static void mbest_search( e = 0.0; for(i=0; iWo > TWO_PI/P_MIN) model->Wo = TWO_PI/P_MIN; - model->L = floor(PI/model->Wo); + model->L = floorf(PI/model->Wo); } /*---------------------------------------------------------------------------*\ @@ -369,7 +369,7 @@ void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[], int est_phase) /* Estimate phase of harmonic, this is expensive in CPU for embedded devicesso we make it an option */ - model->phi[m] = atan2(Sw[b].imag,Sw[b].real); + model->phi[m] = atan2f(Sw[b].imag,Sw[b].real); } } } @@ -423,8 +423,8 @@ float est_voicing_mbe( Am.real = 0.0; Am.imag = 0.0; den = 0.0; - al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI); - bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI); + al = ceilf((l - 0.5)*Wo*FFT_ENC/TWO_PI); + bl = ceilf((l + 0.5)*Wo*FFT_ENC/TWO_PI); /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ @@ -616,10 +616,10 @@ void synthesise( */ for(l=1; l<=model->L; l++) { for(i=0,j=-N+1; iA[l]*cos(j*model->Wo*l + model->phi[l]); + Sw_[FFT_DEC-N+1+i].real += 2.0*model->A[l]*cosf(j*model->Wo*l + model->phi[l]); } for(i=N-1,j=0; i<2*N; i++,j++) - Sw_[j].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]); + Sw_[j].real += 2.0*model->A[l]*cosf(j*model->Wo*l + model->phi[l]); } #endif -- 2.25.1