This commit is contained in:
Anthony Minessale
2019-09-11 15:51:47 +00:00
committed by Andrey Volk
parent 34fcadbd53
commit ceb051af4e
821 changed files with 89961 additions and 48650 deletions

View File

@@ -10,8 +10,11 @@
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <set>
#include <string>
#include <tuple>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "../tools_common.h"
#include "./vpx_config.h"
@@ -29,9 +32,10 @@
namespace {
const int kThreads = 0;
const int kFileName = 1;
const int kMtMode = 1;
const int kFileName = 2;
typedef std::tr1::tuple<int, const char *> DecodeParam;
typedef std::tuple<int, int, const char *> DecodeParam;
class TestVectorTest : public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
@@ -54,6 +58,25 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
<< "Md5 file open failed. Filename: " << md5_file_name_;
}
#if CONFIG_VP9_DECODER
virtual void PreDecodeFrameHook(
const libvpx_test::CompressedVideoSource &video,
libvpx_test::Decoder *decoder) {
if (video.frame_number() == 0 && mt_mode_ >= 0) {
if (mt_mode_ == 1) {
decoder->Control(VP9D_SET_LOOP_FILTER_OPT, 1);
decoder->Control(VP9D_SET_ROW_MT, 0);
} else if (mt_mode_ == 2) {
decoder->Control(VP9D_SET_LOOP_FILTER_OPT, 0);
decoder->Control(VP9D_SET_ROW_MT, 1);
} else {
decoder->Control(VP9D_SET_LOOP_FILTER_OPT, 0);
decoder->Control(VP9D_SET_ROW_MT, 0);
}
}
}
#endif
virtual void DecompressedFrameHook(const vpx_image_t &img,
const unsigned int frame_number) {
ASSERT_TRUE(md5_file_ != NULL);
@@ -77,6 +100,7 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
#if CONFIG_VP9_DECODER
std::set<std::string> resize_clips_;
#endif
int mt_mode_;
private:
FILE *md5_file_;
@@ -88,19 +112,20 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
// the test failed.
TEST_P(TestVectorTest, MD5Match) {
const DecodeParam input = GET_PARAM(1);
const std::string filename = std::tr1::get<kFileName>(input);
const std::string filename = std::get<kFileName>(input);
vpx_codec_flags_t flags = 0;
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
char str[256];
cfg.threads = std::tr1::get<kThreads>(input);
snprintf(str, sizeof(str) / sizeof(str[0]) - 1, "file: %s threads: %d",
filename.c_str(), cfg.threads);
cfg.threads = std::get<kThreads>(input);
mt_mode_ = std::get<kMtMode>(input);
snprintf(str, sizeof(str) / sizeof(str[0]) - 1,
"file: %s threads: %d MT mode: %d", filename.c_str(), cfg.threads,
mt_mode_);
SCOPED_TRACE(str);
// Open compressed video file.
testing::internal::scoped_ptr<libvpx_test::CompressedVideoSource> video;
std::unique_ptr<libvpx_test::CompressedVideoSource> video;
if (filename.substr(filename.length() - 3, 3) == "ivf") {
video.reset(new libvpx_test::IVFVideoSource(filename));
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
@@ -131,7 +156,8 @@ TEST_P(TestVectorTest, MD5Match) {
VP8_INSTANTIATE_TEST_CASE(
TestVectorTest,
::testing::Combine(
::testing::Values(1), // Single thread.
::testing::Values(1), // Single thread.
::testing::Values(-1), // LPF opt and Row MT is not applicable
::testing::ValuesIn(libvpx_test::kVP8TestVectors,
libvpx_test::kVP8TestVectors +
libvpx_test::kNumVP8TestVectors)));
@@ -144,6 +170,7 @@ INSTANTIATE_TEST_CASE_P(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP8)),
::testing::Combine(
::testing::Range(2, 9), // With 2 ~ 8 threads.
::testing::Values(-1), // LPF opt and Row MT is not applicable
::testing::ValuesIn(libvpx_test::kVP8TestVectors,
libvpx_test::kVP8TestVectors +
libvpx_test::kNumVP8TestVectors))));
@@ -154,7 +181,8 @@ INSTANTIATE_TEST_CASE_P(
VP9_INSTANTIATE_TEST_CASE(
TestVectorTest,
::testing::Combine(
::testing::Values(1), // Single thread.
::testing::Values(1), // Single thread.
::testing::Values(-1), // LPF opt and Row MT is not applicable
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
libvpx_test::kVP9TestVectors +
libvpx_test::kNumVP9TestVectors)));
@@ -166,6 +194,10 @@ INSTANTIATE_TEST_CASE_P(
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
::testing::Combine(
::testing::Range(2, 9), // With 2 ~ 8 threads.
::testing::Range(0, 3), // With multi threads modes 0 ~ 2
// 0: LPF opt and Row MT disabled
// 1: LPF opt enabled
// 2: Row MT enabled
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
libvpx_test::kVP9TestVectors +
libvpx_test::kNumVP9TestVectors))));