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

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

Issue 1174813003: Prepare to convert various types to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments + resync Created 5 years, 6 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
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 cDot, range, stage, inverseEnergy, 220 cDot, range, stage, inverseEnergy,
221 inverseEnergyShifts, Crit, 221 inverseEnergyShifts, Crit,
222 &indexNew, &CritNew, &CritNewSh); 222 &indexNew, &CritNew, &CritNewSh);
223 223
224 /* Update the global best index and the corresponding gain */ 224 /* Update the global best index and the corresponding gain */
225 WebRtcIlbcfix_CbUpdateBestIndex( 225 WebRtcIlbcfix_CbUpdateBestIndex(
226 CritNew, CritNewSh, (int16_t)(indexNew+indexOffset), cDot[indexNew+index Offset], 226 CritNew, CritNewSh, (int16_t)(indexNew+indexOffset), cDot[indexNew+index Offset],
227 inverseEnergy[indexNew+indexOffset], inverseEnergyShifts[indexNew+indexO ffset], 227 inverseEnergy[indexNew+indexOffset], inverseEnergyShifts[indexNew+indexO ffset],
228 &CritMax, &shTotMax, &bestIndex, &bestGain); 228 &CritMax, &shTotMax, &bestIndex, &bestGain);
229 229
230 sInd=bestIndex-(int16_t)(CB_RESRANGE>>1); 230 sInd = ((CB_RESRANGE >> 1) > bestIndex) ?
231 0 : (bestIndex - (CB_RESRANGE >> 1));
231 eInd=sInd+CB_RESRANGE; 232 eInd=sInd+CB_RESRANGE;
232 if (sInd<0) {
233 eInd-=sInd;
234 sInd=0;
235 }
236 if (eInd>=range) { 233 if (eInd>=range) {
237 eInd=range-1; 234 eInd=range-1;
238 sInd=eInd-CB_RESRANGE; 235 sInd=eInd-CB_RESRANGE;
239 } 236 }
240 237
241 range = WebRtcIlbcfix_kSearchRange[block][stage]; 238 range = WebRtcIlbcfix_kSearchRange[block][stage];
242 239
243 if (lTarget==SUBL) { 240 if (lTarget==SUBL) {
244 i=sInd; 241 i=sInd;
245 if (sInd<20) { 242 if (sInd<20) {
246 WebRtcIlbcfix_AugmentedCbCorr(target, cbvectors+lMem, 243 WebRtcIlbcfix_AugmentedCbCorr(target, cbvectors+lMem,
247 interpSamplesFilt, cDot, 244 interpSamplesFilt, cDot,
248 (int16_t)(sInd+20), (int16_t)(WEBRTC_SPL_M IN(39, (eInd+20))), scale); 245 (int16_t)(sInd+20), (int16_t)(WEBRTC_SPL_M IN(39, (eInd+20))), scale);
249 i=20; 246 i=20;
247 cDotPtr = &cDot[20 - sInd];
248 } else {
249 cDotPtr = cDot;
250 } 250 }
251 251
252 cDotPtr=&cDot[WEBRTC_SPL_MAX(0,(20-sInd))];
253 cb_vecPtr = cbvectors+lMem-20-i; 252 cb_vecPtr = cbvectors+lMem-20-i;
254 253
255 /* Calculate the cross correlations (main part of the filtered CB) */ 254 /* Calculate the cross correlations (main part of the filtered CB) */
256 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)( eInd-i+1), scale, -1); 255 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)( eInd-i+1), scale, -1);
257 256
258 } else { 257 } else {
259 cDotPtr = cDot; 258 cDotPtr = cDot;
260 cb_vecPtr = cbvectors+lMem-lTarget-sInd; 259 cb_vecPtr = cbvectors+lMem-lTarget-sInd;
261 260
262 /* Calculate the cross correlations (main part of the filtered CB) */ 261 /* Calculate the cross correlations (main part of the filtered CB) */
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 j=i; 388 j=i;
390 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; 389 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i];
391 } 390 }
392 } 391 }
393 gainPtr++; 392 gainPtr++;
394 } 393 }
395 gain_index[0]=j; 394 gain_index[0]=j;
396 395
397 return; 396 return;
398 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698