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

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

Issue 2274083002: Replace calls to assert() with RTC_DCHECK_*() in .c code (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 * filterbanks.c 12 * filterbanks.c
13 * 13 *
14 * This file contains function 14 * This file contains function
15 * WebRtcIsacfix_SplitAndFilter, and WebRtcIsacfix_FilterAndCombine 15 * WebRtcIsacfix_SplitAndFilter, and WebRtcIsacfix_FilterAndCombine
16 * which implement filterbanks that produce decimated lowpass and 16 * which implement filterbanks that produce decimated lowpass and
17 * highpass versions of a signal, and performs reconstruction. 17 * highpass versions of a signal, and performs reconstruction.
18 * 18 *
19 */ 19 */
20 20
21 #include "filterbank_internal.h" 21 #include "filterbank_internal.h"
22 22
23 #include <assert.h>
24
25 #include "codec.h" 23 #include "codec.h"
26 #include "filterbank_tables.h" 24 #include "filterbank_tables.h"
27 #include "settings.h" 25 #include "settings.h"
26 #include "webrtc/base/checks.h"
28 27
29 // Declare a function pointer. 28 // Declare a function pointer.
30 AllpassFilter2FixDec16 WebRtcIsacfix_AllpassFilter2FixDec16; 29 AllpassFilter2FixDec16 WebRtcIsacfix_AllpassFilter2FixDec16;
31 30
32 void WebRtcIsacfix_AllpassFilter2FixDec16C( 31 void WebRtcIsacfix_AllpassFilter2FixDec16C(
33 int16_t *data_ch1, // Input and output in channel 1, in Q0 32 int16_t *data_ch1, // Input and output in channel 1, in Q0
34 int16_t *data_ch2, // Input and output in channel 2, in Q0 33 int16_t *data_ch2, // Input and output in channel 2, in Q0
35 const int16_t *factor_ch1, // Scaling factor for channel 1, in Q15 34 const int16_t *factor_ch1, // Scaling factor for channel 1, in Q15
36 const int16_t *factor_ch2, // Scaling factor for channel 2, in Q15 35 const int16_t *factor_ch2, // Scaling factor for channel 2, in Q15
37 const int length, // Length of the data buffers 36 const int length, // Length of the data buffers
38 int32_t *filter_state_ch1, // Filter state for channel 1, in Q16 37 int32_t *filter_state_ch1, // Filter state for channel 1, in Q16
39 int32_t *filter_state_ch2) { // Filter state for channel 2, in Q16 38 int32_t *filter_state_ch2) { // Filter state for channel 2, in Q16
40 int n = 0; 39 int n = 0;
41 int32_t state0_ch1 = filter_state_ch1[0], state1_ch1 = filter_state_ch1[1]; 40 int32_t state0_ch1 = filter_state_ch1[0], state1_ch1 = filter_state_ch1[1];
42 int32_t state0_ch2 = filter_state_ch2[0], state1_ch2 = filter_state_ch2[1]; 41 int32_t state0_ch2 = filter_state_ch2[0], state1_ch2 = filter_state_ch2[1];
43 int16_t in_out = 0; 42 int16_t in_out = 0;
44 int32_t a = 0, b = 0; 43 int32_t a = 0, b = 0;
45 44
46 // Assembly file assumption. 45 // Assembly file assumption.
47 assert(length % 2 == 0); 46 RTC_DCHECK_EQ(0, length % 2);
48 47
49 for (n = 0; n < length; n++) { 48 for (n = 0; n < length; n++) {
50 // Process channel 1: 49 // Process channel 1:
51 in_out = data_ch1[n]; 50 in_out = data_ch1[n];
52 a = factor_ch1[0] * in_out; // Q15 * Q0 = Q15 51 a = factor_ch1[0] * in_out; // Q15 * Q0 = Q15
53 a *= 1 << 1; // Q15 -> Q16 52 a *= 1 << 1; // Q15 -> Q16
54 b = WebRtcSpl_AddSatW32(a, state0_ch1); 53 b = WebRtcSpl_AddSatW32(a, state0_ch1);
55 a = -factor_ch1[0] * (int16_t)(b >> 16); // Q15 54 a = -factor_ch1[0] * (int16_t)(b >> 16); // Q15
56 state0_ch1 = 55 state0_ch1 =
57 WebRtcSpl_AddSatW32(a * (1 << 1), (int32_t)in_out * (1 << 16)); // Q16 56 WebRtcSpl_AddSatW32(a * (1 << 1), (int32_t)in_out * (1 << 16)); // Q16
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 /* High pass filter */ 412 /* High pass filter */
414 WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut1Q30, postfiltdata->HPstates1_fix); 413 WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut1Q30, postfiltdata->HPstates1_fix);
415 WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut2Q30, postfiltdata->HPstates2_fix); 414 WebRtcIsacfix_HighpassFilterFixDec32(in, len, WebRtcIsacfix_kHPStCoeffOut2Q30, postfiltdata->HPstates2_fix);
416 415
417 for (k=0;k<len;k++) { 416 for (k=0;k<len;k++) {
418 out16[k] = in[k]; 417 out16[k] = in[k];
419 } 418 }
420 } 419 }
421 420
422 #endif 421 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698