| OLD | NEW |
| 1 /*********************************************************************** | 1 /*********************************************************************** |
| 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
| 4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
| 5 are met: | 5 are met: |
| 6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
| 7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
| 8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
| 9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
| 10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 opus_int sf_length, /* I length of one 5 ms s
ubframe */ | 73 opus_int sf_length, /* I length of one 5 ms s
ubframe */ |
| 74 opus_int nb_subfr, /* I number of subframes
*/ | 74 opus_int nb_subfr, /* I number of subframes
*/ |
| 75 opus_int complexity, /* I Complexity setting
*/ | 75 opus_int complexity, /* I Complexity setting
*/ |
| 76 int arch /* I Run-time architectur
e */ | 76 int arch /* I Run-time architectur
e */ |
| 77 ); | 77 ); |
| 78 | 78 |
| 79 /*************************************************************/ | 79 /*************************************************************/ |
| 80 /* FIXED POINT CORE PITCH ANALYSIS FUNCTION */ | 80 /* FIXED POINT CORE PITCH ANALYSIS FUNCTION */ |
| 81 /*************************************************************/ | 81 /*************************************************************/ |
| 82 opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0
voiced, 1 unvoiced */ | 82 opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0
voiced, 1 unvoiced */ |
| 83 const opus_int16 *frame, /* I Signal of length PE_
FRAME_LENGTH_MS*Fs_kHz */ | 83 const opus_int16 *frame_unscaled, /* I Signal of length PE_
FRAME_LENGTH_MS*Fs_kHz */ |
| 84 opus_int *pitch_out, /* O 4 pitch lag values
*/ | 84 opus_int *pitch_out, /* O 4 pitch lag values
*/ |
| 85 opus_int16 *lagIndex, /* O Lag Index
*/ | 85 opus_int16 *lagIndex, /* O Lag Index
*/ |
| 86 opus_int8 *contourIndex, /* O Pitch contour Index
*/ | 86 opus_int8 *contourIndex, /* O Pitch contour Index
*/ |
| 87 opus_int *LTPCorr_Q15, /* I/O Normalized correlati
on; input: value from previous frame */ | 87 opus_int *LTPCorr_Q15, /* I/O Normalized correlati
on; input: value from previous frame */ |
| 88 opus_int prevLag, /* I Last lag of previous
frame; set to zero is unvoiced */ | 88 opus_int prevLag, /* I Last lag of previous
frame; set to zero is unvoiced */ |
| 89 const opus_int32 search_thres1_Q16, /* I First stage threshol
d for lag candidates 0 - 1 */ | 89 const opus_int32 search_thres1_Q16, /* I First stage threshol
d for lag candidates 0 - 1 */ |
| 90 const opus_int search_thres2_Q13, /* I Final threshold for
lag candidates 0 - 1 */ | 90 const opus_int search_thres2_Q13, /* I Final threshold for
lag candidates 0 - 1 */ |
| 91 const opus_int Fs_kHz, /* I Sample frequency (kH
z) */ | 91 const opus_int Fs_kHz, /* I Sample frequency (kH
z) */ |
| 92 const opus_int complexity, /* I Complexity setting,
0-2, where 2 is highest */ | 92 const opus_int complexity, /* I Complexity setting,
0-2, where 2 is highest */ |
| 93 const opus_int nb_subfr, /* I number of 5 ms subfr
ames */ | 93 const opus_int nb_subfr, /* I number of 5 ms subfr
ames */ |
| 94 int arch /* I Run-time architectur
e */ | 94 int arch /* I Run-time architectur
e */ |
| 95 ) | 95 ) |
| 96 { | 96 { |
| 97 VARDECL( opus_int16, frame_8kHz ); | 97 VARDECL( opus_int16, frame_8kHz_buf ); |
| 98 VARDECL( opus_int16, frame_4kHz ); | 98 VARDECL( opus_int16, frame_4kHz ); |
| 99 VARDECL( opus_int16, frame_scaled ); |
| 99 opus_int32 filt_state[ 6 ]; | 100 opus_int32 filt_state[ 6 ]; |
| 100 const opus_int16 *input_frame_ptr; | 101 const opus_int16 *frame, *frame_8kHz; |
| 101 opus_int i, k, d, j; | 102 opus_int i, k, d, j; |
| 102 VARDECL( opus_int16, C ); | 103 VARDECL( opus_int16, C ); |
| 103 VARDECL( opus_int32, xcorr32 ); | 104 VARDECL( opus_int32, xcorr32 ); |
| 104 const opus_int16 *target_ptr, *basis_ptr; | 105 const opus_int16 *target_ptr, *basis_ptr; |
| 105 opus_int32 cross_corr, normalizer, energy, shift, energy_basis, energy_targe
t; | 106 opus_int32 cross_corr, normalizer, energy, energy_basis, energy_target; |
| 106 opus_int d_srch[ PE_D_SRCH_LENGTH ], Cmax, length_d_srch, length_d_comp; | 107 opus_int d_srch[ PE_D_SRCH_LENGTH ], Cmax, length_d_srch, length_d_comp, s
hift; |
| 107 VARDECL( opus_int16, d_comp ); | 108 VARDECL( opus_int16, d_comp ); |
| 108 opus_int32 sum, threshold, lag_counter; | 109 opus_int32 sum, threshold, lag_counter; |
| 109 opus_int CBimax, CBimax_new, CBimax_old, lag, start_lag, end_lag, lag_new; | 110 opus_int CBimax, CBimax_new, CBimax_old, lag, start_lag, end_lag, lag_new; |
| 110 opus_int32 CC[ PE_NB_CBKS_STAGE2_EXT ], CCmax, CCmax_b, CCmax_new_b, CCmax_n
ew; | 111 opus_int32 CC[ PE_NB_CBKS_STAGE2_EXT ], CCmax, CCmax_b, CCmax_new_b, CCmax_n
ew; |
| 111 VARDECL( silk_pe_stage3_vals, energies_st3 ); | 112 VARDECL( silk_pe_stage3_vals, energies_st3 ); |
| 112 VARDECL( silk_pe_stage3_vals, cross_corr_st3 ); | 113 VARDECL( silk_pe_stage3_vals, cross_corr_st3 ); |
| 113 opus_int frame_length, frame_length_8kHz, frame_length_4kHz; | 114 opus_int frame_length, frame_length_8kHz, frame_length_4kHz; |
| 114 opus_int sf_length; | 115 opus_int sf_length; |
| 115 opus_int min_lag; | 116 opus_int min_lag; |
| 116 opus_int max_lag; | 117 opus_int max_lag; |
| 117 opus_int32 contour_bias_Q15, diff; | 118 opus_int32 contour_bias_Q15, diff; |
| 118 opus_int nb_cbk_search, cbk_size; | 119 opus_int nb_cbk_search, cbk_size; |
| 119 opus_int32 delta_lag_log2_sqr_Q7, lag_log2_Q7, prevLag_log2_Q7, prev_lag_bia
s_Q13; | 120 opus_int32 delta_lag_log2_sqr_Q7, lag_log2_Q7, prevLag_log2_Q7, prev_lag_bia
s_Q13; |
| 120 const opus_int8 *Lag_CB_ptr; | 121 const opus_int8 *Lag_CB_ptr; |
| 121 SAVE_STACK; | 122 SAVE_STACK; |
| 123 |
| 122 /* Check for valid sampling frequency */ | 124 /* Check for valid sampling frequency */ |
| 123 silk_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); | 125 silk_assert( Fs_kHz == 8 || Fs_kHz == 12 || Fs_kHz == 16 ); |
| 124 | 126 |
| 125 /* Check for valid complexity setting */ | 127 /* Check for valid complexity setting */ |
| 126 silk_assert( complexity >= SILK_PE_MIN_COMPLEX ); | 128 silk_assert( complexity >= SILK_PE_MIN_COMPLEX ); |
| 127 silk_assert( complexity <= SILK_PE_MAX_COMPLEX ); | 129 silk_assert( complexity <= SILK_PE_MAX_COMPLEX ); |
| 128 | 130 |
| 129 silk_assert( search_thres1_Q16 >= 0 && search_thres1_Q16 <= (1<<16) ); | 131 silk_assert( search_thres1_Q16 >= 0 && search_thres1_Q16 <= (1<<16) ); |
| 130 silk_assert( search_thres2_Q13 >= 0 && search_thres2_Q13 <= (1<<13) ); | 132 silk_assert( search_thres2_Q13 >= 0 && search_thres2_Q13 <= (1<<13) ); |
| 131 | 133 |
| 132 /* Set up frame lengths max / min lag for the sampling frequency */ | 134 /* Set up frame lengths max / min lag for the sampling frequency */ |
| 133 frame_length = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* Fs_kHz; | 135 frame_length = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* Fs_kHz; |
| 134 frame_length_4kHz = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* 4; | 136 frame_length_4kHz = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* 4; |
| 135 frame_length_8kHz = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* 8; | 137 frame_length_8kHz = ( PE_LTP_MEM_LENGTH_MS + nb_subfr * PE_SUBFR_LENGTH_MS )
* 8; |
| 136 sf_length = PE_SUBFR_LENGTH_MS * Fs_kHz; | 138 sf_length = PE_SUBFR_LENGTH_MS * Fs_kHz; |
| 137 min_lag = PE_MIN_LAG_MS * Fs_kHz; | 139 min_lag = PE_MIN_LAG_MS * Fs_kHz; |
| 138 max_lag = PE_MAX_LAG_MS * Fs_kHz - 1; | 140 max_lag = PE_MAX_LAG_MS * Fs_kHz - 1; |
| 139 | 141 |
| 142 /* Downscale input if necessary */ |
| 143 silk_sum_sqr_shift( &energy, &shift, frame_unscaled, frame_length ); |
| 144 shift += 3 - silk_CLZ32( energy ); /* at least two bits headroom */ |
| 145 ALLOC( frame_scaled, frame_length, opus_int16 ); |
| 146 if( shift > 0 ) { |
| 147 shift = silk_RSHIFT( shift + 1, 1 ); |
| 148 for( i = 0; i < frame_length; i++ ) { |
| 149 frame_scaled[ i ] = silk_RSHIFT( frame_unscaled[ i ], shift ); |
| 150 } |
| 151 frame = frame_scaled; |
| 152 } else { |
| 153 frame = frame_unscaled; |
| 154 } |
| 155 |
| 156 ALLOC( frame_8kHz_buf, ( Fs_kHz == 8 ) ? 1 : frame_length_8kHz, opus_int16 )
; |
| 140 /* Resample from input sampled at Fs_kHz to 8 kHz */ | 157 /* Resample from input sampled at Fs_kHz to 8 kHz */ |
| 141 ALLOC( frame_8kHz, frame_length_8kHz, opus_int16 ); | |
| 142 if( Fs_kHz == 16 ) { | 158 if( Fs_kHz == 16 ) { |
| 143 silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); | 159 silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) ); |
| 144 silk_resampler_down2( filt_state, frame_8kHz, frame, frame_length ); | 160 silk_resampler_down2( filt_state, frame_8kHz_buf, frame, frame_length ); |
| 161 frame_8kHz = frame_8kHz_buf; |
| 145 } else if( Fs_kHz == 12 ) { | 162 } else if( Fs_kHz == 12 ) { |
| 146 silk_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); | 163 silk_memset( filt_state, 0, 6 * sizeof( opus_int32 ) ); |
| 147 silk_resampler_down2_3( filt_state, frame_8kHz, frame, frame_length ); | 164 silk_resampler_down2_3( filt_state, frame_8kHz_buf, frame, frame_length
); |
| 165 frame_8kHz = frame_8kHz_buf; |
| 148 } else { | 166 } else { |
| 149 silk_assert( Fs_kHz == 8 ); | 167 silk_assert( Fs_kHz == 8 ); |
| 150 silk_memcpy( frame_8kHz, frame, frame_length_8kHz * sizeof(opus_int16) )
; | 168 frame_8kHz = frame; |
| 151 } | 169 } |
| 152 | 170 |
| 153 /* Decimate again to 4 kHz */ | 171 /* Decimate again to 4 kHz */ |
| 154 silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );/* Set state to zero
*/ | 172 silk_memset( filt_state, 0, 2 * sizeof( opus_int32 ) );/* Set state to zero
*/ |
| 155 ALLOC( frame_4kHz, frame_length_4kHz, opus_int16 ); | 173 ALLOC( frame_4kHz, frame_length_4kHz, opus_int16 ); |
| 156 silk_resampler_down2( filt_state, frame_4kHz, frame_8kHz, frame_length_8kHz
); | 174 silk_resampler_down2( filt_state, frame_4kHz, frame_8kHz, frame_length_8kHz
); |
| 157 | 175 |
| 158 /* Low-pass filter */ | 176 /* Low-pass filter */ |
| 159 for( i = frame_length_4kHz - 1; i > 0; i-- ) { | 177 for( i = frame_length_4kHz - 1; i > 0; i-- ) { |
| 160 frame_4kHz[ i ] = silk_ADD_SAT16( frame_4kHz[ i ], frame_4kHz[ i - 1 ] )
; | 178 frame_4kHz[ i ] = silk_ADD_SAT16( frame_4kHz[ i ], frame_4kHz[ i - 1 ] )
; |
| 161 } | 179 } |
| 162 | 180 |
| 163 /***************************************************************************
**** | |
| 164 ** Scale 4 kHz signal down to prevent correlations measures from overflowing | |
| 165 ** find scaling as max scaling for each 8kHz(?) subframe | |
| 166 ****************************************************************************
***/ | |
| 167 | |
| 168 /* Inner product is calculated with different lengths, so scale for the wors
t case */ | |
| 169 silk_sum_sqr_shift( &energy, &shift, frame_4kHz, frame_length_4kHz ); | |
| 170 if( shift > 0 ) { | |
| 171 shift = silk_RSHIFT( shift, 1 ); | |
| 172 for( i = 0; i < frame_length_4kHz; i++ ) { | |
| 173 frame_4kHz[ i ] = silk_RSHIFT( frame_4kHz[ i ], shift ); | |
| 174 } | |
| 175 } | |
| 176 | 181 |
| 177 /***************************************************************************
*** | 182 /***************************************************************************
*** |
| 178 * FIRST STAGE, operating in 4 khz | 183 * FIRST STAGE, operating in 4 khz |
| 179 ****************************************************************************
**/ | 184 ****************************************************************************
**/ |
| 180 ALLOC( C, nb_subfr * CSTRIDE_8KHZ, opus_int16 ); | 185 ALLOC( C, nb_subfr * CSTRIDE_8KHZ, opus_int16 ); |
| 181 ALLOC( xcorr32, MAX_LAG_4KHZ-MIN_LAG_4KHZ+1, opus_int32 ); | 186 ALLOC( xcorr32, MAX_LAG_4KHZ-MIN_LAG_4KHZ+1, opus_int32 ); |
| 182 silk_memset( C, 0, (nb_subfr >> 1) * CSTRIDE_4KHZ * sizeof( opus_int16 ) ); | 187 silk_memset( C, 0, (nb_subfr >> 1) * CSTRIDE_4KHZ * sizeof( opus_int16 ) ); |
| 183 target_ptr = &frame_4kHz[ silk_LSHIFT( SF_LENGTH_4KHZ, 2 ) ]; | 188 target_ptr = &frame_4kHz[ silk_LSHIFT( SF_LENGTH_4KHZ, 2 ) ]; |
| 184 for( k = 0; k < nb_subfr >> 1; k++ ) { | 189 for( k = 0; k < nb_subfr >> 1; k++ ) { |
| 185 /* Check that we are within range of the array */ | 190 /* Check that we are within range of the array */ |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 if( d_comp[ i - D_COMP_MIN ] > 0 ) { | 309 if( d_comp[ i - D_COMP_MIN ] > 0 ) { |
| 305 d_comp[ length_d_comp ] = i - 2; | 310 d_comp[ length_d_comp ] = i - 2; |
| 306 length_d_comp++; | 311 length_d_comp++; |
| 307 } | 312 } |
| 308 } | 313 } |
| 309 | 314 |
| 310 /***************************************************************************
******* | 315 /***************************************************************************
******* |
| 311 ** SECOND STAGE, operating at 8 kHz, on lag sections with high correlation | 316 ** SECOND STAGE, operating at 8 kHz, on lag sections with high correlation |
| 312 ****************************************************************************
*********/ | 317 ****************************************************************************
*********/ |
| 313 | 318 |
| 314 /***************************************************************************
*** | |
| 315 ** Scale signal down to avoid correlations measures from overflowing | |
| 316 ****************************************************************************
***/ | |
| 317 /* find scaling as max scaling for each subframe */ | |
| 318 silk_sum_sqr_shift( &energy, &shift, frame_8kHz, frame_length_8kHz ); | |
| 319 if( shift > 0 ) { | |
| 320 shift = silk_RSHIFT( shift, 1 ); | |
| 321 for( i = 0; i < frame_length_8kHz; i++ ) { | |
| 322 frame_8kHz[ i ] = silk_RSHIFT( frame_8kHz[ i ], shift ); | |
| 323 } | |
| 324 } | |
| 325 | |
| 326 /***************************************************************************
****** | 319 /***************************************************************************
****** |
| 327 * Find energy of each subframe projected onto its history, for a range of de
lays | 320 * Find energy of each subframe projected onto its history, for a range of de
lays |
| 328 ****************************************************************************
*****/ | 321 ****************************************************************************
*****/ |
| 329 silk_memset( C, 0, nb_subfr * CSTRIDE_8KHZ * sizeof( opus_int16 ) ); | 322 silk_memset( C, 0, nb_subfr * CSTRIDE_8KHZ * sizeof( opus_int16 ) ); |
| 330 | 323 |
| 331 target_ptr = &frame_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ]; | 324 target_ptr = &frame_8kHz[ PE_LTP_MEM_LENGTH_MS * 8 ]; |
| 332 for( k = 0; k < nb_subfr; k++ ) { | 325 for( k = 0; k < nb_subfr; k++ ) { |
| 333 | 326 |
| 334 /* Check that we are within range of the array */ | 327 /* Check that we are within range of the array */ |
| 335 silk_assert( target_ptr >= frame_8kHz ); | 328 silk_assert( target_ptr >= frame_8kHz ); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 *contourIndex = 0; | 448 *contourIndex = 0; |
| 456 RESTORE_STACK; | 449 RESTORE_STACK; |
| 457 return 1; | 450 return 1; |
| 458 } | 451 } |
| 459 | 452 |
| 460 /* Output normalized correlation */ | 453 /* Output normalized correlation */ |
| 461 *LTPCorr_Q15 = (opus_int)silk_LSHIFT( silk_DIV32_16( CCmax, nb_subfr ), 2 ); | 454 *LTPCorr_Q15 = (opus_int)silk_LSHIFT( silk_DIV32_16( CCmax, nb_subfr ), 2 ); |
| 462 silk_assert( *LTPCorr_Q15 >= 0 ); | 455 silk_assert( *LTPCorr_Q15 >= 0 ); |
| 463 | 456 |
| 464 if( Fs_kHz > 8 ) { | 457 if( Fs_kHz > 8 ) { |
| 465 VARDECL( opus_int16, scratch_mem ); | |
| 466 /***********************************************************************
****/ | |
| 467 /* Scale input signal down to avoid correlations measures from overflowi
ng */ | |
| 468 /***********************************************************************
****/ | |
| 469 /* find scaling as max scaling for each subframe */ | |
| 470 silk_sum_sqr_shift( &energy, &shift, frame, frame_length ); | |
| 471 ALLOC( scratch_mem, shift > 0 ? frame_length : ALLOC_NONE, opus_int16 ); | |
| 472 if( shift > 0 ) { | |
| 473 /* Move signal to scratch mem because the input signal should be unc
hanged */ | |
| 474 shift = silk_RSHIFT( shift, 1 ); | |
| 475 for( i = 0; i < frame_length; i++ ) { | |
| 476 scratch_mem[ i ] = silk_RSHIFT( frame[ i ], shift ); | |
| 477 } | |
| 478 input_frame_ptr = scratch_mem; | |
| 479 } else { | |
| 480 input_frame_ptr = frame; | |
| 481 } | |
| 482 | |
| 483 /* Search in original signal */ | 458 /* Search in original signal */ |
| 484 | 459 |
| 485 CBimax_old = CBimax; | 460 CBimax_old = CBimax; |
| 486 /* Compensate for decimation */ | 461 /* Compensate for decimation */ |
| 487 silk_assert( lag == silk_SAT16( lag ) ); | 462 silk_assert( lag == silk_SAT16( lag ) ); |
| 488 if( Fs_kHz == 12 ) { | 463 if( Fs_kHz == 12 ) { |
| 489 lag = silk_RSHIFT( silk_SMULBB( lag, 3 ), 1 ); | 464 lag = silk_RSHIFT( silk_SMULBB( lag, 3 ), 1 ); |
| 490 } else if( Fs_kHz == 16 ) { | 465 } else if( Fs_kHz == 16 ) { |
| 491 lag = silk_LSHIFT( lag, 1 ); | 466 lag = silk_LSHIFT( lag, 1 ); |
| 492 } else { | 467 } else { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 512 Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ]; | 487 Lag_CB_ptr = &silk_CB_lags_stage3[ 0 ][ 0 ]; |
| 513 } else { | 488 } else { |
| 514 nb_cbk_search = PE_NB_CBKS_STAGE3_10MS; | 489 nb_cbk_search = PE_NB_CBKS_STAGE3_10MS; |
| 515 cbk_size = PE_NB_CBKS_STAGE3_10MS; | 490 cbk_size = PE_NB_CBKS_STAGE3_10MS; |
| 516 Lag_CB_ptr = &silk_CB_lags_stage3_10_ms[ 0 ][ 0 ]; | 491 Lag_CB_ptr = &silk_CB_lags_stage3_10_ms[ 0 ][ 0 ]; |
| 517 } | 492 } |
| 518 | 493 |
| 519 /* Calculate the correlations and energies needed in stage 3 */ | 494 /* Calculate the correlations and energies needed in stage 3 */ |
| 520 ALLOC( energies_st3, nb_subfr * nb_cbk_search, silk_pe_stage3_vals ); | 495 ALLOC( energies_st3, nb_subfr * nb_cbk_search, silk_pe_stage3_vals ); |
| 521 ALLOC( cross_corr_st3, nb_subfr * nb_cbk_search, silk_pe_stage3_vals ); | 496 ALLOC( cross_corr_st3, nb_subfr * nb_cbk_search, silk_pe_stage3_vals ); |
| 522 silk_P_Ana_calc_corr_st3( cross_corr_st3, input_frame_ptr, start_lag, s
f_length, nb_subfr, complexity, arch ); | 497 silk_P_Ana_calc_corr_st3( cross_corr_st3, frame, start_lag, sf_length,
nb_subfr, complexity, arch ); |
| 523 silk_P_Ana_calc_energy_st3( energies_st3, input_frame_ptr, start_lag, sf
_length, nb_subfr, complexity, arch ); | 498 silk_P_Ana_calc_energy_st3( energies_st3, frame, start_lag, sf_length, n
b_subfr, complexity, arch ); |
| 524 | 499 |
| 525 lag_counter = 0; | 500 lag_counter = 0; |
| 526 silk_assert( lag == silk_SAT16( lag ) ); | 501 silk_assert( lag == silk_SAT16( lag ) ); |
| 527 contour_bias_Q15 = silk_DIV32_16( SILK_FIX_CONST( PE_FLATCONTOUR_BIAS, 1
5 ), lag ); | 502 contour_bias_Q15 = silk_DIV32_16( SILK_FIX_CONST( PE_FLATCONTOUR_BIAS, 1
5 ), lag ); |
| 528 | 503 |
| 529 target_ptr = &input_frame_ptr[ PE_LTP_MEM_LENGTH_MS * Fs_kHz ]; | 504 target_ptr = &frame[ PE_LTP_MEM_LENGTH_MS * Fs_kHz ]; |
| 530 energy_target = silk_ADD32( silk_inner_prod_aligned( target_ptr, target_
ptr, nb_subfr * sf_length, arch ), 1 ); | 505 energy_target = silk_ADD32( silk_inner_prod_aligned( target_ptr, target_
ptr, nb_subfr * sf_length, arch ), 1 ); |
| 531 for( d = start_lag; d <= end_lag; d++ ) { | 506 for( d = start_lag; d <= end_lag; d++ ) { |
| 532 for( j = 0; j < nb_cbk_search; j++ ) { | 507 for( j = 0; j < nb_cbk_search; j++ ) { |
| 533 cross_corr = 0; | 508 cross_corr = 0; |
| 534 energy = energy_target; | 509 energy = energy_target; |
| 535 for( k = 0; k < nb_subfr; k++ ) { | 510 for( k = 0; k < nb_subfr; k++ ) { |
| 536 cross_corr = silk_ADD32( cross_corr, | 511 cross_corr = silk_ADD32( cross_corr, |
| 537 matrix_ptr( cross_corr_st3, k, j, | 512 matrix_ptr( cross_corr_st3, k, j, |
| 538 nb_cbk_search )[ lag_counter ] ); | 513 nb_cbk_search )[ lag_counter ] ); |
| 539 energy = silk_ADD32( energy, | 514 energy = silk_ADD32( energy, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 matrix_ptr( energies_st3, k, i, nb_cbk_search )[ j ] = | 712 matrix_ptr( energies_st3, k, i, nb_cbk_search )[ j ] = |
| 738 scratch_mem[ idx + j ]; | 713 scratch_mem[ idx + j ]; |
| 739 silk_assert( | 714 silk_assert( |
| 740 matrix_ptr( energies_st3, k, i, nb_cbk_search )[ j ] >= 0 ); | 715 matrix_ptr( energies_st3, k, i, nb_cbk_search )[ j ] >= 0 ); |
| 741 } | 716 } |
| 742 } | 717 } |
| 743 target_ptr += sf_length; | 718 target_ptr += sf_length; |
| 744 } | 719 } |
| 745 RESTORE_STACK; | 720 RESTORE_STACK; |
| 746 } | 721 } |
| OLD | NEW |