| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef MODULES_AUDIO_PROCESSING_AEC3_ALIGNMENT_MIXER_H_ |
| 12 |
#define MODULES_AUDIO_PROCESSING_AEC3_ALIGNMENT_MIXER_H_ |
| 13 |
|
| 14 |
#include <vector> |
| 15 |
|
| 16 |
#include "api/array_view.h" |
| 17 |
#include "api/audio/echo_canceller3_config.h" |
| 18 |
#include "modules/audio_processing/aec3/aec3_common.h" |
| 19 |
|
| 20 |
namespace webrtc { |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
class AlignmentMixer { |
| 26 |
public: |
| 27 |
AlignmentMixer(size_t num_channels, |
| 28 |
const EchoCanceller3Config::Delay::AlignmentMixing& config); |
| 29 |
|
| 30 |
AlignmentMixer(size_t num_channels, |
| 31 |
bool downmix, |
| 32 |
bool adaptive_selection, |
| 33 |
float excitation_limit, |
| 34 |
bool prefer_first_two_channels); |
| 35 |
|
| 36 |
void ProduceOutput(rtc::ArrayView<const std::vector<float>> x, |
| 37 |
rtc::ArrayView<float, kBlockSize> y); |
| 38 |
|
| 39 |
enum class MixingVariant { kDownmix, kAdaptive, kFixed }; |
| 40 |
|
| 41 |
private: |
| 42 |
const size_t num_channels_; |
| 43 |
const float one_by_num_channels_; |
| 44 |
const float excitation_energy_threshold_; |
| 45 |
const bool prefer_first_two_channels_; |
| 46 |
const MixingVariant selection_variant_; |
| 47 |
std::array<size_t, 2> strong_block_counters_; |
| 48 |
std::vector<float> cumulative_energies_; |
| 49 |
int selected_channel_ = 0; |
| 50 |
size_t block_counter_ = 0; |
| 51 |
|
| 52 |
void Downmix(const rtc::ArrayView<const std::vector<float>> x, |
| 53 |
rtc::ArrayView<float, kBlockSize> y) const; |
| 54 |
int SelectChannel(rtc::ArrayView<const std::vector<float>> x); |
| 55 |
}; |
| 56 |
} |
| 57 |
|
| 58 |
#endif |