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

Side by Side Diff: media/base/sinc_resampler_unittest.cc

Issue 308003004: Remove runtime CPU detection for SSE optimized media/ methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more salty fix. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « media/base/sinc_resampler_perftest.cc ('k') | media/base/vector_math.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/cpu.h"
13 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
14 #include "base/time/time.h" 13 #include "base/time/time.h"
15 #include "build/build_config.h" 14 #include "build/build_config.h"
16 #include "media/base/sinc_resampler.h" 15 #include "media/base/sinc_resampler.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 using testing::_; 19 using testing::_;
21 20
22 namespace media { 21 namespace media {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #define CONVOLVE_FUNC Convolve_NEON 113 #define CONVOLVE_FUNC Convolve_NEON
115 #endif 114 #endif
116 115
117 // Ensure various optimized Convolve() methods return the same value. Only run 116 // Ensure various optimized Convolve() methods return the same value. Only run
118 // this test if other optimized methods exist, otherwise the default Convolve() 117 // this test if other optimized methods exist, otherwise the default Convolve()
119 // will be tested by the parameterized SincResampler tests below. 118 // will be tested by the parameterized SincResampler tests below.
120 #if defined(CONVOLVE_FUNC) 119 #if defined(CONVOLVE_FUNC)
121 static const double kKernelInterpolationFactor = 0.5; 120 static const double kKernelInterpolationFactor = 0.5;
122 121
123 TEST(SincResamplerTest, Convolve) { 122 TEST(SincResamplerTest, Convolve) {
124 #if defined(ARCH_CPU_X86_FAMILY)
125 ASSERT_TRUE(base::CPU().has_sse());
126 #endif
127
128 // Initialize a dummy resampler. 123 // Initialize a dummy resampler.
129 MockSource mock_source; 124 MockSource mock_source;
130 SincResampler resampler( 125 SincResampler resampler(
131 kSampleRateRatio, SincResampler::kDefaultRequestSize, 126 kSampleRateRatio, SincResampler::kDefaultRequestSize,
132 base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source))); 127 base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source)));
133 128
134 // The optimized Convolve methods are slightly more precise than Convolve_C(), 129 // The optimized Convolve methods are slightly more precise than Convolve_C(),
135 // so comparison must be done using an epsilon. 130 // so comparison must be done using an epsilon.
136 static const double kEpsilon = 0.00000005; 131 static const double kEpsilon = 0.00000005;
137 132
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 std::tr1::make_tuple(11025, 192000, kResamplingRMSError, -62.61), 357 std::tr1::make_tuple(11025, 192000, kResamplingRMSError, -62.61),
363 std::tr1::make_tuple(16000, 192000, kResamplingRMSError, -63.14), 358 std::tr1::make_tuple(16000, 192000, kResamplingRMSError, -63.14),
364 std::tr1::make_tuple(22050, 192000, kResamplingRMSError, -62.42), 359 std::tr1::make_tuple(22050, 192000, kResamplingRMSError, -62.42),
365 std::tr1::make_tuple(32000, 192000, kResamplingRMSError, -63.38), 360 std::tr1::make_tuple(32000, 192000, kResamplingRMSError, -63.38),
366 std::tr1::make_tuple(44100, 192000, kResamplingRMSError, -62.63), 361 std::tr1::make_tuple(44100, 192000, kResamplingRMSError, -62.63),
367 std::tr1::make_tuple(48000, 192000, kResamplingRMSError, -73.44), 362 std::tr1::make_tuple(48000, 192000, kResamplingRMSError, -73.44),
368 std::tr1::make_tuple(96000, 192000, kResamplingRMSError, -73.52), 363 std::tr1::make_tuple(96000, 192000, kResamplingRMSError, -73.52),
369 std::tr1::make_tuple(192000, 192000, kResamplingRMSError, -73.52))); 364 std::tr1::make_tuple(192000, 192000, kResamplingRMSError, -73.52)));
370 365
371 } // namespace media 366 } // namespace media
OLDNEW
« no previous file with comments | « media/base/sinc_resampler_perftest.cc ('k') | media/base/vector_math.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698