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 IiLBC Speech Coder ANSI-C Source Code
14
15 WebRtcIlbcfix_IndexConvEnc.c
16
17 ******************************************************************/
18
19 #include "modules/audio_coding/codecs/ilbc/defines.h"
20 /*----------------------------------------------------------------*
21 * Convert the codebook indexes to make the search easier
22 *---------------------------------------------------------------*/
23
WebRtcIlbcfix_IndexConvEnc(int16_t * index)24 void WebRtcIlbcfix_IndexConvEnc(
25 int16_t *index /* (i/o) Codebook indexes */
26 ){
27 int k;
28
29 for (k=4;k<6;k++) {
30 /* Readjust the second and third codebook index so that it is
31 packetized into 7 bits (before it was put in lag-wise the same
32 way as for the first codebook which uses 8 bits)
33 */
34 if ((index[k]>=108)&&(index[k]<172)) {
35 index[k]-=64;
36 } else if (index[k]>=236) {
37 index[k]-=128;
38 } else {
39 /* ERROR */
40 }
41 }
42 }
43