diff --git a/webrtc/modules/audio_processing/aec/aec_common.h b/webrtc/modules/audio_processing/aec/aec_common.h index 2b1a1c160f..0e3cddeb4c 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_kExtendedSmoothingCoefficients[2][2]; 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 1a45a0c8c0..e7a10cda68 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.cc +++ b/webrtc/modules/audio_processing/aec/aec_core.cc @@ -40,6 +40,8 @@ extern "C" { #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 @@ void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { 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 75925fc929..854b7236e7 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 @@ int WebRtcAec_system_delay(AecCore* self); // 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 b2e7301724..b13c077bd7 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 @@ extern "C" { #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 @@ extern WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; 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 bd4d8c5841..44224d89a5 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 @@ extern "C" { #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 @@ void WebRtcAec_InitAec_mips(void) { 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 ba374b21ab..baff9bed0e 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 @@ extern "C" { #include "webrtc/modules/audio_processing/aec/aec_rdft.h" } +namespace webrtc { + enum { kShiftExponentIntoTopMantissa = 8 }; enum { kFloatExponentShift = 23 }; @@ -728,3 +730,4 @@ void WebRtcAec_InitAec_neon(void) { 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 bf194a400f..e236a38301 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 @@ extern "C" { #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 @@ void WebRtcAec_InitAec_SSE2(void) { 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 8528fa65e3..cc9046bd43 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 @@ int EstimateSkew(const int* rawSkew, *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 f23e9cfad0..3a7400b010 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 @@ void WebRtcAec_ResampleLinear(void* resampInst, 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 c6f95a5cf9..32496ca33c 100644 --- a/webrtc/modules/audio_processing/aec/echo_cancellation.cc +++ b/webrtc/modules/audio_processing/aec/echo_cancellation.cc @@ -29,6 +29,8 @@ extern "C" { #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 @@ static void EstBufDelayExtended(Aec* self) { 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 5c592631a8..09047f12f1 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 @@ int WebRtcAec_GetDelayMetrics(void* handle, // 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 ccedb28a14..b4a6fd8390 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 @@ extern "C" { } #include "webrtc/modules/audio_processing/aec/aec_core.h" +namespace webrtc { + typedef struct { int delayCtr; int sampFreq; @@ -64,4 +66,6 @@ typedef struct { 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 60b8c092f8..be145898b5 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 @@ TEST_F(SystemDelayTest, CorrectImpactWhenTogglingDeviceBufferValues) { } } // namespace +} // namespace webrtc diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index 2311c65e54..8af5f53e1e 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