diff --git a/test/decode_test_driver.cc b/test/decode_test_driver.cc index 187a1c7cf..a762b036e 100644 --- a/test/decode_test_driver.cc +++ b/test/decode_test_driver.cc @@ -39,8 +39,8 @@ vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size, return res_dec; } -void DecoderTest::RunLoop(CompressedVideoSource *video) { - vpx_codec_dec_cfg_t dec_cfg = {0}; +void DecoderTest::RunLoop(CompressedVideoSource *video, + const vpx_codec_dec_cfg_t &dec_cfg) { Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0); ASSERT_TRUE(decoder != NULL); const char *codec_name = decoder->GetDecoderName(); @@ -82,7 +82,12 @@ void DecoderTest::RunLoop(CompressedVideoSource *video) { while ((img = dec_iter.Next())) DecompressedFrameHook(*img, video->frame_number()); } - delete decoder; } + +void DecoderTest::RunLoop(CompressedVideoSource *video) { + vpx_codec_dec_cfg_t dec_cfg = {0}; + RunLoop(video, dec_cfg); +} + } // namespace libvpx_test diff --git a/test/decode_test_driver.h b/test/decode_test_driver.h index dd3593e1e..a3cfd3f52 100644 --- a/test/decode_test_driver.h +++ b/test/decode_test_driver.h @@ -119,6 +119,8 @@ class DecoderTest { public: // Main decoding loop virtual void RunLoop(CompressedVideoSource *video); + virtual void RunLoop(CompressedVideoSource *video, + const vpx_codec_dec_cfg_t &dec_cfg); // Hook to be called before decompressing every frame. virtual void PreDecodeFrameHook(const CompressedVideoSource& video, diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc index 63c7941b6..d260b86c1 100644 --- a/test/invalid_file_test.cc +++ b/test/invalid_file_test.cc @@ -25,9 +25,13 @@ namespace { +using std::tr1::make_tuple; + +typedef std::tr1::tuple DecodeParam; + class InvalidFileTest : public ::libvpx_test::DecoderTest, - public ::libvpx_test::CodecTestWithParam { + public ::libvpx_test::CodecTestWithParam { protected: InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {} @@ -66,8 +70,11 @@ class InvalidFileTest }; TEST_P(InvalidFileTest, ReturnCode) { - const std::string filename = GET_PARAM(1); libvpx_test::CompressedVideoSource *video = NULL; + const DecodeParam input = GET_PARAM(1); + vpx_codec_dec_cfg_t cfg = {0}; + cfg.threads = std::tr1::get<0>(input); + const std::string filename = std::tr1::get<1>(input); // Open compressed video file. if (filename.substr(filename.length() - 3, 3) == "ivf") { @@ -90,24 +97,35 @@ TEST_P(InvalidFileTest, ReturnCode) { OpenResFile(res_filename); // Decode frame, and check the md5 matching. - ASSERT_NO_FATAL_FAILURE(RunLoop(video)); + ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg)); delete video; } const char *const kVP9InvalidFileTests[] = { - "invalid-vp90-01.webm", - "invalid-vp90-02.webm", + "invalid-vp90-01-v2.webm", + "invalid-vp90-02-v2.webm", "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.ivf", - "invalid-vp90-03.webm", + "invalid-vp90-03-v2.webm", "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf", "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf", }; -#define NELEMENTS(x) static_cast(sizeof(x) / sizeof(x[0])) +INSTANTIATE_TEST_CASE_P( + VP9, InvalidFileTest, + ::testing::Combine( + ::testing::Values( + static_cast(&libvpx_test::kVP9)), + ::testing::Combine(::testing::Values(1), + ::testing::ValuesIn(kVP9InvalidFileTests)))); -VP9_INSTANTIATE_TEST_CASE(InvalidFileTest, - ::testing::ValuesIn(kVP9InvalidFileTests, - kVP9InvalidFileTests + - NELEMENTS(kVP9InvalidFileTests))); +const DecodeParam kMultiThreadedVP9InvalidFileTests[] = { + make_tuple(4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm"), +}; +INSTANTIATE_TEST_CASE_P( + VP9MultiThreaded, InvalidFileTest, + ::testing::Combine( + ::testing::Values( + static_cast(&libvpx_test::kVP9)), + ::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests))); } // namespace diff --git a/test/test-data.sha1 b/test/test-data.sha1 index 894002799..d5a116558 100644 --- a/test/test-data.sha1 +++ b/test/test-data.sha1 @@ -663,3 +663,11 @@ d3964f9dad9f60363c81b688324d95b4ec7c8038 invalid-vp90-2-00-quantizer-00.webm.iv 456d1493e52d32a5c30edf44a27debc1fa6b253a invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf.res c123d1f9f02fb4143abb5e271916e3a3080de8f6 invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf 456d1493e52d32a5c30edf44a27debc1fa6b253a invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf.res +fe346136b9b8c1e6f6084cc106485706915795e4 invalid-vp90-01-v2.webm +25751f5d3b05ff03f0719ad42cd625348eb8961e invalid-vp90-01-v2.webm.res +d78e2fceba5ac942246503ec8366f879c4775ca5 invalid-vp90-02-v2.webm +8e2eff4af87d2b561cce2365713269e301457ef3 invalid-vp90-02-v2.webm.res +df1a1453feb3c00d7d89746c7003b4163523bff3 invalid-vp90-03-v2.webm +25dd58c22d23f75304d7ce7f69f4e5b02ef9119a invalid-vp90-03-v2.webm.res +d637297561dd904eb2c97a9015deeb31c4a1e8d2 invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm +3a204bdbeaa3c6458b77bcebb8366d107267f55d invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm.res diff --git a/test/test.mk b/test/test.mk index ef81ab1a8..f624649f0 100644 --- a/test/test.mk +++ b/test/test.mk @@ -777,18 +777,20 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yuv444.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yuv444.webm.md5 # Invalid files for testing libvpx error checking. -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-01.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-01.webm.res -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-02.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-02.webm.res -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-03.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-03.webm.res +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-01-v2.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-01-v2.webm.res +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-02-v2.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-02-v2.webm.res +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-03-v2.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-03-v2.webm.res LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.ivf LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.ivf.res LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf.res LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf.res +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm.res ifeq ($(CONFIG_DECODE_PERF_TESTS),yes) # BBB VP9 streams diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 55d5b4feb..82d0307e0 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -858,6 +858,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, decode_partition(tile_data->cm, &tile_data->xd, &tile, mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64); } + pbi->mb.corrupted |= tile_data->xd.corrupted; } // Loopfilter one row. if (cm->lf.filter_level) { @@ -1411,6 +1412,9 @@ void vp9_decode_frame(VP9Decoder *pbi, } else { debug_check_frame_counts(cm); } + } else { + vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, + "Decode failed. Frame data is corrupted."); } if (cm->refresh_frame_context)