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 opus_int32 auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; | 47 opus_int32 auto_corr[ MAX_FIND_PITCH_LPC_ORDER + 1 ]; |
48 opus_int16 rc_Q15[ MAX_FIND_PITCH_LPC_ORDER ]; | 48 opus_int16 rc_Q15[ MAX_FIND_PITCH_LPC_ORDER ]; |
49 opus_int32 A_Q24[ MAX_FIND_PITCH_LPC_ORDER ]; | 49 opus_int32 A_Q24[ MAX_FIND_PITCH_LPC_ORDER ]; |
50 opus_int16 A_Q12[ MAX_FIND_PITCH_LPC_ORDER ]; | 50 opus_int16 A_Q12[ MAX_FIND_PITCH_LPC_ORDER ]; |
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 coefficients */ | 63 /* Estimate LPC AR coefficients */ |
64 /*************************************/ | 64 /*************************************/ |
65 | 65 |
66 /* Calculate windowed signal */ | 66 /* Calculate windowed signal */ |
67 | 67 |
(...skipping 26 matching lines...) Expand all Loading... |
94 | 94 |
95 /* Convert reflection coefficients to prediction coefficients */ | 95 /* Convert reflection coefficients to prediction coefficients */ |
96 silk_k2a( A_Q24, rc_Q15, psEnc->sCmn.pitchEstimationLPCOrder ); | 96 silk_k2a( A_Q24, rc_Q15, psEnc->sCmn.pitchEstimationLPCOrder ); |
97 | 97 |
98 /* Convert From 32 bit Q24 to 16 bit Q12 coefs */ | 98 /* Convert From 32 bit Q24 to 16 bit Q12 coefs */ |
99 for( i = 0; i < psEnc->sCmn.pitchEstimationLPCOrder; i++ ) { | 99 for( i = 0; i < psEnc->sCmn.pitchEstimationLPCOrder; i++ ) { |
100 A_Q12[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT( A_Q24[ i ], 12 ) ); | 100 A_Q12[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT( A_Q24[ i ], 12 ) ); |
101 } | 101 } |
102 | 102 |
103 /* Do BWE */ | 103 /* Do BWE */ |
104 silk_bwexpander( A_Q12, psEnc->sCmn.pitchEstimationLPCOrder, SILK_FIX_CONST(
FIND_PITCH_BANDWITH_EXPANSION, 16 ) ); | 104 silk_bwexpander( A_Q12, psEnc->sCmn.pitchEstimationLPCOrder, SILK_FIX_CONST(
FIND_PITCH_BANDWIDTH_EXPANSION, 16 ) ); |
105 | 105 |
106 /*****************************************/ | 106 /*****************************************/ |
107 /* LPC analysis filtering */ | 107 /* LPC analysis filtering */ |
108 /*****************************************/ | 108 /*****************************************/ |
109 silk_LPC_analysis_filter( res, x_buf, A_Q12, buf_len, psEnc->sCmn.pitchEstim
ationLPCOrder ); | 109 silk_LPC_analysis_filter( res, x_buf, A_Q12, buf_len, psEnc->sCmn.pitchEstim
ationLPCOrder ); |
110 | 110 |
111 if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.
first_frame_after_reset == 0 ) { | 111 if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.
first_frame_after_reset == 0 ) { |
112 /* Threshold for pitch estimator */ | 112 /* Threshold for pitch estimator */ |
113 thrhld_Q15 = SILK_FIX_CONST( 0.6, 15 ); | 113 thrhld_Q15 = SILK_FIX_CONST( 0.6, 15 ); |
114 thrhld_Q15 = silk_SMLABB( thrhld_Q15, SILK_FIX_CONST( -0.004, 15 ), psEn
c->sCmn.pitchEstimationLPCOrder ); | 114 thrhld_Q15 = silk_SMLABB( thrhld_Q15, SILK_FIX_CONST( -0.004, 15 ), psEn
c->sCmn.pitchEstimationLPCOrder ); |
(...skipping 13 matching lines...) Expand all Loading... |
128 } else { | 128 } else { |
129 psEnc->sCmn.indices.signalType = TYPE_UNVOICED; | 129 psEnc->sCmn.indices.signalType = TYPE_UNVOICED; |
130 } | 130 } |
131 } else { | 131 } else { |
132 silk_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); | 132 silk_memset( psEncCtrl->pitchL, 0, sizeof( psEncCtrl->pitchL ) ); |
133 psEnc->sCmn.indices.lagIndex = 0; | 133 psEnc->sCmn.indices.lagIndex = 0; |
134 psEnc->sCmn.indices.contourIndex = 0; | 134 psEnc->sCmn.indices.contourIndex = 0; |
135 psEnc->LTPCorr_Q15 = 0; | 135 psEnc->LTPCorr_Q15 = 0; |
136 } | 136 } |
137 } | 137 } |
OLD | NEW |