OLD | NEW |
---|---|
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 |
(...skipping 10 matching lines...) Expand all Loading... | |
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. The same |
27 // ChannelBuffer can be passed in as |input| and |output|. | 27 // ChannelBuffer can be passed in as |input| and |output|. |
28 virtual void ProcessChunk(const ChannelBuffer<T>& input, | 28 virtual void ProcessChunk(const ChannelBuffer<T>& input, |
29 ChannelBuffer<T>* output) = 0; | 29 ChannelBuffer<T>* output) = 0; |
30 | 30 |
31 // Applies the postfilter mask to one chunk of audio. The audio is expected to | |
32 // be split into frequency bands inside the ChannelBuffer. The number of | |
33 // frames must correspond to the constructor parameters and the number of | |
34 // channels is expected to be 1, since that is the output number of channels | |
35 // of ProcessChunk(). The same ChannelBuffer can be passed in as |input| and | |
36 // |output|. | |
37 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
| |
38 ChannelBuffer<float>* output) { | |
39 for (size_t i = 0u; i < input.num_channels(); ++i) { | |
40 for (size_t j = 0u; j < input.num_bands(); ++j) { | |
41 memcpy(output->channels(j)[i], | |
42 input.channels(j)[i], | |
43 input.num_frames_per_band() * sizeof(output->channels(j)[i][0])); | |
44 } | |
45 } | |
46 }; | |
47 | |
31 // Sample rate corresponds to the lower band. | 48 // Sample rate corresponds to the lower band. |
32 // Needs to be called before the the Beamformer can be used. | 49 // Needs to be called before the the Beamformer can be used. |
33 virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0; | 50 virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0; |
34 | 51 |
35 // Aim the beamformer at a point in space. | 52 // Aim the beamformer at a point in space. |
36 virtual void AimAt(const SphericalPointf& spherical_point) = 0; | 53 virtual void AimAt(const SphericalPointf& spherical_point) = 0; |
37 | 54 |
38 // Indicates whether a given point is inside of the beam. | 55 // Indicates whether a given point is inside of the beam. |
39 virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; } | 56 virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; } |
40 | 57 |
41 // Returns true if the current data contains the target signal. | 58 // Returns true if the current data contains the target signal. |
42 // Which signals are considered "targets" is implementation dependent. | 59 // Which signals are considered "targets" is implementation dependent. |
43 virtual bool is_target_present() = 0; | 60 virtual bool is_target_present() = 0; |
44 }; | 61 }; |
45 | 62 |
46 } // namespace webrtc | 63 } // namespace webrtc |
47 | 64 |
48 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_ | 65 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_ |
OLD | NEW |