Introduced WebRtcSpl_SatW32ToW16 to iSAC fix, for Android platforms.

Review URL: http://webrtc-codereview.appspot.com/315005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1190 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kma@webrtc.org
2011-12-14 18:41:07 +00:00
parent f147bbc878
commit 6601902504
5 changed files with 20 additions and 22 deletions

View File

@@ -204,8 +204,8 @@ WebRtc_Word16 WebRtcIsacfix_DecodeImpl(WebRtc_Word16 *signal_out16,
/* Form the polyphase signals, and compensate for DC offset */
for (k=0;k<FRAMESAMPLES/2;k++) {
tmp_1 = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, (((WebRtc_Word32)Vector_Word16_1[k]+Vector_Word16_2[k] + 1)), -32768); /* Construct a new upper channel signal*/
tmp_2 = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, (((WebRtc_Word32)Vector_Word16_1[k]-Vector_Word16_2[k])), -32768); /* Construct a new lower channel signal*/
tmp_1 = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(((WebRtc_Word32)Vector_Word16_1[k]+Vector_Word16_2[k] + 1)); /* Construct a new upper channel signal*/
tmp_2 = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(((WebRtc_Word32)Vector_Word16_1[k]-Vector_Word16_2[k])); /* Construct a new lower channel signal*/
Vector_Word16_1[k] = tmp_1;
Vector_Word16_2[k] = tmp_2;
}

View File

@@ -810,11 +810,11 @@ WebRtc_Word16 WebRtcIsacfix_DecodePlcImpl(WebRtc_Word16 *signal_out16,
for (k=0;k<FRAMESAMPLES_HALF;k++)
{
/* Construct a new upper channel signal*/
tmp_1 = (WebRtc_Word16) WEBRTC_SPL_SAT(32767,
(((WebRtc_Word32)Vector_Word16_1[k]+Vector_Word16_2[k] + 1)), -32768);
tmp_1 = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(
((WebRtc_Word32)Vector_Word16_1[k]+Vector_Word16_2[k] + 1));
/* Construct a new lower channel signal*/
tmp_2 = (WebRtc_Word16) WEBRTC_SPL_SAT(32767,
(((WebRtc_Word32)Vector_Word16_1[k]-Vector_Word16_2[k])), -32768);
tmp_2 = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(
((WebRtc_Word32)Vector_Word16_1[k]-Vector_Word16_2[k]));
Vector_Word16_1[k] = tmp_1;
Vector_Word16_2[k] = tmp_2;
}

View File

@@ -68,7 +68,7 @@ static void HighpassFilterFixDec32(
c = ((WebRtc_Word32)in) + WEBRTC_SPL_RSHIFT_W32(a+b, 7); // Q0
//c = WEBRTC_SPL_RSHIFT_W32(c, 1); // Q-1
io[k] = (WebRtc_Word16)WEBRTC_SPL_SAT((WebRtc_Word32)32767, c, (WebRtc_Word32)-32768); // Write output as Q0
io[k] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(c); // Write output as Q0
/* Q30 * Q4 = Q34 ; shift 32 bit => Q2 */
a = WEBRTC_SPL_MUL_32_32_RSFT32(coeff[2*0], coeff[2*0+1], state[0]);
@@ -144,9 +144,9 @@ void WebRtcIsacfix_SplitAndFilter1(WebRtc_Word16 *pin,
tmp1 = (WebRtc_Word32)tempin_ch1[k]; // Q0 -> Q0
tmp2 = (WebRtc_Word32)tempin_ch2[k]; // Q0 -> Q0
tmp3 = (WebRtc_Word32)WEBRTC_SPL_RSHIFT_W32((tmp1 + tmp2), 1);/* low pass signal*/
LP16[k] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp3, -32768); /*low pass */
LP16[k] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp3); /*low pass */
tmp3 = (WebRtc_Word32)WEBRTC_SPL_RSHIFT_W32((tmp1 - tmp2), 1);/* high pass signal*/
HP16[k] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp3, -32768); /*high pass */
HP16[k] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp3); /*high pass */
}
}/*end of WebRtcIsacfix_SplitAndFilter */
@@ -199,9 +199,9 @@ void WebRtcIsacfix_SplitAndFilter2(WebRtc_Word16 *pin,
tmp1 = (WebRtc_Word32)tempin_ch1[k]; // Q0 -> Q0
tmp2 = (WebRtc_Word32)tempin_ch2[k]; // Q0 -> Q0
tmp3 = (WebRtc_Word32)WEBRTC_SPL_RSHIFT_W32((tmp1 + tmp2), 1);/* low pass signal*/
LP16[k] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp3, -32768); /*low pass */
LP16[k] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp3); /*low pass */
tmp3 = (WebRtc_Word32)WEBRTC_SPL_RSHIFT_W32((tmp1 - tmp2), 1);/* high pass signal*/
HP16[k] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp3, -32768); /*high pass */
HP16[k] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp3); /*high pass */
}
}/*end of WebRtcIsacfix_SplitAndFilter */

