Line data Source code
1 : /** 2 : * \file ComplexConvertFilter.h 3 : */ 4 : 5 : #ifndef ATK_CORE_COMPLEXCONVERTFILTER_H 6 : #define ATK_CORE_COMPLEXCONVERTFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Core/config.h> 10 : 11 : #include <complex> 12 : 13 : namespace ATK 14 : { 15 : /// Converts two real channels into a complex one 16 : template<typename DataType_> 17 : class ATK_CORE_EXPORT RealToComplexFilter final : public TypedBaseFilter<DataType_, std::complex<DataType_>> 18 : { 19 : protected: 20 : /// Simplify parent calls 21 : using Parent = TypedBaseFilter<DataType_, std::complex<DataType_>>; 22 : using Parent::converted_inputs; 23 : using Parent::outputs; 24 : using Parent::nb_input_ports; 25 : using Parent::nb_output_ports; 26 : 27 : public: 28 : /*! 29 : * @brief Constructor 30 : * @param nb_channels is the number of channels, equal to the number of output channels, half the number of input ones 31 : */ 32 : explicit RealToComplexFilter(gsl::index nb_channels = 1); 33 : /// Destructor 34 1 : ~RealToComplexFilter() override = default; 35 : 36 : protected: 37 : void process_impl(gsl::index size) const final; 38 : }; 39 : 40 : /// Converts a complex channels into a two real one 41 : template<typename DataType_> 42 : class ATK_CORE_EXPORT ComplexToRealFilter final : public TypedBaseFilter<std::complex<DataType_>, DataType_> 43 : { 44 : protected: 45 : /// Simplify parent calls 46 : using Parent = TypedBaseFilter<std::complex<DataType_>, DataType_>; 47 : using Parent::converted_inputs; 48 : using Parent::outputs; 49 : using Parent::nb_input_ports; 50 : using Parent::nb_output_ports; 51 : 52 : public: 53 : /*! 54 : * @brief Constructor 55 : * @param nb_channels is the number of channels, equal to the number of input channels, half the number of output ones 56 : */ 57 : explicit ComplexToRealFilter(gsl::index nb_channels = 1); 58 : /// Destructor 59 1 : ~ComplexToRealFilter() override = default; 60 : 61 : protected: 62 : void process_impl(gsl::index size) const final; 63 : }; 64 : } 65 : 66 : #endif