diff --git a/libcelt/rate.c b/libcelt/rate.c index 443146b77129d0872d6334b46f6be4776cc628f3..0588afc9effd7cb84e2048758a7f80713309018c 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -150,11 +150,11 @@ static int interp_bits2pulses(const CELTMode *m, const celt_int16_t * const *cac for (j=0;j<len;j++) { ebits[j] = (((1<<BITRES)-mid)*ebits1[j] + mid*ebits2[j] + (1<<(BITRES-1)))>>BITRES; - esum += C*ebits[j]; + esum += ebits[j]; } for (j=0;j<len;j++) - bits[j] = ((1<<BITRES)-mid)*bits1[j] + mid*bits2[j] - C*(ebits[j]<<BITRES); - if (vec_bits2pulses(m, cache, bits, pulses, len) > (total-esum)<<BITRES) + bits[j] = ((1<<BITRES)-mid)*bits1[j] + mid*bits2[j]; + if (vec_bits2pulses(m, cache, bits, pulses, len) > (total-C*esum)<<BITRES) hi = mid; else lo = mid; @@ -164,19 +164,19 @@ static int interp_bits2pulses(const CELTMode *m, const celt_int16_t * const *cac for (j=0;j<len;j++) { ebits[j] = (((1<<BITRES)-lo)*ebits1[j] + lo*ebits2[j] + (1<<(BITRES-1)))>>BITRES; - esum += C*ebits[j]; + esum += ebits[j]; } for (j=0;j<len;j++) - bits[j] = ((1<<BITRES)-lo)*bits1[j] + lo*bits2[j] - C*(ebits[j]<<BITRES); + bits[j] = ((1<<BITRES)-lo)*bits1[j] + lo*bits2[j]; out = vec_bits2pulses(m, cache, bits, pulses, len); - /*printf ("left to allocate: %d\n", total-esum-(out>>BITRES));*/ + /*printf ("left to allocate: %d\n", total-C*esum-(out>>BITRES));*/ /* Do some refinement to use up all bits. In the first pass, we can only add pulses to bands that are under their allocated budget. In the second pass, anything goes */ for (j=0;j<len;j++) { if (cache[j][pulses[j]] < bits[j] && pulses[j]<MAX_PULSES-1) { - if (out+cache[j][pulses[j]+1]-cache[j][pulses[j]] <= (total-esum)<<BITRES) + if (out+cache[j][pulses[j]+1]-cache[j][pulses[j]] <= (total-C*esum)<<BITRES) { out = out+cache[j][pulses[j]+1]-cache[j][pulses[j]]; pulses[j] += 1; @@ -190,7 +190,7 @@ static int interp_bits2pulses(const CELTMode *m, const celt_int16_t * const *cac { if (pulses[j]<MAX_PULSES-1) { - if (out+cache[j][pulses[j]+1]-cache[j][pulses[j]] <= (total-esum)<<BITRES) + if (out+cache[j][pulses[j]+1]-cache[j][pulses[j]] <= (total-C*esum)<<BITRES) { out = out+cache[j][pulses[j]+1]-cache[j][pulses[j]]; pulses[j] += 1; @@ -245,7 +245,7 @@ int compute_allocation(const CELTMode *m, int *offsets, const int *stereo_mode, int mid = (lo+hi) >> 1; for (j=0;j<len;j++) { - bits1[j] = (m->allocVectors[mid*len+j] - C*m->energy_alloc[mid*(len+1)+j] + offsets[j])<<BITRES; + bits1[j] = (m->allocVectors[mid*len+j] + offsets[j])<<BITRES; if (bits1[j] < 0) bits1[j] = 0; /*printf ("%d ", bits[j]);*/ @@ -264,8 +264,8 @@ int compute_allocation(const CELTMode *m, int *offsets, const int *stereo_mode, { ebits1[j] = m->energy_alloc[lo*(len+1)+j]; ebits2[j] = m->energy_alloc[hi*(len+1)+j]; - bits1[j] = m->allocVectors[lo*len+j] + offsets[j] - 0*ebits1[j]; - bits2[j] = m->allocVectors[hi*len+j] + offsets[j] - 0*ebits2[j]; + bits1[j] = m->allocVectors[lo*len+j] + offsets[j]; + bits2[j] = m->allocVectors[hi*len+j] + offsets[j]; if (bits1[j] < 0) bits1[j] = 0; if (bits2[j] < 0)