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

◆ processing_function()

void MayaFlux::Buffers::AggregateBindingsProcessor::processing_function ( const std::shared_ptr< Buffer > &  buffer)
overridevirtual

BufferProcessor interface - uploads all aggregates.

Parameters
bufferThe buffer this processor is attached to

Implements MayaFlux::Buffers::BufferProcessor.

Definition at line 138 of file AggregateBindingsProcessor.cpp.

139{
140 if (m_aggregates.empty()) {
141 return;
142 }
143
144 auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer);
145 if (!vk_buffer) {
147 "AggregateBindingsProcessor requires VKBuffer, got different buffer type");
148 return;
149 }
150
151 for (auto& [aggregate_name, aggregate] : m_aggregates) {
152 if (aggregate.nodes.empty()) {
153 continue;
154 }
155
156 auto& target = aggregate.target_buffer ? aggregate.target_buffer : vk_buffer;
157
158 ProcessingMode mode = aggregate.processing_mode.load(std::memory_order_acquire);
159
160 for (size_t i = 0; i < aggregate.nodes.size(); ++i) {
161 if (!aggregate.nodes[i]) {
163 "Aggregate '{}' node at index {} is null", aggregate_name, i);
164 aggregate.staging_data[i] = 0.0F;
165 continue;
166 }
167
168 double value = (mode == ProcessingMode::INTERNAL)
169 ? Buffers::extract_single_sample(aggregate.nodes[i])
170 : aggregate.nodes[i]->get_last_output();
171
172 aggregate.staging_data[i] = static_cast<float>(value);
173 }
174
176 aggregate.staging_data.data(),
177 aggregate.staging_data.size() * sizeof(float),
178 target);
179 }
180}
#define MF_RT_ERROR(comp, ctx,...)
@ INTERNAL
Processor calls extract_single_sample() or processes node context.
std::unordered_map< std::string, AggregateBinding > m_aggregates
double extract_single_sample(const std::shared_ptr< Nodes::Node > &node)
Extract a single sample from a node with proper snapshot management.
void upload_to_gpu(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging)
Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::vector< double > mode(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Mode per window via tolerance-bucketed frequency count.
Definition Analysis.cpp:559

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::extract_single_sample(), INTERNAL, m_aggregates, MF_RT_ERROR, and MayaFlux::Buffers::upload_to_gpu().

+ Here is the call graph for this function: