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
This commit is contained in:
kma@webrtc.org 2012-08-28 04:09:50 +00:00
parent 7611791ade
commit 94771cb6a0
10 changed files with 40 additions and 20 deletions

View File

@ -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"', { ['OS=="linux"', {
'defines': [ 'defines': [
'WEBRTC_LINUX', 'WEBRTC_LINUX',
@ -173,8 +194,6 @@
'defines': [ 'defines': [
'WEBRTC_LINUX', 'WEBRTC_LINUX',
'WEBRTC_ANDROID', 'WEBRTC_ANDROID',
'WEBRTC_ARCH_ARM_V7A', # Set default platform to ARMv7.
'WEBRTC_DETECT_ARM_NEON',
# TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
# support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now, # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
# remove it after I verify that CLOCK_MONOTONIC is fully functional # remove it after I verify that CLOCK_MONOTONIC is fully functional

View File

@ -233,7 +233,7 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode)
wr = kSinTable1024[j + 256]; wr = kSinTable1024[j + 256];
wi = -kSinTable1024[j]; wi = -kSinTable1024[j];
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
WebRtc_Word32 wri; WebRtc_Word32 wri;
WebRtc_Word32 frfi_r; WebRtc_Word32 frfi_r;
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : __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; j = i + l;
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) :
"r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1]));
__asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : __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]; wr = kSinTable1024[j + 256];
wi = kSinTable1024[j]; wi = kSinTable1024[j];
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
WebRtc_Word32 wri; WebRtc_Word32 wri;
WebRtc_Word32 frfi_r; WebRtc_Word32 frfi_r;
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : __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; j = i + l;
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) :
"r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1]));
__asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : __asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) :

View File

