// 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.
#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.
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
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
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:
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];
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.
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.
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,
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,