andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 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 | |
pbos@webrtc.org | f24ac59 | 2013-05-27 09:49:58 | [diff] [blame] | 18 | #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 19 | |
pbos@webrtc.org | 45a3434 | 2013-04-10 18:06:57 | [diff] [blame] | 20 | void WebRtcSpl_ReflCoefToLpc(const int16_t *k, int use_order, int16_t *a) |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 21 | { |
pbos@webrtc.org | c49ec13 | 2013-04-09 16:40:28 | [diff] [blame] | 22 | int16_t any[WEBRTC_SPL_MAX_LPC_ORDER + 1]; |
| 23 | int16_t *aptr, *aptr2, *anyptr; |
pbos@webrtc.org | 45a3434 | 2013-04-10 18:06:57 | [diff] [blame] | 24 | const int16_t *kptr; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 25 | int m, i; |
| 26 | |
| 27 | kptr = k; |
| 28 | *a = 4096; // i.e., (Word16_MAX >> 3)+1. |
| 29 | *any = *a; |
bjornv@webrtc.org | cc05752 | 2014-10-13 13:01:13 | [diff] [blame] | 30 | a[1] = *k >> 3; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 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 | |
bjornv@webrtc.org | cc05752 | 2014-10-13 13:01:13 | [diff] [blame] | 41 | any[m + 1] = *kptr >> 3; |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 42 | for (i = 0; i < m; i++) |
| 43 | { |
Bjorn Volcker | 36be253 | 2015-03-25 12:29:49 | [diff] [blame] | 44 | *anyptr = *aptr + (int16_t)((*aptr2 * *kptr) >> 15); |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 | [diff] [blame] | 45 | 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 | } |