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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 *saturated = 1; | 467 *saturated = 1; |
468 stt->envSum = 0; | 468 stt->envSum = 0; |
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 int64_t tmp = 0; |
478 int32_t midVal; | 478 int32_t midVal; |
479 | 479 |
480 /* Is the input signal zero? */ | 480 /* Is the input signal zero? */ |
481 for (i = 0; i < 10; i++) { | 481 for (i = 0; i < 10; i++) { |
482 tmp32 += env[i]; | 482 tmp += env[i]; |
483 } | 483 } |
484 | 484 |
485 /* Each block is allowed to have a few non-zero | 485 /* Each block is allowed to have a few non-zero |
486 * samples. | 486 * samples. |
487 */ | 487 */ |
488 if (tmp32 < 500) { | 488 if (tmp < 500) { |
489 stt->msZero += 10; | 489 stt->msZero += 10; |
490 } else { | 490 } else { |
491 stt->msZero = 0; | 491 stt->msZero = 0; |
492 } | 492 } |
493 | 493 |
494 if (stt->muteGuardMs > 0) { | 494 if (stt->muteGuardMs > 0) { |
495 stt->muteGuardMs -= 10; | 495 stt->muteGuardMs -= 10; |
496 } | 496 } |
497 | 497 |
498 if (stt->msZero > 500) { | 498 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"); | 1380 fprintf(stt->fpt, "minLevel, maxLevel value(s) are invalid\n\n"); |
1381 #endif | 1381 #endif |
1382 return -1; | 1382 return -1; |
1383 } else { | 1383 } else { |
1384 #ifdef WEBRTC_AGC_DEBUG_DUMP | 1384 #ifdef WEBRTC_AGC_DEBUG_DUMP |
1385 fprintf(stt->fpt, "\n"); | 1385 fprintf(stt->fpt, "\n"); |
1386 #endif | 1386 #endif |
1387 return 0; | 1387 return 0; |
1388 } | 1388 } |
1389 } | 1389 } |
OLD | NEW |