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

◆ advance_position()

bool MayaFlux::Kakshya::RegionProcessorBase::advance_position ( std::vector< uint64_t > &  position,
uint64_t  steps = 1,
const OrganizedRegion region = nullptr 
)
protectedvirtual

Advance position according to memory layout and looping.

Supports both linear and multi-dimensional advancement, and respects region-specific looping.

Parameters
positionPosition vector to advance (modified in place).
stepsNumber of steps to advance.
regionOptional region to constrain advancement.
Returns
true if position was advanced, false if at end.

Definition at line 57 of file RegionProcessorBase.cpp.

58{
59 if (position.empty())
60 return false;
61
62 for (auto& pos : position) {
63 pos += steps;
64 }
65
66 if ((region != nullptr) && region->looping_enabled && !region->loop_start.empty() && !region->loop_end.empty()) {
67 for (size_t dim = 0; dim < std::min(position.size(), region->loop_start.size()); ++dim) {
68 if (position[dim] >= region->loop_end[dim]) {
69 position[dim] = region->loop_start[dim] + (position[dim] - region->loop_end[dim]);
70 }
71 }
72 }
73
74 auto frame_count = m_structure.get_frame_count();
75 for (auto& pos : position) {
76 if (pos >= frame_count) {
77 pos = frame_count - 1;
78 return false;
79 }
80 }
81
82 return true;
83}
static size_t get_frame_count(const std::vector< DataDimension > &dimensions)
Extract frame count from video dimensions.

References MayaFlux::Kakshya::ContainerDataStructure::get_frame_count(), MayaFlux::Kakshya::OrganizedRegion::loop_end, MayaFlux::Kakshya::OrganizedRegion::loop_start, MayaFlux::Kakshya::OrganizedRegion::looping_enabled, and m_structure.

+ Here is the call graph for this function: