Fix compiler warnings

- celt/modes.c:430:14: warning: cast from 'const unsigned char *' to
  'opus_int16 *' increases required alignment from 1 to 2 [-Wcast-align]
- 'C[0][1]' may be used uninitialized [-Wmaybe-uninitialized]
- Unused variable/parameter
- Value stored is never read
- MSVC warnings about "possible loss of data" due to type conversions
- MSVC warning C4146: unary minus operator applied to unsigned type
- silk/NLSF_del_dec_quant.c:137:20: warning: array subscript is above
  array bounds [-Warray-bounds] (gcc -O3 false positive)
- src/mlp_train.h:39:20: warning: function declaration isn't a prototype
  [-Wstrict-prototypes]
- Remove SMALL_FOOTPRINT code from SSE 4.1 FIR implementation, matching
  the C implementation.

The clang -Wcast-align warnings with SSE intrinsics are a known
clang issue: https://llvm.org/bugs/show_bug.cgi?id=20670
This commit is contained in:
Mark Harris 2017-02-20 19:51:40 -08:00
parent 8056706f48
commit d6d70371e8
No known key found for this signature in database
GPG key ID: 92293B4D0118BDB0
22 changed files with 91 additions and 90 deletions

View file

@ -1997,7 +1997,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
if (st->silk_info.offset > 100) target -= 18 << BITRES >> (3-LM);
/* Boosting bitrate on transients and vowels with significant temporal
spikes. */
target += MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES));
target += (opus_int32)MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES));
/* If we have a strong transient, let's make sure it has enough bits to code
the first two bands, so that it can use folding rather than noise. */
if (tf_estimate > QCONST16(.7f,14))

View file

@ -63,7 +63,9 @@ extern opus_int64 celt_mips;
#define ADD32_ovflw(a,b) (celt_mips+=2,(opus_val32)((opus_uint32)(a)+(opus_uint32)(b)))
/** Subtract two 32-bit values, ignore any overflows */
#define SUB32_ovflw(a,b) (celt_mips+=2,(opus_val32)((opus_uint32)(a)-(opus_uint32)(b)))
#define NEG32_ovflw(a) (celt_mips+=2,(opus_val32)(-(opus_uint32)(a)))
/* Avoid MSVC warning C4146: unary minus operator applied to unsigned type */
/** Negate 32-bit value, ignore any overflows */
#define NEG32_ovflw(a) (celt_mips+=2,(opus_val32)(0-(opus_uint32)(a)))
static OPUS_INLINE short NEG16(int x)
{

View file

@ -124,7 +124,9 @@
#define ADD32_ovflw(a,b) ((opus_val32)((opus_uint32)(a)+(opus_uint32)(b)))
/** Subtract two 32-bit values, ignore any overflows */
#define SUB32_ovflw(a,b) ((opus_val32)((opus_uint32)(a)-(opus_uint32)(b)))
#define NEG32_ovflw(a) ((opus_val32)(-(opus_uint32)(a)))
/* Avoid MSVC warning C4146: unary minus operator applied to unsigned type */
/** Negate 32-bit value, ignore any overflows */
#define NEG32_ovflw(a) ((opus_val32)(0-(opus_uint32)(a)))
/** 16x16 multiplication where the result fits in 16 bits */
#define MULT16_16_16(a,b) ((((opus_val16)(a))*((opus_val16)(b))))

View file

@ -427,7 +427,7 @@ void opus_custom_mode_destroy(CELTMode *mode)
}
#endif /* CUSTOM_MODES_ONLY */
opus_free((opus_int16*)mode->eBands);
opus_free((opus_int16*)mode->allocVectors);
opus_free((unsigned char*)mode->allocVectors);
opus_free((opus_val16*)mode->window);
opus_free((opus_int16*)mode->logN);

View file

