test/: apply clang-format
Change-Id: I1138fbeff5f63beb5c0de2c357793da12502d453
diff --git a/test/video_source.h b/test/video_source.h
index ade323e..94a95ce 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -51,7 +51,7 @@
#undef TO_STRING
#undef STRINGIFY
-inline FILE *OpenTestDataFile(const std::string& file_name) {
+inline FILE *OpenTestDataFile(const std::string &file_name) {
const std::string path_to_source = GetDataPath() + "/" + file_name;
return fopen(path_to_source.c_str(), "rb");
}
@@ -76,21 +76,15 @@
class TempOutFile {
public:
- TempOutFile() {
- file_ = GetTempOutFile(&file_name_);
- }
+ TempOutFile() { file_ = GetTempOutFile(&file_name_); }
~TempOutFile() {
CloseFile();
if (!file_name_.empty()) {
EXPECT_EQ(0, remove(file_name_.c_str()));
}
}
- FILE *file() {
- return file_;
- }
- const std::string& file_name() {
- return file_name_;
- }
+ FILE *file() { return file_; }
+ const std::string &file_name() { return file_name_; }
protected:
void CloseFile() {
@@ -134,14 +128,10 @@
virtual unsigned int limit() const = 0;
};
-
class DummyVideoSource : public VideoSource {
public:
DummyVideoSource()
- : img_(NULL),
- limit_(100),
- width_(80),
- height_(64),
+ : img_(NULL), limit_(100), width_(80), height_(64),
format_(VPX_IMG_FMT_I420) {
ReallocImage();
}
@@ -158,9 +148,7 @@
FillFrame();
}
- virtual vpx_image_t *img() const {
- return (frame_ < limit_) ? img_ : NULL;
- }
+ virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
// Models a stream where Timebase = 1/FPS, so pts == frame.
virtual vpx_codec_pts_t pts() const { return frame_; }
@@ -168,7 +156,7 @@
virtual unsigned long duration() const { return 1; }
virtual vpx_rational_t timebase() const {
- const vpx_rational_t t = {1, 30};
+ const vpx_rational_t t = { 1, 30 };
return t;
}
@@ -176,9 +164,7 @@
virtual unsigned int limit() const { return limit_; }
- void set_limit(unsigned int limit) {
- limit_ = limit;
- }
+ void set_limit(unsigned int limit) { limit_ = limit; }
void SetSize(unsigned int width, unsigned int height) {
if (width != width_ || height != height_) {
@@ -196,7 +182,9 @@
}
protected:
- virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); }
+ virtual void FillFrame() {
+ if (img_) memset(img_->img_data, 0, raw_sz_);
+ }
void ReallocImage() {
vpx_img_free(img_);
@@ -205,7 +193,7 @@
}
vpx_image_t *img_;
- size_t raw_sz_;
+ size_t raw_sz_;
unsigned int limit_;
unsigned int frame_;
unsigned int width_;
@@ -213,12 +201,10 @@
vpx_img_fmt_t format_;
};
-
class RandomVideoSource : public DummyVideoSource {
public:
RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
- : rnd_(seed),
- seed_(seed) { }
+ : rnd_(seed), seed_(seed) {}
protected:
// Reset the RNG to get a matching stream for the second pass
@@ -233,8 +219,7 @@
virtual void FillFrame() {
if (img_) {
if (frame_ % 30 < 15)
- for (size_t i = 0; i < raw_sz_; ++i)
- img_->img_data[i] = rnd_.Rand8();
+ for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
else
memset(img_->img_data, 0, raw_sz_);
}