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

Side by Side Diff: webrtc/common_audio/signal_processing/filter_ar_fast_q12.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 #include <assert.h>
11 10
11 #include "webrtc/base/checks.h"
12 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 12 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
13 13
14 // TODO(bjornv): Change the return type to report errors. 14 // TODO(bjornv): Change the return type to report errors.
15 15
16 void WebRtcSpl_FilterARFastQ12(const int16_t* data_in, 16 void WebRtcSpl_FilterARFastQ12(const int16_t* data_in,
17 int16_t* data_out, 17 int16_t* data_out,
18 const int16_t* __restrict coefficients, 18 const int16_t* __restrict coefficients,
19 size_t coefficients_length, 19 size_t coefficients_length,
20 size_t data_length) { 20 size_t data_length) {
21 size_t i = 0; 21 size_t i = 0;
22 size_t j = 0; 22 size_t j = 0;
23 23
24 assert(data_length > 0); 24 RTC_DCHECK_GT(data_length, 0);
25 assert(coefficients_length > 1); 25 RTC_DCHECK_GT(coefficients_length, 1);
26 26
27 for (i = 0; i < data_length; i++) { 27 for (i = 0; i < data_length; i++) {
28 int32_t output = 0; 28 int32_t output = 0;
29 int32_t sum = 0; 29 int32_t sum = 0;
30 30
31 for (j = coefficients_length - 1; j > 0; j--) { 31 for (j = coefficients_length - 1; j > 0; j--) {
32 sum += coefficients[j] * data_out[i - j]; 32 sum += coefficients[j] * data_out[i - j];
33 } 33 }
34 34
35 output = coefficients[0] * data_in[i]; 35 output = coefficients[0] * data_in[i];
36 output -= sum; 36 output -= sum;
37 37
38 // Saturate and store the output. 38 // Saturate and store the output.
39 output = WEBRTC_SPL_SAT(134215679, output, -134217728); 39 output = WEBRTC_SPL_SAT(134215679, output, -134217728);
40 data_out[i] = (int16_t)((output + 2048) >> 12); 40 data_out[i] = (int16_t)((output + 2048) >> 12);
41 } 41 }
42 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698