MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / get_gap_segments

Function get_gap_segments

src/models/sortformer_diar/postprocess.cpp:64–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 return kept;
63}
64
65std::vector<SecondSpan> get_gap_segments(const std::vector<SecondSpan> & segments) {
66 if (segments.size() <= 1) {
67 return {};
68 }
69 std::vector<SecondSpan> sorted = segments;
70 std::sort(sorted.begin(), sorted.end(), [](const SecondSpan & lhs, const SecondSpan & rhs) {
71 if (lhs.start != rhs.start) {
72 return lhs.start < rhs.start;
73 }
74 return lhs.end < rhs.end;
75 });
76 std::vector<SecondSpan> gaps;
77 gaps.reserve(sorted.size() - 1);
78 for (size_t i = 0; i + 1 < sorted.size(); ++i) {
79 gaps.push_back({sorted[i].end, sorted[i + 1].start});
80 }
81 return gaps;
82}
83
84std::vector<SecondSpan> subtract_segments(

Callers 1

apply_vad_filteringFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected