Truncated delay quality to avoid negative return values
This forces the output of last_delay_quality to the interval [0, 1] in Q14. BUG=none TESTED=audioproc_unittest, trybot Review URL: https://webrtc-codereview.appspot.com/1211004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3675 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
bda7f305c5
commit
04ecd49ec5
@ -302,6 +302,7 @@ int WebRtc_binary_last_delay(BinaryDelayEstimator* self) {
|
||||
}
|
||||
|
||||
int WebRtc_binary_last_delay_quality(BinaryDelayEstimator* self) {
|
||||
int delay_quality = 0;
|
||||
assert(self != NULL);
|
||||
// |last_delay_probability| is the opposite of quality and states how deep the
|
||||
// minimum of the cost function is. The value states how many non-matching
|
||||
@ -309,8 +310,12 @@ int WebRtc_binary_last_delay_quality(BinaryDelayEstimator* self) {
|
||||
// estimate. The range is thus from 0 to 32, since we use 32 bits in the
|
||||
// binary spectra.
|
||||
|
||||
// Return the quality = 1 - |last_delay_probability| / 32 (in Q14).
|
||||
return (32 << 9) - self->last_delay_probability;
|
||||
// Return the |delay_quality| = 1 - |last_delay_probability| / 32 (in Q14).
|
||||
delay_quality = (32 << 9) - self->last_delay_probability;
|
||||
if (delay_quality < 0) {
|
||||
delay_quality = 0;
|
||||
}
|
||||
return delay_quality;
|
||||
}
|
||||
|
||||
void WebRtc_MeanEstimatorFix(int32_t new_value,
|
||||
|
Loading…
x
Reference in New Issue
Block a user