ref: ad7b28ff19f2074ddd171ddea07222db1414a5f0
parent: d9fb8a6651ea66f18f034fc70a51cfed17d3e12f
author: Jean-Marc Valin <[email protected]>
date: Thu Jan 30 06:27:37 EST 2014
Minor div optimization -- reducing denominators
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -282,7 +282,7 @@
N0 = m->eBands[i+1]-m->eBands[i];
/* depth in 1/8 bits */
celt_assert(pulses[i]>=0);
- depth = celt_udiv(1+pulses[i], (m->eBands[i+1]-m->eBands[i])<<LM);
+ depth = celt_udiv(1+pulses[i], (m->eBands[i+1]-m->eBands[i]))>>LM;
#ifdef FIXED_POINT
thresh32 = SHR32(celt_exp2(-SHL16(depth, 10-BITRES)),1);
--- a/celt/rate.c
+++ b/celt/rate.c
@@ -466,7 +466,7 @@
/* Divide with rounding */
ebits[j] = IMAX(0, (bits[j] + offset + (den<<(BITRES-1))));
- ebits[j] = celt_udiv(ebits[j], den<<BITRES);
+ ebits[j] = celt_udiv(ebits[j], den)>>BITRES;
/* Make sure not to bust */
if (C*ebits[j] > (bits[j]>>BITRES))