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

◆ processing_function()

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

Download the current GPU image, run the VisionSequence, store the result.

No-op if the buffer has expired or the image is unavailable.

Parameters
bufferThe GpuImageSource buffer to read from.

Implements MayaFlux::Buffers::BufferProcessor.

Definition at line 108 of file ImageCVProcessor.hpp.

109 {
110 if (m_skipped_frames < m_eval_delta - 1) {
112 return;
113 }
115
116 auto typed = m_buffer.lock();
117 if (!typed)
118 return;
119
120 auto image = resolve_gpu_image(*typed);
121 if (!image || !image->is_initialized())
122 return;
123
124 m_is_processing.store(true, std::memory_order_release);
125
128 if (!frame.empty()) {
130 m_sequence, frame,
131 image->get_width(), image->get_height());
132 }
133 } else {
134 auto pass = m_executor->run(
136 image->get_width(), image->get_height());
137
138 if (!pass.is_ready()) {
139 m_is_processing.store(false, std::memory_order_release);
140 return;
141 }
142
143 m_result = std::move(pass);
144 }
145
146 if (m_result_source)
147 m_result_source->signal(m_result);
148
149 m_is_processing.store(false, std::memory_order_release);
150 }
IO::ImageData image
Definition Decoder.cpp:47
Kinesis::Vision::VisionSequence m_sequence
std::shared_ptr< Vruta::BroadcastSource< Kinesis::Vision::VisionResult > > m_result_source
std::unique_ptr< Yantra::VisionGpuExecutor > m_executor
Kinesis::Vision::VisionResult m_result
std::shared_ptr< VKBuffer > m_gpu_staging
Kinesis::Vision::VisionExecutor m_cpu_executor
VisionResult run(const VisionSequence &sequence, std::span< const float > frame, uint32_t w, uint32_t h)
Execute a VisionSequence on one frame.
std::shared_ptr< Core::VKImage > resolve_gpu_image(const T &buffer)
Resolve the GPU-resident image from any GpuImageSource buffer.
std::span< const float > download_and_normalise(const std::shared_ptr< Core::VKImage > &image, std::vector< uint8_t > &raw_staging, std::vector< float > &work, const std::shared_ptr< VKBuffer > &gpu_staging)
Download a VKImage to CPU and return a normalised float span.
@ CPU
Execute the sequence with the Kinesis host executor.
VisionBackend backend
Backend used for every step.
Definition VisionOp.hpp:383

References MayaFlux::Kinesis::Vision::VisionSequence::backend, MayaFlux::Kinesis::Vision::CPU, MayaFlux::Buffers::download_and_normalise(), image, MayaFlux::Buffers::ImageCVProcessor< T >::m_buffer, MayaFlux::Buffers::ImageCVProcessor< T >::m_cpu_executor, MayaFlux::Buffers::ImageCVProcessor< T >::m_eval_delta, MayaFlux::Buffers::ImageCVProcessor< T >::m_executor, MayaFlux::Buffers::ImageCVProcessor< T >::m_float_work, MayaFlux::Buffers::ImageCVProcessor< T >::m_gpu_staging, MayaFlux::Buffers::ImageCVProcessor< T >::m_is_processing, MayaFlux::Buffers::ImageCVProcessor< T >::m_raw_staging, MayaFlux::Buffers::ImageCVProcessor< T >::m_result, MayaFlux::Buffers::ImageCVProcessor< T >::m_result_source, MayaFlux::Buffers::ImageCVProcessor< T >::m_sequence, MayaFlux::Buffers::ImageCVProcessor< T >::m_skipped_frames, MayaFlux::Buffers::resolve_gpu_image(), and MayaFlux::Kinesis::Vision::VisionExecutor::run().

+ Here is the call graph for this function: