webrtc/modules/audio_processing: Use RTC_DCHECK() instead of assert()

Review-Url: https://codereview.webrtc.org/2320053003
Cr-Commit-Position: refs/heads/master@{#14211}
This commit is contained in:
kwiberg
2016-09-14 05:23:22 -07:00
committed by Commit bot
parent 3a7f35b1c4
commit 9e2be5f292
27 changed files with 159 additions and 149 deletions

View File

@ -10,7 +10,6 @@
#include "webrtc/modules/audio_processing/aecm/aecm_core.h"
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
@ -24,6 +23,7 @@ extern "C" {
#include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
}
#include "webrtc/base/checks.h"
#include "webrtc/typedefs.h"
#ifdef AEC_DEBUG
@ -193,7 +193,7 @@ const uint16_t* WebRtcAecm_AlignedFarend(AecmCore* self,
int* far_q,
int delay) {
int buffer_position = 0;
assert(self != NULL);
RTC_DCHECK(self);
buffer_position = self->far_history_pos - delay;
// Check buffer position

View File

@ -10,7 +10,6 @@
#include "webrtc/modules/audio_processing/aecm/aecm_core.h"
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
@ -23,6 +22,8 @@ extern "C" {
extern "C" {
#include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
}
#include "webrtc/base/checks.h"
#include "webrtc/typedefs.h"
// Square root of Hanning window in Q14.
@ -483,7 +484,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
}
zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
assert(zeros16 >= 0); // |zeros16| is a norm, hence non-negative.
RTC_DCHECK_GE(zeros16, 0); // |zeros16| is a norm, hence non-negative.
dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
tmp16no1 = aecm->nearFilt[i] << zeros16;
@ -562,7 +563,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
{
avgHnl32 += (int32_t)hnl[i];
}
assert(kMaxPrefBand - kMinPrefBand + 1 > 0);
RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
for (i = kMaxPrefBand; i < PART_LEN1; i++)
@ -652,8 +653,8 @@ static void ComfortNoise(AecmCore* aecm,
int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain;
int16_t minTrackShift;
assert(shiftFromNearToNoise >= 0);
assert(shiftFromNearToNoise < 16);
RTC_DCHECK_GE(shiftFromNearToNoise, 0);
RTC_DCHECK_LT(shiftFromNearToNoise, 16);
if (aecm->noiseEstCtr < 100)
{

View File

@ -10,8 +10,7 @@
#include "webrtc/modules/audio_processing/aecm/aecm_core.h"
#include <assert.h>
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h"
#include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
@ -995,7 +994,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
}
zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
assert(zeros16 >= 0); // |zeros16| is a norm, hence non-negative.
RTC_DCHECK_GE(zeros16, 0); // |zeros16| is a norm, hence non-negative.
dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
tmp16no1 = aecm->nearFilt[i] << zeros16;
@ -1119,7 +1118,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
avgHnl32 += (int32_t)hnl[i];
}
assert(kMaxPrefBand - kMinPrefBand + 1 > 0);
RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
for (i = kMaxPrefBand; i < PART_LEN1; i++) {
@ -1271,8 +1270,8 @@ static void ComfortNoise(AecmCore* aecm,
int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain;
int16_t minTrackShift = 9;
assert(shiftFromNearToNoise >= 0);
assert(shiftFromNearToNoise < 16);
RTC_DCHECK_GE(shiftFromNearToNoise, 0);
RTC_DCHECK_LT(shiftFromNearToNoise, 16);
if (aecm->noiseEstCtr < 100) {
// Track the minimum more quickly initially.

View File

@ -11,8 +11,8 @@
#include "webrtc/modules/audio_processing/aecm/aecm_core.h"
#include <arm_neon.h>
#include <assert.h>
#include "webrtc/base/checks.h"
#include "webrtc/common_audio/signal_processing/include/real_fft.h"
// TODO(kma): Re-write the corresponding assembly file, the offset
@ -104,9 +104,9 @@ void WebRtcAecm_CalcLinearEnergiesNeon(AecmCore* aecm,
void WebRtcAecm_StoreAdaptiveChannelNeon(AecmCore* aecm,
const uint16_t* far_spectrum,
int32_t* echo_est) {
assert((uintptr_t)echo_est % 32 == 0);
assert((uintptr_t)(aecm->channelStored) % 16 == 0);
assert((uintptr_t)(aecm->channelAdapt16) % 16 == 0);
RTC_DCHECK_EQ(0u, (uintptr_t)echo_est % 32);
RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelStored % 16);
RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt16 % 16);
// This is C code of following optimized code.
// During startup we store the channel every block.
@ -161,9 +161,9 @@ void WebRtcAecm_StoreAdaptiveChannelNeon(AecmCore* aecm,
}
void WebRtcAecm_ResetAdaptiveChannelNeon(AecmCore* aecm) {
assert((uintptr_t)(aecm->channelStored) % 16 == 0);
assert((uintptr_t)(aecm->channelAdapt16) % 16 == 0);
assert((uintptr_t)(aecm->channelAdapt32) % 32 == 0);
RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelStored % 16);
RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt16 % 16);
RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt32 % 32);
// The C code of following optimized code.
// for (i = 0; i < PART_LEN1; i++) {