Home | History | Annotate | Download | only in signal_processing
      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 "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
     19 
     20 void WebRtcSpl_ReflCoefToLpc(const int16_t *k, int use_order, int16_t *a)
     21 {
     22     int16_t any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
     23     int16_t *aptr, *aptr2, *anyptr;
     24     const int16_t *kptr;
     25     int m, i;
     26 
     27     kptr = k;
     28     *a = 4096; // i.e., (Word16_MAX >> 3)+1.
     29     *any = *a;
     30     a[1] = *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] = *kptr >> 3;
     42         for (i = 0; i < m; i++)
     43         {
     44             *anyptr = *aptr + (int16_t)((*aptr2 * *kptr) >> 15);
     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 }
     60