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_SimpleLsfQ.c
16
17 ******************************************************************/
18
19 #include "modules/audio_coding/codecs/ilbc/simple_lsf_quant.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/split_vq.h"
24
25 /*----------------------------------------------------------------*
26 * lsf quantizer (subrutine to LPCencode)
27 *---------------------------------------------------------------*/
28
WebRtcIlbcfix_SimpleLsfQ(int16_t * lsfdeq,int16_t * index,int16_t * lsf,int16_t lpc_n)29 void WebRtcIlbcfix_SimpleLsfQ(
30 int16_t *lsfdeq, /* (o) dequantized lsf coefficients
31 (dimension FILTERORDER) Q13 */
32 int16_t *index, /* (o) quantization index */
33 int16_t *lsf, /* (i) the lsf coefficient vector to be
34 quantized (dimension FILTERORDER) Q13 */
35 int16_t lpc_n /* (i) number of lsf sets to quantize */
36 ){
37
38 /* Quantize first LSF with memoryless split VQ */
39 WebRtcIlbcfix_SplitVq( lsfdeq, index, lsf,
40 (int16_t*)WebRtcIlbcfix_kLsfCb, (int16_t*)WebRtcIlbcfix_kLsfDimCb, (int16_t*)WebRtcIlbcfix_kLsfSizeCb);
41
42 if (lpc_n==2) {
43 /* Quantize second LSF with memoryless split VQ */
44 WebRtcIlbcfix_SplitVq( lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT,
45 lsf + LPC_FILTERORDER, (int16_t*)WebRtcIlbcfix_kLsfCb,
46 (int16_t*)WebRtcIlbcfix_kLsfDimCb, (int16_t*)WebRtcIlbcfix_kLsfSizeCb);
47 }
48 return;
49 }
50