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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 for (i = 0; i < kHistorySizeBlocks; i++) { | 813 for (i = 0; i < kHistorySizeBlocks; i++) { |
| 814 l1_norm += abs(i - median) * self->delay_histogram[i]; | 814 l1_norm += abs(i - median) * self->delay_histogram[i]; |
| 815 } | 815 } |
| 816 self->delay_std = (int)((l1_norm + self->num_delay_values / 2) / | 816 self->delay_std = (int)((l1_norm + self->num_delay_values / 2) / |
| 817 self->num_delay_values) * kMsPerBlock; | 817 self->num_delay_values) * kMsPerBlock; |
| 818 | 818 |
| 819 // Determine fraction of delays that are out of bounds, that is, either | 819 // Determine fraction of delays that are out of bounds, that is, either |
| 820 // negative (anti-causal system) or larger than the AEC filter length. | 820 // negative (anti-causal system) or larger than the AEC filter length. |
| 821 { | 821 { |
| 822 int num_delays_out_of_bounds = self->num_delay_values; | 822 int num_delays_out_of_bounds = self->num_delay_values; |
| 823 for (i = lookahead; i < lookahead + self->num_partitions; ++i) { | 823 const int histogram_length = sizeof(self->delay_histogram) / |
| 824 num_delays_out_of_bounds -= self->delay_histogram[i]; | 824 sizeof(self->delay_histogram[0]); |
| 825 for (i = lookahead; | |
| 826 ((i < lookahead + self->num_partitions) && (i < histogram_length)); | |
|
hlundin-webrtc
2015/09/14 07:34:48
You don't need the outer parentheses, and I don't
peah-webrtc
2015/09/14 07:56:07
Acknowledged.
| |
| 827 ++i) { | |
| 828 num_delays_out_of_bounds -= self->delay_histogram[i]; | |
| 825 } | 829 } |
| 826 self->fraction_poor_delays = (float)num_delays_out_of_bounds / | 830 self->fraction_poor_delays = (float)num_delays_out_of_bounds / |
| 827 self->num_delay_values; | 831 self->num_delay_values; |
| 828 } | 832 } |
| 829 | 833 |
| 830 // Reset histogram. | 834 // Reset histogram. |
| 831 memset(self->delay_histogram, 0, sizeof(self->delay_histogram)); | 835 memset(self->delay_histogram, 0, sizeof(self->delay_histogram)); |
| 832 self->num_delay_values = 0; | 836 self->num_delay_values = 0; |
| 833 | 837 |
| 834 return; | 838 return; |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1917 int WebRtcAec_extended_filter_enabled(AecCore* self) { | 1921 int WebRtcAec_extended_filter_enabled(AecCore* self) { |
| 1918 return self->extended_filter_enabled; | 1922 return self->extended_filter_enabled; |
| 1919 } | 1923 } |
| 1920 | 1924 |
| 1921 int WebRtcAec_system_delay(AecCore* self) { return self->system_delay; } | 1925 int WebRtcAec_system_delay(AecCore* self) { return self->system_delay; } |
| 1922 | 1926 |
| 1923 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { | 1927 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { |
| 1924 assert(delay >= 0); | 1928 assert(delay >= 0); |
| 1925 self->system_delay = delay; | 1929 self->system_delay = delay; |
| 1926 } | 1930 } |
| OLD | NEW |