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

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

Issue 1988723002: 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 | webrtc/modules/audio_coding/codecs/ilbc/hp_output.c » ('j') | 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 lspPtr+=2; 58 lspPtr+=2;
59 59
60 for(i=2; i<=5; i++) 60 for(i=2; i<=5; i++)
61 { 61 {
62 (*fPtr) = fPtr[-2]; 62 (*fPtr) = fPtr[-2];
63 63
64 for(j=i; j>1; j--) 64 for(j=i; j>1; j--)
65 { 65 {
66 /* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */ 66 /* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */
67 high = (int16_t)(fPtr[-1] >> 16); 67 high = (int16_t)(fPtr[-1] >> 16);
68 low = (int16_t)((fPtr[-1] - ((int32_t)high << 16)) >> 1); 68 low = (int16_t)((fPtr[-1] & 0xffff) >> 1);
tlegrand 2016/05/17 12:24:32 This is so much nicer!
kwiberg-webrtc 2016/05/17 12:32:29 I've found the "x_low = x - x_high << 16" pattern
69 69
70 tmpW32 = ((high * *lspPtr) << 2) + (((low * *lspPtr) >> 15) << 2); 70 tmpW32 = 4 * high * *lspPtr + 4 * ((low * *lspPtr) >> 15);
71 71
72 (*fPtr) += fPtr[-2]; 72 (*fPtr) += fPtr[-2];
73 (*fPtr) -= tmpW32; 73 (*fPtr) -= tmpW32;
74 fPtr--; 74 fPtr--;
75 } 75 }
76 *fPtr -= *lspPtr << 10; 76 *fPtr -= *lspPtr * (1 << 10);
77 77
78 fPtr+=i; 78 fPtr+=i;
79 lspPtr+=2; 79 lspPtr+=2;
80 } 80 }
81 return; 81 return;
82 } 82 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/ilbc/hp_output.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698