Eliminate some divisions from rate.c.
This commit is contained in:
parent
7c673cfcdc
commit
9b98aaa741
1 changed files with 5 additions and 3 deletions
|
@ -149,6 +149,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
int i, j;
|
int i, j;
|
||||||
int logM;
|
int logM;
|
||||||
const int C = CHANNELS(_C);
|
const int C = CHANNELS(_C);
|
||||||
|
int stereo;
|
||||||
int codedBands=-1;
|
int codedBands=-1;
|
||||||
int alloc_floor;
|
int alloc_floor;
|
||||||
int left, percoeff;
|
int left, percoeff;
|
||||||
|
@ -157,6 +158,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
alloc_floor = C<<BITRES;
|
alloc_floor = C<<BITRES;
|
||||||
|
stereo = C>1;
|
||||||
|
|
||||||
logM = LM<<BITRES;
|
logM = LM<<BITRES;
|
||||||
lo = 0;
|
lo = 0;
|
||||||
|
@ -324,7 +326,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
|
|
||||||
/* Make sure not to bust */
|
/* Make sure not to bust */
|
||||||
if (C*ebits[j] > (bits[j]>>BITRES))
|
if (C*ebits[j] > (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 */
|
/* More than 7 is useless because that's about as far as PVQ can go */
|
||||||
if (ebits[j]>7)
|
if (ebits[j]>7)
|
||||||
|
@ -332,7 +334,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* For N=1, all bits go to fine energy except for a single sign bit */
|
/* 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<<BITRES >= (bits[j]-balance);
|
fine_priority[j] = (ebits[j]+1)*C<<BITRES >= (bits[j]-balance);
|
||||||
/* N=1 bands can't take advantage of the re-balancing in
|
/* N=1 bands can't take advantage of the re-balancing in
|
||||||
quant_all_bands() because they don't have shape, only fine energy.
|
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. */
|
/* The skipped bands use all their bits for fine energy. */
|
||||||
for (;j<end;j++)
|
for (;j<end;j++)
|
||||||
{
|
{
|
||||||
ebits[j] = bits[j]/C >> BITRES;
|
ebits[j] = bits[j] >> stereo >> BITRES;
|
||||||
celt_assert(C*ebits[j]<<BITRES == bits[j]);
|
celt_assert(C*ebits[j]<<BITRES == bits[j]);
|
||||||
bits[j] = 0;
|
bits[j] = 0;
|
||||||
fine_priority[j] = ebits[j]<1;
|
fine_priority[j] = ebits[j]<1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue