Attempt to reland: Allow intelligibility to compile in apm (https://codereview.webrtc.org/1182323005/)
Revert of original: https://codereview.webrtc.org/1187033005/
Changes in original:
- Added files to gyp and BUILD
- Made minor fixes to get everything to compile
and intelligibility_proc to run
- Added comments
- Auto-reformatting
New Changes:
- Added <numeric> header to intelligibility_enhancer.cc to address buildbot errors
- Switched to use WAV for i/o in intelligibility_proc.cc to address windows errors
- clean up
Note: Patch 1 duplicates Patch 7 of https://codereview.webrtc.org/1182323005/
R=andrew@webrtc.org
Review URL: https://codereview.webrtc.org/1190733004.
Cr-Commit-Position: refs/heads/master@{#9486}
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
index 550f293..075b8ad 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
@@ -8,12 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+//
+// Specifies helper classes for intelligibility enhancement.
+//
+
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS_H_
#include <complex>
-#include "webrtc/system_wrappers/interface/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
@@ -63,14 +67,10 @@
void ApplyScale(float scale);
// The current set of variances.
- const float* variance() const {
- return variance_.get();
- }
+ const float* variance() const { return variance_.get(); }
// The mean value of the current set of variances.
- float array_mean() const {
- return array_mean_;
- }
+ float array_mean() const { return array_mean_; }
private:
void InfiniteStep(const std::complex<float>* data, bool dummy);
@@ -78,23 +78,26 @@
void WindowedStep(const std::complex<float>* data, bool dummy);
void BlockedStep(const std::complex<float>* data, bool dummy);
+ // TODO(ekmeyerson): Switch the following running means
+ // and histories from rtc::scoped_ptr to std::vector.
+
// The current average X and X^2.
- scoped_ptr<std::complex<float>[]> running_mean_;
- scoped_ptr<std::complex<float>[]> running_mean_sq_;
+ rtc::scoped_ptr<std::complex<float>[]> running_mean_;
+ rtc::scoped_ptr<std::complex<float>[]> running_mean_sq_;
// Average X and X^2 for the current block in kStepBlocked.
- scoped_ptr<std::complex<float>[]> sub_running_mean_;
- scoped_ptr<std::complex<float>[]> sub_running_mean_sq_;
+ rtc::scoped_ptr<std::complex<float>[]> sub_running_mean_;
+ rtc::scoped_ptr<std::complex<float>[]> sub_running_mean_sq_;
// Sample history for the rolling window in kStepWindowed and block-wise
// histories for kStepBlocked.
- scoped_ptr<scoped_ptr<std::complex<float>[]>[]> history_;
- scoped_ptr<scoped_ptr<std::complex<float>[]>[]> subhistory_;
- scoped_ptr<scoped_ptr<std::complex<float>[]>[]> subhistory_sq_;
+ rtc::scoped_ptr<rtc::scoped_ptr<std::complex<float>[]>[]> history_;
+ rtc::scoped_ptr<rtc::scoped_ptr<std::complex<float>[]>[]> subhistory_;
+ rtc::scoped_ptr<rtc::scoped_ptr<std::complex<float>[]>[]> subhistory_sq_;
// The current set of variances and sums for Welford's algorithm.
- scoped_ptr<float[]> variance_;
- scoped_ptr<float[]> conj_sum_;
+ rtc::scoped_ptr<float[]> variance_;
+ rtc::scoped_ptr<float[]> conj_sum_;
const int freqs_;
const int window_size_;
@@ -118,15 +121,13 @@
std::complex<float>* out_block);
// Return the current target gain set. Modify this array to set the targets.
- float* target() const {
- return target_.get();
- }
+ float* target() const { return target_.get(); }
private:
const int freqs_;
const float change_limit_;
- scoped_ptr<float[]> target_;
- scoped_ptr<float[]> current_;
+ rtc::scoped_ptr<float[]> target_;
+ rtc::scoped_ptr<float[]> current_;
};
} // namespace intelligibility
@@ -134,4 +135,3 @@
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS_H_
-