MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ transform_implementation()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = InputType>
output_type MayaFlux::Yantra::ConvolutionTransformer< InputType, OutputType >::transform_implementation ( input_type input)
inlineoverrideprotectedvirtual

Core transformation implementation for convolution operations.

Parameters
inputInput data to transform using convolution methods
Returns
Transformed output data

Performs the convolution operation specified by m_operation on the input data. Operations include direct convolution, cross-correlation, matched filtering, deconvolution, and auto-correlation. These operations are fundamental for signal processing tasks such as filtering, pattern matching, and system identification. Supports both in-place and out-of-place transformations.

Implements MayaFlux::Yantra::UniversalTransformer< InputType, OutputType >.

Definition at line 76 of file ConvolutionTransformer.hpp.

77 {
78 switch (m_operation) {
80 auto impulse_response = get_parameter_or<std::vector<double>>("impulse_response", std::vector<double> { 1.0 });
81
82 if (this->is_in_place()) {
83 return create_output(transform_convolve(input, impulse_response));
84 }
85 return create_output(transform_convolve(input, impulse_response, m_working_buffer));
86 }
87
89 auto template_signal = get_parameter_or<std::vector<double>>("template_signal", std::vector<double> { 1.0 });
90 auto normalize = get_parameter_or<bool>("normalize", true);
91
92 if (this->is_in_place()) {
93 return create_output(transform_cross_correlate(input, template_signal, normalize));
94 }
95 return create_output(transform_cross_correlate(input, template_signal, normalize, m_working_buffer));
96 }
97
99 auto reference_signal = get_parameter_or<std::vector<double>>("reference_signal", std::vector<double> { 1.0 });
100
101 if (this->is_in_place()) {
102 return create_output(transform_matched_filter(input, reference_signal));
103 }
104 return create_output(transform_matched_filter(input, reference_signal, m_working_buffer));
105 }
106
108 auto impulse_response = get_parameter_or<std::vector<double>>("impulse_response", std::vector<double> { 1.0 });
109 auto regularization = get_parameter_or<double>("regularization", 1e-6);
110
111 if (this->is_in_place()) {
112 return create_output(transform_deconvolve(input, impulse_response, regularization));
113 }
114 return create_output(transform_deconvolve(input, impulse_response, regularization, m_working_buffer));
115 }
116
118 auto normalize = get_parameter_or<bool>("normalize", true);
119
120 if (this->is_in_place()) {
122 }
124 }
125
126 default:
127 return create_output(input);
128 }
129 }
ConvolutionOperation m_operation
Current convolution operation.
std::vector< std::vector< double > > m_working_buffer
Buffer for out-of-place convolution operations.
output_type create_output(const input_type &input)
Creates output with proper type conversion.
virtual bool is_in_place() const
Indicates whether the transformation modifies the input data directly.
DataType transform_auto_correlate_fft(DataType &input, bool normalize=true)
Auto-correlation using FFT (IN-PLACE)
@ DIRECT_CONVOLUTION
Standard convolution.
DataType transform_matched_filter(DataType &input, const std::vector< double > &reference_signal)
Matched filter using cross-correlation for signal detection (IN-PLACE)
DataType transform_deconvolve(DataType &input, const std::vector< double > &impulse_to_remove, double regularization=1e-6)
Deconvolution using frequency domain division (IN-PLACE) Useful for removing known impulse responses.
DataType transform_cross_correlate(DataType &input, const std::vector< double > &template_signal, bool normalize=true)
Cross-correlation using FFT (convolution with time-reversed impulse) (IN-PLACE)
DataType transform_convolve(DataType &input, const std::vector< double > &impulse_response)
Convolution transformation using existing infrastructure with C++20 ranges (IN-PLACE)
void normalize(std::vector< double > &data, double target_peak)
Normalize single-channel data to specified peak level (in-place)
Definition Yantra.cpp:558

References MayaFlux::normalize(), MayaFlux::Yantra::transform_auto_correlate_fft(), MayaFlux::Yantra::transform_convolve(), MayaFlux::Yantra::transform_cross_correlate(), MayaFlux::Yantra::transform_deconvolve(), and MayaFlux::Yantra::transform_matched_filter().

+ Here is the call graph for this function: