1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/*
2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *
4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Use of this source code is governed by a BSD-style license
5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  that can be found in the LICENSE file in the root of the source
6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  tree. An additional intellectual property rights grant can be found
7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  in the file PATENTS.  All contributing project authors may
8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */
10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
11b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/******************************************************************
12b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org iLBC Speech Coder ANSI-C Source Code
14b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org WebRtcIlbcfix_BwExpand.c
16b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org******************************************************************/
18b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#include "defines.h"
20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/*----------------------------------------------------------------*
22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  lpc bandwidth expansion
23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *---------------------------------------------------------------*/
24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
25b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/* The output is in the same domain as the input */
26b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgvoid WebRtcIlbcfix_BwExpand(
27fbda0fcf2f9e82c82bcaac138f44d4e5144f6e0dpbos@webrtc.org    int16_t *out, /* (o) the bandwidth expanded lpc coefficients */
28fbda0fcf2f9e82c82bcaac138f44d4e5144f6e0dpbos@webrtc.org    int16_t *in,  /* (i) the lpc coefficients before bandwidth
29b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                   expansion */
30fbda0fcf2f9e82c82bcaac138f44d4e5144f6e0dpbos@webrtc.org    int16_t *coef, /* (i) the bandwidth expansion factor Q15 */
31fbda0fcf2f9e82c82bcaac138f44d4e5144f6e0dpbos@webrtc.org    int16_t length /* (i) the length of lpc coefficient vectors */
32b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            ) {
33b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  int i;
34b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
35b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  out[0] = in[0];
36b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  for (i = 1; i < length; i++) {
37b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    /* out[i] = coef[i] * in[i] with rounding.
38b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org       in[] and out[] are in Q12 and coef[] is in Q15
39b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    */
40fbda0fcf2f9e82c82bcaac138f44d4e5144f6e0dpbos@webrtc.org    out[i] = (int16_t)((WEBRTC_SPL_MUL_16_16(coef[i], in[i])+16384)>>15);
41b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  }
42b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org}
43