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

◆ interpolate()

void MayaFlux::Yantra::interpolate ( std::span< double >  input,
std::vector< double > &  output,
uint32_t  target_size 
)
inline

Definition at line 603 of file MathematicalHelper.hpp.

604{
605 auto indices = std::views::iota(size_t { 0 }, target_size);
606
607 std::ranges::transform(indices, output.begin(),
608 [&input, target_size](size_t i) {
609 double pos = static_cast<double>(i) * double(input.size() - 1) / (target_size - 1);
610 auto idx = static_cast<size_t>(pos);
611 double frac = pos - (double)idx;
612
613 if (idx + 1 < input.size()) {
614 return input[idx] * (1.0 - frac) + input[idx + 1] * frac;
615 }
616
617 return input[idx];
618 });
619}

References interpolate().

Referenced by interpolate(), interpolate_linear(), interpolate_linear(), transform_time_stretch(), and transform_time_stretch().

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