summaryrefslogtreecommitdiff
path: root/media/base/sinc_resampler.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-05-09 18:35:53 +0100
committerTorne (Richard Coles) <torne@google.com>2013-05-13 13:57:14 +0100
commitc2e0dbddbe15c98d52c4786dac06cb8952a8ae6d (patch)
tree1dbdbb0624cc869ab25ee7f46971984c6fee3e7a /media/base/sinc_resampler.h
parent2d519ce2457219605d4f472da8d2ffd469796035 (diff)
downloadchromium_org-c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d.tar.gz
Merge from Chromium at DEPS revision r198571
This commit was generated by merge_to_master.py. Change-Id: I951118a03836157090561764dd2627f0add8118f
Diffstat (limited to 'media/base/sinc_resampler.h')
-rw-r--r--media/base/sinc_resampler.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/media/base/sinc_resampler.h b/media/base/sinc_resampler.h
index 7b1dfaa124..3ccb85c5d8 100644
--- a/media/base/sinc_resampler.h
+++ b/media/base/sinc_resampler.h
@@ -60,9 +60,17 @@ class MEDIA_EXPORT SincResampler {
// single call to |read_cb_| for more data.
int ChunkSize() const;
- // Flush all buffered data and reset internal indices.
+ // Flush all buffered data and reset internal indices. Not thread safe, do
+ // not call while Resample() is in progress.
void Flush();
+ // Update |io_sample_rate_ratio_|. SetRatio() will cause a reconstruction of
+ // the kernels used for resampling. Not thread safe, do not call while
+ // Resample() is in progress.
+ void SetRatio(double io_sample_rate_ratio);
+
+ float* get_kernel_for_testing() { return kernel_storage_.get(); }
+
private:
FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve);
FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark);
@@ -86,7 +94,7 @@ class MEDIA_EXPORT SincResampler {
#endif
// The ratio of input / output sample rates.
- const double io_sample_rate_ratio_;
+ double io_sample_rate_ratio_;
// An index on the source input buffer with sub-sample precision. It must be
// double precision to avoid drift.
@@ -101,10 +109,12 @@ 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_ptr_malloc<float, base::ScopedPtrAlignedFree> kernel_storage_;
+ scoped_ptr<float[], base::ScopedPtrAlignedFree> kernel_storage_;
+ scoped_ptr<float[], base::ScopedPtrAlignedFree> kernel_pre_sinc_storage_;
+ scoped_ptr<float[], base::ScopedPtrAlignedFree> kernel_window_storage_;
// Data from the source is copied into this buffer for each processing pass.
- scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> input_buffer_;
+ scoped_ptr<float[], base::ScopedPtrAlignedFree> input_buffer_;
// Stores the runtime selection of which Convolve function to use.
#if defined(ARCH_CPU_X86_FAMILY) && !defined(__SSE__)