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_SimpleLsfDeQ.c 16 17 ******************************************************************/ 18 19 #include "modules/audio_coding/codecs/ilbc/simple_lsf_dequant.h" 20 21 #include "modules/audio_coding/codecs/ilbc/constants.h" 22 #include "modules/audio_coding/codecs/ilbc/defines.h" 23 24 /*----------------------------------------------------------------* 25 * obtain dequantized lsf coefficients from quantization index 26 *---------------------------------------------------------------*/ 27 WebRtcIlbcfix_SimpleLsfDeQ(int16_t * lsfdeq,int16_t * index,int16_t lpc_n)28void WebRtcIlbcfix_SimpleLsfDeQ( 29 int16_t *lsfdeq, /* (o) dequantized lsf coefficients */ 30 int16_t *index, /* (i) quantization index */ 31 int16_t lpc_n /* (i) number of LPCs */ 32 ){ 33 int i, j, pos, cb_pos; 34 35 /* decode first LSF */ 36 37 pos = 0; 38 cb_pos = 0; 39 for (i = 0; i < LSF_NSPLIT; i++) { 40 for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) { 41 lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + j + index[i] * 42 WebRtcIlbcfix_kLsfDimCb[i]]; 43 } 44 pos += WebRtcIlbcfix_kLsfDimCb[i]; 45 cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; 46 } 47 48 if (lpc_n>1) { 49 /* decode last LSF */ 50 pos = 0; 51 cb_pos = 0; 52 for (i = 0; i < LSF_NSPLIT; i++) { 53 for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) { 54 lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[ 55 cb_pos + index[LSF_NSPLIT + i] * WebRtcIlbcfix_kLsfDimCb[i] + j]; 56 } 57 pos += WebRtcIlbcfix_kLsfDimCb[i]; 58 cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; 59 } 60 } 61 return; 62 } 63