ref: f958477a54541d65059227b1760ead814025d469
parent: 0828b6506c5b3dc8cb92a2ac42148dee419bdf8a
author: Jean-Marc Valin <[email protected]>
date: Thu Mar 27 08:22:44 EDT 2008
removed some int div
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -152,7 +152,7 @@
#endif /* !STATIC_MODES */
-static int bits2pulses(const CELTMode *m, int band, int bits)
+static inline int bits2pulses(const CELTMode *m, int band, int bits)
{
int i;
int lo, hi;
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -98,6 +98,7 @@
celt_word32_t sum;
celt_word32_t xy, yy, yp;
celt_word16_t Rpp;
+ int N_1; /* Inverse of N, in Q14 format (even for float) */
#ifdef FIXED_POINT
int yshift;
#endif
@@ -110,7 +111,8 @@
ALLOC(y, N, celt_norm_t);
ALLOC(iy, N, int);
ALLOC(signx, N, int);
-
+ N_1 = 16384/N;
+
for (j=0;j<N;j++)
{
if (X[j]>0)
@@ -146,7 +148,7 @@
int best_id;
/* Decide on how many pulses to find at once */
- pulsesAtOnce = pulsesLeft/N;
+ pulsesAtOnce = (pulsesLeft*N_1)>>14; /* pulsesLeft/N */
if (pulsesAtOnce<1)
pulsesAtOnce = 1;