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

◆ process()

void MayaFlux::Kakshya::VisionProcessor::process ( const std::shared_ptr< SignalSourceContainer > &  container)
overridevirtual

Execute the VisionSequence on processed_data[0].

No-op when processed_data is empty, the pixel span normalises to empty, or geometry was not cached at on_attach time.

Parameters
containerThe container to read processed_data[0] from.

Implements MayaFlux::Kakshya::DataProcessor.

Definition at line 74 of file VisionProcessor.cpp.

75{
76 if (m_width == 0 || m_height == 0 || !container)
77 return;
78
79 m_is_processing.store(true, std::memory_order_release);
80
82 std::span<const float> frame;
83 if (auto vc = std::dynamic_pointer_cast<VideoStreamContainer>(container)) {
84 frame = vc->processed_frame_as_float(0);
85 vc->invalidate_float_frame_cache(0);
86 } else if (auto wc = std::dynamic_pointer_cast<WindowContainer>(container)) {
87 frame = wc->processed_frame_as_float(0);
88 wc->invalidate_float_frame_cache(0);
89 } else if (auto tc = std::dynamic_pointer_cast<TextureContainer>(container)) {
90 frame = tc->as_normalised_float(0);
91 }
92
93 if (!frame.empty())
95 } else if (m_gpu_frame) {
96 if (m_executor->is_suspended()) {
98 if (!poll.is_ready()) {
99 m_is_processing.store(false, std::memory_order_release);
100 return;
101 }
102 m_result = std::move(poll);
103 } else if (const void* raw = container->get_raw_data()) {
105 loom.upload_data(m_gpu_frame, raw, m_gpu_frame->get_size_bytes(), m_upload_staging);
106
107 auto pass = m_executor->run(m_sequence, m_gpu_frame, m_width, m_height);
108 if (!pass.is_ready()) {
109 m_is_processing.store(false, std::memory_order_release);
110 return;
111 }
112 m_result = std::move(pass);
113 }
114 }
115
116 if (m_result_source)
117 m_result_source->signal(m_result);
118
119 m_is_processing.store(false, std::memory_order_release);
120}
std::shared_ptr< Buffers::VKBuffer > m_upload_staging
Kinesis::Vision::VisionExecutor m_cpu_executor
std::shared_ptr< Vruta::BroadcastSource< Kinesis::Vision::VisionResult > > m_result_source
Kinesis::Vision::VisionSequence m_sequence
std::unique_ptr< Yantra::VisionGpuExecutor > m_executor
std::shared_ptr< Core::VKImage > m_gpu_frame
Kinesis::Vision::VisionResult m_result
VisionResult run(const VisionSequence &sequence, std::span< const float > frame, uint32_t w, uint32_t h)
Execute a VisionSequence on one frame.
@ 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::Portal::Graphics::TextureLoom::instance(), m_cpu_executor, m_executor, m_gpu_frame, m_height, m_is_processing, m_result, m_result_source, m_sequence, m_upload_staging, m_width, and MayaFlux::Kinesis::Vision::VisionExecutor::run().

+ Here is the call graph for this function: