diff options
author | Mark Harris <mark.hsj@gmail.com> | 2017-02-20 19:51:40 -0800 |
---|---|---|
committer | Mark Harris <mark.hsj@gmail.com> | 2017-02-26 19:10:45 -0800 |
commit | d6d70371e85ec83307f6df0e067d353daa8e6f33 (patch) | |
tree | 9e118ef0267e2e0734cc9db4c5bbd6016aa0e089 /silk | |
parent | 8056706f48880bbf0bb7ee842f1067b85f613353 (diff) | |
download | opus-d6d70371e85ec83307f6df0e067d353daa8e6f33.tar.gz |
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
Diffstat (limited to 'silk')
-rw-r--r-- | silk/NLSF_del_dec_quant.c | 2 | ||||
-rw-r--r-- | silk/enc_API.c | 1 | ||||
-rw-r--r-- | silk/fixed/schur64_FIX.c | 7 | ||||
-rw-r--r-- | silk/fixed/schur_FIX.c | 15 | ||||
-rw-r--r-- | silk/fixed/x86/prefilter_FIX_sse.c | 4 | ||||
-rw-r--r-- | silk/float/schur_FLP.c | 7 |
6 files changed, 19 insertions, 17 deletions
diff --git a/silk/NLSF_del_dec_quant.c b/silk/NLSF_del_dec_quant.c index 5155caef..44a16acd 100644 --- a/silk/NLSF_del_dec_quant.c +++ b/silk/NLSF_del_dec_quant.c @@ -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; diff --git a/silk/enc_API.c b/silk/enc_API.c index ba3db060..701c2905 100644 --- a/silk/enc_API.c +++ b/silk/enc_API.c @@ -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; diff --git a/silk/fixed/schur64_FIX.c b/silk/fixed/schur64_FIX.c index 4d3b0932..b2cb12d9 100644 --- a/silk/fixed/schur64_FIX.c +++ b/silk/fixed/schur64_FIX.c @@ -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. */ diff --git a/silk/fixed/schur_FIX.c b/silk/fixed/schur_FIX.c index 9fe7f419..59d44a6f 100644 --- a/silk/fixed/schur_FIX.c +++ b/silk/fixed/schur_FIX.c @@ -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++ ) { diff --git a/silk/fixed/x86/prefilter_FIX_sse.c b/silk/fixed/x86/prefilter_FIX_sse.c index 488a603f..d8c9c2f5 100644 --- a/silk/fixed/x86/prefilter_FIX_sse.c +++ b/silk/fixed/x86/prefilter_FIX_sse.c @@ -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); diff --git a/silk/float/schur_FLP.c b/silk/float/schur_FLP.c index f4b4072f..c1e0bbb5 100644 --- a/silk/float/schur_FLP.c +++ b/silk/float/schur_FLP.c @@ -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 */ |