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

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/do_plc.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 19 matching lines...) Expand all
30 int16_t *PLCresidual, /* (o) concealed residual */ 30 int16_t *PLCresidual, /* (o) concealed residual */
31 int16_t *PLClpc, /* (o) concealed LP parameters */ 31 int16_t *PLClpc, /* (o) concealed LP parameters */
32 int16_t PLI, /* (i) packet loss indicator 32 int16_t PLI, /* (i) packet loss indicator
33 0 - no PL, 1 = PL */ 33 0 - no PL, 1 = PL */
34 int16_t *decresidual, /* (i) decoded residual */ 34 int16_t *decresidual, /* (i) decoded residual */
35 int16_t *lpc, /* (i) decoded LPC (only used for no PL) */ 35 int16_t *lpc, /* (i) decoded LPC (only used for no PL) */
36 int16_t inlag, /* (i) pitch lag */ 36 int16_t inlag, /* (i) pitch lag */
37 IlbcDecoder *iLBCdec_inst 37 IlbcDecoder *iLBCdec_inst
38 /* (i/o) decoder instance */ 38 /* (i/o) decoder instance */
39 ){ 39 ){
40 int16_t i, pick; 40 int16_t i;
41 int32_t cross, ener, cross_comp, ener_comp = 0; 41 int32_t cross, ener, cross_comp, ener_comp = 0;
42 int32_t measure, maxMeasure, energy; 42 int32_t measure, maxMeasure, energy;
43 int16_t max, crossSquareMax, crossSquare; 43 int16_t max, crossSquareMax, crossSquare;
44 int16_t j, lag, tmp1, tmp2, randlag; 44 int16_t j, lag, tmp1, tmp2, randlag;
45 int16_t shift1, shift2, shift3, shiftMax; 45 int16_t shift1, shift2, shift3, shiftMax;
46 int16_t scale3; 46 int16_t scale3;
47 int16_t corrLen; 47 int16_t corrLen;
48 int32_t tmpW32, tmp2W32; 48 int32_t tmpW32, tmp2W32;
49 int16_t use_gain; 49 int16_t use_gain;
50 int16_t tot_gain; 50 int16_t tot_gain;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 /* compute concealed residual */ 229 /* compute concealed residual */
230 energy = 0; 230 energy = 0;
231 231
232 for (i=0; i<iLBCdec_inst->blockl; i++) { 232 for (i=0; i<iLBCdec_inst->blockl; i++) {
233 233
234 /* noise component - 52 < randlagFIX < 117 */ 234 /* noise component - 52 < randlagFIX < 117 */
235 iLBCdec_inst->seed = (int16_t)(iLBCdec_inst->seed * 31821 + 13849); 235 iLBCdec_inst->seed = (int16_t)(iLBCdec_inst->seed * 31821 + 13849);
236 randlag = 53 + (int16_t)(iLBCdec_inst->seed & 63); 236 randlag = 53 + (int16_t)(iLBCdec_inst->seed & 63);
237 237 if (randlag > i) {
238 pick = i - randlag; 238 randvec[i] =
239 239 iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + i - randlag];
240 if (pick < 0) {
241 randvec[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl+pick];
242 } else { 240 } else {
243 randvec[i] = iLBCdec_inst->prevResidual[pick]; 241 randvec[i] = iLBCdec_inst->prevResidual[i - randlag];
244 } 242 }
245 243
246 /* pitch repeatition component */ 244 /* pitch repeatition component */
247 pick = i - use_lag; 245 if (use_lag > i) {
248 246 PLCresidual[i] =
249 if (pick < 0) { 247 iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + i - use_lag];
250 PLCresidual[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl+pick];
251 } else { 248 } else {
252 PLCresidual[i] = PLCresidual[pick]; 249 PLCresidual[i] = PLCresidual[i - use_lag];
253 } 250 }
254 251
255 /* Attinuate total gain for each 10 ms */ 252 /* Attinuate total gain for each 10 ms */
256 if (i<80) { 253 if (i<80) {
257 tot_gain=use_gain; 254 tot_gain=use_gain;
258 } else if (i<160) { 255 } else if (i<160) {
259 tot_gain = (int16_t)((31130 * use_gain) >> 15); /* 0.95*use_gain */ 256 tot_gain = (int16_t)((31130 * use_gain) >> 15); /* 0.95*use_gain */
260 } else { 257 } else {
261 tot_gain = (int16_t)((29491 * use_gain) >> 15); /* 0.9*use_gain */ 258 tot_gain = (int16_t)((29491 * use_gain) >> 15); /* 0.9*use_gain */
262 } 259 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 iLBCdec_inst->consPLICount = 0; 294 iLBCdec_inst->consPLICount = 0;
298 } 295 }
299 296
300 /* update state */ 297 /* update state */
301 iLBCdec_inst->prevPLI = PLI; 298 iLBCdec_inst->prevPLI = PLI;
302 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevLpc, PLClpc, (LPC_FILTERORDER+1)); 299 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevLpc, PLClpc, (LPC_FILTERORDER+1));
303 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->b lockl); 300 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->b lockl);
304 301
305 return; 302 return;
306 } 303 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c ('k') | webrtc/modules/audio_coding/codecs/ilbc/encode.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698