Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: webrtc/modules/audio_processing/ns/nsx_core_neon.c

Issue 2274083002: Replace calls to assert() with RTC_DCHECK_*() in .c code (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/ns/nsx_core_neon.c
diff --git a/webrtc/modules/audio_processing/ns/nsx_core_neon.c b/webrtc/modules/audio_processing/ns/nsx_core_neon.c
index 516dd095ccbc4c78af6b0ed892246aed215f6566..fb1b32350df1bd9f3af51a06cd0fa2d49b5566c4 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core_neon.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core_neon.c
@@ -11,7 +11,8 @@
#include "webrtc/modules/audio_processing/ns/nsx_core.h"
#include <arm_neon.h>
-#include <assert.h>
+
+#include "webrtc/base/checks.h"
// Constants to compensate for shifting signal log(2^shifts).
const int16_t WebRtcNsx_kLogTable[9] = {
@@ -144,8 +145,8 @@ void WebRtcNsx_NoiseEstimationNeon(NoiseSuppressionFixedC* inst,
size_t i, s, offset;
tabind = inst->stages - inst->normData;
- assert(tabind < 9);
- assert(tabind > -9);
+ RTC_DCHECK_LT(tabind, 9);
+ RTC_DCHECK_GT(tabind, -9);
if (tabind < 0) {
logval = -WebRtcNsx_kLogTable[-tabind];
} else {
@@ -163,7 +164,7 @@ void WebRtcNsx_NoiseEstimationNeon(NoiseSuppressionFixedC* inst,
zeros = WebRtcSpl_NormU32((uint32_t)magn[i]);
frac = (int16_t)((((uint32_t)magn[i] << zeros)
& 0x7FFFFFFF) >> 23);
- assert(frac < 256);
+ RTC_DCHECK_LT(frac, 256);
// log2(magn(i))
log2 = (int16_t)(((31 - zeros) << 8)
+ WebRtcNsx_kLogTableFrac[frac]);
@@ -190,7 +191,7 @@ void WebRtcNsx_NoiseEstimationNeon(NoiseSuppressionFixedC* inst,
// Get counter values from state
counter = inst->noiseEstCounter[s];
- assert(counter < 201);
+ RTC_DCHECK_LT(counter, 201);
countDiv = WebRtcNsx_kCounterDiv[counter];
countProd = (int16_t)(counter * countDiv);
@@ -354,8 +355,8 @@ void WebRtcNsx_NoiseEstimationNeon(NoiseSuppressionFixedC* inst,
// Filter the data in the frequency domain, and create spectrum.
void WebRtcNsx_PrepareSpectrumNeon(NoiseSuppressionFixedC* inst,
int16_t* freq_buf) {
- assert(inst->magnLen % 8 == 1);
- assert(inst->anaLen2 % 16 == 0);
+ RTC_DCHECK_EQ(1, inst->magnLen % 8);
+ RTC_DCHECK_EQ(0, inst->anaLen2 % 16);
// (1) Filtering.
@@ -445,8 +446,8 @@ void WebRtcNsx_PrepareSpectrumNeon(NoiseSuppressionFixedC* inst,
void WebRtcNsx_SynthesisUpdateNeon(NoiseSuppressionFixedC* inst,
int16_t* out_frame,
int16_t gain_factor) {
- assert(inst->anaLen % 16 == 0);
- assert(inst->blockLen10ms % 16 == 0);
+ RTC_DCHECK_EQ(0, inst->anaLen % 16);
+ RTC_DCHECK_EQ(0, inst->blockLen10ms % 16);
int16_t* preal_start = inst->real;
const int16_t* pwindow = inst->window;
@@ -537,8 +538,8 @@ void WebRtcNsx_SynthesisUpdateNeon(NoiseSuppressionFixedC* inst,
void WebRtcNsx_AnalysisUpdateNeon(NoiseSuppressionFixedC* inst,
int16_t* out,
int16_t* new_speech) {
- assert(inst->blockLen10ms % 16 == 0);
- assert(inst->anaLen % 16 == 0);
+ RTC_DCHECK_EQ(0, inst->blockLen10ms % 16);
+ RTC_DCHECK_EQ(0, inst->anaLen % 16);
// For lower band update analysis buffer.
// memcpy(inst->analysisBuffer, inst->analysisBuffer + inst->blockLen10ms,

Powered by Google App Engine
This is Rietveld 408576698