| 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 16 matching lines...) Expand all Loading... |
| 27 // calls back for input. Must be greater than kKernelSize. | 27 // calls back for input. Must be greater than kKernelSize. |
| 28 kDefaultRequestSize = 512, | 28 kDefaultRequestSize = 512, |
| 29 | 29 |
| 30 // The kernel offset count is used for interpolation and is the number of | 30 // The kernel offset count is used for interpolation and is the number of |
| 31 // sub-sample kernel shifts. Can be adjusted for quality (higher is better) | 31 // sub-sample kernel shifts. Can be adjusted for quality (higher is better) |
| 32 // at the expense of allocating more memory. | 32 // at the expense of allocating more memory. |
| 33 kKernelOffsetCount = 32, | 33 kKernelOffsetCount = 32, |
| 34 kKernelStorageSize = kKernelSize * (kKernelOffsetCount + 1), | 34 kKernelStorageSize = kKernelSize * (kKernelOffsetCount + 1), |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Selects runtime specific CPU features like SSE. Must be called before | |
| 38 // using SincResampler. | |
| 39 static void InitializeCPUSpecificFeatures(); | |
| 40 | |
| 41 // Callback type for providing more data into the resampler. Expects |frames| | 37 // Callback type for providing more data into the resampler. Expects |frames| |
| 42 // of data to be rendered into |destination|; zero padded if not enough frames | 38 // of data to be rendered into |destination|; zero padded if not enough frames |
| 43 // are available to satisfy the request. | 39 // are available to satisfy the request. |
| 44 typedef base::Callback<void(int frames, float* destination)> ReadCB; | 40 typedef base::Callback<void(int frames, float* destination)> ReadCB; |
| 45 | 41 |
| 46 // Constructs a SincResampler with the specified |read_cb|, which is used to | 42 // Constructs a SincResampler with the specified |read_cb|, which is used to |
| 47 // acquire audio data for resampling. |io_sample_rate_ratio| is the ratio | 43 // acquire audio data for resampling. |io_sample_rate_ratio| is the ratio |
| 48 // of input / output sample rates. |request_frames| controls the size in | 44 // of input / output sample rates. |request_frames| controls the size in |
| 49 // frames of the buffer requested by each |read_cb| call. The value must be | 45 // frames of the buffer requested by each |read_cb| call. The value must be |
| 50 // greater than kKernelSize. Specify kDefaultRequestSize if there are no | 46 // greater than kKernelSize. Specify kDefaultRequestSize if there are no |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 float* const r2_; | 130 float* const r2_; |
| 135 float* r3_; | 131 float* r3_; |
| 136 float* r4_; | 132 float* r4_; |
| 137 | 133 |
| 138 DISALLOW_COPY_AND_ASSIGN(SincResampler); | 134 DISALLOW_COPY_AND_ASSIGN(SincResampler); |
| 139 }; | 135 }; |
| 140 | 136 |
| 141 } // namespace media | 137 } // namespace media |
| 142 | 138 |
| 143 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ | 139 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ |
| OLD | NEW |