Nagram/TMessagesProj/jni/webrtc/modules/audio_processing/aec3/frame_blocker.h

51 lines
1.7 KiB
C
Raw Normal View History

2019-06-04 10:14:50 +00:00
/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_
#define MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_
#include <stddef.h>
2020-08-14 16:58:22 +00:00
2019-06-04 10:14:50 +00:00
#include <vector>
#include "api/array_view.h"
#include "modules/audio_processing/aec3/aec3_common.h"
namespace webrtc {
2020-08-14 16:58:22 +00:00
// Class for producing 64 sample multiband blocks from frames consisting of 2
// subframes of 80 samples.
2019-06-04 10:14:50 +00:00
class FrameBlocker {
public:
2020-08-14 16:58:22 +00:00
FrameBlocker(size_t num_bands, size_t num_channels);
2019-06-04 10:14:50 +00:00
~FrameBlocker();
2020-08-14 16:58:22 +00:00
FrameBlocker(const FrameBlocker&) = delete;
FrameBlocker& operator=(const FrameBlocker&) = delete;
2019-06-04 10:14:50 +00:00
// Inserts one 80 sample multiband subframe from the multiband frame and
// extracts one 64 sample multiband block.
void InsertSubFrameAndExtractBlock(
2020-08-14 16:58:22 +00:00
const std::vector<std::vector<rtc::ArrayView<float>>>& sub_frame,
std::vector<std::vector<std::vector<float>>>* block);
2019-06-04 10:14:50 +00:00
// Reports whether a multiband block of 64 samples is available for
// extraction.
bool IsBlockAvailable() const;
// Extracts a multiband block of 64 samples.
2020-08-14 16:58:22 +00:00
void ExtractBlock(std::vector<std::vector<std::vector<float>>>* block);
2019-06-04 10:14:50 +00:00
private:
const size_t num_bands_;
2020-08-14 16:58:22 +00:00
const size_t num_channels_;
std::vector<std::vector<std::vector<float>>> buffer_;
2019-06-04 10:14:50 +00:00
};
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_AEC3_FRAME_BLOCKER_H_