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

◆ transform_spectral_invert() [2/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_spectral_invert ( DataType &  input,
uint32_t  window_size = 1024,
uint32_t  hop_size = 256 
)

Spectral inversion (phase inversion in frequency domain) using C++20 ranges (IN-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - WILL BE MODIFIED
window_sizeFFT window size
hop_sizeHop size for overlap-add
Returns
Spectrally inverted data

Definition at line 362 of file SpectralHelper.hpp.

365{
366 auto [target_data, structure_info] = OperationHelper::extract_structured_double(input);
367
368 auto processor = [](Eigen::VectorXcd& spectrum, size_t) {
369 std::ranges::transform(spectrum, spectrum.begin(),
370 [](const std::complex<double>& bin) { return std::conj(bin); });
371 };
372
373 for (auto& span : target_data) {
374 auto result = process_spectral_windows(span, window_size, hop_size, processor);
375 std::ranges::copy(result, span.begin());
376 }
377
378 auto reconstructed_data = target_data
379 | std::views::transform([](const auto& span) {
380 return std::vector<double>(span.begin(), span.end());
381 })
382 | std::ranges::to<std::vector>();
383
384 return OperationHelper::reconstruct_from_double<DataType>(reconstructed_data, structure_info);
385}

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

+ Here is the call graph for this function: