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 661 of file VideoStreamContainer.cpp.

665{
666 if (type != typeid(uint8_t) || coords.size() < 4 || m_data.empty())
667 return;
668
669 auto* pixels = std::get_if<std::vector<uint8_t>>(&m_data[0]);
670 if (!pixels)
671 return;
672
673 const uint64_t frame = coords[0];
674 const uint64_t y = coords[1];
675 const uint64_t x = coords[2];
676 const uint64_t c = coords[3];
677
678 if (frame >= m_num_frames || y >= m_height || x >= m_width || c >= m_channels)
679 return;
680
681 const size_t idx = (frame * m_height * m_width * m_channels)
682 + (y * m_width * m_channels)
683 + (x * m_channels)
684 + c;
685
686 if (idx >= pixels->size())
687 return;
688
689 (*pixels)[idx] = *static_cast<const uint8_t*>(in);
690}
const std::vector< float > * pixels
Definition Decoder.cpp:65

References m_channels, m_data, m_height, m_num_frames, m_width, and pixels.