pbos@webrtc.org | 788acd1 | 2014-12-15 09:41:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |
| 13 | |
kwiberg | 85d8bb0 | 2016-02-16 20:39:36 -0800 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
pbos@webrtc.org | 788acd1 | 2014-12-15 09:41:24 +0000 | [diff] [blame] | 16 | #include "webrtc/typedefs.h" |
| 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | class FIRFilter; |
| 21 | |
| 22 | // A single node of a Wavelet Packet Decomposition (WPD) tree. |
| 23 | class WPDNode { |
| 24 | public: |
| 25 | // Creates a WPDNode. The data vector will contain zeros. The filter will have |
| 26 | // the coefficients provided. |
| 27 | WPDNode(size_t length, const float* coefficients, size_t coefficients_length); |
| 28 | ~WPDNode(); |
| 29 | |
| 30 | // Updates the node data. |parent_data| / 2 must be equals to |length_|. |
| 31 | // Returns 0 if correct, and -1 otherwise. |
| 32 | int Update(const float* parent_data, size_t parent_data_length); |
| 33 | |
| 34 | const float* data() const { return data_.get(); } |
| 35 | // Returns 0 if correct, and -1 otherwise. |
| 36 | int set_data(const float* new_data, size_t length); |
| 37 | size_t length() const { return length_; } |
| 38 | |
| 39 | private: |
kwiberg | 85d8bb0 | 2016-02-16 20:39:36 -0800 | [diff] [blame] | 40 | std::unique_ptr<float[]> data_; |
pbos@webrtc.org | 788acd1 | 2014-12-15 09:41:24 +0000 | [diff] [blame] | 41 | size_t length_; |
kwiberg | 85d8bb0 | 2016-02-16 20:39:36 -0800 | [diff] [blame] | 42 | std::unique_ptr<FIRFilter> filter_; |
pbos@webrtc.org | 788acd1 | 2014-12-15 09:41:24 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace webrtc |
| 46 | |
| 47 | #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_ |