iSAC fix entropy coder: Recently added DCHECK could in fact trigger
A DCHECK added in a recent bugfix, which asserted that a signed 64->32 bit cast did not overflow, has been found to not always pass. We fix this by saturating. BUG=chromium:693868 Review-Url: https://codereview.webrtc.org/2746903002 Cr-Commit-Position: refs/heads/master@{#17209}
This commit is contained in:
parent
53dc23c28f
commit
a1896a649c
@ -63,6 +63,11 @@ static __inline int WebRtcSpl_CountLeadingZeros64(uint64_t n) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline int32_t WebRtcSpl_SatW64ToW32(int64_t x) {
|
||||
int32_t x32 = (int32_t)x;
|
||||
return x32 == x ? x32 : x < 0 ? INT32_MIN : INT32_MAX;
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_ARCH_ARM_V7
|
||||
#include "webrtc/common_audio/signal_processing/include/spl_inl_armv7.h"
|
||||
#else
|
||||
|
||||
@ -234,8 +234,7 @@ static void CalcInvArSpec(const int16_t *ARCoefQ12,
|
||||
for (n = 0; n < FRAMESAMPLES/8; n++) {
|
||||
const int64_t p =
|
||||
(WebRtcIsacfix_kCos[k][n] * (int64_t)CorrQ11[k + 1] + 2) >> 2;
|
||||
RTC_DCHECK_EQ(p, (int32_t)p); // p fits in 32 bits
|
||||
CurveQ16[n] += (int32_t)p;
|
||||
CurveQ16[n] += WebRtcSpl_SatW64ToW32(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user