From 508ef2a6e377b74ab346bf4d5b4d92ab507d1bd3 Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 26 Jun 2017 19:18:14 -0700 Subject: [PATCH 1/2] test_vector_test: rm ref to VPX_CODEC_USE_FRAME_THREADING this was made a no-op in: 01d23109a vp9: make VPX_CODEC_USE_FRAME_THREADING a no-op and the test hitting this branch has been disabled since: 6ab0870d4 disable VP9MultiThreadedFrameParallel tests rename the test to VP9MultiThreaded to exercise the tile-based threading BUG=webm:1395 Change-Id: I35564a75eb5a7d7f7ccb923133b1b07295201f4c --- test/test_vector_test.cc | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc index 14c509d5c..01b651fdd 100644 --- a/test/test_vector_test.cc +++ b/test/test_vector_test.cc @@ -28,13 +28,10 @@ namespace { -enum DecodeMode { kSerialMode, kFrameParallelMode }; +const int kThreads = 0; +const int kFileName = 1; -const int kDecodeMode = 0; -const int kThreads = 1; -const int kFileName = 2; - -typedef std::tr1::tuple DecodeParam; +typedef std::tr1::tuple DecodeParam; class TestVectorTest : public ::libvpx_test::DecoderTest, public ::libvpx_test::CodecTestWithParam { @@ -92,29 +89,14 @@ class TestVectorTest : public ::libvpx_test::DecoderTest, TEST_P(TestVectorTest, MD5Match) { const DecodeParam input = GET_PARAM(1); const std::string filename = std::tr1::get(input); - const int threads = std::tr1::get(input); - const int mode = std::tr1::get(input); vpx_codec_flags_t flags = 0; vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); char str[256]; - if (mode == kFrameParallelMode) { - flags |= VPX_CODEC_USE_FRAME_THREADING; -#if CONFIG_VP9_DECODER - // TODO(hkuang): Fix frame parallel decode bug. See issue 1086. - if (resize_clips_.find(filename) != resize_clips_.end()) { - printf("Skipping the test file: %s, due to frame parallel decode bug.\n", - filename.c_str()); - return; - } -#endif - } + cfg.threads = std::tr1::get(input); - cfg.threads = threads; - - snprintf(str, sizeof(str) / sizeof(str[0]) - 1, - "file: %s mode: %s threads: %d", filename.c_str(), - mode == 0 ? "Serial" : "Parallel", threads); + snprintf(str, sizeof(str) / sizeof(str[0]) - 1, "file: %s threads: %d", + filename.c_str(), cfg.threads); SCOPED_TRACE(str); // Open compressed video file. @@ -145,13 +127,10 @@ TEST_P(TestVectorTest, MD5Match) { ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg)); } -// Test VP8 decode in serial mode with single thread. -// NOTE: VP8 only support serial mode. #if CONFIG_VP8_DECODER VP8_INSTANTIATE_TEST_CASE( TestVectorTest, ::testing::Combine( - ::testing::Values(0), // Serial Mode. ::testing::Values(1), // Single thread. ::testing::ValuesIn(libvpx_test::kVP8TestVectors, libvpx_test::kVP8TestVectors + @@ -164,7 +143,6 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values( static_cast(&libvpx_test::kVP8)), ::testing::Combine( - ::testing::Values(0), // Serial Mode. ::testing::Range(1, 8), // With 1 ~ 8 threads. ::testing::ValuesIn(libvpx_test::kVP8TestVectors, libvpx_test::kVP8TestVectors + @@ -172,25 +150,21 @@ INSTANTIATE_TEST_CASE_P( #endif // CONFIG_VP8_DECODER -// Test VP9 decode in serial mode with single thread. #if CONFIG_VP9_DECODER VP9_INSTANTIATE_TEST_CASE( TestVectorTest, ::testing::Combine( - ::testing::Values(0), // Serial Mode. ::testing::Values(1), // Single thread. ::testing::ValuesIn(libvpx_test::kVP9TestVectors, libvpx_test::kVP9TestVectors + libvpx_test::kNumVP9TestVectors))); -// Test VP9 decode in frame parallel mode with different number of threads. INSTANTIATE_TEST_CASE_P( - DISABLED_VP9MultiThreadedFrameParallel, TestVectorTest, + VP9MultiThreaded, TestVectorTest, ::testing::Combine( ::testing::Values( static_cast(&libvpx_test::kVP9)), ::testing::Combine( - ::testing::Values(1), // Frame Parallel mode. ::testing::Range(2, 9), // With 2 ~ 8 threads. ::testing::ValuesIn(libvpx_test::kVP9TestVectors, libvpx_test::kVP9TestVectors + From e5bdab98e98a1f0c5148f94addb145725502c88d Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 26 Jun 2017 19:26:22 -0700 Subject: [PATCH 2/2] rm vp9_frame_parallel_test.cc VPX_CODEC_USE_FRAME_THREADING was made a no-op in: 01d23109a vp9: make VPX_CODEC_USE_FRAME_THREADING a no-op and the tests in this file have been disabled since: 6ab0870d4 disable VP9MultiThreadedFrameParallel tests BUG=webm:1395 Change-Id: I2c7a250acb65cf9522cf8a7bb724bb92070e41c6 --- test/test.mk | 1 - test/vp9_frame_parallel_test.cc | 217 -------------------------------- 2 files changed, 218 deletions(-) delete mode 100644 test/vp9_frame_parallel_test.cc diff --git a/test/test.mk b/test/test.mk index 1bae50016..c1b848e43 100644 --- a/test/test.mk +++ b/test/test.mk @@ -39,7 +39,6 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += byte_alignment_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += decode_svc_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_frame_parallel_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_refresh_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc diff --git a/test/vp9_frame_parallel_test.cc b/test/vp9_frame_parallel_test.cc deleted file mode 100644 index 136557720..000000000 --- a/test/vp9_frame_parallel_test.cc +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2014 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include -#include -#include -#include "third_party/googletest/src/include/gtest/gtest.h" -#include "./vpx_config.h" -#include "test/codec_factory.h" -#include "test/decode_test_driver.h" -#include "test/ivf_video_source.h" -#include "test/md5_helper.h" -#include "test/util.h" -#if CONFIG_WEBM_IO -#include "test/webm_video_source.h" -#endif -#include "vpx_mem/vpx_mem.h" - -namespace { - -using std::string; - -#if CONFIG_WEBM_IO - -struct PauseFileList { - const char *name; - // md5 sum for decoded frames which does not include skipped frames. - const char *expected_md5; - const int pause_frame_num; -}; - -// Decodes |filename| with |num_threads|. Pause at the specified frame_num, -// seek to next key frame and then continue decoding until the end. Return -// the md5 of the decoded frames which does not include skipped frames. -string DecodeFileWithPause(const string &filename, int num_threads, - int pause_num) { - libvpx_test::WebMVideoSource video(filename); - video.Init(); - int in_frames = 0; - int out_frames = 0; - - vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); - cfg.threads = num_threads; - vpx_codec_flags_t flags = 0; - flags |= VPX_CODEC_USE_FRAME_THREADING; - libvpx_test::VP9Decoder decoder(cfg, flags); - - libvpx_test::MD5 md5; - video.Begin(); - - do { - ++in_frames; - const vpx_codec_err_t res = - decoder.DecodeFrame(video.cxdata(), video.frame_size()); - if (res != VPX_CODEC_OK) { - EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); - break; - } - - // Pause at specified frame number. - if (in_frames == pause_num) { - // Flush the decoder and then seek to next key frame. - decoder.DecodeFrame(NULL, 0); - video.SeekToNextKeyFrame(); - } else { - video.Next(); - } - - // Flush the decoder at the end of the video. - if (!video.cxdata()) decoder.DecodeFrame(NULL, 0); - - libvpx_test::DxDataIterator dec_iter = decoder.GetDxData(); - const vpx_image_t *img; - - // Get decompressed data - while ((img = dec_iter.Next())) { - ++out_frames; - md5.Add(img); - } - } while (video.cxdata() != NULL); - - EXPECT_EQ(in_frames, out_frames) - << "Input frame count does not match output frame count"; - - return string(md5.Get()); -} - -void DecodeFilesWithPause(const PauseFileList files[]) { - for (const PauseFileList *iter = files; iter->name != NULL; ++iter) { - SCOPED_TRACE(iter->name); - for (int t = 2; t <= 8; ++t) { - EXPECT_EQ(iter->expected_md5, - DecodeFileWithPause(iter->name, t, iter->pause_frame_num)) - << "threads = " << t; - } - } -} - -TEST(DISABLED_VP9MultiThreadedFrameParallel, PauseSeekResume) { - // vp90-2-07-frame_parallel-1.webm is a 40 frame video file with - // one key frame for every ten frames. - static const PauseFileList files[] = { - { "vp90-2-07-frame_parallel-1.webm", "6ea7c3875d67252e7caf2bc6e75b36b1", - 6 }, - { "vp90-2-07-frame_parallel-1.webm", "4bb634160c7356a8d7d4299b6dc83a45", - 12 }, - { "vp90-2-07-frame_parallel-1.webm", "89772591e6ef461f9fa754f916c78ed8", - 26 }, - { NULL, NULL, 0 }, - }; - DecodeFilesWithPause(files); -} - -struct FileList { - const char *name; - // md5 sum for decoded frames which does not include corrupted frames. - const char *expected_md5; - // Expected number of decoded frames which does not include corrupted frames. - const int expected_frame_count; -}; - -// Decodes |filename| with |num_threads|. Return the md5 of the decoded -// frames which does not include corrupted frames. -string DecodeFile(const string &filename, int num_threads, - int expected_frame_count) { - libvpx_test::WebMVideoSource video(filename); - video.Init(); - - vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); - cfg.threads = num_threads; - const vpx_codec_flags_t flags = VPX_CODEC_USE_FRAME_THREADING; - libvpx_test::VP9Decoder decoder(cfg, flags); - - libvpx_test::MD5 md5; - video.Begin(); - - int out_frames = 0; - do { - const vpx_codec_err_t res = - decoder.DecodeFrame(video.cxdata(), video.frame_size()); - // TODO(hkuang): frame parallel mode should return an error on corruption. - if (res != VPX_CODEC_OK) { - EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); - break; - } - - video.Next(); - - // Flush the decoder at the end of the video. - if (!video.cxdata()) decoder.DecodeFrame(NULL, 0); - - libvpx_test::DxDataIterator dec_iter = decoder.GetDxData(); - const vpx_image_t *img; - - // Get decompressed data - while ((img = dec_iter.Next())) { - ++out_frames; - md5.Add(img); - } - } while (video.cxdata() != NULL); - - EXPECT_EQ(expected_frame_count, out_frames) - << "Input frame count does not match expected output frame count"; - - return string(md5.Get()); -} - -void DecodeFiles(const FileList files[]) { - for (const FileList *iter = files; iter->name != NULL; ++iter) { - SCOPED_TRACE(iter->name); - for (int t = 2; t <= 8; ++t) { - EXPECT_EQ(iter->expected_md5, - DecodeFile(iter->name, t, iter->expected_frame_count)) - << "threads = " << t; - } - } -} - -TEST(DISABLED_VP9MultiThreadedFrameParallel, InvalidFileTest) { - static const FileList files[] = { - // invalid-vp90-2-07-frame_parallel-1.webm is a 40 frame video file with - // one key frame for every ten frames. The 11th frame has corrupted data. - { "invalid-vp90-2-07-frame_parallel-1.webm", - "0549d0f45f60deaef8eb708e6c0eb6cb", 30 }, - // invalid-vp90-2-07-frame_parallel-2.webm is a 40 frame video file with - // one key frame for every ten frames. The 1st and 31st frames have - // corrupted data. - { "invalid-vp90-2-07-frame_parallel-2.webm", - "6a1f3cf6f9e7a364212fadb9580d525e", 20 }, - // invalid-vp90-2-07-frame_parallel-3.webm is a 40 frame video file with - // one key frame for every ten frames. The 5th and 13th frames have - // corrupted data. - { "invalid-vp90-2-07-frame_parallel-3.webm", - "8256544308de926b0681e04685b98677", 27 }, - { NULL, NULL, 0 }, - }; - DecodeFiles(files); -} - -TEST(DISABLED_VP9MultiThreadedFrameParallel, ValidFileTest) { - static const FileList files[] = { -#if CONFIG_VP9_HIGHBITDEPTH - { "vp92-2-20-10bit-yuv420.webm", "a16b99df180c584e8db2ffeda987d293", 10 }, -#endif - { NULL, NULL, 0 }, - }; - DecodeFiles(files); -} -#endif // CONFIG_WEBM_IO -} // namespace