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

◆ detect_data_dimensions() [1/3]

std::vector< Kakshya::DataDimension > MayaFlux::Kakshya::detect_data_dimensions ( const DataVariant data)

Detect data dimensions from a DataVariant.

Parameters
dataDataVariant to analyze
Returns
Vector of DataDimension descriptors

This function analyzes the structure of the provided DataVariant and extracts dimension information, including size, stride, and semantic roles.

Definition at line 308 of file DataUtils.cpp.

309{
310 MF_WARN(Journal::Component::Kakshya, Journal::Context::Runtime,
311 "{}\n{}\n{}\n{}",
312 "Inferring structure from single DataVariant is not advisable as the method makes naive assumptions that can lead to massive computational errors. "
313 "If the variant is part of a container, region, or segment, please use the appropriate method instead. "
314 "If the variant is part of a vector, please use infer_from_data_variant_vector instead. "
315 "If you are sure you want to proceed, please ignore this warning.");
316
317 return std::visit([](const auto& vec) -> std::vector<DataDimension> {
318 using ValueType = typename std::decay_t<decltype(vec)>::value_type;
319
320 std::vector<DataDimension> dims;
321
322 if constexpr (DecimalData<ValueType>) {
323 dims.emplace_back(DataDimension::time(vec.size()));
324
325 } else if constexpr (ComplexData<ValueType>) {
326 dims.emplace_back(DataDimension::frequency(vec.size()));
327
328 } else if constexpr (IntegerData<ValueType>) {
329 dims.emplace_back(DataDimension::spatial(vec.size(), 'x'));
330 } else if constexpr (GlmData<ValueType>) {
331 constexpr size_t components = glm_component_count<ValueType>();
332 DataDimension::Role role = DataDimension::Role::CUSTOM;
333
334 if constexpr (GlmVec2Type<ValueType>) {
335 role = DataDimension::Role::UV;
336 } else if constexpr (GlmVec3Type<ValueType>) {
337 role = DataDimension::Role::POSITION;
338 } else if constexpr (GlmVec4Type<ValueType>) {
339 role = DataDimension::Role::COLOR;
340 } else if constexpr (GlmMatrixType<ValueType>) {
341 role = DataDimension::Role::CUSTOM;
342 }
343
344 dims.push_back(DataDimension::grouped(
345 "glm_structured_data",
346 static_cast<uint64_t>(vec.size()),
347 static_cast<uint8_t>(components),
348 role));
349 } else {
350 dims.emplace_back(DataDimension::time(vec.size()));
351 }
352
353 return dims;
354 },
355 data);
356}
#define MF_WARN(comp, ctx,...)

References MayaFlux::Kakshya::DataDimension::COLOR, MayaFlux::Kakshya::DataDimension::CUSTOM, MayaFlux::Kakshya::DataDimension::frequency(), MayaFlux::Kakshya::DataDimension::grouped(), MayaFlux::Journal::Kakshya, MF_WARN, MayaFlux::Kakshya::DataDimension::POSITION, MayaFlux::Journal::Runtime, MayaFlux::Kakshya::DataDimension::spatial(), MayaFlux::Kakshya::DataDimension::time(), and MayaFlux::Kakshya::DataDimension::UV.

Referenced by MayaFlux::Yantra::infer_from_data_variant(), and MayaFlux::Yantra::infer_from_data_variant_vector().

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