summaryrefslogtreecommitdiff
path: root/test/video_source.h
diff options
context:
space:
mode:
authorclang-format <noreply@google.com>2016-07-25 22:50:48 -0700
committerJames Zern <jzern@google.com>2016-07-27 01:58:52 +0000
commit33e40cb5db12309b69ef40e84b2ed522a54da09e (patch)
treed9772b1e118a04162b551bdfd53233725a916ab5 /test/video_source.h
parente4290800b21478a3f9548c58b4f15c5ba5393073 (diff)
downloadlibvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.gz
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.bz2
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.zip
test: apply clang-format
Change-Id: I0d9ab85855eb723f653a7bb09b3d0d31dd6cfd2f
Diffstat (limited to 'test/video_source.h')
-rw-r--r--test/video_source.h43
1 files changed, 14 insertions, 29 deletions
diff --git a/test/video_source.h b/test/video_source.h
index ade323e7c..94a95ce8d 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -51,7 +51,7 @@ static std::string GetDataPath() {
#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 @@ static FILE *GetTempOutFile(std::string *file_name) {
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 @@ class VideoSource {
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 @@ class DummyVideoSource : public VideoSource {
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 @@ class DummyVideoSource : public VideoSource {
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 @@ class DummyVideoSource : public VideoSource {
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 @@ class DummyVideoSource : public VideoSource {
}
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 @@ class DummyVideoSource : public VideoSource {
}
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 @@ class DummyVideoSource : public VideoSource {
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 @@ class RandomVideoSource : public DummyVideoSource {
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_);
}