Per Åhgren | 398689f | 2018-08-23 11:38:27 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | |
| 11 | #ifndef MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_ |
| 13 | |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 14 | #include <stddef.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
Per Åhgren | 398689f | 2018-08-23 11:38:27 +0200 | [diff] [blame] | 16 | #include <vector> |
| 17 | |
| 18 | #include "modules/audio_processing/audio_buffer.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | // Class for applying a fixed delay to the samples in a signal partitioned using |
| 23 | // the audiobuffer band-splitting scheme. |
| 24 | class BlockDelayBuffer { |
| 25 | public: |
Per Åhgren | 260c788 | 2020-01-28 15:38:41 +0100 | [diff] [blame] | 26 | BlockDelayBuffer(size_t num_channels, |
| 27 | size_t num_bands, |
| 28 | size_t frame_length, |
| 29 | size_t delay_samples); |
Per Åhgren | 398689f | 2018-08-23 11:38:27 +0200 | [diff] [blame] | 30 | ~BlockDelayBuffer(); |
| 31 | |
| 32 | // Delays the samples by the specified delay. |
| 33 | void DelaySignal(AudioBuffer* frame); |
| 34 | |
| 35 | private: |
| 36 | const size_t frame_length_; |
| 37 | const size_t delay_; |
Per Åhgren | 260c788 | 2020-01-28 15:38:41 +0100 | [diff] [blame] | 38 | std::vector<std::vector<std::vector<float>>> buf_; |
Per Åhgren | 398689f | 2018-08-23 11:38:27 +0200 | [diff] [blame] | 39 | size_t last_insert_ = 0; |
| 40 | }; |
| 41 | } // namespace webrtc |
| 42 | |
| 43 | #endif // MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_ |