block_delay_buffer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_
  11. #define MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_
  12. #include <stddef.h>
  13. #include <vector>
  14. #include "modules/audio_processing/audio_buffer.h"
  15. namespace webrtc {
  16. // Class for applying a fixed delay to the samples in a signal partitioned using
  17. // the audiobuffer band-splitting scheme.
  18. class BlockDelayBuffer {
  19. public:
  20. BlockDelayBuffer(size_t num_channels,
  21. size_t num_bands,
  22. size_t frame_length,
  23. size_t delay_samples);
  24. ~BlockDelayBuffer();
  25. // Delays the samples by the specified delay.
  26. void DelaySignal(AudioBuffer* frame);
  27. private:
  28. const size_t frame_length_;
  29. const size_t delay_;
  30. std::vector<std::vector<std::vector<float>>> buf_;
  31. size_t last_insert_ = 0;
  32. };
  33. } // namespace webrtc
  34. #endif // MODULES_AUDIO_PROCESSING_AEC3_BLOCK_DELAY_BUFFER_H_