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

Unified Diff: media/base/sinc_resampler.h

Issue 10803003: Add SSE optimizations to SincResampler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error. Created 8 years, 5 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 | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/sinc_resampler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/sinc_resampler.h
diff --git a/media/base/sinc_resampler.h b/media/base/sinc_resampler.h
index 58f5c2dd7ebf0c16886c7b9a958571b164d48139..4c55eabfbc6448698ba0d7d73eb3ac67a03a10f6 100644
--- a/media/base/sinc_resampler.h
+++ b/media/base/sinc_resampler.h
@@ -6,7 +6,10 @@
#define MEDIA_BASE_SINC_RESAMPLER_H_
#include "base/callback.h"
+#include "base/gtest_prod_util.h"
+#include "base/memory/aligned_memory.h"
#include "base/memory/scoped_ptr.h"
+#include "build/build_config.h"
#include "media/base/media_export.h"
namespace media {
@@ -33,8 +36,22 @@ class MEDIA_EXPORT SincResampler {
int ChunkSize();
private:
+ FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve);
+ FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark);
+
void InitializeKernel();
+ // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are
+ // linearly interpolated using |kernel_interpolation_factor|. The underlying
+ // implementation is chosen at run time based on SSE support.
+ static float Convolve(const float* input_ptr, const float* k1,
+ const float* k2, double kernel_interpolation_factor);
+ static float Convolve_C(const float* input_ptr, const float* k1,
+ const float* k2, double kernel_interpolation_factor);
+ static float Convolve_SSE(const float* input_ptr, const float* k1,
+ const float* k2,
+ double kernel_interpolation_factor);
+
// The ratio of input / output sample rates.
double io_sample_rate_ratio_;
@@ -51,10 +68,10 @@ class MEDIA_EXPORT SincResampler {
// Contains kKernelOffsetCount kernels back-to-back, each of size kKernelSize.
// The kernel offsets are sub-sample shifts of a windowed sinc shifted from
// 0.0 to 1.0 sample.
- scoped_array<float> kernel_storage_;
+ scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> kernel_storage_;
// Data from the source is copied into this buffer for each processing pass.
- scoped_array<float> input_buffer_;
+ scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> input_buffer_;
// Pointers to the various regions inside |input_buffer_|. See the diagram at
// the top of the .cc file for more information.
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/sinc_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698