Take into accound the 32-bit limit in the VQ
This reduces waste at high bit-rate
This commit is contained in:
parent
79b34eb83e
commit
52dc66b887
1 changed files with 6 additions and 0 deletions
|
@ -166,6 +166,9 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
for (j=start;j<end;j++)
|
for (j=start;j<end;j++)
|
||||||
{
|
{
|
||||||
int tmp = bits1[j] + (mid*bits2[j]>>ALLOC_STEPS);
|
int tmp = bits1[j] + (mid*bits2[j]>>ALLOC_STEPS);
|
||||||
|
/* Don't allocate more than we can actually use */
|
||||||
|
if (tmp > 64*C<<BITRES<<LM)
|
||||||
|
tmp = 64*C<<BITRES<<LM;
|
||||||
if (tmp >= thresh[j])
|
if (tmp >= thresh[j])
|
||||||
psum += tmp;
|
psum += tmp;
|
||||||
else if (tmp >= 1<<BITRES)
|
else if (tmp >= 1<<BITRES)
|
||||||
|
@ -189,6 +192,9 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
bits[j] = 1<<BITRES;
|
bits[j] = 1<<BITRES;
|
||||||
else
|
else
|
||||||
bits[j] = 0;
|
bits[j] = 0;
|
||||||
|
/* Don't allocate more than we can actually use */
|
||||||
|
if (bits[j] > 64*C<<BITRES<<LM)
|
||||||
|
bits[j] = 64*C<<BITRES<<LM;
|
||||||
psum += bits[j];
|
psum += bits[j];
|
||||||
}
|
}
|
||||||
codedBands++;
|
codedBands++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue