Fixes a ibudget bust and a divide-by-zero at very low bit-rate
This commit is contained in:
parent
b1fe4f60e6
commit
83c26fbd7b
2 changed files with 4 additions and 1 deletions
|
@ -861,6 +861,9 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
|
||||||
|
|
||||||
for (i=0;i<st->mode->nbEBands;i++)
|
for (i=0;i<st->mode->nbEBands;i++)
|
||||||
offsets[i] = 0;
|
offsets[i] = 0;
|
||||||
|
/* Dynamic allocation code */
|
||||||
|
/* Make sure that dynamic allocation can't make us bust the budget */
|
||||||
|
if (nbCompressedBytes > 30)
|
||||||
{
|
{
|
||||||
int t1, t2;
|
int t1, t2;
|
||||||
if (LM <= 1)
|
if (LM <= 1)
|
||||||
|
|
|
@ -190,7 +190,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
|
||||||
}
|
}
|
||||||
codedBands++;
|
codedBands++;
|
||||||
/* Allocate the remaining bits */
|
/* Allocate the remaining bits */
|
||||||
{
|
if (codedBands) {
|
||||||
int left, perband;
|
int left, perband;
|
||||||
left = (total<<BITRES)-psum;
|
left = (total<<BITRES)-psum;
|
||||||
perband = left/(codedBands-start);
|
perband = left/(codedBands-start);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue