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

◆ extract_structured_native()

template<OperationReadyData T>
requires (!detail::is_composite_operation_data_v<T>)
static std::tuple< std::vector< Kakshya::DataSpanVariant >, DataStructureInfo > MayaFlux::Yantra::OperationHelper::extract_structured_native ( T &  compute_data)
inlinestatic

Extract native-typed channel spans and structure metadata from a Datum or direct ComputeData, without double coercion.

Mirrors extract_structured_double in structure: same DataStructureInfo population, same Datum unwrapping, same container handling for RegionLike types. The only difference is that channel data is returned as DataSpanVariant (type-erased native span) rather than span<double>.

Use this as the entry point for Kinesis::Vision operations and any other pipeline that must preserve the source's native element type (uint8_t pixel data, uint16_t depth, float HDR, etc.).

For RegionLike data types the region variants are returned as DataSpanVariant via extract_native_data(DataVariant), consistent with the non-region overloads.

Callers branch on DataSpanVariant::element_type() or use FrameView::as<E>() / DataSpanVariant::get_if<span<const E>>() when the native type is statically known.

Template Parameters
TOperationReadyData type.
Parameters
compute_dataDatum or direct ComputeData to extract from.
Returns
Tuple of [native channel spans, DataStructureInfo].
Exceptions
std::runtime_errorif a container is required but absent.

Definition at line 583 of file OperationHelper.hpp.

584 {
585 if constexpr (is_IO<T>::value) {
586 DataStructureInfo info {};
587 info.original_type = std::type_index(typeid(std::decay_t<decltype(compute_data.data)>));
588 info.dimensions = compute_data.dimensions;
589 info.modality = compute_data.modality;
590
591 if constexpr (RequiresContainer<std::decay_t<decltype(compute_data.data)>>) {
592 if (!compute_data.has_container()) {
593 error<std::runtime_error>(
596 std::source_location::current(),
597 "Container is required for region-like data extraction but not provided");
598 }
599
600 const auto region_variants = [&]() -> std::vector<Kakshya::DataVariant> {
601 if constexpr (std::is_same_v<std::decay_t<decltype(compute_data.data)>, Kakshya::Region>) {
602 return compute_data.container.value()->get_region_data(compute_data.data);
603 } else if constexpr (std::is_same_v<std::decay_t<decltype(compute_data.data)>, Kakshya::RegionGroup>) {
604 return compute_data.container.value()->get_region_group_data(compute_data.data);
605 } else {
606 return compute_data.container.value()->get_segments_data(compute_data.data);
607 }
608 }();
609 return { extract_native_data(region_variants), info };
610 } else {
611 auto spans = extract_native_data(compute_data.data);
612 return { std::move(spans), info };
613 }
614 } else {
615 DataStructureInfo info {};
616 info.original_type = std::type_index(typeid(T));
617 auto spans = extract_native_data(compute_data);
618 auto [dimensions, modality] = infer_structure(compute_data);
619 info.dimensions = dimensions;
620 info.modality = modality;
621 return { std::move(spans), info };
622 }
623 }
static Kakshya::DataSpanVariant extract_native_data(const Kakshya::DataVariant &variant)
Extract a single DataVariant as a type-erased span without conversion.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
static std::pair< std::vector< Kakshya::DataDimension >, Kakshya::DataModality > infer_structure(const T &data, const std::shared_ptr< Kakshya::SignalSourceContainer > &container=nullptr)
Infer dimensions and modality from any ComputeData type.

References MayaFlux::Yantra::DataStructureInfo::original_type.