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:
henrik.lundin@webrtc.org
2014-09-04 10:58:43 +00:00
parent 3c0aae17f0
commit f6ab6f86e7
7 changed files with 13 additions and 13 deletions

View File

@@ -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) {
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) {
assert(from_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 {

View File

@@ -43,7 +43,7 @@ class AudioMultiVector {
// 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
// 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
// object. The array is assumed to be channel-interleaved. |length| must be

View File

@@ -101,7 +101,7 @@ TEST_P(AudioMultiVectorTest, PushBackInterleavedAndCopy) {
AudioMultiVector vec(num_channels_);
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
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(array_length(), vec.Size());
ASSERT_EQ(num_channels_, vec_copy.Channels());
@@ -118,7 +118,7 @@ TEST_P(AudioMultiVectorTest, PushBackInterleavedAndCopy) {
EXPECT_TRUE(vec.Empty());
// 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());
}
@@ -127,7 +127,7 @@ TEST_P(AudioMultiVectorTest, CopyToNull) {
AudioMultiVector vec(num_channels_);
AudioMultiVector* vec_copy = NULL;
vec.PushBackInterleaved(array_interleaved_, interleaved_length_);
vec.CopyFrom(vec_copy);
vec.CopyTo(vec_copy);
}
// Test the PushBack method with another AudioMultiVector as input argument.

View File

@@ -22,7 +22,7 @@ void AudioVector::Clear() {
first_free_ix_ = 0;
}
void AudioVector::CopyFrom(AudioVector* copy_to) const {
void AudioVector::CopyTo(AudioVector* copy_to) const {
if (copy_to) {
copy_to->Reserve(Size());
assert(copy_to->capacity_ >= Size());

View File

@@ -43,7 +43,7 @@ class AudioVector {
// 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,
// |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
// length of this object is increased with the length of |prepend_this|.

View File

@@ -65,7 +65,7 @@ TEST_F(AudioVectorTest, PushBackAndCopy) {
AudioVector vec;
AudioVector vec_copy;
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_copy.Size());
for (size_t i = 0; i < array_length(); ++i) {
@@ -78,7 +78,7 @@ TEST_F(AudioVectorTest, PushBackAndCopy) {
EXPECT_TRUE(vec.Empty());
// 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());
}
@@ -87,7 +87,7 @@ TEST_F(AudioVectorTest, CopyToNull) {
AudioVector vec;
AudioVector* vec_copy = NULL;
vec.PushBack(array_, array_length());
vec.CopyFrom(vec_copy);
vec.CopyTo(vec_copy);
}
// Test the PushBack method with another AudioVector as input argument.

View File

@@ -511,7 +511,7 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
parameters.expand_vector0.Clear();
parameters.expand_vector0.PushBack(vector1, expansion_length);
// Copy from expand_vector0 to expand_vector1.
parameters.expand_vector0.CopyFrom(&parameters.expand_vector1);
parameters.expand_vector0.CopyTo(&parameters.expand_vector1);
// Set the energy_ratio since it is used by muting slope.
if ((energy1 / 4 < energy2) || (energy2 == 0)) {
amplitude_ratio = 4096; // 0.5 in Q13.