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 <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/aligned_memory.h" | 13 #include "base/memory/aligned_memory.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 | 18 |
18 // SincResampler is a high-quality single-channel sample-rate converter. | 19 // SincResampler is a high-quality single-channel sample-rate converter. |
19 class MEDIA_EXPORT SincResampler { | 20 class MEDIA_EXPORT SincResampler { |
20 public: | 21 public: |
21 enum { | 22 enum { |
22 // The kernel size can be adjusted for quality (higher is better) at the | 23 // The kernel size can be adjusted for quality (higher is better) at the |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Cached value used for ChunkSize(). The maximum size in frames that | 128 // Cached value used for ChunkSize(). The maximum size in frames that |
128 // guarantees Resample() will only ask for input at most once. | 129 // guarantees Resample() will only ask for input at most once. |
129 int chunk_size_; | 130 int chunk_size_; |
130 | 131 |
131 // The size (in samples) of the internal buffer used by the resampler. | 132 // The size (in samples) of the internal buffer used by the resampler. |
132 const int input_buffer_size_; | 133 const int input_buffer_size_; |
133 | 134 |
134 // Contains kKernelOffsetCount kernels back-to-back, each of size kKernelSize. | 135 // Contains kKernelOffsetCount kernels back-to-back, each of size kKernelSize. |
135 // The kernel offsets are sub-sample shifts of a windowed sinc shifted from | 136 // The kernel offsets are sub-sample shifts of a windowed sinc shifted from |
136 // 0.0 to 1.0 sample. | 137 // 0.0 to 1.0 sample. |
137 scoped_ptr<float[], base::AlignedFreeDeleter> kernel_storage_; | 138 std::unique_ptr<float[], base::AlignedFreeDeleter> kernel_storage_; |
138 scoped_ptr<float[], base::AlignedFreeDeleter> kernel_pre_sinc_storage_; | 139 std::unique_ptr<float[], base::AlignedFreeDeleter> kernel_pre_sinc_storage_; |
139 scoped_ptr<float[], base::AlignedFreeDeleter> kernel_window_storage_; | 140 std::unique_ptr<float[], base::AlignedFreeDeleter> kernel_window_storage_; |
140 | 141 |
141 // Data from the source is copied into this buffer for each processing pass. | 142 // Data from the source is copied into this buffer for each processing pass. |
142 scoped_ptr<float[], base::AlignedFreeDeleter> input_buffer_; | 143 std::unique_ptr<float[], base::AlignedFreeDeleter> input_buffer_; |
143 | 144 |
144 // Pointers to the various regions inside |input_buffer_|. See the diagram at | 145 // Pointers to the various regions inside |input_buffer_|. See the diagram at |
145 // the top of the .cc file for more information. | 146 // the top of the .cc file for more information. |
146 float* r0_; | 147 float* r0_; |
147 float* const r1_; | 148 float* const r1_; |
148 float* const r2_; | 149 float* const r2_; |
149 float* r3_; | 150 float* r3_; |
150 float* r4_; | 151 float* r4_; |
151 | 152 |
152 DISALLOW_COPY_AND_ASSIGN(SincResampler); | 153 DISALLOW_COPY_AND_ASSIGN(SincResampler); |
153 }; | 154 }; |
154 | 155 |
155 } // namespace media | 156 } // namespace media |
156 | 157 |
157 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ | 158 #endif // MEDIA_BASE_SINC_RESAMPLER_H_ |
OLD | NEW |