Converting some silk_assert()s into hardening celt_assert()s

Only converted the ones that are really sure (not signal-dependent)
and that shouldn't add much run-time complexity
This commit is contained in:
Jean-Marc Valin 2018-03-24 02:16:15 -04:00
parent 69bcb28d3d
commit 7e3352ef51
No known key found for this signature in database
GPG key ID: 5E5DD9A36F9189C8
29 changed files with 96 additions and 96 deletions

View file

@ -238,8 +238,8 @@ static opus_int silk_setup_fs(
}
/* Set internal sampling frequency */
silk_assert( fs_kHz == 8 || fs_kHz == 12 || fs_kHz == 16 );
silk_assert( psEnc->sCmn.nb_subfr == 2 || psEnc->sCmn.nb_subfr == 4 );
celt_assert( fs_kHz == 8 || fs_kHz == 12 || fs_kHz == 16 );
celt_assert( psEnc->sCmn.nb_subfr == 2 || psEnc->sCmn.nb_subfr == 4 );
if( psEnc->sCmn.fs_kHz != fs_kHz ) {
/* reset part of the state */
silk_memset( &psEnc->sShape, 0, sizeof( psEnc->sShape ) );
@ -299,7 +299,7 @@ static opus_int silk_setup_fs(
}
/* Check that settings are valid */
silk_assert( ( psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr ) == psEnc->sCmn.frame_length );
celt_assert( ( psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr ) == psEnc->sCmn.frame_length );
return ret;
}
@ -312,7 +312,7 @@ static opus_int silk_setup_complexity(
opus_int ret = 0;
/* Set encoding complexity */
silk_assert( Complexity >= 0 && Complexity <= 10 );
celt_assert( Complexity >= 0 && Complexity <= 10 );
if( Complexity < 1 ) {
psEncC->pitchEstimationComplexity = SILK_PE_MIN_COMPLEX;
psEncC->pitchEstimationThreshold_Q16 = SILK_FIX_CONST( 0.8, 16 );
@ -390,12 +390,12 @@ static opus_int silk_setup_complexity(
psEncC->shapeWinLength = SUB_FRAME_LENGTH_MS * psEncC->fs_kHz + 2 * psEncC->la_shape;
psEncC->Complexity = Complexity;
silk_assert( psEncC->pitchEstimationLPCOrder <= MAX_FIND_PITCH_LPC_ORDER );
silk_assert( psEncC->shapingLPCOrder <= MAX_SHAPE_LPC_ORDER );
silk_assert( psEncC->nStatesDelayedDecision <= MAX_DEL_DEC_STATES );
silk_assert( psEncC->warping_Q16 <= 32767 );
silk_assert( psEncC->la_shape <= LA_SHAPE_MAX );
silk_assert( psEncC->shapeWinLength <= SHAPE_LPC_WIN_MAX );
celt_assert( psEncC->pitchEstimationLPCOrder <= MAX_FIND_PITCH_LPC_ORDER );
celt_assert( psEncC->shapingLPCOrder <= MAX_SHAPE_LPC_ORDER );
celt_assert( psEncC->nStatesDelayedDecision <= MAX_DEL_DEC_STATES );
celt_assert( psEncC->warping_Q16 <= 32767 );
celt_assert( psEncC->la_shape <= LA_SHAPE_MAX );
celt_assert( psEncC->shapeWinLength <= SHAPE_LPC_WIN_MAX );
return ret;
}