30template <GpuImageSource T>
43 m_executor = std::make_unique<Yantra::VisionGpuExecutor>();
57 void on_attach(
const std::shared_ptr<Buffer>& buffer)
override
59 auto typed = std::dynamic_pointer_cast<T>(buffer);
61 error<std::invalid_argument>(
64 std::source_location::current(),
65 "ImageCVProcessor<T>: buffer is not the expected type");
73 m_executor = std::make_unique<Yantra::VisionGpuExecutor>();
78 constexpr size_t k_max_frame_bytes = 3840 * 2160 * 4;
83 "ImageCVProcessor attached");
90 void on_detach(
const std::shared_ptr<Buffer>& )
override
128 if (!frame.empty()) {
176 [[nodiscard]] std::shared_ptr<Vruta::BroadcastSource<Kinesis::Vision::VisionResult>>
239 std::shared_ptr<Vruta::BroadcastSource<Kinesis::Vision::VisionResult>>
m_result_source;
#define MF_INFO(comp, ctx,...)
GPU execution layer for Kinesis::Vision::VisionSequence.
ProcessingToken m_processing_token
Central computational transformation interface for continuous buffer processing.
void processing_function(const std::shared_ptr< Buffer > &) override
Download the current GPU image, run the VisionSequence, store the result.
~ImageCVProcessor() override=default
Kinesis::Vision::VisionSequence m_sequence
std::shared_ptr< Vruta::BroadcastSource< Kinesis::Vision::VisionResult > > m_result_source
std::vector< float > m_float_work
std::shared_ptr< Vruta::BroadcastSource< Kinesis::Vision::VisionResult > > get_result_source()
Shared BroadcastSource signalled with each VisionResult after a successful processing_function call.
std::unique_ptr< Yantra::VisionGpuExecutor > m_executor
void set_eval_rate(uint32_t fps)
Set how often this processor actually evaluates, relative to the engine's preferred frame rate.
void on_detach(const std::shared_ptr< Buffer > &) override
Clear state and reset executor.
uint32_t get_eval_rate() const
Get the currently achieved evaluation rate in frames per second.
ImageCVProcessor(Kinesis::Vision::VisionSequence sequence, bool force_cpu=false)
Construct with the vision pipeline to execute each processing_function call.
std::atomic< bool > m_is_processing
uint32_t m_skipped_frames
Kinesis::Vision::VisionResult m_result
std::shared_ptr< VKBuffer > m_gpu_staging
const Kinesis::Vision::VisionResult & get_result() const
The result of the last successful processing_function call.
std::weak_ptr< T > m_buffer
std::vector< uint8_t > m_raw_staging
void set_sequence(Kinesis::Vision::VisionSequence sequence)
Replace the pipeline and reset inter-frame executor state.
Kinesis::Vision::VisionExecutor m_cpu_executor
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Validate the buffer type and reset executor state.
BufferProcessor executing a Kinesis::Vision pipeline on a GpuImageSource buffer.
void reset()
Clear stored inter-frame state.
VisionResult run(const VisionSequence &sequence, std::span< const float > frame, uint32_t w, uint32_t h)
Execute a VisionSequence on one frame.
Stateful executor for a VisionSequence.
Awaitable single-value broadcast channel for cross-thread signal delivery.
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...
std::shared_ptr< Core::VKImage > resolve_gpu_image(const T &buffer)
Resolve the GPU-resident image from any GpuImageSource buffer.
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
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.
uint32_t s_preferred_frame_rate
Global default frame rate.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
Result of executing a VisionSequence on one frame.
Ordered sequence of VisionSteps describing a complete vision pipeline.