blob: 06a29b663248b5b93f17f698f5b99941ea32a230 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:231/*
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
pbos@webrtc.orgf24ac592013-05-27 09:49:5818#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:2319
pbos@webrtc.org45a34342013-04-10 18:06:5720void WebRtcSpl_ReflCoefToLpc(const int16_t *k, int use_order, int16_t *a)
andrew@webrtc.orgb015cbe2012-10-22 18:19:2321{
pbos@webrtc.orgc49ec132013-04-09 16:40:2822 int16_t any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
23 int16_t *aptr, *aptr2, *anyptr;
pbos@webrtc.org45a34342013-04-10 18:06:5724 const int16_t *kptr;
andrew@webrtc.orgb015cbe2012-10-22 18:19:2325 int m, i;
26
27 kptr = k;
28 *a = 4096; // i.e., (Word16_MAX >> 3)+1.
29 *any = *a;
bjornv@webrtc.orgcc057522014-10-13 13:01:1330 a[1] = *k >> 3;
andrew@webrtc.orgb015cbe2012-10-22 18:19:2331
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
bjornv@webrtc.orgcc057522014-10-13 13:01:1341 any[m + 1] = *kptr >> 3;
andrew@webrtc.orgb015cbe2012-10-22 18:19:2342 for (i = 0; i < m; i++)
43 {
Bjorn Volcker36be2532015-03-25 12:29:4944 *anyptr = *aptr + (int16_t)((*aptr2 * *kptr) >> 15);
andrew@webrtc.orgb015cbe2012-10-22 18:19:2345 anyptr++;
46 aptr++;
47 aptr2--;
48 }
49
50 aptr = a;
51 anyptr = any;
52 for (i = 0; i < (m + 2); i++)
53 {
54 *aptr = *anyptr;
55 aptr++;
56 anyptr++;
57 }
58 }
59}