@ -75,7 +75,7 @@
#define WEBRTC_SPL_UDIV(a, b) \ #define WEBRTC_SPL_UDIV(a, b) \
((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(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 // For ARMv7 platforms, these are inline functions in spl_inl_armv7.h
#define WEBRTC_SPL_MUL_16_16(a, b) \ #define WEBRTC_SPL_MUL_16_16(a, b) \
((WebRtc_Word32) (((WebRtc_Word16)(a)) * ((WebRtc_Word16)(b)))) ((WebRtc_Word32) (((WebRtc_Word16)(a)) * ((WebRtc_Word16)(b))))

View File

@ -15,7 +15,7 @@
#ifndef WEBRTC_SPL_SPL_INL_H_ #ifndef WEBRTC_SPL_SPL_INL_H_
#define 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" #include "spl_inl_armv7.h"
#else #else
@ -116,7 +116,7 @@ static __inline int32_t WebRtc_MulAccumW16(int16_t a,
return (a * b + c); return (a * b + c);
} }
#endif // WEBRTC_ARCH_ARM_V7A #endif // WEBRTC_ARCH_ARM_V7
// The following functions have no optimized versions. // The following functions have no optimized versions.
// TODO(kma): Consider saturating add/sub instructions in X86 platform. // TODO(kma): Consider saturating add/sub instructions in X86 platform.

View File

@ -31,7 +31,8 @@
// TODO(bjorn/kma): Consolidate function pairs (e.g. combine // TODO(bjorn/kma): Consolidate function pairs (e.g. combine
// WebRtcSpl_MaxAbsValueW16 and WebRtcSpl_MaxAbsIndexW16 into a single one.) // 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. // Maximum absolute value of word16 vector.
int16_t WebRtcSpl_MaxAbsValueW16(const int16_t* vector, int length) { 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; return minimum;
} }
#endif #endif // WEBRTC_ARCH_ARM_NEON
// Index of maximum absolute value in a word16 vector. // Index of maximum absolute value in a word16 vector.

View File

@ -17,7 +17,7 @@
#include "signal_processing_library.h" #include "signal_processing_library.h"
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
// allpass filter coefficients. // allpass filter coefficients.
static const WebRtc_UWord32 kResampleAllpass1[3] = {3284, 24441, 49528 << 15}; 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_1(a, b, c) WEBRTC_SPL_SCALEDIFF32(a, b, c)
#define MUL_ACCUM_2(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 // decimator

View File

@ -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, int WebRtcSpl_ScaleAndAddVectorsWithRound(const int16_t* in_vector1,
int16_t in_vector1_scale, int16_t in_vector1_scale,
const int16_t* in_vector2, const int16_t* in_vector2,
@ -173,4 +173,4 @@ int WebRtcSpl_ScaleAndAddVectorsWithRound(const int16_t* in_vector1,
return 0; return 0;
} }
#endif #endif // WEBRTC_ARCH_ARM_NEON

View File

@ -27,7 +27,7 @@
// [Voice] Codec settings // [Voice] Codec settings
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ARCH_ARM
#define WEBRTC_CODEC_ISACFX // fix-point iSAC implementation #define WEBRTC_CODEC_ISACFX // fix-point iSAC implementation
#else #else
#define WEBRTC_CODEC_ISAC // floating-point iSAC implementation (default) #define WEBRTC_CODEC_ISAC // floating-point iSAC implementation (default)

View File

@ -64,7 +64,7 @@ void WebRtcIsacfix_HighpassFilterFixDec32(int16_t *io,
for (k=0; k<len; k++) { for (k=0; k<len; k++) {
in = (WebRtc_Word32)io[k]; in = (WebRtc_Word32)io[k];
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
{ {
int tmp_coeff0 = 0; int tmp_coeff0 = 0;
int tmp_coeff1 = 0; int tmp_coeff1 = 0;

View File

@ -1409,7 +1409,7 @@ static int TimeToFrequencyDomain(const WebRtc_Word16* time_signal,
WebRtc_Word16 *fft = (WebRtc_Word16 *) (((uintptr_t) fft_buf + 31) & ~31); WebRtc_Word16 *fft = (WebRtc_Word16 *) (((uintptr_t) fft_buf + 31) & ~31);
WebRtc_Word16 tmp16no1; WebRtc_Word16 tmp16no1;
#ifndef WEBRTC_ARCH_ARM_V7A #ifndef WEBRTC_ARCH_ARM_V7
WebRtc_Word16 tmp16no2; WebRtc_Word16 tmp16no2;
#endif #endif
#ifdef AECM_WITH_ABS_APPROX #ifdef AECM_WITH_ABS_APPROX
@ -1494,7 +1494,7 @@ static int TimeToFrequencyDomain(const WebRtc_Word16* time_signal,
freq_signal_abs[i] = (WebRtc_UWord16)tmp16no1 + freq_signal_abs[i] = (WebRtc_UWord16)tmp16no1 +
(WebRtc_UWord16)tmp16no2; (WebRtc_UWord16)tmp16no2;
#else #else
#ifdef WEBRTC_ARCH_ARM_V7A #ifdef WEBRTC_ARCH_ARM_V7
__asm __volatile( __asm __volatile(
"smulbb %[tmp32no1], %[real], %[real]\n\t" "smulbb %[tmp32no1], %[real], %[real]\n\t"
"smlabb %[tmp32no2], %[imag], %[imag], %[tmp32no1]\n\t" "smlabb %[tmp32no2], %[imag], %[imag], %[tmp32no1]\n\t"
@ -1509,7 +1509,7 @@ static int TimeToFrequencyDomain(const WebRtc_Word16* time_signal,
tmp32no1 = WEBRTC_SPL_MUL_16_16(tmp16no1, tmp16no1); tmp32no1 = WEBRTC_SPL_MUL_16_16(tmp16no1, tmp16no1);
tmp32no2 = WEBRTC_SPL_MUL_16_16(tmp16no2, tmp16no2); tmp32no2 = WEBRTC_SPL_MUL_16_16(tmp16no2, tmp16no2);
tmp32no2 = WEBRTC_SPL_ADD_SAT_W32(tmp32no1, tmp32no2); tmp32no2 = WEBRTC_SPL_ADD_SAT_W32(tmp32no1, tmp32no2);
#endif // WEBRTC_ARCH_ARM_V7A #endif // WEBRTC_ARCH_ARM_V7
tmp32no1 = WebRtcSpl_SqrtFloor(tmp32no2); tmp32no1 = WebRtcSpl_SqrtFloor(tmp32no2);
freq_signal_abs[i] = (WebRtc_UWord16)tmp32no1; freq_signal_abs[i] = (WebRtc_UWord16)tmp32no1;