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

◆ on_attach()

template<GpuImageSource T>
void MayaFlux::Buffers::ImageCVProcessor< T >::on_attach ( const std::shared_ptr< Buffer > &  buffer)
inlineoverridevirtual

Validate the buffer type and reset executor state.

Throws std::invalid_argument if the buffer cannot be cast to T. Called automatically by BufferProcessingChain::add_processor.

Parameters
bufferThe Buffer to attach to.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 57 of file ImageCVProcessor.hpp.

58 {
59 auto typed = std::dynamic_pointer_cast<T>(buffer);
60 if (!typed) {
61 error<std::invalid_argument>(
64 std::source_location::current(),
65 "ImageCVProcessor<T>: buffer is not the expected type");
66 }
67 m_buffer = typed;
68
69 if (m_force_cpu) {
71 } else {
72 if (!m_executor) {
73 m_executor = std::make_unique<Yantra::VisionGpuExecutor>();
74 }
75 }
76
77 if (!m_gpu_staging) {
78 constexpr size_t k_max_frame_bytes = 3840 * 2160 * 4;
79 m_gpu_staging = create_image_staging_buffer(k_max_frame_bytes);
80 }
81
83 "ImageCVProcessor attached");
84 }
#define MF_INFO(comp, ctx,...)
std::unique_ptr< Yantra::VisionGpuExecutor > m_executor
std::shared_ptr< VKBuffer > m_gpu_staging
Kinesis::Vision::VisionExecutor m_cpu_executor
void reset()
Clear stored inter-frame state.
std::shared_ptr< VKBuffer > create_image_staging_buffer(size_t size)
Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of...
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_image_staging_buffer(), MayaFlux::Buffers::ImageCVProcessor< T >::m_buffer, MayaFlux::Buffers::ImageCVProcessor< T >::m_cpu_executor, MayaFlux::Buffers::ImageCVProcessor< T >::m_executor, MayaFlux::Buffers::ImageCVProcessor< T >::m_force_cpu, MayaFlux::Buffers::ImageCVProcessor< T >::m_gpu_staging, MF_INFO, and MayaFlux::Kinesis::Vision::VisionExecutor::reset().

+ Here is the call graph for this function: