Commit 299f1893 authored by Benjamin Shaya's avatar Benjamin Shaya Committed by Commit Bot

Ensure PostProcessors operate on 16-byte aligned data.

Bug: 112417422
Test: cast_audio_backend_unittests

Change-Id: Iaf52c3ca4c09ab8290e1ddb165ead94d7fb59f63
Reviewed-on: https://chromium-review.googlesource.com/c/1347690Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Commit-Queue: Benjamin Shaya <bshaya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610903}
parent 5ad4c5de
...@@ -26,6 +26,7 @@ cast_source_set("key_systems") { ...@@ -26,6 +26,7 @@ cast_source_set("key_systems") {
cast_source_set("base") { cast_source_set("base") {
sources = [ sources = [
"aligned_buffer.h",
"audio_device_ids.cc", "audio_device_ids.cc",
"audio_device_ids.h", "audio_device_ids.h",
"decrypt_context_impl.cc", "decrypt_context_impl.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_MEDIA_BASE_ALIGNED_BUFFER_H_
#define CHROMECAST_MEDIA_BASE_ALIGNED_BUFFER_H_
#include <algorithm>
#include <memory>
#include "base/memory/aligned_memory.h"
namespace {
const int kAlignment = 16;
} // namespace
namespace chromecast {
namespace media {
// Convenient class for 16-byte aligned buffers.
template <typename T>
class AlignedBuffer {
public:
AlignedBuffer() : size_(0), data_(nullptr) {}
explicit AlignedBuffer(size_t size)
: size_(size),
data_(static_cast<T*>(
base::AlignedAlloc(size_ * sizeof(T), kAlignment))) {}
AlignedBuffer(int size, const T& val) : AlignedBuffer(size) {}
// Copy constructor
AlignedBuffer(const AlignedBuffer& other)
: size_(other.size()),
data_(static_cast<T*>(
base::AlignedAlloc(size_ * sizeof(T), kAlignment))) {
std::memcpy(data_.get(), other.data(), size_ * sizeof(T));
}
~AlignedBuffer() = default;
// Assignment operator
void operator=(const AlignedBuffer& other) {
size_ = other.size();
data_.reset(
static_cast<T*>(base::AlignedAlloc(size_ * sizeof(T), kAlignment)));
std::memcpy(data_.get(), other.data(), size_ * sizeof(T));
}
// Move operator
AlignedBuffer& operator=(AlignedBuffer&& other) {
size_ = other.size();
data_ = std::move(other.data_);
return *this;
}
void resize(size_t new_size) {
std::unique_ptr<T, base::AlignedFreeDeleter> new_data(
static_cast<T*>(base::AlignedAlloc(new_size * sizeof(T), kAlignment)));
size_t size_to_copy = std::min(new_size, size_);
std::memcpy(new_data.get(), data_.get(), size_to_copy * sizeof(T));
size_ = new_size;
data_ = std::move(new_data);
}
void assign(size_t n, const T& val) {
size_ = n;
data_.reset(
static_cast<T*>(base::AlignedAlloc(size_ * sizeof(T), kAlignment)));
std::fill_n(data_.get(), size_, val);
}
// Returns a pointer to the underlying data.
T* data() { return data_.get(); }
const T* data() const { return data_.get(); }
T& operator[](size_t i) { return data()[i]; }
const T& operator[](size_t i) const { return data()[i]; }
// Returns number of elements.
size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
private:
size_t size_;
std::unique_ptr<T, base::AlignedFreeDeleter> data_;
};
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_BASE_ALIGNED_BUFFER_H_
...@@ -83,14 +83,13 @@ cast_source_set("saturated_gain") { ...@@ -83,14 +83,13 @@ cast_source_set("saturated_gain") {
cast_source_set("test_support") { cast_source_set("test_support") {
testonly = true testonly = true
sources = [ sources = [
"post_processor_benchmark.cc",
"post_processor_benchmark.h",
"post_processor_unittest.cc", "post_processor_unittest.cc",
"post_processor_unittest.h", "post_processor_unittest.h",
] ]
deps = [ deps = [
":post_processor_wrapper", ":post_processor_wrapper",
"//base", "//base",
"//chromecast/media/base",
"//chromecast/public/media", "//chromecast/public/media",
"//testing/gtest", "//testing/gtest",
] ]
...@@ -108,6 +107,7 @@ cast_source_set("unittests") { ...@@ -108,6 +107,7 @@ cast_source_set("unittests") {
":saturated_gain", ":saturated_gain",
":test_support", ":test_support",
"//base", "//base",
"//chromecast/media/base",
"//chromecast/public", "//chromecast/public",
"//chromecast/public/media", "//chromecast/public/media",
"//testing/gtest:gtest", "//testing/gtest:gtest",
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chromecast/media/base/aligned_buffer.h"
#include "chromecast/media/cma/backend/post_processors/governor.h" #include "chromecast/media/cma/backend/post_processors/governor.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_benchmark.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h" #include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -43,19 +43,21 @@ void ScaleData(float* data, int frames, float scale) { ...@@ -43,19 +43,21 @@ void ScaleData(float* data, int frames, float scale) {
class GovernorTest : public ::testing::TestWithParam<float> { class GovernorTest : public ::testing::TestWithParam<float> {
protected: protected:
GovernorTest() = default; GovernorTest()
: clamp_(kDefaultClamp),
onset_volume_(GetParam()),
governor_(
std::make_unique<Governor>(MakeConfigString(onset_volume_, clamp_),
kNumChannels)),
data_(LinearChirp(kNumFrames,
std::vector<double>(kNumChannels, 0.0),
std::vector<double>(kNumChannels, 1.0))),
expected_(data_) {}
~GovernorTest() = default; ~GovernorTest() = default;
void SetUp() override { void SetUp() override {
clamp_ = kDefaultClamp;
onset_volume_ = GetParam();
std::string config = MakeConfigString(onset_volume_, clamp_);
governor_ = std::make_unique<Governor>(config, kNumChannels);
governor_->SetSlewTimeMsForTest(0); governor_->SetSlewTimeMsForTest(0);
governor_->SetSampleRate(kSampleRate); governor_->SetSampleRate(kSampleRate);
data_ = LinearChirp(kNumFrames, std::vector<double>(kNumChannels, 0.0),
std::vector<double>(kNumChannels, 1.0));
expected_ = data_;
} }
void ProcessFrames(float volume) { void ProcessFrames(float volume) {
...@@ -69,8 +71,8 @@ class GovernorTest : public ::testing::TestWithParam<float> { ...@@ -69,8 +71,8 @@ class GovernorTest : public ::testing::TestWithParam<float> {
float clamp_; float clamp_;
float onset_volume_; float onset_volume_;
std::unique_ptr<Governor> governor_; std::unique_ptr<Governor> governor_;
std::vector<float> data_; AlignedBuffer<float> data_;
std::vector<float> expected_; AlignedBuffer<float> expected_;
private: private:
DISALLOW_COPY_AND_ASSIGN(GovernorTest); DISALLOW_COPY_AND_ASSIGN(GovernorTest);
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/media/cma/backend/post_processors/post_processor_benchmark.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_wrapper.h"
#include <cmath>
#include <ctime>
#include "base/logging.h"
namespace chromecast {
namespace media {
namespace post_processor_test {
namespace {
const float kTestDurationSec = 1.0;
const int kBlockSizeFrames = 256;
} // namespace
void AudioProcessorBenchmark(AudioPostProcessor2* pp,
int sample_rate,
int num_input_channels) {
int test_size_frames = kTestDurationSec * sample_rate;
// Make test_size multiple of kBlockSizeFrames and calculate effective
// duration.
test_size_frames -= test_size_frames % kBlockSizeFrames;
float effective_duration = static_cast<float>(test_size_frames) / sample_rate;
std::vector<float> data_in = LinearChirp(
test_size_frames, std::vector<double>(num_input_channels, 0.0),
std::vector<double>(num_input_channels, 1.0));
clock_t start_clock = clock();
for (int i = 0; i < test_size_frames; i += kBlockSizeFrames * kNumChannels) {
pp->ProcessFrames(&data_in[i], kBlockSizeFrames, 1.0, 0.0);
}
clock_t stop_clock = clock();
LOG(INFO) << "At " << sample_rate
<< " frames per second CPU usage: " << std::defaultfloat
<< 100.0 * (stop_clock - start_clock) /
(CLOCKS_PER_SEC * effective_duration)
<< "%";
}
void AudioProcessorBenchmark(AudioPostProcessor* pp, int sample_rate) {
AudioPostProcessorWrapper wrapper(pp, kNumChannels);
AudioProcessorBenchmark(&wrapper, sample_rate, kNumChannels);
}
} // namespace post_processor_test
} // namespace media
} // namespace chromecast
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_BENCHMARK_H
#define CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_BENCHMARK_H
#include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
#include "chromecast/public/media/audio_post_processor_shlib.h"
namespace chromecast {
namespace media {
namespace post_processor_test {
// Measure amount of CPU time |pp| takes to run [x] seconds of stereo audio at
// |sample_rate|.
void AudioProcessorBenchmark(AudioPostProcessor2* pp,
int sample_rate,
int num_input_channels = kNumChannels);
void AudioProcessorBenchmark(AudioPostProcessor* pp, int sample_rate);
} // namespace post_processor_test
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_BENCHMARK_H
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
#include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h" #include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_wrapper.h" #include "chromecast/media/cma/backend/post_processors/post_processor_wrapper.h"
#include <time.h>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstdlib>
#include <cstring> #include <cstring>
#include <limits> #include <limits>
...@@ -19,15 +22,19 @@ namespace { ...@@ -19,15 +22,19 @@ namespace {
const float kEpsilon = std::numeric_limits<float>::epsilon(); const float kEpsilon = std::numeric_limits<float>::epsilon();
// Benchmark parameters.
const float kTestDurationSec = 1.0;
const int kBlockSizeFrames = 256;
} // namespace } // namespace
namespace post_processor_test { namespace post_processor_test {
std::vector<float> LinearChirp(int frames, AlignedBuffer<float> LinearChirp(int frames,
const std::vector<double>& start_frequencies, const std::vector<double>& start_frequencies,
const std::vector<double>& end_frequencies) { const std::vector<double>& end_frequencies) {
DCHECK_EQ(start_frequencies.size(), end_frequencies.size()); DCHECK_EQ(start_frequencies.size(), end_frequencies.size());
std::vector<float> chirp(frames * start_frequencies.size()); AlignedBuffer<float> chirp(frames * start_frequencies.size());
for (size_t ch = 0; ch < start_frequencies.size(); ++ch) { for (size_t ch = 0; ch < start_frequencies.size(); ++ch) {
double angle = 0.0; double angle = 0.0;
for (int f = 0; f < frames; ++f) { for (int f = 0; f < frames; ++f) {
...@@ -40,7 +47,7 @@ std::vector<float> LinearChirp(int frames, ...@@ -40,7 +47,7 @@ std::vector<float> LinearChirp(int frames,
return chirp; return chirp;
} }
std::vector<float> GetStereoChirp(int frames, AlignedBuffer<float> GetStereoChirp(int frames,
float start_frequency_left, float start_frequency_left,
float end_frequency_left, float end_frequency_left,
float start_frequency_right, float start_frequency_right,
...@@ -62,18 +69,18 @@ void TestDelay(AudioPostProcessor2* pp, ...@@ -62,18 +69,18 @@ void TestDelay(AudioPostProcessor2* pp,
const int num_output_channels = pp->NumOutputChannels(); const int num_output_channels = pp->NumOutputChannels();
const int test_size_frames = kBufSizeFrames * 100; const int test_size_frames = kBufSizeFrames * 100;
std::vector<float> data_in = LinearChirp( AlignedBuffer<float> data_in = LinearChirp(
test_size_frames, std::vector<double>(num_input_channels, 0.0), test_size_frames, std::vector<double>(num_input_channels, 0.0),
std::vector<double>(num_input_channels, 1.0)); std::vector<double>(num_input_channels, 1.0));
const std::vector<float> data_copy = data_in; AlignedBuffer<float> data_copy = data_in;
std::vector<float> data_out(data_in.size()); AlignedBuffer<float> data_out(data_in.size());
int expected_delay; int expected_delay;
for (int i = 0; i < test_size_frames; i += kBufSizeFrames) { for (int i = 0; i < test_size_frames; i += kBufSizeFrames) {
expected_delay = pp->ProcessFrames(&data_in[i * num_input_channels], expected_delay = pp->ProcessFrames(&data_in[i * num_input_channels],
kBufSizeFrames, 1.0, 0.0); kBufSizeFrames, 1.0, 0.0);
std::memcpy(&data_out[i * num_output_channels], pp->GetOutputBuffer(), std::memcpy(&data_out[i * num_output_channels], pp->GetOutputBuffer(),
kBufSizeFrames * sizeof(data_out[0])); kBufSizeFrames * num_output_channels * sizeof(data_out[0]));
} }
double max_sum = 0; double max_sum = 0;
...@@ -109,13 +116,17 @@ void TestRingingTime(AudioPostProcessor2* pp, ...@@ -109,13 +116,17 @@ void TestRingingTime(AudioPostProcessor2* pp,
const int kNumFrames = GetMaximumFrames(sample_rate); const int kNumFrames = GetMaximumFrames(sample_rate);
const int kSinFreq = 2000; const int kSinFreq = 2000;
int ringing_time_frames = pp->GetRingingTimeInFrames(); int ringing_time_frames = pp->GetRingingTimeInFrames();
std::vector<float> data;
// Send a second of data to excite the filter. // Send a second of data to excite the filter.
for (int i = 0; i < sample_rate; i += kNumFrames) { for (int i = 0; i < sample_rate; i += kNumFrames) {
data = GetSineData(kNumFrames, kSinFreq, sample_rate, num_input_channels); AlignedBuffer<float> data =
GetSineData(kNumFrames, kSinFreq, sample_rate, num_input_channels);
pp->ProcessFrames(data.data(), kNumFrames, 1.0, 0.0); pp->ProcessFrames(data.data(), kNumFrames, 1.0, 0.0);
} }
AlignedBuffer<float> data =
GetSineData(kNumFrames, kSinFreq, sample_rate, num_input_channels);
pp->ProcessFrames(data.data(), kNumFrames, 1.0, 0.0);
// Compute the amplitude of the last buffer // Compute the amplitude of the last buffer
float original_amplitude = float original_amplitude =
SineAmplitude(pp->GetOutputBuffer(), num_input_channels * kNumFrames); SineAmplitude(pp->GetOutputBuffer(), num_input_channels * kNumFrames);
...@@ -159,9 +170,9 @@ void TestPassthrough(AudioPostProcessor2* pp, ...@@ -159,9 +170,9 @@ void TestPassthrough(AudioPostProcessor2* pp,
const int kNumFrames = GetMaximumFrames(sample_rate); const int kNumFrames = GetMaximumFrames(sample_rate);
const int kSinFreq = 2000; const int kSinFreq = 2000;
std::vector<float> data = AlignedBuffer<float> data =
GetSineData(kNumFrames, kSinFreq, sample_rate, num_input_channels); GetSineData(kNumFrames, kSinFreq, sample_rate, num_input_channels);
std::vector<float> expected = data; AlignedBuffer<float> expected(data);
int delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0, 0.0); int delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0, 0.0);
int delayed_frames = 0; int delayed_frames = 0;
...@@ -188,6 +199,34 @@ void TestPassthrough(AudioPostProcessor2* pp, ...@@ -188,6 +199,34 @@ void TestPassthrough(AudioPostProcessor2* pp,
data.size() - delay_samples); data.size() - delay_samples);
} }
void AudioProcessorBenchmark(AudioPostProcessor2* pp,
int sample_rate,
int num_input_channels) {
int test_size_frames = kTestDurationSec * sample_rate;
// Make test_size multiple of kBlockSizeFrames and calculate effective
// duration.
test_size_frames -= test_size_frames % kBlockSizeFrames;
float effective_duration = static_cast<float>(test_size_frames) / sample_rate;
AlignedBuffer<float> data_in = LinearChirp(
test_size_frames, std::vector<double>(num_input_channels, 0.0),
std::vector<double>(num_input_channels, 1.0));
clock_t start_clock = clock();
for (int i = 0; i < test_size_frames; i += kBlockSizeFrames * kNumChannels) {
pp->ProcessFrames(&data_in[i], kBlockSizeFrames, 1.0, 0.0);
}
clock_t stop_clock = clock();
LOG(INFO) << "At " << sample_rate
<< " frames per second CPU usage: " << std::defaultfloat
<< 100.0 * (stop_clock - start_clock) /
(CLOCKS_PER_SEC * effective_duration)
<< "%";
}
void AudioProcessorBenchmark(AudioPostProcessor* pp, int sample_rate) {
AudioPostProcessorWrapper wrapper(pp, kNumChannels);
AudioProcessorBenchmark(&wrapper, sample_rate, kNumChannels);
}
int GetMaximumFrames(int sample_rate) { int GetMaximumFrames(int sample_rate) {
return kMaxAudioWriteTimeMilliseconds * sample_rate / 1000; return kMaxAudioWriteTimeMilliseconds * sample_rate / 1000;
} }
...@@ -236,15 +275,15 @@ float SineAmplitude(const float* data, int num_frames) { ...@@ -236,15 +275,15 @@ float SineAmplitude(const float* data, int num_frames) {
return std::sqrt(power / num_frames) * sqrt(2); return std::sqrt(power / num_frames) * sqrt(2);
} }
std::vector<float> GetSineData(int frames, AlignedBuffer<float> GetSineData(int frames,
float frequency, float frequency,
int sample_rate, int sample_rate,
int num_channels) { int num_channels) {
std::vector<float> sine(frames * num_channels); AlignedBuffer<float> sine(frames * num_channels);
for (int f = 0; f < frames; ++f) { for (int f = 0; f < frames; ++f) {
for (int ch = 0; ch < num_channels; ++ch) { for (int ch = 0; ch < num_channels; ++ch) {
// Offset by a little so that first value is non-zero // Offset by a little so that first value is non-zero
sine[f + ch * num_channels] = sine[f * num_channels + ch] =
sin(static_cast<double>(f + ch) * frequency * 2 * M_PI / sample_rate); sin(static_cast<double>(f + ch) * frequency * 2 * M_PI / sample_rate);
} }
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <vector> #include <vector>
#include "chromecast/media/base/aligned_buffer.h"
#include "chromecast/public/media/audio_post_processor2_shlib.h" #include "chromecast/public/media/audio_post_processor2_shlib.h"
#include "chromecast/public/media/audio_post_processor_shlib.h" #include "chromecast/public/media/audio_post_processor_shlib.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -54,6 +55,13 @@ void TestDelay(AudioPostProcessor* pp, int sample_rate); ...@@ -54,6 +55,13 @@ void TestDelay(AudioPostProcessor* pp, int sample_rate);
void TestRingingTime(AudioPostProcessor* pp, int sample_rate); void TestRingingTime(AudioPostProcessor* pp, int sample_rate);
void TestPassthrough(AudioPostProcessor* pp, int sample_rate); void TestPassthrough(AudioPostProcessor* pp, int sample_rate);
// Measure amount of CPU time |pp| takes to run [x] seconds of stereo audio at
// |sample_rate|.
void AudioProcessorBenchmark(AudioPostProcessor2* pp,
int sample_rate,
int num_input_channels = kNumChannels);
void AudioProcessorBenchmark(AudioPostProcessor* pp, int sample_rate);
// Returns the maximum number of frames a PostProcessor may be asked to handle // Returns the maximum number of frames a PostProcessor may be asked to handle
// in a single call. // in a single call.
int GetMaximumFrames(int sample_rate); int GetMaximumFrames(int sample_rate);
...@@ -77,7 +85,7 @@ float SineAmplitude(const float* data, int num_samples); ...@@ -77,7 +85,7 @@ float SineAmplitude(const float* data, int num_samples);
// Return a vector of |frames| frames of |num_channels| interleaved data. // Return a vector of |frames| frames of |num_channels| interleaved data.
// |frequency| is in hz. // |frequency| is in hz.
// Each channel, ch, will be sin(2 *pi * frequency / sample_rate * (n + ch)). // Each channel, ch, will be sin(2 *pi * frequency / sample_rate * (n + ch)).
std::vector<float> GetSineData(int frames, AlignedBuffer<float> GetSineData(int frames,
float frequency, float frequency,
int sample_rate, int sample_rate,
int num_channels = kNumChannels); int num_channels = kNumChannels);
...@@ -89,7 +97,7 @@ std::vector<float> GetSineData(int frames, ...@@ -89,7 +97,7 @@ std::vector<float> GetSineData(int frames,
// |start_frequencies[ch]| to |end_frequencies[ch]| // |start_frequencies[ch]| to |end_frequencies[ch]|
// Frequencies are normalized to (2 * freq_in_hz / sample_rate); 0 = DC, 1 = // Frequencies are normalized to (2 * freq_in_hz / sample_rate); 0 = DC, 1 =
// nyquist. // nyquist.
std::vector<float> LinearChirp(int frames, AlignedBuffer<float> LinearChirp(int frames,
const std::vector<double>& start_frequencies, const std::vector<double>& start_frequencies,
const std::vector<double>& end_frequencies); const std::vector<double>& end_frequencies);
...@@ -101,7 +109,7 @@ std::vector<float> LinearChirp(int frames, ...@@ -101,7 +109,7 @@ std::vector<float> LinearChirp(int frames,
// Equivalent to LinearChirp(frames, // Equivalent to LinearChirp(frames,
// {start_frequency_left, start_frequency_right}, // {start_frequency_left, start_frequency_right},
// {end_frequency_left, end_frequency_right}) // {end_frequency_left, end_frequency_right})
std::vector<float> GetStereoChirp(int frames, AlignedBuffer<float> GetStereoChirp(int frames,
float start_frequency_left, float start_frequency_left,
float end_frequency_left, float end_frequency_left,
float start_frequency_right, float start_frequency_right,
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <vector> #include <vector>
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_benchmark.h"
#include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h" #include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
#include "chromecast/media/cma/backend/post_processors/saturated_gain.h" #include "chromecast/media/cma/backend/post_processors/saturated_gain.h"
...@@ -49,8 +48,7 @@ TEST_P(PostProcessorTest, Gain) { ...@@ -49,8 +48,7 @@ TEST_P(PostProcessorTest, Gain) {
const int kNumFrames = 256; const int kNumFrames = 256;
std::string config = MakeConfigString(20.0); // Exactly 10x multiplier. std::string config = MakeConfigString(20.0); // Exactly 10x multiplier.
auto pp = std::make_unique<SaturatedGain>(config, kNumChannels); auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
std::vector<float> data = auto data = LinearChirp(kNumFrames, std::vector<double>(kNumChannels, 0.0),
LinearChirp(kNumFrames, std::vector<double>(kNumChannels, 0.0),
std::vector<double>(kNumChannels, 1.0)); std::vector<double>(kNumChannels, 1.0));
for (size_t i = 0; i < data.size(); ++i) { for (size_t i = 0; i < data.size(); ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment