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