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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 silk_float A[ MAX_FIND_PITCH_LPC_ORDER ]; | 47 silk_float A[ MAX_FIND_PITCH_LPC_ORDER ]; |
48 silk_float refl_coef[ MAX_FIND_PITCH_LPC_ORDER ]; | 48 silk_float refl_coef[ MAX_FIND_PITCH_LPC_ORDER ]; |
49 silk_float Wsig[ FIND_PITCH_LPC_WIN_MAX ]; | 49 silk_float Wsig[ FIND_PITCH_LPC_WIN_MAX ]; |
50 silk_float *Wsig_ptr; | 50 silk_float *Wsig_ptr; |
51 | 51 |
52 /******************************************/ | 52 /******************************************/ |
53 /* Set up buffer lengths etc based on Fs */ | 53 /* Set up buffer lengths etc based on Fs */ |
54 /******************************************/ | 54 /******************************************/ |
55 buf_len = psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length + psEnc->sCmn.ltp_
mem_length; | 55 buf_len = psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length + psEnc->sCmn.ltp_
mem_length; |
56 | 56 |
57 /* Safty check */ | 57 /* Safety check */ |
58 silk_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length ); | 58 silk_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length ); |
59 | 59 |
60 x_buf = x - psEnc->sCmn.ltp_mem_length; | 60 x_buf = x - psEnc->sCmn.ltp_mem_length; |
61 | 61 |
62 /******************************************/ | 62 /******************************************/ |
63 /* Estimate LPC AR coeficients */ | 63 /* Estimate LPC AR coeficients */ |
64 /******************************************/ | 64 /******************************************/ |
65 | 65 |
66 /* Calculate windowed signal */ | 66 /* Calculate windowed signal */ |
67 | 67 |
(...skipping 21 matching lines...) Expand all Loading... |
89 /* Calculate the reflection coefficients using Schur */ | 89 /* Calculate the reflection coefficients using Schur */ |
90 res_nrg = silk_schur_FLP( refl_coef, auto_corr, psEnc->sCmn.pitchEstimationL
PCOrder ); | 90 res_nrg = silk_schur_FLP( refl_coef, auto_corr, psEnc->sCmn.pitchEstimationL
PCOrder ); |
91 | 91 |
92 /* Prediction gain */ | 92 /* Prediction gain */ |
93 psEncCtrl->predGain = auto_corr[ 0 ] / silk_max_float( res_nrg, 1.0f ); | 93 psEncCtrl->predGain = auto_corr[ 0 ] / silk_max_float( res_nrg, 1.0f ); |
94 | 94 |
95 /* Convert reflection coefficients to prediction coefficients */ | 95 /* Convert reflection coefficients to prediction coefficients */ |
96 silk_k2a_FLP( A, refl_coef, psEnc->sCmn.pitchEstimationLPCOrder ); | 96 silk_k2a_FLP( A, refl_coef, psEnc->sCmn.pitchEstimationLPCOrder ); |
97 | 97 |
98 /* Bandwidth expansion */ | 98 /* Bandwidth expansion */ |
99 silk_bwexpander_FLP( A, psEnc->sCmn.pitchEstimationLPCOrder, FIND_PITCH_BAND
WITH_EXPANSION ); | 99 silk_bwexpander_FLP( A, psEnc->sCmn.pitchEstimationLPCOrder, FIND_PITCH_BAND
WIDTH_EXPANSION ); |
100 | 100 |
101 /*****************************************/ | 101 /*****************************************/ |
102 /* LPC analysis filtering */ | 102 /* LPC analysis filtering */ |
103 /*****************************************/ | 103 /*****************************************/ |
104 silk_LPC_analysis_filter_FLP( res, A, x_buf, buf_len, psEnc->sCmn.pitchEstim
ationLPCOrder ); | 104 silk_LPC_analysis_filter_FLP( res, A, x_buf, buf_len, psEnc->sCmn.pitchEstim
ationLPCOrder ); |
105 | 105 |
106 if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.
first_frame_after_reset == 0 ) { | 106 if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.
first_frame_after_reset == 0 ) { |
107 /* Threshold for pitch estimator */ | 107 /* Threshold for pitch estimator */ |
108 thrhld = 0.6f; | 108 thrhld = 0.6f; |
109 thrhld -= 0.004f * psEnc->sCmn.pitchEstimationLPCOrder; | 109 thrhld -= 0.004f * psEnc->sCmn.pitchEstimationLPCOrder; |
(...skipping 12 matching lines...) Expand all Loading... |
122 } else { | 122 } else { |
123 psEnc->sCmn.indices.signalType = TYPE_UNVOICED; | 123 psEnc->sCmn.indices.signalType = TYPE_UNVOICED; |
124 } | 124 } |
125 } else { | 125 } else { |
126 silk_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); | 126 silk_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); |
127 psEnc->sCmn.indices.lagIndex = 0; | 127 psEnc->sCmn.indices.lagIndex = 0; |
128 psEnc->sCmn.indices.contourIndex = 0; | 128 psEnc->sCmn.indices.contourIndex = 0; |
129 psEnc->LTPCorr = 0; | 129 psEnc->LTPCorr = 0; |
130 } | 130 } |
131 } | 131 } |
OLD | NEW |