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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } else { | 167 } else { |
168 /* For unvoiced signals and low-quality input, adjust the quality slower
than SNR_dB setting */ | 168 /* For unvoiced signals and low-quality input, adjust the quality slower
than SNR_dB setting */ |
169 SNR_adj_dB += ( -0.4f * psEnc->sCmn.SNR_dB_Q7 * ( 1 / 128.0f ) + 6.0f )
* ( 1.0f - psEncCtrl->input_quality ); | 169 SNR_adj_dB += ( -0.4f * psEnc->sCmn.SNR_dB_Q7 * ( 1 / 128.0f ) + 6.0f )
* ( 1.0f - psEncCtrl->input_quality ); |
170 } | 170 } |
171 | 171 |
172 /*************************/ | 172 /*************************/ |
173 /* SPARSENESS PROCESSING */ | 173 /* SPARSENESS PROCESSING */ |
174 /*************************/ | 174 /*************************/ |
175 /* Set quantizer offset */ | 175 /* Set quantizer offset */ |
176 if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { | 176 if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { |
177 /* Initally set to 0; may be overruled in process_gains(..) */ | 177 /* Initially set to 0; may be overruled in process_gains(..) */ |
178 psEnc->sCmn.indices.quantOffsetType = 0; | 178 psEnc->sCmn.indices.quantOffsetType = 0; |
179 psEncCtrl->sparseness = 0.0f; | 179 psEncCtrl->sparseness = 0.0f; |
180 } else { | 180 } else { |
181 /* Sparseness measure, based on relative fluctuations of energy per 2 mi
lliseconds */ | 181 /* Sparseness measure, based on relative fluctuations of energy per 2 mi
lliseconds */ |
182 nSamples = 2 * psEnc->sCmn.fs_kHz; | 182 nSamples = 2 * psEnc->sCmn.fs_kHz; |
183 energy_variation = 0.0f; | 183 energy_variation = 0.0f; |
184 log_energy_prev = 0.0f; | 184 log_energy_prev = 0.0f; |
185 pitch_res_ptr = pitch_res; | 185 pitch_res_ptr = pitch_res; |
186 for( k = 0; k < silk_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr )
/ 2; k++ ) { | 186 for( k = 0; k < silk_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr )
/ 2; k++ ) { |
187 nrg = ( silk_float )nSamples + ( silk_float )silk_energy_FLP( pitch_
res_ptr, nSamples ); | 187 nrg = ( silk_float )nSamples + ( silk_float )silk_energy_FLP( pitch_
res_ptr, nSamples ); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 /*************************/ | 356 /*************************/ |
357 for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { | 357 for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { |
358 psShapeSt->HarmBoost_smth += SUBFR_SMTH_COEF * ( HarmBoost - psShape
St->HarmBoost_smth ); | 358 psShapeSt->HarmBoost_smth += SUBFR_SMTH_COEF * ( HarmBoost - psShape
St->HarmBoost_smth ); |
359 psEncCtrl->HarmBoost[ k ] = psShapeSt->HarmBoost_smth; | 359 psEncCtrl->HarmBoost[ k ] = psShapeSt->HarmBoost_smth; |
360 psShapeSt->HarmShapeGain_smth += SUBFR_SMTH_COEF * ( HarmShapeGain - psS
hapeSt->HarmShapeGain_smth ); | 360 psShapeSt->HarmShapeGain_smth += SUBFR_SMTH_COEF * ( HarmShapeGain - psS
hapeSt->HarmShapeGain_smth ); |
361 psEncCtrl->HarmShapeGain[ k ] = psShapeSt->HarmShapeGain_smth; | 361 psEncCtrl->HarmShapeGain[ k ] = psShapeSt->HarmShapeGain_smth; |
362 psShapeSt->Tilt_smth += SUBFR_SMTH_COEF * ( Tilt - psShapeSt->T
ilt_smth ); | 362 psShapeSt->Tilt_smth += SUBFR_SMTH_COEF * ( Tilt - psShapeSt->T
ilt_smth ); |
363 psEncCtrl->Tilt[ k ] = psShapeSt->Tilt_smth; | 363 psEncCtrl->Tilt[ k ] = psShapeSt->Tilt_smth; |
364 } | 364 } |
365 } | 365 } |
OLD | NEW |