| OLD | NEW |
| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 SincResampler(double io_sample_rate_ratio, const ReadCB& read_cb); | 28 SincResampler(double io_sample_rate_ratio, const ReadCB& read_cb); |
| 29 virtual ~SincResampler(); | 29 virtual ~SincResampler(); |
| 30 | 30 |
| 31 // Resample |frames| of data from |read_cb_| into |destination|. | 31 // Resample |frames| of data from |read_cb_| into |destination|. |
| 32 void Resample(float* destination, int frames); | 32 void Resample(float* destination, int frames); |
| 33 | 33 |
| 34 // The maximum size in frames that guarantees Resample() will only make a | 34 // The maximum size in frames that guarantees Resample() will only make a |
| 35 // single call to |read_cb_| for more data. | 35 // single call to |read_cb_| for more data. |
| 36 int ChunkSize(); | 36 int ChunkSize(); |
| 37 | 37 |
| 38 // Flush all buffered data and reset internal indexes. |
| 39 void Flush(); |
| 40 |
| 38 private: | 41 private: |
| 42 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Flush); |
| 39 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve); | 43 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve); |
| 40 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark); | 44 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark); |
| 41 | 45 |
| 42 void InitializeKernel(); | 46 void InitializeKernel(); |
| 43 | 47 |
| 44 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are | 48 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are |
| 45 // linearly interpolated using |kernel_interpolation_factor|. The underlying | 49 // linearly interpolated using |kernel_interpolation_factor|. The underlying |
| 46 // implementation is chosen at run time based on SSE support. | 50 // implementation is chosen at run time based on SSE support. |
| 47 static float Convolve(const float* input_ptr, const float* k1, | 51 static float Convolve(const float* input_ptr, const float* k1, |
| 48 const float* k2, double kernel_interpolation_factor); | 52 const float* k2, double kernel_interpolation_factor); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 float* const r3_; | 85 float* const r3_; |
| 82 float* const r4_; | 86 float* const r4_; |
| 83 float* const r5_; | 87 float* const r5_; |
| 84 | 88 |
| 85 DISALLOW_COPY_AND_ASSIGN(SincResampler); | 89 DISALLOW_COPY_AND_ASSIGN(SincResampler); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 } // namespace media | 92 } // namespace media |
| 89 | 93 |
| 90 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ | 94 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ |
| OLD | NEW |