From 942fc816d12be9e42025f3b0e473660b4e5e89bf Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Tue, 1 Oct 2013 19:27:30 -0400 Subject: [PATCH] Replaces log2() with celt_log2() and fixes a potential divide-by-zero --- celt/celt_encoder.c | 4 ++-- celt/mathops.h | 1 + src/opus_multistream_encoder.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 241fb372..59dcc5c6 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -1179,7 +1179,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32 tonal_target = target + (opus_int32)((coded_bins<analysis.tonality, tonal);*/ + /*printf("%f %f ", analysis->tonality, tonal);*/ target = tonal_target; } #endif @@ -1543,7 +1543,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, opus_val32 mask_avg=0; opus_val32 diff=0; int count=0; - mask_end = st->lastCodedBands; + mask_end = IMAX(2,st->lastCodedBands); for (c=0;c