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_IndexConvDec.c
16 
17 ******************************************************************/
18 
19 #include "defines.h"
20 
WebRtcIlbcfix_IndexConvDec(int16_t * index)21 void WebRtcIlbcfix_IndexConvDec(
22     int16_t *index   /* (i/o) Codebook indexes */
23                                 ){
24   int k;
25 
26   for (k=4;k<6;k++) {
27     /* Readjust the second and third codebook index for the first 40 sample
28        so that they look the same as the first (in terms of lag)
29     */
30     if ((index[k]>=44)&&(index[k]<108)) {
31       index[k]+=64;
32     } else if ((index[k]>=108)&&(index[k]<128)) {
33       index[k]+=128;
34     } else {
35       /* ERROR */
36     }
37   }
38 }
39