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

Side by Side Diff: webrtc/modules/audio_processing/beamformer/matrix.h

Issue 1227213002: Update audio code to use size_t more correctly, webrtc/modules/audio_processing/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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
OLDNEW
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
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) {
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) {
108 if (num_rows != num_rows_ || num_columns != num_columns_) { 110 if (num_rows != num_rows_ || num_columns != num_columns_) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698