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

Side by Side 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: Change Beamformer::ProcessChunk() to have one parameter Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
13 13
14 #include "webrtc/common_audio/channel_buffer.h" 14 #include "webrtc/common_audio/channel_buffer.h"
15 #include "webrtc/modules/audio_processing/beamformer/array_util.h" 15 #include "webrtc/modules/audio_processing/beamformer/array_util.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 template<typename T> 19 template<typename T>
20 class Beamformer { 20 class Beamformer {
21 public: 21 public:
22 virtual ~Beamformer() {} 22 virtual ~Beamformer() {}
23 23
24 // Process one time-domain chunk of audio. The audio is expected to be split 24 // Process one time-domain chunk of audio. The audio is expected to be split
25 // into frequency bands inside the ChannelBuffer. The number of frames and 25 // into frequency bands inside the ChannelBuffer. The number of frames and
26 // channels must correspond to the constructor parameters. The same 26 // channels must correspond to the constructor parameters.
27 // ChannelBuffer can be passed in as |input| and |output|. 27 virtual void ProcessChunk(ChannelBuffer<T>* data) = 0;
28 virtual void ProcessChunk(const ChannelBuffer<T>& input, 28
29 ChannelBuffer<T>* output) = 0; 29 // Applies the postfilter mask to one chunk of audio. The audio is expected to
30 // be split into frequency bands inside the ChannelBuffer. The number of
31 // frames must correspond to the constructor parameters and the number of
32 // channels is expected to be 1, since that is the output number of channels
33 // of ProcessChunk().
34 virtual void PostFilter(ChannelBuffer<float>* data) {};
30 35
31 // Sample rate corresponds to the lower band. 36 // Sample rate corresponds to the lower band.
32 // Needs to be called before the the Beamformer can be used. 37 // Needs to be called before the the Beamformer can be used.
33 virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0; 38 virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0;
34 39
35 // Aim the beamformer at a point in space. 40 // Aim the beamformer at a point in space.
36 virtual void AimAt(const SphericalPointf& spherical_point) = 0; 41 virtual void AimAt(const SphericalPointf& spherical_point) = 0;
37 42
38 // Indicates whether a given point is inside of the beam. 43 // Indicates whether a given point is inside of the beam.
39 virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; } 44 virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; }
40 45
41 // Returns true if the current data contains the target signal. 46 // Returns true if the current data contains the target signal.
42 // Which signals are considered "targets" is implementation dependent. 47 // Which signals are considered "targets" is implementation dependent.
43 virtual bool is_target_present() = 0; 48 virtual bool is_target_present() = 0;
44 }; 49 };
45 50
46 } // namespace webrtc 51 } // namespace webrtc
47 52
48 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_ 53 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698