diff --git a/celt/bands.c b/celt/bands.c index 93bd0bc7220a86ed86f174fe02e5c2698d380df2..f22951b5c4a925e2742748e65f2122464ebf5727 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -492,7 +492,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average, *tapset_decision=0; } /*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/ - celt_assert(nbBands>0); /*M*(eBands[end]-eBands[end-1]) <= 8 assures this*/ + celt_assert(nbBands>0); /* end has to be non-zero */ sum /= nbBands; /* Recursive averaging */ sum = (sum+*average)>>1; @@ -869,7 +869,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X, int q; int curr_bits; int imid=0, iside=0; - int N_B=N; int B0=B; opus_val16 mid=0, side=0; unsigned cm=0; @@ -891,8 +890,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X, spread = ctx->spread; ec = ctx->ec; - N_B /= B; - /* If we need 1.5 more bit than we can produce, split the band in two. */ cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i]; if (LM != -1 && b > cache[cache[0]]+12 && N>2) @@ -1072,7 +1069,6 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X, longBlocks = B0==1; N_B /= B; - N_B0 = N_B; /* Special case for one sample */ if (N==1) diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index cae87b5230a51c5c6db19e058655ee7f3fa8d7f9..4e38412880813f9b0a0f16e09a1ca827525fec77 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -240,7 +240,6 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int ALLOC(tmp, len, opus_val16); len2=len/2; - tf_max = 0; for (c=0;c<C;c++) { opus_val32 mean; diff --git a/celt/stack_alloc.h b/celt/stack_alloc.h index 76be6006c499d2f37424a275f22efa9780cde252..316a6ce12c08d019343cd04f96ebe59b988e7da6 100644 --- a/celt/stack_alloc.h +++ b/celt/stack_alloc.h @@ -95,6 +95,8 @@ #define SAVE_STACK #define RESTORE_STACK #define ALLOC_STACK +/* C99 does not allow VLAs of size zero */ +#define ALLOC_NONE 1 #elif defined(USE_ALLOCA) @@ -109,6 +111,7 @@ #define SAVE_STACK #define RESTORE_STACK #define ALLOC_STACK +#define ALLOC_NONE 0 #else @@ -146,6 +149,7 @@ extern char *global_stack_top; #define VARDECL(type, var) type *var #define ALLOC(var, size, type) var = PUSH(global_stack, size, type) #define SAVE_STACK char *_saved_stack = global_stack; +#define ALLOC_NONE 0 #endif /* VAR_ARRAYS */ diff --git a/silk/dec_API.c b/silk/dec_API.c index bb0bc07784af923205abc963565e0eea050cb1c3..4cbcf71514d376215ee8f6c5bfa8e06cb4798478 100644 --- a/silk/dec_API.c +++ b/silk/dec_API.c @@ -305,7 +305,7 @@ opus_int silk_Decode( /* O Returns error co /* Set up pointers to temp buffers */ ALLOC( samplesOut2_tmp, - decControl->nChannelsAPI == 2 ? *nSamplesOut : 0, opus_int16 ); + decControl->nChannelsAPI == 2 ? *nSamplesOut : ALLOC_NONE, opus_int16 ); if( decControl->nChannelsAPI == 2 ) { resample_out_ptr = samplesOut2_tmp; } else { diff --git a/src/analysis.c b/src/analysis.c index 2dd087b84446e7cddaef1697d4585cbee84febf9..3ee206c9a42a8c1a130c35153df2f63002ccee93 100644 --- a/src/analysis.c +++ b/src/analysis.c @@ -317,7 +317,6 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con } relativeE = 0; frame_loudness = 0; - bandwidth_mask = 0; for (b=0;b<NB_TBANDS;b++) { float E=0, tE=0, nE=0; @@ -597,7 +596,6 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con if (tonal->speech_confidence_count==0) tonal->speech_confidence = .1f; } - psum = MAX16(tonal->speech_confidence, MIN16(tonal->music_confidence, psum)); } if (tonal->last_music != (tonal->music_prob>.5f)) tonal->last_transition=0; diff --git a/src/opus_decoder.c b/src/opus_decoder.c index fc6f7b04f7174ed42bc3be6aaff246f9ad3b9252..e7964e3da6b97561febafe9c253cc002ee1a6176 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -297,8 +297,8 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, } } - pcm_transition_silk_size = 0; - pcm_transition_celt_size = 0; + pcm_transition_silk_size = ALLOC_NONE; + pcm_transition_celt_size = ALLOC_NONE; if (data!=NULL && st->prev_mode > 0 && ( (mode == MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY && !st->prev_redundancy) || (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) ) @@ -327,7 +327,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, } /* Don't allocate any memory when in CELT-only mode */ - pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : 0; + pcm_silk_size = (mode != MODE_CELT_ONLY) ? IMAX(F10, frame_size)*st->channels : ALLOC_NONE; ALLOC(pcm_silk, pcm_silk_size, opus_int16); /* SILK processing */