diff --git a/libcelt/opus_types.h b/libcelt/opus_types.h index a676b61078926c9aae3985220550e14ba755a949..1ec6d7e723bc4e202a655004c44bdf9f57f5542f 100644 --- a/libcelt/opus_types.h +++ b/libcelt/opus_types.h @@ -148,4 +148,13 @@ #endif +#define opus_int int /* used for counters etc; at least 16 bits */ +#define opus_int64 long long +#define opus_int8 signed char + +#define opus_uint unsigned int /* used for counters etc; at least 16 bits */ +#define opus_uint64 unsigned long long +#define opus_uint8 unsigned char + + #endif /* _OPUS_TYPES_H */ diff --git a/silk/fixed/silk_LTP_analysis_filter_FIX.c b/silk/fixed/silk_LTP_analysis_filter_FIX.c index 2e864a49b05933e9801ef28aa8969953a6626a0b..e4664deee5241f077fd915a1ca67fa0b0c9eea73 100644 --- a/silk/fixed/silk_LTP_analysis_filter_FIX.c +++ b/silk/fixed/silk_LTP_analysis_filter_FIX.c @@ -28,21 +28,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main_FIX.h" void silk_LTP_analysis_filter_FIX( - SKP_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */ - const SKP_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */ - const SKP_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */ - const SKP_int subfr_length, /* I: Length of each subframe */ - const SKP_int nb_subfr, /* I: Number of subframes */ - const SKP_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */ + opus_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */ + const opus_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */ + const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */ + const opus_int subfr_length, /* I: Length of each subframe */ + const opus_int nb_subfr, /* I: Number of subframes */ + const opus_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */ ) { - const SKP_int16 *x_ptr, *x_lag_ptr; - SKP_int16 Btmp_Q14[ LTP_ORDER ]; - SKP_int16 *LTP_res_ptr; - SKP_int k, i, j; - SKP_int32 LTP_est; + const opus_int16 *x_ptr, *x_lag_ptr; + opus_int16 Btmp_Q14[ LTP_ORDER ]; + opus_int16 *LTP_res_ptr; + opus_int k, i, j; + opus_int32 LTP_est; x_ptr = x; LTP_res_ptr = LTP_res; @@ -65,7 +65,7 @@ void silk_LTP_analysis_filter_FIX( LTP_est = SKP_RSHIFT_ROUND( LTP_est, 14 ); // round and -> Q0 /* Subtract long-term prediction */ - LTP_res_ptr[ i ] = ( SKP_int16 )SKP_SAT16( ( SKP_int32 )x_ptr[ i ] - LTP_est ); + LTP_res_ptr[ i ] = ( opus_int16 )SKP_SAT16( ( opus_int32 )x_ptr[ i ] - LTP_est ); /* Scale residual */ LTP_res_ptr[ i ] = SKP_SMULWB( invGains_Q16[ k ], LTP_res_ptr[ i ] ); diff --git a/silk/fixed/silk_LTP_scale_ctrl_FIX.c b/silk/fixed/silk_LTP_scale_ctrl_FIX.c index 946d24cc67a48999fd4e360675d2e33263dadcf2..d3535c7174270ced9918888bbed243be98f7ee89 100644 --- a/silk/fixed/silk_LTP_scale_ctrl_FIX.c +++ b/silk/fixed/silk_LTP_scale_ctrl_FIX.c @@ -32,7 +32,7 @@ void silk_LTP_scale_ctrl_FIX( silk_encoder_control_FIX *psEncCtrl /* I/O encoder control FIX */ ) { - SKP_int round_loss; + opus_int round_loss; /* 1st order high-pass filter */ psEnc->HPLTPredCodGain_Q7 = SKP_max_int( psEncCtrl->LTPredCodGain_Q7 - SKP_RSHIFT( psEnc->prevLTPredCodGain_Q7, 1 ), 0 ) @@ -42,7 +42,7 @@ void silk_LTP_scale_ctrl_FIX( /* Only scale if first frame in packet */ if( psEnc->sCmn.nFramesEncoded == 0 ) { round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket - 1; - psEnc->sCmn.indices.LTP_scaleIndex = (SKP_int8)SKP_LIMIT( + psEnc->sCmn.indices.LTP_scaleIndex = (opus_int8)SKP_LIMIT( SKP_SMULWB( SKP_SMULBB( round_loss, psEnc->HPLTPredCodGain_Q7 ), SILK_FIX_CONST( 0.1, 9 ) ), 0, 2 ); } else { /* Default is minimum scaling */ diff --git a/silk/fixed/silk_corrMatrix_FIX.c b/silk/fixed/silk_corrMatrix_FIX.c index 453cac8471deacce9dc0b3b88c4e37556d6d617d..619546f0c5250d287b8e045c818606e53a3f4def 100644 --- a/silk/fixed/silk_corrMatrix_FIX.c +++ b/silk/fixed/silk_corrMatrix_FIX.c @@ -33,17 +33,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Calculates correlation vector X'*t */ void silk_corrVector_FIX( - const SKP_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ - const SKP_int16 *t, /* I target vector [L] */ - const SKP_int L, /* I Length of vectors */ - const SKP_int order, /* I Max lag for correlation */ - SKP_int32 *Xt, /* O Pointer to X'*t correlation vector [order] */ - const SKP_int rshifts /* I Right shifts of correlations */ + const opus_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ + const opus_int16 *t, /* I target vector [L] */ + const opus_int L, /* I Length of vectors */ + const opus_int order, /* I Max lag for correlation */ + opus_int32 *Xt, /* O Pointer to X'*t correlation vector [order] */ + const opus_int rshifts /* I Right shifts of correlations */ ) { - SKP_int lag, i; - const SKP_int16 *ptr1, *ptr2; - SKP_int32 inner_prod; + opus_int lag, i; + const opus_int16 *ptr1, *ptr2; + opus_int32 inner_prod; ptr1 = &x[ order - 1 ]; /* Points to first sample of column 0 of X: X[:,0] */ ptr2 = t; @@ -69,17 +69,17 @@ void silk_corrVector_FIX( /* Calculates correlation matrix X'*X */ void silk_corrMatrix_FIX( - const SKP_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ - const SKP_int L, /* I Length of vectors */ - const SKP_int order, /* I Max lag for correlation */ - const SKP_int head_room, /* I Desired headroom */ - SKP_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/ - SKP_int *rshifts /* I/O Right shifts of correlations */ + const opus_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ + const opus_int L, /* I Length of vectors */ + const opus_int order, /* I Max lag for correlation */ + const opus_int head_room, /* I Desired headroom */ + opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/ + opus_int *rshifts /* I/O Right shifts of correlations */ ) { - SKP_int i, j, lag, rshifts_local, head_room_rshifts; - SKP_int32 energy; - const SKP_int16 *ptr1, *ptr2; + opus_int i, j, lag, rshifts_local, head_room_rshifts; + opus_int32 energy; + const opus_int16 *ptr1, *ptr2; /* Calculate energy to find shift used to fit in 32 bits */ silk_sum_sqr_shift( &energy, &rshifts_local, x, L + order - 1 ); diff --git a/silk/fixed/silk_encode_frame_FIX.c b/silk/fixed/silk_encode_frame_FIX.c index 06d1d32109578bc283182ce3bd06711426ee494c..ea05aa7f0ca3dc7341465de7fc2267233bbf2ccf 100644 --- a/silk/fixed/silk_encode_frame_FIX.c +++ b/silk/fixed/silk_encode_frame_FIX.c @@ -31,17 +31,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /****************/ /* Encode frame */ /****************/ -SKP_int silk_encode_frame_FIX( +opus_int silk_encode_frame_FIX( silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */ - SKP_int32 *pnBytesOut, /* O Number of payload bytes */ + opus_int32 *pnBytesOut, /* O Number of payload bytes */ ec_enc *psRangeEnc /* I/O compressor data structure */ ) { silk_encoder_control_FIX sEncCtrl; - SKP_int ret = 0; - SKP_int16 *x_frame, *res_pitch_frame; - SKP_int16 xfw[ MAX_FRAME_LENGTH ]; - SKP_int16 res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ]; + opus_int ret = 0; + opus_int16 *x_frame, *res_pitch_frame; + opus_int16 xfw[ MAX_FRAME_LENGTH ]; + opus_int16 res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ]; TIC(ENCODE_FRAME) @@ -92,7 +92,7 @@ TOC(VAD) /*******************************************/ /* Copy new frame to front of input buffer */ /*******************************************/ - SKP_memcpy( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf - 1, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) ); + SKP_memcpy( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf - 1, psEnc->sCmn.frame_length * sizeof( opus_int16 ) ); /*****************************************/ /* Find pitch lags, initial LPC analysis */ @@ -153,7 +153,7 @@ TOC(NSQ) /* Update input buffer */ SKP_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], - ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * sizeof( SKP_int16 ) ); + ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * sizeof( opus_int16 ) ); /* Parameters needed for next frame */ psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ]; @@ -201,9 +201,9 @@ TOC(ENCODE_FRAME) { SKP_float tmp[ MAX_NB_SUBFR * LTP_ORDER ]; int i; - DEBUG_STORE_DATA( xf.dat, x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( xfw.dat, xfw, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, psEnc->sCmn.nb_subfr * sizeof( SKP_int ) ); + DEBUG_STORE_DATA( xf.dat, x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.frame_length * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( xfw.dat, xfw, psEnc->sCmn.frame_length * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, psEnc->sCmn.nb_subfr * sizeof( opus_int ) ); for( i = 0; i < psEnc->sCmn.nb_subfr * LTP_ORDER; i++ ) { tmp[ i ] = (SKP_float)sEncCtrl.LTPCoef_Q14[ i ] / 16384.0f; } @@ -223,20 +223,20 @@ TOC(ENCODE_FRAME) tmp[ i ] = (SKP_float)sEncCtrl.Gains_Q16[ i ] / 65536.0f; } DEBUG_STORE_DATA( gains.dat, tmp, psEnc->sCmn.nb_subfr * sizeof( SKP_float ) ); - DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( SKP_int ) ); + DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( opus_int ) ); tmp[ 0 ] = (SKP_float)sEncCtrl.current_SNR_dB_Q7 / 128.0f; DEBUG_STORE_DATA( current_SNR_db.dat, tmp, sizeof( SKP_float ) ); - DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( SKP_int ) ); + DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( opus_int ) ); tmp[ 0 ] = (SKP_float)psEnc->sCmn.speech_activity_Q8 / 256.0f; DEBUG_STORE_DATA( speech_activity.dat, tmp, sizeof( SKP_float ) ); for( i = 0; i < VAD_N_BANDS; i++ ) { tmp[ i ] = (SKP_float)psEnc->sCmn.input_quality_bands_Q15[ i ] / 32768.0f; } DEBUG_STORE_DATA( input_quality_bands.dat, tmp, VAD_N_BANDS * sizeof( SKP_float ) ); - DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( SKP_int8) ); - DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( SKP_int8) ); + DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( opus_int8) ); + DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( opus_int8) ); } #endif return ret; @@ -246,10 +246,10 @@ TOC(ENCODE_FRAME) void silk_LBRR_encode_FIX( silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */ - const SKP_int16 xfw[] /* I Input signal */ + const opus_int16 xfw[] /* I Input signal */ ) { - SKP_int32 TempGains_Q16[ MAX_NB_SUBFR ]; + opus_int32 TempGains_Q16[ MAX_NB_SUBFR ]; SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFramesEncoded ]; silk_nsq_state sNSQ_LBRR; @@ -264,7 +264,7 @@ void silk_LBRR_encode_FIX( SKP_memcpy( psIndices_LBRR, &psEnc->sCmn.indices, sizeof( SideInfoIndices ) ); /* Save original gains */ - SKP_memcpy( TempGains_Q16, psEncCtrl->Gains_Q16, psEnc->sCmn.nb_subfr * sizeof( SKP_int32 ) ); + SKP_memcpy( TempGains_Q16, psEncCtrl->Gains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) ); if( psEnc->sCmn.nFramesEncoded == 0 || psEnc->sCmn.LBRR_flags[ psEnc->sCmn.nFramesEncoded - 1 ] == 0 ) { /* First frame in packet or previous frame not LBRR coded */ @@ -296,6 +296,6 @@ void silk_LBRR_encode_FIX( } /* Restore original gains */ - SKP_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( SKP_int32 ) ); + SKP_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) ); } } diff --git a/silk/fixed/silk_find_LPC_FIX.c b/silk/fixed/silk_find_LPC_FIX.c index 97bf1c94b0e34364fd7cdeec39c116ddcf3020c1..f1a0434f9cc44ee9ac290ba74f7f375247f674c6 100644 --- a/silk/fixed/silk_find_LPC_FIX.c +++ b/silk/fixed/silk_find_LPC_FIX.c @@ -30,29 +30,29 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Finds LPC vector from correlations, and converts to NLSF */ void silk_find_LPC_FIX( - SKP_int16 NLSF_Q15[], /* O NLSFs */ - SKP_int8 *interpIndex, /* O NLSF interpolation index, only used for NLSF interpolation */ - const SKP_int16 prev_NLSFq_Q15[], /* I previous NLSFs, only used for NLSF interpolation */ - const SKP_int useInterpNLSFs, /* I Flag */ - const SKP_int firstFrameAfterReset, /* I Flag */ - const SKP_int LPC_order, /* I LPC order */ - const SKP_int16 x[], /* I Input signal */ - const SKP_int subfr_length, /* I Input signal subframe length including preceeding samples */ - const SKP_int nb_subfr /* I: Number of subframes */ + opus_int16 NLSF_Q15[], /* O NLSFs */ + opus_int8 *interpIndex, /* O NLSF interpolation index, only used for NLSF interpolation */ + const opus_int16 prev_NLSFq_Q15[], /* I previous NLSFs, only used for NLSF interpolation */ + const opus_int useInterpNLSFs, /* I Flag */ + const opus_int firstFrameAfterReset, /* I Flag */ + const opus_int LPC_order, /* I LPC order */ + const opus_int16 x[], /* I Input signal */ + const opus_int subfr_length, /* I Input signal subframe length including preceeding samples */ + const opus_int nb_subfr /* I: Number of subframes */ ) { - SKP_int k; - SKP_int32 a_Q16[ MAX_LPC_ORDER ]; - SKP_int isInterpLower, shift; - SKP_int32 res_nrg0, res_nrg1; - SKP_int rshift0, rshift1; + opus_int k; + opus_int32 a_Q16[ MAX_LPC_ORDER ]; + opus_int isInterpLower, shift; + opus_int32 res_nrg0, res_nrg1; + opus_int rshift0, rshift1; /* Used only for LSF interpolation */ - SKP_int32 a_tmp_Q16[ MAX_LPC_ORDER ], res_nrg_interp, res_nrg, res_tmp_nrg, res_nrg_2nd; - SKP_int res_nrg_interp_Q, res_nrg_Q, res_tmp_nrg_Q, res_nrg_2nd_Q; - SKP_int16 a_tmp_Q12[ MAX_LPC_ORDER ]; - SKP_int16 NLSF0_Q15[ MAX_LPC_ORDER ]; - SKP_int16 LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; + opus_int32 a_tmp_Q16[ MAX_LPC_ORDER ], res_nrg_interp, res_nrg, res_tmp_nrg, res_nrg_2nd; + opus_int res_nrg_interp_Q, res_nrg_Q, res_tmp_nrg_Q, res_nrg_2nd_Q; + opus_int16 a_tmp_Q12[ MAX_LPC_ORDER ]; + opus_int16 NLSF0_Q15[ MAX_LPC_ORDER ]; + opus_int16 LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; /* Default: no interpolation */ *interpIndex = 4; @@ -141,7 +141,7 @@ void silk_find_LPC_FIX( /* Interpolation has lower residual energy */ res_nrg = res_nrg_interp; res_nrg_Q = res_nrg_interp_Q; - *interpIndex = (SKP_int8)k; + *interpIndex = (opus_int8)k; } res_nrg_2nd = res_nrg_interp; res_nrg_2nd_Q = res_nrg_interp_Q; diff --git a/silk/fixed/silk_find_LTP_FIX.c b/silk/fixed/silk_find_LTP_FIX.c index 21b28d3dcd6a0618d118cbfa4681dbacf0b670d1..e88dda4dabac584df317f147c625602f91711353 100644 --- a/silk/fixed/silk_find_LTP_FIX.c +++ b/silk/fixed/silk_find_LTP_FIX.c @@ -32,38 +32,38 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define LTP_CORRS_HEAD_ROOM 2 void silk_fit_LTP( - SKP_int32 LTP_coefs_Q16[ LTP_ORDER ], - SKP_int16 LTP_coefs_Q14[ LTP_ORDER ] + opus_int32 LTP_coefs_Q16[ LTP_ORDER ], + opus_int16 LTP_coefs_Q14[ LTP_ORDER ] ); void silk_find_LTP_FIX( - SKP_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ - SKP_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ - SKP_int *LTPredCodGain_Q7, /* O LTP coding gain */ - const SKP_int16 r_lpc[] , /* I residual signal after LPC signal + state for first 10 ms */ - const SKP_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ - const SKP_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I weights */ - const SKP_int subfr_length, /* I subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int mem_offset, /* I number of samples in LTP memory */ - SKP_int corr_rshifts[ MAX_NB_SUBFR ] /* O right shifts applied to correlations */ + opus_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ + opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ + opus_int *LTPredCodGain_Q7, /* O LTP coding gain */ + const opus_int16 r_lpc[] , /* I residual signal after LPC signal + state for first 10 ms */ + const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ + const opus_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I weights */ + const opus_int subfr_length, /* I subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int mem_offset, /* I number of samples in LTP memory */ + opus_int corr_rshifts[ MAX_NB_SUBFR ] /* O right shifts applied to correlations */ ) { - SKP_int i, k, lshift; - const SKP_int16 *r_ptr, *lag_ptr; - SKP_int16 *b_Q14_ptr; - - SKP_int32 regu; - SKP_int32 *WLTP_ptr; - SKP_int32 b_Q16[ LTP_ORDER ], delta_b_Q14[ LTP_ORDER ], d_Q14[ MAX_NB_SUBFR ], nrg[ MAX_NB_SUBFR ], g_Q26; - SKP_int32 w[ MAX_NB_SUBFR ], WLTP_max, max_abs_d_Q14, max_w_bits; - - SKP_int32 temp32, denom32; - SKP_int extra_shifts; - SKP_int rr_shifts, maxRshifts, maxRshifts_wxtra, LZs; - SKP_int32 LPC_res_nrg, LPC_LTP_res_nrg, div_Q16; - SKP_int32 Rr[ LTP_ORDER ], rr[ MAX_NB_SUBFR ]; - SKP_int32 wd, m_Q12; + opus_int i, k, lshift; + const opus_int16 *r_ptr, *lag_ptr; + opus_int16 *b_Q14_ptr; + + opus_int32 regu; + opus_int32 *WLTP_ptr; + opus_int32 b_Q16[ LTP_ORDER ], delta_b_Q14[ LTP_ORDER ], d_Q14[ MAX_NB_SUBFR ], nrg[ MAX_NB_SUBFR ], g_Q26; + opus_int32 w[ MAX_NB_SUBFR ], WLTP_max, max_abs_d_Q14, max_w_bits; + + opus_int32 temp32, denom32; + opus_int extra_shifts; + opus_int rr_shifts, maxRshifts, maxRshifts_wxtra, LZs; + opus_int32 LPC_res_nrg, LPC_LTP_res_nrg, div_Q16; + opus_int32 Rr[ LTP_ORDER ], rr[ MAX_NB_SUBFR ]; + opus_int32 wd, m_Q12; b_Q14_ptr = b_Q14; WLTP_ptr = WLTP; @@ -108,8 +108,8 @@ void silk_find_LTP_FIX( denom32 = SKP_LSHIFT_SAT32( SKP_SMULWB( nrg[ k ], Wght_Q15[ k ] ), 1 + extra_shifts ) + /* Q( -corr_rshifts[ k ] + extra_shifts ) */ SKP_RSHIFT( SKP_SMULWB( subfr_length, 655 ), corr_rshifts[ k ] - extra_shifts ); /* Q( -corr_rshifts[ k ] + extra_shifts ) */ denom32 = SKP_max( denom32, 1 ); - SKP_assert( ((SKP_int64)Wght_Q15[ k ] << 16 ) < SKP_int32_MAX ); /* Wght always < 0.5 in Q0 */ - temp32 = SKP_DIV32( SKP_LSHIFT( ( SKP_int32 )Wght_Q15[ k ], 16 ), denom32 ); /* Q( 15 + 16 + corr_rshifts[k] - extra_shifts ) */ + SKP_assert( ((opus_int64)Wght_Q15[ k ] << 16 ) < SKP_int32_MAX ); /* Wght always < 0.5 in Q0 */ + temp32 = SKP_DIV32( SKP_LSHIFT( ( opus_int32 )Wght_Q15[ k ], 16 ), denom32 ); /* Q( 15 + 16 + corr_rshifts[k] - extra_shifts ) */ temp32 = SKP_RSHIFT( temp32, 31 + corr_rshifts[ k ] - extra_shifts - 26 ); /* Q26 */ /* Limit temp such that the below scaling never wraps around */ @@ -120,7 +120,7 @@ void silk_find_LTP_FIX( lshift = silk_CLZ32( WLTP_max ) - 1 - 3; /* keep 3 bits free for vq_nearest_neighbor_fix */ SKP_assert( 26 - 18 + lshift >= 0 ); if( 26 - 18 + lshift < 31 ) { - temp32 = SKP_min_32( temp32, SKP_LSHIFT( ( SKP_int32 )1, 26 - 18 + lshift ) ); + temp32 = SKP_min_32( temp32, SKP_LSHIFT( ( opus_int32 )1, 26 - 18 + lshift ) ); } silk_scale_vector32_Q26_lshift_18( WLTP_ptr, temp32, LTP_ORDER * LTP_ORDER ); /* WLTP_ptr in Q( 18 - corr_rshifts[ k ] ) */ @@ -150,9 +150,9 @@ void silk_find_LTP_FIX( LPC_LTP_res_nrg = SKP_max( LPC_LTP_res_nrg, 1 ); /* avoid division by zero */ div_Q16 = silk_DIV32_varQ( LPC_res_nrg, LPC_LTP_res_nrg, 16 ); - *LTPredCodGain_Q7 = ( SKP_int )SKP_SMULBB( 3, silk_lin2log( div_Q16 ) - ( 16 << 7 ) ); + *LTPredCodGain_Q7 = ( opus_int )SKP_SMULBB( 3, silk_lin2log( div_Q16 ) - ( 16 << 7 ) ); - SKP_assert( *LTPredCodGain_Q7 == ( SKP_int )SKP_SAT16( SKP_MUL( 3, silk_lin2log( div_Q16 ) - ( 16 << 7 ) ) ) ); + SKP_assert( *LTPredCodGain_Q7 == ( opus_int )SKP_SAT16( SKP_MUL( 3, silk_lin2log( div_Q16 ) - ( 16 << 7 ) ) ) ); } /* smoothing */ @@ -212,7 +212,7 @@ void silk_find_LTP_FIX( SKP_DIV32( SILK_FIX_CONST( LTP_SMOOTHING, 26 ), SKP_RSHIFT( SILK_FIX_CONST( LTP_SMOOTHING, 26 ), 10 ) + temp32 ), /* Q10 */ - SKP_LSHIFT_SAT32( SKP_SUB_SAT32( ( SKP_int32 )m_Q12, SKP_RSHIFT( d_Q14[ k ], 2 ) ), 4 ) ); /* Q16 */ + SKP_LSHIFT_SAT32( SKP_SUB_SAT32( ( opus_int32 )m_Q12, SKP_RSHIFT( d_Q14[ k ], 2 ) ), 4 ) ); /* Q16 */ temp32 = 0; for( i = 0; i < LTP_ORDER; i++ ) { @@ -221,7 +221,7 @@ void silk_find_LTP_FIX( } temp32 = SKP_DIV32( g_Q26, temp32 ); /* Q14->Q12 */ for( i = 0; i < LTP_ORDER; i++ ) { - b_Q14_ptr[ i ] = SKP_LIMIT_32( ( SKP_int32 )b_Q14_ptr[ i ] + SKP_SMULWB( SKP_LSHIFT_SAT32( temp32, 4 ), delta_b_Q14[ i ] ), -16000, 28000 ); + b_Q14_ptr[ i ] = SKP_LIMIT_32( ( opus_int32 )b_Q14_ptr[ i ] + SKP_SMULWB( SKP_LSHIFT_SAT32( temp32, 4 ), delta_b_Q14[ i ] ), -16000, 28000 ); } b_Q14_ptr += LTP_ORDER; } @@ -229,13 +229,13 @@ TOC(find_LTP_FIX) } void silk_fit_LTP( - SKP_int32 LTP_coefs_Q16[ LTP_ORDER ], - SKP_int16 LTP_coefs_Q14[ LTP_ORDER ] + opus_int32 LTP_coefs_Q16[ LTP_ORDER ], + opus_int16 LTP_coefs_Q14[ LTP_ORDER ] ) { - SKP_int i; + opus_int i; for( i = 0; i < LTP_ORDER; i++ ) { - LTP_coefs_Q14[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( LTP_coefs_Q16[ i ], 2 ) ); + LTP_coefs_Q14[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( LTP_coefs_Q16[ i ], 2 ) ); } } diff --git a/silk/fixed/silk_find_pitch_lags_FIX.c b/silk/fixed/silk_find_pitch_lags_FIX.c index d6c4ee8980469c60d2460d80ea387a0a15788fcd..866f1d78c18d0f720800435a2358a73ab7170cbe 100644 --- a/silk/fixed/silk_find_pitch_lags_FIX.c +++ b/silk/fixed/silk_find_pitch_lags_FIX.c @@ -32,18 +32,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_find_pitch_lags_FIX( silk_encoder_state_FIX *psEnc, /* I/O encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control */ - SKP_int16 res[], /* O residual */ - const SKP_int16 x[] /* I Speech signal */ + opus_int16 res[], /* O residual */ + const opus_int16 x[] /* I Speech signal */ ) { - SKP_int buf_len, i, scale; - SKP_int32 thrhld_Q15, res_nrg; - const SKP_int16 *x_buf, *x_buf_ptr; - SKP_int16 Wsig[ FIND_PITCH_LPC_WIN_MAX ], *Wsig_ptr; - SKP_int32 auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; - SKP_int16 rc_Q15[ MAX_FIND_PITCH_LPC_ORDER ]; - SKP_int32 A_Q24[ MAX_FIND_PITCH_LPC_ORDER ]; - SKP_int16 A_Q12[ MAX_FIND_PITCH_LPC_ORDER ]; + opus_int buf_len, i, scale; + opus_int32 thrhld_Q15, res_nrg; + const opus_int16 *x_buf, *x_buf_ptr; + opus_int16 Wsig[ FIND_PITCH_LPC_WIN_MAX ], *Wsig_ptr; + opus_int32 auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; + opus_int16 rc_Q15[ MAX_FIND_PITCH_LPC_ORDER ]; + opus_int32 A_Q24[ MAX_FIND_PITCH_LPC_ORDER ]; + opus_int16 A_Q12[ MAX_FIND_PITCH_LPC_ORDER ]; /******************************************/ /* Setup buffer lengths etc based on Fs */ @@ -69,7 +69,7 @@ void silk_find_pitch_lags_FIX( /* Middle un - windowed samples */ Wsig_ptr += psEnc->sCmn.la_pitch; x_buf_ptr += psEnc->sCmn.la_pitch; - SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 ) ) * sizeof( SKP_int16 ) ); + SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 ) ) * sizeof( opus_int16 ) ); /* Last LA_LTP samples */ Wsig_ptr += psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 ); @@ -93,7 +93,7 @@ void silk_find_pitch_lags_FIX( /* Convert From 32 bit Q24 to 16 bit Q12 coefs */ for( i = 0; i < psEnc->sCmn.pitchEstimationLPCOrder; i++ ) { - A_Q12[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT( A_Q24[ i ], 12 ) ); + A_Q12[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT( A_Q24[ i ], 12 ) ); } /* Do BWE */ @@ -118,7 +118,7 @@ void silk_find_pitch_lags_FIX( /*****************************************/ if( silk_pitch_analysis_core( res, psEncCtrl->pitchL, &psEnc->sCmn.indices.lagIndex, &psEnc->sCmn.indices.contourIndex, &psEnc->LTPCorr_Q15, psEnc->sCmn.prevLag, psEnc->sCmn.pitchEstimationThreshold_Q16, - ( SKP_int16 )thrhld_Q15, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr ) == 0 ) + ( opus_int16 )thrhld_Q15, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr ) == 0 ) { psEnc->sCmn.indices.signalType = TYPE_VOICED; } else { diff --git a/silk/fixed/silk_find_pred_coefs_FIX.c b/silk/fixed/silk_find_pred_coefs_FIX.c index 21885b4dc63935b0b1003530cb5ccd4435932c5e..ae95372d372f25ef4a0f794a15f4786afdb4ed37 100644 --- a/silk/fixed/silk_find_pred_coefs_FIX.c +++ b/silk/fixed/silk_find_pred_coefs_FIX.c @@ -30,18 +30,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_find_pred_coefs_FIX( silk_encoder_state_FIX *psEnc, /* I/O encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control */ - const SKP_int16 res_pitch[], /* I Residual from pitch analysis */ - const SKP_int16 x[] /* I Speech signal */ + const opus_int16 res_pitch[], /* I Residual from pitch analysis */ + const opus_int16 x[] /* I Speech signal */ ) { - SKP_int i; - SKP_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]; - SKP_int32 invGains_Q16[ MAX_NB_SUBFR ], local_gains[ MAX_NB_SUBFR ], Wght_Q15[ MAX_NB_SUBFR ]; - SKP_int16 NLSF_Q15[ MAX_LPC_ORDER ]; - const SKP_int16 *x_ptr; - SKP_int16 *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ]; - SKP_int32 tmp, min_gain_Q16; - SKP_int LTP_corrs_rshift[ MAX_NB_SUBFR ]; + opus_int i; + opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]; + opus_int32 invGains_Q16[ MAX_NB_SUBFR ], local_gains[ MAX_NB_SUBFR ], Wght_Q15[ MAX_NB_SUBFR ]; + opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]; + const opus_int16 *x_ptr; + opus_int16 *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ]; + opus_int32 tmp, min_gain_Q16; + opus_int LTP_corrs_rshift[ MAX_NB_SUBFR ]; /* weighting for weighted least squares */ min_gain_Q16 = SKP_int32_MAX >> 6; @@ -102,7 +102,7 @@ void silk_find_pred_coefs_FIX( x_ptr += psEnc->sCmn.subfr_length; } - SKP_memset( psEncCtrl->LTPCoef_Q14, 0, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( SKP_int16 ) ); + SKP_memset( psEncCtrl->LTPCoef_Q14, 0, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( opus_int16 ) ); psEncCtrl->LTPredCodGain_Q7 = 0; } diff --git a/silk/fixed/silk_main_FIX.h b/silk/fixed/silk_main_FIX.h index cc3be26a73f015c79b08f85177f4917dd009cd13..fb31ae6be7525fbf03d9aff2b3ea3c9ea05d728e 100644 --- a/silk/fixed/silk_main_FIX.h +++ b/silk/fixed/silk_main_FIX.h @@ -53,13 +53,13 @@ extern "C" /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */ void silk_HP_variable_cutoff( silk_encoder_state_Fxx state_Fxx[], /* I/O Encoder states */ - const SKP_int nChannels /* I Number of channels */ + const opus_int nChannels /* I Number of channels */ ); /* Encoder main function */ -SKP_int silk_encode_frame_FIX( +opus_int silk_encode_frame_FIX( silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */ - SKP_int32 *pnBytesOut, /* O Pointer to number of payload bytes; */ + opus_int32 *pnBytesOut, /* O Pointer to number of payload bytes; */ ec_enc *psRangeEnc /* I/O compressor data structure */ ); @@ -67,21 +67,21 @@ SKP_int silk_encode_frame_FIX( void silk_LBRR_encode_FIX( silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk FIX encoder control struct */ - const SKP_int16 xfw[] /* I Input signal */ + const opus_int16 xfw[] /* I Input signal */ ); /* Initializes the Silk encoder state */ -SKP_int silk_init_encoder( +opus_int silk_init_encoder( silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk FIX encoder state */ ); /* Control the Silk encoder */ -SKP_int silk_control_encoder( +opus_int silk_control_encoder( silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk encoder state */ silk_EncControlStruct *encControl, /* I: Control structure */ - const SKP_int32 TargetRate_bps, /* I Target max bitrate (bps) */ - const SKP_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ - const SKP_int channelNb /* I Channel number */ + const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */ + const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ + const opus_int channelNb /* I Channel number */ ); /****************/ @@ -90,8 +90,8 @@ SKP_int silk_control_encoder( void silk_prefilter_FIX( silk_encoder_state_FIX *psEnc, /* I/O Encoder state */ const silk_encoder_control_FIX *psEncCtrl, /* I Encoder control */ - SKP_int16 xw[], /* O Weighted signal */ - const SKP_int16 x[] /* I Speech signal */ + opus_int16 xw[], /* O Weighted signal */ + const opus_int16 x[] /* I Speech signal */ ); /**************************/ @@ -101,18 +101,18 @@ void silk_prefilter_FIX( void silk_noise_shape_analysis_FIX( silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */ silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control FIX */ - const SKP_int16 *pitch_res, /* I LPC residual from pitch analysis */ - const SKP_int16 *x /* I Input signal [ frame_length + la_shape ] */ + const opus_int16 *pitch_res, /* I LPC residual from pitch analysis */ + const opus_int16 *x /* I Input signal [ frame_length + la_shape ] */ ); /* Autocorrelations for a warped frequency axis */ void silk_warped_autocorrelation_FIX( - SKP_int32 *corr, /* O Result [order + 1] */ - SKP_int *scale, /* O Scaling of the correlation vector */ - const SKP_int16 *input, /* I Input data to correlate */ - const SKP_int warping_Q16, /* I Warping coefficient */ - const SKP_int length, /* I Length of input */ - const SKP_int order /* I Correlation order (even) */ + opus_int32 *corr, /* O Result [order + 1] */ + opus_int *scale, /* O Scaling of the correlation vector */ + const opus_int16 *input, /* I Input data to correlate */ + const opus_int warping_Q16, /* I Warping coefficient */ + const opus_int length, /* I Length of input */ + const opus_int order /* I Correlation order (even) */ ); /* Calculation of LTP state scaling */ @@ -128,77 +128,77 @@ void silk_LTP_scale_ctrl_FIX( void silk_find_pitch_lags_FIX( silk_encoder_state_FIX *psEnc, /* I/O encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control */ - SKP_int16 res[], /* O residual */ - const SKP_int16 x[] /* I Speech signal */ + opus_int16 res[], /* O residual */ + const opus_int16 x[] /* I Speech signal */ ); /* Find LPC and LTP coefficients */ void silk_find_pred_coefs_FIX( silk_encoder_state_FIX *psEnc, /* I/O encoder state */ silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control */ - const SKP_int16 res_pitch[], /* I Residual from pitch analysis */ - const SKP_int16 x[] /* I Speech signal */ + const opus_int16 res_pitch[], /* I Residual from pitch analysis */ + const opus_int16 x[] /* I Speech signal */ ); /* LPC analysis */ void silk_find_LPC_FIX( - SKP_int16 NLSF_Q15[], /* O NLSFs */ - SKP_int8 *interpIndex, /* O NLSF interpolation index, only used for NLSF interpolation */ - const SKP_int16 prev_NLSFq_Q15[], /* I previous NLSFs, only used for NLSF interpolation */ - const SKP_int useInterpNLSFs, /* I Flag */ - const SKP_int firstFrameAfterReset, /* I Flag */ - const SKP_int LPC_order, /* I LPC order */ - const SKP_int16 x[], /* I Input signal */ - const SKP_int subfr_length, /* I Input signal subframe length including preceeding samples */ - const SKP_int nb_subfr /* I: Number of subframes */ + opus_int16 NLSF_Q15[], /* O NLSFs */ + opus_int8 *interpIndex, /* O NLSF interpolation index, only used for NLSF interpolation */ + const opus_int16 prev_NLSFq_Q15[], /* I previous NLSFs, only used for NLSF interpolation */ + const opus_int useInterpNLSFs, /* I Flag */ + const opus_int firstFrameAfterReset, /* I Flag */ + const opus_int LPC_order, /* I LPC order */ + const opus_int16 x[], /* I Input signal */ + const opus_int subfr_length, /* I Input signal subframe length including preceeding samples */ + const opus_int nb_subfr /* I: Number of subframes */ ); /* LTP analysis */ void silk_find_LTP_FIX( - SKP_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ - SKP_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ - SKP_int *LTPredCodGain_Q7, /* O LTP coding gain */ - const SKP_int16 r_lpc[], /* I residual signal after LPC signal + state for first 10 ms */ - const SKP_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ - const SKP_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I weights */ - const SKP_int subfr_length, /* I subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int mem_offset, /* I number of samples in LTP memory */ - SKP_int corr_rshifts[ MAX_NB_SUBFR ] /* O right shifts applied to correlations */ + opus_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ + opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ + opus_int *LTPredCodGain_Q7, /* O LTP coding gain */ + const opus_int16 r_lpc[], /* I residual signal after LPC signal + state for first 10 ms */ + const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ + const opus_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I weights */ + const opus_int subfr_length, /* I subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int mem_offset, /* I number of samples in LTP memory */ + opus_int corr_rshifts[ MAX_NB_SUBFR ] /* O right shifts applied to correlations */ ); void silk_LTP_analysis_filter_FIX( - SKP_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */ - const SKP_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */ - const SKP_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */ - const SKP_int subfr_length, /* I: Length of each subframe */ - const SKP_int nb_subfr, /* I: Number of subframes */ - const SKP_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */ + opus_int16 *LTP_res, /* O: LTP residual signal of length MAX_NB_SUBFR * ( pre_length + subfr_length ) */ + const opus_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each MAX_NB_SUBFR subframe */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I: Pitch lag, one for each subframe */ + const opus_int32 invGains_Q16[ MAX_NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */ + const opus_int subfr_length, /* I: Length of each subframe */ + const opus_int nb_subfr, /* I: Number of subframes */ + const opus_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */ ); /* Calculates residual energies of input subframes where all subframes have LPC_order */ /* of preceeding samples */ void silk_residual_energy_FIX( - SKP_int32 nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ - SKP_int nrgsQ[ MAX_NB_SUBFR ], /* O Q value per subframe */ - const SKP_int16 x[], /* I Input signal */ - SKP_int16 a_Q12[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ - const SKP_int32 gains[ MAX_NB_SUBFR ], /* I Quantization gains */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I Number of subframes */ - const SKP_int LPC_order /* I LPC order */ + opus_int32 nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ + opus_int nrgsQ[ MAX_NB_SUBFR ], /* O Q value per subframe */ + const opus_int16 x[], /* I Input signal */ + opus_int16 a_Q12[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ + const opus_int32 gains[ MAX_NB_SUBFR ], /* I Quantization gains */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I Number of subframes */ + const opus_int LPC_order /* I LPC order */ ); /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ -SKP_int32 silk_residual_energy16_covar_FIX( - const SKP_int16 *c, /* I Prediction vector */ - const SKP_int32 *wXX, /* I Correlation matrix */ - const SKP_int32 *wXx, /* I Correlation vector */ - SKP_int32 wxx, /* I Signal energy */ - SKP_int D, /* I Dimension */ - SKP_int cQ /* I Q value for c vector 0 - 15 */ +opus_int32 silk_residual_energy16_covar_FIX( + const opus_int16 *c, /* I Prediction vector */ + const opus_int32 *wXX, /* I Correlation matrix */ + const opus_int32 *wXx, /* I Correlation vector */ + opus_int32 wxx, /* I Signal energy */ + opus_int D, /* I Dimension */ + opus_int cQ /* I Q value for c vector 0 - 15 */ ); /* Processing of gains */ @@ -212,38 +212,38 @@ void silk_process_gains_FIX( /******************/ /* Calculates correlation matrix X'*X */ void silk_corrMatrix_FIX( - const SKP_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ - const SKP_int L, /* I Length of vectors */ - const SKP_int order, /* I Max lag for correlation */ - const SKP_int head_room, /* I Desired headroom */ - SKP_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/ - SKP_int *rshifts /* I/O Right shifts of correlations */ + const opus_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ + const opus_int L, /* I Length of vectors */ + const opus_int order, /* I Max lag for correlation */ + const opus_int head_room, /* I Desired headroom */ + opus_int32 *XX, /* O Pointer to X'*X correlation matrix [ order x order ]*/ + opus_int *rshifts /* I/O Right shifts of correlations */ ); /* Calculates correlation vector X'*t */ void silk_corrVector_FIX( - const SKP_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ - const SKP_int16 *t, /* I Target vector [L] */ - const SKP_int L, /* I Length of vectors */ - const SKP_int order, /* I Max lag for correlation */ - SKP_int32 *Xt, /* O Pointer to X'*t correlation vector [order] */ - const SKP_int rshifts /* I Right shifts of correlations */ + const opus_int16 *x, /* I x vector [L + order - 1] used to form data matrix X */ + const opus_int16 *t, /* I Target vector [L] */ + const opus_int L, /* I Length of vectors */ + const opus_int order, /* I Max lag for correlation */ + opus_int32 *Xt, /* O Pointer to X'*t correlation vector [order] */ + const opus_int rshifts /* I Right shifts of correlations */ ); /* Add noise to matrix diagonal */ void silk_regularize_correlations_FIX( - SKP_int32 *XX, /* I/O Correlation matrices */ - SKP_int32 *xx, /* I/O Correlation values */ - SKP_int32 noise, /* I Noise to add */ - SKP_int D /* I Dimension of XX */ + opus_int32 *XX, /* I/O Correlation matrices */ + opus_int32 *xx, /* I/O Correlation values */ + opus_int32 noise, /* I Noise to add */ + opus_int D /* I Dimension of XX */ ); /* Solves Ax = b, assuming A is symmetric */ void silk_solve_LDL_FIX( - SKP_int32 *A, /* I Pointer to symetric square matrix A */ - SKP_int M, /* I Size of matrix */ - const SKP_int32 *b, /* I Pointer to b vector */ - SKP_int32 *x_Q16 /* O Pointer to x solution vector */ + opus_int32 *A, /* I Pointer to symetric square matrix A */ + opus_int M, /* I Size of matrix */ + const opus_int32 *b, /* I Pointer to b vector */ + opus_int32 *x_Q16 /* O Pointer to x solution vector */ ); #ifndef FORCE_CPP_BUILD diff --git a/silk/fixed/silk_noise_shape_analysis_FIX.c b/silk/fixed/silk_noise_shape_analysis_FIX.c index 7ded610cd8933b7f7a3304b95dae4fa201ad1357..fb2bcc92eeb0df2050976d9bb5e2f35dd5d8c312 100644 --- a/silk/fixed/silk_noise_shape_analysis_FIX.c +++ b/silk/fixed/silk_noise_shape_analysis_FIX.c @@ -30,13 +30,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute gain to make warped filter coefficients have a zero mean log frequency response on a */ /* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */ -SKP_INLINE SKP_int32 warped_gain( // gain in Q16 - const SKP_int32 *coefs_Q24, - SKP_int lambda_Q16, - SKP_int order +SKP_INLINE opus_int32 warped_gain( // gain in Q16 + const opus_int32 *coefs_Q24, + opus_int lambda_Q16, + opus_int order ) { - SKP_int i; - SKP_int32 gain_Q24; + opus_int i; + opus_int32 gain_Q24; lambda_Q16 = -lambda_Q16; gain_Q24 = coefs_Q24[ order - 1 ]; @@ -50,15 +50,15 @@ SKP_INLINE SKP_int32 warped_gain( // gain in Q16 /* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */ /* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */ SKP_INLINE void limit_warped_coefs( - SKP_int32 *coefs_syn_Q24, - SKP_int32 *coefs_ana_Q24, - SKP_int lambda_Q16, - SKP_int32 limit_Q24, - SKP_int order + opus_int32 *coefs_syn_Q24, + opus_int32 *coefs_ana_Q24, + opus_int lambda_Q16, + opus_int32 limit_Q24, + opus_int order ) { - SKP_int i, iter, ind = 0; - SKP_int32 tmp, maxabs_Q24, chirp_Q16, gain_syn_Q16, gain_ana_Q16; - SKP_int32 nom_Q16, den_Q24; + opus_int i, iter, ind = 0; + opus_int32 tmp, maxabs_Q24, chirp_Q16, gain_syn_Q16, gain_ana_Q16; + opus_int32 nom_Q16, den_Q24; /* Convert to monic coefficients */ lambda_Q16 = -lambda_Q16; @@ -137,22 +137,22 @@ SKP_INLINE void limit_warped_coefs( void silk_noise_shape_analysis_FIX( silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */ silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control FIX */ - const SKP_int16 *pitch_res, /* I LPC residual from pitch analysis */ - const SKP_int16 *x /* I Input signal [ frame_length + la_shape ] */ + const opus_int16 *pitch_res, /* I LPC residual from pitch analysis */ + const opus_int16 *x /* I Input signal [ frame_length + la_shape ] */ ) { silk_shape_state_FIX *psShapeSt = &psEnc->sShape; - SKP_int k, i, nSamples, Qnrg, b_Q14, warping_Q16, scale = 0; - SKP_int32 SNR_adj_dB_Q7, HarmBoost_Q16, HarmShapeGain_Q16, Tilt_Q16, tmp32; - SKP_int32 nrg, pre_nrg_Q30, log_energy_Q7, log_energy_prev_Q7, energy_variation_Q7; - SKP_int32 delta_Q16, BWExp1_Q16, BWExp2_Q16, gain_mult_Q16, gain_add_Q16, strength_Q16, b_Q8; - SKP_int32 auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ]; - SKP_int32 refl_coef_Q16[ MAX_SHAPE_LPC_ORDER ]; - SKP_int32 AR1_Q24[ MAX_SHAPE_LPC_ORDER ]; - SKP_int32 AR2_Q24[ MAX_SHAPE_LPC_ORDER ]; - SKP_int16 x_windowed[ SHAPE_LPC_WIN_MAX ]; - SKP_int32 sqrt_nrg[ MAX_NB_SUBFR ], Qnrg_vec[ MAX_NB_SUBFR ]; - const SKP_int16 *x_ptr, *pitch_res_ptr; + opus_int k, i, nSamples, Qnrg, b_Q14, warping_Q16, scale = 0; + opus_int32 SNR_adj_dB_Q7, HarmBoost_Q16, HarmShapeGain_Q16, Tilt_Q16, tmp32; + opus_int32 nrg, pre_nrg_Q30, log_energy_Q7, log_energy_prev_Q7, energy_variation_Q7; + opus_int32 delta_Q16, BWExp1_Q16, BWExp2_Q16, gain_mult_Q16, gain_add_Q16, strength_Q16, b_Q8; + opus_int32 auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ]; + opus_int32 refl_coef_Q16[ MAX_SHAPE_LPC_ORDER ]; + opus_int32 AR1_Q24[ MAX_SHAPE_LPC_ORDER ]; + opus_int32 AR2_Q24[ MAX_SHAPE_LPC_ORDER ]; + opus_int16 x_windowed[ SHAPE_LPC_WIN_MAX ]; + opus_int32 sqrt_nrg[ MAX_NB_SUBFR ], Qnrg_vec[ MAX_NB_SUBFR ]; + const opus_int16 *x_ptr, *pitch_res_ptr; /* Point to start of first LPC analysis block */ x_ptr = x - psEnc->sCmn.la_shape; @@ -163,7 +163,7 @@ void silk_noise_shape_analysis_FIX( SNR_adj_dB_Q7 = psEnc->sCmn.SNR_dB_Q7; /* Input quality is the average of the quality in the lowest two VAD bands */ - psEncCtrl->input_quality_Q14 = ( SKP_int )SKP_RSHIFT( ( SKP_int32 )psEnc->sCmn.input_quality_bands_Q15[ 0 ] + psEncCtrl->input_quality_Q14 = ( opus_int )SKP_RSHIFT( ( opus_int32 )psEnc->sCmn.input_quality_bands_Q15[ 0 ] + psEnc->sCmn.input_quality_bands_Q15[ 1 ], 2 ); /* Coding quality level, between 0.0_Q0 and 1.0_Q0, but in Q14 */ @@ -255,13 +255,13 @@ void silk_noise_shape_analysis_FIX( /********************************************/ for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { /* Apply window: sine slope followed by flat part followed by cosine slope */ - SKP_int shift, slope_part, flat_part; + opus_int shift, slope_part, flat_part; flat_part = psEnc->sCmn.fs_kHz * 3; slope_part = SKP_RSHIFT( psEnc->sCmn.shapeWinLength - flat_part, 1 ); silk_apply_sine_window( x_windowed, x_ptr, 1, slope_part ); shift = slope_part; - SKP_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(SKP_int16) ); + SKP_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(opus_int16) ); shift += flat_part; silk_apply_sine_window( x_windowed + shift, x_ptr + shift, 2, slope_part ); @@ -319,7 +319,7 @@ void silk_noise_shape_analysis_FIX( silk_bwexpander_32( AR2_Q24, psEnc->sCmn.shapingLPCOrder, BWExp2_Q16 ); /* Compute noise shaping filter coefficients */ - SKP_memcpy( AR1_Q24, AR2_Q24, psEnc->sCmn.shapingLPCOrder * sizeof( SKP_int32 ) ); + SKP_memcpy( AR1_Q24, AR2_Q24, psEnc->sCmn.shapingLPCOrder * sizeof( opus_int32 ) ); /* Bandwidth expansion for analysis filter shaping */ SKP_assert( BWExp1_Q16 <= SILK_FIX_CONST( 1.0, 16 ) ); @@ -331,15 +331,15 @@ void silk_noise_shape_analysis_FIX( //psEncCtrl->GainsPre[ k ] = 1.0f - 0.7f * ( 1.0f - pre_nrg / nrg ) = 0.3f + 0.7f * pre_nrg / nrg; pre_nrg_Q30 = SKP_LSHIFT32( SKP_SMULWB( pre_nrg_Q30, SILK_FIX_CONST( 0.7, 15 ) ), 1 ); - psEncCtrl->GainsPre_Q14[ k ] = ( SKP_int ) SILK_FIX_CONST( 0.3, 14 ) + silk_DIV32_varQ( pre_nrg_Q30, nrg, 14 ); + psEncCtrl->GainsPre_Q14[ k ] = ( opus_int ) SILK_FIX_CONST( 0.3, 14 ) + silk_DIV32_varQ( pre_nrg_Q30, nrg, 14 ); /* Convert to monic warped prediction coefficients and limit absolute values */ limit_warped_coefs( AR2_Q24, AR1_Q24, warping_Q16, SILK_FIX_CONST( 3.999, 24 ), psEnc->sCmn.shapingLPCOrder ); /* Convert from Q24 to Q13 and store in int16 */ for( i = 0; i < psEnc->sCmn.shapingLPCOrder; i++ ) { - psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( AR1_Q24[ i ], 11 ) ); - psEncCtrl->AR2_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( AR2_Q24[ i ], 11 ) ); + psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( AR1_Q24[ i ], 11 ) ); + psEncCtrl->AR2_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( AR2_Q24[ i ], 11 ) ); } } @@ -372,14 +372,14 @@ void silk_noise_shape_analysis_FIX( if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { /* Reduce low frequencies quantization noise for periodic signals, depending on pitch lag */ /*f = 400; freqz([1, -0.98 + 2e-4 * f], [1, -0.97 + 7e-4 * f], 2^12, Fs); axis([0, 1000, -10, 1])*/ - SKP_int fs_kHz_inv = SKP_DIV32_16( SILK_FIX_CONST( 0.2, 14 ), psEnc->sCmn.fs_kHz ); + opus_int fs_kHz_inv = SKP_DIV32_16( SILK_FIX_CONST( 0.2, 14 ), psEnc->sCmn.fs_kHz ); for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { b_Q14 = fs_kHz_inv + SKP_DIV32_16( SILK_FIX_CONST( 3.0, 14 ), psEncCtrl->pitchL[ k ] ); /* Pack two coefficients in one int32 */ psEncCtrl->LF_shp_Q14[ k ] = SKP_LSHIFT( SILK_FIX_CONST( 1.0, 14 ) - b_Q14 - SKP_SMULWB( strength_Q16, b_Q14 ), 16 ); - psEncCtrl->LF_shp_Q14[ k ] |= (SKP_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) ); + psEncCtrl->LF_shp_Q14[ k ] |= (opus_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) ); } - SKP_assert( SILK_FIX_CONST( HARM_HP_NOISE_COEF, 24 ) < SILK_FIX_CONST( 0.5, 24 ) ); // Guarantees that second argument to SMULWB() is within range of an SKP_int16 + SKP_assert( SILK_FIX_CONST( HARM_HP_NOISE_COEF, 24 ) < SILK_FIX_CONST( 0.5, 24 ) ); // Guarantees that second argument to SMULWB() is within range of an opus_int16 Tilt_Q16 = - SILK_FIX_CONST( HP_NOISE_COEF, 16 ) - SKP_SMULWB( SILK_FIX_CONST( 1.0, 16 ) - SILK_FIX_CONST( HP_NOISE_COEF, 16 ), SKP_SMULWB( SILK_FIX_CONST( HARM_HP_NOISE_COEF, 24 ), psEnc->sCmn.speech_activity_Q8 ) ); @@ -388,7 +388,7 @@ void silk_noise_shape_analysis_FIX( /* Pack two coefficients in one int32 */ psEncCtrl->LF_shp_Q14[ 0 ] = SKP_LSHIFT( SILK_FIX_CONST( 1.0, 14 ) - b_Q14 - SKP_SMULWB( strength_Q16, SKP_SMULWB( SILK_FIX_CONST( 0.6, 16 ), b_Q14 ) ), 16 ); - psEncCtrl->LF_shp_Q14[ 0 ] |= (SKP_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) ); + psEncCtrl->LF_shp_Q14[ 0 ] |= (opus_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) ); for( k = 1; k < psEnc->sCmn.nb_subfr; k++ ) { psEncCtrl->LF_shp_Q14[ k ] = psEncCtrl->LF_shp_Q14[ 0 ]; } @@ -430,8 +430,8 @@ void silk_noise_shape_analysis_FIX( psShapeSt->Tilt_smth_Q16 = SKP_SMLAWB( psShapeSt->Tilt_smth_Q16, Tilt_Q16 - psShapeSt->Tilt_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) ); - psEncCtrl->HarmBoost_Q14[ k ] = ( SKP_int )SKP_RSHIFT_ROUND( psShapeSt->HarmBoost_smth_Q16, 2 ); - psEncCtrl->HarmShapeGain_Q14[ k ] = ( SKP_int )SKP_RSHIFT_ROUND( psShapeSt->HarmShapeGain_smth_Q16, 2 ); - psEncCtrl->Tilt_Q14[ k ] = ( SKP_int )SKP_RSHIFT_ROUND( psShapeSt->Tilt_smth_Q16, 2 ); + psEncCtrl->HarmBoost_Q14[ k ] = ( opus_int )SKP_RSHIFT_ROUND( psShapeSt->HarmBoost_smth_Q16, 2 ); + psEncCtrl->HarmShapeGain_Q14[ k ] = ( opus_int )SKP_RSHIFT_ROUND( psShapeSt->HarmShapeGain_smth_Q16, 2 ); + psEncCtrl->Tilt_Q14[ k ] = ( opus_int )SKP_RSHIFT_ROUND( psShapeSt->Tilt_smth_Q16, 2 ); } } diff --git a/silk/fixed/silk_prefilter_FIX.c b/silk/fixed/silk_prefilter_FIX.c index 44e603466a3003a3a28daaccbdf0297658ba40ea..368aeda0987a93e17c21f76c72b8702c2630e536 100644 --- a/silk/fixed/silk_prefilter_FIX.c +++ b/silk/fixed/silk_prefilter_FIX.c @@ -31,27 +31,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* silk_prefilter. Prefilter for finding Quantizer input signal */ SKP_INLINE void silk_prefilt_FIX( silk_prefilter_state_FIX *P, /* I/O state */ - SKP_int32 st_res_Q12[], /* I short term residual signal */ - SKP_int16 xw[], /* O prefiltered signal */ - SKP_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */ - SKP_int Tilt_Q14, /* I Tilt shaping coeficient */ - SKP_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/ - SKP_int lag, /* I Lag for harmonic shaping */ - SKP_int length /* I Length of signals */ + opus_int32 st_res_Q12[], /* I short term residual signal */ + opus_int16 xw[], /* O prefiltered signal */ + opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */ + opus_int Tilt_Q14, /* I Tilt shaping coeficient */ + opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/ + opus_int lag, /* I Lag for harmonic shaping */ + opus_int length /* I Length of signals */ ); void silk_warped_LPC_analysis_filter_FIX( - SKP_int32 state[], /* I/O State [order + 1] */ - SKP_int16 res[], /* O Residual signal [length] */ - const SKP_int16 coef_Q13[], /* I Coefficients [order] */ - const SKP_int16 input[], /* I Input signal [length] */ - const SKP_int16 lambda_Q16, /* I Warping factor */ - const SKP_int length, /* I Length of input signal */ - const SKP_int order /* I Filter order (even) */ + opus_int32 state[], /* I/O State [order + 1] */ + opus_int16 res[], /* O Residual signal [length] */ + const opus_int16 coef_Q13[], /* I Coefficients [order] */ + const opus_int16 input[], /* I Input signal [length] */ + const opus_int16 lambda_Q16, /* I Warping factor */ + const opus_int length, /* I Length of input signal */ + const opus_int order /* I Filter order (even) */ ) { - SKP_int n, i; - SKP_int32 acc_Q11, tmp1, tmp2; + opus_int n, i; + opus_int32 acc_Q11, tmp1, tmp2; /* Order must be even */ SKP_assert( ( order & 1 ) == 0 ); @@ -77,28 +77,28 @@ void silk_warped_LPC_analysis_filter_FIX( } state[ order ] = tmp1; acc_Q11 = SKP_SMLAWB( acc_Q11, tmp1, coef_Q13[ order - 1 ] ); - res[ n ] = ( SKP_int16 )SKP_SAT16( ( SKP_int32 )input[ n ] - SKP_RSHIFT_ROUND( acc_Q11, 11 ) ); + res[ n ] = ( opus_int16 )SKP_SAT16( ( opus_int32 )input[ n ] - SKP_RSHIFT_ROUND( acc_Q11, 11 ) ); } } void silk_prefilter_FIX( silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */ const silk_encoder_control_FIX *psEncCtrl, /* I Encoder control FIX */ - SKP_int16 xw[], /* O Weighted signal */ - const SKP_int16 x[] /* I Speech signal */ + opus_int16 xw[], /* O Weighted signal */ + const opus_int16 x[] /* I Speech signal */ ) { silk_prefilter_state_FIX *P = &psEnc->sPrefilt; - SKP_int j, k, lag; - SKP_int32 tmp_32; - const SKP_int16 *AR1_shp_Q13; - const SKP_int16 *px; - SKP_int16 *pxw; - SKP_int HarmShapeGain_Q12, Tilt_Q14; - SKP_int32 HarmShapeFIRPacked_Q12, LF_shp_Q14; - SKP_int32 x_filt_Q12[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ]; - SKP_int16 st_res[ ( MAX_FRAME_LENGTH / MAX_NB_SUBFR ) + MAX_LPC_ORDER ]; - SKP_int16 B_Q12[ 2 ]; + opus_int j, k, lag; + opus_int32 tmp_32; + const opus_int16 *AR1_shp_Q13; + const opus_int16 *px; + opus_int16 *pxw; + opus_int HarmShapeGain_Q12, Tilt_Q14; + opus_int32 HarmShapeFIRPacked_Q12, LF_shp_Q14; + opus_int32 x_filt_Q12[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ]; + opus_int16 st_res[ ( MAX_FRAME_LENGTH / MAX_NB_SUBFR ) + MAX_LPC_ORDER ]; + opus_int16 B_Q12[ 2 ]; /* Setup pointers */ px = x; @@ -114,7 +114,7 @@ void silk_prefilter_FIX( HarmShapeGain_Q12 = SKP_SMULWB( psEncCtrl->HarmShapeGain_Q14[ k ], 16384 - psEncCtrl->HarmBoost_Q14[ k ] ); SKP_assert( HarmShapeGain_Q12 >= 0 ); HarmShapeFIRPacked_Q12 = SKP_RSHIFT( HarmShapeGain_Q12, 2 ); - HarmShapeFIRPacked_Q12 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q12, 1 ), 16 ); + HarmShapeFIRPacked_Q12 |= SKP_LSHIFT( ( opus_int32 )SKP_RSHIFT( HarmShapeGain_Q12, 1 ), 16 ); Tilt_Q14 = psEncCtrl->Tilt_Q14[ k ]; LF_shp_Q14 = psEncCtrl->LF_shp_Q14[ k ]; AR1_shp_Q13 = &psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER ]; @@ -150,19 +150,19 @@ void silk_prefilter_FIX( /* silk_prefilter. Prefilter for finding Quantizer input signal */ SKP_INLINE void silk_prefilt_FIX( silk_prefilter_state_FIX *P, /* I/O state */ - SKP_int32 st_res_Q12[], /* I short term residual signal */ - SKP_int16 xw[], /* O prefiltered signal */ - SKP_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */ - SKP_int Tilt_Q14, /* I Tilt shaping coeficient */ - SKP_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/ - SKP_int lag, /* I Lag for harmonic shaping */ - SKP_int length /* I Length of signals */ + opus_int32 st_res_Q12[], /* I short term residual signal */ + opus_int16 xw[], /* O prefiltered signal */ + opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic shaping coeficients */ + opus_int Tilt_Q14, /* I Tilt shaping coeficient */ + opus_int32 LF_shp_Q14, /* I Low-frequancy shaping coeficients*/ + opus_int lag, /* I Lag for harmonic shaping */ + opus_int length /* I Length of signals */ ) { - SKP_int i, idx, LTP_shp_buf_idx; - SKP_int32 n_LTP_Q12, n_Tilt_Q10, n_LF_Q10; - SKP_int32 sLF_MA_shp_Q12, sLF_AR_shp_Q12; - SKP_int16 *LTP_shp_buf; + opus_int i, idx, LTP_shp_buf_idx; + opus_int32 n_LTP_Q12, n_Tilt_Q10, n_LF_Q10; + opus_int32 sLF_MA_shp_Q12, sLF_AR_shp_Q12; + opus_int16 *LTP_shp_buf; /* To speed up use temp variables instead of using the struct */ LTP_shp_buf = P->sLTP_shp; @@ -189,9 +189,9 @@ SKP_INLINE void silk_prefilt_FIX( sLF_MA_shp_Q12 = SKP_SUB32( sLF_AR_shp_Q12, SKP_LSHIFT( n_LF_Q10, 2 ) ); LTP_shp_buf_idx = ( LTP_shp_buf_idx - 1 ) & LTP_MASK; - LTP_shp_buf[ LTP_shp_buf_idx ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( sLF_MA_shp_Q12, 12 ) ); + LTP_shp_buf[ LTP_shp_buf_idx ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( sLF_MA_shp_Q12, 12 ) ); - xw[i] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SUB32( sLF_MA_shp_Q12, n_LTP_Q12 ), 12 ) ); + xw[i] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SUB32( sLF_MA_shp_Q12, n_LTP_Q12 ), 12 ) ); } /* Copy temp variable back to state */ diff --git a/silk/fixed/silk_process_gains_FIX.c b/silk/fixed/silk_process_gains_FIX.c index b884129c8c6f8b08b7f1a8dd0fc482fcbe3fd1fe..4341ac0175017fabd8a66d2c6a9346aef121fd3a 100644 --- a/silk/fixed/silk_process_gains_FIX.c +++ b/silk/fixed/silk_process_gains_FIX.c @@ -35,8 +35,8 @@ void silk_process_gains_FIX( ) { silk_shape_state_FIX *psShapeSt = &psEnc->sShape; - SKP_int k; - SKP_int32 s_Q16, InvMaxSqrVal_Q16, gain, gain_squared, ResNrg, ResNrgPart, quant_offset_Q10; + opus_int k; + opus_int32 s_Q16, InvMaxSqrVal_Q16, gain, gain_squared, ResNrg, ResNrgPart, quant_offset_Q10; /* Gain reduction when LTP coding gain is high */ if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { diff --git a/silk/fixed/silk_regularize_correlations_FIX.c b/silk/fixed/silk_regularize_correlations_FIX.c index b0737d42073625dccc9eeb9cbf078c31f1e93bb4..8cca332ba45d70c3d0794bf26a7894fe9ead84d5 100644 --- a/silk/fixed/silk_regularize_correlations_FIX.c +++ b/silk/fixed/silk_regularize_correlations_FIX.c @@ -29,13 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Add noise to matrix diagonal */ void silk_regularize_correlations_FIX( - SKP_int32 *XX, /* I/O Correlation matrices */ - SKP_int32 *xx, /* I/O Correlation values */ - SKP_int32 noise, /* I Noise to add */ - SKP_int D /* I Dimension of XX */ + opus_int32 *XX, /* I/O Correlation matrices */ + opus_int32 *xx, /* I/O Correlation values */ + opus_int32 noise, /* I Noise to add */ + opus_int D /* I Dimension of XX */ ) { - SKP_int i; + opus_int i; for( i = 0; i < D; i++ ) { matrix_ptr( &XX[ 0 ], i, i, D ) = SKP_ADD32( matrix_ptr( &XX[ 0 ], i, i, D ), noise ); } diff --git a/silk/fixed/silk_residual_energy16_FIX.c b/silk/fixed/silk_residual_energy16_FIX.c index f651160461e62c33efd70dd9a817a3ac78f00db4..c3b571c8bace2643c91a125ef8f229f669a4635c 100644 --- a/silk/fixed/silk_residual_energy16_FIX.c +++ b/silk/fixed/silk_residual_energy16_FIX.c @@ -28,19 +28,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main_FIX.h" /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ -SKP_int32 silk_residual_energy16_covar_FIX( - const SKP_int16 *c, /* I Prediction vector */ - const SKP_int32 *wXX, /* I Correlation matrix */ - const SKP_int32 *wXx, /* I Correlation vector */ - SKP_int32 wxx, /* I Signal energy */ - SKP_int D, /* I Dimension */ - SKP_int cQ /* I Q value for c vector 0 - 15 */ +opus_int32 silk_residual_energy16_covar_FIX( + const opus_int16 *c, /* I Prediction vector */ + const opus_int32 *wXX, /* I Correlation matrix */ + const opus_int32 *wXx, /* I Correlation vector */ + opus_int32 wxx, /* I Signal energy */ + opus_int D, /* I Dimension */ + opus_int cQ /* I Q value for c vector 0 - 15 */ ) { - SKP_int i, j, lshifts, Qxtra; - SKP_int32 c_max, w_max, tmp, tmp2, nrg; - SKP_int cn[ MAX_MATRIX_SIZE ]; - const SKP_int32 *pRow; + opus_int i, j, lshifts, Qxtra; + opus_int32 c_max, w_max, tmp, tmp2, nrg; + opus_int cn[ MAX_MATRIX_SIZE ]; + const opus_int32 *pRow; /* Safety checks */ SKP_assert( D >= 0 ); @@ -53,7 +53,7 @@ SKP_int32 silk_residual_energy16_covar_FIX( c_max = 0; for( i = 0; i < D; i++ ) { - c_max = SKP_max_32( c_max, SKP_abs( ( SKP_int32 )c[ i ] ) ); + c_max = SKP_max_32( c_max, SKP_abs( ( opus_int32 )c[ i ] ) ); } Qxtra = SKP_min_int( Qxtra, silk_CLZ32( c_max ) - 17 ); @@ -61,7 +61,7 @@ SKP_int32 silk_residual_energy16_covar_FIX( Qxtra = SKP_min_int( Qxtra, silk_CLZ32( SKP_MUL( D, SKP_RSHIFT( SKP_SMULWB( w_max, c_max ), 4 ) ) ) - 5 ); Qxtra = SKP_max_int( Qxtra, 0 ); for( i = 0; i < D; i++ ) { - cn[ i ] = SKP_LSHIFT( ( SKP_int )c[ i ], Qxtra ); + cn[ i ] = SKP_LSHIFT( ( opus_int )c[ i ], Qxtra ); SKP_assert( SKP_abs(cn[i]) <= ( SKP_int16_MAX + 1 ) ); /* Check that SKP_SMLAWB can be used */ } lshifts -= Qxtra; diff --git a/silk/fixed/silk_residual_energy_FIX.c b/silk/fixed/silk_residual_energy_FIX.c index c161bb290d13f5504acb28733cf33ebaa29f232d..e156b363990135a84b408c5660d150083cbab3b4 100644 --- a/silk/fixed/silk_residual_energy_FIX.c +++ b/silk/fixed/silk_residual_energy_FIX.c @@ -30,20 +30,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Calculates residual energies of input subframes where all subframes have LPC_order */ /* of preceeding samples */ void silk_residual_energy_FIX( - SKP_int32 nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ - SKP_int nrgsQ[ MAX_NB_SUBFR ], /* O Q value per subframe */ - const SKP_int16 x[], /* I Input signal */ - SKP_int16 a_Q12[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ - const SKP_int32 gains[ MAX_NB_SUBFR ], /* I Quantization gains */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I Number of subframes */ - const SKP_int LPC_order /* I LPC order */ + opus_int32 nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ + opus_int nrgsQ[ MAX_NB_SUBFR ], /* O Q value per subframe */ + const opus_int16 x[], /* I Input signal */ + opus_int16 a_Q12[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ + const opus_int32 gains[ MAX_NB_SUBFR ], /* I Quantization gains */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I Number of subframes */ + const opus_int LPC_order /* I LPC order */ ) { - SKP_int offset, i, j, rshift, lz1, lz2; - SKP_int16 *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; - const SKP_int16 *x_ptr; - SKP_int32 tmp32; + opus_int offset, i, j, rshift, lz1, lz2; + opus_int16 *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; + const opus_int16 *x_ptr; + opus_int32 tmp32; x_ptr = x; offset = LPC_order + subfr_length; diff --git a/silk/fixed/silk_solve_LS_FIX.c b/silk/fixed/silk_solve_LS_FIX.c index a287a29b6399b8c366ad53b46896c2e98e9d57fb..ef69fb45879ce71cf7ba7ed7a8ba33aa2e1ad9c7 100644 --- a/silk/fixed/silk_solve_LS_FIX.c +++ b/silk/fixed/silk_solve_LS_FIX.c @@ -33,50 +33,50 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*****************************/ typedef struct { - SKP_int32 Q36_part; - SKP_int32 Q48_part; + opus_int32 Q36_part; + opus_int32 Q48_part; } inv_D_t; /* Factorize square matrix A into LDL form */ SKP_INLINE void silk_LDL_factorize_FIX( - SKP_int32 *A, /* I/O Pointer to Symetric Square Matrix */ - SKP_int M, /* I Size of Matrix */ - SKP_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ + opus_int32 *A, /* I/O Pointer to Symetric Square Matrix */ + opus_int M, /* I Size of Matrix */ + opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ inv_D_t *inv_D /* I/O Pointer to vector holding inverted diagonal elements of D */ ); /* Solve Lx = b, when L is lower triangular and has ones on the diagonal */ SKP_INLINE void silk_LS_SolveFirst_FIX( - const SKP_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ - SKP_int M, /* I Dim of Matrix equation */ - const SKP_int32 *b, /* I b Vector */ - SKP_int32 *x_Q16 /* O x Vector */ + const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ + opus_int M, /* I Dim of Matrix equation */ + const opus_int32 *b, /* I b Vector */ + opus_int32 *x_Q16 /* O x Vector */ ); /* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */ SKP_INLINE void silk_LS_SolveLast_FIX( - const SKP_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ - const SKP_int M, /* I Dim of Matrix equation */ - const SKP_int32 *b, /* I b Vector */ - SKP_int32 *x_Q16 /* O x Vector */ + const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ + const opus_int M, /* I Dim of Matrix equation */ + const opus_int32 *b, /* I b Vector */ + opus_int32 *x_Q16 /* O x Vector */ ); SKP_INLINE void silk_LS_divide_Q16_FIX( - SKP_int32 T[], /* I/O Numenator vector */ + opus_int32 T[], /* I/O Numenator vector */ inv_D_t *inv_D, /* I 1 / D vector */ - SKP_int M /* I dimension */ + opus_int M /* I dimension */ ); /* Solves Ax = b, assuming A is symmetric */ void silk_solve_LDL_FIX( - SKP_int32 *A, /* I Pointer to symetric square matrix A */ - SKP_int M, /* I Size of matrix */ - const SKP_int32 *b, /* I Pointer to b vector */ - SKP_int32 *x_Q16 /* O Pointer to x solution vector */ + opus_int32 *A, /* I Pointer to symetric square matrix A */ + opus_int M, /* I Size of matrix */ + const opus_int32 *b, /* I Pointer to b vector */ + opus_int32 *x_Q16 /* O Pointer to x solution vector */ ) { - SKP_int32 L_Q16[ MAX_MATRIX_SIZE * MAX_MATRIX_SIZE ]; - SKP_int32 Y[ MAX_MATRIX_SIZE ]; + opus_int32 L_Q16[ MAX_MATRIX_SIZE * MAX_MATRIX_SIZE ]; + opus_int32 Y[ MAX_MATRIX_SIZE ]; inv_D_t inv_D[ MAX_MATRIX_SIZE ]; SKP_assert( M <= MAX_MATRIX_SIZE ); @@ -106,17 +106,17 @@ void silk_solve_LDL_FIX( } SKP_INLINE void silk_LDL_factorize_FIX( - SKP_int32 *A, /* I Pointer to Symetric Square Matrix */ - SKP_int M, /* I Size of Matrix */ - SKP_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ + opus_int32 *A, /* I Pointer to Symetric Square Matrix */ + opus_int M, /* I Size of Matrix */ + opus_int32 *L_Q16, /* I/O Pointer to Square Upper triangular Matrix */ inv_D_t *inv_D /* I/O Pointer to vector holding inverted diagonal elements of D */ ) { - SKP_int i, j, k, status, loop_count; - const SKP_int32 *ptr1, *ptr2; - SKP_int32 diag_min_value, tmp_32, err; - SKP_int32 v_Q0[ MAX_MATRIX_SIZE ], D_Q0[ MAX_MATRIX_SIZE ]; - SKP_int32 one_div_diag_Q36, one_div_diag_Q40, one_div_diag_Q48; + opus_int i, j, k, status, loop_count; + const opus_int32 *ptr1, *ptr2; + opus_int32 diag_min_value, tmp_32, err; + opus_int32 v_Q0[ MAX_MATRIX_SIZE ], D_Q0[ MAX_MATRIX_SIZE ]; + opus_int32 one_div_diag_Q36, one_div_diag_Q40, one_div_diag_Q48; SKP_assert( M <= MAX_MATRIX_SIZE ); @@ -178,14 +178,14 @@ SKP_INLINE void silk_LDL_factorize_FIX( } SKP_INLINE void silk_LS_divide_Q16_FIX( - SKP_int32 T[], /* I/O Numenator vector */ + opus_int32 T[], /* I/O Numenator vector */ inv_D_t *inv_D, /* I 1 / D vector */ - SKP_int M /* I Order */ + opus_int M /* I Order */ ) { - SKP_int i; - SKP_int32 tmp_32; - SKP_int32 one_div_diag_Q36, one_div_diag_Q48; + opus_int i; + opus_int32 tmp_32; + opus_int32 one_div_diag_Q36, one_div_diag_Q48; for( i = 0; i < M; i++ ) { one_div_diag_Q36 = inv_D[ i ].Q36_part; @@ -198,15 +198,15 @@ SKP_INLINE void silk_LS_divide_Q16_FIX( /* Solve Lx = b, when L is lower triangular and has ones on the diagonal */ SKP_INLINE void silk_LS_SolveFirst_FIX( - const SKP_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ - SKP_int M, /* I Dim of Matrix equation */ - const SKP_int32 *b, /* I b Vector */ - SKP_int32 *x_Q16 /* O x Vector */ + const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ + opus_int M, /* I Dim of Matrix equation */ + const opus_int32 *b, /* I b Vector */ + opus_int32 *x_Q16 /* O x Vector */ ) { - SKP_int i, j; - const SKP_int32 *ptr32; - SKP_int32 tmp_32; + opus_int i, j; + const opus_int32 *ptr32; + opus_int32 tmp_32; for( i = 0; i < M; i++ ) { ptr32 = matrix_adr( L_Q16, i, 0, M ); @@ -220,15 +220,15 @@ SKP_INLINE void silk_LS_SolveFirst_FIX( /* Solve L^t*x = b, where L is lower triangular with ones on the diagonal */ SKP_INLINE void silk_LS_SolveLast_FIX( - const SKP_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ - const SKP_int M, /* I Dim of Matrix equation */ - const SKP_int32 *b, /* I b Vector */ - SKP_int32 *x_Q16 /* O x Vector */ + const opus_int32 *L_Q16, /* I Pointer to Lower Triangular Matrix */ + const opus_int M, /* I Dim of Matrix equation */ + const opus_int32 *b, /* I b Vector */ + opus_int32 *x_Q16 /* O x Vector */ ) { - SKP_int i, j; - const SKP_int32 *ptr32; - SKP_int32 tmp_32; + opus_int i, j; + const opus_int32 *ptr32; + opus_int32 tmp_32; for( i = M - 1; i >= 0; i-- ) { ptr32 = matrix_adr( L_Q16, 0, i, M ); diff --git a/silk/fixed/silk_structs_FIX.h b/silk/fixed/silk_structs_FIX.h index d60eb920a72f2b116d258e129c5f33e198b18f0e..d7d5d87469674ca47c8bf6bcab8b8962236adf43 100644 --- a/silk/fixed/silk_structs_FIX.h +++ b/silk/fixed/silk_structs_FIX.h @@ -41,24 +41,24 @@ extern "C" /* Noise shaping analysis state */ /********************************/ typedef struct { - SKP_int8 LastGainIndex; - SKP_int32 HarmBoost_smth_Q16; - SKP_int32 HarmShapeGain_smth_Q16; - SKP_int32 Tilt_smth_Q16; + opus_int8 LastGainIndex; + opus_int32 HarmBoost_smth_Q16; + opus_int32 HarmShapeGain_smth_Q16; + opus_int32 Tilt_smth_Q16; } silk_shape_state_FIX; /********************************/ /* Prefilter state */ /********************************/ typedef struct { - SKP_int16 sLTP_shp[ LTP_BUF_LENGTH ]; - SKP_int32 sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ]; - SKP_int sLTP_shp_buf_idx; - SKP_int32 sLF_AR_shp_Q12; - SKP_int32 sLF_MA_shp_Q12; - SKP_int sHarmHP; - SKP_int32 rand_seed; - SKP_int lagPrev; + opus_int16 sLTP_shp[ LTP_BUF_LENGTH ]; + opus_int32 sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ]; + opus_int sLTP_shp_buf_idx; + opus_int32 sLF_AR_shp_Q12; + opus_int32 sLF_MA_shp_Q12; + opus_int sHarmHP; + opus_int32 rand_seed; + opus_int lagPrev; } silk_prefilter_state_FIX; /********************************/ @@ -70,12 +70,12 @@ typedef struct { silk_prefilter_state_FIX sPrefilt; /* Prefilter State */ /* Buffer for find pitch and noise shape analysis */ - SKP_DWORD_ALIGN SKP_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */ - SKP_int LTPCorr_Q15; /* Normalized correlation from pitch lag estimator */ + SKP_DWORD_ALIGN opus_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */ + opus_int LTPCorr_Q15; /* Normalized correlation from pitch lag estimator */ /* Parameters For LTP scaling Control */ - SKP_int prevLTPredCodGain_Q7; - SKP_int HPLTPredCodGain_Q7; + opus_int prevLTPredCodGain_Q7; + opus_int HPLTPredCodGain_Q7; } silk_encoder_state_FIX; /************************/ @@ -83,31 +83,31 @@ typedef struct { /************************/ typedef struct { /* Prediction and coding parameters */ - SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; - SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; - SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; - SKP_int LTP_scale_Q14; - SKP_int pitchL[ MAX_NB_SUBFR ]; + opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; + SKP_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; + opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; + opus_int LTP_scale_Q14; + opus_int pitchL[ MAX_NB_SUBFR ]; /* Noise shaping parameters */ /* Testing */ - SKP_DWORD_ALIGN SKP_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; - SKP_DWORD_ALIGN SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; - SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */ - SKP_int GainsPre_Q14[ MAX_NB_SUBFR ]; - SKP_int HarmBoost_Q14[ MAX_NB_SUBFR ]; - SKP_int Tilt_Q14[ MAX_NB_SUBFR ]; - SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; - SKP_int Lambda_Q10; - SKP_int input_quality_Q14; - SKP_int coding_quality_Q14; + SKP_DWORD_ALIGN opus_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; + SKP_DWORD_ALIGN opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; + opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */ + opus_int GainsPre_Q14[ MAX_NB_SUBFR ]; + opus_int HarmBoost_Q14[ MAX_NB_SUBFR ]; + opus_int Tilt_Q14[ MAX_NB_SUBFR ]; + opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; + opus_int Lambda_Q10; + opus_int input_quality_Q14; + opus_int coding_quality_Q14; /* measures */ - SKP_int sparseness_Q8; - SKP_int32 predGain_Q16; - SKP_int LTPredCodGain_Q7; - SKP_int32 ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */ - SKP_int ResNrgQ[ MAX_NB_SUBFR ]; /* Q domain for the residual energy > 0 */ + opus_int sparseness_Q8; + opus_int32 predGain_Q16; + opus_int LTPredCodGain_Q7; + opus_int32 ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */ + opus_int ResNrgQ[ MAX_NB_SUBFR ]; /* Q domain for the residual energy > 0 */ } silk_encoder_control_FIX; @@ -117,11 +117,11 @@ typedef struct { typedef struct { silk_encoder_state_FIX state_Fxx[ ENCODER_NUM_CHANNELS ]; stereo_enc_state sStereo; - SKP_int32 nBitsExceeded; - SKP_int nChannelsAPI; - SKP_int nChannelsInternal; - SKP_int timeSinceSwitchAllowed_ms; - SKP_int allowBandwidthSwitch; + opus_int32 nBitsExceeded; + opus_int nChannelsAPI; + opus_int nChannelsInternal; + opus_int timeSinceSwitchAllowed_ms; + opus_int allowBandwidthSwitch; } silk_encoder; diff --git a/silk/fixed/silk_warped_autocorrelation_FIX.c b/silk/fixed/silk_warped_autocorrelation_FIX.c index 18a3cad972b7629416849241987191f0a8b412ca..2f34cb9644d86c54c0b61c02e54ea4ace99af763 100644 --- a/silk/fixed/silk_warped_autocorrelation_FIX.c +++ b/silk/fixed/silk_warped_autocorrelation_FIX.c @@ -32,18 +32,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Autocorrelations for a warped frequency axis */ void silk_warped_autocorrelation_FIX( - SKP_int32 *corr, /* O Result [order + 1] */ - SKP_int *scale, /* O Scaling of the correlation vector */ - const SKP_int16 *input, /* I Input data to correlate */ - const SKP_int warping_Q16, /* I Warping coefficient */ - const SKP_int length, /* I Length of input */ - const SKP_int order /* I Correlation order (even) */ + opus_int32 *corr, /* O Result [order + 1] */ + opus_int *scale, /* O Scaling of the correlation vector */ + const opus_int16 *input, /* I Input data to correlate */ + const opus_int warping_Q16, /* I Warping coefficient */ + const opus_int length, /* I Length of input */ + const opus_int order /* I Correlation order (even) */ ) { - SKP_int n, i, lsh; - SKP_int32 tmp1_QS, tmp2_QS; - SKP_int32 state_QS[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; - SKP_int64 corr_QC[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; + opus_int n, i, lsh; + opus_int32 tmp1_QS, tmp2_QS; + opus_int32 state_QS[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; + opus_int64 corr_QC[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; /* Order must be even */ SKP_assert( ( order & 1 ) == 0 ); @@ -51,7 +51,7 @@ void silk_warped_autocorrelation_FIX( /* Loop over samples */ for( n = 0; n < length; n++ ) { - tmp1_QS = SKP_LSHIFT32( ( SKP_int32 )input[ n ], QS ); + tmp1_QS = SKP_LSHIFT32( ( opus_int32 )input[ n ], QS ); /* Loop over allpass sections */ for( i = 0; i < order; i += 2 ) { /* Output of allpass section */ @@ -73,11 +73,11 @@ void silk_warped_autocorrelation_FIX( SKP_assert( *scale >= -30 && *scale <= 12 ); if( lsh >= 0 ) { for( i = 0; i < order + 1; i++ ) { - corr[ i ] = ( SKP_int32 )SKP_CHECK_FIT32( SKP_LSHIFT64( corr_QC[ i ], lsh ) ); + corr[ i ] = ( opus_int32 )SKP_CHECK_FIT32( SKP_LSHIFT64( corr_QC[ i ], lsh ) ); } } else { for( i = 0; i < order + 1; i++ ) { - corr[ i ] = ( SKP_int32 )SKP_CHECK_FIT32( SKP_RSHIFT64( corr_QC[ i ], -lsh ) ); + corr[ i ] = ( opus_int32 )SKP_CHECK_FIT32( SKP_RSHIFT64( corr_QC[ i ], -lsh ) ); } } SKP_assert( corr_QC[ 0 ] >= 0 ); // If breaking, decrease QC diff --git a/silk/float/silk_LPC_analysis_filter_FLP.c b/silk/float/silk_LPC_analysis_filter_FLP.c index 7f506c4b0bf9fc0056070af9ad254af12e1fec85..645a6455a1f311606537f94c2603f2fb946084a7 100644 --- a/silk/float/silk_LPC_analysis_filter_FLP.c +++ b/silk/float/silk_LPC_analysis_filter_FLP.c @@ -40,10 +40,10 @@ void silk_LPC_analysis_filter16_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -78,10 +78,10 @@ void silk_LPC_analysis_filter14_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -114,10 +114,10 @@ void silk_LPC_analysis_filter12_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -148,10 +148,10 @@ void silk_LPC_analysis_filter10_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -180,10 +180,10 @@ void silk_LPC_analysis_filter8_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -210,10 +210,10 @@ void silk_LPC_analysis_filter6_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length /* I Length of input signal */ + const opus_int length /* I Length of input signal */ ) { - SKP_int ix; + opus_int ix; SKP_float LPC_pred; const SKP_float *s_ptr; @@ -244,8 +244,8 @@ void silk_LPC_analysis_filter_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length, /* I Length of input signal */ - const SKP_int Order /* I LPC order */ + const opus_int length, /* I Length of input signal */ + const opus_int Order /* I LPC order */ ) { SKP_assert( Order <= length ); diff --git a/silk/float/silk_LPC_inv_pred_gain_FLP.c b/silk/float/silk_LPC_inv_pred_gain_FLP.c index 512ae5d8729b7ebb5011f42423fe9a7f0f0597c9..9e5a3c8c926c1a3798416adc304a919852e7a310 100644 --- a/silk/float/silk_LPC_inv_pred_gain_FLP.c +++ b/silk/float/silk_LPC_inv_pred_gain_FLP.c @@ -33,13 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */ /* this code is based on silk_a2k_FLP() */ -SKP_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */ +opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */ SKP_float *invGain, /* O: inverse prediction gain, energy domain */ const SKP_float *A, /* I: prediction coefficients [order] */ - SKP_int32 order /* I: prediction order */ + opus_int32 order /* I: prediction order */ ) { - SKP_int k, n; + opus_int k, n; double rc, rc_mult1, rc_mult2; SKP_float Atmp[ 2 ][ SILK_MAX_ORDER_LPC ]; SKP_float *Aold, *Anew; diff --git a/silk/float/silk_LTP_analysis_filter_FLP.c b/silk/float/silk_LTP_analysis_filter_FLP.c index 3bf616915a0930eaf2476727853c7becc4cbcc3e..60d04ee9f01f75ab1326304d59eca607a3ac166b 100644 --- a/silk/float/silk_LTP_analysis_filter_FLP.c +++ b/silk/float/silk_LTP_analysis_filter_FLP.c @@ -31,18 +31,18 @@ void silk_LTP_analysis_filter_FLP( SKP_float *LTP_res, /* O LTP res MAX_NB_SUBFR*(pre_lgth+subfr_lngth) */ const SKP_float *x, /* I Input signal, with preceeding samples */ const SKP_float B[ LTP_ORDER * MAX_NB_SUBFR ], /* I LTP coefficients for each subframe */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ const SKP_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ - const SKP_int subfr_length, /* I Length of each subframe */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int pre_length /* I Preceeding samples for each subframe */ + const opus_int subfr_length, /* I Length of each subframe */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int pre_length /* I Preceeding samples for each subframe */ ) { const SKP_float *x_ptr, *x_lag_ptr; SKP_float Btmp[ LTP_ORDER ]; SKP_float *LTP_res_ptr; SKP_float inv_gain; - SKP_int k, i, j; + opus_int k, i, j; x_ptr = x; LTP_res_ptr = LTP_res; diff --git a/silk/float/silk_LTP_scale_ctrl_FLP.c b/silk/float/silk_LTP_scale_ctrl_FLP.c index 437c5249fe88770ad2bc1ff6da268a9c65b6d1a9..6babea309a4ab905eec3245c7f9bde341bd288bf 100644 --- a/silk/float/silk_LTP_scale_ctrl_FLP.c +++ b/silk/float/silk_LTP_scale_ctrl_FLP.c @@ -32,7 +32,7 @@ void silk_LTP_scale_ctrl_FLP( silk_encoder_control_FLP *psEncCtrl /* I/O Encoder control FLP */ ) { - SKP_int round_loss; + opus_int round_loss; /* 1st order high-pass filter */ //g_HP(n) = g(n) - 0.5 * g(n-1) + 0.5 * g_HP(n-1); @@ -43,7 +43,7 @@ void silk_LTP_scale_ctrl_FLP( /* Only scale if first frame in packet */ if( psEnc->sCmn.nFramesEncoded == 0 ) { round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket; - psEnc->sCmn.indices.LTP_scaleIndex = (SKP_int8)SKP_LIMIT( round_loss * psEnc->HPLTPredCodGain * 0.1f, 0.0f, 2.0f ); + psEnc->sCmn.indices.LTP_scaleIndex = (opus_int8)SKP_LIMIT( round_loss * psEnc->HPLTPredCodGain * 0.1f, 0.0f, 2.0f ); } else { /* Default is minimum scaling */ psEnc->sCmn.indices.LTP_scaleIndex = 0; diff --git a/silk/float/silk_SigProc_FLP.h b/silk/float/silk_SigProc_FLP.h index b20bcfd486bbfe97b62bb723f97e0f3d03738fea..ece5af292f88d155395c60d82f523b1413eef961 100644 --- a/silk/float/silk_SigProc_FLP.h +++ b/silk/float/silk_SigProc_FLP.h @@ -43,44 +43,44 @@ extern "C" /* Chirp (bw expand) LP AR filter */ void silk_bwexpander_FLP( SKP_float *ar, /* io AR filter to be expanded (without leading 1) */ - const SKP_int d, /* i length of ar */ + const opus_int d, /* i length of ar */ const SKP_float chirp /* i chirp factor (typically in range (0..1) ) */ ); /* compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */ /* this code is based on silk_FLP_a2k() */ -SKP_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */ +opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherwise 0 */ SKP_float *invGain, /* O: inverse prediction gain, energy domain */ const SKP_float *A, /* I: prediction coefficients [order] */ - SKP_int32 order /* I: prediction order */ + opus_int32 order /* I: prediction order */ ); SKP_float silk_schur_FLP( /* O returns residual energy */ SKP_float refl_coef[], /* O reflection coefficients (length order) */ const SKP_float auto_corr[], /* I autocorrelation sequence (length order+1) */ - SKP_int order /* I order */ + opus_int order /* I order */ ); void silk_k2a_FLP( SKP_float *A, /* O: prediction coefficients [order] */ const SKP_float *rc, /* I: reflection coefficients [order] */ - SKP_int32 order /* I: prediction order */ + opus_int32 order /* I: prediction order */ ); /* Solve the normal equations using the Levinson-Durbin recursion */ SKP_float silk_levinsondurbin_FLP( /* O prediction error energy */ SKP_float A[], /* O prediction coefficients [order] */ const SKP_float corr[], /* I input auto-correlations [order + 1] */ - const SKP_int order /* I prediction order */ + const opus_int order /* I prediction order */ ); /* compute autocorrelation */ void silk_autocorrelation_FLP( SKP_float *results, /* o result (length correlationCount) */ const SKP_float *inputData, /* i input data to correlate */ - SKP_int inputDataSize, /* i length of input */ - SKP_int correlationCount /* i number of correlation taps to compute */ + opus_int inputDataSize, /* i length of input */ + opus_int correlationCount /* i number of correlation taps to compute */ ); /* Pitch estimator */ @@ -88,44 +88,44 @@ void silk_autocorrelation_FLP( #define SigProc_PE_MID_COMPLEX 1 #define SigProc_PE_MAX_COMPLEX 2 -SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */ +opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */ const SKP_float *signal, /* I signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ - SKP_int *pitch_out, /* O 4 pitch lag values */ - SKP_int16 *lagIndex, /* O lag Index */ - SKP_int8 *contourIndex, /* O pitch contour Index */ + opus_int *pitch_out, /* O 4 pitch lag values */ + opus_int16 *lagIndex, /* O lag Index */ + opus_int8 *contourIndex, /* O pitch contour Index */ SKP_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ - SKP_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */ + opus_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */ const SKP_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */ const SKP_float search_thres2, /* I final threshold for lag candidates 0 - 1 */ - const SKP_int Fs_kHz, /* I sample frequency (kHz) */ - const SKP_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ - const SKP_int nb_subfr /* I number of 5 ms subframes */ + const opus_int Fs_kHz, /* I sample frequency (kHz) */ + const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ + const opus_int nb_subfr /* I number of 5 ms subframes */ ); #define PI (3.1415926536f) void silk_insertion_sort_decreasing_FLP( SKP_float *a, /* I/O: Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ); /* Compute reflection coefficients from input signal */ SKP_float silk_burg_modified_FLP( /* O returns residual energy */ SKP_float A[], /* O prediction coefficients (length order) */ const SKP_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */ - const SKP_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ - const SKP_int nb_subfr, /* I number of subframes stacked in x */ + const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ + const opus_int nb_subfr, /* I number of subframes stacked in x */ const SKP_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */ - const SKP_int D /* I order */ + const opus_int D /* I order */ ); /* multiply a vector by a constant */ void silk_scale_vector_FLP( SKP_float *data1, SKP_float gain, - SKP_int dataSize + opus_int dataSize ); /* copy and multiply a vector by a constant */ @@ -133,20 +133,20 @@ void silk_scale_copy_vector_FLP( SKP_float *data_out, const SKP_float *data_in, SKP_float gain, - SKP_int dataSize + opus_int dataSize ); /* inner product of two SKP_float arrays, with result as double */ double silk_inner_product_FLP( const SKP_float *data1, const SKP_float *data2, - SKP_int dataSize + opus_int dataSize ); /* sum of squares of a SKP_float array, with result as double */ double silk_energy_FLP( const SKP_float *data, - SKP_int dataSize + opus_int dataSize ); /********************************************************************/ @@ -167,31 +167,31 @@ SKP_INLINE SKP_float SKP_sigmoid(SKP_float x) } /* floating-point to integer conversion (rounding) */ -SKP_INLINE SKP_int32 SKP_float2int(double x) +SKP_INLINE opus_int32 SKP_float2int(double x) { #ifdef _WIN32 double t = x + 6755399441055744.0; - return *((SKP_int32 *)( &t )); + return *((opus_int32 *)( &t )); #else - return (SKP_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 ); + return (opus_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 ); #endif } /* floating-point to integer conversion (rounding) */ SKP_INLINE void SKP_float2short_array( - SKP_int16 *out, + opus_int16 *out, const SKP_float *in, - SKP_int32 length + opus_int32 length ) { - SKP_int32 k; + opus_int32 k; for (k = length-1; k >= 0; k--) { #ifdef _WIN32 double t = in[k] + 6755399441055744.0; - out[k] = (SKP_int16)SKP_SAT16(*(( SKP_int32 * )( &t ))); + out[k] = (opus_int16)SKP_SAT16(*(( opus_int32 * )( &t ))); #else double x = in[k]; - out[k] = (SKP_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 ); + out[k] = (opus_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 ); #endif } } @@ -199,11 +199,11 @@ SKP_INLINE void SKP_float2short_array( /* integer to floating-point conversion */ SKP_INLINE void SKP_short2float_array( SKP_float *out, - const SKP_int16 *in, - SKP_int32 length + const opus_int16 *in, + opus_int32 length ) { - SKP_int32 k; + opus_int32 k; for (k = length-1; k >= 0; k--) { out[k] = (SKP_float)in[k]; } diff --git a/silk/float/silk_apply_sine_window_FLP.c b/silk/float/silk_apply_sine_window_FLP.c index 450be05c016a9bc9e7d2b1220538d6dc22b55947..e52075c1b97b9e826e72a1e7e80c66a4a98e21de 100644 --- a/silk/float/silk_apply_sine_window_FLP.c +++ b/silk/float/silk_apply_sine_window_FLP.c @@ -34,11 +34,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_apply_sine_window_FLP( SKP_float px_win[], /* O Pointer to windowed signal */ const SKP_float px[], /* I Pointer to input signal */ - const SKP_int win_type, /* I Selects a window type */ - const SKP_int length /* I Window length, multiple of 4 */ + const opus_int win_type, /* I Selects a window type */ + const opus_int length /* I Window length, multiple of 4 */ ) { - SKP_int k; + opus_int k; SKP_float freq, c, S0, S1; SKP_assert( win_type == 1 || win_type == 2 ); diff --git a/silk/float/silk_autocorrelation_FLP.c b/silk/float/silk_autocorrelation_FLP.c index 7cbf87115e05dd1c2f69e7f52341713097779305..991513c1dfbe34f1ea889fde7a7e3f200f3b9085 100644 --- a/silk/float/silk_autocorrelation_FLP.c +++ b/silk/float/silk_autocorrelation_FLP.c @@ -32,11 +32,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_autocorrelation_FLP( SKP_float *results, /* O result (length correlationCount) */ const SKP_float *inputData, /* I input data to correlate */ - SKP_int inputDataSize, /* I length of input */ - SKP_int correlationCount /* I number of correlation taps to compute */ + opus_int inputDataSize, /* I length of input */ + opus_int correlationCount /* I number of correlation taps to compute */ ) { - SKP_int i; + opus_int i; if ( correlationCount > inputDataSize ) { correlationCount = inputDataSize; diff --git a/silk/float/silk_burg_modified_FLP.c b/silk/float/silk_burg_modified_FLP.c index 563216a75557f2602ab9f200fd8804dd7bca1870..622f06110430d074d336f0c3a9c35b6b5a161a25 100644 --- a/silk/float/silk_burg_modified_FLP.c +++ b/silk/float/silk_burg_modified_FLP.c @@ -34,13 +34,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SKP_float silk_burg_modified_FLP( /* O returns residual energy */ SKP_float A[], /* O prediction coefficients (length order) */ const SKP_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */ - const SKP_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ - const SKP_int nb_subfr, /* I number of subframes stacked in x */ + const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ + const opus_int nb_subfr, /* I number of subframes stacked in x */ const SKP_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */ - const SKP_int D /* I order */ + const opus_int D /* I order */ ) { - SKP_int k, n, s; + opus_int k, n, s; double C0, num, nrg_f, nrg_b, rc, Atmp, tmp1, tmp2; const SKP_float *x_ptr; double C_first_row[ SILK_MAX_ORDER_LPC ], C_last_row[ SILK_MAX_ORDER_LPC ]; diff --git a/silk/float/silk_bwexpander_FLP.c b/silk/float/silk_bwexpander_FLP.c index d97328e1c78a612b37f66a5d2f8d3e3b1cb48dc7..55d1fddc275da48eebd5b75db75c36fd2e028282 100644 --- a/silk/float/silk_bwexpander_FLP.c +++ b/silk/float/silk_bwexpander_FLP.c @@ -32,11 +32,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Chirp (bw expand) LP AR filter */ void silk_bwexpander_FLP( SKP_float *ar, /* I/O AR filter to be expanded (without leading 1) */ - const SKP_int d, /* I length of ar */ + const opus_int d, /* I length of ar */ const SKP_float chirp /* I chirp factor (typically in range (0..1) ) */ ) { - SKP_int i; + opus_int i; SKP_float cfac = chirp; for( i = 0; i < d - 1; i++ ) { diff --git a/silk/float/silk_corrMatrix_FLP.c b/silk/float/silk_corrMatrix_FLP.c index 4a259719fddbb96c601e29f83ad2da9ce716e0e8..2b396ee5dec4472f0b324e2e880d3645e43809ae 100644 --- a/silk/float/silk_corrMatrix_FLP.c +++ b/silk/float/silk_corrMatrix_FLP.c @@ -35,12 +35,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_corrVector_FLP( const SKP_float *x, /* I x vector [L+order-1] used to create X */ const SKP_float *t, /* I Target vector [L] */ - const SKP_int L, /* I Length of vecors */ - const SKP_int Order, /* I Max lag for correlation */ + const opus_int L, /* I Length of vecors */ + const opus_int Order, /* I Max lag for correlation */ SKP_float *Xt /* O X'*t correlation vector [order] */ ) { - SKP_int lag; + opus_int lag; const SKP_float *ptr1; ptr1 = &x[ Order - 1 ]; /* Points to first sample of column 0 of X: X[:,0] */ @@ -54,12 +54,12 @@ void silk_corrVector_FLP( /* Calculates correlation matrix X'*X */ void silk_corrMatrix_FLP( const SKP_float *x, /* I x vector [ L+order-1 ] used to create X */ - const SKP_int L, /* I Length of vectors */ - const SKP_int Order, /* I Max lag for correlation */ + const opus_int L, /* I Length of vectors */ + const opus_int Order, /* I Max lag for correlation */ SKP_float *XX /* O X'*X correlation matrix [order x order] */ ) { - SKP_int j, lag; + opus_int j, lag; double energy; const SKP_float *ptr1, *ptr2; diff --git a/silk/float/silk_encode_frame_FLP.c b/silk/float/silk_encode_frame_FLP.c index d18f22b067873faeed8909d3ce75f669bc9e62fc..b2e73f7dcae8834d1822fb7fc4893d2b4c51c061 100644 --- a/silk/float/silk_encode_frame_FLP.c +++ b/silk/float/silk_encode_frame_FLP.c @@ -31,14 +31,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /****************/ /* Encode frame */ /****************/ -SKP_int silk_encode_frame_FLP( +opus_int silk_encode_frame_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ - SKP_int32 *pnBytesOut, /* O Number of payload bytes */ + opus_int32 *pnBytesOut, /* O Number of payload bytes */ ec_enc *psRangeEnc /* I/O compressor data structure */ ) { silk_encoder_control_FLP sEncCtrl; - SKP_int i, ret = 0; + opus_int i, ret = 0; SKP_float *x_frame, *res_pitch_frame; SKP_float xfw[ MAX_FRAME_LENGTH ]; SKP_float res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ]; @@ -195,21 +195,21 @@ TOC(ENCODE_PULSES) TOC(ENCODE_FRAME) #ifdef SAVE_ALL_INTERNAL_DATA - //DEBUG_STORE_DATA( xf.dat, pIn_HP_LP, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) ); + //DEBUG_STORE_DATA( xf.dat, pIn_HP_LP, psEnc->sCmn.frame_length * sizeof( opus_int16 ) ); //DEBUG_STORE_DATA( xfw.dat, xfw, psEnc->sCmn.frame_length * sizeof( SKP_float ) ); - DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, MAX_NB_SUBFR * sizeof( SKP_int ) ); + DEBUG_STORE_DATA( pitchL.dat, sEncCtrl.pitchL, MAX_NB_SUBFR * sizeof( opus_int ) ); DEBUG_STORE_DATA( pitchG_quantized.dat, sEncCtrl.LTPCoef, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( SKP_float ) ); DEBUG_STORE_DATA( LTPcorr.dat, &psEnc->LTPCorr, sizeof( SKP_float ) ); DEBUG_STORE_DATA( gains.dat, sEncCtrl.Gains, psEnc->sCmn.nb_subfr * sizeof( SKP_float ) ); - DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( speech_activity_q8.dat, &psEnc->sCmn.speech_activity_Q8, sizeof( SKP_int ) ); - DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( SKP_int8 ) ); + DEBUG_STORE_DATA( gains_indices.dat, &psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr * sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( quantOffsetType.dat, &psEnc->sCmn.indices.quantOffsetType, sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( speech_activity_q8.dat, &psEnc->sCmn.speech_activity_Q8, sizeof( opus_int ) ); + DEBUG_STORE_DATA( signalType.dat, &psEnc->sCmn.indices.signalType, sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( lag_index.dat, &psEnc->sCmn.indices.lagIndex, sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( contour_index.dat, &psEnc->sCmn.indices.contourIndex, sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( per_index.dat, &psEnc->sCmn.indices.PERIndex, sizeof( opus_int8 ) ); DEBUG_STORE_DATA( PredCoef.dat, &sEncCtrl.PredCoef[ 1 ], psEnc->sCmn.predictLPCOrder * sizeof( SKP_float ) ); - DEBUG_STORE_DATA( ltp_scale_idx.dat, &psEnc->sCmn.indices.LTP_scaleIndex, sizeof( SKP_int8 ) ); + DEBUG_STORE_DATA( ltp_scale_idx.dat, &psEnc->sCmn.indices.LTP_scaleIndex, sizeof( opus_int8 ) ); // DEBUG_STORE_DATA( xq.dat, psEnc->sCmn.sNSQ.xqBuf, psEnc->sCmn.frame_length * sizeof( SKP_float ) ); #endif return ret; @@ -222,8 +222,8 @@ void silk_LBRR_encode_FLP( const SKP_float xfw[] /* I Input signal */ ) { - SKP_int k; - SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; + opus_int k; + opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; SKP_float TempGains[ MAX_NB_SUBFR ]; SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFramesEncoded ]; silk_nsq_state sNSQ_LBRR; diff --git a/silk/float/silk_energy_FLP.c b/silk/float/silk_energy_FLP.c index 87cbb9e31415a11bcab072487aaee4aa3f1344a3..86b634127b54ebbfb3046aa135e092fe8b72ca7b 100644 --- a/silk/float/silk_energy_FLP.c +++ b/silk/float/silk_energy_FLP.c @@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* sum of squares of a SKP_float array, with result as double */ double silk_energy_FLP( const SKP_float *data, - SKP_int dataSize + opus_int dataSize ) { - SKP_int i, dataSize4; + opus_int i, dataSize4; double result; /* 4x unrolled loop */ diff --git a/silk/float/silk_find_LPC_FLP.c b/silk/float/silk_find_LPC_FLP.c index 1ad3c1cc8a65a3e2543135adc99c62afc71880f8..23657e586ffa0ea5ea6a72e60322d7879c7b6984 100644 --- a/silk/float/silk_find_LPC_FLP.c +++ b/silk/float/silk_find_LPC_FLP.c @@ -29,23 +29,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tuning_parameters.h" void silk_find_LPC_FLP( - SKP_int16 NLSF_Q15[], /* O NLSFs */ - SKP_int8 *interpIndex, /* O NLSF interp. index for NLSF interp. */ - const SKP_int16 prev_NLSFq_Q15[], /* I Previous NLSFs, for NLSF interpolation */ - const SKP_int useInterpNLSFs, /* I Flag */ - const SKP_int firstFrameAfterReset, /* I Flag */ - const SKP_int LPC_order, /* I LPC order */ + opus_int16 NLSF_Q15[], /* O NLSFs */ + opus_int8 *interpIndex, /* O NLSF interp. index for NLSF interp. */ + const opus_int16 prev_NLSFq_Q15[], /* I Previous NLSFs, for NLSF interpolation */ + const opus_int useInterpNLSFs, /* I Flag */ + const opus_int firstFrameAfterReset, /* I Flag */ + const opus_int LPC_order, /* I LPC order */ const SKP_float x[], /* I Input signal */ - const SKP_int subfr_length, /* I Subframe length incl preceeding samples */ - const SKP_int nb_subfr /* I: Number of subframes */ + const opus_int subfr_length, /* I Subframe length incl preceeding samples */ + const opus_int nb_subfr /* I: Number of subframes */ ) { - SKP_int k; + opus_int k; SKP_float a[ MAX_LPC_ORDER ]; /* Used only for NLSF interpolation */ double res_nrg, res_nrg_2nd, res_nrg_interp; - SKP_int16 NLSF0_Q15[ MAX_LPC_ORDER ]; + opus_int16 NLSF0_Q15[ MAX_LPC_ORDER ]; SKP_float a_tmp[ MAX_LPC_ORDER ]; SKP_float LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; @@ -91,7 +91,7 @@ void silk_find_LPC_FLP( if( res_nrg_interp < res_nrg ) { /* Interpolation has lower residual energy */ res_nrg = res_nrg_interp; - *interpIndex = (SKP_int8)k; + *interpIndex = (opus_int8)k; } else if( res_nrg_interp > res_nrg_2nd ) { /* No reason to continue iterating - residual energies will continue to climb */ break; diff --git a/silk/float/silk_find_LTP_FLP.c b/silk/float/silk_find_LTP_FLP.c index e8fe1e77dd3e39e9a196dcc9bee9a9249a69fbc4..97ab20b72780e4cfe1f69e07275ebb9da3a5398f 100644 --- a/silk/float/silk_find_LTP_FLP.c +++ b/silk/float/silk_find_LTP_FLP.c @@ -33,14 +33,14 @@ void silk_find_LTP_FLP( SKP_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ SKP_float *LTPredCodGain, /* O LTP coding gain */ const SKP_float r_lpc[], /* I LPC residual */ - const SKP_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ + const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ const SKP_float Wght[ MAX_NB_SUBFR ], /* I Weights */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int mem_offset /* I Number of samples in LTP memory */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int mem_offset /* I Number of samples in LTP memory */ ) { - SKP_int i, k; + opus_int i, k; SKP_float *b_ptr, temp, *WLTP_ptr; SKP_float LPC_res_nrg, LPC_LTP_res_nrg; SKP_float d[ MAX_NB_SUBFR ], m, g, delta_b[ LTP_ORDER ]; diff --git a/silk/float/silk_find_pitch_lags_FLP.c b/silk/float/silk_find_pitch_lags_FLP.c index 8f213ca71b0b2c3419cf56cc915d222bfb853c8e..873c7e0b961ae243ee5a417ee9e7776998acd4ac 100644 --- a/silk/float/silk_find_pitch_lags_FLP.c +++ b/silk/float/silk_find_pitch_lags_FLP.c @@ -36,7 +36,7 @@ void silk_find_pitch_lags_FLP( const SKP_float x[] /* I Speech signal */ ) { - SKP_int buf_len; + opus_int buf_len; SKP_float thrhld, res_nrg; const SKP_float *x_buf_ptr, *x_buf; SKP_float auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; diff --git a/silk/float/silk_find_pred_coefs_FLP.c b/silk/float/silk_find_pred_coefs_FLP.c index 200c78c509ed2623e6739a7a75bdf6240930d8ea..e4be48ee58fbfcf7aabf406a63da07a4c7bf5aba 100644 --- a/silk/float/silk_find_pred_coefs_FLP.c +++ b/silk/float/silk_find_pred_coefs_FLP.c @@ -35,10 +35,10 @@ void silk_find_pred_coefs_FLP( const SKP_float x[] /* I Speech signal */ ) { - SKP_int i; + opus_int i; SKP_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]; SKP_float invGains[ MAX_NB_SUBFR ], Wght[ MAX_NB_SUBFR ]; - SKP_int16 NLSF_Q15[ MAX_LPC_ORDER ]; + opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]; const SKP_float *x_ptr; SKP_float *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ]; diff --git a/silk/float/silk_inner_product_FLP.c b/silk/float/silk_inner_product_FLP.c index 80ad1f5dd3b84b93bda03d2bdc69f08fcfbbc2ce..55fbcf407acb11b3f519a843455c043f4e94b1ea 100644 --- a/silk/float/silk_inner_product_FLP.c +++ b/silk/float/silk_inner_product_FLP.c @@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. double silk_inner_product_FLP( /* O result */ const SKP_float *data1, /* I vector 1 */ const SKP_float *data2, /* I vector 2 */ - SKP_int dataSize /* I length of vectors */ + opus_int dataSize /* I length of vectors */ ) { - SKP_int i, dataSize4; + opus_int i, dataSize4; double result; /* 4x unrolled loop */ diff --git a/silk/float/silk_k2a_FLP.c b/silk/float/silk_k2a_FLP.c index 8aec7da78d563488ba23ecd5aded27a50784a4a2..eedcae4c9f6ae6f32bce969828cbcef23a50ba53 100644 --- a/silk/float/silk_k2a_FLP.c +++ b/silk/float/silk_k2a_FLP.c @@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_k2a_FLP( SKP_float *A, /* O: prediction coefficients [order] */ const SKP_float *rc, /* I: reflection coefficients [order] */ - SKP_int32 order /* I: prediction order */ + opus_int32 order /* I: prediction order */ ) { - SKP_int k, n; + opus_int k, n; SKP_float Atmp[ SILK_MAX_ORDER_LPC ]; for( k = 0; k < order; k++ ){ diff --git a/silk/float/silk_levinsondurbin_FLP.c b/silk/float/silk_levinsondurbin_FLP.c index b58a48a3da2f87a46e3003150c19e93e125ff9a7..b0bf862beb04b64aac84370c703fdf9c0f6144d2 100644 --- a/silk/float/silk_levinsondurbin_FLP.c +++ b/silk/float/silk_levinsondurbin_FLP.c @@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SKP_float silk_levinsondurbin_FLP( /* O prediction error energy */ SKP_float A[], /* O prediction coefficients [order] */ const SKP_float corr[], /* I input auto-correlations [order + 1] */ - const SKP_int order /* I prediction order */ + const opus_int order /* I prediction order */ ) { - SKP_int i, mHalf, m; + opus_int i, mHalf, m; SKP_float min_nrg, nrg, t, km, Atmp1, Atmp2; min_nrg = 1e-12f * corr[ 0 ] + 1e-9f; diff --git a/silk/float/silk_main_FLP.h b/silk/float/silk_main_FLP.h index d1f7021768dee4d8dd1545159bb6cd5a8b673b39..ccc552c8bd7ebe2ccab438b63be506961c8b06d0 100644 --- a/silk/float/silk_main_FLP.h +++ b/silk/float/silk_main_FLP.h @@ -51,13 +51,13 @@ extern "C" /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */ void silk_HP_variable_cutoff( silk_encoder_state_Fxx state_Fxx[], /* I/O Encoder states */ - const SKP_int nChannels /* I Number of channels */ + const opus_int nChannels /* I Number of channels */ ); /* Encoder main function */ -SKP_int silk_encode_frame_FLP( +opus_int silk_encode_frame_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ - SKP_int32 *pnBytesOut, /* O Number of payload bytes; */ + opus_int32 *pnBytesOut, /* O Number of payload bytes; */ ec_enc *psRangeEnc /* I/O compressor data structure */ ); @@ -69,17 +69,17 @@ void silk_LBRR_encode_FLP( ); /* Initializes the Silk encoder state */ -SKP_int silk_init_encoder( +opus_int silk_init_encoder( silk_encoder_state_FLP *psEnc /* I/O Encoder state FLP */ ); /* Control the Silk encoder */ -SKP_int silk_control_encoder( +opus_int silk_control_encoder( silk_encoder_state_FLP *psEnc, /* I/O Pointer to Silk encoder state FLP */ silk_EncControlStruct *encControl, /* I: Control structure */ - const SKP_int32 TargetRate_bps, /* I Target max bitrate (bps) */ - const SKP_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ - const SKP_int channelNb /* I Channel number */ + const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */ + const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ + const opus_int channelNb /* I Channel number */ ); /****************/ @@ -108,8 +108,8 @@ void silk_warped_autocorrelation_FLP( SKP_float *corr, /* O Result [order + 1] */ const SKP_float *input, /* I Input data to correlate */ const SKP_float warping, /* I Warping coefficient */ - const SKP_int length, /* I Length of input */ - const SKP_int order /* I Correlation order (even) */ + const opus_int length, /* I Length of input */ + const opus_int order /* I Correlation order (even) */ ); /* Calculation of LTP state scaling */ @@ -139,15 +139,15 @@ void silk_find_pred_coefs_FLP( /* LPC analysis */ void silk_find_LPC_FLP( - SKP_int16 NLSF_Q15[], /* O NLSFs */ - SKP_int8 *interpIndex, /* O NLSF interp. index for NLSF interp. */ - const SKP_int16 prev_NLSFq_Q15[], /* I Previous NLSFs, for NLSF interpolation */ - const SKP_int useInterpNLSFs, /* I Flag */ - const SKP_int firstFrameAfterReset, /* I Flag */ - const SKP_int LPC_order, /* I LPC order */ + opus_int16 NLSF_Q15[], /* O NLSFs */ + opus_int8 *interpIndex, /* O NLSF interp. index for NLSF interp. */ + const opus_int16 prev_NLSFq_Q15[], /* I Previous NLSFs, for NLSF interpolation */ + const opus_int useInterpNLSFs, /* I Flag */ + const opus_int firstFrameAfterReset, /* I Flag */ + const opus_int LPC_order, /* I LPC order */ const SKP_float x[], /* I Input signal */ - const SKP_int subfr_length, /* I Subframe length incl preceeding samples */ - const SKP_int nb_subfr /* I: Number of subframes */ + const opus_int subfr_length, /* I Subframe length incl preceeding samples */ + const opus_int nb_subfr /* I: Number of subframes */ ); /* LTP analysis */ @@ -156,22 +156,22 @@ void silk_find_LTP_FLP( SKP_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ SKP_float *LTPredCodGain, /* O LTP coding gain */ const SKP_float r_lpc[], /* I LPC residual */ - const SKP_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ + const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ const SKP_float Wght[ MAX_NB_SUBFR ], /* I Weights */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int mem_offset /* I Number of samples in LTP memory */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int mem_offset /* I Number of samples in LTP memory */ ); void silk_LTP_analysis_filter_FLP( SKP_float *LTP_res, /* O LTP res MAX_NB_SUBFR*(pre_lgth+subfr_lngth) */ const SKP_float *x, /* I Input signal, with preceeding samples */ const SKP_float B[ LTP_ORDER * MAX_NB_SUBFR ], /* I LTP coefficients for each subframe */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ const SKP_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ - const SKP_int subfr_length, /* I Length of each subframe */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int pre_length /* I Preceeding samples for each subframe */ + const opus_int subfr_length, /* I Length of each subframe */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int pre_length /* I Preceeding samples for each subframe */ ); /* Calculates residual energies of input subframes where all subframes have LPC_order */ @@ -181,9 +181,9 @@ void silk_residual_energy_FLP( const SKP_float x[], /* I Input signal */ SKP_float a[ 2 ][ MAX_LPC_ORDER ],/* I AR coefs for each frame half */ const SKP_float gains[], /* I Quantization gains */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int LPC_order /* I LPC order */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int LPC_order /* I LPC order */ ); /* 16th order LPC analysis filter */ @@ -191,19 +191,19 @@ void silk_LPC_analysis_filter_FLP( SKP_float r_LPC[], /* O LPC residual signal */ const SKP_float PredCoef[], /* I LPC coefficients */ const SKP_float s[], /* I Input signal */ - const SKP_int length, /* I Length of input signal */ - const SKP_int Order /* I LPC order */ + const opus_int length, /* I Length of input signal */ + const opus_int Order /* I LPC order */ ); /* LTP tap quantizer */ void silk_quant_LTP_gains_FLP( SKP_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un-)quantized LTP gains */ - SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook index */ - SKP_int8 *periodicity_index, /* O Periodicity index */ + opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook index */ + opus_int8 *periodicity_index, /* O Periodicity index */ const SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ - const SKP_int mu_Q10, /* I Mu value (R/D tradeoff) */ - const SKP_int lowComplexity, /* I Flag for low complexity */ - const SKP_int nb_subfr /* I number of subframes */ + const opus_int mu_Q10, /* I Mu value (R/D tradeoff) */ + const opus_int lowComplexity, /* I Flag for low complexity */ + const opus_int nb_subfr /* I number of subframes */ ); /******************/ @@ -213,8 +213,8 @@ void silk_quant_LTP_gains_FLP( void silk_process_NLSFs_FLP( silk_encoder_state *psEncC, /* I/O Encoder state */ SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ - SKP_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ - const SKP_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ + opus_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ + const opus_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ ); /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ @@ -223,19 +223,19 @@ SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual en SKP_float *wXX, /* I/O Weighted correlation matrix, reg. out */ const SKP_float *wXx, /* I Weighted correlation vector */ const SKP_float wxx, /* I Weighted correlation value */ - const SKP_int D /* I Dimension */ + const opus_int D /* I Dimension */ ); /* Entropy constrained MATRIX-weighted VQ, for a single input data vector */ void silk_VQ_WMat_EC_FLP( - SKP_int *ind, /* O Index of best codebook vector */ + opus_int *ind, /* O Index of best codebook vector */ SKP_float *rate_dist, /* O Best weighted quant. error + mu * rate */ const SKP_float *in, /* I Input vector to be quantized */ const SKP_float *W, /* I Weighting matrix */ - const SKP_int16 *cb, /* I Codebook */ - const SKP_int16 *cl_Q6, /* I Code length for each codebook vector */ + const opus_int16 *cb, /* I Codebook */ + const opus_int16 *cl_Q6, /* I Code length for each codebook vector */ const SKP_float mu, /* I Tradeoff between WSSE and rate */ - const SKP_int L /* I Number of vectors in codebook */ + const opus_int L /* I Number of vectors in codebook */ ); /* Processing of gains */ @@ -250,8 +250,8 @@ void silk_process_gains_FLP( /* Calculates correlation matrix X'*X */ void silk_corrMatrix_FLP( const SKP_float *x, /* I x vector [ L+order-1 ] used to create X */ - const SKP_int L, /* I Length of vectors */ - const SKP_int Order, /* I Max lag for correlation */ + const opus_int L, /* I Length of vectors */ + const opus_int Order, /* I Max lag for correlation */ SKP_float *XX /* O X'*X correlation matrix [order x order] */ ); @@ -259,8 +259,8 @@ void silk_corrMatrix_FLP( void silk_corrVector_FLP( const SKP_float *x, /* I x vector [L+order-1] used to create X */ const SKP_float *t, /* I Target vector [L] */ - const SKP_int L, /* I Length of vecors */ - const SKP_int Order, /* I Max lag for correlation */ + const opus_int L, /* I Length of vecors */ + const opus_int Order, /* I Max lag for correlation */ SKP_float *Xt /* O X'*t correlation vector [order] */ ); @@ -269,13 +269,13 @@ void silk_regularize_correlations_FLP( SKP_float *XX, /* I/O Correlation matrices */ SKP_float *xx, /* I/O Correlation values */ const SKP_float noise, /* I Noise energy to add */ - const SKP_int D /* I Dimension of XX */ + const opus_int D /* I Dimension of XX */ ); /* Function to solve linear equation Ax = b, where A is an MxM symmetric matrix */ void silk_solve_LDL_FLP( SKP_float *A, /* I/O Symmetric square matrix, out: reg. */ - const SKP_int M, /* I Size of matrix */ + const opus_int M, /* I Size of matrix */ const SKP_float *b, /* I Pointer to b vector */ SKP_float *x /* O Pointer to x solution vector */ ); @@ -287,24 +287,24 @@ void silk_solve_LDL_FLP( void silk_apply_sine_window_FLP( SKP_float px_win[], /* O Pointer to windowed signal */ const SKP_float px[], /* I Pointer to input signal */ - const SKP_int win_type, /* I Selects a window type */ - const SKP_int length /* I Window length, multiple of 4 */ + const opus_int win_type, /* I Selects a window type */ + const opus_int length /* I Window length, multiple of 4 */ ); /* Wrapper functions. Call flp / fix code */ /* Convert AR filter coefficients to NLSF parameters */ void silk_A2NLSF_FLP( - SKP_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ + opus_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ const SKP_float *pAR, /* I LPC coefficients [ LPC_order ] */ - const SKP_int LPC_order /* I LPC order */ + const opus_int LPC_order /* I LPC order */ ); /* Convert NLSF parameters to AR prediction filter coefficients */ void silk_NLSF2A_FLP( SKP_float *pAR, /* O LPC coefficients [ LPC_order ] */ - const SKP_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ - const SKP_int LPC_order /* I LPC order */ + const opus_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ + const opus_int LPC_order /* I LPC order */ ); /****************************************/ @@ -315,7 +315,7 @@ void silk_NSQ_wrapper_FLP( silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ SideInfoIndices *psIndices, /* I/O Quantization indices */ silk_nsq_state *psNSQ, /* I/O Noise Shaping Quantzation state */ - SKP_int8 pulses[], /* O Quantized pulse signal */ + opus_int8 pulses[], /* O Quantized pulse signal */ const SKP_float x[] /* I Prefiltered input signal */ ); diff --git a/silk/float/silk_noise_shape_analysis_FLP.c b/silk/float/silk_noise_shape_analysis_FLP.c index 4ff41c66212b27a91699245f37a120909726a633..271ee51e2fef66dbaa18ce5f76f1c94849055800 100644 --- a/silk/float/silk_noise_shape_analysis_FLP.c +++ b/silk/float/silk_noise_shape_analysis_FLP.c @@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SKP_INLINE SKP_float warped_gain( const SKP_float *coefs, SKP_float lambda, - SKP_int order + opus_int order ) { - SKP_int i; + opus_int i; SKP_float gain; lambda = -lambda; @@ -53,9 +53,9 @@ SKP_INLINE void warped_true2monic_coefs( SKP_float *coefs_ana, SKP_float lambda, SKP_float limit, - SKP_int order + opus_int order ) { - SKP_int i, iter, ind = 0; + opus_int i, iter, ind = 0; SKP_float tmp, maxabs, chirp, gain_syn, gain_ana; /* Convert to monic coefficients */ @@ -127,7 +127,7 @@ void silk_noise_shape_analysis_FLP( ) { silk_shape_state_FLP *psShapeSt = &psEnc->sShape; - SKP_int k, nSamples; + opus_int k, nSamples; SKP_float SNR_adj_dB, HarmBoost, HarmShapeGain, Tilt; SKP_float nrg, pre_nrg, log_energy, log_energy_prev, energy_variation; SKP_float delta, BWExp1, BWExp2, gain_mult, gain_add, strength, b, warping; @@ -223,7 +223,7 @@ void silk_noise_shape_analysis_FLP( /********************************************/ for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { /* Apply window: sine slope followed by flat part followed by cosine slope */ - SKP_int shift, slope_part, flat_part; + opus_int shift, slope_part, flat_part; flat_part = psEnc->sCmn.fs_kHz * 3; slope_part = ( psEnc->sCmn.shapeWinLength - flat_part ) / 2; diff --git a/silk/float/silk_pitch_analysis_core_FLP.c b/silk/float/silk_pitch_analysis_core_FLP.c index abcdfe27f2b84325dc8b34fb3d25cbbe01a29612..cc748667795be5ccc3880e38b73fcc9cb90848a2 100644 --- a/silk/float/silk_pitch_analysis_core_FLP.c +++ b/silk/float/silk_pitch_analysis_core_FLP.c @@ -47,65 +47,65 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. static void silk_P_Ana_calc_corr_st3( SKP_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ const SKP_float signal[], /* I vector to correlate */ - SKP_int start_lag, /* I start lag */ - SKP_int sf_length, /* I sub frame length */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int start_lag, /* I start lag */ + opus_int sf_length, /* I sub frame length */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ); static void silk_P_Ana_calc_energy_st3( SKP_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ const SKP_float signal[], /* I vector to correlate */ - SKP_int start_lag, /* I start lag */ - SKP_int sf_length, /* I sub frame length */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int start_lag, /* I start lag */ + opus_int sf_length, /* I sub frame length */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //% CORE PITCH ANALYSIS FUNCTION % //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */ +opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */ const SKP_float *signal, /* I signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ - SKP_int *pitch_out, /* O 4 pitch lag values */ - SKP_int16 *lagIndex, /* O lag Index */ - SKP_int8 *contourIndex, /* O pitch contour Index */ + opus_int *pitch_out, /* O 4 pitch lag values */ + opus_int16 *lagIndex, /* O lag Index */ + opus_int8 *contourIndex, /* O pitch contour Index */ SKP_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ - SKP_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */ + opus_int prevLag, /* I last lag of previous frame; set to zero is unvoiced */ const SKP_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */ const SKP_float search_thres2, /* I final threshold for lag candidates 0 - 1 */ - const SKP_int Fs_kHz, /* I sample frequency (kHz) */ - const SKP_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ - const SKP_int nb_subfr /* I number of 5 ms subframes */ + const opus_int Fs_kHz, /* I sample frequency (kHz) */ + const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ + const opus_int nb_subfr /* I number of 5 ms subframes */ ) { - SKP_int i, k, d, j; + opus_int i, k, d, j; SKP_float signal_8kHz[ PE_MAX_FRAME_LENGTH_MS * 8 ]; SKP_float signal_4kHz[ PE_MAX_FRAME_LENGTH_MS * 4 ]; - SKP_int16 signal_8_FIX[ PE_MAX_FRAME_LENGTH_MS * 8 ]; - SKP_int16 signal_4_FIX[ PE_MAX_FRAME_LENGTH_MS * 4 ]; - SKP_int32 filt_state[ 6 ]; + opus_int16 signal_8_FIX[ PE_MAX_FRAME_LENGTH_MS * 8 ]; + opus_int16 signal_4_FIX[ PE_MAX_FRAME_LENGTH_MS * 4 ]; + opus_int32 filt_state[ 6 ]; SKP_float threshold, contour_bias; SKP_float C[ PE_MAX_NB_SUBFR][ (PE_MAX_LAG >> 1) + 5 ]; SKP_float CC[ PE_NB_CBKS_STAGE2_EXT ]; const SKP_float *target_ptr, *basis_ptr; double cross_corr, normalizer, energy, energy_tmp; - SKP_int d_srch[ PE_D_SRCH_LENGTH ]; - SKP_int16 d_comp[ (PE_MAX_LAG >> 1) + 5 ]; - SKP_int length_d_srch, length_d_comp; + opus_int d_srch[ PE_D_SRCH_LENGTH ]; + opus_int16 d_comp[ (PE_MAX_LAG >> 1) + 5 ]; + opus_int length_d_srch, length_d_comp; SKP_float Cmax, CCmax, CCmax_b, CCmax_new_b, CCmax_new; - SKP_int CBimax, CBimax_new, lag, start_lag, end_lag, lag_new; - SKP_int cbk_size; + opus_int CBimax, CBimax_new, lag, start_lag, end_lag, lag_new; + opus_int cbk_size; SKP_float lag_log2, prevLag_log2, delta_lag_log2_sqr; SKP_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; SKP_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; - SKP_int lag_counter; - SKP_int frame_length, frame_length_8kHz, frame_length_4kHz; - SKP_int sf_length, sf_length_8kHz, sf_length_4kHz; - SKP_int min_lag, min_lag_8kHz, min_lag_4kHz; - SKP_int max_lag, max_lag_8kHz, max_lag_4kHz; - SKP_int nb_cbk_search; - const SKP_int8 *Lag_CB_ptr; + opus_int lag_counter; + opus_int frame_length, frame_length_8kHz, frame_length_4kHz; + opus_int sf_length, sf_length_8kHz, sf_length_4kHz; + opus_int min_lag, min_lag_8kHz, min_lag_4kHz; + opus_int max_lag, max_lag_8kHz, max_lag_4kHz; + opus_int nb_cbk_search; + const opus_int8 *Lag_CB_ptr; /* Check for valid sampling frequency */ SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); @@ -136,16 +136,16 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice /* Resample from input sampled at Fs_kHz to 8 kHz */ if( Fs_kHz == 16 ) { /* Resample to 16 -> 8 khz */ - SKP_int16 signal_16_FIX[ 16 * PE_MAX_FRAME_LENGTH_MS ]; + opus_int16 signal_16_FIX[ 16 * PE_MAX_FRAME_LENGTH_MS ]; SKP_float2short_array( signal_16_FIX, signal, frame_length ); - SKP_memset( filt_state, 0, 2 * sizeof( SKP_int32 ) ); + SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); silk_resampler_down2( filt_state, signal_8_FIX, signal_16_FIX, frame_length ); SKP_short2float_array( signal_8kHz, signal_8_FIX, frame_length_8kHz ); } else if( Fs_kHz == 12 ) { /* Resample to 12 -> 8 khz */ - SKP_int16 signal_12_FIX[ 12 * PE_MAX_FRAME_LENGTH_MS ]; + opus_int16 signal_12_FIX[ 12 * PE_MAX_FRAME_LENGTH_MS ]; SKP_float2short_array( signal_12_FIX, signal, frame_length ); - SKP_memset( filt_state, 0, 6 * sizeof( SKP_int32 ) ); + SKP_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); silk_resampler_down2_3( filt_state, signal_8_FIX, signal_12_FIX, frame_length ); SKP_short2float_array( signal_8kHz, signal_8_FIX, frame_length_8kHz ); } else { @@ -154,7 +154,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice } /* Decimate again to 4 kHz */ - SKP_memset( filt_state, 0, 2 * sizeof( SKP_int32 ) ); + SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); silk_resampler_down2( filt_state, signal_4_FIX, signal_8_FIX, frame_length_8kHz ); SKP_short2float_array( signal_4kHz, signal_4_FIX, frame_length_4kHz ); @@ -223,7 +223,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice } threshold = Cmax * Cmax; if( energy / 16.0f > threshold ) { - SKP_memset( pitch_out, 0, nb_subfr * sizeof( SKP_int ) ); + SKP_memset( pitch_out, 0, nb_subfr * sizeof( opus_int ) ); *LTPCorr = 0.0f; *lagIndex = 0; *contourIndex = 0; @@ -270,7 +270,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice length_d_comp = 0; for( i = min_lag_8kHz; i < max_lag_8kHz + 4; i++ ) { if( d_comp[ i ] > 0 ) { - d_comp[ length_d_comp ] = (SKP_int16)( i - 2 ); + d_comp[ length_d_comp ] = (opus_int16)( i - 2 ); length_d_comp++; } } @@ -385,7 +385,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice if( lag == -1 ) { /* No suitable candidate found */ - SKP_memset( pitch_out, 0, PE_MAX_NB_SUBFR * sizeof(SKP_int) ); + SKP_memset( pitch_out, 0, PE_MAX_NB_SUBFR * sizeof(opus_int) ); *LTPCorr = 0.0f; *lagIndex = 0; *contourIndex = 0; @@ -425,7 +425,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice /* Setup cbk parameters acording to complexity setting and frame length */ if( nb_subfr == PE_MAX_NB_SUBFR ) { - nb_cbk_search = (SKP_int)silk_nb_cbk_searchs_stage3[ complexity ]; + nb_cbk_search = (opus_int)silk_nb_cbk_searchs_stage3[ complexity ]; cbk_size = PE_NB_CBKS_STAGE3_MAX; Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ]; } else { @@ -451,7 +451,7 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice } if( CCmax_new > CCmax && - ( d + (SKP_int)silk_CB_lags_stage3[ 0 ][ j ] ) <= max_lag + ( d + (opus_int)silk_CB_lags_stage3[ 0 ][ j ] ) <= max_lag ) { CCmax = CCmax_new; lag_new = d; @@ -464,8 +464,8 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice for( k = 0; k < nb_subfr; k++ ) { pitch_out[ k ] = lag_new + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size ); } - *lagIndex = (SKP_int16)( lag_new - min_lag ); - *contourIndex = (SKP_int8)CBimax; + *lagIndex = (opus_int16)( lag_new - min_lag ); + *contourIndex = (opus_int8)CBimax; } else { /* Save Lags and correlation */ SKP_assert( CCmax >= 0.0f ); @@ -473,8 +473,8 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice for( k = 0; k < nb_subfr; k++ ) { pitch_out[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size ); } - *lagIndex = (SKP_int16)( lag - min_lag ); - *contourIndex = (SKP_int8)CBimax; + *lagIndex = (opus_int16)( lag - min_lag ); + *contourIndex = (opus_int8)CBimax; } SKP_assert( *lagIndex >= 0 ); /* return as voiced */ @@ -484,10 +484,10 @@ SKP_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoice static void silk_P_Ana_calc_corr_st3( SKP_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ const SKP_float signal[], /* I vector to correlate */ - SKP_int start_lag, /* I start lag */ - SKP_int sf_length, /* I sub frame length */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int start_lag, /* I start lag */ + opus_int sf_length, /* I sub frame length */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ) /*********************************************************************** Calculates the correlations used in stage 3 search. In order to cover @@ -504,10 +504,10 @@ static void silk_P_Ana_calc_corr_st3( **********************************************************************/ { const SKP_float *target_ptr, *basis_ptr; - SKP_int i, j, k, lag_counter, lag_low, lag_high; - SKP_int nb_cbk_search, delta, idx, cbk_size; + opus_int i, j, k, lag_counter, lag_low, lag_high; + opus_int nb_cbk_search, delta, idx, cbk_size; SKP_float scratch_mem[ SCRATCH_SIZE ]; - const SKP_int8 *Lag_range_ptr, *Lag_CB_ptr; + const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX ); SKP_assert( complexity <= SigProc_PE_MAX_COMPLEX ); @@ -557,10 +557,10 @@ static void silk_P_Ana_calc_corr_st3( static void silk_P_Ana_calc_energy_st3( SKP_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ const SKP_float signal[], /* I vector to correlate */ - SKP_int start_lag, /* I start lag */ - SKP_int sf_length, /* I sub frame length */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int start_lag, /* I start lag */ + opus_int sf_length, /* I sub frame length */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ) /**************************************************************** Calculate the energies for first two subframes. The energies are @@ -569,10 +569,10 @@ calculated recursively. { const SKP_float *target_ptr, *basis_ptr; double energy; - SKP_int k, i, j, lag_counter; - SKP_int nb_cbk_search, delta, idx, cbk_size, lag_diff; + opus_int k, i, j, lag_counter; + opus_int nb_cbk_search, delta, idx, cbk_size, lag_diff; SKP_float scratch_mem[ SCRATCH_SIZE ]; - const SKP_int8 *Lag_range_ptr, *Lag_CB_ptr; + const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX ); SKP_assert( complexity <= SigProc_PE_MAX_COMPLEX ); diff --git a/silk/float/silk_prefilter_FLP.c b/silk/float/silk_prefilter_FLP.c index 3a61c717d801e6087d7fb881c0a63f7519a1c635..e2534c294910907f76e2243b4e6723ac5926b296 100644 --- a/silk/float/silk_prefilter_FLP.c +++ b/silk/float/silk_prefilter_FLP.c @@ -39,8 +39,8 @@ SKP_INLINE void silk_prefilt_FLP( SKP_float Tilt, /* I */ SKP_float LF_MA_shp, /* I */ SKP_float LF_AR_shp, /* I */ - SKP_int lag, /* I */ - SKP_int length /* I */ + opus_int lag, /* I */ + opus_int length /* I */ ); void silk_warped_LPC_analysis_filter_FLP( @@ -49,11 +49,11 @@ void silk_warped_LPC_analysis_filter_FLP( const SKP_float coef[], /* I Coefficients [order] */ const SKP_float input[], /* I Input signal [length] */ const SKP_float lambda, /* I Warping factor */ - const SKP_int length, /* I Length of input signal */ - const SKP_int order /* I Filter order (even) */ + const opus_int length, /* I Length of input signal */ + const opus_int order /* I Filter order (even) */ ) { - SKP_int n, i; + opus_int n, i; SKP_float acc, tmp1, tmp2; /* Order must be even */ @@ -95,7 +95,7 @@ void silk_prefilter_FLP( ) { silk_prefilter_state_FLP *P = &psEnc->sPrefilt; - SKP_int j, k, lag; + opus_int j, k, lag; SKP_float HarmShapeGain, Tilt, LF_MA_shp, LF_AR_shp; SKP_float B[ 2 ]; const SKP_float *AR1_shp; @@ -157,12 +157,12 @@ SKP_INLINE void silk_prefilt_FLP( SKP_float Tilt, /* I */ SKP_float LF_MA_shp, /* I */ SKP_float LF_AR_shp, /* I */ - SKP_int lag, /* I */ - SKP_int length /* I */ + opus_int lag, /* I */ + opus_int length /* I */ ) { - SKP_int i; - SKP_int idx, LTP_shp_buf_idx; + opus_int i; + opus_int idx, LTP_shp_buf_idx; SKP_float n_Tilt, n_LF, n_LTP; SKP_float sLF_AR_shp, sLF_MA_shp; SKP_float *LTP_shp_buf; diff --git a/silk/float/silk_process_gains_FLP.c b/silk/float/silk_process_gains_FLP.c index 8f517dfa481821d441be9af7430d257ba261a639..e29721dbbac2c2c39aa93a129ff940d2770ba208 100644 --- a/silk/float/silk_process_gains_FLP.c +++ b/silk/float/silk_process_gains_FLP.c @@ -35,8 +35,8 @@ void silk_process_gains_FLP( ) { silk_shape_state_FLP *psShapeSt = &psEnc->sShape; - SKP_int k; - SKP_int32 pGains_Q16[ MAX_NB_SUBFR ]; + opus_int k; + opus_int32 pGains_Q16[ MAX_NB_SUBFR ]; SKP_float s, InvMaxSqrVal, gain, quant_offset; /* Gain reduction when LTP coding gain is high */ @@ -59,7 +59,7 @@ void silk_process_gains_FLP( /* Prepare gains for noise shaping quantization */ for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { - pGains_Q16[ k ] = ( SKP_int32 ) ( psEncCtrl->Gains[ k ] * 65536.0f ); + pGains_Q16[ k ] = ( opus_int32 ) ( psEncCtrl->Gains[ k ] * 65536.0f ); } /* Noise shaping quantization */ diff --git a/silk/float/silk_regularize_correlations_FLP.c b/silk/float/silk_regularize_correlations_FLP.c index dd5d036254451104647f45200a95e317e81c246c..111b1caaa5d0b1f89f4d19b2ed7fbc4a4dd13b06 100644 --- a/silk/float/silk_regularize_correlations_FLP.c +++ b/silk/float/silk_regularize_correlations_FLP.c @@ -31,10 +31,10 @@ void silk_regularize_correlations_FLP( SKP_float *XX, /* I/O Correlation matrices */ SKP_float *xx, /* I/O Correlation values */ const SKP_float noise, /* I Noise energy to add */ - const SKP_int D /* I Dimension of XX */ + const opus_int D /* I Dimension of XX */ ) { - SKP_int i; + opus_int i; for( i = 0; i < D; i++ ) { matrix_ptr( &XX[ 0 ], i, i, D ) += noise; diff --git a/silk/float/silk_residual_energy_FLP.c b/silk/float/silk_residual_energy_FLP.c index 192e57048dbf22a13b00e778804b7aee16978f6a..312a4c3ab7c5025b6750bdb85c61228010383c4f 100644 --- a/silk/float/silk_residual_energy_FLP.c +++ b/silk/float/silk_residual_energy_FLP.c @@ -36,10 +36,10 @@ SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual en SKP_float *wXX, /* I/O Weighted correlation matrix, reg. out */ const SKP_float *wXx, /* I Weighted correlation vector */ const SKP_float wxx, /* I Weighted correlation value */ - const SKP_int D /* I Dimension */ + const opus_int D /* I Dimension */ ) { - SKP_int i, j, k; + opus_int i, j, k; SKP_float tmp, nrg = 0.0f, regularization; /* Safety checks */ @@ -89,12 +89,12 @@ void silk_residual_energy_FLP( const SKP_float x[], /* I Input signal */ SKP_float a[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ const SKP_float gains[], /* I Quantization gains */ - const SKP_int subfr_length, /* I Subframe length */ - const SKP_int nb_subfr, /* I number of subframes */ - const SKP_int LPC_order /* I LPC order */ + const opus_int subfr_length, /* I Subframe length */ + const opus_int nb_subfr, /* I number of subframes */ + const opus_int LPC_order /* I LPC order */ ) { - SKP_int shift; + opus_int shift; SKP_float *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; LPC_res_ptr = LPC_res + LPC_order; diff --git a/silk/float/silk_scale_copy_vector_FLP.c b/silk/float/silk_scale_copy_vector_FLP.c index 3a9487a234138d9bc82fb6ff0136d446923891af..89f86c0736ddb37f3a9a7242df5f4e7d335ee9cd 100644 --- a/silk/float/silk_scale_copy_vector_FLP.c +++ b/silk/float/silk_scale_copy_vector_FLP.c @@ -32,10 +32,10 @@ void silk_scale_copy_vector_FLP( SKP_float *data_out, const SKP_float *data_in, SKP_float gain, - SKP_int dataSize + opus_int dataSize ) { - SKP_int i, dataSize4; + opus_int i, dataSize4; /* 4x unrolled loop */ dataSize4 = dataSize & 0xFFFC; diff --git a/silk/float/silk_scale_vector_FLP.c b/silk/float/silk_scale_vector_FLP.c index 457d738a7df6f976655887044aeb1c80d5673e68..83dba68844d3903e07c2119f106f3ac26da8e69b 100644 --- a/silk/float/silk_scale_vector_FLP.c +++ b/silk/float/silk_scale_vector_FLP.c @@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_scale_vector_FLP( SKP_float *data1, SKP_float gain, - SKP_int dataSize + opus_int dataSize ) { - SKP_int i, dataSize4; + opus_int i, dataSize4; /* 4x unrolled loop */ dataSize4 = dataSize & 0xFFFC; diff --git a/silk/float/silk_schur_FLP.c b/silk/float/silk_schur_FLP.c index 651e50da593b2e5bba6a9617573d06cf2b1f2f0f..887cc1711b12dcf6ae58353a7ba9570758557ae8 100644 --- a/silk/float/silk_schur_FLP.c +++ b/silk/float/silk_schur_FLP.c @@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SKP_float silk_schur_FLP( /* O returns residual energy */ SKP_float refl_coef[], /* O reflection coefficients (length order) */ const SKP_float auto_corr[], /* I autotcorrelation sequence (length order+1) */ - SKP_int order /* I order */ + opus_int order /* I order */ ) { - SKP_int k, n; + opus_int k, n; SKP_float C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; SKP_float Ctmp1, Ctmp2, rc_tmp; diff --git a/silk/float/silk_solve_LS_FLP.c b/silk/float/silk_solve_LS_FLP.c index 296d2ffc8c849125124768361e43dbca784c1f40..f9ac62eb8c61e206cab79165946e3bedb183711d 100644 --- a/silk/float/silk_solve_LS_FLP.c +++ b/silk/float/silk_solve_LS_FLP.c @@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********************************************************************/ void silk_LDL_FLP( SKP_float *A, /* (I/O) Pointer to Symetric Square Matrix */ - SKP_int M, /* (I) Size of Matrix */ + opus_int M, /* (I) Size of Matrix */ SKP_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */ SKP_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */ ); @@ -46,7 +46,7 @@ void silk_LDL_FLP( **********************************************************************/ void silk_SolveWithLowerTriangularWdiagOnes_FLP( const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ - SKP_int M, /* (I) Dim of Matrix equation */ + opus_int M, /* (I) Dim of Matrix equation */ const SKP_float *b, /* (I) b Vector */ SKP_float *x /* (O) x Vector */ ); @@ -57,7 +57,7 @@ void silk_SolveWithLowerTriangularWdiagOnes_FLP( **********************************************************************/ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ - SKP_int M, /* (I) Dim of Matrix equation */ + opus_int M, /* (I) Dim of Matrix equation */ const SKP_float *b, /* (I) b Vector */ SKP_float *x /* (O) x Vector */ ); @@ -68,12 +68,12 @@ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( **********************************************************************/ void silk_solve_LDL_FLP( SKP_float *A, /* I/O Symmetric square matrix, out: reg. */ - const SKP_int M, /* I Size of matrix */ + const opus_int M, /* I Size of matrix */ const SKP_float *b, /* I Pointer to b vector */ SKP_float *x /* O Pointer to x solution vector */ ) { - SKP_int i; + opus_int i; SKP_float L[ MAX_MATRIX_SIZE ][ MAX_MATRIX_SIZE ]; SKP_float T[ MAX_MATRIX_SIZE ]; SKP_float Dinv[ MAX_MATRIX_SIZE ]; // inverse diagonal elements of D @@ -107,12 +107,12 @@ void silk_solve_LDL_FLP( void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ - SKP_int M, /* (I) Dim of Matrix equation */ + opus_int M, /* (I) Dim of Matrix equation */ const SKP_float *b, /* (I) b Vector */ SKP_float *x /* (O) x Vector */ ) { - SKP_int i, j; + opus_int i, j; SKP_float temp; const SKP_float *ptr1; @@ -129,12 +129,12 @@ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( void silk_SolveWithLowerTriangularWdiagOnes_FLP( const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ - SKP_int M, /* (I) Dim of Matrix equation */ + opus_int M, /* (I) Dim of Matrix equation */ const SKP_float *b, /* (I) b Vector */ SKP_float *x /* (O) x Vector */ ) { - SKP_int i, j; + opus_int i, j; SKP_float temp; const SKP_float *ptr1; @@ -151,12 +151,12 @@ void silk_SolveWithLowerTriangularWdiagOnes_FLP( void silk_LDL_FLP( SKP_float *A, /* (I/O) Pointer to Symetric Square Matrix */ - SKP_int M, /* (I) Size of Matrix */ + opus_int M, /* (I) Size of Matrix */ SKP_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */ SKP_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */ ) { - SKP_int i, j, k, loop_count, err = 1; + opus_int i, j, k, loop_count, err = 1; SKP_float *ptr1, *ptr2; double temp, diag_min_value; SKP_float v[ MAX_MATRIX_SIZE ], D[ MAX_MATRIX_SIZE ]; // temp arrays diff --git a/silk/float/silk_sort_FLP.c b/silk/float/silk_sort_FLP.c index 7872fe28186468fee1ae4d0b4c44b5526aeca77c..fc791a93cd28270df48dee2de28ee276a59c1bc9 100644 --- a/silk/float/silk_sort_FLP.c +++ b/silk/float/silk_sort_FLP.c @@ -34,13 +34,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_insertion_sort_decreasing_FLP( SKP_float *a, /* I/O: Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ) { SKP_float value; - SKP_int i, j; + opus_int i, j; /* Safety checks */ SKP_assert( K > 0 ); diff --git a/silk/float/silk_structs_FLP.h b/silk/float/silk_structs_FLP.h index db72bba411fcd8305c9e5872c9dd0cee1000dede..aa47ed112bf54e602f93c421a5dd1514b2329b0a 100644 --- a/silk/float/silk_structs_FLP.h +++ b/silk/float/silk_structs_FLP.h @@ -41,7 +41,7 @@ extern "C" /* Noise shaping analysis state */ /********************************/ typedef struct { - SKP_int8 LastGainIndex; + opus_int8 LastGainIndex; SKP_float HarmBoost_smth; SKP_float HarmShapeGain_smth; SKP_float Tilt_smth; @@ -53,12 +53,12 @@ typedef struct { typedef struct { SKP_float sLTP_shp[ LTP_BUF_LENGTH ]; SKP_float sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ]; - SKP_int sLTP_shp_buf_idx; + opus_int sLTP_shp_buf_idx; SKP_float sLF_AR_shp; SKP_float sLF_MA_shp; SKP_float sHarmHP; - SKP_int32 rand_seed; - SKP_int lagPrev; + opus_int32 rand_seed; + opus_int lagPrev; } silk_prefilter_state_FLP; /********************************/ @@ -87,7 +87,7 @@ typedef struct { SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ]; /* holds interpolated and final coefficients */ SKP_float LTPCoef[LTP_ORDER * MAX_NB_SUBFR]; SKP_float LTP_scale; - SKP_int pitchL[ MAX_NB_SUBFR ]; + opus_int pitchL[ MAX_NB_SUBFR ]; /* Noise shaping parameters */ SKP_float AR1[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; @@ -115,11 +115,11 @@ typedef struct { typedef struct { silk_encoder_state_FLP state_Fxx[ ENCODER_NUM_CHANNELS ]; stereo_enc_state sStereo; - SKP_int32 nBitsExceeded; - SKP_int nChannelsAPI; - SKP_int nChannelsInternal; - SKP_int timeSinceSwitchAllowed_ms; - SKP_int allowBandwidthSwitch; + opus_int32 nBitsExceeded; + opus_int nChannelsAPI; + opus_int nChannelsInternal; + opus_int timeSinceSwitchAllowed_ms; + opus_int allowBandwidthSwitch; } silk_encoder; #ifdef __cplusplus diff --git a/silk/float/silk_warped_autocorrelation_FLP.c b/silk/float/silk_warped_autocorrelation_FLP.c index 402e2ecba8abe6600f863f988f48032a5d75eafc..92296c565943ef972462e956bca4ed987d78038d 100644 --- a/silk/float/silk_warped_autocorrelation_FLP.c +++ b/silk/float/silk_warped_autocorrelation_FLP.c @@ -32,11 +32,11 @@ void silk_warped_autocorrelation_FLP( SKP_float *corr, /* O Result [order + 1] */ const SKP_float *input, /* I Input data to correlate */ const SKP_float warping, /* I Warping coefficient */ - const SKP_int length, /* I Length of input */ - const SKP_int order /* I Correlation order (even) */ + const opus_int length, /* I Length of input */ + const opus_int order /* I Correlation order (even) */ ) { - SKP_int n, i; + opus_int n, i; double tmp1, tmp2; double state[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; double C[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; diff --git a/silk/float/silk_wrappers_FLP.c b/silk/float/silk_wrappers_FLP.c index 040d5d9c99dc759d2ed33f44001ed884163ee28b..f000e9d25a02187dfa6d611dc94c01a92932e272 100644 --- a/silk/float/silk_wrappers_FLP.c +++ b/silk/float/silk_wrappers_FLP.c @@ -31,13 +31,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Convert AR filter coefficients to NLSF parameters */ void silk_A2NLSF_FLP( - SKP_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ + opus_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ const SKP_float *pAR, /* I LPC coefficients [ LPC_order ] */ - const SKP_int LPC_order /* I LPC order */ + const opus_int LPC_order /* I LPC order */ ) { - SKP_int i; - SKP_int32 a_fix_Q16[ MAX_LPC_ORDER ]; + opus_int i; + opus_int32 a_fix_Q16[ MAX_LPC_ORDER ]; for( i = 0; i < LPC_order; i++ ) { a_fix_Q16[ i ] = SKP_float2int( pAR[ i ] * 65536.0f ); @@ -49,12 +49,12 @@ void silk_A2NLSF_FLP( /* Convert LSF parameters to AR prediction filter coefficients */ void silk_NLSF2A_FLP( SKP_float *pAR, /* O LPC coefficients [ LPC_order ] */ - const SKP_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ - const SKP_int LPC_order /* I LPC order */ + const opus_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ + const opus_int LPC_order /* I LPC order */ ) { - SKP_int i; - SKP_int16 a_fix_Q12[ MAX_LPC_ORDER ]; + opus_int i; + opus_int16 a_fix_Q12[ MAX_LPC_ORDER ]; silk_NLSF2A( a_fix_Q12, NLSF_Q15, LPC_order ); @@ -69,12 +69,12 @@ void silk_NLSF2A_FLP( void silk_process_NLSFs_FLP( silk_encoder_state *psEncC, /* I/O Encoder state */ SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ - SKP_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ - const SKP_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ + opus_int16 NLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ + const opus_int16 prev_NLSF_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ ) { - SKP_int i, j; - SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; + opus_int i, j; + opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; silk_process_NLSFs( psEncC, PredCoef_Q12, NLSF_Q15, prev_NLSF_Q15); @@ -93,23 +93,23 @@ void silk_NSQ_wrapper_FLP( silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ SideInfoIndices *psIndices, /* I/O Quantization indices */ silk_nsq_state *psNSQ, /* I/O Noise Shaping Quantzation state */ - SKP_int8 pulses[], /* O Quantized pulse signal */ + opus_int8 pulses[], /* O Quantized pulse signal */ const SKP_float x[] /* I Prefiltered input signal */ ) { - SKP_int i, j; - SKP_int16 x_16[ MAX_FRAME_LENGTH ]; - SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; - SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; - SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; - SKP_int LTP_scale_Q14; + opus_int i, j; + opus_int16 x_16[ MAX_FRAME_LENGTH ]; + opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; + SKP_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; + opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; + opus_int LTP_scale_Q14; /* Noise shaping parameters */ - SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; - SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */ - SKP_int Lambda_Q10; - SKP_int Tilt_Q14[ MAX_NB_SUBFR ]; - SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; + opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; + opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */ + opus_int Lambda_Q10; + opus_int Tilt_Q14[ MAX_NB_SUBFR ]; + opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; /* Convert control struct to fix control struct */ /* Noise shape parameters */ @@ -121,20 +121,20 @@ void silk_NSQ_wrapper_FLP( for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { LF_shp_Q14[ i ] = SKP_LSHIFT32( SKP_float2int( psEncCtrl->LF_AR_shp[ i ] * 16384.0f ), 16 ) | - (SKP_uint16)SKP_float2int( psEncCtrl->LF_MA_shp[ i ] * 16384.0f ); - Tilt_Q14[ i ] = (SKP_int)SKP_float2int( psEncCtrl->Tilt[ i ] * 16384.0f ); - HarmShapeGain_Q14[ i ] = (SKP_int)SKP_float2int( psEncCtrl->HarmShapeGain[ i ] * 16384.0f ); + (opus_uint16)SKP_float2int( psEncCtrl->LF_MA_shp[ i ] * 16384.0f ); + Tilt_Q14[ i ] = (opus_int)SKP_float2int( psEncCtrl->Tilt[ i ] * 16384.0f ); + HarmShapeGain_Q14[ i ] = (opus_int)SKP_float2int( psEncCtrl->HarmShapeGain[ i ] * 16384.0f ); } - Lambda_Q10 = ( SKP_int )SKP_float2int( psEncCtrl->Lambda * 1024.0f ); + Lambda_Q10 = ( opus_int )SKP_float2int( psEncCtrl->Lambda * 1024.0f ); /* prediction and coding parameters */ for( i = 0; i < psEnc->sCmn.nb_subfr * LTP_ORDER; i++ ) { - LTPCoef_Q14[ i ] = ( SKP_int16 )SKP_float2int( psEncCtrl->LTPCoef[ i ] * 16384.0f ); + LTPCoef_Q14[ i ] = ( opus_int16 )SKP_float2int( psEncCtrl->LTPCoef[ i ] * 16384.0f ); } for( j = 0; j < 2; j++ ) { for( i = 0; i < psEnc->sCmn.predictLPCOrder; i++ ) { - PredCoef_Q12[ j ][ i ] = ( SKP_int16 )SKP_float2int( psEncCtrl->PredCoef[ j ][ i ] * 4096.0f ); + PredCoef_Q12[ j ][ i ] = ( opus_int16 )SKP_float2int( psEncCtrl->PredCoef[ j ][ i ] * 4096.0f ); } } @@ -167,23 +167,23 @@ void silk_NSQ_wrapper_FLP( /***********************************************/ void silk_quant_LTP_gains_FLP( SKP_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un-)quantized LTP gains */ - SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook index */ - SKP_int8 *periodicity_index, /* O Periodicity index */ + opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook index */ + opus_int8 *periodicity_index, /* O Periodicity index */ const SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ - const SKP_int mu_Q10, /* I Mu value (R/D tradeoff) */ - const SKP_int lowComplexity, /* I Flag for low complexity */ - const SKP_int nb_subfr /* I number of subframes */ + const opus_int mu_Q10, /* I Mu value (R/D tradeoff) */ + const opus_int lowComplexity, /* I Flag for low complexity */ + const opus_int nb_subfr /* I number of subframes */ ) { - SKP_int i; - SKP_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ]; - SKP_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ]; + opus_int i; + opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ]; + opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ]; for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { - B_Q14[ i ] = (SKP_int16)SKP_float2int( B[ i ] * 16384.0f ); + B_Q14[ i ] = (opus_int16)SKP_float2int( B[ i ] * 16384.0f ); } for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) { - W_Q18[ i ] = (SKP_int32)SKP_float2int( W[ i ] * 262144.0f ); + W_Q18[ i ] = (opus_int32)SKP_float2int( W[ i ] * 262144.0f ); } silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, W_Q18, mu_Q10, lowComplexity, nb_subfr ); diff --git a/silk/silk_A2NLSF.c b/silk/silk_A2NLSF.c index a2257dc9f973e5c0402329e6346a4d243338fcc1..de8f360878e8651a3988ef563b9fe60dd27a9d20 100644 --- a/silk/silk_A2NLSF.c +++ b/silk/silk_A2NLSF.c @@ -45,11 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Helper function for A2NLSF(..) */ /* Transforms polynomials from cos(n*f) to cos(f)^n */ SKP_INLINE void silk_A2NLSF_trans_poly( - SKP_int32 *p, /* I/O Polynomial */ - const SKP_int dd /* I Polynomial order (= filter order / 2 ) */ + opus_int32 *p, /* I/O Polynomial */ + const opus_int dd /* I Polynomial order (= filter order / 2 ) */ ) { - SKP_int k, n; + opus_int k, n; for( k = 2; k <= dd; k++ ) { for( n = dd; n > k; n-- ) { @@ -60,14 +60,14 @@ SKP_INLINE void silk_A2NLSF_trans_poly( } /* Helper function for A2NLSF(..) */ /* Polynomial evaluation */ -SKP_INLINE SKP_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in QPoly */ - SKP_int32 *p, /* I Polynomial, QPoly */ - const SKP_int32 x, /* I Evaluation point, Q12 */ - const SKP_int dd /* I Order */ +SKP_INLINE opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in QPoly */ + opus_int32 *p, /* I Polynomial, QPoly */ + const opus_int32 x, /* I Evaluation point, Q12 */ + const opus_int dd /* I Order */ ) { - SKP_int n; - SKP_int32 x_Q16, y32; + opus_int n; + opus_int32 x_Q16, y32; y32 = p[ dd ]; /* QPoly */ x_Q16 = SKP_LSHIFT( x, 4 ); @@ -78,13 +78,13 @@ SKP_INLINE SKP_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluati } SKP_INLINE void silk_A2NLSF_init( - const SKP_int32 *a_Q16, - SKP_int32 *P, - SKP_int32 *Q, - const SKP_int dd + const opus_int32 *a_Q16, + opus_int32 *P, + opus_int32 *Q, + const opus_int dd ) { - SKP_int k; + opus_int k; /* Convert filter coefs to even and odd polynomials */ P[dd] = SKP_LSHIFT( 1, QPoly ); @@ -118,19 +118,19 @@ SKP_INLINE void silk_A2NLSF_init( /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */ /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */ void silk_A2NLSF( - SKP_int16 *NLSF, /* O Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */ - SKP_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */ - const SKP_int d /* I Filter order (must be even) */ + opus_int16 *NLSF, /* O Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */ + opus_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */ + const opus_int d /* I Filter order (must be even) */ ) { - SKP_int i, k, m, dd, root_ix, ffrac; - SKP_int32 xlo, xhi, xmid; - SKP_int32 ylo, yhi, ymid; - SKP_int32 nom, den; - SKP_int32 P[ SILK_MAX_ORDER_LPC / 2 + 1 ]; - SKP_int32 Q[ SILK_MAX_ORDER_LPC / 2 + 1 ]; - SKP_int32 *PQ[ 2 ]; - SKP_int32 *p; + opus_int i, k, m, dd, root_ix, ffrac; + opus_int32 xlo, xhi, xmid; + opus_int32 ylo, yhi, ymid; + opus_int32 nom, den; + opus_int32 P[ SILK_MAX_ORDER_LPC / 2 + 1 ]; + opus_int32 Q[ SILK_MAX_ORDER_LPC / 2 + 1 ]; + opus_int32 *PQ[ 2 ]; + opus_int32 *p; /* Store pointers to array */ PQ[ 0 ] = P; @@ -211,9 +211,9 @@ void silk_A2NLSF( ffrac += SKP_DIV32( ylo, SKP_RSHIFT( ylo - yhi, 8 - BIN_DIV_STEPS_A2NLSF_FIX ) ); } #if OVERSAMPLE_COSINE_TABLE - NLSF[ root_ix ] = (SKP_int16)SKP_min_32( SKP_LSHIFT( (SKP_int32)k, 7 ) + ffrac, SKP_int16_MAX ); + NLSF[ root_ix ] = (opus_int16)SKP_min_32( SKP_LSHIFT( (opus_int32)k, 7 ) + ffrac, SKP_int16_MAX ); #else - NLSF[ root_ix ] = (SKP_int16)SKP_min_32( SKP_LSHIFT( (SKP_int32)k, 8 ) + ffrac, SKP_int16_MAX ); + NLSF[ root_ix ] = (opus_int16)SKP_min_32( SKP_LSHIFT( (opus_int32)k, 8 ) + ffrac, SKP_int16_MAX ); #endif SKP_assert( NLSF[ root_ix ] >= 0 ); @@ -250,9 +250,9 @@ void silk_A2NLSF( i++; if( i > MAX_ITERATIONS_A2NLSF_FIX ) { /* Set NLSFs to white spectrum and exit */ - NLSF[ 0 ] = (SKP_int16)SKP_DIV32_16( 1 << 15, d + 1 ); + NLSF[ 0 ] = (opus_int16)SKP_DIV32_16( 1 << 15, d + 1 ); for( k = 1; k < d; k++ ) { - NLSF[ k ] = (SKP_int16)SKP_SMULBB( k + 1, NLSF[ 0 ] ); + NLSF[ k ] = (opus_int16)SKP_SMULBB( k + 1, NLSF[ 0 ] ); } return; } diff --git a/silk/silk_API.h b/silk/silk_API.h index 24c530a6c9b52541d03f7591252a98b85dfaf25b..1d00dc9c57f4f562c471bf9cd760d9279dfc1d11 100644 --- a/silk/silk_API.h +++ b/silk/silk_API.h @@ -43,9 +43,9 @@ extern "C" /* Struct for TOC (Table of Contents) */ typedef struct { - SKP_int VADFlag; /* Voice activity for packet */ - SKP_int VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet */ - SKP_int inbandFECFlag; /* Flag indicating if packet contains in-band FEC */ + opus_int VADFlag; /* Voice activity for packet */ + opus_int VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet */ + opus_int inbandFECFlag; /* Flag indicating if packet contains in-band FEC */ } silk_TOC_struct; /****************************************/ @@ -55,14 +55,14 @@ typedef struct { /***********************************************/ /* Get size in bytes of the Silk encoder state */ /***********************************************/ -SKP_int silk_Get_Encoder_Size( /* O: Returns error code */ - SKP_int32 *encSizeBytes /* O: Number of bytes in SILK encoder state */ +opus_int silk_Get_Encoder_Size( /* O: Returns error code */ + opus_int32 *encSizeBytes /* O: Number of bytes in SILK encoder state */ ); /*************************/ /* Init or reset encoder */ /*************************/ -SKP_int silk_InitEncoder( /* O: Returns error code */ +opus_int silk_InitEncoder( /* O: Returns error code */ void *encState, /* I/O: State */ silk_EncControlStruct *encStatus /* O: Encoder Status */ ); @@ -70,7 +70,7 @@ SKP_int silk_InitEncoder( /* O: Returns error co /***************************************/ /* Read control structure from encoder */ /***************************************/ -SKP_int silk_QueryEncoder( /* O: Returns error code */ +opus_int silk_QueryEncoder( /* O: Returns error code */ const void *encState, /* I: State */ silk_EncControlStruct *encStatus /* O: Encoder Status */ ); @@ -80,14 +80,14 @@ SKP_int silk_QueryEncoder( /* O: Returns error co /**************************/ /* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what */ /* encControl->payloadSize_ms is set to */ -SKP_int silk_Encode( /* O: Returns error code */ +opus_int silk_Encode( /* O: Returns error code */ void *encState, /* I/O: State */ silk_EncControlStruct *encControl, /* I: Control status */ - const SKP_int16 *samplesIn, /* I: Speech sample input vector */ - SKP_int nSamplesIn, /* I: Number of samples in input vector */ + const opus_int16 *samplesIn, /* I: Speech sample input vector */ + opus_int nSamplesIn, /* I: Number of samples in input vector */ ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int32 *nBytesOut, /* I/O: Number of bytes in payload (input: Max bytes) */ - const SKP_int prefillFlag /* I: Flag to indicate prefilling buffers no coding */ + opus_int32 *nBytesOut, /* I/O: Number of bytes in payload (input: Max bytes) */ + const opus_int prefillFlag /* I: Flag to indicate prefilling buffers no coding */ ); /****************************************/ @@ -97,37 +97,37 @@ SKP_int silk_Encode( /* O: Returns error co /***********************************************/ /* Get size in bytes of the Silk decoder state */ /***********************************************/ -SKP_int silk_Get_Decoder_Size( /* O: Returns error code */ - SKP_int32 *decSizeBytes /* O: Number of bytes in SILK decoder state */ +opus_int silk_Get_Decoder_Size( /* O: Returns error code */ + opus_int32 *decSizeBytes /* O: Number of bytes in SILK decoder state */ ); /*************************/ /* Init or Reset decoder */ /*************************/ -SKP_int silk_InitDecoder( /* O: Returns error code */ +opus_int silk_InitDecoder( /* O: Returns error code */ void *decState /* I/O: State */ ); /******************/ /* Decode a frame */ /******************/ -SKP_int silk_Decode( /* O: Returns error code */ +opus_int silk_Decode( /* O: Returns error code */ void* decState, /* I/O: State */ silk_DecControlStruct* decControl, /* I/O: Control Structure */ - SKP_int lostFlag, /* I: 0: no loss, 1 loss, 2 decode fec */ - SKP_int newPacketFlag, /* I: Indicates first decoder call for this packet */ + opus_int lostFlag, /* I: 0: no loss, 1 loss, 2 decode fec */ + opus_int newPacketFlag, /* I: Indicates first decoder call for this packet */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int16 *samplesOut, /* O: Decoded output speech vector */ - SKP_int32 *nSamplesOut /* O: Number of samples decoded */ + opus_int16 *samplesOut, /* O: Decoded output speech vector */ + opus_int32 *nSamplesOut /* O: Number of samples decoded */ ); /**************************************/ /* Get table of contents for a packet */ /**************************************/ -SKP_int silk_get_TOC( - const SKP_uint8 *payload, /* I Payload data */ - const SKP_int nBytesIn, /* I: Number of input bytes */ - const SKP_int nFramesPerPayload, /* I: Number of SILK frames per payload */ +opus_int silk_get_TOC( + const opus_uint8 *payload, /* I Payload data */ + const opus_int nBytesIn, /* I: Number of input bytes */ + const opus_int nFramesPerPayload, /* I: Number of SILK frames per payload */ silk_TOC_struct *Silk_TOC /* O: Type of content */ ); diff --git a/silk/silk_CNG.c b/silk/silk_CNG.c index eb8654f34da5f5853335ba73b704025cfb83d53c..5183a0045de2536698529afcb9401c4333ba291e 100644 --- a/silk/silk_CNG.c +++ b/silk/silk_CNG.c @@ -29,15 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Generates excitation for CNG LPC synthesis */ SKP_INLINE void silk_CNG_exc( - SKP_int32 residual_Q10[], /* O CNG residual signal Q10 */ - SKP_int32 exc_buf_Q10[], /* I Random samples buffer Q10 */ - SKP_int32 Gain_Q16, /* I Gain to apply */ - SKP_int length, /* I Length */ - SKP_int32 *rand_seed /* I/O Seed to random index generator */ + opus_int32 residual_Q10[], /* O CNG residual signal Q10 */ + opus_int32 exc_buf_Q10[], /* I Random samples buffer Q10 */ + opus_int32 Gain_Q16, /* I Gain to apply */ + opus_int length, /* I Length */ + opus_int32 *rand_seed /* I/O Seed to random index generator */ ) { - SKP_int32 seed; - SKP_int i, idx, exc_mask; + opus_int32 seed; + opus_int i, idx, exc_mask; exc_mask = CNG_BUF_MASK_MAX; while( exc_mask > length ) { @@ -47,10 +47,10 @@ SKP_INLINE void silk_CNG_exc( seed = *rand_seed; for( i = 0; i < length; i++ ) { seed = SKP_RAND( seed ); - idx = ( SKP_int )( SKP_RSHIFT( seed, 24 ) & exc_mask ); + idx = ( opus_int )( SKP_RSHIFT( seed, 24 ) & exc_mask ); SKP_assert( idx >= 0 ); SKP_assert( idx <= CNG_BUF_MASK_MAX ); - residual_Q10[ i ] = ( SKP_int16 )SKP_SAT16( SKP_SMULWW( exc_buf_Q10[ idx ], Gain_Q16 ) ); + residual_Q10[ i ] = ( opus_int16 )SKP_SAT16( SKP_SMULWW( exc_buf_Q10[ idx ], Gain_Q16 ) ); } *rand_seed = seed; } @@ -59,7 +59,7 @@ void silk_CNG_Reset( silk_decoder_state *psDec /* I/O Decoder state */ ) { - SKP_int i, NLSF_step_Q15, NLSF_acc_Q15; + opus_int i, NLSF_step_Q15, NLSF_acc_Q15; NLSF_step_Q15 = SKP_DIV32_16( SKP_int16_MAX, psDec->LPC_order + 1 ); NLSF_acc_Q15 = 0; @@ -75,14 +75,14 @@ void silk_CNG_Reset( void silk_CNG( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* I/O Signal */ - SKP_int length /* I Length of residual */ + opus_int16 signal[], /* I/O Signal */ + opus_int length /* I Length of residual */ ) { - SKP_int i, j, subfr; - SKP_int32 sum_Q6, max_Gain_Q16; - SKP_int16 A_Q12[ MAX_LPC_ORDER ]; - SKP_int32 CNG_sig_Q10[ MAX_FRAME_LENGTH + MAX_LPC_ORDER ]; + opus_int i, j, subfr; + opus_int32 sum_Q6, max_Gain_Q16; + opus_int16 A_Q12[ MAX_LPC_ORDER ]; + opus_int32 CNG_sig_Q10[ MAX_FRAME_LENGTH + MAX_LPC_ORDER ]; silk_CNG_struct *psCNG = &psDec->sCNG; if( psDec->fs_kHz != psCNG->fs_kHz ) { @@ -108,8 +108,8 @@ void silk_CNG( } } /* Update CNG excitation buffer with excitation from this subframe */ - SKP_memmove( &psCNG->CNG_exc_buf_Q10[ psDec->subfr_length ], psCNG->CNG_exc_buf_Q10, ( psDec->nb_subfr - 1 ) * psDec->subfr_length * sizeof( SKP_int32 ) ); - SKP_memcpy( psCNG->CNG_exc_buf_Q10, &psDec->exc_Q10[ subfr * psDec->subfr_length ], psDec->subfr_length * sizeof( SKP_int32 ) ); + SKP_memmove( &psCNG->CNG_exc_buf_Q10[ psDec->subfr_length ], psCNG->CNG_exc_buf_Q10, ( psDec->nb_subfr - 1 ) * psDec->subfr_length * sizeof( opus_int32 ) ); + SKP_memcpy( psCNG->CNG_exc_buf_Q10, &psDec->exc_Q10[ subfr * psDec->subfr_length ], psDec->subfr_length * sizeof( opus_int32 ) ); /* Smooth gains */ for( i = 0; i < psDec->nb_subfr; i++ ) { @@ -127,7 +127,7 @@ void silk_CNG( silk_NLSF2A( A_Q12, psCNG->CNG_smth_NLSF_Q15, psDec->LPC_order ); /* Generate CNG signal, by synthesis filtering */ - SKP_memcpy( CNG_sig_Q10, psCNG->CNG_synth_state, MAX_LPC_ORDER * sizeof( SKP_int32 ) ); + SKP_memcpy( CNG_sig_Q10, psCNG->CNG_synth_state, MAX_LPC_ORDER * sizeof( opus_int32 ) ); for( i = 0; i < length; i++ ) { /* Partially unrolled */ sum_Q6 = SKP_SMULWB( CNG_sig_Q10[ MAX_LPC_ORDER + i - 1 ], A_Q12[ 0 ] ); @@ -149,8 +149,8 @@ void silk_CNG( signal[ i ] = SKP_ADD_SAT16( signal[ i ], SKP_RSHIFT_ROUND( sum_Q6, 6 ) ); } - SKP_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q10[ length ], MAX_LPC_ORDER * sizeof( SKP_int32 ) ); + SKP_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q10[ length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); } else { - SKP_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( SKP_int32 ) ); + SKP_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( opus_int32 ) ); } } diff --git a/silk/silk_HP_variable_cutoff.c b/silk/silk_HP_variable_cutoff.c index 22aac367174f64a1aa83c3e36fbc2b578eeea301..0345529f607f5d6ca9c77106d8dfbf9a3fff9bed 100644 --- a/silk/silk_HP_variable_cutoff.c +++ b/silk/silk_HP_variable_cutoff.c @@ -38,13 +38,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */ void silk_HP_variable_cutoff( silk_encoder_state_Fxx state_Fxx[], /* I/O Encoder states */ - const SKP_int nChannels /* I Number of channels */ + const opus_int nChannels /* I Number of channels */ ) { - SKP_int quality_Q15, cutoff_Hz; - SKP_int32 B_Q28[ 3 ], A_Q28[ 2 ]; - SKP_int32 Fc_Q19, r_Q28, r_Q22; - SKP_int32 pitch_freq_Hz_Q16, pitch_freq_log_Q7, delta_freq_Q7; + opus_int quality_Q15, cutoff_Hz; + opus_int32 B_Q28[ 3 ], A_Q28[ 2 ]; + opus_int32 Fc_Q19, r_Q28, r_Q22; + opus_int32 pitch_freq_Hz_Q16, pitch_freq_log_Q7, delta_freq_Q7; silk_encoder_state *psEncC1 = &state_Fxx[ 0 ].sCmn; if( psEncC1->HP_cutoff_Hz == 0 ) { diff --git a/silk/silk_Inlines.h b/silk/silk_Inlines.h index 5df42de885c56f71cb206e6991fda5b50d40a306..0921b4e3435e51031f208183ac8783a50f13afd2 100644 --- a/silk/silk_Inlines.h +++ b/silk/silk_Inlines.h @@ -37,15 +37,15 @@ extern "C" { #endif -/* count leading zeros of SKP_int64 */ -SKP_INLINE SKP_int32 silk_CLZ64(SKP_int64 in) +/* count leading zeros of opus_int64 */ +SKP_INLINE opus_int32 silk_CLZ64(opus_int64 in) { - SKP_int32 in_upper; + opus_int32 in_upper; - in_upper = (SKP_int32)SKP_RSHIFT64(in, 32); + in_upper = (opus_int32)SKP_RSHIFT64(in, 32); if (in_upper == 0) { /* Search in the lower 32 bits */ - return 32 + silk_CLZ32( (SKP_int32) in ); + return 32 + silk_CLZ32( (opus_int32) in ); } else { /* Search in the upper 32 bits */ return silk_CLZ32( in_upper ); @@ -53,11 +53,11 @@ SKP_INLINE SKP_int32 silk_CLZ64(SKP_int64 in) } /* get number of leading zeros and fractional part (the bits right after the leading one */ -SKP_INLINE void silk_CLZ_FRAC(SKP_int32 in, /* I: input */ - SKP_int32 *lz, /* O: number of leading zeros */ - SKP_int32 *frac_Q7) /* O: the 7 bits right after the leading one */ +SKP_INLINE void silk_CLZ_FRAC(opus_int32 in, /* I: input */ + opus_int32 *lz, /* O: number of leading zeros */ + opus_int32 *frac_Q7) /* O: the 7 bits right after the leading one */ { - SKP_int32 lzeros = silk_CLZ32(in); + opus_int32 lzeros = silk_CLZ32(in); * lz = lzeros; * frac_Q7 = silk_ROR32(in, 24 - lzeros) & 0x7f; @@ -66,9 +66,9 @@ SKP_INLINE void silk_CLZ_FRAC(SKP_int32 in, /* I: input */ /* Approximation of square root */ /* Accuracy: < +/- 10% for output values > 15 */ /* < +/- 2.5% for output values > 120 */ -SKP_INLINE SKP_int32 silk_SQRT_APPROX(SKP_int32 x) +SKP_INLINE opus_int32 silk_SQRT_APPROX(opus_int32 x) { - SKP_int32 y, lz, frac_Q7; + opus_int32 y, lz, frac_Q7; if( x <= 0 ) { return 0; @@ -92,14 +92,14 @@ SKP_INLINE SKP_int32 silk_SQRT_APPROX(SKP_int32 x) } /* Divide two int32 values and return result as int32 in a given Q-domain */ -SKP_INLINE SKP_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */ - const SKP_int32 a32, /* I numerator (Q0) */ - const SKP_int32 b32, /* I denominator (Q0) */ - const SKP_int Qres /* I Q-domain of result (>= 0) */ +SKP_INLINE opus_int32 silk_DIV32_varQ( /* O returns a good approximation of "(a32 << Qres) / b32" */ + const opus_int32 a32, /* I numerator (Q0) */ + const opus_int32 b32, /* I denominator (Q0) */ + const opus_int Qres /* I Q-domain of result (>= 0) */ ) { - SKP_int a_headrm, b_headrm, lshift; - SKP_int32 b32_inv, a32_nrm, b32_nrm, result; + opus_int a_headrm, b_headrm, lshift; + opus_int32 b32_inv, a32_nrm, b32_nrm, result; SKP_assert( b32 != 0 ); SKP_assert( Qres >= 0 ); @@ -137,13 +137,13 @@ SKP_INLINE SKP_int32 silk_DIV32_varQ( /* O returns a good approximation of } /* Invert int32 value and return result as int32 in a given Q-domain */ -SKP_INLINE SKP_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */ - const SKP_int32 b32, /* I denominator (Q0) */ - const SKP_int Qres /* I Q-domain of result (> 0) */ +SKP_INLINE opus_int32 silk_INVERSE32_varQ( /* O returns a good approximation of "(1 << Qres) / b32" */ + const opus_int32 b32, /* I denominator (Q0) */ + const opus_int Qres /* I Q-domain of result (> 0) */ ) { - SKP_int b_headrm, lshift; - SKP_int32 b32_inv, b32_nrm, err_Q32, result; + opus_int b_headrm, lshift; + opus_int32 b32_inv, b32_nrm, err_Q32, result; SKP_assert( b32 != 0 ); SKP_assert( Qres > 0 ); diff --git a/silk/silk_LPC_analysis_filter.c b/silk/silk_LPC_analysis_filter.c index 2655b4e1dda029948a3b4653043b8ec9165b461c..86a7aaa54073dc1f8510096b9ba052b99610a068 100644 --- a/silk/silk_LPC_analysis_filter.c +++ b/silk/silk_LPC_analysis_filter.c @@ -35,16 +35,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*******************************************/ void silk_LPC_analysis_filter( - SKP_int16 *out, /* O: Output signal */ - const SKP_int16 *in, /* I: Input signal */ - const SKP_int16 *B, /* I: MA prediction coefficients, Q12 [order] */ - const SKP_int32 len, /* I: Signal length */ - const SKP_int32 d /* I: Filter order */ + opus_int16 *out, /* O: Output signal */ + const opus_int16 *in, /* I: Input signal */ + const opus_int16 *B, /* I: MA prediction coefficients, Q12 [order] */ + const opus_int32 len, /* I: Signal length */ + const opus_int32 d /* I: Filter order */ ) { - SKP_int ix, j; - SKP_int32 out32_Q12, out32; - const SKP_int16 *in_ptr; + opus_int ix, j; + opus_int32 out32_Q12, out32; + const opus_int16 *in_ptr; SKP_assert( d >= 6 ); SKP_assert( (d & 1) == 0 ); @@ -65,15 +65,15 @@ void silk_LPC_analysis_filter( } /* Subtract prediction */ - out32_Q12 = SKP_SUB32( SKP_LSHIFT( (SKP_int32)in_ptr[ 1 ], 12 ), out32_Q12 ); + out32_Q12 = SKP_SUB32( SKP_LSHIFT( (opus_int32)in_ptr[ 1 ], 12 ), out32_Q12 ); /* Scale to Q0 */ out32 = SKP_RSHIFT_ROUND( out32_Q12, 12 ); /* Saturate output */ - out[ ix ] = ( SKP_int16 )SKP_SAT16( out32 ); + out[ ix ] = ( opus_int16 )SKP_SAT16( out32 ); } /* Set first d output samples to zero */ - SKP_memset( out, 0, d * sizeof( SKP_int16 ) ); + SKP_memset( out, 0, d * sizeof( opus_int16 ) ); } diff --git a/silk/silk_LPC_inv_pred_gain.c b/silk/silk_LPC_inv_pred_gain.c index 39c17fff5a8d7f769b0aca810bff5a929dfa8e08..2e9346f3cf5c0f36f3ab7793f000d59f1f1428f0 100644 --- a/silk/silk_LPC_inv_pred_gain.c +++ b/silk/silk_LPC_inv_pred_gain.c @@ -32,16 +32,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */ -static SKP_int LPC_inverse_pred_gain_QA( /* O: Returns 1 if unstable, otherwise 0 */ - SKP_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ - SKP_int32 A_QA[ 2 ][ SILK_MAX_ORDER_LPC ], +static opus_int LPC_inverse_pred_gain_QA( /* O: Returns 1 if unstable, otherwise 0 */ + opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ + opus_int32 A_QA[ 2 ][ SILK_MAX_ORDER_LPC ], /* I: Prediction coefficients */ - const SKP_int order /* I: Prediction order */ + const opus_int order /* I: Prediction order */ ) { - SKP_int k, n, headrm; - SKP_int32 rc_Q31, rc_mult1_Q30, rc_mult2_Q16, tmp_QA; - SKP_int32 *Aold_QA, *Anew_QA; + opus_int k, n, headrm; + opus_int32 rc_Q31, rc_mult1_Q30, rc_mult2_Q16, tmp_QA; + opus_int32 *Aold_QA, *Anew_QA; Anew_QA = A_QA[ order & 1 ]; @@ -103,36 +103,36 @@ static SKP_int LPC_inverse_pred_gain_QA( /* O: Returns 1 if unstable, o } /* For input in Q12 domain */ -SKP_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable, otherwise 0 */ - SKP_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ - const SKP_int16 *A_Q12, /* I: Prediction coefficients, Q12 [order] */ - const SKP_int order /* I: Prediction order */ +opus_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable, otherwise 0 */ + opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ + const opus_int16 *A_Q12, /* I: Prediction coefficients, Q12 [order] */ + const opus_int order /* I: Prediction order */ ) { - SKP_int k; - SKP_int32 Atmp_QA[ 2 ][ SILK_MAX_ORDER_LPC ]; - SKP_int32 *Anew_QA; + opus_int k; + opus_int32 Atmp_QA[ 2 ][ SILK_MAX_ORDER_LPC ]; + opus_int32 *Anew_QA; Anew_QA = Atmp_QA[ order & 1 ]; /* Increase Q domain of the AR coefficients */ for( k = 0; k < order; k++ ) { - Anew_QA[ k ] = SKP_LSHIFT( (SKP_int32)A_Q12[ k ], QA - 12 ); + Anew_QA[ k ] = SKP_LSHIFT( (opus_int32)A_Q12[ k ], QA - 12 ); } return LPC_inverse_pred_gain_QA( invGain_Q30, Atmp_QA, order ); } /* For input in Q24 domain */ -SKP_int silk_LPC_inverse_pred_gain_Q24( /* O: Returns 1 if unstable, otherwise 0 */ - SKP_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ - const SKP_int32 *A_Q24, /* I: Prediction coefficients, Q24 [order] */ - const SKP_int order /* I: Prediction order */ +opus_int silk_LPC_inverse_pred_gain_Q24( /* O: Returns 1 if unstable, otherwise 0 */ + opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ + const opus_int32 *A_Q24, /* I: Prediction coefficients, Q24 [order] */ + const opus_int order /* I: Prediction order */ ) { - SKP_int k; - SKP_int32 Atmp_QA[ 2 ][ SILK_MAX_ORDER_LPC ]; - SKP_int32 *Anew_QA; + opus_int k; + opus_int32 Atmp_QA[ 2 ][ SILK_MAX_ORDER_LPC ]; + opus_int32 *Anew_QA; Anew_QA = Atmp_QA[ order & 1 ]; diff --git a/silk/silk_LP_variable_cutoff.c b/silk/silk_LP_variable_cutoff.c index 6165979093905f6a3b84d6f34bf2a6932c76da32..4fc243da63d4b0feebce155b855153555956e96c 100644 --- a/silk/silk_LP_variable_cutoff.c +++ b/silk/silk_LP_variable_cutoff.c @@ -36,13 +36,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Helper function, interpolates the filter taps */ SKP_INLINE void silk_LP_interpolate_filter_taps( - SKP_int32 B_Q28[ TRANSITION_NB ], - SKP_int32 A_Q28[ TRANSITION_NA ], - const SKP_int ind, - const SKP_int32 fac_Q16 + opus_int32 B_Q28[ TRANSITION_NB ], + opus_int32 A_Q28[ TRANSITION_NA ], + const opus_int ind, + const opus_int32 fac_Q16 ) { - SKP_int nb, na; + opus_int nb, na; if( ind < TRANSITION_INT_NUM - 1 ) { if( fac_Q16 > 0 ) { @@ -81,12 +81,12 @@ SKP_INLINE void silk_LP_interpolate_filter_taps( } } } else { - SKP_memcpy( B_Q28, silk_Transition_LP_B_Q28[ ind ], TRANSITION_NB * sizeof( SKP_int32 ) ); - SKP_memcpy( A_Q28, silk_Transition_LP_A_Q28[ ind ], TRANSITION_NA * sizeof( SKP_int32 ) ); + SKP_memcpy( B_Q28, silk_Transition_LP_B_Q28[ ind ], TRANSITION_NB * sizeof( opus_int32 ) ); + SKP_memcpy( A_Q28, silk_Transition_LP_A_Q28[ ind ], TRANSITION_NA * sizeof( opus_int32 ) ); } } else { - SKP_memcpy( B_Q28, silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NB * sizeof( SKP_int32 ) ); - SKP_memcpy( A_Q28, silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NA * sizeof( SKP_int32 ) ); + SKP_memcpy( B_Q28, silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NB * sizeof( opus_int32 ) ); + SKP_memcpy( A_Q28, silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NA * sizeof( opus_int32 ) ); } } @@ -96,12 +96,12 @@ SKP_INLINE void silk_LP_interpolate_filter_taps( /* Deactivate by setting psEncC->mode = 0; */ void silk_LP_variable_cutoff( silk_LP_state *psLP, /* I/O LP filter state */ - SKP_int16 *signal, /* I/O Low-pass filtered output signal */ - const SKP_int frame_length /* I Frame length */ + opus_int16 *signal, /* I/O Low-pass filtered output signal */ + const opus_int frame_length /* I Frame length */ ) { - SKP_int32 B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0; - SKP_int ind = 0; + opus_int32 B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0; + opus_int ind = 0; SKP_assert( psLP->transition_frame_no >= 0 && psLP->transition_frame_no <= TRANSITION_FRAMES ); diff --git a/silk/silk_MacroCount.h b/silk/silk_MacroCount.h index be9f0d037fb769c9f98a42127e1040499ea6d445..247e670e8cf79d3ca5a3db1f9358031c0698de01 100644 --- a/silk/silk_MacroCount.h +++ b/silk/silk_MacroCount.h @@ -30,16 +30,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdio.h> #ifdef SKP_MACRO_COUNT -#define varDefine SKP_int64 ops_count = 0; +#define varDefine opus_int64 ops_count = 0; -extern SKP_int64 ops_count; +extern opus_int64 ops_count; -SKP_INLINE SKP_int64 SKP_SaveCount(){ +SKP_INLINE opus_int64 SKP_SaveCount(){ return(ops_count); } -SKP_INLINE SKP_int64 SKP_SaveResetCount(){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SaveResetCount(){ + opus_int64 ret; ret = ops_count; ops_count = 0; @@ -47,112 +47,112 @@ SKP_INLINE SKP_int64 SKP_SaveResetCount(){ } SKP_INLINE SKP_PrintCount(){ - printf("ops_count = %d \n ", (SKP_int32)ops_count); + printf("ops_count = %d \n ", (opus_int32)ops_count); } #undef SKP_MUL -SKP_INLINE SKP_int32 SKP_MUL(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_MUL(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ops_count += 4; ret = a32 * b32; return ret; } #undef SKP_MUL_uint -SKP_INLINE SKP_uint32 SKP_MUL_uint(SKP_uint32 a32, SKP_uint32 b32){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_MUL_uint(opus_uint32 a32, opus_uint32 b32){ + opus_uint32 ret; ops_count += 4; ret = a32 * b32; return ret; } #undef SKP_MLA -SKP_INLINE SKP_int32 SKP_MLA(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 4; ret = a32 + b32 * c32; return ret; } #undef SKP_MLA_uint -SKP_INLINE SKP_int32 SKP_MLA_uint(SKP_uint32 a32, SKP_uint32 b32, SKP_uint32 c32){ - SKP_uint32 ret; +SKP_INLINE opus_int32 SKP_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){ + opus_uint32 ret; ops_count += 4; ret = a32 + b32 * c32; return ret; } #undef SKP_SMULWB -SKP_INLINE SKP_int32 SKP_SMULWB(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULWB(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ops_count += 5; - ret = (a32 >> 16) * (SKP_int32)((SKP_int16)b32) + (((a32 & 0x0000FFFF) * (SKP_int32)((SKP_int16)b32)) >> 16); + ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); return ret; } #undef SKP_SMLAWB -SKP_INLINE SKP_int32 SKP_SMLAWB(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 5; - ret = ((a32) + ((((b32) >> 16) * (SKP_int32)((SKP_int16)(c32))) + ((((b32) & 0x0000FFFF) * (SKP_int32)((SKP_int16)(c32))) >> 16))); + ret = ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))); return ret; } #undef SKP_SMULWT -SKP_INLINE SKP_int32 SKP_SMULWT(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULWT(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ops_count += 4; ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); return ret; } #undef SKP_SMLAWT -SKP_INLINE SKP_int32 SKP_SMLAWT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 4; ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); return ret; } #undef SKP_SMULBB -SKP_INLINE SKP_int32 SKP_SMULBB(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULBB(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ops_count += 1; - ret = (SKP_int32)((SKP_int16)a32) * (SKP_int32)((SKP_int16)b32); + ret = (opus_int32)((opus_int16)a32) * (opus_int32)((opus_int16)b32); return ret; } #undef SKP_SMLABB -SKP_INLINE SKP_int32 SKP_SMLABB(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 1; - ret = a32 + (SKP_int32)((SKP_int16)b32) * (SKP_int32)((SKP_int16)c32); + ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); return ret; } #undef SKP_SMULBT -SKP_INLINE SKP_int32 SKP_SMULBT(SKP_int32 a32, SKP_int32 b32 ){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULBT(opus_int32 a32, opus_int32 b32 ){ + opus_int32 ret; ops_count += 4; - ret = ((SKP_int32)((SKP_int16)a32)) * (b32 >> 16); + ret = ((opus_int32)((opus_int16)a32)) * (b32 >> 16); return ret; } #undef SKP_SMLABT -SKP_INLINE SKP_int32 SKP_SMLABT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 1; - ret = a32 + ((SKP_int32)((SKP_int16)b32)) * (c32 >> 16); + ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); return ret; } #undef SKP_SMULTT -SKP_INLINE SKP_int32 SKP_SMULTT(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULTT(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ops_count += 1; ret = (a32 >> 16) * (b32 >> 16); return ret; } #undef SKP_SMLATT -SKP_INLINE SKP_int32 SKP_SMLATT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ops_count += 1; ret = a32 + (b32 >> 16) * (c32 >> 16); return ret; @@ -179,32 +179,32 @@ SKP_INLINE SKP_int32 SKP_SMLATT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ #define SKP_SMLAWT_ovflw SKP_SMLAWT #undef SKP_SMULL -SKP_INLINE SKP_int64 SKP_SMULL(SKP_int32 a32, SKP_int32 b32){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SMULL(opus_int32 a32, opus_int32 b32){ + opus_int64 ret; ops_count += 8; - ret = ((SKP_int64)(a32) * /*(SKP_int64)*/(b32)); + ret = ((opus_int64)(a32) * /*(opus_int64)*/(b32)); return ret; } #undef SKP_SMLAL -SKP_INLINE SKP_int64 SKP_SMLAL(SKP_int64 a64, SKP_int32 b32, SKP_int32 c32){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SMLAL(opus_int64 a64, opus_int32 b32, opus_int32 c32){ + opus_int64 ret; ops_count += 8; - ret = a64 + ((SKP_int64)(b32) * /*(SKP_int64)*/(c32)); + ret = a64 + ((opus_int64)(b32) * /*(opus_int64)*/(c32)); return ret; } #undef SKP_SMLALBB -SKP_INLINE SKP_int64 SKP_SMLALBB(SKP_int64 a64, SKP_int16 b16, SKP_int16 c16){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SMLALBB(opus_int64 a64, opus_int16 b16, opus_int16 c16){ + opus_int64 ret; ops_count += 4; - ret = a64 + ((SKP_int64)(b16) * /*(SKP_int64)*/(c16)); + ret = a64 + ((opus_int64)(b16) * /*(opus_int64)*/(c16)); return ret; } #undef SigProcFIX_CLZ16 -SKP_INLINE SKP_int32 SigProcFIX_CLZ16(SKP_int16 in16) +SKP_INLINE opus_int32 SigProcFIX_CLZ16(opus_int16 in16) { - SKP_int32 out32 = 0; + opus_int32 out32 = 0; ops_count += 10; if( in16 == 0 ) { return 16; @@ -240,242 +240,242 @@ SKP_INLINE SKP_int32 SigProcFIX_CLZ16(SKP_int16 in16) } #undef SigProcFIX_CLZ32 -SKP_INLINE SKP_int32 SigProcFIX_CLZ32(SKP_int32 in32) +SKP_INLINE opus_int32 SigProcFIX_CLZ32(opus_int32 in32) { - /* test highest 16 bits and convert to SKP_int16 */ + /* test highest 16 bits and convert to opus_int16 */ ops_count += 2; if( in32 & 0xFFFF0000 ) { - return SigProcFIX_CLZ16((SKP_int16)(in32 >> 16)); + return SigProcFIX_CLZ16((opus_int16)(in32 >> 16)); } else { - return SigProcFIX_CLZ16((SKP_int16)in32) + 16; + return SigProcFIX_CLZ16((opus_int16)in32) + 16; } } #undef SKP_DIV32 -SKP_INLINE SKP_int32 SKP_DIV32(SKP_int32 a32, SKP_int32 b32){ +SKP_INLINE opus_int32 SKP_DIV32(opus_int32 a32, opus_int32 b32){ ops_count += 64; return a32 / b32; } #undef SKP_DIV32_16 -SKP_INLINE SKP_int32 SKP_DIV32_16(SKP_int32 a32, SKP_int32 b32){ +SKP_INLINE opus_int32 SKP_DIV32_16(opus_int32 a32, opus_int32 b32){ ops_count += 32; return a32 / b32; } #undef SKP_SAT8 -SKP_INLINE SKP_int8 SKP_SAT8(SKP_int64 a){ - SKP_int8 tmp; +SKP_INLINE opus_int8 SKP_SAT8(opus_int64 a){ + opus_int8 tmp; ops_count += 1; - tmp = (SKP_int8)((a) > SKP_int8_MAX ? SKP_int8_MAX : \ + tmp = (opus_int8)((a) > SKP_int8_MAX ? SKP_int8_MAX : \ ((a) < SKP_int8_MIN ? SKP_int8_MIN : (a))); return(tmp); } #undef SKP_SAT16 -SKP_INLINE SKP_int16 SKP_SAT16(SKP_int64 a){ - SKP_int16 tmp; +SKP_INLINE opus_int16 SKP_SAT16(opus_int64 a){ + opus_int16 tmp; ops_count += 1; - tmp = (SKP_int16)((a) > SKP_int16_MAX ? SKP_int16_MAX : \ + tmp = (opus_int16)((a) > SKP_int16_MAX ? SKP_int16_MAX : \ ((a) < SKP_int16_MIN ? SKP_int16_MIN : (a))); return(tmp); } #undef SKP_SAT32 -SKP_INLINE SKP_int32 SKP_SAT32(SKP_int64 a){ - SKP_int32 tmp; +SKP_INLINE opus_int32 SKP_SAT32(opus_int64 a){ + opus_int32 tmp; ops_count += 1; - tmp = (SKP_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : \ + tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : \ ((a) < SKP_int32_MIN ? SKP_int32_MIN : (a))); return(tmp); } #undef SKP_POS_SAT32 -SKP_INLINE SKP_int32 SKP_POS_SAT32(SKP_int64 a){ - SKP_int32 tmp; +SKP_INLINE opus_int32 SKP_POS_SAT32(opus_int64 a){ + opus_int32 tmp; ops_count += 1; - tmp = (SKP_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : (a)); + tmp = (opus_int32)((a) > SKP_int32_MAX ? SKP_int32_MAX : (a)); return(tmp); } #undef SKP_ADD_POS_SAT8 -SKP_INLINE SKP_int8 SKP_ADD_POS_SAT8(SKP_int64 a, SKP_int64 b){ - SKP_int8 tmp; +SKP_INLINE opus_int8 SKP_ADD_POS_SAT8(opus_int64 a, opus_int64 b){ + opus_int8 tmp; ops_count += 1; - tmp = (SKP_int8)((((a)+(b)) & 0x80) ? SKP_int8_MAX : ((a)+(b))); + tmp = (opus_int8)((((a)+(b)) & 0x80) ? SKP_int8_MAX : ((a)+(b))); return(tmp); } #undef SKP_ADD_POS_SAT16 -SKP_INLINE SKP_int16 SKP_ADD_POS_SAT16(SKP_int64 a, SKP_int64 b){ - SKP_int16 tmp; +SKP_INLINE opus_int16 SKP_ADD_POS_SAT16(opus_int64 a, opus_int64 b){ + opus_int16 tmp; ops_count += 1; - tmp = (SKP_int16)((((a)+(b)) & 0x8000) ? SKP_int16_MAX : ((a)+(b))); + tmp = (opus_int16)((((a)+(b)) & 0x8000) ? SKP_int16_MAX : ((a)+(b))); return(tmp); } #undef SKP_ADD_POS_SAT32 -SKP_INLINE SKP_int32 SKP_ADD_POS_SAT32(SKP_int64 a, SKP_int64 b){ - SKP_int32 tmp; +SKP_INLINE opus_int32 SKP_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ + opus_int32 tmp; ops_count += 1; - tmp = (SKP_int32)((((a)+(b)) & 0x80000000) ? SKP_int32_MAX : ((a)+(b))); + tmp = (opus_int32)((((a)+(b)) & 0x80000000) ? SKP_int32_MAX : ((a)+(b))); return(tmp); } #undef SKP_ADD_POS_SAT64 -SKP_INLINE SKP_int64 SKP_ADD_POS_SAT64(SKP_int64 a, SKP_int64 b){ - SKP_int64 tmp; +SKP_INLINE opus_int64 SKP_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ + opus_int64 tmp; ops_count += 1; tmp = ((((a)+(b)) & 0x8000000000000000LL) ? SKP_int64_MAX : ((a)+(b))); return(tmp); } #undef SKP_LSHIFT8 -SKP_INLINE SKP_int8 SKP_LSHIFT8(SKP_int8 a, SKP_int32 shift){ - SKP_int8 ret; +SKP_INLINE opus_int8 SKP_LSHIFT8(opus_int8 a, opus_int32 shift){ + opus_int8 ret; ops_count += 1; ret = a << shift; return ret; } #undef SKP_LSHIFT16 -SKP_INLINE SKP_int16 SKP_LSHIFT16(SKP_int16 a, SKP_int32 shift){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_LSHIFT16(opus_int16 a, opus_int32 shift){ + opus_int16 ret; ops_count += 1; ret = a << shift; return ret; } #undef SKP_LSHIFT32 -SKP_INLINE SKP_int32 SKP_LSHIFT32(SKP_int32 a, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_LSHIFT32(opus_int32 a, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a << shift; return ret; } #undef SKP_LSHIFT64 -SKP_INLINE SKP_int64 SKP_LSHIFT64(SKP_int64 a, SKP_int shift){ +SKP_INLINE opus_int64 SKP_LSHIFT64(opus_int64 a, opus_int shift){ ops_count += 1; return a << shift; } #undef SKP_LSHIFT_ovflw -SKP_INLINE SKP_int32 SKP_LSHIFT_ovflw(SKP_int32 a, SKP_int32 shift){ +SKP_INLINE opus_int32 SKP_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ ops_count += 1; return a << shift; } #undef SKP_LSHIFT_uint -SKP_INLINE SKP_uint32 SKP_LSHIFT_uint(SKP_uint32 a, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ + opus_uint32 ret; ops_count += 1; ret = a << shift; return ret; } #undef SKP_RSHIFT8 -SKP_INLINE SKP_int8 SKP_RSHIFT8(SKP_int8 a, SKP_int32 shift){ +SKP_INLINE opus_int8 SKP_RSHIFT8(opus_int8 a, opus_int32 shift){ ops_count += 1; return a >> shift; } #undef SKP_RSHIFT16 -SKP_INLINE SKP_int16 SKP_RSHIFT16(SKP_int16 a, SKP_int32 shift){ +SKP_INLINE opus_int16 SKP_RSHIFT16(opus_int16 a, opus_int32 shift){ ops_count += 1; return a >> shift; } #undef SKP_RSHIFT32 -SKP_INLINE SKP_int32 SKP_RSHIFT32(SKP_int32 a, SKP_int32 shift){ +SKP_INLINE opus_int32 SKP_RSHIFT32(opus_int32 a, opus_int32 shift){ ops_count += 1; return a >> shift; } #undef SKP_RSHIFT64 -SKP_INLINE SKP_int64 SKP_RSHIFT64(SKP_int64 a, SKP_int64 shift){ +SKP_INLINE opus_int64 SKP_RSHIFT64(opus_int64 a, opus_int64 shift){ ops_count += 1; return a >> shift; } #undef SKP_RSHIFT_uint -SKP_INLINE SKP_uint32 SKP_RSHIFT_uint(SKP_uint32 a, SKP_int32 shift){ +SKP_INLINE opus_uint32 SKP_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ ops_count += 1; return a >> shift; } #undef SKP_ADD_LSHIFT -SKP_INLINE SKP_int32 SKP_ADD_LSHIFT(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a + (b << shift); return ret; // shift >= 0 } #undef SKP_ADD_LSHIFT32 -SKP_INLINE SKP_int32 SKP_ADD_LSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a + (b << shift); return ret; // shift >= 0 } #undef SKP_ADD_LSHIFT_uint -SKP_INLINE SKP_uint32 SKP_ADD_LSHIFT_uint(SKP_uint32 a, SKP_uint32 b, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ + opus_uint32 ret; ops_count += 1; ret = a + (b << shift); return ret; // shift >= 0 } #undef SKP_ADD_RSHIFT -SKP_INLINE SKP_int32 SKP_ADD_RSHIFT(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a + (b >> shift); return ret; // shift > 0 } #undef SKP_ADD_RSHIFT32 -SKP_INLINE SKP_int32 SKP_ADD_RSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a + (b >> shift); return ret; // shift > 0 } #undef SKP_ADD_RSHIFT_uint -SKP_INLINE SKP_uint32 SKP_ADD_RSHIFT_uint(SKP_uint32 a, SKP_uint32 b, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ + opus_uint32 ret; ops_count += 1; ret = a + (b >> shift); return ret; // shift > 0 } #undef SKP_SUB_LSHIFT32 -SKP_INLINE SKP_int32 SKP_SUB_LSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a - (b << shift); return ret; // shift >= 0 } #undef SKP_SUB_RSHIFT32 -SKP_INLINE SKP_int32 SKP_SUB_RSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; ops_count += 1; ret = a - (b >> shift); return ret; // shift > 0 } #undef SKP_RSHIFT_ROUND -SKP_INLINE SKP_int32 SKP_RSHIFT_ROUND(SKP_int32 a, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ + opus_int32 ret; ops_count += 3; ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; return ret; } #undef SKP_RSHIFT_ROUND64 -SKP_INLINE SKP_int64 SKP_RSHIFT_ROUND64(SKP_int64 a, SKP_int32 shift){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ + opus_int64 ret; ops_count += 6; ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; return ret; } #undef SKP_abs_int64 -SKP_INLINE SKP_int64 SKP_abs_int64(SKP_int64 a){ +SKP_INLINE opus_int64 SKP_abs_int64(opus_int64 a){ ops_count += 1; return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN } #undef SKP_abs_int32 -SKP_INLINE SKP_int32 SKP_abs_int32(SKP_int32 a){ +SKP_INLINE opus_int32 SKP_abs_int32(opus_int32 a){ ops_count += 1; return abs(a); } @@ -498,64 +498,64 @@ static SKP_sign(a){ } #undef SKP_ADD16 -SKP_INLINE SKP_int16 SKP_ADD16(SKP_int16 a, SKP_int16 b){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_ADD16(opus_int16 a, opus_int16 b){ + opus_int16 ret; ops_count += 1; ret = a + b; return ret; } #undef SKP_ADD32 -SKP_INLINE SKP_int32 SKP_ADD32(SKP_int32 a, SKP_int32 b){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD32(opus_int32 a, opus_int32 b){ + opus_int32 ret; ops_count += 1; ret = a + b; return ret; } #undef SKP_ADD64 -SKP_INLINE SKP_int64 SKP_ADD64(SKP_int64 a, SKP_int64 b){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_ADD64(opus_int64 a, opus_int64 b){ + opus_int64 ret; ops_count += 2; ret = a + b; return ret; } #undef SKP_SUB16 -SKP_INLINE SKP_int16 SKP_SUB16(SKP_int16 a, SKP_int16 b){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_SUB16(opus_int16 a, opus_int16 b){ + opus_int16 ret; ops_count += 1; ret = a - b; return ret; } #undef SKP_SUB32 -SKP_INLINE SKP_int32 SKP_SUB32(SKP_int32 a, SKP_int32 b){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB32(opus_int32 a, opus_int32 b){ + opus_int32 ret; ops_count += 1; ret = a - b; return ret; } #undef SKP_SUB64 -SKP_INLINE SKP_int64 SKP_SUB64(SKP_int64 a, SKP_int64 b){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SUB64(opus_int64 a, opus_int64 b){ + opus_int64 ret; ops_count += 2; ret = a - b; return ret; } #undef SKP_ADD_SAT16 -SKP_INLINE SKP_int16 SKP_ADD_SAT16( SKP_int16 a16, SKP_int16 b16 ) { - SKP_int16 res; +SKP_INLINE opus_int16 SKP_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { + opus_int16 res; // Nb will be counted in AKP_add32 and SKP_SAT16 - res = (SKP_int16)SKP_SAT16( SKP_ADD32( (SKP_int32)(a16), (b16) ) ); + res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) ); return res; } #undef SKP_ADD_SAT32 -SKP_INLINE SKP_int32 SKP_ADD_SAT32(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 res; +SKP_INLINE opus_int32 SKP_ADD_SAT32(opus_int32 a32, opus_int32 b32){ + opus_int32 res; ops_count += 1; res = ((((a32) + (b32)) & 0x80000000) == 0 ? \ ((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \ @@ -564,8 +564,8 @@ SKP_INLINE SKP_int32 SKP_ADD_SAT32(SKP_int32 a32, SKP_int32 b32){ } #undef SKP_ADD_SAT64 -SKP_INLINE SKP_int64 SKP_ADD_SAT64( SKP_int64 a64, SKP_int64 b64 ) { - SKP_int64 res; +SKP_INLINE opus_int64 SKP_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { + opus_int64 res; ops_count += 1; res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ ((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \ @@ -574,17 +574,17 @@ SKP_INLINE SKP_int64 SKP_ADD_SAT64( SKP_int64 a64, SKP_int64 b64 ) { } #undef SKP_SUB_SAT16 -SKP_INLINE SKP_int16 SKP_SUB_SAT16( SKP_int16 a16, SKP_int16 b16 ) { - SKP_int16 res; +SKP_INLINE opus_int16 SKP_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { + opus_int16 res; SKP_assert(0); // Nb will be counted in sub-macros - res = (SKP_int16)SKP_SAT16( SKP_SUB32( (SKP_int32)(a16), (b16) ) ); + res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) ); return res; } #undef SKP_SUB_SAT32 -SKP_INLINE SKP_int32 SKP_SUB_SAT32( SKP_int32 a32, SKP_int32 b32 ) { - SKP_int32 res; +SKP_INLINE opus_int32 SKP_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { + opus_int32 res; ops_count += 1; res = ((((a32)-(b32)) & 0x80000000) == 0 ? \ (( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \ @@ -593,8 +593,8 @@ SKP_INLINE SKP_int32 SKP_SUB_SAT32( SKP_int32 a32, SKP_int32 b32 ) { } #undef SKP_SUB_SAT64 -SKP_INLINE SKP_int64 SKP_SUB_SAT64( SKP_int64 a64, SKP_int64 b64 ) { - SKP_int64 res; +SKP_INLINE opus_int64 SKP_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { + opus_int64 res; ops_count += 1; res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ (( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \ @@ -604,42 +604,42 @@ SKP_INLINE SKP_int64 SKP_SUB_SAT64( SKP_int64 a64, SKP_int64 b64 ) { } #undef SKP_SMULWW -SKP_INLINE SKP_int32 SKP_SMULWW(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULWW(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; // Nb will be counted in sub-macros ret = SKP_MLA(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)); return ret; } #undef SKP_SMLAWW -SKP_INLINE SKP_int32 SKP_SMLAWW(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; // Nb will be counted in sub-macros ret = SKP_MLA(SKP_SMLAWB((a32), (b32), (c32)), (b32), SKP_RSHIFT_ROUND((c32), 16)); return ret; } #undef SKP_min_int -SKP_INLINE SKP_int SKP_min_int(SKP_int a, SKP_int b) +SKP_INLINE opus_int SKP_min_int(opus_int a, opus_int b) { ops_count += 1; return (((a) < (b)) ? (a) : (b)); } #undef SKP_min_16 -SKP_INLINE SKP_int16 SKP_min_16(SKP_int16 a, SKP_int16 b) +SKP_INLINE opus_int16 SKP_min_16(opus_int16 a, opus_int16 b) { ops_count += 1; return (((a) < (b)) ? (a) : (b)); } #undef SKP_min_32 -SKP_INLINE SKP_int32 SKP_min_32(SKP_int32 a, SKP_int32 b) +SKP_INLINE opus_int32 SKP_min_32(opus_int32 a, opus_int32 b) { ops_count += 1; return (((a) < (b)) ? (a) : (b)); } #undef SKP_min_64 -SKP_INLINE SKP_int64 SKP_min_64(SKP_int64 a, SKP_int64 b) +SKP_INLINE opus_int64 SKP_min_64(opus_int64 a, opus_int64 b) { ops_count += 1; return (((a) < (b)) ? (a) : (b)); @@ -647,26 +647,26 @@ SKP_INLINE SKP_int64 SKP_min_64(SKP_int64 a, SKP_int64 b) /* SKP_min() versions with typecast in the function call */ #undef SKP_max_int -SKP_INLINE SKP_int SKP_max_int(SKP_int a, SKP_int b) +SKP_INLINE opus_int SKP_max_int(opus_int a, opus_int b) { ops_count += 1; return (((a) > (b)) ? (a) : (b)); } #undef SKP_max_16 -SKP_INLINE SKP_int16 SKP_max_16(SKP_int16 a, SKP_int16 b) +SKP_INLINE opus_int16 SKP_max_16(opus_int16 a, opus_int16 b) { ops_count += 1; return (((a) > (b)) ? (a) : (b)); } #undef SKP_max_32 -SKP_INLINE SKP_int32 SKP_max_32(SKP_int32 a, SKP_int32 b) +SKP_INLINE opus_int32 SKP_max_32(opus_int32 a, opus_int32 b) { ops_count += 1; return (((a) > (b)) ? (a) : (b)); } #undef SKP_max_64 -SKP_INLINE SKP_int64 SKP_max_64(SKP_int64 a, SKP_int64 b) +SKP_INLINE opus_int64 SKP_max_64(opus_int64 a, opus_int64 b) { ops_count += 1; return (((a) > (b)) ? (a) : (b)); @@ -674,9 +674,9 @@ SKP_INLINE SKP_int64 SKP_max_64(SKP_int64 a, SKP_int64 b) #undef SKP_LIMIT_int -SKP_INLINE SKP_int SKP_LIMIT_int(SKP_int a, SKP_int limit1, SKP_int limit2) +SKP_INLINE opus_int SKP_LIMIT_int(opus_int a, opus_int limit1, opus_int limit2) { - SKP_int ret; + opus_int ret; ops_count += 6; ret = ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ @@ -686,9 +686,9 @@ SKP_INLINE SKP_int SKP_LIMIT_int(SKP_int a, SKP_int limit1, SKP_int limit2) } #undef SKP_LIMIT_16 -SKP_INLINE SKP_int16 SKP_LIMIT_16(SKP_int16 a, SKP_int16 limit1, SKP_int16 limit2) +SKP_INLINE opus_int16 SKP_LIMIT_16(opus_int16 a, opus_int16 limit1, opus_int16 limit2) { - SKP_int16 ret; + opus_int16 ret; ops_count += 6; ret = ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ @@ -699,9 +699,9 @@ return(ret); #undef SKP_LIMIT_32 -SKP_INLINE SKP_int SKP_LIMIT_32(SKP_int32 a, SKP_int32 limit1, SKP_int32 limit2) +SKP_INLINE opus_int SKP_LIMIT_32(opus_int32 a, opus_int32 limit1, opus_int32 limit2) { - SKP_int32 ret; + opus_int32 ret; ops_count += 6; ret = ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ diff --git a/silk/silk_MacroDebug.h b/silk/silk_MacroDebug.h index cabbc2a7d5a217bd925ada0f499f8a691e3467d2..dd6d073e3e6dd4acb85cd31b0287b912822cc29f 100644 --- a/silk/silk_MacroDebug.h +++ b/silk/silk_MacroDebug.h @@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if 0 && defined (_WIN32) && defined (_DEBUG) && !defined (SKP_MACRO_COUNT) #undef SKP_ADD16 -SKP_INLINE SKP_int16 SKP_ADD16(SKP_int16 a, SKP_int16 b){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_ADD16(opus_int16 a, opus_int16 b){ + opus_int16 ret; ret = a + b; SKP_assert( ret == SKP_ADD_SAT16( a, b )); @@ -43,8 +43,8 @@ SKP_INLINE SKP_int16 SKP_ADD16(SKP_int16 a, SKP_int16 b){ } #undef SKP_ADD32 -SKP_INLINE SKP_int32 SKP_ADD32(SKP_int32 a, SKP_int32 b){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD32(opus_int32 a, opus_int32 b){ + opus_int32 ret; ret = a + b; SKP_assert( ret == SKP_ADD_SAT32( a, b )); @@ -52,8 +52,8 @@ SKP_INLINE SKP_int32 SKP_ADD32(SKP_int32 a, SKP_int32 b){ } #undef SKP_ADD64 -SKP_INLINE SKP_int64 SKP_ADD64(SKP_int64 a, SKP_int64 b){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_ADD64(opus_int64 a, opus_int64 b){ + opus_int64 ret; ret = a + b; SKP_assert( ret == SKP_ADD_SAT64( a, b )); @@ -61,8 +61,8 @@ SKP_INLINE SKP_int64 SKP_ADD64(SKP_int64 a, SKP_int64 b){ } #undef SKP_SUB16 -SKP_INLINE SKP_int16 SKP_SUB16(SKP_int16 a, SKP_int16 b){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_SUB16(opus_int16 a, opus_int16 b){ + opus_int16 ret; ret = a - b; SKP_assert( ret == SKP_SUB_SAT16( a, b )); @@ -70,8 +70,8 @@ SKP_INLINE SKP_int16 SKP_SUB16(SKP_int16 a, SKP_int16 b){ } #undef SKP_SUB32 -SKP_INLINE SKP_int32 SKP_SUB32(SKP_int32 a, SKP_int32 b){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB32(opus_int32 a, opus_int32 b){ + opus_int32 ret; ret = a - b; SKP_assert( ret == SKP_SUB_SAT32( a, b )); @@ -79,8 +79,8 @@ SKP_INLINE SKP_int32 SKP_SUB32(SKP_int32 a, SKP_int32 b){ } #undef SKP_SUB64 -SKP_INLINE SKP_int64 SKP_SUB64(SKP_int64 a, SKP_int64 b){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_SUB64(opus_int64 a, opus_int64 b){ + opus_int64 ret; ret = a - b; SKP_assert( ret == SKP_SUB_SAT64( a, b )); @@ -88,26 +88,26 @@ SKP_INLINE SKP_int64 SKP_SUB64(SKP_int64 a, SKP_int64 b){ } #undef SKP_ADD_SAT16 -SKP_INLINE SKP_int16 SKP_ADD_SAT16( SKP_int16 a16, SKP_int16 b16 ) { - SKP_int16 res; - res = (SKP_int16)SKP_SAT16( SKP_ADD32( (SKP_int32)(a16), (b16) ) ); - SKP_assert( res == SKP_SAT16( ( SKP_int32 )a16 + ( SKP_int32 )b16 ) ); +SKP_INLINE opus_int16 SKP_ADD_SAT16( opus_int16 a16, opus_int16 b16 ) { + opus_int16 res; + res = (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a16), (b16) ) ); + SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 + ( opus_int32 )b16 ) ); return res; } #undef SKP_ADD_SAT32 -SKP_INLINE SKP_int32 SKP_ADD_SAT32(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 res; +SKP_INLINE opus_int32 SKP_ADD_SAT32(opus_int32 a32, opus_int32 b32){ + opus_int32 res; res = ((((a32) + (b32)) & 0x80000000) == 0 ? \ ((((a32) & (b32)) & 0x80000000) != 0 ? SKP_int32_MIN : (a32)+(b32)) : \ ((((a32) | (b32)) & 0x80000000) == 0 ? SKP_int32_MAX : (a32)+(b32)) ); - SKP_assert( res == SKP_SAT32( ( SKP_int64 )a32 + ( SKP_int64 )b32 ) ); + SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 + ( opus_int64 )b32 ) ); return res; } #undef SKP_ADD_SAT64 -SKP_INLINE SKP_int64 SKP_ADD_SAT64( SKP_int64 a64, SKP_int64 b64 ) { - SKP_int64 res; +SKP_INLINE opus_int64 SKP_ADD_SAT64( opus_int64 a64, opus_int64 b64 ) { + opus_int64 res; res = ((((a64) + (b64)) & 0x8000000000000000LL) == 0 ? \ ((((a64) & (b64)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a64)+(b64)) : \ ((((a64) | (b64)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a64)+(b64)) ); @@ -123,26 +123,26 @@ SKP_INLINE SKP_int64 SKP_ADD_SAT64( SKP_int64 a64, SKP_int64 b64 ) { } #undef SKP_SUB_SAT16 -SKP_INLINE SKP_int16 SKP_SUB_SAT16( SKP_int16 a16, SKP_int16 b16 ) { - SKP_int16 res; - res = (SKP_int16)SKP_SAT16( SKP_SUB32( (SKP_int32)(a16), (b16) ) ); - SKP_assert( res == SKP_SAT16( ( SKP_int32 )a16 - ( SKP_int32 )b16 ) ); +SKP_INLINE opus_int16 SKP_SUB_SAT16( opus_int16 a16, opus_int16 b16 ) { + opus_int16 res; + res = (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a16), (b16) ) ); + SKP_assert( res == SKP_SAT16( ( opus_int32 )a16 - ( opus_int32 )b16 ) ); return res; } #undef SKP_SUB_SAT32 -SKP_INLINE SKP_int32 SKP_SUB_SAT32( SKP_int32 a32, SKP_int32 b32 ) { - SKP_int32 res; +SKP_INLINE opus_int32 SKP_SUB_SAT32( opus_int32 a32, opus_int32 b32 ) { + opus_int32 res; res = ((((a32)-(b32)) & 0x80000000) == 0 ? \ (( (a32) & ((b32)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a32)-(b32)) : \ ((((a32)^0x80000000) & (b32) & 0x80000000) ? SKP_int32_MAX : (a32)-(b32)) ); - SKP_assert( res == SKP_SAT32( ( SKP_int64 )a32 - ( SKP_int64 )b32 ) ); + SKP_assert( res == SKP_SAT32( ( opus_int64 )a32 - ( opus_int64 )b32 ) ); return res; } #undef SKP_SUB_SAT64 -SKP_INLINE SKP_int64 SKP_SUB_SAT64( SKP_int64 a64, SKP_int64 b64 ) { - SKP_int64 res; +SKP_INLINE opus_int64 SKP_SUB_SAT64( opus_int64 a64, opus_int64 b64 ) { + opus_int64 res; res = ((((a64)-(b64)) & 0x8000000000000000LL) == 0 ? \ (( (a64) & ((b64)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a64)-(b64)) : \ ((((a64)^0x8000000000000000LL) & (b64) & 0x8000000000000000LL) ? SKP_int64_MAX : (a64)-(b64)) ); @@ -159,71 +159,71 @@ SKP_INLINE SKP_int64 SKP_SUB_SAT64( SKP_int64 a64, SKP_int64 b64 ) { } #undef SKP_MUL -SKP_INLINE SKP_int32 SKP_MUL(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; - SKP_int64 ret64; // Will easily show how many bits that are needed +SKP_INLINE opus_int32 SKP_MUL(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; + opus_int64 ret64; // Will easily show how many bits that are needed ret = a32 * b32; - ret64 = (SKP_int64)a32 * (SKP_int64)b32; - SKP_assert((SKP_int64)ret == ret64 ); //Check output overflow + ret64 = (opus_int64)a32 * (opus_int64)b32; + SKP_assert((opus_int64)ret == ret64 ); //Check output overflow return ret; } #undef SKP_MUL_uint -SKP_INLINE SKP_uint32 SKP_MUL_uint(SKP_uint32 a32, SKP_uint32 b32){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_MUL_uint(opus_uint32 a32, opus_uint32 b32){ + opus_uint32 ret; ret = a32 * b32; - SKP_assert((SKP_uint64)ret == (SKP_uint64)a32 * (SKP_uint64)b32); //Check output overflow + SKP_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32); //Check output overflow return ret; } #undef SKP_MLA -SKP_INLINE SKP_int32 SKP_MLA(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ret = a32 + b32 * c32; - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (SKP_int64)b32 * (SKP_int64)c32); //Check output overflow + SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow return ret; } #undef SKP_MLA_uint -SKP_INLINE SKP_int32 SKP_MLA_uint(SKP_uint32 a32, SKP_uint32 b32, SKP_uint32 c32){ - SKP_uint32 ret; +SKP_INLINE opus_int32 SKP_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_uint32 c32){ + opus_uint32 ret; ret = a32 + b32 * c32; - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (SKP_int64)b32 * (SKP_int64)c32); //Check output overflow + SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int64)c32); //Check output overflow return ret; } #undef SKP_SMULWB -SKP_INLINE SKP_int32 SKP_SMULWB(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; - ret = (a32 >> 16) * (SKP_int32)((SKP_int16)b32) + (((a32 & 0x0000FFFF) * (SKP_int32)((SKP_int16)b32)) >> 16); - SKP_assert((SKP_int64)ret == ((SKP_int64)a32 * (SKP_int16)b32) >> 16); +SKP_INLINE opus_int32 SKP_SMULWB(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; + ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); + SKP_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16); return ret; } #undef SKP_SMLAWB -SKP_INLINE SKP_int32 SKP_SMLAWB(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ret = SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) ); SKP_assert(SKP_ADD32( a32, SKP_SMULWB( b32, c32 ) ) == SKP_ADD_SAT32( a32, SKP_SMULWB( b32, c32 ) )); return ret; } #undef SKP_SMULWT -SKP_INLINE SKP_int32 SKP_SMULWT(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMULWT(opus_int32 a32, opus_int32 b32){ + opus_int32 ret; ret = (a32 >> 16) * (b32 >> 16) + (((a32 & 0x0000FFFF) * (b32 >> 16)) >> 16); - SKP_assert((SKP_int64)ret == ((SKP_int64)a32 * (b32 >> 16)) >> 16); + SKP_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16); return ret; } #undef SKP_SMLAWT -SKP_INLINE SKP_int32 SKP_SMLAWT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ret = a32 + ((b32 >> 16) * (c32 >> 16)) + (((b32 & 0x0000FFFF) * ((c32 >> 16)) >> 16)); - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (((SKP_int64)b32 * (c32 >> 16)) >> 16)); + SKP_assert((opus_int64)ret == (opus_int64)a32 + (((opus_int64)b32 * (c32 >> 16)) >> 16)); return ret; } #undef SKP_SMULL -SKP_INLINE SKP_int64 SKP_SMULL(SKP_int64 a64, SKP_int64 b64){ - SKP_int64 ret64; +SKP_INLINE opus_int64 SKP_SMULL(opus_int64 a64, opus_int64 b64){ + opus_int64 ret64; ret64 = a64 * b64; if( b64 != 0 ) { SKP_assert( a64 == (ret64 / b64) ); @@ -235,55 +235,55 @@ SKP_INLINE SKP_int64 SKP_SMULL(SKP_int64 a64, SKP_int64 b64){ // no checking needed for SKP_SMULBB #undef SKP_SMLABB -SKP_INLINE SKP_int32 SKP_SMLABB(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; - ret = a32 + (SKP_int32)((SKP_int16)b32) * (SKP_int32)((SKP_int16)c32); - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (SKP_int64)b32 * (SKP_int16)c32); +SKP_INLINE opus_int32 SKP_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; + ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); + SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (opus_int16)c32); return ret; } // no checking needed for SKP_SMULBT #undef SKP_SMLABT -SKP_INLINE SKP_int32 SKP_SMLABT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; - ret = a32 + ((SKP_int32)((SKP_int16)b32)) * (c32 >> 16); - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (SKP_int64)b32 * (c32 >> 16)); +SKP_INLINE opus_int32 SKP_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; + ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); + SKP_assert((opus_int64)ret == (opus_int64)a32 + (opus_int64)b32 * (c32 >> 16)); return ret; } // no checking needed for SKP_SMULTT #undef SKP_SMLATT -SKP_INLINE SKP_int32 SKP_SMLATT(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret; ret = a32 + (b32 >> 16) * (c32 >> 16); - SKP_assert((SKP_int64)ret == (SKP_int64)a32 + (b32 >> 16) * (c32 >> 16)); + SKP_assert((opus_int64)ret == (opus_int64)a32 + (b32 >> 16) * (c32 >> 16)); return ret; } #undef SKP_SMULWW -SKP_INLINE SKP_int32 SKP_SMULWW(SKP_int32 a32, SKP_int32 b32){ - SKP_int32 ret, tmp1, tmp2; - SKP_int64 ret64; +SKP_INLINE opus_int32 SKP_SMULWW(opus_int32 a32, opus_int32 b32){ + opus_int32 ret, tmp1, tmp2; + opus_int64 ret64; ret = SKP_SMULWB( a32, b32 ); tmp1 = SKP_RSHIFT_ROUND( b32, 16 ); tmp2 = SKP_MUL( a32, tmp1 ); - SKP_assert( (SKP_int64)tmp2 == (SKP_int64) a32 * (SKP_int64) tmp1 ); + SKP_assert( (opus_int64)tmp2 == (opus_int64) a32 * (opus_int64) tmp1 ); tmp1 = ret; ret = SKP_ADD32( tmp1, tmp2 ); SKP_assert( SKP_ADD32( tmp1, tmp2 ) == SKP_ADD_SAT32( tmp1, tmp2 ) ); ret64 = SKP_RSHIFT64( SKP_SMULL( a32, b32 ), 16 ); - SKP_assert( (SKP_int64)ret == ret64 ); + SKP_assert( (opus_int64)ret == ret64 ); return ret; } #undef SKP_SMLAWW -SKP_INLINE SKP_int32 SKP_SMLAWW(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ - SKP_int32 ret, tmp; +SKP_INLINE opus_int32 SKP_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ + opus_int32 ret, tmp; tmp = SKP_SMULWW( b32, c32 ); ret = SKP_ADD32( a32, tmp ); @@ -295,13 +295,13 @@ SKP_INLINE SKP_int32 SKP_SMLAWW(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ #undef SKP_MLA_ovflw #define SKP_MLA_ovflw(a32, b32, c32) ((a32) + ((b32) * (c32))) #undef SKP_SMLABB_ovflw -#define SKP_SMLABB_ovflw(a32, b32, c32) ((a32) + ((SKP_int32)((SKP_int16)(b32))) * (SKP_int32)((SKP_int16)(c32))) +#define SKP_SMLABB_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))) #undef SKP_SMLABT_ovflw -#define SKP_SMLABT_ovflw(a32, b32, c32) ((a32) + ((SKP_int32)((SKP_int16)(b32))) * ((c32) >> 16)) +#define SKP_SMLABT_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * ((c32) >> 16)) #undef SKP_SMLATT_ovflw #define SKP_SMLATT_ovflw(a32, b32, c32) ((a32) + ((b32) >> 16) * ((c32) >> 16)) #undef SKP_SMLAWB_ovflw -#define SKP_SMLAWB_ovflw(a32, b32, c32) ((a32) + ((((b32) >> 16) * (SKP_int32)((SKP_int16)(c32))) + ((((b32) & 0x0000FFFF) * (SKP_int32)((SKP_int16)(c32))) >> 16))) +#define SKP_SMLAWB_ovflw(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))) #undef SKP_SMLAWT_ovflw #define SKP_SMLAWT_ovflw(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16)) @@ -312,13 +312,13 @@ SKP_INLINE SKP_int32 SKP_SMLAWW(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32){ // no checking needed for SigProcFIX_CLZ32 #undef SKP_DIV32 -SKP_INLINE SKP_int32 SKP_DIV32(SKP_int32 a32, SKP_int32 b32){ +SKP_INLINE opus_int32 SKP_DIV32(opus_int32 a32, opus_int32 b32){ SKP_assert( b32 != 0 ); return a32 / b32; } #undef SKP_DIV32_16 -SKP_INLINE SKP_int32 SKP_DIV32_16(SKP_int32 a32, SKP_int32 b32){ +SKP_INLINE opus_int32 SKP_DIV32_16(opus_int32 a32, opus_int32 b32){ SKP_assert( b32 != 0 ); SKP_assert( b32 <= SKP_int16_MAX ); SKP_assert( b32 >= SKP_int16_MIN ); @@ -334,172 +334,172 @@ SKP_INLINE SKP_int32 SKP_DIV32_16(SKP_int32 a32, SKP_int32 b32){ // no checking needed for SKP_ADD_POS_SAT32 // no checking needed for SKP_ADD_POS_SAT64 #undef SKP_LSHIFT8 -SKP_INLINE SKP_int8 SKP_LSHIFT8(SKP_int8 a, SKP_int32 shift){ - SKP_int8 ret; +SKP_INLINE opus_int8 SKP_LSHIFT8(opus_int8 a, opus_int32 shift){ + opus_int8 ret; ret = a << shift; SKP_assert(shift >= 0); SKP_assert(shift < 8); - SKP_assert((SKP_int64)ret == ((SKP_int64)a) << shift); + SKP_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } #undef SKP_LSHIFT16 -SKP_INLINE SKP_int16 SKP_LSHIFT16(SKP_int16 a, SKP_int32 shift){ - SKP_int16 ret; +SKP_INLINE opus_int16 SKP_LSHIFT16(opus_int16 a, opus_int32 shift){ + opus_int16 ret; ret = a << shift; SKP_assert(shift >= 0); SKP_assert(shift < 16); - SKP_assert((SKP_int64)ret == ((SKP_int64)a) << shift); + SKP_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } #undef SKP_LSHIFT32 -SKP_INLINE SKP_int32 SKP_LSHIFT32(SKP_int32 a, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_LSHIFT32(opus_int32 a, opus_int32 shift){ + opus_int32 ret; ret = a << shift; SKP_assert(shift >= 0); SKP_assert(shift < 32); - SKP_assert((SKP_int64)ret == ((SKP_int64)a) << shift); + SKP_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } #undef SKP_LSHIFT64 -SKP_INLINE SKP_int64 SKP_LSHIFT64(SKP_int64 a, SKP_int shift){ +SKP_INLINE opus_int64 SKP_LSHIFT64(opus_int64 a, opus_int shift){ SKP_assert(shift >= 0); SKP_assert(shift < 64); return a << shift; } #undef SKP_LSHIFT_ovflw -SKP_INLINE SKP_int32 SKP_LSHIFT_ovflw(SKP_int32 a, SKP_int32 shift){ +SKP_INLINE opus_int32 SKP_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ SKP_assert(shift >= 0); /* no check for overflow */ return a << shift; } #undef SKP_LSHIFT_uint -SKP_INLINE SKP_uint32 SKP_LSHIFT_uint(SKP_uint32 a, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ + opus_uint32 ret; ret = a << shift; SKP_assert(shift >= 0); - SKP_assert((SKP_int64)ret == ((SKP_int64)a) << shift); + SKP_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } #undef SKP_RSHIFT8 -SKP_INLINE SKP_int8 SKP_RSHIFT8(SKP_int8 a, SKP_int32 shift){ +SKP_INLINE opus_int8 SKP_RSHIFT8(opus_int8 a, opus_int32 shift){ SKP_assert(shift >= 0); SKP_assert(shift < 8); return a >> shift; } #undef SKP_RSHIFT16 -SKP_INLINE SKP_int16 SKP_RSHIFT16(SKP_int16 a, SKP_int32 shift){ +SKP_INLINE opus_int16 SKP_RSHIFT16(opus_int16 a, opus_int32 shift){ SKP_assert(shift >= 0); SKP_assert(shift < 16); return a >> shift; } #undef SKP_RSHIFT32 -SKP_INLINE SKP_int32 SKP_RSHIFT32(SKP_int32 a, SKP_int32 shift){ +SKP_INLINE opus_int32 SKP_RSHIFT32(opus_int32 a, opus_int32 shift){ SKP_assert(shift >= 0); SKP_assert(shift < 32); return a >> shift; } #undef SKP_RSHIFT64 -SKP_INLINE SKP_int64 SKP_RSHIFT64(SKP_int64 a, SKP_int64 shift){ +SKP_INLINE opus_int64 SKP_RSHIFT64(opus_int64 a, opus_int64 shift){ SKP_assert(shift >= 0); SKP_assert(shift <= 63); return a >> shift; } #undef SKP_RSHIFT_uint -SKP_INLINE SKP_uint32 SKP_RSHIFT_uint(SKP_uint32 a, SKP_int32 shift){ +SKP_INLINE opus_uint32 SKP_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ SKP_assert(shift >= 0); SKP_assert(shift <= 32); return a >> shift; } #undef SKP_ADD_LSHIFT -SKP_INLINE SKP_int32 SKP_ADD_LSHIFT(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a + (b << shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) << shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; // shift >= 0 } #undef SKP_ADD_LSHIFT32 -SKP_INLINE SKP_int32 SKP_ADD_LSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a + (b << shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) << shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; // shift >= 0 } #undef SKP_ADD_LSHIFT_uint -SKP_INLINE SKP_uint32 SKP_ADD_LSHIFT_uint(SKP_uint32 a, SKP_uint32 b, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ + opus_uint32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 32); ret = a + (b << shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) << shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; // shift >= 0 } #undef SKP_ADD_RSHIFT -SKP_INLINE SKP_int32 SKP_ADD_RSHIFT(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a + (b >> shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) >> shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; // shift > 0 } #undef SKP_ADD_RSHIFT32 -SKP_INLINE SKP_int32 SKP_ADD_RSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a + (b >> shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) >> shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; // shift > 0 } #undef SKP_ADD_RSHIFT_uint -SKP_INLINE SKP_uint32 SKP_ADD_RSHIFT_uint(SKP_uint32 a, SKP_uint32 b, SKP_int32 shift){ - SKP_uint32 ret; +SKP_INLINE opus_uint32 SKP_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ + opus_uint32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 32); ret = a + (b >> shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a + (((SKP_int64)b) >> shift)); + SKP_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; // shift > 0 } #undef SKP_SUB_LSHIFT32 -SKP_INLINE SKP_int32 SKP_SUB_LSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a - (b << shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a - (((SKP_int64)b) << shift)); + SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift)); return ret; // shift >= 0 } #undef SKP_SUB_RSHIFT32 -SKP_INLINE SKP_int32 SKP_SUB_RSHIFT32(SKP_int32 a, SKP_int32 b, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift >= 0); SKP_assert(shift <= 31); ret = a - (b >> shift); - SKP_assert((SKP_int64)ret == (SKP_int64)a - (((SKP_int64)b) >> shift)); + SKP_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) >> shift)); return ret; // shift > 0 } #undef SKP_RSHIFT_ROUND -SKP_INLINE SKP_int32 SKP_RSHIFT_ROUND(SKP_int32 a, SKP_int32 shift){ - SKP_int32 ret; +SKP_INLINE opus_int32 SKP_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ + opus_int32 ret; SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */ SKP_assert(shift < 32); ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; - SKP_assert((SKP_int64)ret == ((SKP_int64)a + ((SKP_int64)1 << (shift - 1))) >> shift); + SKP_assert((opus_int64)ret == ((opus_int64)a + ((opus_int64)1 << (shift - 1))) >> shift); return ret; } #undef SKP_RSHIFT_ROUND64 -SKP_INLINE SKP_int64 SKP_RSHIFT_ROUND64(SKP_int64 a, SKP_int32 shift){ - SKP_int64 ret; +SKP_INLINE opus_int64 SKP_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ + opus_int64 ret; SKP_assert(shift > 0); /* the marco definition can't handle a shift of zero */ SKP_assert(shift < 64); ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1; @@ -508,44 +508,44 @@ SKP_INLINE SKP_int64 SKP_RSHIFT_ROUND64(SKP_int64 a, SKP_int32 shift){ // SKP_abs is used on floats also, so doesn't work... //#undef SKP_abs -//SKP_INLINE SKP_int32 SKP_abs(SKP_int32 a){ +//SKP_INLINE opus_int32 SKP_abs(opus_int32 a){ // SKP_assert(a != 0x80000000); // return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN //} #undef SKP_abs_int64 -SKP_INLINE SKP_int64 SKP_abs_int64(SKP_int64 a){ +SKP_INLINE opus_int64 SKP_abs_int64(opus_int64 a){ SKP_assert(a != 0x8000000000000000); return (((a) > 0) ? (a) : -(a)); // Be careful, SKP_abs returns wrong when input equals to SKP_intXX_MIN } #undef SKP_abs_int32 -SKP_INLINE SKP_int32 SKP_abs_int32(SKP_int32 a){ +SKP_INLINE opus_int32 SKP_abs_int32(opus_int32 a){ SKP_assert(a != 0x80000000); return abs(a); } #undef SKP_CHECK_FIT8 -SKP_INLINE SKP_int8 SKP_CHECK_FIT8( SKP_int64 a ){ - SKP_int8 ret; - ret = (SKP_int8)a; - SKP_assert( (SKP_int64)ret == a ); +SKP_INLINE opus_int8 SKP_CHECK_FIT8( opus_int64 a ){ + opus_int8 ret; + ret = (opus_int8)a; + SKP_assert( (opus_int64)ret == a ); return( ret ); } #undef SKP_CHECK_FIT16 -SKP_INLINE SKP_int16 SKP_CHECK_FIT16( SKP_int64 a ){ - SKP_int16 ret; - ret = (SKP_int16)a; - SKP_assert( (SKP_int64)ret == a ); +SKP_INLINE opus_int16 SKP_CHECK_FIT16( opus_int64 a ){ + opus_int16 ret; + ret = (opus_int16)a; + SKP_assert( (opus_int64)ret == a ); return( ret ); } #undef SKP_CHECK_FIT32 -SKP_INLINE SKP_int32 SKP_CHECK_FIT32( SKP_int64 a ){ - SKP_int32 ret; - ret = (SKP_int32)a; - SKP_assert( (SKP_int64)ret == a ); +SKP_INLINE opus_int32 SKP_CHECK_FIT32( opus_int64 a ){ + opus_int32 ret; + ret = (opus_int32)a; + SKP_assert( (opus_int64)ret == a ); return( ret ); } diff --git a/silk/silk_NLSF2A.c b/silk/silk_NLSF2A.c index 37e2e6e49da6a265666d1f8dbeeb76eb1cb28e45..da9cfa8eb35c11a56831f9868717ecd7d805754f 100644 --- a/silk/silk_NLSF2A.c +++ b/silk/silk_NLSF2A.c @@ -38,21 +38,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* helper function for NLSF2A(..) */ SKP_INLINE void silk_NLSF2A_find_poly( - SKP_int32 *out, /* O intermediate polynomial, QA [dd+1] */ - const SKP_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */ - SKP_int dd /* I polynomial order (= 1/2 * filter order) */ + opus_int32 *out, /* O intermediate polynomial, QA [dd+1] */ + const opus_int32 *cLSF, /* I vector of interleaved 2*cos(LSFs), QA [d] */ + opus_int dd /* I polynomial order (= 1/2 * filter order) */ ) { - SKP_int k, n; - SKP_int32 ftmp; + opus_int k, n; + opus_int32 ftmp; out[0] = SKP_LSHIFT( 1, QA ); out[1] = -cLSF[0]; for( k = 1; k < dd; k++ ) { ftmp = cLSF[2*k]; // QA - out[k+1] = SKP_LSHIFT( out[k-1], 1 ) - (SKP_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[k] ), QA ); + out[k+1] = SKP_LSHIFT( out[k-1], 1 ) - (opus_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[k] ), QA ); for( n = k; n > 1; n-- ) { - out[n] += out[n-2] - (SKP_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[n-1] ), QA ); + out[n] += out[n-2] - (opus_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[n-1] ), QA ); } out[1] -= ftmp; } @@ -60,17 +60,17 @@ SKP_INLINE void silk_NLSF2A_find_poly( /* compute whitening filter coefficients from normalized line spectral frequencies */ void silk_NLSF2A( - SKP_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ - const SKP_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ - const SKP_int d /* I filter order (should be even) */ + opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ + const opus_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ + const opus_int d /* I filter order (should be even) */ ) { - SKP_int k, i, dd; - SKP_int32 cos_LSF_QA[ SILK_MAX_ORDER_LPC ]; - SKP_int32 P[ SILK_MAX_ORDER_LPC / 2 + 1 ], Q[ SILK_MAX_ORDER_LPC / 2 + 1 ]; - SKP_int32 Ptmp, Qtmp, f_int, f_frac, cos_val, delta; - SKP_int32 a32_QA1[ SILK_MAX_ORDER_LPC ]; - SKP_int32 maxabs, absval, idx=0, sc_Q16, invGain_Q30; + opus_int k, i, dd; + opus_int32 cos_LSF_QA[ SILK_MAX_ORDER_LPC ]; + opus_int32 P[ SILK_MAX_ORDER_LPC / 2 + 1 ], Q[ SILK_MAX_ORDER_LPC / 2 + 1 ]; + opus_int32 Ptmp, Qtmp, f_int, f_frac, cos_val, delta; + opus_int32 a32_QA1[ SILK_MAX_ORDER_LPC ]; + opus_int32 maxabs, absval, idx=0, sc_Q16, invGain_Q30; SKP_assert( LSF_COS_TAB_SZ_FIX == 128 ); @@ -102,7 +102,7 @@ void silk_NLSF2A( silk_NLSF2A_find_poly( P, &cos_LSF_QA[ 0 ], dd ); silk_NLSF2A_find_poly( Q, &cos_LSF_QA[ 1 ], dd ); - /* convert even and odd polynomials to SKP_int32 Q12 filter coefs */ + /* convert even and odd polynomials to opus_int32 Q12 filter coefs */ for( k = 0; k < dd; k++ ) { Ptmp = P[ k+1 ] + P[ k ]; Qtmp = Q[ k+1 ] - Q[ k ]; @@ -139,12 +139,12 @@ void silk_NLSF2A( if( i == 10 ) { /* Reached the last iteration, clip the coefficients */ for( k = 0; k < d; k++ ) { - a_Q12[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ) ); /* QA+1 -> Q12 */ - a32_QA1[ k ] = SKP_LSHIFT( (SKP_int32)a_Q12[ k ], QA + 1 - 12 ); + a_Q12[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ) ); /* QA+1 -> Q12 */ + a32_QA1[ k ] = SKP_LSHIFT( (opus_int32)a_Q12[ k ], QA + 1 - 12 ); } } else { for( k = 0; k < d; k++ ) { - a_Q12[ k ] = (SKP_int16)SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */ + a_Q12[ k ] = (opus_int16)SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */ } } @@ -154,7 +154,7 @@ void silk_NLSF2A( /* on the unscaled coefficients, convert to Q12 and measure again */ silk_bwexpander_32( a32_QA1, d, 65536 - SKP_SMULBB( 9 + i, i ) ); /* 10_Q16 = 0.00015 */ for( k = 0; k < d; k++ ) { - a_Q12[ k ] = (SKP_int16)SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */ + a_Q12[ k ] = (opus_int16)SKP_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */ } } else { break; diff --git a/silk/silk_NLSF_VQ.c b/silk/silk_NLSF_VQ.c index caecbcfb00af0ca738e2a8a916b30f792f610fad..cc6c47c491ce132b8f465933d87ad568cc733edc 100644 --- a/silk/silk_NLSF_VQ.c +++ b/silk/silk_NLSF_VQ.c @@ -29,15 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */ void silk_NLSF_VQ( - SKP_int32 err_Q26[], /* O Quantization errors [K] */ - const SKP_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */ - const SKP_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */ - const SKP_int K, /* I Number of codebook vectors */ - const SKP_int LPC_order /* I Number of LPCs */ + opus_int32 err_Q26[], /* O Quantization errors [K] */ + const opus_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */ + const opus_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */ + const opus_int K, /* I Number of codebook vectors */ + const opus_int LPC_order /* I Number of LPCs */ ) { - SKP_int i, m; - SKP_int32 diff_Q15, sum_error_Q30, sum_error_Q26; + opus_int i, m; + opus_int32 diff_Q15, sum_error_Q30, sum_error_Q26; SKP_assert( LPC_order <= 16 ); SKP_assert( ( LPC_order & 1 ) == 0 ); @@ -47,11 +47,11 @@ void silk_NLSF_VQ( sum_error_Q26 = 0; for( m = 0; m < LPC_order; m += 2 ) { /* Compute weighted squared quantization error for index m */ - diff_Q15 = SKP_SUB_LSHIFT32( in_Q15[ m ], ( SKP_int32 )*pCB_Q8++, 7 ); // range: [ -32767 : 32767 ] + diff_Q15 = SKP_SUB_LSHIFT32( in_Q15[ m ], ( opus_int32 )*pCB_Q8++, 7 ); // range: [ -32767 : 32767 ] sum_error_Q30 = SKP_SMULBB( diff_Q15, diff_Q15 ); /* Compute weighted squared quantization error for index m + 1 */ - diff_Q15 = SKP_SUB_LSHIFT32( in_Q15[m + 1], ( SKP_int32 )*pCB_Q8++, 7 ); // range: [ -32767 : 32767 ] + diff_Q15 = SKP_SUB_LSHIFT32( in_Q15[m + 1], ( opus_int32 )*pCB_Q8++, 7 ); // range: [ -32767 : 32767 ] sum_error_Q30 = SKP_SMLABB( sum_error_Q30, diff_Q15, diff_Q15 ); sum_error_Q26 = SKP_ADD_RSHIFT32( sum_error_Q26, sum_error_Q30, 4 ); diff --git a/silk/silk_NLSF_VQ_weights_laroia.c b/silk/silk_NLSF_VQ_weights_laroia.c index 2e59e7cf9b32849136b8942a8418c4b733a09ecc..82d68253626ef3cecb29bdd09e105c67f8e7068c 100644 --- a/silk/silk_NLSF_VQ_weights_laroia.c +++ b/silk/silk_NLSF_VQ_weights_laroia.c @@ -36,13 +36,13 @@ Signal Processing, pp. 641-644, 1991. /* Laroia low complexity NLSF weights */ void silk_NLSF_VQ_weights_laroia( - SKP_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */ - const SKP_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */ - const SKP_int D /* I: Input vector dimension (even) */ + opus_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */ + const opus_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */ + const opus_int D /* I: Input vector dimension (even) */ ) { - SKP_int k; - SKP_int32 tmp1_int, tmp2_int; + opus_int k; + opus_int32 tmp1_int, tmp2_int; SKP_assert( D > 0 ); SKP_assert( ( D & 1 ) == 0 ); @@ -52,25 +52,25 @@ void silk_NLSF_VQ_weights_laroia( tmp1_int = SKP_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); tmp2_int = SKP_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], 1 ); tmp2_int = SKP_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp2_int ); - pNLSFW_Q_OUT[ 0 ] = (SKP_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); + pNLSFW_Q_OUT[ 0 ] = (opus_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); SKP_assert( pNLSFW_Q_OUT[ 0 ] > 0 ); /* Main loop */ for( k = 1; k < D - 1; k += 2 ) { tmp1_int = SKP_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], 1 ); tmp1_int = SKP_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); - pNLSFW_Q_OUT[ k ] = (SKP_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); + pNLSFW_Q_OUT[ k ] = (opus_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); SKP_assert( pNLSFW_Q_OUT[ k ] > 0 ); tmp2_int = SKP_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], 1 ); tmp2_int = SKP_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp2_int ); - pNLSFW_Q_OUT[ k + 1 ] = (SKP_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); + pNLSFW_Q_OUT[ k + 1 ] = (opus_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); SKP_assert( pNLSFW_Q_OUT[ k + 1 ] > 0 ); } /* Last value */ tmp1_int = SKP_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], 1 ); tmp1_int = SKP_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); - pNLSFW_Q_OUT[ D - 1 ] = (SKP_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); + pNLSFW_Q_OUT[ D - 1 ] = (opus_int16)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX ); SKP_assert( pNLSFW_Q_OUT[ D - 1 ] > 0 ); } diff --git a/silk/silk_NLSF_decode.c b/silk/silk_NLSF_decode.c index 2c2a4978b2e859dd88c7500784c606efd1b9e57f..214d22bd1808fa4629b38e11802111227193f89b 100644 --- a/silk/silk_NLSF_decode.c +++ b/silk/silk_NLSF_decode.c @@ -29,18 +29,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Predictive dequantizer for NLSF residuals */ void silk_NLSF_residual_dequant( /* O Returns RD value in Q30 */ - SKP_int16 x_Q10[], /* O Output [ order ] */ - const SKP_int8 indices[], /* I Quantization indices [ order ] */ - const SKP_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ - const SKP_int quant_step_size_Q16, /* I Quantization step size */ - const SKP_int16 order /* I Number of input values */ + opus_int16 x_Q10[], /* O Output [ order ] */ + const opus_int8 indices[], /* I Quantization indices [ order ] */ + const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ + const opus_int quant_step_size_Q16, /* I Quantization step size */ + const opus_int16 order /* I Number of input values */ ) { - SKP_int i, out_Q10, pred_Q10; + opus_int i, out_Q10, pred_Q10; out_Q10 = 0; for( i = order-1; i >= 0; i-- ) { - pred_Q10 = SKP_RSHIFT( SKP_SMULBB( out_Q10, (SKP_int16)pred_coef_Q8[ i ] ), 8 ); + pred_Q10 = SKP_RSHIFT( SKP_SMULBB( out_Q10, (opus_int16)pred_coef_Q8[ i ] ), 8 ); out_Q10 = SKP_LSHIFT( indices[ i ], 10 ); if( out_Q10 > 0 ) { out_Q10 = SKP_SUB16( out_Q10, SILK_FIX_CONST( NLSF_QUANT_LEVEL_ADJ, 10 ) ); @@ -57,23 +57,23 @@ void silk_NLSF_residual_dequant( /* O Returns RD v /* NLSF vector decoder */ /***********************/ void silk_NLSF_decode( - SKP_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */ - SKP_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ + opus_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */ + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ const silk_NLSF_CB_struct *psNLSF_CB /* I Codebook object */ ) { - SKP_int i; - SKP_uint8 pred_Q8[ MAX_LPC_ORDER ]; - SKP_int16 ec_ix[ MAX_LPC_ORDER ]; - SKP_int16 res_Q10[ MAX_LPC_ORDER ]; - SKP_int16 W_tmp_QW[ MAX_LPC_ORDER ]; - SKP_int32 W_tmp_Q9, NLSF_Q15_tmp; - const SKP_uint8 *pCB_element; + opus_int i; + opus_uint8 pred_Q8[ MAX_LPC_ORDER ]; + opus_int16 ec_ix[ MAX_LPC_ORDER ]; + opus_int16 res_Q10[ MAX_LPC_ORDER ]; + opus_int16 W_tmp_QW[ MAX_LPC_ORDER ]; + opus_int32 W_tmp_Q9, NLSF_Q15_tmp; + const opus_uint8 *pCB_element; /* Decode first stage */ pCB_element = &psNLSF_CB->CB1_NLSF_Q8[ NLSFIndices[ 0 ] * psNLSF_CB->order ]; for( i = 0; i < psNLSF_CB->order; i++ ) { - pNLSF_Q15[ i ] = SKP_LSHIFT( ( SKP_int16 )pCB_element[ i ], 7 ); + pNLSF_Q15[ i ] = SKP_LSHIFT( ( opus_int16 )pCB_element[ i ], 7 ); } /* Unpack entropy table indices and predictor for current CB1 index */ @@ -87,9 +87,9 @@ void silk_NLSF_decode( /* Apply inverse square-rooted weights and add to output */ for( i = 0; i < psNLSF_CB->order; i++ ) { - W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( SKP_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); - NLSF_Q15_tmp = SKP_ADD32( pNLSF_Q15[ i ], SKP_DIV32_16( SKP_LSHIFT( ( SKP_int32 )res_Q10[ i ], 14 ), W_tmp_Q9 ) ); - pNLSF_Q15[ i ] = (SKP_int16)SKP_LIMIT( NLSF_Q15_tmp, 0, 32767 ); + W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( opus_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); + NLSF_Q15_tmp = SKP_ADD32( pNLSF_Q15[ i ], SKP_DIV32_16( SKP_LSHIFT( ( opus_int32 )res_Q10[ i ], 14 ), W_tmp_Q9 ) ); + pNLSF_Q15[ i ] = (opus_int16)SKP_LIMIT( NLSF_Q15_tmp, 0, 32767 ); } /* NLSF stabilization */ diff --git a/silk/silk_NLSF_del_dec_quant.c b/silk/silk_NLSF_del_dec_quant.c index 8361fd638523b756e4cef0d18f9ca55af68911ba..aeb66dc568e1eb6c57323ab5344fd65cf9ddba60 100644 --- a/silk/silk_NLSF_del_dec_quant.c +++ b/silk/silk_NLSF_del_dec_quant.c @@ -28,29 +28,29 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main.h" /* Delayed-decision quantizer for NLSF residuals */ -SKP_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */ - SKP_int8 indices[], /* O Quantization indices [ order ] */ - const SKP_int16 x_Q10[], /* I Input [ order ] */ - const SKP_int16 w_Q5[], /* I Weights [ order ] */ - const SKP_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ - const SKP_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */ - const SKP_uint8 ec_rates_Q5[], /* I Rates [] */ - const SKP_int quant_step_size_Q16, /* I Quantization step size */ - const SKP_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */ - const SKP_int32 mu_Q20, /* I R/D tradeoff */ - const SKP_int16 order /* I Number of input values */ +opus_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */ + opus_int8 indices[], /* O Quantization indices [ order ] */ + const opus_int16 x_Q10[], /* I Input [ order ] */ + const opus_int16 w_Q5[], /* I Weights [ order ] */ + const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ + const opus_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */ + const opus_uint8 ec_rates_Q5[], /* I Rates [] */ + const opus_int quant_step_size_Q16, /* I Quantization step size */ + const opus_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */ + const opus_int32 mu_Q20, /* I R/D tradeoff */ + const opus_int16 order /* I Number of input values */ ) { - SKP_int i, j, nStates, ind_tmp, ind_min_max, ind_max_min, in_Q10, res_Q10; - SKP_int pred_Q10, diff_Q10, out0_Q10, out1_Q10, rate0_Q5, rate1_Q5; - SKP_int32 RD_tmp_Q25, min_Q25, min_max_Q25, max_min_Q25, pred_coef_Q16; - SKP_int ind_sort[ NLSF_QUANT_DEL_DEC_STATES ]; - SKP_int8 ind[ NLSF_QUANT_DEL_DEC_STATES ][ MAX_LPC_ORDER ]; - SKP_int16 prev_out_Q10[ 2 * NLSF_QUANT_DEL_DEC_STATES ]; - SKP_int32 RD_Q25[ 2 * NLSF_QUANT_DEL_DEC_STATES ]; - SKP_int32 RD_min_Q25[ NLSF_QUANT_DEL_DEC_STATES ]; - SKP_int32 RD_max_Q25[ NLSF_QUANT_DEL_DEC_STATES ]; - const SKP_uint8 *rates_Q5; + opus_int i, j, nStates, ind_tmp, ind_min_max, ind_max_min, in_Q10, res_Q10; + opus_int pred_Q10, diff_Q10, out0_Q10, out1_Q10, rate0_Q5, rate1_Q5; + opus_int32 RD_tmp_Q25, min_Q25, min_max_Q25, max_min_Q25, pred_coef_Q16; + opus_int ind_sort[ NLSF_QUANT_DEL_DEC_STATES ]; + opus_int8 ind[ NLSF_QUANT_DEL_DEC_STATES ][ MAX_LPC_ORDER ]; + opus_int16 prev_out_Q10[ 2 * NLSF_QUANT_DEL_DEC_STATES ]; + opus_int32 RD_Q25[ 2 * NLSF_QUANT_DEL_DEC_STATES ]; + opus_int32 RD_min_Q25[ NLSF_QUANT_DEL_DEC_STATES ]; + opus_int32 RD_max_Q25[ NLSF_QUANT_DEL_DEC_STATES ]; + const opus_uint8 *rates_Q5; SKP_assert( (NLSF_QUANT_DEL_DEC_STATES & (NLSF_QUANT_DEL_DEC_STATES-1)) == 0 ); /* must be power of two */ @@ -59,14 +59,14 @@ SKP_int32 silk_NLSF_del_dec_quant( /* O Returns RD value prev_out_Q10[ 0 ] = 0; for( i = order - 1; ; i-- ) { rates_Q5 = &ec_rates_Q5[ ec_ix[ i ] ]; - pred_coef_Q16 = SKP_LSHIFT( (SKP_int32)pred_coef_Q8[ i ], 8 ); + pred_coef_Q16 = SKP_LSHIFT( (opus_int32)pred_coef_Q8[ i ], 8 ); in_Q10 = x_Q10[ i ]; for( j = 0; j < nStates; j++ ) { pred_Q10 = SKP_SMULWB( pred_coef_Q16, prev_out_Q10[ j ] ); res_Q10 = SKP_SUB16( in_Q10, pred_Q10 ); ind_tmp = SKP_SMULWB( inv_quant_step_size_Q6, res_Q10 ); ind_tmp = SKP_LIMIT( ind_tmp, -NLSF_QUANT_MAX_AMPLITUDE_EXT, NLSF_QUANT_MAX_AMPLITUDE_EXT-1 ); - ind[ j ][ i ] = (SKP_int8)ind_tmp; + ind[ j ][ i ] = (opus_int8)ind_tmp; /* compute outputs for ind_tmp and ind_tmp + 1 */ out0_Q10 = SKP_LSHIFT( ind_tmp, 10 ); @@ -171,7 +171,7 @@ SKP_int32 silk_NLSF_del_dec_quant( /* O Returns RD value prev_out_Q10[ ind_max_min ] = prev_out_Q10[ ind_min_max + NLSF_QUANT_DEL_DEC_STATES ]; RD_min_Q25[ ind_max_min ] = 0; RD_max_Q25[ ind_min_max ] = SKP_int32_MAX; - SKP_memcpy( ind[ ind_max_min ], ind[ ind_min_max ], MAX_LPC_ORDER * sizeof( SKP_int8 ) ); + SKP_memcpy( ind[ ind_max_min ], ind[ ind_min_max ], MAX_LPC_ORDER * sizeof( opus_int8 ) ); } /* increment index if it comes from the upper half */ for( j = 0; j < NLSF_QUANT_DEL_DEC_STATES; j++ ) { diff --git a/silk/silk_NLSF_encode.c b/silk/silk_NLSF_encode.c index a0e364a1f44eaf621eeb4953e6bf2984b1aeff06..cf35e5257ba282187b6ac2bd0523e9d9008a04f2 100644 --- a/silk/silk_NLSF_encode.c +++ b/silk/silk_NLSF_encode.c @@ -32,37 +32,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /***********************/ /* NLSF vector encoder */ /***********************/ -SKP_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */ - SKP_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ - SKP_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */ +opus_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */ + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ + opus_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */ const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ - const SKP_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */ - const SKP_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */ - const SKP_int nSurvivors, /* I Max survivors after first stage */ - const SKP_int signalType /* I Signal type: 0/1/2 */ + const opus_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */ + const opus_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */ + const opus_int nSurvivors, /* I Max survivors after first stage */ + const opus_int signalType /* I Signal type: 0/1/2 */ ) { - SKP_int i, s, ind1, bestIndex, prob_Q8, bits_q7; - SKP_int32 W_tmp_Q9; - SKP_int32 err_Q26[ NLSF_VQ_MAX_VECTORS ]; - SKP_int32 RD_Q25[ NLSF_VQ_MAX_SURVIVORS ]; - SKP_int tempIndices1[ NLSF_VQ_MAX_SURVIVORS ]; - SKP_int8 tempIndices2[ NLSF_VQ_MAX_SURVIVORS * MAX_LPC_ORDER ]; - SKP_int16 res_Q15[ MAX_LPC_ORDER ]; - SKP_int16 res_Q10[ MAX_LPC_ORDER ]; - SKP_int16 NLSF_tmp_Q15[ MAX_LPC_ORDER ]; - SKP_int16 W_tmp_QW[ MAX_LPC_ORDER ]; - SKP_int16 W_adj_Q5[ MAX_LPC_ORDER ]; - SKP_uint8 pred_Q8[ MAX_LPC_ORDER ]; - SKP_int16 ec_ix[ MAX_LPC_ORDER ]; - const SKP_uint8 *pCB_element, *iCDF_ptr; + opus_int i, s, ind1, bestIndex, prob_Q8, bits_q7; + opus_int32 W_tmp_Q9; + opus_int32 err_Q26[ NLSF_VQ_MAX_VECTORS ]; + opus_int32 RD_Q25[ NLSF_VQ_MAX_SURVIVORS ]; + opus_int tempIndices1[ NLSF_VQ_MAX_SURVIVORS ]; + opus_int8 tempIndices2[ NLSF_VQ_MAX_SURVIVORS * MAX_LPC_ORDER ]; + opus_int16 res_Q15[ MAX_LPC_ORDER ]; + opus_int16 res_Q10[ MAX_LPC_ORDER ]; + opus_int16 NLSF_tmp_Q15[ MAX_LPC_ORDER ]; + opus_int16 W_tmp_QW[ MAX_LPC_ORDER ]; + opus_int16 W_adj_Q5[ MAX_LPC_ORDER ]; + opus_uint8 pred_Q8[ MAX_LPC_ORDER ]; + opus_int16 ec_ix[ MAX_LPC_ORDER ]; + const opus_uint8 *pCB_element, *iCDF_ptr; #if STORE_LSF_DATA_FOR_TRAINING - SKP_int16 pNLSF_Q15_orig[MAX_LPC_ORDER ]; - DEBUG_STORE_DATA( NLSF.dat, pNLSF_Q15, psNLSF_CB->order * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( WNLSF.dat, pW_Q5, psNLSF_CB->order * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q20, sizeof( SKP_int ) ); - DEBUG_STORE_DATA( sigType.dat, &signalType, sizeof( SKP_int ) ); + opus_int16 pNLSF_Q15_orig[MAX_LPC_ORDER ]; + DEBUG_STORE_DATA( NLSF.dat, pNLSF_Q15, psNLSF_CB->order * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( WNLSF.dat, pW_Q5, psNLSF_CB->order * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q20, sizeof( opus_int ) ); + DEBUG_STORE_DATA( sigType.dat, &signalType, sizeof( opus_int ) ); SKP_memcpy(pNLSF_Q15_orig, pNLSF_Q15, sizeof( pNLSF_Q15_orig )); #endif @@ -86,7 +86,7 @@ SKP_int32 silk_NLSF_encode( /* O Returns RD v /* Residual after first stage */ pCB_element = &psNLSF_CB->CB1_NLSF_Q8[ ind1 * psNLSF_CB->order ]; for( i = 0; i < psNLSF_CB->order; i++ ) { - NLSF_tmp_Q15[ i ] = SKP_LSHIFT16( ( SKP_int16 )pCB_element[ i ], 7 ); + NLSF_tmp_Q15[ i ] = SKP_LSHIFT16( ( opus_int16 )pCB_element[ i ], 7 ); res_Q15[ i ] = pNLSF_Q15[ i ] - NLSF_tmp_Q15[ i ]; } @@ -95,13 +95,13 @@ SKP_int32 silk_NLSF_encode( /* O Returns RD v /* Apply square-rooted weights */ for( i = 0; i < psNLSF_CB->order; i++ ) { - W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( SKP_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); - res_Q10[ i ] = ( SKP_int16 )SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); + W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( opus_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); + res_Q10[ i ] = ( opus_int16 )SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); } /* Modify input weights accordingly */ for( i = 0; i < psNLSF_CB->order; i++ ) { - W_adj_Q5[ i ] = SKP_DIV32_16( SKP_LSHIFT( ( SKP_int32 )pW_QW[ i ], 5 ), W_tmp_QW[ i ] ); + W_adj_Q5[ i ] = SKP_DIV32_16( SKP_LSHIFT( ( opus_int32 )pW_QW[ i ], 5 ), W_tmp_QW[ i ] ); } /* Unpack entropy table indices and predictor for current CB1 index */ @@ -125,8 +125,8 @@ SKP_int32 silk_NLSF_encode( /* O Returns RD v /* Find the lowest rate-distortion error */ silk_insertion_sort_increasing( RD_Q25, &bestIndex, nSurvivors, 1 ); - NLSFIndices[ 0 ] = ( SKP_int8 )tempIndices1[ bestIndex ]; - SKP_memcpy( &NLSFIndices[ 1 ], &tempIndices2[ bestIndex * MAX_LPC_ORDER ], psNLSF_CB->order * sizeof( SKP_int8 ) ); + NLSFIndices[ 0 ] = ( opus_int8 )tempIndices1[ bestIndex ]; + SKP_memcpy( &NLSFIndices[ 1 ], &tempIndices2[ bestIndex * MAX_LPC_ORDER ], psNLSF_CB->order * sizeof( opus_int8 ) ); /* Decode */ silk_NLSF_decode( pNLSF_Q15, NLSFIndices, psNLSF_CB ); @@ -134,23 +134,23 @@ SKP_int32 silk_NLSF_encode( /* O Returns RD v #if STORE_LSF_DATA_FOR_TRAINING { /* code for training the codebooks */ - SKP_int32 RD_dec_Q22, Dist_Q22_dec, Rate_Q7, diff_Q15; + opus_int32 RD_dec_Q22, Dist_Q22_dec, Rate_Q7, diff_Q15; ind1 = NLSFIndices[ 0 ]; silk_NLSF_unpack( ec_ix, pred_Q8, psNLSF_CB, ind1 ); pCB_element = &psNLSF_CB->CB1_NLSF_Q8[ ind1 * psNLSF_CB->order ]; for( i = 0; i < psNLSF_CB->order; i++ ) { - NLSF_tmp_Q15[ i ] = SKP_LSHIFT16( ( SKP_int16 )pCB_element[ i ], 7 ); + NLSF_tmp_Q15[ i ] = SKP_LSHIFT16( ( opus_int16 )pCB_element[ i ], 7 ); } silk_NLSF_VQ_weights_laroia( W_tmp_QW, NLSF_tmp_Q15, psNLSF_CB->order ); for( i = 0; i < psNLSF_CB->order; i++ ) { - W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( SKP_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); + W_tmp_Q9 = silk_SQRT_APPROX( SKP_LSHIFT( ( opus_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) ); res_Q15[ i ] = pNLSF_Q15_orig[ i ] - NLSF_tmp_Q15[ i ]; - res_Q10[ i ] = (SKP_int16)SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); - DEBUG_STORE_DATA( NLSF_res_q10.dat, &res_Q10[ i ], sizeof( SKP_int16 ) ); + res_Q10[ i ] = (opus_int16)SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); + DEBUG_STORE_DATA( NLSF_res_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) ); res_Q15[ i ] = pNLSF_Q15[ i ] - NLSF_tmp_Q15[ i ]; - res_Q10[ i ] = (SKP_int16)SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); - DEBUG_STORE_DATA( NLSF_resq_q10.dat, &res_Q10[ i ], sizeof( SKP_int16 ) ); + res_Q10[ i ] = (opus_int16)SKP_RSHIFT( SKP_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 ); + DEBUG_STORE_DATA( NLSF_resq_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) ); } Dist_Q22_dec = 0; @@ -172,11 +172,11 @@ SKP_int32 silk_NLSF_encode( /* O Returns RD v } } RD_dec_Q22 = Dist_Q22_dec + Rate_Q7 * NLSF_mu_Q20 >> 5; - DEBUG_STORE_DATA( dec_dist_q22.dat, &Dist_Q22_dec, sizeof( SKP_int32 ) ); - DEBUG_STORE_DATA( dec_rate_q7.dat, &Rate_Q7, sizeof( SKP_int32 ) ); - DEBUG_STORE_DATA( dec_rd_q22.dat, &RD_dec_Q22, sizeof( SKP_int32 ) ); + DEBUG_STORE_DATA( dec_dist_q22.dat, &Dist_Q22_dec, sizeof( opus_int32 ) ); + DEBUG_STORE_DATA( dec_rate_q7.dat, &Rate_Q7, sizeof( opus_int32 ) ); + DEBUG_STORE_DATA( dec_rd_q22.dat, &RD_dec_Q22, sizeof( opus_int32 ) ); } - DEBUG_STORE_DATA( NLSF_ind.dat, NLSFIndices, (psNLSF_CB->order+1) * sizeof( SKP_int8 ) ); + DEBUG_STORE_DATA( NLSF_ind.dat, NLSFIndices, (psNLSF_CB->order+1) * sizeof( opus_int8 ) ); #endif return RD_Q25[ 0 ]; diff --git a/silk/silk_NLSF_stabilize.c b/silk/silk_NLSF_stabilize.c index d9f002c2ee2bf8460e9a46aebd98dc868b78ee1c..fadfec7ae1d7204036602a46b40b888a1433d195 100644 --- a/silk/silk_NLSF_stabilize.c +++ b/silk/silk_NLSF_stabilize.c @@ -41,16 +41,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* NLSF stabilizer, for a single input data vector */ void silk_NLSF_stabilize( - SKP_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */ - const SKP_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */ - const SKP_int L /* I: Number of NLSF parameters in the input vector */ + opus_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */ + const opus_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */ + const opus_int L /* I: Number of NLSF parameters in the input vector */ ) { - SKP_int i, I=0, k, loops; - SKP_int16 center_freq_Q15; - SKP_int32 diff_Q15, min_diff_Q15, min_center_Q15, max_center_Q15; + opus_int i, I=0, k, loops; + opus_int16 center_freq_Q15; + opus_int32 diff_Q15, min_diff_Q15, min_center_Q15, max_center_Q15; - /* This is necessary to ensure an output within range of a SKP_int16 */ + /* This is necessary to ensure an output within range of a opus_int16 */ SKP_assert( NDeltaMin_Q15[L] >= 1 ); for( loops = 0; loops < MAX_LOOPS; loops++ ) { @@ -106,7 +106,7 @@ void silk_NLSF_stabilize( max_center_Q15 -= SKP_RSHIFT( NDeltaMin_Q15[I], 1 ); /* Move apart, sorted by value, keeping the same center frequency */ - center_freq_Q15 = (SKP_int16)SKP_LIMIT_32( SKP_RSHIFT_ROUND( (SKP_int32)NLSF_Q15[I-1] + (SKP_int32)NLSF_Q15[I], 1 ), + center_freq_Q15 = (opus_int16)SKP_LIMIT_32( SKP_RSHIFT_ROUND( (opus_int32)NLSF_Q15[I-1] + (opus_int32)NLSF_Q15[I], 1 ), min_center_Q15, max_center_Q15 ); NLSF_Q15[I-1] = center_freq_Q15 - SKP_RSHIFT( NDeltaMin_Q15[I], 1 ); NLSF_Q15[I] = NLSF_Q15[I-1] + NDeltaMin_Q15[I]; diff --git a/silk/silk_NLSF_unpack.c b/silk/silk_NLSF_unpack.c index 937a1b8b362428914f4ae248b558d1428e43f379..f9e496b03a2d958efc9f567bbb06b353639b4f4f 100644 --- a/silk/silk_NLSF_unpack.c +++ b/silk/silk_NLSF_unpack.c @@ -29,15 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Unpack predictor values and indices for entropy coding tables */ void silk_NLSF_unpack( - SKP_int16 ec_ix[], /* O Indices to entropy tales [ LPC_ORDER ] */ - SKP_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */ + opus_int16 ec_ix[], /* O Indices to entropy tales [ LPC_ORDER ] */ + opus_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */ const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ - const SKP_int CB1_index /* I Index of vector in first LSF codebook */ + const opus_int CB1_index /* I Index of vector in first LSF codebook */ ) { - SKP_int i; - SKP_uint8 entry; - const SKP_uint8 *ec_sel_ptr; + opus_int i; + opus_uint8 entry; + const opus_uint8 *ec_sel_ptr; ec_sel_ptr = &psNLSF_CB->ec_sel[ CB1_index * psNLSF_CB->order / 2 ]; for( i = 0; i < psNLSF_CB->order; i += 2 ) { diff --git a/silk/silk_NSQ.c b/silk/silk_NSQ.c index bf5f2042311da3a242879f66723010f658774018..5c70299bade961781d908c4301b2c177146a78de 100644 --- a/silk/silk_NSQ.c +++ b/silk/silk_NSQ.c @@ -30,64 +30,64 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SKP_INLINE void silk_nsq_scale_states( const silk_encoder_state *psEncC, /* I Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ - const SKP_int16 x[], /* I input in Q0 */ - SKP_int32 x_sc_Q10[], /* O input scaled with 1/Gain */ - const SKP_int16 sLTP[], /* I re-whitened LTP state in Q0 */ - SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */ - SKP_int subfr, /* I subframe number */ - const SKP_int LTP_scale_Q14, /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ] /* I */ + const opus_int16 x[], /* I input in Q0 */ + opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain */ + const opus_int16 sLTP[], /* I re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q16[], /* O LTP state matching scaled input */ + opus_int subfr, /* I subframe number */ + const opus_int LTP_scale_Q14, /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ] /* I */ ); SKP_INLINE void silk_noise_shape_quantizer( silk_nsq_state *NSQ, /* I/O NSQ state */ - SKP_int signalType, /* I Signal type */ - const SKP_int32 x_sc_Q10[], /* I */ - SKP_int8 pulses[], /* O */ - SKP_int16 xq[], /* O */ - SKP_int32 sLTP_Q16[], /* I/O LTP state */ - const SKP_int16 a_Q12[], /* I Short term prediction coefs */ - const SKP_int16 b_Q14[], /* I Long term prediction coefs */ - const SKP_int16 AR_shp_Q13[], /* I Noise shaping AR coefs */ - SKP_int lag, /* I Pitch lag */ - SKP_int32 HarmShapeFIRPacked_Q14, /* I */ - SKP_int Tilt_Q14, /* I Spectral tilt */ - SKP_int32 LF_shp_Q14, /* I */ - SKP_int32 Gain_Q16, /* I */ - SKP_int Lambda_Q10, /* I */ - SKP_int offset_Q10, /* I */ - SKP_int length, /* I Input length */ - SKP_int shapingLPCOrder, /* I Noise shaping AR filter order */ - SKP_int predictLPCOrder /* I Prediction filter order */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_sc_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q16[], /* I/O LTP state */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int shapingLPCOrder, /* I Noise shaping AR filter order */ + opus_int predictLPCOrder /* I Prediction filter order */ ); void silk_NSQ( const silk_encoder_state *psEncC, /* I/O Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ SideInfoIndices *psIndices, /* I/O Quantization Indices */ - const SKP_int16 x[], /* I prefiltered input signal */ - SKP_int8 pulses[], /* O quantized qulse signal */ - const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */ - const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ - const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ - const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I */ - const SKP_int Lambda_Q10, /* I */ - const SKP_int LTP_scale_Q14 /* I LTP state scaling */ + const opus_int16 x[], /* I prefiltered input signal */ + opus_int8 pulses[], /* O quantized qulse signal */ + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */ + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I */ + const opus_int Lambda_Q10, /* I */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ ) { - SKP_int k, lag, start_idx, LSF_interpolation_flag; - const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13; - SKP_int16 *pxq; - SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; - SKP_int16 sLTP[ 2 * MAX_FRAME_LENGTH ]; - SKP_int32 HarmShapeFIRPacked_Q14; - SKP_int offset_Q10; - SKP_int32 x_sc_Q10[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ]; + opus_int k, lag, start_idx, LSF_interpolation_flag; + const opus_int16 *A_Q12, *B_Q14, *AR_shp_Q13; + opus_int16 *pxq; + opus_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; + opus_int16 sLTP[ 2 * MAX_FRAME_LENGTH ]; + opus_int32 HarmShapeFIRPacked_Q14; + opus_int offset_Q10; + opus_int32 x_sc_Q10[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ]; NSQ->rand_seed = psIndices->Seed; @@ -116,7 +116,7 @@ void silk_NSQ( /* Noise shape parameters */ SKP_assert( HarmShapeGain_Q14[ k ] >= 0 ); HarmShapeFIRPacked_Q14 = SKP_RSHIFT( HarmShapeGain_Q14[ k ], 2 ); - HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 ); + HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( opus_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 ); NSQ->rewhite_flag = 0; if( psIndices->signalType == TYPE_VOICED ) { @@ -152,13 +152,13 @@ void silk_NSQ( NSQ->lagPrev = pitchL[ psEncC->nb_subfr - 1 ]; /* Save quantized speech and noise shaping signals */ - SKP_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int16 ) ); - SKP_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int32 ) ); + SKP_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) ); + SKP_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) ); #ifdef SAVE_ALL_INTERNAL_DATA - DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( SKP_int32 ) ); + DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( opus_int32 ) ); #endif } @@ -167,32 +167,32 @@ void silk_NSQ( /***********************************/ SKP_INLINE void silk_noise_shape_quantizer( silk_nsq_state *NSQ, /* I/O NSQ state */ - SKP_int signalType, /* I Signal type */ - const SKP_int32 x_sc_Q10[], /* I */ - SKP_int8 pulses[], /* O */ - SKP_int16 xq[], /* O */ - SKP_int32 sLTP_Q16[], /* I/O LTP state */ - const SKP_int16 a_Q12[], /* I Short term prediction coefs */ - const SKP_int16 b_Q14[], /* I Long term prediction coefs */ - const SKP_int16 AR_shp_Q13[], /* I Noise shaping AR coefs */ - SKP_int lag, /* I Pitch lag */ - SKP_int32 HarmShapeFIRPacked_Q14, /* I */ - SKP_int Tilt_Q14, /* I Spectral tilt */ - SKP_int32 LF_shp_Q14, /* I */ - SKP_int32 Gain_Q16, /* I */ - SKP_int Lambda_Q10, /* I */ - SKP_int offset_Q10, /* I */ - SKP_int length, /* I Input length */ - SKP_int shapingLPCOrder, /* I Noise shaping AR filter order */ - SKP_int predictLPCOrder /* I Prediction filter order */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_sc_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q16[], /* I/O LTP state */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping AR coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int shapingLPCOrder, /* I Noise shaping AR filter order */ + opus_int predictLPCOrder /* I Prediction filter order */ ) { - SKP_int i, j; - SKP_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14; - SKP_int32 n_LF_Q10, r_Q10, rr_Q10, q1_Q10, q2_Q10, rd1_Q10, rd2_Q10; - SKP_int32 dither, exc_Q10, LPC_exc_Q10, xq_Q10; - SKP_int32 tmp1, tmp2, sLF_AR_shp_Q10; - SKP_int32 *psLPC_Q14, *shp_lag_ptr, *pred_lag_ptr; + opus_int i, j; + opus_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14; + opus_int32 n_LF_Q10, r_Q10, rr_Q10, q1_Q10, q2_Q10, rd1_Q10, rd2_Q10; + opus_int32 dither, exc_Q10, LPC_exc_Q10, xq_Q10; + opus_int32 tmp1, tmp2, sLF_AR_shp_Q10; + opus_int32 *psLPC_Q14, *shp_lag_ptr, *pred_lag_ptr; shp_lag_ptr = &NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2 ]; pred_lag_ptr = &sLTP_Q16[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ]; @@ -209,7 +209,7 @@ SKP_INLINE void silk_noise_shape_quantizer( /* Short-term prediction */ SKP_assert( ( predictLPCOrder & 1 ) == 0 ); /* check that order is even */ - SKP_assert( ( (SKP_int64)a_Q12 & 3 ) == 0 ); /* check that array starts at 4-byte aligned address */ + SKP_assert( ( (opus_int64)a_Q12 & 3 ) == 0 ); /* check that array starts at 4-byte aligned address */ SKP_assert( predictLPCOrder >= 10 ); /* check that unrolling works */ /* Partially unrolled */ @@ -325,7 +325,7 @@ SKP_INLINE void silk_noise_shape_quantizer( q1_Q10 = q2_Q10; } - pulses[ i ] = ( SKP_int8 )SKP_RSHIFT_ROUND( q1_Q10, 10 ); + pulses[ i ] = ( opus_int8 )SKP_RSHIFT_ROUND( q1_Q10, 10 ); /* Excitation */ exc_Q10 = q1_Q10 ^ dither; @@ -335,7 +335,7 @@ SKP_INLINE void silk_noise_shape_quantizer( xq_Q10 = SKP_ADD32( LPC_exc_Q10, LPC_pred_Q10 ); /* Scale XQ back to normal level before saving */ - xq[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( xq_Q10, Gain_Q16 ), 10 ) ); + xq[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( xq_Q10, Gain_Q16 ), 10 ) ); /* Update states */ psLPC_Q14++; @@ -353,24 +353,24 @@ SKP_INLINE void silk_noise_shape_quantizer( } /* Update LPC synth buffer */ - SKP_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) ); + SKP_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) ); } SKP_INLINE void silk_nsq_scale_states( const silk_encoder_state *psEncC, /* I Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ - const SKP_int16 x[], /* I input in Q0 */ - SKP_int32 x_sc_Q10[], /* O input scaled with 1/Gain */ - const SKP_int16 sLTP[], /* I re-whitened LTP state in Q0 */ - SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */ - SKP_int subfr, /* I subframe number */ - const SKP_int LTP_scale_Q14, /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ] /* I */ + const opus_int16 x[], /* I input in Q0 */ + opus_int32 x_sc_Q10[], /* O input scaled with 1/Gain */ + const opus_int16 sLTP[], /* I re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q16[], /* O LTP state matching scaled input */ + opus_int subfr, /* I subframe number */ + const opus_int LTP_scale_Q14, /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ] /* I */ ) { - SKP_int i, lag; - SKP_int32 inv_gain_Q16, gain_adj_Q16, inv_gain_Q32; + opus_int i, lag; + opus_int32 inv_gain_Q16, gain_adj_Q16, inv_gain_Q32; inv_gain_Q16 = silk_INVERSE32_varQ( SKP_max( Gains_Q16[ subfr ], 1 ), 32 ); inv_gain_Q16 = SKP_min( inv_gain_Q16, SKP_int16_MAX ); @@ -418,7 +418,7 @@ SKP_INLINE void silk_nsq_scale_states( /* Scale input */ for( i = 0; i < psEncC->subfr_length; i++ ) { - x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 ); + x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( opus_int16 )inv_gain_Q16 ), 6 ); } /* save inv_gain */ diff --git a/silk/silk_NSQ_del_dec.c b/silk/silk_NSQ_del_dec.c index 8ff138ae156779ea495a306349908d390d7f0bf7..d335015e26aa413b156c3e04785b20d5147847e1 100644 --- a/silk/silk_NSQ_del_dec.c +++ b/silk/silk_NSQ_del_dec.c @@ -28,42 +28,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main.h" typedef struct { - SKP_int32 sLPC_Q14[ MAX_FRAME_LENGTH / MAX_NB_SUBFR + NSQ_LPC_BUF_LENGTH ]; - SKP_int32 RandState[ DECISION_DELAY ]; - SKP_int32 Q_Q10[ DECISION_DELAY ]; - SKP_int32 Xq_Q10[ DECISION_DELAY ]; - SKP_int32 Pred_Q16[ DECISION_DELAY ]; - SKP_int32 Shape_Q10[ DECISION_DELAY ]; - SKP_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; - SKP_int32 LF_AR_Q12; - SKP_int32 Seed; - SKP_int32 SeedInit; - SKP_int32 RD_Q10; + opus_int32 sLPC_Q14[ MAX_FRAME_LENGTH / MAX_NB_SUBFR + NSQ_LPC_BUF_LENGTH ]; + opus_int32 RandState[ DECISION_DELAY ]; + opus_int32 Q_Q10[ DECISION_DELAY ]; + opus_int32 Xq_Q10[ DECISION_DELAY ]; + opus_int32 Pred_Q16[ DECISION_DELAY ]; + opus_int32 Shape_Q10[ DECISION_DELAY ]; + opus_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; + opus_int32 LF_AR_Q12; + opus_int32 Seed; + opus_int32 SeedInit; + opus_int32 RD_Q10; } NSQ_del_dec_struct; typedef struct { - SKP_int32 Q_Q10; - SKP_int32 RD_Q10; - SKP_int32 xq_Q14; - SKP_int32 LF_AR_Q12; - SKP_int32 sLTP_shp_Q10; - SKP_int32 LPC_exc_Q16; + opus_int32 Q_Q10; + opus_int32 RD_Q10; + opus_int32 xq_Q14; + opus_int32 LF_AR_Q12; + opus_int32 sLTP_shp_Q10; + opus_int32 LPC_exc_Q16; } NSQ_sample_struct; SKP_INLINE void silk_nsq_del_dec_scale_states( const silk_encoder_state *psEncC, /* I Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ - const SKP_int16 x[], /* I Input in Q0 */ - SKP_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */ - const SKP_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ - SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */ - SKP_int subfr, /* I Subframe number */ - SKP_int nStatesDelayedDecision, /* I Number of del dec states */ - SKP_int smpl_buf_idx, /* I Index to newest samples in buffers */ - const SKP_int LTP_scale_Q14, /* I LTP state scaling */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ] /* I Pitch lag */ + const opus_int16 x[], /* I Input in Q0 */ + opus_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */ + const opus_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q16[], /* O LTP state matching scaled input */ + opus_int subfr, /* I Subframe number */ + opus_int nStatesDelayedDecision, /* I Number of del dec states */ + opus_int smpl_buf_idx, /* I Index to newest samples in buffers */ + const opus_int LTP_scale_Q14, /* I LTP state scaling */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ] /* I Pitch lag */ ); /******************************************/ @@ -72,61 +72,61 @@ SKP_INLINE void silk_nsq_del_dec_scale_states( SKP_INLINE void silk_noise_shape_quantizer_del_dec( silk_nsq_state *NSQ, /* I/O NSQ state */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ - SKP_int signalType, /* I Signal type */ - const SKP_int32 x_Q10[], /* I */ - SKP_int8 pulses[], /* O */ - SKP_int16 xq[], /* O */ - SKP_int32 sLTP_Q16[], /* I/O LTP filter state */ - SKP_int32 delayedGain_Q16[], /* I/O Gain delay buffer */ - const SKP_int16 a_Q12[], /* I Short term prediction coefs */ - const SKP_int16 b_Q14[], /* I Long term prediction coefs */ - const SKP_int16 AR_shp_Q13[], /* I Noise shaping coefs */ - SKP_int lag, /* I Pitch lag */ - SKP_int32 HarmShapeFIRPacked_Q14, /* I */ - SKP_int Tilt_Q14, /* I Spectral tilt */ - SKP_int32 LF_shp_Q14, /* I */ - SKP_int32 Gain_Q16, /* I */ - SKP_int Lambda_Q10, /* I */ - SKP_int offset_Q10, /* I */ - SKP_int length, /* I Input length */ - SKP_int subfr, /* I Subframe number */ - SKP_int shapingLPCOrder, /* I Shaping LPC filter order */ - SKP_int predictLPCOrder, /* I Prediction filter order */ - SKP_int warping_Q16, /* I */ - SKP_int nStatesDelayedDecision, /* I Number of states in decision tree */ - SKP_int *smpl_buf_idx, /* I Index to newest samples in buffers */ - SKP_int decisionDelay /* I */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q16[], /* I/O LTP filter state */ + opus_int32 delayedGain_Q16[], /* I/O Gain delay buffer */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int subfr, /* I Subframe number */ + opus_int shapingLPCOrder, /* I Shaping LPC filter order */ + opus_int predictLPCOrder, /* I Prediction filter order */ + opus_int warping_Q16, /* I */ + opus_int nStatesDelayedDecision, /* I Number of states in decision tree */ + opus_int *smpl_buf_idx, /* I Index to newest samples in buffers */ + opus_int decisionDelay /* I */ ); void silk_NSQ_del_dec( const silk_encoder_state *psEncC, /* I/O Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ SideInfoIndices *psIndices, /* I/O Quantization Indices */ - const SKP_int16 x[], /* I Prefiltered input signal */ - SKP_int8 pulses[], /* O Quantized pulse signal */ - const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */ - const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ - const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ - const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I */ - const SKP_int Lambda_Q10, /* I */ - const SKP_int LTP_scale_Q14 /* I LTP state scaling */ + const opus_int16 x[], /* I Prefiltered input signal */ + opus_int8 pulses[], /* O Quantized pulse signal */ + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */ + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I */ + const opus_int Lambda_Q10, /* I */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ ) { - SKP_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr; - SKP_int last_smple_idx, smpl_buf_idx, decisionDelay; - const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13; - SKP_int16 *pxq; - SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; - SKP_int16 sLTP[ 2 * MAX_FRAME_LENGTH ]; - SKP_int32 HarmShapeFIRPacked_Q14; - SKP_int offset_Q10; - SKP_int32 RDmin_Q10; - SKP_int32 x_sc_Q10[ MAX_SUB_FRAME_LENGTH ]; - SKP_int32 delayedGain_Q16[ DECISION_DELAY ]; + opus_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr; + opus_int last_smple_idx, smpl_buf_idx, decisionDelay; + const opus_int16 *A_Q12, *B_Q14, *AR_shp_Q13; + opus_int16 *pxq; + opus_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; + opus_int16 sLTP[ 2 * MAX_FRAME_LENGTH ]; + opus_int32 HarmShapeFIRPacked_Q14; + opus_int offset_Q10; + opus_int32 RDmin_Q10; + opus_int32 x_sc_Q10[ MAX_SUB_FRAME_LENGTH ]; + opus_int32 delayedGain_Q16[ DECISION_DELAY ]; NSQ_del_dec_struct psDelDec[ MAX_DEL_DEC_STATES ]; NSQ_del_dec_struct *psDD; @@ -144,7 +144,7 @@ void silk_NSQ_del_dec( psDD->RD_Q10 = 0; psDD->LF_AR_Q12 = NSQ->sLF_AR_shp_Q12; psDD->Shape_Q10[ 0 ] = NSQ->sLTP_shp_Q10[ psEncC->ltp_mem_length - 1 ]; - SKP_memcpy( psDD->sLPC_Q14, NSQ->sLPC_Q14, NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) ); + SKP_memcpy( psDD->sLPC_Q14, NSQ->sLPC_Q14, NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) ); SKP_memcpy( psDD->sAR2_Q14, NSQ->sAR2_Q14, sizeof( NSQ->sAR2_Q14 ) ); } @@ -183,7 +183,7 @@ void silk_NSQ_del_dec( /* Noise shape parameters */ SKP_assert( HarmShapeGain_Q14[ k ] >= 0 ); HarmShapeFIRPacked_Q14 = SKP_RSHIFT( HarmShapeGain_Q14[ k ], 2 ); - HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 ); + HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( opus_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 ); NSQ->rewhite_flag = 0; if( psIndices->signalType == TYPE_VOICED ) { @@ -215,8 +215,8 @@ void silk_NSQ_del_dec( last_smple_idx = smpl_buf_idx + decisionDelay; for( i = 0; i < decisionDelay; i++ ) { last_smple_idx = ( last_smple_idx - 1 ) & DECISION_DELAY_MASK; - pulses[ i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); - pxq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( + pulses[ i - decisionDelay ] = ( opus_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); + pxq[ i - decisionDelay ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], Gains_Q16[ 1 ] ), 10 ) ); NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay + i ] = psDD->Shape_Q10[ last_smple_idx ]; } @@ -265,13 +265,13 @@ void silk_NSQ_del_dec( last_smple_idx = smpl_buf_idx + decisionDelay; for( i = 0; i < decisionDelay; i++ ) { last_smple_idx = ( last_smple_idx - 1 ) & DECISION_DELAY_MASK; - pulses[ i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); - pxq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( + pulses[ i - decisionDelay ] = ( opus_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); + pxq[ i - decisionDelay ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], Gains_Q16[ psEncC->nb_subfr - 1 ] ), 10 ) ); NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay + i ] = psDD->Shape_Q10[ last_smple_idx ]; sLTP_Q16[ NSQ->sLTP_buf_idx - decisionDelay + i ] = psDD->Pred_Q16[ last_smple_idx ]; } - SKP_memcpy( NSQ->sLPC_Q14, &psDD->sLPC_Q14[ psEncC->subfr_length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) ); + SKP_memcpy( NSQ->sLPC_Q14, &psDD->sLPC_Q14[ psEncC->subfr_length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) ); SKP_memcpy( NSQ->sAR2_Q14, psDD->sAR2_Q14, sizeof( psDD->sAR2_Q14 ) ); /* Update states */ @@ -279,13 +279,13 @@ void silk_NSQ_del_dec( NSQ->lagPrev = pitchL[ psEncC->nb_subfr - 1 ]; /* Save quantized speech and noise shaping signals */ - SKP_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int16 ) ); - SKP_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( SKP_int32 ) ); + SKP_memmove( NSQ->xq, &NSQ->xq[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) ); + SKP_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) ); #ifdef SAVE_ALL_INTERNAL_DATA - DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) ); - DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int8 ) ); - DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( SKP_int32 ) ); + DEBUG_STORE_DATA( xq.dat, &pxq[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int16 ) ); + DEBUG_STORE_DATA( q.dat, &pulses[ -psEncC->frame_length ], psEncC->frame_length * sizeof( opus_int8 ) ); + DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->ltp_mem_length ], psEncC->frame_length * sizeof( opus_int32 ) ); #endif } @@ -295,39 +295,39 @@ void silk_NSQ_del_dec( SKP_INLINE void silk_noise_shape_quantizer_del_dec( silk_nsq_state *NSQ, /* I/O NSQ state */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ - SKP_int signalType, /* I Signal type */ - const SKP_int32 x_Q10[], /* I */ - SKP_int8 pulses[], /* O */ - SKP_int16 xq[], /* O */ - SKP_int32 sLTP_Q16[], /* I/O LTP filter state */ - SKP_int32 delayedGain_Q16[], /* I/O Gain delay buffer */ - const SKP_int16 a_Q12[], /* I Short term prediction coefs */ - const SKP_int16 b_Q14[], /* I Long term prediction coefs */ - const SKP_int16 AR_shp_Q13[], /* I Noise shaping coefs */ - SKP_int lag, /* I Pitch lag */ - SKP_int32 HarmShapeFIRPacked_Q14, /* I */ - SKP_int Tilt_Q14, /* I Spectral tilt */ - SKP_int32 LF_shp_Q14, /* I */ - SKP_int32 Gain_Q16, /* I */ - SKP_int Lambda_Q10, /* I */ - SKP_int offset_Q10, /* I */ - SKP_int length, /* I Input length */ - SKP_int subfr, /* I Subframe number */ - SKP_int shapingLPCOrder, /* I Shaping LPC filter order */ - SKP_int predictLPCOrder, /* I Prediction filter order */ - SKP_int warping_Q16, /* I */ - SKP_int nStatesDelayedDecision, /* I Number of states in decision tree */ - SKP_int *smpl_buf_idx, /* I Index to newest samples in buffers */ - SKP_int decisionDelay /* I */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q16[], /* I/O LTP filter state */ + opus_int32 delayedGain_Q16[], /* I/O Gain delay buffer */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int subfr, /* I Subframe number */ + opus_int shapingLPCOrder, /* I Shaping LPC filter order */ + opus_int predictLPCOrder, /* I Prediction filter order */ + opus_int warping_Q16, /* I */ + opus_int nStatesDelayedDecision, /* I Number of states in decision tree */ + opus_int *smpl_buf_idx, /* I Index to newest samples in buffers */ + opus_int decisionDelay /* I */ ) { - SKP_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; - SKP_int32 Winner_rand_state; - SKP_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14, LTP_Q10; - SKP_int32 n_LF_Q10, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10; - SKP_int32 q1_Q10, q2_Q10, dither, exc_Q10, LPC_exc_Q10, xq_Q10; - SKP_int32 tmp1, tmp2, sLF_AR_shp_Q10; - SKP_int32 *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14; + opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; + opus_int32 Winner_rand_state; + opus_int32 LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14, LTP_Q10; + opus_int32 n_LF_Q10, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10; + opus_int32 q1_Q10, q2_Q10, dither, exc_Q10, LPC_exc_Q10, xq_Q10; + opus_int32 tmp1, tmp2, sLF_AR_shp_Q10; + opus_int32 *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14; NSQ_sample_struct psSampleState[ MAX_DEL_DEC_STATES ][ 2 ]; NSQ_del_dec_struct *psDD; NSQ_sample_struct *psSS; @@ -382,7 +382,7 @@ SKP_INLINE void silk_noise_shape_quantizer_del_dec( /* Short-term prediction */ SKP_assert( predictLPCOrder >= 10 ); /* check that unrolling works */ SKP_assert( ( predictLPCOrder & 1 ) == 0 ); /* check that order is even */ - SKP_assert( ( (SKP_int64)a_Q12 & 3 ) == 0 ); /* check that array starts at 4-byte aligned address */ + SKP_assert( ( (opus_int64)a_Q12 & 3 ) == 0 ); /* check that array starts at 4-byte aligned address */ /* Partially unrolled */ LPC_pred_Q10 = SKP_SMULWB( psLPC_Q14[ 0 ], a_Q12[ 0 ] ); LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -1 ], a_Q12[ 1 ] ); @@ -556,16 +556,16 @@ SKP_INLINE void silk_noise_shape_quantizer_del_dec( /* Replace a state if best from second set outperforms worst in first set */ if( RDmin_Q10 < RDmax_Q10 ) { - SKP_memcpy( ((SKP_int32 *)&psDelDec[ RDmax_ind ]) + i, - ((SKP_int32 *)&psDelDec[ RDmin_ind ]) + i, sizeof( NSQ_del_dec_struct ) - i * sizeof( SKP_int32) ); + SKP_memcpy( ((opus_int32 *)&psDelDec[ RDmax_ind ]) + i, + ((opus_int32 *)&psDelDec[ RDmin_ind ]) + i, sizeof( NSQ_del_dec_struct ) - i * sizeof( opus_int32) ); SKP_memcpy( &psSampleState[ RDmax_ind ][ 0 ], &psSampleState[ RDmin_ind ][ 1 ], sizeof( NSQ_sample_struct ) ); } /* Write samples from winner to output and long-term filter states */ psDD = &psDelDec[ Winner_ind ]; if( subfr > 0 || i >= decisionDelay ) { - pulses[ i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); - xq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( + pulses[ i - decisionDelay ] = ( opus_int8 )SKP_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 ); + xq[ i - decisionDelay ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], delayedGain_Q16[ last_smple_idx ] ), 10 ) ); NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay ] = psDD->Shape_Q10[ last_smple_idx ]; sLTP_Q16[ NSQ->sLTP_buf_idx - decisionDelay ] = psDD->Pred_Q16[ last_smple_idx ]; @@ -592,7 +592,7 @@ SKP_INLINE void silk_noise_shape_quantizer_del_dec( /* Update LPC states */ for( k = 0; k < nStatesDelayedDecision; k++ ) { psDD = &psDelDec[ k ]; - SKP_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) ); + SKP_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) ); } } @@ -600,20 +600,20 @@ SKP_INLINE void silk_nsq_del_dec_scale_states( const silk_encoder_state *psEncC, /* I Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ - const SKP_int16 x[], /* I Input in Q0 */ - SKP_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */ - const SKP_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ - SKP_int32 sLTP_Q16[], /* O LTP state matching scaled input */ - SKP_int subfr, /* I Subframe number */ - SKP_int nStatesDelayedDecision, /* I Number of del dec states */ - SKP_int smpl_buf_idx, /* I Index to newest samples in buffers */ - const SKP_int LTP_scale_Q14, /* I LTP state scaling */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ] /* I Pitch lag */ + const opus_int16 x[], /* I Input in Q0 */ + opus_int32 x_sc_Q10[], /* O Input scaled with 1/Gain in Q10 */ + const opus_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q16[], /* O LTP state matching scaled input */ + opus_int subfr, /* I Subframe number */ + opus_int nStatesDelayedDecision, /* I Number of del dec states */ + opus_int smpl_buf_idx, /* I Index to newest samples in buffers */ + const opus_int LTP_scale_Q14, /* I LTP state scaling */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ] /* I Pitch lag */ ) { - SKP_int i, k, lag; - SKP_int32 inv_gain_Q16, gain_adj_Q16, inv_gain_Q32; + opus_int i, k, lag; + opus_int32 inv_gain_Q16, gain_adj_Q16, inv_gain_Q32; NSQ_del_dec_struct *psDD; inv_gain_Q16 = silk_INVERSE32_varQ( SKP_max( Gains_Q16[ subfr ], 1 ), 32 ); @@ -671,7 +671,7 @@ SKP_INLINE void silk_nsq_del_dec_scale_states( /* Scale input */ for( i = 0; i < psEncC->subfr_length; i++ ) { - x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 ); + x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( opus_int16 )inv_gain_Q16 ), 6 ); } /* save inv_gain */ diff --git a/silk/silk_PLC.c b/silk/silk_PLC.c index d8a9db3fef80e4ffc2df7cd50905bde98cde5491..3289adbfb33ccf41cffb8fadbcf0508aa0eb31eb 100644 --- a/silk/silk_PLC.c +++ b/silk/silk_PLC.c @@ -29,9 +29,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_PLC.h" #define NB_ATT 2 -static const SKP_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */ -static const SKP_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ -static const SKP_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ +static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */ +static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ +static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ void silk_PLC_Reset( silk_decoder_state *psDec /* I/O Decoder state */ @@ -43,9 +43,9 @@ void silk_PLC_Reset( void silk_PLC( silk_decoder_state *psDec, /* I Decoder state */ silk_decoder_control *psDecCtrl, /* I Decoder control */ - SKP_int16 signal[], /* O Concealed signal */ - SKP_int length, /* I length of residual */ - SKP_int lost /* I Loss flag */ + opus_int16 signal[], /* O Concealed signal */ + opus_int length, /* I length of residual */ + opus_int lost /* I Loss flag */ ) { /* PLC control function */ @@ -75,12 +75,12 @@ void silk_PLC( void silk_PLC_update( silk_decoder_state *psDec, /* (I/O) Decoder state */ silk_decoder_control *psDecCtrl, /* (I/O) Decoder control */ - SKP_int16 signal[], - SKP_int length + opus_int16 signal[], + opus_int length ) { - SKP_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14; - SKP_int i, j; + opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14; + opus_int i, j; silk_PLC_struct *psPLC; psPLC = &psDec->sPLC; @@ -102,21 +102,21 @@ void silk_PLC_update( LTP_Gain_Q14 = temp_LTP_Gain_Q14; SKP_memcpy( psPLC->LTPCoef_Q14, &psDecCtrl->LTPCoef_Q14[ SKP_SMULBB( psDec->nb_subfr - 1 - j, LTP_ORDER ) ], - LTP_ORDER * sizeof( SKP_int16 ) ); + LTP_ORDER * sizeof( opus_int16 ) ); psPLC->pitchL_Q8 = SKP_LSHIFT( psDecCtrl->pitchL[ psDec->nb_subfr - 1 - j ], 8 ); } } #if USE_SINGLE_TAP - SKP_memset( psPLC->LTPCoef_Q14, 0, LTP_ORDER * sizeof( SKP_int16 ) ); + SKP_memset( psPLC->LTPCoef_Q14, 0, LTP_ORDER * sizeof( opus_int16 ) ); psPLC->LTPCoef_Q14[ LTP_ORDER / 2 ] = LTP_Gain_Q14; #endif /* Limit LT coefs */ if( LTP_Gain_Q14 < V_PITCH_GAIN_START_MIN_Q14 ) { - SKP_int scale_Q10; - SKP_int32 tmp; + opus_int scale_Q10; + opus_int32 tmp; tmp = SKP_LSHIFT( V_PITCH_GAIN_START_MIN_Q14, 10 ); scale_Q10 = SKP_DIV32( tmp, SKP_max( LTP_Gain_Q14, 1 ) ); @@ -124,8 +124,8 @@ void silk_PLC_update( psPLC->LTPCoef_Q14[ i ] = SKP_RSHIFT( SKP_SMULBB( psPLC->LTPCoef_Q14[ i ], scale_Q10 ), 10 ); } } else if( LTP_Gain_Q14 > V_PITCH_GAIN_START_MAX_Q14 ) { - SKP_int scale_Q14; - SKP_int32 tmp; + opus_int scale_Q14; + opus_int32 tmp; tmp = SKP_LSHIFT( V_PITCH_GAIN_START_MAX_Q14, 14 ); scale_Q14 = SKP_DIV32( tmp, SKP_max( LTP_Gain_Q14, 1 ) ); @@ -135,36 +135,36 @@ void silk_PLC_update( } } else { psPLC->pitchL_Q8 = SKP_LSHIFT( SKP_SMULBB( psDec->fs_kHz, 18 ), 8 ); - SKP_memset( psPLC->LTPCoef_Q14, 0, LTP_ORDER * sizeof( SKP_int16 )); + SKP_memset( psPLC->LTPCoef_Q14, 0, LTP_ORDER * sizeof( opus_int16 )); } /* Save LPC coeficients */ - SKP_memcpy( psPLC->prevLPC_Q12, psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_order * sizeof( SKP_int16 ) ); + SKP_memcpy( psPLC->prevLPC_Q12, psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_order * sizeof( opus_int16 ) ); psPLC->prevLTP_scale_Q14 = psDecCtrl->LTP_scale_Q14; /* Save Gains */ - SKP_memcpy( psPLC->prevGain_Q16, psDecCtrl->Gains_Q16, psDec->nb_subfr * sizeof( SKP_int32 ) ); + SKP_memcpy( psPLC->prevGain_Q16, psDecCtrl->Gains_Q16, psDec->nb_subfr * sizeof( opus_int32 ) ); } void silk_PLC_conceal( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* O concealed signal */ - SKP_int length /* I length of residual */ + opus_int16 signal[], /* O concealed signal */ + opus_int length /* I length of residual */ ) { - SKP_int i, j, k; - SKP_int16 *B_Q14, exc_buf[ MAX_FRAME_LENGTH ], *exc_buf_ptr; - SKP_int16 rand_scale_Q14, A_Q12_tmp[ MAX_LPC_ORDER ]; - SKP_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15; - SKP_int lag, idx, sLTP_buf_idx, shift1, shift2; - SKP_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr; - SKP_int32 sig_Q10[ MAX_FRAME_LENGTH ], *sig_Q10_ptr, LPC_exc_Q10, LPC_pred_Q10, LTP_pred_Q14; + opus_int i, j, k; + opus_int16 *B_Q14, exc_buf[ MAX_FRAME_LENGTH ], *exc_buf_ptr; + opus_int16 rand_scale_Q14, A_Q12_tmp[ MAX_LPC_ORDER ]; + opus_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15; + opus_int lag, idx, sLTP_buf_idx, shift1, shift2; + opus_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr; + opus_int32 sig_Q10[ MAX_FRAME_LENGTH ], *sig_Q10_ptr, LPC_exc_Q10, LPC_pred_Q10, LTP_pred_Q14; silk_PLC_struct *psPLC; psPLC = &psDec->sPLC; /* Update LTP buffer */ - SKP_memmove( psDec->sLTP_Q16, &psDec->sLTP_Q16[ psDec->frame_length ], psDec->ltp_mem_length * sizeof( SKP_int32 ) ); + SKP_memmove( psDec->sLTP_Q16, &psDec->sLTP_Q16[ psDec->frame_length ], psDec->ltp_mem_length * sizeof( opus_int32 ) ); /* LPC concealment. Apply BWE to previous LPC */ silk_bwexpander( psPLC->prevLPC_Q12, psDec->LPC_order, SILK_FIX_CONST( BWE_COEF, 16 ) ); @@ -177,7 +177,7 @@ void silk_PLC_conceal( exc_buf[i] = 0; for( k = ( psDec->nb_subfr >> 1 ); k < psDec->nb_subfr; k++ ) { for( i = 0; i < psDec->subfr_length; i++ ) { - exc_buf_ptr[ i ] = ( SKP_int16 )SKP_RSHIFT( + exc_buf_ptr[ i ] = ( opus_int16 )SKP_RSHIFT( SKP_SMULWW( psDec->exc_Q10[ i + k * psDec->subfr_length ], psPLC->prevGain_Q16[ k ] ), 10 ); } exc_buf_ptr += psDec->subfr_length; @@ -216,10 +216,10 @@ void silk_PLC_conceal( rand_scale_Q14 -= B_Q14[ i ]; } rand_scale_Q14 = SKP_max_16( 3277, rand_scale_Q14 ); /* 0.2 */ - rand_scale_Q14 = ( SKP_int16 )SKP_RSHIFT( SKP_SMULBB( rand_scale_Q14, psPLC->prevLTP_scale_Q14 ), 14 ); + rand_scale_Q14 = ( opus_int16 )SKP_RSHIFT( SKP_SMULBB( rand_scale_Q14, psPLC->prevLTP_scale_Q14 ), 14 ); } else { /* Reduce random noise for unvoiced frames with high LPC gain */ - SKP_int32 invGain_Q30, down_scale_Q30; + opus_int32 invGain_Q30, down_scale_Q30; silk_LPC_inverse_pred_gain( &invGain_Q30, psPLC->prevLPC_Q12, psDec->LPC_order ); @@ -284,7 +284,7 @@ void silk_PLC_conceal( /***************************/ sig_Q10_ptr = sig_Q10; /* Preload LPC coeficients to array on stack. Gives small performance gain */ - SKP_memcpy( A_Q12_tmp, psPLC->prevLPC_Q12, psDec->LPC_order * sizeof( SKP_int16 ) ); + SKP_memcpy( A_Q12_tmp, psPLC->prevLPC_Q12, psDec->LPC_order * sizeof( opus_int16 ) ); SKP_assert( psDec->LPC_order >= 10 ); /* check that unrolling works */ for( k = 0; k < psDec->nb_subfr; k++ ) { for( i = 0; i < psDec->subfr_length; i++ ){ @@ -312,12 +312,12 @@ void silk_PLC_conceal( } sig_Q10_ptr += psDec->subfr_length; /* Update LPC filter state */ - SKP_memcpy( psDec->sLPC_Q14, &psDec->sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( SKP_int32 ) ); + SKP_memcpy( psDec->sLPC_Q14, &psDec->sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); } /* Scale with Gain */ for( i = 0; i < psDec->frame_length; i++ ) { - signal[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( sig_Q10[ i ], psPLC->prevGain_Q16[ psDec->nb_subfr - 1 ] ), 10 ) ); + signal[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( sig_Q10[ i ], psPLC->prevGain_Q16[ psDec->nb_subfr - 1 ] ), 10 ) ); } /**************************************/ @@ -334,12 +334,12 @@ void silk_PLC_conceal( void silk_PLC_glue_frames( silk_decoder_state *psDec, /* I/O decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* I/O signal */ - SKP_int length /* I length of residual */ + opus_int16 signal[], /* I/O signal */ + opus_int length /* I length of residual */ ) { - SKP_int i, energy_shift; - SKP_int32 energy; + opus_int i, energy_shift; + opus_int32 energy; silk_PLC_struct *psPLC; psPLC = &psDec->sPLC; @@ -362,8 +362,8 @@ void silk_PLC_glue_frames( /* Fade in the energy difference */ if( energy > psPLC->conc_energy ) { - SKP_int32 frac_Q24, LZ; - SKP_int32 gain_Q16, slope_Q16; + opus_int32 frac_Q24, LZ; + opus_int32 gain_Q16, slope_Q16; LZ = silk_CLZ32( psPLC->conc_energy ); LZ = LZ - 1; diff --git a/silk/silk_PLC.h b/silk/silk_PLC.h index 8044c1a9f7d38696af6a6cfe2f495a1b0f991b58..3c78e7a33e32784dd7c045379c7d12aceddd45aa 100644 --- a/silk/silk_PLC.h +++ b/silk/silk_PLC.h @@ -49,30 +49,30 @@ void silk_PLC_Reset( void silk_PLC( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* I/O signal */ - SKP_int length, /* I length of residual */ - SKP_int lost /* I Loss flag */ + opus_int16 signal[], /* I/O signal */ + opus_int length, /* I length of residual */ + opus_int lost /* I Loss flag */ ); void silk_PLC_update( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], - SKP_int length + opus_int16 signal[], + opus_int length ); void silk_PLC_conceal( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* O LPC residual signal */ - SKP_int length /* I length of signal */ + opus_int16 signal[], /* O LPC residual signal */ + opus_int length /* I length of signal */ ); void silk_PLC_glue_frames( silk_decoder_state *psDec, /* I/O decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* I/O signal */ - SKP_int length /* I length of signal */ + opus_int16 signal[], /* I/O signal */ + opus_int length /* I length of signal */ ); #endif diff --git a/silk/silk_SigProc_FIX.h b/silk/silk_SigProc_FIX.h index a0059e7a8e537a15b6cfed84a231814f90fe7f49..428e67d5cc2d5da1fd4218b7be7a0938f0cb5c55 100644 --- a/silk/silk_SigProc_FIX.h +++ b/silk/silk_SigProc_FIX.h @@ -51,47 +51,47 @@ extern "C" /*! * Initialize/reset the resampler state for a given pair of input/output sampling rates */ -SKP_int silk_resampler_init( +opus_int silk_resampler_init( silk_resampler_state_struct *S, /* I/O: Resampler state */ - SKP_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */ - SKP_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */ + opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */ + opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */ ); /*! * Clear the states of all resampling filters, without resetting sampling rate ratio */ -SKP_int silk_resampler_clear( +opus_int silk_resampler_clear( silk_resampler_state_struct *S /* I/O: Resampler state */ ); /*! * Resampler: convert from one sampling rate to another */ -SKP_int silk_resampler( +opus_int silk_resampler( silk_resampler_state_struct *S, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ); /*! Upsample 2x, low quality */ void silk_resampler_up2( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ); /*! * Downsample 2x, mediocre quality */ void silk_resampler_down2( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ len ] */ - const SKP_int16 *in, /* I: Input signal [ floor(len/2) ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ len ] */ + const opus_int16 *in, /* I: Input signal [ floor(len/2) ] */ + opus_int32 inLen /* I: Number of input samples */ ); @@ -99,20 +99,20 @@ void silk_resampler_down2( * Downsample by a factor 2/3, low quality */ void silk_resampler_down2_3( - SKP_int32 *S, /* I/O: State vector [ 6 ] */ - SKP_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */ - const SKP_int16 *in, /* I: Input signal [ inLen ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 6 ] */ + opus_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */ + const opus_int16 *in, /* I: Input signal [ inLen ] */ + opus_int32 inLen /* I: Number of input samples */ ); /*! * Downsample by a factor 3, low quality */ void silk_resampler_down3( - SKP_int32 *S, /* I/O: State vector [ 8 ] */ - SKP_int16 *out, /* O: Output signal [ floor(inLen/3) ] */ - const SKP_int16 *in, /* I: Input signal [ inLen ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 8 ] */ + opus_int16 *out, /* O: Output signal [ floor(inLen/3) ] */ + const opus_int16 *in, /* I: Input signal [ inLen ] */ + opus_int32 inLen /* I: Number of input samples */ ); /*! @@ -121,58 +121,58 @@ void silk_resampler_down3( * can handle (slowly) varying coefficients */ void silk_biquad_alt( - const SKP_int16 *in, /* I: input signal */ - const SKP_int32 *B_Q28, /* I: MA coefficients [3] */ - const SKP_int32 *A_Q28, /* I: AR coefficients [2] */ - SKP_int32 *S, /* I/O: State vector [2] */ - SKP_int16 *out, /* O: output signal */ - const SKP_int32 len /* I: signal length (must be even) */ + const opus_int16 *in, /* I: input signal */ + const opus_int32 *B_Q28, /* I: MA coefficients [3] */ + const opus_int32 *A_Q28, /* I: AR coefficients [2] */ + opus_int32 *S, /* I/O: State vector [2] */ + opus_int16 *out, /* O: output signal */ + const opus_int32 len /* I: signal length (must be even) */ ); /* Variable order MA prediction error filter. */ void silk_LPC_analysis_filter( - SKP_int16 *out, /* O: Output signal */ - const SKP_int16 *in, /* I: Input signal */ - const SKP_int16 *B, /* I: MA prediction coefficients, Q12 [order] */ - const SKP_int32 len, /* I: Signal length */ - const SKP_int32 Order /* I: Filter order */ + opus_int16 *out, /* O: Output signal */ + const opus_int16 *in, /* I: Input signal */ + const opus_int16 *B, /* I: MA prediction coefficients, Q12 [order] */ + const opus_int32 len, /* I: Signal length */ + const opus_int32 Order /* I: Filter order */ ); /* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander( - SKP_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ - const SKP_int d, /* I Length of ar */ - SKP_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */ + opus_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ + const opus_int d, /* I Length of ar */ + opus_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */ ); /* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander_32( - SKP_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ - const SKP_int d, /* I Length of ar */ - SKP_int32 chirp_Q16 /* I Chirp factor in Q16 */ + opus_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ + const opus_int d, /* I Length of ar */ + opus_int32 chirp_Q16 /* I Chirp factor in Q16 */ ); /* Compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */ -SKP_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable, otherwise 0 */ - SKP_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ - const SKP_int16 *A_Q12, /* I: Prediction coefficients, Q12 [order] */ - const SKP_int order /* I: Prediction order */ +opus_int silk_LPC_inverse_pred_gain( /* O: Returns 1 if unstable, otherwise 0 */ + opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ + const opus_int16 *A_Q12, /* I: Prediction coefficients, Q12 [order] */ + const opus_int order /* I: Prediction order */ ); -SKP_int silk_LPC_inverse_pred_gain_Q24( /* O: Returns 1 if unstable, otherwise 0 */ - SKP_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ - const SKP_int32 *A_Q24, /* I: Prediction coefficients, Q24 [order] */ - const SKP_int order /* I: Prediction order */ +opus_int silk_LPC_inverse_pred_gain_Q24( /* O: Returns 1 if unstable, otherwise 0 */ + opus_int32 *invGain_Q30, /* O: Inverse prediction gain, Q30 energy domain */ + const opus_int32 *A_Q24, /* I: Prediction coefficients, Q24 [order] */ + const opus_int order /* I: Prediction order */ ); /* split signal in two decimated bands using first-order allpass filters */ void silk_ana_filt_bank_1( - const SKP_int16 *in, /* I: Input signal [N] */ - SKP_int32 *S, /* I/O: State vector [2] */ - SKP_int16 *outL, /* O: Low band [N/2] */ - SKP_int16 *outH, /* O: High band [N/2] */ - const SKP_int32 N /* I: Number of input samples */ + const opus_int16 *in, /* I: Input signal [N] */ + opus_int32 *S, /* I/O: State vector [2] */ + opus_int16 *outL, /* O: Low band [N/2] */ + opus_int16 *outH, /* O: High band [N/2] */ + const opus_int32 N /* I: Number of input samples */ ); /********************************************************************/ @@ -181,60 +181,60 @@ void silk_ana_filt_bank_1( /* approximation of 128 * log2() (exact inverse of approx 2^() below) */ /* convert input to a log scale */ -SKP_int32 silk_lin2log(const SKP_int32 inLin); /* I: input in linear scale */ +opus_int32 silk_lin2log(const opus_int32 inLin); /* I: input in linear scale */ /* Approximation of a sigmoid function */ -SKP_int silk_sigm_Q15(SKP_int in_Q5); +opus_int silk_sigm_Q15(opus_int in_Q5); /* approximation of 2^() (exact inverse of approx log2() above) */ /* convert input to a linear scale */ -SKP_int32 silk_log2lin(const SKP_int32 inLog_Q7); /* I: input on log scale */ +opus_int32 silk_log2lin(const opus_int32 inLog_Q7); /* I: input on log scale */ /* Function that returns the maximum absolut value of the input vector */ -SKP_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */ - const SKP_int16 *vec, /* I Input vector [len] */ - const SKP_int32 len /* I Length of input vector */ +opus_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */ + const opus_int16 *vec, /* I Input vector [len] */ + const opus_int32 len /* I Length of input vector */ ); /* Compute number of bits to right shift the sum of squares of a vector */ /* of int16s to make it fit in an int32 */ void silk_sum_sqr_shift( - SKP_int32 *energy, /* O Energy of x, after shifting to the right */ - SKP_int *shift, /* O Number of bits right shift applied to energy */ - const SKP_int16 *x, /* I Input vector */ - SKP_int len /* I Length of input vector */ + opus_int32 *energy, /* O Energy of x, after shifting to the right */ + opus_int *shift, /* O Number of bits right shift applied to energy */ + const opus_int16 *x, /* I Input vector */ + opus_int len /* I Length of input vector */ ); /* Calculates the reflection coefficients from the correlation sequence */ /* Faster than schur64(), but much less accurate. */ /* uses SMLAWB(), requiring armv5E and higher. */ -SKP_int32 silk_schur( /* O: Returns residual energy */ - SKP_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */ - const SKP_int32 *c, /* I: correlations [order+1] */ - const SKP_int32 order /* I: prediction order */ +opus_int32 silk_schur( /* O: Returns residual energy */ + opus_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */ + const opus_int32 *c, /* I: correlations [order+1] */ + const opus_int32 order /* I: prediction order */ );; /* Calculates the reflection coefficients from the correlation sequence */ /* Slower than schur(), but more accurate. */ /* Uses SMULL(), available on armv4 */ -SKP_int32 silk_schur64( /* O: returns residual energy */ - SKP_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */ - const SKP_int32 c[], /* I: Correlations [order+1] */ - SKP_int32 order /* I: Prediction order */ +opus_int32 silk_schur64( /* O: returns residual energy */ + opus_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */ + const opus_int32 c[], /* I: Correlations [order+1] */ + opus_int32 order /* I: Prediction order */ ); /* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a( - SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ - const SKP_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */ - const SKP_int32 order /* I: Prediction order */ + opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ + const opus_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */ + const opus_int32 order /* I: Prediction order */ ); /* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a_Q16( - SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ - const SKP_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */ - const SKP_int32 order /* I: Prediction order */ + opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ + const opus_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */ + const opus_int32 order /* I: Prediction order */ ); /* Apply sine window to signal vector. */ @@ -243,19 +243,19 @@ void silk_k2a_Q16( /* 2 -> sine window from pi/2 to pi */ /* every other sample of window is linearly interpolated, for speed */ void silk_apply_sine_window( - SKP_int16 px_win[], /* O Pointer to windowed signal */ - const SKP_int16 px[], /* I Pointer to input signal */ - const SKP_int win_type, /* I Selects a window type */ - const SKP_int length /* I Window length, multiple of 4 */ + opus_int16 px_win[], /* O Pointer to windowed signal */ + const opus_int16 px[], /* I Pointer to input signal */ + const opus_int win_type, /* I Selects a window type */ + const opus_int length /* I Window length, multiple of 4 */ ); /* Compute autocorrelation */ void silk_autocorr( - SKP_int32 *results, /* O Result (length correlationCount) */ - SKP_int *scale, /* O Scaling of the correlation vector */ - const SKP_int16 *inputData, /* I Input data to correlate */ - const SKP_int inputDataSize, /* I Length of input */ - const SKP_int correlationCount /* I Number of correlation taps to compute */ + opus_int32 *results, /* O Result (length correlationCount) */ + opus_int *scale, /* O Scaling of the correlation vector */ + const opus_int16 *inputData, /* I Input data to correlate */ + const opus_int inputDataSize, /* I Length of input */ + const opus_int correlationCount /* I Number of correlation taps to compute */ ); /* Pitch estimator */ @@ -264,100 +264,100 @@ void silk_autocorr( #define SILK_PE_MAX_COMPLEX 2 void silk_decode_pitch( - SKP_int16 lagIndex, /* I */ - SKP_int8 contourIndex, /* O */ - SKP_int pitch_lags[], /* O 4 pitch values */ - const SKP_int Fs_kHz, /* I sampling frequency (kHz) */ - const SKP_int nb_subfr /* I number of sub frames */ -); - -SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ - const SKP_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ - SKP_int *pitch_out, /* O 4 pitch lag values */ - SKP_int16 *lagIndex, /* O Lag Index */ - SKP_int8 *contourIndex, /* O Pitch contour Index */ - SKP_int *LTPCorr_Q15, /* I/O Normalized correlation; input: value from previous frame */ - SKP_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ - const SKP_int32 search_thres1_Q16, /* I First stage threshold for lag candidates 0 - 1 */ - const SKP_int search_thres2_Q15, /* I Final threshold for lag candidates 0 - 1 */ - const SKP_int Fs_kHz, /* I Sample frequency (kHz) */ - const SKP_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ - const SKP_int nb_subfr /* I number of 5 ms subframes */ + opus_int16 lagIndex, /* I */ + opus_int8 contourIndex, /* O */ + opus_int pitch_lags[], /* O 4 pitch values */ + const opus_int Fs_kHz, /* I sampling frequency (kHz) */ + const opus_int nb_subfr /* I number of sub frames */ +); + +opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ + const opus_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ + opus_int *pitch_out, /* O 4 pitch lag values */ + opus_int16 *lagIndex, /* O Lag Index */ + opus_int8 *contourIndex, /* O Pitch contour Index */ + opus_int *LTPCorr_Q15, /* I/O Normalized correlation; input: value from previous frame */ + opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ + const opus_int32 search_thres1_Q16, /* I First stage threshold for lag candidates 0 - 1 */ + const opus_int search_thres2_Q15, /* I Final threshold for lag candidates 0 - 1 */ + const opus_int Fs_kHz, /* I Sample frequency (kHz) */ + const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ + const opus_int nb_subfr /* I number of 5 ms subframes */ ); /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */ /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */ void silk_A2NLSF( - SKP_int16 *NLSF, /* O Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */ - SKP_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */ - const SKP_int d /* I Filter order (must be even) */ + opus_int16 *NLSF, /* O Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */ + opus_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */ + const opus_int d /* I Filter order (must be even) */ ); /* compute whitening filter coefficients from normalized line spectral frequencies */ void silk_NLSF2A( - SKP_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ - const SKP_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ - const SKP_int d /* I filter order (should be even) */ + opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ + const opus_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ + const opus_int d /* I filter order (should be even) */ ); void silk_insertion_sort_increasing( - SKP_int32 *a, /* I/O Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int32 *a, /* I/O Unsorted / Sorted vector */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ); void silk_insertion_sort_decreasing_int16( - SKP_int16 *a, /* I/O: Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int16 *a, /* I/O: Unsorted / Sorted vector */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ); void silk_insertion_sort_increasing_all_values_int16( - SKP_int16 *a, /* I/O: Unsorted / Sorted vector */ - const SKP_int L /* I: Vector length */ + opus_int16 *a, /* I/O: Unsorted / Sorted vector */ + const opus_int L /* I: Vector length */ ); /* NLSF stabilizer, for a single input data vector */ void silk_NLSF_stabilize( - SKP_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */ - const SKP_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */ - const SKP_int L /* I: Number of NLSF parameters in the input vector */ + opus_int16 *NLSF_Q15, /* I/O: Unstable/stabilized normalized LSF vector in Q15 [L] */ + const opus_int16 *NDeltaMin_Q15, /* I: Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */ + const opus_int L /* I: Number of NLSF parameters in the input vector */ ); /* Laroia low complexity NLSF weights */ void silk_NLSF_VQ_weights_laroia( - SKP_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */ - const SKP_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */ - const SKP_int D /* I: Input vector dimension (even) */ + opus_int16 *pNLSFW_Q_OUT, /* O: Pointer to input vector weights [D x 1] */ + const opus_int16 *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */ + const opus_int D /* I: Input vector dimension (even) */ ); /* Compute reflection coefficients from input signal */ void silk_burg_modified( - SKP_int32 *res_nrg, /* O residual energy */ - SKP_int *res_nrgQ, /* O residual energy Q value */ - SKP_int32 A_Q16[], /* O prediction coefficients (length order) */ - const SKP_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */ - const SKP_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ - const SKP_int nb_subfr, /* I number of subframes stacked in x */ - const SKP_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */ - const SKP_int D /* I order */ + opus_int32 *res_nrg, /* O residual energy */ + opus_int *res_nrgQ, /* O residual energy Q value */ + opus_int32 A_Q16[], /* O prediction coefficients (length order) */ + const opus_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */ + const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ + const opus_int nb_subfr, /* I number of subframes stacked in x */ + const opus_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */ + const opus_int D /* I order */ ); /* Copy and multiply a vector by a constant */ void silk_scale_copy_vector16( - SKP_int16 *data_out, - const SKP_int16 *data_in, - SKP_int32 gain_Q16, /* I: gain in Q16 */ - const SKP_int dataSize /* I: length */ + opus_int16 *data_out, + const opus_int16 *data_in, + opus_int32 gain_Q16, /* I: gain in Q16 */ + const opus_int dataSize /* I: length */ ); /* Some for the LTP related function requires Q26 to work.*/ void silk_scale_vector32_Q26_lshift_18( - SKP_int32 *data1, /* I/O: Q0/Q18 */ - SKP_int32 gain_Q26, /* I: Q26 */ - SKP_int dataSize /* I: length */ + opus_int32 *data1, /* I/O: Q0/Q18 */ + opus_int32 gain_Q26, /* I: Q26 */ + opus_int dataSize /* I: length */ ); /********************************************************************/ @@ -365,23 +365,23 @@ void silk_scale_vector32_Q26_lshift_18( /********************************************************************/ /* return sum(inVec1[i]*inVec2[i]) */ -SKP_int32 silk_inner_prod_aligned( - const SKP_int16 *const inVec1, /* I input vector 1 */ - const SKP_int16 *const inVec2, /* I input vector 2 */ - const SKP_int len /* I vector lengths */ +opus_int32 silk_inner_prod_aligned( + const opus_int16 *const inVec1, /* I input vector 1 */ + const opus_int16 *const inVec2, /* I input vector 2 */ + const opus_int len /* I vector lengths */ ); -SKP_int32 silk_inner_prod_aligned_scale( - const SKP_int16 *const inVec1, /* I input vector 1 */ - const SKP_int16 *const inVec2, /* I input vector 2 */ - const SKP_int scale, /* I number of bits to shift */ - const SKP_int len /* I vector lengths */ +opus_int32 silk_inner_prod_aligned_scale( + const opus_int16 *const inVec1, /* I input vector 1 */ + const opus_int16 *const inVec2, /* I input vector 2 */ + const opus_int scale, /* I number of bits to shift */ + const opus_int len /* I vector lengths */ ); -SKP_int64 silk_inner_prod16_aligned_64( - const SKP_int16 *inVec1, /* I input vector 1 */ - const SKP_int16 *inVec2, /* I input vector 2 */ - const SKP_int len /* I vector lengths */ +opus_int64 silk_inner_prod16_aligned_64( + const opus_int16 *inVec1, /* I input vector 1 */ + const opus_int16 *inVec2, /* I input vector 2 */ + const opus_int len /* I vector lengths */ ); /********************************************************************/ @@ -392,18 +392,18 @@ SKP_int64 silk_inner_prod16_aligned_64( left. Output is 32bit int. Note: contemporary compilers recognize the C expression below and compile it into a 'ror' instruction if available. No need for inline ASM! */ -SKP_INLINE SKP_int32 silk_ROR32( SKP_int32 a32, SKP_int rot ) +SKP_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) { - SKP_uint32 x = (SKP_uint32) a32; - SKP_uint32 r = (SKP_uint32) rot; - SKP_uint32 m = (SKP_uint32) -rot; + opus_uint32 x = (opus_uint32) a32; + opus_uint32 r = (opus_uint32) rot; + opus_uint32 m = (opus_uint32) -rot; if(rot <= 0) - return (SKP_int32) ((x << m) | (x >> (32 - m))); + return (opus_int32) ((x << m) | (x >> (32 - m))); else - return (SKP_int32) ((x << (32 - r)) | (x >> r)); + return (opus_int32) ((x << (32 - r)) | (x >> r)); } -/* Allocate SKP_int16 alligned to 4-byte memory address */ +/* Allocate opus_int16 alligned to 4-byte memory address */ #if EMBEDDED_ARM #define SKP_DWORD_ALIGN __attribute__((aligned(4))) #else @@ -434,10 +434,10 @@ SKP_INLINE SKP_int32 silk_ROR32( SKP_int32 a32, SKP_int rot ) // a32 + ((a32 >> 16) * (b32 >> 16)) output have to be 32bit int #define SKP_SMLATT(a32, b32, c32) SKP_ADD32((a32),((b32) >> 16) * ((c32) >> 16)) -#define SKP_SMLALBB(a64, b16, c16) SKP_ADD64((a64),(SKP_int64)((SKP_int32)(b16) * (SKP_int32)(c16))) +#define SKP_SMLALBB(a64, b16, c16) SKP_ADD64((a64),(opus_int64)((opus_int32)(b16) * (opus_int32)(c16))) // (a32 * b32) -#define SKP_SMULL(a32, b32) ((SKP_int64)(a32) * /*(SKP_int64)*/(b32)) +#define SKP_SMULL(a32, b32) ((opus_int64)(a32) * /*(opus_int64)*/(b32)) // multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) #define SKP_MLA_ovflw(a32, b32, c32) SKP_MLA(a32, b32, c32) @@ -449,8 +449,8 @@ SKP_INLINE SKP_int32 silk_ROR32( SKP_int32 a32, SKP_int rot ) #define SKP_SMLAWB_ovflw(a32, b32, c32) SKP_SMLAWB(a32, b32, c32) #define SKP_SMLAWT_ovflw(a32, b32, c32) SKP_SMLAWT(a32, b32, c32) -#define SKP_DIV32_16(a32, b16) ((SKP_int32)((a32) / (b16))) -#define SKP_DIV32(a32, b32) ((SKP_int32)((a32) / (b32))) +#define SKP_DIV32_16(a32, b16) ((opus_int32)((a32) / (b16))) +#define SKP_DIV32(a32, b32) ((opus_int32)((a32) / (b32))) // These macros enables checking for overflow in silk_API_Debug.h #define SKP_ADD16(a, b) ((a) + (b)) @@ -472,12 +472,12 @@ SKP_INLINE SKP_int32 silk_ROR32( SKP_int32 a32, SKP_int rot ) #define SKP_CHECK_FIT16(a) (a) #define SKP_CHECK_FIT32(a) (a) -#define SKP_ADD_SAT16(a, b) (SKP_int16)SKP_SAT16( SKP_ADD32( (SKP_int32)(a), (b) ) ) +#define SKP_ADD_SAT16(a, b) (opus_int16)SKP_SAT16( SKP_ADD32( (opus_int32)(a), (b) ) ) #define SKP_ADD_SAT64(a, b) ((((a) + (b)) & 0x8000000000000000LL) == 0 ? \ ((((a) & (b)) & 0x8000000000000000LL) != 0 ? SKP_int64_MIN : (a)+(b)) : \ ((((a) | (b)) & 0x8000000000000000LL) == 0 ? SKP_int64_MAX : (a)+(b)) ) -#define SKP_SUB_SAT16(a, b) (SKP_int16)SKP_SAT16( SKP_SUB32( (SKP_int32)(a), (b) ) ) +#define SKP_SUB_SAT16(a, b) (opus_int16)SKP_SAT16( SKP_SUB32( (opus_int32)(a), (b) ) ) #define SKP_SUB_SAT64(a, b) ((((a)-(b)) & 0x8000000000000000LL) == 0 ? \ (( (a) & ((b)^0x8000000000000000LL) & 0x8000000000000000LL) ? SKP_int64_MIN : (a)-(b)) : \ ((((a)^0x8000000000000000LL) & (b) & 0x8000000000000000LL) ? SKP_int64_MAX : (a)-(b)) ) @@ -535,40 +535,40 @@ SKP_INLINE SKP_int32 silk_ROR32( SKP_int32 a32, SKP_int rot ) #define SKP_max(a, b) (((a) > (b)) ? (a) : (b)) /* Macro to convert floating-point constants to fixed-point */ -#define SILK_FIX_CONST( C, Q ) ((SKP_int32)((C) * ((SKP_int64)1 << (Q)) + 0.5)) +#define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5)) /* SKP_min() versions with typecast in the function call */ -SKP_INLINE SKP_int SKP_min_int(SKP_int a, SKP_int b) +SKP_INLINE opus_int SKP_min_int(opus_int a, opus_int b) { return (((a) < (b)) ? (a) : (b)); } -SKP_INLINE SKP_int16 SKP_min_16(SKP_int16 a, SKP_int16 b) +SKP_INLINE opus_int16 SKP_min_16(opus_int16 a, opus_int16 b) { return (((a) < (b)) ? (a) : (b)); } -SKP_INLINE SKP_int32 SKP_min_32(SKP_int32 a, SKP_int32 b) +SKP_INLINE opus_int32 SKP_min_32(opus_int32 a, opus_int32 b) { return (((a) < (b)) ? (a) : (b)); } -SKP_INLINE SKP_int64 SKP_min_64(SKP_int64 a, SKP_int64 b) +SKP_INLINE opus_int64 SKP_min_64(opus_int64 a, opus_int64 b) { return (((a) < (b)) ? (a) : (b)); } /* SKP_min() versions with typecast in the function call */ -SKP_INLINE SKP_int SKP_max_int(SKP_int a, SKP_int b) +SKP_INLINE opus_int SKP_max_int(opus_int a, opus_int b) { return (((a) > (b)) ? (a) : (b)); } -SKP_INLINE SKP_int16 SKP_max_16(SKP_int16 a, SKP_int16 b) +SKP_INLINE opus_int16 SKP_max_16(opus_int16 a, opus_int16 b) { return (((a) > (b)) ? (a) : (b)); } -SKP_INLINE SKP_int32 SKP_max_32(SKP_int32 a, SKP_int32 b) +SKP_INLINE opus_int32 SKP_max_32(opus_int32 a, opus_int32 b) { return (((a) > (b)) ? (a) : (b)); } -SKP_INLINE SKP_int64 SKP_max_64(SKP_int64 a, SKP_int64 b) +SKP_INLINE opus_int64 SKP_max_64(opus_int64 a, opus_int64 b) { return (((a) > (b)) ? (a) : (b)); } @@ -602,9 +602,9 @@ SKP_INLINE SKP_int64 SKP_max_64(SKP_int64 a, SKP_int64 b) // SKP_SMMUL: Signed top word multiply. // ARMv6 2 instruction cycles. // ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers.(except xM) -//#define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT(SKP_SMLAL(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)), 16) +//#define SKP_SMMUL(a32, b32) (opus_int32)SKP_RSHIFT(SKP_SMLAL(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)), 16) // the following seems faster on x86 -#define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT64(SKP_SMULL((a32), (b32)), 32) +#define SKP_SMMUL(a32, b32) (opus_int32)SKP_RSHIFT64(SKP_SMULL((a32), (b32)), 32) #include "silk_Inlines.h" #include "silk_MacroCount.h" diff --git a/silk/silk_VAD.c b/silk/silk_VAD.c index 15295fde8d3208ecea7af2867309529b8b4c8474..a0ab835df44a2fd2749e5e8603837581f8ff7dee 100644 --- a/silk/silk_VAD.c +++ b/silk/silk_VAD.c @@ -31,11 +31,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /**********************************/ /* Initialization of the Silk VAD */ /**********************************/ -SKP_int silk_VAD_Init( /* O Return value, 0 if success */ +opus_int silk_VAD_Init( /* O Return value, 0 if success */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ ) { - SKP_int b, ret = 0; + opus_int b, ret = 0; /* reset state memory */ SKP_memset( psSilk_VAD, 0, sizeof( silk_VAD_state ) ); @@ -62,25 +62,25 @@ SKP_int silk_VAD_Init( /* O Return value, 0 if s } /* Weighting factors for tilt measure */ -static const SKP_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -12000 }; +static const opus_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -12000 }; /***************************************/ /* Get the speech activity level in Q8 */ /***************************************/ -SKP_int silk_VAD_GetSA_Q8( /* O Return value, 0 if success */ +opus_int silk_VAD_GetSA_Q8( /* O Return value, 0 if success */ silk_encoder_state *psEncC, /* I/O Encoder state */ - const SKP_int16 pIn[] /* I PCM input */ + const opus_int16 pIn[] /* I PCM input */ ) { - SKP_int SA_Q15, pSNR_dB_Q7, input_tilt; - SKP_int decimated_framelength, dec_subframe_length, dec_subframe_offset, SNR_Q7, i, b, s; - SKP_int32 sumSquared, smooth_coef_Q16; - SKP_int16 HPstateTmp; - SKP_int16 X[ VAD_N_BANDS ][ MAX_FRAME_LENGTH / 2 ]; - SKP_int32 Xnrg[ VAD_N_BANDS ]; - SKP_int32 NrgToNoiseRatio_Q8[ VAD_N_BANDS ]; - SKP_int32 speech_nrg, x_tmp; - SKP_int ret = 0; + opus_int SA_Q15, pSNR_dB_Q7, input_tilt; + opus_int decimated_framelength, dec_subframe_length, dec_subframe_offset, SNR_Q7, i, b, s; + opus_int32 sumSquared, smooth_coef_Q16; + opus_int16 HPstateTmp; + opus_int16 X[ VAD_N_BANDS ][ MAX_FRAME_LENGTH / 2 ]; + opus_int32 Xnrg[ VAD_N_BANDS ]; + opus_int32 NrgToNoiseRatio_Q8[ VAD_N_BANDS ]; + opus_int32 speech_nrg, x_tmp; + opus_int ret = 0; silk_VAD_state *psSilk_VAD = &psEncC->sVAD; /* Safety checks */ @@ -194,7 +194,7 @@ SKP_int silk_VAD_GetSA_Q8( /* O Return value, 0 if s sumSquared = SKP_DIV32_16( sumSquared, VAD_N_BANDS ); /* Q14 */ /* Root-mean-square approximation, scale to dBs, and write to output pointer */ - pSNR_dB_Q7 = ( SKP_int16 )( 3 * silk_SQRT_APPROX( sumSquared ) ); /* Q7 */ + pSNR_dB_Q7 = ( opus_int16 )( 3 * silk_SQRT_APPROX( sumSquared ) ); /* Q7 */ /*********************************/ /* Speech Probability Estimation */ @@ -261,13 +261,13 @@ SKP_int silk_VAD_GetSA_Q8( /* O Return value, 0 if s /* Noise level estimation */ /**************************/ void silk_VAD_GetNoiseLevels( - const SKP_int32 pX[ VAD_N_BANDS ], /* I subband energies */ + const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ ) { - SKP_int k; - SKP_int32 nl, nrg, inv_nrg; - SKP_int coef, min_coef; + opus_int k; + opus_int32 nl, nrg, inv_nrg; + opus_int coef, min_coef; /* Initially faster smoothing */ if( psSilk_VAD->counter < 1000 ) { /* 1000 = 20 sec */ diff --git a/silk/silk_VQ_WMat_EC.c b/silk/silk_VQ_WMat_EC.c index bf123eb7b8162e400c43a4b34f9492c230908a4c..e35e48136d1e9671cba9621438242414435401fa 100644 --- a/silk/silk_VQ_WMat_EC.c +++ b/silk/silk_VQ_WMat_EC.c @@ -29,20 +29,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Entropy constrained matrix-weighted VQ, hard-coded to 5-element vectors, for a single input data vector */ void silk_VQ_WMat_EC( - SKP_int8 *ind, /* O index of best codebook vector */ - SKP_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/ - const SKP_int16 *in_Q14, /* I input vector to be quantized */ - const SKP_int32 *W_Q18, /* I weighting matrix */ - const SKP_int8 *cb_Q7, /* I codebook */ - const SKP_uint8 *cl_Q5, /* I code length for each codebook vector */ - const SKP_int mu_Q9, /* I tradeoff between weighted error and rate */ - SKP_int L /* I number of vectors in codebook */ + opus_int8 *ind, /* O index of best codebook vector */ + opus_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/ + const opus_int16 *in_Q14, /* I input vector to be quantized */ + const opus_int32 *W_Q18, /* I weighting matrix */ + const opus_int8 *cb_Q7, /* I codebook */ + const opus_uint8 *cl_Q5, /* I code length for each codebook vector */ + const opus_int mu_Q9, /* I tradeoff between weighted error and rate */ + opus_int L /* I number of vectors in codebook */ ) { - SKP_int k; - const SKP_int8 *cb_row_Q7; - SKP_int16 diff_Q14[ 5 ]; - SKP_int32 sum1_Q14, sum2_Q16; + opus_int k; + const opus_int8 *cb_row_Q7; + opus_int16 diff_Q14[ 5 ]; + opus_int32 sum1_Q14, sum2_Q16; /* Loop over codebook */ *rate_dist_Q14 = SKP_int32_MAX; @@ -98,7 +98,7 @@ void silk_VQ_WMat_EC( /* find best */ if( sum1_Q14 < *rate_dist_Q14 ) { *rate_dist_Q14 = sum1_Q14; - *ind = (SKP_int8)k; + *ind = (opus_int8)k; } /* Go to next cbk vector */ diff --git a/silk/silk_ana_filt_bank_1.c b/silk/silk_ana_filt_bank_1.c index 7ad8b926c7f2d5ab646f165808b42ed3ad035da9..1cc3baf63ed619653bcbd612772807462ba120dd 100644 --- a/silk/silk_ana_filt_bank_1.c +++ b/silk/silk_ana_filt_bank_1.c @@ -29,25 +29,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Coefficients for 2-band filter bank based on first-order allpass filters */ // old -static SKP_int16 A_fb1_20[ 1 ] = { 5394 << 1 }; -static SKP_int16 A_fb1_21[ 1 ] = { 20623 << 1 }; /* wrap-around to negative number is intentional */ +static opus_int16 A_fb1_20[ 1 ] = { 5394 << 1 }; +static opus_int16 A_fb1_21[ 1 ] = { 20623 << 1 }; /* wrap-around to negative number is intentional */ /* Split signal into two decimated bands using first-order allpass filters */ void silk_ana_filt_bank_1( - const SKP_int16 *in, /* I: Input signal [N] */ - SKP_int32 *S, /* I/O: State vector [2] */ - SKP_int16 *outL, /* O: Low band [N/2] */ - SKP_int16 *outH, /* O: High band [N/2] */ - const SKP_int32 N /* I: Number of input samples */ + const opus_int16 *in, /* I: Input signal [N] */ + opus_int32 *S, /* I/O: State vector [2] */ + opus_int16 *outL, /* O: Low band [N/2] */ + opus_int16 *outH, /* O: High band [N/2] */ + const opus_int32 N /* I: Number of input samples */ ) { - SKP_int k, N2 = SKP_RSHIFT( N, 1 ); - SKP_int32 in32, X, Y, out_1, out_2; + opus_int k, N2 = SKP_RSHIFT( N, 1 ); + opus_int32 in32, X, Y, out_1, out_2; /* Internal variables and state are in Q10 format */ for( k = 0; k < N2; k++ ) { /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ 2 * k ], 10 ); /* All-pass section for even input sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -56,7 +56,7 @@ void silk_ana_filt_bank_1( S[ 0 ] = SKP_ADD32( in32, X ); /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k + 1 ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ 2 * k + 1 ], 10 ); /* All-pass section for odd input sample, and add to output of previous section */ Y = SKP_SUB32( in32, S[ 1 ] ); @@ -65,7 +65,7 @@ void silk_ana_filt_bank_1( S[ 1 ] = SKP_ADD32( in32, X ); /* Add/subtract, convert back to int16 and store to output */ - outL[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( SKP_ADD32( out_2, out_1 ), 11 ) ); - outH[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SUB32( out_2, out_1 ), 11 ) ); + outL[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( SKP_ADD32( out_2, out_1 ), 11 ) ); + outH[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SUB32( out_2, out_1 ), 11 ) ); } } diff --git a/silk/silk_apply_sine_window.c b/silk/silk_apply_sine_window.c index ce8acf9cad9b5ab61b2e7a84687ebb2878603856..f9f44bfcb421b21d293f7467cdf1672c763d3ae2 100644 --- a/silk/silk_apply_sine_window.c +++ b/silk/silk_apply_sine_window.c @@ -37,21 +37,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Matlab code for table: for k=16:9*4:16+2*9*4, fprintf(' %7.d,', -round(65536*pi ./ (k:4:k+8*4))); fprintf('\n'); end */ -static SKP_int16 freq_table_Q16[ 27 ] = { +static opus_int16 freq_table_Q16[ 27 ] = { 12111, 9804, 8235, 7100, 6239, 5565, 5022, 4575, 4202, 3885, 3612, 3375, 3167, 2984, 2820, 2674, 2542, 2422, 2313, 2214, 2123, 2038, 1961, 1889, 1822, 1760, 1702, }; void silk_apply_sine_window( - SKP_int16 px_win[], /* O Pointer to windowed signal */ - const SKP_int16 px[], /* I Pointer to input signal */ - const SKP_int win_type, /* I Selects a window type */ - const SKP_int length /* I Window length, multiple of 4 */ + opus_int16 px_win[], /* O Pointer to windowed signal */ + const opus_int16 px[], /* I Pointer to input signal */ + const opus_int win_type, /* I Selects a window type */ + const opus_int length /* I Window length, multiple of 4 */ ) { - SKP_int k, f_Q16, c_Q16; - SKP_int32 S0_Q16, S1_Q16; + opus_int k, f_Q16, c_Q16; + opus_int32 S0_Q16, S1_Q16; SKP_assert( win_type == 1 || win_type == 2 ); @@ -62,7 +62,7 @@ void silk_apply_sine_window( /* Frequency */ k = ( length >> 2 ) - 4; SKP_assert( k >= 0 && k <= 26 ); - f_Q16 = (SKP_int)freq_table_Q16[ k ]; + f_Q16 = (opus_int)freq_table_Q16[ k ]; /* Factor used for cosine approximation */ c_Q16 = SKP_SMULWB( f_Q16, -f_Q16 ); @@ -84,13 +84,13 @@ void silk_apply_sine_window( /* Uses the recursive equation: sin(n*f) = 2 * cos(f) * sin((n-1)*f) - sin((n-2)*f) */ /* 4 samples at a time */ for( k = 0; k < length; k += 4 ) { - px_win[ k ] = (SKP_int16)SKP_SMULWB( SKP_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k ] ); - px_win[ k + 1 ] = (SKP_int16)SKP_SMULWB( S1_Q16, px[ k + 1] ); + px_win[ k ] = (opus_int16)SKP_SMULWB( SKP_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k ] ); + px_win[ k + 1 ] = (opus_int16)SKP_SMULWB( S1_Q16, px[ k + 1] ); S0_Q16 = SKP_SMULWB( S1_Q16, c_Q16 ) + SKP_LSHIFT( S1_Q16, 1 ) - S0_Q16 + 1; S0_Q16 = SKP_min( S0_Q16, ( 1 << 16 ) ); - px_win[ k + 2 ] = (SKP_int16)SKP_SMULWB( SKP_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k + 2] ); - px_win[ k + 3 ] = (SKP_int16)SKP_SMULWB( S0_Q16, px[ k + 3 ] ); + px_win[ k + 2 ] = (opus_int16)SKP_SMULWB( SKP_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k + 2] ); + px_win[ k + 3 ] = (opus_int16)SKP_SMULWB( S0_Q16, px[ k + 3 ] ); S1_Q16 = SKP_SMULWB( S0_Q16, c_Q16 ) + SKP_LSHIFT( S0_Q16, 1 ) - S1_Q16; S1_Q16 = SKP_min( S1_Q16, ( 1 << 16 ) ); } diff --git a/silk/silk_array_maxabs.c b/silk/silk_array_maxabs.c index 41dbcfd7ad35e592030ed8da468a30fa3b1e2a32..b93dfc8903ae35bfce8259b43e049f14b7f30a7e 100644 --- a/silk/silk_array_maxabs.c +++ b/silk/silk_array_maxabs.c @@ -28,12 +28,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" /* Function that returns the maximum absolut value of the input vector */ -SKP_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */ - const SKP_int16 *vec, /* I Input vector [len] */ - const SKP_int32 len /* I Length of input vector */ +opus_int16 silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */ + const opus_int16 *vec, /* I Input vector [len] */ + const opus_int32 len /* I Length of input vector */ ) { - SKP_int32 max = 0, i, lvl = 0, ind; + opus_int32 max = 0, i, lvl = 0, ind; if( len == 0 ) return 0; ind = len - 1; diff --git a/silk/silk_autocorr.c b/silk/silk_autocorr.c index 1b613639930329a592c855fbc9e2bbd2c4873998..16294011b157d659880c2ab43bc2bfbecfc33ca7 100644 --- a/silk/silk_autocorr.c +++ b/silk/silk_autocorr.c @@ -29,15 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute autocorrelation */ void silk_autocorr( - SKP_int32 *results, /* O Result (length correlationCount) */ - SKP_int *scale, /* O Scaling of the correlation vector */ - const SKP_int16 *inputData, /* I Input data to correlate */ - const SKP_int inputDataSize, /* I Length of input */ - const SKP_int correlationCount /* I Number of correlation taps to compute */ + opus_int32 *results, /* O Result (length correlationCount) */ + opus_int *scale, /* O Scaling of the correlation vector */ + const opus_int16 *inputData, /* I Input data to correlate */ + const opus_int inputDataSize, /* I Length of input */ + const opus_int correlationCount /* I Number of correlation taps to compute */ ) { - SKP_int i, lz, nRightShifts, corrCount; - SKP_int64 corr64; + opus_int i, lz, nRightShifts, corrCount; + opus_int64 corr64; corrCount = SKP_min_int( inputDataSize, correlationCount ); @@ -55,18 +55,18 @@ void silk_autocorr( *scale = nRightShifts; if( nRightShifts <= 0 ) { - results[ 0 ] = SKP_LSHIFT( (SKP_int32)SKP_CHECK_FIT32( corr64 ), -nRightShifts ); + results[ 0 ] = SKP_LSHIFT( (opus_int32)SKP_CHECK_FIT32( corr64 ), -nRightShifts ); /* compute remaining correlations based on int32 inner product */ for( i = 1; i < corrCount; i++ ) { results[ i ] = SKP_LSHIFT( silk_inner_prod_aligned( inputData, inputData + i, inputDataSize - i ), -nRightShifts ); } } else { - results[ 0 ] = (SKP_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( corr64, nRightShifts ) ); + results[ 0 ] = (opus_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( corr64, nRightShifts ) ); /* compute remaining correlations based on int64 inner product */ for( i = 1; i < corrCount; i++ ) { - results[ i ] = (SKP_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( silk_inner_prod16_aligned_64( inputData, inputData + i, inputDataSize - i ), nRightShifts ) ); + results[ i ] = (opus_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( silk_inner_prod16_aligned_64( inputData, inputData + i, inputDataSize - i ), nRightShifts ) ); } } } diff --git a/silk/silk_biquad_alt.c b/silk/silk_biquad_alt.c index 74bf2c4595d07687cff3c3e29120a6843b5c6bcb..ab81f41e1d04117e56b71e22fbd42c14e01071d6 100644 --- a/silk/silk_biquad_alt.c +++ b/silk/silk_biquad_alt.c @@ -36,17 +36,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Second order ARMA filter, alternative implementation */ void silk_biquad_alt( - const SKP_int16 *in, /* I: Input signal */ - const SKP_int32 *B_Q28, /* I: MA coefficients [3] */ - const SKP_int32 *A_Q28, /* I: AR coefficients [2] */ - SKP_int32 *S, /* I/O: State vector [2] */ - SKP_int16 *out, /* O: Output signal */ - const SKP_int32 len /* I: Signal length (must be even) */ + const opus_int16 *in, /* I: Input signal */ + const opus_int32 *B_Q28, /* I: MA coefficients [3] */ + const opus_int32 *A_Q28, /* I: AR coefficients [2] */ + opus_int32 *S, /* I/O: State vector [2] */ + opus_int16 *out, /* O: Output signal */ + const opus_int32 len /* I: Signal length (must be even) */ ) { /* DIRECT FORM II TRANSPOSED (uses 2 element state vector) */ - SKP_int k; - SKP_int32 inval, A0_U_Q28, A0_L_Q28, A1_U_Q28, A1_L_Q28, out32_Q14; + opus_int k; + opus_int32 inval, A0_U_Q28, A0_L_Q28, A1_U_Q28, A1_L_Q28, out32_Q14; /* Negate A_Q28 values and split in two parts */ A0_L_Q28 = ( -A_Q28[ 0 ] ) & 0x00003FFF; /* lower part */ @@ -68,6 +68,6 @@ void silk_biquad_alt( S[ 1 ] = SKP_SMLAWB( S[ 1 ], B_Q28[ 2 ], inval ); /* Scale back to Q0 and saturate */ - out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT( out32_Q14 + (1<<14) - 1, 14 ) ); + out[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT( out32_Q14 + (1<<14) - 1, 14 ) ); } } diff --git a/silk/silk_burg_modified.c b/silk/silk_burg_modified.c index c4f330ef1975bd20248e2ef196715ed644387d5a..8295c7fb635d638bf43eeacb9d937ddac0ca3ef0 100644 --- a/silk/silk_burg_modified.c +++ b/silk/silk_burg_modified.c @@ -37,26 +37,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute reflection coefficients from input signal */ void silk_burg_modified( - SKP_int32 *res_nrg, /* O residual energy */ - SKP_int *res_nrg_Q, /* O residual energy Q value */ - SKP_int32 A_Q16[], /* O prediction coefficients (length order) */ - const SKP_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */ - const SKP_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ - const SKP_int nb_subfr, /* I number of subframes stacked in x */ - const SKP_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */ - const SKP_int D /* I order */ + opus_int32 *res_nrg, /* O residual energy */ + opus_int *res_nrg_Q, /* O residual energy Q value */ + opus_int32 A_Q16[], /* O prediction coefficients (length order) */ + const opus_int16 x[], /* I input signal, length: nb_subfr * ( D + subfr_length ) */ + const opus_int subfr_length, /* I input signal subframe length (including D preceeding samples) */ + const opus_int nb_subfr, /* I number of subframes stacked in x */ + const opus_int32 WhiteNoiseFrac_Q32, /* I fraction added to zero-lag autocorrelation */ + const opus_int D /* I order */ ) { - SKP_int k, n, s, lz, rshifts, rshifts_extra; - SKP_int32 C0, num, nrg, rc_Q31, Atmp_QA, Atmp1, tmp1, tmp2, x1, x2; - const SKP_int16 *x_ptr; + opus_int k, n, s, lz, rshifts, rshifts_extra; + opus_int32 C0, num, nrg, rc_Q31, Atmp_QA, Atmp1, tmp1, tmp2, x1, x2; + const opus_int16 *x_ptr; - SKP_int32 C_first_row[ SILK_MAX_ORDER_LPC ]; - SKP_int32 C_last_row[ SILK_MAX_ORDER_LPC ]; - SKP_int32 Af_QA[ SILK_MAX_ORDER_LPC ]; + opus_int32 C_first_row[ SILK_MAX_ORDER_LPC ]; + opus_int32 C_last_row[ SILK_MAX_ORDER_LPC ]; + opus_int32 Af_QA[ SILK_MAX_ORDER_LPC ]; - SKP_int32 CAf[ SILK_MAX_ORDER_LPC + 1 ]; - SKP_int32 CAb[ SILK_MAX_ORDER_LPC + 1 ]; + opus_int32 CAf[ SILK_MAX_ORDER_LPC + 1 ]; + opus_int32 CAb[ SILK_MAX_ORDER_LPC + 1 ]; SKP_assert( subfr_length * nb_subfr <= MAX_FRAME_SIZE ); SKP_assert( nb_subfr <= MAX_NB_SUBFR ); @@ -80,12 +80,12 @@ void silk_burg_modified( } rshifts += rshifts_extra; } - SKP_memset( C_first_row, 0, SILK_MAX_ORDER_LPC * sizeof( SKP_int32 ) ); + SKP_memset( C_first_row, 0, SILK_MAX_ORDER_LPC * sizeof( opus_int32 ) ); if( rshifts > 0 ) { for( s = 0; s < nb_subfr; s++ ) { x_ptr = x + s * subfr_length; for( n = 1; n < D + 1; n++ ) { - C_first_row[ n - 1 ] += (SKP_int32)SKP_RSHIFT64( + C_first_row[ n - 1 ] += (opus_int32)SKP_RSHIFT64( silk_inner_prod16_aligned_64( x_ptr, x_ptr + n, subfr_length - n ), rshifts ); } } @@ -98,7 +98,7 @@ void silk_burg_modified( } } } - SKP_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( SKP_int32 ) ); + SKP_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( opus_int32 ) ); /* Initialize */ CAb[ 0 ] = CAf[ 0 ] = C0 + SKP_SMMUL( WhiteNoiseFrac_Q32, C0 ) + 1; // Q(-rshifts) @@ -111,10 +111,10 @@ void silk_burg_modified( if( rshifts > -2 ) { for( s = 0; s < nb_subfr; s++ ) { x_ptr = x + s * subfr_length; - x1 = -SKP_LSHIFT32( (SKP_int32)x_ptr[ n ], 16 - rshifts ); // Q(16-rshifts) - x2 = -SKP_LSHIFT32( (SKP_int32)x_ptr[ subfr_length - n - 1 ], 16 - rshifts ); // Q(16-rshifts) - tmp1 = SKP_LSHIFT32( (SKP_int32)x_ptr[ n ], QA - 16 ); // Q(QA-16) - tmp2 = SKP_LSHIFT32( (SKP_int32)x_ptr[ subfr_length - n - 1 ], QA - 16 ); // Q(QA-16) + x1 = -SKP_LSHIFT32( (opus_int32)x_ptr[ n ], 16 - rshifts ); // Q(16-rshifts) + x2 = -SKP_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n - 1 ], 16 - rshifts ); // Q(16-rshifts) + tmp1 = SKP_LSHIFT32( (opus_int32)x_ptr[ n ], QA - 16 ); // Q(QA-16) + tmp2 = SKP_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n - 1 ], QA - 16 ); // Q(QA-16) for( k = 0; k < n; k++ ) { C_first_row[ k ] = SKP_SMLAWB( C_first_row[ k ], x1, x_ptr[ n - k - 1 ] ); // Q( -rshifts ) C_last_row[ k ] = SKP_SMLAWB( C_last_row[ k ], x2, x_ptr[ subfr_length - n + k ] ); // Q( -rshifts ) @@ -132,10 +132,10 @@ void silk_burg_modified( } else { for( s = 0; s < nb_subfr; s++ ) { x_ptr = x + s * subfr_length; - x1 = -SKP_LSHIFT32( (SKP_int32)x_ptr[ n ], -rshifts ); // Q( -rshifts ) - x2 = -SKP_LSHIFT32( (SKP_int32)x_ptr[ subfr_length - n - 1 ], -rshifts ); // Q( -rshifts ) - tmp1 = SKP_LSHIFT32( (SKP_int32)x_ptr[ n ], 17 ); // Q17 - tmp2 = SKP_LSHIFT32( (SKP_int32)x_ptr[ subfr_length - n - 1 ], 17 ); // Q17 + x1 = -SKP_LSHIFT32( (opus_int32)x_ptr[ n ], -rshifts ); // Q( -rshifts ) + x2 = -SKP_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n - 1 ], -rshifts ); // Q( -rshifts ) + tmp1 = SKP_LSHIFT32( (opus_int32)x_ptr[ n ], 17 ); // Q17 + tmp2 = SKP_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n - 1 ], 17 ); // Q17 for( k = 0; k < n; k++ ) { C_first_row[ k ] = SKP_MLA( C_first_row[ k ], x1, x_ptr[ n - k - 1 ] ); // Q( -rshifts ) C_last_row[ k ] = SKP_MLA( C_last_row[ k ], x2, x_ptr[ subfr_length - n + k ] ); // Q( -rshifts ) @@ -147,9 +147,9 @@ void silk_burg_modified( tmp2 = -tmp2; // Q17 for( k = 0; k <= n; k++ ) { CAf[ k ] = SKP_SMLAWW( CAf[ k ], tmp1, - SKP_LSHIFT32( (SKP_int32)x_ptr[ n - k ], -rshifts - 1 ) ); // Q( -rshift ) + SKP_LSHIFT32( (opus_int32)x_ptr[ n - k ], -rshifts - 1 ) ); // Q( -rshift ) CAb[ k ] = SKP_SMLAWW( CAb[ k ], tmp2, - SKP_LSHIFT32( (SKP_int32)x_ptr[ subfr_length - n + k - 1 ], -rshifts - 1 ) );// Q( -rshift ) + SKP_LSHIFT32( (opus_int32)x_ptr[ subfr_length - n + k - 1 ], -rshifts - 1 ) );// Q( -rshift ) } } } @@ -181,7 +181,7 @@ void silk_burg_modified( rc_Q31 = silk_DIV32_varQ( num, nrg, 31 ); } else { /* Negative energy or ratio too high; set remaining coefficients to zero and exit loop */ - SKP_memset( &Af_QA[ n ], 0, ( D - n ) * sizeof( SKP_int32 ) ); + SKP_memset( &Af_QA[ n ], 0, ( D - n ) * sizeof( opus_int32 ) ); SKP_assert( 0 ); break; } diff --git a/silk/silk_bwexpander.c b/silk/silk_bwexpander.c index ca6fb462cbff9b2526fde5b34db47a2c1e30b798..8f65f04cea1c03cf514f60df7fb383fb012e041a 100644 --- a/silk/silk_bwexpander.c +++ b/silk/silk_bwexpander.c @@ -29,19 +29,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander( - SKP_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ - const SKP_int d, /* I Length of ar */ - SKP_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */ + opus_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ + const opus_int d, /* I Length of ar */ + opus_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */ ) { - SKP_int i; - SKP_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; + opus_int i; + opus_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; /* NB: Dont use SKP_SMULWB, instead of SKP_RSHIFT_ROUND( SKP_MUL(), 16 ), below. */ /* Bias in SKP_SMULWB can lead to unstable filters */ for( i = 0; i < d - 1; i++ ) { - ar[ i ] = (SKP_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ i ] ), 16 ); + ar[ i ] = (opus_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ i ] ), 16 ); chirp_Q16 += SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, chirp_minus_one_Q16 ), 16 ); } - ar[ d - 1 ] = (SKP_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ d - 1 ] ), 16 ); + ar[ d - 1 ] = (opus_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ d - 1 ] ), 16 ); } diff --git a/silk/silk_bwexpander_32.c b/silk/silk_bwexpander_32.c index e2bfada5387cc2ba2b05bb0a68c2cf04260ec14c..c5a857d19f8b44a477db9f687c75bf86390e0072 100644 --- a/silk/silk_bwexpander_32.c +++ b/silk/silk_bwexpander_32.c @@ -29,13 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander_32( - SKP_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ - const SKP_int d, /* I Length of ar */ - SKP_int32 chirp_Q16 /* I Chirp factor in Q16 */ + opus_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ + const opus_int d, /* I Length of ar */ + opus_int32 chirp_Q16 /* I Chirp factor in Q16 */ ) { - SKP_int i; - SKP_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; + opus_int i; + opus_int32 chirp_minus_one_Q16 = chirp_Q16 - 65536; for( i = 0; i < d - 1; i++ ) { ar[ i ] = SKP_SMULWW( chirp_Q16, ar[ i ] ); diff --git a/silk/silk_check_control_input.c b/silk/silk_check_control_input.c index d787ebaa06a598aa368f1c426403223318153faf..6ece48b05c10d5d8b977ec66f9546529d1795060 100644 --- a/silk/silk_check_control_input.c +++ b/silk/silk_check_control_input.c @@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_errors.h" /* Check encoder control struct */ -SKP_int check_control_input( +opus_int check_control_input( silk_EncControlStruct *encControl /* I: Control structure */ ) { diff --git a/silk/silk_code_signs.c b/silk/silk_code_signs.c index 86ae69ed6c99d22813a22b034c7b9b7a65a917aa..d875778b8261365aefc34c46fc1485840c55f96d 100644 --- a/silk/silk_code_signs.c +++ b/silk/silk_code_signs.c @@ -36,17 +36,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Encodes signs of excitation */ void silk_encode_signs( ec_enc *psRangeEnc, /* I/O Compressor data structure */ - const SKP_int8 pulses[], /* I pulse signal */ - SKP_int length, /* I length of input */ - const SKP_int signalType, /* I Signal type */ - const SKP_int quantOffsetType, /* I Quantization offset type */ - const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ + const opus_int8 pulses[], /* I pulse signal */ + opus_int length, /* I length of input */ + const opus_int signalType, /* I Signal type */ + const opus_int quantOffsetType, /* I Quantization offset type */ + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ ) { - SKP_int i, j, p; - SKP_uint8 icdf[ 2 ]; - const SKP_int8 *q_ptr; - const SKP_uint8 *icdf_ptr; + opus_int i, j, p; + opus_uint8 icdf[ 2 ]; + const opus_int8 *q_ptr; + const opus_uint8 *icdf_ptr; icdf[ 1 ] = 0; q_ptr = pulses; @@ -70,17 +70,17 @@ void silk_encode_signs( /* Decodes signs of excitation */ void silk_decode_signs( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int pulses[], /* I/O pulse signal */ - SKP_int length, /* I length of input */ - const SKP_int signalType, /* I Signal type */ - const SKP_int quantOffsetType, /* I Quantization offset type */ - const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ + opus_int pulses[], /* I/O pulse signal */ + opus_int length, /* I length of input */ + const opus_int signalType, /* I Signal type */ + const opus_int quantOffsetType, /* I Quantization offset type */ + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ ) { - SKP_int i, j, p; - SKP_uint8 icdf[ 2 ]; - SKP_int *q_ptr; - const SKP_uint8 *icdf_ptr; + opus_int i, j, p; + opus_uint8 icdf[ 2 ]; + opus_int *q_ptr; + const opus_uint8 *icdf_ptr; icdf[ 1 ] = 0; q_ptr = pulses; diff --git a/silk/silk_control.h b/silk/silk_control.h index f85c5dea53602bf61e9056110edbd9d0db837fd4..6e6b8c995dc0bd2431a12d7dd85b7a9208267be3 100644 --- a/silk/silk_control.h +++ b/silk/silk_control.h @@ -45,58 +45,58 @@ extern "C" /***********************************************/ typedef struct { /* I: Number of channels; 1/2 */ - SKP_int32 nChannelsAPI; + opus_int32 nChannelsAPI; /* I: Number of channels; 1/2 */ - SKP_int32 nChannelsInternal; + opus_int32 nChannelsInternal; /* I: Input signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */ - SKP_int32 API_sampleRate; + opus_int32 API_sampleRate; /* I: Maximum internal sampling rate in Hertz; 8000/12000/16000 */ - SKP_int32 maxInternalSampleRate; + opus_int32 maxInternalSampleRate; /* I: Minimum internal sampling rate in Hertz; 8000/12000/16000 */ - SKP_int32 minInternalSampleRate; + opus_int32 minInternalSampleRate; /* I: Soft request for internal sampling rate in Hertz; 8000/12000/16000 */ - SKP_int32 desiredInternalSampleRate; + opus_int32 desiredInternalSampleRate; /* I: Number of samples per packet in milliseconds; 10/20/40/60 */ - SKP_int payloadSize_ms; + opus_int payloadSize_ms; /* I: Bitrate during active speech in bits/second; internally limited */ - SKP_int32 bitRate; + opus_int32 bitRate; /* I: Uplink packet loss in percent (0-100) */ - SKP_int packetLossPercentage; + opus_int packetLossPercentage; /* I: Complexity mode; 0 is lowest, 10 is highest complexity */ - SKP_int complexity; + opus_int complexity; /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */ - SKP_int useInBandFEC; + opus_int useInBandFEC; /* I: Flag to enable discontinuous transmission (DTX); 0/1 */ - SKP_int useDTX; + opus_int useDTX; /* I: Flag to use constant bitrate */ - SKP_int useCBR; + opus_int useCBR; /* I: Cutoff frequency of input HP filter (of zero: adaptive) */ - SKP_int HP_cutoff_Hz; + opus_int HP_cutoff_Hz; /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */ - SKP_int32 internalSampleRate; + opus_int32 internalSampleRate; /* O: Flag that bandwidth switching is allowed (because low voice activity) */ - SKP_int allowBandwidthSwitch; + opus_int allowBandwidthSwitch; /* O: Flag that SILK runs in WB mode without variable LP filter (use for switching between WB/SWB/FB) */ - SKP_int inWBmodeWithoutVariableLP; + opus_int inWBmodeWithoutVariableLP; /* O: Stereo width */ - SKP_int stereoWidth_Q14; + opus_int stereoWidth_Q14; } silk_EncControlStruct; /**************************************************************************/ @@ -104,19 +104,19 @@ typedef struct { /**************************************************************************/ typedef struct { /* I: Number of channels; 1/2 */ - SKP_int32 nChannelsAPI; + opus_int32 nChannelsAPI; /* I: Number of channels; 1/2 */ - SKP_int32 nChannelsInternal; + opus_int32 nChannelsInternal; /* I: Output signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */ - SKP_int32 API_sampleRate; + opus_int32 API_sampleRate; /* I: Internal sampling rate used, in Hertz; 8000/12000/16000 */ - SKP_int32 internalSampleRate; + opus_int32 internalSampleRate; /* I: Number of samples per packet in milliseconds; 10/20/40/60 */ - SKP_int payloadSize_ms; + opus_int payloadSize_ms; } silk_DecControlStruct; #ifdef __cplusplus diff --git a/silk/silk_control_SNR.c b/silk/silk_control_SNR.c index 28f0ef9983a6e0bf47edea86db40657755e902a9..686de96cb022494a7e22a60d6b0a7edf70bf4ecd 100644 --- a/silk/silk_control_SNR.c +++ b/silk/silk_control_SNR.c @@ -29,14 +29,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tuning_parameters.h" /* Control SNR of redidual quantizer */ -SKP_int silk_control_SNR( +opus_int silk_control_SNR( silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */ - SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */ + opus_int32 TargetRate_bps /* I Target max bitrate (bps) */ ) { - SKP_int k, ret = SILK_NO_ERROR; - SKP_int32 frac_Q6; - const SKP_int32 *rateTable; + opus_int k, ret = SILK_NO_ERROR; + opus_int32 frac_Q6; + const opus_int32 *rateTable; /* Set bitrate/coding quality */ TargetRate_bps = SKP_LIMIT( TargetRate_bps, MIN_TARGET_RATE_BPS, MAX_TARGET_RATE_BPS ); diff --git a/silk/silk_control_audio_bandwidth.c b/silk/silk_control_audio_bandwidth.c index 8f887dca276e0fc53c90c051ce341be694dffa93..92f965e09b94435dc9d729a3ea75510de3a35070 100644 --- a/silk/silk_control_audio_bandwidth.c +++ b/silk/silk_control_audio_bandwidth.c @@ -29,12 +29,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tuning_parameters.h" /* Control internal sampling rate */ -SKP_int silk_control_audio_bandwidth( +opus_int silk_control_audio_bandwidth( silk_encoder_state *psEncC /* I/O Pointer to Silk encoder state */ ) { - SKP_int fs_kHz; - SKP_int32 fs_Hz; + opus_int fs_kHz; + opus_int32 fs_Hz; fs_kHz = psEncC->fs_kHz; fs_Hz = SKP_SMULBB( fs_kHz, 1000 ); diff --git a/silk/silk_control_codec.c b/silk/silk_control_codec.c index e7e3023ca3e8034a61737518deed51b904aeed73..8e261d39b654dbae30a2b751aaa07e1c336703a9 100644 --- a/silk/silk_control_codec.c +++ b/silk/silk_control_codec.c @@ -37,38 +37,38 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include "silk_tuning_parameters.h" -SKP_int silk_setup_resamplers( +opus_int silk_setup_resamplers( silk_encoder_state_Fxx *psEnc, /* I/O */ - SKP_int fs_kHz /* I */ + opus_int fs_kHz /* I */ ); -SKP_int silk_setup_fs( +opus_int silk_setup_fs( silk_encoder_state_Fxx *psEnc, /* I/O */ - SKP_int fs_kHz, /* I */ - SKP_int PacketSize_ms /* I */ + opus_int fs_kHz, /* I */ + opus_int PacketSize_ms /* I */ ); -SKP_int silk_setup_complexity( +opus_int silk_setup_complexity( silk_encoder_state *psEncC, /* I/O */ - SKP_int Complexity /* I */ + opus_int Complexity /* I */ ); -SKP_INLINE SKP_int silk_setup_LBRR( +SKP_INLINE opus_int silk_setup_LBRR( silk_encoder_state *psEncC, /* I/O */ - const SKP_int32 TargetRate_bps /* I */ + const opus_int32 TargetRate_bps /* I */ ); /* Control encoder */ -SKP_int silk_control_encoder( +opus_int silk_control_encoder( silk_encoder_state_Fxx *psEnc, /* I/O Pointer to Silk encoder state */ silk_EncControlStruct *encControl, /* I: Control structure */ - const SKP_int32 TargetRate_bps, /* I Target max bitrate (bps) */ - const SKP_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ - const SKP_int channelNb /* I Channel number */ + const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */ + const opus_int allow_bw_switch, /* I Flag to allow switching audio bandwidth */ + const opus_int channelNb /* I Channel number */ ) { - SKP_int fs_kHz, ret = 0; + opus_int fs_kHz, ret = 0; psEnc->sCmn.useDTX = encControl->useDTX; psEnc->sCmn.useCBR = encControl->useCBR; @@ -127,13 +127,13 @@ SKP_int silk_control_encoder( return ret; } -SKP_int silk_setup_resamplers( +opus_int silk_setup_resamplers( silk_encoder_state_Fxx *psEnc, /* I/O */ - SKP_int fs_kHz /* I */ + opus_int fs_kHz /* I */ ) { - SKP_int ret = SILK_NO_ERROR; - SKP_int32 nSamples_temp; + opus_int ret = SILK_NO_ERROR; + opus_int32 nSamples_temp; if( psEnc->sCmn.fs_kHz != fs_kHz || psEnc->sCmn.prev_API_fs_Hz != psEnc->sCmn.API_fs_Hz ) { @@ -142,11 +142,11 @@ SKP_int silk_setup_resamplers( ret += silk_resampler_init( &psEnc->sCmn.resampler_state, psEnc->sCmn.API_fs_Hz, fs_kHz * 1000 ); } else { /* Allocate worst case space for temporary upsampling, 8 to 48 kHz, so a factor 6 */ - SKP_int16 x_buf_API_fs_Hz[ ( 2 * MAX_FRAME_LENGTH_MS + LA_SHAPE_MS ) * MAX_API_FS_KHZ ]; + opus_int16 x_buf_API_fs_Hz[ ( 2 * MAX_FRAME_LENGTH_MS + LA_SHAPE_MS ) * MAX_API_FS_KHZ ]; #ifdef FIXED_POINT - SKP_int16 *x_bufFIX = psEnc->x_buf; + opus_int16 *x_bufFIX = psEnc->x_buf; #else - SKP_int16 x_bufFIX[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ]; + opus_int16 x_bufFIX[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ]; #endif nSamples_temp = SKP_LSHIFT( psEnc->sCmn.frame_length, 1 ) + LA_SHAPE_MS * psEnc->sCmn.fs_kHz; @@ -174,7 +174,7 @@ SKP_int silk_setup_resamplers( } else { /* Copy data */ - SKP_memcpy( x_buf_API_fs_Hz, x_bufFIX, nSamples_temp * sizeof( SKP_int16 ) ); + SKP_memcpy( x_buf_API_fs_Hz, x_bufFIX, nSamples_temp * sizeof( opus_int16 ) ); } if( 1000 * fs_kHz != psEnc->sCmn.API_fs_Hz ) { @@ -192,13 +192,13 @@ SKP_int silk_setup_resamplers( return ret; } -SKP_int silk_setup_fs( +opus_int silk_setup_fs( silk_encoder_state_Fxx *psEnc, /* I/O */ - SKP_int fs_kHz, /* I */ - SKP_int PacketSize_ms /* I */ + opus_int fs_kHz, /* I */ + opus_int PacketSize_ms /* I */ ) { - SKP_int ret = SILK_NO_ERROR; + opus_int ret = SILK_NO_ERROR; /* Set packet size */ if( PacketSize_ms != psEnc->sCmn.PacketSize_ms ) { @@ -309,12 +309,12 @@ SKP_int silk_setup_fs( return ret; } -SKP_int silk_setup_complexity( +opus_int silk_setup_complexity( silk_encoder_state *psEncC, /* I/O */ - SKP_int Complexity /* I */ + opus_int Complexity /* I */ ) { - SKP_int ret = 0; + opus_int ret = 0; /* Set encoding complexity */ SKP_assert( Complexity >= 0 && Complexity <= 10 ); @@ -391,13 +391,13 @@ SKP_int silk_setup_complexity( return ret; } -SKP_INLINE SKP_int silk_setup_LBRR( +SKP_INLINE opus_int silk_setup_LBRR( silk_encoder_state *psEncC, /* I/O */ - const SKP_int32 TargetRate_bps /* I */ + const opus_int32 TargetRate_bps /* I */ ) { - SKP_int ret = SILK_NO_ERROR; - SKP_int32 LBRR_rate_thres_bps; + opus_int ret = SILK_NO_ERROR; + opus_int32 LBRR_rate_thres_bps; psEncC->LBRR_enabled = 0; if( psEncC->useInBandFEC && psEncC->PacketLoss_perc > 0 ) { diff --git a/silk/silk_create_init_destroy.c b/silk/silk_create_init_destroy.c index 10500bb1ef93f32d058d178a176ad4d657efa398..524dafd182fa8fb0288cb96906e6bd7ed8443d8b 100644 --- a/silk/silk_create_init_destroy.c +++ b/silk/silk_create_init_destroy.c @@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /************************/ /* Init Decoder State */ /************************/ -SKP_int silk_init_decoder( +opus_int silk_init_decoder( silk_decoder_state *psDec /* I/O Decoder state pointer */ ) { diff --git a/silk/silk_debug.c b/silk/silk_debug.c index d948960bad69bd49a06eab7aed064815df7b1d65..ff5399e40ed5b202f77cc12a7f0a29584cc84729 100644 --- a/silk/silk_debug.c +++ b/silk/silk_debug.c @@ -67,10 +67,10 @@ LARGE_INTEGER silk_Timer_start[SKP_NUM_TIMERS_MAX]; unsigned long silk_Timer_start[SKP_NUM_TIMERS_MAX]; #endif unsigned int silk_Timer_cnt[SKP_NUM_TIMERS_MAX]; -SKP_int64 silk_Timer_min[SKP_NUM_TIMERS_MAX]; -SKP_int64 silk_Timer_sum[SKP_NUM_TIMERS_MAX]; -SKP_int64 silk_Timer_max[SKP_NUM_TIMERS_MAX]; -SKP_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; +opus_int64 silk_Timer_min[SKP_NUM_TIMERS_MAX]; +opus_int64 silk_Timer_sum[SKP_NUM_TIMERS_MAX]; +opus_int64 silk_Timer_max[SKP_NUM_TIMERS_MAX]; +opus_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; #ifdef WIN32 void silk_TimerSave(char *file_name) diff --git a/silk/silk_debug.h b/silk/silk_debug.h index 1aad9f767a99f5005a60bd20f82f049254af67a9..c25ec973f303aec6cd4f517f70d5ea39b87cb42d 100644 --- a/silk/silk_debug.h +++ b/silk/silk_debug.h @@ -104,10 +104,10 @@ extern LARGE_INTEGER silk_Timer_start[SKP_NUM_TIMERS_MAX]; extern unsigned long silk_Timer_start[SKP_NUM_TIMERS_MAX]; #endif extern unsigned int silk_Timer_cnt[SKP_NUM_TIMERS_MAX]; -extern SKP_int64 silk_Timer_sum[SKP_NUM_TIMERS_MAX]; -extern SKP_int64 silk_Timer_max[SKP_NUM_TIMERS_MAX]; -extern SKP_int64 silk_Timer_min[SKP_NUM_TIMERS_MAX]; -extern SKP_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; +extern opus_int64 silk_Timer_sum[SKP_NUM_TIMERS_MAX]; +extern opus_int64 silk_Timer_max[SKP_NUM_TIMERS_MAX]; +extern opus_int64 silk_Timer_min[SKP_NUM_TIMERS_MAX]; +extern opus_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; /* WARNING: TIC()/TOC can measure only up to 0.1 seconds at a time */ #ifdef _WIN32 @@ -246,7 +246,7 @@ extern SKP_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; /* opens an empty file if this file has not yet been open, then writes to the file and closes it */ /* if file has been open previously it is opened again and the fwrite is appending, finally it is closed */ #define SAVE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) { \ - static SKP_int32 init = 0; \ + static opus_int32 init = 0; \ FILE *fp; \ if (init == 0) { \ init = 1; \ @@ -258,7 +258,7 @@ extern SKP_int64 silk_Timer_depth[SKP_NUM_TIMERS_MAX]; fclose(fp); \ } -/* Example: DEBUG_STORE_DATA(testfile.pcm, &RIN[0], 160*sizeof(SKP_int16)); */ +/* Example: DEBUG_STORE_DATA(testfile.pcm, &RIN[0], 160*sizeof(opus_int16)); */ #if 0 /* Ensure that everything is written to files when an assert breaks */ @@ -273,7 +273,7 @@ extern int silk_debug_store_count; /* Faster way of storing the data */ #define DEBUG_STORE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) { \ - static SKP_int init = 0, cnt = 0; \ + static opus_int init = 0, cnt = 0; \ static FILE **fp; \ if (init == 0) { \ init = 1; \ @@ -285,7 +285,7 @@ extern int silk_debug_store_count; /* Call this at the end of main() */ #define SILK_DEBUG_STORE_CLOSE_FILES { \ - SKP_int i; \ + opus_int i; \ for( i = 0; i < silk_debug_store_count; i++ ) { \ fclose( silk_debug_store_fp[ i ] ); \ } \ @@ -293,7 +293,7 @@ extern int silk_debug_store_count; #endif /* micro sec */ -#define SKP_GETTIME(void) time = (SKP_int64) silk_GetHighResolutionTime(); +#define SKP_GETTIME(void) time = (opus_int64) silk_GetHighResolutionTime(); #else /* SILK_DEBUG */ diff --git a/silk/silk_dec_API.c b/silk/silk_dec_API.c index eb456f3e49f1241aab6fa87531a3a64c43bad446..212b494bd06056d0bcc81769247f22443074292d 100644 --- a/silk/silk_dec_API.c +++ b/silk/silk_dec_API.c @@ -37,17 +37,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. typedef struct { silk_decoder_state channel_state[ DECODER_NUM_CHANNELS ]; stereo_dec_state sStereo; - SKP_int nChannelsAPI; - SKP_int nChannelsInternal; + opus_int nChannelsAPI; + opus_int nChannelsInternal; } silk_decoder; /*********************/ /* Decoder functions */ /*********************/ -SKP_int silk_Get_Decoder_Size( SKP_int32 *decSizeBytes ) +opus_int silk_Get_Decoder_Size( opus_int32 *decSizeBytes ) { - SKP_int ret = SILK_NO_ERROR; + opus_int ret = SILK_NO_ERROR; *decSizeBytes = sizeof( silk_decoder ); @@ -55,11 +55,11 @@ SKP_int silk_Get_Decoder_Size( SKP_int32 *decSizeBytes ) } /* Reset decoder state */ -SKP_int silk_InitDecoder( +opus_int silk_InitDecoder( void* decState /* I/O: State */ ) { - SKP_int n, ret = SILK_NO_ERROR; + opus_int n, ret = SILK_NO_ERROR; silk_decoder_state *channel_state = ((silk_decoder *)decState)->channel_state; for( n = 0; n < DECODER_NUM_CHANNELS; n++ ) { @@ -70,22 +70,22 @@ SKP_int silk_InitDecoder( } /* Decode a frame */ -SKP_int silk_Decode( +opus_int silk_Decode( void* decState, /* I/O: State */ silk_DecControlStruct* decControl, /* I/O: Control Structure */ - SKP_int lostFlag, /* I: 0: no loss, 1 loss, 2 decode FEC */ - SKP_int newPacketFlag, /* I: Indicates first decoder call for this packet */ + opus_int lostFlag, /* I: 0: no loss, 1 loss, 2 decode FEC */ + opus_int newPacketFlag, /* I: Indicates first decoder call for this packet */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int16 *samplesOut, /* O: Decoded output speech vector */ - SKP_int32 *nSamplesOut /* O: Number of samples decoded */ + opus_int16 *samplesOut, /* O: Decoded output speech vector */ + opus_int32 *nSamplesOut /* O: Number of samples decoded */ ) { - SKP_int i, n, prev_fs_kHz, decode_only_middle = 0, ret = SILK_NO_ERROR; - SKP_int32 nSamplesOutDec, LBRR_symbol; - SKP_int16 samplesOut1_tmp[ 2 ][ MAX_FS_KHZ * MAX_FRAME_LENGTH_MS + 2 ]; - SKP_int16 samplesOut2_tmp[ MAX_API_FS_KHZ * MAX_FRAME_LENGTH_MS ]; - SKP_int MS_pred_Q13[ 2 ] = { 0 }; - SKP_int16 *resample_out_ptr; + opus_int i, n, prev_fs_kHz, decode_only_middle = 0, ret = SILK_NO_ERROR; + opus_int32 nSamplesOutDec, LBRR_symbol; + opus_int16 samplesOut1_tmp[ 2 ][ MAX_FS_KHZ * MAX_FRAME_LENGTH_MS + 2 ]; + opus_int16 samplesOut2_tmp[ MAX_API_FS_KHZ * MAX_FRAME_LENGTH_MS ]; + opus_int MS_pred_Q13[ 2 ] = { 0 }; + opus_int16 *resample_out_ptr; silk_decoder *psDec = ( silk_decoder * )decState; silk_decoder_state *channel_state = psDec->channel_state; @@ -111,7 +111,7 @@ SKP_int silk_Decode( for( n = 0; n < decControl->nChannelsInternal; n++ ) { if( channel_state[ n ].nFramesDecoded == 0 ) { - SKP_int fs_kHz_dec; + opus_int fs_kHz_dec; if( decControl->payloadSize_ms == 0 ) { /* Assuming packet loss, use 10 ms */ channel_state[ n ].nFramesPerPacket = 1; @@ -190,7 +190,7 @@ SKP_int silk_Decode( for( i = 0; i < channel_state[ 0 ].nFramesPerPacket; i++ ) { for( n = 0; n < decControl->nChannelsInternal; n++ ) { if( channel_state[ n ].LBRR_flags[ i ] ) { - SKP_int pulses[ MAX_FRAME_LENGTH ]; + opus_int pulses[ MAX_FRAME_LENGTH ]; if( decControl->nChannelsInternal == 2 && n == 0 ) { silk_stereo_decode_pred( psRangeDec, &decode_only_middle, MS_pred_Q13 ); } @@ -219,7 +219,7 @@ SKP_int silk_Decode( if( n == 0 || decode_only_middle == 0 ) { ret += silk_decode_frame( &channel_state[ n ], psRangeDec, &samplesOut1_tmp[ n ][ 2 ], &nSamplesOutDec, lostFlag ); } else { - SKP_memset( &samplesOut1_tmp[ n ][ 2 ], 0, nSamplesOutDec * sizeof( SKP_int16 ) ); + SKP_memset( &samplesOut1_tmp[ n ][ 2 ], 0, nSamplesOutDec * sizeof( opus_int16 ) ); } } @@ -228,8 +228,8 @@ SKP_int silk_Decode( silk_stereo_MS_to_LR( &psDec->sStereo, samplesOut1_tmp[ 0 ], samplesOut1_tmp[ 1 ], MS_pred_Q13, channel_state[ 0 ].fs_kHz, nSamplesOutDec ); } else { /* Buffering */ - SKP_memcpy( samplesOut1_tmp[ 0 ], psDec->sStereo.sMid, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( psDec->sStereo.sMid, &samplesOut1_tmp[ 0 ][ nSamplesOutDec ], 2 * sizeof( SKP_int16 ) ); + SKP_memcpy( samplesOut1_tmp[ 0 ], psDec->sStereo.sMid, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( psDec->sStereo.sMid, &samplesOut1_tmp[ 0 ][ nSamplesOutDec ], 2 * sizeof( opus_int16 ) ); } /* Number of output samples */ @@ -265,14 +265,14 @@ SKP_int silk_Decode( } /* Getting table of contents for a packet */ -SKP_int silk_get_TOC( - const SKP_uint8 *payload, /* I Payload data */ - const SKP_int nBytesIn, /* I: Number of input bytes */ - const SKP_int nFramesPerPayload, /* I: Number of SILK frames per payload */ +opus_int silk_get_TOC( + const opus_uint8 *payload, /* I Payload data */ + const opus_int nBytesIn, /* I: Number of input bytes */ + const opus_int nFramesPerPayload, /* I: Number of SILK frames per payload */ silk_TOC_struct *Silk_TOC /* O: Type of content */ ) { - SKP_int i, flags, ret = SILK_NO_ERROR; + opus_int i, flags, ret = SILK_NO_ERROR; if( nBytesIn < 1 ) { return -1; diff --git a/silk/silk_decode_core.c b/silk/silk_decode_core.c index f2607480b4394a05720c851fb440f34870388ba0..e1b7dbd0cd1d2988f186472671a00cd256c2f312 100644 --- a/silk/silk_decode_core.c +++ b/silk/silk_decode_core.c @@ -33,17 +33,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_decode_core( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I Decoder control */ - SKP_int16 xq[], /* O Decoded speech */ - const SKP_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ + opus_int16 xq[], /* O Decoded speech */ + const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ ) { - SKP_int i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType; - SKP_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; - SKP_int16 sLTP[ MAX_FRAME_LENGTH ]; - SKP_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q16, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10; - SKP_int32 *pred_lag_ptr, *pexc_Q10, *pres_Q10; - SKP_int32 res_Q10[ MAX_SUB_FRAME_LENGTH ]; - SKP_int32 vec_Q10[ MAX_SUB_FRAME_LENGTH ]; + opus_int i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType; + opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ]; + opus_int16 sLTP[ MAX_FRAME_LENGTH ]; + opus_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q16, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10; + opus_int32 *pred_lag_ptr, *pexc_Q10, *pres_Q10; + opus_int32 res_Q10[ MAX_SUB_FRAME_LENGTH ]; + opus_int32 vec_Q10[ MAX_SUB_FRAME_LENGTH ]; SKP_assert( psDec->prev_inv_gain_Q16 != 0 ); @@ -59,7 +59,7 @@ void silk_decode_core( rand_seed = psDec->indices.Seed; for( i = 0; i < psDec->frame_length; i++ ) { rand_seed = SKP_RAND( rand_seed ); - psDec->exc_Q10[ i ] = SKP_LSHIFT( ( SKP_int32 )pulses[ i ], 10 ); + psDec->exc_Q10[ i ] = SKP_LSHIFT( ( opus_int32 )pulses[ i ], 10 ); if( psDec->exc_Q10[ i ] > 0 ) { psDec->exc_Q10[ i ] -= QUANT_LEVEL_ADJUST_Q10; } else @@ -73,7 +73,7 @@ void silk_decode_core( } #ifdef SAVE_ALL_INTERNAL_DATA - DEBUG_STORE_DATA( dec_q.dat, pulses, psDec->frame_length * sizeof( SKP_int ) ); + DEBUG_STORE_DATA( dec_q.dat, pulses, psDec->frame_length * sizeof( opus_int ) ); #endif pexc_Q10 = psDec->exc_Q10; @@ -85,7 +85,7 @@ void silk_decode_core( A_Q12 = psDecCtrl->PredCoef_Q12[ k >> 1 ]; /* Preload LPC coeficients to array on stack. Gives small performance gain */ - SKP_memcpy( A_Q12_tmp, A_Q12, psDec->LPC_order * sizeof( SKP_int16 ) ); + SKP_memcpy( A_Q12_tmp, A_Q12, psDec->LPC_order * sizeof( opus_int16 ) ); B_Q14 = &psDecCtrl->LTPCoef_Q14[ k * LTP_ORDER ]; Gain_Q16 = psDecCtrl->Gains_Q16[ k ]; signalType = psDec->indices.signalType; @@ -112,7 +112,7 @@ void silk_decode_core( if( psDec->lossCnt && psDec->prevSignalType == TYPE_VOICED && psDec->indices.signalType != TYPE_VOICED && k < MAX_NB_SUBFR/2 ) { - SKP_memset( B_Q14, 0, LTP_ORDER * sizeof( SKP_int16 ) ); + SKP_memset( B_Q14, 0, LTP_ORDER * sizeof( opus_int16 ) ); B_Q14[ LTP_ORDER/2 ] = SILK_FIX_CONST( 0.25, 14 ); signalType = TYPE_VOICED; @@ -176,8 +176,8 @@ void silk_decode_core( } #ifdef SAVE_ALL_INTERNAL_DATA - DEBUG_STORE_DATA( dec_exc_Q10.dat, pexc_Q10, psDec->subfr_length * sizeof( SKP_int32 ) ); - DEBUG_STORE_DATA( dec_res_Q10.dat, pres_Q10, psDec->subfr_length * sizeof( SKP_int32 ) ); + DEBUG_STORE_DATA( dec_exc_Q10.dat, pexc_Q10, psDec->subfr_length * sizeof( opus_int32 ) ); + DEBUG_STORE_DATA( dec_res_Q10.dat, pres_Q10, psDec->subfr_length * sizeof( opus_int32 ) ); #endif for( i = 0; i < psDec->subfr_length; i++ ) { @@ -205,20 +205,20 @@ void silk_decode_core( /* Scale with Gain */ for( i = 0; i < psDec->subfr_length; i++ ) { - pxq[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( vec_Q10[ i ], Gain_Q16 ), 10 ) ); + pxq[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( vec_Q10[ i ], Gain_Q16 ), 10 ) ); } /* Update LPC filter state */ - SKP_memcpy( psDec->sLPC_Q14, &psDec->sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( SKP_int32 ) ); + SKP_memcpy( psDec->sLPC_Q14, &psDec->sLPC_Q14[ psDec->subfr_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); pexc_Q10 += psDec->subfr_length; pxq += psDec->subfr_length; } /* Copy to output */ - SKP_memcpy( xq, &psDec->outBuf[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( SKP_int16 ) ); + SKP_memcpy( xq, &psDec->outBuf[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( opus_int16 ) ); #ifdef SAVE_ALL_INTERNAL_DATA - DEBUG_STORE_DATA( dec_sLTP_Q16.dat, &psDec->sLTP_Q16[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( SKP_int32 )); - DEBUG_STORE_DATA( dec_xq.dat, xq, psDec->frame_length * sizeof( SKP_int16 ) ); + DEBUG_STORE_DATA( dec_sLTP_Q16.dat, &psDec->sLTP_Q16[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( opus_int32 )); + DEBUG_STORE_DATA( dec_xq.dat, xq, psDec->frame_length * sizeof( opus_int16 ) ); #endif } diff --git a/silk/silk_decode_frame.c b/silk/silk_decode_frame.c index 3d508db9459322e4fa54ce499da61c7ae223ebea..731bc83cb07eb18bd487db23924cb88b2453a197 100644 --- a/silk/silk_decode_frame.c +++ b/silk/silk_decode_frame.c @@ -31,17 +31,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /****************/ /* Decode frame */ /****************/ -SKP_int silk_decode_frame( +opus_int silk_decode_frame( silk_decoder_state *psDec, /* I/O Pointer to Silk decoder state */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int16 pOut[], /* O Pointer to output speech frame */ - SKP_int32 *pN, /* O Pointer to size of output frame */ - SKP_int lostFlag /* I 0: no loss, 1 loss, 2 decode fec */ + opus_int16 pOut[], /* O Pointer to output speech frame */ + opus_int32 *pN, /* O Pointer to size of output frame */ + opus_int lostFlag /* I 0: no loss, 1 loss, 2 decode fec */ ) { silk_decoder_control sDecCtrl; - SKP_int L, mv_len, ret = 0; - SKP_int pulses[ MAX_FRAME_LENGTH ]; + opus_int L, mv_len, ret = 0; + opus_int pulses[ MAX_FRAME_LENGTH ]; TIC(DECODE_FRAME) @@ -107,8 +107,8 @@ TOC(decode_core) /*************************/ SKP_assert( psDec->ltp_mem_length >= psDec->frame_length ); mv_len = psDec->ltp_mem_length - psDec->frame_length; - SKP_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(SKP_int16) ); - SKP_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( SKP_int16 ) ); + SKP_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(opus_int16) ); + SKP_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( opus_int16 ) ); /****************************************************************/ /* Ensure smooth connection of extrapolated and good frames */ diff --git a/silk/silk_decode_indices.c b/silk/silk_decode_indices.c index 0eebdbd3c53b1042d8741895f601e91ebbed4379..c30a041e5e926aa937892034414d6534e6f7fb50 100644 --- a/silk/silk_decode_indices.c +++ b/silk/silk_decode_indices.c @@ -31,14 +31,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_decode_indices( silk_decoder_state *psDec, /* I/O State */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int FrameIndex, /* I Frame number */ - SKP_int decode_LBRR /* I Flag indicating LBRR data is being decoded */ + opus_int FrameIndex, /* I Frame number */ + opus_int decode_LBRR /* I Flag indicating LBRR data is being decoded */ ) { - SKP_int i, k, Ix, condCoding; - SKP_int decode_absolute_lagIndex, delta_lagIndex; - SKP_int16 ec_ix[ MAX_LPC_ORDER ]; - SKP_uint8 pred_Q8[ MAX_LPC_ORDER ]; + opus_int i, k, Ix, condCoding; + opus_int decode_absolute_lagIndex, delta_lagIndex; + opus_int16 ec_ix[ MAX_LPC_ORDER ]; + opus_uint8 pred_Q8[ MAX_LPC_ORDER ]; /* Use conditional coding if previous frame available */ if( FrameIndex > 0 && ( decode_LBRR == 0 || psDec->LBRR_flags[ FrameIndex - 1 ] == 1 ) ) { @@ -55,8 +55,8 @@ void silk_decode_indices( } else { Ix = ec_dec_icdf( psRangeDec, silk_type_offset_no_VAD_iCDF, 8 ); } - psDec->indices.signalType = (SKP_int8)SKP_RSHIFT( Ix, 1 ); - psDec->indices.quantOffsetType = (SKP_int8)( Ix & 1 ); + psDec->indices.signalType = (opus_int8)SKP_RSHIFT( Ix, 1 ); + psDec->indices.quantOffsetType = (opus_int8)( Ix & 1 ); /****************/ /* Decode gains */ @@ -64,22 +64,22 @@ void silk_decode_indices( /* First subframe */ if( condCoding ) { /* Conditional coding */ - psDec->indices.GainsIndices[ 0 ] = (SKP_int8)ec_dec_icdf( psRangeDec, silk_delta_gain_iCDF, 8 ); + psDec->indices.GainsIndices[ 0 ] = (opus_int8)ec_dec_icdf( psRangeDec, silk_delta_gain_iCDF, 8 ); } else { /* Independent coding, in two stages: MSB bits followed by 3 LSBs */ - psDec->indices.GainsIndices[ 0 ] = (SKP_int8)SKP_LSHIFT( ec_dec_icdf( psRangeDec, silk_gain_iCDF[ psDec->indices.signalType ], 8 ), 3 ); - psDec->indices.GainsIndices[ 0 ] += (SKP_int8)ec_dec_icdf( psRangeDec, silk_uniform8_iCDF, 8 ); + psDec->indices.GainsIndices[ 0 ] = (opus_int8)SKP_LSHIFT( ec_dec_icdf( psRangeDec, silk_gain_iCDF[ psDec->indices.signalType ], 8 ), 3 ); + psDec->indices.GainsIndices[ 0 ] += (opus_int8)ec_dec_icdf( psRangeDec, silk_uniform8_iCDF, 8 ); } /* Remaining subframes */ for( i = 1; i < psDec->nb_subfr; i++ ) { - psDec->indices.GainsIndices[ i ] = (SKP_int8)ec_dec_icdf( psRangeDec, silk_delta_gain_iCDF, 8 ); + psDec->indices.GainsIndices[ i ] = (opus_int8)ec_dec_icdf( psRangeDec, silk_delta_gain_iCDF, 8 ); } /**********************/ /* Decode LSF Indices */ /**********************/ - psDec->indices.NLSFIndices[ 0 ] = (SKP_int8)ec_dec_icdf( psRangeDec, &psDec->psNLSF_CB->CB1_iCDF[ ( psDec->indices.signalType >> 1 ) * psDec->psNLSF_CB->nVectors ], 8 ); + psDec->indices.NLSFIndices[ 0 ] = (opus_int8)ec_dec_icdf( psRangeDec, &psDec->psNLSF_CB->CB1_iCDF[ ( psDec->indices.signalType >> 1 ) * psDec->psNLSF_CB->nVectors ], 8 ); silk_NLSF_unpack( ec_ix, pred_Q8, psDec->psNLSF_CB, psDec->indices.NLSFIndices[ 0 ] ); SKP_assert( psDec->psNLSF_CB->order == psDec->LPC_order ); for( i = 0; i < psDec->psNLSF_CB->order; i++ ) { @@ -89,12 +89,12 @@ void silk_decode_indices( } else if( Ix == 2 * NLSF_QUANT_MAX_AMPLITUDE ) { Ix += ec_dec_icdf( psRangeDec, silk_NLSF_EXT_iCDF, 8 ); } - psDec->indices.NLSFIndices[ i+1 ] = (SKP_int8)( Ix - NLSF_QUANT_MAX_AMPLITUDE ); + psDec->indices.NLSFIndices[ i+1 ] = (opus_int8)( Ix - NLSF_QUANT_MAX_AMPLITUDE ); } /* Decode LSF interpolation factor */ if( psDec->nb_subfr == MAX_NB_SUBFR ) { - psDec->indices.NLSFInterpCoef_Q2 = (SKP_int8)ec_dec_icdf( psRangeDec, silk_NLSF_interpolation_factor_iCDF, 8 ); + psDec->indices.NLSFInterpCoef_Q2 = (opus_int8)ec_dec_icdf( psRangeDec, silk_NLSF_interpolation_factor_iCDF, 8 ); } else { psDec->indices.NLSFInterpCoef_Q2 = 4; } @@ -108,38 +108,38 @@ void silk_decode_indices( decode_absolute_lagIndex = 1; if( condCoding && psDec->ec_prevSignalType == TYPE_VOICED ) { /* Decode Delta index */ - delta_lagIndex = (SKP_int16)ec_dec_icdf( psRangeDec, silk_pitch_delta_iCDF, 8 ); + delta_lagIndex = (opus_int16)ec_dec_icdf( psRangeDec, silk_pitch_delta_iCDF, 8 ); if( delta_lagIndex > 0 ) { delta_lagIndex = delta_lagIndex - 9; - psDec->indices.lagIndex = (SKP_int16)( psDec->ec_prevLagIndex + delta_lagIndex ); + psDec->indices.lagIndex = (opus_int16)( psDec->ec_prevLagIndex + delta_lagIndex ); decode_absolute_lagIndex = 0; } } if( decode_absolute_lagIndex ) { /* Absolute decoding */ - psDec->indices.lagIndex = (SKP_int16)ec_dec_icdf( psRangeDec, silk_pitch_lag_iCDF, 8 ) * SKP_RSHIFT( psDec->fs_kHz, 1 ); - psDec->indices.lagIndex += (SKP_int16)ec_dec_icdf( psRangeDec, psDec->pitch_lag_low_bits_iCDF, 8 ); + psDec->indices.lagIndex = (opus_int16)ec_dec_icdf( psRangeDec, silk_pitch_lag_iCDF, 8 ) * SKP_RSHIFT( psDec->fs_kHz, 1 ); + psDec->indices.lagIndex += (opus_int16)ec_dec_icdf( psRangeDec, psDec->pitch_lag_low_bits_iCDF, 8 ); } psDec->ec_prevLagIndex = psDec->indices.lagIndex; /* Get countour index */ - psDec->indices.contourIndex = (SKP_int8)ec_dec_icdf( psRangeDec, psDec->pitch_contour_iCDF, 8 ); + psDec->indices.contourIndex = (opus_int8)ec_dec_icdf( psRangeDec, psDec->pitch_contour_iCDF, 8 ); /********************/ /* Decode LTP gains */ /********************/ /* Decode PERIndex value */ - psDec->indices.PERIndex = (SKP_int8)ec_dec_icdf( psRangeDec, silk_LTP_per_index_iCDF, 8 ); + psDec->indices.PERIndex = (opus_int8)ec_dec_icdf( psRangeDec, silk_LTP_per_index_iCDF, 8 ); for( k = 0; k < psDec->nb_subfr; k++ ) { - psDec->indices.LTPIndex[ k ] = (SKP_int8)ec_dec_icdf( psRangeDec, silk_LTP_gain_iCDF_ptrs[ psDec->indices.PERIndex ], 8 ); + psDec->indices.LTPIndex[ k ] = (opus_int8)ec_dec_icdf( psRangeDec, silk_LTP_gain_iCDF_ptrs[ psDec->indices.PERIndex ], 8 ); } /**********************/ /* Decode LTP scaling */ /**********************/ if( !condCoding ) { - psDec->indices.LTP_scaleIndex = (SKP_int8)ec_dec_icdf( psRangeDec, silk_LTPscale_iCDF, 8 ); + psDec->indices.LTP_scaleIndex = (opus_int8)ec_dec_icdf( psRangeDec, silk_LTPscale_iCDF, 8 ); } else { psDec->indices.LTP_scaleIndex = 0; } @@ -149,5 +149,5 @@ void silk_decode_indices( /***************/ /* Decode seed */ /***************/ - psDec->indices.Seed = (SKP_int8)ec_dec_icdf( psRangeDec, silk_uniform4_iCDF, 8 ); + psDec->indices.Seed = (opus_int8)ec_dec_icdf( psRangeDec, silk_uniform4_iCDF, 8 ); } diff --git a/silk/silk_decode_parameters.c b/silk/silk_decode_parameters.c index fc8c809dbc48e67cbbd85f64879d672a5e5c597e..d5977840877dd73949312a3a775c04bf25266589 100644 --- a/silk/silk_decode_parameters.c +++ b/silk/silk_decode_parameters.c @@ -33,9 +33,9 @@ void silk_decode_parameters( silk_decoder_control *psDecCtrl /* I/O Decoder control */ ) { - SKP_int i, k, Ix; - SKP_int16 pNLSF_Q15[ MAX_LPC_ORDER ], pNLSF0_Q15[ MAX_LPC_ORDER ]; - const SKP_int8 *cbk_ptr_Q7; + opus_int i, k, Ix; + opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ], pNLSF0_Q15[ MAX_LPC_ORDER ]; + const opus_int8 *cbk_ptr_Q7; /* Dequant Gains */ silk_gains_dequant( psDecCtrl->Gains_Q16, psDec->indices.GainsIndices, @@ -68,10 +68,10 @@ void silk_decode_parameters( } else { /* Copy LPC coefficients for first half from second half */ SKP_memcpy( psDecCtrl->PredCoef_Q12[ 0 ], psDecCtrl->PredCoef_Q12[ 1 ], - psDec->LPC_order * sizeof( SKP_int16 ) ); + psDec->LPC_order * sizeof( opus_int16 ) ); } - SKP_memcpy( psDec->prevNLSF_Q15, pNLSF_Q15, psDec->LPC_order * sizeof( SKP_int16 ) ); + SKP_memcpy( psDec->prevNLSF_Q15, pNLSF_Q15, psDec->LPC_order * sizeof( opus_int16 ) ); /* After a packet loss do BWE of LPC coefs */ if( psDec->lossCnt ) { @@ -103,8 +103,8 @@ void silk_decode_parameters( Ix = psDec->indices.LTP_scaleIndex; psDecCtrl->LTP_scale_Q14 = silk_LTPScales_table_Q14[ Ix ]; } else { - SKP_memset( psDecCtrl->pitchL, 0, psDec->nb_subfr * sizeof( SKP_int ) ); - SKP_memset( psDecCtrl->LTPCoef_Q14, 0, LTP_ORDER * psDec->nb_subfr * sizeof( SKP_int16 ) ); + SKP_memset( psDecCtrl->pitchL, 0, psDec->nb_subfr * sizeof( opus_int ) ); + SKP_memset( psDecCtrl->LTPCoef_Q14, 0, LTP_ORDER * psDec->nb_subfr * sizeof( opus_int16 ) ); psDec->indices.PERIndex = 0; psDecCtrl->LTP_scale_Q14 = 0; } diff --git a/silk/silk_decode_pitch.c b/silk/silk_decode_pitch.c index 62dc2c506d9acc8f6254f4123a6cee1b16b16b15..32d05cc796598fcabcd41078a34bd3a1433fdb4c 100644 --- a/silk/silk_decode_pitch.c +++ b/silk/silk_decode_pitch.c @@ -32,15 +32,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_pitch_est_defines.h" void silk_decode_pitch( - SKP_int16 lagIndex, /* I */ - SKP_int8 contourIndex, /* O */ - SKP_int pitch_lags[], /* O pitch values */ - const SKP_int Fs_kHz, /* I sampling frequency (kHz) */ - const SKP_int nb_subfr /* I number of sub frames */ + opus_int16 lagIndex, /* I */ + opus_int8 contourIndex, /* O */ + opus_int pitch_lags[], /* O pitch values */ + const opus_int Fs_kHz, /* I sampling frequency (kHz) */ + const opus_int nb_subfr /* I number of sub frames */ ) { - SKP_int lag, k, min_lag, max_lag, cbk_size; - const SKP_int8 *Lag_CB_ptr; + opus_int lag, k, min_lag, max_lag, cbk_size; + const opus_int8 *Lag_CB_ptr; if( Fs_kHz == 8 ) { if( nb_subfr == PE_MAX_NB_SUBFR ) { diff --git a/silk/silk_decode_pulses.c b/silk/silk_decode_pulses.c index eb99f61c12c5404b63254fbd4c6fec3f9953b7b7..3eba50cd533563d7d2586f9042be51fbd6bbb6d9 100644 --- a/silk/silk_decode_pulses.c +++ b/silk/silk_decode_pulses.c @@ -32,16 +32,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*********************************************/ void silk_decode_pulses( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int pulses[], /* O Excitation signal */ - const SKP_int signalType, /* I Sigtype */ - const SKP_int quantOffsetType, /* I quantOffsetType */ - const SKP_int frame_length /* I Frame length */ + opus_int pulses[], /* O Excitation signal */ + const opus_int signalType, /* I Sigtype */ + const opus_int quantOffsetType, /* I quantOffsetType */ + const opus_int frame_length /* I Frame length */ ) { - SKP_int i, j, k, iter, abs_q, nLS, RateLevelIndex; - SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ], nLshifts[ MAX_NB_SHELL_BLOCKS ]; - SKP_int *pulses_ptr; - const SKP_uint8 *cdf_ptr; + opus_int i, j, k, iter, abs_q, nLS, RateLevelIndex; + opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ], nLshifts[ MAX_NB_SHELL_BLOCKS ]; + opus_int *pulses_ptr; + const opus_uint8 *cdf_ptr; /*********************/ /* Decode rate level */ @@ -80,7 +80,7 @@ void silk_decode_pulses( if( sum_pulses[ i ] > 0 ) { silk_shell_decoder( &pulses[ SKP_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], psRangeDec, sum_pulses[ i ] ); } else { - SKP_memset( &pulses[ SKP_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof( SKP_int ) ); + SKP_memset( &pulses[ SKP_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof( opus_int ) ); } } diff --git a/silk/silk_decoder_set_fs.c b/silk/silk_decoder_set_fs.c index 66eb2013a9cd23d9c4903d349de25e8729557fa1..be45eb22f48713c6d7370f8879f83685da75da69 100644 --- a/silk/silk_decoder_set_fs.c +++ b/silk/silk_decoder_set_fs.c @@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Set decoder sampling rate */ void silk_decoder_set_fs( silk_decoder_state *psDec, /* I/O Decoder state pointer */ - SKP_int fs_kHz /* I Sampling frequency (kHz) */ + opus_int fs_kHz /* I Sampling frequency (kHz) */ ) { - SKP_int frame_length; + opus_int frame_length; SKP_assert( fs_kHz == 8 || fs_kHz == 12 || fs_kHz == 16 ); SKP_assert( psDec->nb_subfr == MAX_NB_SUBFR || psDec->nb_subfr == MAX_NB_SUBFR/2 ); @@ -67,7 +67,7 @@ void silk_decoder_set_fs( /* Reset part of the decoder state */ SKP_memset( psDec->sLPC_Q14, 0, sizeof( psDec->sLPC_Q14 ) ); - SKP_memset( psDec->outBuf, 0, MAX_FRAME_LENGTH * sizeof( SKP_int16 ) ); + SKP_memset( psDec->outBuf, 0, MAX_FRAME_LENGTH * sizeof( opus_int16 ) ); SKP_memset( psDec->prevNLSF_Q15, 0, sizeof( psDec->prevNLSF_Q15 ) ); psDec->lagPrev = 100; diff --git a/silk/silk_enc_API.c b/silk/silk_enc_API.c index d3f8934a8eed2e6c5404487cab2f03aa72380f55..992ba6607ef581840fc78a76d7d0ac6b6922014c 100644 --- a/silk/silk_enc_API.c +++ b/silk/silk_enc_API.c @@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Encoder functions */ /****************************************/ -SKP_int silk_Get_Encoder_Size( SKP_int32 *encSizeBytes ) +opus_int silk_Get_Encoder_Size( opus_int32 *encSizeBytes ) { - SKP_int ret = SILK_NO_ERROR; + opus_int ret = SILK_NO_ERROR; *encSizeBytes = sizeof( silk_encoder ); @@ -56,13 +56,13 @@ SKP_int silk_Get_Encoder_Size( SKP_int32 *encSizeBytes ) /*************************/ /* Init or Reset encoder */ /*************************/ -SKP_int silk_InitEncoder( +opus_int silk_InitEncoder( void *encState, /* I/O: State */ silk_EncControlStruct *encStatus /* O: Control structure */ ) { silk_encoder *psEnc; - SKP_int n, ret = SILK_NO_ERROR; + opus_int n, ret = SILK_NO_ERROR; psEnc = (silk_encoder *)encState; @@ -88,12 +88,12 @@ SKP_int silk_InitEncoder( /***************************************/ /* Read control structure from encoder */ /***************************************/ -SKP_int silk_QueryEncoder( +opus_int silk_QueryEncoder( const void *encState, /* I: State Vector */ silk_EncControlStruct *encStatus /* O: Control Structure */ ) { - SKP_int ret = SILK_NO_ERROR; + opus_int ret = SILK_NO_ERROR; silk_encoder_state_Fxx *state_Fxx; silk_encoder *psEnc = (silk_encoder *)encState; @@ -123,22 +123,22 @@ SKP_int silk_QueryEncoder( /**************************/ /* Encode frame with Silk */ /**************************/ -SKP_int silk_Encode( +opus_int silk_Encode( void *encState, /* I/O: State */ silk_EncControlStruct *encControl, /* I: Control structure */ - const SKP_int16 *samplesIn, /* I: Speech sample input vector */ - SKP_int nSamplesIn, /* I: Number of samples in input vector */ + const opus_int16 *samplesIn, /* I: Speech sample input vector */ + opus_int nSamplesIn, /* I: Number of samples in input vector */ ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int32 *nBytesOut, /* I/O: Number of bytes in payload (input: Max bytes) */ - const SKP_int prefillFlag /* I: Flag to indicate prefilling buffers; no coding */ + opus_int32 *nBytesOut, /* I/O: Number of bytes in payload (input: Max bytes) */ + const opus_int prefillFlag /* I: Flag to indicate prefilling buffers; no coding */ ) { - SKP_int n, i, nBits, flags, tmp_payloadSize_ms = 0, tmp_complexity = 0, ret = 0; - SKP_int nSamplesToBuffer, nBlocksOf10ms, nSamplesFromInput = 0; - SKP_int speech_act_thr_for_switch_Q8; - SKP_int32 TargetRate_bps, MStargetRates_bps[ 2 ], channelRate_bps, LBRR_symbol; + opus_int n, i, nBits, flags, tmp_payloadSize_ms = 0, tmp_complexity = 0, ret = 0; + opus_int nSamplesToBuffer, nBlocksOf10ms, nSamplesFromInput = 0; + opus_int speech_act_thr_for_switch_Q8; + opus_int32 TargetRate_bps, MStargetRates_bps[ 2 ], channelRate_bps, LBRR_symbol; silk_encoder *psEnc = ( silk_encoder * )encState; - SKP_int16 buf[ MAX_FRAME_LENGTH_MS * MAX_API_FS_KHZ ]; + opus_int16 buf[ MAX_FRAME_LENGTH_MS * MAX_API_FS_KHZ ]; /* Check values in encoder control structure */ if( ( ret = check_control_input( encControl ) != 0 ) ) { @@ -192,7 +192,7 @@ SKP_int silk_Encode( return ret; } /* Make sure no more than one packet can be produced */ - if( 1000 * (SKP_int32)nSamplesIn > encControl->payloadSize_ms * encControl->API_sampleRate ) { + if( 1000 * (opus_int32)nSamplesIn > encControl->payloadSize_ms * encControl->API_sampleRate ) { ret = SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES; SKP_assert( 0 ); return ret; @@ -233,7 +233,7 @@ SKP_int silk_Encode( } else if( encControl->nChannelsAPI == 2 && encControl->nChannelsInternal == 1 ) { /* Combine left and right channels before resampling */ for( n = 0; n < nSamplesFromInput; n++ ) { - buf[ n ] = (SKP_int16)SKP_RSHIFT_ROUND( samplesIn[ 2 * n ] + samplesIn[ 2 * n + 1 ], 1 ); + buf[ n ] = (opus_int16)SKP_RSHIFT_ROUND( samplesIn[ 2 * n ] + samplesIn[ 2 * n + 1 ], 1 ); } ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx ], buf, nSamplesFromInput ); @@ -259,7 +259,7 @@ SKP_int silk_Encode( /* Deal with LBRR data */ if( psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == 0 && !prefillFlag ) { /* Create space at start of payload for VAD and FEC flags */ - SKP_uint8 iCDF[ 2 ] = { 0, 0 }; + opus_uint8 iCDF[ 2 ] = { 0, 0 }; iCDF[ 0 ] = 256 - SKP_RSHIFT( 256, ( psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket + 1 ) * encControl->nChannelsInternal ); ec_enc_icdf( psRangeEnc, 0, iCDF, 8 ); @@ -327,8 +327,8 @@ SKP_int silk_Encode( silk_stereo_encode_pred( psRangeEnc, psEnc->sStereo.ix[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded ] ); } else { /* Buffering */ - SKP_memcpy( &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ -2 ], psEnc->sStereo.sMid, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( psEnc->sStereo.sMid, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.frame_length - 2 ], 2 * sizeof( SKP_int16 ) ); + SKP_memcpy( &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ -2 ], psEnc->sStereo.sMid, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( psEnc->sStereo.sMid, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.frame_length - 2 ], 2 * sizeof( opus_int16 ) ); } /* Encode */ diff --git a/silk/silk_encode_indices.c b/silk/silk_encode_indices.c index 39b8cbb33c1e80c6940ea4aa839ddc9bb501e102..2087121b1656b953d74892f432c3fc08ae709b7a 100644 --- a/silk/silk_encode_indices.c +++ b/silk/silk_encode_indices.c @@ -31,18 +31,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_encode_indices( silk_encoder_state *psEncC, /* I/O Encoder state */ ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int FrameIndex, /* I Frame number */ - SKP_int encode_LBRR /* I Flag indicating LBRR data is being encoded */ + opus_int FrameIndex, /* I Frame number */ + opus_int encode_LBRR /* I Flag indicating LBRR data is being encoded */ ) { - SKP_int i, k, condCoding, typeOffset; - SKP_int encode_absolute_lagIndex, delta_lagIndex; - SKP_int16 ec_ix[ MAX_LPC_ORDER ]; - SKP_uint8 pred_Q8[ MAX_LPC_ORDER ]; + opus_int i, k, condCoding, typeOffset; + opus_int encode_absolute_lagIndex, delta_lagIndex; + opus_int16 ec_ix[ MAX_LPC_ORDER ]; + opus_uint8 pred_Q8[ MAX_LPC_ORDER ]; const SideInfoIndices *psIndices; #if SAVE_ALL_INTERNAL_DATA - SKP_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP; - SKP_int nBytes_after, nBytes_before; + opus_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP; + opus_int nBytes_after, nBytes_before; #endif /* Use conditional coding if previous frame available */ @@ -97,7 +97,7 @@ void silk_encode_indices( #ifdef SAVE_ALL_INTERNAL_DATA nBytes_after = SKP_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); nBytes_after -= nBytes_before; // bytes just added - DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( SKP_int ) ); + DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( opus_int ) ); #endif /****************/ @@ -132,7 +132,7 @@ void silk_encode_indices( DEBUG_STORE_DATA( lsf_interpol.dat, &psIndices->NLSFInterpCoef_Q2, sizeof(int) ); nBytes_after = SKP_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); nBytes_after -= nBytes_before; // bytes just added - DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( SKP_int ) ); + DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( opus_int ) ); #endif if( psIndices->signalType == TYPE_VOICED ) @@ -159,7 +159,7 @@ void silk_encode_indices( } if( encode_absolute_lagIndex ) { /* Absolute encoding */ - SKP_int32 pitch_high_bits, pitch_low_bits; + opus_int32 pitch_high_bits, pitch_low_bits; pitch_high_bits = SKP_DIV32_16( psIndices->lagIndex, SKP_RSHIFT( psEncC->fs_kHz, 1 ) ); pitch_low_bits = psIndices->lagIndex - SKP_SMULBB( pitch_high_bits, SKP_RSHIFT( psEncC->fs_kHz, 1 ) ); SKP_assert( pitch_low_bits < psEncC->fs_kHz / 2 ); @@ -227,9 +227,9 @@ void silk_encode_indices( nBytes_contourIndex = 0; nBytes_LTP = 0; } - DEBUG_STORE_DATA( nBytes_lagIndex.dat, &nBytes_lagIndex, sizeof( SKP_int ) ); - DEBUG_STORE_DATA( nBytes_contourIndex.dat, &nBytes_contourIndex, sizeof( SKP_int ) ); - DEBUG_STORE_DATA( nBytes_LTP.dat, &nBytes_LTP, sizeof( SKP_int ) ); + DEBUG_STORE_DATA( nBytes_lagIndex.dat, &nBytes_lagIndex, sizeof( opus_int ) ); + DEBUG_STORE_DATA( nBytes_contourIndex.dat, &nBytes_contourIndex, sizeof( opus_int ) ); + DEBUG_STORE_DATA( nBytes_LTP.dat, &nBytes_LTP, sizeof( opus_int ) ); #endif psEncC->ec_prevSignalType = psIndices->signalType; diff --git a/silk/silk_encode_pulses.c b/silk/silk_encode_pulses.c index 1696831997afbf9816f8a21ace862e442636cb22..8410be9d19854190f2cb635ebb7440ed9372e0d9 100644 --- a/silk/silk_encode_pulses.c +++ b/silk/silk_encode_pulses.c @@ -31,14 +31,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Encode quantization indices of excitation */ /*********************************************/ -SKP_INLINE SKP_int combine_and_check( /* return ok */ - SKP_int *pulses_comb, /* O */ - const SKP_int *pulses_in, /* I */ - SKP_int max_pulses, /* I max value for sum of pulses */ - SKP_int len /* I number of output values */ +SKP_INLINE opus_int combine_and_check( /* return ok */ + opus_int *pulses_comb, /* O */ + const opus_int *pulses_in, /* I */ + opus_int max_pulses, /* I max value for sum of pulses */ + opus_int len /* I number of output values */ ) { - SKP_int k, sum; + opus_int k, sum; for( k = 0; k < len; k++ ) { sum = pulses_in[ 2 * k ] + pulses_in[ 2 * k + 1 ]; @@ -54,24 +54,24 @@ SKP_INLINE SKP_int combine_and_check( /* return ok */ /* Encode quantization indices of excitation */ void silk_encode_pulses( ec_enc *psRangeEnc, /* I/O compressor data structure */ - const SKP_int signalType, /* I Sigtype */ - const SKP_int quantOffsetType, /* I quantOffsetType */ - SKP_int8 pulses[], /* I quantization indices */ - const SKP_int frame_length /* I Frame length */ + const opus_int signalType, /* I Sigtype */ + const opus_int quantOffsetType, /* I quantOffsetType */ + opus_int8 pulses[], /* I quantization indices */ + const opus_int frame_length /* I Frame length */ ) { - SKP_int i, k, j, iter, bit, nLS, scale_down, RateLevelIndex = 0; - SKP_int32 abs_q, minSumBits_Q5, sumBits_Q5; - SKP_int abs_pulses[ MAX_FRAME_LENGTH ]; - SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ]; - SKP_int nRshifts[ MAX_NB_SHELL_BLOCKS ]; - SKP_int pulses_comb[ 8 ]; - SKP_int *abs_pulses_ptr; - const SKP_int8 *pulses_ptr; - const SKP_uint8 *cdf_ptr; - const SKP_uint8 *nBits_ptr; - - SKP_memset( pulses_comb, 0, 8 * sizeof( SKP_int ) ); // Fixing Valgrind reported problem + opus_int i, k, j, iter, bit, nLS, scale_down, RateLevelIndex = 0; + opus_int32 abs_q, minSumBits_Q5, sumBits_Q5; + opus_int abs_pulses[ MAX_FRAME_LENGTH ]; + opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ]; + opus_int nRshifts[ MAX_NB_SHELL_BLOCKS ]; + opus_int pulses_comb[ 8 ]; + opus_int *abs_pulses_ptr; + const opus_int8 *pulses_ptr; + const opus_uint8 *cdf_ptr; + const opus_uint8 *nBits_ptr; + + SKP_memset( pulses_comb, 0, 8 * sizeof( opus_int ) ); // Fixing Valgrind reported problem /****************************/ /* Prepare for shell coding */ @@ -82,15 +82,15 @@ void silk_encode_pulses( if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ){ SKP_assert( frame_length == 12 * 10 ); /* Make sure only happens for 10 ms @ 12 kHz */ iter++; - SKP_memset( &pulses[ frame_length ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof(SKP_int8)); + SKP_memset( &pulses[ frame_length ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof(opus_int8)); } /* Take the absolute value of the pulses */ for( i = 0; i < iter * SHELL_CODEC_FRAME_LENGTH; i+=4 ) { - abs_pulses[i+0] = ( SKP_int )SKP_abs( pulses[ i + 0 ] ); - abs_pulses[i+1] = ( SKP_int )SKP_abs( pulses[ i + 1 ] ); - abs_pulses[i+2] = ( SKP_int )SKP_abs( pulses[ i + 2 ] ); - abs_pulses[i+3] = ( SKP_int )SKP_abs( pulses[ i + 3 ] ); + abs_pulses[i+0] = ( opus_int )SKP_abs( pulses[ i + 0 ] ); + abs_pulses[i+1] = ( opus_int )SKP_abs( pulses[ i + 1 ] ); + abs_pulses[i+2] = ( opus_int )SKP_abs( pulses[ i + 2 ] ); + abs_pulses[i+3] = ( opus_int )SKP_abs( pulses[ i + 3 ] ); } /* Calc sum pulses per shell code frame */ @@ -177,7 +177,7 @@ void silk_encode_pulses( pulses_ptr = &pulses[ i * SHELL_CODEC_FRAME_LENGTH ]; nLS = nRshifts[ i ] - 1; for( k = 0; k < SHELL_CODEC_FRAME_LENGTH; k++ ) { - abs_q = (SKP_int8)SKP_abs( pulses_ptr[ k ] ); + abs_q = (opus_int8)SKP_abs( pulses_ptr[ k ] ); for( j = nLS; j > 0; j-- ) { bit = SKP_RSHIFT( abs_q, j ) & 1; ec_enc_icdf( psRangeEnc, bit, silk_lsb_iCDF, 8 ); diff --git a/silk/silk_gain_quant.c b/silk/silk_gain_quant.c index 0ce7dbdec1b5e9de6a49f5351ebd4c727256e790..9e4e4aa3dbf334e4ace4b7dc5b7e9b7ad7db6ba4 100644 --- a/silk/silk_gain_quant.c +++ b/silk/silk_gain_quant.c @@ -33,14 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Gain scalar quantization with hysteresis, uniform on log scale */ void silk_gains_quant( - SKP_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */ - SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */ - SKP_int8 *prev_ind, /* I/O last index in previous frame */ - const SKP_int conditional, /* I first gain is delta coded if 1 */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */ + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */ + opus_int8 *prev_ind, /* I/O last index in previous frame */ + const opus_int conditional, /* I first gain is delta coded if 1 */ + const opus_int nb_subfr /* I number of subframes */ ) { - SKP_int k, double_step_size_threshold; + opus_int k, double_step_size_threshold; for( k = 0; k < nb_subfr; k++ ) { /* Add half of previous quantization error, convert to log scale, scale, floor() */ @@ -87,14 +87,14 @@ void silk_gains_quant( /* Gains scalar dequantization, uniform on log scale */ void silk_gains_dequant( - SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */ - const SKP_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ - SKP_int8 *prev_ind, /* I/O last index in previous frame */ - const SKP_int conditional, /* I first gain is delta coded if 1 */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */ + const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ + opus_int8 *prev_ind, /* I/O last index in previous frame */ + const opus_int conditional, /* I first gain is delta coded if 1 */ + const opus_int nb_subfr /* I number of subframes */ ) { - SKP_int k, ind_tmp, double_step_size_threshold; + opus_int k, ind_tmp, double_step_size_threshold; for( k = 0; k < nb_subfr; k++ ) { if( k == 0 && conditional == 0 ) { diff --git a/silk/silk_init_encoder.c b/silk/silk_init_encoder.c index eeb32da935442fa1cc8ba2c61e379ded5a318efb..2a50001446a0c9a110abb1a2e644f4bcff35f323 100644 --- a/silk/silk_init_encoder.c +++ b/silk/silk_init_encoder.c @@ -38,10 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*********************************/ /* Initialize Silk Encoder state */ /*********************************/ -SKP_int silk_init_encoder( +opus_int silk_init_encoder( silk_encoder_state_Fxx *psEnc /* I/O Pointer to Silk encoder state */ ) { - SKP_int ret = 0; + opus_int ret = 0; /* Clear the entire encoder state */ SKP_memset( psEnc, 0, sizeof( silk_encoder_state_Fxx ) ); diff --git a/silk/silk_inner_prod_aligned.c b/silk/silk_inner_prod_aligned.c index 34988e87b63cc083d1ad3be186b637d09bdec016..c0e9faae62aac4a9e8aa099f058584a809180480 100644 --- a/silk/silk_inner_prod_aligned.c +++ b/silk/silk_inner_prod_aligned.c @@ -33,43 +33,43 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* * len should be positive 16bit integer. */ /* * only when len>6, memory access can be reduced by half. */ -SKP_int32 silk_inner_prod_aligned( - const SKP_int16 *const inVec1, /* I input vector 1 */ - const SKP_int16 *const inVec2, /* I input vector 2 */ - const SKP_int len /* I vector lengths */ +opus_int32 silk_inner_prod_aligned( + const opus_int16 *const inVec1, /* I input vector 1 */ + const opus_int16 *const inVec2, /* I input vector 2 */ + const opus_int len /* I vector lengths */ ) { - SKP_int i; - SKP_int32 sum = 0; + opus_int i; + opus_int32 sum = 0; for( i = 0; i < len; i++ ) { sum = SKP_SMLABB( sum, inVec1[ i ], inVec2[ i ] ); } return sum; } -SKP_int32 silk_inner_prod_aligned_scale( - const SKP_int16 *const inVec1, /* I input vector 1 */ - const SKP_int16 *const inVec2, /* I input vector 2 */ - const SKP_int scale, /* I number of bits to shift */ - const SKP_int len /* I vector lengths */ +opus_int32 silk_inner_prod_aligned_scale( + const opus_int16 *const inVec1, /* I input vector 1 */ + const opus_int16 *const inVec2, /* I input vector 2 */ + const opus_int scale, /* I number of bits to shift */ + const opus_int len /* I vector lengths */ ) { - SKP_int i; - SKP_int32 sum = 0; + opus_int i; + opus_int32 sum = 0; for( i = 0; i < len; i++ ) { sum = SKP_ADD_RSHIFT32( sum, SKP_SMULBB( inVec1[ i ], inVec2[ i ] ), scale ); } return sum; } -SKP_int64 silk_inner_prod16_aligned_64( - const SKP_int16 *inVec1, /* I input vector 1 */ - const SKP_int16 *inVec2, /* I input vector 2 */ - const SKP_int len /* I vector lengths */ +opus_int64 silk_inner_prod16_aligned_64( + const opus_int16 *inVec1, /* I input vector 1 */ + const opus_int16 *inVec2, /* I input vector 2 */ + const opus_int len /* I vector lengths */ ) { - SKP_int i; - SKP_int64 sum = 0; + opus_int i; + opus_int64 sum = 0; for( i = 0; i < len; i++ ) { sum = SKP_SMLALBB( sum, inVec1[ i ], inVec2[ i ] ); } diff --git a/silk/silk_interpolate.c b/silk/silk_interpolate.c index ba510cfe04698910b1543127dbc8c616fe8ce173..4c50a4a62baf58422e743925d707354d9e765ea7 100644 --- a/silk/silk_interpolate.c +++ b/silk/silk_interpolate.c @@ -29,19 +29,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Interpolate two vectors */ void silk_interpolate( - SKP_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ - const SKP_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ - const SKP_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ - const SKP_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ - const SKP_int d /* I number of parameters */ + opus_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ + const opus_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ + const opus_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ + const opus_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ + const opus_int d /* I number of parameters */ ) { - SKP_int i; + opus_int i; SKP_assert( ifact_Q2 >= 0 ); SKP_assert( ifact_Q2 <= 4 ); for( i = 0; i < d; i++ ) { - xi[ i ] = ( SKP_int16 )SKP_ADD_RSHIFT( x0[ i ], SKP_SMULBB( x1[ i ] - x0[ i ], ifact_Q2 ), 2 ); + xi[ i ] = ( opus_int16 )SKP_ADD_RSHIFT( x0[ i ], SKP_SMULBB( x1[ i ] - x0[ i ], ifact_Q2 ), 2 ); } } diff --git a/silk/silk_k2a.c b/silk/silk_k2a.c index c6989f2c4c4ffb91c63757e9cc9c2bbcbc0122e1..ef43c16518cbe82c0c157b83cc40386e963c5900 100644 --- a/silk/silk_k2a.c +++ b/silk/silk_k2a.c @@ -29,13 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a( - SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ - const SKP_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */ - const SKP_int32 order /* I: Prediction order */ + opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ + const opus_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */ + const opus_int32 order /* I: Prediction order */ ) { - SKP_int k, n; - SKP_int32 Atmp[ SILK_MAX_ORDER_LPC ]; + opus_int k, n; + opus_int32 Atmp[ SILK_MAX_ORDER_LPC ]; for( k = 0; k < order; k++ ) { for( n = 0; n < k; n++ ) { @@ -44,6 +44,6 @@ void silk_k2a( for( n = 0; n < k; n++ ) { A_Q24[ n ] = SKP_SMLAWB( A_Q24[ n ], SKP_LSHIFT( Atmp[ k - n - 1 ], 1 ), rc_Q15[ k ] ); } - A_Q24[ k ] = -SKP_LSHIFT( (SKP_int32)rc_Q15[ k ], 9 ); + A_Q24[ k ] = -SKP_LSHIFT( (opus_int32)rc_Q15[ k ], 9 ); } } diff --git a/silk/silk_k2a_Q16.c b/silk/silk_k2a_Q16.c index f2cde25c3829bafb8161a91489f15ae6aea71ad5..2b7c5b78c8d1ce0f69bf4892186260c00e45bef6 100644 --- a/silk/silk_k2a_Q16.c +++ b/silk/silk_k2a_Q16.c @@ -29,13 +29,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a_Q16( - SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ - const SKP_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */ - const SKP_int32 order /* I: Prediction order */ + opus_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */ + const opus_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */ + const opus_int32 order /* I: Prediction order */ ) { - SKP_int k, n; - SKP_int32 Atmp[ SILK_MAX_ORDER_LPC ]; + opus_int k, n; + opus_int32 Atmp[ SILK_MAX_ORDER_LPC ]; for( k = 0; k < order; k++ ) { for( n = 0; n < k; n++ ) { diff --git a/silk/silk_lin2log.c b/silk/silk_lin2log.c index e55d64e5654c421e63fe2ba3cb18a8dc9e623d9a..7de345a7e1d9c4dc5240c10ab5f7370c5be37817 100644 --- a/silk/silk_lin2log.c +++ b/silk/silk_lin2log.c @@ -28,9 +28,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" /* Approximation of 128 * log2() (very close inverse of silk_log2lin()) */ /* Convert input to a log scale */ -SKP_int32 silk_lin2log( const SKP_int32 inLin ) /* I: Input in linear scale */ +opus_int32 silk_lin2log( const opus_int32 inLin ) /* I: Input in linear scale */ { - SKP_int32 lz, frac_Q7; + opus_int32 lz, frac_Q7; silk_CLZ_FRAC( inLin, &lz, &frac_Q7 ); diff --git a/silk/silk_log2lin.c b/silk/silk_log2lin.c index f6be92ebdbacd2d6852e88b7003948d55e4c5f4c..a7bb26e25c0c85b89947482a5096999445dace6d 100644 --- a/silk/silk_log2lin.c +++ b/silk/silk_log2lin.c @@ -29,9 +29,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Approximation of 2^() (very close inverse of silk_lin2log()) */ /* Convert input to a linear scale */ -SKP_int32 silk_log2lin( const SKP_int32 inLog_Q7 ) /* I: Input on log scale */ +opus_int32 silk_log2lin( const opus_int32 inLog_Q7 ) /* I: Input on log scale */ { - SKP_int32 out, frac_Q7; + opus_int32 out, frac_Q7; if( inLog_Q7 < 0 ) { return 0; diff --git a/silk/silk_macros.h b/silk/silk_macros.h index ec022531060bfcc9d5ed9b3c638f5a7f497e693f..56424669ead0d677e47275fdd1cda5fa65f8c24a 100644 --- a/silk/silk_macros.h +++ b/silk/silk_macros.h @@ -30,11 +30,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This is an inline header file for general platform. -// (a32 * (SKP_int32)((SKP_int16)(b32))) >> 16 output have to be 32bit int -#define SKP_SMULWB(a32, b32) ((((a32) >> 16) * (SKP_int32)((SKP_int16)(b32))) + ((((a32) & 0x0000FFFF) * (SKP_int32)((SKP_int16)(b32))) >> 16)) +// (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int +#define SKP_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) -// a32 + (b32 * (SKP_int32)((SKP_int16)(c32))) >> 16 output have to be 32bit int -#define SKP_SMLAWB(a32, b32, c32) ((a32) + ((((b32) >> 16) * (SKP_int32)((SKP_int16)(c32))) + ((((b32) & 0x0000FFFF) * (SKP_int32)((SKP_int16)(c32))) >> 16))) +// a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int +#define SKP_SMLAWB(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))) // (a32 * (b32 >> 16)) >> 16 #define SKP_SMULWT(a32, b32) (((a32) >> 16) * ((b32) >> 16) + ((((a32) & 0x0000FFFF) * ((b32) >> 16)) >> 16)) @@ -42,20 +42,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // a32 + (b32 * (c32 >> 16)) >> 16 #define SKP_SMLAWT(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16)) -// (SKP_int32)((SKP_int16)(a3))) * (SKP_int32)((SKP_int16)(b32)) output have to be 32bit int -#define SKP_SMULBB(a32, b32) ((SKP_int32)((SKP_int16)(a32)) * (SKP_int32)((SKP_int16)(b32))) +// (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int +#define SKP_SMULBB(a32, b32) ((opus_int32)((opus_int16)(a32)) * (opus_int32)((opus_int16)(b32))) -// a32 + (SKP_int32)((SKP_int16)(b32)) * (SKP_int32)((SKP_int16)(c32)) output have to be 32bit int -#define SKP_SMLABB(a32, b32, c32) ((a32) + ((SKP_int32)((SKP_int16)(b32))) * (SKP_int32)((SKP_int16)(c32))) +// a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int +#define SKP_SMLABB(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))) -// (SKP_int32)((SKP_int16)(a32)) * (b32 >> 16) -#define SKP_SMULBT(a32, b32) ((SKP_int32)((SKP_int16)(a32)) * ((b32) >> 16)) +// (opus_int32)((opus_int16)(a32)) * (b32 >> 16) +#define SKP_SMULBT(a32, b32) ((opus_int32)((opus_int16)(a32)) * ((b32) >> 16)) -// a32 + (SKP_int32)((SKP_int16)(b32)) * (c32 >> 16) -#define SKP_SMLABT(a32, b32, c32) ((a32) + ((SKP_int32)((SKP_int16)(b32))) * ((c32) >> 16)) +// a32 + (opus_int32)((opus_int16)(b32)) * (c32 >> 16) +#define SKP_SMLABT(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * ((c32) >> 16)) // a64 + (b32 * c32) -#define SKP_SMLAL(a64, b32, c32) (SKP_ADD64((a64), ((SKP_int64)(b32) * (SKP_int64)(c32)))) +#define SKP_SMLAL(a64, b32, c32) (SKP_ADD64((a64), ((opus_int64)(b32) * (opus_int64)(c32)))) // (a32 * b32) >> 16 #define SKP_SMULWW(a32, b32) SKP_MLA(SKP_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)) @@ -72,9 +72,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (( (a) & ((b)^0x80000000) & 0x80000000) ? SKP_int32_MIN : (a)-(b)) : \ ((((a)^0x80000000) & (b) & 0x80000000) ? SKP_int32_MAX : (a)-(b)) ) -SKP_INLINE SKP_int32 silk_CLZ16(SKP_int16 in16) +SKP_INLINE opus_int32 silk_CLZ16(opus_int16 in16) { - SKP_int32 out32 = 0; + opus_int32 out32 = 0; if( in16 == 0 ) { return 16; } @@ -108,13 +108,13 @@ SKP_INLINE SKP_int32 silk_CLZ16(SKP_int16 in16) } } -SKP_INLINE SKP_int32 silk_CLZ32(SKP_int32 in32) +SKP_INLINE opus_int32 silk_CLZ32(opus_int32 in32) { - /* test highest 16 bits and convert to SKP_int16 */ + /* test highest 16 bits and convert to opus_int16 */ if( in32 & 0xFFFF0000 ) { - return silk_CLZ16((SKP_int16)(in32 >> 16)); + return silk_CLZ16((opus_int16)(in32 >> 16)); } else { - return silk_CLZ16((SKP_int16)in32) + 16; + return silk_CLZ16((opus_int16)in32) + 16; } } diff --git a/silk/silk_main.h b/silk/silk_main.h index fde136184688259ccb7702fdc068084f4382df02..68a79be2abd559b90a36e6892491aec0aaa2655e 100644 --- a/silk/silk_main.h +++ b/silk/silk_main.h @@ -53,90 +53,90 @@ extern "C" /* Convert Left/Right stereo signal to adaptive Mid/Side representation */ void silk_stereo_LR_to_MS( stereo_enc_state *state, /* I/O State */ - SKP_int16 x1[], /* I/O Left input signal, becomes mid signal */ - SKP_int16 x2[], /* I/O Right input signal, becomes side signal */ - SKP_int8 ix[ 2 ][ 4 ], /* O Quantization indices */ - SKP_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */ - SKP_int32 total_rate_bps, /* I Total bitrate */ - SKP_int prev_speech_act_Q8, /* I Speech activity level in previous frame */ - SKP_int fs_kHz, /* I Sample rate (kHz) */ - SKP_int frame_length /* I Number of samples */ + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ + opus_int8 ix[ 2 ][ 4 ], /* O Quantization indices */ + opus_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */ + opus_int32 total_rate_bps, /* I Total bitrate */ + opus_int prev_speech_act_Q8, /* I Speech activity level in previous frame */ + opus_int fs_kHz, /* I Sample rate (kHz) */ + opus_int frame_length /* I Number of samples */ ); /* Convert adaptive Mid/Side representation to Left/Right stereo signal */ void silk_stereo_MS_to_LR( stereo_dec_state *state, /* I/O State */ - SKP_int16 x1[], /* I/O Left input signal, becomes mid signal */ - SKP_int16 x2[], /* I/O Right input signal, becomes side signal */ - const SKP_int32 pred_Q13[], /* I Predictors */ - SKP_int fs_kHz, /* I Samples rate (kHz) */ - SKP_int frame_length /* I Number of samples */ + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ + const opus_int32 pred_Q13[], /* I Predictors */ + opus_int fs_kHz, /* I Samples rate (kHz) */ + opus_int frame_length /* I Number of samples */ ); /* Find least-squares prediction gain for one signal based on another and quantize it */ -SKP_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */ - SKP_int32 *ratio_Q14, /* O Ratio of residual and mid energies */ - const SKP_int16 x[], /* I Basis signal */ - const SKP_int16 y[], /* I Target signal */ - SKP_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */ - SKP_int length, /* I Number of samples */ - SKP_int smooth_coef_Q16 /* I Smoothing coefficient */ +opus_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */ + opus_int32 *ratio_Q14, /* O Ratio of residual and mid energies */ + const opus_int16 x[], /* I Basis signal */ + const opus_int16 y[], /* I Target signal */ + opus_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */ + opus_int length, /* I Number of samples */ + opus_int smooth_coef_Q16 /* I Smoothing coefficient */ ); /* Quantize mid/side predictors */ void silk_stereo_quant_pred( stereo_enc_state *state, /* I/O State */ - SKP_int32 pred_Q13[], /* I/O Predictors (out: quantized) */ - SKP_int8 ix[ 2 ][ 4 ] /* O Quantization indices */ + opus_int32 pred_Q13[], /* I/O Predictors (out: quantized) */ + opus_int8 ix[ 2 ][ 4 ] /* O Quantization indices */ ); /* Entropy code the mid/side quantization indices */ void silk_stereo_encode_pred( ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int8 ix[ 2 ][ 4 ] /* I Quantization indices */ + opus_int8 ix[ 2 ][ 4 ] /* I Quantization indices */ ); /* Decode mid/side predictors */ void silk_stereo_decode_pred( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int *decode_only_mid, /* O Flag that only mid channel has been coded */ - SKP_int32 pred_Q13[] /* O Predictors */ + opus_int *decode_only_mid, /* O Flag that only mid channel has been coded */ + opus_int32 pred_Q13[] /* O Predictors */ ); /* Encodes signs of excitation */ void silk_encode_signs( ec_enc *psRangeEnc, /* I/O Compressor data structure */ - const SKP_int8 pulses[], /* I pulse signal */ - SKP_int length, /* I length of input */ - const SKP_int signalType, /* I Signal type */ - const SKP_int quantOffsetType, /* I Quantization offset type */ - const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ + const opus_int8 pulses[], /* I pulse signal */ + opus_int length, /* I length of input */ + const opus_int signalType, /* I Signal type */ + const opus_int quantOffsetType, /* I Quantization offset type */ + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ ); /* Decodes signs of excitation */ void silk_decode_signs( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int pulses[], /* I/O pulse signal */ - SKP_int length, /* I length of input */ - const SKP_int signalType, /* I Signal type */ - const SKP_int quantOffsetType, /* I Quantization offset type */ - const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ + opus_int pulses[], /* I/O pulse signal */ + opus_int length, /* I length of input */ + const opus_int signalType, /* I Signal type */ + const opus_int quantOffsetType, /* I Quantization offset type */ + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ ); /* Check encoder control struct */ -SKP_int check_control_input( +opus_int check_control_input( silk_EncControlStruct *encControl /* I: Control structure */ ); /* Control internal sampling rate */ -SKP_int silk_control_audio_bandwidth( +opus_int silk_control_audio_bandwidth( silk_encoder_state *psEncC /* I/O Pointer to Silk encoder state */ ); /* Control SNR of redidual quantizer */ -SKP_int silk_control_SNR( +opus_int silk_control_SNR( silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */ - SKP_int32 TargetRate_bps /* I Target max bitrate (bps) */ + opus_int32 TargetRate_bps /* I Target max bitrate (bps) */ ); /***************/ @@ -146,73 +146,73 @@ SKP_int silk_control_SNR( /* Encode quantization indices of excitation */ void silk_encode_pulses( ec_enc *psRangeEnc, /* I/O compressor data structure */ - const SKP_int signalType, /* I Signal type */ - const SKP_int quantOffsetType, /* I quantOffsetType */ - SKP_int8 pulses[], /* I quantization indices */ - const SKP_int frame_length /* I Frame length */ + const opus_int signalType, /* I Signal type */ + const opus_int quantOffsetType, /* I quantOffsetType */ + opus_int8 pulses[], /* I quantization indices */ + const opus_int frame_length /* I Frame length */ ); /* Shell encoder, operates on one shell code frame of 16 pulses */ void silk_shell_encoder( ec_enc *psRangeEnc, /* I/O compressor data structure */ - const SKP_int *pulses0 /* I data: nonnegative pulse amplitudes */ + const opus_int *pulses0 /* I data: nonnegative pulse amplitudes */ ); /* Shell decoder, operates on one shell code frame of 16 pulses */ void silk_shell_decoder( - SKP_int *pulses0, /* O data: nonnegative pulse amplitudes */ + opus_int *pulses0, /* O data: nonnegative pulse amplitudes */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - const SKP_int pulses4 /* I number of pulses per pulse-subframe */ + const opus_int pulses4 /* I number of pulses per pulse-subframe */ ); /* Gain scalar quantization with hysteresis, uniform on log scale */ void silk_gains_quant( - SKP_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */ - SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */ - SKP_int8 *prev_ind, /* I/O last index in previous frame */ - const SKP_int conditional, /* I first gain is delta coded if 1 */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */ + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */ + opus_int8 *prev_ind, /* I/O last index in previous frame */ + const opus_int conditional, /* I first gain is delta coded if 1 */ + const opus_int nb_subfr /* I number of subframes */ ); /* Gains scalar dequantization, uniform on log scale */ void silk_gains_dequant( - SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */ - const SKP_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ - SKP_int8 *prev_ind, /* I/O last index in previous frame */ - const SKP_int conditional, /* I first gain is delta coded if 1 */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */ + const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ + opus_int8 *prev_ind, /* I/O last index in previous frame */ + const opus_int conditional, /* I first gain is delta coded if 1 */ + const opus_int nb_subfr /* I number of subframes */ ); /* Interpolate two vectors */ void silk_interpolate( - SKP_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ - const SKP_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ - const SKP_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ - const SKP_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ - const SKP_int d /* I number of parameters */ + opus_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ + const opus_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ + const opus_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ + const opus_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ + const opus_int d /* I number of parameters */ ); /* LTP tap quantizer */ void silk_quant_LTP_gains( - SKP_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ - SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ - SKP_int8 *periodicity_index, /* O Periodicity Index */ - const SKP_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ - SKP_int mu_Q9, /* I Mu value (R/D tradeoff) */ - SKP_int lowComplexity, /* I Flag for low complexity */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ + opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ + opus_int8 *periodicity_index, /* O Periodicity Index */ + const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ + opus_int mu_Q9, /* I Mu value (R/D tradeoff) */ + opus_int lowComplexity, /* I Flag for low complexity */ + const opus_int nb_subfr /* I number of subframes */ ); /* Entropy constrained matrix-weighted VQ, for a single input data vector */ void silk_VQ_WMat_EC( - SKP_int8 *ind, /* O index of best codebook vector */ - SKP_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/ - const SKP_int16 *in_Q14, /* I input vector to be quantized */ - const SKP_int32 *W_Q18, /* I weighting matrix */ - const SKP_int8 *cb_Q7, /* I codebook */ - const SKP_uint8 *cl_Q5, /* I code length for each codebook vector */ - const SKP_int mu_Q9, /* I tradeoff between weighted error and rate */ - SKP_int L /* I number of vectors in codebook */ + opus_int8 *ind, /* O index of best codebook vector */ + opus_int32 *rate_dist_Q14, /* O best weighted quantization error + mu * rate*/ + const opus_int16 *in_Q14, /* I input vector to be quantized */ + const opus_int32 *W_Q18, /* I weighting matrix */ + const opus_int8 *cb_Q7, /* I codebook */ + const opus_uint8 *cl_Q5, /* I code length for each codebook vector */ + const opus_int mu_Q9, /* I tradeoff between weighted error and rate */ + opus_int L /* I number of vectors in codebook */ ); /***********************************/ @@ -222,18 +222,18 @@ void silk_NSQ( const silk_encoder_state *psEncC, /* I/O Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ SideInfoIndices *psIndices, /* I/O Quantization Indices */ - const SKP_int16 x[], /* I prefiltered input signal */ - SKP_int8 pulses[], /* O quantized qulse signal */ - const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */ - const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ - const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ - const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I */ - const SKP_int Lambda_Q10, /* I */ - const SKP_int LTP_scale_Q14 /* I LTP state scaling */ + const opus_int16 x[], /* I prefiltered input signal */ + opus_int8 pulses[], /* O quantized qulse signal */ + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefficients */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefficients */ + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I */ + const opus_int Lambda_Q10, /* I */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ ); /* Noise shaping using delayed decision */ @@ -241,38 +241,38 @@ void silk_NSQ_del_dec( const silk_encoder_state *psEncC, /* I/O Encoder State */ silk_nsq_state *NSQ, /* I/O NSQ state */ SideInfoIndices *psIndices, /* I/O Quantization Indices */ - const SKP_int16 x[], /* I Prefiltered input signal */ - SKP_int8 pulses[], /* O Quantized pulse signal */ - const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */ - const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */ - const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ - const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ - const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ - const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ - const SKP_int pitchL[ MAX_NB_SUBFR ], /* I */ - const SKP_int Lambda_Q10, /* I */ - const SKP_int LTP_scale_Q14 /* I LTP state scaling */ + const opus_int16 x[], /* I Prefiltered input signal */ + opus_int8 pulses[], /* O Quantized pulse signal */ + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Prediction coefs */ + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I LT prediction coefs */ + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I */ + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I */ + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I */ + const opus_int pitchL[ MAX_NB_SUBFR ], /* I */ + const opus_int Lambda_Q10, /* I */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ ); /************/ /* Silk VAD */ /************/ /* Initialize the Silk VAD */ -SKP_int silk_VAD_Init( /* O Return value, 0 if success */ +opus_int silk_VAD_Init( /* O Return value, 0 if success */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ ); /* Silk VAD noise level estimation */ void silk_VAD_GetNoiseLevels( - const SKP_int32 pX[ VAD_N_BANDS ], /* I subband energies */ + const opus_int32 pX[ VAD_N_BANDS ], /* I subband energies */ silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ ); /* Get speech activity level in Q8 */ -SKP_int silk_VAD_GetSA_Q8( /* O Return value, 0 if success */ +opus_int silk_VAD_GetSA_Q8( /* O Return value, 0 if success */ silk_encoder_state *psEncC, /* I/O Encoder state */ - const SKP_int16 pIn[] /* I PCM input */ + const opus_int16 pIn[] /* I PCM input */ ); /* Low-pass filter with variable cutoff frequency based on */ @@ -280,8 +280,8 @@ SKP_int silk_VAD_GetSA_Q8( /* O Return value, 0 if s /* Start by setting transition_frame_no = 1; */ void silk_LP_variable_cutoff( silk_LP_state *psLP, /* I/O LP filter state */ - SKP_int16 *signal, /* I/O Low-pass filtered output signal */ - const SKP_int frame_length /* I Frame length */ + opus_int16 *signal, /* I/O Low-pass filtered output signal */ + const opus_int frame_length /* I Frame length */ ); /******************/ @@ -290,91 +290,91 @@ void silk_LP_variable_cutoff( /* Limit, stabilize, convert and quantize NLSFs */ void silk_process_NLSFs( silk_encoder_state *psEncC, /* I/O Encoder state */ - SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ - SKP_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ - const SKP_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ + opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ + opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ + const opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ ); -SKP_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */ - SKP_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ - SKP_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */ +opus_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */ + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ + opus_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */ const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ - const SKP_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */ - const SKP_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */ - const SKP_int nSurvivors, /* I Max survivors after first stage */ - const SKP_int signalType /* I Signal type: 0/1/2 */ + const opus_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */ + const opus_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */ + const opus_int nSurvivors, /* I Max survivors after first stage */ + const opus_int signalType /* I Signal type: 0/1/2 */ ); /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */ void silk_NLSF_VQ( - SKP_int32 err_Q26[], /* O Quantization errors [K] */ - const SKP_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */ - const SKP_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */ - const SKP_int K, /* I Number of codebook vectors */ - const SKP_int LPC_order /* I Number of LPCs */ + opus_int32 err_Q26[], /* O Quantization errors [K] */ + const opus_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */ + const opus_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */ + const opus_int K, /* I Number of codebook vectors */ + const opus_int LPC_order /* I Number of LPCs */ ); /* Delayed-decision quantizer for NLSF residuals */ -SKP_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */ - SKP_int8 indices[], /* O Quantization indices [ order ] */ - const SKP_int16 x_Q10[], /* I Input [ order ] */ - const SKP_int16 w_Q5[], /* I Weights [ order ] */ - const SKP_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ - const SKP_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */ - const SKP_uint8 ec_rates_Q5[], /* I Rates [] */ - const SKP_int quant_step_size_Q16, /* I Quantization step size */ - const SKP_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */ - const SKP_int32 mu_Q20, /* I R/D tradeoff */ - const SKP_int16 order /* I Number of input values */ +opus_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */ + opus_int8 indices[], /* O Quantization indices [ order ] */ + const opus_int16 x_Q10[], /* I Input [ order ] */ + const opus_int16 w_Q5[], /* I Weights [ order ] */ + const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ + const opus_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */ + const opus_uint8 ec_rates_Q5[], /* I Rates [] */ + const opus_int quant_step_size_Q16, /* I Quantization step size */ + const opus_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */ + const opus_int32 mu_Q20, /* I R/D tradeoff */ + const opus_int16 order /* I Number of input values */ ); /* Unpack predictor values and indices for entropy coding tables */ void silk_NLSF_unpack( - SKP_int16 ec_ix[], /* O Indices to entropy tales [ LPC_ORDER ] */ - SKP_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */ + opus_int16 ec_ix[], /* O Indices to entropy tales [ LPC_ORDER ] */ + opus_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */ const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ - const SKP_int CB1_index /* I Index of vector in first LSF codebook */ + const opus_int CB1_index /* I Index of vector in first LSF codebook */ ); /***********************/ /* NLSF vector decoder */ /***********************/ void silk_NLSF_decode( - SKP_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */ - SKP_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ + opus_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */ + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ const silk_NLSF_CB_struct *psNLSF_CB /* I Codebook object */ ); /****************************************************/ /* Decoder Functions */ /****************************************************/ -SKP_int silk_create_decoder( +opus_int silk_create_decoder( silk_decoder_state **ppsDec /* I/O Decoder state pointer pointer */ ); -SKP_int silk_free_decoder( +opus_int silk_free_decoder( silk_decoder_state *psDec /* I/O Decoder state pointer */ ); -SKP_int silk_init_decoder( +opus_int silk_init_decoder( silk_decoder_state *psDec /* I/O Decoder state pointer */ ); /* Set decoder sampling rate */ void silk_decoder_set_fs( silk_decoder_state *psDec, /* I/O Decoder state pointer */ - SKP_int fs_kHz /* I Sampling frequency (kHz) */ + opus_int fs_kHz /* I Sampling frequency (kHz) */ ); /****************/ /* Decode frame */ /****************/ -SKP_int silk_decode_frame( +opus_int silk_decode_frame( silk_decoder_state *psDec, /* I/O Pointer to Silk decoder state */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int16 pOut[], /* O Pointer to output speech frame */ - SKP_int32 *pN, /* O Pointer to size of output frame */ - SKP_int lostFlag /* I 0: no loss, 1 loss, 2 decode fec */ + opus_int16 pOut[], /* O Pointer to output speech frame */ + opus_int32 *pN, /* O Pointer to size of output frame */ + opus_int lostFlag /* I 0: no loss, 1 loss, 2 decode fec */ ); /* Decode LBRR side info and excitation */ @@ -387,8 +387,8 @@ void silk_LBRR_extract( void silk_decode_indices( silk_decoder_state *psDec, /* I/O State */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int FrameIndex, /* I Frame number */ - SKP_int decode_LBRR /* I Flag indicating LBRR data is being decoded */ + opus_int FrameIndex, /* I Frame number */ + opus_int decode_LBRR /* I Flag indicating LBRR data is being decoded */ ); /* Decode parameters from payload */ @@ -401,17 +401,17 @@ void silk_decode_parameters( void silk_decode_core( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I Decoder control */ - SKP_int16 xq[], /* O Decoded speech */ - const SKP_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ + opus_int16 xq[], /* O Decoded speech */ + const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ ); /* Decode quantization indices of excitation (Shell coding) */ void silk_decode_pulses( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int pulses[], /* O Excitation signal */ - const SKP_int signalType, /* I Sigtype */ - const SKP_int quantOffsetType, /* I quantOffsetType */ - const SKP_int frame_length /* I Frame length */ + opus_int pulses[], /* O Excitation signal */ + const opus_int signalType, /* I Sigtype */ + const opus_int quantOffsetType, /* I quantOffsetType */ + const opus_int frame_length /* I Frame length */ ); /******************/ @@ -427,16 +427,16 @@ void silk_CNG_Reset( void silk_CNG( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ - SKP_int16 signal[], /* I/O Signal */ - SKP_int length /* I Length of residual */ + opus_int16 signal[], /* I/O Signal */ + opus_int length /* I Length of residual */ ); /* Encoding of various parameters */ void silk_encode_indices( silk_encoder_state *psEncC, /* I/O Encoder state */ ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int FrameIndex, /* I Frame number */ - SKP_int encode_LBRR /* I Flag indicating LBRR data is being encoded */ + opus_int FrameIndex, /* I Frame number */ + opus_int encode_LBRR /* I Flag indicating LBRR data is being encoded */ ); #ifdef __cplusplus diff --git a/silk/silk_pitch_analysis_core.c b/silk/silk_pitch_analysis_core.c index 39f69aaaeedd7b3facc534475965cf604bd4052b..df1c1bca899050750a5b481bbfc52a103fa58b61 100644 --- a/silk/silk_pitch_analysis_core.c +++ b/silk/silk_pitch_analysis_core.c @@ -38,70 +38,70 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Internally used functions */ /************************************************************/ void silk_P_Ana_calc_corr_st3( - SKP_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */ - const SKP_int16 signal[], /* I vector to correlate */ - SKP_int start_lag, /* I lag offset to search around */ - SKP_int sf_length, /* I length of a 5 ms subframe */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */ + const opus_int16 signal[], /* I vector to correlate */ + opus_int start_lag, /* I lag offset to search around */ + opus_int sf_length, /* I length of a 5 ms subframe */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ); void silk_P_Ana_calc_energy_st3( - SKP_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */ - const SKP_int16 signal[], /* I vector to calc energy in */ - SKP_int start_lag, /* I lag offset to search around */ - SKP_int sf_length, /* I length of one 5 ms subframe */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */ + const opus_int16 signal[], /* I vector to calc energy in */ + opus_int start_lag, /* I lag offset to search around */ + opus_int sf_length, /* I length of one 5 ms subframe */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ); -SKP_int32 silk_P_Ana_find_scaling( - const SKP_int16 *signal, - const SKP_int signal_length, - const SKP_int sum_sqr_len +opus_int32 silk_P_Ana_find_scaling( + const opus_int16 *signal, + const opus_int signal_length, + const opus_int sum_sqr_len ); /*************************************************************/ /* FIXED POINT CORE PITCH ANALYSIS FUNCTION */ /*************************************************************/ -SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ - const SKP_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ - SKP_int *pitch_out, /* O 4 pitch lag values */ - SKP_int16 *lagIndex, /* O Lag Index */ - SKP_int8 *contourIndex, /* O Pitch contour Index */ - SKP_int *LTPCorr_Q15, /* I/O Normalized correlation; input: value from previous frame */ - SKP_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ - const SKP_int32 search_thres1_Q16, /* I First stage threshold for lag candidates 0 - 1 */ - const SKP_int search_thres2_Q15, /* I Final threshold for lag candidates 0 - 1 */ - const SKP_int Fs_kHz, /* I Sample frequency (kHz) */ - const SKP_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ - const SKP_int nb_subfr /* I number of 5 ms subframes */ +opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ + const opus_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ + opus_int *pitch_out, /* O 4 pitch lag values */ + opus_int16 *lagIndex, /* O Lag Index */ + opus_int8 *contourIndex, /* O Pitch contour Index */ + opus_int *LTPCorr_Q15, /* I/O Normalized correlation; input: value from previous frame */ + opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ + const opus_int32 search_thres1_Q16, /* I First stage threshold for lag candidates 0 - 1 */ + const opus_int search_thres2_Q15, /* I Final threshold for lag candidates 0 - 1 */ + const opus_int Fs_kHz, /* I Sample frequency (kHz) */ + const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ + const opus_int nb_subfr /* I number of 5 ms subframes */ ) { - SKP_int16 signal_8kHz[ PE_MAX_FRAME_LENGTH_ST_2 ]; - SKP_int16 signal_4kHz[ PE_MAX_FRAME_LENGTH_ST_1 ]; - SKP_int32 filt_state[ 6 ]; - SKP_int32 scratch_mem[ 3 * PE_MAX_FRAME_LENGTH ]; - SKP_int16 *input_signal_ptr; - SKP_int i, k, d, j; - SKP_int16 C[ PE_MAX_NB_SUBFR ][ ( PE_MAX_LAG >> 1 ) + 5 ]; - const SKP_int16 *target_ptr, *basis_ptr; - SKP_int32 cross_corr, normalizer, energy, shift, energy_basis, energy_target; - SKP_int d_srch[ PE_D_SRCH_LENGTH ], Cmax, length_d_srch, length_d_comp; - SKP_int16 d_comp[ ( PE_MAX_LAG >> 1 ) + 5 ]; - SKP_int32 sum, threshold, temp32, lag_counter; - SKP_int CBimax, CBimax_new, CBimax_old, lag, start_lag, end_lag, lag_new; - SKP_int32 CC[ PE_NB_CBKS_STAGE2_EXT ], CCmax, CCmax_b, CCmax_new_b, CCmax_new; - SKP_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; - SKP_int32 crosscorr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; - SKP_int frame_length, frame_length_8kHz, frame_length_4kHz, max_sum_sq_length; - SKP_int sf_length, sf_length_8kHz, sf_length_4kHz; - SKP_int min_lag, min_lag_8kHz, min_lag_4kHz; - SKP_int max_lag, max_lag_8kHz, max_lag_4kHz; - SKP_int32 contour_bias_Q20, diff, lz, lshift; - SKP_int nb_cbk_search, cbk_size; - SKP_int32 delta_lag_log2_sqr_Q7, lag_log2_Q7, prevLag_log2_Q7, prev_lag_bias_Q15, corr_thres_Q15; - const SKP_int8 *Lag_CB_ptr; + opus_int16 signal_8kHz[ PE_MAX_FRAME_LENGTH_ST_2 ]; + opus_int16 signal_4kHz[ PE_MAX_FRAME_LENGTH_ST_1 ]; + opus_int32 filt_state[ 6 ]; + opus_int32 scratch_mem[ 3 * PE_MAX_FRAME_LENGTH ]; + opus_int16 *input_signal_ptr; + opus_int i, k, d, j; + opus_int16 C[ PE_MAX_NB_SUBFR ][ ( PE_MAX_LAG >> 1 ) + 5 ]; + const opus_int16 *target_ptr, *basis_ptr; + opus_int32 cross_corr, normalizer, energy, shift, energy_basis, energy_target; + opus_int d_srch[ PE_D_SRCH_LENGTH ], Cmax, length_d_srch, length_d_comp; + opus_int16 d_comp[ ( PE_MAX_LAG >> 1 ) + 5 ]; + opus_int32 sum, threshold, temp32, lag_counter; + opus_int CBimax, CBimax_new, CBimax_old, lag, start_lag, end_lag, lag_new; + opus_int32 CC[ PE_NB_CBKS_STAGE2_EXT ], CCmax, CCmax_b, CCmax_new_b, CCmax_new; + opus_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; + opus_int32 crosscorr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; + opus_int frame_length, frame_length_8kHz, frame_length_4kHz, max_sum_sq_length; + opus_int sf_length, sf_length_8kHz, sf_length_4kHz; + opus_int min_lag, min_lag_8kHz, min_lag_4kHz; + opus_int max_lag, max_lag_8kHz, max_lag_4kHz; + opus_int32 contour_bias_Q20, diff, lz, lshift; + opus_int nb_cbk_search, cbk_size; + opus_int32 delta_lag_log2_sqr_Q7, lag_log2_Q7, prevLag_log2_Q7, prev_lag_bias_Q15, corr_thres_Q15; + const opus_int8 *Lag_CB_ptr; /* Check for valid sampling frequency */ SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); @@ -126,22 +126,22 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u max_lag_4kHz = PE_MAX_LAG_MS * 4; max_lag_8kHz = PE_MAX_LAG_MS * 8 - 1; - SKP_memset( C, 0, sizeof( SKP_int16 ) * nb_subfr * ( ( PE_MAX_LAG >> 1 ) + 5) ); + SKP_memset( C, 0, sizeof( opus_int16 ) * nb_subfr * ( ( PE_MAX_LAG >> 1 ) + 5) ); /* Resample from input sampled at Fs_kHz to 8 kHz */ if( Fs_kHz == 16 ) { - SKP_memset( filt_state, 0, 2 * sizeof( SKP_int32 ) ); + SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); silk_resampler_down2( filt_state, signal_8kHz, signal, frame_length ); } else if ( Fs_kHz == 12 ) { - SKP_memset( filt_state, 0, 6 * sizeof( SKP_int32 ) ); + SKP_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); silk_resampler_down2_3( filt_state, signal_8kHz, signal, frame_length ); } else { SKP_assert( Fs_kHz == 8 ); - SKP_memcpy( signal_8kHz, signal, frame_length_8kHz * sizeof(SKP_int16) ); + SKP_memcpy( signal_8kHz, signal, frame_length_8kHz * sizeof(opus_int16) ); } /* Decimate again to 4 kHz */ - SKP_memset( filt_state, 0, 2 * sizeof( SKP_int32 ) );/* Set state to zero */ + SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );/* Set state to zero */ silk_resampler_down2( filt_state, signal_4kHz, signal_8kHz, frame_length_8kHz ); /* Low-pass filter */ @@ -186,7 +186,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u normalizer = SKP_ADD_SAT32( normalizer, SKP_SMULBB( sf_length_8kHz, 4000 ) ); temp32 = SKP_DIV32( cross_corr, silk_SQRT_APPROX( normalizer ) + 1 ); - C[ k ][ min_lag_4kHz ] = (SKP_int16)SKP_SAT16( temp32 ); /* Q0 */ + C[ k ][ min_lag_4kHz ] = (opus_int16)SKP_SAT16( temp32 ); /* Q0 */ /* From now on normalizer is computed recursively */ for( d = min_lag_4kHz + 1; d <= max_lag_4kHz; d++ ) { @@ -204,7 +204,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u SKP_SMULBB( basis_ptr[ sf_length_8kHz ], basis_ptr[ sf_length_8kHz ] ); temp32 = SKP_DIV32( cross_corr, silk_SQRT_APPROX( normalizer ) + 1 ); - C[ k ][ d ] = (SKP_int16)SKP_SAT16( temp32 ); /* Q0 */ + C[ k ][ d ] = (opus_int16)SKP_SAT16( temp32 ); /* Q0 */ } /* Update target pointer */ target_ptr += sf_length_8kHz; @@ -213,20 +213,20 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u /* Combine two subframes into single correlation measure and apply short-lag bias */ if( nb_subfr == PE_MAX_NB_SUBFR ) { for( i = max_lag_4kHz; i >= min_lag_4kHz; i-- ) { - sum = (SKP_int32)C[ 0 ][ i ] + (SKP_int32)C[ 1 ][ i ]; /* Q0 */ + sum = (opus_int32)C[ 0 ][ i ] + (opus_int32)C[ 1 ][ i ]; /* Q0 */ SKP_assert( SKP_RSHIFT( sum, 1 ) == SKP_SAT16( SKP_RSHIFT( sum, 1 ) ) ); sum = SKP_RSHIFT( sum, 1 ); /* Q-1 */ - SKP_assert( SKP_LSHIFT( (SKP_int32)-i, 4 ) == SKP_SAT16( SKP_LSHIFT( (SKP_int32)-i, 4 ) ) ); + SKP_assert( SKP_LSHIFT( (opus_int32)-i, 4 ) == SKP_SAT16( SKP_LSHIFT( (opus_int32)-i, 4 ) ) ); sum = SKP_SMLAWB( sum, sum, SKP_LSHIFT( -i, 4 ) ); /* Q-1 */ SKP_assert( sum == SKP_SAT16( sum ) ); - C[ 0 ][ i ] = (SKP_int16)sum; /* Q-1 */ + C[ 0 ][ i ] = (opus_int16)sum; /* Q-1 */ } } else { /* Only short-lag bias */ for( i = max_lag_4kHz; i >= min_lag_4kHz; i-- ) { - sum = (SKP_int32)C[ 0 ][ i ]; + sum = (opus_int32)C[ 0 ][ i ]; sum = SKP_SMLAWB( sum, sum, SKP_LSHIFT( -i, 4 ) ); /* Q-1 */ - C[ 0 ][ i ] = (SKP_int16)sum; /* Q-1 */ + C[ 0 ][ i ] = (opus_int16)sum; /* Q-1 */ } } @@ -239,12 +239,12 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u target_ptr = &signal_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ]; energy = silk_inner_prod_aligned( target_ptr, target_ptr, SKP_LSHIFT( sf_length_4kHz, 2 ) ); energy = SKP_ADD_SAT32( energy, 1000 ); /* Q0 */ - Cmax = (SKP_int)C[ 0 ][ min_lag_4kHz ]; /* Q-1 */ + Cmax = (opus_int)C[ 0 ][ min_lag_4kHz ]; /* Q-1 */ threshold = SKP_SMULBB( Cmax, Cmax ); /* Q-2 */ /* Compare in Q-2 domain */ if( SKP_RSHIFT( energy, 4 + 2 ) > threshold ) { - SKP_memset( pitch_out, 0, nb_subfr * sizeof( SKP_int ) ); + SKP_memset( pitch_out, 0, nb_subfr * sizeof( opus_int ) ); *LTPCorr_Q15 = 0; *lagIndex = 0; *contourIndex = 0; @@ -314,7 +314,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u /********************************************************************************* * Find energy of each subframe projected onto its history, for a range of delays *********************************************************************************/ - SKP_memset( C, 0, PE_MAX_NB_SUBFR * ( ( PE_MAX_LAG >> 1 ) + 5 ) * sizeof( SKP_int16 ) ); + SKP_memset( C, 0, PE_MAX_NB_SUBFR * ( ( PE_MAX_LAG >> 1 ) + 5 ) * sizeof( opus_int16 ) ); target_ptr = &signal_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ]; for( k = 0; k < nb_subfr; k++ ) { @@ -369,7 +369,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u } else if( Fs_kHz == 16 ) { prevLag = SKP_RSHIFT( prevLag, 1 ); } - prevLag_log2_Q7 = silk_lin2log( (SKP_int32)prevLag ); + prevLag_log2_Q7 = silk_lin2log( (opus_int32)prevLag ); } else { prevLag_log2_Q7 = 0; } @@ -398,7 +398,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u CC[ j ] = 0; for( i = 0; i < nb_subfr; i++ ) { /* Try all codebooks */ - CC[ j ] = CC[ j ] + (SKP_int32)C[ i ][ d + matrix_ptr( Lag_CB_ptr, i, j, cbk_size )]; + CC[ j ] = CC[ j ] + (opus_int32)C[ i ][ d + matrix_ptr( Lag_CB_ptr, i, j, cbk_size )]; } } /* Find best codebook */ @@ -412,7 +412,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u } /* Bias towards shorter lags */ - lag_log2_Q7 = silk_lin2log( (SKP_int32)d ); /* Q7 */ + lag_log2_Q7 = silk_lin2log( (opus_int32)d ); /* Q7 */ SKP_assert( lag_log2_Q7 == SKP_SAT16( lag_log2_Q7 ) ); SKP_assert( nb_subfr * SILK_FIX_CONST( PE_SHORTLAG_BIAS, 15 ) == SKP_SAT16( nb_subfr * SILK_FIX_CONST( PE_SHORTLAG_BIAS, 15 ) ) ); CCmax_new_b = CCmax_new - SKP_RSHIFT( SKP_SMULBB( nb_subfr * SILK_FIX_CONST( PE_SHORTLAG_BIAS, 15 ), lag_log2_Q7 ), 7 ); /* Q15 */ @@ -441,7 +441,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u if( lag == -1 ) { /* No suitable candidate found */ - SKP_memset( pitch_out, 0, nb_subfr * sizeof( SKP_int ) ); + SKP_memset( pitch_out, 0, nb_subfr * sizeof( opus_int ) ); *LTPCorr_Q15 = 0; *lagIndex = 0; *contourIndex = 0; @@ -458,12 +458,12 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u if( shift > 0 ) { /* Move signal to scratch mem because the input signal should be unchanged */ /* Reuse the 32 bit scratch mem vector, use a 16 bit pointer from now */ - input_signal_ptr = (SKP_int16*)scratch_mem; + input_signal_ptr = (opus_int16*)scratch_mem; for( i = 0; i < frame_length; i++ ) { input_signal_ptr[ i ] = SKP_RSHIFT( signal[ i ], shift ); } } else { - input_signal_ptr = (SKP_int16*)signal; + input_signal_ptr = (opus_int16*)signal; } /*********************************************************************************/ @@ -486,7 +486,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u lag_new = lag; /* to avoid undefined lag */ CBimax = 0; /* to avoid undefined lag */ SKP_assert( SKP_LSHIFT( CCmax, 13 ) >= 0 ); - *LTPCorr_Q15 = (SKP_int)silk_SQRT_APPROX( SKP_LSHIFT( CCmax, 13 ) ); /* Output normalized correlation */ + *LTPCorr_Q15 = (opus_int)silk_SQRT_APPROX( SKP_LSHIFT( CCmax, 13 ) ); /* Output normalized correlation */ CCmax = SKP_int32_MIN; /* pitch lags according to second stage */ @@ -503,7 +503,7 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u /* Setup cbk parameters acording to complexity setting and frame length */ if( nb_subfr == PE_MAX_NB_SUBFR ) { - nb_cbk_search = (SKP_int)silk_nb_cbk_searchs_stage3[ complexity ]; + nb_cbk_search = (opus_int)silk_nb_cbk_searchs_stage3[ complexity ]; cbk_size = PE_NB_CBKS_STAGE3_MAX; Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ]; } else { @@ -557,17 +557,17 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u for( k = 0; k < nb_subfr; k++ ) { pitch_out[ k ] = lag_new + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size ); } - *lagIndex = (SKP_int16)( lag_new - min_lag); - *contourIndex = (SKP_int8)CBimax; + *lagIndex = (opus_int16)( lag_new - min_lag); + *contourIndex = (opus_int8)CBimax; } else { /* Save Lags and correlation */ CCmax = SKP_max( CCmax, 0 ); - *LTPCorr_Q15 = (SKP_int)silk_SQRT_APPROX( SKP_LSHIFT( CCmax, 13 ) ); /* Output normalized correlation */ + *LTPCorr_Q15 = (opus_int)silk_SQRT_APPROX( SKP_LSHIFT( CCmax, 13 ) ); /* Output normalized correlation */ for( k = 0; k < nb_subfr; k++ ) { pitch_out[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size ); } - *lagIndex = (SKP_int16)( lag - min_lag_8kHz ); - *contourIndex = (SKP_int8)CBimax; + *lagIndex = (opus_int16)( lag - min_lag_8kHz ); + *contourIndex = (opus_int8)CBimax; } SKP_assert( *lagIndex >= 0 ); /* return as voiced */ @@ -579,20 +579,20 @@ SKP_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 u /* the whole lag codebook for all the searched offset lags (lag +- 2), */ /*************************************************************************/ void silk_P_Ana_calc_corr_st3( - SKP_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */ - const SKP_int16 signal[], /* I vector to correlate */ - SKP_int start_lag, /* I lag offset to search around */ - SKP_int sf_length, /* I length of a 5 ms subframe */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */ + const opus_int16 signal[], /* I vector to correlate */ + opus_int start_lag, /* I lag offset to search around */ + opus_int sf_length, /* I length of a 5 ms subframe */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ) { - const SKP_int16 *target_ptr, *basis_ptr; - SKP_int32 cross_corr; - SKP_int i, j, k, lag_counter, lag_low, lag_high; - SKP_int nb_cbk_search, delta, idx, cbk_size; - SKP_int32 scratch_mem[ SCRATCH_SIZE ]; - const SKP_int8 *Lag_range_ptr, *Lag_CB_ptr; + const opus_int16 *target_ptr, *basis_ptr; + opus_int32 cross_corr; + opus_int i, j, k, lag_counter, lag_low, lag_high; + opus_int nb_cbk_search, delta, idx, cbk_size; + opus_int32 scratch_mem[ SCRATCH_SIZE ]; + const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; SKP_assert( complexity >= SILK_PE_MIN_COMPLEX ); SKP_assert( complexity <= SILK_PE_MAX_COMPLEX ); @@ -619,7 +619,7 @@ void silk_P_Ana_calc_corr_st3( lag_high = matrix_ptr( Lag_range_ptr, k, 1, 2 ); for( j = lag_low; j <= lag_high; j++ ) { basis_ptr = target_ptr - ( start_lag + j ); - cross_corr = silk_inner_prod_aligned( (SKP_int16*)target_ptr, (SKP_int16*)basis_ptr, sf_length ); + cross_corr = silk_inner_prod_aligned( (opus_int16*)target_ptr, (opus_int16*)basis_ptr, sf_length ); SKP_assert( lag_counter < SCRATCH_SIZE ); scratch_mem[ lag_counter ] = cross_corr; lag_counter++; @@ -645,20 +645,20 @@ void silk_P_Ana_calc_corr_st3( /* calculated recursively. */ /********************************************************************/ void silk_P_Ana_calc_energy_st3( - SKP_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */ - const SKP_int16 signal[], /* I vector to calc energy in */ - SKP_int start_lag, /* I lag offset to search around */ - SKP_int sf_length, /* I length of one 5 ms subframe */ - SKP_int nb_subfr, /* I number of subframes */ - SKP_int complexity /* I Complexity setting */ + opus_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */ + const opus_int16 signal[], /* I vector to calc energy in */ + opus_int start_lag, /* I lag offset to search around */ + opus_int sf_length, /* I length of one 5 ms subframe */ + opus_int nb_subfr, /* I number of subframes */ + opus_int complexity /* I Complexity setting */ ) { - const SKP_int16 *target_ptr, *basis_ptr; - SKP_int32 energy; - SKP_int k, i, j, lag_counter; - SKP_int nb_cbk_search, delta, idx, cbk_size, lag_diff; - SKP_int32 scratch_mem[ SCRATCH_SIZE ]; - const SKP_int8 *Lag_range_ptr, *Lag_CB_ptr; + const opus_int16 *target_ptr, *basis_ptr; + opus_int32 energy; + opus_int k, i, j, lag_counter; + opus_int nb_cbk_search, delta, idx, cbk_size, lag_diff; + opus_int32 scratch_mem[ SCRATCH_SIZE ]; + const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; SKP_assert( complexity >= SILK_PE_MIN_COMPLEX ); SKP_assert( complexity <= SILK_PE_MAX_COMPLEX ); @@ -716,13 +716,13 @@ void silk_P_Ana_calc_energy_st3( } } -SKP_int32 silk_P_Ana_find_scaling( - const SKP_int16 *signal, - const SKP_int signal_length, - const SKP_int sum_sqr_len +opus_int32 silk_P_Ana_find_scaling( + const opus_int16 *signal, + const opus_int signal_length, + const opus_int sum_sqr_len ) { - SKP_int32 nbits, x_max; + opus_int32 nbits, x_max; x_max = silk_int16_array_maxabs( signal, signal_length ); diff --git a/silk/silk_pitch_est_defines.h b/silk/silk_pitch_est_defines.h index 537d1b391206e846bb35b51013807129f86a4a80..1a6edb66f1cd1a179acd5fcf4b13345f2e5dc04f 100644 --- a/silk/silk_pitch_est_defines.h +++ b/silk/silk_pitch_est_defines.h @@ -73,15 +73,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define PE_PREVLAG_BIAS 0.2f /* for logarithmic weighting */ #define PE_FLATCONTOUR_BIAS 0.05f -extern const SKP_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ]; -extern const SKP_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ]; -extern const SKP_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBFR ][ 2 ]; -extern const SKP_int8 silk_nb_cbk_searchs_stage3[ SILK_PE_MAX_COMPLEX + 1 ]; +extern const opus_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ]; +extern const opus_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ]; +extern const opus_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBFR ][ 2 ]; +extern const opus_int8 silk_nb_cbk_searchs_stage3[ SILK_PE_MAX_COMPLEX + 1 ]; /* Tables added for 10 ms frames */ -extern const SKP_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ 3 ]; -extern const SKP_int8 silk_CB_lags_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 12 ]; -extern const SKP_int8 silk_Lag_range_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 2 ]; +extern const opus_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ 3 ]; +extern const opus_int8 silk_CB_lags_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 12 ]; +extern const opus_int8 silk_Lag_range_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 2 ]; #endif diff --git a/silk/silk_pitch_est_tables.c b/silk/silk_pitch_est_tables.c index 1c005308dcb8ff0d97db981e897e7e6910d4707e..5a4c3585666abd060e74e84d8e7e2cd4978357bb 100644 --- a/silk/silk_pitch_est_tables.c +++ b/silk/silk_pitch_est_tables.c @@ -28,25 +28,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_typedef.h" #include "silk_pitch_est_defines.h" -const SKP_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ PE_NB_CBKS_STAGE2_10MS ] = +const opus_int8 silk_CB_lags_stage2_10_ms[ PE_MAX_NB_SUBFR >> 1][ PE_NB_CBKS_STAGE2_10MS ] = { {0, 1, 0}, {0, 0, 1} }; -const SKP_int8 silk_CB_lags_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ PE_NB_CBKS_STAGE3_10MS ] = +const opus_int8 silk_CB_lags_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ PE_NB_CBKS_STAGE3_10MS ] = { { 0, 0, 1,-1, 1,-1, 2,-2, 2,-2, 3,-3}, { 0, 1, 0, 1,-1, 2,-1, 2,-2, 3,-2, 3} }; -const SKP_int8 silk_Lag_range_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 2 ] = +const opus_int8 silk_Lag_range_stage3_10_ms[ PE_MAX_NB_SUBFR >> 1 ][ 2 ] = { {-3, 7}, {-2, 7} }; -const SKP_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ] = +const opus_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ] = { {0, 2,-1,-1,-1, 0, 0, 1, 1, 0, 1}, {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0}, @@ -54,7 +54,7 @@ const SKP_int8 silk_CB_lags_stage2[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE2_EXT ] = {0,-1, 2, 1, 0, 1, 1, 0, 0,-1,-1} }; -const SKP_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ] = +const opus_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ] = { {0, 0, 1,-1, 0, 1,-1, 0,-1, 1,-2, 2,-2,-2, 2,-3, 2, 3,-3,-4, 3,-4, 4, 4,-5, 5,-6,-5, 6,-7, 6, 5, 8,-9}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1,-1, 0, 1,-1,-1, 1,-1, 2, 1,-1, 2,-2,-2, 2,-2, 2, 2, 3,-3}, @@ -62,7 +62,7 @@ const SKP_int8 silk_CB_lags_stage3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ] = {0, 1, 0, 0, 1, 0, 1,-1, 2,-1, 2,-1, 2, 3,-2, 3,-2,-2, 4, 4,-3, 5,-3,-4, 6,-4, 6, 5,-5, 8,-6,-5,-7, 9} }; -const SKP_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBFR ][ 2 ] = +const opus_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBFR ][ 2 ] = { /* Lags to search for low number of stage3 cbks */ { @@ -87,7 +87,7 @@ const SKP_int8 silk_Lag_range_stage3[ SILK_PE_MAX_COMPLEX + 1 ] [ PE_MAX_NB_SUBF } }; -const SKP_int8 silk_nb_cbk_searchs_stage3[ SILK_PE_MAX_COMPLEX + 1 ] = +const opus_int8 silk_nb_cbk_searchs_stage3[ SILK_PE_MAX_COMPLEX + 1 ] = { PE_NB_CBKS_STAGE3_MIN, PE_NB_CBKS_STAGE3_MID, diff --git a/silk/silk_process_NLSFs.c b/silk/silk_process_NLSFs.c index 392e8a344512d4d33fd5b235875d87e935cdd02c..57329c4e76a2f81873d085e35df7ab40eafe3521 100644 --- a/silk/silk_process_NLSFs.c +++ b/silk/silk_process_NLSFs.c @@ -30,17 +30,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Limit, stabilize, convert and quantize NLSFs */ void silk_process_NLSFs( silk_encoder_state *psEncC, /* I/O Encoder state */ - SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ - SKP_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ - const SKP_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ + opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ + opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ + const opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ ) { - SKP_int i, doInterpolate; - SKP_int NLSF_mu_Q20; - SKP_int32 i_sqr_Q15; - SKP_int16 pNLSF0_temp_Q15[ MAX_LPC_ORDER ]; - SKP_int16 pNLSFW_QW[ MAX_LPC_ORDER ]; - SKP_int16 pNLSFW0_temp_QW[ MAX_LPC_ORDER ]; + opus_int i, doInterpolate; + opus_int NLSF_mu_Q20; + opus_int32 i_sqr_Q15; + opus_int16 pNLSF0_temp_Q15[ MAX_LPC_ORDER ]; + opus_int16 pNLSFW_QW[ MAX_LPC_ORDER ]; + opus_int16 pNLSFW0_temp_QW[ MAX_LPC_ORDER ]; SKP_assert( psEncC->speech_activity_Q8 >= 0 ); SKP_assert( psEncC->speech_activity_Q8 <= SILK_FIX_CONST( 1.0, 8 ) ); @@ -98,6 +98,6 @@ void silk_process_NLSFs( } else { /* Copy LPC coefficients for first half from second half */ - SKP_memcpy( PredCoef_Q12[ 0 ], PredCoef_Q12[ 1 ], psEncC->predictLPCOrder * sizeof( SKP_int16 ) ); + SKP_memcpy( PredCoef_Q12[ 0 ], PredCoef_Q12[ 1 ], psEncC->predictLPCOrder * sizeof( opus_int16 ) ); } } diff --git a/silk/silk_quant_LTP_gains.c b/silk/silk_quant_LTP_gains.c index 27be18ecb5b7343095d0188a17927049aa0f46f3..6d68ead3b3e7c02b6a919cae1422e28b64a2abf2 100644 --- a/silk/silk_quant_LTP_gains.c +++ b/silk/silk_quant_LTP_gains.c @@ -28,22 +28,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main.h" void silk_quant_LTP_gains( - SKP_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ - SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ - SKP_int8 *periodicity_index, /* O Periodicity Index */ - const SKP_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ - SKP_int mu_Q9, /* I Mu value (R/D tradeoff) */ - SKP_int lowComplexity, /* I Flag for low complexity */ - const SKP_int nb_subfr /* I number of subframes */ + opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ + opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ + opus_int8 *periodicity_index, /* O Periodicity Index */ + const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ + opus_int mu_Q9, /* I Mu value (R/D tradeoff) */ + opus_int lowComplexity, /* I Flag for low complexity */ + const opus_int nb_subfr /* I number of subframes */ ) { - SKP_int j, k, cbk_size; - SKP_int8 temp_idx[ MAX_NB_SUBFR ]; - const SKP_uint8 *cl_ptr_Q5; - const SKP_int8 *cbk_ptr_Q7; - const SKP_int16 *b_Q14_ptr; - const SKP_int32 *W_Q18_ptr; - SKP_int32 rate_dist_Q14_subfr, rate_dist_Q14, min_rate_dist_Q14; + opus_int j, k, cbk_size; + opus_int8 temp_idx[ MAX_NB_SUBFR ]; + const opus_uint8 *cl_ptr_Q5; + const opus_int8 *cbk_ptr_Q7; + const opus_int16 *b_Q14_ptr; + const opus_int32 *W_Q18_ptr; + opus_int32 rate_dist_Q14_subfr, rate_dist_Q14, min_rate_dist_Q14; TIC(quant_LTP) @@ -86,8 +86,8 @@ TIC(quant_LTP) if( rate_dist_Q14 < min_rate_dist_Q14 ) { min_rate_dist_Q14 = rate_dist_Q14; - *periodicity_index = (SKP_int8)k; - SKP_memcpy( cbk_index, temp_idx, nb_subfr * sizeof( SKP_int8 ) ); + *periodicity_index = (opus_int8)k; + SKP_memcpy( cbk_index, temp_idx, nb_subfr * sizeof( opus_int8 ) ); } /* Break early in low-complexity mode if rate distortion is below threshold */ diff --git a/silk/silk_resampler.c b/silk/silk_resampler.c index 232c172b6485f57e9aff58d5dbe6953b57332aa8..1f3d2f0b3012d5483ddd1396a93a73f856cbda7b 100644 --- a/silk/silk_resampler.c +++ b/silk/silk_resampler.c @@ -54,12 +54,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_resampler_private.h" /* Greatest common divisor */ -static SKP_int32 gcd( - SKP_int32 a, - SKP_int32 b +static opus_int32 gcd( + opus_int32 a, + opus_int32 b ) { - SKP_int32 tmp; + opus_int32 tmp; while( b > 0 ) { tmp = a - b * SKP_DIV32( a, b ); a = b; @@ -69,13 +69,13 @@ static SKP_int32 gcd( } /* Initialize/reset the resampler state for a given pair of input/output sampling rates */ -SKP_int silk_resampler_init( +opus_int silk_resampler_init( silk_resampler_state_struct *S, /* I/O: Resampler state */ - SKP_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */ - SKP_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */ + opus_int32 Fs_Hz_in, /* I: Input sampling rate (Hz) */ + opus_int32 Fs_Hz_out /* I: Output sampling rate (Hz) */ ) { - SKP_int32 cycleLen, cyclesPerBatch, up2 = 0, down2 = 0; + opus_int32 cycleLen, cyclesPerBatch, up2 = 0, down2 = 0; /* Clear state */ SKP_memset( S, 0, sizeof( silk_resampler_state_struct ) ); @@ -243,7 +243,7 @@ SKP_int silk_resampler_init( } /* Clear the states of all resampling filters, without resetting sampling rate ratio */ -SKP_int silk_resampler_clear( +opus_int silk_resampler_clear( silk_resampler_state_struct *S /* I/O: Resampler state */ ) { @@ -259,11 +259,11 @@ SKP_int silk_resampler_clear( } /* Resampler: convert from one sampling rate to another */ -SKP_int silk_resampler( +opus_int silk_resampler( silk_resampler_state_struct *S, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ) { /* Verify that state was initialized and has not been corrupted */ @@ -275,8 +275,8 @@ SKP_int silk_resampler( #if RESAMPLER_SUPPORT_ABOVE_48KHZ if( S->nPreDownsamplers + S->nPostUpsamplers > 0 ) { /* The input and/or output sampling rate is above 48000 Hz */ - SKP_int32 nSamplesIn, nSamplesOut; - SKP_int16 in_buf[ 480 ], out_buf[ 480 ]; + opus_int32 nSamplesIn, nSamplesOut; + opus_int16 in_buf[ 480 ], out_buf[ 480 ]; while( inLen > 0 ) { /* Number of input and output samples to process */ diff --git a/silk/silk_resampler_down2.c b/silk/silk_resampler_down2.c index 4d952ec56333c49b30c1e138905c52a249ae144f..0f950e5743c1ca445a7eb7c67a5542b9def6e340 100644 --- a/silk/silk_resampler_down2.c +++ b/silk/silk_resampler_down2.c @@ -30,14 +30,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Downsample by a factor 2, mediocre quality */ void silk_resampler_down2( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ len ] */ - const SKP_int16 *in, /* I: Input signal [ floor(len/2) ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ len ] */ + const opus_int16 *in, /* I: Input signal [ floor(len/2) ] */ + opus_int32 inLen /* I: Number of input samples */ ) { - SKP_int32 k, len2 = SKP_RSHIFT32( inLen, 1 ); - SKP_int32 in32, out32, Y, X; + opus_int32 k, len2 = SKP_RSHIFT32( inLen, 1 ); + opus_int32 in32, out32, Y, X; SKP_assert( silk_resampler_down2_0 > 0 ); SKP_assert( silk_resampler_down2_1 < 0 ); @@ -45,7 +45,7 @@ void silk_resampler_down2( /* Internal variables and state are in Q10 format */ for( k = 0; k < len2; k++ ) { /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ 2 * k ], 10 ); /* All-pass section for even input sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -54,7 +54,7 @@ void silk_resampler_down2( S[ 0 ] = SKP_ADD32( in32, X ); /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k + 1 ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ 2 * k + 1 ], 10 ); /* All-pass section for odd input sample, and add to output of previous section */ Y = SKP_SUB32( in32, S[ 1 ] ); @@ -64,7 +64,7 @@ void silk_resampler_down2( S[ 1 ] = SKP_ADD32( in32, X ); /* Add, convert back to int16 and store to output */ - out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 11 ) ); + out[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 11 ) ); } } diff --git a/silk/silk_resampler_down2_3.c b/silk/silk_resampler_down2_3.c index 42abad5bb20b72309a4833c7b3ca10bd1477f801..6a6af23903910c4fc955f6db0eac0c3c06eff3a2 100644 --- a/silk/silk_resampler_down2_3.c +++ b/silk/silk_resampler_down2_3.c @@ -32,18 +32,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Downsample by a factor 2/3, low quality */ void silk_resampler_down2_3( - SKP_int32 *S, /* I/O: State vector [ 6 ] */ - SKP_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */ - const SKP_int16 *in, /* I: Input signal [ inLen ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 6 ] */ + opus_int16 *out, /* O: Output signal [ floor(2*inLen/3) ] */ + const opus_int16 *in, /* I: Input signal [ inLen ] */ + opus_int32 inLen /* I: Number of input samples */ ) { - SKP_int32 nSamplesIn, counter, res_Q6; - SKP_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ]; - SKP_int32 *buf_ptr; + opus_int32 nSamplesIn, counter, res_Q6; + opus_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ]; + opus_int32 *buf_ptr; /* Copy buffered samples to start of buffer */ - SKP_memcpy( buf, S, ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, S, ORDER_FIR * sizeof( opus_int32 ) ); /* Iterate over blocks of frameSizeIn input samples */ while( 1 ) { @@ -64,7 +64,7 @@ void silk_resampler_down2_3( res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 3 ], silk_Resampler_2_3_COEFS_LQ[ 4 ] ); /* Scale down, saturate and store in output array */ - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); res_Q6 = SKP_SMULWB( buf_ptr[ 1 ], silk_Resampler_2_3_COEFS_LQ[ 4 ] ); res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 2 ], silk_Resampler_2_3_COEFS_LQ[ 5 ] ); @@ -72,7 +72,7 @@ void silk_resampler_down2_3( res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 4 ], silk_Resampler_2_3_COEFS_LQ[ 2 ] ); /* Scale down, saturate and store in output array */ - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); buf_ptr += 3; counter -= 3; @@ -83,12 +83,12 @@ void silk_resampler_down2_3( if( inLen > 0 ) { /* More iterations to do; copy last part of filtered signal to beginning of buffer */ - SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) ); } else { break; } } /* Copy last part of filtered signal to the state for the next call */ - SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) ); } diff --git a/silk/silk_resampler_down3.c b/silk/silk_resampler_down3.c index cf445f764aff3cd275cda1a96d4568fe54b97453..58169d5e88ff33d9cdb5e51124bea037204c3a0a 100644 --- a/silk/silk_resampler_down3.c +++ b/silk/silk_resampler_down3.c @@ -32,18 +32,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Downsample by a factor 3, low quality */ void silk_resampler_down3( - SKP_int32 *S, /* I/O: State vector [ 8 ] */ - SKP_int16 *out, /* O: Output signal [ floor(inLen/3) ] */ - const SKP_int16 *in, /* I: Input signal [ inLen ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 8 ] */ + opus_int16 *out, /* O: Output signal [ floor(inLen/3) ] */ + const opus_int16 *in, /* I: Input signal [ inLen ] */ + opus_int32 inLen /* I: Number of input samples */ ) { - SKP_int32 nSamplesIn, counter, res_Q6; - SKP_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ]; - SKP_int32 *buf_ptr; + opus_int32 nSamplesIn, counter, res_Q6; + opus_int32 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + ORDER_FIR ]; + opus_int32 *buf_ptr; /* Copy buffered samples to start of buffer */ - SKP_memcpy( buf, S, ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, S, ORDER_FIR * sizeof( opus_int32 ) ); /* Iterate over blocks of frameSizeIn input samples */ while( 1 ) { @@ -63,7 +63,7 @@ void silk_resampler_down3( res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 2 ], buf_ptr[ 3 ] ), silk_Resampler_1_3_COEFS_LQ[ 4 ] ); /* Scale down, saturate and store in output array */ - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); buf_ptr += 3; counter -= 3; @@ -74,12 +74,12 @@ void silk_resampler_down3( if( inLen > 0 ) { /* More iterations to do; copy last part of filtered signal to beginning of buffer */ - SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) ); } else { break; } } /* Copy last part of filtered signal to the state for the next call */ - SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( S, &buf[ nSamplesIn ], ORDER_FIR * sizeof( opus_int32 ) ); } diff --git a/silk/silk_resampler_private.h b/silk/silk_resampler_private.h index fc973816f2ed0b169df1e565bc4c677ca7c7964f..f69b8ea463671887f9f48a91669238105ad8e4c9 100644 --- a/silk/silk_resampler_private.h +++ b/silk/silk_resampler_private.h @@ -42,75 +42,75 @@ extern "C" { /* Description: Hybrid IIR/FIR polyphase implementation of resampling */ void silk_resampler_private_IIR_FIR( void *SS, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ); /* Description: Hybrid IIR/FIR polyphase implementation of resampling */ void silk_resampler_private_down_FIR( void *SS, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ); /* Copy */ void silk_resampler_private_copy( void *SS, /* I/O: Resampler state (unused) */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ); /* Upsample by a factor 2, high quality */ void silk_resampler_private_up2_HQ_wrapper( void *SS, /* I/O: Resampler state (unused) */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ); /* Upsample by a factor 2, high quality */ void silk_resampler_private_up2_HQ( - SKP_int32 *S, /* I/O: Resampler state [ 6 ] */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int32 *S, /* I/O: Resampler state [ 6 ] */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ); /* Upsample 4x, low quality */ void silk_resampler_private_up4( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ 4 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ 4 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ); /* Downsample 4x, low quality */ void silk_resampler_private_down4( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ floor(len/2) ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ floor(len/2) ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 inLen /* I: Number of input samples */ ); /* Second order AR filter */ void silk_resampler_private_AR2( - SKP_int32 S[], /* I/O: State vector [ 2 ] */ - SKP_int32 out_Q8[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - const SKP_int16 A_Q14[], /* I: AR coefficients, Q14 */ - SKP_int32 len /* I: Signal length */ + opus_int32 S[], /* I/O: State vector [ 2 ] */ + opus_int32 out_Q8[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */ + opus_int32 len /* I: Signal length */ ); /* Fourth order ARMA filter */ void silk_resampler_private_ARMA4( - SKP_int32 S[], /* I/O: State vector [ 4 ] */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - const SKP_int16 Coef[], /* I: ARMA coefficients [ 7 ] */ - SKP_int32 len /* I: Signal length */ + opus_int32 S[], /* I/O: State vector [ 4 ] */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */ + opus_int32 len /* I: Signal length */ ); diff --git a/silk/silk_resampler_private_AR2.c b/silk/silk_resampler_private_AR2.c index 3279c7ee1b469ad909499ba433bfc27e35244e2a..98d8e21fea344bcd3fb73d981257a0c98cf970dd 100644 --- a/silk/silk_resampler_private_AR2.c +++ b/silk/silk_resampler_private_AR2.c @@ -30,18 +30,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Second order AR filter with single delay elements */ void silk_resampler_private_AR2( - SKP_int32 S[], /* I/O: State vector [ 2 ] */ - SKP_int32 out_Q8[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - const SKP_int16 A_Q14[], /* I: AR coefficients, Q14 */ - SKP_int32 len /* I: Signal length */ + opus_int32 S[], /* I/O: State vector [ 2 ] */ + opus_int32 out_Q8[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + const opus_int16 A_Q14[], /* I: AR coefficients, Q14 */ + opus_int32 len /* I: Signal length */ ) { - SKP_int32 k; - SKP_int32 out32; + opus_int32 k; + opus_int32 out32; for( k = 0; k < len; k++ ) { - out32 = SKP_ADD_LSHIFT32( S[ 0 ], (SKP_int32)in[ k ], 8 ); + out32 = SKP_ADD_LSHIFT32( S[ 0 ], (opus_int32)in[ k ], 8 ); out_Q8[ k ] = out32; out32 = SKP_LSHIFT( out32, 2 ); S[ 0 ] = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] ); diff --git a/silk/silk_resampler_private_ARMA4.c b/silk/silk_resampler_private_ARMA4.c index c277238d84ffa8ff622344c7aa6c446c86801d4f..cfc214077bc4efb7982a37092a29259ef95779dc 100644 --- a/silk/silk_resampler_private_ARMA4.c +++ b/silk/silk_resampler_private_ARMA4.c @@ -36,18 +36,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* where it is assumed that B*_Q14[0], B*_Q14[2], A*_Q14[0] are all 16384 */ void silk_resampler_private_ARMA4( - SKP_int32 S[], /* I/O: State vector [ 4 ] */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - const SKP_int16 Coef[], /* I: ARMA coefficients [ 7 ] */ - SKP_int32 len /* I: Signal length */ + opus_int32 S[], /* I/O: State vector [ 4 ] */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + const opus_int16 Coef[], /* I: ARMA coefficients [ 7 ] */ + opus_int32 len /* I: Signal length */ ) { - SKP_int32 k; - SKP_int32 in_Q8, out1_Q8, out2_Q8, X; + opus_int32 k; + opus_int32 in_Q8, out1_Q8, out2_Q8, X; for( k = 0; k < len; k++ ) { - in_Q8 = SKP_LSHIFT32( (SKP_int32)in[ k ], 8 ); + in_Q8 = SKP_LSHIFT32( (opus_int32)in[ k ], 8 ); /* Outputs of first and second biquad */ out1_Q8 = SKP_ADD_LSHIFT32( in_Q8, S[ 0 ], 2 ); @@ -64,7 +64,7 @@ void silk_resampler_private_ARMA4( S[ 3 ] = SKP_SMLAWB( SKP_RSHIFT32( out1_Q8, 2 ), out2_Q8, Coef[ 5 ] ); /* Apply gain and store to output. The coefficient is in Q16 */ - out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 128, out2_Q8, Coef[ 6 ] ), 8 ) ); + out[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 128, out2_Q8, Coef[ 6 ] ), 8 ) ); } } diff --git a/silk/silk_resampler_private_IIR_FIR.c b/silk/silk_resampler_private_IIR_FIR.c index ba4b9ba35ad8ee338c741d49477e32f7c172fb79..1fcf8f90d8b89aab798ccfd5ed15a07dc7ae0f4d 100644 --- a/silk/silk_resampler_private_IIR_FIR.c +++ b/silk/silk_resampler_private_IIR_FIR.c @@ -28,11 +28,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" #include "silk_resampler_private.h" -SKP_INLINE SKP_int16 *silk_resampler_private_IIR_FIR_INTERPOL( - SKP_int16 * out, SKP_int16 * buf, SKP_int32 max_index_Q16 , SKP_int32 index_increment_Q16 ){ - SKP_int32 index_Q16, res_Q15; - SKP_int16 *buf_ptr; - SKP_int32 table_index; +SKP_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL( + opus_int16 * out, opus_int16 * buf, opus_int32 max_index_Q16 , opus_int32 index_increment_Q16 ){ + opus_int32 index_Q16, res_Q15; + opus_int16 *buf_ptr; + opus_int32 table_index; /* Interpolate upsampled signal and store in output array */ for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) { table_index = SKP_SMULWB( index_Q16 & 0xFFFF, 144 ); @@ -44,26 +44,26 @@ SKP_INLINE SKP_int16 *silk_resampler_private_IIR_FIR_INTERPOL( res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 3 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 2 ] ); res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 4 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 1 ] ); res_Q15 = SKP_SMLABB( res_Q15, buf_ptr[ 5 ], silk_resampler_frac_FIR_144[ 143 - table_index ][ 0 ] ); - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q15, 15 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q15, 15 ) ); } return out; } /* Upsample using a combination of allpass-based 2x upsampling and FIR interpolation */ void silk_resampler_private_IIR_FIR( void *SS, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ) { silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS; - SKP_int32 nSamplesIn; - SKP_int32 max_index_Q16, index_increment_Q16; - SKP_int16 buf[ 2 * RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_ORDER_FIR_144 ]; + opus_int32 nSamplesIn; + opus_int32 max_index_Q16, index_increment_Q16; + opus_int16 buf[ 2 * RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_ORDER_FIR_144 ]; /* Copy buffered samples to start of buffer */ - SKP_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_144 * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) ); /* Iterate over blocks of frameSizeIn input samples */ index_increment_Q16 = S->invRatio_Q16; @@ -85,13 +85,13 @@ void silk_resampler_private_IIR_FIR( if( inLen > 0 ) { /* More iterations to do; copy last part of filtered signal to beginning of buffer */ - SKP_memcpy( buf, &buf[ nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( SKP_int32 ) ); + SKP_memcpy( buf, &buf[ nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) ); } else { break; } } /* Copy last part of filtered signal to the state for the next call */ - SKP_memcpy( S->sFIR, &buf[nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( SKP_int32 ) ); + SKP_memcpy( S->sFIR, &buf[nSamplesIn << S->input2x ], RESAMPLER_ORDER_FIR_144 * sizeof( opus_int32 ) ); } diff --git a/silk/silk_resampler_private_copy.c b/silk/silk_resampler_private_copy.c index 3eb6d6c6d0562bc07df8d13a3fc43993ef0a9343..828e64b85a067eecff6ae987b57824e2eb9b844d 100644 --- a/silk/silk_resampler_private_copy.c +++ b/silk/silk_resampler_private_copy.c @@ -31,10 +31,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Copy */ void silk_resampler_private_copy( void *SS, /* I/O: Resampler state (unused) */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ) { - SKP_memcpy( out, in, inLen * sizeof( SKP_int16 ) ); + SKP_memcpy( out, in, inLen * sizeof( opus_int16 ) ); } diff --git a/silk/silk_resampler_private_down4.c b/silk/silk_resampler_private_down4.c index bdf42dc64ec0b3820c2a89a7ec68cda80de597fd..48c61015472d23e8331bff15133cb5d10f2cf845 100644 --- a/silk/silk_resampler_private_down4.c +++ b/silk/silk_resampler_private_down4.c @@ -30,14 +30,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Downsample by a factor 4. Note: very low quality, only use with input sampling rates above 96 kHz. */ void silk_resampler_private_down4( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ floor(len/2) ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ floor(len/2) ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 inLen /* I: Number of input samples */ ) { - SKP_int32 k, len4 = SKP_RSHIFT32( inLen, 2 ); - SKP_int32 in32, out32, Y, X; + opus_int32 k, len4 = SKP_RSHIFT32( inLen, 2 ); + opus_int32 in32, out32, Y, X; SKP_assert( silk_resampler_down2_0 > 0 ); SKP_assert( silk_resampler_down2_1 < 0 ); @@ -45,7 +45,7 @@ void silk_resampler_private_down4( /* Internal variables and state are in Q10 format */ for( k = 0; k < len4; k++ ) { /* Add two input samples and convert to Q10 */ - in32 = SKP_LSHIFT( SKP_ADD32( (SKP_int32)in[ 4 * k ], (SKP_int32)in[ 4 * k + 1 ] ), 9 ); + in32 = SKP_LSHIFT( SKP_ADD32( (opus_int32)in[ 4 * k ], (opus_int32)in[ 4 * k + 1 ] ), 9 ); /* All-pass section for even input sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -54,7 +54,7 @@ void silk_resampler_private_down4( S[ 0 ] = SKP_ADD32( in32, X ); /* Add two input samples and convert to Q10 */ - in32 = SKP_LSHIFT( SKP_ADD32( (SKP_int32)in[ 4 * k + 2 ], (SKP_int32)in[ 4 * k + 3 ] ), 9 ); + in32 = SKP_LSHIFT( SKP_ADD32( (opus_int32)in[ 4 * k + 2 ], (opus_int32)in[ 4 * k + 3 ] ), 9 ); /* All-pass section for odd input sample */ Y = SKP_SUB32( in32, S[ 1 ] ); @@ -64,6 +64,6 @@ void silk_resampler_private_down4( S[ 1 ] = SKP_ADD32( in32, X ); /* Add, convert back to int16 and store to output */ - out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 11 ) ); + out[ k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 11 ) ); } } diff --git a/silk/silk_resampler_private_down_FIR.c b/silk/silk_resampler_private_down_FIR.c index d0306a40301ddcb8fe2ecceb4282f092f4d7df3b..c8a0e06e1c169ab5e82fa8b7953e386714130b33 100644 --- a/silk/silk_resampler_private_down_FIR.c +++ b/silk/silk_resampler_private_down_FIR.c @@ -28,11 +28,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" #include "silk_resampler_private.h" -SKP_INLINE SKP_int16 *silk_resampler_private_down_FIR_INTERPOL0( - SKP_int16 *out, SKP_int32 *buf2, const SKP_int16 *FIR_Coefs, SKP_int32 max_index_Q16, SKP_int32 index_increment_Q16){ +SKP_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL0( + opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16){ - SKP_int32 index_Q16, res_Q6; - SKP_int32 *buf_ptr; + opus_int32 index_Q16, res_Q6; + opus_int32 *buf_ptr; for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) { /* Integer part gives pointer to buffered input */ buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 ); @@ -48,18 +48,18 @@ SKP_INLINE SKP_int16 *silk_resampler_private_down_FIR_INTERPOL0( res_Q6 = SKP_SMLAWB( res_Q6, SKP_ADD32( buf_ptr[ 7 ], buf_ptr[ 8 ] ), FIR_Coefs[ 7 ] ); /* Scale down, saturate and store in output array */ - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); } return out; } -SKP_INLINE SKP_int16 *silk_resampler_private_down_FIR_INTERPOL1( - SKP_int16 *out, SKP_int32 *buf2, const SKP_int16 *FIR_Coefs, SKP_int32 max_index_Q16, SKP_int32 index_increment_Q16, SKP_int32 FIR_Fracs){ +SKP_INLINE opus_int16 *silk_resampler_private_down_FIR_INTERPOL1( + opus_int16 *out, opus_int32 *buf2, const opus_int16 *FIR_Coefs, opus_int32 max_index_Q16, opus_int32 index_increment_Q16, opus_int32 FIR_Fracs){ - SKP_int32 index_Q16, res_Q6; - SKP_int32 *buf_ptr; - SKP_int32 interpol_ind; - const SKP_int16 *interpol_ptr; + opus_int32 index_Q16, res_Q6; + opus_int32 *buf_ptr; + opus_int32 interpol_ind; + const opus_int16 *interpol_ptr; for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) { /* Integer part gives pointer to buffered input */ buf_ptr = buf2 + SKP_RSHIFT( index_Q16, 16 ); @@ -88,7 +88,7 @@ SKP_INLINE SKP_int16 *silk_resampler_private_down_FIR_INTERPOL1( res_Q6 = SKP_SMLAWB( res_Q6, buf_ptr[ 8 ], interpol_ptr[ 7 ] ); /* Scale down, saturate and store in output array */ - *out++ = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); + *out++ = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( res_Q6, 6 ) ); } return out; } @@ -97,20 +97,20 @@ SKP_INLINE SKP_int16 *silk_resampler_private_down_FIR_INTERPOL1( /* Resample with a 2x downsampler (optional), a 2nd order AR filter followed by FIR interpolation */ void silk_resampler_private_down_FIR( void *SS, /* I/O: Resampler state */ - SKP_int16 out[], /* O: Output signal */ - const SKP_int16 in[], /* I: Input signal */ - SKP_int32 inLen /* I: Number of input samples */ + opus_int16 out[], /* O: Output signal */ + const opus_int16 in[], /* I: Input signal */ + opus_int32 inLen /* I: Number of input samples */ ) { silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS; - SKP_int32 nSamplesIn; - SKP_int32 max_index_Q16, index_increment_Q16; - SKP_int16 buf1[ RESAMPLER_MAX_BATCH_SIZE_IN / 2 ]; - SKP_int32 buf2[ RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_DOWN_ORDER_FIR ]; - const SKP_int16 *FIR_Coefs; + opus_int32 nSamplesIn; + opus_int32 max_index_Q16, index_increment_Q16; + opus_int16 buf1[ RESAMPLER_MAX_BATCH_SIZE_IN / 2 ]; + opus_int32 buf2[ RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_DOWN_ORDER_FIR ]; + const opus_int16 *FIR_Coefs; /* Copy buffered samples to start of buffer */ - SKP_memcpy( buf2, S->sFIR, RESAMPLER_DOWN_ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf2, S->sFIR, RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) ); FIR_Coefs = &S->Coefs[ 2 ]; @@ -146,13 +146,13 @@ void silk_resampler_private_down_FIR( if( inLen > S->input2x ) { /* More iterations to do; copy last part of filtered signal to beginning of buffer */ - SKP_memcpy( buf2, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( buf2, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) ); } else { break; } } /* Copy last part of filtered signal to the state for the next call */ - SKP_memcpy( S->sFIR, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( SKP_int32 ) ); + SKP_memcpy( S->sFIR, &buf2[ nSamplesIn ], RESAMPLER_DOWN_ORDER_FIR * sizeof( opus_int32 ) ); } diff --git a/silk/silk_resampler_private_up2_HQ.c b/silk/silk_resampler_private_up2_HQ.c index 860e41b5cbc189d78f7aa6560524502652d2da1b..5a03a8b10a0fb2cb0e692722eaa212040d916285 100644 --- a/silk/silk_resampler_private_up2_HQ.c +++ b/silk/silk_resampler_private_up2_HQ.c @@ -32,14 +32,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Uses 2nd order allpass filters for the 2x upsampling, followed by a */ /* notch filter just above Nyquist. */ void silk_resampler_private_up2_HQ( - SKP_int32 *S, /* I/O: Resampler state [ 6 ] */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of INPUT samples */ + opus_int32 *S, /* I/O: Resampler state [ 6 ] */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of INPUT samples */ ) { - SKP_int32 k; - SKP_int32 in32, out32_1, out32_2, Y, X; + opus_int32 k; + opus_int32 in32, out32_1, out32_2, Y, X; SKP_assert( silk_resampler_up2_hq_0[ 0 ] > 0 ); SKP_assert( silk_resampler_up2_hq_0[ 1 ] < 0 ); @@ -49,7 +49,7 @@ void silk_resampler_private_up2_HQ( /* Internal variables and state are in Q10 format */ for( k = 0; k < len; k++ ) { /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ k ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ k ], 10 ); /* First all-pass section for even output sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -70,7 +70,7 @@ void silk_resampler_private_up2_HQ( S[ 5 ] = SKP_SUB32( out32_2, S[ 5 ] ); /* Apply gain in Q15, convert back to int16 and store to output */ - out[ 2 * k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT32( + out[ 2 * k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 256, out32_1, silk_resampler_up2_hq_notch[ 3 ] ), 9 ) ); /* First all-pass section for odd output sample */ @@ -92,16 +92,16 @@ void silk_resampler_private_up2_HQ( S[ 4 ] = SKP_SUB32( out32_2, S[ 4 ] ); /* Apply gain in Q15, convert back to int16 and store to output */ - out[ 2 * k + 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT32( + out[ 2 * k + 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 256, out32_1, silk_resampler_up2_hq_notch[ 3 ] ), 9 ) ); } } void silk_resampler_private_up2_HQ_wrapper( void *SS, /* I/O: Resampler state (unused) */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ) { silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS; diff --git a/silk/silk_resampler_private_up4.c b/silk/silk_resampler_private_up4.c index 84ccd54e1b2c889dd1397982793ac2dc149b09b3..bfbba9cc42f8b1402c9625e752b90be8be1ee1d4 100644 --- a/silk/silk_resampler_private_up4.c +++ b/silk/silk_resampler_private_up4.c @@ -30,15 +30,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Upsample by a factor 4, Note: low quality, only use with output sampling rates above 96 kHz. */ void silk_resampler_private_up4( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ 4 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of INPUT samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ 4 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of INPUT samples */ ) { - SKP_int32 k; - SKP_int32 in32, out32, Y, X; - SKP_int16 out16; + opus_int32 k; + opus_int32 in32, out32, Y, X; + opus_int16 out16; SKP_assert( silk_resampler_up2_lq_0 > 0 ); SKP_assert( silk_resampler_up2_lq_1 < 0 ); @@ -46,7 +46,7 @@ void silk_resampler_private_up4( /* Internal variables and state are in Q10 format */ for( k = 0; k < len; k++ ) { /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ k ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ k ], 10 ); /* All-pass section for even output sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -55,7 +55,7 @@ void silk_resampler_private_up4( S[ 0 ] = SKP_ADD32( in32, X ); /* Convert back to int16 and store to output */ - out16 = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); + out16 = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); out[ 4 * k ] = out16; out[ 4 * k + 1 ] = out16; @@ -66,7 +66,7 @@ void silk_resampler_private_up4( S[ 1 ] = SKP_ADD32( in32, X ); /* Convert back to int16 and store to output */ - out16 = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); + out16 = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); out[ 4 * k + 2 ] = out16; out[ 4 * k + 3 ] = out16; } diff --git a/silk/silk_resampler_rom.c b/silk/silk_resampler_rom.c index 250fc567ff401f9943ebc83472f07f83b5b7fe70..de6000ab44dff6dabce121749b65561fe71b12cd 100644 --- a/silk/silk_resampler_rom.c +++ b/silk/silk_resampler_rom.c @@ -31,56 +31,56 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_resampler_private.h" /* Tables for 2x downsampler */ -const SKP_int16 silk_resampler_down2_0 = 9872; -const SKP_int16 silk_resampler_down2_1 = 39809 - 65536; +const opus_int16 silk_resampler_down2_0 = 9872; +const opus_int16 silk_resampler_down2_1 = 39809 - 65536; /* Tables for 2x upsampler, low quality */ -const SKP_int16 silk_resampler_up2_lq_0 = 8102; -const SKP_int16 silk_resampler_up2_lq_1 = 36783 - 65536; +const opus_int16 silk_resampler_up2_lq_0 = 8102; +const opus_int16 silk_resampler_up2_lq_1 = 36783 - 65536; /* Tables for 2x upsampler, high quality */ -const SKP_int16 silk_resampler_up2_hq_0[ 2 ] = { 4280, 33727 - 65536 }; -const SKP_int16 silk_resampler_up2_hq_1[ 2 ] = { 16295, 54015 - 65536 }; -const SKP_int16 silk_resampler_up2_hq_notch[ 4 ] = { 6554, -3932, 6554, 30573 }; +const opus_int16 silk_resampler_up2_hq_0[ 2 ] = { 4280, 33727 - 65536 }; +const opus_int16 silk_resampler_up2_hq_1[ 2 ] = { 16295, 54015 - 65536 }; +const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 6554, -3932, 6554, 30573 }; /* Tables with IIR and FIR coefficients for fractional downsamplers (90 Words) */ -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { -20253, -13986, 86, 7, -151, 368, -542, 232, 11041, 21904, 39, 90, -181, 216, -17, -877, 6408, 19695, 2, 113, -108, 2, 314, -977, 2665, 15787, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { -13997, -14120, 60, -174, 71, 298, -800, 659, 9238, 17461, 48, -40, -150, 314, -155, -845, 4188, 14293, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { 1233, -14293, -91, 162, 169, -342, -505, 1332, 5281, 8742, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_3_8_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_3_8_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { 12634, -14550, 246, -175, -326, -113, 764, 2209, 3664, 4402, 171, 3, -301, -258, 391, 1693, 3227, 4272, 88, 138, -236, -327, 95, 1203, 2733, 4022, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { 16306, -14409, 99, -201, -220, -16, 572, 1483, 2433, 3043, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = { -2797, -6507, 4697, 10739, 1567, 8276, }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ] = { 16777, -9792, 890, 1614, 2148, }; @@ -89,28 +89,28 @@ SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ] = { /* Tables with coefficients for 4th order ARMA filter (35 Words), in a packed format: */ /* { B1_Q14[1], B2_Q14[1], -A1_Q14[1], -A1_Q14[2], -A2_Q14[1], -A2_Q14[2], gain_Q16 } */ /* where it is assumed that B*_Q14[0], B*_Q14[2], A*_Q14[0] are all 16384 */ -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_320_441_ARMA4_COEFS[ 7 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_320_441_ARMA4_COEFS[ 7 ] = { 31454, 24746, -9706, -3386, -17911, -13243, 24797 }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_240_441_ARMA4_COEFS[ 7 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_240_441_ARMA4_COEFS[ 7 ] = { 28721, 11254, 3189, -2546, -1495, -12618, 11562 }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_160_441_ARMA4_COEFS[ 7 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_160_441_ARMA4_COEFS[ 7 ] = { 23492, -6457, 14358, -4856, 14654, -13008, 4456 }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_120_441_ARMA4_COEFS[ 7 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_120_441_ARMA4_COEFS[ 7 ] = { 19311, -15569, 19489, -6950, 21441, -13559, 2370 }; -SKP_DWORD_ALIGN const SKP_int16 silk_Resampler_80_441_ARMA4_COEFS[ 7 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_Resampler_80_441_ARMA4_COEFS[ 7 ] = { 13248, -23849, 24126, -9486, 26806, -14286, 1065 }; /* Table with interplation fractions of 1/288 : 2/288 : 287/288 (432 Words) */ -SKP_DWORD_ALIGN const SKP_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ] = { +SKP_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ] = { { -25, 58, 32526}, { -8, -69, 32461}, { 8, -195, 32393}, diff --git a/silk/silk_resampler_rom.h b/silk/silk_resampler_rom.h index 49d82af2ca389abc4a9f444ae06f8f4b5e9cbc0e..f5b82c67cb3cbc2b4c75942e01a0fd6dc61cede8 100644 --- a/silk/silk_resampler_rom.h +++ b/silk/silk_resampler_rom.h @@ -41,36 +41,36 @@ extern "C" /* Tables for 2x downsampler. Values above 32767 intentionally wrap to a negative value. */ -extern const SKP_int16 silk_resampler_down2_0; -extern const SKP_int16 silk_resampler_down2_1; +extern const opus_int16 silk_resampler_down2_0; +extern const opus_int16 silk_resampler_down2_1; /* Tables for 2x upsampler, low quality. Values above 32767 intentionally wrap to a negative value. */ -extern const SKP_int16 silk_resampler_up2_lq_0; -extern const SKP_int16 silk_resampler_up2_lq_1; +extern const opus_int16 silk_resampler_up2_lq_0; +extern const opus_int16 silk_resampler_up2_lq_1; /* Tables for 2x upsampler, high quality. Values above 32767 intentionally wrap to a negative value. */ -extern const SKP_int16 silk_resampler_up2_hq_0[ 2 ]; -extern const SKP_int16 silk_resampler_up2_hq_1[ 2 ]; -extern const SKP_int16 silk_resampler_up2_hq_notch[ 4 ]; +extern const opus_int16 silk_resampler_up2_hq_0[ 2 ]; +extern const opus_int16 silk_resampler_up2_hq_1[ 2 ]; +extern const opus_int16 silk_resampler_up2_hq_notch[ 4 ]; /* Tables with IIR and FIR coefficients for fractional downsamplers */ -extern const SKP_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; -extern const SKP_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; -extern const SKP_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ]; -extern const SKP_int16 silk_Resampler_3_8_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; -extern const SKP_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ]; -extern const SKP_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ]; -extern const SKP_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ]; +extern const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; +extern const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; +extern const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ]; +extern const opus_int16 silk_Resampler_3_8_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ]; +extern const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ]; +extern const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ]; +extern const opus_int16 silk_Resampler_1_3_COEFS_LQ[ 2 + 3 ]; /* Tables with coefficients for 4th order ARMA filter */ -extern const SKP_int16 silk_Resampler_320_441_ARMA4_COEFS[ 7 ]; -extern const SKP_int16 silk_Resampler_240_441_ARMA4_COEFS[ 7 ]; -extern const SKP_int16 silk_Resampler_160_441_ARMA4_COEFS[ 7 ]; -extern const SKP_int16 silk_Resampler_120_441_ARMA4_COEFS[ 7 ]; -extern const SKP_int16 silk_Resampler_80_441_ARMA4_COEFS[ 7 ]; +extern const opus_int16 silk_Resampler_320_441_ARMA4_COEFS[ 7 ]; +extern const opus_int16 silk_Resampler_240_441_ARMA4_COEFS[ 7 ]; +extern const opus_int16 silk_Resampler_160_441_ARMA4_COEFS[ 7 ]; +extern const opus_int16 silk_Resampler_120_441_ARMA4_COEFS[ 7 ]; +extern const opus_int16 silk_Resampler_80_441_ARMA4_COEFS[ 7 ]; /* Table with interplation fractions of 1/288 : 2/288 : 287/288 (432 Words) */ -extern const SKP_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ]; +extern const opus_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ]; #ifdef __cplusplus } diff --git a/silk/silk_resampler_structs.h b/silk/silk_resampler_structs.h index e00e4117697e8553cb11312e333c78398995bc95..090ea99b12630e79d84a4dbc9d903b6ced57900d 100644 --- a/silk/silk_resampler_structs.h +++ b/silk/silk_resampler_structs.h @@ -40,27 +40,27 @@ extern "C" { typedef struct _silk_resampler_state_struct{ - SKP_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */ - SKP_int32 sFIR[ SILK_RESAMPLER_MAX_FIR_ORDER ]; - SKP_int32 sDown2[ 2 ]; - void (*resampler_function)( void *, SKP_int16 *, const SKP_int16 *, SKP_int32 ); - void (*up2_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 ); - SKP_int32 batchSize; - SKP_int32 invRatio_Q16; - SKP_int32 FIR_Fracs; - SKP_int32 input2x; - const SKP_int16 *Coefs; + opus_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */ + opus_int32 sFIR[ SILK_RESAMPLER_MAX_FIR_ORDER ]; + opus_int32 sDown2[ 2 ]; + void (*resampler_function)( void *, opus_int16 *, const opus_int16 *, opus_int32 ); + void (*up2_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 ); + opus_int32 batchSize; + opus_int32 invRatio_Q16; + opus_int32 FIR_Fracs; + opus_int32 input2x; + const opus_int16 *Coefs; #if RESAMPLER_SUPPORT_ABOVE_48KHZ - SKP_int32 sDownPre[ 2 ]; - SKP_int32 sUpPost[ 2 ]; - void (*down_pre_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 ); - void (*up_post_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 ); - SKP_int32 batchSizePrePost; - SKP_int32 ratio_Q16; - SKP_int32 nPreDownsamplers; - SKP_int32 nPostUpsamplers; + opus_int32 sDownPre[ 2 ]; + opus_int32 sUpPost[ 2 ]; + void (*down_pre_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 ); + void (*up_post_function)( opus_int32 *, opus_int16 *, const opus_int16 *, opus_int32 ); + opus_int32 batchSizePrePost; + opus_int32 ratio_Q16; + opus_int32 nPreDownsamplers; + opus_int32 nPostUpsamplers; #endif - SKP_int32 magic_number; + opus_int32 magic_number; } silk_resampler_state_struct; #ifdef __cplusplus diff --git a/silk/silk_resampler_up2.c b/silk/silk_resampler_up2.c index b27636d45ab41e2dfa07ac5f022002519d4295d7..b50184c7ddb278c4c839b769be201e5e273157f5 100644 --- a/silk/silk_resampler_up2.c +++ b/silk/silk_resampler_up2.c @@ -30,21 +30,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Upsample by a factor 2, low quality */ void silk_resampler_up2( - SKP_int32 *S, /* I/O: State vector [ 2 ] */ - SKP_int16 *out, /* O: Output signal [ 2 * len ] */ - const SKP_int16 *in, /* I: Input signal [ len ] */ - SKP_int32 len /* I: Number of input samples */ + opus_int32 *S, /* I/O: State vector [ 2 ] */ + opus_int16 *out, /* O: Output signal [ 2 * len ] */ + const opus_int16 *in, /* I: Input signal [ len ] */ + opus_int32 len /* I: Number of input samples */ ) { - SKP_int32 k; - SKP_int32 in32, out32, Y, X; + opus_int32 k; + opus_int32 in32, out32, Y, X; SKP_assert( silk_resampler_up2_lq_0 > 0 ); SKP_assert( silk_resampler_up2_lq_1 < 0 ); /* Internal variables and state are in Q10 format */ for( k = 0; k < len; k++ ) { /* Convert to Q10 */ - in32 = SKP_LSHIFT( (SKP_int32)in[ k ], 10 ); + in32 = SKP_LSHIFT( (opus_int32)in[ k ], 10 ); /* All-pass section for even output sample */ Y = SKP_SUB32( in32, S[ 0 ] ); @@ -53,7 +53,7 @@ void silk_resampler_up2( S[ 0 ] = SKP_ADD32( in32, X ); /* Convert back to int16 and store to output */ - out[ 2 * k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); + out[ 2 * k ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); /* All-pass section for odd output sample */ Y = SKP_SUB32( in32, S[ 1 ] ); @@ -62,6 +62,6 @@ void silk_resampler_up2( S[ 1 ] = SKP_ADD32( in32, X ); /* Convert back to int16 and store to output */ - out[ 2 * k + 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); + out[ 2 * k + 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) ); } } diff --git a/silk/silk_scale_copy_vector16.c b/silk/silk_scale_copy_vector16.c index 46eb095ab2fd5ce35104e21445b894032be16d86..56cf1861efa1634a74aeadfb78d276c5aba1a48d 100644 --- a/silk/silk_scale_copy_vector16.c +++ b/silk/silk_scale_copy_vector16.c @@ -29,17 +29,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Copy and multiply a vector by a constant */ void silk_scale_copy_vector16( - SKP_int16 *data_out, - const SKP_int16 *data_in, - SKP_int32 gain_Q16, /* (I): gain in Q16 */ - const SKP_int dataSize /* (I): length */ + opus_int16 *data_out, + const opus_int16 *data_in, + opus_int32 gain_Q16, /* (I): gain in Q16 */ + const opus_int dataSize /* (I): length */ ) { - SKP_int i; - SKP_int32 tmp32; + opus_int i; + opus_int32 tmp32; for( i = 0; i < dataSize; i++ ) { tmp32 = SKP_SMULWB( gain_Q16, data_in[ i ] ); - data_out[ i ] = (SKP_int16)SKP_CHECK_FIT16( tmp32 ); + data_out[ i ] = (opus_int16)SKP_CHECK_FIT16( tmp32 ); } } diff --git a/silk/silk_scale_vector.c b/silk/silk_scale_vector.c index c91fc6ae1a8bf6f2f44d6302d1a77bae4417c5c4..371fcb08bec1322c83d5c63666811d649c66e71c 100644 --- a/silk/silk_scale_vector.c +++ b/silk/silk_scale_vector.c @@ -29,14 +29,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Multiply a vector by a constant */ void silk_scale_vector32_Q26_lshift_18( - SKP_int32 *data1, /* (I/O): Q0/Q18 */ - SKP_int32 gain_Q26, /* (I): Q26 */ - SKP_int dataSize /* (I): length */ + opus_int32 *data1, /* (I/O): Q0/Q18 */ + opus_int32 gain_Q26, /* (I): Q26 */ + opus_int dataSize /* (I): length */ ) { - SKP_int i; + opus_int i; for( i = 0; i < dataSize; i++ ) { - data1[ i ] = (SKP_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( SKP_SMULL( data1[ i ], gain_Q26 ), 8 ) );// OUTPUT: Q18 + data1[ i ] = (opus_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( SKP_SMULL( data1[ i ], gain_Q26 ), 8 ) );// OUTPUT: Q18 } } diff --git a/silk/silk_schur.c b/silk/silk_schur.c index b8fdc372fa059c2605e6d4fc5d1afc3d88824775..57ebd4b2048986359f58f25561296e3087b2b5b5 100644 --- a/silk/silk_schur.c +++ b/silk/silk_schur.c @@ -29,15 +29,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Faster than schur64(), but much less accurate. */ /* uses SMLAWB(), requiring armv5E and higher. */ -SKP_int32 silk_schur( /* O: Returns residual energy */ - SKP_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */ - const SKP_int32 *c, /* I: correlations [order+1] */ - const SKP_int32 order /* I: prediction order */ +opus_int32 silk_schur( /* O: Returns residual energy */ + opus_int16 *rc_Q15, /* O: reflection coefficients [order] Q15 */ + const opus_int32 *c, /* I: correlations [order+1] */ + const opus_int32 order /* I: prediction order */ ) { - SKP_int k, n, lz; - SKP_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; - SKP_int32 Ctmp1, Ctmp2, rc_tmp_Q15; + opus_int k, n, lz; + opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; + opus_int32 Ctmp1, Ctmp2, rc_tmp_Q15; /* Get number of leading zeros */ lz = silk_CLZ32( c[ 0 ] ); @@ -70,7 +70,7 @@ SKP_int32 silk_schur( /* O: Returns residual energy rc_tmp_Q15 = SKP_SAT16( rc_tmp_Q15 ); /* Store */ - rc_Q15[ k ] = ( SKP_int16 )rc_tmp_Q15; + rc_Q15[ k ] = ( opus_int16 )rc_tmp_Q15; /* Update correlations */ for( n = 0; n < order - k; n++ ) { diff --git a/silk/silk_schur64.c b/silk/silk_schur64.c index b6e854a8e8fe3faeaebbda447c320cb75fd7750c..02e93a777f3178c0a4777a2a287e1e4f54221743 100644 --- a/silk/silk_schur64.c +++ b/silk/silk_schur64.c @@ -29,19 +29,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Slower than schur(), but more accurate. */ /* Uses SMULL(), available on armv4 */ -SKP_int32 silk_schur64( /* O: Returns residual energy */ - SKP_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */ - const SKP_int32 c[], /* I: Correlations [order+1] */ - SKP_int32 order /* I: Prediction order */ +opus_int32 silk_schur64( /* O: Returns residual energy */ + opus_int32 rc_Q16[], /* O: Reflection coefficients [order] Q16 */ + const opus_int32 c[], /* I: Correlations [order+1] */ + opus_int32 order /* I: Prediction order */ ) { - SKP_int k, n; - SKP_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; - SKP_int32 Ctmp1_Q30, Ctmp2_Q30, rc_tmp_Q31; + opus_int k, n; + opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; + opus_int32 Ctmp1_Q30, Ctmp2_Q30, rc_tmp_Q31; /* Check for invalid input */ if( c[ 0 ] <= 0 ) { - SKP_memset( rc_Q16, 0, order * sizeof( SKP_int32 ) ); + SKP_memset( rc_Q16, 0, order * sizeof( opus_int32 ) ); return 0; } diff --git a/silk/silk_shell_coder.c b/silk/silk_shell_coder.c index 97cd826384b5ee498efb30859b4459b5fd20eede..d226b33cf5d40e0684af8a3c42cfa32ce14b0b23 100644 --- a/silk/silk_shell_coder.c +++ b/silk/silk_shell_coder.c @@ -30,12 +30,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* shell coder; pulse-subframe length is hardcoded */ SKP_INLINE void combine_pulses( - SKP_int *out, /* O: combined pulses vector [len] */ - const SKP_int *in, /* I: input vector [2 * len] */ - const SKP_int len /* I: number of OUTPUT samples */ + opus_int *out, /* O: combined pulses vector [len] */ + const opus_int *in, /* I: input vector [2 * len] */ + const opus_int len /* I: number of OUTPUT samples */ ) { - SKP_int k; + opus_int k; for( k = 0; k < len; k++ ) { out[ k ] = in[ 2 * k ] + in[ 2 * k + 1 ]; } @@ -43,9 +43,9 @@ SKP_INLINE void combine_pulses( SKP_INLINE void encode_split( ec_enc *psRangeEnc, /* I/O compressor data structure */ - const SKP_int p_child1, /* I: pulse amplitude of first child subframe */ - const SKP_int p, /* I: pulse amplitude of current subframe */ - const SKP_uint8 *shell_table /* I: table of shell cdfs */ + const opus_int p_child1, /* I: pulse amplitude of first child subframe */ + const opus_int p, /* I: pulse amplitude of current subframe */ + const opus_uint8 *shell_table /* I: table of shell cdfs */ ) { if( p > 0 ) { @@ -54,11 +54,11 @@ SKP_INLINE void encode_split( } SKP_INLINE void decode_split( - SKP_int *p_child1, /* O: pulse amplitude of first child subframe */ - SKP_int *p_child2, /* O: pulse amplitude of second child subframe */ + opus_int *p_child1, /* O: pulse amplitude of first child subframe */ + opus_int *p_child2, /* O: pulse amplitude of second child subframe */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - const SKP_int p, /* I: pulse amplitude of current subframe */ - const SKP_uint8 *shell_table /* I: table of shell cdfs */ + const opus_int p, /* I: pulse amplitude of current subframe */ + const opus_uint8 *shell_table /* I: table of shell cdfs */ ) { if( p > 0 ) { @@ -73,10 +73,10 @@ SKP_INLINE void decode_split( /* Shell encoder, operates on one shell code frame of 16 pulses */ void silk_shell_encoder( ec_enc *psRangeEnc, /* I/O compressor data structure */ - const SKP_int *pulses0 /* I data: nonnegative pulse amplitudes */ + const opus_int *pulses0 /* I data: nonnegative pulse amplitudes */ ) { - SKP_int pulses1[ 8 ], pulses2[ 4 ], pulses3[ 2 ], pulses4[ 1 ]; + opus_int pulses1[ 8 ], pulses2[ 4 ], pulses3[ 2 ], pulses4[ 1 ]; /* this function operates on one shell code frame of 16 pulses */ SKP_assert( SHELL_CODEC_FRAME_LENGTH == 16 ); @@ -113,12 +113,12 @@ void silk_shell_encoder( /* Shell decoder, operates on one shell code frame of 16 pulses */ void silk_shell_decoder( - SKP_int *pulses0, /* O data: nonnegative pulse amplitudes */ + opus_int *pulses0, /* O data: nonnegative pulse amplitudes */ ec_dec *psRangeDec, /* I/O Compressor data structure */ - const SKP_int pulses4 /* I number of pulses per pulse-subframe */ + const opus_int pulses4 /* I number of pulses per pulse-subframe */ ) { - SKP_int pulses3[ 2 ], pulses2[ 4 ], pulses1[ 8 ]; + opus_int pulses3[ 2 ], pulses2[ 4 ], pulses1[ 8 ]; /* this function operates on one shell code frame of 16 pulses */ SKP_assert( SHELL_CODEC_FRAME_LENGTH == 16 ); diff --git a/silk/silk_sigm_Q15.c b/silk/silk_sigm_Q15.c index a0df8f4994f077ecd983f1253455c853ab16ddc0..8785c455711965bac927b17156fb478db2c65c41 100644 --- a/silk/silk_sigm_Q15.c +++ b/silk/silk_sigm_Q15.c @@ -30,21 +30,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" /* fprintf(1, '%d, ', round(1024 * ([1 ./ (1 + exp(-(1:5))), 1] - 1 ./ (1 + exp(-(0:5)))))); */ -static const SKP_int32 sigm_LUT_slope_Q10[ 6 ] = { +static const opus_int32 sigm_LUT_slope_Q10[ 6 ] = { 237, 153, 73, 30, 12, 7 }; /* fprintf(1, '%d, ', round(32767 * 1 ./ (1 + exp(-(0:5))))); */ -static const SKP_int32 sigm_LUT_pos_Q15[ 6 ] = { +static const opus_int32 sigm_LUT_pos_Q15[ 6 ] = { 16384, 23955, 28861, 31213, 32178, 32548 }; /* fprintf(1, '%d, ', round(32767 * 1 ./ (1 + exp((0:5))))); */ -static const SKP_int32 sigm_LUT_neg_Q15[ 6 ] = { +static const opus_int32 sigm_LUT_neg_Q15[ 6 ] = { 16384, 8812, 3906, 1554, 589, 219 }; -SKP_int silk_sigm_Q15( SKP_int in_Q5 ) +opus_int silk_sigm_Q15( opus_int in_Q5 ) { - SKP_int ind; + opus_int ind; if( in_Q5 < 0 ) { /* Negative input */ diff --git a/silk/silk_sort.c b/silk/silk_sort.c index 53661679da2e25d7efdc54f475c76745a9cce8be..3bec458d54fc435cc3ac09e994668ea0a531c333 100644 --- a/silk/silk_sort.c +++ b/silk/silk_sort.c @@ -34,14 +34,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FIX.h" void silk_insertion_sort_increasing( - SKP_int32 *a, /* I/O: Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int32 *a, /* I/O: Unsorted / Sorted vector */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ) { - SKP_int32 value; - SKP_int i, j; + opus_int32 value; + opus_int i, j; /* Safety checks */ SKP_assert( K > 0 ); @@ -80,14 +80,14 @@ void silk_insertion_sort_increasing( } void silk_insertion_sort_decreasing_int16( - SKP_int16 *a, /* I/O: Unsorted / Sorted vector */ - SKP_int *idx, /* O: Index vector for the sorted elements */ - const SKP_int L, /* I: Vector length */ - const SKP_int K /* I: Number of correctly sorted positions */ + opus_int16 *a, /* I/O: Unsorted / Sorted vector */ + opus_int *idx, /* O: Index vector for the sorted elements */ + const opus_int L, /* I: Vector length */ + const opus_int K /* I: Number of correctly sorted positions */ ) { - SKP_int i, j; - SKP_int value; + opus_int i, j; + opus_int value; /* Safety checks */ SKP_assert( K > 0 ); @@ -126,12 +126,12 @@ void silk_insertion_sort_decreasing_int16( } void silk_insertion_sort_increasing_all_values_int16( - SKP_int16 *a, /* I/O: Unsorted / Sorted vector */ - const SKP_int L /* I: Vector length */ + opus_int16 *a, /* I/O: Unsorted / Sorted vector */ + const opus_int L /* I: Vector length */ ) { - SKP_int value; - SKP_int i, j; + opus_int value; + opus_int i, j; /* Safety checks */ SKP_assert( L > 0 ); diff --git a/silk/silk_stereo_LR_to_MS.c b/silk/silk_stereo_LR_to_MS.c index c86a96d34bbf8f29c6cdd225eed96c496787463d..c69310d080eae5d50a8d733ea8385f37e031b6af 100644 --- a/silk/silk_stereo_LR_to_MS.c +++ b/silk/silk_stereo_LR_to_MS.c @@ -30,37 +30,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Convert Left/Right stereo signal to adaptive Mid/Side representation */ void silk_stereo_LR_to_MS( stereo_enc_state *state, /* I/O State */ - SKP_int16 x1[], /* I/O Left input signal, becomes mid signal */ - SKP_int16 x2[], /* I/O Right input signal, becomes side signal */ - SKP_int8 ix[ 2 ][ 4 ], /* O Quantization indices */ - SKP_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */ - SKP_int32 total_rate_bps, /* I Total bitrate */ - SKP_int prev_speech_act_Q8, /* I Speech activity level in previous frame */ - SKP_int fs_kHz, /* I Sample rate (kHz) */ - SKP_int frame_length /* I Number of samples */ + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ + opus_int8 ix[ 2 ][ 4 ], /* O Quantization indices */ + opus_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */ + opus_int32 total_rate_bps, /* I Total bitrate */ + opus_int prev_speech_act_Q8, /* I Speech activity level in previous frame */ + opus_int fs_kHz, /* I Sample rate (kHz) */ + opus_int frame_length /* I Number of samples */ ) { - SKP_int n, is10msFrame, denom_Q16, delta0_Q13, delta1_Q13; - SKP_int32 sum, diff, smooth_coef_Q16, pred_Q13[ 2 ], pred0_Q13, pred1_Q13; - SKP_int32 LP_ratio_Q14, HP_ratio_Q14, frac_Q16, frac_3_Q16, min_mid_rate_bps, width_Q14, w_Q24, deltaw_Q24; - SKP_int16 side[ MAX_FRAME_LENGTH + 2 ]; - SKP_int16 LP_mid[ MAX_FRAME_LENGTH ], HP_mid[ MAX_FRAME_LENGTH ]; - SKP_int16 LP_side[ MAX_FRAME_LENGTH ], HP_side[ MAX_FRAME_LENGTH ]; - SKP_int16 *mid = &x1[ -2 ]; + opus_int n, is10msFrame, denom_Q16, delta0_Q13, delta1_Q13; + opus_int32 sum, diff, smooth_coef_Q16, pred_Q13[ 2 ], pred0_Q13, pred1_Q13; + opus_int32 LP_ratio_Q14, HP_ratio_Q14, frac_Q16, frac_3_Q16, min_mid_rate_bps, width_Q14, w_Q24, deltaw_Q24; + opus_int16 side[ MAX_FRAME_LENGTH + 2 ]; + opus_int16 LP_mid[ MAX_FRAME_LENGTH ], HP_mid[ MAX_FRAME_LENGTH ]; + opus_int16 LP_side[ MAX_FRAME_LENGTH ], HP_side[ MAX_FRAME_LENGTH ]; + opus_int16 *mid = &x1[ -2 ]; /* Convert to basic mid/side signals */ for( n = 0; n < frame_length + 2; n++ ) { - sum = x1[ n - 2 ] + (SKP_int32)x2[ n - 2 ]; - diff = x1[ n - 2 ] - (SKP_int32)x2[ n - 2 ]; - mid[ n ] = (SKP_int16)SKP_RSHIFT_ROUND( sum, 1 ); - side[ n ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( diff, 1 ) ); + sum = x1[ n - 2 ] + (opus_int32)x2[ n - 2 ]; + diff = x1[ n - 2 ] - (opus_int32)x2[ n - 2 ]; + mid[ n ] = (opus_int16)SKP_RSHIFT_ROUND( sum, 1 ); + side[ n ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( diff, 1 ) ); } /* Buffering */ - SKP_memcpy( mid, state->sMid, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( side, state->sSide, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( state->sMid, &mid[ frame_length ], 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( state->sSide, &side[ frame_length ], 2 * sizeof( SKP_int16 ) ); + SKP_memcpy( mid, state->sMid, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( side, state->sSide, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( state->sMid, &mid[ frame_length ], 2 * sizeof( opus_int16 ) ); + SKP_memcpy( state->sSide, &side[ frame_length ], 2 * sizeof( opus_int16 ) ); /* LP and HP filter mid signal */ for( n = 0; n < frame_length; n++ ) { @@ -110,7 +110,7 @@ void silk_stereo_LR_to_MS( } /* Smoother */ - state->smth_width_Q14 = (SKP_int16)SKP_SMLAWB( state->smth_width_Q14, width_Q14 - state->smth_width_Q14, smooth_coef_Q16 ); + state->smth_width_Q14 = (opus_int16)SKP_SMLAWB( state->smth_width_Q14, width_Q14 - state->smth_width_Q14, smooth_coef_Q16 ); /* Reduce predictors */ pred_Q13[ 0 ] = SKP_RSHIFT( SKP_SMULBB( state->smth_width_Q14, pred_Q13[ 0 ] ), 14 ); @@ -159,8 +159,8 @@ void silk_stereo_LR_to_MS( w_Q24 += deltaw_Q24; sum = SKP_LSHIFT( SKP_ADD_LSHIFT( mid[ n ] + mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */ sum = SKP_SMLAWB( SKP_SMULWB( w_Q24, side[ n + 1 ] ), sum, pred0_Q13 ); /* Q8 */ - sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( SKP_int32 )mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ - x2[ n - 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); + sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ + x2[ n - 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); } pred0_Q13 = -pred_Q13[ 0 ]; pred1_Q13 = -pred_Q13[ 1 ]; @@ -168,10 +168,10 @@ void silk_stereo_LR_to_MS( for( n = STEREO_INTERP_LEN_MS * fs_kHz; n < frame_length; n++ ) { sum = SKP_LSHIFT( SKP_ADD_LSHIFT( mid[ n ] + mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */ sum = SKP_SMLAWB( SKP_SMULWB( w_Q24, side[ n + 1 ] ), sum, pred0_Q13 ); /* Q8 */ - sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( SKP_int32 )mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ - x2[ n - 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); + sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ + x2[ n - 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); } - state->pred_prev_Q13[ 0 ] = (SKP_int16)pred_Q13[ 0 ]; - state->pred_prev_Q13[ 1 ] = (SKP_int16)pred_Q13[ 1 ]; - state->width_prev_Q14 = (SKP_int16)width_Q14; + state->pred_prev_Q13[ 0 ] = (opus_int16)pred_Q13[ 0 ]; + state->pred_prev_Q13[ 1 ] = (opus_int16)pred_Q13[ 1 ]; + state->width_prev_Q14 = (opus_int16)width_Q14; } diff --git a/silk/silk_stereo_MS_to_LR.c b/silk/silk_stereo_MS_to_LR.c index 357415ade81954213487c159045b6c5566e0427d..807fb351b1cfa3154044cdbd6c774eaf6128d532 100644 --- a/silk/silk_stereo_MS_to_LR.c +++ b/silk/silk_stereo_MS_to_LR.c @@ -30,21 +30,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Convert adaptive Mid/Side representation to Left/Right stereo signal */ void silk_stereo_MS_to_LR( stereo_dec_state *state, /* I/O State */ - SKP_int16 x1[], /* I/O Left input signal, becomes mid signal */ - SKP_int16 x2[], /* I/O Right input signal, becomes side signal */ - const SKP_int32 pred_Q13[], /* I Predictors */ - SKP_int fs_kHz, /* I Samples rate (kHz) */ - SKP_int frame_length /* I Number of samples */ + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ + const opus_int32 pred_Q13[], /* I Predictors */ + opus_int fs_kHz, /* I Samples rate (kHz) */ + opus_int frame_length /* I Number of samples */ ) { - SKP_int n, denom_Q16, delta0_Q13, delta1_Q13; - SKP_int32 sum, diff, pred0_Q13, pred1_Q13; + opus_int n, denom_Q16, delta0_Q13, delta1_Q13; + opus_int32 sum, diff, pred0_Q13, pred1_Q13; /* Buffering */ - SKP_memcpy( x1, state->sMid, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( x2, state->sSide, 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( state->sMid, &x1[ frame_length ], 2 * sizeof( SKP_int16 ) ); - SKP_memcpy( state->sSide, &x2[ frame_length ], 2 * sizeof( SKP_int16 ) ); + SKP_memcpy( x1, state->sMid, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( x2, state->sSide, 2 * sizeof( opus_int16 ) ); + SKP_memcpy( state->sMid, &x1[ frame_length ], 2 * sizeof( opus_int16 ) ); + SKP_memcpy( state->sSide, &x2[ frame_length ], 2 * sizeof( opus_int16 ) ); /* Interpolate predictors and add prediction to side channel */ pred0_Q13 = state->pred_prev_Q13[ 0 ]; @@ -56,26 +56,26 @@ void silk_stereo_MS_to_LR( pred0_Q13 += delta0_Q13; pred1_Q13 += delta1_Q13; sum = SKP_LSHIFT( SKP_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */ - sum = SKP_SMLAWB( SKP_LSHIFT( ( SKP_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */ - sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( SKP_int32 )x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ - x2[ n + 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); + sum = SKP_SMLAWB( SKP_LSHIFT( ( opus_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */ + sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ + x2[ n + 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); } pred0_Q13 = pred_Q13[ 0 ]; pred1_Q13 = pred_Q13[ 1 ]; for( n = STEREO_INTERP_LEN_MS * fs_kHz; n < frame_length; n++ ) { sum = SKP_LSHIFT( SKP_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */ - sum = SKP_SMLAWB( SKP_LSHIFT( ( SKP_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */ - sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( SKP_int32 )x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ - x2[ n + 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); + sum = SKP_SMLAWB( SKP_LSHIFT( ( opus_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */ + sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */ + x2[ n + 1 ] = (opus_int16)SKP_SAT16( SKP_RSHIFT_ROUND( sum, 8 ) ); } state->pred_prev_Q13[ 0 ] = pred_Q13[ 0 ]; state->pred_prev_Q13[ 1 ] = pred_Q13[ 1 ]; /* Convert to left/right signals */ for( n = 0; n < frame_length; n++ ) { - sum = x1[ n + 1 ] + (SKP_int32)x2[ n + 1 ]; - diff = x1[ n + 1 ] - (SKP_int32)x2[ n + 1 ]; - x1[ n + 1 ] = (SKP_int16)SKP_SAT16( sum ); - x2[ n + 1 ] = (SKP_int16)SKP_SAT16( diff ); + sum = x1[ n + 1 ] + (opus_int32)x2[ n + 1 ]; + diff = x1[ n + 1 ] - (opus_int32)x2[ n + 1 ]; + x1[ n + 1 ] = (opus_int16)SKP_SAT16( sum ); + x2[ n + 1 ] = (opus_int16)SKP_SAT16( diff ); } } diff --git a/silk/silk_stereo_decode_pred.c b/silk/silk_stereo_decode_pred.c index e7e6c0094bc515c9e98f58ab7ba20567be0e7fd0..7906f3e606093eaeb561d7d83a659def371aaef1 100644 --- a/silk/silk_stereo_decode_pred.c +++ b/silk/silk_stereo_decode_pred.c @@ -30,12 +30,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Decode mid/side predictors */ void silk_stereo_decode_pred( ec_dec *psRangeDec, /* I/O Compressor data structure */ - SKP_int *decode_only_mid, /* O Flag that only mid channel has been coded */ - SKP_int32 pred_Q13[] /* O Predictors */ + opus_int *decode_only_mid, /* O Flag that only mid channel has been coded */ + opus_int32 pred_Q13[] /* O Predictors */ ) { - SKP_int n, ix[ 2 ][ 3 ]; - SKP_int32 low_Q13, step_Q13; + opus_int n, ix[ 2 ][ 3 ]; + opus_int32 low_Q13, step_Q13; /* Entropy decoding */ n = ec_dec_icdf( psRangeDec, silk_stereo_pred_joint_iCDF, 8 ); diff --git a/silk/silk_stereo_encode_pred.c b/silk/silk_stereo_encode_pred.c index 18546ab685dedfbf0166dce86b5c47d0ccee937b..adb34d534a32d07431f31287c7a88df8c22ffaba 100644 --- a/silk/silk_stereo_encode_pred.c +++ b/silk/silk_stereo_encode_pred.c @@ -30,10 +30,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Entropy code the mid/side quantization indices */ void silk_stereo_encode_pred( ec_enc *psRangeEnc, /* I/O Compressor data structure */ - SKP_int8 ix[ 2 ][ 4 ] /* I Quantization indices */ + opus_int8 ix[ 2 ][ 4 ] /* I Quantization indices */ ) { - SKP_int n; + opus_int n; /* Entropy coding */ n = 5 * ix[ 0 ][ 2 ] + ix[ 1 ][ 2 ]; diff --git a/silk/silk_stereo_find_predictor.c b/silk/silk_stereo_find_predictor.c index e9ab376c84a15363b70da2c93fbf135251802c2b..7a00dae5a4ad63955e32da431678a9e10a71ecb4 100644 --- a/silk/silk_stereo_find_predictor.c +++ b/silk/silk_stereo_find_predictor.c @@ -28,17 +28,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main.h" /* Find least-squares prediction gain for one signal based on another and quantize it */ -SKP_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */ - SKP_int32 *ratio_Q14, /* O Ratio of residual and mid energies */ - const SKP_int16 x[], /* I Basis signal */ - const SKP_int16 y[], /* I Target signal */ - SKP_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */ - SKP_int length, /* I Number of samples */ - SKP_int smooth_coef_Q16 /* I Smoothing coefficient */ +opus_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */ + opus_int32 *ratio_Q14, /* O Ratio of residual and mid energies */ + const opus_int16 x[], /* I Basis signal */ + const opus_int16 y[], /* I Target signal */ + opus_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */ + opus_int length, /* I Number of samples */ + opus_int smooth_coef_Q16 /* I Smoothing coefficient */ ) { - SKP_int scale, scale1, scale2; - SKP_int32 nrgx, nrgy, corr, pred_Q13; + opus_int scale, scale1, scale2; + opus_int32 nrgx, nrgy, corr, pred_Q13; /* Find predictor */ silk_sum_sqr_shift( &nrgx, &scale1, x, length ); diff --git a/silk/silk_stereo_quant_pred.c b/silk/silk_stereo_quant_pred.c index 275605c7ff004a8dc8db76a896a3db6e3cdd7bfc..e9f0c85448925679238e112dbfa6386d57066c85 100644 --- a/silk/silk_stereo_quant_pred.c +++ b/silk/silk_stereo_quant_pred.c @@ -30,12 +30,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Quantize mid/side predictors */ void silk_stereo_quant_pred( stereo_enc_state *state, /* I/O State */ - SKP_int32 pred_Q13[], /* I/O Predictors (out: quantized) */ - SKP_int8 ix[ 2 ][ 4 ] /* O Quantization indices */ + opus_int32 pred_Q13[], /* I/O Predictors (out: quantized) */ + opus_int8 ix[ 2 ][ 4 ] /* O Quantization indices */ ) { - SKP_int i, j, n; - SKP_int32 low_Q13, step_Q13, lvl_Q13, err_min_Q13, err_Q13, quant_pred_Q13 = 0; + opus_int i, j, n; + opus_int32 low_Q13, step_Q13, lvl_Q13, err_min_Q13, err_Q13, quant_pred_Q13 = 0; /* Quantize */ for( n = 0; n < 2; n++ ) { diff --git a/silk/silk_structs.h b/silk/silk_structs.h index 78bb98a99e5adcb2317cc136752cbb86d25ea833..7a205792ea824b8a02926268b4219a6677966f3d 100644 --- a/silk/silk_structs.h +++ b/silk/silk_structs.h @@ -47,246 +47,246 @@ extern "C" /* Noise shaping quantization state */ /************************************/ typedef struct { - SKP_int16 xq[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for quantized output signal */ - SKP_int32 sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ]; - SKP_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ]; - SKP_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; - SKP_int32 sLF_AR_shp_Q12; - SKP_int lagPrev; - SKP_int sLTP_buf_idx; - SKP_int sLTP_shp_buf_idx; - SKP_int32 rand_seed; - SKP_int32 prev_inv_gain_Q16; - SKP_int rewhite_flag; + opus_int16 xq[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for quantized output signal */ + opus_int32 sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ]; + opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ]; + opus_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; + opus_int32 sLF_AR_shp_Q12; + opus_int lagPrev; + opus_int sLTP_buf_idx; + opus_int sLTP_shp_buf_idx; + opus_int32 rand_seed; + opus_int32 prev_inv_gain_Q16; + opus_int rewhite_flag; } silk_nsq_state; /********************************/ /* VAD state */ /********************************/ typedef struct { - SKP_int32 AnaState[ 2 ]; /* Analysis filterbank state: 0-8 kHz */ - SKP_int32 AnaState1[ 2 ]; /* Analysis filterbank state: 0-4 kHz */ - SKP_int32 AnaState2[ 2 ]; /* Analysis filterbank state: 0-2 kHz */ - SKP_int32 XnrgSubfr[ VAD_N_BANDS ]; /* Subframe energies */ - SKP_int32 NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in each band */ - SKP_int16 HPstate; /* State of differentiator in the lowest band */ - SKP_int32 NL[ VAD_N_BANDS ]; /* Noise energy level in each band */ - SKP_int32 inv_NL[ VAD_N_BANDS ]; /* Inverse noise energy level in each band */ - SKP_int32 NoiseLevelBias[ VAD_N_BANDS ]; /* Noise level estimator bias/offset */ - SKP_int32 counter; /* Frame counter used in the initial phase */ + opus_int32 AnaState[ 2 ]; /* Analysis filterbank state: 0-8 kHz */ + opus_int32 AnaState1[ 2 ]; /* Analysis filterbank state: 0-4 kHz */ + opus_int32 AnaState2[ 2 ]; /* Analysis filterbank state: 0-2 kHz */ + opus_int32 XnrgSubfr[ VAD_N_BANDS ]; /* Subframe energies */ + opus_int32 NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in each band */ + opus_int16 HPstate; /* State of differentiator in the lowest band */ + opus_int32 NL[ VAD_N_BANDS ]; /* Noise energy level in each band */ + opus_int32 inv_NL[ VAD_N_BANDS ]; /* Inverse noise energy level in each band */ + opus_int32 NoiseLevelBias[ VAD_N_BANDS ]; /* Noise level estimator bias/offset */ + opus_int32 counter; /* Frame counter used in the initial phase */ } silk_VAD_state; /* Variable cut-off low-pass filter state */ typedef struct { - SKP_int32 In_LP_State[ 2 ]; /* Low pass filter state */ - SKP_int32 transition_frame_no; /* Counter which is mapped to a cut-off frequency */ - SKP_int mode; /* Operating mode, <0: switch down, >0: switch up; 0: do nothing */ + opus_int32 In_LP_State[ 2 ]; /* Low pass filter state */ + opus_int32 transition_frame_no; /* Counter which is mapped to a cut-off frequency */ + opus_int mode; /* Operating mode, <0: switch down, >0: switch up; 0: do nothing */ } silk_LP_state; /* Structure containing NLSF codebook */ typedef struct { - const SKP_int16 nVectors; - const SKP_int16 order; - const SKP_int16 quantStepSize_Q16; - const SKP_int16 invQuantStepSize_Q6; - const SKP_uint8 *CB1_NLSF_Q8; - const SKP_uint8 *CB1_iCDF; - const SKP_uint8 *pred_Q8; - const SKP_uint8 *ec_sel; - const SKP_uint8 *ec_iCDF; - const SKP_uint8 *ec_Rates_Q5; - const SKP_int16 *deltaMin_Q15; + const opus_int16 nVectors; + const opus_int16 order; + const opus_int16 quantStepSize_Q16; + const opus_int16 invQuantStepSize_Q6; + const opus_uint8 *CB1_NLSF_Q8; + const opus_uint8 *CB1_iCDF; + const opus_uint8 *pred_Q8; + const opus_uint8 *ec_sel; + const opus_uint8 *ec_iCDF; + const opus_uint8 *ec_Rates_Q5; + const opus_int16 *deltaMin_Q15; } silk_NLSF_CB_struct; typedef struct { - SKP_int16 pred_prev_Q13[ 2 ]; - SKP_int16 sMid[ 2 ]; - SKP_int16 sSide[ 2 ]; - SKP_int32 mid_side_amp_Q0[ 4 ]; - SKP_int16 smth_width_Q14; - SKP_int16 width_prev_Q14; - SKP_int8 ix[ MAX_FRAMES_PER_PACKET ][ 2 ][ 4 ]; + opus_int16 pred_prev_Q13[ 2 ]; + opus_int16 sMid[ 2 ]; + opus_int16 sSide[ 2 ]; + opus_int32 mid_side_amp_Q0[ 4 ]; + opus_int16 smth_width_Q14; + opus_int16 width_prev_Q14; + opus_int8 ix[ MAX_FRAMES_PER_PACKET ][ 2 ][ 4 ]; } stereo_enc_state; typedef struct { - SKP_int16 pred_prev_Q13[ 2 ]; - SKP_int16 sMid[ 2 ]; - SKP_int16 sSide[ 2 ]; + opus_int16 pred_prev_Q13[ 2 ]; + opus_int16 sMid[ 2 ]; + opus_int16 sSide[ 2 ]; } stereo_dec_state; typedef struct { - SKP_int8 GainsIndices[ MAX_NB_SUBFR ]; - SKP_int8 LTPIndex[ MAX_NB_SUBFR ]; - SKP_int8 NLSFIndices[ MAX_LPC_ORDER + 1 ]; - SKP_int16 lagIndex; - SKP_int8 contourIndex; - SKP_int8 signalType; - SKP_int8 quantOffsetType; - SKP_int8 NLSFInterpCoef_Q2; - SKP_int8 PERIndex; - SKP_int8 LTP_scaleIndex; - SKP_int8 Seed; + opus_int8 GainsIndices[ MAX_NB_SUBFR ]; + opus_int8 LTPIndex[ MAX_NB_SUBFR ]; + opus_int8 NLSFIndices[ MAX_LPC_ORDER + 1 ]; + opus_int16 lagIndex; + opus_int8 contourIndex; + opus_int8 signalType; + opus_int8 quantOffsetType; + opus_int8 NLSFInterpCoef_Q2; + opus_int8 PERIndex; + opus_int8 LTP_scaleIndex; + opus_int8 Seed; } SideInfoIndices; /********************************/ /* Encoder state */ /********************************/ typedef struct { - SKP_int32 In_HP_State[ 2 ]; /* High pass filter state */ - SKP_int32 variable_HP_smth1_Q15; /* State of first smoother */ - SKP_int32 variable_HP_smth2_Q15; /* State of second smoother */ - SKP_int HP_cutoff_Hz; /* Fixed cutoff frequency (if zero: adaptive) */ + opus_int32 In_HP_State[ 2 ]; /* High pass filter state */ + opus_int32 variable_HP_smth1_Q15; /* State of first smoother */ + opus_int32 variable_HP_smth2_Q15; /* State of second smoother */ + opus_int HP_cutoff_Hz; /* Fixed cutoff frequency (if zero: adaptive) */ silk_LP_state sLP; /* Low pass filter state */ silk_VAD_state sVAD; /* Voice activity detector state */ silk_nsq_state sNSQ; /* Noise Shape Quantizer State */ - SKP_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector */ - SKP_int speech_activity_Q8; /* Speech activity */ - SKP_int allow_bandwidth_switch; /* Flag indicating that switching of internal bandwidth is allowed */ - SKP_int8 LBRRprevLastGainIndex; - SKP_int8 prevSignalType; - SKP_int prevLag; - SKP_int pitch_LPC_win_length; - SKP_int max_pitch_lag; /* Highest possible pitch lag (samples) */ - SKP_int32 API_fs_Hz; /* API sampling frequency (Hz) */ - SKP_int32 prev_API_fs_Hz; /* Previous API sampling frequency (Hz) */ - SKP_int maxInternal_fs_Hz; /* Maximum internal sampling frequency (Hz) */ - SKP_int minInternal_fs_Hz; /* Minimum internal sampling frequency (Hz) */ - SKP_int desiredInternal_fs_Hz; /* Soft request for internal sampling frequency (Hz) */ - SKP_int fs_kHz; /* Internal sampling frequency (kHz) */ - SKP_int nb_subfr; /* Number of 5 ms subframes in a frame */ - SKP_int frame_length; /* Frame length (samples) */ - SKP_int subfr_length; /* Subframe length (samples) */ - SKP_int ltp_mem_length; /* Length of LTP memory */ - SKP_int la_pitch; /* Look-ahead for pitch analysis (samples) */ - SKP_int la_shape; /* Look-ahead for noise shape analysis (samples) */ - SKP_int shapeWinLength; /* Window length for noise shape analysis (samples) */ - SKP_int32 TargetRate_bps; /* Target bitrate (bps) */ - SKP_int PacketSize_ms; /* Number of milliseconds to put in each packet */ - SKP_int PacketLoss_perc; /* Packet loss rate measured by farend */ - SKP_int32 frameCounter; - SKP_int Complexity; /* Complexity setting */ - SKP_int nStatesDelayedDecision; /* Number of states in delayed decision quantization */ - SKP_int useInterpolatedNLSFs; /* Flag for using NLSF interpolation */ - SKP_int shapingLPCOrder; /* Filter order for noise shaping filters */ - SKP_int predictLPCOrder; /* Filter order for prediction filters */ - SKP_int pitchEstimationComplexity; /* Complexity level for pitch estimator */ - SKP_int pitchEstimationLPCOrder; /* Whitening filter order for pitch estimator */ - SKP_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */ - SKP_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */ - SKP_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */ - SKP_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */ - SKP_int first_frame_after_reset; /* Flag for deactivating NLSF interp. and fluc. reduction after resets */ - SKP_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */ - SKP_int warping_Q16; /* Warping parameter for warped noise shaping */ - SKP_int useCBR; /* Flag to enable constant bitrate */ - SKP_int prefillFlag; /* Flag to indicate that only buffers are prefilled, no coding */ - const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Pointer to iCDF table for low bits of pitch lag index */ - const SKP_uint8 *pitch_contour_iCDF; /* Pointer to iCDF table for pitch contour index */ + opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector */ + opus_int speech_activity_Q8; /* Speech activity */ + opus_int allow_bandwidth_switch; /* Flag indicating that switching of internal bandwidth is allowed */ + opus_int8 LBRRprevLastGainIndex; + opus_int8 prevSignalType; + opus_int prevLag; + opus_int pitch_LPC_win_length; + opus_int max_pitch_lag; /* Highest possible pitch lag (samples) */ + opus_int32 API_fs_Hz; /* API sampling frequency (Hz) */ + opus_int32 prev_API_fs_Hz; /* Previous API sampling frequency (Hz) */ + opus_int maxInternal_fs_Hz; /* Maximum internal sampling frequency (Hz) */ + opus_int minInternal_fs_Hz; /* Minimum internal sampling frequency (Hz) */ + opus_int desiredInternal_fs_Hz; /* Soft request for internal sampling frequency (Hz) */ + opus_int fs_kHz; /* Internal sampling frequency (kHz) */ + opus_int nb_subfr; /* Number of 5 ms subframes in a frame */ + opus_int frame_length; /* Frame length (samples) */ + opus_int subfr_length; /* Subframe length (samples) */ + opus_int ltp_mem_length; /* Length of LTP memory */ + opus_int la_pitch; /* Look-ahead for pitch analysis (samples) */ + opus_int la_shape; /* Look-ahead for noise shape analysis (samples) */ + opus_int shapeWinLength; /* Window length for noise shape analysis (samples) */ + opus_int32 TargetRate_bps; /* Target bitrate (bps) */ + opus_int PacketSize_ms; /* Number of milliseconds to put in each packet */ + opus_int PacketLoss_perc; /* Packet loss rate measured by farend */ + opus_int32 frameCounter; + opus_int Complexity; /* Complexity setting */ + opus_int nStatesDelayedDecision; /* Number of states in delayed decision quantization */ + opus_int useInterpolatedNLSFs; /* Flag for using NLSF interpolation */ + opus_int shapingLPCOrder; /* Filter order for noise shaping filters */ + opus_int predictLPCOrder; /* Filter order for prediction filters */ + opus_int pitchEstimationComplexity; /* Complexity level for pitch estimator */ + opus_int pitchEstimationLPCOrder; /* Whitening filter order for pitch estimator */ + opus_int32 pitchEstimationThreshold_Q16; /* Threshold for pitch estimator */ + opus_int LTPQuantLowComplexity; /* Flag for low complexity LTP quantization */ + opus_int mu_LTP_Q9; /* Rate-distortion tradeoff in LTP quantization */ + opus_int NLSF_MSVQ_Survivors; /* Number of survivors in NLSF MSVQ */ + opus_int first_frame_after_reset; /* Flag for deactivating NLSF interp. and fluc. reduction after resets */ + opus_int controlled_since_last_payload; /* Flag for ensuring codec_control only runs once per packet */ + opus_int warping_Q16; /* Warping parameter for warped noise shaping */ + opus_int useCBR; /* Flag to enable constant bitrate */ + opus_int prefillFlag; /* Flag to indicate that only buffers are prefilled, no coding */ + const opus_uint8 *pitch_lag_low_bits_iCDF; /* Pointer to iCDF table for low bits of pitch lag index */ + const opus_uint8 *pitch_contour_iCDF; /* Pointer to iCDF table for pitch contour index */ const silk_NLSF_CB_struct *psNLSF_CB; /* Pointer to NLSF codebook */ - SKP_int input_quality_bands_Q15[ VAD_N_BANDS ]; - SKP_int input_tilt_Q15; - SKP_int SNR_dB_Q7; /* Quality setting */ + opus_int input_quality_bands_Q15[ VAD_N_BANDS ]; + opus_int input_tilt_Q15; + opus_int SNR_dB_Q7; /* Quality setting */ - SKP_int8 VAD_flags[ MAX_FRAMES_PER_PACKET ]; - SKP_int8 LBRR_flag; - SKP_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; + opus_int8 VAD_flags[ MAX_FRAMES_PER_PACKET ]; + opus_int8 LBRR_flag; + opus_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; SideInfoIndices indices; - SKP_int8 pulses[ MAX_FRAME_LENGTH ]; + opus_int8 pulses[ MAX_FRAME_LENGTH ]; /* Input/output buffering */ - SKP_int16 inputBuf__[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */ - SKP_int16 *inputBuf; /* Points to second element of above buffer */ - SKP_int inputBufIx; - SKP_int nFramesPerPacket; - SKP_int nFramesEncoded; /* Number of frames analyzed in current packet */ + opus_int16 inputBuf__[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */ + opus_int16 *inputBuf; /* Points to second element of above buffer */ + opus_int inputBufIx; + opus_int nFramesPerPacket; + opus_int nFramesEncoded; /* Number of frames analyzed in current packet */ - SKP_int nChannelsAPI; - SKP_int nChannelsInternal; - SKP_int channelNb; + opus_int nChannelsAPI; + opus_int nChannelsInternal; + opus_int channelNb; /* Parameters For LTP scaling Control */ - SKP_int frames_since_onset; + opus_int frames_since_onset; /* Specifically for entropy coding */ - SKP_int ec_prevSignalType; - SKP_int16 ec_prevLagIndex; + opus_int ec_prevSignalType; + opus_int16 ec_prevLagIndex; silk_resampler_state_struct resampler_state; /* DTX */ - SKP_int useDTX; /* Flag to enable DTX */ - SKP_int inDTX; /* Flag to signal DTX period */ - SKP_int noSpeechCounter; /* Counts concecutive nonactive frames, used by DTX */ + opus_int useDTX; /* Flag to enable DTX */ + opus_int inDTX; /* Flag to signal DTX period */ + opus_int noSpeechCounter; /* Counts concecutive nonactive frames, used by DTX */ /* Inband Low Bitrate Redundancy (LBRR) data */ - SKP_int useInBandFEC; /* Saves the API setting for query */ - SKP_int LBRR_enabled; /* Depends on useInBandFRC, bitrate and packet loss rate */ - SKP_int LBRR_GainIncreases; /* Gains increment for coding LBRR frames */ + opus_int useInBandFEC; /* Saves the API setting for query */ + opus_int LBRR_enabled; /* Depends on useInBandFRC, bitrate and packet loss rate */ + opus_int LBRR_GainIncreases; /* Gains increment for coding LBRR frames */ SideInfoIndices indices_LBRR[ MAX_FRAMES_PER_PACKET ]; - SKP_int8 pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ]; + opus_int8 pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ]; } silk_encoder_state; /* Struct for Packet Loss Concealment */ typedef struct { - SKP_int32 pitchL_Q8; /* Pitch lag to use for voiced concealment */ - SKP_int16 LTPCoef_Q14[ LTP_ORDER ]; /* LTP coeficients to use for voiced concealment */ - SKP_int16 prevLPC_Q12[ MAX_LPC_ORDER ]; - SKP_int last_frame_lost; /* Was previous frame lost */ - SKP_int32 rand_seed; /* Seed for unvoiced signal generation */ - SKP_int16 randScale_Q14; /* Scaling of unvoiced random signal */ - SKP_int32 conc_energy; - SKP_int conc_energy_shift; - SKP_int16 prevLTP_scale_Q14; - SKP_int32 prevGain_Q16[ MAX_NB_SUBFR ]; - SKP_int fs_kHz; + opus_int32 pitchL_Q8; /* Pitch lag to use for voiced concealment */ + opus_int16 LTPCoef_Q14[ LTP_ORDER ]; /* LTP coeficients to use for voiced concealment */ + opus_int16 prevLPC_Q12[ MAX_LPC_ORDER ]; + opus_int last_frame_lost; /* Was previous frame lost */ + opus_int32 rand_seed; /* Seed for unvoiced signal generation */ + opus_int16 randScale_Q14; /* Scaling of unvoiced random signal */ + opus_int32 conc_energy; + opus_int conc_energy_shift; + opus_int16 prevLTP_scale_Q14; + opus_int32 prevGain_Q16[ MAX_NB_SUBFR ]; + opus_int fs_kHz; } silk_PLC_struct; /* Struct for CNG */ typedef struct { - SKP_int32 CNG_exc_buf_Q10[ MAX_FRAME_LENGTH ]; - SKP_int16 CNG_smth_NLSF_Q15[ MAX_LPC_ORDER ]; - SKP_int32 CNG_synth_state[ MAX_LPC_ORDER ]; - SKP_int32 CNG_smth_Gain_Q16; - SKP_int32 rand_seed; - SKP_int fs_kHz; + opus_int32 CNG_exc_buf_Q10[ MAX_FRAME_LENGTH ]; + opus_int16 CNG_smth_NLSF_Q15[ MAX_LPC_ORDER ]; + opus_int32 CNG_synth_state[ MAX_LPC_ORDER ]; + opus_int32 CNG_smth_Gain_Q16; + opus_int32 rand_seed; + opus_int fs_kHz; } silk_CNG_struct; /********************************/ /* Decoder state */ /********************************/ typedef struct { - SKP_int32 prev_inv_gain_Q16; - SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; - SKP_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; - SKP_int32 exc_Q10[ MAX_FRAME_LENGTH ]; - SKP_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for output signal */ - SKP_int lagPrev; /* Previous Lag */ - SKP_int8 LastGainIndex; /* Previous gain index */ - SKP_int fs_kHz; /* Sampling frequency in kHz */ - SKP_int32 prev_API_sampleRate; /* Previous API sample frequency (Hz) */ - SKP_int nb_subfr; /* Number of 5 ms subframes in a frame */ - SKP_int frame_length; /* Frame length (samples) */ - SKP_int subfr_length; /* Subframe length (samples) */ - SKP_int ltp_mem_length; /* Length of LTP memory */ - SKP_int LPC_order; /* LPC order */ - SKP_int16 prevNLSF_Q15[ MAX_LPC_ORDER ]; /* Used to interpolate LSFs */ - SKP_int first_frame_after_reset; /* Flag for deactivating NLSF interp. and fluc. reduction after resets */ - const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Pointer to iCDF table for low bits of pitch lag index */ - const SKP_uint8 *pitch_contour_iCDF; /* Pointer to iCDF table for pitch contour index */ + opus_int32 prev_inv_gain_Q16; + opus_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; + opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; + opus_int32 exc_Q10[ MAX_FRAME_LENGTH ]; + opus_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for output signal */ + opus_int lagPrev; /* Previous Lag */ + opus_int8 LastGainIndex; /* Previous gain index */ + opus_int fs_kHz; /* Sampling frequency in kHz */ + opus_int32 prev_API_sampleRate; /* Previous API sample frequency (Hz) */ + opus_int nb_subfr; /* Number of 5 ms subframes in a frame */ + opus_int frame_length; /* Frame length (samples) */ + opus_int subfr_length; /* Subframe length (samples) */ + opus_int ltp_mem_length; /* Length of LTP memory */ + opus_int LPC_order; /* LPC order */ + opus_int16 prevNLSF_Q15[ MAX_LPC_ORDER ]; /* Used to interpolate LSFs */ + opus_int first_frame_after_reset; /* Flag for deactivating NLSF interp. and fluc. reduction after resets */ + const opus_uint8 *pitch_lag_low_bits_iCDF; /* Pointer to iCDF table for low bits of pitch lag index */ + const opus_uint8 *pitch_contour_iCDF; /* Pointer to iCDF table for pitch contour index */ /* For buffering payload in case of more frames per packet */ - SKP_int nFramesDecoded; - SKP_int nFramesPerPacket; + opus_int nFramesDecoded; + opus_int nFramesPerPacket; /* Specifically for entropy coding */ - SKP_int ec_prevSignalType; - SKP_int16 ec_prevLagIndex; + opus_int ec_prevSignalType; + opus_int16 ec_prevLagIndex; - SKP_int VAD_flags[ MAX_FRAMES_PER_PACKET ]; - SKP_int LBRR_flag; - SKP_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; + opus_int VAD_flags[ MAX_FRAMES_PER_PACKET ]; + opus_int LBRR_flag; + opus_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; silk_resampler_state_struct resampler_state; @@ -299,8 +299,8 @@ typedef struct { silk_CNG_struct sCNG; /* Stuff used for PLC */ - SKP_int lossCnt; - SKP_int prevSignalType; + opus_int lossCnt; + opus_int prevSignalType; silk_PLC_struct sPLC; @@ -311,12 +311,12 @@ typedef struct { /************************/ typedef struct { /* prediction and coding parameters */ - SKP_int pitchL[ MAX_NB_SUBFR ]; - SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; + opus_int pitchL[ MAX_NB_SUBFR ]; + opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; /* holds interpolated and final coefficients, 4-byte aligned */ - SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; - SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; - SKP_int LTP_scale_Q14; + SKP_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; + opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; + opus_int LTP_scale_Q14; } silk_decoder_control; diff --git a/silk/silk_sum_sqr_shift.c b/silk/silk_sum_sqr_shift.c index ddf3b3dfb4ef8f92b7f121f384de9e82e5cbcb94..1b9f83e6bda4a3b0de5fda3797d02bccc1d5af10 100644 --- a/silk/silk_sum_sqr_shift.c +++ b/silk/silk_sum_sqr_shift.c @@ -30,14 +30,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Compute number of bits to right shift the sum of squares of a vector */ /* of int16s to make it fit in an int32 */ void silk_sum_sqr_shift( - SKP_int32 *energy, /* O Energy of x, after shifting to the right */ - SKP_int *shift, /* O Number of bits right shift applied to energy */ - const SKP_int16 *x, /* I Input vector */ - SKP_int len /* I Length of input vector */ + opus_int32 *energy, /* O Energy of x, after shifting to the right */ + opus_int *shift, /* O Number of bits right shift applied to energy */ + const opus_int16 *x, /* I Input vector */ + opus_int len /* I Length of input vector */ ) { - SKP_int i, shft; - SKP_int32 nrg_tmp, nrg; + opus_int i, shft; + opus_int32 nrg_tmp, nrg; nrg = 0; shft = 0; @@ -47,7 +47,7 @@ void silk_sum_sqr_shift( nrg = SKP_SMLABB_ovflw( nrg, x[ i + 1 ], x[ i + 1 ] ); if( nrg < 0 ) { /* Scale down */ - nrg = (SKP_int32)SKP_RSHIFT_uint( (SKP_uint32)nrg, 2 ); + nrg = (opus_int32)SKP_RSHIFT_uint( (opus_uint32)nrg, 2 ); shft = 2; break; } @@ -55,22 +55,22 @@ void silk_sum_sqr_shift( for( ; i < len; i += 2 ) { nrg_tmp = SKP_SMULBB( x[ i ], x[ i ] ); nrg_tmp = SKP_SMLABB_ovflw( nrg_tmp, x[ i + 1 ], x[ i + 1 ] ); - nrg = (SKP_int32)SKP_ADD_RSHIFT_uint( nrg, (SKP_uint32)nrg_tmp, shft ); + nrg = (opus_int32)SKP_ADD_RSHIFT_uint( nrg, (opus_uint32)nrg_tmp, shft ); if( nrg < 0 ) { /* Scale down */ - nrg = (SKP_int32)SKP_RSHIFT_uint( (SKP_uint32)nrg, 2 ); + nrg = (opus_int32)SKP_RSHIFT_uint( (opus_uint32)nrg, 2 ); shft += 2; } } if( i == len ) { /* One sample left to process */ nrg_tmp = SKP_SMULBB( x[ i ], x[ i ] ); - nrg = (SKP_int32)SKP_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); + nrg = (opus_int32)SKP_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); } /* Make sure to have at least one extra leading zero (two leading zeros in total) */ if( nrg & 0xC0000000 ) { - nrg = SKP_RSHIFT_uint( (SKP_uint32)nrg, 2 ); + nrg = SKP_RSHIFT_uint( (opus_uint32)nrg, 2 ); shft += 2; } diff --git a/silk/silk_table_LSF_cos.c b/silk/silk_table_LSF_cos.c index 653a8d1b907357200628bf09e252bc642a41039a..ff5ebf73165f4f37edce9e70b225a8bb3e08ff0d 100644 --- a/silk/silk_table_LSF_cos.c +++ b/silk/silk_table_LSF_cos.c @@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Cosine approximation table for LSF conversion */ /* Q12 values (even) */ -const SKP_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ] = { +const opus_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ] = { 8192, 8190, 8182, 8170, 8152, 8130, 8104, 8072, 8034, 7994, 7946, 7896, diff --git a/silk/silk_tables.h b/silk/silk_tables.h index 9c80e14d9f4898a6f64bf03ccd4e0454e96c11a9..dfb934dcc62e65cfe134a073116a3bd5156c9674 100644 --- a/silk/silk_tables.h +++ b/silk/silk_tables.h @@ -37,81 +37,81 @@ extern "C" #endif /* entropy coding tables */ -extern const SKP_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ]; /* 24 */ -extern const SKP_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 41 */ +extern const opus_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ]; /* 24 */ +extern const opus_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 41 */ -extern const SKP_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ]; /* 32 */ -extern const SKP_uint8 silk_pitch_delta_iCDF[ 21 ]; /* 21 */ -extern const SKP_uint8 silk_pitch_contour_iCDF[ 34 ]; /* 34 */ -extern const SKP_uint8 silk_pitch_contour_NB_iCDF[ 11 ]; /* 11 */ -extern const SKP_uint8 silk_pitch_contour_10_ms_iCDF[ 12 ]; /* 12 */ -extern const SKP_uint8 silk_pitch_contour_10_ms_NB_iCDF[ 3 ]; /* 3 */ +extern const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ]; /* 32 */ +extern const opus_uint8 silk_pitch_delta_iCDF[ 21 ]; /* 21 */ +extern const opus_uint8 silk_pitch_contour_iCDF[ 34 ]; /* 34 */ +extern const opus_uint8 silk_pitch_contour_NB_iCDF[ 11 ]; /* 11 */ +extern const opus_uint8 silk_pitch_contour_10_ms_iCDF[ 12 ]; /* 12 */ +extern const opus_uint8 silk_pitch_contour_10_ms_NB_iCDF[ 3 ]; /* 3 */ -extern const SKP_uint8 silk_pulses_per_block_iCDF[ N_RATE_LEVELS ][ MAX_PULSES + 2 ]; /* 180 */ -extern const SKP_uint8 silk_pulses_per_block_BITS_Q5[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 2 ]; /* 162 */ +extern const opus_uint8 silk_pulses_per_block_iCDF[ N_RATE_LEVELS ][ MAX_PULSES + 2 ]; /* 180 */ +extern const opus_uint8 silk_pulses_per_block_BITS_Q5[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 2 ]; /* 162 */ -extern const SKP_uint8 silk_rate_levels_iCDF[ 2 ][ N_RATE_LEVELS - 1 ]; /* 18 */ -extern const SKP_uint8 silk_rate_levels_BITS_Q5[ 2 ][ N_RATE_LEVELS - 1 ]; /* 18 */ +extern const opus_uint8 silk_rate_levels_iCDF[ 2 ][ N_RATE_LEVELS - 1 ]; /* 18 */ +extern const opus_uint8 silk_rate_levels_BITS_Q5[ 2 ][ N_RATE_LEVELS - 1 ]; /* 18 */ -extern const SKP_uint8 silk_max_pulses_table[ 4 ]; /* 4 */ +extern const opus_uint8 silk_max_pulses_table[ 4 ]; /* 4 */ -extern const SKP_uint8 silk_shell_code_table0[ 44 ]; /* 44 */ -extern const SKP_uint8 silk_shell_code_table1[ 65 ]; /* 65 */ -extern const SKP_uint8 silk_shell_code_table2[ 90 ]; /* 90 */ -extern const SKP_uint8 silk_shell_code_table3[ 152 ]; /* 152 */ -extern const SKP_uint8 silk_shell_code_table_offsets[ MAX_PULSES + 1 ]; /* 17 */ +extern const opus_uint8 silk_shell_code_table0[ 44 ]; /* 44 */ +extern const opus_uint8 silk_shell_code_table1[ 65 ]; /* 65 */ +extern const opus_uint8 silk_shell_code_table2[ 90 ]; /* 90 */ +extern const opus_uint8 silk_shell_code_table3[ 152 ]; /* 152 */ +extern const opus_uint8 silk_shell_code_table_offsets[ MAX_PULSES + 1 ]; /* 17 */ -extern const SKP_uint8 silk_lsb_iCDF[ 2 ]; /* 2 */ +extern const opus_uint8 silk_lsb_iCDF[ 2 ]; /* 2 */ -extern const SKP_uint8 silk_sign_iCDF[ 36 ]; /* 36 */ +extern const opus_uint8 silk_sign_iCDF[ 36 ]; /* 36 */ -extern const SKP_uint8 silk_uniform3_iCDF[ 3 ]; /* 3 */ -extern const SKP_uint8 silk_uniform4_iCDF[ 4 ]; /* 4 */ -extern const SKP_uint8 silk_uniform5_iCDF[ 5 ]; /* 5 */ -extern const SKP_uint8 silk_uniform6_iCDF[ 6 ]; /* 6 */ -extern const SKP_uint8 silk_uniform8_iCDF[ 8 ]; /* 8 */ +extern const opus_uint8 silk_uniform3_iCDF[ 3 ]; /* 3 */ +extern const opus_uint8 silk_uniform4_iCDF[ 4 ]; /* 4 */ +extern const opus_uint8 silk_uniform5_iCDF[ 5 ]; /* 5 */ +extern const opus_uint8 silk_uniform6_iCDF[ 6 ]; /* 6 */ +extern const opus_uint8 silk_uniform8_iCDF[ 8 ]; /* 8 */ -extern const SKP_uint8 silk_NLSF_EXT_iCDF[ 7 ]; /* 7 */ +extern const opus_uint8 silk_NLSF_EXT_iCDF[ 7 ]; /* 7 */ -extern const SKP_uint8 silk_LTP_per_index_iCDF[ 3 ]; /* 3 */ -extern const SKP_uint8 * const silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ]; /* 3 */ -extern const SKP_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */ -extern const SKP_int16 silk_LTP_gain_middle_avg_RD_Q14; -extern const SKP_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */ -extern const SKP_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */ +extern const opus_uint8 silk_LTP_per_index_iCDF[ 3 ]; /* 3 */ +extern const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ]; /* 3 */ +extern const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ]; /* 3 */ +extern const opus_int16 silk_LTP_gain_middle_avg_RD_Q14; +extern const opus_int8 * const silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ]; /* 168 */ +extern const opus_int8 silk_LTP_vq_sizes[ NB_LTP_CBKS ]; /* 3 */ -extern const SKP_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */ -extern const SKP_int16 silk_LTPScales_table_Q14[ 3 ]; +extern const opus_uint8 silk_LTPscale_iCDF[ 3 ]; /* 4 */ +extern const opus_int16 silk_LTPScales_table_Q14[ 3 ]; -extern const SKP_uint8 silk_type_offset_VAD_iCDF[ 4 ]; /* 4 */ -extern const SKP_uint8 silk_type_offset_no_VAD_iCDF[ 2 ]; /* 2 */ +extern const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ]; /* 4 */ +extern const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ]; /* 2 */ -extern const SKP_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ]; /* 32 */ -extern const SKP_uint8 silk_stereo_pred_joint_iCDF[ 25 ]; /* 25 */ -extern const SKP_uint8 silk_stereo_only_code_mid_iCDF[ 2 ]; /* 2 */ +extern const opus_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ]; /* 32 */ +extern const opus_uint8 silk_stereo_pred_joint_iCDF[ 25 ]; /* 25 */ +extern const opus_uint8 silk_stereo_only_code_mid_iCDF[ 2 ]; /* 2 */ -extern const SKP_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ]; /* 10 */ +extern const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ]; /* 10 */ -extern const SKP_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ]; /* 5 */ +extern const opus_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ]; /* 5 */ extern const silk_NLSF_CB_struct silk_NLSF_CB_WB; extern const silk_NLSF_CB_struct silk_NLSF_CB_NB_MB; /* Piece-wise linear mapping from bitrate in kbps to coding quality in dB SNR */ -extern const SKP_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ]; -extern const SKP_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ]; -extern const SKP_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ]; -extern const SKP_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ]; +extern const opus_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ]; +extern const opus_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ]; +extern const opus_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ]; +extern const opus_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ]; /* Quantization offsets */ -extern const SKP_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ]; +extern const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ]; /* Interpolation points for filter coefficients used in the bandwidth transition smoother */ -extern const SKP_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ]; -extern const SKP_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ]; +extern const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ]; +extern const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ]; /* Rom table with cosine values */ -extern const SKP_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ]; +extern const opus_int16 silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ]; #ifdef __cplusplus } diff --git a/silk/silk_tables_LTP.c b/silk/silk_tables_LTP.c index 851c8cd579eeeae1951d092e76761c3a3fb54772..e86253db1cce6f14f8a12162d20c7087ca286cb6 100644 --- a/silk/silk_tables_LTP.c +++ b/silk/silk_tables_LTP.c @@ -27,57 +27,57 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tables.h" -const SKP_uint8 silk_LTP_per_index_iCDF[3] = { +const opus_uint8 silk_LTP_per_index_iCDF[3] = { 179, 99, 0 }; -const SKP_uint8 silk_LTP_gain_iCDF_0[8] = { +const opus_uint8 silk_LTP_gain_iCDF_0[8] = { 71, 56, 43, 30, 21, 12, 6, 0 }; -const SKP_uint8 silk_LTP_gain_iCDF_1[16] = { +const opus_uint8 silk_LTP_gain_iCDF_1[16] = { 199, 165, 144, 124, 109, 96, 84, 71, 61, 51, 42, 32, 23, 15, 8, 0 }; -const SKP_uint8 silk_LTP_gain_iCDF_2[32] = { +const opus_uint8 silk_LTP_gain_iCDF_2[32] = { 241, 225, 211, 199, 187, 175, 164, 153, 142, 132, 123, 114, 105, 96, 88, 80, 72, 64, 57, 50, 44, 38, 33, 29, 24, 20, 16, 12, 9, 5, 2, 0 }; -const SKP_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; +const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; -const SKP_uint8 silk_LTP_gain_BITS_Q5_0[8] = { +const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { 15, 131, 138, 138, 155, 155, 173, 173 }; -const SKP_uint8 silk_LTP_gain_BITS_Q5_1[16] = { +const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = { 69, 93, 115, 118, 131, 138, 141, 138, 150, 150, 155, 150, 155, 160, 166, 160 }; -const SKP_uint8 silk_LTP_gain_BITS_Q5_2[32] = { +const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { 131, 128, 134, 141, 141, 141, 145, 145, 145, 150, 155, 155, 155, 155, 160, 160, 160, 160, 166, 166, 173, 173, 182, 192, 182, 192, 192, 192, 205, 192, 205, 224 }; -const SKP_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { +const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { silk_LTP_gain_iCDF_0, silk_LTP_gain_iCDF_1, silk_LTP_gain_iCDF_2 }; -const SKP_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { +const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { silk_LTP_gain_BITS_Q5_0, silk_LTP_gain_BITS_Q5_1, silk_LTP_gain_BITS_Q5_2 }; -const SKP_int8 silk_LTP_gain_vq_0[8][5] = +const opus_int8 silk_LTP_gain_vq_0[8][5] = { { 4, 6, 24, 7, 5 @@ -105,7 +105,7 @@ const SKP_int8 silk_LTP_gain_vq_0[8][5] = } }; -const SKP_int8 silk_LTP_gain_vq_1[16][5] = +const opus_int8 silk_LTP_gain_vq_1[16][5] = { { 13, 22, 39, 23, 12 @@ -157,7 +157,7 @@ const SKP_int8 silk_LTP_gain_vq_1[16][5] = } }; -const SKP_int8 silk_LTP_gain_vq_2[32][5] = +const opus_int8 silk_LTP_gain_vq_2[32][5] = { { -6, 27, 61, 39, 5 @@ -257,12 +257,12 @@ const SKP_int8 silk_LTP_gain_vq_2[32][5] = } }; -const SKP_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = { - (SKP_int8 *)&silk_LTP_gain_vq_0[0][0], - (SKP_int8 *)&silk_LTP_gain_vq_1[0][0], - (SKP_int8 *)&silk_LTP_gain_vq_2[0][0] +const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = { + (opus_int8 *)&silk_LTP_gain_vq_0[0][0], + (opus_int8 *)&silk_LTP_gain_vq_1[0][0], + (opus_int8 *)&silk_LTP_gain_vq_2[0][0] }; -const SKP_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { +const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { 8, 16, 32 }; diff --git a/silk/silk_tables_NLSF_CB_NB_MB.c b/silk/silk_tables_NLSF_CB_NB_MB.c index c574289e20a92e7de6215b27e123daf5241833ca..ed566d856b282a043280c04021160804cafed16f 100644 --- a/silk/silk_tables_NLSF_CB_NB_MB.c +++ b/silk/silk_tables_NLSF_CB_NB_MB.c @@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_structs.h" -const SKP_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { +const opus_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { 12, 35, 60, 83, 108, 132, 157, 180, 206, 228, 15, 32, 55, 77, 101, 125, 151, 175, 201, 225, 19, 42, 66, 89, @@ -70,7 +70,7 @@ const SKP_uint8 silk_NLSF_CB1_NB_MB_Q8[ 320 ] = { 64, 84, 104, 118, 156, 177, 201, 230 }; -const SKP_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { +const opus_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { 212, 178, 148, 129, 108, 96, 85, 82, 79, 77, 61, 59, 57, 56, 51, 49, 48, 45, 42, 41, 40, 38, 36, 34, @@ -81,7 +81,7 @@ const SKP_uint8 silk_NLSF_CB1_iCDF_NB_MB[ 64 ] = { 28, 20, 19, 18, 12, 11, 5, 0 }; -const SKP_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { +const opus_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { 16, 0, 0, 0, 0, 99, 66, 36, 36, 34, 36, 34, 34, 34, 34, 83, 69, 36, 52, 34, 116, 102, 70, 68, @@ -104,7 +104,7 @@ const SKP_uint8 silk_NLSF_CB2_SELECT_NB_MB[ 160 ] = { 171, 137, 139, 137, 155, 218, 219, 139 }; -const SKP_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { +const opus_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { 255, 254, 253, 238, 14, 3, 2, 1, 0, 255, 254, 252, 218, 35, 3, 2, 1, 0, 255, 254, 250, 208, 59, 4, @@ -116,7 +116,7 @@ const SKP_uint8 silk_NLSF_CB2_iCDF_NB_MB[ 72 ] = { 254, 236, 173, 95, 37, 7, 1, 0 }; -const SKP_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { +const opus_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { 255, 255, 255, 131, 6, 145, 255, 255, 255, 255, 255, 236, 93, 15, 96, 255, 255, 255, 255, 255, 194, 83, 25, 71, @@ -128,13 +128,13 @@ const SKP_uint8 silk_NLSF_CB2_BITS_NB_MB_Q5[ 72 ] = { 251, 123, 65, 55, 68, 100, 171, 255 }; -const SKP_uint8 silk_NLSF_PRED_NB_MB_Q8[ 18 ] = { +const opus_uint8 silk_NLSF_PRED_NB_MB_Q8[ 18 ] = { 179, 138, 140, 148, 151, 149, 153, 151, 163, 116, 67, 82, 59, 92, 72, 100, 89, 92 }; -const SKP_int16 silk_NLSF_DELTA_MIN_NB_MB_Q15[ 11 ] = { +const opus_int16 silk_NLSF_DELTA_MIN_NB_MB_Q15[ 11 ] = { 250, 3, 6, 3, 3, 3, 4, 3, 3, 3, 461 }; diff --git a/silk/silk_tables_NLSF_CB_WB.c b/silk/silk_tables_NLSF_CB_WB.c index 3d3b4e6e9f6e728b512405eb7fde59a08a9b5a14..06a95b55cc2aa02ba6e4d44d2c8534b86bc445ad 100644 --- a/silk/silk_tables_NLSF_CB_WB.c +++ b/silk/silk_tables_NLSF_CB_WB.c @@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_structs.h" -const SKP_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { +const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { 7, 23, 38, 54, 69, 85, 100, 116, 131, 147, 162, 178, 193, 208, 223, 239, 13, 25, 41, 55, 69, 83, 98, 112, @@ -94,7 +94,7 @@ const SKP_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = { 110, 119, 129, 141, 175, 198, 218, 237 }; -const SKP_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { +const opus_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { 225, 204, 201, 184, 183, 175, 158, 154, 153, 135, 119, 115, 113, 110, 109, 99, 98, 95, 79, 68, 52, 50, 48, 45, @@ -105,7 +105,7 @@ const SKP_uint8 silk_NLSF_CB1_iCDF_WB[ 64 ] = { 24, 21, 11, 6, 5, 4, 3, 0 }; -const SKP_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { +const opus_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { 0, 0, 0, 0, 0, 0, 0, 1, 100, 102, 102, 68, 68, 36, 34, 96, 164, 107, 158, 185, 180, 185, 139, 102, @@ -140,7 +140,7 @@ const SKP_uint8 silk_NLSF_CB2_SELECT_WB[ 256 ] = { 100, 107, 120, 119, 36, 197, 24, 0 }; -const SKP_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { +const opus_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { 255, 254, 253, 244, 12, 3, 2, 1, 0, 255, 254, 252, 224, 38, 3, 2, 1, 0, 255, 254, 251, 209, 57, 4, @@ -152,7 +152,7 @@ const SKP_uint8 silk_NLSF_CB2_iCDF_WB[ 72 ] = { 248, 227, 177, 100, 19, 2, 1, 0 }; -const SKP_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { +const opus_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { 255, 255, 255, 156, 4, 154, 255, 255, 255, 255, 255, 227, 102, 15, 92, 255, 255, 255, 255, 255, 213, 83, 24, 72, @@ -164,14 +164,14 @@ const SKP_uint8 silk_NLSF_CB2_BITS_WB_Q5[ 72 ] = { 166, 116, 76, 55, 53, 125, 255, 255 }; -const SKP_uint8 silk_NLSF_PRED_WB_Q8[ 30 ] = { +const opus_uint8 silk_NLSF_PRED_WB_Q8[ 30 ] = { 175, 148, 160, 176, 178, 173, 174, 164, 177, 174, 196, 182, 198, 192, 182, 68, 62, 66, 60, 72, 117, 85, 90, 118, 136, 151, 142, 160, 142, 155 }; -const SKP_int16 silk_NLSF_DELTA_MIN_WB_Q15[ 17 ] = { +const opus_int16 silk_NLSF_DELTA_MIN_WB_Q15[ 17 ] = { 100, 3, 40, 3, 3, 3, 5, 14, 14, 10, 11, 3, 8, 9, 7, 3, 347 diff --git a/silk/silk_tables_gain.c b/silk/silk_tables_gain.c index a03ff283e0e31d7204a47cc730cc61e8db8876f7..cda087a1dcb79bb84b38b20e0000e752bef27041 100644 --- a/silk/silk_tables_gain.c +++ b/silk/silk_tables_gain.c @@ -32,7 +32,7 @@ extern "C" { #endif -const SKP_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] = +const opus_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] = { { 224, 112, 44, 15, 3, 2, 1, 0 @@ -45,7 +45,7 @@ const SKP_uint8 silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] = } }; -const SKP_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ] = { +const opus_uint8 silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ] = { 250, 245, 234, 203, 71, 50, 42, 38, 35, 33, 31, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, diff --git a/silk/silk_tables_other.c b/silk/silk_tables_other.c index 80dfde0371d94fc999a746cc69edf26452824adc..b7d3ad9d338bec2faceec563f83c2a72dbc4be03 100644 --- a/silk/silk_tables_other.c +++ b/silk/silk_tables_other.c @@ -35,81 +35,81 @@ extern "C" #endif /* Piece-wise linear mapping from bitrate in kbps to coding quality in dB SNR */ -const SKP_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ] = { +const opus_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ] = { 0, 8000, 9400, 11500, 13500, 17500, 25000, MAX_TARGET_RATE_BPS }; -const SKP_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ] = { +const opus_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ] = { 0, 9000, 12000, 14500, 18500, 24500, 35500, MAX_TARGET_RATE_BPS }; -const SKP_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ] = { +const opus_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ] = { 0, 10500, 14000, 17000, 21500, 28500, 42000, MAX_TARGET_RATE_BPS }; -const SKP_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ] = { +const opus_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ] = { 19, 29, 35, 39, 44, 50, 60, 80 }; /* Tables for stereo predictor coding */ -const SKP_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ] = { +const opus_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ] = { -13732, -10050, -8266, -7526, -6500, -5000, -2950, -820, 820, 2950, 5000, 6500, 7526, 8266, 10050, 13732 }; -const SKP_uint8 silk_stereo_pred_joint_iCDF[ 25 ] = { +const opus_uint8 silk_stereo_pred_joint_iCDF[ 25 ] = { 249, 247, 246, 245, 244, 234, 210, 202, 201, 200, 197, 174, 82, 59, 56, 55, 54, 46, 22, 12, 11, 10, 9, 7, 0 }; -const SKP_uint8 silk_stereo_only_code_mid_iCDF[ 2 ] = { 64, 0 }; +const opus_uint8 silk_stereo_only_code_mid_iCDF[ 2 ] = { 64, 0 }; /* Tables for LBRR flags */ -const SKP_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; -const SKP_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; -const SKP_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ] = { +const opus_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; +const opus_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; +const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ] = { silk_LBRR_flags_2_iCDF, silk_LBRR_flags_3_iCDF }; /* Table for LSB coding */ -const SKP_uint8 silk_lsb_iCDF[ 2 ] = { 120, 0 }; +const opus_uint8 silk_lsb_iCDF[ 2 ] = { 120, 0 }; /* Tables for LTPScale */ -const SKP_uint8 silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 }; +const opus_uint8 silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 }; /* Tables for signal type and offset coding */ -const SKP_uint8 silk_type_offset_VAD_iCDF[ 4 ] = { +const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ] = { 232, 158, 10, 0 }; -const SKP_uint8 silk_type_offset_no_VAD_iCDF[ 2 ] = { +const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ] = { 230, 0 }; /* Tables for NLSF interpolation factor */ -const SKP_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ] = { 243, 221, 192, 181, 0 }; +const opus_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ] = { 243, 221, 192, 181, 0 }; /* Quantization offsets */ -const SKP_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = { +const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = { { OFFSET_UVL_Q10, OFFSET_UVH_Q10 }, { OFFSET_VL_Q10, OFFSET_VH_Q10 } }; /* Table for LTPScale */ -const SKP_int16 silk_LTPScales_table_Q14[ 3 ] = { 15565, 12288, 8192 }; +const opus_int16 silk_LTPScales_table_Q14[ 3 ] = { 15565, 12288, 8192 }; /* Uniform entropy tables */ -const SKP_uint8 silk_uniform3_iCDF[ 3 ] = { 171, 85, 0 }; -const SKP_uint8 silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 }; -const SKP_uint8 silk_uniform5_iCDF[ 5 ] = { 205, 154, 102, 51, 0 }; -const SKP_uint8 silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 }; -const SKP_uint8 silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 }; +const opus_uint8 silk_uniform3_iCDF[ 3 ] = { 171, 85, 0 }; +const opus_uint8 silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 }; +const opus_uint8 silk_uniform5_iCDF[ 5 ] = { 205, 154, 102, 51, 0 }; +const opus_uint8 silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 }; +const opus_uint8 silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 }; -const SKP_uint8 silk_NLSF_EXT_iCDF[ 7 ] = { 100, 40, 16, 7, 3, 1, 0 }; +const opus_uint8 silk_NLSF_EXT_iCDF[ 7 ] = { 100, 40, 16, 7, 3, 1, 0 }; /* Elliptic/Cauer filters designed with 0.1 dB passband ripple, 80 dB minimum stopband attenuation, and [0.95 : 0.15 : 0.35] normalized cut off frequencies. */ /* Interpolation points for filter coefficients used in the bandwidth transition smoother */ -const SKP_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ] = +const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ] = { { 250767114, 501534038, 250767114 }, { 209867381, 419732057, 209867381 }, @@ -119,7 +119,7 @@ const SKP_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ] }; /* Interpolation points for filter coefficients used in the bandwidth transition smoother */ -const SKP_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ] = +const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ] = { { 506393414, 239854379 }, { 411067935, 169683996 }, diff --git a/silk/silk_tables_pitch_lag.c b/silk/silk_tables_pitch_lag.c index aa71e59248fafda629f2270419985a3129cbd83b..f534df53d57fe1ad6b829a3a2c7964f9deb1a688 100644 --- a/silk/silk_tables_pitch_lag.c +++ b/silk/silk_tables_pitch_lag.c @@ -27,20 +27,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tables.h" -const SKP_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ] = { +const opus_uint8 silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ] = { 253, 250, 244, 233, 212, 182, 150, 131, 120, 110, 98, 85, 72, 60, 49, 40, 32, 25, 19, 15, 13, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; -const SKP_uint8 silk_pitch_delta_iCDF[21] = { +const opus_uint8 silk_pitch_delta_iCDF[21] = { 210, 208, 206, 203, 199, 193, 183, 168, 142, 104, 74, 52, 37, 27, 20, 14, 10, 6, 4, 2, 0 }; -const SKP_uint8 silk_pitch_contour_iCDF[34] = { +const opus_uint8 silk_pitch_contour_iCDF[34] = { 223, 201, 183, 167, 152, 138, 124, 111, 98, 88, 79, 70, 62, 56, 50, 44, 39, 35, 31, 27, 24, 21, 18, 16, @@ -48,17 +48,17 @@ const SKP_uint8 silk_pitch_contour_iCDF[34] = { 1, 0 }; -const SKP_uint8 silk_pitch_contour_NB_iCDF[11] = { +const opus_uint8 silk_pitch_contour_NB_iCDF[11] = { 188, 176, 155, 138, 119, 97, 67, 43, 26, 10, 0 }; -const SKP_uint8 silk_pitch_contour_10_ms_iCDF[12] = { +const opus_uint8 silk_pitch_contour_10_ms_iCDF[12] = { 165, 119, 80, 61, 47, 35, 27, 20, 14, 9, 4, 0 }; -const SKP_uint8 silk_pitch_contour_10_ms_NB_iCDF[3] = { +const opus_uint8 silk_pitch_contour_10_ms_NB_iCDF[3] = { 113, 63, 0 }; diff --git a/silk/silk_tables_pulses_per_block.c b/silk/silk_tables_pulses_per_block.c index f6984cb81fd920f6bf94dadce615eb4644e992e0..1c59bad2d7fcc25b945856fff9527af454501fbd 100644 --- a/silk/silk_tables_pulses_per_block.c +++ b/silk/silk_tables_pulses_per_block.c @@ -27,11 +27,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tables.h" -const SKP_uint8 silk_max_pulses_table[ 4 ] = { +const opus_uint8 silk_max_pulses_table[ 4 ] = { 8, 10, 12, 16 }; -const SKP_uint8 silk_pulses_per_block_iCDF[ 10 ][ 18 ] = { +const opus_uint8 silk_pulses_per_block_iCDF[ 10 ][ 18 ] = { { 125, 51, 26, 18, 15, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, @@ -84,7 +84,7 @@ const SKP_uint8 silk_pulses_per_block_iCDF[ 10 ][ 18 ] = { } }; -const SKP_uint8 silk_pulses_per_block_BITS_Q5[ 9 ][ 18 ] = { +const opus_uint8 silk_pulses_per_block_BITS_Q5[ 9 ][ 18 ] = { { 31, 57, 107, 160, 205, 205, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -132,7 +132,7 @@ const SKP_uint8 silk_pulses_per_block_BITS_Q5[ 9 ][ 18 ] = { } }; -const SKP_uint8 silk_rate_levels_iCDF[ 2 ][ 9 ] = +const opus_uint8 silk_rate_levels_iCDF[ 2 ][ 9 ] = { { 241, 190, 178, 132, 87, 74, 41, 14, @@ -144,7 +144,7 @@ const SKP_uint8 silk_rate_levels_iCDF[ 2 ][ 9 ] = } }; -const SKP_uint8 silk_rate_levels_BITS_Q5[ 2 ][ 9 ] = +const opus_uint8 silk_rate_levels_BITS_Q5[ 2 ][ 9 ] = { { 131, 74, 141, 79, 80, 138, 95, 104, @@ -156,7 +156,7 @@ const SKP_uint8 silk_rate_levels_BITS_Q5[ 2 ][ 9 ] = } }; -const SKP_uint8 silk_shell_code_table0[ 44 ] = { +const opus_uint8 silk_shell_code_table0[ 44 ] = { 128, 0, 214, 42, 0, 235, 128, 21, 0, 244, 184, 72, 11, 0, 248, 214, 128, 42, 7, 0, 248, 225, 170, 80, @@ -165,7 +165,7 @@ const SKP_uint8 silk_shell_code_table0[ 44 ] = { 35, 15, 5, 0 }; -const SKP_uint8 silk_shell_code_table1[ 65 ] = { +const opus_uint8 silk_shell_code_table1[ 65 ] = { 129, 0, 207, 50, 0, 236, 129, 20, 0, 245, 185, 72, 10, 0, 249, 213, 129, 42, 6, 0, 250, 226, 169, 87, @@ -177,7 +177,7 @@ const SKP_uint8 silk_shell_code_table1[ 65 ] = { 0 }; -const SKP_uint8 silk_shell_code_table2[ 90 ] = { +const opus_uint8 silk_shell_code_table2[ 90 ] = { 129, 0, 203, 54, 0, 234, 129, 23, 0, 245, 184, 73, 10, 0, 250, 215, 129, 41, 5, 0, 252, 232, 173, 86, @@ -192,7 +192,7 @@ const SKP_uint8 silk_shell_code_table2[ 90 ] = { 1, 0 }; -const SKP_uint8 silk_shell_code_table3[ 152 ] = { +const opus_uint8 silk_shell_code_table3[ 152 ] = { 130, 0, 200, 58, 0, 231, 130, 26, 0, 244, 184, 76, 12, 0, 249, 214, 130, 43, 6, 0, 252, 232, 173, 87, @@ -214,13 +214,13 @@ const SKP_uint8 silk_shell_code_table3[ 152 ] = { 76, 42, 18, 4, 3, 2, 1, 0 }; -const SKP_uint8 silk_shell_code_table_offsets[ 17 ] = { +const opus_uint8 silk_shell_code_table_offsets[ 17 ] = { 0, 0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, 104, 119, 135 }; -const SKP_uint8 silk_sign_iCDF[ 36 ] = { +const opus_uint8 silk_sign_iCDF[ 36 ] = { 49, 67, 77, 82, 93, 99, 11, 18, 24, 31, 36, 45, 46, 66, 78, 87, 94, 104, 14, 21, 32, 42, 51, 66, diff --git a/silk/silk_typedef.h b/silk/silk_typedef.h index 40ca766bfef65277e0b63fdaca3541c21f22e77b..14ebcdfdb117d3f7e275e05dd4b407ff9c6a8622 100644 --- a/silk/silk_typedef.h +++ b/silk/silk_typedef.h @@ -28,6 +28,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _SILK_TYPEDEF_H_ #define _SILK_TYPEDEF_H_ +#include "opus_types.h" + #ifndef SKP_USE_DOUBLE_PRECISION_FLOATS #define SKP_USE_DOUBLE_PRECISION_FLOATS 0 #endif @@ -37,18 +39,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdint.h> #endif -#define SKP_int int /* used for counters etc; at least 16 bits */ -#define SKP_int64 long long -#define SKP_int32 int -#define SKP_int16 short -#define SKP_int8 signed char - -#define SKP_uint unsigned int /* used for counters etc; at least 16 bits */ -#define SKP_uint64 unsigned long long -#define SKP_uint32 unsigned int -#define SKP_uint16 unsigned short -#define SKP_uint8 unsigned char - #define SKP_int_ptr_size intptr_t #if SKP_USE_DOUBLE_PRECISION_FLOATS @@ -67,14 +57,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # define SKP_STR_CASEINSENSITIVE_COMPARE(x, y) strcasecmp(x, y) #endif -#define SKP_int64_MAX ((SKP_int64)0x7FFFFFFFFFFFFFFFLL) // 2^63 - 1 -#define SKP_int64_MIN ((SKP_int64)0x8000000000000000LL) // -2^63 +#define SKP_int64_MAX ((opus_int64)0x7FFFFFFFFFFFFFFFLL) // 2^63 - 1 +#define SKP_int64_MIN ((opus_int64)0x8000000000000000LL) // -2^63 #define SKP_int32_MAX 0x7FFFFFFF // 2^31 - 1 = 2147483647 -#define SKP_int32_MIN ((SKP_int32)0x80000000) // -2^31 = -2147483648 +#define SKP_int32_MIN ((opus_int32)0x80000000) // -2^31 = -2147483648 #define SKP_int16_MAX 0x7FFF // 2^15 - 1 = 32767 -#define SKP_int16_MIN ((SKP_int16)0x8000) // -2^15 = -32768 +#define SKP_int16_MIN ((opus_int16)0x8000) // -2^15 = -32768 #define SKP_int8_MAX 0x7F // 2^7 - 1 = 127 -#define SKP_int8_MIN ((SKP_int8)0x80) // -2^7 = -128 +#define SKP_int8_MIN ((opus_int8)0x80) // -2^7 = -128 #define SKP_uint32_MAX 0xFFFFFFFF // 2^32 - 1 = 4294967295 #define SKP_uint32_MIN 0x00000000 diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 42d5e8c4fae059fb348db51bca14f0186fcf35f4..cfefaff14776a684ef1eccd9782fd89b24bcf403 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -151,7 +151,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, int i, silk_ret=0, celt_ret=0; ec_dec dec; silk_DecControlStruct DecControl; - SKP_int32 silk_frame_size; + opus_int32 silk_frame_size; short pcm_celt[960*2]; short pcm_transition[480*2]; @@ -218,7 +218,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, if (mode != MODE_CELT_ONLY) { int lost_flag, decoded_samples; - SKP_int16 *pcm_ptr = pcm; + opus_int16 *pcm_ptr = pcm; if (st->prev_mode==MODE_CELT_ONLY) silk_InitDecoder( silk_dec );