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

Side by Side Diff: webrtc/modules/audio_processing/ns/nsx_core_c.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, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <assert.h> 11 #include "webrtc/base/checks.h"
12
13 #include "webrtc/modules/audio_processing/ns/noise_suppression_x.h" 12 #include "webrtc/modules/audio_processing/ns/noise_suppression_x.h"
14 #include "webrtc/modules/audio_processing/ns/nsx_core.h" 13 #include "webrtc/modules/audio_processing/ns/nsx_core.h"
15 #include "webrtc/modules/audio_processing/ns/nsx_defines.h" 14 #include "webrtc/modules/audio_processing/ns/nsx_defines.h"
16 15
17 static const int16_t kIndicatorTable[17] = { 16 static const int16_t kIndicatorTable[17] = {
18 0, 2017, 3809, 5227, 6258, 6963, 7424, 7718, 17 0, 2017, 3809, 5227, 6258, 6963, 7424, 7718,
19 7901, 8014, 8084, 8126, 8152, 8168, 8177, 8183, 8187 18 7901, 8014, 8084, 8126, 8152, 8168, 8177, 8183, 8187
20 }; 19 };
21 20
22 // Compute speech/noise probability 21 // Compute speech/noise probability
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 141 }
143 indPriorFX += inst->weightSpecFlat * tmpIndFX; // 6*Q14 142 indPriorFX += inst->weightSpecFlat * tmpIndFX; // 6*Q14
144 } 143 }
145 144
146 //for template spectral-difference 145 //for template spectral-difference
147 if (inst->weightSpecDiff) { 146 if (inst->weightSpecDiff) {
148 tmpU32no1 = 0; 147 tmpU32no1 = 0;
149 if (inst->featureSpecDiff) { 148 if (inst->featureSpecDiff) {
150 normTmp = WEBRTC_SPL_MIN(20 - inst->stages, 149 normTmp = WEBRTC_SPL_MIN(20 - inst->stages,
151 WebRtcSpl_NormU32(inst->featureSpecDiff)); 150 WebRtcSpl_NormU32(inst->featureSpecDiff));
152 assert(normTmp >= 0); 151 RTC_DCHECK_GE(normTmp, 0);
153 tmpU32no1 = inst->featureSpecDiff << normTmp; // Q(normTmp-2*stages) 152 tmpU32no1 = inst->featureSpecDiff << normTmp; // Q(normTmp-2*stages)
154 tmpU32no2 = inst->timeAvgMagnEnergy >> (20 - inst->stages - normTmp); 153 tmpU32no2 = inst->timeAvgMagnEnergy >> (20 - inst->stages - normTmp);
155 if (tmpU32no2 > 0) { 154 if (tmpU32no2 > 0) {
156 // Q(20 - inst->stages) 155 // Q(20 - inst->stages)
157 tmpU32no1 /= tmpU32no2; 156 tmpU32no1 /= tmpU32no2;
158 } else { 157 } else {
159 tmpU32no1 = (uint32_t)(0x7fffffff); 158 tmpU32no1 = (uint32_t)(0x7fffffff);
160 } 159 }
161 } 160 }
162 tmpU32no3 = (inst->thresholdSpecDiff << 17) / 25; 161 tmpU32no3 = (inst->thresholdSpecDiff << 17) / 25;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 tmp32no1 = (int32_t)inst->priorNonSpeechProb << 8; // Q22 251 tmp32no1 = (int32_t)inst->priorNonSpeechProb << 8; // Q22
253 252
254 nonSpeechProbFinal[i] = tmp32no1 / 253 nonSpeechProbFinal[i] = tmp32no1 /
255 (inst->priorNonSpeechProb + invLrtFX); // Q8 254 (inst->priorNonSpeechProb + invLrtFX); // Q8
256 } 255 }
257 } 256 }
258 } 257 }
259 } 258 }
260 } 259 }
261 260
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698