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

◆ transform_time_stretch() [1/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_time_stretch ( DataType &  input,
double  stretch_factor 
)

Simple time stretching via resampling using C++20 ranges (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
stretch_factorStretch ratio (>1.0 = slower, <1.0 = faster)
Returns
Time-stretched data

Definition at line 106 of file TemporalHelper.hpp.

107{
108 if (stretch_factor == 1.0) {
109 return input;
110 }
111
112 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
113
114 std::vector<std::vector<double>> result(target_data.size());
115
116 for (size_t i = 0; i < target_data.size(); ++i) {
117 auto new_size = static_cast<size_t>(target_data[i].size() * stretch_factor);
118 result[i].resize(new_size);
119 interpolate(target_data[i], result[i], new_size);
120 }
121
122 return OperationHelper::reconstruct_from_double<DataType>(result, structure_info);
123}

References MayaFlux::Yantra::OperationHelper::extract_structured_double(), and interpolate().

Referenced by MayaFlux::Yantra::TemporalTransformer< InputType, OutputType >::transform_implementation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: