frame_blocker.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_
  11. #define MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_
  12. #include <stddef.h>
  13. #include <vector>
  14. #include "api/array_view.h"
  15. #include "modules/audio_processing/aec3/aec3_common.h"
  16. namespace webrtc {
  17. // Class for producing 64 sample multiband blocks from frames consisting of 2
  18. // subframes of 80 samples.
  19. class FrameBlocker {
  20. public:
  21. FrameBlocker(size_t num_bands, size_t num_channels);
  22. ~FrameBlocker();
  23. FrameBlocker(const FrameBlocker&) = delete;
  24. FrameBlocker& operator=(const FrameBlocker&) = delete;
  25. // Inserts one 80 sample multiband subframe from the multiband frame and
  26. // extracts one 64 sample multiband block.
  27. void InsertSubFrameAndExtractBlock(
  28. const std::vector<std::vector<rtc::ArrayView<float>>>& sub_frame,
  29. std::vector<std::vector<std::vector<float>>>* block);
  30. // Reports whether a multiband block of 64 samples is available for
  31. // extraction.
  32. bool IsBlockAvailable() const;
  33. // Extracts a multiband block of 64 samples.
  34. void ExtractBlock(std::vector<std::vector<std::vector<float>>>* block);
  35. private:
  36. const size_t num_bands_;
  37. const size_t num_channels_;
  38. std::vector<std::vector<std::vector<float>>> buffer_;
  39. };
  40. } // namespace webrtc
  41. #endif // MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_