Rename Audio[Multi]Vector.CopyFrom to .CopyTo
The name of the copy method was confusing. This change makes the code easier to read where the method is used. R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/25389004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7059 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -57,10 +57,10 @@ void AudioMultiVector::Zeros(size_t length) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMultiVector::CopyFrom(AudioMultiVector* copy_to) const {
|
void AudioMultiVector::CopyTo(AudioMultiVector* copy_to) const {
|
||||||
if (copy_to) {
|
if (copy_to) {
|
||||||
for (size_t i = 0; i < num_channels_; ++i) {
|
for (size_t i = 0; i < num_channels_; ++i) {
|
||||||
channels_[i]->CopyFrom(&(*copy_to)[i]);
|
channels_[i]->CopyTo(&(*copy_to)[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ bool AudioMultiVector::Empty() const {
|
|||||||
void AudioMultiVector::CopyChannel(size_t from_channel, size_t to_channel) {
|
void AudioMultiVector::CopyChannel(size_t from_channel, size_t to_channel) {
|
||||||
assert(from_channel < num_channels_);
|
assert(from_channel < num_channels_);
|
||||||
assert(to_channel < num_channels_);
|
assert(to_channel < num_channels_);
|
||||||
channels_[from_channel]->CopyFrom(channels_[to_channel]);
|
channels_[from_channel]->CopyTo(channels_[to_channel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioVector& AudioMultiVector::operator[](size_t index) const {
|
const AudioVector& AudioMultiVector::operator[](size_t index) const {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class AudioMultiVector {
|
|||||||
// are deleted. After the operation is done, |copy_to| will be an exact
|
// are deleted. After the operation is done, |copy_to| will be an exact
|
||||||
// replica of this object. The source and the destination must have the same
|
// replica of this object. The source and the destination must have the same
|
||||||
// number of channels.
|
// number of channels.
|
||||||
virtual void CopyFrom(AudioMultiVector* copy_to) const;
|
virtual void CopyTo(AudioMultiVector* copy_to) const;
|
||||||
|
|
||||||
// Appends the contents of array |append_this| to the end of this
|
// Appends the contents of array |append_this| to the end of this
|
||||||
// object. The array is assumed to be channel-interleaved. |length| must be
|
// object. The array is assumed to be channel-interleaved. |length| must be
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ TEST_P(AudioMultiVectorTest, PushBackInterleavedAndCopy) {
|
|||||||
AudioMultiVector vec(num_channels_);
|
AudioMultiVector vec(num_channels_);
|
||||||
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
|
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
|
||||||
AudioMultiVector vec_copy(num_channels_);
|
AudioMultiVector vec_copy(num_channels_);
|
||||||
vec.CopyFrom(&vec_copy); // Copy from |vec| to |vec_copy|.
|
vec.CopyTo(&vec_copy); // Copy from |vec| to |vec_copy|.
|
||||||
ASSERT_EQ(num_channels_, vec.Channels());
|
ASSERT_EQ(num_channels_, vec.Channels());
|
||||||
ASSERT_EQ(array_length(), vec.Size());
|
ASSERT_EQ(array_length(), vec.Size());
|
||||||
ASSERT_EQ(num_channels_, vec_copy.Channels());
|
ASSERT_EQ(num_channels_, vec_copy.Channels());
|
||||||
@@ -118,7 +118,7 @@ TEST_P(AudioMultiVectorTest, PushBackInterleavedAndCopy) {
|
|||||||
EXPECT_TRUE(vec.Empty());
|
EXPECT_TRUE(vec.Empty());
|
||||||
|
|
||||||
// Now copy the empty vector and verify that the copy becomes empty too.
|
// Now copy the empty vector and verify that the copy becomes empty too.
|
||||||
vec.CopyFrom(&vec_copy);
|
vec.CopyTo(&vec_copy);
|
||||||
EXPECT_TRUE(vec_copy.Empty());
|
EXPECT_TRUE(vec_copy.Empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ TEST_P(AudioMultiVectorTest, CopyToNull) {
|
|||||||
AudioMultiVector vec(num_channels_);
|
AudioMultiVector vec(num_channels_);
|
||||||
AudioMultiVector* vec_copy = NULL;
|
AudioMultiVector* vec_copy = NULL;
|
||||||
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
|
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
|
||||||
vec.CopyFrom(vec_copy);
|
vec.CopyTo(vec_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the PushBack method with another AudioMultiVector as input argument.
|
// Test the PushBack method with another AudioMultiVector as input argument.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void AudioVector::Clear() {
|
|||||||
first_free_ix_ = 0;
|
first_free_ix_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioVector::CopyFrom(AudioVector* copy_to) const {
|
void AudioVector::CopyTo(AudioVector* copy_to) const {
|
||||||
if (copy_to) {
|
if (copy_to) {
|
||||||
copy_to->Reserve(Size());
|
copy_to->Reserve(Size());
|
||||||
assert(copy_to->capacity_ >= Size());
|
assert(copy_to->capacity_ >= Size());
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class AudioVector {
|
|||||||
// Copies all values from this vector to |copy_to|. Any contents in |copy_to|
|
// Copies all values from this vector to |copy_to|. Any contents in |copy_to|
|
||||||
// are deleted before the copy operation. After the operation is done,
|
// are deleted before the copy operation. After the operation is done,
|
||||||
// |copy_to| will be an exact replica of this object.
|
// |copy_to| will be an exact replica of this object.
|
||||||
virtual void CopyFrom(AudioVector* copy_to) const;
|
virtual void CopyTo(AudioVector* copy_to) const;
|
||||||
|
|
||||||
// Prepends the contents of AudioVector |prepend_this| to this object. The
|
// Prepends the contents of AudioVector |prepend_this| to this object. The
|
||||||
// length of this object is increased with the length of |prepend_this|.
|
// length of this object is increased with the length of |prepend_this|.
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ TEST_F(AudioVectorTest, PushBackAndCopy) {
|
|||||||
AudioVector vec;
|
AudioVector vec;
|
||||||
AudioVector vec_copy;
|
AudioVector vec_copy;
|
||||||
vec.PushBack(array_, array_length());
|
vec.PushBack(array_, array_length());
|
||||||
vec.CopyFrom(&vec_copy); // Copy from |vec| to |vec_copy|.
|
vec.CopyTo(&vec_copy); // Copy from |vec| to |vec_copy|.
|
||||||
ASSERT_EQ(array_length(), vec.Size());
|
ASSERT_EQ(array_length(), vec.Size());
|
||||||
ASSERT_EQ(array_length(), vec_copy.Size());
|
ASSERT_EQ(array_length(), vec_copy.Size());
|
||||||
for (size_t i = 0; i < array_length(); ++i) {
|
for (size_t i = 0; i < array_length(); ++i) {
|
||||||
@@ -78,7 +78,7 @@ TEST_F(AudioVectorTest, PushBackAndCopy) {
|
|||||||
EXPECT_TRUE(vec.Empty());
|
EXPECT_TRUE(vec.Empty());
|
||||||
|
|
||||||
// Now copy the empty vector and verify that the copy becomes empty too.
|
// Now copy the empty vector and verify that the copy becomes empty too.
|
||||||
vec.CopyFrom(&vec_copy);
|
vec.CopyTo(&vec_copy);
|
||||||
EXPECT_TRUE(vec_copy.Empty());
|
EXPECT_TRUE(vec_copy.Empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ TEST_F(AudioVectorTest, CopyToNull) {
|
|||||||
AudioVector vec;
|
AudioVector vec;
|
||||||
AudioVector* vec_copy = NULL;
|
AudioVector* vec_copy = NULL;
|
||||||
vec.PushBack(array_, array_length());
|
vec.PushBack(array_, array_length());
|
||||||
vec.CopyFrom(vec_copy);
|
vec.CopyTo(vec_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the PushBack method with another AudioVector as input argument.
|
// Test the PushBack method with another AudioVector as input argument.
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
|
|||||||
parameters.expand_vector0.Clear();
|
parameters.expand_vector0.Clear();
|
||||||
parameters.expand_vector0.PushBack(vector1, expansion_length);
|
parameters.expand_vector0.PushBack(vector1, expansion_length);
|
||||||
// Copy from expand_vector0 to expand_vector1.
|
// Copy from expand_vector0 to expand_vector1.
|
||||||
parameters.expand_vector0.CopyFrom(¶meters.expand_vector1);
|
parameters.expand_vector0.CopyTo(¶meters.expand_vector1);
|
||||||
// Set the energy_ratio since it is used by muting slope.
|
// Set the energy_ratio since it is used by muting slope.
|
||||||
if ((energy1 / 4 < energy2) || (energy2 == 0)) {
|
if ((energy1 / 4 < energy2) || (energy2 == 0)) {
|
||||||
amplitude_ratio = 4096; // 0.5 in Q13.
|
amplitude_ratio = 4096; // 0.5 in Q13.
|
||||||
|
|||||||
Reference in New Issue
Block a user