@ -214,7 +214,7 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch)
rcp = EXTRACT16(MULT16_32_Q16(K, celt_rcp(sum)));
#else
/* Using K+e with e < 1 guarantees we cannot get more than K pulses. */
rcp = EXTRACT16(MULT16_32_Q16(K+0.8, celt_rcp(sum)));
rcp = EXTRACT16(MULT16_32_Q16(K+0.8f, celt_rcp(sum)));
#endif
j=0; do {
#ifdef FIXED_POINT

View file

@ -57,17 +57,6 @@ void celt_fir_sse4_1(const opus_val16 *x,
ALLOC(rnum, ord, opus_val16);
for(i=0;i<ord;i++)
rnum[i] = num[ord-i-1];
#ifdef SMALL_FOOTPRINT
for (i=0;i<N;i++)
{
opus_val32 sum = SHL32(EXTEND32(x[i]), SIG_SHIFT);
for (j=0;j<ord;j++)
{
sum = MAC16_16(sum,rnum[j],x[i+j-ord]);
}
y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT));
}
#else
noA = EXTEND32(1) << SIG_SHIFT >> 1;
vecNoA = _mm_set_epi32(noA, noA, noA, noA);
@ -94,7 +83,6 @@ void celt_fir_sse4_1(const opus_val16 *x,
y[i] = SATURATE16(ADD32(EXTEND32(x[i]), PSHR32(sum, SIG_SHIFT)));
}
#endif
RESTORE_STACK;
}

View file

@ -155,7 +155,6 @@ opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch)
__m128 max, max2;
__m128i count;
__m128i pos;
best_id = 0;
/* The squared magnitude term gets added anyway, so we might as well
add it outside the loop */
yy = ADD16(yy, 1);

View file

