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 |
11 #include "webrtc/modules/audio_processing/utility/delay_estimator.h" | 11 #include "webrtc/modules/audio_processing/utility/delay_estimator.h" |
12 | 12 |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "webrtc/base/checks.h" | 17 #include "webrtc/rtc_base/checks.h" |
18 | 18 |
19 // Number of right shifts for scaling is linearly depending on number of bits in | 19 // Number of right shifts for scaling is linearly depending on number of bits in |
20 // the far-end binary spectrum. | 20 // the far-end binary spectrum. |
21 static const int kShiftsAtZero = 13; // Right shifts at zero binary spectrum. | 21 static const int kShiftsAtZero = 13; // Right shifts at zero binary spectrum. |
22 static const int kShiftsLinearSlope = 3; | 22 static const int kShiftsLinearSlope = 3; |
23 | 23 |
24 static const int32_t kProbabilityOffset = 1024; // 2 in Q9. | 24 static const int32_t kProbabilityOffset = 1024; // 2 in Q9. |
25 static const int32_t kProbabilityLowerLimit = 8704; // 17 in Q9. | 25 static const int32_t kProbabilityLowerLimit = 8704; // 17 in Q9. |
26 static const int32_t kProbabilityMinSpread = 2816; // 5.5 in Q9. | 26 static const int32_t kProbabilityMinSpread = 2816; // 5.5 in Q9. |
27 | 27 |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 int32_t diff = new_value - *mean_value; | 694 int32_t diff = new_value - *mean_value; |
695 | 695 |
696 // mean_new = mean_value + ((new_value - mean_value) >> factor); | 696 // mean_new = mean_value + ((new_value - mean_value) >> factor); |
697 if (diff < 0) { | 697 if (diff < 0) { |
698 diff = -((-diff) >> factor); | 698 diff = -((-diff) >> factor); |
699 } else { | 699 } else { |
700 diff = (diff >> factor); | 700 diff = (diff >> factor); |
701 } | 701 } |
702 *mean_value += diff; | 702 *mean_value += diff; |
703 } | 703 } |
OLD | NEW |