MayaFlux 0.5.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 109 of file ImageCVProcessor.hpp.

110 {
111 if (m_skipped_frames < m_eval_delta - 1) {
113 return;
114 }
116
117 auto typed = m_buffer.lock();
118 if (!typed)
119 return;
120
121 auto image = resolve_gpu_image(*typed);
122 if (!image || !image->is_initialized())
123 return;
124
125 m_is_processing.store(true, std::memory_order_release);
126
127 if (m_force_cpu) {
129 if (!frame.empty()) {
131 m_sequence, frame,
132 image->get_width(), image->get_height());
133 }
134 } else {
135 auto pass = m_executor->run(
137 image->get_width(), image->get_height());
138
139 if (!pass.is_ready()) {
140 m_is_processing.store(false, std::memory_order_release);
141 return;
142 }
143
144 m_result = std::move(pass);
145 }
146
147 if (m_result_source)
148 m_result_source->signal(m_result);
149
150 m_is_processing.store(false, std::memory_order_release);
151 }
IO::ImageData image
Definition Decoder.cpp:64
uint32_t pass
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.

References 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_force_cpu, 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, pass, MayaFlux::Buffers::resolve_gpu_image(), and MayaFlux::Kinesis::Vision::VisionExecutor::run().

+ Here is the call graph for this function: