| 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 15 matching lines...) Expand all Loading... |
| 26 ***********************************************************************/ | 26 ***********************************************************************/ |
| 27 | 27 |
| 28 #ifdef HAVE_CONFIG_H | 28 #ifdef HAVE_CONFIG_H |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #include "main_FIX.h" | 32 #include "main_FIX.h" |
| 33 #include "stack_alloc.h" | 33 #include "stack_alloc.h" |
| 34 #include "tuning_parameters.h" | 34 #include "tuning_parameters.h" |
| 35 | 35 |
| 36 #if defined(MIPSr1_ASM) |
| 37 #include "mips/prefilter_FIX_mipsr1.h" |
| 38 #endif |
| 39 |
| 40 |
| 36 /* Prefilter for finding Quantizer input signal */ | 41 /* Prefilter for finding Quantizer input signal */ |
| 37 static OPUS_INLINE void silk_prefilt_FIX( | 42 static OPUS_INLINE void silk_prefilt_FIX( |
| 38 silk_prefilter_state_FIX *P, /* I/O state
*/ | 43 silk_prefilter_state_FIX *P, /* I/O state
*/ |
| 39 opus_int32 st_res_Q12[], /* I short term r
esidual signal */ | 44 opus_int32 st_res_Q12[], /* I short term r
esidual signal */ |
| 40 opus_int32 xw_Q3[], /* O prefiltered
signal */ | 45 opus_int32 xw_Q3[], /* O prefiltered
signal */ |
| 41 opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic sha
ping coeficients */ | 46 opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic sha
ping coeficients */ |
| 42 opus_int Tilt_Q14, /* I Tilt shaping
coeficient */ | 47 opus_int Tilt_Q14, /* I Tilt shaping
coeficient */ |
| 43 opus_int32 LF_shp_Q14, /* I Low-frequanc
y shaping coeficients */ | 48 opus_int32 LF_shp_Q14, /* I Low-frequanc
y shaping coeficients */ |
| 44 opus_int lag, /* I Lag for harm
onic shaping */ | 49 opus_int lag, /* I Lag for harm
onic shaping */ |
| 45 opus_int length /* I Length of si
gnals */ | 50 opus_int length /* I Length of si
gnals */ |
| 46 ); | 51 ); |
| 47 | 52 |
| 48 void silk_warped_LPC_analysis_filter_FIX( | 53 void silk_warped_LPC_analysis_filter_FIX_c( |
| 49 opus_int32 state[], /* I/O State [order
+ 1] */ | 54 opus_int32 state[], /* I/O State [order
+ 1] */ |
| 50 opus_int32 res_Q2[], /* O Residual sig
nal [length] */ | 55 opus_int32 res_Q2[], /* O Residual sig
nal [length] */ |
| 51 const opus_int16 coef_Q13[], /* I Coefficients
[order] */ | 56 const opus_int16 coef_Q13[], /* I Coefficients
[order] */ |
| 52 const opus_int16 input[], /* I Input signal
[length] */ | 57 const opus_int16 input[], /* I Input signal
[length] */ |
| 53 const opus_int16 lambda_Q16, /* I Warping fact
or */ | 58 const opus_int16 lambda_Q16, /* I Warping fact
or */ |
| 54 const opus_int length, /* I Length of in
put signal */ | 59 const opus_int length, /* I Length of in
put signal */ |
| 55 const opus_int order /* I Filter order
(even) */ | 60 const opus_int order /* I Filter order
(even) */ |
| 56 ) | 61 ) |
| 57 { | 62 { |
| 58 opus_int n, i; | 63 opus_int n, i; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 HarmShapeGain_Q12 = silk_SMULWB( (opus_int32)psEncCtrl->HarmShapeGain_Q1
4[ k ], 16384 - psEncCtrl->HarmBoost_Q14[ k ] ); | 128 HarmShapeGain_Q12 = silk_SMULWB( (opus_int32)psEncCtrl->HarmShapeGain_Q1
4[ k ], 16384 - psEncCtrl->HarmBoost_Q14[ k ] ); |
| 124 silk_assert( HarmShapeGain_Q12 >= 0 ); | 129 silk_assert( HarmShapeGain_Q12 >= 0 ); |
| 125 HarmShapeFIRPacked_Q12 = silk_RSHIFT( HarmShap
eGain_Q12, 2 ); | 130 HarmShapeFIRPacked_Q12 = silk_RSHIFT( HarmShap
eGain_Q12, 2 ); |
| 126 HarmShapeFIRPacked_Q12 |= silk_LSHIFT( (opus_int32)silk_RSHIFT( HarmShap
eGain_Q12, 1 ), 16 ); | 131 HarmShapeFIRPacked_Q12 |= silk_LSHIFT( (opus_int32)silk_RSHIFT( HarmShap
eGain_Q12, 1 ), 16 ); |
| 127 Tilt_Q14 = psEncCtrl->Tilt_Q14[ k ]; | 132 Tilt_Q14 = psEncCtrl->Tilt_Q14[ k ]; |
| 128 LF_shp_Q14 = psEncCtrl->LF_shp_Q14[ k ]; | 133 LF_shp_Q14 = psEncCtrl->LF_shp_Q14[ k ]; |
| 129 AR1_shp_Q13 = &psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER ]; | 134 AR1_shp_Q13 = &psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER ]; |
| 130 | 135 |
| 131 /* Short term FIR filtering*/ | 136 /* Short term FIR filtering*/ |
| 132 silk_warped_LPC_analysis_filter_FIX( P->sAR_shp, st_res_Q2, AR1_shp_Q13,
px, | 137 silk_warped_LPC_analysis_filter_FIX( P->sAR_shp, st_res_Q2, AR1_shp_Q13,
px, |
| 133 psEnc->sCmn.warping_Q16, psEnc->sCmn.subfr_length, psEnc->sCmn.shapi
ngLPCOrder ); | 138 psEnc->sCmn.warping_Q16, psEnc->sCmn.subfr_length, psEnc->sCmn.shapi
ngLPCOrder, psEnc->sCmn.arch ); |
| 134 | 139 |
| 135 /* Reduce (mainly) low frequencies during harmonic emphasis */ | 140 /* Reduce (mainly) low frequencies during harmonic emphasis */ |
| 136 B_Q10[ 0 ] = silk_RSHIFT_ROUND( psEncCtrl->GainsPre_Q14[ k ], 4 ); | 141 B_Q10[ 0 ] = silk_RSHIFT_ROUND( psEncCtrl->GainsPre_Q14[ k ], 4 ); |
| 137 tmp_32 = silk_SMLABB( SILK_FIX_CONST( INPUT_TILT, 26 ), psEncCtrl->HarmB
oost_Q14[ k ], HarmShapeGain_Q12 ); /* Q26 */ | 142 tmp_32 = silk_SMLABB( SILK_FIX_CONST( INPUT_TILT, 26 ), psEncCtrl->HarmB
oost_Q14[ k ], HarmShapeGain_Q12 ); /* Q26 */ |
| 138 tmp_32 = silk_SMLABB( tmp_32, psEncCtrl->coding_quality_Q14, SILK_FIX_CO
NST( HIGH_RATE_INPUT_TILT, 12 ) ); /* Q26 */ | 143 tmp_32 = silk_SMLABB( tmp_32, psEncCtrl->coding_quality_Q14, SILK_FIX_CO
NST( HIGH_RATE_INPUT_TILT, 12 ) ); /* Q26 */ |
| 139 tmp_32 = silk_SMULWB( tmp_32, -psEncCtrl->GainsPre_Q14[ k ] );
/* Q24 */ | 144 tmp_32 = silk_SMULWB( tmp_32, -psEncCtrl->GainsPre_Q14[ k ] );
/* Q24 */ |
| 140 tmp_32 = silk_RSHIFT_ROUND( tmp_32, 14 );
/* Q10 */ | 145 tmp_32 = silk_RSHIFT_ROUND( tmp_32, 14 );
/* Q10 */ |
| 141 B_Q10[ 1 ]= silk_SAT16( tmp_32 ); | 146 B_Q10[ 1 ]= silk_SAT16( tmp_32 ); |
| 142 x_filt_Q12[ 0 ] = silk_MLA( silk_MUL( st_res_Q2[ 0 ], B_Q10[ 0 ] ), P->s
HarmHP_Q2, B_Q10[ 1 ] ); | 147 x_filt_Q12[ 0 ] = silk_MLA( silk_MUL( st_res_Q2[ 0 ], B_Q10[ 0 ] ), P->s
HarmHP_Q2, B_Q10[ 1 ] ); |
| 143 for( j = 1; j < psEnc->sCmn.subfr_length; j++ ) { | 148 for( j = 1; j < psEnc->sCmn.subfr_length; j++ ) { |
| 144 x_filt_Q12[ j ] = silk_MLA( silk_MUL( st_res_Q2[ j ], B_Q10[ 0 ] ),
st_res_Q2[ j - 1 ], B_Q10[ 1 ] ); | 149 x_filt_Q12[ j ] = silk_MLA( silk_MUL( st_res_Q2[ j ], B_Q10[ 0 ] ),
st_res_Q2[ j - 1 ], B_Q10[ 1 ] ); |
| 145 } | 150 } |
| 146 P->sHarmHP_Q2 = st_res_Q2[ psEnc->sCmn.subfr_length - 1 ]; | 151 P->sHarmHP_Q2 = st_res_Q2[ psEnc->sCmn.subfr_length - 1 ]; |
| 147 | 152 |
| 148 silk_prefilt_FIX( P, x_filt_Q12, pxw_Q3, HarmShapeFIRPacked_Q12, Tilt_Q1
4, LF_shp_Q14, lag, psEnc->sCmn.subfr_length ); | 153 silk_prefilt_FIX( P, x_filt_Q12, pxw_Q3, HarmShapeFIRPacked_Q12, Tilt_Q1
4, LF_shp_Q14, lag, psEnc->sCmn.subfr_length ); |
| 149 | 154 |
| 150 px += psEnc->sCmn.subfr_length; | 155 px += psEnc->sCmn.subfr_length; |
| 151 pxw_Q3 += psEnc->sCmn.subfr_length; | 156 pxw_Q3 += psEnc->sCmn.subfr_length; |
| 152 } | 157 } |
| 153 | 158 |
| 154 P->lagPrev = psEncCtrl->pitchL[ psEnc->sCmn.nb_subfr - 1 ]; | 159 P->lagPrev = psEncCtrl->pitchL[ psEnc->sCmn.nb_subfr - 1 ]; |
| 155 RESTORE_STACK; | 160 RESTORE_STACK; |
| 156 } | 161 } |
| 157 | 162 |
| 163 #ifndef OVERRIDE_silk_prefilt_FIX |
| 158 /* Prefilter for finding Quantizer input signal */ | 164 /* Prefilter for finding Quantizer input signal */ |
| 159 static OPUS_INLINE void silk_prefilt_FIX( | 165 static OPUS_INLINE void silk_prefilt_FIX( |
| 160 silk_prefilter_state_FIX *P, /* I/O state
*/ | 166 silk_prefilter_state_FIX *P, /* I/O state
*/ |
| 161 opus_int32 st_res_Q12[], /* I short term r
esidual signal */ | 167 opus_int32 st_res_Q12[], /* I short term r
esidual signal */ |
| 162 opus_int32 xw_Q3[], /* O prefiltered
signal */ | 168 opus_int32 xw_Q3[], /* O prefiltered
signal */ |
| 163 opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic sha
ping coeficients */ | 169 opus_int32 HarmShapeFIRPacked_Q12, /* I Harmonic sha
ping coeficients */ |
| 164 opus_int Tilt_Q14, /* I Tilt shaping
coeficient */ | 170 opus_int Tilt_Q14, /* I Tilt shaping
coeficient */ |
| 165 opus_int32 LF_shp_Q14, /* I Low-frequanc
y shaping coeficients */ | 171 opus_int32 LF_shp_Q14, /* I Low-frequanc
y shaping coeficients */ |
| 166 opus_int lag, /* I Lag for harm
onic shaping */ | 172 opus_int lag, /* I Lag for harm
onic shaping */ |
| 167 opus_int length /* I Length of si
gnals */ | 173 opus_int length /* I Length of si
gnals */ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 LTP_shp_buf[ LTP_shp_buf_idx ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROU
ND( sLF_MA_shp_Q12, 12 ) ); | 206 LTP_shp_buf[ LTP_shp_buf_idx ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROU
ND( sLF_MA_shp_Q12, 12 ) ); |
| 201 | 207 |
| 202 xw_Q3[i] = silk_RSHIFT_ROUND( silk_SUB32( sLF_MA_shp_Q12, n_LTP_Q12 ), 9
); | 208 xw_Q3[i] = silk_RSHIFT_ROUND( silk_SUB32( sLF_MA_shp_Q12, n_LTP_Q12 ), 9
); |
| 203 } | 209 } |
| 204 | 210 |
| 205 /* Copy temp variable back to state */ | 211 /* Copy temp variable back to state */ |
| 206 P->sLF_AR_shp_Q12 = sLF_AR_shp_Q12; | 212 P->sLF_AR_shp_Q12 = sLF_AR_shp_Q12; |
| 207 P->sLF_MA_shp_Q12 = sLF_MA_shp_Q12; | 213 P->sLF_MA_shp_Q12 = sLF_MA_shp_Q12; |
| 208 P->sLTP_shp_buf_idx = LTP_shp_buf_idx; | 214 P->sLTP_shp_buf_idx = LTP_shp_buf_idx; |
| 209 } | 215 } |
| 216 #endif /* OVERRIDE_silk_prefilt_FIX */ |
| OLD | NEW |