9 , memory_layout(layout)
117 if (expected_roles.empty()) {
121 if (
dimensions.size() != expected_roles.size()) {
125 for (
size_t i = 0; i <
dimensions.size(); ++i) {
126 if (
dimensions[i].role != expected_roles[i]) {
148 auto it = std::ranges::find(expected_roles, role);
149 if (it != expected_roles.end()) {
150 return std::distance(expected_roles.begin(), it);
153 for (
size_t i = 0; i <
dimensions.size(); ++i) {
184 uint64_t time_size = 0;
185 uint64_t channel_size = 1;
189 time_size = dim.size;
191 channel_size = dim.size;
195 return time_size * channel_size;
241 size_t frame_size = 1;
244 frame_size *= dim.size;
DataModality
Data modality types for cross-modal analysis.
@ AUDIO_MULTICHANNEL
Multi-channel audio.
@ SPECTRAL_2D
2D spectral data (time + frequency)
@ AUDIO_1D
1D audio signal
@ UNKNOWN
Unknown or undefined modality.
@ VOLUMETRIC_3D
3D volumetric data
@ VIDEO_GRAYSCALE
3D video (time + 2D grayscale)
@ VIDEO_COLOR
4D video (time + 2D + color)
@ TENSOR_ND
N-dimensional tensor.
@ IMAGE_COLOR
2D RGB/RGBA image
@ IMAGE_2D
2D image (grayscale or single channel)
MemoryLayout
Memory layout for multi-dimensional data.
OrganizationStrategy
Data organization strategy for multi-channel/multi-frame data.
@ PLANAR
Separate DataVariant per logical unit (LLL...RRR for stereo)
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)
std::vector< DataDimension > dimensions
size_t get_frame_size() const
static ContainerDataStructure audio_planar()
Create structure for planar audio data.
uint64_t get_samples_count_per_channel() const
static ContainerDataStructure image_planar()
Create structure for planar image data.
uint64_t get_channel_count() const
uint64_t get_pixels_count() const
uint64_t get_total_elements() const
static ContainerDataStructure image_interleaved()
Create structure for interleaved image data.
std::vector< DataDimension::Role > get_expected_dimension_roles() const
Get the expected dimension roles for this structure's modality.
OrganizationStrategy organization
ContainerDataStructure()=default
size_t get_expected_variant_count(const std::vector< DataDimension > &dimensions) const
Calculate expected number of data variants for given dimensions.
bool validate_dimensions(const std::vector< DataDimension > &dimensions) const
Validate that dimensions match this structure's expectations.
static ContainerDataStructure audio_interleaved()
Create structure for interleaved audio data.
uint64_t get_height() const
uint64_t get_samples_count() const
uint64_t get_variant_size() const
uint64_t get_width() const
size_t get_frame_count() const
size_t get_dimension_index_for_role(const std::vector< DataDimension > &dimensions, DataDimension::Role role) const
Find the index of a dimension with the specified role.
Container structure for consistent dimension ordering.
Role
Semantic role of the dimension.
@ FREQUENCY
Spectral/frequency axis.
@ SPATIAL_Y
Spatial Y axis.
@ TIME
Temporal progression (samples, frames, steps)
@ SPATIAL_Z
Spatial Z axis.
@ CHANNEL
Parallel streams (audio channels, color channels)
@ SPATIAL_X
Spatial X axis (images, tensors)