MayaFlux 0.1.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::TemporalTransformer< InputType, OutputType >::transform_implementation ( input_type input)
inlineoverrideprotectedvirtual

Core transformation implementation for temporal operations.

Parameters
inputInput data to transform in the time domain
Returns
Transformed output data

Performs the temporal operation specified by m_operation on the input data. Operations modify the temporal characteristics of the data including timing, duration, ordering, and envelope shaping. Supports both in-place and out-of-place transformations based on transformer settings.

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

Definition at line 77 of file TemporalTransformer.hpp.

78 {
79 switch (m_operation) {
81 if (this->is_in_place()) {
83 }
84
86 }
87
89 auto stretch_factor = get_parameter_or<double>("stretch_factor", 1.0);
90 if (this->is_in_place()) {
91 return create_output(transform_time_stretch(input, stretch_factor));
92 }
93
94 return create_output(transform_time_stretch(input, stretch_factor, m_working_buffer));
95 }
96
98 auto delay_samples = get_parameter_or<uint32_t>("delay_samples", 1000);
99 auto fill_value = get_parameter_or<double>("fill_value", 0.0);
100 if (this->is_in_place()) {
101 return create_output(transform_delay(input, delay_samples, fill_value));
102 }
103
104 return create_output(transform_delay(input, delay_samples, fill_value, m_working_buffer));
105 }
106
108 auto fade_in_ratio = get_parameter_or<double>("fade_in_ratio", 0.1);
109 auto fade_out_ratio = get_parameter_or<double>("fade_out_ratio", 0.1);
110 if (this->is_in_place()) {
111 return create_output(transform_fade(input, fade_in_ratio, fade_out_ratio));
112 }
113
114 return create_output(transform_fade(input, fade_in_ratio, fade_out_ratio, m_working_buffer));
115 }
116
118 auto start_ratio = get_parameter_or<double>("start_ratio", 0.0);
119 auto end_ratio = get_parameter_or<double>("end_ratio", 1.0);
120 if (this->is_in_place()) {
121 return create_output(transform_slice(input, start_ratio, end_ratio));
122 }
123
124 return create_output(transform_slice(input, start_ratio, end_ratio, m_working_buffer));
125 }
126
128 auto target_size = get_parameter_or<size_t>("target_size", 0);
129 auto use_cubic = get_parameter_or<bool>("use_cubic", false);
130 if (target_size > 0) {
131 if (use_cubic) {
132 if (this->is_in_place()) {
133 return create_output(interpolate_cubic(input, target_size));
134 }
135
136 return create_output(interpolate_cubic(input, target_size, m_working_buffer));
137 }
138
139 if (this->is_in_place()) {
140 return create_output(interpolate_linear(input, target_size));
141 }
142 return create_output(interpolate_linear(input, target_size, m_working_buffer));
143 }
144 return create_output(input);
145 }
146
147 default:
148 return create_output(input);
149 }
150 }
output_type create_output(const input_type &input)
Creates output with proper type conversion.
std::vector< std::vector< double > > m_working_buffer
Buffer for out-of-place temporal operations.
TemporalOperation m_operation
Current temporal operation.
virtual bool is_in_place() const
Indicates whether the transformation modifies the input data directly.
DataType interpolate_cubic(DataType &input, size_t target_size)
Cubic interpolation between data points using C++20 ranges (IN-PLACE)
DataType interpolate_linear(DataType &input, size_t target_size)
Linear interpolation between data points using C++20 ranges (IN-PLACE)
DataType transform_time_reverse(DataType &input)
Time reversal transformation using C++20 ranges (IN-PLACE)
DataType transform_delay(DataType &input, uint32_t delay_samples, double fill_value=0.0)
Delay transformation that extends buffer size (IN-PLACE)
DataType transform_time_stretch(DataType &input, double stretch_factor)
Simple time stretching via resampling using C++20 ranges (IN-PLACE)
DataType transform_slice(DataType &input, double start_ratio, double end_ratio)
Slice transformation to extract a portion of the data based on ratios (IN-PLACE)
DataType transform_fade(DataType &input, double fade_in_duration_ratio=0.0, double fade_out_duration_ratio=0.0)
Fade transformation (linear fade-in and fade-out) using C++20 ranges (IN-PLACE)
@ SLICE
Extract temporal slice.
@ TIME_REVERSE
Reverse temporal order.
@ TIME_STRETCH
Change playback speed.
@ FADE_IN_OUT
Apply fade envelope.
@ INTERPOLATE
Temporal interpolation.

References MayaFlux::Yantra::interpolate_cubic(), MayaFlux::Yantra::interpolate_linear(), MayaFlux::Yantra::transform_delay(), MayaFlux::Yantra::transform_fade(), MayaFlux::Yantra::transform_slice(), MayaFlux::Yantra::transform_time_reverse(), and MayaFlux::Yantra::transform_time_stretch().

+ Here is the call graph for this function: