| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 shift = slope_part; | 162 shift = slope_part; |
| 163 silk_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(opus_
int16) ); | 163 silk_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(opus_
int16) ); |
| 164 shift += flat_part; | 164 shift += flat_part; |
| 165 silk_apply_sine_window( x_windowed + shift, x_ptr + shift, 2, slope_part
); | 165 silk_apply_sine_window( x_windowed + shift, x_ptr + shift, 2, slope_part
); |
| 166 | 166 |
| 167 /* Update pointer: next LPC analysis block */ | 167 /* Update pointer: next LPC analysis block */ |
| 168 x_ptr += psEnc->sCmn.subfr_length; | 168 x_ptr += psEnc->sCmn.subfr_length; |
| 169 | 169 |
| 170 if( psEnc->sCmn.warping_Q16 > 0 ) { | 170 if( psEnc->sCmn.warping_Q16 > 0 ) { |
| 171 /* Calculate warped auto correlation */ | 171 /* Calculate warped auto correlation */ |
| 172 silk_warped_autocorrelation_FIX( auto_corr, &scale, x_windowed, warp
ing_Q16, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder ); | 172 silk_warped_autocorrelation_FIX( auto_corr, &scale, x_windowed, warp
ing_Q16, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder, arch ); |
| 173 } else { | 173 } else { |
| 174 /* Calculate regular auto correlation */ | 174 /* Calculate regular auto correlation */ |
| 175 silk_autocorr( auto_corr, &scale, x_windowed, psEnc->sCmn.shapeWinLe
ngth, psEnc->sCmn.shapingLPCOrder + 1, arch ); | 175 silk_autocorr( auto_corr, &scale, x_windowed, psEnc->sCmn.shapeWinLe
ngth, psEnc->sCmn.shapingLPCOrder + 1, arch ); |
| 176 } | 176 } |
| 177 | 177 |
| 178 /* Add white noise, as a fraction of energy */ | 178 /* Add white noise, as a fraction of energy */ |
| 179 auto_corr[0] = silk_ADD32( auto_corr[0], silk_max_32( silk_SMULWB( silk_
RSHIFT( auto_corr[ 0 ], 4 ), | 179 auto_corr[0] = silk_ADD32( auto_corr[0], silk_max_32( silk_SMULWB( silk_
RSHIFT( auto_corr[ 0 ], 4 ), |
| 180 SILK_FIX_CONST( SHAPE_WHITE_NOISE_FRACTION, 20 ) ), 1 ) ); | 180 SILK_FIX_CONST( SHAPE_WHITE_NOISE_FRACTION, 20 ) ), 1 ) ); |
| 181 | 181 |
| 182 /* Calculate the reflection coefficients using schur */ | 182 /* Calculate the reflection coefficients using schur */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 silk_bwexpander_32( AR2_Q24, psEnc->sCmn.shapingLPCOrder, BWExp2_Q16 ); | 217 silk_bwexpander_32( AR2_Q24, psEnc->sCmn.shapingLPCOrder, BWExp2_Q16 ); |
| 218 | 218 |
| 219 /* Compute noise shaping filter coefficients */ | 219 /* Compute noise shaping filter coefficients */ |
| 220 silk_memcpy( AR1_Q24, AR2_Q24, psEnc->sCmn.shapingLPCOrder * sizeof( opu
s_int32 ) ); | 220 silk_memcpy( AR1_Q24, AR2_Q24, psEnc->sCmn.shapingLPCOrder * sizeof( opu
s_int32 ) ); |
| 221 | 221 |
| 222 /* Bandwidth expansion for analysis filter shaping */ | 222 /* Bandwidth expansion for analysis filter shaping */ |
| 223 silk_assert( BWExp1_Q16 <= SILK_FIX_CONST( 1.0, 16 ) ); | 223 silk_assert( BWExp1_Q16 <= SILK_FIX_CONST( 1.0, 16 ) ); |
| 224 silk_bwexpander_32( AR1_Q24, psEnc->sCmn.shapingLPCOrder, BWExp1_Q16 ); | 224 silk_bwexpander_32( AR1_Q24, psEnc->sCmn.shapingLPCOrder, BWExp1_Q16 ); |
| 225 | 225 |
| 226 /* Ratio of prediction gains, in energy domain */ | 226 /* Ratio of prediction gains, in energy domain */ |
| 227 pre_nrg_Q30 = silk_LPC_inverse_pred_gain_Q24( AR2_Q24, psEnc->sCmn.shapi
ngLPCOrder ); | 227 pre_nrg_Q30 = silk_LPC_inverse_pred_gain_Q24( AR2_Q24, psEnc->sCmn.shapi
ngLPCOrder, arch ); |
| 228 nrg = silk_LPC_inverse_pred_gain_Q24( AR1_Q24, psEnc->sCmn.shapi
ngLPCOrder ); | 228 nrg = silk_LPC_inverse_pred_gain_Q24( AR1_Q24, psEnc->sCmn.shapi
ngLPCOrder, arch ); |
| 229 | 229 |
| 230 /*psEncCtrl->GainsPre[ k ] = 1.0f - 0.7f * ( 1.0f - pre_nrg / nrg ) = 0.
3f + 0.7f * pre_nrg / nrg;*/ | 230 /*psEncCtrl->GainsPre[ k ] = 1.0f - 0.7f * ( 1.0f - pre_nrg / nrg ) = 0.
3f + 0.7f * pre_nrg / nrg;*/ |
| 231 pre_nrg_Q30 = silk_LSHIFT32( silk_SMULWB( pre_nrg_Q30, SILK_FIX_CONST( 0
.7, 15 ) ), 1 ); | 231 pre_nrg_Q30 = silk_LSHIFT32( silk_SMULWB( pre_nrg_Q30, SILK_FIX_CONST( 0
.7, 15 ) ), 1 ); |
| 232 psEncCtrl->GainsPre_Q14[ k ] = ( opus_int ) SILK_FIX_CONST( 0.3, 14 ) +
silk_DIV32_varQ( pre_nrg_Q30, nrg, 14 ); | 232 psEncCtrl->GainsPre_Q14[ k ] = ( opus_int ) SILK_FIX_CONST( 0.3, 14 ) +
silk_DIV32_varQ( pre_nrg_Q30, nrg, 14 ); |
| 233 | 233 |
| 234 /* Convert to monic warped prediction coefficients and limit absolute va
lues */ | 234 /* Convert to monic warped prediction coefficients and limit absolute va
lues */ |
| 235 limit_warped_coefs( AR2_Q24, AR1_Q24, warping_Q16, SILK_FIX_CONST( 3.999
, 24 ), psEnc->sCmn.shapingLPCOrder ); | 235 limit_warped_coefs( AR2_Q24, AR1_Q24, warping_Q16, SILK_FIX_CONST( 3.999
, 24 ), psEnc->sCmn.shapingLPCOrder ); |
| 236 | 236 |
| 237 /* Convert from Q24 to Q13 and store in int16 */ | 237 /* Convert from Q24 to Q13 and store in int16 */ |
| 238 for( i = 0; i < psEnc->sCmn.shapingLPCOrder; i++ ) { | 238 for( i = 0; i < psEnc->sCmn.shapingLPCOrder; i++ ) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 silk_SMLAWB( psShapeSt->HarmShapeGain_smth_Q16, HarmShapeGain_Q16 -
psShapeSt->HarmShapeGain_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) ); | 327 silk_SMLAWB( psShapeSt->HarmShapeGain_smth_Q16, HarmShapeGain_Q16 -
psShapeSt->HarmShapeGain_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) ); |
| 328 psShapeSt->Tilt_smth_Q16 = | 328 psShapeSt->Tilt_smth_Q16 = |
| 329 silk_SMLAWB( psShapeSt->Tilt_smth_Q16, Tilt_Q16 -
psShapeSt->Tilt_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) ); | 329 silk_SMLAWB( psShapeSt->Tilt_smth_Q16, Tilt_Q16 -
psShapeSt->Tilt_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) ); |
| 330 | 330 |
| 331 psEncCtrl->HarmBoost_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->HarmBoost_smth_Q16, 2 ); | 331 psEncCtrl->HarmBoost_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->HarmBoost_smth_Q16, 2 ); |
| 332 psEncCtrl->HarmShapeGain_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->HarmShapeGain_smth_Q16, 2 ); | 332 psEncCtrl->HarmShapeGain_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->HarmShapeGain_smth_Q16, 2 ); |
| 333 psEncCtrl->Tilt_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->Tilt_smth_Q16, 2 ); | 333 psEncCtrl->Tilt_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psSha
peSt->Tilt_smth_Q16, 2 ); |
| 334 } | 334 } |
| 335 RESTORE_STACK; | 335 RESTORE_STACK; |
| 336 } | 336 } |
| OLD | NEW |