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

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

Issue 1227163003: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments Created 5 years, 4 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 * Contains the core loop function for the lattice filter AR routine 12 * Contains the core loop function for the lattice filter AR routine
13 * for iSAC codec. 13 * for iSAC codec.
14 * 14 *
15 */ 15 */
16 16
17 #include "settings.h" 17 #include "settings.h"
18 #include "signal_processing_library.h" 18 #include "signal_processing_library.h"
19 #include "webrtc/typedefs.h" 19 #include "webrtc/typedefs.h"
20 20
21 /* Filter ar_g_Q0[] and ar_f_Q0[] through an AR filter with coefficients 21 /* Filter ar_g_Q0[] and ar_f_Q0[] through an AR filter with coefficients
22 * cth_Q15[] and sth_Q15[]. 22 * cth_Q15[] and sth_Q15[].
23 */ 23 */
24 void WebRtcIsacfix_FilterArLoop(int16_t* ar_g_Q0, // Input samples 24 void WebRtcIsacfix_FilterArLoop(int16_t* ar_g_Q0, // Input samples
25 int16_t* ar_f_Q0, // Input samples 25 int16_t* ar_f_Q0, // Input samples
26 int16_t* cth_Q15, // Filter coefficients 26 int16_t* cth_Q15, // Filter coefficients
27 int16_t* sth_Q15, // Filter coefficients 27 int16_t* sth_Q15, // Filter coefficients
28 int16_t order_coef) { // order of the filter 28 size_t order_coef) { // order of the filter
29 int n = 0; 29 int n = 0;
30 30
31 for (n = 0; n < HALF_SUBFRAMELEN - 1; n++) { 31 for (n = 0; n < HALF_SUBFRAMELEN - 1; n++) {
32 int k = 0; 32 size_t k = 0;
33 int16_t tmpAR = 0; 33 int16_t tmpAR = 0;
34 int32_t tmp32 = 0; 34 int32_t tmp32 = 0;
35 int32_t tmp32_2 = 0; 35 int32_t tmp32_2 = 0;
36 36
37 tmpAR = ar_f_Q0[n + 1]; 37 tmpAR = ar_f_Q0[n + 1];
38 for (k = order_coef; k > 0; k--) { 38 for (k = order_coef; k > 0; k--) {
39 tmp32 = (cth_Q15[k - 1] * tmpAR - sth_Q15[k - 1] * ar_g_Q0[k - 1] + 39 tmp32 = (cth_Q15[k - 1] * tmpAR - sth_Q15[k - 1] * ar_g_Q0[k - 1] +
40 16384) >> 15; 40 16384) >> 15;
41 tmp32_2 = (sth_Q15[k - 1] * tmpAR + cth_Q15[k - 1] * ar_g_Q0[k - 1] + 41 tmp32_2 = (sth_Q15[k - 1] * tmpAR + cth_Q15[k - 1] * ar_g_Q0[k - 1] +
42 16384) >> 15; 42 16384) >> 15;
43 tmpAR = (int16_t)WebRtcSpl_SatW32ToW16(tmp32); 43 tmpAR = (int16_t)WebRtcSpl_SatW32ToW16(tmp32);
44 ar_g_Q0[k] = (int16_t)WebRtcSpl_SatW32ToW16(tmp32_2); 44 ar_g_Q0[k] = (int16_t)WebRtcSpl_SatW32ToW16(tmp32_2);
45 } 45 }
46 ar_f_Q0[n + 1] = tmpAR; 46 ar_f_Q0[n + 1] = tmpAR;
47 ar_g_Q0[0] = tmpAR; 47 ar_g_Q0[0] = tmpAR;
48 } 48 }
49 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698