| 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 <stdlib.h> |
| 33 | #include "main_FLP.h"cxx . . $ `<file>/external/opusfile/opus/silk/float/main_FLP.h`/ |
| 34 | #include "tuning_parameters.h"cxx . . $ `<file>/external/opusfile/opus/silk/tuning_parameters.h`/ |
| 35 | |
| 36 | /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */ |
| 37 | static OPUS_INLINEcxx . . $ `external/opusfile/opus/opus_defines.h:110:10`! void silk_LBRR_encode_FLPcxx . . $ silk_LBRR_encode_FLP(aef807337498f3).( |
| 38 | silk_encoder_state_FLPcxx . . $ silk_encoder_state_FLP# *psEnc, /* I/O Encoder state FLP */ |
| 39 | silk_encoder_control_FLPcxx . . $ silk_encoder_control_FLP# *psEncCtrl, /* I/O Encoder control FLP */ |
| 40 | const silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! xfw[], /* I Input signal */ |
| 41 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! condCoding /* I The type of conditional coding used so far for this frame */ |
| 42 | ); |
| 43 | |
| 44 | void silk_encode_do_VAD_FLPcxx . . $ silk_encode_do_VAD_FLP(d39802e7e94fa7fd).( |
| 45 | silk_encoder_state_FLPcxx . . $ silk_encoder_state_FLP# *psEnc, /* I/O Encoder state FLP */ |
| 46 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! activity /* I Decision of Opus voice activity detector */ |
| 47 | ) |
| 48 | { |
| 49 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! activity_threshold = SILK_FIX_CONSTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:543:9`!( SPEECH_ACTIVITY_DTX_THREScxx . . $ `external/opusfile/opus/silk/tuning_parameters.h:80:9`!, 8 ); |
| 50 | |
| 51 | /****************************/ |
| 52 | /* Voice Activity Detection */ |
| 53 | /****************************/ |
| 54 | silk_VAD_GetSA_Q8cxx . . $ `external/opusfile/opus/silk/main.h:315:9`!( &psEnc->sCmn, psEnc->sCmn.inputBuf + 1, psEnc->sCmn.arch ); |
| 55 | /* If Opus VAD is inactive and Silk VAD is active: lower Silk VAD to just under the threshold */ |
| 56 | if( activity == VAD_NO_ACTIVITYcxx . . $ `external/opusfile/opus/silk/define.h:62:9`! && psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..speech_activity_Q8cxx . . $ $anonymous_type_c9846ade8c67dd67_7#speech_activity_Q8. >= activity_threshold ) { |
| 57 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..speech_activity_Q8cxx . . $ $anonymous_type_c9846ade8c67dd67_7#speech_activity_Q8. = activity_threshold - 1; |
| 58 | } |
| 59 | |
| 60 | /**************************************************/ |
| 61 | /* Convert speech activity into VAD and DTX flags */ |
| 62 | /**************************************************/ |
| 63 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..speech_activity_Q8cxx . . $ $anonymous_type_c9846ade8c67dd67_7#speech_activity_Q8. < activity_threshold ) { |
| 64 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType. = TYPE_NO_VOICE_ACTIVITYcxx . . $ `external/opusfile/opus/silk/define.h:70:9`!; |
| 65 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..noSpeechCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#noSpeechCounter.++; |
| 66 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..noSpeechCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#noSpeechCounter. <= NB_SPEECH_FRAMES_BEFORE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:56:9`! ) { |
| 67 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..inDTXcxx . . $ $anonymous_type_c9846ade8c67dd67_7#inDTX. = 0; |
| 68 | } else if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..noSpeechCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#noSpeechCounter. > MAX_CONSECUTIVE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:57:9`! + NB_SPEECH_FRAMES_BEFORE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:56:9`! ) { |
| 69 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..noSpeechCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#noSpeechCounter. = NB_SPEECH_FRAMES_BEFORE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:56:9`!; |
| 70 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..inDTXcxx . . $ $anonymous_type_c9846ade8c67dd67_7#inDTX. = 0; |
| 71 | } |
| 72 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..VAD_flagscxx . . $ $anonymous_type_c9846ade8c67dd67_7#VAD_flags.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. ] = 0; |
| 73 | } else { |
| 74 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..noSpeechCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#noSpeechCounter. = 0; |
| 75 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..inDTXcxx . . $ $anonymous_type_c9846ade8c67dd67_7#inDTX. = 0; |
| 76 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType. = TYPE_UNVOICEDcxx . . $ `external/opusfile/opus/silk/define.h:71:9`!; |
| 77 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..VAD_flagscxx . . $ $anonymous_type_c9846ade8c67dd67_7#VAD_flags.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. ] = 1; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /****************/ |
| 82 | /* Encode frame */ |
| 83 | /****************/ |
| 84 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! silk_encode_frame_FLPcxx . . $ silk_encode_frame_FLP(c1d5b1b48153e860).( |
| 85 | silk_encoder_state_FLPcxx . . $ silk_encoder_state_FLP# *psEnc, /* I/O Encoder state FLP */ |
| 86 | opus_int32cxx . . $ opus_int32# *pnBytesOut, /* O Number of payload bytes; */ |
| 87 | ec_enccxx . . $ ec_enc# *psRangeEnc, /* I/O compressor data structure */ |
| 88 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! condCoding, /* I The type of conditional coding to use */ |
| 89 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! maxBits, /* I If > 0: maximum number of output bits */ |
| 90 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! useCBR /* I Flag to force constant-bitrate operation */ |
| 91 | ) |
| 92 | { |
| 93 | silk_encoder_control_FLPcxx . . $ silk_encoder_control_FLP# sEncCtrl; |
| 94 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! i, iter, maxIter, found_upper, found_lower, ret = 0; |
| 95 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! *x_frame, *res_pitch_frame; |
| 96 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! res_pitch[ 2 * MAX_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:97:9`! + LA_PITCH_MAXcxx . . $ `external/opusfile/opus/silk/define.h:101:9`! ]; |
| 97 | ec_enccxx . . $ ec_enc# sRangeEnc_copy, sRangeEnc_copy2; |
| 98 | silk_nsq_statecxx . . $ silk_nsq_state# sNSQ_copy, sNSQ_copy2; |
| 99 | opus_int32cxx . . $ opus_int32# seed_copy, nBits, nBits_lower, nBits_upper, gainMult_lower, gainMult_upper; |
| 100 | opus_int32cxx . . $ opus_int32# gainsID, gainsID_lower, gainsID_upper; |
| 101 | opus_int16cxx . . $ opus_int16# gainMult_Q8; |
| 102 | opus_int16cxx . . $ opus_int16# ec_prevLagIndex_copy; |
| 103 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! ec_prevSignalType_copy; |
| 104 | opus_int8cxx . . $ opus_int8# LastGainIndex_copy2; |
| 105 | opus_int32cxx . . $ opus_int32# pGains_Q16[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 106 | opus_uint8cxx . . $ opus_uint8# ec_buf_copy[ 1275 ]; |
| 107 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! gain_lock[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ] = {0}; |
| 108 | opus_int16cxx . . $ opus_int16# best_gain_mult[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 109 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! best_sum[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 110 | |
| 111 | /* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */ |
| 112 | LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0; |
| 113 | |
| 114 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..Seedcxx . . $ $anonymous_type_c9846ade8c67dd67_6#Seed. = psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frameCountercxx . . $ $anonymous_type_c9846ade8c67dd67_7#frameCounter.++ & 3; |
| 115 | |
| 116 | /**************************************************************/ |
| 117 | /* Set up Input Pointers, and insert frame in input buffer */ |
| 118 | /**************************************************************/ |
| 119 | /* pointers aligned with start of frame to encode */ |
| 120 | x_frame = psEnc->x_bufcxx . . $ $anonymous_type_f1d9da68e5821ba3_1#x_buf. + psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ltp_mem_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#ltp_mem_length.; /* start of frame to encode */ |
| 121 | res_pitch_frame = res_pitch + psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ltp_mem_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#ltp_mem_length.; /* start of pitch LPC residual frame */ |
| 122 | |
| 123 | /***************************************/ |
| 124 | /* Ensure smooth bandwidth transitions */ |
| 125 | /***************************************/ |
| 126 | silk_LP_variable_cutoffcxx . . $ silk_LP_variable_cutoff(71adae6c5584b270).( &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..sLPcxx . . $ $anonymous_type_c9846ade8c67dd67_7#sLP., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..inputBufcxx . . $ $anonymous_type_c9846ade8c67dd67_7#inputBuf. + 1, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. ); |
| 127 | |
| 128 | /*******************************************/ |
| 129 | /* Copy new frame to front of input buffer */ |
| 130 | /*******************************************/ |
| 131 | silk_short2float_arraycxx . . $ silk_short2float_array(18833b0d715537a5).( x_frame + LA_SHAPE_MScxx . . $ `external/opusfile/opus/silk/define.h:112:9`! * psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..fs_kHzcxx . . $ $anonymous_type_c9846ade8c67dd67_7#fs_kHz., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..inputBufcxx . . $ $anonymous_type_c9846ade8c67dd67_7#inputBuf. + 1, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. ); |
| 132 | |
| 133 | /* Add tiny signal to avoid high CPU load from denormalized floating point numbers */ |
| 134 | for( i = 0; i < 8; i++ ) { |
| 135 | x_frame[ LA_SHAPE_MScxx . . $ `external/opusfile/opus/silk/define.h:112:9`! * psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..fs_kHzcxx . . $ $anonymous_type_c9846ade8c67dd67_7#fs_kHz. + i * ( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. >> 3 ) ] += ( 1 - ( i & 2 ) ) * 1e-6f; |
| 136 | } |
| 137 | |
| 138 | if( !psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..prefillFlagcxx . . $ $anonymous_type_c9846ade8c67dd67_7#prefillFlag. ) { |
| 139 | /*****************************************/ |
| 140 | /* Find pitch lags, initial LPC analysis */ |
| 141 | /*****************************************/ |
| 142 | silk_find_pitch_lags_FLPcxx . . $ silk_find_pitch_lags_FLP(939f966e969441ae).( psEnc, &sEncCtrl, res_pitch, x_frame, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..archcxx . . $ $anonymous_type_c9846ade8c67dd67_7#arch. ); |
| 143 | |
| 144 | /************************/ |
| 145 | /* Noise shape analysis */ |
| 146 | /************************/ |
| 147 | silk_noise_shape_analysis_FLPcxx . . $ silk_noise_shape_analysis_FLP(a45271cc632fe2e9).( psEnc, &sEncCtrl, res_pitch_frame, x_frame ); |
| 148 | |
| 149 | /***************************************************/ |
| 150 | /* Find linear prediction coefficients (LPC + LTP) */ |
| 151 | /***************************************************/ |
| 152 | silk_find_pred_coefs_FLPcxx . . $ silk_find_pred_coefs_FLP(113e6d499d18708f).( psEnc, &sEncCtrl, res_pitch_frame, x_frame, condCoding ); |
| 153 | |
| 154 | /****************************************/ |
| 155 | /* Process gains */ |
| 156 | /****************************************/ |
| 157 | silk_process_gains_FLPcxx . . $ silk_process_gains_FLP(b70e6895816142b3).( psEnc, &sEncCtrl, condCoding ); |
| 158 | |
| 159 | /****************************************/ |
| 160 | /* Low Bitrate Redundant Encoding */ |
| 161 | /****************************************/ |
| 162 | silk_LBRR_encode_FLPcxx . . $ silk_LBRR_encode_FLP(aef807337498f3).( psEnc, &sEncCtrl, x_frame, condCoding ); |
| 163 | |
| 164 | /* Loop over quantizer and entroy coding to control bitrate */ |
| 165 | maxIter = 6; |
| 166 | gainMult_Q8 = SILK_FIX_CONSTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:543:9`!( 1, 8 ); |
| 167 | found_lower = 0; |
| 168 | found_upper = 0; |
| 169 | gainsID = silk_gains_IDcxx . . $ silk_gains_ID(1380bfeceff4370d).( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. ); |
| 170 | gainsID_lower = -1; |
| 171 | gainsID_upper = -1; |
| 172 | /* Copy part of the input state */ |
| 173 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sRangeEnc_copy, psRangeEnc, sizeof( ec_enc ) ); |
| 174 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sNSQ_copy, &psEnc->sCmn.sNSQ, sizeof( silk_nsq_state ) ); |
| 175 | seed_copy = psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..Seedcxx . . $ $anonymous_type_c9846ade8c67dd67_6#Seed.; |
| 176 | ec_prevLagIndex_copy = psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevLagIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevLagIndex.; |
| 177 | ec_prevSignalType_copy = psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevSignalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevSignalType.; |
| 178 | for( iter = 0; ; iter++ ) { |
| 179 | if( gainsID == gainsID_lower ) { |
| 180 | nBits = nBits_lower; |
| 181 | } else if( gainsID == gainsID_upper ) { |
| 182 | nBits = nBits_upper; |
| 183 | } else { |
| 184 | /* Restore part of the input state */ |
| 185 | if( iter > 0 ) { |
| 186 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psRangeEnc, &sRangeEnc_copy, sizeof( ec_enc ) ); |
| 187 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &psEnc->sCmn.sNSQ, &sNSQ_copy, sizeof( silk_nsq_state ) ); |
| 188 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..Seedcxx . . $ $anonymous_type_c9846ade8c67dd67_6#Seed. = seed_copy; |
| 189 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevLagIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevLagIndex. = ec_prevLagIndex_copy; |
| 190 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevSignalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevSignalType. = ec_prevSignalType_copy; |
| 191 | } |
| 192 | |
| 193 | /*****************************************/ |
| 194 | /* Noise shaping quantization */ |
| 195 | /*****************************************/ |
| 196 | silk_NSQ_wrapper_FLPcxx . . $ silk_NSQ_wrapper_FLP(eebcec1d18360cd1).( psEnc, &sEncCtrl, &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices., &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..sNSQcxx . . $ $anonymous_type_c9846ade8c67dd67_7#sNSQ., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulsescxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses., x_frame ); |
| 197 | |
| 198 | if ( iter == maxIter && !found_lower ) { |
| 199 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sRangeEnc_copy2, psRangeEnc, sizeof( ec_enc ) ); |
| 200 | } |
| 201 | |
| 202 | /****************************************/ |
| 203 | /* Encode Parameters */ |
| 204 | /****************************************/ |
| 205 | silk_encode_indicescxx . . $ silk_encode_indices(ff8f51fcf2ede63a).( &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn., psRangeEnc, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded., 0, condCoding ); |
| 206 | |
| 207 | /****************************************/ |
| 208 | /* Encode Excitation Signal */ |
| 209 | /****************************************/ |
| 210 | silk_encode_pulsescxx . . $ silk_encode_pulses(b0c488396eb75e85).( psRangeEnc, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..quantOffsetTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#quantOffsetType., |
| 211 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulsescxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. ); |
| 212 | |
| 213 | nBits = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).( psRangeEnc ); |
| 214 | |
| 215 | /* If we still bust after the last iteration, do some damage control. */ |
| 216 | if ( iter == maxIter && !found_lower && nBits > maxBits ) { |
| 217 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psRangeEnc, &sRangeEnc_copy2, sizeof( ec_enc ) ); |
| 218 | |
| 219 | /* Keep gains the same as the last frame. */ |
| 220 | psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex. = sEncCtrl.lastGainIndexPrevcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#lastGainIndexPrev.; |
| 221 | for ( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 222 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices.[ i ] = 4; |
| 223 | } |
| 224 | if (condCoding != CODE_CONDITIONALLYcxx . . $ `external/opusfile/opus/silk/define.h:77:9`!) { |
| 225 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices.[ 0 ] = sEncCtrl.lastGainIndexPrevcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#lastGainIndexPrev.; |
| 226 | } |
| 227 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevLagIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevLagIndex. = ec_prevLagIndex_copy; |
| 228 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..ec_prevSignalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_7#ec_prevSignalType. = ec_prevSignalType_copy; |
| 229 | /* Clear all pulses. */ |
| 230 | for ( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length.; i++ ) { |
| 231 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulsescxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses.[ i ] = 0; |
| 232 | } |
| 233 | |
| 234 | silk_encode_indicescxx . . $ silk_encode_indices(ff8f51fcf2ede63a).( &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn., psRangeEnc, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded., 0, condCoding ); |
| 235 | |
| 236 | silk_encode_pulsescxx . . $ silk_encode_pulses(b0c488396eb75e85).( psRangeEnc, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..quantOffsetTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#quantOffsetType., |
| 237 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulsescxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. ); |
| 238 | |
| 239 | nBits = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).( psRangeEnc ); |
| 240 | } |
| 241 | |
| 242 | if( useCBR == 0 && iter == 0 && nBits <= maxBits ) { |
| 243 | break; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | if( iter == maxIter ) { |
| 248 | if( found_lower && ( gainsID == gainsID_lower || nBits > maxBits ) ) { |
| 249 | /* Restore output state from earlier iteration that did meet the bitrate budget */ |
| 250 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psRangeEnc, &sRangeEnc_copy2, sizeof( ec_enc ) ); |
| 251 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!( sRangeEnc_copy2.offs <= 1275 ); |
| 252 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psRangeEnc->buf, ec_buf_copy, sRangeEnc_copy2.offs ); |
| 253 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &psEnc->sCmn.sNSQ, &sNSQ_copy2, sizeof( silk_nsq_state ) ); |
| 254 | psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex. = LastGainIndex_copy2; |
| 255 | } |
| 256 | break; |
| 257 | } |
| 258 | |
| 259 | if( nBits > maxBits ) { |
| 260 | if( found_lower == 0 && iter >= 2 ) { |
| 261 | /* Adjust the quantizer's rate/distortion tradeoff and discard previous "upper" results */ |
| 262 | sEncCtrl.Lambdacxx . . $ $anonymous_type_f1d9da68e5821ba3_2#Lambda. = silk_max_floatcxx . . $ `external/opusfile/opus/silk/float/SigProc_FLP.h:146:9`!(sEncCtrl.Lambda*1.5f, 1.5f); |
| 263 | /* Reducing dithering can help us hit the target. */ |
| 264 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..quantOffsetTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#quantOffsetType. = 0; |
| 265 | found_upper = 0; |
| 266 | gainsID_upper = -1; |
| 267 | } else { |
| 268 | found_upper = 1; |
| 269 | nBits_upper = nBits; |
| 270 | gainMult_upper = gainMult_Q8; |
| 271 | gainsID_upper = gainsID; |
| 272 | } |
| 273 | } else if( nBits < maxBits - 5 ) { |
| 274 | found_lower = 1; |
| 275 | nBits_lower = nBits; |
| 276 | gainMult_lower = gainMult_Q8; |
| 277 | if( gainsID != gainsID_lower ) { |
| 278 | gainsID_lower = gainsID; |
| 279 | /* Copy part of the output state */ |
| 280 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sRangeEnc_copy2, psRangeEnc, sizeof( ec_enc ) ); |
| 281 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!( psRangeEnc->offs <= 1275 ); |
| 282 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( ec_buf_copy, psRangeEnc->buf, psRangeEnc->offs ); |
| 283 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sNSQ_copy2, &psEnc->sCmn.sNSQ, sizeof( silk_nsq_state ) ); |
| 284 | LastGainIndex_copy2 = psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex.; |
| 285 | } |
| 286 | } else { |
| 287 | /* Within 5 bits of budget: close enough */ |
| 288 | break; |
| 289 | } |
| 290 | |
| 291 | if ( !found_lower && nBits > maxBits ) { |
| 292 | int j; |
| 293 | for ( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 294 | int sum=0; |
| 295 | for ( j = i*psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length.; j < (i+1)*psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..subfr_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#subfr_length.; j++ ) { |
| 296 | sum += abscxx . . $ abs(7864480464b09eea).( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulsescxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses.[j] ); |
| 297 | } |
| 298 | if ( iter == 0 || (sum < best_sum[i] && !gain_lock[i]) ) { |
| 299 | best_sum[i] = sum; |
| 300 | best_gain_mult[i] = gainMult_Q8; |
| 301 | } else { |
| 302 | gain_lock[i] = 1; |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | if( ( found_lower & found_upper ) == 0 ) { |
| 307 | /* Adjust gain according to high-rate rate/distortion curve */ |
| 308 | if( nBits > maxBits ) { |
| 309 | if (gainMult_Q8 < 16384) { |
| 310 | gainMult_Q8 *= 2; |
| 311 | } else { |
| 312 | gainMult_Q8 = 32767; |
| 313 | } |
| 314 | } else { |
| 315 | opus_int32cxx . . $ opus_int32# gain_factor_Q16; |
| 316 | gain_factor_Q16 = silk_log2lincxx . . $ silk_log2lin(7864480464b09eea).( silk_LSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:505:9`!( nBits - maxBits, 7 ) / psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..frame_lengthcxx . . $ $anonymous_type_c9846ade8c67dd67_7#frame_length. + SILK_FIX_CONSTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:543:9`!( 16, 7 ) ); |
| 317 | gainMult_Q8 = silk_SMULWBcxx . . $ `external/opusfile/opus/silk/macros.h:43:9`!( gain_factor_Q16, gainMult_Q8 ); |
| 318 | } |
| 319 | } else { |
| 320 | /* Adjust gain by interpolating */ |
| 321 | gainMult_Q8 = gainMult_lower + ( ( gainMult_upper - gainMult_lower ) * ( maxBits - nBits_lower ) ) / ( nBits_upper - nBits_lower ); |
| 322 | /* New gain multplier must be between 25% and 75% of old range (note that gainMult_upper < gainMult_lower) */ |
| 323 | if( gainMult_Q8 > silk_ADD_RSHIFT32cxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:525:9`!( gainMult_lower, gainMult_upper - gainMult_lower, 2 ) ) { |
| 324 | gainMult_Q8 = silk_ADD_RSHIFT32cxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:525:9`!( gainMult_lower, gainMult_upper - gainMult_lower, 2 ); |
| 325 | } else |
| 326 | if( gainMult_Q8 < silk_SUB_RSHIFT32cxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:528:9`!( gainMult_upper, gainMult_upper - gainMult_lower, 2 ) ) { |
| 327 | gainMult_Q8 = silk_SUB_RSHIFT32cxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:528:9`!( gainMult_upper, gainMult_upper - gainMult_lower, 2 ); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | for( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 332 | opus_int16cxx . . $ opus_int16# tmp; |
| 333 | if ( gain_lock[i] ) { |
| 334 | tmp = best_gain_mult[i]; |
| 335 | } else { |
| 336 | tmp = gainMult_Q8; |
| 337 | } |
| 338 | pGains_Q16[ i ] = silk_LSHIFT_SAT32cxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:514:9`!( silk_SMULWBcxx . . $ `external/opusfile/opus/silk/macros.h:43:9`!( sEncCtrl.GainsUnq_Q16[ i ], tmp ), 8 ); |
| 339 | } |
| 340 | |
| 341 | /* Quantize gains */ |
| 342 | psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex. = sEncCtrl.lastGainIndexPrevcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#lastGainIndexPrev.; |
| 343 | silk_gains_quantcxx . . $ silk_gains_quant(fe48b9a386c4132d).( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices., pGains_Q16, |
| 344 | &psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex., condCoding == CODE_CONDITIONALLYcxx . . $ `external/opusfile/opus/silk/define.h:77:9`!, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. ); |
| 345 | |
| 346 | /* Unique identifier of gains vector */ |
| 347 | gainsID = silk_gains_IDcxx . . $ silk_gains_ID(1380bfeceff4370d).( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices., psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. ); |
| 348 | |
| 349 | /* Overwrite unquantized gains with quantized gains and convert back to Q0 from Q16 */ |
| 350 | for( i = 0; i < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; i++ ) { |
| 351 | sEncCtrl.Gainscxx . . $ $anonymous_type_f1d9da68e5821ba3_2#Gains.[ i ] = pGains_Q16[ i ] / 65536.0f; |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | /* Update input buffer */ |
| 357 | silk_memmovecxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:422:9`!( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], |
| 358 | ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MScxx . . $ `external/opusfile/opus/silk/define.h:112:9`! * psEnc->sCmn.fs_kHz ) * sizeof( silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! ) ); |
| 359 | |
| 360 | /* Exit without entropy coding */ |
| 361 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..prefillFlagcxx . . $ $anonymous_type_c9846ade8c67dd67_7#prefillFlag. ) { |
| 362 | /* No payload */ |
| 363 | *pnBytesOut = 0; |
| 364 | return ret; |
| 365 | } |
| 366 | |
| 367 | /* Parameters needed for next frame */ |
| 368 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..prevLagcxx . . $ $anonymous_type_c9846ade8c67dd67_7#prevLag. = sEncCtrl.pitchLcxx . . $ $anonymous_type_f1d9da68e5821ba3_2#pitchL.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. - 1 ]; |
| 369 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..prevSignalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_7#prevSignalType. = psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indicescxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType.; |
| 370 | |
| 371 | /****************************************/ |
| 372 | /* Finalize payload */ |
| 373 | /****************************************/ |
| 374 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..first_frame_after_resetcxx . . $ $anonymous_type_c9846ade8c67dd67_7#first_frame_after_reset. = 0; |
| 375 | /* Payload size */ |
| 376 | *pnBytesOut = silk_RSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:511:9`!( ec_tell( psRangeEnc ) + 7, 3 ); |
| 377 | |
| 378 | return ret; |
| 379 | } |
| 380 | |
| 381 | /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate */ |
| 382 | static OPUS_INLINEcxx . . $ `external/opusfile/opus/opus_defines.h:110:10`! void silk_LBRR_encode_FLPcxx . . $ silk_LBRR_encode_FLP(aef807337498f3).( |
| 383 | silk_encoder_state_FLPcxx . . $ silk_encoder_state_FLP# *psEnc, /* I/O Encoder state FLP */ |
| 384 | silk_encoder_control_FLPcxx . . $ silk_encoder_control_FLP# *psEncCtrl, /* I/O Encoder control FLP */ |
| 385 | const silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! xfw[], /* I Input signal */ |
| 386 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! condCoding /* I The type of conditional coding used so far for this frame */ |
| 387 | ) |
| 388 | { |
| 389 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! k; |
| 390 | opus_int32cxx . . $ opus_int32# Gains_Q16[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 391 | silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! TempGains[ MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ]; |
| 392 | SideInfoIndicescxx . . $ SideInfoIndices# *psIndices_LBRR = &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..indices_LBRRcxx . . $ $anonymous_type_c9846ade8c67dd67_7#indices_LBRR.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. ]; |
| 393 | silk_nsq_statecxx . . $ silk_nsq_state# sNSQ_LBRR; |
| 394 | |
| 395 | /*******************************************/ |
| 396 | /* Control use of inband LBRR */ |
| 397 | /*******************************************/ |
| 398 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRR_enabledcxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRR_enabled. && psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..speech_activity_Q8cxx . . $ $anonymous_type_c9846ade8c67dd67_7#speech_activity_Q8. > SILK_FIX_CONSTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:543:9`!( LBRR_SPEECH_ACTIVITY_THREScxx . . $ `external/opusfile/opus/silk/tuning_parameters.h:83:9`!, 8 ) ) { |
| 399 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRR_flagscxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRR_flags.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. ] = 1; |
| 400 | |
| 401 | /* Copy noise shaping quantizer state and quantization indices from regular encoding */ |
| 402 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( &sNSQ_LBRR, &psEnc->sCmn.sNSQ, sizeof( silk_nsq_state ) ); |
| 403 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psIndices_LBRR, &psEnc->sCmn.indices, sizeof( SideInfoIndices ) ); |
| 404 | |
| 405 | /* Save original gains */ |
| 406 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( TempGains, psEncCtrl->Gains, psEnc->sCmn.nb_subfr * sizeof( silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! ) ); |
| 407 | |
| 408 | if( psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. == 0 || psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRR_flagscxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRR_flags.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. - 1 ] == 0 ) { |
| 409 | /* First frame in packet or previous frame not LBRR coded */ |
| 410 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRRprevLastGainIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRRprevLastGainIndex. = psEnc->sShapecxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sShape..LastGainIndexcxx . . $ $anonymous_type_f1d9da68e5821ba3_0#LastGainIndex.; |
| 411 | |
| 412 | /* Increase Gains to get target LBRR rate */ |
| 413 | psIndices_LBRR->GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices.[ 0 ] += psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRR_GainIncreasescxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRR_GainIncreases.; |
| 414 | psIndices_LBRR->GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices.[ 0 ] = silk_min_intcxx . . $ silk_min_int(9b79fb6aee4c0440).( psIndices_LBRR->GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices.[ 0 ], N_LEVELS_QGAINcxx . . $ `external/opusfile/opus/silk/define.h:123:9`! - 1 ); |
| 415 | } |
| 416 | |
| 417 | /* Decode to get gains in sync with decoder */ |
| 418 | silk_gains_dequantcxx . . $ silk_gains_dequant(e7a7ed9bd36c8e0d).( Gains_Q16, psIndices_LBRR->GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices., |
| 419 | &psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..LBRRprevLastGainIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_7#LBRRprevLastGainIndex., condCoding == CODE_CONDITIONALLYcxx . . $ `external/opusfile/opus/silk/define.h:77:9`!, psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr. ); |
| 420 | |
| 421 | /* Overwrite unquantized gains with quantized gains and convert back to Q0 from Q16 */ |
| 422 | for( k = 0; k < psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nb_subfr.; k++ ) { |
| 423 | psEncCtrl->Gainscxx . . $ $anonymous_type_f1d9da68e5821ba3_2#Gains.[ k ] = Gains_Q16[ k ] * ( 1.0f / 65536.0f ); |
| 424 | } |
| 425 | |
| 426 | /*****************************************/ |
| 427 | /* Noise shaping quantization */ |
| 428 | /*****************************************/ |
| 429 | silk_NSQ_wrapper_FLPcxx . . $ silk_NSQ_wrapper_FLP(eebcec1d18360cd1).( psEnc, psEncCtrl, psIndices_LBRR, &sNSQ_LBRR, |
| 430 | psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..pulses_LBRRcxx . . $ $anonymous_type_c9846ade8c67dd67_7#pulses_LBRR.[ psEnc->sCmncxx . . $ $anonymous_type_f1d9da68e5821ba3_1#sCmn..nFramesEncodedcxx . . $ $anonymous_type_c9846ade8c67dd67_7#nFramesEncoded. ], xfw ); |
| 431 | |
| 432 | /* Restore original gains */ |
| 433 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psEncCtrl->Gains, TempGains, psEnc->sCmn.nb_subfr * sizeof( silk_floatcxx . . $ `external/opusfile/opus/silk/typedef.h:36:10`! ) ); |
| 434 | } |
| 435 | } |