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< DataVariant >.
Definition at line 761 of file VideoStreamContainer.cpp.
763{
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
773 return;
774
777 &&
m_slot_frame[slot].load(std::memory_order_acquire) != frame)
778 return;
779
782 + c;
783
784 if (
type ==
typeid(
float)) {
785 *
static_cast<float*
>(
out) =
static_cast<float>(
787 return;
788 }
789 if (
type ==
typeid(
double)) {
791 return;
792 }
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 }
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}
std::vector< float > * out
std::vector< glm::ivec3 > coords
vk::PhysicalDeviceType type
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.
std::vector< DataVariant > m_data
uint32_t slot_for(uint64_t frame_index) const
size_t storage_element_size(ImageFormat format)
Byte width of the DataVariant element backing a given ImageFormat.
double read_normalized_at(const DataVariant &v, ImageFormat format, const std::optional< DataDimension::ValueRange > &range, size_t elem_index)
Read one element as a normalised double, with optional range remapping.
References component_range(), coords, get_frame_element_count(), m_channels, m_data, m_format, m_height, m_num_frames, m_ring_capacity, m_slot_frame, m_width, out, MayaFlux::Kakshya::read_normalized_at(), slot_for(), MayaFlux::Kakshya::storage_element_size(), and type.