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

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

Issue 2293893002: Add functions to interact with ASan and MSan, and some sample uses (Closed)
Patch Set: Created 4 years, 3 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
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
11 /****************************************************************** 11 /******************************************************************
12 12
13 iLBC Speech Coder ANSI-C Source Code 13 iLBC Speech Coder ANSI-C Source Code
14 14
15 WebRtcIlbcfix_CreateAugmentedVec.c 15 WebRtcIlbcfix_CreateAugmentedVec.c
16 16
17 ******************************************************************/ 17 ******************************************************************/
18 18
19 #include "defines.h" 19 #include "defines.h"
20 #include "constants.h" 20 #include "constants.h"
21 #include "webrtc/base/sanitizer.h"
21 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
22 23
23 /*----------------------------------------------------------------* 24 /*----------------------------------------------------------------*
24 * Recreate a specific codebook vector from the augmented part. 25 * Recreate a specific codebook vector from the augmented part.
25 * 26 *
26 *----------------------------------------------------------------*/ 27 *----------------------------------------------------------------*/
27 28
28 void WebRtcIlbcfix_CreateAugmentedVec( 29 void WebRtcIlbcfix_CreateAugmentedVec(
29 size_t index, /* (i) Index for the augmented vector to be 30 size_t index, /* (i) Index for the augmented vector to be
30 created */ 31 created */
31 const int16_t* buffer, /* (i) Pointer to the end of the codebook memory 32 const int16_t* buffer, /* (i) Pointer to the end of the codebook memory
32 that is used for creation of the augmented 33 that is used for creation of the augmented
33 codebook */ 34 codebook */
34 int16_t* cbVec) { /* (o) The constructed codebook vector */ 35 int16_t* cbVec) { /* (o) The constructed codebook vector */
35 size_t ilow; 36 size_t ilow;
36 const int16_t *ppo, *ppi; 37 const int16_t *ppo, *ppi;
37 int16_t cbVecTmp[4]; 38 int16_t cbVecTmp[4];
38 /* Interpolation starts 4 elements before cbVec+index, but must not start 39 /* Interpolation starts 4 elements before cbVec+index, but must not start
39 outside |cbVec|; clamping interp_len to stay within |cbVec|. 40 outside |cbVec|; clamping interp_len to stay within |cbVec|.
40 */ 41 */
41 size_t interp_len = WEBRTC_SPL_MIN(index, 4); 42 size_t interp_len = WEBRTC_SPL_MIN(index, 4);
42 43
44 rtc_MsanCheckInitialized(buffer - index - interp_len, sizeof(buffer[0]),
45 index + interp_len);
kwiberg-webrtc 2016/08/30 19:55:28 This is another example of a rtc_MsanCheckInitiali
46
43 ilow = index - interp_len; 47 ilow = index - interp_len;
44 48
45 /* copy the first noninterpolated part */ 49 /* copy the first noninterpolated part */
46 ppo = buffer-index; 50 ppo = buffer-index;
47 WEBRTC_SPL_MEMCPY_W16(cbVec, ppo, index); 51 WEBRTC_SPL_MEMCPY_W16(cbVec, ppo, index);
48 52
49 /* interpolation */ 53 /* interpolation */
50 ppo = buffer - interp_len; 54 ppo = buffer - interp_len;
51 ppi = buffer - index - interp_len; 55 ppi = buffer - index - interp_len;
52 56
(...skipping 15 matching lines...) Expand all
68 tempbuff2+SUBL+5. Since ppo=buffer-index, we cannot read any more than 72 tempbuff2+SUBL+5. Since ppo=buffer-index, we cannot read any more than
69 |index| elements from |ppo|. 73 |index| elements from |ppo|.
70 74
71 |cbVec| is declared to be SUBL elements long in WebRtcIlbcfix_CbConstruct. 75 |cbVec| is declared to be SUBL elements long in WebRtcIlbcfix_CbConstruct.
72 Therefore, we can only write SUBL-index elements to cbVec+index. 76 Therefore, we can only write SUBL-index elements to cbVec+index.
73 77
74 These two conditions limit the number of elements to copy. 78 These two conditions limit the number of elements to copy.
75 */ 79 */
76 WEBRTC_SPL_MEMCPY_W16(cbVec+index, ppo, WEBRTC_SPL_MIN(SUBL-index, index)); 80 WEBRTC_SPL_MEMCPY_W16(cbVec+index, ppo, WEBRTC_SPL_MIN(SUBL-index, index));
77 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698