Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h

Issue 1982183002: Pull out the PostFilter to its own NonlinearBeamformer API (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h
diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h
index b8953b0a4f8d2d4c1e0083b8de7cba0c37e80dc5..73fc3784662a122336b76bd8ec07742cd3ab44f5 100644
--- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h
+++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h
@@ -26,6 +26,8 @@
namespace webrtc {
+class PostFilterTransform;
+
// Enhances sound sources coming directly in front of a uniform linear array
// and suppresses sound sources coming from all other directions. Operates on
// multichannel signals and produces single-channel output.
@@ -35,6 +37,7 @@ namespace webrtc {
class NonlinearBeamformer
: public Beamformer<float>,
public LappedTransform::Callback {
+ friend class PostFilterTransform;
public:
static const float kHalfBeamWidthRadians;
@@ -53,6 +56,14 @@ class NonlinearBeamformer
// ChannelBuffer can be passed in as |input| and |output|.
void ProcessChunk(const ChannelBuffer<float>& input,
ChannelBuffer<float>* output) override;
+ // Applies the postfilter mask to one chunk of audio. The audio is expected to
peah-webrtc 2016/05/22 21:06:48 I think that this description is longer than requi
aluebs-webrtc 2016/05/26 01:04:45 I personally think adding more documentation than
peah-webrtc 2016/05/26 08:48:52 Great!
+ // be split into frequency bands inside the ChannelBuffer. The number of
+ // frames must correspond to the constructor parameters and the number of
+ // channels is expected to be 1, since that is the output number of channels
+ // of ProcessChunk(). The same ChannelBuffer can be passed in as |input| and
+ // |output|.
+ void PostFilter(const ChannelBuffer<float>& input,
+ ChannelBuffer<float>* output) override;
void AimAt(const SphericalPointf& target_direction) override;
@@ -116,8 +127,11 @@ class NonlinearBeamformer
// Compute the means needed for the above frequency correction.
float MaskRangeMean(size_t start_bin, size_t end_bin);
- // Applies both sets of masks to |input| and store in |output|.
- void ApplyMasks(const complex_f* const* input, complex_f* const* output);
+ // Applies delay-and-sum mask to |input| and store in |output|.
+ void ApplyDelayAndSum(const complex_f* const* input,
+ complex_f* const* output);
+ // Applies post-filter mask to |input| and store in |output|.
+ void ApplyPostFilter(const complex_f* input, complex_f* output);
void EstimateTargetPresence();
@@ -126,7 +140,8 @@ class NonlinearBeamformer
// Deals with the fft transform and blocking.
size_t chunk_length_;
- std::unique_ptr<LappedTransform> lapped_transform_;
+ std::unique_ptr<LappedTransform> process_transform_;
+ std::unique_ptr<LappedTransform> postfilter_transform_;
float window_[kFftSize];
// Parameters exposed to the user.
@@ -186,6 +201,7 @@ class NonlinearBeamformer
// For processing the high-frequency input signal.
float high_pass_postfilter_mask_;
+ float old_high_pass_mask_;
// True when the target signal is present.
bool is_target_present_;

Powered by Google App Engine
This is Rietveld 408576698