
This is mainly to support the native audio format in Chrome. Although this implementation just moves the float->int conversion under the hood, we will transition AudioProcessing towards supporting this format throughout. - Add a test which verifies we get identical output with the float and int interfaces. - The float and int wrappers are tasked with conversion to the AudioBuffer format. A new shared Process/Analyze method does most of the work. - Add a new field to the debug.proto to hold deinterleaved data. - Add helpers to audio_utils.cc, and start using numeric_limits. - Note that there was no performance difference between numeric_limits and a literal value when measured on Linux using gcc or clang. BUG=2894 R=aluebs@webrtc.org, bjornv@webrtc.org, henrikg@webrtc.org, tommi@webrtc.org, turaj@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9179004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5641 4adac7df-926f-26a2-2b94-8c16560cd09d
33 lines
961 B
C++
33 lines
961 B
C++
/*
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "webrtc/common_audio/include/audio_util.h"
|
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
namespace webrtc {
|
|
|
|
void RoundToInt16(const float* src, int size, int16_t* dest) {
|
|
for (int i = 0; i < size; ++i)
|
|
dest[i] = RoundToInt16(src[i]);
|
|
}
|
|
|
|
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
|