diff --git a/webrtc/common_audio/signal_processing/auto_corr_to_refl_coef.c b/webrtc/common_audio/signal_processing/auto_corr_to_refl_coef.c index daffd9362f..f99dd62b82 100644 --- a/webrtc/common_audio/signal_processing/auto_corr_to_refl_coef.c +++ b/webrtc/common_audio/signal_processing/auto_corr_to_refl_coef.c @@ -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++; } } 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 33a41ba21c..fcc5cea001 100644 --- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h +++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h @@ -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) \ diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc index 146afae530..c21263b2bf 100644 --- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc +++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc @@ -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 diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c index ae0d687e47..0f5c81938e 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c @@ -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) ); diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode_plc.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode_plc.c index 6bd5843cd9..fd30183964 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode_plc.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode_plc.c @@ -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); } } } 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 c8dcb16645..8be427afda 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks.c @@ -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 } diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_neon.S b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_neon.S index 125a5d1fa7..b4739215f3 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_neon.S +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_neon.S @@ -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); diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters.c index eb0e87af73..cf92a4d1d2 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters.c @@ -75,11 +75,11 @@ static void AllpassFilterForDec32(int16_t *InOut16, //Q0 for (n=0;n 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;nchannelAdapt32[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 diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_c.c b/webrtc/modules/audio_processing/aecm/aecm_core_c.c index 00323ccd5a..577cc63cd1 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core_c.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.c @@ -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]); } } diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_mips.c b/webrtc/modules/audio_processing/aecm/aecm_core_mips.c index 4c925ca274..3a7b115971 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core_mips.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core_mips.c @@ -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; diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c index d0f7b10d04..c9fca51a44 100644 --- a/webrtc/modules/audio_processing/agc/digital_agc.c +++ b/webrtc/modules/audio_processing/agc/digital_agc.c @@ -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); diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c index 2c8270f568..86cbb0ba9e 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core.c +++ b/webrtc/modules/audio_processing/ns/nsx_core.c @@ -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 diff --git a/webrtc/modules/audio_processing/ns/nsx_core_neon.c b/webrtc/modules/audio_processing/ns/nsx_core_neon.c index 3490d06301..4dbad9e6cf 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core_neon.c +++ b/webrtc/modules/audio_processing/ns/nsx_core_neon.c @@ -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"