OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 // Downmixes an interleaved multichannel signal to a single channel by averaging | 150 // Downmixes an interleaved multichannel signal to a single channel by averaging |
151 // all channels. | 151 // all channels. |
152 template <typename T, typename Intermediate> | 152 template <typename T, typename Intermediate> |
153 void DownmixInterleavedToMonoImpl(const T* interleaved, | 153 void DownmixInterleavedToMonoImpl(const T* interleaved, |
154 size_t num_frames, | 154 size_t num_frames, |
155 int num_channels, | 155 int num_channels, |
156 T* deinterleaved) { | 156 T* deinterleaved) { |
157 DCHECK_GT(num_channels, 0); | 157 RTC_DCHECK_GT(num_channels, 0); |
158 DCHECK_GT(num_frames, 0u); | 158 RTC_DCHECK_GT(num_frames, 0u); |
159 | 159 |
160 const T* const end = interleaved + num_frames * num_channels; | 160 const T* const end = interleaved + num_frames * num_channels; |
161 | 161 |
162 while (interleaved < end) { | 162 while (interleaved < end) { |
163 const T* const frame_end = interleaved + num_channels; | 163 const T* const frame_end = interleaved + num_channels; |
164 | 164 |
165 Intermediate value = *interleaved++; | 165 Intermediate value = *interleaved++; |
166 while (interleaved < frame_end) { | 166 while (interleaved < frame_end) { |
167 value += *interleaved++; | 167 value += *interleaved++; |
168 } | 168 } |
(...skipping 10 matching lines...) Expand all Loading... |
179 | 179 |
180 template <> | 180 template <> |
181 void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved, | 181 void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved, |
182 size_t num_frames, | 182 size_t num_frames, |
183 int num_channels, | 183 int num_channels, |
184 int16_t* deinterleaved); | 184 int16_t* deinterleaved); |
185 | 185 |
186 } // namespace webrtc | 186 } // namespace webrtc |
187 | 187 |
188 #endif // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_ | 188 #endif // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_ |
OLD | NEW |