blob: be67c48f6053990ae5c16458980936532166e8a9 [file] [log] [blame]
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +00001/*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/common_audio/include/audio_util.h"
12
13#include "webrtc/typedefs.h"
14
15namespace webrtc {
16
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000017void FloatToS16(const float* src, size_t size, int16_t* dest) {
kwiberg@webrtc.orgefb81d82014-07-16 08:36:52 +000018 for (size_t i = 0; i < size; ++i)
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000019 dest[i] = FloatToS16(src[i]);
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000020}
21
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000022void S16ToFloat(const int16_t* src, size_t size, float* dest) {
kwiberg@webrtc.orgefb81d82014-07-16 08:36:52 +000023 for (size_t i = 0; i < size; ++i)
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000024 dest[i] = S16ToFloat(src[i]);
andrew@webrtc.org17e40642014-03-04 20:58:13 +000025}
26
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000027void FloatS16ToS16(const float* src, size_t size, int16_t* dest) {
kwiberg@webrtc.orgefb81d82014-07-16 08:36:52 +000028 for (size_t i = 0; i < size; ++i)
andrew@webrtc.org4fc4add2014-10-30 03:40:10 +000029 dest[i] = FloatS16ToS16(src[i]);
30}
31
32void FloatToFloatS16(const float* src, size_t size, float* dest) {
33 for (size_t i = 0; i < size; ++i)
34 dest[i] = FloatToFloatS16(src[i]);
35}
36
37void FloatS16ToFloat(const float* src, size_t size, float* dest) {
38 for (size_t i = 0; i < size; ++i)
39 dest[i] = FloatS16ToFloat(src[i]);
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000040}
41
Michael Graczyk86c6d332015-07-23 11:41:39 -070042template <>
43void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved,
44 int num_multichannel_frames,
45 int num_channels,
46 int16_t* deinterleaved) {
47 DownmixInterleavedToMonoImpl<int16_t, int32_t>(
48 interleaved, num_multichannel_frames, num_channels, deinterleaved);
49}
50
andrew@webrtc.org50b2efe2013-04-29 17:27:29 +000051} // namespace webrtc