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

Side by Side Diff: webrtc/modules/audio_processing/aecm/aecm_core_mips.cc

Issue 2320053003: webrtc/modules/audio_processing: Use RTC_DCHECK() instead of assert() (Closed)
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 "webrtc/modules/audio_processing/aecm/aecm_core.h" 11 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
12 12
13 #include <assert.h> 13 #include "webrtc/base/checks.h"
14
15 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" 14 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h"
16 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" 15 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
17 16
18 static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = { 17 static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = {
19 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172, 18 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172,
20 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224, 19 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224,
21 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040, 20 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040,
22 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514, 21 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
23 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553, 22 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553,
24 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079, 23 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079,
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 echoEst32Gained = WEBRTC_SPL_UMUL_32_16( 987 echoEst32Gained = WEBRTC_SPL_UMUL_32_16(
989 (uint32_t)aecm->echoFilt[i], 988 (uint32_t)aecm->echoFilt[i],
990 supGain >> tmp16no1); 989 supGain >> tmp16no1);
991 } else { 990 } else {
992 // Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16) 991 // Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16)
993 echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain; 992 echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain;
994 } 993 }
995 } 994 }
996 995
997 zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]); 996 zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
998 assert(zeros16 >= 0); // |zeros16| is a norm, hence non-negative. 997 RTC_DCHECK_GE(zeros16, 0); // |zeros16| is a norm, hence non-negative.
999 dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld; 998 dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
1000 if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) { 999 if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
1001 tmp16no1 = aecm->nearFilt[i] << zeros16; 1000 tmp16no1 = aecm->nearFilt[i] << zeros16;
1002 qDomainDiff = zeros16 - dfa_clean_q_domain_diff; 1001 qDomainDiff = zeros16 - dfa_clean_q_domain_diff;
1003 tmp16no2 = ptrDfaClean[i] >> -qDomainDiff; 1002 tmp16no2 = ptrDfaClean[i] >> -qDomainDiff;
1004 } else { 1003 } else {
1005 tmp16no1 = dfa_clean_q_domain_diff < 0 1004 tmp16no1 = dfa_clean_q_domain_diff < 0
1006 ? aecm->nearFilt[i] >> -dfa_clean_q_domain_diff 1005 ? aecm->nearFilt[i] >> -dfa_clean_q_domain_diff
1007 : aecm->nearFilt[i] << dfa_clean_q_domain_diff; 1006 : aecm->nearFilt[i] << dfa_clean_q_domain_diff;
1008 qDomainDiff = 0; 1007 qDomainDiff = 0;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 : [temp1] "=&r" (temp1), [ptr1] "+r" (ptr1) 1111 : [temp1] "=&r" (temp1), [ptr1] "+r" (ptr1)
1113 : 1112 :
1114 : "memory", "hi", "lo" 1113 : "memory", "hi", "lo"
1115 ); 1114 );
1116 } 1115 }
1117 1116
1118 for (i = kMinPrefBand; i <= kMaxPrefBand; i++) { 1117 for (i = kMinPrefBand; i <= kMaxPrefBand; i++) {
1119 avgHnl32 += (int32_t)hnl[i]; 1118 avgHnl32 += (int32_t)hnl[i];
1120 } 1119 }
1121 1120
1122 assert(kMaxPrefBand - kMinPrefBand + 1 > 0); 1121 RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
1123 avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1); 1122 avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
1124 1123
1125 for (i = kMaxPrefBand; i < PART_LEN1; i++) { 1124 for (i = kMaxPrefBand; i < PART_LEN1; i++) {
1126 if (hnl[i] > (int16_t)avgHnl32) { 1125 if (hnl[i] > (int16_t)avgHnl32) {
1127 hnl[i] = (int16_t)avgHnl32; 1126 hnl[i] = (int16_t)avgHnl32;
1128 } 1127 }
1129 } 1128 }
1130 } 1129 }
1131 1130
1132 // Calculate NLP gain, result is in Q14 1131 // Calculate NLP gain, result is in Q14
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 const int32_t c114 = ONE_Q14; 1263 const int32_t c114 = ONE_Q14;
1265 1264
1266 int16_t randW16[PART_LEN]; 1265 int16_t randW16[PART_LEN];
1267 int16_t uReal[PART_LEN1]; 1266 int16_t uReal[PART_LEN1];
1268 int16_t uImag[PART_LEN1]; 1267 int16_t uImag[PART_LEN1];
1269 int32_t outLShift32; 1268 int32_t outLShift32;
1270 1269
1271 int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain; 1270 int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain;
1272 int16_t minTrackShift = 9; 1271 int16_t minTrackShift = 9;
1273 1272
1274 assert(shiftFromNearToNoise >= 0); 1273 RTC_DCHECK_GE(shiftFromNearToNoise, 0);
1275 assert(shiftFromNearToNoise < 16); 1274 RTC_DCHECK_LT(shiftFromNearToNoise, 16);
1276 1275
1277 if (aecm->noiseEstCtr < 100) { 1276 if (aecm->noiseEstCtr < 100) {
1278 // Track the minimum more quickly initially. 1277 // Track the minimum more quickly initially.
1279 aecm->noiseEstCtr++; 1278 aecm->noiseEstCtr++;
1280 minTrackShift = 6; 1279 minTrackShift = 6;
1281 } 1280 }
1282 1281
1283 // Generate a uniform random array on [0 2^15-1]. 1282 // Generate a uniform random array on [0 2^15-1].
1284 WebRtcSpl_RandUArray(randW16, PART_LEN, &aecm->seed); 1283 WebRtcSpl_RandUArray(randW16, PART_LEN, &aecm->seed);
1285 int16_t* randW16p = (int16_t*)randW16; 1284 int16_t* randW16p = (int16_t*)randW16;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 sgn = ((int)tt) >> 31; 1555 sgn = ((int)tt) >> 31;
1557 out[i].imag = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn); 1556 out[i].imag = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn);
1558 } 1557 }
1559 tt = out[PART_LEN].real + uReal[PART_LEN]; 1558 tt = out[PART_LEN].real + uReal[PART_LEN];
1560 sgn = ((int)tt) >> 31; 1559 sgn = ((int)tt) >> 31;
1561 out[PART_LEN].real = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn); 1560 out[PART_LEN].real = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn);
1562 tt = out[PART_LEN].imag; 1561 tt = out[PART_LEN].imag;
1563 sgn = ((int)tt) >> 31; 1562 sgn = ((int)tt) >> 31;
1564 out[PART_LEN].imag = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn); 1563 out[PART_LEN].imag = sgn == (int16_t)(tt >> 15) ? (int16_t)tt : (16384 ^ sgn);
1565 } 1564 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aecm/aecm_core_c.cc ('k') | webrtc/modules/audio_processing/aecm/aecm_core_neon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698