| 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.h"cxx . . $ `<file>/external/opusfile/opus/silk/main.h`/ |
| 33 | |
| 34 | /* Decode parameters from payload */ |
| 35 | void silk_decode_parameterscxx . . $ silk_decode_parameters(34334dd9f9bfd38c).( |
| 36 | silk_decoder_statecxx . . $ silk_decoder_state# *psDec, /* I/O State */ |
| 37 | silk_decoder_controlcxx . . $ silk_decoder_control# *psDecCtrl, /* I/O Decoder control */ |
| 38 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! condCoding /* I The type of conditional coding to use */ |
| 39 | ) |
| 40 | { |
| 41 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! i, k, Ix; |
| 42 | opus_int16cxx . . $ opus_int16# pNLSF_Q15[ MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! ], pNLSF0_Q15[ MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! ]; |
| 43 | const opus_int8cxx . . $ opus_int8# *cbk_ptr_Q7; |
| 44 | |
| 45 | /* Dequant Gains */ |
| 46 | silk_gains_dequantcxx . . $ silk_gains_dequant(e7a7ed9bd36c8e0d).( psDecCtrl->Gains_Q16cxx . . $ $anonymous_type_c9846ade8c67dd67_11#Gains_Q16., psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..GainsIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#GainsIndices., |
| 47 | &psDec->LastGainIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_10#LastGainIndex., condCoding == CODE_CONDITIONALLYcxx . . $ `external/opusfile/opus/silk/define.h:77:9`!, psDec->nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_10#nb_subfr. ); |
| 48 | |
| 49 | /****************/ |
| 50 | /* Decode NLSFs */ |
| 51 | /****************/ |
| 52 | silk_NLSF_decodecxx . . $ silk_NLSF_decode(f271e27b3cab8e21).( pNLSF_Q15, psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..NLSFIndicescxx . . $ $anonymous_type_c9846ade8c67dd67_6#NLSFIndices., psDec->psNLSF_CBcxx . . $ $anonymous_type_c9846ade8c67dd67_10#psNLSF_CB. ); |
| 53 | |
| 54 | /* Convert NLSF parameters to AR prediction filter coefficients */ |
| 55 | silk_NLSF2Acxx . . $ silk_NLSF2A(f180bfede03221d3).( psDecCtrl->PredCoef_Q12cxx . . $ $anonymous_type_c9846ade8c67dd67_11#PredCoef_Q12.[ 1 ], pNLSF_Q15, psDec->LPC_ordercxx . . $ $anonymous_type_c9846ade8c67dd67_10#LPC_order., psDec->archcxx . . $ $anonymous_type_c9846ade8c67dd67_10#arch. ); |
| 56 | |
| 57 | /* If just reset, e.g., because internal Fs changed, do not allow interpolation */ |
| 58 | /* improves the case of packet loss in the first frame after a switch */ |
| 59 | if( psDec->first_frame_after_resetcxx . . $ $anonymous_type_c9846ade8c67dd67_10#first_frame_after_reset. == 1 ) { |
| 60 | psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..NLSFInterpCoef_Q2cxx . . $ $anonymous_type_c9846ade8c67dd67_6#NLSFInterpCoef_Q2. = 4; |
| 61 | } |
| 62 | |
| 63 | if( psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..NLSFInterpCoef_Q2cxx . . $ $anonymous_type_c9846ade8c67dd67_6#NLSFInterpCoef_Q2. < 4 ) { |
| 64 | /* Calculation of the interpolated NLSF0 vector from the interpolation factor, */ |
| 65 | /* the previous NLSF1, and the current NLSF1 */ |
| 66 | for( i = 0; i < psDec->LPC_ordercxx . . $ $anonymous_type_c9846ade8c67dd67_10#LPC_order.; i++ ) { |
| 67 | pNLSF0_Q15[ i ] = psDec->prevNLSF_Q15cxx . . $ $anonymous_type_c9846ade8c67dd67_10#prevNLSF_Q15.[ i ] + silk_RSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:511:9`!( silk_MULcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:427:9`!( psDec->indices.NLSFInterpCoef_Q2, |
| 68 | pNLSF_Q15[ i ] - psDec->prevNLSF_Q15[ i ] ), 2 ); |
| 69 | } |
| 70 | |
| 71 | /* Convert NLSF parameters to AR prediction filter coefficients */ |
| 72 | silk_NLSF2Acxx . . $ silk_NLSF2A(f180bfede03221d3).( psDecCtrl->PredCoef_Q12cxx . . $ $anonymous_type_c9846ade8c67dd67_11#PredCoef_Q12.[ 0 ], pNLSF0_Q15, psDec->LPC_ordercxx . . $ $anonymous_type_c9846ade8c67dd67_10#LPC_order., psDec->archcxx . . $ $anonymous_type_c9846ade8c67dd67_10#arch. ); |
| 73 | } else { |
| 74 | /* Copy LPC coefficients for first half from second half */ |
| 75 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psDecCtrl->PredCoef_Q12[ 0 ], psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_order * sizeof( opus_int16 ) ); |
| 76 | } |
| 77 | |
| 78 | silk_memcpycxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:420:9`!( psDec->prevNLSF_Q15, pNLSF_Q15, psDec->LPC_order * sizeof( opus_int16 ) ); |
| 79 | |
| 80 | /* After a packet loss do BWE of LPC coefs */ |
| 81 | if( psDec->lossCntcxx . . $ $anonymous_type_c9846ade8c67dd67_10#lossCnt. ) { |
| 82 | silk_bwexpandercxx . . $ silk_bwexpander(e1bec1d01040f3bf).( psDecCtrl->PredCoef_Q12cxx . . $ $anonymous_type_c9846ade8c67dd67_11#PredCoef_Q12.[ 0 ], psDec->LPC_ordercxx . . $ $anonymous_type_c9846ade8c67dd67_10#LPC_order., BWE_AFTER_LOSS_Q16cxx . . $ `external/opusfile/opus/silk/define.h:223:9`! ); |
| 83 | silk_bwexpandercxx . . $ silk_bwexpander(e1bec1d01040f3bf).( psDecCtrl->PredCoef_Q12cxx . . $ $anonymous_type_c9846ade8c67dd67_11#PredCoef_Q12.[ 1 ], psDec->LPC_ordercxx . . $ $anonymous_type_c9846ade8c67dd67_10#LPC_order., BWE_AFTER_LOSS_Q16cxx . . $ `external/opusfile/opus/silk/define.h:223:9`! ); |
| 84 | } |
| 85 | |
| 86 | if( psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..signalTypecxx . . $ $anonymous_type_c9846ade8c67dd67_6#signalType. == TYPE_VOICEDcxx . . $ `external/opusfile/opus/silk/define.h:72:9`! ) { |
| 87 | /*********************/ |
| 88 | /* Decode pitch lags */ |
| 89 | /*********************/ |
| 90 | |
| 91 | /* Decode pitch values */ |
| 92 | silk_decode_pitchcxx . . $ silk_decode_pitch(bc12a53a8c24cb73).( psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..lagIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#lagIndex., psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..contourIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#contourIndex., psDecCtrl->pitchLcxx . . $ $anonymous_type_c9846ade8c67dd67_11#pitchL., psDec->fs_kHzcxx . . $ $anonymous_type_c9846ade8c67dd67_10#fs_kHz., psDec->nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_10#nb_subfr. ); |
| 93 | |
| 94 | /* Decode Codebook Index */ |
| 95 | cbk_ptr_Q7 = silk_LTP_vq_ptrs_Q7cxx . . $ silk_LTP_vq_ptrs_Q7.[ psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..PERIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#PERIndex. ]; /* set pointer to start of codebook */ |
| 96 | |
| 97 | for( k = 0; k < psDec->nb_subfrcxx . . $ $anonymous_type_c9846ade8c67dd67_10#nb_subfr.; k++ ) { |
| 98 | Ix = psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..LTPIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#LTPIndex.[ k ]; |
| 99 | for( i = 0; i < LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`!; i++ ) { |
| 100 | psDecCtrl->LTPCoef_Q14cxx . . $ $anonymous_type_c9846ade8c67dd67_11#LTPCoef_Q14.[ k * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! + i ] = silk_LSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:505:9`!( cbk_ptr_Q7[ Ix * LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! + i ], 7 ); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /**********************/ |
| 105 | /* Decode LTP scaling */ |
| 106 | /**********************/ |
| 107 | Ix = psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..LTP_scaleIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#LTP_scaleIndex.; |
| 108 | psDecCtrl->LTP_scale_Q14cxx . . $ $anonymous_type_c9846ade8c67dd67_11#LTP_scale_Q14. = silk_LTPScales_table_Q14cxx . . $ silk_LTPScales_table_Q14.[ Ix ]; |
| 109 | } else { |
| 110 | silk_memsetcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:421:9`!( psDecCtrl->pitchL, 0, psDec->nb_subfr * sizeof( opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! ) ); |
| 111 | silk_memsetcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:421:9`!( psDecCtrl->LTPCoef_Q14, 0, LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! * psDec->nb_subfr * sizeof( opus_int16 ) ); |
| 112 | psDec->indicescxx . . $ $anonymous_type_c9846ade8c67dd67_10#indices..PERIndexcxx . . $ $anonymous_type_c9846ade8c67dd67_6#PERIndex. = 0; |
| 113 | psDecCtrl->LTP_scale_Q14cxx . . $ $anonymous_type_c9846ade8c67dd67_11#LTP_scale_Q14. = 0; |
| 114 | } |
| 115 | } |