Line data Source code
1 : /** 2 : * \file DerivativeFilter.cpp 3 : */ 4 : 5 : #include "DerivativeFilter.h" 6 : 7 : #include <cassert> 8 : #include <cmath> 9 : #include <complex> 10 : #include <cstdint> 11 : 12 : namespace ATK 13 : { 14 : template<typename DataType_> 15 1 : DerivativeFilter<DataType_>::DerivativeFilter(gsl::index nb_channels) 16 1 : :Parent(nb_channels, nb_channels) 17 : { 18 1 : input_delay = 1; 19 1 : } 20 : 21 : template<typename DataType_> 22 1 : void DerivativeFilter<DataType_>::process_impl(gsl::index size) const 23 : { 24 1 : assert(nb_input_ports == nb_output_ports); 25 : 26 2 : for(gsl::index channel = 0; channel < nb_input_ports; ++channel) 27 : { 28 1 : const DataType* ATK_RESTRICT input = converted_inputs[channel]; 29 1 : DataType* ATK_RESTRICT output = outputs[channel]; 30 1001 : for(gsl::index i = 0; i < size; ++i) 31 : { 32 1000 : output[i] = input[i] - input[i-1]; 33 : } 34 : } 35 1 : } 36 : 37 : #if ATK_ENABLE_INSTANTIATION 38 : template class DerivativeFilter<std::int16_t>; 39 : template class DerivativeFilter<std::int32_t>; 40 : template class DerivativeFilter<std::int64_t>; 41 : template class DerivativeFilter<float>; 42 : template class DerivativeFilter<std::complex<float>>; 43 : template class DerivativeFilter<std::complex<double>>; 44 : #endif 45 : template class DerivativeFilter<double>; 46 : }