LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/common_audio/signal_processing - filter_ar.c (source / functions) Hit Total Coverage
Test: output.info Lines: 0 33 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_FilterAR().
      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           0 : size_t WebRtcSpl_FilterAR(const int16_t* a,
      21             :                           size_t a_length,
      22             :                           const int16_t* x,
      23             :                           size_t x_length,
      24             :                           int16_t* state,
      25             :                           size_t state_length,
      26             :                           int16_t* state_low,
      27             :                           size_t state_low_length,
      28             :                           int16_t* filtered,
      29             :                           int16_t* filtered_low,
      30             :                           size_t filtered_low_length)
      31             : {
      32             :     int32_t o;
      33             :     int32_t oLOW;
      34             :     size_t i, j, stop;
      35           0 :     const int16_t* x_ptr = &x[0];
      36           0 :     int16_t* filteredFINAL_ptr = filtered;
      37           0 :     int16_t* filteredFINAL_LOW_ptr = filtered_low;
      38             : 
      39           0 :     for (i = 0; i < x_length; i++)
      40             :     {
      41             :         // Calculate filtered[i] and filtered_low[i]
      42           0 :         const int16_t* a_ptr = &a[1];
      43           0 :         int16_t* filtered_ptr = &filtered[i - 1];
      44           0 :         int16_t* filtered_low_ptr = &filtered_low[i - 1];
      45           0 :         int16_t* state_ptr = &state[state_length - 1];
      46           0 :         int16_t* state_low_ptr = &state_low[state_length - 1];
      47             : 
      48           0 :         o = (int32_t)(*x_ptr++) * (1 << 12);
      49           0 :         oLOW = (int32_t)0;
      50             : 
      51           0 :         stop = (i < a_length) ? i + 1 : a_length;
      52           0 :         for (j = 1; j < stop; j++)
      53             :         {
      54           0 :           o -= *a_ptr * *filtered_ptr--;
      55           0 :           oLOW -= *a_ptr++ * *filtered_low_ptr--;
      56             :         }
      57           0 :         for (j = i + 1; j < a_length; j++)
      58             :         {
      59           0 :           o -= *a_ptr * *state_ptr--;
      60           0 :           oLOW -= *a_ptr++ * *state_low_ptr--;
      61             :         }
      62             : 
      63           0 :         o += (oLOW >> 12);
      64           0 :         *filteredFINAL_ptr = (int16_t)((o + (int32_t)2048) >> 12);
      65           0 :         *filteredFINAL_LOW_ptr++ =
      66           0 :             (int16_t)(o - ((int32_t)(*filteredFINAL_ptr++) * (1 << 12)));
      67             :     }
      68             : 
      69             :     // Save the filter state
      70           0 :     if (x_length >= state_length)
      71             :     {
      72           0 :         WebRtcSpl_CopyFromEndW16(filtered, x_length, a_length - 1, state);
      73           0 :         WebRtcSpl_CopyFromEndW16(filtered_low, x_length, a_length - 1, state_low);
      74             :     } else
      75             :     {
      76           0 :         for (i = 0; i < state_length - x_length; i++)
      77             :         {
      78           0 :             state[i] = state[i + x_length];
      79           0 :             state_low[i] = state_low[i + x_length];
      80             :         }
      81           0 :         for (i = 0; i < x_length; i++)
      82             :         {
      83           0 :             state[state_length - x_length + i] = filtered[i];
      84           0 :             state[state_length - x_length + i] = filtered_low[i];
      85             :         }
      86             :     }
      87             : 
      88           0 :     return x_length;
      89             : }

Generated by: LCOV version 1.13