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

◆ image_at() [1/2]

std::shared_ptr< Core::VKImage > MayaFlux::Kakshya::WindowContainer::image_at ( uint32_t  frame_index) const

Refresh the cached VKImage for m_data[frame_index].

Parameters
frame_indexIndex into m_data in [0, frame_capacity).

Definition at line 215 of file WindowContainer.cpp.

216{
217 if (frame_index >= m_data.size()) {
219 "WindowContainer::to_image({}) : out of range (capacity={})",
220 frame_index, m_frame_capacity);
221 return nullptr;
222 }
223
224 const uint64_t written = m_frames_written.load(std::memory_order_acquire);
225 const uint32_t head = m_write_head.load(std::memory_order_acquire);
226 const bool ring_full = written >= m_frame_capacity;
227
228 if (!ring_full && frame_index >= head) {
230 "WindowContainer::image_at({}) : frame index is ahead of write head ({}), data may be stale or uninitialized",
231 frame_index, head);
232 return nullptr;
233 }
234
235 auto pixels = snapshot_pixels(frame_index);
236 if (!pixels)
237 return nullptr;
238
239 const auto format = get_image_format();
240 Memory::SerializedSeqlockWriteGuard image_guard(m_image_cache_lock);
242 m_frame_images[frame_index], sampled_image_key(pixels->width, pixels->height, format),
243 pixels->pixels);
244}
#define MF_RT_WARN(comp, ctx,...)
const std::vector< float > * pixels
Definition Decoder.cpp:48
bool format
std::optional< PixelSnapshot > snapshot_pixels(std::optional< uint32_t > frame_index=std::nullopt) const
ImageFormat get_image_format() const
Portal ImageFormat corresponding to the live swapchain surface format.
std::vector< DataVariant > m_data
std::atomic< uint64_t > m_frames_written
std::vector< Portal::Graphics::ImageCacheEntry > m_frame_images
std::shared_ptr< Core::VKImage > refresh_cached_image(ImageCacheEntry &entry, const ImageKey &key, std::span< const uint8_t > pixels, const std::shared_ptr< Buffers::VKBuffer > &staging={})
Refresh a sampled image in an owner-held cache entry.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MayaFlux::Journal::ContainerProcessing, format, get_image_format(), MayaFlux::Portal::Graphics::TextureLoom::instance(), MayaFlux::Journal::Kakshya, m_data, m_frame_capacity, m_frame_images, m_frames_written, m_image_cache_lock, m_write_head, MF_RT_WARN, pixels, MayaFlux::Portal::Graphics::TextureLoom::refresh_cached_image(), and snapshot_pixels().

+ Here is the call graph for this function: