common_audio/signal_processing: Moves WEBRTC_SPL_UMUL_16_16_RSFT16 to iSAC fix
This macro is only used by the fixed point version of iSAC. Replacing the (five) locations in arith_routines_logist.c, where it is used, with the actual operation. BUG=3348,3353 TESTED=trybots and manually R=kwiberg@webrtc.org, tina.legrand@webrtc.org, turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/14659004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6392 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -55,8 +55,6 @@
|
|||||||
((uint32_t) ((uint32_t)(a) * (uint32_t)(b)))
|
((uint32_t) ((uint32_t)(a) * (uint32_t)(b)))
|
||||||
#define WEBRTC_SPL_UMUL_16_16(a, b) \
|
#define WEBRTC_SPL_UMUL_16_16(a, b) \
|
||||||
((uint32_t) (uint16_t)(a) * (uint16_t)(b))
|
((uint32_t) (uint16_t)(a) * (uint16_t)(b))
|
||||||
#define WEBRTC_SPL_UMUL_16_16_RSFT16(a, b) \
|
|
||||||
(((uint32_t) (uint16_t)(a) * (uint16_t)(b)) >> 16)
|
|
||||||
#define WEBRTC_SPL_UMUL_32_16(a, b) \
|
#define WEBRTC_SPL_UMUL_32_16(a, b) \
|
||||||
((uint32_t) ((uint32_t)(a) * (uint16_t)(b)))
|
((uint32_t) ((uint32_t)(a) * (uint16_t)(b)))
|
||||||
#define WEBRTC_SPL_UMUL_32_16_RSFT16(a, b) \
|
#define WEBRTC_SPL_UMUL_32_16_RSFT16(a, b) \
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ TEST_F(SplTest, MacroTest) {
|
|||||||
EXPECT_EQ(2147483651u, WEBRTC_SPL_UMUL(a, b));
|
EXPECT_EQ(2147483651u, WEBRTC_SPL_UMUL(a, b));
|
||||||
b = WEBRTC_SPL_WORD16_MAX >> 1;
|
b = WEBRTC_SPL_WORD16_MAX >> 1;
|
||||||
EXPECT_EQ(1073627139u, WEBRTC_SPL_UMUL_16_16(a, b));
|
EXPECT_EQ(1073627139u, WEBRTC_SPL_UMUL_16_16(a, b));
|
||||||
EXPECT_EQ(16382u, WEBRTC_SPL_UMUL_16_16_RSFT16(a, b));
|
|
||||||
EXPECT_EQ(4294918147u, WEBRTC_SPL_UMUL_32_16(a, b));
|
EXPECT_EQ(4294918147u, WEBRTC_SPL_UMUL_32_16(a, b));
|
||||||
EXPECT_EQ(65535u, WEBRTC_SPL_UMUL_32_16_RSFT16(a, b));
|
EXPECT_EQ(65535u, WEBRTC_SPL_UMUL_32_16_RSFT16(a, b));
|
||||||
EXPECT_EQ(-49149, WEBRTC_SPL_MUL_16_U16(a, b));
|
EXPECT_EQ(-49149, WEBRTC_SPL_MUL_16_U16(a, b));
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "arith_routins.h"
|
#include "arith_routins.h"
|
||||||
|
|
||||||
|
|
||||||
/* Tables for piecewise linear cdf functions: y = k*x */
|
/* Tables for piecewise linear cdf functions: y = k*x */
|
||||||
|
|
||||||
/* x Points for function piecewise() in Q15 */
|
/* x Points for function piecewise() in Q15 */
|
||||||
@@ -304,7 +303,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
|
|||||||
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
||||||
|
|
||||||
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
||||||
W_tmp += WEBRTC_SPL_UMUL_16_16_RSFT16(cdfTmp, W_upper_LSB);
|
W_tmp += ((uint32_t)cdfTmp * (uint32_t)W_upper_LSB) >> 16;
|
||||||
|
|
||||||
if (streamVal > W_tmp)
|
if (streamVal > W_tmp)
|
||||||
{
|
{
|
||||||
@@ -313,7 +312,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
|
|||||||
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
||||||
|
|
||||||
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
||||||
W_tmp += WEBRTC_SPL_UMUL_16_16_RSFT16(cdfTmp, W_upper_LSB);
|
W_tmp += ((uint32_t)cdfTmp * (uint32_t)W_upper_LSB) >> 16;
|
||||||
|
|
||||||
while (streamVal > W_tmp)
|
while (streamVal > W_tmp)
|
||||||
{
|
{
|
||||||
@@ -323,7 +322,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
|
|||||||
WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
||||||
|
|
||||||
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
||||||
W_tmp += WEBRTC_SPL_UMUL_16_16_RSFT16(cdfTmp, W_upper_LSB);
|
W_tmp += ((uint32_t)cdfTmp * (uint32_t)W_upper_LSB) >> 16;
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if (W_lower == W_tmp) {
|
if (W_lower == W_tmp) {
|
||||||
@@ -342,7 +341,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
|
|||||||
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
cdfTmp = WebRtcIsacfix_Piecewise(WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
||||||
|
|
||||||
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
||||||
W_tmp += WEBRTC_SPL_UMUL_16_16_RSFT16(cdfTmp, W_upper_LSB);
|
W_tmp += ((uint32_t)cdfTmp * (uint32_t)W_upper_LSB) >> 16;
|
||||||
|
|
||||||
while ( !(streamVal > W_tmp) )
|
while ( !(streamVal > W_tmp) )
|
||||||
{
|
{
|
||||||
@@ -352,7 +351,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
|
|||||||
WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
WEBRTC_SPL_MUL_16_U16(candQ7, tmpARSpecQ8));
|
||||||
|
|
||||||
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
W_tmp = WEBRTC_SPL_UMUL_16_16(cdfTmp, W_upper_MSB);
|
||||||
W_tmp += WEBRTC_SPL_UMUL_16_16_RSFT16(cdfTmp, W_upper_LSB);
|
W_tmp += ((uint32_t)cdfTmp * (uint32_t)W_upper_LSB) >> 16;
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if (W_upper == W_tmp){
|
if (W_upper == W_tmp){
|
||||||
|
|||||||
Reference in New Issue
Block a user