This CL introduces namespaces in the aec c++ files
(the ones that were recently moved from c)
There are many files changed but most changes just
consist of adding namespaces.
In aec_common.h an C++-specific #ifdef needed to be added as
that file is both included from C and C++. I could see no
way around that but please let me know if there is a better
way around that.
BUG=webrtc:5201
Review URL: https://codereview.webrtc.org/1766663002
Cr-Commit-Position: refs/heads/master@{#11883}
diff --git a/webrtc/modules/audio_processing/aec/aec_common.h b/webrtc/modules/audio_processing/aec/aec_common.h
index 2b1a1c1..0e3cdde 100644
--- a/webrtc/modules/audio_processing/aec/aec_common.h
+++ b/webrtc/modules/audio_processing/aec/aec_common.h
@@ -21,6 +21,10 @@
#define ALIGN16_END __attribute__((aligned(16)))
#endif
+#ifdef __cplusplus
+namespace webrtc {
+#endif
+
extern ALIGN16_BEG const float ALIGN16_END WebRtcAec_sqrtHanning[65];
extern ALIGN16_BEG const float ALIGN16_END WebRtcAec_weightCurve[65];
extern ALIGN16_BEG const float ALIGN16_END WebRtcAec_overDriveCurve[65];
@@ -28,4 +32,8 @@
extern const float WebRtcAec_kNormalSmoothingCoefficients[2][2];
extern const float WebRtcAec_kMinFarendPSD;
+#ifdef __cplusplus
+} // namespace webrtc
+#endif
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_COMMON_H_
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 1a45a0c..e7a10cd 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -40,6 +40,8 @@
#include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
#include "webrtc/typedefs.h"
+namespace webrtc {
+
// Buffer size (samples)
static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz.
@@ -1901,3 +1903,4 @@
assert(delay >= 0);
self->system_delay = delay;
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_core.h b/webrtc/modules/audio_processing/aec/aec_core.h
index 75925fc..854b723 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.h
+++ b/webrtc/modules/audio_processing/aec/aec_core.h
@@ -19,6 +19,8 @@
#include "webrtc/typedefs.h"
+namespace webrtc {
+
#define FRAME_LEN 80
#define PART_LEN 64 // Length of partition
#define PART_LEN1 (PART_LEN + 1) // Unique fft coefficients
@@ -132,4 +134,6 @@
// care.
void WebRtcAec_SetSystemDelay(AecCore* self, int delay);
+} // namespace webrtc
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_
diff --git a/webrtc/modules/audio_processing/aec/aec_core_internal.h b/webrtc/modules/audio_processing/aec/aec_core_internal.h
index b2e7301..b13c077 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_internal.h
+++ b/webrtc/modules/audio_processing/aec/aec_core_internal.h
@@ -19,6 +19,8 @@
#include "webrtc/modules/audio_processing/aec/aec_core.h"
#include "webrtc/typedefs.h"
+namespace webrtc {
+
// Number of partitions for the extended filter mode. The first one is an enum
// to be used in array declarations, as it represents the maximum filter length.
enum { kExtendedNumPartitions = 32 };
@@ -227,4 +229,6 @@
typedef void (*WebRtcAecWindowData)(float* x_windowed, const float* x);
extern WebRtcAecWindowData WebRtcAec_WindowData;
+} // namespace webrtc
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_
diff --git a/webrtc/modules/audio_processing/aec/aec_core_mips.cc b/webrtc/modules/audio_processing/aec/aec_core_mips.cc
index bd4d8c5..44224d8 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_mips.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_mips.cc
@@ -24,6 +24,8 @@
#include "webrtc/modules/audio_processing/aec/aec_rdft.h"
}
+namespace webrtc {
+
extern const float WebRtcAec_weightCurve[65];
extern const float WebRtcAec_overDriveCurve[65];
@@ -781,3 +783,4 @@
WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips;
WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips;
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_core_neon.cc b/webrtc/modules/audio_processing/aec/aec_core_neon.cc
index ba374b2..baff9be 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_neon.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_neon.cc
@@ -27,6 +27,8 @@
#include "webrtc/modules/audio_processing/aec/aec_rdft.h"
}
+namespace webrtc {
+
enum { kShiftExponentIntoTopMantissa = 8 };
enum { kFloatExponentShift = 23 };
@@ -728,3 +730,4 @@
WebRtcAec_PartitionDelay = PartitionDelayNEON;
WebRtcAec_WindowData = WindowDataNEON;
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_core_sse2.cc b/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
index bf194a4..e236a38 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
@@ -25,6 +25,8 @@
#include "webrtc/modules/audio_processing/aec/aec_rdft.h"
}
+namespace webrtc {
+
__inline static float MulRe(float aRe, float aIm, float bRe, float bIm) {
return aRe * bRe - aIm * bIm;
}
@@ -742,3 +744,4 @@
WebRtcAec_PartitionDelay = PartitionDelaySSE2;
WebRtcAec_WindowData = WindowDataSSE2;
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_resampler.cc b/webrtc/modules/audio_processing/aec/aec_resampler.cc
index 8528fa6..cc9046b 100644
--- a/webrtc/modules/audio_processing/aec/aec_resampler.cc
+++ b/webrtc/modules/audio_processing/aec/aec_resampler.cc
@@ -21,6 +21,8 @@
#include "webrtc/modules/audio_processing/aec/aec_core.h"
+namespace webrtc {
+
enum { kEstimateLengthFrames = 400 };
typedef struct {
@@ -202,3 +204,4 @@
*skewEst = skew;
return 0;
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_resampler.h b/webrtc/modules/audio_processing/aec/aec_resampler.h
index f23e9cf..3a7400b 100644
--- a/webrtc/modules/audio_processing/aec/aec_resampler.h
+++ b/webrtc/modules/audio_processing/aec/aec_resampler.h
@@ -13,6 +13,8 @@
#include "webrtc/modules/audio_processing/aec/aec_core.h"
+namespace webrtc {
+
enum { kResamplingDelay = 1 };
enum { kResamplerBufferSize = FRAME_LEN * 4 };
@@ -32,4 +34,6 @@
float* outspeech,
size_t* size_out);
+} // namespace webrtc
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_RESAMPLER_H_
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.cc b/webrtc/modules/audio_processing/aec/echo_cancellation.cc
index c6f95a5..32496ca 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.cc
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.cc
@@ -29,6 +29,8 @@
#include "webrtc/modules/audio_processing/aec/echo_cancellation_internal.h"
#include "webrtc/typedefs.h"
+namespace webrtc {
+
// Measured delays [ms]
// Device Chrome GTP
// MacBook Air 10
@@ -881,3 +883,4 @@
self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0);
}
}
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.h b/webrtc/modules/audio_processing/aec/echo_cancellation.h
index 5c59263..09047f1 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.h
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.h
@@ -15,6 +15,8 @@
#include "webrtc/typedefs.h"
+namespace webrtc {
+
// Errors
#define AEC_UNSPECIFIED_ERROR 12000
#define AEC_UNSUPPORTED_FUNCTION_ERROR 12001
@@ -234,4 +236,6 @@
//
struct AecCore* WebRtcAec_aec_core(void* handle);
+} // namespace webrtc
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h b/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
index ccedb28..b4a6fd8 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
@@ -16,6 +16,8 @@
}
#include "webrtc/modules/audio_processing/aec/aec_core.h"
+namespace webrtc {
+
typedef struct {
int delayCtr;
int sampFreq;
@@ -64,4 +66,6 @@
AecCore* aec;
} Aec;
+} // namespace webrtc
+
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_INTERNAL_H_
diff --git a/webrtc/modules/audio_processing/aec/system_delay_unittest.cc b/webrtc/modules/audio_processing/aec/system_delay_unittest.cc
index 60b8c09..be14589 100644
--- a/webrtc/modules/audio_processing/aec/system_delay_unittest.cc
+++ b/webrtc/modules/audio_processing/aec/system_delay_unittest.cc
@@ -13,7 +13,7 @@
#include "webrtc/modules/audio_processing/aec/echo_cancellation_internal.h"
#include "webrtc/modules/audio_processing/aec/echo_cancellation.h"
#include "webrtc/typedefs.h"
-
+namespace webrtc {
namespace {
class SystemDelayTest : public ::testing::Test {
@@ -597,3 +597,4 @@
}
} // namespace
+} // namespace webrtc
diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h
index 2311c65..8af5f53 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -25,10 +25,10 @@
#include "webrtc/modules/audio_processing/beamformer/array_util.h"
#include "webrtc/typedefs.h"
-struct AecCore;
-
namespace webrtc {
+struct AecCore;
+
class AudioFrame;
template<typename T>