ref: d125c264e458455c8e713cd06d52a231fc32fe18
parent: c24b518fb0cb6c215fece7e835fffc0ec821c843
author: Jean-Marc Valin <[email protected]>
date: Fri Sep 19 13:22:44 EDT 2008
Removed a bunch of divides from the fine energy quantisation
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -170,7 +170,11 @@
if (q2 > frac-1)
q2 = frac-1;
ec_enc_bits(enc, q2, fine_quant[i]);
- offset = EXTRACT16(celt_div(SHL16(q2,8)+QCONST16(.5,8),frac)-QCONST16(.5f,8));
+#ifdef FIXED_POINT
+ offset = SUB16(SHR16(SHL16(q2,8)+QCONST16(.5,8),fine_quant[i]),QCONST16(.5f,8));
+#else
+ offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
+#endif
oldEBands[i] += PSHR32(MULT16_16(DB_SCALING*6,offset),8);
/*printf ("%f ", error[i] - offset);*/
}
@@ -227,7 +231,11 @@
if (fine_quant[i] <= 0)
continue;
q2 = ec_dec_bits(dec, fine_quant[i]);
- offset = EXTRACT16(celt_div(SHL16(q2,8)+QCONST16(.5,8),frac)-QCONST16(.5f,8));
+#ifdef FIXED_POINT
+ offset = SUB16(SHR16(SHL16(q2,8)+QCONST16(.5,8),fine_quant[i]),QCONST16(.5f,8));
+#else
+ offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
+#endif
oldEBands[i] += PSHR32(MULT16_16(DB_SCALING*6,offset),8);
}
for (i=0;i<m->nbEBands;i++)