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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/decode_plc.c

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 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
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 *B = WEBRTC_SPL_WORD16_MAX; 170 *B = WEBRTC_SPL_WORD16_MAX;
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 175
176 176
177 177
178 static void LinearResampler(int16_t* in, 178 static void LinearResampler(int16_t* in,
179 int16_t* out, 179 int16_t* out,
180 int16_t lenIn, 180 size_t lenIn,
181 int16_t lenOut) 181 size_t lenOut)
182 { 182 {
183 int32_t n = (lenIn - 1) * RESAMP_RES; 183 size_t n = (lenIn - 1) * RESAMP_RES;
184 int16_t resOut, i, j, relativePos, diff; /* */ 184 int16_t resOut, relativePos, diff; /* */
185 size_t i, j;
185 uint16_t udiff; 186 uint16_t udiff;
186 187
187 if( lenIn == lenOut ) 188 if( lenIn == lenOut )
188 { 189 {
189 WEBRTC_SPL_MEMCPY_W16( out, in, lenIn ); 190 WEBRTC_SPL_MEMCPY_W16( out, in, lenIn );
190 return; 191 return;
191 } 192 }
192 193
193 resOut = WebRtcSpl_DivW32W16ResW16( n, (int16_t)(lenOut-1) ); 194 resOut = WebRtcSpl_DivW32W16ResW16( (int32_t)n, (int16_t)(lenOut-1) );
194 195
195 out[0] = in[0]; 196 out[0] = in[0];
196 for( i = 1, j = 0, relativePos = 0; i < lenOut; i++ ) 197 for( i = 1, j = 0, relativePos = 0; i < lenOut; i++ )
197 { 198 {
198 199
199 relativePos += resOut; 200 relativePos += resOut;
200 while( relativePos > RESAMP_RES ) 201 while( relativePos > RESAMP_RES )
201 { 202 {
202 j++; 203 j++;
203 relativePos -= RESAMP_RES; 204 relativePos -= RESAMP_RES;
(...skipping 24 matching lines...) Expand all
228 } 229 }
229 } 230 }
230 } 231 }
231 232
232 233
233 234
234 235
235 236
236 void WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16, 237 void WebRtcIsacfix_DecodePlcImpl(int16_t *signal_out16,
237 IsacFixDecoderInstance *ISACdec_obj, 238 IsacFixDecoderInstance *ISACdec_obj,
238 int16_t *current_framesamples ) 239 size_t *current_framesamples )
239 { 240 {
240 int subframecnt; 241 int subframecnt;
241 242
242 int16_t* Vector_Word16_1; 243 int16_t* Vector_Word16_1;
243 int16_t Vector_Word16_Extended_1[FRAMESAMPLES_HALF + NOISE_FILTER_LEN]; 244 int16_t Vector_Word16_Extended_1[FRAMESAMPLES_HALF + NOISE_FILTER_LEN];
244 int16_t* Vector_Word16_2; 245 int16_t* Vector_Word16_2;
245 int16_t Vector_Word16_Extended_2[FRAMESAMPLES_HALF + NOISE_FILTER_LEN]; 246 int16_t Vector_Word16_Extended_2[FRAMESAMPLES_HALF + NOISE_FILTER_LEN];
246 247
247 int32_t Vector_Word32_1[FRAMESAMPLES_HALF]; 248 int32_t Vector_Word32_1[FRAMESAMPLES_HALF];
248 int32_t Vector_Word32_2[FRAMESAMPLES_HALF]; 249 int32_t Vector_Word32_2[FRAMESAMPLES_HALF];
249 250
250 int16_t lofilt_coefQ15[ORDERLO*SUBFRAMES]; //refl. coeffs 251 int16_t lofilt_coefQ15[ORDERLO*SUBFRAMES]; //refl. coeffs
251 int16_t hifilt_coefQ15[ORDERHI*SUBFRAMES]; //refl. coeffs 252 int16_t hifilt_coefQ15[ORDERHI*SUBFRAMES]; //refl. coeffs
252 253
253 int16_t pitchLags_Q7[PITCH_SUBFRAMES]; 254 int16_t pitchLags_Q7[PITCH_SUBFRAMES];
254 int16_t pitchGains_Q12[PITCH_SUBFRAMES]; 255 int16_t pitchGains_Q12[PITCH_SUBFRAMES];
255 256
256 int16_t tmp_1, tmp_2; 257 int16_t tmp_1, tmp_2;
257 int32_t tmp32a, tmp32b; 258 int32_t tmp32a, tmp32b;
258 int16_t gainQ13; 259 int16_t gainQ13;
259 260
260 int16_t myDecayRate; 261 int16_t myDecayRate;
261 262
262 /* ---------- PLC variables ------------ */ 263 /* ---------- PLC variables ------------ */
263 int16_t lag0, i, k, noiseIndex; 264 size_t lag0, i, k;
265 int16_t noiseIndex;
264 int16_t stretchPitchLP[PITCH_MAX_LAG + 10], stretchPitchLP1[PITCH_MAX_LAG + 10 ]; 266 int16_t stretchPitchLP[PITCH_MAX_LAG + 10], stretchPitchLP1[PITCH_MAX_LAG + 10 ];
265 267
266 int32_t gain_lo_hiQ17[2*SUBFRAMES]; 268 int32_t gain_lo_hiQ17[2*SUBFRAMES];
267 269
268 int16_t nLP, pLP, wNoisyLP, wPriodicLP, tmp16, minIdx; 270 int16_t nLP, pLP, wNoisyLP, wPriodicLP, tmp16;
271 size_t minIdx;
269 int32_t nHP, pHP, wNoisyHP, wPriodicHP, corr, minCorr, maxCoeff; 272 int32_t nHP, pHP, wNoisyHP, wPriodicHP, corr, minCorr, maxCoeff;
270 int16_t noise1, rshift; 273 int16_t noise1, rshift;
271 274
272 275
273 int16_t ltpGain, pitchGain, myVoiceIndicator, myAbs, maxAbs; 276 int16_t ltpGain, pitchGain, myVoiceIndicator, myAbs, maxAbs;
274 int32_t varIn, varOut, logVarIn, logVarOut, Q, logMaxAbs; 277 int32_t varIn, varOut, logVarIn, logVarOut, Q, logMaxAbs;
275 int rightShiftIn, rightShiftOut; 278 int rightShiftIn, rightShiftOut;
276 279
277 280
278 /* ------------------------------------- */ 281 /* ------------------------------------- */
(...skipping 14 matching lines...) Expand all
293 296
294 /* Upper Band */ 297 /* Upper Band */
295 WEBRTC_SPL_MEMCPY_W16(&hifilt_coefQ15[ subframecnt * ORDERHI ], 298 WEBRTC_SPL_MEMCPY_W16(&hifilt_coefQ15[ subframecnt * ORDERHI ],
296 (ISACdec_obj->plcstr_obj).hifilt_coefQ15, ORDERHI); 299 (ISACdec_obj->plcstr_obj).hifilt_coefQ15, ORDERHI);
297 gain_lo_hiQ17[2*subframecnt + 1] = (ISACdec_obj->plcstr_obj).gain_lo_hiQ17[1 ]; 300 gain_lo_hiQ17[2*subframecnt + 1] = (ISACdec_obj->plcstr_obj).gain_lo_hiQ17[1 ];
298 } 301 }
299 302
300 303
301 304
302 305
303 lag0 = ((ISACdec_obj->plcstr_obj.lastPitchLag_Q7 + 64) >> 7) + 1; 306 lag0 = (size_t)(((ISACdec_obj->plcstr_obj.lastPitchLag_Q7 + 64) >> 7) + 1);
304 307
305 308
306 if( (ISACdec_obj->plcstr_obj).used != PLC_WAS_USED ) 309 if( (ISACdec_obj->plcstr_obj).used != PLC_WAS_USED )
307 { 310 {
308 (ISACdec_obj->plcstr_obj).pitchCycles = 0; 311 (ISACdec_obj->plcstr_obj).pitchCycles = 0;
309 312
310 (ISACdec_obj->plcstr_obj).lastPitchLP = 313 (ISACdec_obj->plcstr_obj).lastPitchLP =
311 &((ISACdec_obj->plcstr_obj).prevPitchInvIn[FRAMESAMPLES_HALF - lag0]); 314 &((ISACdec_obj->plcstr_obj).prevPitchInvIn[FRAMESAMPLES_HALF - lag0]);
312 minCorr = WEBRTC_SPL_WORD32_MAX; 315 minCorr = WEBRTC_SPL_WORD32_MAX;
313 316
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 Vector_Word16_2[k] = tmp_2; 796 Vector_Word16_2[k] = tmp_2;
794 } 797 }
795 798
796 799
797 WebRtcIsacfix_FilterAndCombine1(Vector_Word16_1, 800 WebRtcIsacfix_FilterAndCombine1(Vector_Word16_1,
798 Vector_Word16_2, signal_out16, &ISACdec_obj->p ostfiltbankstr_obj); 801 Vector_Word16_2, signal_out16, &ISACdec_obj->p ostfiltbankstr_obj);
799 802
800 (ISACdec_obj->plcstr_obj).used = PLC_WAS_USED; 803 (ISACdec_obj->plcstr_obj).used = PLC_WAS_USED;
801 *current_framesamples = 480; 804 *current_framesamples = 480;
802 } 805 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698