Delete header file rtc_base/memory/aligned_array.h
Move definition of AlignedArray to the only code using it, the test-only LappedTransform class, and delete unused methods. Bug: webrtc:6424, webrtc:9577 Change-Id: I1bb5f57400f7217345b7ec7376235ad4c4bae858 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168701 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30576}
This commit is contained in:
@ -30,7 +30,7 @@ if (rtc_include_tests) {
|
||||
"../../../../../common_audio",
|
||||
"../../../../../common_audio:common_audio_c",
|
||||
"../../../../../rtc_base:checks",
|
||||
"../../../../../rtc_base/memory:aligned_array",
|
||||
"../../../../../rtc_base/memory:aligned_malloc",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,53 @@
|
||||
|
||||
#include "common_audio/real_fourier.h"
|
||||
#include "modules/audio_coding/codecs/opus/test/blocker.h"
|
||||
#include "rtc_base/memory/aligned_array.h"
|
||||
#include "rtc_base/memory/aligned_malloc.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Wrapper class for aligned arrays. Every row (and the first dimension) are
|
||||
// aligned to the given byte alignment.
|
||||
template <typename T>
|
||||
class AlignedArray {
|
||||
public:
|
||||
AlignedArray(size_t rows, size_t cols, size_t alignment)
|
||||
: rows_(rows), cols_(cols) {
|
||||
RTC_CHECK_GT(alignment, 0);
|
||||
head_row_ =
|
||||
static_cast<T**>(AlignedMalloc(rows_ * sizeof(*head_row_), alignment));
|
||||
for (size_t i = 0; i < rows_; ++i) {
|
||||
head_row_[i] = static_cast<T*>(
|
||||
AlignedMalloc(cols_ * sizeof(**head_row_), alignment));
|
||||
}
|
||||
}
|
||||
|
||||
~AlignedArray() {
|
||||
for (size_t i = 0; i < rows_; ++i) {
|
||||
AlignedFree(head_row_[i]);
|
||||
}
|
||||
AlignedFree(head_row_);
|
||||
}
|
||||
|
||||
T* const* Array() { return head_row_; }
|
||||
|
||||
const T* const* Array() const { return head_row_; }
|
||||
|
||||
T* Row(size_t row) {
|
||||
RTC_CHECK_LE(row, rows_);
|
||||
return head_row_[row];
|
||||
}
|
||||
|
||||
const T* Row(size_t row) const {
|
||||
RTC_CHECK_LE(row, rows_);
|
||||
return head_row_[row];
|
||||
}
|
||||
|
||||
private:
|
||||
size_t rows_;
|
||||
size_t cols_;
|
||||
T** head_row_;
|
||||
};
|
||||
|
||||
// Helper class for audio processing modules which operate on frequency domain
|
||||
// input derived from the windowed time domain audio stream.
|
||||
//
|
||||
|
Reference in New Issue
Block a user