Moved the file aec_resampler.c to be built using C++.

The steps involved were:
1) Change file name to .cc from .c.
2) Update the build files accordingly.
3) Remove the extern header file inclusion.
4) Change the casts in aec_resampler.cc to static_cast
   and reinterpret_cast.

The changes are bitexact.

The CL will be followed with another CL where a proper (webrtc) namespace is introduced. The reason for not having it in this CL is that this was missed in the corresponding
CL that did the above for aec_core.c, ..., and if the
namespaces in all the aec_core -related files can be changed
at the same time that will simplify things.

BUG=webrtc:5201

Review URL: https://codereview.webrtc.org/1754223004

Cr-Commit-Position: refs/heads/master@{#11867}
This commit is contained in:
peah 2016-03-04 00:12:40 -08:00 committed by Commit bot
parent 0023fdffd0
commit 88950cfbf9
4 changed files with 11 additions and 13 deletions

View File

@ -27,7 +27,7 @@ source_set("audio_processing") {
"aec/aec_core_internal.h",
"aec/aec_rdft.c",
"aec/aec_rdft.h",
"aec/aec_resampler.c",
"aec/aec_resampler.cc",
"aec/aec_resampler.h",
"aec/echo_cancellation.cc",
"aec/echo_cancellation.h",

View File

@ -43,7 +43,7 @@ void* WebRtcAec_CreateResampler() {
}
int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) {
AecResampler* obj = (AecResampler*)resampInst;
AecResampler* obj = static_cast<AecResampler*>(resampInst);
memset(obj->buffer, 0, sizeof(obj->buffer));
obj->position = 0.0;
@ -56,7 +56,7 @@ int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) {
}
void WebRtcAec_FreeResampler(void* resampInst) {
AecResampler* obj = (AecResampler*)resampInst;
AecResampler* obj = static_cast<AecResampler*>(resampInst);
free(obj);
}
@ -66,7 +66,7 @@ void WebRtcAec_ResampleLinear(void* resampInst,
float skew,
float* outspeech,
size_t* size_out) {
AecResampler* obj = (AecResampler*)resampInst;
AecResampler* obj = static_cast<AecResampler*>(resampInst);
float* y;
float be, tnew;
@ -98,7 +98,7 @@ void WebRtcAec_ResampleLinear(void* resampInst,
mm++;
tnew = be * mm + obj->position;
tn = (int)tnew;
tn = static_cast<int>(tnew);
}
*size_out = mm;
@ -110,7 +110,7 @@ void WebRtcAec_ResampleLinear(void* resampInst,
}
int WebRtcAec_GetSkew(void* resampInst, int rawSkew, float* skewEst) {
AecResampler* obj = (AecResampler*)resampInst;
AecResampler* obj = static_cast<AecResampler*>(resampInst);
int err = 0;
if (obj->skewDataIndex < kEstimateLengthFrames) {
@ -132,8 +132,8 @@ int EstimateSkew(const int* rawSkew,
int size,
int deviceSampleRateHz,
float* skewEst) {
const int absLimitOuter = (int)(0.04f * deviceSampleRateHz);
const int absLimitInner = (int)(0.0025f * deviceSampleRateHz);
const int absLimitOuter = static_cast<int>(0.04f * deviceSampleRateHz);
const int absLimitInner = static_cast<int>(0.0025f * deviceSampleRateHz);
int i = 0;
int n = 0;
float rawAvg = 0;
@ -172,8 +172,8 @@ int EstimateSkew(const int* rawSkew,
}
assert(n > 0);
rawAbsDev /= n;
upperLimit = (int)(rawAvg + 5 * rawAbsDev + 1); // +1 for ceiling.
lowerLimit = (int)(rawAvg - 5 * rawAbsDev - 1); // -1 for floor.
upperLimit = static_cast<int>(rawAvg + 5 * rawAbsDev + 1); // +1 for ceiling.
lowerLimit = static_cast<int>(rawAvg - 5 * rawAbsDev - 1); // -1 for floor.
n = 0;
for (i = 0; i < size; i++) {

View File

@ -25,9 +25,7 @@ extern "C" {
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
}
#include "webrtc/modules/audio_processing/aec/aec_core.h"
extern "C" {
#include "webrtc/modules/audio_processing/aec/aec_resampler.h"
}
#include "webrtc/modules/audio_processing/aec/echo_cancellation_internal.h"
#include "webrtc/typedefs.h"

View File

@ -37,7 +37,7 @@
'aec/aec_core_internal.h',
'aec/aec_rdft.c',
'aec/aec_rdft.h',
'aec/aec_resampler.c',
'aec/aec_resampler.cc',
'aec/aec_resampler.h',
'aec/echo_cancellation.cc',
'aec/echo_cancellation_internal.h',