diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-09-16 00:58:26 -0700 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-09-16 00:58:26 -0700 |
commit | fb3a437c9dabb4aafe4a3927158161590ed745ab (patch) | |
tree | 8677d28fbacc7132286a6779d7e8657440a15b18 /silk/float | |
parent | c0f050e7439ef93e256d35377ef20954a0d13b8f (diff) | |
download | opus-fb3a437c9dabb4aafe4a3927158161590ed745ab.tar.gz |
Renaming the SKP_ prefix to silk_
Diffstat (limited to 'silk/float')
34 files changed, 585 insertions, 585 deletions
diff --git a/silk/float/silk_LPC_analysis_filter_FLP.c b/silk/float/silk_LPC_analysis_filter_FLP.c index c221812e..1cfd1d7f 100644 --- a/silk/float/silk_LPC_analysis_filter_FLP.c +++ b/silk/float/silk_LPC_analysis_filter_FLP.c @@ -41,15 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* 16th order LPC analysis filter, does not write first 16 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 16; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -79,15 +79,15 @@ void silk_LPC_analysis_filter16_FLP( /* 14th order LPC analysis filter, does not write first 14 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 14; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -115,15 +115,15 @@ void silk_LPC_analysis_filter14_FLP( /* 12th order LPC analysis filter, does not write first 12 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 12; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -149,15 +149,15 @@ void silk_LPC_analysis_filter12_FLP( /* 10th order LPC analysis filter, does not write first 10 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 10; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -181,15 +181,15 @@ void silk_LPC_analysis_filter10_FLP( /* 8th order LPC analysis filter, does not write first 8 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 8; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -211,15 +211,15 @@ void silk_LPC_analysis_filter8_FLP( /* 6th order LPC analysis filter, does not write first 6 samples */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length /* I Length of input signal */ ) { opus_int ix; - SKP_float LPC_pred; - const SKP_float *s_ptr; + silk_float LPC_pred; + const silk_float *s_ptr; for ( ix = 6; ix < length; ix++) { s_ptr = &s[ix - 1]; @@ -245,14 +245,14 @@ void silk_LPC_analysis_filter6_FLP( /************************************************/ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ const opus_int length, /* I Length of input signal */ const opus_int Order /* I LPC order */ ) { - SKP_assert( Order <= length ); + silk_assert( Order <= length ); switch( Order ) { case 6: @@ -280,11 +280,11 @@ void silk_LPC_analysis_filter_FLP( break; default: - SKP_assert( 0 ); + silk_assert( 0 ); break; } /* Set first Order output samples to zero */ - SKP_memset( r_LPC, 0, Order * sizeof( SKP_float ) ); + silk_memset( r_LPC, 0, Order * sizeof( silk_float ) ); } diff --git a/silk/float/silk_LPC_inv_pred_gain_FLP.c b/silk/float/silk_LPC_inv_pred_gain_FLP.c index bbff53ab..29c0c0d2 100644 --- a/silk/float/silk_LPC_inv_pred_gain_FLP.c +++ b/silk/float/silk_LPC_inv_pred_gain_FLP.c @@ -38,18 +38,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* test if LPC coefficients are stable (all poles within unit circle) */ /* this code is based on silk_a2k_FLP() */ 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] */ + silk_float *invGain, /* O: inverse prediction gain, energy domain */ + const silk_float *A, /* I: prediction coefficients [order] */ opus_int32 order /* I: prediction order */ ) { opus_int k, n; double rc, rc_mult1, rc_mult2; - SKP_float Atmp[ 2 ][ SILK_MAX_ORDER_LPC ]; - SKP_float *Aold, *Anew; + silk_float Atmp[ 2 ][ SILK_MAX_ORDER_LPC ]; + silk_float *Aold, *Anew; Anew = Atmp[ order & 1 ]; - SKP_memcpy( Anew, A, order * sizeof(SKP_float) ); + silk_memcpy( Anew, A, order * sizeof(silk_float) ); *invGain = 1.0f; for( k = order - 1; k > 0; k-- ) { @@ -59,12 +59,12 @@ opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherw } rc_mult1 = 1.0f - rc * rc; rc_mult2 = 1.0f / rc_mult1; - *invGain *= (SKP_float)rc_mult1; + *invGain *= (silk_float)rc_mult1; /* swap pointers */ Aold = Anew; Anew = Atmp[ k & 1 ]; for( n = 0; n < k; n++ ) { - Anew[ n ] = (SKP_float)( ( Aold[ n ] - Aold[ k - n - 1 ] * rc ) * rc_mult2 ); + Anew[ n ] = (silk_float)( ( Aold[ n ] - Aold[ k - n - 1 ] * rc ) * rc_mult2 ); } } rc = -Anew[ 0 ]; @@ -72,6 +72,6 @@ opus_int silk_LPC_inverse_pred_gain_FLP( /* O: returns 1 if unstable, otherw return 1; } rc_mult1 = 1.0f - rc * rc; - *invGain *= (SKP_float)rc_mult1; + *invGain *= (silk_float)rc_mult1; return 0; } diff --git a/silk/float/silk_LTP_analysis_filter_FLP.c b/silk/float/silk_LTP_analysis_filter_FLP.c index a02d09d9..4b54c0f6 100644 --- a/silk/float/silk_LTP_analysis_filter_FLP.c +++ b/silk/float/silk_LTP_analysis_filter_FLP.c @@ -32,20 +32,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main_FLP.h" 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 */ + silk_float *LTP_res, /* O LTP res MAX_NB_SUBFR*(pre_lgth+subfr_lngth) */ + const silk_float *x, /* I Input signal, with preceeding samples */ + const silk_float B[ LTP_ORDER * MAX_NB_SUBFR ], /* I LTP coefficients for each subframe */ const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ - const SKP_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ + const silk_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ 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; + const silk_float *x_ptr, *x_lag_ptr; + silk_float Btmp[ LTP_ORDER ]; + silk_float *LTP_res_ptr; + silk_float inv_gain; opus_int k, i, j; x_ptr = x; diff --git a/silk/float/silk_LTP_scale_ctrl_FLP.c b/silk/float/silk_LTP_scale_ctrl_FLP.c index 7ff2325b..bd4405dd 100644 --- a/silk/float/silk_LTP_scale_ctrl_FLP.c +++ b/silk/float/silk_LTP_scale_ctrl_FLP.c @@ -40,17 +40,17 @@ void silk_LTP_scale_ctrl_FLP( /* 1st order high-pass filter */ /*g_HP(n) = g(n) - 0.5 * g(n-1) + 0.5 * g_HP(n-1);*/ - psEnc->HPLTPredCodGain = SKP_max_float( psEncCtrl->LTPredCodGain - 0.5f * psEnc->prevLTPredCodGain, 0.0f ) + psEnc->HPLTPredCodGain = silk_max_float( psEncCtrl->LTPredCodGain - 0.5f * psEnc->prevLTPredCodGain, 0.0f ) + 0.5f * psEnc->HPLTPredCodGain; psEnc->prevLTPredCodGain = psEncCtrl->LTPredCodGain; /* 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 = (opus_int8)SKP_LIMIT( round_loss * psEnc->HPLTPredCodGain * 0.1f, 0.0f, 2.0f ); + psEnc->sCmn.indices.LTP_scaleIndex = (opus_int8)silk_LIMIT( round_loss * psEnc->HPLTPredCodGain * 0.1f, 0.0f, 2.0f ); } else { /* Default is minimum scaling */ psEnc->sCmn.indices.LTP_scaleIndex = 0; } - psEncCtrl->LTP_scale = (SKP_float)silk_LTPScales_table_Q14[ psEnc->sCmn.indices.LTP_scaleIndex ] / 16384.0f; + psEncCtrl->LTP_scale = (silk_float)silk_LTPScales_table_Q14[ psEnc->sCmn.indices.LTP_scaleIndex ] / 16384.0f; } diff --git a/silk/float/silk_SigProc_FLP.h b/silk/float/silk_SigProc_FLP.h index 05e620c8..b1019245 100644 --- a/silk/float/silk_SigProc_FLP.h +++ b/silk/float/silk_SigProc_FLP.h @@ -42,43 +42,43 @@ extern "C" /* Chirp (bw expand) LP AR filter */ void silk_bwexpander_FLP( - SKP_float *ar, /* io AR filter to be expanded (without leading 1) */ + silk_float *ar, /* io AR filter to be expanded (without leading 1) */ const opus_int d, /* i length of ar */ - const SKP_float chirp /* i chirp factor (typically in range (0..1) ) */ + const silk_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() */ 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] */ + silk_float *invGain, /* O: inverse prediction gain, energy domain */ + const silk_float *A, /* I: prediction coefficients [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) */ +silk_float silk_schur_FLP( /* O returns residual energy */ + silk_float refl_coef[], /* O reflection coefficients (length order) */ + const silk_float auto_corr[], /* I autocorrelation sequence (length order+1) */ opus_int order /* I order */ ); void silk_k2a_FLP( - SKP_float *A, /* O: prediction coefficients [order] */ - const SKP_float *rc, /* I: reflection coefficients [order] */ + silk_float *A, /* O: prediction coefficients [order] */ + const silk_float *rc, /* I: reflection coefficients [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] */ +silk_float silk_levinsondurbin_FLP( /* O prediction error energy */ + silk_float A[], /* O prediction coefficients [order] */ + const silk_float corr[], /* I input auto-correlations [order + 1] */ 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 */ + silk_float *results, /* o result (length correlationCount) */ + const silk_float *inputData, /* i input data to correlate */ opus_int inputDataSize, /* i length of input */ opus_int correlationCount /* i number of correlation taps to compute */ ); @@ -89,14 +89,14 @@ void silk_autocorrelation_FLP( #define SigProc_PE_MAX_COMPLEX 2 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 */ + const silk_float *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 */ - SKP_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ + silk_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ 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 silk_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */ + const silk_float search_thres2, /* 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 */ @@ -105,47 +105,47 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvo #define PI (3.1415926536f) void silk_insertion_sort_decreasing_FLP( - SKP_float *a, /* I/O: Unsorted / Sorted vector */ + silk_float *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 */ ); /* 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) */ +silk_float silk_burg_modified_FLP( /* O returns residual energy */ + silk_float A[], /* O prediction coefficients (length order) */ + const silk_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */ 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 silk_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */ const opus_int D /* I order */ ); /* multiply a vector by a constant */ void silk_scale_vector_FLP( - SKP_float *data1, - SKP_float gain, + silk_float *data1, + silk_float gain, opus_int dataSize ); /* copy and multiply a vector by a constant */ void silk_scale_copy_vector_FLP( - SKP_float *data_out, - const SKP_float *data_in, - SKP_float gain, + silk_float *data_out, + const silk_float *data_in, + silk_float gain, opus_int dataSize ); -/* inner product of two SKP_float arrays, with result as double */ +/* inner product of two silk_float arrays, with result as double */ double silk_inner_product_FLP( - const SKP_float *data1, - const SKP_float *data2, + const silk_float *data1, + const silk_float *data2, opus_int dataSize ); -/* sum of squares of a SKP_float array, with result as double */ +/* sum of squares of a silk_float array, with result as double */ double silk_energy_FLP( - const SKP_float *data, + const silk_float *data, opus_int dataSize ); @@ -153,21 +153,21 @@ double silk_energy_FLP( /* MACROS */ /********************************************************************/ -#define SKP_min_float(a, b) (((a) < (b)) ? (a) : (b)) -#define SKP_max_float(a, b) (((a) > (b)) ? (a) : (b)) -#define SKP_abs_float(a) ((SKP_float)fabs(a)) +#define silk_min_float(a, b) (((a) < (b)) ? (a) : (b)) +#define silk_max_float(a, b) (((a) > (b)) ? (a) : (b)) +#define silk_abs_float(a) ((silk_float)fabs(a)) -#define SKP_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ +#define silk_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ : ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a)))) /* sigmoid function */ -static inline SKP_float SKP_sigmoid(SKP_float x) +static inline silk_float silk_sigmoid(silk_float x) { - return (SKP_float)(1.0 / (1.0 + exp(-x))); + return (silk_float)(1.0 / (1.0 + exp(-x))); } /* floating-point to integer conversion (rounding) */ -static inline opus_int32 SKP_float2int(double x) +static inline opus_int32 silk_float2int(double x) { #ifdef _WIN32 double t = x + 6755399441055744.0; @@ -178,9 +178,9 @@ static inline opus_int32 SKP_float2int(double x) } /* floating-point to integer conversion (rounding) */ -static inline void SKP_float2short_array( +static inline void silk_float2short_array( opus_int16 *out, - const SKP_float *in, + const silk_float *in, opus_int32 length ) { @@ -188,29 +188,29 @@ static inline void SKP_float2short_array( for (k = length-1; k >= 0; k--) { #ifdef _WIN32 double t = in[k] + 6755399441055744.0; - out[k] = (opus_int16)SKP_SAT16(*(( opus_int32 * )( &t ))); + out[k] = (opus_int16)silk_SAT16(*(( opus_int32 * )( &t ))); #else double x = in[k]; - out[k] = (opus_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 ); + out[k] = (opus_int16)silk_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 ); #endif } } /* integer to floating-point conversion */ -static inline void SKP_short2float_array( - SKP_float *out, +static inline void silk_short2float_array( + silk_float *out, const opus_int16 *in, opus_int32 length ) { opus_int32 k; for (k = length-1; k >= 0; k--) { - out[k] = (SKP_float)in[k]; + out[k] = (silk_float)in[k]; } } /* using log2() helps the fixed-point conversion */ -static inline SKP_float silk_log2( double x ) { return ( SKP_float )( 3.32192809488736 * log10( x ) ); } +static inline silk_float silk_log2( double x ) { return ( silk_float )( 3.32192809488736 * log10( x ) ); } #ifdef __cplusplus } diff --git a/silk/float/silk_apply_sine_window_FLP.c b/silk/float/silk_apply_sine_window_FLP.c index def99334..9a82d9c2 100644 --- a/silk/float/silk_apply_sine_window_FLP.c +++ b/silk/float/silk_apply_sine_window_FLP.c @@ -36,19 +36,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* 1 -> sine window from 0 to pi/2 */ /* 2 -> sine window from pi/2 to pi */ void silk_apply_sine_window_FLP( - SKP_float px_win[], /* O Pointer to windowed signal */ - const SKP_float px[], /* I Pointer to input signal */ + silk_float px_win[], /* O Pointer to windowed signal */ + const silk_float 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 */ ) { opus_int k; - SKP_float freq, c, S0, S1; + silk_float freq, c, S0, S1; - SKP_assert( win_type == 1 || win_type == 2 ); + silk_assert( win_type == 1 || win_type == 2 ); /* Length must be multiple of 4 */ - SKP_assert( ( length & 3 ) == 0 ); + silk_assert( ( length & 3 ) == 0 ); freq = PI / ( length + 1 ); diff --git a/silk/float/silk_autocorrelation_FLP.c b/silk/float/silk_autocorrelation_FLP.c index 540512ce..5c6662a3 100644 --- a/silk/float/silk_autocorrelation_FLP.c +++ b/silk/float/silk_autocorrelation_FLP.c @@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* compute autocorrelation */ void silk_autocorrelation_FLP( - SKP_float *results, /* O result (length correlationCount) */ - const SKP_float *inputData, /* I input data to correlate */ + silk_float *results, /* O result (length correlationCount) */ + const silk_float *inputData, /* I input data to correlate */ opus_int inputDataSize, /* I length of input */ opus_int correlationCount /* I number of correlation taps to compute */ ) @@ -47,6 +47,6 @@ void silk_autocorrelation_FLP( } for( i = 0; i < correlationCount; i++ ) { - results[ i ] = (SKP_float)silk_inner_product_FLP( inputData, inputData + i, inputDataSize - i ); + results[ i ] = (silk_float)silk_inner_product_FLP( inputData, inputData + i, inputDataSize - i ); } } diff --git a/silk/float/silk_burg_modified_FLP.c b/silk/float/silk_burg_modified_FLP.c index bf9278d8..24806aed 100644 --- a/silk/float/silk_burg_modified_FLP.c +++ b/silk/float/silk_burg_modified_FLP.c @@ -35,35 +35,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MAX_NB_SUBFR 4 /* 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) */ +silk_float silk_burg_modified_FLP( /* O returns residual energy */ + silk_float A[], /* O prediction coefficients (length order) */ + const silk_float x[], /* I input signal, length: nb_subfr*(D+L_sub) */ 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 silk_float WhiteNoiseFrac, /* I fraction added to zero-lag autocorrelation */ const opus_int D /* I order */ ) { opus_int k, n, s; double C0, num, nrg_f, nrg_b, rc, Atmp, tmp1, tmp2; - const SKP_float *x_ptr; + const silk_float *x_ptr; double C_first_row[ SILK_MAX_ORDER_LPC ], C_last_row[ SILK_MAX_ORDER_LPC ]; double CAf[ SILK_MAX_ORDER_LPC + 1 ], CAb[ SILK_MAX_ORDER_LPC + 1 ]; double Af[ SILK_MAX_ORDER_LPC ]; - SKP_assert( subfr_length * nb_subfr <= MAX_FRAME_SIZE ); - SKP_assert( nb_subfr <= MAX_NB_SUBFR ); + silk_assert( subfr_length * nb_subfr <= MAX_FRAME_SIZE ); + silk_assert( nb_subfr <= MAX_NB_SUBFR ); /* Compute autocorrelations, added over subframes */ C0 = silk_energy_FLP( x, nb_subfr * subfr_length ); - SKP_memset( C_first_row, 0, SILK_MAX_ORDER_LPC * sizeof( double ) ); + silk_memset( C_first_row, 0, SILK_MAX_ORDER_LPC * sizeof( double ) ); 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 ] += silk_inner_product_FLP( x_ptr, x_ptr + n, subfr_length - n ); } } - SKP_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( double ) ); + silk_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( double ) ); /* Initialize */ CAb[ 0 ] = CAf[ 0 ] = C0 + WhiteNoiseFrac * C0 + 1e-9f; @@ -109,12 +109,12 @@ SKP_float silk_burg_modified_FLP( /* O returns residual energy nrg_b += CAb[ k + 1 ] * Atmp; nrg_f += CAf[ k + 1 ] * Atmp; } - SKP_assert( nrg_f > 0.0 ); - SKP_assert( nrg_b > 0.0 ); + silk_assert( nrg_f > 0.0 ); + silk_assert( nrg_b > 0.0 ); /* Calculate the next order reflection (parcor) coefficient */ rc = -2.0 * num / ( nrg_f + nrg_b ); - SKP_assert( rc > -1.0 && rc < 1.0 ); + silk_assert( rc > -1.0 && rc < 1.0 ); /* Update the AR coefficients */ for( k = 0; k < (n + 1) >> 1; k++ ) { @@ -140,9 +140,9 @@ SKP_float silk_burg_modified_FLP( /* O returns residual energy Atmp = Af[ k ]; nrg_f += CAf[ k + 1 ] * Atmp; tmp1 += Atmp * Atmp; - A[ k ] = (SKP_float)(-Atmp); + A[ k ] = (silk_float)(-Atmp); } nrg_f -= WhiteNoiseFrac * C0 * tmp1; - return (SKP_float)nrg_f; + return (silk_float)nrg_f; } diff --git a/silk/float/silk_bwexpander_FLP.c b/silk/float/silk_bwexpander_FLP.c index ddae86a8..4a0088ae 100644 --- a/silk/float/silk_bwexpander_FLP.c +++ b/silk/float/silk_bwexpander_FLP.c @@ -34,13 +34,13 @@ 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) */ + silk_float *ar, /* I/O AR filter to be expanded (without leading 1) */ const opus_int d, /* I length of ar */ - const SKP_float chirp /* I chirp factor (typically in range (0..1) ) */ + const silk_float chirp /* I chirp factor (typically in range (0..1) ) */ ) { opus_int i; - SKP_float cfac = chirp; + silk_float cfac = chirp; for( i = 0; i < d - 1; i++ ) { ar[ i ] *= cfac; diff --git a/silk/float/silk_corrMatrix_FLP.c b/silk/float/silk_corrMatrix_FLP.c index 1d92da8a..d66107af 100644 --- a/silk/float/silk_corrMatrix_FLP.c +++ b/silk/float/silk_corrMatrix_FLP.c @@ -37,56 +37,56 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Calculates correlation vector X'*t */ 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 silk_float *x, /* I x vector [L+order-1] used to create X */ + const silk_float *t, /* I Target vector [L] */ 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] */ + silk_float *Xt /* O X'*t correlation vector [order] */ ) { opus_int lag; - const SKP_float *ptr1; + const silk_float *ptr1; ptr1 = &x[ Order - 1 ]; /* Points to first sample of column 0 of X: X[:,0] */ for( lag = 0; lag < Order; lag++ ) { /* Calculate X[:,lag]'*t */ - Xt[ lag ] = (SKP_float)silk_inner_product_FLP( ptr1, t, L ); + Xt[ lag ] = (silk_float)silk_inner_product_FLP( ptr1, t, L ); ptr1--; /* Next column of X */ } } /* Calculates correlation matrix X'*X */ void silk_corrMatrix_FLP( - const SKP_float *x, /* I x vector [ L+order-1 ] used to create X */ + const silk_float *x, /* I x vector [ L+order-1 ] used to create X */ 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] */ + silk_float *XX /* O X'*X correlation matrix [order x order] */ ) { opus_int j, lag; double energy; - const SKP_float *ptr1, *ptr2; + const silk_float *ptr1, *ptr2; ptr1 = &x[ Order - 1 ]; /* First sample of column 0 of X */ energy = silk_energy_FLP( ptr1, L ); /* X[:,0]'*X[:,0] */ - matrix_ptr( XX, 0, 0, Order ) = ( SKP_float )energy; + matrix_ptr( XX, 0, 0, Order ) = ( silk_float )energy; for( j = 1; j < Order; j++ ) { /* Calculate X[:,j]'*X[:,j] */ energy += ptr1[ -j ] * ptr1[ -j ] - ptr1[ L - j ] * ptr1[ L - j ]; - matrix_ptr( XX, j, j, Order ) = ( SKP_float )energy; + matrix_ptr( XX, j, j, Order ) = ( silk_float )energy; } ptr2 = &x[ Order - 2 ]; /* First sample of column 1 of X */ for( lag = 1; lag < Order; lag++ ) { /* Calculate X[:,0]'*X[:,lag] */ energy = silk_inner_product_FLP( ptr1, ptr2, L ); - matrix_ptr( XX, lag, 0, Order ) = ( SKP_float )energy; - matrix_ptr( XX, 0, lag, Order ) = ( SKP_float )energy; + matrix_ptr( XX, lag, 0, Order ) = ( silk_float )energy; + matrix_ptr( XX, 0, lag, Order ) = ( silk_float )energy; /* Calculate X[:,j]'*X[:,j + lag] */ for( j = 1; j < ( Order - lag ); j++ ) { energy += ptr1[ -j ] * ptr2[ -j ] - ptr1[ L - j ] * ptr2[ L - j ]; - matrix_ptr( XX, lag + j, j, Order ) = ( SKP_float )energy; - matrix_ptr( XX, j, lag + j, Order ) = ( SKP_float )energy; + matrix_ptr( XX, lag + j, j, Order ) = ( silk_float )energy; + matrix_ptr( XX, j, lag + j, Order ) = ( silk_float )energy; } ptr2--; /* Next column of X */ } diff --git a/silk/float/silk_encode_frame_FLP.c b/silk/float/silk_encode_frame_FLP.c index 2fc701de..fce61601 100644 --- a/silk/float/silk_encode_frame_FLP.c +++ b/silk/float/silk_encode_frame_FLP.c @@ -43,9 +43,9 @@ opus_int silk_encode_frame_FLP( { silk_encoder_control_FLP sEncCtrl; 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 ]; + silk_float *x_frame, *res_pitch_frame; + silk_float xfw[ MAX_FRAME_LENGTH ]; + silk_float res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ]; TIC(ENCODE_FRAME) @@ -96,7 +96,7 @@ TOC(VAD) /*******************************************/ /* Copy new frame to front of input buffer */ /*******************************************/ - SKP_short2float_array( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf + 1, psEnc->sCmn.frame_length ); + silk_short2float_array( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf + 1, psEnc->sCmn.frame_length ); /* Add tiny signal to avoid high CPU load from denormalized floating point numbers */ for( i = 0; i < 8; i++ ) { @@ -153,8 +153,8 @@ TIC(NSQ) 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_float ) ); + silk_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], + ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * sizeof( silk_float ) ); /* Parameters needed for next frame */ psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ]; @@ -188,7 +188,7 @@ TOC(ENCODE_PULSES) psEnc->sCmn.first_frame_after_reset = 0; if( ++psEnc->sCmn.nFramesEncoded >= psEnc->sCmn.nFramesPerPacket ) { /* Payload size */ - *pnBytesOut = SKP_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); + *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); /* Reset the number of frames in payload buffer */ psEnc->sCmn.nFramesEncoded = 0; @@ -200,11 +200,11 @@ TOC(ENCODE_FRAME) #ifdef SAVE_ALL_INTERNAL_DATA /*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( xfw.dat, xfw, psEnc->sCmn.frame_length * sizeof( silk_float ) );*/ 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( pitchG_quantized.dat, sEncCtrl.LTPCoef, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( silk_float ) ); + DEBUG_STORE_DATA( LTPcorr.dat, &psEnc->LTPCorr, sizeof( silk_float ) ); + DEBUG_STORE_DATA( gains.dat, sEncCtrl.Gains, psEnc->sCmn.nb_subfr * sizeof( silk_float ) ); 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 ) ); @@ -212,9 +212,9 @@ TOC(ENCODE_FRAME) 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( PredCoef.dat, &sEncCtrl.PredCoef[ 1 ], psEnc->sCmn.predictLPCOrder * sizeof( silk_float ) ); 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 ) );*/ + /*DEBUG_STORE_DATA( xq.dat, psEnc->sCmn.sNSQ.xqBuf, psEnc->sCmn.frame_length * sizeof( silk_float ) );*/ #endif return ret; } @@ -223,12 +223,12 @@ TOC(ENCODE_FRAME) void silk_LBRR_encode_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float xfw[] /* I Input signal */ + const silk_float xfw[] /* I Input signal */ ) { opus_int k; opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; - SKP_float TempGains[ MAX_NB_SUBFR ]; + silk_float TempGains[ MAX_NB_SUBFR ]; SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFramesEncoded ]; silk_nsq_state sNSQ_LBRR; @@ -239,11 +239,11 @@ void silk_LBRR_encode_FLP( psEnc->sCmn.LBRR_flags[ psEnc->sCmn.nFramesEncoded ] = 1; /* Copy noise shaping quantizer state and quantization indices from regular encoding */ - SKP_memcpy( &sNSQ_LBRR, &psEnc->sCmn.sNSQ, sizeof( silk_nsq_state ) ); - SKP_memcpy( psIndices_LBRR, &psEnc->sCmn.indices, sizeof( SideInfoIndices ) ); + silk_memcpy( &sNSQ_LBRR, &psEnc->sCmn.sNSQ, sizeof( silk_nsq_state ) ); + silk_memcpy( psIndices_LBRR, &psEnc->sCmn.indices, sizeof( SideInfoIndices ) ); /* Save original gains */ - SKP_memcpy( TempGains, psEncCtrl->Gains, psEnc->sCmn.nb_subfr * sizeof( SKP_float ) ); + silk_memcpy( TempGains, psEncCtrl->Gains, psEnc->sCmn.nb_subfr * sizeof( silk_float ) ); if( psEnc->sCmn.nFramesEncoded == 0 || psEnc->sCmn.LBRR_flags[ psEnc->sCmn.nFramesEncoded - 1 ] == 0 ) { /* First frame in packet or previous frame not LBRR coded */ @@ -251,7 +251,7 @@ void silk_LBRR_encode_FLP( /* Increase Gains to get target LBRR rate */ psIndices_LBRR->GainsIndices[ 0 ] += psEnc->sCmn.LBRR_GainIncreases; - psIndices_LBRR->GainsIndices[ 0 ] = SKP_min_int( psIndices_LBRR->GainsIndices[ 0 ], N_LEVELS_QGAIN - 1 ); + psIndices_LBRR->GainsIndices[ 0 ] = silk_min_int( psIndices_LBRR->GainsIndices[ 0 ], N_LEVELS_QGAIN - 1 ); } /* Decode to get gains in sync with decoder */ @@ -270,6 +270,6 @@ void silk_LBRR_encode_FLP( psEnc->sCmn.pulses_LBRR[ psEnc->sCmn.nFramesEncoded ], xfw ); /* Restore original gains */ - SKP_memcpy( psEncCtrl->Gains, TempGains, psEnc->sCmn.nb_subfr * sizeof( SKP_float ) ); + silk_memcpy( psEncCtrl->Gains, TempGains, psEnc->sCmn.nb_subfr * sizeof( silk_float ) ); } } diff --git a/silk/float/silk_energy_FLP.c b/silk/float/silk_energy_FLP.c index 2995f314..bb6c7807 100644 --- a/silk/float/silk_energy_FLP.c +++ b/silk/float/silk_energy_FLP.c @@ -31,9 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FLP.h" -/* sum of squares of a SKP_float array, with result as double */ +/* sum of squares of a silk_float array, with result as double */ double silk_energy_FLP( - const SKP_float *data, + const silk_float *data, opus_int dataSize ) { @@ -55,6 +55,6 @@ double silk_energy_FLP( result += data[ i ] * data[ i ]; } - SKP_assert( result >= 0.0 ); + silk_assert( result >= 0.0 ); return result; } diff --git a/silk/float/silk_find_LPC_FLP.c b/silk/float/silk_find_LPC_FLP.c index 463b8891..f98e9505 100644 --- a/silk/float/silk_find_LPC_FLP.c +++ b/silk/float/silk_find_LPC_FLP.c @@ -39,19 +39,19 @@ void silk_find_LPC_FLP( 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 silk_float x[], /* I Input signal */ const opus_int subfr_length, /* I Subframe length incl preceeding samples */ const opus_int nb_subfr /* I: Number of subframes */ ) { opus_int k; - SKP_float a[ MAX_LPC_ORDER ]; + silk_float a[ MAX_LPC_ORDER ]; /* Used only for NLSF interpolation */ double res_nrg, res_nrg_2nd, res_nrg_interp; 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 ]; + silk_float a_tmp[ MAX_LPC_ORDER ]; + silk_float LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; /* Default: No interpolation */ *interpIndex = 4; @@ -77,7 +77,7 @@ void silk_find_LPC_FLP( silk_A2NLSF_FLP( NLSF_Q15, a_tmp, LPC_order ); /* Search over interpolation indices to find the one with lowest residual energy */ - res_nrg_2nd = SKP_float_MAX; + res_nrg_2nd = silk_float_MAX; for( k = 3; k >= 0; k-- ) { /* Interpolate NLSFs for first half */ silk_interpolate( NLSF0_Q15, prev_NLSFq_Q15, NLSF_Q15, k, LPC_order ); @@ -109,5 +109,5 @@ void silk_find_LPC_FLP( silk_A2NLSF_FLP( NLSF_Q15, a, LPC_order ); } - SKP_assert( *interpIndex == 4 || ( useInterpNLSFs && !firstFrameAfterReset && nb_subfr == MAX_NB_SUBFR ) ); + silk_assert( *interpIndex == 4 || ( useInterpNLSFs && !firstFrameAfterReset && nb_subfr == MAX_NB_SUBFR ) ); } diff --git a/silk/float/silk_find_LTP_FLP.c b/silk/float/silk_find_LTP_FLP.c index deb3361d..faf1b982 100644 --- a/silk/float/silk_find_LTP_FLP.c +++ b/silk/float/silk_find_LTP_FLP.c @@ -33,24 +33,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_tuning_parameters.h" void silk_find_LTP_FLP( - SKP_float b[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ - 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 */ + silk_float b[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ + silk_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ + silk_float *LTPredCodGain, /* O LTP coding gain */ + const silk_float r_lpc[], /* I LPC residual */ const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ - const SKP_float Wght[ MAX_NB_SUBFR ], /* I Weights */ + const silk_float Wght[ 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 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 ]; - SKP_float w[ MAX_NB_SUBFR ], nrg[ MAX_NB_SUBFR ], regu; - SKP_float Rr[ LTP_ORDER ], rr[ MAX_NB_SUBFR ]; - const SKP_float *r_ptr, *lag_ptr; + silk_float *b_ptr, temp, *WLTP_ptr; + silk_float LPC_res_nrg, LPC_LTP_res_nrg; + silk_float d[ MAX_NB_SUBFR ], m, g, delta_b[ LTP_ORDER ]; + silk_float w[ MAX_NB_SUBFR ], nrg[ MAX_NB_SUBFR ], regu; + silk_float Rr[ LTP_ORDER ], rr[ MAX_NB_SUBFR ]; + const silk_float *r_ptr, *lag_ptr; b_ptr = b; WLTP_ptr = WLTP; @@ -61,7 +61,7 @@ void silk_find_LTP_FLP( silk_corrMatrix_FLP( lag_ptr, subfr_length, LTP_ORDER, WLTP_ptr ); silk_corrVector_FLP( lag_ptr, r_ptr, subfr_length, LTP_ORDER, Rr ); - rr[ k ] = ( SKP_float )silk_energy_FLP( r_ptr, subfr_length ); + rr[ k ] = ( silk_float )silk_energy_FLP( r_ptr, subfr_length ); regu = 1.0f + rr[ k ] + matrix_ptr( WLTP_ptr, 0, 0, LTP_ORDER ) + matrix_ptr( WLTP_ptr, LTP_ORDER-1, LTP_ORDER-1, LTP_ORDER ); @@ -90,7 +90,7 @@ void silk_find_LTP_FLP( LPC_LTP_res_nrg += nrg[ k ] * Wght[ k ]; } - SKP_assert( LPC_LTP_res_nrg > 0 ); + silk_assert( LPC_LTP_res_nrg > 0 ); *LTPredCodGain = 3.0f * silk_log2( LPC_res_nrg / LPC_LTP_res_nrg ); } @@ -120,7 +120,7 @@ void silk_find_LTP_FLP( g = LTP_SMOOTHING / ( LTP_SMOOTHING + w[ k ] ) * ( m - d[ k ] ); temp = 0; for( i = 0; i < LTP_ORDER; i++ ) { - delta_b[ i ] = SKP_max_float( b_ptr[ i ], 0.1f ); + delta_b[ i ] = silk_max_float( b_ptr[ i ], 0.1f ); temp += delta_b[ i ]; } temp = g / temp; diff --git a/silk/float/silk_find_pitch_lags_FLP.c b/silk/float/silk_find_pitch_lags_FLP.c index 382bcd57..05629eaf 100644 --- a/silk/float/silk_find_pitch_lags_FLP.c +++ b/silk/float/silk_find_pitch_lags_FLP.c @@ -36,18 +36,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_find_pitch_lags_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - SKP_float res[], /* O Residual */ - const SKP_float x[] /* I Speech signal */ + silk_float res[], /* O Residual */ + const silk_float x[] /* I Speech signal */ ) { 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 ]; - SKP_float A[ MAX_FIND_PITCH_LPC_ORDER ]; - SKP_float refl_coef[ MAX_FIND_PITCH_LPC_ORDER ]; - SKP_float Wsig[ FIND_PITCH_LPC_WIN_MAX ]; - SKP_float *Wsig_ptr; + silk_float thrhld, res_nrg; + const silk_float *x_buf_ptr, *x_buf; + silk_float auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; + silk_float A[ MAX_FIND_PITCH_LPC_ORDER ]; + silk_float refl_coef[ MAX_FIND_PITCH_LPC_ORDER ]; + silk_float Wsig[ FIND_PITCH_LPC_WIN_MAX ]; + silk_float *Wsig_ptr; /******************************************/ /* Setup buffer lengths etc based on Fs */ @@ -55,7 +55,7 @@ void silk_find_pitch_lags_FLP( buf_len = psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length + psEnc->sCmn.ltp_mem_length; /* Safty check */ - SKP_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length ); + silk_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length ); x_buf = x - psEnc->sCmn.ltp_mem_length; @@ -73,7 +73,7 @@ void silk_find_pitch_lags_FLP( /* Middle non-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 - ( psEnc->sCmn.la_pitch << 1 ) ) * sizeof( SKP_float ) ); + silk_memcpy( Wsig_ptr, x_buf_ptr, ( psEnc->sCmn.pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 ) ) * sizeof( silk_float ) ); /* Last LA_LTP samples */ Wsig_ptr += psEnc->sCmn.pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 ); @@ -90,7 +90,7 @@ void silk_find_pitch_lags_FLP( res_nrg = silk_schur_FLP( refl_coef, auto_corr, psEnc->sCmn.pitchEstimationLPCOrder ); /* Prediction gain */ - psEncCtrl->predGain = auto_corr[ 0 ] / SKP_max_float( res_nrg, 1.0f ); + psEncCtrl->predGain = auto_corr[ 0 ] / silk_max_float( res_nrg, 1.0f ); /* Convert reflection coefficients to prediction coefficients */ silk_k2a_FLP( A, refl_coef, psEnc->sCmn.pitchEstimationLPCOrder ); @@ -123,7 +123,7 @@ void silk_find_pitch_lags_FLP( psEnc->sCmn.indices.signalType = TYPE_UNVOICED; } } else { - SKP_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); + silk_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); psEnc->sCmn.indices.lagIndex = 0; psEnc->sCmn.indices.contourIndex = 0; psEnc->LTPCorr = 0; diff --git a/silk/float/silk_find_pred_coefs_FLP.c b/silk/float/silk_find_pred_coefs_FLP.c index 5803615a..9ad33779 100644 --- a/silk/float/silk_find_pred_coefs_FLP.c +++ b/silk/float/silk_find_pred_coefs_FLP.c @@ -35,20 +35,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void silk_find_pred_coefs_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float res_pitch[], /* I Residual from pitch analysis */ - const SKP_float x[] /* I Speech signal */ + const silk_float res_pitch[], /* I Residual from pitch analysis */ + const silk_float x[] /* I Speech signal */ ) { opus_int i; - SKP_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]; - SKP_float invGains[ MAX_NB_SUBFR ], Wght[ MAX_NB_SUBFR ]; + silk_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]; + silk_float invGains[ MAX_NB_SUBFR ], Wght[ MAX_NB_SUBFR ]; 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 ]; + const silk_float *x_ptr; + silk_float *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ]; /* Weighting for weighted least squares */ for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { - SKP_assert( psEncCtrl->Gains[ i ] > 0.0f ); + silk_assert( psEncCtrl->Gains[ i ] > 0.0f ); invGains[ i ] = 1.0f / psEncCtrl->Gains[ i ]; Wght[ i ] = invGains[ i ] * invGains[ i ]; } @@ -57,7 +57,7 @@ void silk_find_pred_coefs_FLP( /**********/ /* VOICED */ /**********/ - SKP_assert( psEnc->sCmn.ltp_mem_length - psEnc->sCmn.predictLPCOrder >= psEncCtrl->pitchL[ 0 ] + LTP_ORDER / 2 ); + silk_assert( psEnc->sCmn.ltp_mem_length - psEnc->sCmn.predictLPCOrder >= psEncCtrl->pitchL[ 0 ] + LTP_ORDER / 2 ); /* LTP analysis */ silk_find_LTP_FLP( psEncCtrl->LTPCoef, WLTP, &psEncCtrl->LTPredCodGain, res_pitch, @@ -93,7 +93,7 @@ void silk_find_pred_coefs_FLP( x_ptr += psEnc->sCmn.subfr_length; } - SKP_memset( psEncCtrl->LTPCoef, 0, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( SKP_float ) ); + silk_memset( psEncCtrl->LTPCoef, 0, psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( silk_float ) ); psEncCtrl->LTPredCodGain = 0.0f; } @@ -112,6 +112,6 @@ TOC(LSF_quant); psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr, psEnc->sCmn.predictLPCOrder ); /* Copy to prediction struct for use in next frame for fluctuation reduction */ - SKP_memcpy( psEnc->sCmn.prev_NLSFq_Q15, NLSF_Q15, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) ); + silk_memcpy( psEnc->sCmn.prev_NLSFq_Q15, NLSF_Q15, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) ); } diff --git a/silk/float/silk_inner_product_FLP.c b/silk/float/silk_inner_product_FLP.c index 963cc779..18444e1d 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. #include "silk_SigProc_FLP.h" -/* inner product of two SKP_float arrays, with result as double */ +/* inner product of two silk_float arrays, with result as double */ double silk_inner_product_FLP( /* O result */ - const SKP_float *data1, /* I vector 1 */ - const SKP_float *data2, /* I vector 2 */ + const silk_float *data1, /* I vector 1 */ + const silk_float *data2, /* I vector 2 */ opus_int dataSize /* I length of vectors */ ) { diff --git a/silk/float/silk_k2a_FLP.c b/silk/float/silk_k2a_FLP.c index 318b8d63..dd2081b8 100644 --- a/silk/float/silk_k2a_FLP.c +++ b/silk/float/silk_k2a_FLP.c @@ -33,13 +33,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_FLP( - SKP_float *A, /* O: prediction coefficients [order] */ - const SKP_float *rc, /* I: reflection coefficients [order] */ + silk_float *A, /* O: prediction coefficients [order] */ + const silk_float *rc, /* I: reflection coefficients [order] */ opus_int32 order /* I: prediction order */ ) { opus_int k, n; - SKP_float Atmp[ SILK_MAX_ORDER_LPC ]; + silk_float Atmp[ SILK_MAX_ORDER_LPC ]; for( k = 0; k < order; k++ ){ for( n = 0; n < k; n++ ){ diff --git a/silk/float/silk_levinsondurbin_FLP.c b/silk/float/silk_levinsondurbin_FLP.c index 113204b6..05933bba 100644 --- a/silk/float/silk_levinsondurbin_FLP.c +++ b/silk/float/silk_levinsondurbin_FLP.c @@ -32,21 +32,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FLP.h" /* 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] */ +silk_float silk_levinsondurbin_FLP( /* O prediction error energy */ + silk_float A[], /* O prediction coefficients [order] */ + const silk_float corr[], /* I input auto-correlations [order + 1] */ const opus_int order /* I prediction order */ ) { opus_int i, mHalf, m; - SKP_float min_nrg, nrg, t, km, Atmp1, Atmp2; + silk_float min_nrg, nrg, t, km, Atmp1, Atmp2; min_nrg = 1e-12f * corr[ 0 ] + 1e-9f; nrg = corr[ 0 ]; - nrg = SKP_max_float(min_nrg, nrg); + nrg = silk_max_float(min_nrg, nrg); A[ 0 ] = corr[ 1 ] / nrg; nrg -= A[ 0 ] * corr[ 1 ]; - nrg = SKP_max_float(min_nrg, nrg); + nrg = silk_max_float(min_nrg, nrg); for( m = 1; m < order; m++ ) { @@ -60,7 +60,7 @@ SKP_float silk_levinsondurbin_FLP( /* O prediction error energy /* residual energy */ nrg -= km * t; - nrg = SKP_max_float(min_nrg, nrg); + nrg = silk_max_float(min_nrg, nrg); mHalf = m >> 1; for( i = 0; i < mHalf; i++ ) { diff --git a/silk/float/silk_main_FLP.h b/silk/float/silk_main_FLP.h index ddd5a612..da658616 100644 --- a/silk/float/silk_main_FLP.h +++ b/silk/float/silk_main_FLP.h @@ -65,7 +65,7 @@ opus_int silk_encode_frame_FLP( void silk_LBRR_encode_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float xfw[] /* I Input signal */ + const silk_float xfw[] /* I Input signal */ ); /* Initializes the Silk encoder state */ @@ -89,8 +89,8 @@ opus_int silk_control_encoder( void silk_prefilter_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ const silk_encoder_control_FLP *psEncCtrl, /* I Encoder control FLP */ - SKP_float xw[], /* O Weighted signal */ - const SKP_float x[] /* I Speech signal */ + silk_float xw[], /* O Weighted signal */ + const silk_float x[] /* I Speech signal */ ); /**************************/ @@ -100,15 +100,15 @@ void silk_prefilter_FLP( void silk_noise_shape_analysis_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float *pitch_res, /* I LPC residual from pitch analysis */ - const SKP_float *x /* I Input signal [frame_length + la_shape] */ + const silk_float *pitch_res, /* I LPC residual from pitch analysis */ + const silk_float *x /* I Input signal [frame_length + la_shape] */ ); /* Autocorrelations for a warped frequency axis */ 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 */ + silk_float *corr, /* O Result [order + 1] */ + const silk_float *input, /* I Input data to correlate */ + const silk_float warping, /* I Warping coefficient */ const opus_int length, /* I Length of input */ const opus_int order /* I Correlation order (even) */ ); @@ -126,16 +126,16 @@ void silk_LTP_scale_ctrl_FLP( void silk_find_pitch_lags_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - SKP_float res[], /* O Residual */ - const SKP_float x[] /* I Speech signal */ + silk_float res[], /* O Residual */ + const silk_float x[] /* I Speech signal */ ); /* Find LPC and LTP coefficients */ void silk_find_pred_coefs_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float res_pitch[], /* I Residual from pitch analysis */ - const SKP_float x[] /* I Speech signal */ + const silk_float res_pitch[], /* I Residual from pitch analysis */ + const silk_float x[] /* I Speech signal */ ); /* LPC analysis */ @@ -146,30 +146,30 @@ void silk_find_LPC_FLP( 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 silk_float x[], /* I Input signal */ const opus_int subfr_length, /* I Subframe length incl preceeding samples */ const opus_int nb_subfr /* I: Number of subframes */ ); /* LTP analysis */ void silk_find_LTP_FLP( - SKP_float b[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ - 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 */ + silk_float b[ MAX_NB_SUBFR * LTP_ORDER ], /* O LTP coefs */ + silk_float WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* O Weight for LTP quantization */ + silk_float *LTPredCodGain, /* O LTP coding gain */ + const silk_float r_lpc[], /* I LPC residual */ const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ - const SKP_float Wght[ MAX_NB_SUBFR ], /* I Weights */ + const silk_float Wght[ 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 */ ); 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 */ + silk_float *LTP_res, /* O LTP res MAX_NB_SUBFR*(pre_lgth+subfr_lngth) */ + const silk_float *x, /* I Input signal, with preceeding samples */ + const silk_float B[ LTP_ORDER * MAX_NB_SUBFR ], /* I LTP coefficients for each subframe */ const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ - const SKP_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ + const silk_float invGains[ MAX_NB_SUBFR ], /* I Inverse quantization gains */ 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 */ @@ -178,10 +178,10 @@ void silk_LTP_analysis_filter_FLP( /* Calculates residual energies of input subframes where all subframes have LPC_order */ /* of preceeding samples */ void silk_residual_energy_FLP( - SKP_float nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ - 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 */ + silk_float nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ + const silk_float x[], /* I Input signal */ + silk_float a[ 2 ][ MAX_LPC_ORDER ],/* I AR coefs for each frame half */ + const silk_float gains[], /* 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 */ @@ -189,19 +189,19 @@ void silk_residual_energy_FLP( /* 16th order LPC analysis filter */ 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 */ + silk_float r_LPC[], /* O LPC residual signal */ + const silk_float PredCoef[], /* I LPC coefficients */ + const silk_float s[], /* I Input signal */ 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 */ + silk_float B[ 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 SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ + const silk_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ 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,29 +213,29 @@ void silk_quant_LTP_gains_FLP( /* Limit, stabilize, and quantize NLSFs */ void silk_process_NLSFs_FLP( silk_encoder_state *psEncC, /* I/O Encoder state */ - SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ + silk_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ 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 */ -SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual energy */ - const SKP_float *c, /* I Filter coefficients */ - 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 */ +silk_float silk_residual_energy_covar_FLP( /* O Weighted residual energy */ + const silk_float *c, /* I Filter coefficients */ + silk_float *wXX, /* I/O Weighted correlation matrix, reg. out */ + const silk_float *wXx, /* I Weighted correlation vector */ + const silk_float wxx, /* I Weighted correlation value */ const opus_int D /* I Dimension */ ); /* Entropy constrained MATRIX-weighted VQ, for a single input data vector */ void silk_VQ_WMat_EC_FLP( 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 */ + silk_float *rate_dist, /* O Best weighted quant. error + mu * rate */ + const silk_float *in, /* I Input vector to be quantized */ + const silk_float *W, /* I Weighting matrix */ 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 silk_float mu, /* I Tradeoff between WSSE and rate */ const opus_int L /* I Number of vectors in codebook */ ); @@ -250,35 +250,35 @@ 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 silk_float *x, /* I x vector [ L+order-1 ] used to create X */ 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] */ + silk_float *XX /* O X'*X correlation matrix [order x order] */ ); /* Calculates correlation vector X'*t */ 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 silk_float *x, /* I x vector [L+order-1] used to create X */ + const silk_float *t, /* I Target vector [L] */ 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] */ + silk_float *Xt /* O X'*t correlation vector [order] */ ); /* Add noise to matrix diagonal */ 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 */ + silk_float *XX, /* I/O Correlation matrices */ + silk_float *xx, /* I/O Correlation values */ + const silk_float noise, /* I Noise energy to add */ 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. */ + silk_float *A, /* I/O Symmetric square matrix, out: reg. */ 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 */ + const silk_float *b, /* I Pointer to b vector */ + silk_float *x /* O Pointer to x solution vector */ ); /* Apply sine window to signal vector. */ @@ -286,8 +286,8 @@ void silk_solve_LDL_FLP( /* 1 -> sine window from 0 to pi/2 */ /* 2 -> sine window from pi/2 to pi */ void silk_apply_sine_window_FLP( - SKP_float px_win[], /* O Pointer to windowed signal */ - const SKP_float px[], /* I Pointer to input signal */ + silk_float px_win[], /* O Pointer to windowed signal */ + const silk_float 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 */ ); @@ -297,13 +297,13 @@ void silk_apply_sine_window_FLP( /* Convert AR filter coefficients to NLSF parameters */ void silk_A2NLSF_FLP( opus_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ - const SKP_float *pAR, /* I LPC coefficients [ LPC_order ] */ + const silk_float *pAR, /* I LPC coefficients [ 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 ] */ + silk_float *pAR, /* O LPC coefficients [ LPC_order ] */ const opus_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ const opus_int LPC_order /* I LPC order */ ); @@ -317,7 +317,7 @@ void silk_NSQ_wrapper_FLP( SideInfoIndices *psIndices, /* I/O Quantization indices */ silk_nsq_state *psNSQ, /* I/O Noise Shaping Quantzation state */ opus_int8 pulses[], /* O Quantized pulse signal */ - const SKP_float x[] /* I Prefiltered input signal */ + const silk_float x[] /* I Prefiltered input signal */ ); #ifdef __cplusplus diff --git a/silk/float/silk_noise_shape_analysis_FLP.c b/silk/float/silk_noise_shape_analysis_FLP.c index 3005a0dc..ac4c8872 100644 --- a/silk/float/silk_noise_shape_analysis_FLP.c +++ b/silk/float/silk_noise_shape_analysis_FLP.c @@ -34,33 +34,33 @@ 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.) */ -static inline SKP_float warped_gain( - const SKP_float *coefs, - SKP_float lambda, +static inline silk_float warped_gain( + const silk_float *coefs, + silk_float lambda, opus_int order ) { opus_int i; - SKP_float gain; + silk_float gain; lambda = -lambda; gain = coefs[ order - 1 ]; for( i = order - 2; i >= 0; i-- ) { gain = lambda * gain + coefs[ i ]; } - return (SKP_float)( 1.0f / ( 1.0f - lambda * gain ) ); + return (silk_float)( 1.0f / ( 1.0f - lambda * gain ) ); } /* 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 */ static inline void warped_true2monic_coefs( - SKP_float *coefs_syn, - SKP_float *coefs_ana, - SKP_float lambda, - SKP_float limit, + silk_float *coefs_syn, + silk_float *coefs_ana, + silk_float lambda, + silk_float limit, opus_int order ) { opus_int i, iter, ind = 0; - SKP_float tmp, maxabs, chirp, gain_syn, gain_ana; + silk_float tmp, maxabs, chirp, gain_syn, gain_ana; /* Convert to monic coefficients */ for( i = order - 1; i > 0; i-- ) { @@ -79,7 +79,7 @@ static inline void warped_true2monic_coefs( /* Find maximum absolute value */ maxabs = -1.0f; for( i = 0; i < order; i++ ) { - tmp = SKP_max( SKP_abs_float( coefs_syn[ i ] ), SKP_abs_float( coefs_ana[ i ] ) ); + tmp = silk_max( silk_abs_float( coefs_syn[ i ] ), silk_abs_float( coefs_ana[ i ] ) ); if( tmp > maxabs ) { maxabs = tmp; ind = i; @@ -119,25 +119,25 @@ static inline void warped_true2monic_coefs( coefs_ana[ i ] *= gain_ana; } } - SKP_assert( 0 ); + silk_assert( 0 ); } /* Compute noise shaping coefficients and initial gain values */ void silk_noise_shape_analysis_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */ - const SKP_float *pitch_res, /* I LPC residual from pitch analysis */ - const SKP_float *x /* I Input signal [frame_length + la_shape] */ + const silk_float *pitch_res, /* I LPC residual from pitch analysis */ + const silk_float *x /* I Input signal [frame_length + la_shape] */ ) { silk_shape_state_FLP *psShapeSt = &psEnc->sShape; 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; - SKP_float x_windowed[ SHAPE_LPC_WIN_MAX ]; - SKP_float auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ]; - const SKP_float *x_ptr, *pitch_res_ptr; + silk_float SNR_adj_dB, HarmBoost, HarmShapeGain, Tilt; + silk_float nrg, pre_nrg, log_energy, log_energy_prev, energy_variation; + silk_float delta, BWExp1, BWExp2, gain_mult, gain_add, strength, b, warping; + silk_float x_windowed[ SHAPE_LPC_WIN_MAX ]; + silk_float auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ]; + const silk_float *x_ptr, *pitch_res_ptr; /* Point to start of first LPC analysis block */ x_ptr = x - psEnc->sCmn.la_shape; @@ -151,7 +151,7 @@ void silk_noise_shape_analysis_FLP( psEncCtrl->input_quality = 0.5f * ( psEnc->sCmn.input_quality_bands_Q15[ 0 ] + psEnc->sCmn.input_quality_bands_Q15[ 1 ] ) * ( 1.0f / 32768.0f ); /* Coding quality level, between 0.0 and 1.0 */ - psEncCtrl->coding_quality = SKP_sigmoid( 0.25f * ( SNR_adj_dB - 18.0f ) ); + psEncCtrl->coding_quality = silk_sigmoid( 0.25f * ( SNR_adj_dB - 18.0f ) ); if( psEnc->sCmn.useCBR == 0 ) { /* Reduce coding SNR during low speech activity */ @@ -181,16 +181,16 @@ void silk_noise_shape_analysis_FLP( energy_variation = 0.0f; log_energy_prev = 0.0f; pitch_res_ptr = pitch_res; - for( k = 0; k < SKP_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr ) / 2; k++ ) { - nrg = ( SKP_float )nSamples + ( SKP_float )silk_energy_FLP( pitch_res_ptr, nSamples ); + for( k = 0; k < silk_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr ) / 2; k++ ) { + nrg = ( silk_float )nSamples + ( silk_float )silk_energy_FLP( pitch_res_ptr, nSamples ); log_energy = silk_log2( nrg ); if( k > 0 ) { - energy_variation += SKP_abs_float( log_energy - log_energy_prev ); + energy_variation += silk_abs_float( log_energy - log_energy_prev ); } log_energy_prev = log_energy; pitch_res_ptr += nSamples; } - psEncCtrl->sparseness = SKP_sigmoid( 0.4f * ( energy_variation - 5.0f ) ); + psEncCtrl->sparseness = silk_sigmoid( 0.4f * ( energy_variation - 5.0f ) ); /* Set quantization offset depending on sparseness measure */ if( psEncCtrl->sparseness > SPARSENESS_THRESHOLD_QNT_OFFSET ) { @@ -217,7 +217,7 @@ void silk_noise_shape_analysis_FLP( if( psEnc->sCmn.warping_Q16 > 0 ) { /* Slightly more warping in analysis will move quantization noise up in frequency, where it's better masked */ - warping = (SKP_float)psEnc->sCmn.warping_Q16 / 65536.0f + 0.01f * psEncCtrl->coding_quality; + warping = (silk_float)psEnc->sCmn.warping_Q16 / 65536.0f + 0.01f * psEncCtrl->coding_quality; } else { warping = 0.0f; } @@ -233,7 +233,7 @@ void silk_noise_shape_analysis_FLP( silk_apply_sine_window_FLP( x_windowed, x_ptr, 1, slope_part ); shift = slope_part; - SKP_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(SKP_float) ); + silk_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(silk_float) ); shift += flat_part; silk_apply_sine_window_FLP( x_windowed + shift, x_ptr + shift, 2, slope_part ); @@ -254,7 +254,7 @@ void silk_noise_shape_analysis_FLP( /* Convert correlations to prediction coefficients, and compute residual energy */ nrg = silk_levinsondurbin_FLP( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], auto_corr, psEnc->sCmn.shapingLPCOrder ); - psEncCtrl->Gains[ k ] = ( SKP_float )sqrt( nrg ); + psEncCtrl->Gains[ k ] = ( silk_float )sqrt( nrg ); if( psEnc->sCmn.warping_Q16 > 0 ) { /* Adjust gain for warping */ @@ -265,10 +265,10 @@ void silk_noise_shape_analysis_FLP( silk_bwexpander_FLP( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder, BWExp2 ); /* Compute noise shaping filter coefficients */ - SKP_memcpy( + silk_memcpy( &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ], &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], - psEnc->sCmn.shapingLPCOrder * sizeof( SKP_float ) ); + psEnc->sCmn.shapingLPCOrder * sizeof( silk_float ) ); /* Bandwidth expansion for analysis filter shaping */ silk_bwexpander_FLP( &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder, BWExp1 ); @@ -287,8 +287,8 @@ void silk_noise_shape_analysis_FLP( /* Gain tweaking */ /*****************/ /* Increase gains during low speech activity */ - gain_mult = (SKP_float)pow( 2.0f, -0.16f * SNR_adj_dB ); - gain_add = (SKP_float)pow( 2.0f, 0.16f * MIN_QGAIN_DB ); + gain_mult = (silk_float)pow( 2.0f, -0.16f * SNR_adj_dB ); + gain_add = (silk_float)pow( 2.0f, 0.16f * MIN_QGAIN_DB ); for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { psEncCtrl->Gains[ k ] *= gain_mult; psEncCtrl->Gains[ k ] += gain_add; @@ -344,7 +344,7 @@ void silk_noise_shape_analysis_FLP( ( 1.0f - ( 1.0f - psEncCtrl->coding_quality ) * psEncCtrl->input_quality ); /* Less harmonic noise shaping for less periodic signals */ - HarmShapeGain *= ( SKP_float )sqrt( psEnc->LTPCorr ); + HarmShapeGain *= ( silk_float )sqrt( psEnc->LTPCorr ); } else { HarmShapeGain = 0.0f; } diff --git a/silk/float/silk_pitch_analysis_core_FLP.c b/silk/float/silk_pitch_analysis_core_FLP.c index 1ff07974..5aaf41af 100644 --- a/silk/float/silk_pitch_analysis_core_FLP.c +++ b/silk/float/silk_pitch_analysis_core_FLP.c @@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Internally used functions */ /************************************************************/ 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 frame[], /* I vector to correlate */ + silk_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ + const silk_float frame[], /* I vector to correlate */ opus_int start_lag, /* I start lag */ opus_int sf_length, /* I sub frame length */ opus_int nb_subfr, /* I number of subframes */ @@ -58,8 +58,8 @@ 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 frame[], /* I vector to correlate */ + silk_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ + const silk_float frame[], /* I vector to correlate */ opus_int start_lag, /* I start lag */ opus_int sf_length, /* I sub frame length */ opus_int nb_subfr, /* I number of subframes */ @@ -72,39 +72,39 @@ static void silk_P_Ana_calc_energy_st3( %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoiced */ - const SKP_float *frame, /* I signal of length PE_FRAME_LENGTH_MS*Fs_kHz */ + const silk_float *frame, /* 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 */ - SKP_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ + silk_float *LTPCorr, /* I/O normalized correlation; input: value from previous frame */ 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 silk_float search_thres1, /* I first stage threshold for lag candidates 0 - 1 */ + const silk_float search_thres2, /* 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 */ ) { opus_int i, k, d, j; - SKP_float frame_8kHz[ PE_MAX_FRAME_LENGTH_MS * 8 ]; - SKP_float frame_4kHz[ PE_MAX_FRAME_LENGTH_MS * 4 ]; + silk_float frame_8kHz[ PE_MAX_FRAME_LENGTH_MS * 8 ]; + silk_float frame_4kHz[ PE_MAX_FRAME_LENGTH_MS * 4 ]; opus_int16 frame_8_FIX[ PE_MAX_FRAME_LENGTH_MS * 8 ]; opus_int16 frame_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; + silk_float threshold, contour_bias; + silk_float C[ PE_MAX_NB_SUBFR][ (PE_MAX_LAG >> 1) + 5 ]; + silk_float CC[ PE_NB_CBKS_STAGE2_EXT ]; + const silk_float *target_ptr, *basis_ptr; double cross_corr, normalizer, energy, energy_tmp; 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; + silk_float Cmax, CCmax, CCmax_b, CCmax_new_b, CCmax_new; 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 ]; + silk_float lag_log2, prevLag_log2, delta_lag_log2_sqr; + silk_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; + silk_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ]; opus_int lag_counter; opus_int frame_length, frame_length_8kHz, frame_length_4kHz; opus_int sf_length, sf_length_8kHz, sf_length_4kHz; @@ -114,14 +114,14 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic const opus_int8 *Lag_CB_ptr; /* Check for valid sampling frequency */ - SKP_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); + silk_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); /* Check for valid complexity setting */ - SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX ); - SKP_assert( complexity <= SigProc_PE_MAX_COMPLEX ); + silk_assert( complexity >= SigProc_PE_MIN_COMPLEX ); + silk_assert( complexity <= SigProc_PE_MAX_COMPLEX ); - SKP_assert( search_thres1 >= 0.0f && search_thres1 <= 1.0f ); - SKP_assert( search_thres2 >= 0.0f && search_thres2 <= 1.0f ); + silk_assert( search_thres1 >= 0.0f && search_thres1 <= 1.0f ); + silk_assert( search_thres2 >= 0.0f && search_thres2 <= 1.0f ); /* Setup frame lengths max / min lag for the sampling frequency */ frame_length = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS ) * Fs_kHz; @@ -137,32 +137,32 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic max_lag_4kHz = PE_MAX_LAG_MS * 4; max_lag_8kHz = PE_MAX_LAG_MS * 8 - 1; - SKP_memset(C, 0, sizeof(SKP_float) * nb_subfr * ((PE_MAX_LAG >> 1) + 5)); + silk_memset(C, 0, sizeof(silk_float) * nb_subfr * ((PE_MAX_LAG >> 1) + 5)); /* Resample from input sampled at Fs_kHz to 8 kHz */ if( Fs_kHz == 16 ) { /* Resample to 16 -> 8 khz */ opus_int16 frame_16_FIX[ 16 * PE_MAX_FRAME_LENGTH_MS ]; - SKP_float2short_array( frame_16_FIX, frame, frame_length ); - SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); + silk_float2short_array( frame_16_FIX, frame, frame_length ); + silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); silk_resampler_down2( filt_state, frame_8_FIX, frame_16_FIX, frame_length ); - SKP_short2float_array( frame_8kHz, frame_8_FIX, frame_length_8kHz ); + silk_short2float_array( frame_8kHz, frame_8_FIX, frame_length_8kHz ); } else if( Fs_kHz == 12 ) { /* Resample to 12 -> 8 khz */ opus_int16 frame_12_FIX[ 12 * PE_MAX_FRAME_LENGTH_MS ]; - SKP_float2short_array( frame_12_FIX, frame, frame_length ); - SKP_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); + silk_float2short_array( frame_12_FIX, frame, frame_length ); + silk_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); silk_resampler_down2_3( filt_state, frame_8_FIX, frame_12_FIX, frame_length ); - SKP_short2float_array( frame_8kHz, frame_8_FIX, frame_length_8kHz ); + silk_short2float_array( frame_8kHz, frame_8_FIX, frame_length_8kHz ); } else { - SKP_assert( Fs_kHz == 8 ); - SKP_float2short_array( frame_8_FIX, frame, frame_length_8kHz ); + silk_assert( Fs_kHz == 8 ); + silk_float2short_array( frame_8_FIX, frame, frame_length_8kHz ); } /* Decimate again to 4 kHz */ - SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); + silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); silk_resampler_down2( filt_state, frame_4_FIX, frame_8_FIX, frame_length_8kHz ); - SKP_short2float_array( frame_4kHz, frame_4_FIX, frame_length_4kHz ); + silk_short2float_array( frame_4kHz, frame_4_FIX, frame_length_4kHz ); /* Low-pass filter */ for( i = frame_length_4kHz - 1; i > 0; i-- ) { @@ -172,31 +172,31 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic /****************************************************************************** * FIRST STAGE, operating in 4 khz ******************************************************************************/ - target_ptr = &frame_4kHz[ SKP_LSHIFT( sf_length_4kHz, 2 ) ]; + target_ptr = &frame_4kHz[ silk_LSHIFT( sf_length_4kHz, 2 ) ]; for( k = 0; k < nb_subfr >> 1; k++ ) { /* Check that we are within range of the array */ - SKP_assert( target_ptr >= frame_4kHz ); - SKP_assert( target_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); + silk_assert( target_ptr >= frame_4kHz ); + silk_assert( target_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); basis_ptr = target_ptr - min_lag_4kHz; /* Check that we are within range of the array */ - SKP_assert( basis_ptr >= frame_4kHz ); - SKP_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); + silk_assert( basis_ptr >= frame_4kHz ); + silk_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); /* Calculate first vector products before loop */ cross_corr = silk_inner_product_FLP( target_ptr, basis_ptr, sf_length_8kHz ); normalizer = silk_energy_FLP( basis_ptr, sf_length_8kHz ) + sf_length_8kHz * 4000.0f; - C[ 0 ][ min_lag_4kHz ] += (SKP_float)(cross_corr / sqrt(normalizer)); + C[ 0 ][ min_lag_4kHz ] += (silk_float)(cross_corr / sqrt(normalizer)); /* From now on normalizer is computed recursively */ for(d = min_lag_4kHz + 1; d <= max_lag_4kHz; d++) { basis_ptr--; /* Check that we are within range of the array */ - SKP_assert( basis_ptr >= frame_4kHz ); - SKP_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); + silk_assert( basis_ptr >= frame_4kHz ); + silk_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz ); cross_corr = silk_inner_product_FLP(target_ptr, basis_ptr, sf_length_8kHz); @@ -204,7 +204,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic normalizer += basis_ptr[ 0 ] * basis_ptr[ 0 ] - basis_ptr[ sf_length_8kHz ] * basis_ptr[ sf_length_8kHz ]; - C[ 0 ][ d ] += (SKP_float)(cross_corr / sqrt( normalizer )); + C[ 0 ][ d ] += (silk_float)(cross_corr / sqrt( normalizer )); } /* Update target pointer */ target_ptr += sf_length_8kHz; @@ -217,19 +217,19 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic /* Sort */ length_d_srch = 4 + 2 * complexity; - SKP_assert( 3 * length_d_srch <= PE_D_SRCH_LENGTH ); + silk_assert( 3 * length_d_srch <= PE_D_SRCH_LENGTH ); silk_insertion_sort_decreasing_FLP( &C[ 0 ][ min_lag_4kHz ], d_srch, max_lag_4kHz - min_lag_4kHz + 1, length_d_srch ); /* Escape if correlation is very low already here */ Cmax = C[ 0 ][ min_lag_4kHz ]; - target_ptr = &frame_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ]; + target_ptr = &frame_4kHz[ silk_SMULBB( sf_length_4kHz, nb_subfr ) ]; energy = 1000.0f; - for( i = 0; i < SKP_LSHIFT( sf_length_4kHz, 2 ); i++ ) { + for( i = 0; i < silk_LSHIFT( sf_length_4kHz, 2 ); i++ ) { energy += target_ptr[i] * target_ptr[i]; } threshold = Cmax * Cmax; if( energy / 16.0f > threshold ) { - SKP_memset( pitch_out, 0, nb_subfr * sizeof( opus_int ) ); + silk_memset( pitch_out, 0, nb_subfr * sizeof( opus_int ) ); *LTPCorr = 0.0f; *lagIndex = 0; *contourIndex = 0; @@ -240,13 +240,13 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic for( i = 0; i < length_d_srch; i++ ) { /* Convert to 8 kHz indices for the sorted correlation that exceeds the threshold */ if( C[ 0 ][ min_lag_4kHz + i ] > threshold ) { - d_srch[ i ] = SKP_LSHIFT( d_srch[ i ] + min_lag_4kHz, 1 ); + d_srch[ i ] = silk_LSHIFT( d_srch[ i ] + min_lag_4kHz, 1 ); } else { length_d_srch = i; break; } } - SKP_assert( length_d_srch > 0 ); + silk_assert( length_d_srch > 0 ); for( i = min_lag_8kHz - 5; i < max_lag_8kHz + 5; i++ ) { d_comp[ i ] = 0; @@ -287,7 +287,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic /********************************************************************************* * 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_float)); /* Is this needed?*/ + silk_memset( C, 0, PE_MAX_NB_SUBFR*((PE_MAX_LAG >> 1) + 5) * sizeof(silk_float)); /* Is this needed?*/ if( Fs_kHz == 8 ) { target_ptr = &frame[ PE_LTP_MEM_LENGTH_MS * 8 ]; @@ -302,7 +302,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic cross_corr = silk_inner_product_FLP( basis_ptr, target_ptr, sf_length_8kHz ); energy = silk_energy_FLP( basis_ptr, sf_length_8kHz ); if (cross_corr > 0.0f) { - C[ k ][ d ] = (SKP_float)(cross_corr * cross_corr / (energy * energy_tmp + eps)); + C[ k ][ d ] = (silk_float)(cross_corr * cross_corr / (energy * energy_tmp + eps)); } else { C[ k ][ d ] = 0.0f; } @@ -321,11 +321,11 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic if( prevLag > 0 ) { if( Fs_kHz == 12 ) { - prevLag = SKP_LSHIFT( prevLag, 1 ) / 3; + prevLag = silk_LSHIFT( prevLag, 1 ) / 3; } else if( Fs_kHz == 16 ) { - prevLag = SKP_RSHIFT( prevLag, 1 ); + prevLag = silk_RSHIFT( prevLag, 1 ); } - prevLag_log2 = silk_log2((SKP_float)prevLag); + prevLag_log2 = silk_log2((silk_float)prevLag); } else { prevLag_log2 = 0; } @@ -364,11 +364,11 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic CBimax_new = i; } } - CCmax_new = SKP_max_float(CCmax_new, 0.0f); /* To avoid taking square root of negative number later */ + CCmax_new = silk_max_float(CCmax_new, 0.0f); /* To avoid taking square root of negative number later */ CCmax_new_b = CCmax_new; /* Bias towards shorter lags */ - lag_log2 = silk_log2((SKP_float)d); + lag_log2 = silk_log2((silk_float)d); CCmax_new_b -= PE_SHORTLAG_BIAS * nb_subfr * lag_log2; /* Bias towards previous lag */ @@ -391,7 +391,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic if( lag == -1 ) { /* No suitable candidate found */ - SKP_memset( pitch_out, 0, PE_MAX_NB_SUBFR * sizeof(opus_int) ); + silk_memset( pitch_out, 0, PE_MAX_NB_SUBFR * sizeof(opus_int) ); *LTPCorr = 0.0f; *lagIndex = 0; *contourIndex = 0; @@ -402,22 +402,22 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic /* Search in original signal */ /* Compensate for decimation */ - SKP_assert( lag == SKP_SAT16( lag ) ); + silk_assert( lag == silk_SAT16( lag ) ); if( Fs_kHz == 12 ) { - lag = SKP_RSHIFT_ROUND( SKP_SMULBB( lag, 3 ), 1 ); + lag = silk_RSHIFT_ROUND( silk_SMULBB( lag, 3 ), 1 ); } else if( Fs_kHz == 16 ) { - lag = SKP_LSHIFT( lag, 1 ); + lag = silk_LSHIFT( lag, 1 ); } else { - lag = SKP_SMULBB( lag, 3 ); + lag = silk_SMULBB( lag, 3 ); } - lag = SKP_LIMIT_int( lag, min_lag, max_lag ); - start_lag = SKP_max_int( lag - 2, min_lag ); - end_lag = SKP_min_int( lag + 2, max_lag ); + lag = silk_LIMIT_int( lag, min_lag, max_lag ); + start_lag = silk_max_int( lag - 2, min_lag ); + end_lag = silk_min_int( lag + 2, max_lag ); lag_new = lag; /* to avoid undefined lag */ CBimax = 0; /* to avoid undefined lag */ - SKP_assert( CCmax >= 0.0f ); - *LTPCorr = (SKP_float)sqrt( CCmax / nb_subfr ); /* Output normalized correlation */ + silk_assert( CCmax >= 0.0f ); + *LTPCorr = (silk_float)sqrt( CCmax / nb_subfr ); /* Output normalized correlation */ CCmax = -1000.0f; @@ -426,7 +426,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic silk_P_Ana_calc_energy_st3( energies_st3, frame, start_lag, sf_length, nb_subfr, complexity ); lag_counter = 0; - SKP_assert( lag == SKP_SAT16( lag ) ); + silk_assert( lag == silk_SAT16( lag ) ); contour_bias = PE_FLATCONTOUR_BIAS / lag; /* Setup cbk parameters acording to complexity setting and frame length */ @@ -449,7 +449,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic cross_corr += cross_corr_st3[ k ][ j ][ lag_counter ]; } if( cross_corr > 0.0 ) { - CCmax_new = (SKP_float)(cross_corr * cross_corr / energy); + CCmax_new = (silk_float)(cross_corr * cross_corr / energy); /* Reduce depending on flatness of contour */ CCmax_new *= 1.0f - contour_bias * j; } else { @@ -474,22 +474,22 @@ opus_int silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unvoic *contourIndex = (opus_int8)CBimax; } else { /* Save Lags and correlation */ - SKP_assert( CCmax >= 0.0f ); - *LTPCorr = (SKP_float)sqrt( CCmax / nb_subfr ); /* Output normalized correlation */ + silk_assert( CCmax >= 0.0f ); + *LTPCorr = (silk_float)sqrt( CCmax / nb_subfr ); /* Output normalized correlation */ for( k = 0; k < nb_subfr; k++ ) { pitch_out[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, CBimax, cbk_size ); } *lagIndex = (opus_int16)( lag - min_lag ); *contourIndex = (opus_int8)CBimax; } - SKP_assert( *lagIndex >= 0 ); + silk_assert( *lagIndex >= 0 ); /* return as voiced */ return 0; } 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 frame[], /* I vector to correlate */ + silk_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ + const silk_float frame[], /* I vector to correlate */ opus_int start_lag, /* I start lag */ opus_int sf_length, /* I sub frame length */ opus_int nb_subfr, /* I number of subframes */ @@ -509,14 +509,14 @@ static void silk_P_Ana_calc_corr_st3( 4*12*5 = 240 correlations, but more likely around 120. **********************************************************************/ { - const SKP_float *target_ptr, *basis_ptr; + const silk_float *target_ptr, *basis_ptr; 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 ]; + silk_float scratch_mem[ SCRATCH_SIZE ]; const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; - SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX ); - SKP_assert( complexity <= SigProc_PE_MAX_COMPLEX ); + silk_assert( complexity >= SigProc_PE_MIN_COMPLEX ); + silk_assert( complexity <= SigProc_PE_MAX_COMPLEX ); if( nb_subfr == PE_MAX_NB_SUBFR ){ Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ]; @@ -524,14 +524,14 @@ static void silk_P_Ana_calc_corr_st3( nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ]; cbk_size = PE_NB_CBKS_STAGE3_MAX; } else { - SKP_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1); + silk_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1); Lag_range_ptr = &silk_Lag_range_stage3_10_ms[ 0 ][ 0 ]; Lag_CB_ptr = &silk_CB_lags_stage3_10_ms[ 0 ][ 0 ]; nb_cbk_search = PE_NB_CBKS_STAGE3_10MS; cbk_size = PE_NB_CBKS_STAGE3_10MS; } - target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */ + target_ptr = &frame[ silk_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */ for( k = 0; k < nb_subfr; k++ ) { lag_counter = 0; @@ -540,8 +540,8 @@ static 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 ); - SKP_assert( lag_counter < SCRATCH_SIZE ); - scratch_mem[ lag_counter ] = (SKP_float)silk_inner_product_FLP( target_ptr, basis_ptr, sf_length ); + silk_assert( lag_counter < SCRATCH_SIZE ); + scratch_mem[ lag_counter ] = (silk_float)silk_inner_product_FLP( target_ptr, basis_ptr, sf_length ); lag_counter++; } @@ -551,8 +551,8 @@ static void silk_P_Ana_calc_corr_st3( /* each code_book vector for each start lag */ idx = matrix_ptr( Lag_CB_ptr, k, i, cbk_size ) - delta; for( j = 0; j < PE_NB_STAGE3_LAGS; j++ ) { - SKP_assert( idx + j < SCRATCH_SIZE ); - SKP_assert( idx + j < lag_counter ); + silk_assert( idx + j < SCRATCH_SIZE ); + silk_assert( idx + j < lag_counter ); cross_corr_st3[ k ][ i ][ j ] = scratch_mem[ idx + j ]; } } @@ -561,8 +561,8 @@ 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 frame[], /* I vector to correlate */ + silk_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */ + const silk_float frame[], /* I vector to correlate */ opus_int start_lag, /* I start lag */ opus_int sf_length, /* I sub frame length */ opus_int nb_subfr, /* I number of subframes */ @@ -573,15 +573,15 @@ Calculate the energies for first two subframes. The energies are calculated recursively. ****************************************************************/ { - const SKP_float *target_ptr, *basis_ptr; + const silk_float *target_ptr, *basis_ptr; double energy; opus_int k, i, j, lag_counter; opus_int nb_cbk_search, delta, idx, cbk_size, lag_diff; - SKP_float scratch_mem[ SCRATCH_SIZE ]; + silk_float scratch_mem[ SCRATCH_SIZE ]; const opus_int8 *Lag_range_ptr, *Lag_CB_ptr; - SKP_assert( complexity >= SigProc_PE_MIN_COMPLEX ); - SKP_assert( complexity <= SigProc_PE_MAX_COMPLEX ); + silk_assert( complexity >= SigProc_PE_MIN_COMPLEX ); + silk_assert( complexity <= SigProc_PE_MAX_COMPLEX ); if( nb_subfr == PE_MAX_NB_SUBFR ){ Lag_range_ptr = &silk_Lag_range_stage3[ complexity ][ 0 ][ 0 ]; @@ -589,35 +589,35 @@ calculated recursively. nb_cbk_search = silk_nb_cbk_searchs_stage3[ complexity ]; cbk_size = PE_NB_CBKS_STAGE3_MAX; } else { - SKP_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1); + silk_assert( nb_subfr == PE_MAX_NB_SUBFR >> 1); Lag_range_ptr = &silk_Lag_range_stage3_10_ms[ 0 ][ 0 ]; Lag_CB_ptr = &silk_CB_lags_stage3_10_ms[ 0 ][ 0 ]; nb_cbk_search = PE_NB_CBKS_STAGE3_10MS; cbk_size = PE_NB_CBKS_STAGE3_10MS; } - target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ]; + target_ptr = &frame[ silk_LSHIFT( sf_length, 2 ) ]; for( k = 0; k < nb_subfr; k++ ) { lag_counter = 0; /* Calculate the energy for first lag */ basis_ptr = target_ptr - ( start_lag + matrix_ptr( Lag_range_ptr, k, 0, 2 ) ); energy = silk_energy_FLP( basis_ptr, sf_length ) + 1e-3; - SKP_assert( energy >= 0.0 ); - scratch_mem[lag_counter] = (SKP_float)energy; + silk_assert( energy >= 0.0 ); + scratch_mem[lag_counter] = (silk_float)energy; lag_counter++; lag_diff = ( matrix_ptr( Lag_range_ptr, k, 1, 2 ) - matrix_ptr( Lag_range_ptr, k, 0, 2 ) + 1 ); for( i = 1; i < lag_diff; i++ ) { /* remove part outside new window */ energy -= basis_ptr[sf_length - i] * basis_ptr[sf_length - i]; - SKP_assert( energy >= 0.0 ); + silk_assert( energy >= 0.0 ); /* add part that comes into window */ energy += basis_ptr[ -i ] * basis_ptr[ -i ]; - SKP_assert( energy >= 0.0 ); - SKP_assert( lag_counter < SCRATCH_SIZE ); - scratch_mem[lag_counter] = (SKP_float)energy; + silk_assert( energy >= 0.0 ); + silk_assert( lag_counter < SCRATCH_SIZE ); + scratch_mem[lag_counter] = (silk_float)energy; lag_counter++; } @@ -627,10 +627,10 @@ calculated recursively. /* each code_book vector for each start lag */ idx = matrix_ptr( Lag_CB_ptr, k, i, cbk_size ) - delta; for( j = 0; j < PE_NB_STAGE3_LAGS; j++ ) { - SKP_assert( idx + j < SCRATCH_SIZE ); - SKP_assert( idx + j < lag_counter ); + silk_assert( idx + j < SCRATCH_SIZE ); + silk_assert( idx + j < lag_counter ); energies_st3[ k ][ i ][ j ] = scratch_mem[ idx + j ]; - SKP_assert( energies_st3[ k ][ i ][ j ] >= 0.0f ); + silk_assert( energies_st3[ k ][ i ][ j ] >= 0.0f ); } } target_ptr += sf_length; diff --git a/silk/float/silk_prefilter_FLP.c b/silk/float/silk_prefilter_FLP.c index e52a494a..6737559b 100644 --- a/silk/float/silk_prefilter_FLP.c +++ b/silk/float/silk_prefilter_FLP.c @@ -37,31 +37,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ static inline void silk_prefilt_FLP( silk_prefilter_state_FLP *P,/* I/O state */ - SKP_float st_res[], /* I */ - SKP_float xw[], /* O */ - SKP_float *HarmShapeFIR, /* I */ - SKP_float Tilt, /* I */ - SKP_float LF_MA_shp, /* I */ - SKP_float LF_AR_shp, /* I */ + silk_float st_res[], /* I */ + silk_float xw[], /* O */ + silk_float *HarmShapeFIR, /* I */ + silk_float Tilt, /* I */ + silk_float LF_MA_shp, /* I */ + silk_float LF_AR_shp, /* I */ opus_int lag, /* I */ opus_int length /* I */ ); void silk_warped_LPC_analysis_filter_FLP( - SKP_float state[], /* I/O State [order + 1] */ - SKP_float res[], /* O Residual signal [length] */ - const SKP_float coef[], /* I Coefficients [order] */ - const SKP_float input[], /* I Input signal [length] */ - const SKP_float lambda, /* I Warping factor */ + silk_float state[], /* I/O State [order + 1] */ + silk_float res[], /* O Residual signal [length] */ + const silk_float coef[], /* I Coefficients [order] */ + const silk_float input[], /* I Input signal [length] */ + const silk_float lambda, /* I Warping factor */ const opus_int length, /* I Length of input signal */ const opus_int order /* I Filter order (even) */ ) { opus_int n, i; - SKP_float acc, tmp1, tmp2; + silk_float acc, tmp1, tmp2; /* Order must be even */ - SKP_assert( ( order & 1 ) == 0 ); + silk_assert( ( order & 1 ) == 0 ); for( n = 0; n < length; n++ ) { /* Output of lowpass section */ @@ -94,19 +94,19 @@ void silk_warped_LPC_analysis_filter_FLP( void silk_prefilter_FLP( silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */ const silk_encoder_control_FLP *psEncCtrl, /* I Encoder control FLP */ - SKP_float xw[], /* O Weighted signal */ - const SKP_float x[] /* I Speech signal */ + silk_float xw[], /* O Weighted signal */ + const silk_float x[] /* I Speech signal */ ) { silk_prefilter_state_FLP *P = &psEnc->sPrefilt; opus_int j, k, lag; - SKP_float HarmShapeGain, Tilt, LF_MA_shp, LF_AR_shp; - SKP_float B[ 2 ]; - const SKP_float *AR1_shp; - const SKP_float *px; - SKP_float *pxw; - SKP_float HarmShapeFIR[ 3 ]; - SKP_float st_res[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; + silk_float HarmShapeGain, Tilt, LF_MA_shp, LF_AR_shp; + silk_float B[ 2 ]; + const silk_float *AR1_shp; + const silk_float *px; + silk_float *pxw; + silk_float HarmShapeFIR[ 3 ]; + silk_float st_res[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; /* Setup pointers */ px = x; @@ -130,7 +130,7 @@ void silk_prefilter_FLP( /* Short term FIR filtering */ silk_warped_LPC_analysis_filter_FLP( P->sAR_shp, st_res, AR1_shp, px, - (SKP_float)psEnc->sCmn.warping_Q16 / 65536.0f, psEnc->sCmn.subfr_length, psEnc->sCmn.shapingLPCOrder ); + (silk_float)psEnc->sCmn.warping_Q16 / 65536.0f, psEnc->sCmn.subfr_length, psEnc->sCmn.shapingLPCOrder ); /* Reduce (mainly) low frequencies during harmonic emphasis */ B[ 0 ] = psEncCtrl->GainsPre[ k ]; @@ -155,21 +155,21 @@ void silk_prefilter_FLP( */ static inline void silk_prefilt_FLP( silk_prefilter_state_FLP *P,/* I/O state */ - SKP_float st_res[], /* I */ - SKP_float xw[], /* O */ - SKP_float *HarmShapeFIR, /* I */ - SKP_float Tilt, /* I */ - SKP_float LF_MA_shp, /* I */ - SKP_float LF_AR_shp, /* I */ + silk_float st_res[], /* I */ + silk_float xw[], /* O */ + silk_float *HarmShapeFIR, /* I */ + silk_float Tilt, /* I */ + silk_float LF_MA_shp, /* I */ + silk_float LF_AR_shp, /* I */ opus_int lag, /* I */ opus_int length /* I */ ) { 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; + silk_float n_Tilt, n_LF, n_LTP; + silk_float sLF_AR_shp, sLF_MA_shp; + silk_float *LTP_shp_buf; /* To speed up use temp variables instead of using the struct */ LTP_shp_buf = P->sLTP_shp; @@ -179,7 +179,7 @@ static inline void silk_prefilt_FLP( for( i = 0; i < length; i++ ) { if( lag > 0 ) { - SKP_assert( HARM_SHAPE_FIR_TAPS == 3 ); + silk_assert( HARM_SHAPE_FIR_TAPS == 3 ); idx = lag + LTP_shp_buf_idx; n_LTP = LTP_shp_buf[ ( idx - HARM_SHAPE_FIR_TAPS / 2 - 1) & LTP_MASK ] * HarmShapeFIR[ 0 ]; n_LTP += LTP_shp_buf[ ( idx - HARM_SHAPE_FIR_TAPS / 2 ) & LTP_MASK ] * HarmShapeFIR[ 1 ]; diff --git a/silk/float/silk_process_gains_FLP.c b/silk/float/silk_process_gains_FLP.c index 2dceb02f..33dada2a 100644 --- a/silk/float/silk_process_gains_FLP.c +++ b/silk/float/silk_process_gains_FLP.c @@ -41,24 +41,24 @@ void silk_process_gains_FLP( silk_shape_state_FLP *psShapeSt = &psEnc->sShape; opus_int k; opus_int32 pGains_Q16[ MAX_NB_SUBFR ]; - SKP_float s, InvMaxSqrVal, gain, quant_offset; + silk_float s, InvMaxSqrVal, gain, quant_offset; /* Gain reduction when LTP coding gain is high */ if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { - s = 1.0f - 0.5f * SKP_sigmoid( 0.25f * ( psEncCtrl->LTPredCodGain - 12.0f ) ); + s = 1.0f - 0.5f * silk_sigmoid( 0.25f * ( psEncCtrl->LTPredCodGain - 12.0f ) ); for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { psEncCtrl->Gains[ k ] *= s; } } /* Limit the quantized signal */ - InvMaxSqrVal = ( SKP_float )( pow( 2.0f, 0.33f * ( 21.0f - psEnc->sCmn.SNR_dB_Q7 * ( 1 / 128.0f ) ) ) / psEnc->sCmn.subfr_length ); + InvMaxSqrVal = ( silk_float )( pow( 2.0f, 0.33f * ( 21.0f - psEnc->sCmn.SNR_dB_Q7 * ( 1 / 128.0f ) ) ) / psEnc->sCmn.subfr_length ); for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { /* Soft limit on ratio residual energy and squared gains */ gain = psEncCtrl->Gains[ k ]; - gain = ( SKP_float )sqrt( gain * gain + psEncCtrl->ResNrg[ k ] * InvMaxSqrVal ); - psEncCtrl->Gains[ k ] = SKP_min_float( gain, 32767.0f ); + gain = ( silk_float )sqrt( gain * gain + psEncCtrl->ResNrg[ k ] * InvMaxSqrVal ); + psEncCtrl->Gains[ k ] = silk_min_float( gain, 32767.0f ); } /* Prepare gains for noise shaping quantization */ @@ -93,6 +93,6 @@ void silk_process_gains_FLP( + LAMBDA_CODING_QUALITY * psEncCtrl->coding_quality + LAMBDA_QUANT_OFFSET * quant_offset; - SKP_assert( psEncCtrl->Lambda > 0.0f ); - SKP_assert( psEncCtrl->Lambda < 2.0f ); + silk_assert( psEncCtrl->Lambda > 0.0f ); + silk_assert( psEncCtrl->Lambda < 2.0f ); } diff --git a/silk/float/silk_regularize_correlations_FLP.c b/silk/float/silk_regularize_correlations_FLP.c index 9741ca9a..7034dd3e 100644 --- a/silk/float/silk_regularize_correlations_FLP.c +++ b/silk/float/silk_regularize_correlations_FLP.c @@ -32,9 +32,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_main_FLP.h" 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 */ + silk_float *XX, /* I/O Correlation matrices */ + silk_float *xx, /* I/O Correlation values */ + const silk_float noise, /* I Noise energy to add */ const opus_int D /* I Dimension of XX */ ) { diff --git a/silk/float/silk_residual_energy_FLP.c b/silk/float/silk_residual_energy_FLP.c index fadd7cca..6ab9ecf2 100644 --- a/silk/float/silk_residual_energy_FLP.c +++ b/silk/float/silk_residual_energy_FLP.c @@ -35,19 +35,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define REGULARIZATION_FACTOR 1e-8f /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ -SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual energy */ - const SKP_float *c, /* I Filter coefficients */ - 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 */ +silk_float silk_residual_energy_covar_FLP( /* O Weighted residual energy */ + const silk_float *c, /* I Filter coefficients */ + silk_float *wXX, /* I/O Weighted correlation matrix, reg. out */ + const silk_float *wXx, /* I Weighted correlation vector */ + const silk_float wxx, /* I Weighted correlation value */ const opus_int D /* I Dimension */ ) { opus_int i, j, k; - SKP_float tmp, nrg = 0.0f, regularization; + silk_float tmp, nrg = 0.0f, regularization; /* Safety checks */ - SKP_assert( D >= 0 ); + silk_assert( D >= 0 ); regularization = REGULARIZATION_FACTOR * ( wXX[ 0 ] + wXX[ D * D - 1 ] ); for( k = 0; k < MAX_ITERATIONS_RESIDUAL_NRG; k++ ) { @@ -79,7 +79,7 @@ SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual en } } if( k == MAX_ITERATIONS_RESIDUAL_NRG ) { - SKP_assert( nrg == 0 ); + silk_assert( nrg == 0 ); nrg = 1.0f; } @@ -89,29 +89,29 @@ SKP_float silk_residual_energy_covar_FLP( /* O Weighted residual en /* Calculates residual energies of input subframes where all subframes have LPC_order */ /* of preceeding samples */ void silk_residual_energy_FLP( - SKP_float nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ - 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 */ + silk_float nrgs[ MAX_NB_SUBFR ], /* O Residual energy per subframe */ + const silk_float x[], /* I Input signal */ + silk_float a[ 2 ][ MAX_LPC_ORDER ], /* I AR coefs for each frame half */ + const silk_float gains[], /* 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 */ ) { opus_int shift; - SKP_float *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; + silk_float *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ]; LPC_res_ptr = LPC_res + LPC_order; shift = LPC_order + subfr_length; /* Filter input to create the LPC residual for each frame half, and measure subframe energies */ silk_LPC_analysis_filter_FLP( LPC_res, a[ 0 ], x + 0 * shift, 2 * shift, LPC_order ); - nrgs[ 0 ] = ( SKP_float )( gains[ 0 ] * gains[ 0 ] * silk_energy_FLP( LPC_res_ptr + 0 * shift, subfr_length ) ); - nrgs[ 1 ] = ( SKP_float )( gains[ 1 ] * gains[ 1 ] * silk_energy_FLP( LPC_res_ptr + 1 * shift, subfr_length ) ); + nrgs[ 0 ] = ( silk_float )( gains[ 0 ] * gains[ 0 ] * silk_energy_FLP( LPC_res_ptr + 0 * shift, subfr_length ) ); + nrgs[ 1 ] = ( silk_float )( gains[ 1 ] * gains[ 1 ] * silk_energy_FLP( LPC_res_ptr + 1 * shift, subfr_length ) ); if( nb_subfr == MAX_NB_SUBFR ) { silk_LPC_analysis_filter_FLP( LPC_res, a[ 1 ], x + 2 * shift, 2 * shift, LPC_order ); - nrgs[ 2 ] = ( SKP_float )( gains[ 2 ] * gains[ 2 ] * silk_energy_FLP( LPC_res_ptr + 0 * shift, subfr_length ) ); - nrgs[ 3 ] = ( SKP_float )( gains[ 3 ] * gains[ 3 ] * silk_energy_FLP( LPC_res_ptr + 1 * shift, subfr_length ) ); + nrgs[ 2 ] = ( silk_float )( gains[ 2 ] * gains[ 2 ] * silk_energy_FLP( LPC_res_ptr + 0 * shift, subfr_length ) ); + nrgs[ 3 ] = ( silk_float )( gains[ 3 ] * gains[ 3 ] * silk_energy_FLP( LPC_res_ptr + 1 * shift, subfr_length ) ); } } diff --git a/silk/float/silk_scale_copy_vector_FLP.c b/silk/float/silk_scale_copy_vector_FLP.c index 396203cf..ca6867e1 100644 --- a/silk/float/silk_scale_copy_vector_FLP.c +++ b/silk/float/silk_scale_copy_vector_FLP.c @@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* copy and multiply a vector by a constant */ void silk_scale_copy_vector_FLP( - SKP_float *data_out, - const SKP_float *data_in, - SKP_float gain, + silk_float *data_out, + const silk_float *data_in, + silk_float gain, opus_int dataSize ) { diff --git a/silk/float/silk_scale_vector_FLP.c b/silk/float/silk_scale_vector_FLP.c index b8fa92c3..33982ebb 100644 --- a/silk/float/silk_scale_vector_FLP.c +++ b/silk/float/silk_scale_vector_FLP.c @@ -33,8 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* multiply a vector by a constant */ void silk_scale_vector_FLP( - SKP_float *data1, - SKP_float gain, + silk_float *data1, + silk_float gain, opus_int dataSize ) { diff --git a/silk/float/silk_schur_FLP.c b/silk/float/silk_schur_FLP.c index f57ebdab..d13d5ccd 100644 --- a/silk/float/silk_schur_FLP.c +++ b/silk/float/silk_schur_FLP.c @@ -31,15 +31,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FLP.h" -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) */ +silk_float silk_schur_FLP( /* O returns residual energy */ + silk_float refl_coef[], /* O reflection coefficients (length order) */ + const silk_float auto_corr[], /* I autotcorrelation sequence (length order+1) */ opus_int order /* I order */ ) { opus_int k, n; - SKP_float C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; - SKP_float Ctmp1, Ctmp2, rc_tmp; + silk_float C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; + silk_float Ctmp1, Ctmp2, rc_tmp; /* Copy correlations */ for( k = 0; k < order+1; k++ ) { @@ -48,7 +48,7 @@ SKP_float silk_schur_FLP( /* O returns residual energy for( k = 0; k < order; k++ ) { /* Get reflection coefficient */ - rc_tmp = -C[ k + 1 ][ 0 ] / SKP_max_float( C[ 0 ][ 1 ], 1e-9f ); + rc_tmp = -C[ k + 1 ][ 0 ] / silk_max_float( C[ 0 ][ 1 ], 1e-9f ); /* Save the output */ refl_coef[ k ] = rc_tmp; diff --git a/silk/float/silk_solve_LS_FLP.c b/silk/float/silk_solve_LS_FLP.c index a082b33a..fc38c7f3 100644 --- a/silk/float/silk_solve_LS_FLP.c +++ b/silk/float/silk_solve_LS_FLP.c @@ -38,10 +38,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * the symmetric matric A is given by A = L*D*L'. **********************************************************************/ void silk_LDL_FLP( - SKP_float *A, /* (I/O) Pointer to Symetric Square Matrix */ + silk_float *A, /* (I/O) Pointer to Symetric Square 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 */ + silk_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */ + silk_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */ ); /********************************************************************** @@ -49,10 +49,10 @@ void silk_LDL_FLP( * triangular matrix, with ones on the diagonal. **********************************************************************/ void silk_SolveWithLowerTriangularWdiagOnes_FLP( - const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ + const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */ opus_int M, /* (I) Dim of Matrix equation */ - const SKP_float *b, /* (I) b Vector */ - SKP_float *x /* (O) x Vector */ + const silk_float *b, /* (I) b Vector */ + silk_float *x /* (O) x Vector */ ); /********************************************************************** @@ -60,10 +60,10 @@ void silk_SolveWithLowerTriangularWdiagOnes_FLP( * triangular, with ones on the diagonal. (ie then A^T is upper triangular) **********************************************************************/ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( - const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ + const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */ opus_int M, /* (I) Dim of Matrix equation */ - const SKP_float *b, /* (I) b Vector */ - SKP_float *x /* (O) x Vector */ + const silk_float *b, /* (I) b Vector */ + silk_float *x /* (O) x Vector */ ); /********************************************************************** @@ -71,18 +71,18 @@ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( * symmetric square matrix - using LDL factorisation **********************************************************************/ void silk_solve_LDL_FLP( - SKP_float *A, /* I/O Symmetric square matrix, out: reg. */ + silk_float *A, /* I/O Symmetric square matrix, out: reg. */ 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 */ + const silk_float *b, /* I Pointer to b vector */ + silk_float *x /* O Pointer to x solution vector */ ) { 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*/ + silk_float L[ MAX_MATRIX_SIZE ][ MAX_MATRIX_SIZE ]; + silk_float T[ MAX_MATRIX_SIZE ]; + silk_float Dinv[ MAX_MATRIX_SIZE ]; /* inverse diagonal elements of D*/ - SKP_assert( M <= MAX_MATRIX_SIZE ); + silk_assert( M <= MAX_MATRIX_SIZE ); /*************************************************** Factorize A by LDL such that A = L*D*(L^T), @@ -110,15 +110,15 @@ void silk_solve_LDL_FLP( } void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( - const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ + const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */ opus_int M, /* (I) Dim of Matrix equation */ - const SKP_float *b, /* (I) b Vector */ - SKP_float *x /* (O) x Vector */ + const silk_float *b, /* (I) b Vector */ + silk_float *x /* (O) x Vector */ ) { opus_int i, j; - SKP_float temp; - const SKP_float *ptr1; + silk_float temp; + const silk_float *ptr1; for( i = M - 1; i >= 0; i-- ) { ptr1 = matrix_adr( L, 0, i, M ); @@ -132,15 +132,15 @@ void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( } void silk_SolveWithLowerTriangularWdiagOnes_FLP( - const SKP_float *L, /* (I) Pointer to Lower Triangular Matrix */ + const silk_float *L, /* (I) Pointer to Lower Triangular Matrix */ opus_int M, /* (I) Dim of Matrix equation */ - const SKP_float *b, /* (I) b Vector */ - SKP_float *x /* (O) x Vector */ + const silk_float *b, /* (I) b Vector */ + silk_float *x /* (O) x Vector */ ) { opus_int i, j; - SKP_float temp; - const SKP_float *ptr1; + silk_float temp; + const silk_float *ptr1; for( i = 0; i < M; i++ ) { ptr1 = matrix_adr( L, i, 0, M ); @@ -154,18 +154,18 @@ void silk_SolveWithLowerTriangularWdiagOnes_FLP( } void silk_LDL_FLP( - SKP_float *A, /* (I/O) Pointer to Symetric Square Matrix */ + silk_float *A, /* (I/O) Pointer to Symetric Square 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 */ + silk_float *L, /* (I/O) Pointer to Square Upper triangular Matrix */ + silk_float *Dinv /* (I/O) Pointer to vector holding the inverse diagonal elements of D */ ) { opus_int i, j, k, loop_count, err = 1; - SKP_float *ptr1, *ptr2; + silk_float *ptr1, *ptr2; double temp, diag_min_value; - SKP_float v[ MAX_MATRIX_SIZE ], D[ MAX_MATRIX_SIZE ]; /* temp arrays*/ + silk_float v[ MAX_MATRIX_SIZE ], D[ MAX_MATRIX_SIZE ]; /* temp arrays*/ - SKP_assert( M <= MAX_MATRIX_SIZE ); + silk_assert( M <= MAX_MATRIX_SIZE ); diag_min_value = FIND_LTP_COND_FAC * 0.5f * ( A[ 0 ] + A[ M * M - 1 ] ); for( loop_count = 0; loop_count < M && err == 1; loop_count++ ) { @@ -181,13 +181,13 @@ void silk_LDL_FLP( /* Badly conditioned matrix: add white noise and run again */ temp = ( loop_count + 1 ) * diag_min_value - temp; for( i = 0; i < M; i++ ) { - matrix_ptr( A, i, i, M ) += ( SKP_float )temp; + matrix_ptr( A, i, i, M ) += ( silk_float )temp; } err = 1; break; } - D[ j ] = ( SKP_float )temp; - Dinv[ j ] = ( SKP_float )( 1.0f / temp ); + D[ j ] = ( silk_float )temp; + Dinv[ j ] = ( silk_float )( 1.0f / temp ); matrix_ptr( L, j, j, M ) = 1.0f; ptr1 = matrix_adr( A, j, 0, M ); @@ -197,11 +197,11 @@ void silk_LDL_FLP( for( k = 0; k < j; k++ ) { temp += ptr2[ k ] * v[ k ]; } - matrix_ptr( L, i, j, M ) = ( SKP_float )( ( ptr1[ i ] - temp ) * Dinv[ j ] ); + matrix_ptr( L, i, j, M ) = ( silk_float )( ( ptr1[ i ] - temp ) * Dinv[ j ] ); ptr2 += M; /* go to next column*/ } } } - SKP_assert( err == 0 ); + silk_assert( err == 0 ); } diff --git a/silk/float/silk_sort_FLP.c b/silk/float/silk_sort_FLP.c index 62249b5d..c08fb32f 100644 --- a/silk/float/silk_sort_FLP.c +++ b/silk/float/silk_sort_FLP.c @@ -37,19 +37,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "silk_SigProc_FLP.h" void silk_insertion_sort_decreasing_FLP( - SKP_float *a, /* I/O: Unsorted / Sorted vector */ + silk_float *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_float value; + silk_float value; opus_int i, j; /* Safety checks */ - SKP_assert( K > 0 ); - SKP_assert( L > 0 ); - SKP_assert( L >= K ); + silk_assert( K > 0 ); + silk_assert( L > 0 ); + silk_assert( L >= K ); /* Write start indices in index vector */ for( i = 0; i < K; i++ ) { diff --git a/silk/float/silk_structs_FLP.h b/silk/float/silk_structs_FLP.h index e9c5b1ae..68d358a2 100644 --- a/silk/float/silk_structs_FLP.h +++ b/silk/float/silk_structs_FLP.h @@ -42,21 +42,21 @@ extern "C" /********************************/ typedef struct { opus_int8 LastGainIndex; - SKP_float HarmBoost_smth; - SKP_float HarmShapeGain_smth; - SKP_float Tilt_smth; + silk_float HarmBoost_smth; + silk_float HarmShapeGain_smth; + silk_float Tilt_smth; } silk_shape_state_FLP; /********************************/ /* Prefilter state */ /********************************/ typedef struct { - SKP_float sLTP_shp[ LTP_BUF_LENGTH ]; - SKP_float sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ]; + silk_float sLTP_shp[ LTP_BUF_LENGTH ]; + silk_float sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ]; opus_int sLTP_shp_buf_idx; - SKP_float sLF_AR_shp; - SKP_float sLF_MA_shp; - SKP_float sHarmHP; + silk_float sLF_AR_shp; + silk_float sLF_MA_shp; + silk_float sHarmHP; opus_int32 rand_seed; opus_int lagPrev; } silk_prefilter_state_FLP; @@ -70,12 +70,12 @@ typedef struct { silk_prefilter_state_FLP sPrefilt; /* Prefilter State */ /* Buffer for find pitch and noise shape analysis */ - SKP_float x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */ - SKP_float LTPCorr; /* Normalized correlation from pitch lag estimator */ + silk_float x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */ + silk_float LTPCorr; /* Normalized correlation from pitch lag estimator */ /* Parameters for LTP scaling control */ - SKP_float prevLTPredCodGain; - SKP_float HPLTPredCodGain; + silk_float prevLTPredCodGain; + silk_float HPLTPredCodGain; } silk_encoder_state_FLP; /************************/ @@ -83,30 +83,30 @@ typedef struct { /************************/ typedef struct { /* Prediction and coding parameters */ - SKP_float Gains[ MAX_NB_SUBFR ]; - SKP_float PredCoef[ 2 ][ MAX_LPC_ORDER ]; /* holds interpolated and final coefficients */ - SKP_float LTPCoef[LTP_ORDER * MAX_NB_SUBFR]; - SKP_float LTP_scale; + silk_float Gains[ MAX_NB_SUBFR ]; + silk_float PredCoef[ 2 ][ MAX_LPC_ORDER ]; /* holds interpolated and final coefficients */ + silk_float LTPCoef[LTP_ORDER * MAX_NB_SUBFR]; + silk_float LTP_scale; opus_int pitchL[ MAX_NB_SUBFR ]; /* Noise shaping parameters */ - SKP_float AR1[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; - SKP_float AR2[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; - SKP_float LF_MA_shp[ MAX_NB_SUBFR ]; - SKP_float LF_AR_shp[ MAX_NB_SUBFR ]; - SKP_float GainsPre[ MAX_NB_SUBFR ]; - SKP_float HarmBoost[ MAX_NB_SUBFR ]; - SKP_float Tilt[ MAX_NB_SUBFR ]; - SKP_float HarmShapeGain[ MAX_NB_SUBFR ]; - SKP_float Lambda; - SKP_float input_quality; - SKP_float coding_quality; + silk_float AR1[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; + silk_float AR2[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; + silk_float LF_MA_shp[ MAX_NB_SUBFR ]; + silk_float LF_AR_shp[ MAX_NB_SUBFR ]; + silk_float GainsPre[ MAX_NB_SUBFR ]; + silk_float HarmBoost[ MAX_NB_SUBFR ]; + silk_float Tilt[ MAX_NB_SUBFR ]; + silk_float HarmShapeGain[ MAX_NB_SUBFR ]; + silk_float Lambda; + silk_float input_quality; + silk_float coding_quality; /* Measures */ - SKP_float sparseness; - SKP_float predGain; - SKP_float LTPredCodGain; - SKP_float ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */ + silk_float sparseness; + silk_float predGain; + silk_float LTPredCodGain; + silk_float ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */ } silk_encoder_control_FLP; /************************/ diff --git a/silk/float/silk_warped_autocorrelation_FLP.c b/silk/float/silk_warped_autocorrelation_FLP.c index e997f62a..de08d497 100644 --- a/silk/float/silk_warped_autocorrelation_FLP.c +++ b/silk/float/silk_warped_autocorrelation_FLP.c @@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Autocorrelations for a warped frequency axis */ 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 */ + silk_float *corr, /* O Result [order + 1] */ + const silk_float *input, /* I Input data to correlate */ + const silk_float warping, /* I Warping coefficient */ const opus_int length, /* I Length of input */ const opus_int order /* I Correlation order (even) */ ) @@ -46,7 +46,7 @@ void silk_warped_autocorrelation_FLP( double C[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; /* Order must be even */ - SKP_assert( ( order & 1 ) == 0 ); + silk_assert( ( order & 1 ) == 0 ); /* Loop over samples */ for( n = 0; n < length; n++ ) { @@ -66,8 +66,8 @@ void silk_warped_autocorrelation_FLP( C[ order ] += state[ 0 ] * tmp1; } - /* Copy correlations in SKP_float output format */ + /* Copy correlations in silk_float output format */ for( i = 0; i < order + 1; i++ ) { - corr[ i ] = ( SKP_float )C[ i ]; + corr[ i ] = ( silk_float )C[ i ]; } } diff --git a/silk/float/silk_wrappers_FLP.c b/silk/float/silk_wrappers_FLP.c index 826251fe..2e38f081 100644 --- a/silk/float/silk_wrappers_FLP.c +++ b/silk/float/silk_wrappers_FLP.c @@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Convert AR filter coefficients to NLSF parameters */ void silk_A2NLSF_FLP( opus_int16 *NLSF_Q15, /* O NLSF vector [ LPC_order ] */ - const SKP_float *pAR, /* I LPC coefficients [ LPC_order ] */ + const silk_float *pAR, /* I LPC coefficients [ LPC_order ] */ const opus_int LPC_order /* I LPC order */ ) { @@ -44,7 +44,7 @@ void silk_A2NLSF_FLP( 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 ); + a_fix_Q16[ i ] = silk_float2int( pAR[ i ] * 65536.0f ); } silk_A2NLSF( NLSF_Q15, a_fix_Q16, LPC_order ); @@ -52,7 +52,7 @@ void silk_A2NLSF_FLP( /* Convert LSF parameters to AR prediction filter coefficients */ void silk_NLSF2A_FLP( - SKP_float *pAR, /* O LPC coefficients [ LPC_order ] */ + silk_float *pAR, /* O LPC coefficients [ LPC_order ] */ const opus_int16 *NLSF_Q15, /* I NLSF vector [ LPC_order ] */ const opus_int LPC_order /* I LPC order */ ) @@ -63,7 +63,7 @@ void silk_NLSF2A_FLP( silk_NLSF2A( a_fix_Q12, NLSF_Q15, LPC_order ); for( i = 0; i < LPC_order; i++ ) { - pAR[ i ] = ( SKP_float )a_fix_Q12[ i ] * ( 1.0f / 4096.0f ); + pAR[ i ] = ( silk_float )a_fix_Q12[ i ] * ( 1.0f / 4096.0f ); } } @@ -72,7 +72,7 @@ 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 */ + silk_float PredCoef[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ 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)) */ ) @@ -84,7 +84,7 @@ void silk_process_NLSFs_FLP( for( j = 0; j < 2; j++ ) { for( i = 0; i < psEncC->predictLPCOrder; i++ ) { - PredCoef[ j ][ i ] = ( SKP_float )PredCoef_Q12[ j ][ i ] * ( 1.0f / 4096.0f ); + PredCoef[ j ][ i ] = ( silk_float )PredCoef_Q12[ j ][ i ] * ( 1.0f / 4096.0f ); } } } @@ -98,13 +98,13 @@ void silk_NSQ_wrapper_FLP( SideInfoIndices *psIndices, /* I/O Quantization indices */ silk_nsq_state *psNSQ, /* I/O Noise Shaping Quantzation state */ opus_int8 pulses[], /* O Quantized pulse signal */ - const SKP_float x[] /* I Prefiltered input signal */ + const silk_float x[] /* I Prefiltered input signal */ ) { 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 ]; + silk_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; opus_int LTP_scale_Q14; @@ -119,32 +119,32 @@ void silk_NSQ_wrapper_FLP( /* Noise shape parameters */ for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { for( j = 0; j < psEnc->sCmn.shapingLPCOrder; j++ ) { - AR2_Q13[ i * MAX_SHAPE_LPC_ORDER + j ] = SKP_float2int( psEncCtrl->AR2[ i * MAX_SHAPE_LPC_ORDER + j ] * 8192.0f ); + AR2_Q13[ i * MAX_SHAPE_LPC_ORDER + j ] = silk_float2int( psEncCtrl->AR2[ i * MAX_SHAPE_LPC_ORDER + j ] * 8192.0f ); } } 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 ) | - (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 ); + LF_shp_Q14[ i ] = silk_LSHIFT32( silk_float2int( psEncCtrl->LF_AR_shp[ i ] * 16384.0f ), 16 ) | + (opus_uint16)silk_float2int( psEncCtrl->LF_MA_shp[ i ] * 16384.0f ); + Tilt_Q14[ i ] = (opus_int)silk_float2int( psEncCtrl->Tilt[ i ] * 16384.0f ); + HarmShapeGain_Q14[ i ] = (opus_int)silk_float2int( psEncCtrl->HarmShapeGain[ i ] * 16384.0f ); } - Lambda_Q10 = ( opus_int )SKP_float2int( psEncCtrl->Lambda * 1024.0f ); + Lambda_Q10 = ( opus_int )silk_float2int( psEncCtrl->Lambda * 1024.0f ); /* prediction and coding parameters */ for( i = 0; i < psEnc->sCmn.nb_subfr * LTP_ORDER; i++ ) { - LTPCoef_Q14[ i ] = ( opus_int16 )SKP_float2int( psEncCtrl->LTPCoef[ i ] * 16384.0f ); + LTPCoef_Q14[ i ] = ( opus_int16 )silk_float2int( psEncCtrl->LTPCoef[ i ] * 16384.0f ); } for( j = 0; j < 2; j++ ) { for( i = 0; i < psEnc->sCmn.predictLPCOrder; i++ ) { - PredCoef_Q12[ j ][ i ] = ( opus_int16 )SKP_float2int( psEncCtrl->PredCoef[ j ][ i ] * 4096.0f ); + PredCoef_Q12[ j ][ i ] = ( opus_int16 )silk_float2int( psEncCtrl->PredCoef[ j ][ i ] * 4096.0f ); } } for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { - Gains_Q16[ i ] = SKP_float2int( psEncCtrl->Gains[ i ] * 65536.0f ); - SKP_assert( Gains_Q16[ i ] > 0 ); + Gains_Q16[ i ] = silk_float2int( psEncCtrl->Gains[ i ] * 65536.0f ); + silk_assert( Gains_Q16[ i ] > 0 ); } if( psIndices->signalType == TYPE_VOICED ) { @@ -154,7 +154,7 @@ void silk_NSQ_wrapper_FLP( } /* Convert input to fix */ - SKP_float2short_array( x_16, x, psEnc->sCmn.frame_length ); + silk_float2short_array( x_16, x, psEnc->sCmn.frame_length ); /* Call NSQ */ if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 ) { @@ -170,10 +170,10 @@ void silk_NSQ_wrapper_FLP( /* Floating-point Silk LTP quantiation wrapper */ /***********************************************/ void silk_quant_LTP_gains_FLP( - SKP_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un-)quantized LTP gains */ + silk_float B[ 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 SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ + const silk_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Error weights */ 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 */ @@ -184,15 +184,15 @@ void silk_quant_LTP_gains_FLP( opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ]; for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { - B_Q14[ i ] = (opus_int16)SKP_float2int( B[ i ] * 16384.0f ); + B_Q14[ i ] = (opus_int16)silk_float2int( B[ i ] * 16384.0f ); } for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) { - W_Q18[ i ] = (opus_int32)SKP_float2int( W[ i ] * 262144.0f ); + W_Q18[ i ] = (opus_int32)silk_float2int( W[ i ] * 262144.0f ); } silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, W_Q18, mu_Q10, lowComplexity, nb_subfr ); for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { - B[ i ] = (SKP_float)B_Q14[ i ] * ( 1.0f / 16384.0f ); + B[ i ] = (silk_float)B_Q14[ i ] * ( 1.0f / 16384.0f ); } } |