Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2013-11-10 03:28:40 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-11-10 03:28:40 +0400
commitca6fac041bc6ffe4a8b21eb6ee429dd32d803764 (patch)
tree1f2a30d22bf28b82c2168f65afe0e9c4856b30ec
parenta599ccd2172c159cb690a8b446bb4b3986d594fb (diff)
Fixes some minor issues found by scan build
-rw-r--r--celt/bands.c6
-rw-r--r--celt/celt_encoder.c1
-rw-r--r--celt/stack_alloc.h4
-rw-r--r--silk/dec_API.c2
-rw-r--r--src/analysis.c2
-rw-r--r--src/opus_decoder.c6
6 files changed, 9 insertions, 12 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 93bd0bc7..f22951b5 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 cae87b52..4e384128 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 76be6006..316a6ce1 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 bb0bc077..4cbcf715 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 2dd087b8..3ee206c9 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 fc6f7b04..e7964e3d 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 */