diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/quant_bands.c')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/quant_bands.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/quant_bands.c b/lib/rbcodec/codecs/libopus/celt/quant_bands.c index ac6952c266..39a221eda5 100644 --- a/lib/rbcodec/codecs/libopus/celt/quant_bands.c +++ b/lib/rbcodec/codecs/libopus/celt/quant_bands.c | |||
@@ -292,7 +292,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, | |||
292 | #endif | 292 | #endif |
293 | } | 293 | } |
294 | if (lfe) | 294 | if (lfe) |
295 | max_decay=3; | 295 | max_decay = QCONST16(3.f,DB_SHIFT); |
296 | enc_start_state = *enc; | 296 | enc_start_state = *enc; |
297 | 297 | ||
298 | ALLOC(oldEBands_intra, C*m->nbEBands, opus_val16); | 298 | ALLOC(oldEBands_intra, C*m->nbEBands, opus_val16); |
@@ -418,6 +418,7 @@ void quant_energy_finalise(const CELTMode *m, int start, int end, opus_val16 *ol | |||
418 | offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384); | 418 | offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384); |
419 | #endif | 419 | #endif |
420 | oldEBands[i+c*m->nbEBands] += offset; | 420 | oldEBands[i+c*m->nbEBands] += offset; |
421 | error[i+c*m->nbEBands] -= offset; | ||
421 | bits_left--; | 422 | bits_left--; |
422 | } while (++c < C); | 423 | } while (++c < C); |
423 | } | 424 | } |
@@ -456,7 +457,7 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol | |||
456 | /* It would be better to express this invariant as a | 457 | /* It would be better to express this invariant as a |
457 | test on C at function entry, but that isn't enough | 458 | test on C at function entry, but that isn't enough |
458 | to make the static analyzer happy. */ | 459 | to make the static analyzer happy. */ |
459 | celt_assert(c<2); | 460 | celt_sig_assert(c<2); |
460 | tell = ec_tell(dec); | 461 | tell = ec_tell(dec); |
461 | if(budget-tell>=15) | 462 | if(budget-tell>=15) |
462 | { | 463 | { |
@@ -547,9 +548,15 @@ void amp2Log2(const CELTMode *m, int effEnd, int end, | |||
547 | c=0; | 548 | c=0; |
548 | do { | 549 | do { |
549 | for (i=0;i<effEnd;i++) | 550 | for (i=0;i<effEnd;i++) |
551 | { | ||
550 | bandLogE[i+c*m->nbEBands] = | 552 | bandLogE[i+c*m->nbEBands] = |
551 | celt_log2(SHL32(bandE[i+c*m->nbEBands],2)) | 553 | celt_log2(bandE[i+c*m->nbEBands]) |
552 | - SHL16((opus_val16)eMeans[i],6); | 554 | - SHL16((opus_val16)eMeans[i],6); |
555 | #ifdef FIXED_POINT | ||
556 | /* Compensate for bandE[] being Q12 but celt_log2() taking a Q14 input. */ | ||
557 | bandLogE[i+c*m->nbEBands] += QCONST16(2.f, DB_SHIFT); | ||
558 | #endif | ||
559 | } | ||
553 | for (i=effEnd;i<end;i++) | 560 | for (i=effEnd;i<end;i++) |
554 | bandLogE[c*m->nbEBands+i] = -QCONST16(14.f,DB_SHIFT); | 561 | bandLogE[c*m->nbEBands+i] = -QCONST16(14.f,DB_SHIFT); |
555 | } while (++c < C); | 562 | } while (++c < C); |