Make the high frequency correction range depend on the target angle
Depends on this CL: https://codereview.webrtc.org/1388033002/ Review URL: https://codereview.webrtc.org/1395453004 Cr-Commit-Position: refs/heads/master@{#10331}
This commit is contained in:
@ -61,11 +61,6 @@ const float kMaskFrequencySmoothAlpha = 0.6f;
|
|||||||
const int kLowMeanStartHz = 200;
|
const int kLowMeanStartHz = 200;
|
||||||
const int kLowMeanEndHz = 400;
|
const int kLowMeanEndHz = 400;
|
||||||
|
|
||||||
// TODO(aluebs): Make the high frequency correction range depend on the target
|
|
||||||
// angle.
|
|
||||||
const int kHighMeanStartHz = 3000;
|
|
||||||
const int kHighMeanEndHz = 5000;
|
|
||||||
|
|
||||||
// Range limiter for subtractive terms in the nominator and denominator of the
|
// Range limiter for subtractive terms in the nominator and denominator of the
|
||||||
// postfilter expression. It handles the scenario mismatch between the true and
|
// postfilter expression. It handles the scenario mismatch between the true and
|
||||||
// model sources (target and interference).
|
// model sources (target and interference).
|
||||||
@ -207,25 +202,7 @@ void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) {
|
|||||||
chunk_length_ =
|
chunk_length_ =
|
||||||
static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms));
|
static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms));
|
||||||
sample_rate_hz_ = sample_rate_hz;
|
sample_rate_hz_ = sample_rate_hz;
|
||||||
low_mean_start_bin_ = Round(kLowMeanStartHz * kFftSize / sample_rate_hz_);
|
InitFrequencyCorrectionRanges();
|
||||||
low_mean_end_bin_ = Round(kLowMeanEndHz * kFftSize / sample_rate_hz_);
|
|
||||||
high_mean_start_bin_ = Round(kHighMeanStartHz * kFftSize / sample_rate_hz_);
|
|
||||||
high_mean_end_bin_ = Round(kHighMeanEndHz * kFftSize / sample_rate_hz_);
|
|
||||||
// These bin indexes determine the regions over which a mean is taken. This
|
|
||||||
// is applied as a constant value over the adjacent end "frequency correction"
|
|
||||||
// regions.
|
|
||||||
//
|
|
||||||
// low_mean_start_bin_ high_mean_start_bin_
|
|
||||||
// v v constant
|
|
||||||
// |----------------|--------|----------------|-------|----------------|
|
|
||||||
// constant ^ ^
|
|
||||||
// low_mean_end_bin_ high_mean_end_bin_
|
|
||||||
//
|
|
||||||
RTC_DCHECK_GT(low_mean_start_bin_, 0U);
|
|
||||||
RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_);
|
|
||||||
RTC_DCHECK_LT(low_mean_end_bin_, high_mean_end_bin_);
|
|
||||||
RTC_DCHECK_LT(high_mean_start_bin_, high_mean_end_bin_);
|
|
||||||
RTC_DCHECK_LT(high_mean_end_bin_, kNumFreqBins - 1);
|
|
||||||
|
|
||||||
high_pass_postfilter_mask_ = 1.f;
|
high_pass_postfilter_mask_ = 1.f;
|
||||||
is_target_present_ = false;
|
is_target_present_ = false;
|
||||||
@ -261,6 +238,37 @@ void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NonlinearBeamformer::InitFrequencyCorrectionRanges() {
|
||||||
|
const float kAliasingFreqHz =
|
||||||
|
kSpeedOfSoundMeterSeconds /
|
||||||
|
(min_mic_spacing_ * (1.f + std::abs(std::cos(kTargetAngleRadians))));
|
||||||
|
const float kHighMeanStartHz = std::min(0.5f * kAliasingFreqHz,
|
||||||
|
sample_rate_hz_ / 2.f);
|
||||||
|
const float kHighMeanEndHz = std::min(0.75f * kAliasingFreqHz,
|
||||||
|
sample_rate_hz_ / 2.f);
|
||||||
|
|
||||||
|
low_mean_start_bin_ = Round(kLowMeanStartHz * kFftSize / sample_rate_hz_);
|
||||||
|
low_mean_end_bin_ = Round(kLowMeanEndHz * kFftSize / sample_rate_hz_);
|
||||||
|
high_mean_start_bin_ = Round(kHighMeanStartHz * kFftSize / sample_rate_hz_);
|
||||||
|
high_mean_end_bin_ = Round(kHighMeanEndHz * kFftSize / sample_rate_hz_);
|
||||||
|
// These bin indexes determine the regions over which a mean is taken. This
|
||||||
|
// is applied as a constant value over the adjacent end "frequency correction"
|
||||||
|
// regions.
|
||||||
|
//
|
||||||
|
// low_mean_start_bin_ high_mean_start_bin_
|
||||||
|
// v v constant
|
||||||
|
// |----------------|--------|----------------|-------|----------------|
|
||||||
|
// constant ^ ^
|
||||||
|
// low_mean_end_bin_ high_mean_end_bin_
|
||||||
|
//
|
||||||
|
RTC_DCHECK_GT(low_mean_start_bin_, 0U);
|
||||||
|
RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_);
|
||||||
|
RTC_DCHECK_LT(low_mean_end_bin_, high_mean_end_bin_);
|
||||||
|
RTC_DCHECK_LT(high_mean_start_bin_, high_mean_end_bin_);
|
||||||
|
RTC_DCHECK_LT(high_mean_end_bin_, kNumFreqBins - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NonlinearBeamformer::InitInterfAngles() {
|
void NonlinearBeamformer::InitInterfAngles() {
|
||||||
const float kAwayRadians =
|
const float kAwayRadians =
|
||||||
std::min(static_cast<float>(M_PI),
|
std::min(static_cast<float>(M_PI),
|
||||||
|
@ -66,6 +66,7 @@ class NonlinearBeamformer
|
|||||||
typedef ComplexMatrix<float> ComplexMatrixF;
|
typedef ComplexMatrix<float> ComplexMatrixF;
|
||||||
typedef complex<float> complex_f;
|
typedef complex<float> complex_f;
|
||||||
|
|
||||||
|
void InitFrequencyCorrectionRanges();
|
||||||
void InitInterfAngles();
|
void InitInterfAngles();
|
||||||
void InitDelaySumMasks();
|
void InitDelaySumMasks();
|
||||||
void InitTargetCovMats();
|
void InitTargetCovMats();
|
||||||
|
Reference in New Issue
Block a user