Fix error when accumulating floats in an int.
I saw this when browsing the code, I think the intended behavior is accumulating to a float. BUG=none Review-Url: https://codereview.webrtc.org/2268163004 Cr-Commit-Position: refs/heads/master@{#13918}
This commit is contained in:
@ -35,7 +35,7 @@ void UpdateAndRemoveDcLevel(float forgetting_factor,
|
|||||||
rtc::ArrayView<float> x) {
|
rtc::ArrayView<float> x) {
|
||||||
RTC_DCHECK(!x.empty());
|
RTC_DCHECK(!x.empty());
|
||||||
float mean =
|
float mean =
|
||||||
std::accumulate(x.begin(), x.end(), 0) / static_cast<float>(x.size());
|
std::accumulate(x.begin(), x.end(), 0.0f) / static_cast<float>(x.size());
|
||||||
*dc_level += forgetting_factor * (mean - *dc_level);
|
*dc_level += forgetting_factor * (mean - *dc_level);
|
||||||
|
|
||||||
for (float& v : x) {
|
for (float& v : x) {
|
||||||
|
|||||||
Reference in New Issue
Block a user