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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 void CopyFrom(const Matrix& other) { | 88 void CopyFrom(const Matrix& other) { |
89 CopyFrom(&other.data_[0], other.num_rows_, other.num_columns_); | 89 CopyFrom(&other.data_[0], other.num_rows_, other.num_columns_); |
90 } | 90 } |
91 | 91 |
92 // Copy |data| into the Matrix. The current data is lost. | 92 // Copy |data| into the Matrix. The current data is lost. |
93 void CopyFrom(const T* const data, int num_rows, int num_columns) { | 93 void CopyFrom(const T* const data, int num_rows, int num_columns) { |
94 Resize(num_rows, num_columns); | 94 Resize(num_rows, num_columns); |
95 memcpy(&data_[0], data, num_rows_ * num_columns_ * sizeof(data_[0])); | 95 memcpy(&data_[0], data, num_rows_ * num_columns_ * sizeof(data_[0])); |
96 } | 96 } |
97 | 97 |
98 Matrix& CopyFromColumn(const T* const* src, int column_index, int num_rows) { | 98 Matrix& CopyFromColumn(const T* const* src, |
99 size_t column_index, | |
100 int num_rows) { | |
Andrew MacDonald
2015/07/24 04:01:43
num_rows should be size_t
Peter Kasting
2015/07/24 06:44:22
That's also part of the followup: https://coderevi
Andrew MacDonald
2015/07/24 19:07:13
Acknowledged.
| |
99 Resize(1, num_rows); | 101 Resize(1, num_rows); |
100 for (int i = 0; i < num_columns_; ++i) { | 102 for (int i = 0; i < num_columns_; ++i) { |
101 data_[i] = src[i][column_index]; | 103 data_[i] = src[i][column_index]; |
102 } | 104 } |
103 | 105 |
104 return *this; | 106 return *this; |
105 } | 107 } |
106 | 108 |
107 void Resize(int num_rows, int num_columns) { | 109 void Resize(int num_rows, int num_columns) { |
Andrew MacDonald
2015/07/24 04:01:43
And here, and everywhere else we have num_rows/num
Peter Kasting
2015/07/24 06:44:22
No! Seriously, it would literally be impossible t
Andrew MacDonald
2015/07/24 19:07:13
Acknowledged.
| |
108 if (num_rows != num_rows_ || num_columns != num_columns_) { | 110 if (num_rows != num_rows_ || num_columns != num_columns_) { |
109 num_rows_ = num_rows; | 111 num_rows_ = num_rows; |
110 num_columns_ = num_columns; | 112 num_columns_ = num_columns; |
111 Resize(); | 113 Resize(); |
112 } | 114 } |
113 } | 115 } |
114 | 116 |
115 // Accessors and mutators. | 117 // Accessors and mutators. |
116 int num_rows() const { return num_rows_; } | 118 int num_rows() const { return num_rows_; } |
117 int num_columns() const { return num_columns_; } | 119 int num_columns() const { return num_columns_; } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 | 359 |
358 return *this; | 360 return *this; |
359 } | 361 } |
360 | 362 |
361 DISALLOW_COPY_AND_ASSIGN(Matrix); | 363 DISALLOW_COPY_AND_ASSIGN(Matrix); |
362 }; | 364 }; |
363 | 365 |
364 } // namespace webrtc | 366 } // namespace webrtc |
365 | 367 |
366 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_MATRIX_H_ | 368 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_MATRIX_H_ |
OLD | NEW |