Coverity warnings in audio codecs
Coverity reported errors/warnings in iSAC and iLBC. Seven of the warnings should be fixed with this CL. Review URL: https://webrtc-codereview.appspot.com/793004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2740 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f0effa12d9
commit
1617f65eec
@ -69,7 +69,8 @@ void WebRtcIlbcfix_CbSearch(
|
||||
WebRtc_Word32 cDot[128];
|
||||
WebRtc_Word32 Crit[128];
|
||||
WebRtc_Word16 targetVec[SUBL+LPC_FILTERORDER];
|
||||
WebRtc_Word16 cbvectors[CB_MEML];
|
||||
WebRtc_Word16 cbvectors[CB_MEML + 1]; /* Adding one extra position for
|
||||
Coverity warnings. */
|
||||
WebRtc_Word16 codedVec[SUBL];
|
||||
WebRtc_Word16 interpSamples[20*4];
|
||||
WebRtc_Word16 interpSamplesFilt[20*4];
|
||||
|
@ -630,8 +630,10 @@ WebRtc_UWord16 WebRtcIsacfix_GetDownlinkBwIndexImpl(BwEstimatorstr *bweStr)
|
||||
WEBRTC_SPL_UMUL(102, WEBRTC_SPL_LSHIFT_U32((WebRtc_UWord32)rate + bweStr->recHeaderRate, 5));
|
||||
bweStr->recBwAvg = WEBRTC_SPL_RSHIFT_U32(bweStr->recBwAvg, 10);
|
||||
|
||||
/* find quantization index that gives the closest rate after averaging */
|
||||
for (rateInd = 1; rateInd < 12; rateInd++) {
|
||||
/* Find quantization index that gives the closest rate after averaging.
|
||||
* Note that we don't need to check the last value, rate <= kQRateTable[11],
|
||||
* because we will use rateInd = 11 even if rate > kQRateTable[11]. */
|
||||
for (rateInd = 1; rateInd < 11; rateInd++) {
|
||||
if (rate <= kQRateTable[rateInd]){
|
||||
break;
|
||||
}
|
||||
|
@ -1589,7 +1589,7 @@ int WebRtcIsacfix_DecodePitchGain(Bitstr_dec *streamdata, WebRtc_Word16 *PitchGa
|
||||
*pitch_gain_cdf_ptr = WebRtcIsacfix_kPitchGainCdf;
|
||||
err = WebRtcIsacfix_DecHistBisectMulti(&index_comb, streamdata, pitch_gain_cdf_ptr, WebRtcIsacfix_kCdfTableSizeGain, 1);
|
||||
/* error check, Q_mean_Gain.. tables are of size 144 */
|
||||
if ((err<0) || (index_comb<0) || (index_comb>144))
|
||||
if ((err < 0) || (index_comb < 0) || (index_comb >= 144))
|
||||
return -ISAC_RANGE_ERROR_DECODE_PITCH_GAIN;
|
||||
|
||||
/* unquantize back to pitch gains by table look-up */
|
||||
|
@ -614,13 +614,6 @@ WebRtc_Word16 WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst
|
||||
memcpy(streamdata.stream, encoded, 5);
|
||||
#endif
|
||||
|
||||
if (packet_size == 0)
|
||||
{
|
||||
/* return error code if the packet length is null */
|
||||
ISAC_inst->errorcode = ISAC_EMPTY_PACKET;
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = WebRtcIsacfix_EstimateBandwidth(&ISAC_inst->bwestimator_obj,
|
||||
&streamdata,
|
||||
packet_size,
|
||||
@ -709,13 +702,6 @@ WebRtc_Word16 WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst,
|
||||
memcpy(streamdata.stream, encoded, 5);
|
||||
#endif
|
||||
|
||||
if (packet_size == 0)
|
||||
{
|
||||
/* return error code if the packet length is null */
|
||||
ISAC_inst->errorcode = ISAC_EMPTY_PACKET;
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = WebRtcIsacfix_EstimateBandwidth(&ISAC_inst->bwestimator_obj,
|
||||
&streamdata,
|
||||
packet_size,
|
||||
|
@ -1518,7 +1518,7 @@ int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
|
||||
WebRtcIsac_kQPitchGainCdf_ptr,
|
||||
WebRtcIsac_kQCdfTableSizeGain, 1);
|
||||
/* Error check, Q_mean_Gain.. tables are of size 144 */
|
||||
if ((err < 0) || (index_comb < 0) || (index_comb > 144)) {
|
||||
if ((err < 0) || (index_comb < 0) || (index_comb >= 144)) {
|
||||
return -ISAC_RANGE_ERROR_DECODE_PITCH_GAIN;
|
||||
}
|
||||
/* De-quantize back to pitch gains by table look-up. */
|
||||
|
@ -335,10 +335,6 @@ static int FFTRADIX (REAL Re[],
|
||||
/* allow full use of alloc'd space */
|
||||
max_perm = fftstate->MaxPermAlloced;
|
||||
}
|
||||
if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
|
||||
|| fftstate->Perm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* assign pointers */
|
||||
Rtmp = (REAL *) fftstate->Tmp0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user