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

◆ get_frame()

std::span< const double > MayaFlux::Kakshya::TextureContainer::get_frame ( uint64_t  frame_index) const
overridevirtual

Returns a normalized double view of one pixel row.

Maps frame_index to row index (SPATIAL_Y). Each uint8_t sample is normalized to [0.0, 1.0]. The returned span is backed by m_frame_cache and remains valid until the next call to get_frame() or clear().

Parameters
frame_indexRow index in [0, height).
Returns
Span of width * channels doubles, or empty if out of range.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 450 of file TextureContainer.cpp.

451{
452 if (frame_index >= m_height)
453 return {};
454
455 std::shared_lock lock(m_data_mutex);
456 if (m_data.empty())
457 return {};
458
459 const size_t row_elems = static_cast<size_t>(m_width) * m_channels;
460 const size_t offset = static_cast<size_t>(frame_index) * row_elems;
461
462 m_frame_cache.resize(row_elems);
463 for (size_t i = 0; i < row_elems; ++i)
464 m_frame_cache[i] = read_normalized_at(m_data[0], m_format, offset + i);
465
466 return { m_frame_cache.data(), m_frame_cache.size() };
467}
void lock() override
Acquire a lock for thread-safe access.
Portal::Graphics::ImageFormat m_format
std::vector< double > m_frame_cache
Row cache backing the double span returned by get_frame().