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 * This file contains the function WebRtcSpl_ReflCoefToLpc().
14 * The description header can be found in signal_processing_library.h
15 *
16 */
17
18 #include "signal_processing_library.h"
19
WebRtcSpl_ReflCoefToLpc(G_CONST WebRtc_Word16 * k,int use_order,WebRtc_Word16 * a)20 void WebRtcSpl_ReflCoefToLpc(G_CONST WebRtc_Word16 *k, int use_order, WebRtc_Word16 *a)
21 {
22 WebRtc_Word16 any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
23 WebRtc_Word16 *aptr, *aptr2, *anyptr;
24 G_CONST WebRtc_Word16 *kptr;
25 int m, i;
26
27 kptr = k;
28 *a = 4096; // i.e., (Word16_MAX >> 3)+1.
29 *any = *a;
30 a[1] = WEBRTC_SPL_RSHIFT_W16((*k), 3);
31
32 for (m = 1; m < use_order; m++)
33 {
34 kptr++;
35 aptr = a;
36 aptr++;
37 aptr2 = &a[m];
38 anyptr = any;
39 anyptr++;
40
41 any[m + 1] = WEBRTC_SPL_RSHIFT_W16((*kptr), 3);
42 for (i = 0; i < m; i++)
43 {
44 *anyptr = (*aptr)
45 + (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT((*aptr2), (*kptr), 15);
46 anyptr++;
47 aptr++;
48 aptr2--;
49 }
50
51 aptr = a;
52 anyptr = any;
53 for (i = 0; i < (m + 2); i++)
54 {
55 *aptr = *anyptr;
56 aptr++;
57 anyptr++;
58 }
59 }
60 }
61