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

Side by Side Diff: webrtc/modules/audio_processing/transient/wpd_tree.cc

Issue 1685993003: Fix negative shift exponent in WPDTree (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 nodes_[index_right_child].reset(new WPDNode(nodes_[index]->length() / 2, 59 nodes_[index_right_child].reset(new WPDNode(nodes_[index]->length() / 2,
60 high_pass_coefficients, 60 high_pass_coefficients,
61 coefficients_length)); 61 coefficients_length));
62 } 62 }
63 } 63 }
64 } 64 }
65 65
66 WPDTree::~WPDTree() {} 66 WPDTree::~WPDTree() {}
67 67
68 WPDNode* WPDTree::NodeAt(int level, int index) { 68 WPDNode* WPDTree::NodeAt(int level, int index) {
69 const int kNumNodesAtLevel = 1 << level; 69 if (level < 0 || level > levels_ || index < 0 || index >= 1 << level) {
70 if (level < 0 || level > levels_ || index < 0 || index >= kNumNodesAtLevel) {
71 return NULL; 70 return NULL;
72 } 71 }
72
73 return nodes_[(1 << level) + index].get(); 73 return nodes_[(1 << level) + index].get();
74 } 74 }
75 75
76 int WPDTree::Update(const float* data, size_t data_length) { 76 int WPDTree::Update(const float* data, size_t data_length) {
77 if (!data || data_length != data_length_) { 77 if (!data || data_length != data_length_) {
78 return -1; 78 return -1;
79 } 79 }
80 80
81 // Update the root node. 81 // Update the root node.
82 int update_result = nodes_[1]->set_data(data, data_length); 82 int update_result = nodes_[1]->set_data(data, data_length);
(...skipping 27 matching lines...) Expand all
110 if (update_result != 0) { 110 if (update_result != 0) {
111 return -1; 111 return -1;
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 return 0; 116 return 0;
117 } 117 }
118 118
119 } // namespace webrtc 119 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698