1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 /****************************************************************** 12 13 iLBC Speech Coder ANSI-C Source Code 14 15 WebRtcIlbcfix_LpcEncode.c 16 17 ******************************************************************/ 18 19 #include "defines.h" 20 #include "simple_lpc_analysis.h" 21 #include "simple_interpolate_lsf.h" 22 #include "simple_lsf_quant.h" 23 #include "lsf_check.h" 24 #include "constants.h" 25 26 /*----------------------------------------------------------------* 27 * lpc encoder 28 *---------------------------------------------------------------*/ 29 30 void WebRtcIlbcfix_LpcEncode( 31 int16_t *syntdenum, /* (i/o) synthesis filter coefficients 32 before/after encoding */ 33 int16_t *weightdenum, /* (i/o) weighting denumerator coefficients 34 before/after encoding */ 35 int16_t *lsf_index, /* (o) lsf quantization index */ 36 int16_t *data, /* (i) Speech to do LPC analysis on */ 37 iLBC_Enc_Inst_t *iLBCenc_inst 38 /* (i/o) the encoder state structure */ 39 ) { 40 /* Stack based */ 41 int16_t lsf[LPC_FILTERORDER * LPC_N_MAX]; 42 int16_t lsfdeq[LPC_FILTERORDER * LPC_N_MAX]; 43 44 /* Calculate LSF's from the input speech */ 45 WebRtcIlbcfix_SimpleLpcAnalysis(lsf, data, iLBCenc_inst); 46 47 /* Quantize the LSF's */ 48 WebRtcIlbcfix_SimpleLsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n); 49 50 /* Stableize the LSF's if needed */ 51 WebRtcIlbcfix_LsfCheck(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n); 52 53 /* Calculate the synthesis and weighting filter coefficients from 54 the optimal LSF and the dequantized LSF */ 55 WebRtcIlbcfix_SimpleInterpolateLsf(syntdenum, weightdenum, 56 lsf, lsfdeq, iLBCenc_inst->lsfold, 57 iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst); 58 59 return; 60 } 61