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