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

◆ set_value_impl()

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

Type-erased single-element write.

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

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 804 of file VideoStreamContainer.cpp.

806{
807 if (coords.size() < 4 || m_data.empty())
808 return;
809
810 const uint64_t frame = coords[0];
811 const uint64_t y = coords[1];
812 const uint64_t x = coords[2];
813 const uint64_t c = coords[3];
814
815 if (frame >= m_num_frames || y >= m_height || x >= m_width || c >= m_channels)
816 return;
817
818 const size_t slot = (m_ring_capacity == 0) ? frame : slot_for(frame);
819 const size_t idx = slot * get_frame_element_count()
820 + (y * m_width + x) * m_channels
821 + c;
822
823 if (type == typeid(float)) {
825 static_cast<double>(*static_cast<const float*>(in)));
826 return;
827 }
828 if (type == typeid(double)) {
830 *static_cast<const double*>(in));
831 return;
832 }
833 if (type == typeid(uint8_t) && storage_element_size(m_format) == 1) {
834 if (auto* v = std::get_if<std::vector<uint8_t>>(&m_data[0]); v && idx < v->size())
835 (*v)[idx] = *static_cast<const uint8_t*>(in);
836 return;
837 }
838 if (type == typeid(uint16_t) && storage_element_size(m_format) == 2) {
839 if (auto* v = std::get_if<std::vector<uint16_t>>(&m_data[0]); v && idx < v->size())
840 (*v)[idx] = *static_cast<const uint16_t*>(in);
841 }
842}
vk::PhysicalDeviceType type
Definition VKDevice.cpp:146
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
void write_normalized_at(DataVariant &v, ImageFormat format, const std::optional< DataDimension::ValueRange > &range, size_t elem_index, double value)
size_t storage_element_size(ImageFormat format)

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

+ Here is the call graph for this function: