| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 22 matching lines...) Expand all Loading... |
| 33 size_t state_length_; | 33 size_t state_length_; |
| 34 std::unique_ptr<float[]> coefficients_; | 34 std::unique_ptr<float[]> coefficients_; |
| 35 std::unique_ptr<float[]> state_; | 35 std::unique_ptr<float[]> state_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 FIRFilter* FIRFilter::Create(const float* coefficients, | 38 FIRFilter* FIRFilter::Create(const float* coefficients, |
| 39 size_t coefficients_length, | 39 size_t coefficients_length, |
| 40 size_t max_input_length) { | 40 size_t max_input_length) { |
| 41 if (!coefficients || coefficients_length <= 0 || max_input_length <= 0) { | 41 if (!coefficients || coefficients_length <= 0 || max_input_length <= 0) { |
| 42 RTC_NOTREACHED(); | 42 RTC_NOTREACHED(); |
| 43 return NULL; | 43 return nullptr; |
| 44 } | 44 } |
| 45 | 45 |
| 46 FIRFilter* filter = NULL; | 46 FIRFilter* filter = nullptr; |
| 47 // If we know the minimum architecture at compile time, avoid CPU detection. | 47 // If we know the minimum architecture at compile time, avoid CPU detection. |
| 48 #if defined(WEBRTC_ARCH_X86_FAMILY) | 48 #if defined(WEBRTC_ARCH_X86_FAMILY) |
| 49 #if defined(__SSE2__) | 49 #if defined(__SSE2__) |
| 50 filter = | 50 filter = |
| 51 new FIRFilterSSE2(coefficients, coefficients_length, max_input_length); | 51 new FIRFilterSSE2(coefficients, coefficients_length, max_input_length); |
| 52 #else | 52 #else |
| 53 // x86 CPU detection required. | 53 // x86 CPU detection required. |
| 54 if (WebRtc_GetCPUInfo(kSSE2)) { | 54 if (WebRtc_GetCPUInfo(kSSE2)) { |
| 55 filter = | 55 filter = |
| 56 new FIRFilterSSE2(coefficients, coefficients_length, max_input_length); | 56 new FIRFilterSSE2(coefficients, coefficients_length, max_input_length); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 state_.get(), &in[length - state_length_], state_length_ * sizeof(*in)); | 101 state_.get(), &in[length - state_length_], state_length_ * sizeof(*in)); |
| 102 } else { | 102 } else { |
| 103 memmove(state_.get(), | 103 memmove(state_.get(), |
| 104 &state_[length], | 104 &state_[length], |
| 105 (state_length_ - length) * sizeof(state_[0])); | 105 (state_length_ - length) * sizeof(state_[0])); |
| 106 memcpy(&state_[state_length_ - length], in, length * sizeof(*in)); | 106 memcpy(&state_[state_length_ - length], in, length * sizeof(*in)); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace webrtc | 110 } // namespace webrtc |
| OLD | NEW |