| 1 | /*********************************************************************** |
| 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 | Redistribution and use in source and binary forms, with or without |
| 4 | modification, are permitted provided that the following conditions |
| 5 | are met: |
| 6 | - Redistributions of source code must retain the above copyright notice, |
| 7 | this list of conditions and the following disclaimer. |
| 8 | - Redistributions in binary form must reproduce the above copyright |
| 9 | notice, this list of conditions and the following disclaimer in the |
| 10 | documentation and/or other materials provided with the distribution. |
| 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
| 12 | names of specific contributors, may be used to endorse or promote |
| 13 | products derived from this software without specific prior written |
| 14 | permission. |
| 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | POSSIBILITY OF SUCH DAMAGE. |
| 26 | ***********************************************************************/ |
| 27 | |
| 28 | //#ifdef HAVE_CONFIG_H |
| 29 | #include "opus__config.h"cxx . . $ `<file>/external/opusfile/opus/opus__config.h`/ |
| 30 | //#endif |
| 31 | |
| 32 | #include "main_FLP.h"cxx . . $ `<file>/external/opusfile/opus/silk/float/main_FLP.h`/ |
| 33 | |
| 34 | /* Find LPC and LTP coefficients */ |
| 35 | void silk_find_pred_coefs_FLPcxx . . $ silk_find_pred_coefs_FLP(113e6d499d18708f).( |
| 36 | silk_encoder_state_FLPcxx . . $ silk_encoder_state_FLP# *psEnc, /* I/O Encoder state FLP */ |
| 37 | silk_encoder_control_FLPcxx . . $ silk_encoder_control_FLP# *psEncCtrl, /* I/O Encoder control FLP */ |
| 38 | const silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! res_pitch[], /* I Residual from pitch analysis */ |
| 39 | const silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! x[], /* I Speech signal */ |
| 40 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! condCoding /* I The type of conditional coding to use */ |
| 41 | ) |
| 42 | { |
| 43 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! i; |
| 44 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! XXLTP[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! ]; |
| 45 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! xXLTP[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! ]; |
| 46 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! invGains[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 47 | opus_int16cxx . . $ opus_int16# NLSF_Q15[ MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! ]; |
| 48 | const silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! *x_ptr; |
| 49 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! * MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! + MAX_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:97:9`! ]; |
| 50 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! minInvGain; |
| 51 | |
| 52 | /* Weighting for weighted least squares */ |
| 53 | for( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 54 | silk_assertcxx . . $ `external/opusfile/opus/silk/typedef.h:74:11`!( psEncCtrl->Gains[ i ] > 0.0f ); |
| 55 | invGains[ i ] = 1.0f / psEncCtrl->Gainscxx . . $ $anonymous_type_f1d9da68e5821ba3_2#Gains.[ i ]; |
| 56 | } |
| 57 | |
| 58 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType. == TYPE_VOICEDcxx . . $ `external/opusfile/opus/silk/define.h:72:9`! ) { |
| 59 | /**********/ |
| 60 | /* VOICED */ |
| 61 | /**********/ |
| 62 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!( psEnc->sCmn.ltp_mem_length - psEnc->sCmn.predictLPCOrder >= psEncCtrl->pitchL[ 0 ] + LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! / 2 ); |
| 63 | |
| 64 | /* LTP analysis */ |
| 65 | silk_find_LTP_FLPcxx . . $ silk_find_LTP_FLP(8ab8107739751ae0).( XXLTP, xXLTP, res_pitch, psEncCtrl->pitchLcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#pitchL., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. ); |
| 66 | |
| 67 | /* Quantize LTP gain parameters */ |
| 68 | silk_quant_LTP_gains_FLPcxx . . $ silk_quant_LTP_gains_FLP(229faa8c237d9a26).( psEncCtrl->LTPCoefcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#LTPCoef., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..LTPIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#LTPIndex., &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..PERIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#PERIndex., |
| 69 | &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..sum_log_gain_Q7cxx . . $ $anonymous_type_c9846ade8c67dd67_7#sum_log_gain_Q7., &psEncCtrl->LTPredCodGaincxx . . $ $anonymous_type_f1d9da68e5821ba3_2#LTPredCodGain., XXLTP, xXLTP, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..archcxx . . $ $anonymous_type_c9846ade8c67dd67_7#arch. ); |
| 70 | |
| 71 | /* Control LTP scaling */ |
| 72 | silk_LTP_scale_ctrl_FLPcxx . . $ silk_LTP_scale_ctrl_FLP(b70e6895816142b3).( psEnc, psEncCtrl, condCoding ); |
| 73 | |
| 74 | /* Create LTP residual */ |
| 75 | silk_LTP_analysis_filter_FLPcxx . . $ silk_LTP_analysis_filter_FLP(5eaa15233dddf083).( LPC_in_pre, x - psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder., psEncCtrl->LTPCoefcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#LTPCoef., |
| 76 | psEncCtrl->pitchLcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#pitchL., invGains, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder. ); |
| 77 | } else { |
| 78 | /************/ |
| 79 | /* UNVOICED */ |
| 80 | /************/ |
| 81 | /* Create signal with prepended subframes, scaled by inverse gains */ |
| 82 | x_ptr = x - psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder.; |
| 83 | x_pre_ptr = LPC_in_pre; |
| 84 | for( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 85 | silk_scale_copy_vector_FLPcxx . . $ silk_scale_copy_vector_FLP(7445535a3bd3c98e).( x_pre_ptr, x_ptr, invGains[ i ], |
| 86 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length. + psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder. ); |
| 87 | x_pre_ptr += psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length. + psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder.; |
| 88 | x_ptr += psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length.; |
| 89 | } |
| 90 | silk_memsetcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:421:9`!( psEncCtrl->LTPCoef, 0, psEnc->sCmn.nb_subfr * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! * sizeof( silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! ) ); |
| 91 | psEncCtrl->LTPredCodGaincxx . . $ $anonymous_type_f1d9da68e5821ba3_2#LTPredCodGain. = 0.0f; |
| 92 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..sum_log_gain_Q7cxx . . $ $anonymous_type_c9846ade8c67dd67_7#sum_log_gain_Q7. = 0; |
| 93 | } |
| 94 | |
| 95 | /* Limit on total predictive coding gain */ |
| 96 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..first_frame_after_resetcxx . . $ $anonymous_type_c9846ade8c67dd67_7#first_frame_after_reset. ) { |
| 97 | minInvGain = 1.0f / MAX_PREDICTION_POWER_GAIN_AFTER_RESETcxx . . $ `external/opusfile/opus/silk/define.h:140:9`!; |
| 98 | } else { |
| 99 | minInvGain = (silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`!)pow( 2, psEncCtrl->LTPredCodGaincxx . . $ $anonymous_type_f1d9da68e5821ba3_2#LTPredCodGain. / 3 ) / MAX_PREDICTION_POWER_GAINcxx . . $ `external/opusfile/opus/silk/define.h:139:9`!; |
| 100 | minInvGain /= 0.25f + 0.75f * psEncCtrl->coding_qualitycxx . . $ $anonymous_type_f1d9da68e5821ba3_2#coding_quality.; |
| 101 | } |
| 102 | |
| 103 | /* LPC_in_pre contains the LTP-filtered input for voiced, and the unfiltered input for unvoiced */ |
| 104 | silk_find_LPC_FLPcxx . . $ silk_find_LPC_FLP(d5c4183a9082d97b).( &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn., NLSF_Q15, LPC_in_pre, minInvGain ); |
| 105 | |
| 106 | /* Quantize LSFs */ |
| 107 | silk_process_NLSFs_FLPcxx . . $ silk_process_NLSFs_FLP(1b34f60eaa012760).( &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn., psEncCtrl->PredCoefcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#PredCoef., NLSF_Q15, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..prev_NLSFq_Q15cxx . . $ $anonymous_type_c9846ade8c67dd67_7#prev_NLSFq_Q15. ); |
| 108 | |
| 109 | /* Calculate residual energy using quantized LPC coefficients */ |
| 110 | silk_residual_energy_FLPcxx . . $ silk_residual_energy_FLP(884882ec012626d9).( psEncCtrl->ResNrgcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#ResNrg., LPC_in_pre, psEncCtrl->PredCoefcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#PredCoef., psEncCtrl->Gainscxx . . $ $anonymous_type_f1d9da68e5821ba3_2#Gains., |
| 111 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..predictLPCOrdercxx . . $ $anonymous_type_c9846ade8c67dd67_7#predictLPCOrder. ); |
| 112 | |
| 113 | /* Copy to prediction struct for use in next frame for interpolation */ |
| 114 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psEnc->sCmn.prev_NLSFq_Q15, NLSF_Q15, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) ); |
| 115 | } |
| 116 |