ref: 86476906ec9711cdd1d74ae35bfb9bd0ba60f0d9
parent: bed02c9205476b93fc9bf3d9e3608d792cfaf8e3
author: Ralph Giles <[email protected]>
date: Wed Aug 24 08:49:04 EDT 2011
Use 'frame' instead of 'signal' in the silk code. On MacOS, stdlib.h ends up including sys/signal.h, generating warnings about the local variables called 'signal' shadowing the global symbol signal(3). Tested with XCode 4.1 on MacOS X 10.7.0. The signal buffers passed in are generally frames being processed, and the code already uses the term frame and frame_length elsewhere, so I've resolved the warning by renaming signal and signal_* locals and parameters to frame and frame_*.
--- a/silk/float/silk_pitch_analysis_core_FLP.c
+++ b/silk/float/silk_pitch_analysis_core_FLP.c
@@ -50,7 +50,7 @@
/************************************************************/
static void silk_P_Ana_calc_corr_st3(
SKP_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */
- const SKP_float signal[], /* I vector to correlate */
+ const SKP_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 */
@@ -59,7 +59,7 @@
static void silk_P_Ana_calc_energy_st3(
SKP_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */
- const SKP_float signal[], /* I vector to correlate */
+ const SKP_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 */
@@ -70,7 +70,7 @@
//% CORE PITCH ANALYSIS FUNCTION %
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 SKP_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 */
@@ -84,10 +84,10 @@
)
{
opus_int i, k, d, j;
- SKP_float signal_8kHz[ PE_MAX_FRAME_LENGTH_MS * 8 ];
- SKP_float signal_4kHz[ PE_MAX_FRAME_LENGTH_MS * 4 ];
- opus_int16 signal_8_FIX[ PE_MAX_FRAME_LENGTH_MS * 8 ];
- opus_int16 signal_4_FIX[ PE_MAX_FRAME_LENGTH_MS * 4 ];
+ SKP_float frame_8kHz[ PE_MAX_FRAME_LENGTH_MS * 8 ];
+ SKP_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 ];
@@ -140,47 +140,47 @@
/* Resample from input sampled at Fs_kHz to 8 kHz */
if( Fs_kHz == 16 ) {
/* Resample to 16 -> 8 khz */
- opus_int16 signal_16_FIX[ 16 * PE_MAX_FRAME_LENGTH_MS ];
- SKP_float2short_array( signal_16_FIX, signal, frame_length );
+ 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_resampler_down2( filt_state, signal_8_FIX, signal_16_FIX, frame_length );
- SKP_short2float_array( signal_8kHz, signal_8_FIX, frame_length_8kHz );
+ silk_resampler_down2( filt_state, frame_8_FIX, frame_16_FIX, frame_length );
+ SKP_short2float_array( frame_8kHz, frame_8_FIX, frame_length_8kHz );
} else if( Fs_kHz == 12 ) {
/* Resample to 12 -> 8 khz */
- opus_int16 signal_12_FIX[ 12 * PE_MAX_FRAME_LENGTH_MS ];
- SKP_float2short_array( signal_12_FIX, signal, frame_length );
+ 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_resampler_down2_3( filt_state, signal_8_FIX, signal_12_FIX, frame_length );
- SKP_short2float_array( signal_8kHz, signal_8_FIX, frame_length_8kHz );
+ 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 );
} else {
SKP_assert( Fs_kHz == 8 );
- SKP_float2short_array( signal_8_FIX, signal, frame_length_8kHz );
+ SKP_float2short_array( frame_8_FIX, frame, frame_length_8kHz );
}
/* Decimate again to 4 kHz */
SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );
- silk_resampler_down2( filt_state, signal_4_FIX, signal_8_FIX, frame_length_8kHz );
- SKP_short2float_array( signal_4kHz, signal_4_FIX, frame_length_4kHz );
+ 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 );
/* Low-pass filter */
for( i = frame_length_4kHz - 1; i > 0; i-- ) {
- signal_4kHz[ i ] += signal_4kHz[ i - 1 ];
+ frame_4kHz[ i ] += frame_4kHz[ i - 1 ];
}
/******************************************************************************
* FIRST STAGE, operating in 4 khz
******************************************************************************/
- target_ptr = &signal_4kHz[ SKP_LSHIFT( sf_length_4kHz, 2 ) ];
+ target_ptr = &frame_4kHz[ SKP_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 >= signal_4kHz );
- SKP_assert( target_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( target_ptr >= frame_4kHz );
+ SKP_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 >= signal_4kHz );
- SKP_assert( basis_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( basis_ptr >= frame_4kHz );
+ SKP_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 );
@@ -193,8 +193,8 @@
basis_ptr--;
/* Check that we are within range of the array */
- SKP_assert( basis_ptr >= signal_4kHz );
- SKP_assert( basis_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( basis_ptr >= frame_4kHz );
+ SKP_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz );
cross_corr = silk_inner_product_FLP(target_ptr, basis_ptr, sf_length_8kHz);
@@ -220,7 +220,7 @@
/* Escape if correlation is very low already here */
Cmax = C[ 0 ][ min_lag_4kHz ];
- target_ptr = &signal_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ];
+ target_ptr = &frame_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ];
energy = 1000.0f;
for( i = 0; i < SKP_LSHIFT( sf_length_4kHz, 2 ); i++ ) {
energy += target_ptr[i] * target_ptr[i];
@@ -288,9 +288,9 @@
SKP_memset( C, 0, PE_MAX_NB_SUBFR*((PE_MAX_LAG >> 1) + 5) * sizeof(SKP_float)); // Is this needed?
if( Fs_kHz == 8 ) {
- target_ptr = &signal[ PE_LTP_MEM_LENGTH_MS * 8 ];
+ target_ptr = &frame[ PE_LTP_MEM_LENGTH_MS * 8 ];
} else {
- target_ptr = &signal_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ];
+ target_ptr = &frame_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ];
}
for( k = 0; k < nb_subfr; k++ ) {
energy_tmp = silk_energy_FLP( target_ptr, sf_length_8kHz );
@@ -420,8 +420,8 @@
CCmax = -1000.0f;
/* Calculate the correlations and energies needed in stage 3 */
- silk_P_Ana_calc_corr_st3( cross_corr_st3, signal, start_lag, sf_length, nb_subfr, complexity );
- silk_P_Ana_calc_energy_st3( energies_st3, signal, start_lag, sf_length, nb_subfr, complexity );
+ silk_P_Ana_calc_corr_st3( cross_corr_st3, frame, start_lag, sf_length, nb_subfr, complexity );
+ 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 ) );
@@ -487,7 +487,7 @@
static void silk_P_Ana_calc_corr_st3(
SKP_float cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */
- const SKP_float signal[], /* I vector to correlate */
+ const SKP_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 */
@@ -529,7 +529,7 @@
cbk_size = PE_NB_CBKS_STAGE3_10MS;
}
- target_ptr = &signal[ SKP_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */
+ target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */
for( k = 0; k < nb_subfr; k++ ) {
lag_counter = 0;
@@ -560,7 +560,7 @@
static void silk_P_Ana_calc_energy_st3(
SKP_float energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ], /* O 3 DIM correlation array */
- const SKP_float signal[], /* I vector to correlate */
+ const SKP_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 */
@@ -594,7 +594,7 @@
cbk_size = PE_NB_CBKS_STAGE3_10MS;
}
- target_ptr = &signal[ SKP_LSHIFT( sf_length, 2 ) ];
+ target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ];
for( k = 0; k < nb_subfr; k++ ) {
lag_counter = 0;
--- a/silk/silk_CNG.c
+++ b/silk/silk_CNG.c
@@ -79,7 +79,7 @@
void silk_CNG(
silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
- opus_int16 signal[], /* I/O Signal */
+ opus_int16 frame[], /* I/O Signal data */
opus_int length /* I Length of residual */
)
{
@@ -151,7 +151,7 @@
/* Update states */
CNG_sig_Q10[ MAX_LPC_ORDER + i ] = SKP_ADD_LSHIFT( CNG_sig_Q10[ MAX_LPC_ORDER + i ], sum_Q6, 4 );
- signal[ i ] = SKP_ADD_SAT16( signal[ i ], SKP_RSHIFT_ROUND( sum_Q6, 6 ) );
+ frame[ i ] = SKP_ADD_SAT16( frame[ i ], SKP_RSHIFT_ROUND( sum_Q6, 6 ) );
}
SKP_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q10[ length ], MAX_LPC_ORDER * sizeof( opus_int32 ) );
} else {
--- a/silk/silk_LP_variable_cutoff.c
+++ b/silk/silk_LP_variable_cutoff.c
@@ -100,7 +100,7 @@
/* Deactivate by setting psEncC->mode = 0; */
void silk_LP_variable_cutoff(
silk_LP_state *psLP, /* I/O LP filter state */
- opus_int16 *signal, /* I/O Low-pass filtered output signal */
+ opus_int16 *frame, /* I/O Low-pass filtered output */
const opus_int frame_length /* I Frame length */
)
{
@@ -131,6 +131,6 @@
/* ARMA low-pass filtering */
SKP_assert( TRANSITION_NB == 3 && TRANSITION_NA == 2 );
- silk_biquad_alt( signal, B_Q28, A_Q28, psLP->In_LP_State, signal, frame_length );
+ silk_biquad_alt( frame, B_Q28, A_Q28, psLP->In_LP_State, frame, frame_length );
}
}
--- a/silk/silk_PLC.c
+++ b/silk/silk_PLC.c
@@ -47,7 +47,7 @@
void silk_PLC(
silk_decoder_state *psDec, /* I Decoder state */
silk_decoder_control *psDecCtrl, /* I Decoder control */
- opus_int16 signal[], /* O Concealed signal */
+ opus_int16 frame[], /* O Concealed signal */
opus_int length, /* I length of residual */
opus_int lost /* I Loss flag */
)
@@ -62,7 +62,7 @@
/****************************/
/* Generate Signal */
/****************************/
- silk_PLC_conceal( psDec, psDecCtrl, signal, length );
+ silk_PLC_conceal( psDec, psDecCtrl, frame, length );
psDec->lossCnt++;
} else {
@@ -69,7 +69,7 @@
/****************************/
/* Update state */
/****************************/
- silk_PLC_update( psDec, psDecCtrl, signal, length );
+ silk_PLC_update( psDec, psDecCtrl, frame, length );
}
}
@@ -79,7 +79,7 @@
void silk_PLC_update(
silk_decoder_state *psDec, /* (I/O) Decoder state */
silk_decoder_control *psDecCtrl, /* (I/O) Decoder control */
- opus_int16 signal[],
+ opus_int16 frame[],
opus_int length
)
{
@@ -153,7 +153,7 @@
void silk_PLC_conceal(
silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
- opus_int16 signal[], /* O concealed signal */
+ opus_int16 frame[], /* O concealed signal */
opus_int length /* I length of residual */
)
{
@@ -321,7 +321,7 @@
/* Scale with Gain */
for( i = 0; i < psDec->frame_length; i++ ) {
- signal[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( sig_Q10[ i ], psPLC->prevGain_Q16[ psDec->nb_subfr - 1 ] ), 10 ) );
+ frame[ i ] = ( opus_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( sig_Q10[ i ], psPLC->prevGain_Q16[ psDec->nb_subfr - 1 ] ), 10 ) );
}
/**************************************/
@@ -338,7 +338,7 @@
void silk_PLC_glue_frames(
silk_decoder_state *psDec, /* I/O decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
- opus_int16 signal[], /* I/O signal */
+ opus_int16 frame[], /* I/O signal */
opus_int length /* I length of residual */
)
{
@@ -349,13 +349,13 @@
if( psDec->lossCnt ) {
/* Calculate energy in concealed residual */
- silk_sum_sqr_shift( &psPLC->conc_energy, &psPLC->conc_energy_shift, signal, length );
+ silk_sum_sqr_shift( &psPLC->conc_energy, &psPLC->conc_energy_shift, frame, length );
psPLC->last_frame_lost = 1;
} else {
if( psDec->sPLC.last_frame_lost ) {
/* Calculate residual in decoded signal if last frame was lost */
- silk_sum_sqr_shift( &energy, &energy_shift, signal, length );
+ silk_sum_sqr_shift( &energy, &energy_shift, frame, length );
/* Normalize energies */
if( energy_shift > psPLC->conc_energy_shift ) {
@@ -382,7 +382,7 @@
slope_Q16 = SKP_LSHIFT( slope_Q16, 2 );
for( i = 0; i < length; i++ ) {
- signal[ i ] = SKP_SMULWB( gain_Q16, signal[ i ] );
+ frame[ i ] = SKP_SMULWB( gain_Q16, frame[ i ] );
gain_Q16 += slope_Q16;
if( gain_Q16 > 1 << 16 ) {
break;
--- a/silk/silk_pitch_analysis_core.c
+++ b/silk/silk_pitch_analysis_core.c
@@ -43,7 +43,7 @@
/************************************************************/
void silk_P_Ana_calc_corr_st3(
opus_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */
- const opus_int16 signal[], /* I vector to correlate */
+ const opus_int16 frame[], /* I vector to correlate */
opus_int start_lag, /* I lag offset to search around */
opus_int sf_length, /* I length of a 5 ms subframe */
opus_int nb_subfr, /* I number of subframes */
@@ -52,7 +52,7 @@
void silk_P_Ana_calc_energy_st3(
opus_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */
- const opus_int16 signal[], /* I vector to calc energy in */
+ const opus_int16 frame[], /* I vector to calc energy in */
opus_int start_lag, /* I lag offset to search around */
opus_int sf_length, /* I length of one 5 ms subframe */
opus_int nb_subfr, /* I number of subframes */
@@ -60,8 +60,8 @@
);
opus_int32 silk_P_Ana_find_scaling(
- const opus_int16 *signal,
- const opus_int signal_length,
+ const opus_int16 *frame,
+ const opus_int frame_length,
const opus_int sum_sqr_len
);
@@ -69,7 +69,7 @@
/* FIXED POINT CORE PITCH ANALYSIS FUNCTION */
/*************************************************************/
opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */
- const opus_int16 *signal, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
+ const opus_int16 *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 */
@@ -82,11 +82,11 @@
const opus_int nb_subfr /* I number of 5 ms subframes */
)
{
- opus_int16 signal_8kHz[ PE_MAX_FRAME_LENGTH_ST_2 ];
- opus_int16 signal_4kHz[ PE_MAX_FRAME_LENGTH_ST_1 ];
+ opus_int16 frame_8kHz[ PE_MAX_FRAME_LENGTH_ST_2 ];
+ opus_int16 frame_4kHz[ PE_MAX_FRAME_LENGTH_ST_1 ];
opus_int32 filt_state[ 6 ];
opus_int32 scratch_mem[ 3 * PE_MAX_FRAME_LENGTH ];
- opus_int16 *input_signal_ptr;
+ opus_int16 *input_frame_ptr;
opus_int i, k, d, j;
opus_int16 C[ PE_MAX_NB_SUBFR ][ ( PE_MAX_LAG >> 1 ) + 5 ];
const opus_int16 *target_ptr, *basis_ptr;
@@ -135,22 +135,22 @@
/* Resample from input sampled at Fs_kHz to 8 kHz */
if( Fs_kHz == 16 ) {
SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );
- silk_resampler_down2( filt_state, signal_8kHz, signal, frame_length );
+ silk_resampler_down2( filt_state, frame_8kHz, frame, frame_length );
} else if ( Fs_kHz == 12 ) {
SKP_memset( filt_state, 0, 6 * sizeof( opus_int32 ) );
- silk_resampler_down2_3( filt_state, signal_8kHz, signal, frame_length );
+ silk_resampler_down2_3( filt_state, frame_8kHz, frame, frame_length );
} else {
SKP_assert( Fs_kHz == 8 );
- SKP_memcpy( signal_8kHz, signal, frame_length_8kHz * sizeof(opus_int16) );
+ SKP_memcpy( frame_8kHz, frame, frame_length_8kHz * sizeof(opus_int16) );
}
/* Decimate again to 4 kHz */
SKP_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );/* Set state to zero */
- silk_resampler_down2( filt_state, signal_4kHz, signal_8kHz, frame_length_8kHz );
+ silk_resampler_down2( filt_state, frame_4kHz, frame_8kHz, frame_length_8kHz );
/* Low-pass filter */
for( i = frame_length_4kHz - 1; i > 0; i-- ) {
- signal_4kHz[ i ] = SKP_ADD_SAT16( signal_4kHz[ i ], signal_4kHz[ i - 1 ] );
+ frame_4kHz[ i ] = SKP_ADD_SAT16( frame_4kHz[ i ], frame_4kHz[ i - 1 ] );
}
/*******************************************************************************
@@ -160,10 +160,10 @@
/* Inner product is calculated with different lengths, so scale for the worst case */
max_sum_sq_length = SKP_max_32( sf_length_8kHz, SKP_LSHIFT( sf_length_4kHz, 2 ) );
- shift = silk_P_Ana_find_scaling( signal_4kHz, frame_length_4kHz, max_sum_sq_length );
+ shift = silk_P_Ana_find_scaling( frame_4kHz, frame_length_4kHz, max_sum_sq_length );
if( shift > 0 ) {
for( i = 0; i < frame_length_4kHz; i++ ) {
- signal_4kHz[ i ] = SKP_RSHIFT( signal_4kHz[ i ], shift );
+ frame_4kHz[ i ] = SKP_RSHIFT( frame_4kHz[ i ], shift );
}
}
@@ -170,17 +170,17 @@
/******************************************************************************
* FIRST STAGE, operating in 4 khz
******************************************************************************/
- target_ptr = &signal_4kHz[ SKP_LSHIFT( sf_length_4kHz, 2 ) ];
+ target_ptr = &frame_4kHz[ SKP_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 >= signal_4kHz );
- SKP_assert( target_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( target_ptr >= frame_4kHz );
+ SKP_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 >= signal_4kHz );
- SKP_assert( basis_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( basis_ptr >= frame_4kHz );
+ SKP_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz );
normalizer = 0;
cross_corr = 0;
@@ -197,8 +197,8 @@
basis_ptr--;
/* Check that we are within range of the array */
- SKP_assert( basis_ptr >= signal_4kHz );
- SKP_assert( basis_ptr + sf_length_8kHz <= signal_4kHz + frame_length_4kHz );
+ SKP_assert( basis_ptr >= frame_4kHz );
+ SKP_assert( basis_ptr + sf_length_8kHz <= frame_4kHz + frame_length_4kHz );
cross_corr = silk_inner_prod_aligned( target_ptr, basis_ptr, sf_length_8kHz );
@@ -240,7 +240,7 @@
silk_insertion_sort_decreasing_int16( &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 */
- target_ptr = &signal_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ];
+ target_ptr = &frame_4kHz[ SKP_SMULBB( sf_length_4kHz, nb_subfr ) ];
energy = silk_inner_prod_aligned( target_ptr, target_ptr, SKP_LSHIFT( sf_length_4kHz, 2 ) );
energy = SKP_ADD_SAT32( energy, 1000 ); /* Q0 */
Cmax = (opus_int)C[ 0 ][ min_lag_4kHz ]; /* Q-1 */
@@ -308,10 +308,10 @@
** Scale signal down to avoid correlations measures from overflowing
*******************************************************************************/
/* find scaling as max scaling for each subframe */
- shift = silk_P_Ana_find_scaling( signal_8kHz, frame_length_8kHz, sf_length_8kHz );
+ shift = silk_P_Ana_find_scaling( frame_8kHz, frame_length_8kHz, sf_length_8kHz );
if( shift > 0 ) {
for( i = 0; i < frame_length_8kHz; i++ ) {
- signal_8kHz[ i ] = SKP_RSHIFT( signal_8kHz[ i ], shift );
+ frame_8kHz[ i ] = SKP_RSHIFT( frame_8kHz[ i ], shift );
}
}
@@ -320,12 +320,12 @@
*********************************************************************************/
SKP_memset( C, 0, PE_MAX_NB_SUBFR * ( ( PE_MAX_LAG >> 1 ) + 5 ) * sizeof( opus_int16 ) );
- target_ptr = &signal_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ];
+ target_ptr = &frame_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ];
for( k = 0; k < nb_subfr; k++ ) {
/* Check that we are within range of the array */
- SKP_assert( target_ptr >= signal_8kHz );
- SKP_assert( target_ptr + sf_length_8kHz <= signal_8kHz + frame_length_8kHz );
+ SKP_assert( target_ptr >= frame_8kHz );
+ SKP_assert( target_ptr + sf_length_8kHz <= frame_8kHz + frame_length_8kHz );
energy_target = silk_inner_prod_aligned( target_ptr, target_ptr, sf_length_8kHz );
// ToDo: Calculate 1 / energy_target here and save one division inside next for loop
@@ -334,8 +334,8 @@
basis_ptr = target_ptr - d;
/* Check that we are within range of the array */
- SKP_assert( basis_ptr >= signal_8kHz );
- SKP_assert( basis_ptr + sf_length_8kHz <= signal_8kHz + frame_length_8kHz );
+ SKP_assert( basis_ptr >= frame_8kHz );
+ SKP_assert( basis_ptr + sf_length_8kHz <= frame_8kHz + frame_length_8kHz );
cross_corr = silk_inner_prod_aligned( target_ptr, basis_ptr, sf_length_8kHz );
energy_basis = silk_inner_prod_aligned( basis_ptr, basis_ptr, sf_length_8kHz );
@@ -458,16 +458,16 @@
** Scale input signal down to avoid correlations measures from overflowing
*******************************************************************************/
/* find scaling as max scaling for each subframe */
- shift = silk_P_Ana_find_scaling( signal, frame_length, sf_length );
+ shift = silk_P_Ana_find_scaling( frame, frame_length, sf_length );
if( shift > 0 ) {
/* Move signal to scratch mem because the input signal should be unchanged */
/* Reuse the 32 bit scratch mem vector, use a 16 bit pointer from now */
- input_signal_ptr = (opus_int16*)scratch_mem;
+ input_frame_ptr = (opus_int16*)scratch_mem;
for( i = 0; i < frame_length; i++ ) {
- input_signal_ptr[ i ] = SKP_RSHIFT( signal[ i ], shift );
+ input_frame_ptr[ i ] = SKP_RSHIFT( frame[ i ], shift );
}
} else {
- input_signal_ptr = (opus_int16*)signal;
+ input_frame_ptr = (opus_int16*)signal;
}
/*********************************************************************************/
@@ -498,8 +498,8 @@
pitch_out[ k ] = lag + 2 * silk_CB_lags_stage2[ k ][ CBimax_old ];
}
/* Calculate the correlations and energies needed in stage 3 */
- silk_P_Ana_calc_corr_st3( crosscorr_st3, input_signal_ptr, start_lag, sf_length, nb_subfr, complexity );
- silk_P_Ana_calc_energy_st3( energies_st3, input_signal_ptr, start_lag, sf_length, nb_subfr, complexity );
+ silk_P_Ana_calc_corr_st3( crosscorr_st3, input_frame_ptr, start_lag, sf_length, nb_subfr, complexity );
+ silk_P_Ana_calc_energy_st3( energies_st3, input_frame_ptr, start_lag, sf_length, nb_subfr, complexity );
lag_counter = 0;
SKP_assert( lag == SKP_SAT16( lag ) );
@@ -584,7 +584,7 @@
/*************************************************************************/
void silk_P_Ana_calc_corr_st3(
opus_int32 cross_corr_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM correlation array */
- const opus_int16 signal[], /* I vector to correlate */
+ const opus_int16 frame[], /* I vector to correlate */
opus_int start_lag, /* I lag offset to search around */
opus_int sf_length, /* I length of a 5 ms subframe */
opus_int nb_subfr, /* I number of subframes */
@@ -614,7 +614,7 @@
cbk_size = PE_NB_CBKS_STAGE3_10MS;
}
- target_ptr = &signal[ SKP_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */
+ target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ]; /* Pointer to middle of frame */
for( k = 0; k < nb_subfr; k++ ) {
lag_counter = 0;
@@ -650,7 +650,7 @@
/********************************************************************/
void silk_P_Ana_calc_energy_st3(
opus_int32 energies_st3[ PE_MAX_NB_SUBFR ][ PE_NB_CBKS_STAGE3_MAX ][ PE_NB_STAGE3_LAGS ],/* (O) 3 DIM energy array */
- const opus_int16 signal[], /* I vector to calc energy in */
+ const opus_int16 frame[], /* I vector to calc energy in */
opus_int start_lag, /* I lag offset to search around */
opus_int sf_length, /* I length of one 5 ms subframe */
opus_int nb_subfr, /* I number of subframes */
@@ -679,7 +679,7 @@
nb_cbk_search = PE_NB_CBKS_STAGE3_10MS;
cbk_size = PE_NB_CBKS_STAGE3_10MS;
}
- target_ptr = &signal[ SKP_LSHIFT( sf_length, 2 ) ];
+ target_ptr = &frame[ SKP_LSHIFT( sf_length, 2 ) ];
for( k = 0; k < nb_subfr; k++ ) {
lag_counter = 0;
@@ -721,14 +721,14 @@
}
opus_int32 silk_P_Ana_find_scaling(
- const opus_int16 *signal,
- const opus_int signal_length,
+ const opus_int16 *frame,
+ const opus_int frame_length,
const opus_int sum_sqr_len
)
{
opus_int32 nbits, x_max;
- x_max = silk_int16_array_maxabs( signal, signal_length );
+ x_max = silk_int16_array_maxabs( frame, frame_length );
if( x_max < SKP_int16_MAX ) {
/* Number of bits needed for the sum of the squares */