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

◆ weights_for()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Eigen::MatrixXd>
std::vector< double > MayaFlux::Yantra::SpectralAnalyzer< InputType, OutputType >::weights_for ( const SpectralAnalyzerConfig & cfg)
inlinestaticprivate

Rows of weights: total, first moment, then one row per band.

Definition at line 322 of file SpectralAnalyzer.hpp.

323 {
324 const size_t bins = static_cast<size_t>(cfg.window_size) / 2 + 1;
325 const size_t bands = cfg.band_edges.size() - 1;
327 for (size_t k = 0; k < bins; ++k) {
328 const double fraction = static_cast<double>(k) / static_cast<double>(bins - 1);
329 weights[k] = 1.0;
330 weights[bins + k] = static_cast<double>(k);
331 for (size_t b = 0; b < bands; ++b) {
332 const bool last = b + 1 == bands;
333 if (fraction >= cfg.band_edges[b] && (fraction < cfg.band_edges[b + 1] || (last && fraction <= cfg.band_edges[b + 1]))) {
334 weights[(2 + b) * bins + k] = 1.0;
335 }
336 }
337 }
338 return weights;
339 }
Windowed spectral descriptors of every channel, run on the GPU.

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

Here is the caller graph for this function: