mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 15:47:40 +02:00
add some comments to PacketTimeWindow
This commit is contained in:
parent
71b2d90c64
commit
1c176e55ed
1 changed files with 4 additions and 0 deletions
|
@ -51,6 +51,7 @@ int32_t meanOfMedianFilteredValues(std::vector<int> intervals, int numValues, in
|
||||||
// grab the median value of the intervals vector
|
// grab the median value of the intervals vector
|
||||||
int intervalsMedian = median(intervals.begin(), intervals.end());
|
int intervalsMedian = median(intervals.begin(), intervals.end());
|
||||||
|
|
||||||
|
// figure out our bounds for median filtering
|
||||||
static const int MEDIAN_FILTERING_BOUND_MULTIPLIER = 8;
|
static const int MEDIAN_FILTERING_BOUND_MULTIPLIER = 8;
|
||||||
int upperBound = intervalsMedian * MEDIAN_FILTERING_BOUND_MULTIPLIER;
|
int upperBound = intervalsMedian * MEDIAN_FILTERING_BOUND_MULTIPLIER;
|
||||||
int lowerBound = intervalsMedian / MEDIAN_FILTERING_BOUND_MULTIPLIER;
|
int lowerBound = intervalsMedian / MEDIAN_FILTERING_BOUND_MULTIPLIER;
|
||||||
|
@ -58,6 +59,7 @@ int32_t meanOfMedianFilteredValues(std::vector<int> intervals, int numValues, in
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
// sum the values that are inside the median filtered bounds
|
||||||
for (auto& interval : intervals) {
|
for (auto& interval : intervals) {
|
||||||
if ((interval < upperBound) && (interval > lowerBound)) {
|
if ((interval < upperBound) && (interval > lowerBound)) {
|
||||||
++count;
|
++count;
|
||||||
|
@ -65,7 +67,9 @@ int32_t meanOfMedianFilteredValues(std::vector<int> intervals, int numValues, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure we hit our threshold of values required
|
||||||
if (count >= valuesRequired) {
|
if (count >= valuesRequired) {
|
||||||
|
// return the frequency (per second) for the mean interval
|
||||||
static const double USECS_PER_SEC = 1000000.0;
|
static const double USECS_PER_SEC = 1000000.0;
|
||||||
return (int32_t) ceil(USECS_PER_SEC / (((double) sum) / ((double) count)));
|
return (int32_t) ceil(USECS_PER_SEC / (((double) sum) / ((double) count)));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue