niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 06c2aa9 | 2018-02-01 15:11:41 +0100 | [diff] [blame^] | 19 | #include "modules/audio_coding/codecs/ilbc/defines.h" |
| 20 | #include "modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h" |
| 21 | #include "modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h" |
| 22 | #include "modules/audio_coding/codecs/ilbc/simple_lsf_quant.h" |
| 23 | #include "modules/audio_coding/codecs/ilbc/lsf_check.h" |
| 24 | #include "modules/audio_coding/codecs/ilbc/constants.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | |
| 26 | /*----------------------------------------------------------------* |
| 27 | * lpc encoder |
| 28 | *---------------------------------------------------------------*/ |
| 29 | |
| 30 | void WebRtcIlbcfix_LpcEncode( |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 31 | int16_t *syntdenum, /* (i/o) synthesis filter coefficients |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | before/after encoding */ |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 33 | int16_t *weightdenum, /* (i/o) weighting denumerator coefficients |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | before/after encoding */ |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 35 | int16_t *lsf_index, /* (o) lsf quantization index */ |
| 36 | int16_t *data, /* (i) Speech to do LPC analysis on */ |
pbos@webrtc.org | eb54446 | 2014-12-17 15:23:29 +0000 | [diff] [blame] | 37 | IlbcEncoder *iLBCenc_inst |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | /* (i/o) the encoder state structure */ |
| 39 | ) { |
| 40 | /* Stack based */ |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 41 | int16_t lsf[LPC_FILTERORDER * LPC_N_MAX]; |
| 42 | int16_t lsfdeq[LPC_FILTERORDER * LPC_N_MAX]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | } |