Remove an optimization that's no longer worth the extra complexity it causes

The data_ optimization was a way to operate on the data directly
instead of copying it, applicable in the mono, non-float case. Since a
few audio_processing steps are already using floats (with more
hopefully to come), we don't end up benefiting from the optimization
anyway, so we might as well remove it.

BUG=
R=aluebs@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/15539004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6307 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kwiberg@webrtc.org 2014-06-03 09:10:06 +00:00
parent 34a08b4fb8
commit c0035a67a1
2 changed files with 0 additions and 32 deletions

View File

@ -159,7 +159,6 @@ AudioBuffer::AudioBuffer(int input_samples_per_channel,
num_mixed_low_pass_channels_(0),
reference_copied_(false),
activity_(AudioFrame::kVadUnknown),
data_(NULL),
keyboard_data_(NULL),
channels_(new IFChannelBuffer(proc_samples_per_channel_,
num_proc_channels_)) {
@ -278,7 +277,6 @@ void AudioBuffer::CopyTo(int samples_per_channel,
}
void AudioBuffer::InitForNewData() {
data_ = NULL;
keyboard_data_ = NULL;
num_mixed_channels_ = 0;
num_mixed_low_pass_channels_ = 0;
@ -288,11 +286,6 @@ void AudioBuffer::InitForNewData() {
const int16_t* AudioBuffer::data(int channel) const {
assert(channel >= 0 && channel < num_proc_channels_);
if (data_ != NULL) {
assert(channel == 0 && num_proc_channels_ == 1);
return data_;
}
return channels_->ibuf()->channel(channel);
}
@ -303,14 +296,6 @@ int16_t* AudioBuffer::data(int channel) {
float* AudioBuffer::data_f(int channel) {
assert(channel >= 0 && channel < num_proc_channels_);
if (data_ != NULL) {
// Need to make a copy of the data instead of just pointing to it, since
// we're about to convert it to float.
assert(channel == 0 && num_proc_channels_ == 1);
memcpy(channels_->ibuf()->channel(0), data_,
sizeof(*data_) * proc_samples_per_channel_);
data_ = NULL;
}
return channels_->fbuf()->channel(channel);
}
@ -418,12 +403,6 @@ void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
InitForNewData();
activity_ = frame->vad_activity_;
if (num_proc_channels_ == 1) {
// We can get away with a pointer assignment in this case.
data_ = frame->data_;
return;
}
int16_t* interleaved = frame->data_;
for (int i = 0; i < num_proc_channels_; i++) {
int16_t* deinterleaved = channels_->ibuf()->channel(i);
@ -446,12 +425,6 @@ void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
return;
}
if (data_) {
assert(num_proc_channels_ == 1);
assert(data_ == frame->data_);
return;
}
int16_t* interleaved = frame->data_;
for (int i = 0; i < num_proc_channels_; i++) {
int16_t* deinterleaved = channels_->ibuf()->channel(i);

View File

@ -113,11 +113,6 @@ class AudioBuffer {
bool reference_copied_;
AudioFrame::VADActivity activity_;
// If non-null, use this instead of channels_->channel(0). This is an
// optimization for the case num_proc_channels_ == 1 that allows us to point
// to the data instead of copying it.
int16_t* data_;
const float* keyboard_data_;
scoped_ptr<IFChannelBuffer> channels_;
scoped_ptr<SplitChannelBuffer> split_channels_;