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

Unified Diff: media/filters/audio_renderer_algorithm_unittest.cc

Issue 217553004: Handle near-colinear case in WSOLAS QuadraticInterpolation better. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/wsola_internals.h » ('j') | media/filters/wsola_internals.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_algorithm_unittest.cc
diff --git a/media/filters/audio_renderer_algorithm_unittest.cc b/media/filters/audio_renderer_algorithm_unittest.cc
index bde07a23f8439e7900ee2b610dd1fbba8d4d4fce..11a844adb9afab6a024957973e8dd8b5c835bf40 100644
--- a/media/filters/audio_renderer_algorithm_unittest.cc
+++ b/media/filters/audio_renderer_algorithm_unittest.cc
@@ -590,7 +590,7 @@ TEST_F(AudioRendererAlgorithmTest, FullAndDecimatedSearch) {
exclude_interval));
}
-TEST_F(AudioRendererAlgorithmTest, CubicInterpolation) {
+TEST_F(AudioRendererAlgorithmTest, QuadraticInterpolation) {
// Arbitrary coefficients.
const float kA = 0.7f;
const float kB = 1.2f;
@@ -604,7 +604,7 @@ TEST_F(AudioRendererAlgorithmTest, CubicInterpolation) {
float extremum;
float extremum_value;
- internal::CubicInterpolation(y_values, &extremum, &extremum_value);
+ internal::QuadraticInterpolation(y_values, &extremum, &extremum_value);
float x_star = -kB / (2.f * kA);
float y_star = kA * x_star * x_star + kB * x_star + kC;
@@ -613,6 +613,21 @@ TEST_F(AudioRendererAlgorithmTest, CubicInterpolation) {
EXPECT_FLOAT_EQ(y_star, extremum_value);
}
+TEST_F(AudioRendererAlgorithmTest, QuadraticInterpolation_Colinear) {
+ float y_values[3];
+ y_values[0] = 1.0;
+ y_values[1] = 1.0;
+ y_values[2] = 1.0;
+
+ float extremum;
+ float extremum_value;
+
+ internal::QuadraticInterpolation(y_values, &extremum, &extremum_value);
+
+ EXPECT_NEAR(extremum, 0.0, 1.0);
DaleCurtis 2014/03/29 01:10:01 within 1 seems pretty large?
sandersd (OOO until July 31) 2014/03/29 01:19:37 Since the choice of x = 0 was arbitrary, I'm only
+ EXPECT_FLOAT_EQ(extremum_value, 1.0);
+}
+
TEST_F(AudioRendererAlgorithmTest, WsolaSlowdown) {
WsolaTest(0.6f);
}
« no previous file with comments | « no previous file | media/filters/wsola_internals.h » ('j') | media/filters/wsola_internals.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698