OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 156 matching lines...) Loading... |
167 double LoudnessHistogram::AudioContent() const { | 167 double LoudnessHistogram::AudioContent() const { |
168 return audio_content_q10_ / kProbQDomain; | 168 return audio_content_q10_ / kProbQDomain; |
169 } | 169 } |
170 | 170 |
171 LoudnessHistogram* LoudnessHistogram::Create() { | 171 LoudnessHistogram* LoudnessHistogram::Create() { |
172 return new LoudnessHistogram; | 172 return new LoudnessHistogram; |
173 } | 173 } |
174 | 174 |
175 LoudnessHistogram* LoudnessHistogram::Create(int window_size) { | 175 LoudnessHistogram* LoudnessHistogram::Create(int window_size) { |
176 if (window_size < 0) | 176 if (window_size < 0) |
177 return NULL; | 177 return nullptr; |
178 return new LoudnessHistogram(window_size); | 178 return new LoudnessHistogram(window_size); |
179 } | 179 } |
180 | 180 |
181 void LoudnessHistogram::Reset() { | 181 void LoudnessHistogram::Reset() { |
182 // Reset the histogram, audio-content and number of updates. | 182 // Reset the histogram, audio-content and number of updates. |
183 memset(bin_count_q10_, 0, sizeof(bin_count_q10_)); | 183 memset(bin_count_q10_, 0, sizeof(bin_count_q10_)); |
184 audio_content_q10_ = 0; | 184 audio_content_q10_ = 0; |
185 num_updates_ = 0; | 185 num_updates_ = 0; |
186 // Empty the circular buffer. | 186 // Empty the circular buffer. |
187 buffer_index_ = 0; | 187 buffer_index_ = 0; |
(...skipping 32 matching lines...) Loading... |
220 p = static_cast<double>(bin_count_q10_[n]) * p_total_inverse; | 220 p = static_cast<double>(bin_count_q10_[n]) * p_total_inverse; |
221 mean_val += p * kHistBinCenters[n]; | 221 mean_val += p * kHistBinCenters[n]; |
222 } | 222 } |
223 } else { | 223 } else { |
224 mean_val = kHistBinCenters[0]; | 224 mean_val = kHistBinCenters[0]; |
225 } | 225 } |
226 return mean_val; | 226 return mean_val; |
227 } | 227 } |
228 | 228 |
229 } // namespace webrtc | 229 } // namespace webrtc |
OLD | NEW |