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/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // Update |io_sample_rate_ratio_|. SetRatio() will cause a reconstruction of | 69 // Update |io_sample_rate_ratio_|. SetRatio() will cause a reconstruction of |
70 // the kernels used for resampling. Not thread safe, do not call while | 70 // the kernels used for resampling. Not thread safe, do not call while |
71 // Resample() is in progress. | 71 // Resample() is in progress. |
72 void SetRatio(double io_sample_rate_ratio); | 72 void SetRatio(double io_sample_rate_ratio); |
73 | 73 |
74 float* get_kernel_for_testing() { return kernel_storage_.get(); } | 74 float* get_kernel_for_testing() { return kernel_storage_.get(); } |
75 | 75 |
76 private: | 76 private: |
77 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve); | 77 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, Convolve); |
78 FRIEND_TEST_ALL_PREFIXES(SincResamplerTest, ConvolveBenchmark); | 78 FRIEND_TEST_ALL_PREFIXES(SincResamplerPerfTest, Convolve); |
79 | 79 |
80 void InitializeKernel(); | 80 void InitializeKernel(); |
81 void UpdateRegions(bool second_load); | 81 void UpdateRegions(bool second_load); |
82 | 82 |
83 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are | 83 // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are |
84 // linearly interpolated using |kernel_interpolation_factor|. On x86, the | 84 // linearly interpolated using |kernel_interpolation_factor|. On x86, the |
85 // underlying implementation is chosen at run time based on SSE support. On | 85 // underlying implementation is chosen at run time based on SSE support. On |
86 // ARM, NEON support is chosen at compile time based on compilation flags. | 86 // ARM, NEON support is chosen at compile time based on compilation flags. |
87 static float Convolve_C(const float* input_ptr, const float* k1, | 87 static float Convolve_C(const float* input_ptr, const float* k1, |
88 const float* k2, double kernel_interpolation_factor); | 88 const float* k2, double kernel_interpolation_factor); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Will be CHECK'd to find crashes... | 140 // Will be CHECK'd to find crashes... |
141 // TODO(dalecurtis): Remove debug helpers for http://crbug.com/295278 | 141 // TODO(dalecurtis): Remove debug helpers for http://crbug.com/295278 |
142 base::AtomicRefCount currently_resampling_; | 142 base::AtomicRefCount currently_resampling_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(SincResampler); | 144 DISALLOW_COPY_AND_ASSIGN(SincResampler); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace media | 147 } // namespace media |
148 | 148 |
149 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ | 149 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ |
OLD | NEW |