Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 } | 469 } |
| 470 | 470 |
| 471 /* stt->envSum *= 0.99; */ | 471 /* stt->envSum *= 0.99; */ |
| 472 stt->envSum = (int16_t)((stt->envSum * 32440) >> 15); | 472 stt->envSum = (int16_t)((stt->envSum * 32440) >> 15); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) { | 475 void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) { |
| 476 int16_t i; | 476 int16_t i; |
| 477 int32_t tmp32 = 0; | 477 int32_t tmp32 = 0; |
| 478 int32_t midVal; | 478 int32_t midVal; |
| 479 const int kZeroThreshold = 500; | |
| 479 | 480 |
| 480 /* Is the input signal zero? */ | 481 /* Is the input signal zero? */ |
| 481 for (i = 0; i < 10; i++) { | 482 for (i = 0; i < 10; i++) { |
| 483 if (env[i] >= kZeroThreshold || tmp32 >= kZeroThreshold) { | |
|
peah-webrtc
2016/06/03 06:51:12
What about my comment on what happened to the int6
| |
| 484 break; | |
| 485 } | |
| 482 tmp32 += env[i]; | 486 tmp32 += env[i]; |
| 483 } | 487 } |
| 484 | 488 |
| 485 /* Each block is allowed to have a few non-zero | 489 /* Each block is allowed to have a few non-zero |
| 486 * samples. | 490 * samples. |
| 487 */ | 491 */ |
| 488 if (tmp32 < 500) { | 492 if (i == 10 && tmp32 < kZeroThreshold) { |
| 489 stt->msZero += 10; | 493 stt->msZero += 10; |
| 490 } else { | 494 } else { |
| 491 stt->msZero = 0; | 495 stt->msZero = 0; |
| 492 } | 496 } |
| 493 | 497 |
| 494 if (stt->muteGuardMs > 0) { | 498 if (stt->muteGuardMs > 0) { |
| 495 stt->muteGuardMs -= 10; | 499 stt->muteGuardMs -= 10; |
| 496 } | 500 } |
| 497 | 501 |
| 498 if (stt->msZero > 500) { | 502 if (stt->msZero > 500) { |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1380 fprintf(stt->fpt, "minLevel, maxLevel value(s) are invalid\n\n"); | 1384 fprintf(stt->fpt, "minLevel, maxLevel value(s) are invalid\n\n"); |
| 1381 #endif | 1385 #endif |
| 1382 return -1; | 1386 return -1; |
| 1383 } else { | 1387 } else { |
| 1384 #ifdef WEBRTC_AGC_DEBUG_DUMP | 1388 #ifdef WEBRTC_AGC_DEBUG_DUMP |
| 1385 fprintf(stt->fpt, "\n"); | 1389 fprintf(stt->fpt, "\n"); |
| 1386 #endif | 1390 #endif |
| 1387 return 0; | 1391 return 0; |
| 1388 } | 1392 } |
| 1389 } | 1393 } |
| OLD | NEW |