/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Returns a pointer array to the channels. // If band is explicitly specificed, the channels for a specific band are // returned and the usage becomes: channels(band)[channel][sample]. // Where: // 0 <= band < `num_bands_` // 0 <= channel < `num_allocated_channels_` // 0 <= sample < `num_frames_per_band_`
// If band is not explicitly specified, the full-band channels (or lower band // channels) are returned and the usage becomes: channels()[channel][sample]. // Where: // 0 <= channel < `num_allocated_channels_` // 0 <= sample < `num_frames_` const T* const* channels(size_t band = 0) const {
RTC_DCHECK_LT(band, num_bands_); return &channels_[band * num_allocated_channels_];
}
T* const* channels(size_t band = 0) { const ChannelBuffer<T>* t = this; returnconst_cast<T* const*>(t->channels(band));
}
rtc::ArrayView<const rtc::ArrayView<T>> channels_view(size_t band = 0) { return channels_view_[band];
}
rtc::ArrayView<const rtc::ArrayView<T>> channels_view(size_t band = 0) const { return channels_view_[band];
}
// Returns a pointer array to the bands for a specific channel. // Usage: // bands(channel)[band][sample]. // Where: // 0 <= channel < `num_channels_` // 0 <= band < `num_bands_` // 0 <= sample < `num_frames_per_band_` const T* const* bands(size_t channel) const {
RTC_DCHECK_LT(channel, num_channels_);
RTC_DCHECK_GE(channel, 0); return &bands_[channel * num_bands_];
}
T* const* bands(size_t channel) { const ChannelBuffer<T>* t = this; returnconst_cast<T* const*>(t->bands(channel));
}
private:
std::unique_ptr<T[]> data_;
std::unique_ptr<T*[]> channels_;
std::unique_ptr<T*[]> bands_; const size_t num_frames_; const size_t num_frames_per_band_; // Number of channels the internal buffer holds. const size_t num_allocated_channels_; // Number of channels the user sees.
size_t num_channels_; const size_t num_bands_; const std::vector<std::vector<rtc::ArrayView<T>>> bands_view_; const std::vector<std::vector<rtc::ArrayView<T>>> channels_view_;
};
// One int16_t and one float ChannelBuffer that are kept in sync. The sync is // broken when someone requests write access to either ChannelBuffer, and // reestablished when someone requests the outdated ChannelBuffer. It is // therefore safe to use the return value of ibuf_const() and fbuf_const() // until the next call to ibuf() or fbuf(), and the return value of ibuf() and // fbuf() until the next call to any of the other functions. class IFChannelBuffer { public:
IFChannelBuffer(size_t num_frames, size_t num_channels, size_t num_bands = 1);
~IFChannelBuffer();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.