AEC3: Fix filter output transition when input and output is the same array
This CL fixes a bug in the filter output transition when the 'from' input points to the same array as the output. It also includes a slight improvement to the transition by starting one sample earlier than previously. Bug: webrtc:9741,chromium:882789 Change-Id: Ifd5f16c1ac88a74d93499e7f4b4c0e5cb3e4976f Reviewed-on: https://webrtc-review.googlesource.com/99540 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24683}
This commit is contained in:
committed by
Commit Bot
parent
7255fef258
commit
ddb82a6b5f
@ -62,15 +62,15 @@ void SignalTransition(rtc::ArrayView<const float> from,
|
||||
rtc::ArrayView<const float> to,
|
||||
rtc::ArrayView<float> out) {
|
||||
constexpr size_t kTransitionSize = 30;
|
||||
constexpr float kOneByTransitionSize = 1.f / kTransitionSize;
|
||||
constexpr float kOneByTransitionSizePlusOne = 1.f / (kTransitionSize + 1);
|
||||
|
||||
RTC_DCHECK_EQ(from.size(), to.size());
|
||||
RTC_DCHECK_EQ(from.size(), out.size());
|
||||
RTC_DCHECK_LE(kTransitionSize, out.size());
|
||||
|
||||
for (size_t k = 0; k < kTransitionSize; ++k) {
|
||||
out[k] = k * kOneByTransitionSize * to[k];
|
||||
out[k] += (kTransitionSize - k) * kOneByTransitionSize * from[k];
|
||||
float a = (k + 1) * kOneByTransitionSizePlusOne;
|
||||
out[k] = a * to[k] + (1.f - a) * from[k];
|
||||
}
|
||||
|
||||
std::copy(to.begin() + kTransitionSize, to.end(),
|
||||
|
||||
Reference in New Issue
Block a user