Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -34,8 +34,7 @@ AudioCodecSpeedTest::AudioCodecSpeedTest(int block_duration_ms,
|
||||
encoded_bytes_(0),
|
||||
encoding_time_ms_(0.0),
|
||||
decoding_time_ms_(0.0),
|
||||
out_file_(NULL) {
|
||||
}
|
||||
out_file_(NULL) {}
|
||||
|
||||
void AudioCodecSpeedTest::SetUp() {
|
||||
channels_ = get<0>(GetParam());
|
||||
@ -52,8 +51,8 @@ void AudioCodecSpeedTest::SetUp() {
|
||||
rewind(fp);
|
||||
|
||||
// Allocate memory to contain the whole file.
|
||||
in_data_.reset(new int16_t[loop_length_samples_ +
|
||||
input_length_sample_ * channels_]);
|
||||
in_data_.reset(
|
||||
new int16_t[loop_length_samples_ + input_length_sample_ * channels_]);
|
||||
|
||||
data_pointer_ = 0;
|
||||
|
||||
@ -111,11 +110,11 @@ void AudioCodecSpeedTest::EncodeDecode(size_t audio_duration_sec) {
|
||||
time_ms = DecodeABlock(&bit_stream_[0], encoded_bytes_, &out_data_[0]);
|
||||
decoding_time_ms_ += time_ms;
|
||||
if (save_out_data_) {
|
||||
fwrite(&out_data_[0], sizeof(int16_t),
|
||||
output_length_sample_ * channels_, out_file_);
|
||||
fwrite(&out_data_[0], sizeof(int16_t), output_length_sample_ * channels_,
|
||||
out_file_);
|
||||
}
|
||||
data_pointer_ = (data_pointer_ + input_length_sample_ * channels_) %
|
||||
loop_length_samples_;
|
||||
loop_length_samples_;
|
||||
time_now_ms += block_duration_ms_;
|
||||
}
|
||||
|
||||
|
@ -36,15 +36,18 @@ class AudioCodecSpeedTest : public testing::TestWithParam<coding_param> {
|
||||
// 2. save the bit stream to |bit_stream| of |max_bytes| bytes in size,
|
||||
// 3. assign |encoded_bytes| with the length of the bit stream (in bytes),
|
||||
// 4. return the cost of time (in millisecond) spent on actual encoding.
|
||||
virtual float EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
|
||||
size_t max_bytes, size_t* encoded_bytes) = 0;
|
||||
virtual float EncodeABlock(int16_t* in_data,
|
||||
uint8_t* bit_stream,
|
||||
size_t max_bytes,
|
||||
size_t* encoded_bytes) = 0;
|
||||
|
||||
// DecodeABlock(...) does the following:
|
||||
// 1. decodes the bit stream in |bit_stream| with a length of |encoded_bytes|
|
||||
// (in bytes),
|
||||
// 2. save the decoded audio in |out_data|,
|
||||
// 3. return the cost of time (in millisecond) spent on actual decoding.
|
||||
virtual float DecodeABlock(const uint8_t* bit_stream, size_t encoded_bytes,
|
||||
virtual float DecodeABlock(const uint8_t* bit_stream,
|
||||
size_t encoded_bytes,
|
||||
int16_t* out_data) = 0;
|
||||
|
||||
// Encoding and decode an audio of |audio_duration| (in seconds) and
|
||||
|
Reference in New Issue
Block a user