blob: 9fa0d61ded2fd758d9886bed2c87f18f1ea2a22e [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
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 "defines.h"
20#include "constants.h"
21
22/*----------------------------------------------------------------*
23 * obtain dequantized lsf coefficients from quantization index
24 *---------------------------------------------------------------*/
25
26void WebRtcIlbcfix_SimpleLsfDeQ(
pbos@webrtc.org0946a562013-04-09 00:28:0627 int16_t *lsfdeq, /* (o) dequantized lsf coefficients */
28 int16_t *index, /* (i) quantization index */
29 int16_t lpc_n /* (i) number of LPCs */
niklase@google.com470e71d2011-07-07 08:21:2530 ){
31 int i, j, pos, cb_pos;
32
33 /* decode first LSF */
34
35 pos = 0;
36 cb_pos = 0;
37 for (i = 0; i < LSF_NSPLIT; i++) {
38 for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) {
bjornv@webrtc.orgba97ea62015-02-13 09:51:4039 lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + j + index[i] *
40 WebRtcIlbcfix_kLsfDimCb[i]];
niklase@google.com470e71d2011-07-07 08:21:2541 }
42 pos += WebRtcIlbcfix_kLsfDimCb[i];
bjornv@webrtc.orgba97ea62015-02-13 09:51:4043 cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i];
niklase@google.com470e71d2011-07-07 08:21:2544 }
45
46 if (lpc_n>1) {
47 /* decode last LSF */
48 pos = 0;
49 cb_pos = 0;
50 for (i = 0; i < LSF_NSPLIT; i++) {
51 for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) {
bjornv@webrtc.orgba97ea62015-02-13 09:51:4052 lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[
53 cb_pos + index[LSF_NSPLIT + i] * WebRtcIlbcfix_kLsfDimCb[i] + j];
niklase@google.com470e71d2011-07-07 08:21:2554 }
55 pos += WebRtcIlbcfix_kLsfDimCb[i];
bjornv@webrtc.orgba97ea62015-02-13 09:51:4056 cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i];
niklase@google.com470e71d2011-07-07 08:21:2557 }
58 }
59 return;
60}