Fix overflow in digital AGC1
Bug: chromium:855900 Change-Id: I966d5d977cee2862f7c0dd07e35561e475269d20 Reviewed-on: https://webrtc-review.googlesource.com/85368 Reviewed-by: Alex Loiko <aleloi@google.com> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23737}
This commit is contained in:

committed by
Commit Bot

parent
f4db542a9b
commit
762289ed13
@ -412,8 +412,10 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc* stt,
|
||||
}
|
||||
tmp32 = ((uint32_t)cur_level << zeros) & 0x7FFFFFFF;
|
||||
frac = (int16_t)(tmp32 >> 19); // Q12.
|
||||
tmp32 = (stt->gainTable[zeros - 1] - stt->gainTable[zeros]) * frac;
|
||||
gains[k + 1] = stt->gainTable[zeros] + (tmp32 >> 12);
|
||||
// Interpolate between gainTable[zeros] and gainTable[zeros-1].
|
||||
tmp32 = ((stt->gainTable[zeros - 1] - stt->gainTable[zeros]) *
|
||||
(int64_t)frac) >> 12;
|
||||
gains[k + 1] = stt->gainTable[zeros] + tmp32;
|
||||
#ifdef WEBRTC_AGC_DEBUG_DUMP
|
||||
if (k == 0) {
|
||||
fprintf(stt->logFile, "%d\t%d\t%d\t%d\t%d\n", env[0], cur_level,
|
||||
|
Reference in New Issue
Block a user