common_audio/signal_processing: Removes macro WEBRTC_SPL_MUL_32_32_RSFT32
The macro is only used at four places in iSAC fixed point and the macro have been replaced at those places.
In addition, it is used in a unit test, but throws a warning treated as error (issue3674).
The macro has both MIPS and armv7 optimizations. Removing them impacts only MIPS platforms without DSP ASE. This may cause a very small increase in complexity when using iSAC fix.
The armv7 optimizations are not used anywhere, since specific ones are used inline in iSAC fix.
BUG=3348,3353,3674
TESTED=locally and trybots
R=ljubomir.papuga@gmail.com, tina.legrand@webrtc.org, turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/16299004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6871 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/common_audio/signal_processing/include/signal_processing_library.h b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
index a658645..36ee34f 100644
--- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h
+++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
@@ -75,9 +75,6 @@
#define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \
(WEBRTC_SPL_MUL_16_16(a, b >> 16) \
+ ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15))
-#define WEBRTC_SPL_MUL_32_32_RSFT32(a32a, a32b, b32) \
- ((int32_t)(WEBRTC_SPL_MUL_16_32_RSFT16(a32a, b32) \
- + (WEBRTC_SPL_MUL_16_32_RSFT16(a32b, b32) >> 16)))
#endif
#endif
diff --git a/webrtc/common_audio/signal_processing/include/spl_inl_armv7.h b/webrtc/common_audio/signal_processing/include/spl_inl_armv7.h
index a437a55..b52ebc5 100644
--- a/webrtc/common_audio/signal_processing/include/spl_inl_armv7.h
+++ b/webrtc/common_audio/signal_processing/include/spl_inl_armv7.h
@@ -30,25 +30,6 @@
return tmp;
}
-/* This function produces result that is not bit exact with that by the generic
- * C version in some cases, although the former is at least as accurate as the
- * later.
- */
-static __inline int32_t WEBRTC_SPL_MUL_32_32_RSFT32(int16_t a,
- int16_t b,
- int32_t c) {
- int32_t tmp = 0;
- __asm __volatile (
- "pkhbt %[tmp], %[b], %[a], lsl #16\n\t"
- "smmulr %[tmp], %[tmp], %[c]\n\t"
- :[tmp]"+&r"(tmp)
- :[a]"r"(a),
- [b]"r"(b),
- [c]"r"(c)
- );
- return tmp;
-}
-
static __inline int32_t WEBRTC_SPL_MUL_32_32_RSFT32BI(int32_t a, int32_t b) {
int32_t tmp = 0;
__asm volatile ("smmulr %0, %1, %2":"=r"(tmp):"r"(a), "r"(b));
diff --git a/webrtc/common_audio/signal_processing/include/spl_inl_mips.h b/webrtc/common_audio/signal_processing/include/spl_inl_mips.h
index e173777..f29f701 100644
--- a/webrtc/common_audio/signal_processing/include/spl_inl_mips.h
+++ b/webrtc/common_audio/signal_processing/include/spl_inl_mips.h
@@ -78,50 +78,6 @@
return tmp;
}
-static __inline int32_t WEBRTC_SPL_MUL_32_32_RSFT32(int16_t a,
- int16_t b,
- int32_t c) {
- int32_t tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
-
- __asm __volatile(
- "sra %[tmp1], %[c], 16 \n\t"
- "andi %[tmp2], %[c], 0xFFFF \n\t"
-#if defined(MIPS32_R2_LE)
- "seh %[a], %[a] \n\t"
- "seh %[b], %[b] \n\t"
-#else
- "sll %[a], %[a], 16 \n\t"
- "sra %[a], %[a], 16 \n\t"
- "sll %[b], %[b], 16 \n\t"
- "sra %[b], %[b], 16 \n\t"
-#endif
- "sra %[tmp2], %[tmp2], 1 \n\t"
- "mul %[tmp3], %[a], %[tmp2] \n\t"
- "mul %[tmp4], %[b], %[tmp2] \n\t"
- "mul %[tmp2], %[a], %[tmp1] \n\t"
- "mul %[tmp1], %[b], %[tmp1] \n\t"
-#if defined(MIPS_DSP_R1_LE)
- "shra_r.w %[tmp3], %[tmp3], 15 \n\t"
- "shra_r.w %[tmp4], %[tmp4], 15 \n\t"
-#else
- "addiu %[tmp3], %[tmp3], 0x4000 \n\t"
- "sra %[tmp3], %[tmp3], 15 \n\t"
- "addiu %[tmp4], %[tmp4], 0x4000 \n\t"
- "sra %[tmp4], %[tmp4], 15 \n\t"
-#endif
- "addu %[tmp3], %[tmp3], %[tmp2] \n\t"
- "addu %[tmp4], %[tmp4], %[tmp1] \n\t"
- "sra %[tmp4], %[tmp4], 16 \n\t"
- "addu %[tmp1], %[tmp3], %[tmp4] \n\t"
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2),
- [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
- [a] "+r" (a), [b] "+r" (b)
- : [c] "r" (c)
- : "hi", "lo"
- );
- return tmp1;
-}
-
#if defined(MIPS_DSP_R1_LE)
static __inline int16_t WebRtcSpl_SatW32ToW16(int32_t value32) {
__asm __volatile(
diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
index 284fb83..2a34708 100644
--- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
@@ -61,10 +61,6 @@
EXPECT_EQ(-3, WEBRTC_SPL_MUL_16_32_RSFT14(a, b));
EXPECT_EQ(-24, WEBRTC_SPL_MUL_16_32_RSFT11(a, b));
- int a32a = (WEBRTC_SPL_WORD32_MAX >> 16);
- int a32b = (WEBRTC_SPL_WORD32_MAX & 0x0000ffff);
- EXPECT_EQ(5, WEBRTC_SPL_MUL_32_32_RSFT32(a32a, a32b, A));
-
EXPECT_EQ(-12288, WEBRTC_SPL_MUL_16_16_RSFT(a, b, 2));
EXPECT_EQ(-12287, WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, 2));
@@ -104,15 +100,10 @@
EXPECT_EQ(-1073741824,
WEBRTC_SPL_MUL_16_32_RSFT16(WEBRTC_SPL_WORD16_MIN,
WEBRTC_SPL_WORD32_MAX));
- EXPECT_EQ(0x3fffffff, WEBRTC_SPL_MUL_32_32_RSFT32(WEBRTC_SPL_WORD16_MAX,
- 0xffff, WEBRTC_SPL_WORD32_MAX));
#else
EXPECT_EQ(-1073741823,
WEBRTC_SPL_MUL_16_32_RSFT16(WEBRTC_SPL_WORD16_MIN,
WEBRTC_SPL_WORD32_MAX));
- // TODO(bjornv): fix issue 3674 and re-enable or delete the following test.
- // EXPECT_EQ(0x3fff7ffe, WEBRTC_SPL_MUL_32_32_RSFT32(WEBRTC_SPL_WORD16_MAX,
- // 0xffff, WEBRTC_SPL_WORD32_MAX));
#endif
}
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c
index 1928a7c..c8dcb16 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c
@@ -129,12 +129,16 @@
}
#else
/* Q35 * Q4 = Q39 ; shift 32 bit => Q7 */
- a1 = WEBRTC_SPL_MUL_32_32_RSFT32(coefficient[5], coefficient[4], state0);
- b1 = WEBRTC_SPL_MUL_32_32_RSFT32(coefficient[7], coefficient[6], state1);
+ a1 = WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[5], state0) +
+ (WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[4], state0) >> 16);
+ b1 = WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[7], state1) +
+ (WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[6], state1) >> 16);
/* Q30 * Q4 = Q34 ; shift 32 bit => Q2 */
- a2 = WEBRTC_SPL_MUL_32_32_RSFT32(coefficient[1], coefficient[0], state0);
- b2 = WEBRTC_SPL_MUL_32_32_RSFT32(coefficient[3], coefficient[2], state1);
+ a2 = WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[1], state0) +
+ (WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[0], state0) >> 16);
+ b2 = WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[3], state1) +
+ (WEBRTC_SPL_MUL_16_32_RSFT16(coefficient[2], state1) >> 16);
#endif
c = ((int32_t)in) + WEBRTC_SPL_RSHIFT_W32(a1+b1, 7); // Q0