ref: 23e82b26dd345cd5696bb171f4f4e0b455bfd7a0
parent: 17ad401c2c0e01dc7a6b0ba105d71903bdaf0e3f
author: Jean-Marc Valin <[email protected]>
date: Mon Mar 24 04:15:40 EDT 2008
replaced divisions by recoprocals in intra prediction and folding
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -409,7 +409,7 @@
E = MAC16_16(E, P[j],P[j]);
}
/*pred_gain = pred_gain/sqrt(E);*/
- pred_gain = MULT16_16_Q15(pred_gain,DIV32_16(SHL32(EXTEND32(1),14+8),celt_sqrt(E)));
+ pred_gain = MULT16_16_Q15(pred_gain,celt_rcp(SHL32(celt_sqrt(E),9)));
for (j=0;j<N;j++)
P[j] = PSHR32(MULT16_16(pred_gain, P[j]),8);
if (K>0)
@@ -457,7 +457,7 @@
E = MAC16_16(E, P[j],P[j]);
}
/*pred_gain = pred_gain/sqrt(E);*/
- pred_gain = MULT16_16_Q15(pred_gain,DIV32_16(SHL32(EXTEND32(1),14+8),celt_sqrt(E)));
+ pred_gain = MULT16_16_Q15(pred_gain,celt_rcp(SHL32(celt_sqrt(E),9)));
for (j=0;j<N;j++)
P[j] = PSHR32(MULT16_16(pred_gain, P[j]),8);
if (K==0)
@@ -491,7 +491,7 @@
E = MAC16_16(E, P[j],P[j]);
}
}
- g = DIV32_16(SHL32(EXTEND32(1),14+8),celt_sqrt(E));
+ g = celt_rcp(SHL32(celt_sqrt(E),9));
for (j=0;j<N;j++)
P[j] = PSHR32(MULT16_16(g, P[j]),8);
for (j=0;j<N;j++)