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

◆ validate_config()

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

Definition at line 296 of file SpectralAnalyzer.hpp.

297 {
298 const auto fail = [](std::string_view message) {
301 };
302 if (cfg.window_size < 2 || cfg.window_size > 2048 || (cfg.window_size & (cfg.window_size - 1)) != 0) {
303 fail("Window size must be a power of two from 2 to 2048");
304 }
305 if (cfg.hop_size == 0) {
306 fail("Hop size must be greater than 0");
307 }
308 if (cfg.band_edges.size() < 2) {
309 fail("At least two band edges are needed");
310 }
311 for (size_t i = 0; i < cfg.band_edges.size(); ++i) {
312 const double edge = cfg.band_edges[i];
313 if (std::isnan(edge) || edge < 0.0 || edge > 1.0 || (i > 0 && edge <= cfg.band_edges[i - 1])) {
314 fail("Band edges must ascend strictly within 0 to 1");
315 }
316 }
317 }
Windowed spectral descriptors of every channel, run on the GPU.