diff options
Diffstat (limited to 'apps/codecs/libspeex/ltp.c')
-rw-r--r-- | apps/codecs/libspeex/ltp.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/apps/codecs/libspeex/ltp.c b/apps/codecs/libspeex/ltp.c index 2f86b678d9..04c1115b3f 100644 --- a/apps/codecs/libspeex/ltp.c +++ b/apps/codecs/libspeex/ltp.c @@ -40,6 +40,7 @@ #include "filters.h" #include <speex/speex_bits.h> #include "math_approx.h" +#include "os_support.h" #ifndef NULL #define NULL 0 @@ -498,8 +499,7 @@ int scaledown *cdbk_index=best_cdbk; } - for (i=0;i<nsf;i++) - exc[i]=0; + SPEEX_MEMSET(exc, 0, nsf); for (i=0;i<3;i++) { int j; @@ -551,7 +551,7 @@ int plc_tuning, spx_word32_t *cumul_gain ) { - int i,j; + int i; int cdbk_index, pitch=0, best_gain_index=0; VARDECL(spx_sig_t *best_exc); VARDECL(spx_word16_t *new_target); @@ -583,8 +583,7 @@ spx_word32_t *cumul_gain { speex_bits_pack(bits, 0, params->pitch_bits); speex_bits_pack(bits, 0, params->gain_bits); - for (i=0;i<nsf;i++) - exc[i]=0; + SPEEX_MEMSET(exc, 0, nsf); return start; } @@ -621,16 +620,13 @@ spx_word32_t *cumul_gain for (i=0;i<N;i++) { pitch=nbest[i]; - for (j=0;j<nsf;j++) - exc[j]=0; + SPEEX_MEMSET(exc, 0, nsf); err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, gain_cdbk, gain_cdbk_size, pitch, p, nsf, bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain, scaledown); if (err<best_err || best_err<0) { - for (j=0;j<nsf;j++) - best_exc[j]=exc[j]; - for (j=0;j<nsf;j++) - best_target[j]=new_target[j]; + SPEEX_COPY(best_exc, exc, nsf); + SPEEX_COPY(best_target, new_target, nsf); best_err=err; best_pitch=pitch; best_gain_index=cdbk_index; @@ -646,10 +642,8 @@ spx_word32_t *cumul_gain #endif /*printf ("%f\n", cumul_gain);*/ /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/ - for (i=0;i<nsf;i++) - exc[i]=best_exc[i]; - for (i=0;i<nsf;i++) - target[i]=best_target[i]; + SPEEX_COPY(exc, best_exc, nsf); + SPEEX_COPY(target, best_target, nsf); #ifdef FIXED_POINT /* Scale target back up if needed */ if (scaledown) @@ -739,8 +733,7 @@ int cdbk_offset gain[0] = SHL16(gain[0],7); gain[1] = SHL16(gain[1],7); gain[2] = SHL16(gain[2],7); - for (i=0;i<nsf;i++) - exc_out[i]=0; + SPEEX_MEMSET(exc_out, 0, nsf); for (i=0;i<3;i++) { int j; |