peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_ |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 13 | |
| 14 | #include <stddef.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 16 | #include <vector> |
| 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "api/array_view.h" |
| 19 | #include "modules/audio_processing/aec3/aec3_common.h" |
Gustaf Ullberg | d3ead1a | 2022-05-23 10:39:53 +0200 | [diff] [blame] | 20 | #include "modules/audio_processing/aec3/block.h" |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
Per Åhgren | ce202a0 | 2019-09-02 17:01:19 +0200 | [diff] [blame] | 24 | // Class for producing 64 sample multiband blocks from frames consisting of 2 |
| 25 | // subframes of 80 samples. |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 26 | class FrameBlocker { |
| 27 | public: |
Per Åhgren | ce202a0 | 2019-09-02 17:01:19 +0200 | [diff] [blame] | 28 | FrameBlocker(size_t num_bands, size_t num_channels); |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 29 | ~FrameBlocker(); |
Per Åhgren | ce202a0 | 2019-09-02 17:01:19 +0200 | [diff] [blame] | 30 | FrameBlocker(const FrameBlocker&) = delete; |
| 31 | FrameBlocker& operator=(const FrameBlocker&) = delete; |
| 32 | |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 33 | // Inserts one 80 sample multiband subframe from the multiband frame and |
| 34 | // extracts one 64 sample multiband block. |
| 35 | void InsertSubFrameAndExtractBlock( |
Per Åhgren | ce202a0 | 2019-09-02 17:01:19 +0200 | [diff] [blame] | 36 | const std::vector<std::vector<rtc::ArrayView<float>>>& sub_frame, |
Gustaf Ullberg | d3ead1a | 2022-05-23 10:39:53 +0200 | [diff] [blame] | 37 | Block* block); |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 38 | // Reports whether a multiband block of 64 samples is available for |
| 39 | // extraction. |
| 40 | bool IsBlockAvailable() const; |
| 41 | // Extracts a multiband block of 64 samples. |
Gustaf Ullberg | d3ead1a | 2022-05-23 10:39:53 +0200 | [diff] [blame] | 42 | void ExtractBlock(Block* block); |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | const size_t num_bands_; |
Per Åhgren | ce202a0 | 2019-09-02 17:01:19 +0200 | [diff] [blame] | 46 | const size_t num_channels_; |
| 47 | std::vector<std::vector<std::vector<float>>> buffer_; |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 48 | }; |
| 49 | } // namespace webrtc |
| 50 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 51 | #endif // MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_ |