|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Time-domain descriptors of every channel, run on the GPU. More...
#include <WaveformAnalyzer.hpp>
Classes | |
| struct | ChunkMeasures |
| struct | WordPass |
Public Types | |
| using | base_type = Analyzer<InputType, OutputType> |
| using | input_type = Datum<InputType> |
| using | output_type = Datum<OutputType> |
| using | supports = Supports<WaveformAnalyzerConfig> |
| Public Types inherited from MayaFlux::Yantra::Analyzer< InputType, OutputType > | |
| using | base_type = ComputeOperation<InputType, OutputType> |
| using | input_type = Datum<InputType> |
| using | output_type = Datum<OutputType> |
| Public Types inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType > | |
| using | input_type = Datum<InputType> |
| using | output_type = Datum<OutputType> |
Public Member Functions | |
| WaveformAnalysis | analyze_waveform (const input_type &data) |
| Type-safe waveform analysis. | |
| WaveformAnalysis | analyze_waveform (const InputType &data) |
| ConfigRefs | configs () const override |
| The base view of the config structs this operation holds. | |
| AnalysisType | get_analysis_type () const override |
| Gets the analysis type category for this analyzer. | |
| std::string | get_name () const override |
| Get operation name for debugging/introspection. | |
| WaveformAnalysis | get_waveform_analysis () const |
| WaveformAnalyzer (WaveformAnalyzerConfig config={}) | |
| Construct a waveform analyzer from its settings. | |
| Public Member Functions inherited from MayaFlux::Yantra::Analyzer< InputType, OutputType > | |
| std::vector< std::any > | analyze_batch (const std::vector< input_type > &inputs) |
| Batch analysis for multiple inputs. | |
| std::vector< std::any > | analyze_batch (const std::vector< InputType > &inputs) |
| std::any | analyze_data (const input_type &data) |
| User-facing analysis method - returns analysis results directly. | |
| std::any | analyze_data (const InputType &data) |
| std::any | get_current_analysis () const |
| Access cached analysis from last operation. | |
| OperationType | get_operation_type () const override |
| Returns the category of this operation for grammar and registry discovery. | |
| bool | has_current_analysis () const |
| Check if analysis has been performed. | |
| bool | validate_input (const input_type &input) const override |
| Validates input data meets analyzer requirements. | |
| virtual | ~Analyzer ()=default |
| Public Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType > | |
| void | add_dependency (std::shared_ptr< ComputeOperation > dep) |
| output_type | apply_operation (const input_type &input) |
| Public synchronous execution interface. | |
| output_type | apply_operation_with_dependencies (const input_type &input) |
| Applies the operation with dependencies resolved. | |
| OutputType | apply_to_data (const InputType &data) |
| Convenience overload that extracts just the data from result. | |
| ComputeOperation () | |
| Constructor with data type validation warnings. | |
| template<typename Config> requires std::derived_from<Config, OperationConfig> | |
| const Config & | config () const |
| The stored config struct of type Config, or its defaults when none was set. | |
| output_type | execute (const input_type &input) |
| OpUnit interface - operations can act as units in dependency graphs. | |
| const auto & | get_dependencies () const |
| const ExecutionContext & | get_last_execution_context () const |
| void | merge_config (const Facets &incoming) |
Adds the config structs of incoming, replacing stored ones of the same type. | |
| output_type | operator() (const InputType &data) |
| Convenience overload for direct data processing (backward compatibility). | |
| template<typename Config> requires std::derived_from<Config, OperationConfig> | |
| const Config * | resolved_config () const |
| The stored config struct of type Config, or nullptr when absent. | |
| template<typename Config> requires std::derived_from<Config, OperationConfig> | |
| void | set_config (Config config) |
| Stores a config struct, whole, under its own type. | |
| void | set_last_execution_context (const ExecutionContext &ctx) |
| void | set_post_execution_hook (const OperationHookCallback &hook) |
| void | set_pre_execution_hook (const OperationHookCallback &hook) |
| void | set_reconstruction_callback (const ReconstructionCallback &callback) |
| template<typename... Configs> | |
| ConfigRefs | stored_configs (Supports< Configs... >) const |
| The stored configs among those listed, in listed order. | |
| virtual | ~ComputeOperation ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
Static Public Member Functions | |
| static float | fitness (const input_type &) |
| One while a device is up, zero otherwise. | |
Static Public Attributes | |
| static constexpr Target | target = targets::vulkan |
Protected Member Functions | |
| output_type | analyze_implementation (const input_type &input) override |
| Pure virtual analysis implementation - derived classes implement this. | |
| Protected Member Functions inherited from MayaFlux::Yantra::Analyzer< InputType, OutputType > | |
| virtual output_type | apply_granularity_formatting (const output_type &raw_output) |
| Output formatting by granularity (override for custom formatting). | |
| output_type | operation_function (const input_type &input) override |
| Core analysis implementation - must be overridden by derived classes. | |
| template<typename AnalysisResultType> | |
| void | store_current_analysis (AnalysisResultType &&result) const |
| virtual bool | validate_analysis_input (const input_type &) const |
| Input validation (override for custom validation logic). | |
| Protected Member Functions inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType > | |
| output_type | apply_hooks (const input_type &input, const ExecutionContext &context) |
| virtual std::future< output_type > | apply_operation_async (const input_type &input) |
| Optional async implementation - default delegates to operation_function. | |
| virtual output_type | apply_operation_chained (const input_type &input, const ExecutionContext &ctx) |
| Optional chain-aware implementation - default delegates to operation_function. | |
| virtual output_type | apply_operation_internal (const input_type &input, const ExecutionContext &context) |
| Internal execution method - ComputeMatrix can access this. | |
| virtual output_type | apply_operation_parallel (const input_type &input, const ExecutionContext &ctx) |
| Optional parallel-aware implementation - default delegates to operation_function. | |
| 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. | |
Private Member Functions | |
| void | append_windows (ChannelWaveform &out, size_t first, size_t count, uint32_t min_lag, const WaveformAnalyzerConfig &cfg, const ChunkMeasures &m) const |
| void | ensure_contexts () const |
| void | ensure_native () const |
| void | measure_chunk (ChannelWaveform &out, std::span< const double > samples, size_t first, size_t count, uint32_t min_lag, uint32_t max_lag, const WaveformAnalyzerConfig &cfg) const |
| void | measure_chunk_native (ChannelWaveform &out, std::span< const double > samples, size_t first, size_t count, uint32_t min_lag, uint32_t max_lag, const WaveformAnalyzerConfig &cfg) const |
| void | upload_chunk (std::span< const double > chunk) const |
Static Private Member Functions | |
| template<typename Context> | |
| static std::vector< double > | collect (Context &context) |
| static void | derive_changes (ChannelWaveform &out) |
| static std::vector< double > | download_lagged (WordPass &pass, size_t windows, uint32_t lag_count) |
| static uint32_t | longest_lag (const WaveformAnalyzerConfig &cfg) |
| static WordPass | make_lagged (Portal::Graphics::PairMap map, bool centred) |
| static WordPass | make_select () |
| static WindowedKernelShape | native_shape () noexcept |
| static void | record_lagged (WordPass &pass, const SegmentGeometry &geometry, uint32_t first_lag, uint32_t lag_count) |
| static void | select_values (ChannelWaveform &out, WaveformMethod method) |
| static uint32_t | shortest_lag (const WaveformAnalyzerConfig &cfg) |
| static void | validate_config (const WaveformAnalyzerConfig &cfg) |
Private Attributes | |
| WordPass | m_correlation |
| WordPass | m_crossings |
| WordPass | m_distance |
| std::unique_ptr< SegmentedReductionContext > | m_energy |
| std::unique_ptr< ShaderExecutionContext<> > | m_native |
| GpuComputeConfig | m_native_config |
| std::unique_ptr< SegmentedReductionContext > | m_peak |
| std::shared_ptr< GpuDispatchRecorder > | m_recording |
| WordPass | m_select |
| std::unique_ptr< SegmentedReductionContext > | m_sum |
| WordPass | m_zero |
Static Private Attributes | |
| static constexpr size_t | k_chunk_windows = 4096 |
| static constexpr uint32_t | k_native_lanes = 128 |
| static constexpr uint32_t | k_native_outputs = 7 |
| static constexpr uint32_t | k_row_binding = 1 |
| static constexpr double | k_strength_ceiling = 1.0 - 1e-12 |
| static constexpr uint32_t | k_values_binding = 0 |
| static constexpr double | k_variance_floor = 1e-12 |
Additional Inherited Members | |
| Protected Attributes inherited from MayaFlux::Yantra::Analyzer< InputType, OutputType > | |
| std::any | m_current_analysis |
| std::optional< output_type > | m_current_output |
| Protected Attributes inherited from MayaFlux::Yantra::ComputeOperation< InputType, OutputType > | |
| ExecutionContext | m_last_execution_context |
Time-domain descriptors of every channel, run on the GPU.
Measures the shape of the waveform: its level and extremes, how often it changes sign, and at what lag, and how strongly, it repeats. It makes no claim about what the signal is. A sung note, a bowed string and a fan hum all repeat, so deciding that a sound is voice or speech is left to operations built on top of this one.
Six device passes (energy, sum, peak, sign changes, centred correlation and optionally mean difference) read one shared upload of the chunk, and a selection pass picks the best lag from the correlation row on the device. The row is downloaded only with keep_profiles. They are recorded into one command buffer and submitted once per chunk of windows. The method picks which descriptor becomes the output data; all of them are always in the analysis. Sums run in emulated double arithmetic on word pairs, so results agree with the Kinesis references (Discrete::rms, mean, peak, zero_crossing_rate and periodicity) to rounding and the device needs no float64. The profiles are the full autocorrelation and mean difference rows a model can read, not only the lag they reduce to; to_tensor hands them over as a tensor. A channel shorter than one window gives no windows.
The set of descriptors is a starting point and is expected to grow. It is a distinct operation on the vulkan target and has no CPU twin.
Definition at line 265 of file WaveformAnalyzer.hpp.