Commit 4d0b848d authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

[wsola] Rename misleading "symmetric" Hanning window function.

This function actually produces a periodic Hanning window instead of a
symmetric one.

Change-Id: If921c08d990eafe3e9475de2fbf7b6a64c7879f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211363
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771085}
parent f34af30b
...@@ -272,11 +272,11 @@ int AudioRendererAlgorithm::FillBuffer(AudioBus* dest, ...@@ -272,11 +272,11 @@ int AudioRendererAlgorithm::FillBuffer(AudioBus* dest,
// chunk of memory. ~56kB for stereo 48kHz, up to ~765kB for 7.1 192kHz. // chunk of memory. ~56kB for stereo 48kHz, up to ~765kB for 7.1 192kHz.
if (!ola_window_) { if (!ola_window_) {
ola_window_.reset(new float[ola_window_size_]); ola_window_.reset(new float[ola_window_size_]);
internal::GetSymmetricHanningWindow(ola_window_size_, ola_window_.get()); internal::GetPeriodicHanningWindow(ola_window_size_, ola_window_.get());
transition_window_.reset(new float[ola_window_size_ * 2]); transition_window_.reset(new float[ola_window_size_ * 2]);
internal::GetSymmetricHanningWindow(2 * ola_window_size_, internal::GetPeriodicHanningWindow(2 * ola_window_size_,
transition_window_.get()); transition_window_.get());
// Initialize for overlap-and-add of the first block. // Initialize for overlap-and-add of the first block.
wsola_output_ = wsola_output_ =
......
...@@ -308,7 +308,7 @@ int OptimalIndex(const AudioBus* search_block, ...@@ -308,7 +308,7 @@ int OptimalIndex(const AudioBus* search_block,
energy_candidate_blocks.get()); energy_candidate_blocks.get());
} }
void GetSymmetricHanningWindow(int window_length, float* window) { void GetPeriodicHanningWindow(int window_length, float* window) {
const float scale = 2.0f * base::kPiFloat / window_length; const float scale = 2.0f * base::kPiFloat / window_length;
for (int n = 0; n < window_length; ++n) for (int n = 0; n < window_length; ++n)
window[n] = 0.5f * (1.0f - std::cos(n * scale)); window[n] = 0.5f * (1.0f - std::cos(n * scale));
......
...@@ -78,7 +78,7 @@ MEDIA_EXPORT int OptimalIndex(const AudioBus* search_block, ...@@ -78,7 +78,7 @@ MEDIA_EXPORT int OptimalIndex(const AudioBus* search_block,
// Return a "periodic" Hann window. This is the first L samples of an L+1 // Return a "periodic" Hann window. This is the first L samples of an L+1
// Hann window. It is perfect reconstruction for overlap-and-add. // Hann window. It is perfect reconstruction for overlap-and-add.
MEDIA_EXPORT void GetSymmetricHanningWindow(int window_length, float* window); MEDIA_EXPORT void GetPeriodicHanningWindow(int window_length, float* window);
} // namespace internal } // namespace internal
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment