Merge changes I1d3edbdb,I8b49fd05
* changes: tests: use scoped_ptr for local video source vars y4m_test: init members in the constructor
This commit is contained in:
commit
4916a87bfc
@ -350,7 +350,6 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
// Otherwise, the test failed.
|
||||
TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
|
||||
const std::string filename = GET_PARAM(kVideoNameParam);
|
||||
libvpx_test::CompressedVideoSource *video = NULL;
|
||||
|
||||
// Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
|
||||
// #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
|
||||
@ -365,18 +364,19 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
|
||||
#endif
|
||||
|
||||
// Open compressed video file.
|
||||
testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video = new libvpx_test::IVFVideoSource(filename);
|
||||
video.reset(new libvpx_test::IVFVideoSource(filename));
|
||||
} else {
|
||||
#if CONFIG_WEBM_IO
|
||||
video = new libvpx_test::WebMVideoSource(filename);
|
||||
video.reset(new libvpx_test::WebMVideoSource(filename));
|
||||
#else
|
||||
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
ASSERT_TRUE(video != NULL);
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
video->Init();
|
||||
|
||||
// Construct md5 file name.
|
||||
@ -384,8 +384,7 @@ TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
|
||||
OpenMD5File(md5_filename);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video));
|
||||
delete video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
@ -84,23 +84,24 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
|
||||
|
||||
void RunTest() {
|
||||
const DecodeParam input = GET_PARAM(1);
|
||||
libvpx_test::CompressedVideoSource *video = NULL;
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
cfg.threads = input.threads;
|
||||
const std::string filename = input.filename;
|
||||
|
||||
// Open compressed video file.
|
||||
testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video = new libvpx_test::IVFVideoSource(filename);
|
||||
video.reset(new libvpx_test::IVFVideoSource(filename));
|
||||
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
|
||||
#if CONFIG_WEBM_IO
|
||||
video = new libvpx_test::WebMVideoSource(filename);
|
||||
video.reset(new libvpx_test::WebMVideoSource(filename));
|
||||
#else
|
||||
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
video->Init();
|
||||
|
||||
// Construct result file name. The file holds a list of expected integer
|
||||
@ -110,8 +111,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
|
||||
OpenResFile(res_filename);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
|
||||
delete video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -94,7 +94,6 @@ TEST_P(TestVectorTest, MD5Match) {
|
||||
const std::string filename = std::tr1::get<kFileName>(input);
|
||||
const int threads = std::tr1::get<kThreads>(input);
|
||||
const int mode = std::tr1::get<kDecodeMode>(input);
|
||||
libvpx_test::CompressedVideoSource *video = NULL;
|
||||
vpx_codec_flags_t flags = 0;
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
char str[256];
|
||||
@ -119,17 +118,19 @@ TEST_P(TestVectorTest, MD5Match) {
|
||||
SCOPED_TRACE(str);
|
||||
|
||||
// Open compressed video file.
|
||||
testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video = new libvpx_test::IVFVideoSource(filename);
|
||||
video.reset(new libvpx_test::IVFVideoSource(filename));
|
||||
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
|
||||
#if CONFIG_WEBM_IO
|
||||
video = new libvpx_test::WebMVideoSource(filename);
|
||||
video.reset(new libvpx_test::WebMVideoSource(filename));
|
||||
#else
|
||||
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
video->Init();
|
||||
|
||||
// Construct md5 file name.
|
||||
@ -141,8 +142,7 @@ TEST_P(TestVectorTest, MD5Match) {
|
||||
set_flags(flags);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
|
||||
delete video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
|
||||
}
|
||||
|
||||
// Test VP8 decode in serial mode with single thread.
|
||||
|
@ -140,12 +140,11 @@ class VpxEncoderParmsGetToDecoder
|
||||
TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
|
||||
libvpx_test::VideoSource *const video =
|
||||
new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames);
|
||||
ASSERT_TRUE(video != NULL);
|
||||
testing::internal::scoped_ptr<libvpx_test::VideoSource> video(
|
||||
new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames));
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video));
|
||||
delete video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
|
||||
|
@ -154,20 +154,20 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
|
||||
|
||||
libvpx_test::VideoSource *video;
|
||||
testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
|
||||
if (is_extension_y4m(test_video_param_.filename)) {
|
||||
video =
|
||||
new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0, kFrames);
|
||||
video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
kFrames));
|
||||
} else {
|
||||
video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
|
||||
test_video_param_.fmt, kWidth,
|
||||
kHeight, kFramerate, 1, 0, kFrames);
|
||||
video.reset(new libvpx_test::YUVVideoSource(
|
||||
test_video_param_.filename, test_video_param_.fmt, kWidth, kHeight,
|
||||
kFramerate, 1, 0, kFrames));
|
||||
}
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video));
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
const double psnr = GetAveragePsnr();
|
||||
EXPECT_GT(psnr, GetPsnrThreshold());
|
||||
delete (video);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,
|
||||
|
@ -138,7 +138,7 @@ INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,
|
||||
|
||||
class Y4mVideoWriteTest : public Y4mVideoSourceTest {
|
||||
protected:
|
||||
Y4mVideoWriteTest() {}
|
||||
Y4mVideoWriteTest() : tmpfile_(NULL) {}
|
||||
|
||||
virtual ~Y4mVideoWriteTest() {
|
||||
delete tmpfile_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user