Replace slave -> helper, master -> reference

A slight simplification of the NetEq code is also included.

The subtrees below common_audio, modules/audio_coding and
modules/audio_processing were scanned while making this CL.

Bug: webrtc:11680
Change-Id: I33bb1c75b2e3d1c6793fd1c5741ca59f4b6e8455
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178361
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31578}
This commit is contained in:
Henrik Lundin
2020-06-29 12:17:42 +02:00
committed by Commit Bot
parent d21f7ab174
commit 11b6f6857f
5 changed files with 25 additions and 27 deletions

View File

@ -80,7 +80,7 @@ size_t Merge::Process(int16_t* input,
if (channel == 0) {
// Downsample, correlate, and find strongest correlation period for the
// master (i.e., first) channel only.
// reference (i.e., first) channel only.
// Downsample to 4kHz sample rate.
Downsample(input_channel.get(), input_length_per_channel,
expanded_channel.get(), expanded_length);

View File

@ -43,7 +43,7 @@ TimeStretch::ReturnCodes TimeStretch::Process(const int16_t* input,
signal_len = input_len / num_channels_;
signal_array.reset(new int16_t[signal_len]);
signal = signal_array.get();
size_t j = master_channel_;
size_t j = kRefChannel;
for (size_t i = 0; i < signal_len; ++i) {
signal_array[i] = input[j];
j += num_channels_;
@ -187,7 +187,7 @@ bool TimeStretch::SpeechDetection(int32_t vec1_energy,
(static_cast<int64_t>(vec1_energy) + vec2_energy) / 16);
int32_t right_side;
if (background_noise_.initialized()) {
right_side = background_noise_.Energy(master_channel_);
right_side = background_noise_.Energy(kRefChannel);
} else {
// If noise parameters have not been estimated, use a fixed threshold.
right_side = 75000;

View File

@ -40,13 +40,11 @@ class TimeStretch {
: sample_rate_hz_(sample_rate_hz),
fs_mult_(sample_rate_hz / 8000),
num_channels_(num_channels),
master_channel_(0), // First channel is master.
background_noise_(background_noise),
max_input_value_(0) {
assert(sample_rate_hz_ == 8000 || sample_rate_hz_ == 16000 ||
sample_rate_hz_ == 32000 || sample_rate_hz_ == 48000);
assert(num_channels_ > 0);
assert(master_channel_ < num_channels_);
memset(auto_correlation_, 0, sizeof(auto_correlation_));
}
@ -86,11 +84,11 @@ class TimeStretch {
static const size_t kMaxLag = 60;
static const size_t kDownsampledLen = kCorrelationLen + kMaxLag;
static const int kCorrelationThreshold = 14746; // 0.9 in Q14.
static constexpr size_t kRefChannel = 0; // First channel is reference.
const int sample_rate_hz_;
const int fs_mult_; // Sample rate multiplier = sample_rate_hz_ / 8000.
const size_t num_channels_;
const size_t master_channel_;
const BackgroundNoise& background_noise_;
int16_t max_input_value_;
int16_t downsampled_input_[kDownsampledLen];