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

◆ resolve_image()

std::shared_ptr< Core::VKImage > MayaFlux::Yantra::VisionAnalyzer::resolve_image ( const std::shared_ptr< Kakshya::SignalSourceContainer > &  source,
size_t  index 
)
private

Resolve source/index to a GPU image, the same way VisionProcessor does: TextureContainer's own to_image(index) (zero-copy cache), or get_raw_data() uploaded into a persistent m_upload_image for VideoStreamContainer/ WindowContainer.

Null on an unsupported container type.

Definition at line 388 of file VisionAnalyzer.cpp.

391{
392 if (!source)
393 return nullptr;
394
395 if (auto tc = std::dynamic_pointer_cast<Kakshya::TextureContainer>(source))
396 return tc->to_image(static_cast<uint32_t>(index));
397
398 if (auto wc = std::dynamic_pointer_cast<Kakshya::WindowContainer>(source))
399 return wc->to_image();
400
401 auto vc = std::dynamic_pointer_cast<Kakshya::VideoStreamContainer>(source);
402 if (!vc)
403 return nullptr;
404
405 const uint32_t w = vc->get_width();
406 const uint32_t h = vc->get_height();
407
408 const void* raw = source->get_raw_data();
409 if (!raw)
410 return nullptr;
411
412 if (!m_upload_image || m_upload_w != w || m_upload_h != h) {
414 w, h, Portal::Graphics::ImageFormat::RGBA8, nullptr);
415 m_upload_w = w;
416 m_upload_h = h;
417 }
418 if (!m_upload_image)
419 return nullptr;
420
422 return m_upload_image;
423}
uint32_t h
Definition InkPress.cpp:29
uint32_t index
Definition VKDevice.cpp:122
void upload_data(const std::shared_ptr< Core::VKImage > &image, const void *data, size_t size)
Upload pixel data to an existing texture.
std::shared_ptr< Core::VKImage > create_2d(uint32_t width, uint32_t height, ImageFormat format=ImageFormat::RGBA8, const void *data=nullptr, uint32_t mip_levels=1)
Create a 2D texture.
std::shared_ptr< Core::VKImage > m_upload_image
Source source()
Begin a Source chain.
Definition Plot.hpp:127

References MayaFlux::Portal::Graphics::TextureLoom::create_2d(), h, index, MayaFlux::Portal::Graphics::TextureLoom::instance(), m_upload_h, m_upload_image, m_upload_w, and MayaFlux::Portal::Graphics::TextureLoom::upload_data().

Referenced by analyze_vision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: