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

◆ process()

void MayaFlux::Buffers::BufferProcessor::process ( 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 6 of file BufferProcessor.cpp.

7{
8 if (!buffer->try_acquire_processing()) {
9 std::cerr << "Warning: Buffer already being processed, skipping processor" << std::endl;
10 return;
11 }
12
13 m_active_processing.fetch_add(1, std::memory_order_acquire);
14
15 try {
16 processing_function(buffer);
17 } catch (...) {
18 buffer->release_processing();
19 m_active_processing.fetch_sub(1, std::memory_order_release);
20 throw;
21 }
22
23 buffer->release_processing();
24 m_active_processing.fetch_sub(1, std::memory_order_release);
25}
std::atomic< size_t > m_active_processing
virtual void processing_function(std::shared_ptr< Buffer > buffer)=0
The core processing function that must be implemented by derived classes.

References m_active_processing, and processing_function().

+ Here is the call graph for this function: