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

◆ build_chunks()

void MayaFlux::Kinesis::CurveEvaluator::build_chunks ( Eigen::Index  num_samples,
Eigen::Index  num_segments,
Eigen::Index  active_count 
)
private

Definition at line 684 of file MotionCurves.cpp.

688{
689 const auto segments = static_cast<size_t>(num_segments);
690
691 m_seg_first.assign(segments, -1);
692 m_seg_total.assign(segments, 0);
693
694 for (Eigen::Index i = 0; i < num_samples; ++i) {
695 const double t_global = static_cast<double>(i) / static_cast<double>(num_samples - 1);
696 const double segment_float = t_global * static_cast<double>(num_segments);
697 auto seg_idx = static_cast<Eigen::Index>(std::floor(segment_float));
698
699 if (i == num_samples - 1 || seg_idx >= num_segments) {
700 seg_idx = num_segments - 1;
701 }
702
703 const auto s = static_cast<size_t>(seg_idx);
704 if (m_seg_first[s] < 0) {
705 m_seg_first[s] = i;
706 }
707 ++m_seg_total[s];
708 }
709
710 m_chunks.clear();
711
712 for (Eigen::Index seg_idx = 0; seg_idx < num_segments; ++seg_idx) {
713 const auto s = static_cast<size_t>(seg_idx);
714 if (m_seg_total[s] == 0) {
715 continue;
716 }
717
718 Eigen::Index start_col = seg_idx * (m_points_per_segment - m_overlap);
719 const bool clamp = (start_col + m_points_per_segment > active_count);
720 if (clamp) {
721 start_col = active_count - m_points_per_segment;
722 }
723
724 for (Eigen::Index off = 0; off < m_seg_total[s]; off += k_chunk_samples) {
725 m_chunks.push_back({ .segment = seg_idx,
726 .start_col = start_col,
727 .sample_begin = m_seg_first[s] + off,
728 .sample_count = std::min(k_chunk_samples, m_seg_total[s] - off),
729 .clamp_t_high = clamp });
730 }
731 }
732}
std::vector< Eigen::Index > m_seg_total
std::vector< CurveChunk > m_chunks
std::vector< Eigen::Index > m_seg_first
void clamp(std::span< double > data, double lo, double hi) noexcept
Clamp values to [lo, hi] in-place.
Definition Transform.cpp:44

References m_chunks, m_overlap, m_points_per_segment, m_seg_first, and m_seg_total.

Referenced by evaluate_planar().

+ Here is the caller graph for this function: