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

Side by Side Diff: source/libvpx/test/y4m_test.cc

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/vpxenc.sh ('k') | source/libvpx/third_party/libwebm/PATENTS.TXT » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest, 135 INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,
136 ::testing::ValuesIn(kY4mTestVectors)); 136 ::testing::ValuesIn(kY4mTestVectors));
137 137
138 class Y4mVideoWriteTest 138 class Y4mVideoWriteTest
139 : public Y4mVideoSourceTest { 139 : public Y4mVideoSourceTest {
140 protected: 140 protected:
141 Y4mVideoWriteTest() {} 141 Y4mVideoWriteTest() {}
142 142
143 virtual ~Y4mVideoWriteTest() { 143 virtual ~Y4mVideoWriteTest() {
144 delete tmpfile_;
145 input_file_ = NULL;
146 }
147
148 void ReplaceInputFile(FILE *input_file) {
144 CloseSource(); 149 CloseSource();
145 delete tmpfile_; 150 frame_ = 0;
151 input_file_ = input_file;
152 rewind(input_file_);
153 ReadSourceToStart();
146 } 154 }
147 155
148 // Writes out a y4m file and then reads it back 156 // Writes out a y4m file and then reads it back
149 void WriteY4mAndReadBack() { 157 void WriteY4mAndReadBack() {
150 ASSERT_TRUE(input_file_ != NULL); 158 ASSERT_TRUE(input_file_ != NULL);
151 char buf[Y4M_BUFFER_SIZE] = {0}; 159 char buf[Y4M_BUFFER_SIZE] = {0};
152 const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d}; 160 const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d};
153 tmpfile_ = new libvpx_test::TempOutFile; 161 tmpfile_ = new libvpx_test::TempOutFile;
154 ASSERT_TRUE(tmpfile_->file() != NULL); 162 ASSERT_TRUE(tmpfile_->file() != NULL);
155 y4m_write_file_header(buf, sizeof(buf), 163 y4m_write_file_header(buf, sizeof(buf),
156 kWidth, kHeight, 164 kWidth, kHeight,
157 &framerate, y4m_.vpx_fmt, 165 &framerate, y4m_.vpx_fmt,
158 y4m_.bit_depth); 166 y4m_.bit_depth);
159 fputs(buf, tmpfile_->file()); 167 fputs(buf, tmpfile_->file());
160 for (unsigned int i = start_; i < limit_; i++) { 168 for (unsigned int i = start_; i < limit_; i++) {
161 y4m_write_frame_header(buf, sizeof(buf)); 169 y4m_write_frame_header(buf, sizeof(buf));
162 fputs(buf, tmpfile_->file()); 170 fputs(buf, tmpfile_->file());
163 write_image_file(img(), tmpfile_->file()); 171 write_image_file(img(), tmpfile_->file());
164 Next(); 172 Next();
165 } 173 }
166 tmpfile_->CloseFile(); 174 ReplaceInputFile(tmpfile_->file());
167 Y4mVideoSourceTest::Init(tmpfile_->file_name(), limit_);
168 } 175 }
169 176
170 virtual void Init(const std::string &file_name, int limit) { 177 virtual void Init(const std::string &file_name, int limit) {
171 Y4mVideoSourceTest::Init(file_name, limit); 178 Y4mVideoSourceTest::Init(file_name, limit);
172 WriteY4mAndReadBack(); 179 WriteY4mAndReadBack();
173 } 180 }
174 libvpx_test::TempOutFile *tmpfile_; 181 libvpx_test::TempOutFile *tmpfile_;
175 }; 182 };
176 183
177 TEST_P(Y4mVideoWriteTest, WriteTest) { 184 TEST_P(Y4mVideoWriteTest, WriteTest) {
178 const Y4mTestParam t = GetParam(); 185 const Y4mTestParam t = GetParam();
179 Init(t.filename, kFrames); 186 Init(t.filename, kFrames);
180 HeaderChecks(t.bit_depth, t.format); 187 HeaderChecks(t.bit_depth, t.format);
181 Md5Check(t.md5raw); 188 Md5Check(t.md5raw);
182 } 189 }
183 190
184 INSTANTIATE_TEST_CASE_P(C, Y4mVideoWriteTest, 191 INSTANTIATE_TEST_CASE_P(C, Y4mVideoWriteTest,
185 ::testing::ValuesIn(kY4mTestVectors)); 192 ::testing::ValuesIn(kY4mTestVectors));
186 } // namespace 193 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/vpxenc.sh ('k') | source/libvpx/third_party/libwebm/PATENTS.TXT » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698