blob: 6a52fb7284d850e173f22679006a9e15bcfb5b65 [file] [log] [blame]
pbos@webrtc.org788acd12014-12-15 09:41:24 +00001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_
12#define MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_
pbos@webrtc.org788acd12014-12-15 09:41:24 +000013
kwiberg85d8bb02016-02-16 20:39:36 -080014#include <memory>
15
pbos@webrtc.org788acd12014-12-15 09:41:24 +000016namespace webrtc {
17
18class FIRFilter;
19
20// A single node of a Wavelet Packet Decomposition (WPD) tree.
21class WPDNode {
22 public:
23 // Creates a WPDNode. The data vector will contain zeros. The filter will have
24 // the coefficients provided.
25 WPDNode(size_t length, const float* coefficients, size_t coefficients_length);
26 ~WPDNode();
27
28 // Updates the node data. |parent_data| / 2 must be equals to |length_|.
29 // Returns 0 if correct, and -1 otherwise.
30 int Update(const float* parent_data, size_t parent_data_length);
31
32 const float* data() const { return data_.get(); }
33 // Returns 0 if correct, and -1 otherwise.
34 int set_data(const float* new_data, size_t length);
35 size_t length() const { return length_; }
36
37 private:
kwiberg85d8bb02016-02-16 20:39:36 -080038 std::unique_ptr<float[]> data_;
pbos@webrtc.org788acd12014-12-15 09:41:24 +000039 size_t length_;
kwiberg85d8bb02016-02-16 20:39:36 -080040 std::unique_ptr<FIRFilter> filter_;
pbos@webrtc.org788acd12014-12-15 09:41:24 +000041};
42
43} // namespace webrtc
44
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020045#endif // MODULES_AUDIO_PROCESSING_TRANSIENT_WPD_NODE_H_