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

◆ regions_around_positions()

std::vector< std::pair< size_t, size_t > > MayaFlux::Kinesis::Discrete::regions_around_positions ( const std::vector< size_t > &  positions,
size_t  half_region,
size_t  data_size 
)

Build [start, end) intervals centred on a set of positions.

Parameters
positionsSample indices of region centres
half_regionRadius in samples on each side
data_sizeTotal span length for clamping
Returns
One [start, end) pair per position

Definition at line 52 of file Extract.cpp.

56{
57 std::vector<std::pair<size_t, size_t>> out;
58 out.reserve(positions.size());
59 for (size_t pos : positions) {
60 const size_t s = (pos >= half_region) ? pos - half_region : 0;
61 const size_t e = std::min(pos + half_region, data_size);
62 if (s < e)
63 out.emplace_back(s, e);
64 }
65 return out;
66}

Referenced by MayaFlux::Yantra::extract_onsets(), MayaFlux::Yantra::extract_peaks(), and MayaFlux::Yantra::extract_zero_crossings().

+ Here is the caller graph for this function: