Fix resampler compiler warnings.

half-duplex
Phil Taylor 2023-01-02 00:21:37 +00:00
rodzic 7348fc2ed0
commit a327b2690e
2 zmienionych plików z 11 dodań i 11 usunięć

Wyświetl plik

@ -294,7 +294,7 @@ static spx_word16_t sinc(float cutoff, float x, int N, const struct FuncDef* win
else if (fabs(x) > .5 * N) else if (fabs(x) > .5 * N)
return 0; return 0;
/*FIXME: Can it really be any slower than this? */ /*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 (spx_word16_t)(cutoff * (float)(sin(M_PI * xx) / (M_PI * xx) * compute_func((float)fabs(2. * x / N), window_func)));
} }
#endif #endif
@ -324,7 +324,7 @@ static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4])
/*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/ /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
interp[3] = -0.33333f * frac + 0.5f * frac * frac - 0.16667f * frac * frac * frac; interp[3] = -0.33333f * frac + 0.5f * frac * frac - 0.16667f * frac * frac * frac;
/* Just to make sure we don't have rounding problems */ /* Just to make sure we don't have rounding problems */
interp[2] = 1. - interp[0] - interp[1] - interp[3]; interp[2] = (spx_word16_t) (1. - interp[0] - interp[1] - interp[3]);
} }
#endif #endif
@ -419,7 +419,7 @@ static int resampler_basic_direct_double(SpeexResamplerState* st, spx_uint32_t c
sum = inner_product_double(sinct, iptr, N); sum = inner_product_double(sinct, iptr, N);
#endif #endif
out[out_stride * out_sample++] = PSHR32(sum, 15); out[out_stride * out_sample++] = (spx_word16_t)PSHR32(sum, 15);
last_sample += int_advance; last_sample += int_advance;
samp_frac_num += frac_advance; samp_frac_num += frac_advance;
if (samp_frac_num >= den_rate) if (samp_frac_num >= den_rate)
@ -539,7 +539,7 @@ static int resampler_basic_interpolate_double(SpeexResamplerState* st, spx_uint3
sum = MULT16_32_Q15(interp[0], accum[0]) + MULT16_32_Q15(interp[1], accum[1]) + MULT16_32_Q15(interp[2], accum[2]) + MULT16_32_Q15(interp[3], accum[3]); sum = MULT16_32_Q15(interp[0], accum[0]) + MULT16_32_Q15(interp[1], accum[1]) + MULT16_32_Q15(interp[2], accum[2]) + MULT16_32_Q15(interp[3], accum[3]);
#else #else
cubic_coef(frac, interp); cubic_coef(frac, interp);
sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); sum = (spx_word16_t)interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
#endif #endif
out[out_stride * out_sample++] = PSHR32(sum, 15); out[out_stride * out_sample++] = PSHR32(sum, 15);
@ -673,7 +673,7 @@ static int update_filter(SpeexResamplerState* st)
for (i = 0; i < st->den_rate; i++) for (i = 0; i < st->den_rate; i++)
{ {
spx_int32_t j; spx_int32_t j;
for (j = 0; j < st->filt_len; j++) for (j = 0; j < (spx_int32_t)st->filt_len; j++)
{ {
st->sinc_table[i * st->filt_len + j] = sinc(st->cutoff, ((j - (spx_int32_t)st->filt_len / 2 + 1) - ((float)i) / st->den_rate), st->filt_len, quality_map[st->quality].window_func); st->sinc_table[i * st->filt_len + j] = sinc(st->cutoff, ((j - (spx_int32_t)st->filt_len / 2 + 1) - ((float)i) / st->den_rate), st->filt_len, quality_map[st->quality].window_func);
} }
@ -934,7 +934,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState* st, spx_uint32_t cha
EXPORT int speex_resampler_process_float(SpeexResamplerState* st, spx_uint32_t channel_index, const float* in, spx_uint32_t* in_len, float* out, spx_uint32_t* out_len) EXPORT int speex_resampler_process_float(SpeexResamplerState* st, spx_uint32_t channel_index, const float* in, spx_uint32_t* in_len, float* out, spx_uint32_t* out_len)
#endif #endif
{ {
int j; spx_uint32_t j;
spx_uint32_t ilen = *in_len; spx_uint32_t ilen = *in_len;
spx_uint32_t olen = *out_len; spx_uint32_t olen = *out_len;
spx_word16_t* x = st->mem + channel_index * st->mem_alloc_size; spx_word16_t* x = st->mem + channel_index * st->mem_alloc_size;
@ -976,7 +976,7 @@ EXPORT int speex_resampler_process_float(SpeexResamplerState* st, spx_uint32_t c
EXPORT int speex_resampler_process_int(SpeexResamplerState* st, spx_uint32_t channel_index, const spx_int16_t* in, spx_uint32_t* in_len, spx_int16_t* out, spx_uint32_t* out_len) EXPORT int speex_resampler_process_int(SpeexResamplerState* st, spx_uint32_t channel_index, const spx_int16_t* in, spx_uint32_t* in_len, spx_int16_t* out, spx_uint32_t* out_len)
#endif #endif
{ {
int j; spx_uint32_t j;
const int istride_save = st->in_stride; const int istride_save = st->in_stride;
const int ostride_save = st->out_stride; const int ostride_save = st->out_stride;
spx_uint32_t ilen = *in_len; spx_uint32_t ilen = *in_len;

Wyświetl plik

@ -39,7 +39,7 @@
#define OVERRIDE_INNER_PRODUCT_SINGLE #define OVERRIDE_INNER_PRODUCT_SINGLE
static inline float inner_product_single(const float* a, const float* b, unsigned int len) static inline float inner_product_single(const float* a, const float* b, unsigned int len)
{ {
int i; unsigned int i;
float ret; float ret;
__m128 sum = _mm_setzero_ps(); __m128 sum = _mm_setzero_ps();
for (i = 0; i < len; i += 8) for (i = 0; i < len; i += 8)
@ -55,7 +55,7 @@ static inline float inner_product_single(const float* a, const float* b, unsigne
#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE #define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
static inline float interpolate_product_single(const float* a, const float* b, unsigned int len, const spx_uint32_t oversample, float* frac) { static inline float interpolate_product_single(const float* a, const float* b, unsigned int len, const spx_uint32_t oversample, float* frac) {
int i; unsigned int i;
float ret; float ret;
__m128 sum = _mm_setzero_ps(); __m128 sum = _mm_setzero_ps();
__m128 f = _mm_loadu_ps(frac); __m128 f = _mm_loadu_ps(frac);
@ -77,7 +77,7 @@ static inline float interpolate_product_single(const float* a, const float* b, u
static inline double inner_product_double(const float* a, const float* b, unsigned int len) static inline double inner_product_double(const float* a, const float* b, unsigned int len)
{ {
int i; unsigned int i;
double ret; double ret;
__m128d sum = _mm_setzero_pd(); __m128d sum = _mm_setzero_pd();
__m128 t; __m128 t;
@ -98,7 +98,7 @@ static inline double inner_product_double(const float* a, const float* b, unsign
#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE #define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
static inline double interpolate_product_double(const float* a, const float* b, unsigned int len, const spx_uint32_t oversample, float* frac) { static inline double interpolate_product_double(const float* a, const float* b, unsigned int len, const spx_uint32_t oversample, float* frac) {
int i; unsigned int i;
double ret; double ret;
__m128d sum; __m128d sum;
__m128d sum1 = _mm_setzero_pd(); __m128d sum1 = _mm_setzero_pd();