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 // Downmixes an interleaved multichannel signal to a single channel by averaging | 149 // Downmixes an interleaved multichannel signal to a single channel by averaging |
150 // all channels. | 150 // all channels. |
151 template <typename T, typename Intermediate> | 151 template <typename T, typename Intermediate> |
152 void DownmixInterleavedToMonoImpl(const T* interleaved, | 152 void DownmixInterleavedToMonoImpl(const T* interleaved, |
153 size_t num_frames, | 153 size_t num_frames, |
154 int num_channels, | 154 int num_channels, |
155 T* deinterleaved) { | 155 T* deinterleaved) { |
156 RTC_DCHECK_GT(num_channels, 0); | 156 RTC_DCHECK_GT(num_channels, 0); |
157 RTC_DCHECK_GT(num_frames, 0u); | 157 RTC_DCHECK_GT(num_frames, 0); |
158 | 158 |
159 const T* const end = interleaved + num_frames * num_channels; | 159 const T* const end = interleaved + num_frames * num_channels; |
160 | 160 |
161 while (interleaved < end) { | 161 while (interleaved < end) { |
162 const T* const frame_end = interleaved + num_channels; | 162 const T* const frame_end = interleaved + num_channels; |
163 | 163 |
164 Intermediate value = *interleaved++; | 164 Intermediate value = *interleaved++; |
165 while (interleaved < frame_end) { | 165 while (interleaved < frame_end) { |
166 value += *interleaved++; | 166 value += *interleaved++; |
167 } | 167 } |
(...skipping 10 matching lines...) Expand all Loading... |
178 | 178 |
179 template <> | 179 template <> |
180 void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved, | 180 void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved, |
181 size_t num_frames, | 181 size_t num_frames, |
182 int num_channels, | 182 int num_channels, |
183 int16_t* deinterleaved); | 183 int16_t* deinterleaved); |
184 | 184 |
185 } // namespace webrtc | 185 } // namespace webrtc |
186 | 186 |
187 #endif // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_ | 187 #endif // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_ |
OLD | NEW |