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 22 matching lines...) Expand all Loading... |
33 #include "tuning_parameters.h" | 33 #include "tuning_parameters.h" |
34 #include "define.h" | 34 #include "define.h" |
35 | 35 |
36 #define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 1
6000 + 16 ) * 4 = 384*/ | 36 #define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 1
6000 + 16 ) * 4 = 384*/ |
37 | 37 |
38 /* Compute reflection coefficients from input signal */ | 38 /* Compute reflection coefficients from input signal */ |
39 silk_float silk_burg_modified_FLP( /* O returns residual energy
*/ | 39 silk_float silk_burg_modified_FLP( /* O returns residual energy
*/ |
40 silk_float A[], /* O prediction coefficients (len
gth order) */ | 40 silk_float A[], /* O prediction coefficients (len
gth order) */ |
41 const silk_float x[], /* I input signal, length: nb_sub
fr*(D+L_sub) */ | 41 const silk_float x[], /* I input signal, length: nb_sub
fr*(D+L_sub) */ |
42 const silk_float minInvGain, /* I minimum inverse prediction g
ain */ | 42 const silk_float minInvGain, /* I minimum inverse prediction g
ain */ |
43 const opus_int subfr_length, /* I input signal subframe length
(incl. D preceeding samples) */ | 43 const opus_int subfr_length, /* I input signal subframe length
(incl. D preceding samples) */ |
44 const opus_int nb_subfr, /* I number of subframes stacked
in x */ | 44 const opus_int nb_subfr, /* I number of subframes stacked
in x */ |
45 const opus_int D /* I order
*/ | 45 const opus_int D /* I order
*/ |
46 ) | 46 ) |
47 { | 47 { |
48 opus_int k, n, s, reached_max_gain; | 48 opus_int k, n, s, reached_max_gain; |
49 double C0, invGain, num, nrg_f, nrg_b, rc, Atmp, tmp1, tmp2; | 49 double C0, invGain, num, nrg_f, nrg_b, rc, Atmp, tmp1, tmp2; |
50 const silk_float *x_ptr; | 50 const silk_float *x_ptr; |
51 double C_first_row[ SILK_MAX_ORDER_LPC ], C_last_row[ SILK_MAX_ORD
ER_LPC ]; | 51 double C_first_row[ SILK_MAX_ORDER_LPC ], C_last_row[ SILK_MAX_ORD
ER_LPC ]; |
52 double CAf[ SILK_MAX_ORDER_LPC + 1 ], CAb[ SILK_MAX_ORDER_LPC + 1
]; | 52 double CAf[ SILK_MAX_ORDER_LPC + 1 ], CAb[ SILK_MAX_ORDER_LPC + 1
]; |
53 double Af[ SILK_MAX_ORDER_LPC ]; | 53 double Af[ SILK_MAX_ORDER_LPC ]; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 CAf[ k ] += rc * CAb[ n - k + 1 ]; | 155 CAf[ k ] += rc * CAb[ n - k + 1 ]; |
156 CAb[ n - k + 1 ] += rc * tmp1; | 156 CAb[ n - k + 1 ] += rc * tmp1; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 if( reached_max_gain ) { | 160 if( reached_max_gain ) { |
161 /* Convert to silk_float */ | 161 /* Convert to silk_float */ |
162 for( k = 0; k < D; k++ ) { | 162 for( k = 0; k < D; k++ ) { |
163 A[ k ] = (silk_float)( -Af[ k ] ); | 163 A[ k ] = (silk_float)( -Af[ k ] ); |
164 } | 164 } |
165 /* Subtract energy of preceeding samples from C0 */ | 165 /* Subtract energy of preceding samples from C0 */ |
166 for( s = 0; s < nb_subfr; s++ ) { | 166 for( s = 0; s < nb_subfr; s++ ) { |
167 C0 -= silk_energy_FLP( x + s * subfr_length, D ); | 167 C0 -= silk_energy_FLP( x + s * subfr_length, D ); |
168 } | 168 } |
169 /* Approximate residual energy */ | 169 /* Approximate residual energy */ |
170 nrg_f = C0 * invGain; | 170 nrg_f = C0 * invGain; |
171 } else { | 171 } else { |
172 /* Compute residual energy and store coefficients as silk_float */ | 172 /* Compute residual energy and store coefficients as silk_float */ |
173 nrg_f = CAf[ 0 ]; | 173 nrg_f = CAf[ 0 ]; |
174 tmp1 = 1.0; | 174 tmp1 = 1.0; |
175 for( k = 0; k < D; k++ ) { | 175 for( k = 0; k < D; k++ ) { |
176 Atmp = Af[ k ]; | 176 Atmp = Af[ k ]; |
177 nrg_f += CAf[ k + 1 ] * Atmp; | 177 nrg_f += CAf[ k + 1 ] * Atmp; |
178 tmp1 += Atmp * Atmp; | 178 tmp1 += Atmp * Atmp; |
179 A[ k ] = (silk_float)(-Atmp); | 179 A[ k ] = (silk_float)(-Atmp); |
180 } | 180 } |
181 nrg_f -= FIND_LPC_COND_FAC * C0 * tmp1; | 181 nrg_f -= FIND_LPC_COND_FAC * C0 * tmp1; |
182 } | 182 } |
183 | 183 |
184 /* Return residual energy */ | 184 /* Return residual energy */ |
185 return (silk_float)nrg_f; | 185 return (silk_float)nrg_f; |
186 } | 186 } |
OLD | NEW |