Refactoring common_audio/signal_processing: Replaces trivial macros
The macros WEBRTC_SPL_ADD_SAT_W16 and WEBRTC_SPL_ADD_SAT_W32 make direct use of the corresponding functions WebRtcSpl_AddSatW16() and WebRtcSpl_AddSatW32(). This CL replaces these macros in the code. BUG=3348,3353 TESTED=locally on linux and trybots R=kwiberg@webrtc.org, tina.legrand@webrtc.org, turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/21199004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6960 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
584cd8da4b
commit
6e71d17bc9
@ -88,15 +88,15 @@ void WebRtcSpl_AutoCorrToReflCoef(const int32_t *R, int use_order, int16_t *K)
|
||||
pptr = P;
|
||||
wptr = w1ptr;
|
||||
tmp = (int16_t)(((int32_t)*p1ptr * (int32_t)*K + 16384) >> 15);
|
||||
*pptr = WEBRTC_SPL_ADD_SAT_W16( *pptr, tmp );
|
||||
*pptr = WebRtcSpl_AddSatW16(*pptr, tmp);
|
||||
pptr++;
|
||||
for (i = 1; i <= use_order - n; i++)
|
||||
{
|
||||
tmp = (int16_t)(((int32_t)*wptr * (int32_t)*K + 16384) >> 15);
|
||||
*pptr = WEBRTC_SPL_ADD_SAT_W16( *(pptr+1), tmp );
|
||||
*pptr = WebRtcSpl_AddSatW16(*(pptr + 1), tmp);
|
||||
pptr++;
|
||||
tmp = (int16_t)(((int32_t)*pptr * (int32_t)*K + 16384) >> 15);
|
||||
*wptr = WEBRTC_SPL_ADD_SAT_W16( *wptr, tmp );
|
||||
*wptr = WebRtcSpl_AddSatW16(*wptr, tmp);
|
||||
wptr++;
|
||||
}
|
||||
}
|
||||
|
@ -84,12 +84,9 @@
|
||||
#define WEBRTC_SPL_SCALEDIFF32(A, B, C) \
|
||||
(C + (B >> 16) * A + (((uint32_t)(0x0000FFFF & B) * A) >> 16))
|
||||
|
||||
#define WEBRTC_SPL_ADD_SAT_W32(a, b) WebRtcSpl_AddSatW32(a, b)
|
||||
#define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b)
|
||||
#define WEBRTC_SPL_MUL_32_16(a, b) ((a) * (b))
|
||||
|
||||
#define WEBRTC_SPL_ADD_SAT_W16(a, b) WebRtcSpl_AddSatW16(a, b)
|
||||
|
||||
// Shifting with negative numbers allowed
|
||||
// Positive means left shift
|
||||
#define WEBRTC_SPL_SHIFT_W32(x, c) \
|
||||
|
@ -58,13 +58,10 @@ TEST_F(SplTest, MacroTest) {
|
||||
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));
|
||||
|
||||
EXPECT_EQ(16380, WEBRTC_SPL_ADD_SAT_W32(a, b));
|
||||
EXPECT_EQ(21, WEBRTC_SPL_SAT(a, A, B));
|
||||
EXPECT_EQ(21, WEBRTC_SPL_SAT(a, B, A));
|
||||
EXPECT_EQ(-49149, WEBRTC_SPL_MUL_32_16(a, b));
|
||||
|
||||
EXPECT_EQ(16380, WEBRTC_SPL_ADD_SAT_W16(a, b));
|
||||
|
||||
// Shifting with negative numbers allowed
|
||||
int shift_amount = 1; // Workaround compiler warning using variable here.
|
||||
// Positive means left shift
|
||||
|
@ -134,7 +134,7 @@ int16_t WebRtcIsacfix_DecodeImpl(int16_t *signal_out16,
|
||||
/* ---- Add-overlap ---- */
|
||||
WebRtcSpl_GetHanningWindow( overlapWin, RECOVERY_OVERLAP );
|
||||
for( k = 0; k < RECOVERY_OVERLAP; k++ )
|
||||
Vector_Word16_1[k] = WEBRTC_SPL_ADD_SAT_W16(
|
||||
Vector_Word16_1[k] = WebRtcSpl_AddSatW16(
|
||||
(int16_t)WEBRTC_SPL_MUL_16_16_RSFT( (ISACdec_obj->plcstr_obj).overlapLP[k], overlapWin[RECOVERY_OVERLAP - k - 1], 14),
|
||||
(int16_t)WEBRTC_SPL_MUL_16_16_RSFT( Vector_Word16_1[k], overlapWin[k], 14) );
|
||||
|
||||
|
@ -59,13 +59,13 @@ static int16_t plc_filterma_Fast(
|
||||
|
||||
for (j = 0;j < Blen; j++)
|
||||
{
|
||||
o = WEBRTC_SPL_ADD_SAT_W32( o, WEBRTC_SPL_MUL_16_16( *b_ptr, *x_ptr) );
|
||||
o = WebRtcSpl_AddSatW32(o, WEBRTC_SPL_MUL_16_16(*b_ptr, *x_ptr));
|
||||
b_ptr++;
|
||||
x_ptr--;
|
||||
}
|
||||
|
||||
/* to round off correctly */
|
||||
o = WEBRTC_SPL_ADD_SAT_W32( o, WEBRTC_SPL_LSHIFT_W32( 1, (rshift-1) ) );
|
||||
o = WebRtcSpl_AddSatW32(o, 1 << (rshift - 1));
|
||||
|
||||
/* saturate according to the domain of the filter coefficients */
|
||||
o = WEBRTC_SPL_SAT((int32_t)lim, o, (int32_t)-lim);
|
||||
@ -325,7 +325,7 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16,
|
||||
corr = 0;
|
||||
for( k = 0; k < lag0; k++ )
|
||||
{
|
||||
corr = WEBRTC_SPL_ADD_SAT_W32( corr, WEBRTC_SPL_ABS_W32(
|
||||
corr = WebRtcSpl_AddSatW32(corr, WEBRTC_SPL_ABS_W32(
|
||||
WebRtcSpl_SubSatW16(
|
||||
(ISACdec_obj->plcstr_obj).lastPitchLP[k],
|
||||
(ISACdec_obj->plcstr_obj).prevPitchInvIn[
|
||||
@ -756,10 +756,8 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16,
|
||||
}
|
||||
|
||||
/* ------ Sum the noisy and periodic signals ------ */
|
||||
Vector_Word16_1[i] = (int16_t)WEBRTC_SPL_ADD_SAT_W16(
|
||||
wNoisyLP, wPriodicLP );
|
||||
Vector_Word32_2[i] = (int32_t)WEBRTC_SPL_ADD_SAT_W32(
|
||||
wNoisyHP, wPriodicHP );
|
||||
Vector_Word16_1[i] = WebRtcSpl_AddSatW16(wNoisyLP, wPriodicLP);
|
||||
Vector_Word32_2[i] = WebRtcSpl_AddSatW32(wNoisyHP, wPriodicHP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,32 +51,32 @@ void WebRtcIsacfix_AllpassFilter2FixDec16C(
|
||||
in_out = data_ch1[n];
|
||||
a = WEBRTC_SPL_MUL_16_16(factor_ch1[0], in_out); // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WEBRTC_SPL_ADD_SAT_W32(a, state0_ch1);
|
||||
b = WebRtcSpl_AddSatW32(a, state0_ch1);
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b >> 16)); // Q15
|
||||
state0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
state0_ch1 = WebRtcSpl_AddSatW32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
in_out = (int16_t) (b >> 16); // Save as Q0
|
||||
|
||||
a = WEBRTC_SPL_MUL_16_16(factor_ch1[1], in_out); // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WEBRTC_SPL_ADD_SAT_W32(a, state1_ch1); // Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state1_ch1); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b >> 16)); // Q15
|
||||
state1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
state1_ch1 = WebRtcSpl_AddSatW32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
data_ch1[n] = (int16_t) (b >> 16); // Save as Q0
|
||||
|
||||
// Process channel 2:
|
||||
in_out = data_ch2[n];
|
||||
a = WEBRTC_SPL_MUL_16_16(factor_ch2[0], in_out); // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WEBRTC_SPL_ADD_SAT_W32(a, state0_ch2); // Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state0_ch2); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b >> 16)); // Q15
|
||||
state0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
state0_ch2 = WebRtcSpl_AddSatW32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
in_out = (int16_t) (b >> 16); // Save as Q0
|
||||
|
||||
a = WEBRTC_SPL_MUL_16_16(factor_ch2[1], in_out); // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WEBRTC_SPL_ADD_SAT_W32(a, state1_ch2); // Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state1_ch2); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b >> 16)); // Q15
|
||||
state1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
state1_ch2 = WebRtcSpl_AddSatW32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
data_ch2[n] = (int16_t) (b >> 16); // Save as Q0
|
||||
}
|
||||
|
||||
|
@ -147,14 +147,14 @@ FOR_LOOP:
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample0_ch1) << 1;
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[0], sample0_ch2) << 1;
|
||||
@
|
||||
@ b0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1, state0_ch1);
|
||||
@ b0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@ b0_ch1 = WebRtcSpl_AddSatW32(a0_ch1, state0_ch1);
|
||||
@ b0_ch2 = WebRtcSpl_AddSatW32(a0_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b0_ch1 >> 16));
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b0_ch2 >> 16));
|
||||
@
|
||||
@ state0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1 <<1, (uint32_t)sample0_ch1 << 16);
|
||||
@ state0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2 <<1, (uint32_t)sample0_ch2 << 16);
|
||||
@ state0_ch1 = WebRtcSpl_AddSatW32(a0_ch1 <<1, (uint32_t)sample0_ch1 << 16);
|
||||
@ state0_ch2 = WebRtcSpl_AddSatW32(a0_ch2 <<1, (uint32_t)sample0_ch2 << 16);
|
||||
@
|
||||
@ sample1_ch1 = data_ch1[n + 1];
|
||||
@ sample0_ch1 = (int16_t) (b0_ch1 >> 16); //Save as Q0
|
||||
@ -168,20 +168,20 @@ FOR_LOOP:
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[0], sample1_ch2 ) << 1;
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[1], sample0_ch2) << 1;
|
||||
@
|
||||
@ b1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1, state0_ch1);
|
||||
@ b0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@ b0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@ b1_ch1 = WebRtcSpl_AddSatW32(a1_ch1, state0_ch1);
|
||||
@ b0_ch1 = WebRtcSpl_AddSatW32(a0_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WebRtcSpl_AddSatW32(a1_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@ b0_ch2 = WebRtcSpl_AddSatW32(a0_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b1_ch1 >> 16));
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b0_ch1 >> 16));
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b1_ch2 >> 16));
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b0_ch2 >> 16));
|
||||
@
|
||||
@ state0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1<<1, (uint32_t)sample1_ch1 <<16);
|
||||
@ state1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1<<1, (uint32_t)sample0_ch1 <<16);
|
||||
@ state0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2<<1, (uint32_t)sample1_ch2 <<16);
|
||||
@ state1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2<<1, (uint32_t)sample0_ch2 <<16);
|
||||
@ state0_ch1 = WebRtcSpl_AddSatW32(a1_ch1<<1, (uint32_t)sample1_ch1 <<16);
|
||||
@ state1_ch1 = WebRtcSpl_AddSatW32(a0_ch1<<1, (uint32_t)sample0_ch1 <<16);
|
||||
@ state0_ch2 = WebRtcSpl_AddSatW32(a1_ch2<<1, (uint32_t)sample1_ch2 <<16);
|
||||
@ state1_ch2 = WebRtcSpl_AddSatW32(a0_ch2<<1, (uint32_t)sample0_ch2 <<16);
|
||||
@
|
||||
@ sample0_ch1 = data_ch1[n + 2];
|
||||
@ sample1_ch1 = (int16_t) (b1_ch1 >> 16); //Save as Q0
|
||||
@ -193,20 +193,20 @@ FOR_LOOP:
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[0], sample0_ch2) << 1;
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[1], sample1_ch2 ) << 1;
|
||||
@
|
||||
@ b2_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1, state0_ch1);
|
||||
@ b1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b2_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@ b2_ch1 = WebRtcSpl_AddSatW32(a0_ch1, state0_ch1);
|
||||
@ b1_ch1 = WebRtcSpl_AddSatW32(a1_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b2_ch2 = WebRtcSpl_AddSatW32(a0_ch2, state0_ch2); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WebRtcSpl_AddSatW32(a1_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b2_ch1 >> 16));
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b1_ch1 >> 16));
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b2_ch2 >> 16));
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b1_ch2 >> 16));
|
||||
@
|
||||
@ state0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1<<1, (uint32_t)sample0_ch1<<16);
|
||||
@ state1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1<<1, (uint32_t)sample1_ch1<<16);
|
||||
@ state0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2<<1, (uint32_t)sample0_ch2<<16);
|
||||
@ state1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2<<1, (uint32_t)sample1_ch2<<16);
|
||||
@ state0_ch1 = WebRtcSpl_AddSatW32(a0_ch1<<1, (uint32_t)sample0_ch1<<16);
|
||||
@ state1_ch1 = WebRtcSpl_AddSatW32(a1_ch1<<1, (uint32_t)sample1_ch1<<16);
|
||||
@ state0_ch2 = WebRtcSpl_AddSatW32(a0_ch2<<1, (uint32_t)sample0_ch2<<16);
|
||||
@ state1_ch2 = WebRtcSpl_AddSatW32(a1_ch2<<1, (uint32_t)sample1_ch2<<16);
|
||||
@
|
||||
@
|
||||
@ sample1_ch1 = data_ch1[n + 3];
|
||||
@ -227,20 +227,20 @@ FOR_LOOP:
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[0], sample1_ch2 ) << 1;
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[1], sample0_ch2) << 1;
|
||||
@
|
||||
@ b1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1, state0_ch1);
|
||||
@ b0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1, state1_ch1);
|
||||
@ b1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2, state0_ch2);
|
||||
@ b0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2, state1_ch2);
|
||||
@ b1_ch1 = WebRtcSpl_AddSatW32(a1_ch1, state0_ch1);
|
||||
@ b0_ch1 = WebRtcSpl_AddSatW32(a0_ch1, state1_ch1);
|
||||
@ b1_ch2 = WebRtcSpl_AddSatW32(a1_ch2, state0_ch2);
|
||||
@ b0_ch2 = WebRtcSpl_AddSatW32(a0_ch2, state1_ch2);
|
||||
@
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b1_ch1 >> 16));
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b0_ch1 >> 16));
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b1_ch2 >> 16));
|
||||
@ a0_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b0_ch2 >> 16));
|
||||
@
|
||||
@ state0_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1<<1, (uint32_t)sample1_ch1 << 16);
|
||||
@ state1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a0_ch1<<1, (uint32_t)sample0_ch1 << 16);
|
||||
@ state0_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2<<1, (uint32_t)sample1_ch2 << 16);
|
||||
@ state1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a0_ch2<<1, (uint32_t)sample0_ch2 << 16);
|
||||
@ state0_ch1 = WebRtcSpl_AddSatW32(a1_ch1<<1, (uint32_t)sample1_ch1 << 16);
|
||||
@ state1_ch1 = WebRtcSpl_AddSatW32(a0_ch1<<1, (uint32_t)sample0_ch1 << 16);
|
||||
@ state0_ch2 = WebRtcSpl_AddSatW32(a1_ch2<<1, (uint32_t)sample1_ch2 << 16);
|
||||
@ state1_ch2 = WebRtcSpl_AddSatW32(a0_ch2<<1, (uint32_t)sample0_ch2 << 16);
|
||||
@
|
||||
@ data_ch1[n] = (int16_t) (b0_ch1 >> 16); //Save as Q0
|
||||
@ data_ch2[n] = (int16_t) (b0_ch2 >> 16);
|
||||
@ -251,14 +251,14 @@ FOR_LOOP:
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample1_ch1) << 1;
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(factor_ch2[1], sample1_ch2 ) << 1;
|
||||
@
|
||||
@ b1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@ b1_ch1 = WebRtcSpl_AddSatW32(a1_ch1, state1_ch1); //Q16+Q16=Q16
|
||||
@ b1_ch2 = WebRtcSpl_AddSatW32(a1_ch2, state1_ch2); //Q16+Q16=Q16
|
||||
@
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b1_ch1 >> 16));
|
||||
@ a1_ch2 = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b1_ch2 >> 16));
|
||||
@
|
||||
@ state1_ch1 = WEBRTC_SPL_ADD_SAT_W32(a1_ch1<<1, (uint32_t)sample1_ch1<<16);
|
||||
@ state1_ch2 = WEBRTC_SPL_ADD_SAT_W32(a1_ch2<<1, (uint32_t)sample1_ch2<<16);
|
||||
@ state1_ch1 = WebRtcSpl_AddSatW32(a1_ch1<<1, (uint32_t)sample1_ch1<<16);
|
||||
@ state1_ch2 = WebRtcSpl_AddSatW32(a1_ch2<<1, (uint32_t)sample1_ch2<<16);
|
||||
@
|
||||
@ data_ch1[n + 1] = (int16_t) (b1_ch1 >> 16); //Save as Q0
|
||||
@ data_ch2[n + 1] = (int16_t) (b1_ch2 >> 16);
|
||||
|
@ -75,11 +75,11 @@ static void AllpassFilterForDec32(int16_t *InOut16, //Q0
|
||||
for (n=0;n<lengthInOut;n+=2){
|
||||
a = WEBRTC_SPL_MUL_16_32_RSFT16(InOut16[n], APSectionFactors[j]); //Q0*Q31=Q31 shifted 16 gives Q15
|
||||
a = WEBRTC_SPL_LSHIFT_W32(a, 1); // Q15 -> Q16
|
||||
b = WEBRTC_SPL_ADD_SAT_W32(a, FilterState[j]); //Q16+Q16=Q16
|
||||
b = WebRtcSpl_AddSatW32(a, FilterState[j]); //Q16+Q16=Q16
|
||||
a = WEBRTC_SPL_MUL_16_32_RSFT16(
|
||||
(int16_t) WEBRTC_SPL_RSHIFT_W32(b, 16),
|
||||
-APSectionFactors[j]); //Q0*Q31=Q31 shifted 16 gives Q15
|
||||
FilterState[j] = WEBRTC_SPL_ADD_SAT_W32(
|
||||
FilterState[j] = WebRtcSpl_AddSatW32(
|
||||
WEBRTC_SPL_LSHIFT_W32(a,1),
|
||||
WEBRTC_SPL_LSHIFT_W32((uint32_t)InOut16[n], 16)); // Q15<<1 + Q0<<16 = Q16 + Q16 = Q16
|
||||
InOut16[n] = (int16_t) WEBRTC_SPL_RSHIFT_W32(b, 16); //Save as Q0
|
||||
@ -111,6 +111,7 @@ void WebRtcIsacfix_DecimateAllpass32(const int16_t *in,
|
||||
AllpassFilterForDec32(data_vec, kApLowerQ15, N, state_in+ALLPASSSECTIONS);
|
||||
|
||||
for (n=0;n<N/2;n++) {
|
||||
out[n]=WEBRTC_SPL_ADD_SAT_W16(data_vec[WEBRTC_SPL_MUL_16_16(2, n)], data_vec[WEBRTC_SPL_MUL_16_16(2, n)+1]);
|
||||
out[n] = WebRtcSpl_AddSatW16(data_vec[WEBRTC_SPL_MUL_16_16(2, n)],
|
||||
data_vec[WEBRTC_SPL_MUL_16_16(2, n) + 1]);
|
||||
}
|
||||
}
|
||||
|
@ -1067,8 +1067,8 @@ void WebRtcAecm_UpdateChannel(AecmCore_t * aecm,
|
||||
{
|
||||
tmp32no2 = WEBRTC_SPL_SHIFT_W32(tmp32no2, shift2ResChan);
|
||||
}
|
||||
aecm->channelAdapt32[i] = WEBRTC_SPL_ADD_SAT_W32(aecm->channelAdapt32[i],
|
||||
tmp32no2);
|
||||
aecm->channelAdapt32[i] =
|
||||
WebRtcSpl_AddSatW32(aecm->channelAdapt32[i], tmp32no2);
|
||||
if (aecm->channelAdapt32[i] < 0)
|
||||
{
|
||||
// We can never have negative channel gain
|
||||
|
@ -270,7 +270,7 @@ static int TimeToFrequencyDomain(AecmCore_t* aecm,
|
||||
tmp16no2 = WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
|
||||
tmp32no1 = WEBRTC_SPL_MUL_16_16(tmp16no1, tmp16no1);
|
||||
tmp32no2 = WEBRTC_SPL_MUL_16_16(tmp16no2, tmp16no2);
|
||||
tmp32no2 = WEBRTC_SPL_ADD_SAT_W32(tmp32no1, tmp32no2);
|
||||
tmp32no2 = WebRtcSpl_AddSatW32(tmp32no1, tmp32no2);
|
||||
#endif // WEBRTC_ARCH_ARM_V7
|
||||
tmp32no1 = WebRtcSpl_SqrtFloor(tmp32no2);
|
||||
|
||||
@ -784,8 +784,8 @@ static void ComfortNoise(AecmCore_t* aecm,
|
||||
|
||||
for (i = 0; i < PART_LEN1; i++)
|
||||
{
|
||||
out[i].real = WEBRTC_SPL_ADD_SAT_W16(out[i].real, uReal[i]);
|
||||
out[i].imag = WEBRTC_SPL_ADD_SAT_W16(out[i].imag, uImag[i]);
|
||||
out[i].real = WebRtcSpl_AddSatW16(out[i].real, uReal[i]);
|
||||
out[i].imag = WebRtcSpl_AddSatW16(out[i].imag, uImag[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -693,7 +693,7 @@ static int TimeToFrequencyDomain(AecmCore_t* aecm,
|
||||
tmp16no2 = WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
|
||||
tmp32no1 = WEBRTC_SPL_MUL_16_16(tmp16no1, tmp16no1);
|
||||
tmp32no2 = WEBRTC_SPL_MUL_16_16(tmp16no2, tmp16no2);
|
||||
tmp32no2 = WEBRTC_SPL_ADD_SAT_W32(tmp32no1, tmp32no2);
|
||||
tmp32no2 = WebRtcSpl_AddSatW32(tmp32no1, tmp32no2);
|
||||
tmp32no1 = WebRtcSpl_SqrtFloor(tmp32no2);
|
||||
|
||||
freq_signal_abs[i] = (uint16_t)tmp32no1;
|
||||
|
@ -755,14 +755,14 @@ int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
|
||||
|
||||
// update long-term estimate of mean energy level (Q10)
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(state->meanLongTerm, state->counter) + (int32_t)dB;
|
||||
state->meanLongTerm = WebRtcSpl_DivW32W16ResW16(tmp32,
|
||||
WEBRTC_SPL_ADD_SAT_W16(state->counter, 1));
|
||||
state->meanLongTerm = WebRtcSpl_DivW32W16ResW16(
|
||||
tmp32, WebRtcSpl_AddSatW16(state->counter, 1));
|
||||
|
||||
// update long-term estimate of variance in energy level (Q8)
|
||||
tmp32 = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL_16_16(dB, dB), 12);
|
||||
tmp32 += WEBRTC_SPL_MUL(state->varianceLongTerm, state->counter);
|
||||
state->varianceLongTerm = WebRtcSpl_DivW32W16(tmp32,
|
||||
WEBRTC_SPL_ADD_SAT_W16(state->counter, 1));
|
||||
state->varianceLongTerm = WebRtcSpl_DivW32W16(
|
||||
tmp32, WebRtcSpl_AddSatW16(state->counter, 1));
|
||||
|
||||
// update long-term estimate of standard deviation in energy level (Q10)
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(state->meanLongTerm, state->meanLongTerm);
|
||||
|
@ -503,8 +503,8 @@ static void SynthesisUpdateC(NsxInst_t* inst,
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(tmp16a, gain_factor, 13); // Q0
|
||||
// Down shift with rounding
|
||||
tmp16b = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
inst->synthesisBuffer[i] = WEBRTC_SPL_ADD_SAT_W16(inst->synthesisBuffer[i],
|
||||
tmp16b); // Q0
|
||||
inst->synthesisBuffer[i] = WebRtcSpl_AddSatW16(inst->synthesisBuffer[i],
|
||||
tmp16b); // Q0
|
||||
}
|
||||
|
||||
// read out fully processed segment
|
||||
|
@ -513,7 +513,7 @@ void WebRtcNsx_SynthesisUpdateNeon(NsxInst_t* inst,
|
||||
"vmull.s16 q11, d24, d22\n\t"
|
||||
// tmp16b = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqrshrn.s32 d22, q11, #13\n\t"
|
||||
// inst->synthesisBuffer[i] = WEBRTC_SPL_ADD_SAT_W16(
|
||||
// inst->synthesisBuffer[i] = WebRtcSpl_AddSatW16(
|
||||
// inst->synthesisBuffer[i], tmp16b); // Q0
|
||||
"vqadd.s16 d25, d22\n\t"
|
||||
"vst1.16 d25, [%[ptr_syn]]!\n\t"
|
||||
@ -530,7 +530,7 @@ void WebRtcNsx_SynthesisUpdateNeon(NsxInst_t* inst,
|
||||
"vmull.s16 q13, d24, d26\n\t"
|
||||
// tmp16b = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqrshrn.s32 d26, q13, #13\n\t"
|
||||
// inst->synthesisBuffer[i] = WEBRTC_SPL_ADD_SAT_W16(
|
||||
// inst->synthesisBuffer[i] = WebRtcSpl_AddSatW16(
|
||||
// inst->synthesisBuffer[i], tmp16b); // Q0
|
||||
"vqadd.s16 d28, d26\n\t"
|
||||
"vst1.16 d28, [%[ptr_syn]]!\n\t"
|
||||
|
Loading…
Reference in New Issue
Block a user