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

Unified Diff: webrtc/modules/audio_processing/beamformer/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/beamformer.h
diff --git a/webrtc/modules/audio_processing/beamformer/beamformer.h b/webrtc/modules/audio_processing/beamformer/beamformer.h
index 6a9ff45d129e14d84676db9b068b414f26850c54..61225a052b8801537b31225095d0c430d9f5b5dd 100644
--- a/webrtc/modules/audio_processing/beamformer/beamformer.h
+++ b/webrtc/modules/audio_processing/beamformer/beamformer.h
@@ -28,6 +28,23 @@ class Beamformer {
virtual void ProcessChunk(const ChannelBuffer<T>& input,
ChannelBuffer<T>* output) = 0;
+ // Applies the postfilter mask to one chunk of audio. The audio is expected to
+ // 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|.
+ virtual void PostFilter(const ChannelBuffer<float>& input,
peah-webrtc 2016/05/22 21:06:48 Why not change this to have one input/output param
peah-webrtc 2016/05/22 21:06:48 Is there a reason why this is not implemented in t
aluebs-webrtc 2016/05/26 01:04:45 Beamformer is an interface, it has no .cc file.
aluebs-webrtc 2016/05/26 01:04:45 To be consistent with the ProcessChunk interface a
peah-webrtc 2016/05/26 08:48:52 My skills on this are limited, but to me, an inter
aluebs-webrtc 2016/05/28 03:00:00 It already is not a pure interface, because IsInBe
peah-webrtc 2016/05/30 11:49:25 Do you mean that there are more beamformers that u
aluebs-webrtc 2016/06/01 00:16:34 At this point there is only the non-linear Beamfor
peah-webrtc 2016/06/01 14:51:01 If there are no other beamformer solutions that sh
aluebs-webrtc 2016/06/01 22:13:20 I think we should keep the code scalable, speciall
+ ChannelBuffer<float>* output) {
+ for (size_t i = 0u; i < input.num_channels(); ++i) {
+ for (size_t j = 0u; j < input.num_bands(); ++j) {
+ memcpy(output->channels(j)[i],
+ input.channels(j)[i],
+ input.num_frames_per_band() * sizeof(output->channels(j)[i][0]));
+ }
+ }
+ };
+
// Sample rate corresponds to the lower band.
// Needs to be called before the the Beamformer can be used.
virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0;

Powered by Google App Engine
This is Rietveld 408576698