kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

biquad.cpp (1997B)


      1 /** @addtogroup dft
      2  *  @{
      3  */
      4 /*
      5   Copyright (C) 2016-2023 Dan Cazarin (https://www.kfrlib.com)
      6   This file is part of KFR
      7 
      8   KFR is free software: you can redistribute it and/or modify
      9   it under the terms of the GNU General Public License as published by
     10   the Free Software Foundation, either version 2 of the License, or
     11   (at your option) any later version.
     12 
     13   KFR is distributed in the hope that it will be useful,
     14   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16   GNU General Public License for more details.
     17 
     18   You should have received a copy of the GNU General Public License
     19   along with KFR.
     20 
     21   If GPL is not suitable for your project, you must purchase a commercial license to use KFR.
     22   Buying a commercial license is mandatory as soon as you develop commercial activities without
     23   disclosing the source code of your own applications.
     24   See https://www.kfrlib.com for details.
     25  */
     26 #include <kfr/multiarch.h>
     27 #include <kfr/dsp/biquad.hpp>
     28 
     29 namespace kfr
     30 {
     31 
     32 CMT_MULTI_PROTO(namespace impl {
     33     template <typename T>
     34     expression_handle<T, 1> create_iir_filter(const iir_params<T>& params);
     35 } // namespace impl
     36 )
     37 
     38 inline namespace CMT_ARCH_NAME
     39 {
     40 namespace impl
     41 {
     42 template <typename T>
     43 expression_handle<T, 1> create_iir_filter(const iir_params<T>& params)
     44 {
     45     return iir(placeholder<T>(), params);
     46 }
     47 template expression_handle<float, 1> create_iir_filter<float>(const iir_params<float>& params);
     48 template expression_handle<double, 1> create_iir_filter<double>(const iir_params<double>& params);
     49 } // namespace impl
     50 } // namespace CMT_ARCH_NAME
     51 
     52 #ifdef CMT_MULTI_NEEDS_GATE
     53 
     54 template <typename T>
     55 iir_filter<T>::iir_filter(const iir_params<T>& params)
     56 {
     57     CMT_MULTI_GATE(this->filter_expr = ns::impl::create_iir_filter<T>(params));
     58 }
     59 
     60 template iir_filter<float>::iir_filter(const iir_params<float>&);
     61 template iir_filter<double>::iir_filter(const iir_params<double>&);
     62 
     63 #endif
     64 
     65 } // namespace kfr