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

◆ process()

void MayaFlux::Buffers::BufferProcessingChain::process ( const std::shared_ptr< Buffer > &  buffer)

Applies the transformation pipeline to a buffer with intelligent execution.

Parameters
bufferBuffer to transform

Applies each processor in the buffer's sequence using an optimized execution strategy. The chain leverages processor capabilities for maximum performance:

  • Backend Optimization: Uses processor-recommended backends when beneficial
  • Parallel Execution: Executes compatible processors in parallel when possible
  • Resource Management: Optimally allocates CPU, GPU, and memory resources
  • Error Handling: Provides robust error recovery and fallback mechanisms

This does not include the final processor, which must be applied separately with process_final() to ensure proper pipeline completion.

Definition at line 127 of file BufferProcessingChain.cpp.

128{
129 bool expected = false;
130 if (!m_is_processing.compare_exchange_strong(expected, true,
131 std::memory_order_acquire, std::memory_order_relaxed)) {
132 return;
133 }
134
135 if (m_pending_count.load(std::memory_order_relaxed) > 0) {
137 }
138
139 auto it = m_buffer_processors.find(buffer);
140 if (it == m_buffer_processors.end() || it->second.empty()) {
141 m_is_processing.store(false, std::memory_order_release);
142 return;
143 }
144
145 for (auto& processor : it->second) {
146 bool should_process = true;
147
149 auto processor_token = processor->get_processing_token();
150 should_process = are_tokens_compatible(m_token_filter_mask, processor_token);
151 }
152
153 if (should_process) {
154 processor->process(buffer);
155 }
156 }
157
160 }
161
162 m_is_processing.store(false, std::memory_order_release);
163}
ProcessingToken m_token_filter_mask
Preferred processing token for this chain.
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< BufferProcessor > > > m_buffer_processors
Map of buffers to their processor sequences.
void cleanup_rejected_processors(const std::shared_ptr< Buffer > &buffer)
Validates the processing token against the chain's preferred token.
void process_pending_processor_operations()
Process pending processor operations.
TokenEnforcementStrategy m_enforcement_strategy
Token enforcement strategy for this chain.
bool are_tokens_compatible(ProcessingToken preferred, ProcessingToken current)
Determines if two processing tokens are compatible for joint execution.
@ OVERRIDE_SKIP
Allows token overrides but skips processing for incompatible operations.
@ OVERRIDE_REJECT
Allows token overrides but rejects incompatible processors from chains.

References MayaFlux::Buffers::are_tokens_compatible(), cleanup_rejected_processors(), m_buffer_processors, m_enforcement_strategy, m_is_processing, m_pending_count, m_token_filter_mask, MayaFlux::Buffers::OVERRIDE_REJECT, MayaFlux::Buffers::OVERRIDE_SKIP, and process_pending_processor_operations().

+ Here is the call graph for this function: