OLD | NEW |
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 #include <climits> | 10 #include <climits> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 encoder->Control(VP8E_SET_SCALEMODE, &mode); | 204 encoder->Control(VP8E_SET_SCALEMODE, &mode); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { | 208 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { |
209 if (!frame0_psnr_) | 209 if (!frame0_psnr_) |
210 frame0_psnr_ = pkt->data.psnr.psnr[0]; | 210 frame0_psnr_ = pkt->data.psnr.psnr[0]; |
211 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); | 211 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); |
212 } | 212 } |
213 | 213 |
| 214 #if WRITE_COMPRESSED_STREAM |
214 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { | 215 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { |
215 #if WRITE_COMPRESSED_STREAM | |
216 ++out_frames_; | 216 ++out_frames_; |
217 | 217 |
218 // Write initial file header if first frame. | 218 // Write initial file header if first frame. |
219 if (pkt->data.frame.pts == 0) | 219 if (pkt->data.frame.pts == 0) |
220 write_ivf_file_header(&cfg_, 0, outfile_); | 220 write_ivf_file_header(&cfg_, 0, outfile_); |
221 | 221 |
222 // Write frame header and data. | 222 // Write frame header and data. |
223 write_ivf_frame_header(pkt, outfile_); | 223 write_ivf_frame_header(pkt, outfile_); |
224 (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_); | 224 (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_); |
| 225 } |
225 #endif | 226 #endif |
226 } | |
227 | 227 |
228 double frame0_psnr_; | 228 double frame0_psnr_; |
229 #if WRITE_COMPRESSED_STREAM | 229 #if WRITE_COMPRESSED_STREAM |
230 FILE *outfile_; | 230 FILE *outfile_; |
231 unsigned int out_frames_; | 231 unsigned int out_frames_; |
232 #endif | 232 #endif |
233 }; | 233 }; |
234 | 234 |
235 TEST_P(ResizeInternalTest, TestInternalResizeWorks) { | 235 TEST_P(ResizeInternalTest, TestInternalResizeWorks) { |
236 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 236 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
(...skipping 20 matching lines...) Expand all Loading... |
257 EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width"; | 257 EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width"; |
258 EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height"; | 258 EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height"; |
259 } | 259 } |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES); | 263 VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES); |
264 VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest, | 264 VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest, |
265 ::testing::Values(::libvpx_test::kOnePassBest)); | 265 ::testing::Values(::libvpx_test::kOnePassBest)); |
266 } // namespace | 266 } // namespace |
OLD | NEW |