summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/webrtc/common_audio/audio_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/webrtc/common_audio/audio_util.cc')
-rw-r--r--chromium/third_party/webrtc/common_audio/audio_util.cc31
1 files changed, 11 insertions, 20 deletions
diff --git a/chromium/third_party/webrtc/common_audio/audio_util.cc b/chromium/third_party/webrtc/common_audio/audio_util.cc
index a6114fdf484..0c961e1ad74 100644
--- a/chromium/third_party/webrtc/common_audio/audio_util.cc
+++ b/chromium/third_party/webrtc/common_audio/audio_util.cc
@@ -14,28 +14,19 @@
namespace webrtc {
-void Deinterleave(const int16_t* interleaved, int samples_per_channel,
- int num_channels, int16_t** deinterleaved) {
- for (int i = 0; i < num_channels; i++) {
- int16_t* channel = deinterleaved[i];
- int interleaved_idx = i;
- for (int j = 0; j < samples_per_channel; j++) {
- channel[j] = interleaved[interleaved_idx];
- interleaved_idx += num_channels;
- }
- }
+void RoundToInt16(const float* src, int size, int16_t* dest) {
+ for (int i = 0; i < size; ++i)
+ dest[i] = RoundToInt16(src[i]);
}
-void Interleave(const int16_t* const* deinterleaved, int samples_per_channel,
- int num_channels, int16_t* interleaved) {
- for (int i = 0; i < num_channels; ++i) {
- const int16_t* channel = deinterleaved[i];
- int interleaved_idx = i;
- for (int j = 0; j < samples_per_channel; j++) {
- interleaved[interleaved_idx] = channel[j];
- interleaved_idx += num_channels;
- }
- }
+void ScaleAndRoundToInt16(const float* src, int size, int16_t* dest) {
+ for (int i = 0; i < size; ++i)
+ dest[i] = ScaleAndRoundToInt16(src[i]);
+}
+
+void ScaleToFloat(const int16_t* src, int size, float* dest) {
+ for (int i = 0; i < size; ++i)
+ dest[i] = ScaleToFloat(src[i]);
}
} // namespace webrtc