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 "modules/audio_coding/codecs/ilbc/lpc_encode.h"
20
21 #include "modules/audio_coding/codecs/ilbc/constants.h"
22 #include "modules/audio_coding/codecs/ilbc/defines.h"
23 #include "modules/audio_coding/codecs/ilbc/lsf_check.h"
24 #include "modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h"
25 #include "modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h"
26 #include "modules/audio_coding/codecs/ilbc/simple_lsf_quant.h"
27
28 /*----------------------------------------------------------------*
29 * lpc encoder
30 *---------------------------------------------------------------*/
31
WebRtcIlbcfix_LpcEncode(int16_t * syntdenum,int16_t * weightdenum,int16_t * lsf_index,int16_t * data,IlbcEncoder * iLBCenc_inst)32 void WebRtcIlbcfix_LpcEncode(
33 int16_t *syntdenum, /* (i/o) synthesis filter coefficients
34 before/after encoding */
35 int16_t *weightdenum, /* (i/o) weighting denumerator coefficients
36 before/after encoding */
37 int16_t *lsf_index, /* (o) lsf quantization index */
38 int16_t *data, /* (i) Speech to do LPC analysis on */
39 IlbcEncoder *iLBCenc_inst
40 /* (i/o) the encoder state structure */
41 ) {
42 /* Stack based */
43 int16_t lsf[LPC_FILTERORDER * LPC_N_MAX];
44 int16_t lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
45
46 /* Calculate LSF's from the input speech */
47 WebRtcIlbcfix_SimpleLpcAnalysis(lsf, data, iLBCenc_inst);
48
49 /* Quantize the LSF's */
50 WebRtcIlbcfix_SimpleLsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
51
52 /* Stableize the LSF's if needed */
53 WebRtcIlbcfix_LsfCheck(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n);
54
55 /* Calculate the synthesis and weighting filter coefficients from
56 the optimal LSF and the dequantized LSF */
57 WebRtcIlbcfix_SimpleInterpolateLsf(syntdenum, weightdenum,
58 lsf, lsfdeq, iLBCenc_inst->lsfold,
59 iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst);
60
61 return;
62 }
63