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

Side by Side Diff: media/base/sinc_resampler.h

Issue 10960023: Add ARM NEON intrinsic optimizations for SincResampler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 8 years, 2 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 | « no previous file | media/base/sinc_resampler.cc » ('j') | media/base/sinc_resampler_unittest.cc » ('J')
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 #ifndef MEDIA_BASE_SINC_RESAMPLER_H_ 5 #ifndef MEDIA_BASE_SINC_RESAMPLER_H_
6 #define MEDIA_BASE_SINC_RESAMPLER_H_ 6 #define MEDIA_BASE_SINC_RESAMPLER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "build/build_config.h"
13 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
14 13
15 namespace media { 14 namespace media {
16 15
17 // SincResampler is a high-quality single-channel sample-rate converter. 16 // SincResampler is a high-quality single-channel sample-rate converter.
18 class MEDIA_EXPORT SincResampler { 17 class MEDIA_EXPORT SincResampler {
19 public: 18 public:
20 // Callback type for providing more data into the resampler. Expects |frames| 19 // Callback type for providing more data into the resampler. Expects |frames|
21 // of data to be rendered into |destination|; zero padded if not enough frames 20 // of data to be rendered into |destination|; zero padded if not enough frames
22 // are available to satisfy the request. 21 // are available to satisfy the request.
(...skipping 15 matching lines...) Expand all
38 // Flush all buffered data and reset internal indices. 37 // Flush all buffered data and reset internal indices.
39 void Flush(); 38 void Flush();
40 39
41 private: 40 private:
42 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve); 41 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve);
43 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark); 42 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark);
44 43
45 void InitializeKernel(); 44 void InitializeKernel();
46 45
47 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are 46 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are
48 // linearly interpolated using |kernel_interpolation_factor|. The underlying 47 // linearly interpolated using |kernel_interpolation_factor|. On x86, the
49 // implementation is chosen at run time based on SSE support. 48 // underlying implementation is chosen at run time based on SSE support. On
49 // ARM, NEON support is chosen at compile time based on compilation flags.
50 static float Convolve(const float* input_ptr, const float* k1, 50 static float Convolve(const float* input_ptr, const float* k1,
51 const float* k2, double kernel_interpolation_factor); 51 const float* k2, double kernel_interpolation_factor);
52 static float Convolve_C(const float* input_ptr, const float* k1, 52 static float Convolve_C(const float* input_ptr, const float* k1,
53 const float* k2, double kernel_interpolation_factor); 53 const float* k2, double kernel_interpolation_factor);
54 static float Convolve_SSE(const float* input_ptr, const float* k1, 54 static float Convolve_SSE(const float* input_ptr, const float* k1,
55 const float* k2, 55 const float* k2,
56 double kernel_interpolation_factor); 56 double kernel_interpolation_factor);
57 static float Convolve_NEON(const float* input_ptr, const float* k1,
58 const float* k2,
59 double kernel_interpolation_factor);
57 60
58 // The ratio of input / output sample rates. 61 // The ratio of input / output sample rates.
59 double io_sample_rate_ratio_; 62 double io_sample_rate_ratio_;
60 63
61 // An index on the source input buffer with sub-sample precision. It must be 64 // An index on the source input buffer with sub-sample precision. It must be
62 // double precision to avoid drift. 65 // double precision to avoid drift.
63 double virtual_source_idx_; 66 double virtual_source_idx_;
64 67
65 // The buffer is primed once at the very beginning of processing. 68 // The buffer is primed once at the very beginning of processing.
66 bool buffer_primed_; 69 bool buffer_primed_;
(...skipping 17 matching lines...) Expand all
84 float* const r3_; 87 float* const r3_;
85 float* const r4_; 88 float* const r4_;
86 float* const r5_; 89 float* const r5_;
87 90
88 DISALLOW_COPY_AND_ASSIGN(SincResampler); 91 DISALLOW_COPY_AND_ASSIGN(SincResampler);
89 }; 92 };
90 93
91 } // namespace media 94 } // namespace media
92 95
93 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ 96 #endif // MEDIA_BASE_SINC_RESAMPLER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/sinc_resampler.cc » ('j') | media/base/sinc_resampler_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698