Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/do_plc.c

Issue 1988113003: Fix UBSan errors (left shift of negative value) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 shift2 = WebRtcSpl_GetSizeInBits(ener)-15; 113 shift2 = WebRtcSpl_GetSizeInBits(ener)-15;
114 measure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, -shift2) * crossSquare; 114 measure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, -shift2) * crossSquare;
115 115
116 shift3 = WebRtcSpl_GetSizeInBits(ener_comp)-15; 116 shift3 = WebRtcSpl_GetSizeInBits(ener_comp)-15;
117 maxMeasure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener_comp, -shift3) * 117 maxMeasure = (int16_t)WEBRTC_SPL_SHIFT_W32(ener_comp, -shift3) *
118 crossSquareMax; 118 crossSquareMax;
119 119
120 /* Calculate shift value, so that the two measures can 120 /* Calculate shift value, so that the two measures can
121 be put in the same Q domain */ 121 be put in the same Q domain */
122 if(((shiftMax<<1)+shift3) > ((shift1<<1)+shift2)) { 122 if(2 * shiftMax + shift3 > 2 * shift1 + shift2) {
123 tmp1 = WEBRTC_SPL_MIN(31, (shiftMax<<1)+shift3-(shift1<<1)-shift2); 123 tmp1 =
124 WEBRTC_SPL_MIN(31, 2 * shiftMax + shift3 - 2 * shift1 - shift2);
124 tmp2 = 0; 125 tmp2 = 0;
125 } else { 126 } else {
126 tmp1 = 0; 127 tmp1 = 0;
127 tmp2 = WEBRTC_SPL_MIN(31, (shift1<<1)+shift2-(shiftMax<<1)-shift3); 128 tmp2 =
129 WEBRTC_SPL_MIN(31, 2 * shift1 + shift2 - 2 * shiftMax - shift3);
128 } 130 }
129 131
130 if ((measure>>tmp1) > (maxMeasure>>tmp2)) { 132 if ((measure>>tmp1) > (maxMeasure>>tmp2)) {
131 /* New lag is better => record lag, measure and domain */ 133 /* New lag is better => record lag, measure and domain */
132 lag = j; 134 lag = j;
133 crossSquareMax = crossSquare; 135 crossSquareMax = crossSquare;
134 cross = cross_comp; 136 cross = cross_comp;
135 shiftMax = shift1; 137 shiftMax = shift1;
136 ener = ener_comp; 138 ener = ener_comp;
137 } 139 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 iLBCdec_inst->consPLICount = 0; 298 iLBCdec_inst->consPLICount = 0;
297 } 299 }
298 300
299 /* update state */ 301 /* update state */
300 iLBCdec_inst->prevPLI = PLI; 302 iLBCdec_inst->prevPLI = PLI;
301 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevLpc, PLClpc, (LPC_FILTERORDER+1)); 303 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevLpc, PLClpc, (LPC_FILTERORDER+1));
302 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->b lockl); 304 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->b lockl);
303 305
304 return; 306 return;
305 } 307 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698