From 94771cb6a0bbbd7d4979164173b63a7022577e7d Mon Sep 17 00:00:00 2001 From: "kma@webrtc.org" Date: Tue, 28 Aug 2012 04:09:50 +0000 Subject: [PATCH] Change preprocessor define WEBRTC_ANDROID into WEBRTC_ARCH_ARM, for ARM platform depended code. Review URL: https://webrtc-codereview.appspot.com/735010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2674 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/build/common.gypi | 23 +++++++++++++++++-- .../signal_processing/complex_fft.c | 8 +++---- .../include/signal_processing_library.h | 2 +- .../signal_processing/include/spl_inl.h | 4 ++-- .../signal_processing/min_max_operations.c | 5 ++-- .../signal_processing/resample_by_2.c | 4 ++-- .../vector_scaling_operations.c | 4 ++-- src/engine_configurations.h | 2 +- .../codecs/isac/fix/source/filterbanks.c | 2 +- src/modules/audio_processing/aecm/aecm_core.c | 6 ++--- 10 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/build/common.gypi b/src/build/common.gypi index f333b2b07..b7e018154 100644 --- a/src/build/common.gypi +++ b/src/build/common.gypi @@ -138,6 +138,27 @@ }], ], }], + ['target_arch=="arm"', { + 'defines': [ + 'WEBRTC_ARCH_ARM', + ], + 'conditions': [ + ['armv7==1', { + 'defines': [ + 'WEBRTC_ARCH_ARM_V7', + 'WEBRTC_DETECT_ARM_NEON', + ], + }], + ['arm_neon==1', { + 'defines': [ + 'WEBRTC_ARCH_ARM_NEON', + ], + 'defines!': [ + 'WEBRTC_DETECT_ARM_NEON', + ], + }], + ], + }], ['OS=="linux"', { 'defines': [ 'WEBRTC_LINUX', @@ -173,8 +194,6 @@ 'defines': [ 'WEBRTC_LINUX', 'WEBRTC_ANDROID', - 'WEBRTC_ARCH_ARM_V7A', # Set default platform to ARMv7. - 'WEBRTC_DETECT_ARM_NEON', # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now, # remove it after I verify that CLOCK_MONOTONIC is fully functional diff --git a/src/common_audio/signal_processing/complex_fft.c b/src/common_audio/signal_processing/complex_fft.c index 1e8503c24..3f06ab333 100644 --- a/src/common_audio/signal_processing/complex_fft.c +++ b/src/common_audio/signal_processing/complex_fft.c @@ -233,7 +233,7 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode) wr = kSinTable1024[j + 256]; wi = -kSinTable1024[j]; -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 WebRtc_Word32 wri; WebRtc_Word32 frfi_r; __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : @@ -244,7 +244,7 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode) { j = i + l; -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); __asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : @@ -374,7 +374,7 @@ int WebRtcSpl_ComplexIFFT(WebRtc_Word16 frfi[], int stages, int mode) wr = kSinTable1024[j + 256]; wi = kSinTable1024[j]; -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 WebRtc_Word32 wri; WebRtc_Word32 frfi_r; __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : @@ -385,7 +385,7 @@ int WebRtcSpl_ComplexIFFT(WebRtc_Word16 frfi[], int stages, int mode) { j = i + l; -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); __asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : diff --git a/src/common_audio/signal_processing/include/signal_processing_library.h b/src/common_audio/signal_processing/include/signal_processing_library.h index 2f2706948..1da9078d8 100644 --- a/src/common_audio/signal_processing/include/signal_processing_library.h +++ b/src/common_audio/signal_processing/include/signal_processing_library.h @@ -75,7 +75,7 @@ #define WEBRTC_SPL_UDIV(a, b) \ ((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(b))) -#ifndef WEBRTC_ARCH_ARM_V7A +#ifndef WEBRTC_ARCH_ARM_V7 // For ARMv7 platforms, these are inline functions in spl_inl_armv7.h #define WEBRTC_SPL_MUL_16_16(a, b) \ ((WebRtc_Word32) (((WebRtc_Word16)(a)) * ((WebRtc_Word16)(b)))) diff --git a/src/common_audio/signal_processing/include/spl_inl.h b/src/common_audio/signal_processing/include/spl_inl.h index 1cc07d2a9..1cde181b9 100644 --- a/src/common_audio/signal_processing/include/spl_inl.h +++ b/src/common_audio/signal_processing/include/spl_inl.h @@ -15,7 +15,7 @@ #ifndef WEBRTC_SPL_SPL_INL_H_ #define WEBRTC_SPL_SPL_INL_H_ -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 #include "spl_inl_armv7.h" #else @@ -116,7 +116,7 @@ static __inline int32_t WebRtc_MulAccumW16(int16_t a, return (a * b + c); } -#endif // WEBRTC_ARCH_ARM_V7A +#endif // WEBRTC_ARCH_ARM_V7 // The following functions have no optimized versions. // TODO(kma): Consider saturating add/sub instructions in X86 platform. diff --git a/src/common_audio/signal_processing/min_max_operations.c b/src/common_audio/signal_processing/min_max_operations.c index ec377d2ea..d3539d7cf 100644 --- a/src/common_audio/signal_processing/min_max_operations.c +++ b/src/common_audio/signal_processing/min_max_operations.c @@ -31,7 +31,8 @@ // TODO(bjorn/kma): Consolidate function pairs (e.g. combine // WebRtcSpl_MaxAbsValueW16 and WebRtcSpl_MaxAbsIndexW16 into a single one.) -#if !(defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM_NEON)) +// TODO(kma): Move the code in the #ifndef block into min_max_operations_c.c. +#ifndef WEBRTC_ARCH_ARM_NEON // Maximum absolute value of word16 vector. int16_t WebRtcSpl_MaxAbsValueW16(const int16_t* vector, int length) { @@ -144,7 +145,7 @@ int32_t WebRtcSpl_MinValueW32(const int32_t* vector, int length) { } return minimum; } -#endif +#endif // WEBRTC_ARCH_ARM_NEON // Index of maximum absolute value in a word16 vector. diff --git a/src/common_audio/signal_processing/resample_by_2.c b/src/common_audio/signal_processing/resample_by_2.c index e239db75c..c1d8b3784 100644 --- a/src/common_audio/signal_processing/resample_by_2.c +++ b/src/common_audio/signal_processing/resample_by_2.c @@ -17,7 +17,7 @@ #include "signal_processing_library.h" -#ifdef WEBRTC_ARCH_ARM_V7A +#ifdef WEBRTC_ARCH_ARM_V7 // allpass filter coefficients. static const WebRtc_UWord32 kResampleAllpass1[3] = {3284, 24441, 49528 << 15}; @@ -62,7 +62,7 @@ static const WebRtc_UWord16 kResampleAllpass2[3] = {12199, 37471, 60255}; #define MUL_ACCUM_1(a, b, c) WEBRTC_SPL_SCALEDIFF32(a, b, c) #define MUL_ACCUM_2(a, b, c) WEBRTC_SPL_SCALEDIFF32(a, b, c) -#endif // WEBRTC_ARCH_ARM_V7A +#endif // WEBRTC_ARCH_ARM_V7 // decimator diff --git a/src/common_audio/signal_processing/vector_scaling_operations.c b/src/common_audio/signal_processing/vector_scaling_operations.c index 76601ad6b..91d9671da 100644 --- a/src/common_audio/signal_processing/vector_scaling_operations.c +++ b/src/common_audio/signal_processing/vector_scaling_operations.c @@ -148,7 +148,7 @@ void WebRtcSpl_ScaleAndAddVectors(G_CONST WebRtc_Word16 *in1, WebRtc_Word16 gain } } -#if !(defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM_NEON)) +#ifndef WEBRTC_ARCH_ARM_NEON int WebRtcSpl_ScaleAndAddVectorsWithRound(const int16_t* in_vector1, int16_t in_vector1_scale, const int16_t* in_vector2, @@ -173,4 +173,4 @@ int WebRtcSpl_ScaleAndAddVectorsWithRound(const int16_t* in_vector1, return 0; } -#endif +#endif // WEBRTC_ARCH_ARM_NEON diff --git a/src/engine_configurations.h b/src/engine_configurations.h index 39e656b34..a1ed4a904 100644 --- a/src/engine_configurations.h +++ b/src/engine_configurations.h @@ -27,7 +27,7 @@ // [Voice] Codec settings // ---------------------------------------------------------------------------- -#ifdef WEBRTC_ANDROID +#ifdef WEBRTC_ARCH_ARM #define WEBRTC_CODEC_ISACFX // fix-point iSAC implementation #else #define WEBRTC_CODEC_ISAC // floating-point iSAC implementation (default) diff --git a/src/modules/audio_coding/codecs/isac/fix/source/filterbanks.c b/src/modules/audio_coding/codecs/isac/fix/source/filterbanks.c index 457815d83..949e7cf6e 100644 --- a/src/modules/audio_coding/codecs/isac/fix/source/filterbanks.c +++ b/src/modules/audio_coding/codecs/isac/fix/source/filterbanks.c @@ -64,7 +64,7 @@ void WebRtcIsacfix_HighpassFilterFixDec32(int16_t *io, for (k=0; k