View File

@@ -245,16 +245,16 @@ void WebRtcIsacfix_NormLatticeFilterAr(WebRtc_Word16 orderCoef,
tmp32 = WEBRTC_SPL_MUL_16_32_RSFT16(inv_gain16, tmp32); //lat_in[]*inv_gain in (Q(18-sh)*Q26)>>16 = Q(28-sh)
tmp32 = WEBRTC_SPL_SHIFT_W32(tmp32, -(28-sh)); // lat_in[]*inv_gain in Q0
ARfQ0vec[i] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp32, -32768); // Q0
ARfQ0vec[i] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp32); // Q0
}
for (i=orderCoef-1;i>=0;i--) //get the state of f&g for the first input, for all orders
{
tmp32 = WEBRTC_SPL_RSHIFT_W32(((WEBRTC_SPL_MUL_16_16(cthQ15[i],ARfQ0vec[0])) - (WEBRTC_SPL_MUL_16_16(sthQ15[i],stateGQ0[i])) + 16384), 15);
tmpAR = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp32, -32768); // Q0
tmpAR = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp32); // Q0
tmp32 = WEBRTC_SPL_RSHIFT_W32(((WEBRTC_SPL_MUL_16_16(sthQ15[i],ARfQ0vec[0])) + (WEBRTC_SPL_MUL_16_16(cthQ15[i], stateGQ0[i])) + 16384), 15);
ARgQ0vec[i+1] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp32, -32768); // Q0
ARgQ0vec[i+1] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp32); // Q0
ARfQ0vec[0] = tmpAR;
}
ARgQ0vec[0] = ARfQ0vec[0];
@@ -266,10 +266,8 @@ void WebRtcIsacfix_NormLatticeFilterAr(WebRtc_Word16 orderCoef,
{
tmp32 = WEBRTC_SPL_RSHIFT_W32(((WEBRTC_SPL_MUL_16_16(cthQ15[k], tmpAR)) - (WEBRTC_SPL_MUL_16_16(sthQ15[k], ARgQ0vec[k])) + 16384), 15);
tmp32_2 = WEBRTC_SPL_RSHIFT_W32(((WEBRTC_SPL_MUL_16_16(sthQ15[k], tmpAR)) + (WEBRTC_SPL_MUL_16_16(cthQ15[k], ARgQ0vec[k])) + 16384), 15);
tmpAR = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp32, -32768); // Q0
ARgQ0vec[k+1] = (WebRtc_Word16) WEBRTC_SPL_SAT(32767, tmp32_2, -32768); // Q0
tmpAR = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp32); // Q0
ARgQ0vec[k+1] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmp32_2); // Q0
}
ARfQ0vec[n+1] = tmpAR;
ARgQ0vec[0] = tmpAR;

View File

@@ -162,9 +162,9 @@ void WebRtcIsacfix_PitchFilter(WebRtc_Word16 *indatQQ, /* Q10 if type is 1 or 4,
/* Subtract from input and update buffer */
tmpW32 = indatQQ[ind] - WEBRTC_SPL_MUL_16_16(sign, tmpW16);
outdatQQ[ind] = (WebRtc_Word16)WEBRTC_SPL_SAT(32767, tmpW32, -32768);
outdatQQ[ind] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmpW32);
tmpW32 = indatQQ[ind] + (WebRtc_Word32)outdatQQ[ind];
ubufQQ[pos] = (WebRtc_Word16)WEBRTC_SPL_SAT(32767, tmpW32, -32768);
ubufQQ[pos] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmpW32);
ind++;
cnt--;
@@ -213,9 +213,9 @@ void WebRtcIsacfix_PitchFilter(WebRtc_Word16 *indatQQ, /* Q10 if type is 1 or 4,
/* Subtract from input and update buffer */
tmpW32 = indatQQ[ind] - (WebRtc_Word32)tmpW16;
outdatQQ[ind] = (WebRtc_Word16)WEBRTC_SPL_SAT(32767, tmpW32, -32768);
outdatQQ[ind] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmpW32);
tmpW32 = indatQQ[ind] + (WebRtc_Word32)outdatQQ[ind];
ubufQQ[pos] = (WebRtc_Word16)WEBRTC_SPL_SAT(32767, tmpW32, -32768);
ubufQQ[pos] = (WebRtc_Word16)WebRtcSpl_SatW32ToW16(tmpW32);
ind++;
}