minor tweaks to frac_div32()
This commit is contained in:
parent
bd82ca80f7
commit
3a9699ee94
1 changed files with 8 additions and 8 deletions
|
@ -6,13 +6,14 @@
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
static celt_word32 frac_div32(celt_word32 a, celt_word32 b)
|
static celt_word32 frac_div32(celt_word32 a, celt_word32 b)
|
||||||
{
|
{
|
||||||
celt_word32 rcp, result, rem;
|
celt_word16 rcp;
|
||||||
while (b<(1<<30))
|
celt_word32 result, rem;
|
||||||
{
|
int shift = 30-celt_ilog2(b);
|
||||||
a = SHL32(a,1);
|
a = SHL32(a,shift);
|
||||||
b = SHL32(b,1);
|
b = SHL32(b,shift);
|
||||||
}
|
|
||||||
rcp = PSHR32(celt_rcp(ROUND16(b,16)),2);
|
/* 16-bit reciprocal */
|
||||||
|
rcp = ROUND16(celt_rcp(ROUND16(b,16)),2);
|
||||||
result = SHL32(MULT16_32_Q15(rcp, a),1);
|
result = SHL32(MULT16_32_Q15(rcp, a),1);
|
||||||
rem = a-MULT32_32_Q31(result, b);
|
rem = a-MULT32_32_Q31(result, b);
|
||||||
result += SHL32(MULT16_32_Q15(rcp, rem),1);
|
result += SHL32(MULT16_32_Q15(rcp, rem),1);
|
||||||
|
@ -48,7 +49,6 @@ int p
|
||||||
for (j = 0; j < i; j++)
|
for (j = 0; j < i; j++)
|
||||||
rr += MULT32_32_Q31(lpc[j],ac[i - j]);
|
rr += MULT32_32_Q31(lpc[j],ac[i - j]);
|
||||||
rr += SHR32(ac[i + 1],3);
|
rr += SHR32(ac[i + 1],3);
|
||||||
//r = -RC_SCALING*1.*SHL32(rr,3)/(error+1e-15);
|
|
||||||
r = -frac_div32(SHL32(rr,3), error);
|
r = -frac_div32(SHL32(rr,3), error);
|
||||||
/* Update LPC coefficients and total error */
|
/* Update LPC coefficients and total error */
|
||||||
lpc[i] = SHR32(r,3);
|
lpc[i] = SHR32(r,3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue