Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: media/filters/wsola_internals.h

Issue 217553004: Handle near-colinear case in WSOLAS QuadraticInterpolation better. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify cases handled. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/audio_renderer_algorithm_unittest.cc ('k') | media/filters/wsola_internals.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A set of utility functions to perform WSOLA. 5 // A set of utility functions to perform WSOLA.
6 6
7 #ifndef MEDIA_FILTERS_WSOLA_INTERNALS_H_ 7 #ifndef MEDIA_FILTERS_WSOLA_INTERNALS_H_
8 #define MEDIA_FILTERS_WSOLA_INTERNALS_H_ 8 #define MEDIA_FILTERS_WSOLA_INTERNALS_H_
9 9
10 #include <utility> 10 #include <utility>
(...skipping 20 matching lines...) Expand all
31 31
32 // Energies of sliding windows of channels are interleaved. 32 // Energies of sliding windows of channels are interleaved.
33 // The number windows is |input->frames()| - (|frames_per_window| - 1), hence, 33 // The number windows is |input->frames()| - (|frames_per_window| - 1), hence,
34 // the method assumes |energy| must be, at least, of size 34 // the method assumes |energy| must be, at least, of size
35 // (|input->frames()| - (|frames_per_window| - 1)) * |input->channels()|. 35 // (|input->frames()| - (|frames_per_window| - 1)) * |input->channels()|.
36 MEDIA_EXPORT void MultiChannelMovingBlockEnergies(const AudioBus* input, 36 MEDIA_EXPORT void MultiChannelMovingBlockEnergies(const AudioBus* input,
37 int frames_per_window, 37 int frames_per_window,
38 float* energy); 38 float* energy);
39 39
40 // Fit the curve f(x) = a * x^2 + b * x + c such that 40 // Fit the curve f(x) = a * x^2 + b * x + c such that
41 // 41 // f(-1) = y[0]
42 // f(-1) = |y[0]| 42 // f(0) = y[1]
43 // f(0) = |y[1]| 43 // f(1) = y[2]
44 // f(1) = |y[2]|. 44 // and return the maximum, assuming that y[0] <= y[1] >= y[2].
45 // 45 MEDIA_EXPORT void QuadraticInterpolation(const float* y_values,
46 // Then compute the |extremum| point -b / (2*a) and |extremum_value| 46 float* extremum,
47 // b^2 / (4*a) - b^2 / (2*a) + c. 47 float* extremum_value);
48 //
49 // It is not expected that this function is called with
50 // y[0] == y[1] == y[2].
51 MEDIA_EXPORT void CubicInterpolation(const float* y_values,
52 float* extremum,
53 float* extremum_value);
54 48
55 // Search a subset of all candid blocks. The search is performed every 49 // Search a subset of all candid blocks. The search is performed every
56 // |decimation| frames. This reduces complexity by a factor of about 50 // |decimation| frames. This reduces complexity by a factor of about
57 // 1 / |decimation|. A cubic interpolation is used to have a better estimate of 51 // 1 / |decimation|. A cubic interpolation is used to have a better estimate of
58 // the best match. 52 // the best match.
59 MEDIA_EXPORT int DecimatedSearch(int decimation, 53 MEDIA_EXPORT int DecimatedSearch(int decimation,
60 Interval exclude_interval, 54 Interval exclude_interval,
61 const AudioBus* target_block, 55 const AudioBus* target_block,
62 const AudioBus* search_segment, 56 const AudioBus* search_segment,
63 const float* energy_target_block, 57 const float* energy_target_block,
(...skipping 20 matching lines...) Expand all
84 78
85 // Return a "periodic" Hann window. This is the first L samples of an L+1 79 // Return a "periodic" Hann window. This is the first L samples of an L+1
86 // Hann window. It is perfect reconstruction for overlap-and-add. 80 // Hann window. It is perfect reconstruction for overlap-and-add.
87 MEDIA_EXPORT void GetSymmetricHanningWindow(int window_length, float* window); 81 MEDIA_EXPORT void GetSymmetricHanningWindow(int window_length, float* window);
88 82
89 } // namespace internal 83 } // namespace internal
90 84
91 } // namespace media 85 } // namespace media
92 86
93 #endif // MEDIA_FILTERS_WSOLA_INTERNALS_H_ 87 #endif // MEDIA_FILTERS_WSOLA_INTERNALS_H_
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_algorithm_unittest.cc ('k') | media/filters/wsola_internals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698