You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  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. #include "common_audio/include/audio_util.h"
  11. namespace webrtc {
  12. void FloatToS16(const float* src, size_t size, int16_t* dest) {
  13. for (size_t i = 0; i < size; ++i)
  14. dest[i] = FloatToS16(src[i]);
  15. }
  16. void S16ToFloat(const int16_t* src, size_t size, float* dest) {
  17. for (size_t i = 0; i < size; ++i)
  18. dest[i] = S16ToFloat(src[i]);
  19. }
  20. void S16ToFloatS16(const int16_t* src, size_t size, float* dest) {
  21. for (size_t i = 0; i < size; ++i)
  22. dest[i] = src[i];
  23. }
  24. void FloatS16ToS16(const float* src, size_t size, int16_t* dest) {
  25. for (size_t i = 0; i < size; ++i)
  26. dest[i] = FloatS16ToS16(src[i]);
  27. }
  28. void FloatToFloatS16(const float* src, size_t size, float* dest) {
  29. for (size_t i = 0; i < size; ++i)
  30. dest[i] = FloatToFloatS16(src[i]);
  31. }
  32. void FloatS16ToFloat(const float* src, size_t size, float* dest) {
  33. for (size_t i = 0; i < size; ++i)
  34. dest[i] = FloatS16ToFloat(src[i]);
  35. }
  36. template <>
  37. void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved,
  38. size_t num_frames,
  39. int num_channels,
  40. int16_t* deinterleaved) {
  41. DownmixInterleavedToMonoImpl<int16_t, int32_t>(interleaved, num_frames,
  42. num_channels, deinterleaved);
  43. }
  44. } // namespace webrtc