1 /*
2  *  Copyright (c) 2018 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 #ifndef MODULES_AUDIO_PROCESSING_AGC2_RNN_VAD_LP_RESIDUAL_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_RNN_VAD_LP_RESIDUAL_H_
13 
14 #include <stddef.h>
15 
16 #include "api/array_view.h"
17 
18 namespace webrtc {
19 namespace rnn_vad {
20 
21 // LPC inverse filter length.
22 constexpr size_t kNumLpcCoefficients = 5;
23 
24 // Given a frame |x|, computes a post-processed version of LPC coefficients
25 // tailored for pitch estimation.
26 void ComputeAndPostProcessLpcCoefficients(
27     rtc::ArrayView<const float> x,
28     rtc::ArrayView<float, kNumLpcCoefficients> lpc_coeffs);
29 
30 // Computes the LP residual for the input frame |x| and the LPC coefficients
31 // |lpc_coeffs|. |y| and |x| can point to the same array for in-place
32 // computation.
33 void ComputeLpResidual(
34     rtc::ArrayView<const float, kNumLpcCoefficients> lpc_coeffs,
35     rtc::ArrayView<const float> x,
36     rtc::ArrayView<float> y);
37 
38 }  // namespace rnn_vad
39 }  // namespace webrtc
40 
41 #endif  // MODULES_AUDIO_PROCESSING_AGC2_RNN_VAD_LP_RESIDUAL_H_
42