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

◆ fill_channel()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Eigen::MatrixXd>
void MayaFlux::Yantra::SpectralAnalyzer< InputType, OutputType >::fill_channel ( ChannelSpectrum & out,
const std::vector< double > & projected,
size_t windows,
size_t rows,
size_t bands,
const SpectralAnalyzerConfig & cfg )
inlinestaticprivate

Definition at line 355 of file SpectralAnalyzer.hpp.

357 {
358 out.values.resize(windows);
359 out.band_energies.resize(windows);
360 out.window_positions.reserve(windows);
361
362 for (size_t w = 0; w < windows; ++w) {
363 const double* row = projected.data() + w * rows;
364 out.band_energies[w].assign(row + 2, row + 2 + bands);
365 const size_t start = w * cfg.hop_size;
366 out.window_positions.emplace_back(start, start + cfg.window_size);
367
368 switch (static_cast<SpectralMethod>(cfg.method)) {
370 out.values[w] = row[0] > 0.0 ? row[1] / row[0] : 0.0;
371 break;
373 double rise = 0.0;
374 if (w > 0) {
375 for (size_t b = 0; b < bands; ++b) {
376 rise += std::max(0.0, out.band_energies[w][b] - out.band_energies[w - 1][b]);
377 }
378 }
379 out.values[w] = rise;
380 break;
381 }
383 default:
384 out.values[w] = row[0];
385 break;
386 }
387 }
388 }
Windowed spectral descriptors of every channel, run on the GPU.

Referenced by MayaFlux::Yantra::SpectralAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd >::analyze_implementation().

Here is the caller graph for this function: