Chromium Code Reviews| Index: webrtc/common_audio/include/audio_util.h |
| diff --git a/webrtc/common_audio/include/audio_util.h b/webrtc/common_audio/include/audio_util.h |
| index 8262649145546180f23b6e82094d324b7f604e7f..b0ecc068198afbbca001409e6003352e9bf83015 100644 |
| --- a/webrtc/common_audio/include/audio_util.h |
| +++ b/webrtc/common_audio/include/audio_util.h |
| @@ -97,6 +97,21 @@ void Interleave(const T* const* deinterleaved, int samples_per_channel, |
| } |
| } |
| +// Copies audio from a single channel buffer pointed to by |mono| to each |
| +// channel of |interleaved|. There must be sufficient space allocated in |
| +// |interleaved| (|samples_per_channel| * |num_channels|). |
| +template <typename T> |
| +void UpmixMonoToInterleaved(const T* mono, int samples_per_channel, |
|
Andrew MacDonald
2015/07/29 03:52:27
Go with num_frames for new code rather than sample
ekm
2015/07/29 23:35:06
Done.
|
| + int num_channels, T* interleaved) { |
| + int interleaved_idx = 0; |
| + for (int i = 0; i < samples_per_channel; ++i) { |
| + for (int j = 0; j < num_channels; ++j) { |
| + interleaved[interleaved_idx] = mono[i]; |
|
aluebs-webrtc
2015/07/29 22:17:10
How about:
interleaved[i * num_channels + j] = mo
ekm
2015/07/29 23:35:06
I'd like to avoid the inner multiplication, though
aluebs-webrtc
2015/07/30 15:28:07
Agreed.
|
| + interleaved_idx++; |
|
Andrew MacDonald
2015/07/29 03:52:27
nit: could put the post-increment in the above lin
ekm
2015/07/29 23:35:06
Done.
|
| + } |
| + } |
| +} |
| + |
| } // namespace webrtc |
| #endif // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_ |