• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CreateAugmentedVec.c
16 
17 ******************************************************************/
18 
19 #include "defines.h"
20 #include "constants.h"
21 
22 /*----------------------------------------------------------------*
23  *  Recreate a specific codebook vector from the augmented part.
24  *
25  *----------------------------------------------------------------*/
26 
WebRtcIlbcfix_CreateAugmentedVec(size_t index,int16_t * buffer,int16_t * cbVec)27 void WebRtcIlbcfix_CreateAugmentedVec(
28     size_t index,  /* (i) Index for the augmented vector to be created */
29     int16_t *buffer,  /* (i) Pointer to the end of the codebook memory that
30                                            is used for creation of the augmented codebook */
31     int16_t *cbVec  /* (o) The construced codebook vector */
32                                       ) {
33   size_t ilow;
34   int16_t *ppo, *ppi;
35   int16_t cbVecTmp[4];
36 
37   ilow = index-4;
38 
39   /* copy the first noninterpolated part */
40   ppo = buffer-index;
41   WEBRTC_SPL_MEMCPY_W16(cbVec, ppo, index);
42 
43   /* interpolation */
44   ppo = buffer - 4;
45   ppi = buffer - index - 4;
46 
47   /* perform cbVec[ilow+k] = ((ppi[k]*alphaTbl[k])>>15) + ((ppo[k]*alphaTbl[3-k])>>15);
48      for k = 0..3
49   */
50   WebRtcSpl_ElementwiseVectorMult(&cbVec[ilow], ppi, WebRtcIlbcfix_kAlpha, 4, 15);
51   WebRtcSpl_ReverseOrderMultArrayElements(cbVecTmp, ppo, &WebRtcIlbcfix_kAlpha[3], 4, 15);
52   WebRtcSpl_AddVectorsAndShift(&cbVec[ilow], &cbVec[ilow], cbVecTmp, 4, 0);
53 
54   /* copy the second noninterpolated part */
55   ppo = buffer - index;
56   WEBRTC_SPL_MEMCPY_W16(cbVec+index,ppo,(SUBL-index));
57 }
58