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

◆ swap_components()

void MayaFlux::IO::Detail::swap_components ( std::span< std::byte > data,
size_t component_bytes )
noexcept

Reverse the byte order of every component in place.

Definition at line 59 of file TensorCodec.cpp.

60{
61 if (component_bytes <= 1)
62 return;
63 for (size_t offset = 0; offset + component_bytes <= data.size(); offset += component_bytes)
64 std::reverse(data.begin() + static_cast<std::ptrdiff_t>(offset),
65 data.begin() + static_cast<std::ptrdiff_t>(offset + component_bytes));
66}
size_t component_bytes(Kakshya::TensorDType dtype) noexcept
Bytes of one independently ordered component of an element.

References component_bytes().

Referenced by encode_npy(), MayaFlux::IO::NpyReader::read(), MayaFlux::IO::NpzReader::read(), MayaFlux::IO::RawTensorReader::read(), MayaFlux::IO::SafetensorsReader::read(), and MayaFlux::IO::SafetensorsWriter::write().

Here is the call graph for this function:
Here is the caller graph for this function: