From 9b98aaa741635ccbb0b9ed6acff45a88f84e96e8 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sun, 19 Dec 2010 02:50:12 -0500 Subject: [PATCH] Eliminate some divisions from rate.c. --- libcelt/rate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libcelt/rate.c b/libcelt/rate.c index f2d38dd9..202fdb10 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -149,6 +149,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int int i, j; int logM; const int C = CHANNELS(_C); + int stereo; int codedBands=-1; int alloc_floor; int left, percoeff; @@ -157,6 +158,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int SAVE_STACK; alloc_floor = C<1; logM = LM< (bits[j]>>BITRES)) - ebits[j] = bits[j]/C >> BITRES; + ebits[j] = bits[j] >> stereo >> BITRES; /* More than 7 is useless because that's about as far as PVQ can go */ if (ebits[j]>7) @@ -332,7 +334,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int } else { /* For N=1, all bits go to fine energy except for a single sign bit */ - ebits[j] = IMIN(IMAX(0,(bits[j]/C >> BITRES)-1),7); + ebits[j] = IMIN(IMAX(0,(bits[j] >> stereo >> BITRES)-1),7); fine_priority[j] = (ebits[j]+1)*C<= (bits[j]-balance); /* N=1 bands can't take advantage of the re-balancing in quant_all_bands() because they don't have shape, only fine energy. @@ -353,7 +355,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int /* The skipped bands use all their bits for fine energy. */ for (;j> BITRES; + ebits[j] = bits[j] >> stereo >> BITRES; celt_assert(C*ebits[j]<