mirror of
https://github.com/xiph/opus.git
synced 2025-06-07 07:50:51 +00:00
Fixes some minor issues found by scan build
This commit is contained in:
parent
a599ccd217
commit
ca6fac041b
6 changed files with 9 additions and 12 deletions
|
@ -492,7 +492,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average,
|
||||||
*tapset_decision=0;
|
*tapset_decision=0;
|
||||||
}
|
}
|
||||||
/*printf("%d %d %d\n", hf_sum, *hf_average, *tapset_decision);*/
|
/*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;
|
sum /= nbBands;
|
||||||
/* Recursive averaging */
|
/* Recursive averaging */
|
||||||
sum = (sum+*average)>>1;
|
sum = (sum+*average)>>1;
|
||||||
|
@ -869,7 +869,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
|
||||||
int q;
|
int q;
|
||||||
int curr_bits;
|
int curr_bits;
|
||||||
int imid=0, iside=0;
|
int imid=0, iside=0;
|
||||||
int N_B=N;
|
|
||||||
int B0=B;
|
int B0=B;
|
||||||
opus_val16 mid=0, side=0;
|
opus_val16 mid=0, side=0;
|
||||||
unsigned cm=0;
|
unsigned cm=0;
|
||||||
|
@ -891,8 +890,6 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
|
||||||
spread = ctx->spread;
|
spread = ctx->spread;
|
||||||
ec = ctx->ec;
|
ec = ctx->ec;
|
||||||
|
|
||||||
N_B /= B;
|
|
||||||
|
|
||||||
/* If we need 1.5 more bit than we can produce, split the band in two. */
|
/* 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];
|
cache = m->cache.bits + m->cache.index[(LM+1)*m->nbEBands+i];
|
||||||
if (LM != -1 && b > cache[cache[0]]+12 && N>2)
|
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;
|
longBlocks = B0==1;
|
||||||
|
|
||||||
N_B /= B;
|
N_B /= B;
|
||||||
N_B0 = N_B;
|
|
||||||
|
|
||||||
/* Special case for one sample */
|
/* Special case for one sample */
|
||||||
if (N==1)
|
if (N==1)
|
||||||
|
|
|
@ -240,7 +240,6 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
|
||||||
ALLOC(tmp, len, opus_val16);
|
ALLOC(tmp, len, opus_val16);
|
||||||
|
|
||||||
len2=len/2;
|
len2=len/2;
|
||||||
tf_max = 0;
|
|
||||||
for (c=0;c<C;c++)
|
for (c=0;c<C;c++)
|
||||||
{
|
{
|
||||||
opus_val32 mean;
|
opus_val32 mean;
|
||||||
|
|
|
@ -95,6 +95,8 @@
|
||||||
#define SAVE_STACK
|
#define SAVE_STACK
|
||||||
#define RESTORE_STACK
|
#define RESTORE_STACK
|
||||||
#define ALLOC_STACK
|
#define ALLOC_STACK
|
||||||
|
/* C99 does not allow VLAs of size zero */
|
||||||
|
#define ALLOC_NONE 1
|
||||||
|
|
||||||
#elif defined(USE_ALLOCA)
|
#elif defined(USE_ALLOCA)
|
||||||
|
|
||||||
|
@ -109,6 +111,7 @@
|
||||||
#define SAVE_STACK
|
#define SAVE_STACK
|
||||||
#define RESTORE_STACK
|
#define RESTORE_STACK
|
||||||
#define ALLOC_STACK
|
#define ALLOC_STACK
|
||||||
|
#define ALLOC_NONE 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -146,6 +149,7 @@ extern char *global_stack_top;
|
||||||
#define VARDECL(type, var) type *var
|
#define VARDECL(type, var) type *var
|
||||||
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
|
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
|
||||||
#define SAVE_STACK char *_saved_stack = global_stack;
|
#define SAVE_STACK char *_saved_stack = global_stack;
|
||||||
|
#define ALLOC_NONE 0
|
||||||
|
|
||||||
#endif /* VAR_ARRAYS */
|
#endif /* VAR_ARRAYS */
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ opus_int silk_Decode( /* O Returns error co
|
||||||
|
|
||||||
/* Set up pointers to temp buffers */
|
/* Set up pointers to temp buffers */
|
||||||
ALLOC( samplesOut2_tmp,
|
ALLOC( samplesOut2_tmp,
|
||||||
decControl->nChannelsAPI == 2 ? *nSamplesOut : 0, opus_int16 );
|
decControl->nChannelsAPI == 2 ? *nSamplesOut : ALLOC_NONE, opus_int16 );
|
||||||
if( decControl->nChannelsAPI == 2 ) {
|
if( decControl->nChannelsAPI == 2 ) {
|
||||||
resample_out_ptr = samplesOut2_tmp;
|
resample_out_ptr = samplesOut2_tmp;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -317,7 +317,6 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con
|
||||||
}
|
}
|
||||||
relativeE = 0;
|
relativeE = 0;
|
||||||
frame_loudness = 0;
|
frame_loudness = 0;
|
||||||
bandwidth_mask = 0;
|
|
||||||
for (b=0;b<NB_TBANDS;b++)
|
for (b=0;b<NB_TBANDS;b++)
|
||||||
{
|
{
|
||||||
float E=0, tE=0, nE=0;
|
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)
|
if (tonal->speech_confidence_count==0)
|
||||||
tonal->speech_confidence = .1f;
|
tonal->speech_confidence = .1f;
|
||||||
}
|
}
|
||||||
psum = MAX16(tonal->speech_confidence, MIN16(tonal->music_confidence, psum));
|
|
||||||
}
|
}
|
||||||
if (tonal->last_music != (tonal->music_prob>.5f))
|
if (tonal->last_music != (tonal->music_prob>.5f))
|
||||||
tonal->last_transition=0;
|
tonal->last_transition=0;
|
||||||
|
|
|
@ -297,8 +297,8 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm_transition_silk_size = 0;
|
pcm_transition_silk_size = ALLOC_NONE;
|
||||||
pcm_transition_celt_size = 0;
|
pcm_transition_celt_size = ALLOC_NONE;
|
||||||
if (data!=NULL && st->prev_mode > 0 && (
|
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 && !st->prev_redundancy)
|
||||||
|| (mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY) )
|
|| (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 */
|
/* 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);
|
ALLOC(pcm_silk, pcm_silk_size, opus_int16);
|
||||||
|
|
||||||
/* SILK processing */
|
/* SILK processing */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue