OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |
13 | 13 |
14 #include "webrtc/base/scoped_ptr.h" | 14 #include <memory> |
| 15 |
15 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 | 19 |
19 class FIRFilter; | 20 class FIRFilter; |
20 | 21 |
21 // A single node of a Wavelet Packet Decomposition (WPD) tree. | 22 // A single node of a Wavelet Packet Decomposition (WPD) tree. |
22 class WPDNode { | 23 class WPDNode { |
23 public: | 24 public: |
24 // Creates a WPDNode. The data vector will contain zeros. The filter will have | 25 // Creates a WPDNode. The data vector will contain zeros. The filter will have |
25 // the coefficients provided. | 26 // the coefficients provided. |
26 WPDNode(size_t length, const float* coefficients, size_t coefficients_length); | 27 WPDNode(size_t length, const float* coefficients, size_t coefficients_length); |
27 ~WPDNode(); | 28 ~WPDNode(); |
28 | 29 |
29 // Updates the node data. |parent_data| / 2 must be equals to |length_|. | 30 // Updates the node data. |parent_data| / 2 must be equals to |length_|. |
30 // Returns 0 if correct, and -1 otherwise. | 31 // Returns 0 if correct, and -1 otherwise. |
31 int Update(const float* parent_data, size_t parent_data_length); | 32 int Update(const float* parent_data, size_t parent_data_length); |
32 | 33 |
33 const float* data() const { return data_.get(); } | 34 const float* data() const { return data_.get(); } |
34 // Returns 0 if correct, and -1 otherwise. | 35 // Returns 0 if correct, and -1 otherwise. |
35 int set_data(const float* new_data, size_t length); | 36 int set_data(const float* new_data, size_t length); |
36 size_t length() const { return length_; } | 37 size_t length() const { return length_; } |
37 | 38 |
38 private: | 39 private: |
39 rtc::scoped_ptr<float[]> data_; | 40 std::unique_ptr<float[]> data_; |
40 size_t length_; | 41 size_t length_; |
41 rtc::scoped_ptr<FIRFilter> filter_; | 42 std::unique_ptr<FIRFilter> filter_; |
42 }; | 43 }; |
43 | 44 |
44 } // namespace webrtc | 45 } // namespace webrtc |
45 | 46 |
46 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ | 47 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |
OLD | NEW |