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

◆ get_value_impl()

void MayaFlux::Kakshya::VideoStreamContainer::get_value_impl ( const std::vector< uint64_t > &  coords,
void *  out,
const std::type_info &  type 
) const
overrideprotectedvirtual

Type-erased single-element read.

Implementations copy the native element at coords into out if type matches their native type, otherwise no-op. out points to a caller-owned buffer of exactly sizeof(native type) bytes.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 761 of file VideoStreamContainer.cpp.

763{
764 if (coords.size() < 4 || m_data.empty())
765 return;
766
767 const uint64_t frame = coords[0];
768 const uint64_t y = coords[1];
769 const uint64_t x = coords[2];
770 const uint64_t c = coords[3];
771
772 if (frame >= m_num_frames || y >= m_height || x >= m_width || c >= m_channels)
773 return;
774
775 const size_t slot = (m_ring_capacity == 0) ? frame : slot_for(frame);
776 if (m_ring_capacity != 0
777 && m_slot_frame[slot].load(std::memory_order_acquire) != frame)
778 return;
779
780 const size_t idx = slot * get_frame_element_count()
781 + (y * m_width + x) * m_channels
782 + c;
783
784 if (type == typeid(float)) {
785 *static_cast<float*>(out) = static_cast<float>(
787 return;
788 }
789 if (type == typeid(double)) {
790 *static_cast<double*>(out) = read_normalized_at(m_data[0], m_format, component_range(), idx);
791 return;
792 }
793 if (type == typeid(uint8_t) && storage_element_size(m_format) == 1) {
794 if (const auto* v = std::get_if<std::vector<uint8_t>>(&m_data[0]); v && idx < v->size())
795 *static_cast<uint8_t*>(out) = (*v)[idx];
796 return;
797 }
798 if (type == typeid(uint16_t) && storage_element_size(m_format) == 2) {
799 if (const auto* v = std::get_if<std::vector<uint16_t>>(&m_data[0]); v && idx < v->size())
800 *static_cast<uint16_t*>(out) = (*v)[idx];
801 }
802}
vk::PhysicalDeviceType type
Definition VKDevice.cpp:146
std::vector< std::atomic< uint64_t > > m_slot_frame
std::optional< DataDimension::ValueRange > component_range() const
Value range declared on the component dimension, if any.
size_t get_frame_element_count() const
Elements in one frame: width * height * channels.
uint32_t slot_for(uint64_t frame_index) const
size_t storage_element_size(ImageFormat format)
double read_normalized_at(const DataVariant &v, ImageFormat format, const std::optional< DataDimension::ValueRange > &range, size_t elem_index)

References component_range(), get_frame_element_count(), m_channels, m_data, m_format, m_height, m_num_frames, m_ring_capacity, m_slot_frame, m_width, MayaFlux::Kakshya::read_normalized_at(), slot_for(), MayaFlux::Kakshya::storage_element_size(), and type.

+ Here is the call graph for this function: