Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: source/libvpx/test/y4m_test.cc

Issue 394353005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/test/vp9_subtract_test.cc ('k') | source/libvpx/tools_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/test/y4m_test.cc
===================================================================
--- source/libvpx/test/y4m_test.cc (revision 284462)
+++ source/libvpx/test/y4m_test.cc (working copy)
@@ -24,14 +24,14 @@
static const unsigned int kHeight = 90;
static const unsigned int kFrames = 10;
-typedef struct {
+struct Y4mTestParam {
const char *filename;
unsigned int bit_depth;
vpx_img_fmt format;
const char *md5raw;
-} test_entry_type;
+};
-const test_entry_type kY4mTestVectors[] = {
+const Y4mTestParam kY4mTestVectors[] = {
{"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,
"e5406275b9fc6bb3436c31d4a05c1cab"},
{"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,
@@ -70,7 +70,7 @@
}
class Y4mVideoSourceTest
- : public ::testing::TestWithParam<test_entry_type>,
+ : public ::testing::TestWithParam<Y4mTestParam>,
public ::libvpx_test::Y4mVideoSource {
protected:
Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
@@ -126,7 +126,7 @@
};
TEST_P(Y4mVideoSourceTest, SourceTest) {
- const test_entry_type t = GetParam();
+ const Y4mTestParam t = GetParam();
Init(t.filename, kFrames);
HeaderChecks(t.bit_depth, t.format);
Md5Check(t.md5raw);
@@ -138,14 +138,11 @@
class Y4mVideoWriteTest
: public Y4mVideoSourceTest {
protected:
- Y4mVideoWriteTest() : Y4mVideoSourceTest() {}
+ Y4mVideoWriteTest() {}
- virtual void ReplaceInputFp(FILE *input_file) {
+ virtual ~Y4mVideoWriteTest() {
CloseSource();
- frame_ = 0;
- input_file_ = input_file;
- rewind(input_file_);
- ReadSourceToStart();
+ delete tmpfile_;
}
// Writes out a y4m file and then reads it back
@@ -153,30 +150,32 @@
ASSERT_TRUE(input_file_ != NULL);
char buf[Y4M_BUFFER_SIZE] = {0};
const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d};
- FILE *out_file = libvpx_test::OpenTempOutFile();
- ASSERT_TRUE(out_file != NULL);
+ tmpfile_ = new libvpx_test::TempOutFile;
+ ASSERT_TRUE(tmpfile_->file() != NULL);
y4m_write_file_header(buf, sizeof(buf),
kWidth, kHeight,
&framerate, y4m_.vpx_fmt,
y4m_.bit_depth);
- fputs(buf, out_file);
+ fputs(buf, tmpfile_->file());
for (unsigned int i = start_; i < limit_; i++) {
y4m_write_frame_header(buf, sizeof(buf));
- fputs(buf, out_file);
- write_image_file(img(), out_file);
+ fputs(buf, tmpfile_->file());
+ write_image_file(img(), tmpfile_->file());
Next();
}
- ReplaceInputFp(out_file);
+ tmpfile_->CloseFile();
+ Y4mVideoSourceTest::Init(tmpfile_->file_name(), limit_);
}
virtual void Init(const std::string &file_name, int limit) {
Y4mVideoSourceTest::Init(file_name, limit);
WriteY4mAndReadBack();
}
+ libvpx_test::TempOutFile *tmpfile_;
};
TEST_P(Y4mVideoWriteTest, WriteTest) {
- const test_entry_type t = GetParam();
+ const Y4mTestParam t = GetParam();
Init(t.filename, kFrames);
HeaderChecks(t.bit_depth, t.format);
Md5Check(t.md5raw);
« no previous file with comments | « source/libvpx/test/vp9_subtract_test.cc ('k') | source/libvpx/tools_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698