optimized one spl function for AECM.
AECM test results bit-exact. Review URL: http://webrtc-codereview.appspot.com/139012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@556 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
3bbe41aad6
commit
b6fc9f1d6f
@ -228,7 +228,7 @@ WebRtc_Word16 WebRtcSpl_OnesArrayW32(WebRtc_Word32* vector,
|
||||
|
||||
// Minimum and maximum operations. Implementation in min_max_operations.c.
|
||||
// Descriptions at bottom of file.
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(G_CONST WebRtc_Word16* vector,
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(const WebRtc_Word16* vector,
|
||||
WebRtc_Word16 length);
|
||||
WebRtc_Word32 WebRtcSpl_MaxAbsValueW32(G_CONST WebRtc_Word32* vector,
|
||||
WebRtc_Word16 length);
|
||||
|
@ -72,6 +72,13 @@ LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../interface \
|
||||
$(LOCAL_PATH)/../../../..
|
||||
|
||||
ifeq ($(ARCH_ARM_HAVE_NEON),true)
|
||||
LOCAL_SRC_FILES += \
|
||||
min_max_operations_neon.c
|
||||
LOCAL_CFLAGS += \
|
||||
$(MY_ARM_CFLAGS_NEON)
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libstlport
|
||||
|
||||
ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
|
||||
|
@ -28,8 +28,10 @@
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
|
||||
#if !(defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM_NEON))
|
||||
|
||||
// Maximum absolute value of word16 vector.
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(G_CONST WebRtc_Word16 *vector, WebRtc_Word16 length)
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(const WebRtc_Word16 *vector, WebRtc_Word16 length)
|
||||
{
|
||||
WebRtc_Word32 tempMax = 0;
|
||||
WebRtc_Word32 absVal;
|
||||
@ -37,49 +39,6 @@ WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(G_CONST WebRtc_Word16 *vector, WebRtc_Wor
|
||||
int i;
|
||||
G_CONST WebRtc_Word16 *tmpvector = vector;
|
||||
|
||||
#ifdef _ARM_OPT_
|
||||
#pragma message("NOTE: _ARM_OPT_ optimizations are used")
|
||||
|
||||
WebRtc_Word16 len4 = (length >> 2) << 2;
|
||||
|
||||
for (i = 0; i < len4; i = i + 4)
|
||||
{
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
if (absVal > tempMax)
|
||||
{
|
||||
tempMax = absVal;
|
||||
}
|
||||
tmpvector++;
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
if (absVal > tempMax)
|
||||
{
|
||||
tempMax = absVal;
|
||||
}
|
||||
tmpvector++;
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
if (absVal > tempMax)
|
||||
{
|
||||
tempMax = absVal;
|
||||
}
|
||||
tmpvector++;
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
if (absVal > tempMax)
|
||||
{
|
||||
tempMax = absVal;
|
||||
}
|
||||
tmpvector++;
|
||||
}
|
||||
|
||||
for (i = len4; i < len; i++)
|
||||
{
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
if (absVal > tempMax)
|
||||
{
|
||||
tempMax = absVal;
|
||||
}
|
||||
tmpvector++;
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
|
||||
@ -91,9 +50,10 @@ WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(G_CONST WebRtc_Word16 *vector, WebRtc_Wor
|
||||
}
|
||||
totMax = (WebRtc_Word16)WEBRTC_SPL_MIN(tempMax, WEBRTC_SPL_WORD16_MAX);
|
||||
return totMax;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Index of maximum absolute value in a word16 vector.
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsIndexW16(G_CONST WebRtc_Word16* vector, WebRtc_Word16 length)
|
||||
{
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2011 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
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#if (defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM_NEON))
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
|
||||
// Maximum absolute value of word16 vector.
|
||||
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(const WebRtc_Word16* vector,
|
||||
WebRtc_Word16 length) {
|
||||
WebRtc_Word32 temp_max = 0;
|
||||
WebRtc_Word32 abs_val;
|
||||
WebRtc_Word16 tot_max;
|
||||
int i;
|
||||
|
||||
__asm__("vmov.i16 d25, #0" : : : "d25");
|
||||
|
||||
for (i = 0; i < length - 7; i += 8) {
|
||||
__asm__("vld1.16 {d26, d27}, [%0]" : : "r"(&vector[i]) : "q13");
|
||||
__asm__("vabs.s16 q13, q13" : : : "q13");
|
||||
__asm__("vpmax.s16 d26, d27" : : : "q13");
|
||||
__asm__("vpmax.s16 d25, d26" : : : "d25", "d26");
|
||||
}
|
||||
__asm__("vpmax.s16 d25, d25" : : : "d25");
|
||||
__asm__("vpmax.s16 d25, d25" : : : "d25");
|
||||
__asm__("vmov.s16 %0, d25[0]" : "=r"(temp_max): : "d25");
|
||||
|
||||
for (; i < length; i++) {
|
||||
abs_val = WEBRTC_SPL_ABS_W32((vector[i]));
|
||||
if (abs_val > temp_max) {
|
||||
temp_max = abs_val;
|
||||
}
|
||||
}
|
||||
tot_max = (WebRtc_Word16)WEBRTC_SPL_MIN(temp_max, WEBRTC_SPL_WORD16_MAX);
|
||||
return tot_max;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user