1/*
2 *  Copyright (c) 2012 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 WEBRTC_MODULES_AUDIO_PROCESSING_VAD_POLE_ZERO_FILTER_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_POLE_ZERO_FILTER_H_
13
14#include <cstddef>
15
16#include "webrtc/typedefs.h"
17
18namespace webrtc {
19
20class PoleZeroFilter {
21 public:
22  ~PoleZeroFilter() {}
23
24  static PoleZeroFilter* Create(const float* numerator_coefficients,
25                                size_t order_numerator,
26                                const float* denominator_coefficients,
27                                size_t order_denominator);
28
29  int Filter(const int16_t* in, size_t num_input_samples, float* output);
30
31 private:
32  PoleZeroFilter(const float* numerator_coefficients,
33                 size_t order_numerator,
34                 const float* denominator_coefficients,
35                 size_t order_denominator);
36
37  static const int kMaxFilterOrder = 24;
38
39  int16_t past_input_[kMaxFilterOrder * 2];
40  float past_output_[kMaxFilterOrder * 2];
41
42  float numerator_coefficients_[kMaxFilterOrder + 1];
43  float denominator_coefficients_[kMaxFilterOrder + 1];
44
45  size_t order_numerator_;
46  size_t order_denominator_;
47  size_t highest_order_;
48};
49
50}  // namespace webrtc
51
52#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_VAD_POLE_ZERO_FILTER_H_
53