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_SplitVq.c
16
17 ******************************************************************/
18
19 #include "modules/audio_coding/codecs/ilbc/split_vq.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/vq3.h"
24 #include "modules/audio_coding/codecs/ilbc/vq4.h"
25
26 /*----------------------------------------------------------------*
27 * split vector quantization
28 *---------------------------------------------------------------*/
29
WebRtcIlbcfix_SplitVq(int16_t * qX,int16_t * index,int16_t * X,int16_t * CB,int16_t * dim,int16_t * cbsize)30 void WebRtcIlbcfix_SplitVq(
31 int16_t *qX, /* (o) the quantized vector in Q13 */
32 int16_t *index, /* (o) a vector of indexes for all vector
33 codebooks in the split */
34 int16_t *X, /* (i) the vector to quantize */
35 int16_t *CB, /* (i) the quantizer codebook in Q13 */
36 int16_t *dim, /* (i) the dimension of X and qX */
37 int16_t *cbsize /* (i) the number of vectors in the codebook */
38 ) {
39
40 int16_t *qXPtr, *indexPtr, *CBPtr, *XPtr;
41
42 /* Quantize X with the 3 vectror quantization tables */
43
44 qXPtr=qX;
45 indexPtr=index;
46 CBPtr=CB;
47 XPtr=X;
48 WebRtcIlbcfix_Vq3(qXPtr, indexPtr, CBPtr, XPtr, cbsize[0]);
49
50 qXPtr+=3;
51 indexPtr+=1;
52 CBPtr+=(dim[0]*cbsize[0]);
53 XPtr+=3;
54 WebRtcIlbcfix_Vq3(qXPtr, indexPtr, CBPtr, XPtr, cbsize[1]);
55
56 qXPtr+=3;
57 indexPtr+=1;
58 CBPtr+=(dim[1]*cbsize[1]);
59 XPtr+=3;
60 WebRtcIlbcfix_Vq4(qXPtr, indexPtr, CBPtr, XPtr, cbsize[2]);
61
62 return;
63 }
64