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

◆ process()

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

Applies a computational transformation to the data in the provided buffer.

Parameters
bufferBuffer to transform

This is the main transformation method that must be implemented by all concrete processor classes. It applies the processor's algorithm to the data in the buffer, potentially modifying it in-place or generating derived information. The processor has full agency over how the transformation is executed, including:

  • Backend Selection: Choosing between CPU, GPU, or specialized hardware backends
  • Execution Strategy: Sequential vs parallel processing based on data characteristics
  • Memory Management: Optimizing data layout and access patterns for performance
  • Resource Utilization: Leveraging available hardware acceleration when beneficial

The method works seamlessly with any data type supported by the buffer interface, automatically adapting to audio samples, video frames, texture data, or other specialized buffer contents while maintaining type safety through the buffer abstraction. This method calls the core processing function defined in derived classes, with atomic thread-safe management of processing state to ensure that concurrent access does not lead to race conditions or data corruption.

Definition at line 8 of file BufferProcessor.cpp.

9{
10 if (!buffer->try_acquire_processing()) {
12 "Buffer is already being processed, skipping processor");
13 return;
14 }
15
16 m_active_processing.fetch_add(1, std::memory_order_acquire);
17
18 try {
19 processing_function(buffer);
20 } catch (...) {
21 buffer->release_processing();
22 m_active_processing.fetch_sub(1, std::memory_order_release);
23 throw;
24 }
25
26 buffer->release_processing();
27 m_active_processing.fetch_sub(1, std::memory_order_release);
28}
#define MF_RT_ERROR(comp, ctx,...)
std::atomic< size_t > m_active_processing
virtual void processing_function(const std::shared_ptr< Buffer > &buffer)=0
The core processing function that must be implemented by derived classes.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_active_processing, MF_RT_ERROR, and processing_function().

+ Here is the call graph for this function: