ref: 6f85cc664864a8692e83734cce7b9f41a10eb180
parent: 0999a2a24e9a63a0e0d323ed4fef412ce1abd69e
parent: c147cf3d3b3042f8c7d1252c934a9336551b7cd1
author: hkuang <[email protected]>
date: Fri Jul 11 12:09:41 EDT 2014
Merge "Add unit test to test tile decoding error handling."
--- a/test/decode_test_driver.cc
+++ b/test/decode_test_driver.cc
@@ -39,8 +39,8 @@
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 @@
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
--- a/test/decode_test_driver.h
+++ b/test/decode_test_driver.h
@@ -119,6 +119,8 @@
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,
--- 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<int, const char *> DecodeParam;
+
class InvalidFileTest
: public ::libvpx_test::DecoderTest,
- public ::libvpx_test::CodecTestWithParam<const char*> {
+ public ::libvpx_test::CodecTestWithParam<DecodeParam> {
protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
@@ -66,8 +70,11 @@
};
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 @@
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<int>(sizeof(x) / sizeof(x[0]))
+INSTANTIATE_TEST_CASE_P(
+ VP9, InvalidFileTest,
+ ::testing::Combine(
+ ::testing::Values(
+ static_cast<const libvpx_test::CodecFactory*>(&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<const libvpx_test::CodecFactory*>(&libvpx_test::kVP9)),
+ ::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));
} // namespace
--- a/test/test-data.sha1
+++ b/test/test-data.sha1
@@ -663,3 +663,11 @@
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
--- a/test/test.mk
+++ b/test/test.mk
@@ -777,12 +777,12 @@
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
@@ -789,6 +789,8 @@
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
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -858,6 +858,7 @@
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 @@
} 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)