diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-09-06 05:26:16 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-09-06 07:01:20 +0400 |
commit | bf848c46ea60f1b4a3c2c9d26661e66211e2dfc3 (patch) | |
tree | b968193f51a6c879d872355372fd557e1cd06e01 /libspeex | |
parent | 6efc76d8e40148232e1357efddc6b1df38c86208 (diff) |
Simplifying the "middle case" in _spx_lpc().
Diffstat (limited to 'libspeex')
-rw-r--r-- | libspeex/lpc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libspeex/lpc.c b/libspeex/lpc.c index 46cdd21..9224392 100644 --- a/libspeex/lpc.c +++ b/libspeex/lpc.c @@ -102,14 +102,15 @@ int p #endif /* Update LPC coefficients and total error */ lpc[i] = r; - for (j = 0; j < i>>1; j++) + for (j = 0; j < (i+1)>>1; j++) { - spx_word16_t tmp = lpc[j]; - lpc[j] = MAC16_16_P13(lpc[j],r,lpc[i-1-j]); - lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp); + spx_word16_t tmp1, tmp2; + /* It could be that j == i-1-j, in which case, we're updating the same value twice, which is OK */ + tmp1 = lpc[j]; + tmp2 = lpc[i-1-j]; + lpc[j] = MAC16_16_P13(tmp1,r,tmp2); + lpc[i-1-j] = MAC16_16_P13(tmp2,r,tmp1); } - if (i & 1) - lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r); error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r))); } |