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

Side by Side Diff: webrtc/modules/audio_processing/aec/aec_core.c

Issue 1211053006: Rename APM Config ReportedDelay to DelayAgnostic (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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) 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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 } 1445 }
1446 // We create the delay_estimator with the same amount of maximum lookahead as 1446 // We create the delay_estimator with the same amount of maximum lookahead as
1447 // the delay history size (kHistorySizeBlocks) for symmetry reasons. 1447 // the delay history size (kHistorySizeBlocks) for symmetry reasons.
1448 aec->delay_estimator = WebRtc_CreateDelayEstimator( 1448 aec->delay_estimator = WebRtc_CreateDelayEstimator(
1449 aec->delay_estimator_farend, kHistorySizeBlocks); 1449 aec->delay_estimator_farend, kHistorySizeBlocks);
1450 if (aec->delay_estimator == NULL) { 1450 if (aec->delay_estimator == NULL) {
1451 WebRtcAec_FreeAec(aec); 1451 WebRtcAec_FreeAec(aec);
1452 return NULL; 1452 return NULL;
1453 } 1453 }
1454 #ifdef WEBRTC_ANDROID 1454 #ifdef WEBRTC_ANDROID
1455 aec->reported_delay_enabled = 0; // DA-AEC enabled by default. 1455 aec->delay_agnostic_enabled = 0; // DA-AEC enabled by default.
bjornv1 2015/07/01 18:13:34 You should change 0 to 1. Otherwise it will break
hlundin-webrtc 2015/07/02 06:36:30 Good. You found the error I planted there. I alrea
1456 // DA-AEC assumes the system is causal from the beginning and will self adjust 1456 // DA-AEC assumes the system is causal from the beginning and will self adjust
1457 // the lookahead when shifting is required. 1457 // the lookahead when shifting is required.
1458 WebRtc_set_lookahead(aec->delay_estimator, 0); 1458 WebRtc_set_lookahead(aec->delay_estimator, 0);
1459 #else 1459 #else
1460 aec->reported_delay_enabled = 1; 1460 aec->delay_agnostic_enabled = 0;
1461 WebRtc_set_lookahead(aec->delay_estimator, kLookaheadBlocks); 1461 WebRtc_set_lookahead(aec->delay_estimator, kLookaheadBlocks);
1462 #endif 1462 #endif
1463 aec->extended_filter_enabled = 0; 1463 aec->extended_filter_enabled = 0;
1464 1464
1465 // Assembly optimization 1465 // Assembly optimization
1466 WebRtcAec_FilterFar = FilterFar; 1466 WebRtcAec_FilterFar = FilterFar;
1467 WebRtcAec_ScaleErrorSignal = ScaleErrorSignal; 1467 WebRtcAec_ScaleErrorSignal = ScaleErrorSignal;
1468 WebRtcAec_FilterAdaptation = FilterAdaptation; 1468 WebRtcAec_FilterAdaptation = FilterAdaptation;
1469 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress; 1469 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress;
1470 WebRtcAec_ComfortNoise = ComfortNoise; 1470 WebRtcAec_ComfortNoise = ComfortNoise;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 } 1779 }
1780 1780
1781 // 1) At most we process |aec->mult|+1 partitions in 10 ms. Make sure we 1781 // 1) At most we process |aec->mult|+1 partitions in 10 ms. Make sure we
1782 // have enough far-end data for that by stuffing the buffer if the 1782 // have enough far-end data for that by stuffing the buffer if the
1783 // |system_delay| indicates others. 1783 // |system_delay| indicates others.
1784 if (aec->system_delay < FRAME_LEN) { 1784 if (aec->system_delay < FRAME_LEN) {
1785 // We don't have enough data so we rewind 10 ms. 1785 // We don't have enough data so we rewind 10 ms.
1786 WebRtcAec_MoveFarReadPtr(aec, -(aec->mult + 1)); 1786 WebRtcAec_MoveFarReadPtr(aec, -(aec->mult + 1));
1787 } 1787 }
1788 1788
1789 if (aec->reported_delay_enabled) { 1789 if (!aec->delay_agnostic_enabled) {
1790 // 2 a) Compensate for a possible change in the system delay. 1790 // 2 a) Compensate for a possible change in the system delay.
1791 1791
1792 // TODO(bjornv): Investigate how we should round the delay difference; 1792 // TODO(bjornv): Investigate how we should round the delay difference;
1793 // right now we know that incoming |knownDelay| is underestimated when 1793 // right now we know that incoming |knownDelay| is underestimated when
1794 // it's less than |aec->knownDelay|. We therefore, round (-32) in that 1794 // it's less than |aec->knownDelay|. We therefore, round (-32) in that
1795 // direction. In the other direction, we don't have this situation, but 1795 // direction. In the other direction, we don't have this situation, but
1796 // might flush one partition too little. This can cause non-causality, 1796 // might flush one partition too little. This can cause non-causality,
1797 // which should be investigated. Maybe, allow for a non-symmetric 1797 // which should be investigated. Maybe, allow for a non-symmetric
1798 // rounding, like -16. 1798 // rounding, like -16.
1799 int move_elements = (aec->knownDelay - knownDelay - 32) / PART_LEN; 1799 int move_elements = (aec->knownDelay - knownDelay - 32) / PART_LEN;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 int metrics_mode, 1893 int metrics_mode,
1894 int delay_logging) { 1894 int delay_logging) {
1895 assert(nlp_mode >= 0 && nlp_mode < 3); 1895 assert(nlp_mode >= 0 && nlp_mode < 3);
1896 self->nlp_mode = nlp_mode; 1896 self->nlp_mode = nlp_mode;
1897 self->metricsMode = metrics_mode; 1897 self->metricsMode = metrics_mode;
1898 if (self->metricsMode) { 1898 if (self->metricsMode) {
1899 InitMetrics(self); 1899 InitMetrics(self);
1900 } 1900 }
1901 // Turn on delay logging if it is either set explicitly or if delay agnostic 1901 // Turn on delay logging if it is either set explicitly or if delay agnostic
1902 // AEC is enabled (which requires delay estimates). 1902 // AEC is enabled (which requires delay estimates).
1903 self->delay_logging_enabled = delay_logging || !self->reported_delay_enabled; 1903 self->delay_logging_enabled = delay_logging || self->delay_agnostic_enabled;
1904 if (self->delay_logging_enabled) { 1904 if (self->delay_logging_enabled) {
1905 memset(self->delay_histogram, 0, sizeof(self->delay_histogram)); 1905 memset(self->delay_histogram, 0, sizeof(self->delay_histogram));
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 void WebRtcAec_enable_reported_delay(AecCore* self, int enable) { 1909 void WebRtcAec_enable_delay_agnostic(AecCore* self, int enable) {
1910 self->reported_delay_enabled = enable; 1910 self->delay_agnostic_enabled = enable;
1911 } 1911 }
1912 1912
1913 int WebRtcAec_reported_delay_enabled(AecCore* self) { 1913 int WebRtcAec_delay_agnostic_enabled(AecCore* self) {
1914 return self->reported_delay_enabled; 1914 return self->delay_agnostic_enabled;
1915 } 1915 }
1916 1916
1917 void WebRtcAec_enable_extended_filter(AecCore* self, int enable) { 1917 void WebRtcAec_enable_extended_filter(AecCore* self, int enable) {
1918 self->extended_filter_enabled = enable; 1918 self->extended_filter_enabled = enable;
1919 self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions; 1919 self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions;
1920 // Update the delay estimator with filter length. See InitAEC() for details. 1920 // Update the delay estimator with filter length. See InitAEC() for details.
1921 WebRtc_set_allowed_offset(self->delay_estimator, self->num_partitions / 2); 1921 WebRtc_set_allowed_offset(self->delay_estimator, self->num_partitions / 2);
1922 } 1922 }
1923 1923
1924 int WebRtcAec_extended_filter_enabled(AecCore* self) { 1924 int WebRtcAec_extended_filter_enabled(AecCore* self) {
1925 return self->extended_filter_enabled; 1925 return self->extended_filter_enabled;
1926 } 1926 }
1927 1927
1928 int WebRtcAec_system_delay(AecCore* self) { return self->system_delay; } 1928 int WebRtcAec_system_delay(AecCore* self) { return self->system_delay; }
1929 1929
1930 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { 1930 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) {
1931 assert(delay >= 0); 1931 assert(delay >= 0);
1932 self->system_delay = delay; 1932 self->system_delay = delay;
1933 } 1933 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698