Refactor audio_coding/codecs/isac: Removed usage of macro WEBRTC_SPL_MUL_16_16
The macro is in C defined as #define WEBRTC_SPL_MUL_16_16(a, b) ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) (For definition on ARMv7 and MIPS, see common_audio/signal_processing/include/spl_inl_armv7.h and common_audio/signal_processing/include/spl_inl_mips.h) The replacement consists of - avoiding casts to int16_t if inputs already are int16_t - adding explicit cast to <type> if result is assigned to <type> (other than int or int32_t) Some other minor code cleanup also exists. BUG=3348,3353 TESTED=locally on Mac and trybots R=henrik.lundin@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/42639004 Cr-Commit-Position: refs/heads/master@{#8717} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8717 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -243,7 +243,7 @@ int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bweStr,
|
||||
bweStr->countRecPkts++;
|
||||
|
||||
/* Calculate framesize in msec */
|
||||
frameSizeSampl = WEBRTC_SPL_MUL_16_16((int16_t)SAMPLES_PER_MSEC, frameSize);
|
||||
frameSizeSampl = SAMPLES_PER_MSEC * frameSize;
|
||||
|
||||
/* Check that it's not one of the first 9 packets */
|
||||
if ( bweStr->countUpdates > 0 ) {
|
||||
@ -269,7 +269,7 @@ int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bweStr,
|
||||
|
||||
/* If received number of packets is more than 90% of expected (922 = 0.9 in Q10): */
|
||||
/* do the update, else not */
|
||||
if(WEBRTC_SPL_LSHIFT_W32(bweStr->countRecPkts, 10) > WEBRTC_SPL_MUL_16_16(922, numPktsExpected)) {
|
||||
if ((int32_t)bweStr->countRecPkts << 10 > 922 * numPktsExpected) {
|
||||
/* Q4 chosen to approx dividing by 16 */
|
||||
msec = (arrivalTime - bweStr->lastReduction);
|
||||
|
||||
@ -378,7 +378,7 @@ int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bweStr,
|
||||
pksize + HEADER_SIZE);
|
||||
|
||||
/* 8389 is ~ 1/128000 in Q30 */
|
||||
byteSecondsPerBit = WEBRTC_SPL_MUL_16_16(arrTimeDiff, 8389);
|
||||
byteSecondsPerBit = (uint32_t)(arrTimeDiff * 8389);
|
||||
|
||||
/* get upper N bits */
|
||||
tempUpper = WEBRTC_SPL_RSHIFT_U32(byteSecondsPerBit, 15);
|
||||
|
||||
@ -181,7 +181,7 @@ int16_t WebRtcIsacfix_DecodeImpl(int16_t *signal_out16,
|
||||
|
||||
for (k = 0; k < FRAMESAMPLES/2; k++)
|
||||
{
|
||||
Vector_Word32_1[k] = (int32_t) WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(Vector_Word16_2[k], gainQ13), 3); // Q25
|
||||
Vector_Word32_1[k] = (Vector_Word16_2[k] * gainQ13) << 3; // Q25
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ static int16_t plc_filterma_Fast(
|
||||
|
||||
for (j = 0;j < Blen; j++)
|
||||
{
|
||||
o = WebRtcSpl_AddSatW32(o, WEBRTC_SPL_MUL_16_16(*b_ptr, *x_ptr));
|
||||
o = WebRtcSpl_AddSatW32(o, *b_ptr * *x_ptr);
|
||||
b_ptr++;
|
||||
x_ptr--;
|
||||
}
|
||||
@ -141,8 +141,7 @@ static void MemshipValQ15( int16_t in, int16_t *A, int16_t *B )
|
||||
x*15 + (x*983)/(2^12); note that 983/2^12 = 0.23999 */
|
||||
|
||||
/* we are sure that x is in the range of int16_t */
|
||||
x = (int16_t)( WEBRTC_SPL_MUL_16_16( in, 15 ) +
|
||||
WEBRTC_SPL_MUL_16_16_RSFT( in, 983, 12) );
|
||||
x = (int16_t)(in * 15 + WEBRTC_SPL_MUL_16_16_RSFT(in, 983, 12));
|
||||
/* b = x^2 / 2 {in Q15} so a shift of 16 is required to
|
||||
be in correct domain and one more for the division by 2 */
|
||||
*B = (int16_t)((x * x + 0x00010000) >> 17);
|
||||
@ -160,8 +159,7 @@ static void MemshipValQ15( int16_t in, int16_t *A, int16_t *B )
|
||||
{
|
||||
/* This is a mirror case of the above */
|
||||
in = 4300 - in;
|
||||
x = (int16_t)( WEBRTC_SPL_MUL_16_16( in, 15 ) +
|
||||
WEBRTC_SPL_MUL_16_16_RSFT( in, 983, 12) );
|
||||
x = (int16_t)(in * 15 + WEBRTC_SPL_MUL_16_16_RSFT(in, 983, 12));
|
||||
/* b = x^2 / 2 {in Q15} so a shift of 16 is required to
|
||||
be in correct domain and one more for the division by 2 */
|
||||
*A = (int16_t)((x * x + 0x00010000) >> 17);
|
||||
@ -181,7 +179,7 @@ static void MemshipValQ15( int16_t in, int16_t *A, int16_t *B )
|
||||
|
||||
static void LinearResampler( int16_t *in, int16_t *out, int16_t lenIn, int16_t lenOut )
|
||||
{
|
||||
int32_t n;
|
||||
int32_t n = (lenIn - 1) * RESAMP_RES;
|
||||
int16_t resOut, i, j, relativePos, diff; /* */
|
||||
uint16_t udiff;
|
||||
|
||||
@ -191,7 +189,6 @@ static void LinearResampler( int16_t *in, int16_t *out, int16_t lenIn, int16_t l
|
||||
return;
|
||||
}
|
||||
|
||||
n = WEBRTC_SPL_MUL_16_16( (int16_t)(lenIn-1), RESAMP_RES );
|
||||
resOut = WebRtcSpl_DivW32W16ResW16( n, (int16_t)(lenOut-1) );
|
||||
|
||||
out[0] = in[0];
|
||||
@ -780,8 +777,7 @@ int16_t WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16,
|
||||
|
||||
/* perceptual post-filtering (using normalized lattice filter) */
|
||||
for (k = 0; k < FRAMESAMPLES_HALF; k++)
|
||||
Vector_Word32_1[k] = (int32_t) WEBRTC_SPL_MUL_16_16(
|
||||
Vector_Word16_2[k], gainQ13) << 3; // Q25
|
||||
Vector_Word32_1[k] = (Vector_Word16_2[k] * gainQ13) << 3; // Q25
|
||||
|
||||
|
||||
WebRtcIsacfix_NormLatticeFilterAr(ORDERLO,
|
||||
|
||||
@ -338,9 +338,9 @@ int WebRtcIsacfix_EncodeImpl(int16_t *in,
|
||||
|
||||
// we compare bytesLeftQ5 with ratioQ5[]*arithLenDFTByte;
|
||||
idx = 4;
|
||||
idx += (bytesLeftQ5 >= WEBRTC_SPL_MUL_16_16(ratioQ5[idx], arithLenDFTByte))? 2:-2;
|
||||
idx += (bytesLeftQ5 >= WEBRTC_SPL_MUL_16_16(ratioQ5[idx], arithLenDFTByte))? 1:-1;
|
||||
idx += (bytesLeftQ5 >= WEBRTC_SPL_MUL_16_16(ratioQ5[idx], arithLenDFTByte))? 0:-1;
|
||||
idx += (bytesLeftQ5 >= ratioQ5[idx] * arithLenDFTByte) ? 2 : -2;
|
||||
idx += (bytesLeftQ5 >= ratioQ5[idx] * arithLenDFTByte) ? 1 : -1;
|
||||
idx += (bytesLeftQ5 >= ratioQ5[idx] * arithLenDFTByte) ? 0 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -140,7 +140,7 @@ static int32_t CalcExpN(int16_t x) {
|
||||
axFRAC = ax&0x00FF;
|
||||
exp16 = WEBRTC_SPL_LSHIFT_W32(1, axINT); //Q0
|
||||
axFRAC = axFRAC+256; //Q8
|
||||
exp = WEBRTC_SPL_MUL_16_16(exp16, axFRAC); // Q0*Q8 = Q8
|
||||
exp = exp16 * axFRAC; // Q0*Q8 = Q8
|
||||
exp = WEBRTC_SPL_LSHIFT_W32(exp, 9); //Q17
|
||||
} else {
|
||||
// ax=(int16_t)WEBRTC_SPL_MUL_16_16_RSFT(x, 23637+700, 14); //Q8
|
||||
@ -150,7 +150,7 @@ static int32_t CalcExpN(int16_t x) {
|
||||
axFRAC = 0x00FF - (ax&0x00FF);
|
||||
exp16 = (int16_t)(32768 >> axINT); // Q15
|
||||
axFRAC = axFRAC+256; //Q8
|
||||
exp = WEBRTC_SPL_MUL_16_16(exp16, axFRAC); // Q15*Q8 = Q23
|
||||
exp = exp16 * axFRAC; // Q15*Q8 = Q23
|
||||
exp >>= 6; // Q17
|
||||
}
|
||||
|
||||
@ -1132,18 +1132,14 @@ static int EstCodeLpcCoef(int32_t *LPCCoefQ17,
|
||||
posg = 0;
|
||||
for (j=0; j<SUBFRAMES; j++) {
|
||||
// Q21 = Q6 * Q15
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg],
|
||||
WebRtcIsacfix_kT1GainQ15[0][0]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][2]);
|
||||
sumQQ = tmpcoeffs_gQ6[offsg] * WebRtcIsacfix_kT1GainQ15[0][0] +
|
||||
tmpcoeffs_gQ6[offsg + 1] * WebRtcIsacfix_kT1GainQ15[0][2];
|
||||
tmpcoeffs2_gQ21[posg] = sumQQ;
|
||||
posg++;
|
||||
|
||||
// Q21 = Q6 * Q15
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg],
|
||||
WebRtcIsacfix_kT1GainQ15[0][1]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][3]);
|
||||
sumQQ = tmpcoeffs_gQ6[offsg] * WebRtcIsacfix_kT1GainQ15[0][1] +
|
||||
tmpcoeffs_gQ6[offsg + 1] * WebRtcIsacfix_kT1GainQ15[0][3];
|
||||
tmpcoeffs2_gQ21[posg] = sumQQ;
|
||||
posg++;
|
||||
|
||||
@ -1384,17 +1380,13 @@ int WebRtcIsacfix_EstCodeLpcGain(int32_t *gain_lo_hiQ17,
|
||||
posg = 0;
|
||||
for (j=0; j<SUBFRAMES; j++) {
|
||||
// Q21 = Q6 * Q15
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[j * 2],
|
||||
WebRtcIsacfix_kT1GainQ15[0][0]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[j * 2 + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][2]);
|
||||
sumQQ = tmpcoeffs_gQ6[j * 2] * WebRtcIsacfix_kT1GainQ15[0][0] +
|
||||
tmpcoeffs_gQ6[j * 2 + 1] * WebRtcIsacfix_kT1GainQ15[0][2];
|
||||
tmpcoeffs2_gQ21[posg] = sumQQ;
|
||||
posg++;
|
||||
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[j * 2],
|
||||
WebRtcIsacfix_kT1GainQ15[0][1]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[j * 2 + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][3]);
|
||||
sumQQ = tmpcoeffs_gQ6[j * 2] * WebRtcIsacfix_kT1GainQ15[0][1] +
|
||||
tmpcoeffs_gQ6[j * 2 + 1] * WebRtcIsacfix_kT1GainQ15[0][3];
|
||||
tmpcoeffs2_gQ21[posg] = sumQQ;
|
||||
posg++;
|
||||
}
|
||||
@ -2015,17 +2007,13 @@ void WebRtcIsacfix_TranscodeLpcCoef(int32_t *gain_lo_hiQ17,
|
||||
/* left transform */
|
||||
for (j = 0, offsg = 0; j < SUBFRAMES; j++, offsg += 2) {
|
||||
// Q21 = Q6 * Q15
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg],
|
||||
WebRtcIsacfix_kT1GainQ15[0][0]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][2]);
|
||||
sumQQ = tmpcoeffs_gQ6[offsg] * WebRtcIsacfix_kT1GainQ15[0][0] +
|
||||
tmpcoeffs_gQ6[offsg + 1] * WebRtcIsacfix_kT1GainQ15[0][2];
|
||||
tmpcoeffs2_gQ21[offsg] = sumQQ;
|
||||
|
||||
// Q21 = Q6 * Q15
|
||||
sumQQ = WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg],
|
||||
WebRtcIsacfix_kT1GainQ15[0][1]);
|
||||
sumQQ += WEBRTC_SPL_MUL_16_16(tmpcoeffs_gQ6[offsg + 1],
|
||||
WebRtcIsacfix_kT1GainQ15[0][3]);
|
||||
sumQQ = tmpcoeffs_gQ6[offsg] * WebRtcIsacfix_kT1GainQ15[0][1] +
|
||||
tmpcoeffs_gQ6[offsg + 1] * WebRtcIsacfix_kT1GainQ15[0][3];
|
||||
tmpcoeffs2_gQ21[offsg + 1] = sumQQ;
|
||||
}
|
||||
|
||||
|
||||
@ -126,11 +126,11 @@ int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_
|
||||
}
|
||||
|
||||
ccc1Q14 = kCosTabFfftQ14[kk];
|
||||
ccc2Q14 = kCosTabFfftQ14[WEBRTC_SPL_MUL_16_16(2, kk)];
|
||||
ccc3Q14 = kCosTabFfftQ14[WEBRTC_SPL_MUL_16_16(3, kk)];
|
||||
sss1Q14 = kCosTabFfftQ14[kk+60];
|
||||
sss2Q14 = kCosTabFfftQ14[WEBRTC_SPL_MUL_16_16(2, kk)+60];
|
||||
sss3Q14 = kCosTabFfftQ14[WEBRTC_SPL_MUL_16_16(3, kk)+60];
|
||||
ccc2Q14 = kCosTabFfftQ14[2 * kk];
|
||||
ccc3Q14 = kCosTabFfftQ14[3 * kk];
|
||||
sss1Q14 = kCosTabFfftQ14[kk + 60];
|
||||
sss2Q14 = kCosTabFfftQ14[2 * kk + 60];
|
||||
sss3Q14 = kCosTabFfftQ14[3 * kk + 60];
|
||||
if (iSign==1) {
|
||||
sss1Q14 = -sss1Q14;
|
||||
sss2Q14 = -sss2Q14;
|
||||
@ -211,7 +211,7 @@ int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_
|
||||
kk += 20;
|
||||
ff = ff+4;
|
||||
for (hh=0; hh<2; hh++) {
|
||||
ee = ff + (int16_t)WEBRTC_SPL_MUL_16_16(hh, ff);
|
||||
ee = ff + hh * ff;
|
||||
dd = ee + 60;
|
||||
ccc2Q14 = kCosTabFfftQ14[ee];
|
||||
sss2Q14 = kCosTabFfftQ14[dd];
|
||||
@ -308,7 +308,7 @@ int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_
|
||||
|
||||
for (gg=0; gg<3; gg++) {
|
||||
kk += 4;
|
||||
dd = 12 + (int16_t)WEBRTC_SPL_MUL_16_16(12, gg);
|
||||
dd = 12 + 12 * gg;
|
||||
ff = 0;
|
||||
for (hh=0; hh<4; hh++) {
|
||||
ff = ff+dd;
|
||||
|
||||
@ -49,33 +49,33 @@ void WebRtcIsacfix_AllpassFilter2FixDec16C(
|
||||
for (n = 0; n < length; n++) {
|
||||
// Process channel 1:
|
||||
in_out = data_ch1[n];
|
||||
a = WEBRTC_SPL_MUL_16_16(factor_ch1[0], in_out); // Q15 * Q0 = Q15
|
||||
a = factor_ch1[0] * in_out; // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state0_ch1);
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch1[0], (int16_t) (b >> 16)); // Q15
|
||||
a = -factor_ch1[0] * (int16_t)(b >> 16); // Q15
|
||||
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 = factor_ch1[1] * in_out; // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state1_ch1); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch1[1], (int16_t) (b >> 16)); // Q15
|
||||
a = -factor_ch1[1] * (int16_t)(b >> 16); // Q15
|
||||
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 = factor_ch2[0] * in_out; // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state0_ch2); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch2[0], (int16_t) (b >> 16)); // Q15
|
||||
a = -factor_ch2[0] * (int16_t)(b >> 16); // Q15
|
||||
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 = factor_ch2[1] * in_out; // Q15 * Q0 = Q15
|
||||
a <<= 1; // Q15 -> Q16
|
||||
b = WebRtcSpl_AddSatW32(a, state1_ch2); // Q16
|
||||
a = WEBRTC_SPL_MUL_16_16(-factor_ch2[1], (int16_t) (b >> 16)); // Q15
|
||||
a = -factor_ch2[1] * (int16_t)(b >> 16); // Q15
|
||||
state1_ch2 = WebRtcSpl_AddSatW32(a << 1, (uint32_t)in_out << 16); // Q16
|
||||
data_ch2[n] = (int16_t) (b >> 16); // Save as Q0
|
||||
}
|
||||
@ -177,21 +177,21 @@ void WebRtcIsacfix_SplitAndFilter1(int16_t *pin,
|
||||
|
||||
/* First Channel */
|
||||
for (k=0;k<FRAMESAMPLES/2;k++) {
|
||||
tempin_ch1[QLOOKAHEAD + k] = pin[1+WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
tempin_ch1[QLOOKAHEAD + k] = pin[1 + 2 * k];
|
||||
}
|
||||
for (k=0;k<QLOOKAHEAD;k++) {
|
||||
tempin_ch1[k]=prefiltdata->INLABUF1_fix[k];
|
||||
prefiltdata->INLABUF1_fix[k]=pin[FRAMESAMPLES+1-WEBRTC_SPL_MUL_16_16(2, QLOOKAHEAD)+WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
prefiltdata->INLABUF1_fix[k] = pin[FRAMESAMPLES + 1 - 2 * (QLOOKAHEAD - k)];
|
||||
}
|
||||
|
||||
/* Second Channel. This is exactly like the first channel, except that the
|
||||
even samples are now filtered instead (lower channel). */
|
||||
for (k=0;k<FRAMESAMPLES/2;k++) {
|
||||
tempin_ch2[QLOOKAHEAD+k] = pin[WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
tempin_ch2[QLOOKAHEAD + k] = pin[2 * k];
|
||||
}
|
||||
for (k=0;k<QLOOKAHEAD;k++) {
|
||||
tempin_ch2[k]=prefiltdata->INLABUF2_fix[k];
|
||||
prefiltdata->INLABUF2_fix[k]=pin[FRAMESAMPLES-WEBRTC_SPL_MUL_16_16(2, QLOOKAHEAD)+WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
prefiltdata->INLABUF2_fix[k] = pin[FRAMESAMPLES - 2 * (QLOOKAHEAD - k)];
|
||||
}
|
||||
|
||||
|
||||
@ -206,7 +206,7 @@ void WebRtcIsacfix_SplitAndFilter1(int16_t *pin,
|
||||
prefiltdata->INSTAT1_fix,
|
||||
prefiltdata->INSTAT2_fix);
|
||||
|
||||
for (k=0;k<WEBRTC_SPL_MUL_16_16(2, (QORDER-1));k++) {
|
||||
for (k = 0; k < 2 * (QORDER - 1); k++) {
|
||||
tmpState_ch1[k] = prefiltdata->INSTAT1_fix[k];
|
||||
tmpState_ch2[k] = prefiltdata->INSTAT2_fix[k];
|
||||
}
|
||||
@ -256,13 +256,13 @@ void WebRtcIsacfix_SplitAndFilter2(int16_t *pin,
|
||||
|
||||
/* First Channel */
|
||||
for (k=0;k<FRAMESAMPLES/2;k++) {
|
||||
tempin_ch1[k] = pin[1+WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
tempin_ch1[k] = pin[1 + 2 * k];
|
||||
}
|
||||
|
||||
/* Second Channel. This is exactly like the first channel, except that the
|
||||
even samples are now filtered instead (lower channel). */
|
||||
for (k=0;k<FRAMESAMPLES/2;k++) {
|
||||
tempin_ch2[k] = pin[WEBRTC_SPL_MUL_16_16(2, k)];
|
||||
tempin_ch2[k] = pin[2 * k];
|
||||
}
|
||||
|
||||
|
||||
@ -341,8 +341,8 @@ void WebRtcIsacfix_FilterAndCombine1(int16_t *tempin_ch1,
|
||||
|
||||
/* Merge outputs to form the full length output signal.*/
|
||||
for (k=0;k<FRAMESAMPLES/2;k++) {
|
||||
in[WEBRTC_SPL_MUL_16_16(2, k)]=tempin_ch2[k];
|
||||
in[WEBRTC_SPL_MUL_16_16(2, k)+1]=tempin_ch1[k];
|
||||
in[2 * k] = tempin_ch2[k];
|
||||
in[2 * k + 1] = tempin_ch1[k];
|
||||
}
|
||||
|
||||
/* High pass filter */
|
||||
@ -402,8 +402,8 @@ void WebRtcIsacfix_FilterAndCombine2(int16_t *tempin_ch1,
|
||||
|
||||
/* Merge outputs to form the full length output signal.*/
|
||||
for (k=0;k<len/2;k++) {
|
||||
in[WEBRTC_SPL_MUL_16_16(2, k)]=tempin_ch2[k];
|
||||
in[WEBRTC_SPL_MUL_16_16(2, k)+1]=tempin_ch1[k];
|
||||
in[2 * k] = tempin_ch2[k];
|
||||
in[2 * k + 1] = tempin_ch1[k];
|
||||
}
|
||||
|
||||
/* High pass filter */
|
||||
|
||||
@ -144,14 +144,14 @@ FOR_LOOP:
|
||||
@ sample0_ch1 = data_ch1[n];
|
||||
@ sample0_ch2 = data_ch2[n];
|
||||
@
|
||||
@ 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;
|
||||
@ a0_ch1 = (factor_ch1[0] * sample0_ch1) << 1;
|
||||
@ a0_ch2 = (factor_ch2[0] * sample0_ch2) << 1;
|
||||
@
|
||||
@ 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));
|
||||
@ a0_ch1 = -factor_ch1[0] * (int16_t)(b0_ch1 >> 16);
|
||||
@ a0_ch2 = -factor_ch2[0] * (int16_t)(b0_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);
|
||||
@ -163,20 +163,20 @@ FOR_LOOP:
|
||||
@
|
||||
@
|
||||
@ for (n = 0; n < length - 2; n += 2) {
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample1_ch1) << 1;
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample0_ch1) << 1;
|
||||
@ 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;
|
||||
@ a1_ch1 = (factor_ch1[0] * sample1_ch1) << 1;
|
||||
@ a0_ch1 = (factor_ch1[1] * sample0_ch1) << 1;
|
||||
@ a1_ch2 = (factor_ch2[0] * sample1_ch2) << 1;
|
||||
@ a0_ch2 = (factor_ch2[1] * sample0_ch2) << 1;
|
||||
@
|
||||
@ 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));
|
||||
@ a1_ch1 = -factor_ch1[0] * (int16_t)(b1_ch1 >> 16);
|
||||
@ a0_ch1 = -factor_ch1[1] * (int16_t)(b0_ch1 >> 16);
|
||||
@ a1_ch2 = -factor_ch2[0] * (int16_t)(b1_ch2 >> 16);
|
||||
@ a0_ch2 = -factor_ch2[1] * (int16_t)(b0_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);
|
||||
@ -188,20 +188,20 @@ FOR_LOOP:
|
||||
@ sample0_ch2 = data_ch2[n + 2];
|
||||
@ sample1_ch2 = (int16_t) (b1_ch2 >> 16); //Save as Q0
|
||||
@
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample0_ch1) << 1;
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample1_ch1) << 1;
|
||||
@ 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;
|
||||
@ a0_ch1 = (factor_ch1[0] * sample0_ch1) << 1;
|
||||
@ a1_ch1 = (factor_ch1[1] * sample1_ch1) << 1;
|
||||
@ a0_ch2 = (factor_ch2[0] * sample0_ch2) << 1;
|
||||
@ a1_ch2 = (factor_ch2[1] * sample1_ch2) << 1;
|
||||
@
|
||||
@ 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));
|
||||
@ a0_ch1 = -factor_ch1[0] * (int16_t)(b2_ch1 >> 16);
|
||||
@ a1_ch1 = -factor_ch1[1] * (int16_t)(b1_ch1 >> 16);
|
||||
@ a0_ch2 = -factor_ch2[0] * (int16_t)(b2_ch2 >> 16);
|
||||
@ a1_ch2 = -factor_ch2[1] * (int16_t)(b1_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);
|
||||
@ -222,20 +222,20 @@ FOR_LOOP:
|
||||
@
|
||||
@ // Loop unrolling post-processing.
|
||||
@
|
||||
@ a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample1_ch1) << 1;
|
||||
@ a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample0_ch1) << 1;
|
||||
@ 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;
|
||||
@ a1_ch1 = (factor_ch1[0] * sample1_ch1) << 1;
|
||||
@ a0_ch1 = (factor_ch1[1] * sample0_ch1) << 1;
|
||||
@ a1_ch2 = (factor_ch2[0] * sample1_ch2) << 1;
|
||||
@ a0_ch2 = (factor_ch2[1] * sample0_ch2) << 1;
|
||||
@
|
||||
@ 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));
|
||||
@ a1_ch1 = -factor_ch1[0] * (int16_t)(b1_ch1 >> 16);
|
||||
@ a0_ch1 = -factor_ch1[1] * (int16_t)(b0_ch1 >> 16);
|
||||
@ a1_ch2 = -factor_ch2[0] * (int16_t)(b1_ch2 >> 16);
|
||||
@ a0_ch2 = -factor_ch2[1] * (int16_t)(b0_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);
|
||||
@ -248,14 +248,14 @@ FOR_LOOP:
|
||||
@ sample1_ch1 = (int16_t) (b1_ch1 >> 16); //Save as Q0
|
||||
@ sample1_ch2 = (int16_t) (b1_ch2 >> 16); //Save as Q0
|
||||
@
|
||||
@ 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;
|
||||
@ a1_ch1 = (factor_ch1[1] * sample1_ch1) << 1;
|
||||
@ a1_ch2 = (factor_ch2[1] * sample1_ch2) << 1;
|
||||
@
|
||||
@ 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));
|
||||
@ a1_ch1 = -factor_ch1[1] * (int16_t)(b1_ch1 >> 16);
|
||||
@ a1_ch2 = -factor_ch2[1] * (int16_t)(b1_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);
|
||||
|
||||
@ -149,14 +149,14 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
|
||||
// sample0_ch1 = data_ch1[n];
|
||||
// sample0_ch2 = data_ch2[n];
|
||||
//
|
||||
// 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;
|
||||
// a0_ch1 = (factor_ch1[0] * sample0_ch1) << 1;
|
||||
// a0_ch2 = (factor_ch2[0] * sample0_ch2) << 1;
|
||||
//
|
||||
// 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));
|
||||
// a0_ch1 = -factor_ch1[0] * (int16_t)(b0_ch1 >> 16);
|
||||
// a0_ch2 = -factor_ch2[0] * (int16_t)(b0_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);
|
||||
@ -168,20 +168,20 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
|
||||
//
|
||||
//
|
||||
// for (n = 0; n < length - 2; n += 2) {
|
||||
// a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample1_ch1) << 1;
|
||||
// a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample0_ch1) << 1;
|
||||
// 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;
|
||||
// a1_ch1 = (factor_ch1[0] * sample1_ch1) << 1;
|
||||
// a0_ch1 = (factor_ch1[1] * sample0_ch1) << 1;
|
||||
// a1_ch2 = (factor_ch2[0] * sample1_ch2) << 1;
|
||||
// a0_ch2 = (factor_ch2[1] * sample0_ch2) << 1;
|
||||
//
|
||||
// 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));
|
||||
// a1_ch1 = -factor_ch1[0] * (int16_t)(b1_ch1 >> 16);
|
||||
// a0_ch1 = -factor_ch1[1] * (int16_t)(b0_ch1 >> 16);
|
||||
// a1_ch2 = -factor_ch2[0] * (int16_t)(b1_ch2 >> 16);
|
||||
// a0_ch2 = -factor_ch2[1] * (int16_t)(b0_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);
|
||||
@ -193,20 +193,20 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
|
||||
// sample0_ch2 = data_ch2[n + 2];
|
||||
// sample1_ch2 = (int16_t) (b1_ch2 >> 16); //Save as Q0
|
||||
//
|
||||
// a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample0_ch1) << 1;
|
||||
// a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample1_ch1) << 1;
|
||||
// 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;
|
||||
// a0_ch1 = (factor_ch1[0] * sample0_ch1) << 1;
|
||||
// a1_ch1 = (factor_ch1[1] * sample1_ch1) << 1;
|
||||
// a0_ch2 = (factor_ch2[0] * sample0_ch2) << 1;
|
||||
// a1_ch2 = (factor_ch2[1] * sample1_ch2) << 1;
|
||||
//
|
||||
// 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));
|
||||
// a0_ch1 = -factor_ch1[0] * (int16_t)(b2_ch1 >> 16);
|
||||
// a1_ch1 = -factor_ch1[1] * (int16_t)(b1_ch1 >> 16);
|
||||
// a0_ch2 = -factor_ch2[0] * (int16_t)(b2_ch2 >> 16);
|
||||
// a1_ch2 = -factor_ch2[1] * (int16_t)(b1_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);
|
||||
@ -227,20 +227,20 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
|
||||
//
|
||||
// // Loop unrolling post-processing.
|
||||
//
|
||||
// a1_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[0], sample1_ch1) << 1;
|
||||
// a0_ch1 = WEBRTC_SPL_MUL_16_16(factor_ch1[1], sample0_ch1) << 1;
|
||||
// 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;
|
||||
// a1_ch1 = (factor_ch1[0] * sample1_ch1) << 1;
|
||||
// a0_ch1 = (factor_ch1[1] * sample0_ch1) << 1;
|
||||
// a1_ch2 = (factor_ch2[0] * sample1_ch2) << 1;
|
||||
// a0_ch2 = (factor_ch2[1] * sample0_ch2) << 1;
|
||||
//
|
||||
// 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));
|
||||
// a1_ch1 = -factor_ch1[0] * (int16_t)(b1_ch1 >> 16);
|
||||
// a0_ch1 = -factor_ch1[1] * (int16_t)(b0_ch1 >> 16);
|
||||
// a1_ch2 = -factor_ch2[0] * (int16_t)(b1_ch2 >> 16);
|
||||
// a0_ch2 = -factor_ch2[1] * (int16_t)(b0_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);
|
||||
@ -253,14 +253,14 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
|
||||
// sample1_ch1 = (int16_t) (b1_ch1 >> 16); //Save as Q0
|
||||
// sample1_ch2 = (int16_t) (b1_ch2 >> 16); //Save as Q0
|
||||
//
|
||||
// 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;
|
||||
// a1_ch1 = (factor_ch1[1] * sample1_ch1) << 1;
|
||||
// a1_ch2 = (factor_ch2[1] * sample1_ch2) << 1;
|
||||
//
|
||||
// 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));
|
||||
// a1_ch1 = -factor_ch1[1] * (int16_t)(b1_ch1 >> 16);
|
||||
// a1_ch2 = -factor_ch2[1] * (int16_t)(b1_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);
|
||||
|
||||
@ -32,7 +32,7 @@ int WebRtcIsacfix_AutocorrC(int32_t* __restrict r,
|
||||
|
||||
// Calculate r[0].
|
||||
for (i = 0; i < N; i++) {
|
||||
prod += WEBRTC_SPL_MUL_16_16(x[i], x[i]);
|
||||
prod += x[i] * x[i];
|
||||
}
|
||||
|
||||
// Calculate scaling (the value of shifting).
|
||||
@ -48,7 +48,7 @@ int WebRtcIsacfix_AutocorrC(int32_t* __restrict r,
|
||||
for (i = 1; i < order + 1; i++) {
|
||||
prod = 0;
|
||||
for (j = 0; j < N - i; j++) {
|
||||
prod += WEBRTC_SPL_MUL_16_16(x[j], x[i + j]);
|
||||
prod += x[j] * x[i + j];
|
||||
}
|
||||
sum = (int32_t)(prod >> scaling);
|
||||
r[i] = sum;
|
||||
@ -98,11 +98,10 @@ void WebRtcIsacfix_DecimateAllpass32(const int16_t *in,
|
||||
int16_t data_vec[PITCH_FRAME_LEN];
|
||||
|
||||
/* copy input */
|
||||
memcpy(data_vec+1, in, WEBRTC_SPL_MUL_16_16(sizeof(int16_t), (N-1)));
|
||||
|
||||
memcpy(data_vec + 1, in, sizeof(int16_t) * (N - 1));
|
||||
|
||||
data_vec[0] = (int16_t)(state_in[2 * ALLPASSSECTIONS] >> 16); // z^-1 state.
|
||||
state_in[WEBRTC_SPL_MUL_16_16(2, ALLPASSSECTIONS)] = WEBRTC_SPL_LSHIFT_W32((uint32_t)in[N-1],16);
|
||||
state_in[2 * ALLPASSSECTIONS] = WEBRTC_SPL_LSHIFT_W32((uint32_t)in[N-1],16);
|
||||
|
||||
|
||||
|
||||
@ -110,7 +109,6 @@ void WebRtcIsacfix_DecimateAllpass32(const int16_t *in,
|
||||
AllpassFilterForDec32(data_vec, kApLowerQ15, N, state_in+ALLPASSSECTIONS);
|
||||
|
||||
for (n=0;n<N/2;n++) {
|
||||
out[n] = WebRtcSpl_AddSatW16(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[2 * n], data_vec[2 * n + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
|
||||
|
||||
prod_tail = 0;
|
||||
while (x_start < x_end1) {
|
||||
prod_tail += WEBRTC_SPL_MUL_16_16(*x_start, *y_start);
|
||||
prod_tail += *x_start * *y_start;
|
||||
++x_start;
|
||||
++y_start;
|
||||
}
|
||||
|
||||
@ -78,8 +78,7 @@ void WebRtcIsacfix_InitPreFilterbank(PreFiltBankstr *prefiltdata)
|
||||
prefiltdata->INLABUF1_fix[k] = 0;
|
||||
prefiltdata->INLABUF2_fix[k] = 0;
|
||||
}
|
||||
for (k = 0; k < WEBRTC_SPL_MUL_16_16(2,(QORDER-1)); k++) {
|
||||
|
||||
for (k = 0; k < 2 * (QORDER - 1); k++) {
|
||||
prefiltdata->INSTAT1_fix[k] = 0;
|
||||
prefiltdata->INSTAT2_fix[k] = 0;
|
||||
}
|
||||
@ -95,8 +94,7 @@ void WebRtcIsacfix_InitPostFilterbank(PostFiltBankstr *postfiltdata)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < WEBRTC_SPL_MUL_16_16(2, POSTQORDER); k++) {
|
||||
|
||||
for (k = 0; k < 2 * POSTQORDER; k++) {
|
||||
postfiltdata->STATE_0_LOWER_fix[k] = 0;
|
||||
postfiltdata->STATE_0_UPPER_fix[k] = 0;
|
||||
}
|
||||
@ -133,7 +131,7 @@ void WebRtcIsacfix_InitPitchAnalysis(PitchAnalysisStruct *State)
|
||||
for (k = 0; k < PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2; k++) {
|
||||
State->dec_buffer16[k] = 0;
|
||||
}
|
||||
for (k = 0; k < WEBRTC_SPL_MUL_16_16(2, ALLPASSSECTIONS)+1; k++) {
|
||||
for (k = 0; k < 2 * ALLPASSSECTIONS + 1; k++) {
|
||||
State->decimator_state32[k] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -115,11 +115,11 @@ void WebRtcIsacfix_NormLatticeFilterMa(int16_t orderCoef,
|
||||
|
||||
for (u=0;u<SUBFRAMES;u++)
|
||||
{
|
||||
int32_t temp1 = WEBRTC_SPL_MUL_16_16(u, HALF_SUBFRAMELEN);
|
||||
int32_t temp1 = u * HALF_SUBFRAMELEN;
|
||||
|
||||
/* set the Direct Form coefficients */
|
||||
temp2 = (int16_t)WEBRTC_SPL_MUL_16_16(u, orderCoef);
|
||||
temp3 = (int16_t)WEBRTC_SPL_MUL_16_16(2, u)+lo_hi;
|
||||
temp2 = (int16_t)(u * orderCoef);
|
||||
temp3 = (int16_t)(2 * u + lo_hi);
|
||||
|
||||
/* compute lattice filter coefficients */
|
||||
memcpy(sthQ15, &filt_coefQ15[temp2], orderCoef * sizeof(int16_t));
|
||||
@ -238,11 +238,11 @@ void WebRtcIsacfix_NormLatticeFilterAr(int16_t orderCoef,
|
||||
|
||||
for (u=0;u<SUBFRAMES;u++)
|
||||
{
|
||||
int32_t temp1 = WEBRTC_SPL_MUL_16_16(u, HALF_SUBFRAMELEN);
|
||||
int32_t temp1 = u * HALF_SUBFRAMELEN;
|
||||
|
||||
//set the denominator and numerator of the Direct Form
|
||||
temp2 = (int16_t)WEBRTC_SPL_MUL_16_16(u, orderCoef);
|
||||
temp3 = (int16_t)WEBRTC_SPL_MUL_16_16(2, u) + lo_hi;
|
||||
temp2 = (int16_t)(u * orderCoef);
|
||||
temp3 = (int16_t)(2 * u + lo_hi);
|
||||
|
||||
for (ii=0; ii<orderCoef; ii++) {
|
||||
sthQ15[ii] = filt_coefQ15[temp2+ii];
|
||||
|
||||
@ -38,12 +38,13 @@ void WebRtcSpl_AToK_JSK(
|
||||
k16[useOrder-1] = a16[useOrder] << 4; // Q11<<4 => Q15
|
||||
|
||||
for (m=useOrder-1; m>0; m--) {
|
||||
tmp_inv_denum32 = ((int32_t) 1073741823) - WEBRTC_SPL_MUL_16_16(k16[m], k16[m]); // (1 - k^2) in Q30
|
||||
// (1 - k^2) in Q30
|
||||
tmp_inv_denum32 = 1073741823 - k16[m] * k16[m];
|
||||
tmp_inv_denum16 = (int16_t)(tmp_inv_denum32 >> 15); // (1 - k^2) in Q15.
|
||||
|
||||
for (k=1; k<=m; k++) {
|
||||
tmp32b = WEBRTC_SPL_LSHIFT_W32((int32_t)a16[k], 16) -
|
||||
WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(k16[m], a16[m-k+1]), 1);
|
||||
WEBRTC_SPL_LSHIFT_W32(k16[m] * a16[m - k + 1], 1);
|
||||
|
||||
tmp32[k] = WebRtcSpl_DivW32W16(tmp32b, tmp_inv_denum16); //Q27/Q15 = Q12
|
||||
}
|
||||
@ -371,19 +372,19 @@ void WebRtcIsacfix_GetVars(const int16_t *input, const int16_t *pitchGains_Q12,
|
||||
/* Calculate energies of first and second frame halfs */
|
||||
nrgQ[0]=0;
|
||||
for (k = QLOOKAHEAD/2; k < (FRAMESAMPLES/4 + QLOOKAHEAD) / 2; k++) {
|
||||
nrgQ[0] +=WEBRTC_SPL_MUL_16_16(input[k],input[k]);
|
||||
nrgQ[0] += (uint32_t)(input[k] * input[k]);
|
||||
}
|
||||
nrgQ[1]=0;
|
||||
for ( ; k < (FRAMESAMPLES/2 + QLOOKAHEAD) / 2; k++) {
|
||||
nrgQ[1] +=WEBRTC_SPL_MUL_16_16(input[k],input[k]);
|
||||
nrgQ[1] += (uint32_t)(input[k] * input[k]);
|
||||
}
|
||||
nrgQ[2]=0;
|
||||
for ( ; k < (WEBRTC_SPL_MUL_16_16(FRAMESAMPLES, 3)/4 + QLOOKAHEAD) / 2; k++) {
|
||||
nrgQ[2] +=WEBRTC_SPL_MUL_16_16(input[k],input[k]);
|
||||
for ( ; k < (FRAMESAMPLES * 3 / 4 + QLOOKAHEAD) / 2; k++) {
|
||||
nrgQ[2] += (uint32_t)(input[k] * input[k]);
|
||||
}
|
||||
nrgQ[3]=0;
|
||||
for ( ; k < (FRAMESAMPLES + QLOOKAHEAD) / 2; k++) {
|
||||
nrgQ[3] +=WEBRTC_SPL_MUL_16_16(input[k],input[k]);
|
||||
nrgQ[3] += (uint32_t)(input[k] * input[k]);
|
||||
}
|
||||
|
||||
for ( k=0; k<4; k++) {
|
||||
@ -482,7 +483,7 @@ int32_t WebRtcIsacfix_CalculateResidualEnergyC(int lpc_order,
|
||||
* a_polynomial[j] * corr_coeffs[i] * a_polynomial[j - i] * 2;
|
||||
*/
|
||||
|
||||
tmp32 = WEBRTC_SPL_MUL_16_16(a_polynomial[j], a_polynomial[j - i]);
|
||||
tmp32 = a_polynomial[j] * a_polynomial[j - i];
|
||||
/* tmp32 in Q(q_val_polynomial * 2). */
|
||||
if (i != 0) {
|
||||
tmp32 <<= 1;
|
||||
@ -622,7 +623,7 @@ void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0,
|
||||
DataHiQ6[pos1] = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(
|
||||
maskdata->DataBufferHiQ0[pos1], kWindowAutocorr[pos1], 15); // Q0*Q21>>15 = Q6
|
||||
}
|
||||
pos2 = (int16_t)(WEBRTC_SPL_MUL_16_16(k, UPDATE)/2);
|
||||
pos2 = (int16_t)(k * UPDATE / 2);
|
||||
for (n = 0; n < UPDATE/2; n++, pos1++) {
|
||||
maskdata->DataBufferLoQ0[pos1] = inLoQ0[QLOOKAHEAD + pos2];
|
||||
maskdata->DataBufferHiQ0[pos1] = inHiQ0[pos2++];
|
||||
@ -830,15 +831,15 @@ void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0,
|
||||
|
||||
/* bandwidth expansion */
|
||||
for (n = 1; n <= ORDERLO; n++) {
|
||||
a_LOQ11[n] = (int16_t) ((WEBRTC_SPL_MUL_16_16(
|
||||
kPolyVecLo[n-1], a_LOQ11[n]) + ((int32_t) (1 << 14))) >> 15);
|
||||
a_LOQ11[n] = (int16_t)((kPolyVecLo[n - 1] * a_LOQ11[n] + (1 << 14)) >>
|
||||
15);
|
||||
}
|
||||
|
||||
|
||||
polyHI[0] = a_HIQ12[0];
|
||||
for (n = 1; n <= ORDERHI; n++) {
|
||||
a_HIQ12[n] = (int16_t) ((WEBRTC_SPL_MUL_16_16(
|
||||
kPolyVecHi[n-1], a_HIQ12[n]) + ((int32_t) (1 << 14))) >> 15);
|
||||
a_HIQ12[n] = (int16_t)(((int32_t)(kPolyVecHi[n - 1] * a_HIQ12[n]) +
|
||||
(1 << 14)) >> 15);
|
||||
polyHI[n] = a_HIQ12[n];
|
||||
}
|
||||
|
||||
|
||||
@ -87,9 +87,9 @@ static __inline void Intrp1DQ8(int32_t *x, int32_t *fx, int32_t *y, int32_t *fy)
|
||||
/* fy = 0.5 * t * (t-1) * fx[0] + (1-t*t) * fx[1] + 0.5 * t * (t+1) * fx[2]; */
|
||||
|
||||
/* Part I: 0.5 * t * (t-1) * fx[0] */
|
||||
tmp16_1=(int16_t)WEBRTC_SPL_MUL_16_16(t16,t16); /* Q8*Q8=Q16 */
|
||||
tmp16_1 = (int16_t)(t16 * t16); /* Q8*Q8=Q16 */
|
||||
tmp16_1 >>= 2; /* Q16>>2 = Q14 */
|
||||
t16 = (int16_t)WEBRTC_SPL_MUL_16_16(t16, 64); /* Q8<<6 = Q14 */
|
||||
t16 <<= 6; /* Q8<<6 = Q14 */
|
||||
tmp16 = tmp16_1-t16;
|
||||
*fy = WEBRTC_SPL_MUL_16_32_RSFT15(tmp16, fx[0]); /* (Q14 * Q8 >>15)/2 = Q8 */
|
||||
|
||||
@ -191,7 +191,7 @@ void WebRtcIsacfix_InitialPitch(const int16_t *in, /* Q0 */
|
||||
|
||||
|
||||
/* copy old values from state buffer */
|
||||
memcpy(buf_dec16, State->dec_buffer16, WEBRTC_SPL_MUL_16_16(sizeof(int16_t), (PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2)));
|
||||
memcpy(buf_dec16, State->dec_buffer16, sizeof(State->dec_buffer16));
|
||||
|
||||
/* decimation; put result after the old values */
|
||||
WebRtcIsacfix_DecimateAllpass32(in, State->decimator_state32, PITCH_FRAME_LEN,
|
||||
|
||||
@ -219,7 +219,7 @@ void WebRtcIsacfix_PitchFilterGains(const int16_t* indatQ0,
|
||||
|
||||
tmpW32 = 0;
|
||||
for (m = 0; m < PITCH_FRACORDER; m++) {
|
||||
tmpW32 += WEBRTC_SPL_MUL_16_16(ubufQQ[pos3QQ + m], fracoeffQQ[m]);
|
||||
tmpW32 += ubufQQ[pos3QQ + m] * fracoeffQQ[m];
|
||||
}
|
||||
|
||||
// Subtract from input and update buffer.
|
||||
@ -228,7 +228,7 @@ void WebRtcIsacfix_PitchFilterGains(const int16_t* indatQ0,
|
||||
tmp2W32 = WEBRTC_SPL_MUL_16_32_RSFT14(indatQ0[ind], tmpW32);
|
||||
tmpW32 += 8192;
|
||||
tmpW16 = (int16_t)(tmpW32 >> 14);
|
||||
tmpW32 = WEBRTC_SPL_MUL_16_16(tmpW16, tmpW16);
|
||||
tmpW32 = tmpW16 * tmpW16;
|
||||
|
||||
if ((tmp2W32 > 1073700000) || (csum1QQ > 1073700000) ||
|
||||
(tmpW32 > 1073700000) || (esumxQQ > 1073700000)) { // 2^30
|
||||
|
||||
@ -35,7 +35,7 @@ void WebRtcIsacfix_PitchFilterCore(int loopNumber,
|
||||
|
||||
/* Filter to get fractional pitch. */
|
||||
for (j = 0; j < PITCH_FRACORDER; j++) {
|
||||
tmpW32 += WEBRTC_SPL_MUL_16_16(ubufQQpos2[*index2 + j], coefficient[j]);
|
||||
tmpW32 += ubufQQpos2[*index2 + j] * coefficient[j];
|
||||
}
|
||||
|
||||
/* Saturate to avoid overflow in tmpW16. */
|
||||
@ -54,7 +54,7 @@ void WebRtcIsacfix_PitchFilterCore(int loopNumber,
|
||||
/* TODO(kma): Define a static inline function WebRtcSpl_DotProduct()
|
||||
in spl_inl.h to replace this and other similar loops. */
|
||||
for (j = 0; j < PITCH_DAMPORDER; j++) {
|
||||
tmpW32 += WEBRTC_SPL_MUL_16_16(inputState[j], kDampFilter[j]);
|
||||
tmpW32 += inputState[j] * kDampFilter[j];
|
||||
}
|
||||
|
||||
/* Saturate to avoid overflow in tmpW16. */
|
||||
@ -63,7 +63,7 @@ void WebRtcIsacfix_PitchFilterCore(int loopNumber,
|
||||
tmpW16 = (int16_t)(tmpW32 >> 15);
|
||||
|
||||
/* Subtract from input and update buffer. */
|
||||
tmpW32 = inputBuf[*index2] - WEBRTC_SPL_MUL_16_16(sign, tmpW16);
|
||||
tmpW32 = inputBuf[*index2] - sign * tmpW16;
|
||||
outputBuf[*index2] = WebRtcSpl_SatW32ToW16(tmpW32);
|
||||
tmpW32 = inputBuf[*index2] + outputBuf[*index2];
|
||||
outputBuf2[*index2 + PITCH_BUFFSIZE] = WebRtcSpl_SatW32ToW16(tmpW32);
|
||||
|
||||
Reference in New Issue
Block a user