Skip to content

Commit

Permalink
addresed requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
spran180 committed Jul 22, 2024
1 parent 302b1cc commit 47cbf38
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/internal_modules/roc_core/mov_histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@ template <typename T> class MovHistogram {
T oldest_value = ring_buffer_.front();
ring_buffer_.pop_front();
size_t oldest_bin_index = get_bin_index_(oldest_value);
if (oldest_bin_index >= 0
&& static_cast<size_t>(oldest_bin_index) < num_bins_) {
bins_[static_cast<size_t>(oldest_bin_index)]--;
if (oldest_bin_index < num_bins_) {
bins_[oldest_bin_index]--;
}
}

ring_buffer_.push_back(value);
size_t new_bin_index = get_bin_index_(value);
if (new_bin_index >= 0 && static_cast<size_t>(new_bin_index) < num_bins_) {
bins_[static_cast<size_t>(new_bin_index)]++;
if (new_bin_index < num_bins_) {
bins_[new_bin_index]++;
}
}

Expand All @@ -85,7 +84,6 @@ template <typename T> class MovHistogram {
private:
//! returns the bin index for a given value
size_t get_bin_index_(const T& value) const {

T clamped_value = value;

if (clamped_value < value_range_min_) {
Expand Down

0 comments on commit 47cbf38

Please sign in to comment.