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