niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [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_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 | |
| 26 | void WebRtcIlbcfix_SimpleLsfDeQ( |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 | [diff] [blame] | 27 | 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.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 30 | ){ |
| 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.org | ba97ea6 | 2015-02-13 09:51:40 | [diff] [blame] | 39 | lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + j + index[i] * |
| 40 | WebRtcIlbcfix_kLsfDimCb[i]]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 41 | } |
| 42 | pos += WebRtcIlbcfix_kLsfDimCb[i]; |
bjornv@webrtc.org | ba97ea6 | 2015-02-13 09:51:40 | [diff] [blame] | 43 | cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 44 | } |
| 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.org | ba97ea6 | 2015-02-13 09:51:40 | [diff] [blame] | 52 | lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[ |
| 53 | cb_pos + index[LSF_NSPLIT + i] * WebRtcIlbcfix_kLsfDimCb[i] + j]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 54 | } |
| 55 | pos += WebRtcIlbcfix_kLsfDimCb[i]; |
bjornv@webrtc.org | ba97ea6 | 2015-02-13 09:51:40 | [diff] [blame] | 56 | cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | return; |
| 60 | } |