@ -131,7 +131,7 @@ opus_int32 silk_NLSF_del_dec_quant( /* O Returns
RD_Q25[ j + nStates ] = silk_SMLABB( silk_MLA( RD_tmp_Q25, silk_SMULBB( diff_Q10, diff_Q10 ), w_Q5[ i ] ), mu_Q20, rate1_Q5 );
}
if( silk_LSHIFT( nStates, 1 ) <= NLSF_QUANT_DEL_DEC_STATES ) {
if( nStates <= NLSF_QUANT_DEL_DEC_STATES/2 ) {
/* double number of states and copy */
for( j = 0; j < nStates; j++ ) {
ind[ j + nStates ][ i ] = ind[ j ][ i ] + 1;

View file

@ -233,7 +233,6 @@ opus_int silk_Encode( /* O Returns error co
}
}
TargetRate_bps = silk_RSHIFT32( encControl->bitRate, encControl->nChannelsInternal - 1 );
for( n = 0; n < encControl->nChannelsInternal; n++ ) {
/* Force the side channel to the same rate as the mid */
opus_int force_fs_kHz = (n==1) ? psEnc->state_Fxx[0].sCmn.fs_kHz : 0;

View file

@ -43,7 +43,7 @@ opus_int32 silk_schur64( /* O returns residual ene
opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ];
opus_int32 Ctmp1_Q30, Ctmp2_Q30, rc_tmp_Q31;
silk_assert( order <= SILK_MAX_ORDER_LPC );
silk_assert( order >= 0 && order <= SILK_MAX_ORDER_LPC );
/* Check for invalid input */
if( c[ 0 ] <= 0 ) {
@ -51,9 +51,10 @@ opus_int32 silk_schur64( /* O returns residual ene
return 0;
}
for( k = 0; k < order + 1; k++ ) {
k = 0;
do {
C[ k ][ 0 ] = C[ k ][ 1 ] = c[ k ];
}
} while( ++k <= order );
for( k = 0; k < order; k++ ) {
/* Check that we won't be getting an unstable rc, otherwise stop here. */

View file

@ -43,28 +43,29 @@ opus_int32 silk_schur( /* O Returns residual ene
opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ];
opus_int32 Ctmp1, Ctmp2, rc_tmp_Q15;
silk_assert( order <= SILK_MAX_ORDER_LPC );
silk_assert( order >= 0 && order <= SILK_MAX_ORDER_LPC );
/* Get number of leading zeros */
lz = silk_CLZ32( c[ 0 ] );
/* Copy correlations and adjust level to Q30 */
k = 0;
if( lz < 2 ) {
/* lz must be 1, so shift one to the right */
for( k = 0; k < order + 1; k++ ) {
do {
C[ k ][ 0 ] = C[ k ][ 1 ] = silk_RSHIFT( c[ k ], 1 );
}
} while( ++k <= order );
} else if( lz > 2 ) {
/* Shift to the left */
lz -= 2;
for( k = 0; k < order + 1; k++ ) {
do {
C[ k ][ 0 ] = C[ k ][ 1 ] = silk_LSHIFT( c[ k ], lz );
}
} while( ++k <= order );
} else {
/* No need to shift */
for( k = 0; k < order + 1; k++ ) {
do {
C[ k ][ 0 ] = C[ k ][ 1 ] = c[ k ];
}
} while( ++k <= order );
}
for( k = 0; k < order; k++ ) {

View file

@ -107,8 +107,8 @@ void silk_warped_LPC_analysis_filter_FIX_sse4_1(
xmm_tempb = _mm_add_epi32( xmm_tempb, xmm_product2 );
xmm_tempa = _mm_add_epi32( xmm_tempa, xmm_tempb );
sum = (coef_Q13_8 * state_8) >> 16;
sum += (coef_Q13_9 * state_9) >> 16;
sum = (opus_int32)((coef_Q13_8 * state_8) >> 16);
sum += (opus_int32)((coef_Q13_9 * state_9) >> 16);
xmm_tempa = _mm_add_epi32( xmm_tempa, _mm_shuffle_epi32( xmm_tempa, _MM_SHUFFLE( 0, 0, 0, 2 ) ) );
sum += _mm_cvtsi128_si32( xmm_tempa);

View file

@ -41,12 +41,13 @@ silk_float silk_schur_FLP( /* O returns residual energy
double C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ];
double Ctmp1, Ctmp2, rc_tmp;
silk_assert( order <= SILK_MAX_ORDER_LPC );
silk_assert( order >= 0 && order <= SILK_MAX_ORDER_LPC );
/* Copy correlations */
for( k = 0; k < order+1; k++ ) {
k = 0;
do {
C[ k ][ 0 ] = C[ k ][ 1 ] = auto_corr[ k ];
}
} while( ++k <= order );
for( k = 0; k < order; k++ ) {
/* Get reflection coefficient */

View file

@ -48,6 +48,8 @@
#define M_PI 3.141592653
#endif
#ifndef DISABLE_FLOAT_API
static const float dct_table[128] = {
0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f,
0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f, 0.250000f,
@ -151,7 +153,7 @@ static opus_val32 silk_resampler_down2_hp(
/* len2 can be up to 480, so we shift by 8 more to make it fit. */
hp_ener = hp_ener >> (2*SIG_SHIFT + 8);
#endif
return hp_ener;
return (opus_val32)hp_ener;
}
static opus_val32 downmix_and_resample(downmix_func downmix, const void *_x, opus_val32 *y, opus_val32 S[3], int subframe, int offset, int c1, int c2, int C, int Fs)
@ -256,7 +258,7 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
pos = 0;
if (pos == tonal->write_pos)
break;
info_out->tonality = MAX32(0, -.03 + MAX32(info_out->tonality, tonal->info[pos].tonality-.05));
info_out->tonality = MAX32(0, -.03f + MAX32(info_out->tonality, tonal->info[pos].tonality-.05f));
}
tonal->read_subframe += len/(tonal->Fs/400);
while (tonal->read_subframe>=8)
@ -284,8 +286,8 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
}
static const float std_feature_bias[9] = {
5.684947, 3.475288, 1.770634, 1.599784, 3.773215,
2.163313, 1.260756, 1.116868, 1.918795
5.684947f, 3.475288f, 1.770634f, 1.599784f, 3.773215f,
2.163313f, 1.260756f, 1.116868f, 1.918795f
};
static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt_mode, const void *x, int len, int offset, int c1, int c2, int C, int lsb_depth, downmix_func downmix)
@ -346,7 +348,8 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
kfft = celt_mode->mdct.kfft[0];
if (tonal->count==0)
tonal->mem_fill = 240;
tonal->hp_ener_accum += downmix_and_resample(downmix, x, &tonal->inmem[tonal->mem_fill], tonal->downmix_state,
tonal->hp_ener_accum += (float)downmix_and_resample(downmix, x,
&tonal->inmem[tonal->mem_fill], tonal->downmix_state,
IMIN(len, ANALYSIS_BUF_SIZE-tonal->mem_fill), offset, c1, c2, C, tonal->Fs);
if (tonal->mem_fill+len < ANALYSIS_BUF_SIZE)
{
@ -374,8 +377,9 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
}
OPUS_MOVE(tonal->inmem, tonal->inmem+ANALYSIS_BUF_SIZE-240, 240);
remaining = len - (ANALYSIS_BUF_SIZE-tonal->mem_fill);
tonal->hp_ener_accum = downmix_and_resample(downmix, x, &tonal->inmem[240], tonal->downmix_state,
remaining, offset+ANALYSIS_BUF_SIZE-tonal->mem_fill, c1, c2, C, tonal->Fs);
tonal->hp_ener_accum = (float)downmix_and_resample(downmix, x,
&tonal->inmem[240], tonal->downmix_state, remaining,
offset+ANALYSIS_BUF_SIZE-tonal->mem_fill, c1, c2, C, tonal->Fs);
tonal->mem_fill = 240 + remaining;
opus_fft(kfft, in, out, tonal->arch);
#ifndef FIXED_POINT
@ -430,7 +434,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
for (i=2;i<N2-1;i++)
{
float tt = MIN32(tonality2[i], MAX32(tonality2[i-1], tonality2[i+1]));
tonality[i] = .9*MAX32(tonality[i], tt-.1);
tonality[i] = .9f*MAX32(tonality[i], tt-.1f);
}
frame_tonality = 0;
max_frame_tonality = 0;
@ -486,9 +490,9 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
if (tonal->highE[b] > tonal->lowE[b] + 7.5)
{
if (tonal->highE[b] - logE[b] > logE[b] - tonal->lowE[b])
tonal->highE[b] -= .01;
tonal->highE[b] -= .01f;
else
tonal->lowE[b] += .01;
tonal->lowE[b] += .01f;
}
if (logE[b] > tonal->highE[b])
{
@ -534,7 +538,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
for (i=0;i<NB_FRAMES;i++)
{
int j;
float mindist = 1e15;
float mindist = 1e15f;
for (j=0;j<NB_FRAMES;j++)
{
int k;
@ -550,7 +554,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
}
spec_variability += mindist;
}
spec_variability = sqrt(spec_variability/NB_FRAMES/NB_TBANDS);
spec_variability = (float)sqrt(spec_variability/NB_FRAMES/NB_TBANDS);
bandwidth_mask = 0;
bandwidth = 0;
maxE = 0;
@ -590,7 +594,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
/* Special case for the last two bands, for which we don't have spectrum but only
the energy above 12 kHz. */
{
float E = hp_ener*(1./(240*240));
float E = hp_ener*(1.f/(240*240));
#ifdef FIXED_POINT
/* silk_resampler_down2_hp() shifted right by an extra 8 bits. */
E *= ((opus_int32)1 << 2*SIG_SHIFT)*256.f;
@ -622,7 +626,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
{
float sum=0;
for (b=0;b<16;b++)
sum += dct_table[i*16+b]*.5*(tonal->highE[b]+tonal->lowE[b]);
sum += dct_table[i*16+b]*.5f*(tonal->highE[b]+tonal->lowE[b]);
midE[i] = sum;
}
@ -675,14 +679,13 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
}
for (i=0;i<9;i++)
features[11+i] = (float)sqrt(tonal->std[i]) - std_feature_bias[i];
features[18] = spec_variability-.78;;
features[20] = info->tonality - 0.154723;
features[21] = info->activity - 0.724643;
features[22] = frame_stationarity - 0.743717;
features[23] = info->tonality_slope + 0.069216;
features[24] = tonal->lowECount - 0.067930;
features[18] = spec_variability - 0.78f;
features[20] = info->tonality - 0.154723f;
features[21] = info->activity - 0.724643f;
features[22] = frame_stationarity - 0.743717f;
features[23] = info->tonality_slope + 0.069216f;
features[24] = tonal->lowECount - 0.067930f;
#ifndef DISABLE_FLOAT_API
mlp_process(&net, features, frame_probs);
frame_probs[0] = .5f*(frame_probs[0]+1);
/* Curve fitting between the MLP probability and the actual probability */
@ -818,9 +821,6 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
}
}
tonal->last_music = tonal->music_prob>.5f;
#else
info->music_prob = 0;
#endif
#ifdef MLP_TRAINING
for (i=0;i<25;i++)
printf("%f ", features[i]);
@ -862,3 +862,5 @@ void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, co
analysis_info->valid = 0;
tonality_get_info(analysis, analysis_info, frame_size);
}
#endif /* DISABLE_FLOAT_API */

View file

@ -95,13 +95,13 @@ static const float weights[450] = {
-0.222056f, -0.508859f, -0.473369f, 0.484958f, -2.28411f,
0.0139516f,
/* output layer */
3.90017, 1.71789, -1.43372, -2.70839, 1.77107,
5.48006, 1.44661, 2.01134, -1.88383, -3.64958,
-1.26351, 0.779421, 2.11357, 3.10409, 1.68846,
-4.46197, -1.61455, 3.59832, 2.43531, -1.26458,
0.417941, 1.47437, 2.16635, -1.909, -0.828869,
1.38805, -2.67975, -0.110044, 1.95596, 0.697931,
-0.313226, -0.889315, 0.283236, 0.946102, };
3.90017f, 1.71789f, -1.43372f, -2.70839f, 1.77107f,
5.48006f, 1.44661f, 2.01134f, -1.88383f, -3.64958f,
-1.26351f, 0.779421f, 2.11357f, 3.10409f, 1.68846f,
-4.46197f, -1.61455f, 3.59832f, 2.43531f, -1.26458f,
0.417941f, 1.47437f, 2.16635f, -1.909f, -0.828869f,
1.38805f, -2.67975f, -0.110044f, 1.95596f, 0.697931f,
-0.313226f, -0.889315f, 0.283236f, 0.946102f, };
static const int topo[3] = {25, 16, 2};

View file

@ -485,7 +485,7 @@ int main(int argc, char **argv)
printf ("\n/* output layer */\n");
for (i=0;i<(topo[1]+1)*topo[2];i++)
{
printf ("%g,", net->weights[1][i]);
printf ("%gf,", net->weights[1][i]);
if (i%5==4)
printf("\n");
else
@ -494,8 +494,8 @@ int main(int argc, char **argv)
printf ("};\n\n");
printf ("static const int topo[3] = {%d, %d, %d};\n\n", topo[0], topo[1], topo[2]);
printf ("const MLP net = {\n");
printf ("\t3,\n");
printf ("\ttopo,\n");
printf ("\tweights\n};\n");
printf (" 3,\n");
printf (" topo,\n");
printf (" weights\n};\n");
return 0;
}

View file

@ -36,7 +36,7 @@ static inline double tansig_double(double x)
{
return 2./(1.+exp(-2.*x)) - 1.;
}
static inline void build_tansig_table()
static inline void build_tansig_table(void)
{
int i;
for (i=0;i<501;i++)
@ -59,7 +59,7 @@ static inline double tansig_approx(double x)
return y;
}
inline float randn(float sd)
static inline float randn(float sd)
{
float U1, U2, S, x;
do {

View file

@ -107,7 +107,7 @@ OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem)
/* Slightly boost "a" by 2^-22. This is just enough to ensure -ffast-math
does not cause output values larger than +/-1, but small enough not
to matter even for 24-bit output. */
a += a*2.4e-7;
a += a*2.4e-7f;
if (x[i*C]>0)
a = -a;
/* Apply soft clipping */

View file

@ -253,6 +253,7 @@ int main(int argc, char *argv[])
opus_uint32 dec_final_range;
int encode_only=0, decode_only=0;
int max_frame_size = 48000*2;
size_t num_read;
int curr_read=0;
int sweep_bps = 0;
int random_framesize=0, newsize=0, delayed_celt=0;
@ -657,8 +658,8 @@ int main(int argc, char *argv[])
if (decode_only)
{
unsigned char ch[4];
err = fread(ch, 1, 4, fin);
if (feof(fin))
num_read = fread(ch, 1, 4, fin);
if (num_read!=4)
break;
len[toggle] = char_to_int(ch);
if (len[toggle]>max_payload_bytes || len[toggle]<0)
@ -666,14 +667,16 @@ int main(int argc, char *argv[])
fprintf(stderr, "Invalid payload length: %d\n",len[toggle]);
break;
}
err = fread(ch, 1, 4, fin);
num_read = fread(ch, 1, 4, fin);
if (num_read!=4)
break;
enc_final_range[toggle] = char_to_int(ch);
err = fread(data[toggle], 1, len[toggle], fin);
if (err<len[toggle])
num_read = fread(data[toggle], 1, len[toggle], fin);
if (num_read!=(size_t)len[toggle])
{
fprintf(stderr, "Ran out of input, "
"expecting %d bytes got %d\n",
len[toggle],err);
len[toggle],(int)num_read);
break;
}
} else {
@ -685,8 +688,8 @@ int main(int argc, char *argv[])
opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS(mode_list[curr_mode][3]));
frame_size = mode_list[curr_mode][2];
}
err = fread(fbytes, sizeof(short)*channels, frame_size-remaining, fin);
curr_read = err;
num_read = fread(fbytes, sizeof(short)*channels, frame_size-remaining, fin);
curr_read = (int)num_read;
tot_in += curr_read;
for(i=0;i<curr_read*channels;i++)
{
@ -795,7 +798,7 @@ int main(int argc, char *argv[])
if (!decode_only && tot_out + output_samples > tot_in)
{
stop=1;
output_samples = tot_in-tot_out;
output_samples = (opus_int32)(tot_in - tot_out);
}
if (output_samples>skip) {
int i;

View file

@ -1130,7 +1130,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
/* Track the peak signal energy */
if (!is_silence && analysis_info.activity_probability > DTX_ACTIVITY_THRESHOLD)
st->peak_signal_energy = MAX32(MULT16_32_Q15(QCONST16(0.999, 15), st->peak_signal_energy),
st->peak_signal_energy = MAX32(MULT16_32_Q15(QCONST16(0.999f, 15), st->peak_signal_energy),
compute_frame_energy(pcm, frame_size, st->channels, st->arch));
}
#else

View file

@ -935,6 +935,7 @@ static int ec_enc_shrink_assert(void)
opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(6));
opus_encoder_ctl(enc, OPUS_SET_BITRATE(6000));
data_len = opus_encode(enc, pcm1, 960, data, 2000);
assert(data_len > 0);
opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));
opus_encoder_ctl(enc, OPUS_SET_PREDICTION_DISABLED(1));
@ -942,11 +943,13 @@ static int ec_enc_shrink_assert(void)
opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(1));
opus_encoder_ctl(enc, OPUS_SET_BITRATE(15600));
data_len = opus_encode(enc, pcm2, 2880, data, 122);
assert(data_len > 0);
opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC));
opus_encoder_ctl(enc, OPUS_SET_BITRATE(27000));
data_len = opus_encode(enc, pcm3, 2880, data, 122); /* assertion failure */
(void)data_len;
assert(data_len > 0);
opus_encoder_destroy(enc);
return 0;
}

View file

@ -582,7 +582,7 @@ int run_test1(int no_fuzz)
the decoders in order to compare them. */
if(opus_packet_parse(packet,len,&toc,frames,size,&payload_offset)<=0)test_failed();
if((fast_rand()&1023)==0)len=0;
for(j=(frames[0]-packet);j<len;j++)for(jj=0;jj<8;jj++)packet[j]^=((!no_fuzz)&&((fast_rand()&1023)==0))<<jj;
for(j=(opus_int32)(frames[0]-packet);j<len;j++)for(jj=0;jj<8;jj++)packet[j]^=((!no_fuzz)&&((fast_rand()&1023)==0))<<jj;
out_samples = opus_decode(dec_err[0], len>0?packet:NULL, len, out2buf, MAX_FRAME_SAMP, 0);
if(out_samples<0||out_samples>MAX_FRAME_SAMP)test_failed();
if((len>0&&out_samples!=frame_size))test_failed(); /*FIXME use lastframe*/