From ada5db4e7554a4c76b3d59a63e318081d7bf1693 Mon Sep 17 00:00:00 2001 From: "leozwang@webrtc.org" Date: Fri, 18 May 2012 16:48:45 +0000 Subject: [PATCH] Enable aecm neon optimized code in android build Description: This CL is a follow up of http://review.webrtc.org/575008/ and r2241. Because of r2243, r2241 is messed up and reverted, I'm going to commit it again. This is exact same to the last patch in 575008, just want to inform you and have your double check before I commit it. The original description This cl enables cpu detection and aecm optimized code in android build. BUG= TEST=build on all platforms Review URL: https://webrtc-codereview.appspot.com/568006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2259 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/build/common.gypi | 1 + src/modules/audio_processing/aecm/aecm.gypi | 22 +++++++++++++++++++ .../audio_processing/aecm/aecm_core_neon.c | 6 ++--- src/modules/audio_processing/ns/ns.gypi | 3 --- .../main/test/android_test/jni/Android.mk | 7 ++++++ 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/build/common.gypi b/src/build/common.gypi index 161c30f742..5601827f9e 100644 --- a/src/build/common.gypi +++ b/src/build/common.gypi @@ -168,6 +168,7 @@ 'WEBRTC_ANDROID', # TODO(leozwang): move WEBRTC_ARCH_ARM to typedefs.h. 'WEBRTC_ARCH_ARM', + '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/modules/audio_processing/aecm/aecm.gypi b/src/modules/audio_processing/aecm/aecm.gypi index 3e4a113f78..42b1b7763b 100644 --- a/src/modules/audio_processing/aecm/aecm.gypi +++ b/src/modules/audio_processing/aecm/aecm.gypi @@ -30,6 +30,28 @@ 'aecm_core.c', 'aecm_core.h', ], + 'conditions': [ + ['OS=="android"', { + 'dependencies': [ 'aecm_neon', ], + }], + ], }, ], + 'conditions': [ + ['OS=="android"', { + 'targets': [ + { + 'target_name': 'aecm_neon', + 'type': '<(library)', + 'includes': [ '../../../build/arm_neon.gypi', ], + 'dependencies': [ + '<(webrtc_root)/common_audio/common_audio.gyp:signal_processing', + ], + 'sources': [ + 'aecm_core_neon.c', + ], + }, + ], + }], + ], } diff --git a/src/modules/audio_processing/aecm/aecm_core_neon.c b/src/modules/audio_processing/aecm/aecm_core_neon.c index ab448b48da..169201d9ef 100644 --- a/src/modules/audio_processing/aecm/aecm_core_neon.c +++ b/src/modules/audio_processing/aecm/aecm_core_neon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -16,7 +16,7 @@ // Square root of Hanning window in Q14. static const WebRtc_Word16 kSqrtHanningReversed[] __attribute__((aligned(8))) = { - 16384, 16373, 16354, 16325, + 16384, 16373, 16354, 16325, 16286, 16237, 16179, 16111, 16034, 15947, 15851, 15746, 15631, 15506, 15373, 15231, @@ -92,7 +92,6 @@ static void InverseFFTAndWindowNeon(AecmCore_t* aecm, WebRtc_Word16* output, const WebRtc_Word16* nearendClean) { int i, j, outCFFT; - WebRtc_Word32 tmp32no1; // Synthesis for (i = 0, j = 0; i < PART_LEN; i += 4, j += 8) { @@ -198,7 +197,6 @@ static void CalcLinearEnergiesNeon(AecmCore_t* aecm, register WebRtc_UWord32 far_energy_r; register WebRtc_UWord32 echo_energy_stored_r; register WebRtc_UWord32 echo_energy_adapt_r; - uint32x4_t tmp32x4_0; __asm__("vmov.i32 q14, #0" : : : "q14"); // far_energy __asm__("vmov.i32 q8, #0" : : : "q8"); // echo_energy_stored diff --git a/src/modules/audio_processing/ns/ns.gypi b/src/modules/audio_processing/ns/ns.gypi index 1dbbe6822f..16bc0dde76 100644 --- a/src/modules/audio_processing/ns/ns.gypi +++ b/src/modules/audio_processing/ns/ns.gypi @@ -57,9 +57,6 @@ 'conditions': [ ['OS=="android"', { 'dependencies': [ 'ns_neon', ], - 'defines': [ - 'WEBRTC_DETECT_ARM_NEON' - ], }], ], }, diff --git a/src/video_engine/main/test/android_test/jni/Android.mk b/src/video_engine/main/test/android_test/jni/Android.mk index 8446b4226f..8146ae987a 100644 --- a/src/video_engine/main/test/android_test/jni/Android.mk +++ b/src/video_engine/main/test/android_test/jni/Android.mk @@ -142,6 +142,12 @@ LOCAL_SRC_FILES := \ $(MY_LIBS_PATH)/src/modules/libaecm.a include $(PREBUILT_STATIC_LIBRARY) +include $(CLEAR_VARS) +LOCAL_MODULE := libaecm_neon +LOCAL_SRC_FILES := \ + $(MY_LIBS_PATH)/src/modules/libaecm_neon.a +include $(PREBUILT_STATIC_LIBRARY) + include $(CLEAR_VARS) LOCAL_MODULE := libbitrate_controller LOCAL_SRC_FILES := \ @@ -312,6 +318,7 @@ LOCAL_STATIC_LIBRARIES := \ libagc \ libaec \ libaecm \ + libaecm_neon \ libbitrate_controller \ libresampler \ libsignal_processing \