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

◆ analyze_implementation()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Eigen::MatrixXd>
output_type MayaFlux::Yantra::WindowedKernelAnalyzer< InputType, OutputType >::analyze_implementation ( const input_type & input)
inlineoverrideprotectedvirtual

Pure virtual analysis implementation - derived classes implement this.

Parameters
inputInput data with metadata
Returns
Raw analysis output before granularity formatting

Implements MayaFlux::Yantra::Analyzer< InputType, OutputType >.

Definition at line 463 of file WindowedKernelAnalyzer.hpp.

464 {
465 try {
466 const auto& cfg = this->template config<WindowedKernelConfig>();
467
469 const_cast<input_type&>(input));
470
471 auto& context = this->context(cfg);
472
475
477
478 if (cfg.inputs == 1) {
479 analysis.channels.resize(data_span.size());
480 channel_values.reserve(data_span.size());
481 for (size_t channel = 0; channel < data_span.size(); ++channel) {
484 channel_values.emplace_back(analysis.channels[channel].values.begin(), analysis.channels[channel].values.end());
485 }
486 } else {
487 if (data_span.size() < cfg.inputs) {
489 std::source_location::current(), "A kernel of {} inputs needs that many channels and {} were given", cfg.inputs, data_span.size());
490 }
492 for (uint32_t input = 0; input < cfg.inputs; ++input) {
493 inputs.emplace_back(data_span[input].data(), data_span[input].size());
494 }
495 analysis.channels.resize(1);
496 analyse(context, analysis.channels[0], inputs, cfg);
497 channel_values.emplace_back(analysis.channels[0].values.begin(), analysis.channels[0].values.end());
498 }
499
501
503 output.metadata = input.metadata;
504 output.facets = input.facets;
505 output.facets.set(analysis);
506 return output;
507 } catch (const std::exception& e) {
508 MF_ERROR(Journal::Component::Yantra, Journal::Context::ComputeMatrix, "Windowed kernel analysis failed: {}", e.what());
510 error_result.metadata = input.metadata;
511 error_result.facets = input.facets;
512 return error_result;
513 }
514 }
#define MF_ERROR(comp, ctx,...)
void store_current_analysis(AnalysisResultType &&result) const
Definition Analyzer.hpp:234
const Config & config() const
The stored config struct of type Config, or its defaults when none was set.
output_type convert_result(std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
Convert processed double data back to OutputType using metadata and optional callback.
static std::tuple< NumericChannels, DataStructureInfo > extract_structured_double(T &compute_data)
Extract structured double data from Datum container or direct ComputeData with automatic container ha...
void analyse(ShaderExecutionContext<> &context, ChannelWindowedKernel &result, std::span< const std::span< const double > > inputs, const WindowedKernelConfig &cfg) const
ShaderExecutionContext & context(const WindowedKernelConfig &cfg) const
Runs a caller's compute kernel once per window of every channel.