diff options
author | Vignesh Venkatasubramanian <vigneshv@google.com> | 2014-03-27 00:50:12 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-27 00:50:12 +0000 |
commit | 7616a7e29066d65ecd1d6f54485360d3964c67bb (patch) | |
tree | c051eed430b02e9a3b5275d65969e25b024e2733 /libvpx/test | |
parent | b2e48fbeea3ad651e5e1d00770cb3609c60bb3e7 (diff) | |
parent | 2ec72e65689c948e92b826ae1e867bf369e72f13 (diff) | |
download | android_external_libvpx-7616a7e29066d65ecd1d6f54485360d3964c67bb.tar.gz android_external_libvpx-7616a7e29066d65ecd1d6f54485360d3964c67bb.tar.bz2 android_external_libvpx-7616a7e29066d65ecd1d6f54485360d3964c67bb.zip |
am 2ec72e65: libvpx: Roll latest libvpx
* commit '2ec72e65689c948e92b826ae1e867bf369e72f13':
libvpx: Roll latest libvpx
Diffstat (limited to 'libvpx/test')
57 files changed, 2434 insertions, 575 deletions
diff --git a/libvpx/test/acm_random.h b/libvpx/test/acm_random.h index de94186..496dae3 100644 --- a/libvpx/test/acm_random.h +++ b/libvpx/test/acm_random.h @@ -26,6 +26,11 @@ class ACMRandom { void Reset(int seed) { random_.Reseed(seed); } + uint16_t Rand16(void) { + const uint32_t value = + random_.Generate(testing::internal::Random::kMaxRange); + return (value >> 16) & 0xffff; + } uint8_t Rand8(void) { const uint32_t value = diff --git a/libvpx/test/active_map_test.cc b/libvpx/test/active_map_test.cc new file mode 100644 index 0000000..6377e72 --- /dev/null +++ b/libvpx/test/active_map_test.cc @@ -0,0 +1,92 @@ +/* + * 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 <climits> +#include <vector> +#include "third_party/googletest/src/include/gtest/gtest.h" +#include "test/codec_factory.h" +#include "test/encode_test_driver.h" +#include "test/i420_video_source.h" +#include "test/util.h" + +namespace { + +class ActiveMapTest + : public ::libvpx_test::EncoderTest, + public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { + protected: + static const int kWidth = 208; + static const int kHeight = 144; + + ActiveMapTest() : EncoderTest(GET_PARAM(0)) {} + virtual ~ActiveMapTest() {} + + virtual void SetUp() { + InitializeConfig(); + SetMode(GET_PARAM(1)); + cpu_used_ = GET_PARAM(2); + } + + virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, + ::libvpx_test::Encoder *encoder) { + if (video->frame() == 1) { + encoder->Control(VP8E_SET_CPUUSED, cpu_used_); + } else if (video->frame() == 3) { + vpx_active_map_t map = {0}; + uint8_t active_map[9 * 13] = { + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, + 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, + 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, + }; + map.cols = (kWidth + 15) / 16; + map.rows = (kHeight + 15) / 16; + ASSERT_EQ(map.cols, 13u); + ASSERT_EQ(map.rows, 9u); + map.active_map = active_map; + encoder->Control(VP8E_SET_ACTIVEMAP, &map); + } else if (video->frame() == 15) { + vpx_active_map_t map = {0}; + map.cols = (kWidth + 15) / 16; + map.rows = (kHeight + 15) / 16; + map.active_map = NULL; + encoder->Control(VP8E_SET_ACTIVEMAP, &map); + } + } + + int cpu_used_; +}; + +TEST_P(ActiveMapTest, Test) { + // Validate that this non multiple of 64 wide clip encodes + cfg_.g_lag_in_frames = 0; + cfg_.rc_target_bitrate = 400; + cfg_.rc_resize_allowed = 0; + cfg_.g_pass = VPX_RC_ONE_PASS; + cfg_.rc_end_usage = VPX_CBR; + cfg_.kf_max_dist = 90000; + + ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, + 1, 0, 20); + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); +} + +#define VP9_FACTORY \ + static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9) + +VP9_INSTANTIATE_TEST_CASE(ActiveMapTest, + ::testing::Values(::libvpx_test::kRealTime), + ::testing::Range(0, 6)); +} // namespace diff --git a/libvpx/test/aq_segment_test.cc b/libvpx/test/aq_segment_test.cc new file mode 100644 index 0000000..2f88b53 --- /dev/null +++ b/libvpx/test/aq_segment_test.cc @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2012 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 <climits> +#include <vector> +#include "third_party/googletest/src/include/gtest/gtest.h" +#include "test/codec_factory.h" +#include "test/encode_test_driver.h" +#include "test/i420_video_source.h" +#include "test/util.h" + +namespace { + +class AqSegmentTest : public ::libvpx_test::EncoderTest, + public ::libvpx_test::CodecTestWith2Params< + libvpx_test::TestMode, int> { + protected: + AqSegmentTest() : EncoderTest(GET_PARAM(0)) {} + + virtual void SetUp() { + InitializeConfig(); + SetMode(GET_PARAM(1)); + set_cpu_used_ = GET_PARAM(2); + aq_mode_ = 0; + } + + virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, + ::libvpx_test::Encoder *encoder) { + if (video->frame() == 1) { + encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); + encoder->Control(VP9E_SET_AQ_MODE, aq_mode_); + encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100); + } + } + + virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { + if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) { + } + } + int set_cpu_used_; + int aq_mode_; +}; + +// Validate that this AQ segmentation mode (AQ=1, variance_ap) +// encodes and decodes without a mismatch. +TEST_P(AqSegmentTest, TestNoMisMatchAQ1) { + cfg_.rc_min_quantizer = 8; + cfg_.rc_max_quantizer = 56; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_target_bitrate = 300; + + aq_mode_ = 1; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 100); + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); +} + +// Validate that this AQ segmentation mode (AQ=2, complexity_aq) +// encodes and decodes without a mismatch. +TEST_P(AqSegmentTest, TestNoMisMatchAQ2) { + cfg_.rc_min_quantizer = 8; + cfg_.rc_max_quantizer = 56; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_target_bitrate = 300; + + aq_mode_ = 2; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 100); + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); +} + +// Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq) +// encodes and decodes without a mismatch. +TEST_P(AqSegmentTest, TestNoMisMatchAQ3) { + cfg_.rc_min_quantizer = 8; + cfg_.rc_max_quantizer = 56; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_target_bitrate = 300; + + aq_mode_ = 3; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 100); + + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); +} + +using std::tr1::make_tuple; + +#define VP9_FACTORY \ + static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9) + +VP9_INSTANTIATE_TEST_CASE(AqSegmentTest, + ::testing::Values(::libvpx_test::kRealTime, + ::libvpx_test::kOnePassGood), + ::testing::Range(3, 9)); +} // namespace diff --git a/libvpx/test/borders_test.cc b/libvpx/test/borders_test.cc index dcdedcf..b30be45 100644 --- a/libvpx/test/borders_test.cc +++ b/libvpx/test/borders_test.cc @@ -21,6 +21,7 @@ class BordersTest : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { protected: BordersTest() : EncoderTest(GET_PARAM(0)) {} + virtual ~BordersTest() {} virtual void SetUp() { InitializeConfig(); @@ -67,7 +68,7 @@ TEST_P(BordersTest, TestLowBitrate) { cfg_.g_lag_in_frames = 25; cfg_.rc_2pass_vbr_minsection_pct = 5; - cfg_.rc_2pass_vbr_minsection_pct = 2000; + cfg_.rc_2pass_vbr_maxsection_pct = 2000; cfg_.rc_target_bitrate = 200; cfg_.rc_min_quantizer = 40; diff --git a/libvpx/test/clear_system_state.h b/libvpx/test/clear_system_state.h index 8f08a4c..5e76797 100644 --- a/libvpx/test/clear_system_state.h +++ b/libvpx/test/clear_system_state.h @@ -11,11 +11,9 @@ #define TEST_CLEAR_SYSTEM_STATE_H_ #include "./vpx_config.h" -extern "C" { #if ARCH_X86 || ARCH_X86_64 # include "vpx_ports/x86.h" #endif -} namespace libvpx_test { diff --git a/libvpx/test/codec_factory.h b/libvpx/test/codec_factory.h index cc7b53f..7f9398c 100644 --- a/libvpx/test/codec_factory.h +++ b/libvpx/test/codec_factory.h @@ -10,7 +10,6 @@ #ifndef TEST_CODEC_FACTORY_H_ #define TEST_CODEC_FACTORY_H_ -extern "C" { #include "./vpx_config.h" #include "vpx/vpx_decoder.h" #include "vpx/vpx_encoder.h" @@ -20,12 +19,13 @@ extern "C" { #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER #include "vpx/vp8dx.h" #endif -} #include "test/decode_test_driver.h" #include "test/encode_test_driver.h" namespace libvpx_test { +const int kCodecFactoryParam = 0; + class CodecFactory { public: CodecFactory() {} @@ -73,7 +73,7 @@ class VP8Decoder : public Decoder { : Decoder(cfg, deadline) {} protected: - virtual const vpx_codec_iface_t* CodecInterface() const { + virtual vpx_codec_iface_t* CodecInterface() const { #if CONFIG_VP8_DECODER return &vpx_codec_vp8_dx_algo; #else @@ -89,7 +89,7 @@ class VP8Encoder : public Encoder { : Encoder(cfg, deadline, init_flags, stats) {} protected: - virtual const vpx_codec_iface_t* CodecInterface() const { + virtual vpx_codec_iface_t* CodecInterface() const { #if CONFIG_VP8_ENCODER return &vpx_codec_vp8_cx_algo; #else @@ -155,7 +155,7 @@ class VP9Decoder : public Decoder { : Decoder(cfg, deadline) {} protected: - virtual const vpx_codec_iface_t* CodecInterface() const { + virtual vpx_codec_iface_t* CodecInterface() const { #if CONFIG_VP9_DECODER return &vpx_codec_vp9_dx_algo; #else @@ -171,7 +171,7 @@ class VP9Encoder : public Encoder { : Encoder(cfg, deadline, init_flags, stats) {} protected: - virtual const vpx_codec_iface_t* CodecInterface() const { + virtual vpx_codec_iface_t* CodecInterface() const { #if CONFIG_VP9_ENCODER return &vpx_codec_vp9_cx_algo; #else diff --git a/libvpx/test/config_test.cc b/libvpx/test/config_test.cc index 36c6330..0493110 100644 --- a/libvpx/test/config_test.cc +++ b/libvpx/test/config_test.cc @@ -20,6 +20,7 @@ class ConfigTest : public ::libvpx_test::EncoderTest, protected: ConfigTest() : EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {} + virtual ~ConfigTest() {} virtual void SetUp() { InitializeConfig(); diff --git a/libvpx/test/convolve_test.cc b/libvpx/test/convolve_test.cc index abeb4bd..e920de8 100644 --- a/libvpx/test/convolve_test.cc +++ b/libvpx/test/convolve_test.cc @@ -14,13 +14,11 @@ #include "test/util.h" #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { #include "./vpx_config.h" #include "./vp9_rtcd.h" #include "vp9/common/vp9_filter.h" #include "vpx_mem/vpx_mem.h" #include "vpx_ports/mem.h" -} namespace { typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride, @@ -44,6 +42,8 @@ struct ConvolveFunctions { convolve_fn_t hv8_avg_; }; +typedef std::tr1::tuple<int, int, const ConvolveFunctions*> convolve_param_t; + // Reference 8-tap subpixel filter, slightly modified to fit into this test. #define VP9_FILTER_WEIGHT 128 #define VP9_FILTER_SHIFT 7 @@ -169,7 +169,7 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr, output_width, output_height); } -class ConvolveTest : public PARAMS(int, int, const ConvolveFunctions*) { +class ConvolveTest : public ::testing::TestWithParam<convolve_param_t> { public: static void SetUpTestCase() { // Force input_ to be unaligned, output to be 16 byte aligned. diff --git a/libvpx/test/cpu_speed_test.cc b/libvpx/test/cpu_speed_test.cc index c92e723..be651b4 100644 --- a/libvpx/test/cpu_speed_test.cc +++ b/libvpx/test/cpu_speed_test.cc @@ -22,6 +22,7 @@ class CpuSpeedTest : public ::libvpx_test::EncoderTest, libvpx_test::TestMode, int> { protected: CpuSpeedTest() : EncoderTest(GET_PARAM(0)) {} + virtual ~CpuSpeedTest() {} virtual void SetUp() { InitializeConfig(); @@ -79,7 +80,7 @@ TEST_P(CpuSpeedTest, TestEncodeHighBitrate) { cfg_.rc_min_quantizer = 0; ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, - 40); + 20); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); } @@ -95,7 +96,7 @@ TEST_P(CpuSpeedTest, TestLowBitrate) { cfg_.rc_min_quantizer = 40; ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, - 40); + 20); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); } @@ -107,6 +108,6 @@ using std::tr1::make_tuple; VP9_INSTANTIATE_TEST_CASE( CpuSpeedTest, - ::testing::Values(::libvpx_test::kTwoPassGood), - ::testing::Range(0, 5)); + ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood), + ::testing::Range(0, 8)); } // namespace diff --git a/libvpx/test/cq_test.cc b/libvpx/test/cq_test.cc index a2c8291..7da7b80 100644 --- a/libvpx/test/cq_test.cc +++ b/libvpx/test/cq_test.cc @@ -20,7 +20,7 @@ namespace { const int kCQLevelMin = 4; const int kCQLevelMax = 63; const int kCQLevelStep = 8; -const int kCQTargetBitrate = 2000; +const unsigned int kCQTargetBitrate = 2000; class CQTest : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<int> { @@ -66,17 +66,17 @@ class CQTest : public ::libvpx_test::EncoderTest, return pow(10.0, avg_psnr / 10.0) / file_size_; } - int file_size() const { return file_size_; } + size_t file_size() const { return file_size_; } int n_frames() const { return n_frames_; } private: int cq_level_; - int file_size_; + size_t file_size_; double psnr_; int n_frames_; }; -int prev_actual_bitrate = kCQTargetBitrate; +unsigned int prev_actual_bitrate = kCQTargetBitrate; TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) { const vpx_rational timebase = { 33333333, 1000000000 }; cfg_.g_timebase = timebase; @@ -88,7 +88,8 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) { timebase.den, timebase.num, 0, 30); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); const double cq_psnr_lin = GetLinearPSNROverBitrate(); - const int cq_actual_bitrate = file_size() * 8 * 30 / (n_frames() * 1000); + const unsigned int cq_actual_bitrate = + static_cast<unsigned int>(file_size()) * 8 * 30 / (n_frames() * 1000); EXPECT_LE(cq_actual_bitrate, kCQTargetBitrate); EXPECT_LE(cq_actual_bitrate, prev_actual_bitrate); prev_actual_bitrate = cq_actual_bitrate; diff --git a/libvpx/test/datarate_test.cc b/libvpx/test/datarate_test.cc index 5785a0a..f673adc 100644 --- a/libvpx/test/datarate_test.cc +++ b/libvpx/test/datarate_test.cc @@ -7,18 +7,22 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ +#include "./vpx_config.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" #include "test/i420_video_source.h" #include "test/util.h" +#include "test/y4m_video_source.h" namespace { -class DatarateTest : public ::libvpx_test::EncoderTest, +class DatarateTestLarge : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public: - DatarateTest() : EncoderTest(GET_PARAM(0)) {} + DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {} + + virtual ~DatarateTestLarge() {} protected: virtual void SetUp() { @@ -55,21 +59,22 @@ class DatarateTest : public ::libvpx_test::EncoderTest, duration = 1; // Add to the buffer the bits we'd expect from a constant bitrate server. - bits_in_buffer_model_ += duration * timebase_ * cfg_.rc_target_bitrate - * 1000; + bits_in_buffer_model_ += static_cast<int64_t>( + duration * timebase_ * cfg_.rc_target_bitrate * 1000); /* Test the buffer model here before subtracting the frame. Do so because * the way the leaky bucket model works in libvpx is to allow the buffer to * empty - and then stop showing frames until we've got enough bits to * show one. As noted in comment below (issue 495), this does not currently * apply to key frames. For now exclude key frames in condition below. */ - bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true: false; + const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) + ? true: false; if (!key_frame) { ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " << pkt->data.frame.pts; } - const int frame_size_in_bits = pkt->data.frame.sz * 8; + const size_t frame_size_in_bits = pkt->data.frame.sz * 8; // Subtract from the buffer the bits associated with a played back frame. bits_in_buffer_model_ -= frame_size_in_bits; @@ -93,7 +98,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, virtual void EndPassHook(void) { if (bits_total_) { - const double file_size_in_kb = bits_total_ / 1000; /* bits per kilobit */ + const double file_size_in_kb = bits_total_ / 1000.; // bits per kilobit duration_ = (last_pts_ + 1) * timebase_; @@ -106,7 +111,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, } vpx_codec_pts_t last_pts_; - int bits_in_buffer_model_; + int64_t bits_in_buffer_model_; double timebase_; int frame_number_; vpx_codec_pts_t first_drop_; @@ -114,10 +119,10 @@ class DatarateTest : public ::libvpx_test::EncoderTest, double duration_; double file_datarate_; double effective_datarate_; - int bits_in_last_frame_; + size_t bits_in_last_frame_; }; -TEST_P(DatarateTest, BasicBufferModel) { +TEST_P(DatarateTestLarge, BasicBufferModel) { cfg_.rc_buf_initial_sz = 500; cfg_.rc_dropframe_thresh = 1; cfg_.rc_max_quantizer = 56; @@ -148,7 +153,7 @@ TEST_P(DatarateTest, BasicBufferModel) { } } -TEST_P(DatarateTest, ChangingDropFrameThresh) { +TEST_P(DatarateTestLarge, ChangingDropFrameThresh) { cfg_.rc_buf_initial_sz = 500; cfg_.rc_max_quantizer = 36; cfg_.rc_end_usage = VPX_CBR; @@ -176,13 +181,13 @@ TEST_P(DatarateTest, ChangingDropFrameThresh) { } } -class DatarateTestVP9 : public ::libvpx_test::EncoderTest, +class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public: - DatarateTestVP9() : EncoderTest(GET_PARAM(0)) {} + DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {} protected: - virtual ~DatarateTestVP9() {} + virtual ~DatarateTestVP9Large() {} virtual void SetUp() { InitializeConfig(); @@ -193,54 +198,177 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest, virtual void ResetModel() { last_pts_ = 0; + bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz; frame_number_ = 0; - bits_total_ = 0; - duration_ = 0.0; + tot_frame_number_ = 0; + first_drop_ = 0; + num_drops_ = 0; + // For testing up to 3 layers. + for (int i = 0; i < 3; ++i) { + bits_total_[i] = 0; + } + } + + // + // Frame flags and layer id for temporal layers. + // + + // For two layers, test pattern is: + // 1 3 + // 0 2 ..... + // For three layers, test pattern is: + // 1 3 5 7 + // 2 6 + // 0 4 .... + // LAST is always update on base/layer 0, GOLDEN is updated on layer 1. + // For this 3 layer example, the 2nd enhancement layer (layer 2) does not + // update any reference frames. + int SetFrameFlags(int frame_num, int num_temp_layers) { + int frame_flags = 0; + if (num_temp_layers == 2) { + if (frame_num % 2 == 0) { + // Layer 0: predict from L and ARF, update L. + frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | + VP8_EFLAG_NO_UPD_ARF; + } else { + // Layer 1: predict from L, G and ARF, and update G. + frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | + VP8_EFLAG_NO_UPD_ENTROPY; + } + } else if (num_temp_layers == 3) { + if (frame_num % 4 == 0) { + // Layer 0: predict from L and ARF; update L. + frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | + VP8_EFLAG_NO_REF_GF; + } else if ((frame_num - 2) % 4 == 0) { + // Layer 1: predict from L, G, ARF; update G. + frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST; + } else if ((frame_num - 1) % 2 == 0) { + // Layer 2: predict from L, G, ARF; update none. + frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | + VP8_EFLAG_NO_UPD_LAST; + } + } + return frame_flags; + } + + int SetLayerId(int frame_num, int num_temp_layers) { + int layer_id = 0; + if (num_temp_layers == 2) { + if (frame_num % 2 == 0) { + layer_id = 0; + } else { + layer_id = 1; + } + } else if (num_temp_layers == 3) { + if (frame_num % 4 == 0) { + layer_id = 0; + } else if ((frame_num - 2) % 4 == 0) { + layer_id = 1; + } else if ((frame_num - 1) % 2 == 0) { + layer_id = 2; + } + } + return layer_id; } virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, - ::libvpx_test::Encoder *encoder) { + ::libvpx_test::Encoder *encoder) { if (video->frame() == 1) { encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); } + if (cfg_.ts_number_layers > 1) { + if (video->frame() == 1) { + encoder->Control(VP9E_SET_SVC, 1); + } + vpx_svc_layer_id_t layer_id = {0, 0}; + layer_id.spatial_layer_id = 0; + frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers); + layer_id.temporal_layer_id = SetLayerId(video->frame(), + cfg_.ts_number_layers); + if (video->frame() > 0) { + encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id); + } + } const vpx_rational_t tb = video->timebase(); timebase_ = static_cast<double>(tb.num) / tb.den; duration_ = 0; } + virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { - const int frame_size_in_bits = pkt->data.frame.sz * 8; - bits_total_ += frame_size_in_bits; + // Time since last timestamp = duration. + vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_; + + if (duration > 1) { + // If first drop not set and we have a drop set it to this time. + if (!first_drop_) + first_drop_ = last_pts_ + 1; + // Update the number of frame drops. + num_drops_ += static_cast<int>(duration - 1); + // Update counter for total number of frames (#frames input to encoder). + // Needed for setting the proper layer_id below. + tot_frame_number_ += static_cast<int>(duration - 1); + } + + int layer = SetLayerId(tot_frame_number_, cfg_.ts_number_layers); + + // Add to the buffer the bits we'd expect from a constant bitrate server. + bits_in_buffer_model_ += static_cast<int64_t>( + duration * timebase_ * cfg_.rc_target_bitrate * 1000); + + // Buffer should not go negative. + ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " + << pkt->data.frame.pts; + + const size_t frame_size_in_bits = pkt->data.frame.sz * 8; + + // Update the total encoded bits. For temporal layers, update the cumulative + // encoded bits per layer. + for (int i = layer; i < static_cast<int>(cfg_.ts_number_layers); ++i) { + bits_total_[i] += frame_size_in_bits; + } + // Update the most recent pts. last_pts_ = pkt->data.frame.pts; ++frame_number_; + ++tot_frame_number_; } virtual void EndPassHook(void) { - if (bits_total_) { + for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers); + ++layer) { duration_ = (last_pts_ + 1) * timebase_; - // Effective file datarate: - effective_datarate_ = ((bits_total_) / 1000.0) / duration_; + if (bits_total_[layer]) { + // Effective file datarate: + effective_datarate_[layer] = (bits_total_[layer] / 1000.0) / duration_; + } } } vpx_codec_pts_t last_pts_; double timebase_; - int frame_number_; - int64_t bits_total_; + int frame_number_; // Counter for number of non-dropped/encoded frames. + int tot_frame_number_; // Counter for total number of input frames. + int64_t bits_total_[3]; double duration_; - double effective_datarate_; + double effective_datarate_[3]; int set_cpu_used_; + int64_t bits_in_buffer_model_; + vpx_codec_pts_t first_drop_; + int num_drops_; }; -// There is no buffer model/frame dropper in VP9 currently, so for now we -// have separate test for VP9 rate targeting for 1-pass CBR. We only check -// that effective datarate is within some range of target bitrate. -// No frame dropper, so we can't go to low bitrates. -TEST_P(DatarateTestVP9, BasicRateTargeting) { +// Check basic rate targeting, +TEST_P(DatarateTestVP9Large, BasicRateTargeting) { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 1; cfg_.rc_min_quantizer = 0; cfg_.rc_max_quantizer = 63; cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, 30, 1, 0, 140); @@ -248,15 +376,213 @@ TEST_P(DatarateTestVP9, BasicRateTargeting) { cfg_.rc_target_bitrate = i; ResetModel(); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.9) + ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) + << " The datarate for the file is lower than target by too much!"; + ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) + << " The datarate for the file is greater than target by too much!"; + } +} + +// Check basic rate targeting, +TEST_P(DatarateTestVP9Large, BasicRateTargeting444) { + ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); + + cfg_.g_profile = 1; + cfg_.g_timebase = video.timebase(); + + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 1; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.rc_end_usage = VPX_CBR; + + for (int i = 250; i < 900; i += 200) { + cfg_.rc_target_bitrate = i; + ResetModel(); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), + effective_datarate_[0] * 0.85) << " The datarate for the file exceeds the target by too much!"; - ASSERT_LE(cfg_.rc_target_bitrate, effective_datarate_ * 1.1) - << " The datarate for the file missed the target!"; + ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), + effective_datarate_[0] * 1.15) + << " The datarate for the file missed the target!" + << cfg_.rc_target_bitrate << " "<< effective_datarate_; + } +} + +// Check that (1) the first dropped frame gets earlier and earlier +// as the drop frame threshold is increased, and (2) that the total number of +// frame drops does not decrease as we increase frame drop threshold. +// Use a lower qp-max to force some frame drops. +TEST_P(DatarateTestVP9Large, ChangingDropFrameThresh) { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_undershoot_pct = 20; + cfg_.rc_undershoot_pct = 20; + cfg_.rc_dropframe_thresh = 10; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 50; + cfg_.rc_end_usage = VPX_CBR; + cfg_.rc_target_bitrate = 200; + cfg_.g_lag_in_frames = 0; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 140); + + const int kDropFrameThreshTestStep = 30; + vpx_codec_pts_t last_drop = 140; + int last_num_drops = 0; + for (int i = 10; i < 100; i += kDropFrameThreshTestStep) { + cfg_.rc_dropframe_thresh = i; + ResetModel(); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) + << " The datarate for the file is lower than target by too much!"; + ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) + << " The datarate for the file is greater than target by too much!"; + ASSERT_LE(first_drop_, last_drop) + << " The first dropped frame for drop_thresh " << i + << " > first dropped frame for drop_thresh " + << i - kDropFrameThreshTestStep; + ASSERT_GE(num_drops_, last_num_drops) + << " The number of dropped frames for drop_thresh " << i + << " < number of dropped frames for drop_thresh " + << i - kDropFrameThreshTestStep; + last_drop = first_drop_; + last_num_drops = num_drops_; + } +} + +// Check basic rate targeting for 2 temporal layers. +TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 1; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + + // 2 Temporal layers, no spatial layers: Framerate decimation (2, 1). + cfg_.ss_number_layers = 1; + cfg_.ts_number_layers = 2; + cfg_.ts_rate_decimator[0] = 2; + cfg_.ts_rate_decimator[1] = 1; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 200); + for (int i = 200; i <= 800; i += 200) { + cfg_.rc_target_bitrate = i; + ResetModel(); + // 60-40 bitrate allocation for 2 temporal layers. + cfg_.ts_target_bitrate[0] = 60 * cfg_.rc_target_bitrate / 100; + cfg_.ts_target_bitrate[1] = cfg_.rc_target_bitrate; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { + ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85) + << " The datarate for the file is lower than target by too much, " + "for layer: " << j; + ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) + << " The datarate for the file is greater than target by too much, " + "for layer: " << j; + } + } +} + +// Check basic rate targeting for 3 temporal layers. +TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayers) { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + cfg_.rc_dropframe_thresh = 1; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 63; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + + // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1). + cfg_.ss_number_layers = 1; + cfg_.ts_number_layers = 3; + cfg_.ts_rate_decimator[0] = 4; + cfg_.ts_rate_decimator[1] = 2; + cfg_.ts_rate_decimator[2] = 1; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 200); + for (int i = 200; i <= 800; i += 200) { + cfg_.rc_target_bitrate = i; + ResetModel(); + // 40-20-40 bitrate allocation for 3 temporal layers. + cfg_.ts_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100; + cfg_.ts_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100; + cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { + ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85) + << " The datarate for the file is lower than target by too much, " + "for layer: " << j; + ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) + << " The datarate for the file is greater than target by too much, " + "for layer: " << j; + } + } +} + +// Check basic rate targeting for 3 temporal layers, with frame dropping. +// Only for one (low) bitrate with lower max_quantizer, and somewhat higher +// frame drop threshold, to force frame dropping. +TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) { + cfg_.rc_buf_initial_sz = 500; + cfg_.rc_buf_optimal_sz = 500; + cfg_.rc_buf_sz = 1000; + // Set frame drop threshold and rc_max_quantizer to force some frame drops. + cfg_.rc_dropframe_thresh = 20; + cfg_.rc_max_quantizer = 45; + cfg_.rc_min_quantizer = 0; + cfg_.rc_end_usage = VPX_CBR; + cfg_.g_lag_in_frames = 0; + + // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1). + cfg_.ss_number_layers = 1; + cfg_.ts_number_layers = 3; + cfg_.ts_rate_decimator[0] = 4; + cfg_.ts_rate_decimator[1] = 2; + cfg_.ts_rate_decimator[2] = 1; + + ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, + 30, 1, 0, 200); + cfg_.rc_target_bitrate = 200; + ResetModel(); + // 40-20-40 bitrate allocation for 3 temporal layers. + cfg_.ts_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100; + cfg_.ts_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100; + cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { + ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85) + << " The datarate for the file is lower than target by too much, " + "for layer: " << j; + ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15) + << " The datarate for the file is greater than target by too much, " + "for layer: " << j; + // Expect some frame drops in this test: for this 200 frames test, + // expect at least 10% and not more than 50% drops. + ASSERT_GE(num_drops_, 20); + ASSERT_LE(num_drops_, 100); } } -VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES); -VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9, - ::testing::Values(::libvpx_test::kOnePassGood), - ::testing::Range(1, 5)); +VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); +VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, + ::testing::Values(::libvpx_test::kOnePassGood, + ::libvpx_test::kRealTime), + ::testing::Range(2, 7)); +// TODO(marpan): Speed 7 fails on one of these tests (likely just a threshold +// needs to be changed), so for now test up to speed 6, and start at 2 (since +// speed 0 and 1 are slow). Allow speed 7 (for real-time mode) after +// looking into/fix failing issue. } // namespace diff --git a/libvpx/test/dct16x16_test.cc b/libvpx/test/dct16x16_test.cc index b61df8d..cb5562e 100644 --- a/libvpx/test/dct16x16_test.cc +++ b/libvpx/test/dct16x16_test.cc @@ -18,12 +18,13 @@ #include "test/register_state_check.h" #include "test/util.h" -extern "C" { -#include "vp9/common/vp9_entropy.h" #include "./vp9_rtcd.h" +#include "vp9/common/vp9_entropy.h" +#include "vpx/vpx_integer.h" + +extern "C" { void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch); } -#include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -264,12 +265,15 @@ typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, int tx_type); +typedef std::tr1::tuple<fdct_t, idct_t, int> dct_16x16_param_t; +typedef std::tr1::tuple<fht_t, iht_t, int> ht_16x16_param_t; + void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { vp9_fdct16x16_c(in, out, stride); } void fht16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { - vp9_short_fht16x16_c(in, out, stride, tx_type); + vp9_fht16x16_c(in, out, stride, tx_type); } class Trans16x16TestBase { @@ -412,8 +416,9 @@ class Trans16x16TestBase { fht_t fwd_txfm_ref; }; -class Trans16x16DCT : public Trans16x16TestBase, - public PARAMS(fdct_t, idct_t, int) { +class Trans16x16DCT + : public Trans16x16TestBase, + public ::testing::TestWithParam<dct_16x16_param_t> { public: virtual ~Trans16x16DCT() {} @@ -454,8 +459,9 @@ TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); } -class Trans16x16HT : public Trans16x16TestBase, - public PARAMS(fht_t, iht_t, int) { +class Trans16x16HT + : public Trans16x16TestBase, + public ::testing::TestWithParam<ht_16x16_param_t> { public: virtual ~Trans16x16HT() {} @@ -501,10 +507,18 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( C, Trans16x16HT, ::testing::Values( - make_tuple(&vp9_short_fht16x16_c, &vp9_iht16x16_256_add_c, 0), - make_tuple(&vp9_short_fht16x16_c, &vp9_iht16x16_256_add_c, 1), - make_tuple(&vp9_short_fht16x16_c, &vp9_iht16x16_256_add_c, 2), - make_tuple(&vp9_short_fht16x16_c, &vp9_iht16x16_256_add_c, 3))); + make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0), + make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1), + make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2), + make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3))); + +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P( + NEON, Trans16x16DCT, + ::testing::Values( + make_tuple(&vp9_fdct16x16_c, + &vp9_idct16x16_256_add_neon, 0))); +#endif #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( @@ -515,9 +529,9 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( SSE2, Trans16x16HT, ::testing::Values( - make_tuple(&vp9_short_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0), - make_tuple(&vp9_short_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1), - make_tuple(&vp9_short_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2), - make_tuple(&vp9_short_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3))); + make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0), + make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1), + make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2), + make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3))); #endif } // namespace diff --git a/libvpx/test/dct32x32_test.cc b/libvpx/test/dct32x32_test.cc index 1e792da..013f451 100644 --- a/libvpx/test/dct32x32_test.cc +++ b/libvpx/test/dct32x32_test.cc @@ -18,12 +18,9 @@ #include "test/register_state_check.h" #include "test/util.h" -extern "C" { #include "./vpx_config.h" -#include "vp9/common/vp9_entropy.h" #include "./vp9_rtcd.h" -} - +#include "vp9/common/vp9_entropy.h" #include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -77,7 +74,9 @@ void reference_32x32_dct_2d(const int16_t input[kNumCoeffs], typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride); typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride); -class Trans32x32Test : public PARAMS(fwd_txfm_t, inv_txfm_t, int) { +typedef std::tr1::tuple<fwd_txfm_t, inv_txfm_t, int> trans_32x32_param_t; + +class Trans32x32Test : public ::testing::TestWithParam<trans_32x32_param_t> { public: virtual ~Trans32x32Test() {} virtual void SetUp() { @@ -249,6 +248,16 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&vp9_fdct32x32_c, &vp9_idct32x32_1024_add_c, 0), make_tuple(&vp9_fdct32x32_rd_c, &vp9_idct32x32_1024_add_c, 1))); +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P( + NEON, Trans32x32Test, + ::testing::Values( + make_tuple(&vp9_fdct32x32_c, + &vp9_idct32x32_1024_add_neon, 0), + make_tuple(&vp9_fdct32x32_rd_c, + &vp9_idct32x32_1024_add_neon, 1))); +#endif + #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( SSE2, Trans32x32Test, @@ -258,4 +267,14 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&vp9_fdct32x32_rd_sse2, &vp9_idct32x32_1024_add_sse2, 1))); #endif + +#if HAVE_AVX2 +INSTANTIATE_TEST_CASE_P( + AVX2, Trans32x32Test, + ::testing::Values( + make_tuple(&vp9_fdct32x32_avx2, + &vp9_idct32x32_1024_add_sse2, 0), + make_tuple(&vp9_fdct32x32_rd_avx2, + &vp9_idct32x32_1024_add_sse2, 1))); +#endif } // namespace diff --git a/libvpx/test/decode_perf_test.cc b/libvpx/test/decode_perf_test.cc new file mode 100644 index 0000000..a438261 --- /dev/null +++ b/libvpx/test/decode_perf_test.cc @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2013 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 "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" +#include "test/webm_video_source.h" +#include "vpx_ports/vpx_timer.h" +#include "./vpx_version.h" + +using std::tr1::make_tuple; + +namespace { + +#define VIDEO_NAME 0 +#define THREADS 1 + +const double kUsecsInSec = 1000000.0; + +/* + DecodePerfTest takes a tuple of filename + number of threads to decode with + */ +typedef std::tr1::tuple<const char *, unsigned> decode_perf_param_t; + +const decode_perf_param_t kVP9DecodePerfVectors[] = { + make_tuple("vp90-2-bbb_426x240_tile_1x1_180kbps.webm", 1), + make_tuple("vp90-2-bbb_640x360_tile_1x2_337kbps.webm", 2), + make_tuple("vp90-2-bbb_854x480_tile_1x2_651kbps.webm", 2), + make_tuple("vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm", 4), + make_tuple("vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm", 1), + make_tuple("vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm", 4), + make_tuple("vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm", 4), + make_tuple("vp90-2-sintel_426x182_tile_1x1_171kbps.webm", 1), + make_tuple("vp90-2-sintel_640x272_tile_1x2_318kbps.webm", 2), + make_tuple("vp90-2-sintel_854x364_tile_1x2_621kbps.webm", 2), + make_tuple("vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm", 4), + make_tuple("vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm", 4), + make_tuple("vp90-2-tos_426x178_tile_1x1_181kbps.webm", 1), + make_tuple("vp90-2-tos_640x266_tile_1x2_336kbps.webm", 2), + make_tuple("vp90-2-tos_854x356_tile_1x2_656kbps.webm", 2), + make_tuple("vp90-2-tos_1280x534_tile_1x4_1306kbps.webm", 4), + make_tuple("vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm", 4), +}; + +/* + In order to reflect real world performance as much as possible, Perf tests + *DO NOT* do any correctness checks. Please run them alongside correctness + tests to ensure proper codec integrity. Furthermore, in this test we + deliberately limit the amount of system calls we make to avoid OS + preemption. + + TODO(joshualitt) create a more detailed perf measurement test to collect + power/temp/min max frame decode times/etc + */ + +class DecodePerfTest : public ::testing::TestWithParam<decode_perf_param_t> { +}; + +TEST_P(DecodePerfTest, PerfTest) { + const char *const video_name = GET_PARAM(VIDEO_NAME); + const unsigned threads = GET_PARAM(THREADS); + + libvpx_test::WebMVideoSource video(video_name); + video.Init(); + + vpx_codec_dec_cfg_t cfg = {0}; + cfg.threads = threads; + libvpx_test::VP9Decoder decoder(cfg, 0); + + vpx_usec_timer t; + vpx_usec_timer_start(&t); + + for (video.Begin(); video.cxdata() != NULL; video.Next()) { + decoder.DecodeFrame(video.cxdata(), video.frame_size()); + } + + vpx_usec_timer_mark(&t); + const double elapsed_secs = double(vpx_usec_timer_elapsed(&t)) + / kUsecsInSec; + const unsigned frames = video.frame_number(); + const double fps = double(frames) / elapsed_secs; + + printf("{\n"); + printf("\t\"version\" : \"%s\",\n", VERSION_STRING_NOSP); + printf("\t\"videoName\" : \"%s\",\n", video_name); + printf("\t\"threadCount\" : %u,\n", threads); + printf("\t\"decodeTimeSecs\" : %f,\n", elapsed_secs); + printf("\t\"totalFrames\" : %u,\n", frames); + printf("\t\"framesPerSecond\" : %f\n", fps); + printf("}\n"); +} + +INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest, + ::testing::ValuesIn(kVP9DecodePerfVectors)); + +} // namespace diff --git a/libvpx/test/decode_test_driver.cc b/libvpx/test/decode_test_driver.cc index 1f6d540..e667d1d 100644 --- a/libvpx/test/decode_test_driver.cc +++ b/libvpx/test/decode_test_driver.cc @@ -15,11 +15,13 @@ namespace libvpx_test { -vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, int size) { +vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) { vpx_codec_err_t res_dec; InitOnce(); - REGISTER_STATE_CHECK(res_dec = vpx_codec_decode(&decoder_, - cxdata, size, NULL, 0)); + REGISTER_STATE_CHECK( + res_dec = vpx_codec_decode(&decoder_, + cxdata, static_cast<unsigned int>(size), + NULL, 0)); return res_dec; } @@ -30,6 +32,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video) { // Decode frames. for (video->Begin(); video->cxdata(); video->Next()) { + PreDecodeFrameHook(*video, decoder); vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(), video->frame_size()); ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); diff --git a/libvpx/test/decode_test_driver.h b/libvpx/test/decode_test_driver.h index 055c45e..2734a45 100644 --- a/libvpx/test/decode_test_driver.h +++ b/libvpx/test/decode_test_driver.h @@ -49,7 +49,7 @@ class Decoder { vpx_codec_destroy(&decoder_); } - vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, int size); + vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size); DxDataIterator GetDxData() { return DxDataIterator(&decoder_); @@ -76,8 +76,17 @@ class Decoder { return detail ? detail : vpx_codec_error(&decoder_); } + // Passes the external frame buffer information to libvpx. + vpx_codec_err_t SetFrameBufferFunctions( + vpx_get_frame_buffer_cb_fn_t cb_get, + vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) { + InitOnce(); + return vpx_codec_set_frame_buffer_functions( + &decoder_, cb_get, cb_release, user_priv); + } + protected: - virtual const vpx_codec_iface_t* CodecInterface() const = 0; + virtual vpx_codec_iface_t* CodecInterface() const = 0; void InitOnce() { if (!init_done_) { @@ -101,6 +110,10 @@ class DecoderTest { // Main decoding loop virtual void RunLoop(CompressedVideoSource *video); + // Hook to be called before decompressing every frame. + virtual void PreDecodeFrameHook(const CompressedVideoSource& video, + Decoder *decoder) {} + // Hook to be called on every decompressed frame. virtual void DecompressedFrameHook(const vpx_image_t& img, const unsigned int frame_number) {} diff --git a/libvpx/test/encode_test_driver.h b/libvpx/test/encode_test_driver.h index dbdc33c..9526068 100644 --- a/libvpx/test/encode_test_driver.h +++ b/libvpx/test/encode_test_driver.h @@ -16,6 +16,9 @@ #include "./vpx_config.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "vpx/vpx_encoder.h" +#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER +#include "vpx/vp8cx.h" +#endif namespace libvpx_test { @@ -123,12 +126,24 @@ class Encoder { ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); } + void Control(int ctrl_id, struct vpx_svc_layer_id *arg) { + const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg); + ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); + } + +#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER + void Control(int ctrl_id, vpx_active_map_t *arg) { + const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg); + ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); + } +#endif + void set_deadline(unsigned long deadline) { deadline_ = deadline; } protected: - virtual const vpx_codec_iface_t* CodecInterface() const = 0; + virtual vpx_codec_iface_t* CodecInterface() const = 0; const char *EncoderError() { const char *detail = vpx_codec_error_detail(&encoder_); diff --git a/libvpx/test/error_resilience_test.cc b/libvpx/test/error_resilience_test.cc index 16d250c..89684f8 100644 --- a/libvpx/test/error_resilience_test.cc +++ b/libvpx/test/error_resilience_test.cc @@ -1,12 +1,12 @@ /* - Copyright (c) 2012 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. -*/ + * Copyright (c) 2013 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 "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" @@ -16,22 +16,23 @@ namespace { -const int kMaxErrorFrames = 8; -const int kMaxDroppableFrames = 8; +const int kMaxErrorFrames = 12; +const int kMaxDroppableFrames = 12; -class ErrorResilienceTest : public ::libvpx_test::EncoderTest, +class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { protected: - ErrorResilienceTest() : EncoderTest(GET_PARAM(0)), - psnr_(0.0), - nframes_(0), - mismatch_psnr_(0.0), - mismatch_nframes_(0), - encoding_mode_(GET_PARAM(1)) { + ErrorResilienceTestLarge() + : EncoderTest(GET_PARAM(0)), + psnr_(0.0), + nframes_(0), + mismatch_psnr_(0.0), + mismatch_nframes_(0), + encoding_mode_(GET_PARAM(1)) { Reset(); } - virtual ~ErrorResilienceTest() {} + virtual ~ErrorResilienceTestLarge() {} void Reset() { error_nframes_ = 0; @@ -144,7 +145,7 @@ class ErrorResilienceTest : public ::libvpx_test::EncoderTest, libvpx_test::TestMode encoding_mode_; }; -TEST_P(ErrorResilienceTest, OnVersusOff) { +TEST_P(ErrorResilienceTestLarge, OnVersusOff) { const vpx_rational timebase = { 33333333, 1000000000 }; cfg_.g_timebase = timebase; cfg_.rc_target_bitrate = 2000; @@ -175,7 +176,11 @@ TEST_P(ErrorResilienceTest, OnVersusOff) { } } -TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { +// Check for successful decoding and no encoder/decoder mismatch +// if we lose (i.e., drop before decoding) a set of droppable +// frames (i.e., frames that don't update any reference buffers). +// Check both isolated and consecutive loss. +TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) { const vpx_rational timebase = { 33333333, 1000000000 }; cfg_.g_timebase = timebase; cfg_.rc_target_bitrate = 500; @@ -186,14 +191,18 @@ TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { init_flags_ = VPX_CODEC_USE_PSNR; libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, - timebase.den, timebase.num, 0, 30); + timebase.den, timebase.num, 0, 40); // Error resilient mode ON. cfg_.g_error_resilient = 1; - - // Set an arbitrary set of error frames same as droppable frames - unsigned int num_droppable_frames = 2; - unsigned int droppable_frame_list[] = {5, 16}; + cfg_.kf_mode = VPX_KF_DISABLED; + + // Set an arbitrary set of error frames same as droppable frames. + // In addition to isolated loss/drop, add a long consecutive series + // (of size 9) of dropped frames. + unsigned int num_droppable_frames = 11; + unsigned int droppable_frame_list[] = {5, 16, 22, 23, 24, 25, 26, 27, 28, + 29, 30}; SetDroppableFrames(num_droppable_frames, droppable_frame_list); SetErrorFrames(num_droppable_frames, droppable_frame_list); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); @@ -202,7 +211,7 @@ TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { << GetMismatchFrames() << "\n"; EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0); - // reset previously set error/droppable frames + // Reset previously set of error/droppable frames. Reset(); #if 0 @@ -227,7 +236,7 @@ TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { #endif } -VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); -VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); +VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES); +VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES); } // namespace diff --git a/libvpx/test/external_frame_buffer_test.cc b/libvpx/test/external_frame_buffer_test.cc new file mode 100644 index 0000000..2e7adc1 --- /dev/null +++ b/libvpx/test/external_frame_buffer_test.cc @@ -0,0 +1,466 @@ +/* + * 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 <string> + +#include "test/codec_factory.h" +#include "test/decode_test_driver.h" +#include "test/ivf_video_source.h" +#include "test/md5_helper.h" +#include "test/test_vectors.h" +#include "test/util.h" +#include "test/webm_video_source.h" + +namespace { + +const int kVideoNameParam = 1; +const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm"; + +struct ExternalFrameBuffer { + uint8_t *data; + size_t size; + int in_use; +}; + +// Class to manipulate a list of external frame buffers. +class ExternalFrameBufferList { + public: + ExternalFrameBufferList() + : num_buffers_(0), + ext_fb_list_(NULL) {} + + virtual ~ExternalFrameBufferList() { + for (int i = 0; i < num_buffers_; ++i) { + delete [] ext_fb_list_[i].data; + } + delete [] ext_fb_list_; + } + + // Creates the list to hold the external buffers. Returns true on success. + bool CreateBufferList(int num_buffers) { + if (num_buffers < 0) + return false; + + num_buffers_ = num_buffers; + ext_fb_list_ = new ExternalFrameBuffer[num_buffers_]; + EXPECT_TRUE(ext_fb_list_ != NULL); + memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_); + return true; + } + + // Searches the frame buffer list for a free frame buffer. Makes sure + // that the frame buffer is at least |min_size| in bytes. Marks that the + // frame buffer is in use by libvpx. Finally sets |fb| to point to the + // external frame buffer. Returns < 0 on an error. + int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { + EXPECT_TRUE(fb != NULL); + const int idx = FindFreeBufferIndex(); + if (idx == num_buffers_) + return -1; + + if (ext_fb_list_[idx].size < min_size) { + delete [] ext_fb_list_[idx].data; + ext_fb_list_[idx].data = new uint8_t[min_size]; + ext_fb_list_[idx].size = min_size; + } + + SetFrameBuffer(idx, fb); + return 0; + } + + // Test function that will not allocate any data for the frame buffer. + // Returns < 0 on an error. + int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { + EXPECT_TRUE(fb != NULL); + const int idx = FindFreeBufferIndex(); + if (idx == num_buffers_) + return -1; + + if (ext_fb_list_[idx].size < min_size) { + delete [] ext_fb_list_[idx].data; + ext_fb_list_[idx].data = NULL; + ext_fb_list_[idx].size = min_size; + } + + SetFrameBuffer(idx, fb); + return 0; + } + + // Marks the external frame buffer that |fb| is pointing too as free. + // Returns < 0 on an error. + int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) { + EXPECT_TRUE(fb != NULL); + ExternalFrameBuffer *const ext_fb = + reinterpret_cast<ExternalFrameBuffer*>(fb->priv); + EXPECT_TRUE(ext_fb != NULL); + EXPECT_EQ(1, ext_fb->in_use); + ext_fb->in_use = 0; + return 0; + } + + // Checks that the ximage data is contained within the external frame buffer + // private data passed back in the ximage. + void CheckXImageFrameBuffer(const vpx_image_t *img) { + if (img->fb_priv != NULL) { + const struct ExternalFrameBuffer *const ext_fb = + reinterpret_cast<ExternalFrameBuffer*>(img->fb_priv); + + ASSERT_TRUE(img->planes[0] >= ext_fb->data && + img->planes[0] < (ext_fb->data + ext_fb->size)); + } + } + + private: + // Returns the index of the first free frame buffer. Returns |num_buffers_| + // if there are no free frame buffers. + int FindFreeBufferIndex() { + int i; + // Find a free frame buffer. + for (i = 0; i < num_buffers_; ++i) { + if (!ext_fb_list_[i].in_use) + break; + } + return i; + } + + // Sets |fb| to an external frame buffer. idx is the index into the frame + // buffer list. + void SetFrameBuffer(int idx, vpx_codec_frame_buffer_t *fb) { + ASSERT_TRUE(fb != NULL); + fb->data = ext_fb_list_[idx].data; + fb->size = ext_fb_list_[idx].size; + ASSERT_EQ(0, ext_fb_list_[idx].in_use); + ext_fb_list_[idx].in_use = 1; + fb->priv = &ext_fb_list_[idx]; + } + + int num_buffers_; + ExternalFrameBuffer *ext_fb_list_; +}; + +// Callback used by libvpx to request the application to return a frame +// buffer of at least |min_size| in bytes. +int get_vp9_frame_buffer(void *user_priv, size_t min_size, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferList *const fb_list = + reinterpret_cast<ExternalFrameBufferList*>(user_priv); + return fb_list->GetFreeFrameBuffer(min_size, fb); +} + +// Callback used by libvpx to tell the application that |fb| is not needed +// anymore. +int release_vp9_frame_buffer(void *user_priv, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferList *const fb_list = + reinterpret_cast<ExternalFrameBufferList*>(user_priv); + return fb_list->ReturnFrameBuffer(fb); +} + +// Callback will not allocate data for frame buffer. +int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferList *const fb_list = + reinterpret_cast<ExternalFrameBufferList*>(user_priv); + return fb_list->GetZeroFrameBuffer(min_size, fb); +} + +// Callback will allocate one less byte than |min_size|. +int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferList *const fb_list = + reinterpret_cast<ExternalFrameBufferList*>(user_priv); + return fb_list->GetFreeFrameBuffer(min_size - 1, fb); +} + +// Callback will not release the external frame buffer. +int do_not_release_vp9_frame_buffer(void *user_priv, + vpx_codec_frame_buffer_t *fb) { + (void)user_priv; + (void)fb; + return 0; +} + +// Class for testing passing in external frame buffers to libvpx. +class ExternalFrameBufferMD5Test + : public ::libvpx_test::DecoderTest, + public ::libvpx_test::CodecTestWithParam<const char*> { + protected: + ExternalFrameBufferMD5Test() + : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)), + md5_file_(NULL), + num_buffers_(0) {} + + virtual ~ExternalFrameBufferMD5Test() { + if (md5_file_ != NULL) + fclose(md5_file_); + } + + virtual void PreDecodeFrameHook( + const libvpx_test::CompressedVideoSource &video, + libvpx_test::Decoder *decoder) { + if (num_buffers_ > 0 && video.frame_number() == 0) { + // Have libvpx use frame buffers we create. + ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_)); + ASSERT_EQ(VPX_CODEC_OK, + decoder->SetFrameBufferFunctions( + GetVp9FrameBuffer, ReleaseVP9FrameBuffer, this)); + } + } + + void OpenMD5File(const std::string &md5_file_name_) { + md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_); + ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: " + << md5_file_name_; + } + + virtual void DecompressedFrameHook(const vpx_image_t &img, + const unsigned int frame_number) { + ASSERT_TRUE(md5_file_ != NULL); + char expected_md5[33]; + char junk[128]; + + // Read correct md5 checksums. + const int res = fscanf(md5_file_, "%s %s", expected_md5, junk); + ASSERT_NE(EOF, res) << "Read md5 data failed"; + expected_md5[32] = '\0'; + + ::libvpx_test::MD5 md5_res; + md5_res.Add(&img); + const char *const actual_md5 = md5_res.Get(); + + // Check md5 match. + ASSERT_STREQ(expected_md5, actual_md5) + << "Md5 checksums don't match: frame number = " << frame_number; + } + + // Callback to get a free external frame buffer. Return value < 0 is an + // error. + static int GetVp9FrameBuffer(void *user_priv, size_t min_size, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferMD5Test *const md5Test = + reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv); + return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb); + } + + // Callback to release an external frame buffer. Return value < 0 is an + // error. + static int ReleaseVP9FrameBuffer(void *user_priv, + vpx_codec_frame_buffer_t *fb) { + ExternalFrameBufferMD5Test *const md5Test = + reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv); + return md5Test->fb_list_.ReturnFrameBuffer(fb); + } + + void set_num_buffers(int num_buffers) { num_buffers_ = num_buffers; } + int num_buffers() const { return num_buffers_; } + + private: + FILE *md5_file_; + int num_buffers_; + ExternalFrameBufferList fb_list_; +}; + +// Class for testing passing in external frame buffers to libvpx. +class ExternalFrameBufferTest : public ::testing::Test { + protected: + ExternalFrameBufferTest() + : video_(NULL), + decoder_(NULL), + num_buffers_(0) {} + + virtual void SetUp() { + video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); + ASSERT_TRUE(video_ != NULL); + video_->Init(); + video_->Begin(); + + vpx_codec_dec_cfg_t cfg = {0}; + decoder_ = new libvpx_test::VP9Decoder(cfg, 0); + ASSERT_TRUE(decoder_ != NULL); + } + + virtual void TearDown() { + delete decoder_; + delete video_; + } + + // Passes the external frame buffer information to libvpx. + vpx_codec_err_t SetFrameBufferFunctions( + int num_buffers, + vpx_get_frame_buffer_cb_fn_t cb_get, + vpx_release_frame_buffer_cb_fn_t cb_release) { + if (num_buffers > 0) { + num_buffers_ = num_buffers; + EXPECT_TRUE(fb_list_.CreateBufferList(num_buffers_)); + } + + return decoder_->SetFrameBufferFunctions(cb_get, cb_release, &fb_list_); + } + + vpx_codec_err_t DecodeOneFrame() { + const vpx_codec_err_t res = + decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); + CheckDecodedFrames(); + if (res == VPX_CODEC_OK) + video_->Next(); + return res; + } + + vpx_codec_err_t DecodeRemainingFrames() { + for (; video_->cxdata() != NULL; video_->Next()) { + const vpx_codec_err_t res = + decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); + if (res != VPX_CODEC_OK) + return res; + CheckDecodedFrames(); + } + return VPX_CODEC_OK; + } + + private: + void CheckDecodedFrames() { + libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData(); + const vpx_image_t *img = NULL; + + // Get decompressed data + while ((img = dec_iter.Next()) != NULL) { + fb_list_.CheckXImageFrameBuffer(img); + } + } + + libvpx_test::WebMVideoSource *video_; + libvpx_test::VP9Decoder *decoder_; + int num_buffers_; + ExternalFrameBufferList fb_list_; +}; + +// This test runs through the set of test vectors, and decodes them. +// Libvpx will call into the application to allocate a frame buffer when +// needed. The md5 checksums are computed for each frame in the video file. +// If md5 checksums match the correct md5 data, then the test is passed. +// 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. + const int jitter_buffers = 4; + const int num_buffers = + VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers; + set_num_buffers(num_buffers); + +#if CONFIG_VP8_DECODER + // Tell compiler we are not using kVP8TestVectors. + (void)libvpx_test::kVP8TestVectors; +#endif + + // Open compressed video file. + if (filename.substr(filename.length() - 3, 3) == "ivf") { + video = new libvpx_test::IVFVideoSource(filename); + } else { + video = new libvpx_test::WebMVideoSource(filename); + } + ASSERT_TRUE(video != NULL); + video->Init(); + + // Construct md5 file name. + const std::string md5_filename = filename + ".md5"; + OpenMD5File(md5_filename); + + // Decode frame, and check the md5 matching. + ASSERT_NO_FATAL_FAILURE(RunLoop(video)); + delete video; +} + +TEST_F(ExternalFrameBufferTest, MinFrameBuffers) { + // Minimum number of external frame buffers for VP9 is + // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions( + num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames()); +} + +TEST_F(ExternalFrameBufferTest, EightJitterBuffers) { + // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS + + // #VPX_MAXIMUM_WORK_BUFFERS + eight jitter buffers. + const int jitter_buffers = 8; + const int num_buffers = + VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions( + num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames()); +} + +TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) { + // Minimum number of external frame buffers for VP9 is + // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. Most files will + // only use 5 frame buffers at one time. + const int num_buffers = 2; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions( + num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); + ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames()); +} + +TEST_F(ExternalFrameBufferTest, NoRelease) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, + do_not_release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); + ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames()); +} + +TEST_F(ExternalFrameBufferTest, NullRealloc) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions(num_buffers, get_vp9_zero_frame_buffer, + release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame()); +} + +TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_OK, + SetFrameBufferFunctions( + num_buffers, get_vp9_one_less_byte_frame_buffer, + release_vp9_frame_buffer)); + ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame()); +} + +TEST_F(ExternalFrameBufferTest, NullGetFunction) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_INVALID_PARAM, + SetFrameBufferFunctions(num_buffers, NULL, + release_vp9_frame_buffer)); +} + +TEST_F(ExternalFrameBufferTest, NullReleaseFunction) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_INVALID_PARAM, + SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, NULL)); +} + +TEST_F(ExternalFrameBufferTest, SetAfterDecode) { + const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; + ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); + ASSERT_EQ(VPX_CODEC_ERROR, + SetFrameBufferFunctions( + num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); +} + +VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, + ::testing::ValuesIn(libvpx_test::kVP9TestVectors)); +} // namespace diff --git a/libvpx/test/fdct4x4_test.cc b/libvpx/test/fdct4x4_test.cc index 9d8b0bd..127775c 100644 --- a/libvpx/test/fdct4x4_test.cc +++ b/libvpx/test/fdct4x4_test.cc @@ -18,12 +18,13 @@ #include "test/register_state_check.h" #include "test/util.h" -extern "C" { -#include "vp9/common/vp9_entropy.h" #include "./vp9_rtcd.h" +#include "vp9/common/vp9_entropy.h" +#include "vpx/vpx_integer.h" + +extern "C" { void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch); } -#include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -36,12 +37,15 @@ typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, int tx_type); +typedef std::tr1::tuple<fdct_t, idct_t, int> dct_4x4_param_t; +typedef std::tr1::tuple<fht_t, iht_t, int> ht_4x4_param_t; + void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { vp9_fdct4x4_c(in, out, stride); } void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { - vp9_short_fht4x4_c(in, out, stride, tx_type); + vp9_fht4x4_c(in, out, stride, tx_type); } class Trans4x4TestBase { @@ -183,7 +187,7 @@ class Trans4x4TestBase { class Trans4x4DCT : public Trans4x4TestBase, - public PARAMS(fdct_t, idct_t, int) { + public ::testing::TestWithParam<dct_4x4_param_t> { public: virtual ~Trans4x4DCT() {} @@ -226,7 +230,7 @@ TEST_P(Trans4x4DCT, InvAccuracyCheck) { class Trans4x4HT : public Trans4x4TestBase, - public PARAMS(fht_t, iht_t, int) { + public ::testing::TestWithParam<ht_4x4_param_t> { public: virtual ~Trans4x4HT() {} @@ -277,10 +281,25 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( C, Trans4x4HT, ::testing::Values( - make_tuple(&vp9_short_fht4x4_c, &vp9_iht4x4_16_add_c, 0), - make_tuple(&vp9_short_fht4x4_c, &vp9_iht4x4_16_add_c, 1), - make_tuple(&vp9_short_fht4x4_c, &vp9_iht4x4_16_add_c, 2), - make_tuple(&vp9_short_fht4x4_c, &vp9_iht4x4_16_add_c, 3))); + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3))); + +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P( + NEON, Trans4x4DCT, + ::testing::Values( + make_tuple(&vp9_fdct4x4_c, + &vp9_idct4x4_16_add_neon, 0))); +INSTANTIATE_TEST_CASE_P( + DISABLED_NEON, Trans4x4HT, + ::testing::Values( + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2), + make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3))); +#endif #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( @@ -291,10 +310,10 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( SSE2, Trans4x4HT, ::testing::Values( - make_tuple(&vp9_short_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0), - make_tuple(&vp9_short_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1), - make_tuple(&vp9_short_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2), - make_tuple(&vp9_short_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3))); + make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0), + make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1), + make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2), + make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3))); #endif } // namespace diff --git a/libvpx/test/fdct8x8_test.cc b/libvpx/test/fdct8x8_test.cc index 3777b11..6f2d7d1 100644 --- a/libvpx/test/fdct8x8_test.cc +++ b/libvpx/test/fdct8x8_test.cc @@ -18,12 +18,13 @@ #include "test/register_state_check.h" #include "test/util.h" -extern "C" { -#include "vp9/common/vp9_entropy.h" #include "./vp9_rtcd.h" +#include "vp9/common/vp9_entropy.h" +#include "vpx/vpx_integer.h" + +extern "C" { void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *output, int pitch); } -#include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -35,12 +36,15 @@ typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, int tx_type); +typedef std::tr1::tuple<fdct_t, idct_t, int> dct_8x8_param_t; +typedef std::tr1::tuple<fht_t, iht_t, int> ht_8x8_param_t; + void fdct8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { vp9_fdct8x8_c(in, out, stride); } void fht8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { - vp9_short_fht8x8_c(in, out, stride, tx_type); + vp9_fht8x8_c(in, out, stride, tx_type); } class FwdTrans8x8TestBase { @@ -215,8 +219,9 @@ class FwdTrans8x8TestBase { fht_t fwd_txfm_ref; }; -class FwdTrans8x8DCT : public FwdTrans8x8TestBase, - public PARAMS(fdct_t, idct_t, int) { +class FwdTrans8x8DCT + : public FwdTrans8x8TestBase, + public ::testing::TestWithParam<dct_8x8_param_t> { public: virtual ~FwdTrans8x8DCT() {} @@ -254,8 +259,9 @@ TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); } -class FwdTrans8x8HT : public FwdTrans8x8TestBase, - public PARAMS(fht_t, iht_t, int) { +class FwdTrans8x8HT + : public FwdTrans8x8TestBase, + public ::testing::TestWithParam<ht_8x8_param_t> { public: virtual ~FwdTrans8x8HT() {} @@ -302,10 +308,24 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( C, FwdTrans8x8HT, ::testing::Values( - make_tuple(&vp9_short_fht8x8_c, &vp9_iht8x8_64_add_c, 0), - make_tuple(&vp9_short_fht8x8_c, &vp9_iht8x8_64_add_c, 1), - make_tuple(&vp9_short_fht8x8_c, &vp9_iht8x8_64_add_c, 2), - make_tuple(&vp9_short_fht8x8_c, &vp9_iht8x8_64_add_c, 3))); + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3))); + +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P( + NEON, FwdTrans8x8DCT, + ::testing::Values( + make_tuple(&vp9_fdct8x8_c, &vp9_idct8x8_64_add_neon, 0))); +INSTANTIATE_TEST_CASE_P( + DISABLED_NEON, FwdTrans8x8HT, + ::testing::Values( + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 1), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 2), + make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 3))); +#endif #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( @@ -315,9 +335,9 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( SSE2, FwdTrans8x8HT, ::testing::Values( - make_tuple(&vp9_short_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0), - make_tuple(&vp9_short_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1), - make_tuple(&vp9_short_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2), - make_tuple(&vp9_short_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3))); + make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0), + make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1), + make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2), + make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3))); #endif } // namespace diff --git a/libvpx/test/i420_video_source.h b/libvpx/test/i420_video_source.h index 2bf2a03..c3315f9 100644 --- a/libvpx/test/i420_video_source.h +++ b/libvpx/test/i420_video_source.h @@ -52,7 +52,7 @@ class I420VideoSource : public VideoSource { ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " << file_name_; if (start_) { - fseek(input_file_, raw_sz_ * start_, SEEK_SET); + fseek(input_file_, static_cast<unsigned>(raw_sz_) * start_, SEEK_SET); } frame_ = start_; diff --git a/libvpx/test/idct8x8_test.cc b/libvpx/test/idct8x8_test.cc index d8c61ff..5f4c33a 100644 --- a/libvpx/test/idct8x8_test.cc +++ b/libvpx/test/idct8x8_test.cc @@ -14,9 +14,7 @@ #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { #include "./vp9_rtcd.h" -} #include "test/acm_random.h" #include "vpx/vpx_integer.h" diff --git a/libvpx/test/idct_test.cc b/libvpx/test/idct_test.cc index 2c7fa0e..1bbf80a 100644 --- a/libvpx/test/idct_test.cc +++ b/libvpx/test/idct_test.cc @@ -8,10 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -extern "C" { #include "./vpx_config.h" #include "./vp8_rtcd.h" -} #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" diff --git a/libvpx/test/intrapred_test.cc b/libvpx/test/intrapred_test.cc index 5fba700..cefe192 100644 --- a/libvpx/test/intrapred_test.cc +++ b/libvpx/test/intrapred_test.cc @@ -14,12 +14,11 @@ #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { + #include "./vpx_config.h" #include "./vp8_rtcd.h" #include "vp8/common/blockd.h" #include "vpx_mem/vpx_mem.h" -} namespace { @@ -27,11 +26,7 @@ using libvpx_test::ACMRandom; class IntraPredBase { public: - virtual ~IntraPredBase() {} - - virtual void TearDown() { - libvpx_test::ClearSystemState(); - } + virtual ~IntraPredBase() { libvpx_test::ClearSystemState(); } protected: void SetupMacroblock(MACROBLOCKD *mbptr, @@ -228,8 +223,9 @@ typedef void (*intra_pred_y_fn_t)(MACROBLOCKD *x, uint8_t *ypred_ptr, int y_stride); -class IntraPredYTest : public ::testing::TestWithParam<intra_pred_y_fn_t>, - protected IntraPredBase { +class IntraPredYTest + : public IntraPredBase, + public ::testing::TestWithParam<intra_pred_y_fn_t> { public: static void SetUpTestCase() { mb_ = reinterpret_cast<MACROBLOCKD*>( @@ -309,8 +305,9 @@ typedef void (*intra_pred_uv_fn_t)(MACROBLOCKD *x, uint8_t *vpred_ptr, int pred_stride); -class IntraPredUVTest : public ::testing::TestWithParam<intra_pred_uv_fn_t>, - protected IntraPredBase { +class IntraPredUVTest + : public IntraPredBase, + public ::testing::TestWithParam<intra_pred_uv_fn_t> { public: static void SetUpTestCase() { mb_ = reinterpret_cast<MACROBLOCKD*>( diff --git a/libvpx/test/ivf_video_source.h b/libvpx/test/ivf_video_source.h index 3fbafbd..824a39d 100644 --- a/libvpx/test/ivf_video_source.h +++ b/libvpx/test/ivf_video_source.h @@ -94,14 +94,14 @@ class IVFVideoSource : public CompressedVideoSource { virtual const uint8_t *cxdata() const { return end_of_file_ ? NULL : compressed_frame_buf_; } - virtual const unsigned int frame_size() const { return frame_sz_; } - virtual const unsigned int frame_number() const { return frame_; } + virtual size_t frame_size() const { return frame_sz_; } + virtual unsigned int frame_number() const { return frame_; } protected: std::string file_name_; FILE *input_file_; uint8_t *compressed_frame_buf_; - unsigned int frame_sz_; + size_t frame_sz_; unsigned int frame_; bool end_of_file_; }; diff --git a/libvpx/test/keyframe_test.cc b/libvpx/test/keyframe_test.cc index 7ee2898..d8b21a1 100644 --- a/libvpx/test/keyframe_test.cc +++ b/libvpx/test/keyframe_test.cc @@ -21,6 +21,7 @@ class KeyframeTest : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { protected: KeyframeTest() : EncoderTest(GET_PARAM(0)) {} + virtual ~KeyframeTest() {} virtual void SetUp() { InitializeConfig(); diff --git a/libvpx/test/md5_helper.h b/libvpx/test/md5_helper.h index 289f608..dd446f4 100644 --- a/libvpx/test/md5_helper.h +++ b/libvpx/test/md5_helper.h @@ -11,10 +11,8 @@ #ifndef TEST_MD5_HELPER_H_ #define TEST_MD5_HELPER_H_ -extern "C" { #include "./md5_utils.h" #include "vpx/vpx_decoder.h" -} namespace libvpx_test { class MD5 { diff --git a/libvpx/test/partial_idct_test.cc b/libvpx/test/partial_idct_test.cc new file mode 100644 index 0000000..8849ce6 --- /dev/null +++ b/libvpx/test/partial_idct_test.cc @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2013 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 <math.h> +#include <stdlib.h> +#include <string.h> + +#include "third_party/googletest/src/include/gtest/gtest.h" +#include "test/acm_random.h" +#include "test/clear_system_state.h" +#include "test/register_state_check.h" +#include "test/util.h" + +#include "./vp9_rtcd.h" +#include "vp9/common/vp9_blockd.h" +#include "vp9/common/vp9_scan.h" +#include "vpx/vpx_integer.h" + +using libvpx_test::ACMRandom; + +namespace { +typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride); +typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride); +typedef std::tr1::tuple<inv_txfm_t, + inv_txfm_t, + TX_SIZE, int> partial_itxfm_param_t; +const int kMaxNumCoeffs = 1024; +class PartialIDctTest : public ::testing::TestWithParam<partial_itxfm_param_t> { + public: + virtual ~PartialIDctTest() {} + virtual void SetUp() { + full_itxfm_ = GET_PARAM(0); + partial_itxfm_ = GET_PARAM(1); + tx_size_ = GET_PARAM(2); + last_nonzero_ = GET_PARAM(3); + } + + virtual void TearDown() { libvpx_test::ClearSystemState(); } + + protected: + int last_nonzero_; + TX_SIZE tx_size_; + inv_txfm_t full_itxfm_; + inv_txfm_t partial_itxfm_; +}; + +TEST_P(PartialIDctTest, ResultsMatch) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); + int size; + switch (tx_size_) { + case TX_4X4: + size = 4; + break; + case TX_8X8: + size = 8; + break; + case TX_16X16: + size = 16; + break; + case TX_32X32: + size = 32; + break; + default: + FAIL() << "Wrong Size!"; + break; + } + DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block1, kMaxNumCoeffs); + DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block2, kMaxNumCoeffs); + DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs); + DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs); + const int count_test_block = 1000; + const int max_coeff = 32766 / 4; + const int block_size = size * size; + int max_error = 0; + for (int i = 0; i < count_test_block; ++i) { + // clear out destination buffer + memset(dst1, 0, sizeof(*dst1) * block_size); + memset(dst2, 0, sizeof(*dst2) * block_size); + memset(test_coef_block1, 0, sizeof(*test_coef_block1) * block_size); + memset(test_coef_block2, 0, sizeof(*test_coef_block2) * block_size); + int max_energy_leftover = max_coeff * max_coeff; + for (int j = 0; j < last_nonzero_; ++j) { + int16_t coef = static_cast<int16_t>(sqrt(1.0 * max_energy_leftover) * + (rnd.Rand16() - 32768) / 65536); + max_energy_leftover -= coef * coef; + if (max_energy_leftover < 0) { + max_energy_leftover = 0; + coef = 0; + } + test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] = coef; + } + + memcpy(test_coef_block2, test_coef_block1, + sizeof(*test_coef_block2) * block_size); + + REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size)); + REGISTER_STATE_CHECK(partial_itxfm_(test_coef_block2, dst2, size)); + + for (int j = 0; j < block_size; ++j) { + const int diff = dst1[j] - dst2[j]; + const int error = diff * diff; + if (max_error < error) + max_error = error; + } + } + + EXPECT_EQ(0, max_error) + << "Error: partial inverse transform produces different results"; +} +using std::tr1::make_tuple; + +INSTANTIATE_TEST_CASE_P( + C, PartialIDctTest, + ::testing::Values( + make_tuple(&vp9_idct32x32_1024_add_c, + &vp9_idct32x32_34_add_c, + TX_32X32, 34), + make_tuple(&vp9_idct32x32_1024_add_c, + &vp9_idct32x32_1_add_c, + TX_32X32, 1), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_10_add_c, + TX_16X16, 10), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_1_add_c, + TX_16X16, 1), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_10_add_c, + TX_8X8, 10), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_1_add_c, + TX_8X8, 1), + make_tuple(&vp9_idct4x4_16_add_c, + &vp9_idct4x4_1_add_c, + TX_4X4, 1))); +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P( + NEON, PartialIDctTest, + ::testing::Values( + make_tuple(&vp9_idct32x32_1024_add_c, + &vp9_idct32x32_1_add_neon, + TX_32X32, 1), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_10_add_neon, + TX_16X16, 10), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_1_add_neon, + TX_16X16, 1), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_10_add_neon, + TX_8X8, 10), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_1_add_neon, + TX_8X8, 1), + make_tuple(&vp9_idct4x4_16_add_c, + &vp9_idct4x4_1_add_neon, + TX_4X4, 1))); +#endif + +#if HAVE_SSE2 +INSTANTIATE_TEST_CASE_P( + SSE2, PartialIDctTest, + ::testing::Values( + make_tuple(&vp9_idct32x32_1024_add_c, + &vp9_idct32x32_34_add_sse2, + TX_32X32, 34), + make_tuple(&vp9_idct32x32_1024_add_c, + &vp9_idct32x32_1_add_sse2, + TX_32X32, 1), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_10_add_sse2, + TX_16X16, 10), + make_tuple(&vp9_idct16x16_256_add_c, + &vp9_idct16x16_1_add_sse2, + TX_16X16, 1), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_10_add_sse2, + TX_8X8, 10), + make_tuple(&vp9_idct8x8_64_add_c, + &vp9_idct8x8_1_add_sse2, + TX_8X8, 1), + make_tuple(&vp9_idct4x4_16_add_c, + &vp9_idct4x4_1_add_sse2, + TX_4X4, 1))); +#endif +} // namespace diff --git a/libvpx/test/pp_filter_test.cc b/libvpx/test/pp_filter_test.cc index e5ac9db..ff7bb08 100644 --- a/libvpx/test/pp_filter_test.cc +++ b/libvpx/test/pp_filter_test.cc @@ -10,12 +10,10 @@ #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { #include "./vpx_config.h" #include "./vp8_rtcd.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" -} typedef void (*post_proc_func_t)(unsigned char *src_ptr, unsigned char *dst_ptr, diff --git a/libvpx/test/register_state_check.h b/libvpx/test/register_state_check.h index 479a42d..7e3d053 100644 --- a/libvpx/test/register_state_check.h +++ b/libvpx/test/register_state_check.h @@ -11,14 +11,15 @@ #ifndef TEST_REGISTER_STATE_CHECK_H_ #define TEST_REGISTER_STATE_CHECK_H_ -#ifdef _WIN64 +#include "third_party/googletest/src/include/gtest/gtest.h" +#include "./vpx_config.h" + +#if defined(_WIN64) #define _WIN32_LEAN_AND_MEAN #include <windows.h> #include <winnt.h> -#include "third_party/googletest/src/include/gtest/gtest.h" - namespace testing { namespace internal { @@ -81,7 +82,61 @@ class RegisterStateCheck { } // namespace libvpx_test -#else // !_WIN64 +#elif defined(CONFIG_SHARED) && defined(HAVE_NEON) \ + && !CONFIG_SHARED && HAVE_NEON + +#include "vpx/vpx_integer.h" + +extern "C" { +// Save the d8-d15 registers into store. +void vp9_push_neon(int64_t *store); +} + +namespace libvpx_test { + +// Compares the state of d8-d15 at construction with their state at +// destruction. These registers should be preserved by the callee on +// arm platform. +// Usage: +// { +// RegisterStateCheck reg_check; +// FunctionToVerify(); +// } +class RegisterStateCheck { + public: + RegisterStateCheck() { initialized_ = StoreRegisters(pre_store_); } + ~RegisterStateCheck() { EXPECT_TRUE(Check()); } + + private: + static bool StoreRegisters(int64_t store[8]) { + vp9_push_neon(store); + return true; + } + + // Compares the register state. Returns true if the states match. + bool Check() const { + if (!initialized_) return false; + int64_t post_store[8]; + vp9_push_neon(post_store); + for (int i = 0; i < 8; ++i) { + EXPECT_EQ(pre_store_[i], post_store[i]) << "d" + << i + 8 << " has been modified"; + } + return !testing::Test::HasNonfatalFailure(); + } + + bool initialized_; + int64_t pre_store_[8]; +}; + +#define REGISTER_STATE_CHECK(statement) do { \ + libvpx_test::RegisterStateCheck reg_check; \ + statement; \ +} while (false) + +} // namespace libvpx_test + +#else namespace libvpx_test { diff --git a/libvpx/test/resize_test.cc b/libvpx/test/resize_test.cc index e8c2c82..8d08f1e 100644 --- a/libvpx/test/resize_test.cc +++ b/libvpx/test/resize_test.cc @@ -146,16 +146,16 @@ TEST_P(ResizeTest, TestExternalResizeWorks) { ResizingVideoSource video; ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin(); + for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin(); info != frame_info_list_.end(); ++info) { - const vpx_codec_pts_t pts = info->pts; - const unsigned int expected_w = ScaleForFrameNumber(pts, kInitialWidth); - const unsigned int expected_h = ScaleForFrameNumber(pts, kInitialHeight); + const unsigned int frame = static_cast<unsigned>(info->pts); + const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth); + const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight); EXPECT_EQ(expected_w, info->w) - << "Frame " << pts << "had unexpected width"; + << "Frame " << frame << "had unexpected width"; EXPECT_EQ(expected_h, info->h) - << "Frame " << pts << "had unexpected height"; + << "Frame " << frame << "had unexpected height"; } } @@ -208,7 +208,7 @@ class ResizeInternalTest : public ResizeTest { virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { if (!frame0_psnr_) frame0_psnr_ = pkt->data.psnr.psnr[0]; - EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 1.5); + EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); } virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { @@ -247,7 +247,7 @@ TEST_P(ResizeInternalTest, TestInternalResizeWorks) { cfg_.g_lag_in_frames = 0; ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); - for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin(); + for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin(); info != frame_info_list_.end(); ++info) { const vpx_codec_pts_t pts = info->pts; if (pts >= kStepDownFrame && pts < kStepUpFrame) { diff --git a/libvpx/test/sad_test.cc b/libvpx/test/sad_test.cc index 453b3a8..a692891 100644 --- a/libvpx/test/sad_test.cc +++ b/libvpx/test/sad_test.cc @@ -13,7 +13,6 @@ #include <limits.h> #include <stdio.h> -extern "C" { #include "./vpx_config.h" #if CONFIG_VP8_ENCODER #include "./vp8_rtcd.h" @@ -22,7 +21,6 @@ extern "C" { #include "./vp9_rtcd.h" #endif #include "vpx_mem/vpx_mem.h" -} #include "test/acm_random.h" #include "test/clear_system_state.h" @@ -298,6 +296,8 @@ TEST_P(SADTest, MaxSAD) { using std::tr1::make_tuple; +//------------------------------------------------------------------------------ +// C functions #if CONFIG_VP8_ENCODER const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c; const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c; @@ -366,16 +366,20 @@ INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values( make_tuple(8, 4, sad_8x4x4d_c), make_tuple(4, 8, sad_4x8x4d_c), make_tuple(4, 4, sad_4x4x4d_c))); -#endif +#endif // CONFIG_VP9_ENCODER -// ARM tests +//------------------------------------------------------------------------------ +// ARM functions #if HAVE_MEDIA +#if CONFIG_VP8_ENCODER const sad_m_by_n_fn_t sad_16x16_armv6 = vp8_sad16x16_armv6; INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values( make_tuple(16, 16, sad_16x16_armv6))); - #endif +#endif + #if HAVE_NEON +#if CONFIG_VP8_ENCODER const sad_m_by_n_fn_t sad_16x16_neon = vp8_sad16x16_neon; const sad_m_by_n_fn_t sad_8x16_neon = vp8_sad8x16_neon; const sad_m_by_n_fn_t sad_16x8_neon = vp8_sad16x8_neon; @@ -388,8 +392,10 @@ INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values( make_tuple(8, 8, sad_8x8_neon), make_tuple(4, 4, sad_4x4_neon))); #endif +#endif -// X86 tests +//------------------------------------------------------------------------------ +// x86 functions #if HAVE_MMX #if CONFIG_VP8_ENCODER const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx; @@ -439,9 +445,9 @@ const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse = vp9_sad4x4x4d_sse; INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values( make_tuple(4, 8, sad_4x8x4d_sse), make_tuple(4, 4, sad_4x4x4d_sse))); -#endif -#endif -#endif +#endif // CONFIG_USE_X86INC +#endif // CONFIG_VP9_ENCODER +#endif // HAVE_SSE #if HAVE_SSE2 #if CONFIG_VP8_ENCODER @@ -539,10 +545,12 @@ INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values( #if HAVE_SSSE3 #if CONFIG_USE_X86INC +#if CONFIG_VP8_ENCODER const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3; INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values( make_tuple(16, 16, sad_16x16_sse3))); #endif #endif +#endif } // namespace diff --git a/libvpx/test/set_roi.cc b/libvpx/test/set_roi.cc index 9d2e771..e28f511 100644 --- a/libvpx/test/set_roi.cc +++ b/libvpx/test/set_roi.cc @@ -18,11 +18,9 @@ #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/acm_random.h" +#include "vp8/encoder/onyx_int.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" -extern "C" { -#include "vp8/encoder/onyx_int.h" -} using libvpx_test::ACMRandom; diff --git a/libvpx/test/sixtap_predict_test.cc b/libvpx/test/sixtap_predict_test.cc index ee4faac..0c600f4 100644 --- a/libvpx/test/sixtap_predict_test.cc +++ b/libvpx/test/sixtap_predict_test.cc @@ -1,12 +1,12 @@ /* -* Copyright (c) 2012 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. -*/ + * Copyright (c) 2013 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 <math.h> #include <stdlib.h> @@ -16,12 +16,10 @@ #include "test/register_state_check.h" #include "test/util.h" #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { #include "./vpx_config.h" #include "./vp8_rtcd.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" -} namespace { @@ -32,7 +30,10 @@ typedef void (*sixtap_predict_fn_t)(uint8_t *src_ptr, uint8_t *dst_ptr, int dst_pitch); -class SixtapPredictTest : public PARAMS(int, int, sixtap_predict_fn_t) { +typedef std::tr1::tuple<int, int, sixtap_predict_fn_t> sixtap_predict_param_t; + +class SixtapPredictTest + : public ::testing::TestWithParam<sixtap_predict_param_t> { public: static void SetUpTestCase() { src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize)); @@ -192,6 +193,16 @@ INSTANTIATE_TEST_CASE_P( make_tuple(8, 8, sixtap_8x8_c), make_tuple(8, 4, sixtap_8x4_c), make_tuple(4, 4, sixtap_4x4_c))); +#if HAVE_NEON +const sixtap_predict_fn_t sixtap_16x16_neon = vp8_sixtap_predict16x16_neon; +const sixtap_predict_fn_t sixtap_8x8_neon = vp8_sixtap_predict8x8_neon; +const sixtap_predict_fn_t sixtap_8x4_neon = vp8_sixtap_predict8x4_neon; +INSTANTIATE_TEST_CASE_P( + DISABLED_NEON, SixtapPredictTest, ::testing::Values( + make_tuple(16, 16, sixtap_16x16_neon), + make_tuple(8, 8, sixtap_8x8_neon), + make_tuple(8, 4, sixtap_8x4_neon))); +#endif #if HAVE_MMX const sixtap_predict_fn_t sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx; const sixtap_predict_fn_t sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx; diff --git a/libvpx/test/subtract_test.cc b/libvpx/test/subtract_test.cc index d1f2729..3efb955 100644 --- a/libvpx/test/subtract_test.cc +++ b/libvpx/test/subtract_test.cc @@ -12,13 +12,11 @@ #include "test/acm_random.h" #include "test/clear_system_state.h" #include "test/register_state_check.h" -extern "C" { #include "./vpx_config.h" #include "./vp8_rtcd.h" #include "vp8/common/blockd.h" #include "vp8/encoder/block.h" #include "vpx_mem/vpx_mem.h" -} typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch); @@ -61,7 +59,7 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { int16_t *src_diff = be.src_diff; for (int r = 0; r < kBlockHeight; ++r) { for (int c = 0; c < kBlockWidth; ++c) { - src_diff[c] = static_cast<int16_t>(0xa5a5); + src_diff[c] = static_cast<int16_t>(0xa5a5u); } src_diff += kDiffPredStride; } @@ -107,6 +105,11 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { INSTANTIATE_TEST_CASE_P(C, SubtractBlockTest, ::testing::Values(vp8_subtract_b_c)); +#if HAVE_NEON +INSTANTIATE_TEST_CASE_P(NEON, SubtractBlockTest, + ::testing::Values(vp8_subtract_b_neon)); +#endif + #if HAVE_MMX INSTANTIATE_TEST_CASE_P(MMX, SubtractBlockTest, ::testing::Values(vp8_subtract_b_mmx)); diff --git a/libvpx/test/superframe_test.cc b/libvpx/test/superframe_test.cc index d91e7b1..c0f542d 100644 --- a/libvpx/test/superframe_test.cc +++ b/libvpx/test/superframe_test.cc @@ -21,6 +21,7 @@ class SuperframeTest : public ::libvpx_test::EncoderTest, protected: SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL), last_sf_pts_(0) {} + virtual ~SuperframeTest() {} virtual void SetUp() { InitializeConfig(); diff --git a/libvpx/test/svc_test.cc b/libvpx/test/svc_test.cc index 98a5d94..dff2ec7 100644 --- a/libvpx/test/svc_test.cc +++ b/libvpx/test/svc_test.cc @@ -41,7 +41,6 @@ class SvcTest : public ::testing::Test { virtual ~SvcTest() {} virtual void SetUp() { - svc_.first_frame_full_size = 1; svc_.encoding_mode = INTER_LAYER_PREDICTION_IP; svc_.log_level = SVC_LOG_DEBUG; svc_.log_print = 0; @@ -178,21 +177,48 @@ TEST_F(SvcTest, SetQuantizersOption) { codec_initialized_ = true; } +TEST_F(SvcTest, SetKeyFrameQuantizersOption) { + svc_.spatial_layers = 2; + vpx_codec_err_t res = vpx_svc_set_options(&svc_, + "quantizers-keyframe=not-quantizers"); + EXPECT_EQ(VPX_CODEC_OK, res); + res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); + EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); + + vpx_svc_set_options(&svc_, "quantizers-keyframe=40,45"); + res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); + EXPECT_EQ(VPX_CODEC_OK, res); + codec_initialized_ = true; +} + TEST_F(SvcTest, SetQuantizers) { - vpx_codec_err_t res = vpx_svc_set_quantizers(NULL, "40,30"); + vpx_codec_err_t res = vpx_svc_set_quantizers(NULL, "40,30", 0); EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); - res = vpx_svc_set_quantizers(&svc_, NULL); + res = vpx_svc_set_quantizers(&svc_, NULL, 0); EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); - svc_.first_frame_full_size = 0; svc_.spatial_layers = 2; - res = vpx_svc_set_quantizers(&svc_, "40"); + res = vpx_svc_set_quantizers(&svc_, "40", 0); + EXPECT_EQ(VPX_CODEC_OK, res); + res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); + EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); + + res = vpx_svc_set_quantizers(&svc_, "40,30", 0); EXPECT_EQ(VPX_CODEC_OK, res); res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); + EXPECT_EQ(VPX_CODEC_OK, res); + codec_initialized_ = true; +} + +TEST_F(SvcTest, SetKeyFrameQuantizers) { + vpx_codec_err_t res = vpx_svc_set_quantizers(NULL, "40,31", 1); EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); - res = vpx_svc_set_quantizers(&svc_, "40,30"); + res = vpx_svc_set_quantizers(&svc_, NULL, 1); + EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); + + res = vpx_svc_set_quantizers(&svc_, "40,30", 1); EXPECT_EQ(VPX_CODEC_OK, res); res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); EXPECT_EQ(VPX_CODEC_OK, res); @@ -206,7 +232,6 @@ TEST_F(SvcTest, SetScaleFactors) { res = vpx_svc_set_scale_factors(&svc_, NULL); EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); - svc_.first_frame_full_size = 0; svc_.spatial_layers = 2; res = vpx_svc_set_scale_factors(&svc_, "4/16"); EXPECT_EQ(VPX_CODEC_OK, res); @@ -220,14 +245,11 @@ TEST_F(SvcTest, SetScaleFactors) { codec_initialized_ = true; } -// test that decoder can handle an SVC frame as the first frame in a sequence -// this test is disabled since it always fails because of a decoder issue -// https://code.google.com/p/webm/issues/detail?id=654 -TEST_F(SvcTest, DISABLED_FirstFrameHasLayers) { - svc_.first_frame_full_size = 0; +// Test that decoder can handle an SVC frame as the first frame in a sequence. +TEST_F(SvcTest, FirstFrameHasLayers) { svc_.spatial_layers = 2; vpx_svc_set_scale_factors(&svc_, "4/16,16/16"); - vpx_svc_set_quantizers(&svc_, "40,30"); + vpx_svc_set_quantizers(&svc_, "40,30", 0); vpx_codec_err_t res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); @@ -240,7 +262,7 @@ TEST_F(SvcTest, DISABLED_FirstFrameHasLayers) { video.Begin(); res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), - video.duration(), VPX_DL_REALTIME); + video.duration(), VPX_DL_GOOD_QUALITY); EXPECT_EQ(VPX_CODEC_OK, res); const vpx_codec_err_t res_dec = decoder_->DecodeFrame( @@ -252,10 +274,9 @@ TEST_F(SvcTest, DISABLED_FirstFrameHasLayers) { } TEST_F(SvcTest, EncodeThreeFrames) { - svc_.first_frame_full_size = 1; svc_.spatial_layers = 2; vpx_svc_set_scale_factors(&svc_, "4/16,16/16"); - vpx_svc_set_quantizers(&svc_, "40,30"); + vpx_svc_set_quantizers(&svc_, "40,30", 0); vpx_codec_err_t res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); @@ -265,11 +286,11 @@ TEST_F(SvcTest, EncodeThreeFrames) { libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight, codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30); - // FRAME 1 + // FRAME 0 video.Begin(); - // this frame is full size, with only one layer + // This frame is a keyframe. res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), - video.duration(), VPX_DL_REALTIME); + video.duration(), VPX_DL_GOOD_QUALITY); ASSERT_EQ(VPX_CODEC_OK, res); EXPECT_EQ(1, vpx_svc_is_keyframe(&svc_)); @@ -278,13 +299,13 @@ TEST_F(SvcTest, EncodeThreeFrames) { vpx_svc_get_frame_size(&svc_)); ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError(); - // FRAME 2 + // FRAME 1 video.Next(); - // this is an I-frame + // This is a P-frame. res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), - video.duration(), VPX_DL_REALTIME); + video.duration(), VPX_DL_GOOD_QUALITY); ASSERT_EQ(VPX_CODEC_OK, res); - EXPECT_EQ(1, vpx_svc_is_keyframe(&svc_)); + EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_)); res_dec = decoder_->DecodeFrame( static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)), @@ -293,9 +314,9 @@ TEST_F(SvcTest, EncodeThreeFrames) { // FRAME 2 video.Next(); - // this is a P-frame + // This is a P-frame. res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), - video.duration(), VPX_DL_REALTIME); + video.duration(), VPX_DL_GOOD_QUALITY); ASSERT_EQ(VPX_CODEC_OK, res); EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_)); @@ -306,10 +327,9 @@ TEST_F(SvcTest, EncodeThreeFrames) { } TEST_F(SvcTest, GetLayerResolution) { - svc_.first_frame_full_size = 0; svc_.spatial_layers = 2; vpx_svc_set_scale_factors(&svc_, "4/16,8/16"); - vpx_svc_set_quantizers(&svc_, "40,30"); + vpx_svc_set_quantizers(&svc_, "40,30", 0); vpx_codec_err_t res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); @@ -342,4 +362,39 @@ TEST_F(SvcTest, GetLayerResolution) { EXPECT_EQ(kHeight * 8 / 16, layer_height); } +TEST_F(SvcTest, FirstPassEncode) { + svc_.spatial_layers = 2; + codec_enc_.g_pass = VPX_RC_FIRST_PASS; + vpx_svc_set_scale_factors(&svc_, "4/16,16/16"); + vpx_svc_set_quantizers(&svc_, "40,30", 0); + + vpx_codec_err_t res = + vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); + ASSERT_EQ(VPX_CODEC_OK, res); + codec_initialized_ = true; + + libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight, + codec_enc_.g_timebase.den, + codec_enc_.g_timebase.num, 0, 30); + // FRAME 0 + video.Begin(); + res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U); + + // FRAME 1 + video.Next(); + res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U); + + // Flush encoder and test EOS packet + res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(), + video.duration(), VPX_DL_GOOD_QUALITY); + ASSERT_EQ(VPX_CODEC_OK, res); + EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U); +} + } // namespace diff --git a/libvpx/test/test-data.sha1 b/libvpx/test/test-data.sha1 index 5229d09..6f718ef 100644 --- a/libvpx/test/test-data.sha1 +++ b/libvpx/test/test-data.sha1 @@ -1,5 +1,6 @@ d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv b87815bf86020c592ccc7a846ba2e28ec8043902 hantro_odd.yuv +b1f1c3ec79114b9a0651af24ce634afb44a9a419 rush_hour_444.y4m 5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf 65bf1bbbced81b97bd030f376d1b7f61a224793f vp80-00-comprehensive-002.ivf 906b4c1e99eb734504c504b3f1ad8052137ce672 vp80-00-comprehensive-003.ivf @@ -61,6 +62,7 @@ c87599cbecd72d4cd4f7ace3313b7a6bc6eb8163 vp80-05-sharpness-1438.ivf aff51d865c2621b60510459244ea83e958e4baed vp80-05-sharpness-1439.ivf da386e72b19b5485a6af199c5eb60ef25e510dd1 vp80-05-sharpness-1440.ivf 6759a095203d96ccd267ce09b1b050b8cc4c2f1f vp80-05-sharpness-1443.ivf +b95d3cc1d0df991e63e150a801710a72f20d9ba0 vp80-06-smallsize.ivf db55ec7fd02c864ba996ff060b25b1e08611330b vp80-00-comprehensive-001.ivf.md5 29db0ad011cba1e45f856d5623cd38dac3e3bf19 vp80-00-comprehensive-002.ivf.md5 e84f258f69e173e7d68f8f8c037a0a3766902182 vp80-00-comprehensive-003.ivf.md5 @@ -122,6 +124,7 @@ f95eb6214571434f1f73ab7833b9ccdf47588020 vp80-03-segmentation-1437.ivf.md5 086c56378df81b6cee264d7540a7b8f2b405c7a4 vp80-05-sharpness-1439.ivf.md5 d32dc2c4165eb266ea4c23c14a45459b363def32 vp80-05-sharpness-1440.ivf.md5 8c69dc3d8e563f56ffab5ad1e400d9e689dd23df vp80-05-sharpness-1443.ivf.md5 +d6f246df012c241b5fa6c1345019a3703d85c419 vp80-06-smallsize.ivf.md5 ce881e567fe1d0fbcb2d3e9e6281a1a8d74d82e0 vp90-2-00-quantizer-00.webm ac5eda33407d0521c7afca43a63fd305c0cd9d13 vp90-2-00-quantizer-00.webm.md5 2ca0463f2cfb93d25d7dded174db70b7cb87cb48 vp90-2-00-quantizer-01.webm @@ -542,3 +545,46 @@ c9b237dfcc01c1b414fbcaa481d014a906ef7998 vp90-2-08-tile_1x4.webm.md5 ae7451810247fd13975cc257aa0301ff17102255 vp90-2-08-tile-4x4.webm.md5 2ec6e15422ac7a61af072dc5f27fcaf1942ce116 vp90-2-08-tile-4x1.webm 0094f5ee5e46345017c30e0aa4835b550212d853 vp90-2-08-tile-4x1.webm.md5 +edea45dac4a3c2e5372339f8851d24c9bef803d6 vp90-2-09-subpixel-00.ivf +5428efc4bf92191faedf4a727fcd1d94966a7abc vp90-2-09-subpixel-00.ivf.md5 +8cdd435d89029987ee196896e21520e5f879f04d vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm +091b373aa2ecb59aa5c647affd5bcafcc7547364 vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm +87ee28032b0963a44b73a850fcc816a6dc83efbb vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm +c6ce25c4bfd4bdfc2932b70428e3dfe11210ec4f vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm +2064bdb22aa71c2691e0469fb62e8087a43f08f8 vp90-2-bbb_426x240_tile_1x1_180kbps.webm +8080eda22694910162f0996e8a962612f381a57f vp90-2-bbb_640x360_tile_1x2_337kbps.webm +a484b335c27ea189c0f0d77babea4a510ce12d50 vp90-2-bbb_854x480_tile_1x2_651kbps.webm +3eacf1f006250be4cc5c92a7ef146e385ee62653 vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm +217f089a16447490823127b36ce0d945522accfd vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm +eedb3c641e60dacbe082491a16df529a5c9187df vp90-2-sintel_426x182_tile_1x1_171kbps.webm +cb7e4955af183dff33bcba0c837f0922ab066400 vp90-2-sintel_640x272_tile_1x2_318kbps.webm +48613f9380e2580002f8a09d6e412ea4e89a52b9 vp90-2-sintel_854x364_tile_1x2_621kbps.webm +990a91f24dd284562d21d714ae773dff5452cad8 vp90-2-tos_1280x534_tile_1x4_1306kbps.webm +b6dd558c90bca466b4bcbd03b3371648186465a7 vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm +1a9c2914ba932a38f0a143efc1ad0e318e78888b vp90-2-tos_426x178_tile_1x1_181kbps.webm +a3d2b09f24debad4747a1b3066f572be4273bced vp90-2-tos_640x266_tile_1x2_336kbps.webm +c64b03b5c090e6888cb39685c31f00a6b79fa45c vp90-2-tos_854x356_tile_1x2_656kbps.webm +0e7cd4135b231c9cea8d76c19f9e84b6fd77acec vp90-2-08-tile_1x8_frame_parallel.webm +c9b6850af28579b031791066457f4cb40df6e1c7 vp90-2-08-tile_1x8_frame_parallel.webm.md5 +e448b6e83490bca0f8d58b4f4b1126a17baf4b0c vp90-2-08-tile_1x8.webm +5e524165f0397e6141d914f4f0a66267d7658376 vp90-2-08-tile_1x8.webm.md5 +a34e14923d6d17b1144254d8187d7f85b700a63c vp90-2-02-size-lf-1920x1080.webm +e3b28ddcfaeb37fb4d132b93f92642a9ad17c22d vp90-2-02-size-lf-1920x1080.webm.md5 +d48c5db1b0f8e60521a7c749696b8067886033a3 vp90-2-09-aq2.webm +84c1599298aac78f2fc05ae2274575d10569dfa0 vp90-2-09-aq2.webm.md5 +55fc55ed73d578ed60fad05692579873f8bad758 vp90-2-09-lf_deltas.webm +54638c38009198c38c8f3b25c182b709b6c1fd2e vp90-2-09-lf_deltas.webm.md5 +510d95f3beb3b51c572611fdaeeece12277dac30 vp90-2-10-show-existing-frame.webm +14d631096f4bfa2d71f7f739aec1448fb3c33bad vp90-2-10-show-existing-frame.webm.md5 +b4318e75f73a6a08992c7326de2fb589c2a794c7 vp90-2-11-size-351x287.webm +b3c48382cf7d0454e83a02497c229d27720f9e20 vp90-2-11-size-351x287.webm.md5 +8e0096475ea2535bac71d3e2fc09e0c451c444df vp90-2-11-size-351x288.webm +19e003804ec1dfc5464813b32339a15d5ba7b42f vp90-2-11-size-351x288.webm.md5 +40cd1d6a188d7a88b21ebac1e573d3f270ab261e vp90-2-11-size-352x287.webm +68f515abe3858fc1eded46c8e6b2f727d43b5331 vp90-2-11-size-352x287.webm.md5 +9a510769ff23db410880ec3029d433e87d17f7fc vp90-2-12-droppable_1.ivf +952eaac6eefa6f62179ed1db3e922fd42fecc624 vp90-2-12-droppable_1.ivf.md5 +9a510769ff23db410880ec3029d433e87d17f7fc vp90-2-12-droppable_2.ivf +92a756469fa438220524e7fa6ac1d38c89514d17 vp90-2-12-droppable_2.ivf.md5 +c21e97e4ba486520118d78b01a5cb6e6dc33e190 vp90-2-12-droppable_3.ivf +601abc9e4176c70f82ac0381365e9b151fdd24cd vp90-2-12-droppable_3.ivf.md5 diff --git a/libvpx/test/test.mk b/libvpx/test/test.mk index ac072d0..175bc52 100644 --- a/libvpx/test/test.mk +++ b/libvpx/test/test.mk @@ -1,10 +1,12 @@ +LIBVPX_TEST_SRCS-yes += acm_random.h LIBVPX_TEST_SRCS-yes += clear_system_state.h +LIBVPX_TEST_SRCS-yes += codec_factory.h +LIBVPX_TEST_SRCS-yes += md5_helper.h LIBVPX_TEST_SRCS-yes += register_state_check.h LIBVPX_TEST_SRCS-yes += test.mk -LIBVPX_TEST_SRCS-yes += acm_random.h -LIBVPX_TEST_SRCS-yes += md5_helper.h -LIBVPX_TEST_SRCS-yes += codec_factory.h LIBVPX_TEST_SRCS-yes += test_libvpx.cc +LIBVPX_TEST_SRCS-yes += test_vectors.cc +LIBVPX_TEST_SRCS-yes += test_vectors.h LIBVPX_TEST_SRCS-yes += util.h LIBVPX_TEST_SRCS-yes += video_source.h @@ -13,38 +15,49 @@ LIBVPX_TEST_SRCS-yes += video_source.h ## ## Black box tests only use the public API. ## +LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../md5_utils.h ../md5_utils.c +LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += aq_segment_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += datarate_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h + LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += altref_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += datarate_test.cc - -LIBVPX_TEST_SRCS-yes += encode_test_driver.cc -LIBVPX_TEST_SRCS-yes += encode_test_driver.h -LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc + +LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += resize_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += resize_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_lossless_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../md5_utils.h ../md5_utils.c LIBVPX_TEST_SRCS-yes += decode_test_driver.cc LIBVPX_TEST_SRCS-yes += decode_test_driver.h -LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h +LIBVPX_TEST_SRCS-yes += encode_test_driver.cc +LIBVPX_TEST_SRCS-yes += encode_test_driver.h ## WebM Parsing -NESTEGG_SRCS += ../nestegg/halloc/halloc.h -NESTEGG_SRCS += ../nestegg/halloc/src/align.h -NESTEGG_SRCS += ../nestegg/halloc/src/halloc.c -NESTEGG_SRCS += ../nestegg/halloc/src/hlist.h -NESTEGG_SRCS += ../nestegg/include/nestegg/nestegg.h -NESTEGG_SRCS += ../nestegg/src/nestegg.c +NESTEGG_SRCS += ../third_party/nestegg/halloc/halloc.h +NESTEGG_SRCS += ../third_party/nestegg/halloc/src/align.h +NESTEGG_SRCS += ../third_party/nestegg/halloc/src/halloc.c +NESTEGG_SRCS += ../third_party/nestegg/halloc/src/hlist.h +NESTEGG_SRCS += ../third_party/nestegg/include/nestegg/nestegg.h +NESTEGG_SRCS += ../third_party/nestegg/src/nestegg.c LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += $(NESTEGG_SRCS) LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += test_vector_test.cc +# Currently we only support decoder perf tests for vp9 +ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP9_DECODER), yesyes) +LIBVPX_TEST_SRCS-yes += decode_perf_test.cc +endif + ## ## WHITE BOX TESTS ## @@ -61,18 +74,17 @@ ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes) LIBVPX_TEST_SRCS-yes += vp8_boolcoder_test.cc endif -LIBVPX_TEST_SRCS-yes += idct_test.cc -LIBVPX_TEST_SRCS-yes += intrapred_test.cc LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += vp8_decrypt_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc -LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += subtract_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_subtract_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += variance_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += vp8_decrypt_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_fdct4x4_test.cc +LIBVPX_TEST_SRCS-yes += idct_test.cc +LIBVPX_TEST_SRCS-yes += intrapred_test.cc +LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc + endif # VP8 ## VP9 @@ -80,28 +92,30 @@ ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),) # These tests require both the encoder and decoder to be built. ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),yesyes) -LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc - # IDCT test currently depends on FDCT function LIBVPX_TEST_SRCS-yes += idct8x8_test.cc +LIBVPX_TEST_SRCS-yes += partial_idct_test.cc LIBVPX_TEST_SRCS-yes += superframe_test.cc LIBVPX_TEST_SRCS-yes += tile_independence_test.cc +LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc + endif LIBVPX_TEST_SRCS-$(CONFIG_VP9) += convolve_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_thread_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc - -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct32x32_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc +LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_subtract_test.cc endif # VP9 +LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc -endif +endif # CONFIG_SHARED ## @@ -109,129 +123,132 @@ endif ## LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv +LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-06-smallsize.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-06-smallsize.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-00.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-00.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-01.webm @@ -502,6 +519,10 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x64.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x64.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x66.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x66.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-lf-1920x1080.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-lf-1920x1080.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x196.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x196.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x198.webm @@ -630,25 +651,87 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x224.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x224.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x226.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x226.webm.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-05-resize.ivf LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-05-resize.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-06-bilinear.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-06-bilinear.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-07-frame_parallel.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-07-frame_parallel.webm.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2.webm.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4.webm.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm.md5 -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm -LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8_frame_parallel.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8_frame_parallel.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-aq2.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-aq2.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-lf_deltas.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-lf_deltas.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-subpixel-00.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-subpixel-00.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-10-show-existing-frame.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-10-show-existing-frame.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x287.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x287.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x288.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x288.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-352x287.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-352x287.webm.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_1.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_1.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_2.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_2.ivf.md5 +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_3.ivf +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_3.ivf.md5 LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yv444.webm LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yv444.webm.md5 + +ifeq ($(CONFIG_DECODE_PERF_TESTS),yes) +# BBB VP9 streams +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_426x240_tile_1x1_180kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_640x360_tile_1x2_337kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_854x480_tile_1x2_651kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm +#Sintel VP9 streams +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-sintel_426x182_tile_1x1_171kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-sintel_640x272_tile_1x2_318kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-sintel_854x364_tile_1x2_621kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm +# TOS VP9 streams +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-tos_426x178_tile_1x1_181kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-tos_640x266_tile_1x2_336kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-tos_854x356_tile_1x2_656kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-tos_1280x534_tile_1x4_1306kbps.webm +LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \ + vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm +endif # CONFIG_DECODE_PERF_TESTS diff --git a/libvpx/test/test_libvpx.cc b/libvpx/test/test_libvpx.cc index 80aca98..fc035af 100644 --- a/libvpx/test/test_libvpx.cc +++ b/libvpx/test/test_libvpx.cc @@ -9,10 +9,10 @@ */ #include <string> #include "./vpx_config.h" -extern "C" { #if ARCH_X86 || ARCH_X86_64 #include "vpx_ports/x86.h" #endif +extern "C" { #if CONFIG_VP8 extern void vp8_rtcd(); #endif @@ -22,8 +22,10 @@ extern void vp9_rtcd(); } #include "third_party/googletest/src/include/gtest/gtest.h" -static void append_gtest_filter(const char *str) { +static void append_negative_gtest_filter(const char *str) { std::string filter = ::testing::FLAGS_gtest_filter; + // Negative patterns begin with one '-' followed by a ':' separated list. + if (filter.find('-') == std::string::npos) filter += '-'; filter += str; ::testing::FLAGS_gtest_filter = filter; } @@ -34,21 +36,21 @@ int main(int argc, char **argv) { #if ARCH_X86 || ARCH_X86_64 const int simd_caps = x86_simd_caps(); if (!(simd_caps & HAS_MMX)) - append_gtest_filter(":-MMX/*"); + append_negative_gtest_filter(":MMX/*"); if (!(simd_caps & HAS_SSE)) - append_gtest_filter(":-SSE/*"); + append_negative_gtest_filter(":SSE/*"); if (!(simd_caps & HAS_SSE2)) - append_gtest_filter(":-SSE2/*"); + append_negative_gtest_filter(":SSE2/*"); if (!(simd_caps & HAS_SSE3)) - append_gtest_filter(":-SSE3/*"); + append_negative_gtest_filter(":SSE3/*"); if (!(simd_caps & HAS_SSSE3)) - append_gtest_filter(":-SSSE3/*"); + append_negative_gtest_filter(":SSSE3/*"); if (!(simd_caps & HAS_SSE4_1)) - append_gtest_filter(":-SSE4_1/*"); + append_negative_gtest_filter(":SSE4_1/*"); if (!(simd_caps & HAS_AVX)) - append_gtest_filter(":-AVX/*"); + append_negative_gtest_filter(":AVX/*"); if (!(simd_caps & HAS_AVX2)) - append_gtest_filter(":-AVX2/*"); + append_negative_gtest_filter(":AVX2/*"); #endif #if !CONFIG_SHARED diff --git a/libvpx/test/test_vector_test.cc b/libvpx/test/test_vector_test.cc index 08449a5..53b7636 100644 --- a/libvpx/test/test_vector_test.cc +++ b/libvpx/test/test_vector_test.cc @@ -1,11 +1,11 @@ /* - Copyright (c) 2012 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. + * Copyright (c) 2013 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 <cstdio> @@ -15,161 +15,13 @@ #include "test/codec_factory.h" #include "test/decode_test_driver.h" #include "test/ivf_video_source.h" -#include "test/webm_video_source.h" -#include "test/util.h" #include "test/md5_helper.h" -extern "C" { +#include "test/test_vectors.h" +#include "test/util.h" +#include "test/webm_video_source.h" #include "vpx_mem/vpx_mem.h" -} namespace { -#if CONFIG_VP8_DECODER -const char *kVP8TestVectors[] = { - "vp80-00-comprehensive-001.ivf", - "vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf", - "vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf", - "vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf", - "vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf", - "vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf", - "vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf", - "vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf", - "vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf", - "vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf", - "vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf", - "vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf", - "vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf", - "vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf", - "vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf", - "vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf", - "vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf", - "vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf", - "vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf", - "vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf", - "vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf", - "vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf", - "vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf", - "vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf", - "vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf", - "vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf", - "vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf", - "vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf", - "vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf", - "vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf", - "vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf" -}; -#endif -#if CONFIG_VP9_DECODER -const char *kVP9TestVectors[] = { - "vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm", - "vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm", - "vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm", - "vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm", - "vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm", - "vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm", - "vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm", - "vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm", - "vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm", - "vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm", - "vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm", - "vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm", - "vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm", - "vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm", - "vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm", - "vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm", - "vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm", - "vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm", - "vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm", - "vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm", - "vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm", - "vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm", - "vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm", - "vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm", - "vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm", - "vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm", - "vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm", - "vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm", - "vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm", - "vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm", - "vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm", - "vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm", - "vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm", - "vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm", - "vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm", - "vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm", - "vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm", - "vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm", - "vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm", - "vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm", - "vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm", - "vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm", - "vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm", - "vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm", - "vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm", - "vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm", - "vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm", - "vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm", - "vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm", - "vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm", - "vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.webm", - "vp90-2-02-size-18x66.webm", "vp90-2-02-size-32x08.webm", - "vp90-2-02-size-32x10.webm", "vp90-2-02-size-32x16.webm", - "vp90-2-02-size-32x18.webm", "vp90-2-02-size-32x32.webm", - "vp90-2-02-size-32x34.webm", "vp90-2-02-size-32x64.webm", - "vp90-2-02-size-32x66.webm", "vp90-2-02-size-34x08.webm", - "vp90-2-02-size-34x10.webm", "vp90-2-02-size-34x16.webm", - "vp90-2-02-size-34x18.webm", "vp90-2-02-size-34x32.webm", - "vp90-2-02-size-34x34.webm", "vp90-2-02-size-34x64.webm", - "vp90-2-02-size-34x66.webm", "vp90-2-02-size-64x08.webm", - "vp90-2-02-size-64x10.webm", "vp90-2-02-size-64x16.webm", - "vp90-2-02-size-64x18.webm", "vp90-2-02-size-64x32.webm", - "vp90-2-02-size-64x34.webm", "vp90-2-02-size-64x64.webm", - "vp90-2-02-size-64x66.webm", "vp90-2-02-size-66x08.webm", - "vp90-2-02-size-66x10.webm", "vp90-2-02-size-66x16.webm", - "vp90-2-02-size-66x18.webm", "vp90-2-02-size-66x32.webm", - "vp90-2-02-size-66x34.webm", "vp90-2-02-size-66x64.webm", - "vp90-2-02-size-66x66.webm", "vp90-2-03-size-196x196.webm", - "vp90-2-03-size-196x198.webm", "vp90-2-03-size-196x200.webm", - "vp90-2-03-size-196x202.webm", "vp90-2-03-size-196x208.webm", - "vp90-2-03-size-196x210.webm", "vp90-2-03-size-196x224.webm", - "vp90-2-03-size-196x226.webm", "vp90-2-03-size-198x196.webm", - "vp90-2-03-size-198x198.webm", "vp90-2-03-size-198x200.webm", - "vp90-2-03-size-198x202.webm", "vp90-2-03-size-198x208.webm", - "vp90-2-03-size-198x210.webm", "vp90-2-03-size-198x224.webm", - "vp90-2-03-size-198x226.webm", "vp90-2-03-size-200x196.webm", - "vp90-2-03-size-200x198.webm", "vp90-2-03-size-200x200.webm", - "vp90-2-03-size-200x202.webm", "vp90-2-03-size-200x208.webm", - "vp90-2-03-size-200x210.webm", "vp90-2-03-size-200x224.webm", - "vp90-2-03-size-200x226.webm", "vp90-2-03-size-202x196.webm", - "vp90-2-03-size-202x198.webm", "vp90-2-03-size-202x200.webm", - "vp90-2-03-size-202x202.webm", "vp90-2-03-size-202x208.webm", - "vp90-2-03-size-202x210.webm", "vp90-2-03-size-202x224.webm", - "vp90-2-03-size-202x226.webm", "vp90-2-03-size-208x196.webm", - "vp90-2-03-size-208x198.webm", "vp90-2-03-size-208x200.webm", - "vp90-2-03-size-208x202.webm", "vp90-2-03-size-208x208.webm", - "vp90-2-03-size-208x210.webm", "vp90-2-03-size-208x224.webm", - "vp90-2-03-size-208x226.webm", "vp90-2-03-size-210x196.webm", - "vp90-2-03-size-210x198.webm", "vp90-2-03-size-210x200.webm", - "vp90-2-03-size-210x202.webm", "vp90-2-03-size-210x208.webm", - "vp90-2-03-size-210x210.webm", "vp90-2-03-size-210x224.webm", - "vp90-2-03-size-210x226.webm", "vp90-2-03-size-224x196.webm", - "vp90-2-03-size-224x198.webm", "vp90-2-03-size-224x200.webm", - "vp90-2-03-size-224x202.webm", "vp90-2-03-size-224x208.webm", - "vp90-2-03-size-224x210.webm", "vp90-2-03-size-224x224.webm", - "vp90-2-03-size-224x226.webm", "vp90-2-03-size-226x196.webm", - "vp90-2-03-size-226x198.webm", "vp90-2-03-size-226x200.webm", - "vp90-2-03-size-226x202.webm", "vp90-2-03-size-226x208.webm", - "vp90-2-03-size-226x210.webm", "vp90-2-03-size-226x224.webm", - "vp90-2-03-size-226x226.webm", "vp90-2-03-deltaq.webm", - "vp90-2-05-resize.ivf", "vp90-2-06-bilinear.webm", - "vp90-2-07-frame_parallel.webm", - "vp90-2-08-tile_1x2_frame_parallel.webm", "vp90-2-08-tile_1x2.webm", - "vp90-2-08-tile_1x4_frame_parallel.webm", "vp90-2-08-tile_1x4.webm", - "vp90-2-08-tile-4x4.webm", "vp90-2-08-tile-4x1.webm", -#if CONFIG_NON420 - "vp91-2-04-yv444.webm" -#endif -}; -#endif class TestVectorTest : public ::libvpx_test::DecoderTest, public ::libvpx_test::CodecTestWithParam<const char*> { @@ -183,7 +35,7 @@ class TestVectorTest : public ::libvpx_test::DecoderTest, void OpenMD5File(const std::string& md5_file_name_) { md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_); - ASSERT_TRUE(md5_file_) << "Md5 file open failed. Filename: " + ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: " << md5_file_name_; } @@ -237,8 +89,8 @@ TEST_P(TestVectorTest, MD5Match) { } VP8_INSTANTIATE_TEST_CASE(TestVectorTest, - ::testing::ValuesIn(kVP8TestVectors)); + ::testing::ValuesIn(libvpx_test::kVP8TestVectors)); VP9_INSTANTIATE_TEST_CASE(TestVectorTest, - ::testing::ValuesIn(kVP9TestVectors)); + ::testing::ValuesIn(libvpx_test::kVP9TestVectors)); } // namespace diff --git a/libvpx/test/test_vectors.cc b/libvpx/test/test_vectors.cc new file mode 100644 index 0000000..aba8a3c --- /dev/null +++ b/libvpx/test/test_vectors.cc @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2013 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 "test/test_vectors.h" + +namespace libvpx_test { + +#if CONFIG_VP8_DECODER +const char *kVP8TestVectors[kNumVp8TestVectors] = { + "vp80-00-comprehensive-001.ivf", + "vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf", + "vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf", + "vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf", + "vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf", + "vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf", + "vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf", + "vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf", + "vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf", + "vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf", + "vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf", + "vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf", + "vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf", + "vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf", + "vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf", + "vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf", + "vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf", + "vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf", + "vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf", + "vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf", + "vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf", + "vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf", + "vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf", + "vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf", + "vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf", + "vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf", + "vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf", + "vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf", + "vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf", + "vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf", + "vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf", + "vp80-06-smallsize.ivf" +}; +#endif // CONFIG_VP8_DECODER +#if CONFIG_VP9_DECODER +const char *kVP9TestVectors[kNumVp9TestVectors] = { + "vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm", + "vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm", + "vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm", + "vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm", + "vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm", + "vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm", + "vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm", + "vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm", + "vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm", + "vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm", + "vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm", + "vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm", + "vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm", + "vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm", + "vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm", + "vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm", + "vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm", + "vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm", + "vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm", + "vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm", + "vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm", + "vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm", + "vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm", + "vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm", + "vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm", + "vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm", + "vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm", + "vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm", + "vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm", + "vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm", + "vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm", + "vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm", + "vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm", + "vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm", + "vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm", + "vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm", + "vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm", + "vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm", + "vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm", + "vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm", + "vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm", + "vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm", + "vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm", + "vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm", + "vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm", + "vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm", + "vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm", + "vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm", + "vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm", + "vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm", + "vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.webm", + "vp90-2-02-size-18x66.webm", "vp90-2-02-size-32x08.webm", + "vp90-2-02-size-32x10.webm", "vp90-2-02-size-32x16.webm", + "vp90-2-02-size-32x18.webm", "vp90-2-02-size-32x32.webm", + "vp90-2-02-size-32x34.webm", "vp90-2-02-size-32x64.webm", + "vp90-2-02-size-32x66.webm", "vp90-2-02-size-34x08.webm", + "vp90-2-02-size-34x10.webm", "vp90-2-02-size-34x16.webm", + "vp90-2-02-size-34x18.webm", "vp90-2-02-size-34x32.webm", + "vp90-2-02-size-34x34.webm", "vp90-2-02-size-34x64.webm", + "vp90-2-02-size-34x66.webm", "vp90-2-02-size-64x08.webm", + "vp90-2-02-size-64x10.webm", "vp90-2-02-size-64x16.webm", + "vp90-2-02-size-64x18.webm", "vp90-2-02-size-64x32.webm", + "vp90-2-02-size-64x34.webm", "vp90-2-02-size-64x64.webm", + "vp90-2-02-size-64x66.webm", "vp90-2-02-size-66x08.webm", + "vp90-2-02-size-66x10.webm", "vp90-2-02-size-66x16.webm", + "vp90-2-02-size-66x18.webm", "vp90-2-02-size-66x32.webm", + "vp90-2-02-size-66x34.webm", "vp90-2-02-size-66x64.webm", + "vp90-2-02-size-66x66.webm", "vp90-2-03-size-196x196.webm", + "vp90-2-03-size-196x198.webm", "vp90-2-03-size-196x200.webm", + "vp90-2-03-size-196x202.webm", "vp90-2-03-size-196x208.webm", + "vp90-2-03-size-196x210.webm", "vp90-2-03-size-196x224.webm", + "vp90-2-03-size-196x226.webm", "vp90-2-03-size-198x196.webm", + "vp90-2-03-size-198x198.webm", "vp90-2-03-size-198x200.webm", + "vp90-2-03-size-198x202.webm", "vp90-2-03-size-198x208.webm", + "vp90-2-03-size-198x210.webm", "vp90-2-03-size-198x224.webm", + "vp90-2-03-size-198x226.webm", "vp90-2-03-size-200x196.webm", + "vp90-2-03-size-200x198.webm", "vp90-2-03-size-200x200.webm", + "vp90-2-03-size-200x202.webm", "vp90-2-03-size-200x208.webm", + "vp90-2-03-size-200x210.webm", "vp90-2-03-size-200x224.webm", + "vp90-2-03-size-200x226.webm", "vp90-2-03-size-202x196.webm", + "vp90-2-03-size-202x198.webm", "vp90-2-03-size-202x200.webm", + "vp90-2-03-size-202x202.webm", "vp90-2-03-size-202x208.webm", + "vp90-2-03-size-202x210.webm", "vp90-2-03-size-202x224.webm", + "vp90-2-03-size-202x226.webm", "vp90-2-03-size-208x196.webm", + "vp90-2-03-size-208x198.webm", "vp90-2-03-size-208x200.webm", + "vp90-2-03-size-208x202.webm", "vp90-2-03-size-208x208.webm", + "vp90-2-03-size-208x210.webm", "vp90-2-03-size-208x224.webm", + "vp90-2-03-size-208x226.webm", "vp90-2-03-size-210x196.webm", + "vp90-2-03-size-210x198.webm", "vp90-2-03-size-210x200.webm", + "vp90-2-03-size-210x202.webm", "vp90-2-03-size-210x208.webm", + "vp90-2-03-size-210x210.webm", "vp90-2-03-size-210x224.webm", + "vp90-2-03-size-210x226.webm", "vp90-2-03-size-224x196.webm", + "vp90-2-03-size-224x198.webm", "vp90-2-03-size-224x200.webm", + "vp90-2-03-size-224x202.webm", "vp90-2-03-size-224x208.webm", + "vp90-2-03-size-224x210.webm", "vp90-2-03-size-224x224.webm", + "vp90-2-03-size-224x226.webm", "vp90-2-03-size-226x196.webm", + "vp90-2-03-size-226x198.webm", "vp90-2-03-size-226x200.webm", + "vp90-2-03-size-226x202.webm", "vp90-2-03-size-226x208.webm", + "vp90-2-03-size-226x210.webm", "vp90-2-03-size-226x224.webm", + "vp90-2-03-size-226x226.webm", "vp90-2-03-deltaq.webm", + "vp90-2-05-resize.ivf", "vp90-2-06-bilinear.webm", + "vp90-2-07-frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm", + "vp90-2-08-tile_1x2.webm", "vp90-2-08-tile_1x4_frame_parallel.webm", + "vp90-2-08-tile_1x4.webm", "vp90-2-08-tile_1x8_frame_parallel.webm", + "vp90-2-08-tile_1x8.webm", "vp90-2-08-tile-4x4.webm", + "vp90-2-08-tile-4x1.webm", "vp90-2-09-subpixel-00.ivf", + "vp90-2-02-size-lf-1920x1080.webm", "vp90-2-09-aq2.webm", + "vp90-2-09-lf_deltas.webm", "vp90-2-10-show-existing-frame.webm", + "vp90-2-11-size-351x287.webm", "vp90-2-11-size-351x288.webm", + "vp90-2-11-size-352x287.webm", "vp90-2-12-droppable_1.ivf", + "vp90-2-12-droppable_2.ivf", "vp90-2-12-droppable_3.ivf", + "vp91-2-04-yv444.webm" +}; +#endif // CONFIG_VP9_DECODER + +} // namespace libvpx_test diff --git a/libvpx/test/test_vectors.h b/libvpx/test/test_vectors.h new file mode 100644 index 0000000..d5ecc96 --- /dev/null +++ b/libvpx/test/test_vectors.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2013 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. + */ + +#ifndef TEST_TEST_VECTORS_H_ +#define TEST_TEST_VECTORS_H_ + +#include "./vpx_config.h" + +namespace libvpx_test { + +#if CONFIG_VP8_DECODER +const int kNumVp8TestVectors = 62; +extern const char *kVP8TestVectors[kNumVp8TestVectors]; +#endif + +#if CONFIG_VP9_DECODER +const int kNumVp9TestVectors = 223; + +extern const char *kVP9TestVectors[kNumVp9TestVectors]; +#endif // CONFIG_VP9_DECODER + +} // namespace libvpx_test + +#endif // TEST_TEST_VECTORS_H_ diff --git a/libvpx/test/tile_independence_test.cc b/libvpx/test/tile_independence_test.cc index 403dbb6..d714452 100644 --- a/libvpx/test/tile_independence_test.cc +++ b/libvpx/test/tile_independence_test.cc @@ -1,11 +1,11 @@ /* - Copyright (c) 2012 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. + * Copyright (c) 2013 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 <cstdio> @@ -17,9 +17,7 @@ #include "test/i420_video_source.h" #include "test/util.h" #include "test/md5_helper.h" -extern "C" { #include "vpx_mem/vpx_mem.h" -} namespace { class TileIndependenceTest : public ::libvpx_test::EncoderTest, diff --git a/libvpx/test/util.h b/libvpx/test/util.h index 4d7f3d4..3c45721 100644 --- a/libvpx/test/util.h +++ b/libvpx/test/util.h @@ -17,7 +17,6 @@ #include "vpx/vpx_image.h" // Macros -#define PARAMS(...) ::testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > > #define GET_PARAM(k) std::tr1::get< k >(GetParam()) static double compute_psnr(const vpx_image_t *img1, diff --git a/libvpx/test/variance_test.cc b/libvpx/test/variance_test.cc index 3f55601..c9bf13a 100644 --- a/libvpx/test/variance_test.cc +++ b/libvpx/test/variance_test.cc @@ -17,17 +17,15 @@ #include "vpx/vpx_integer.h" #include "./vpx_config.h" -extern "C" { #include "vpx_mem/vpx_mem.h" #if CONFIG_VP8_ENCODER -# include "vp8/common/variance.h" # include "./vp8_rtcd.h" +# include "vp8/common/variance.h" #endif #if CONFIG_VP9_ENCODER -# include "vp9/encoder/vp9_variance.h" # include "./vp9_rtcd.h" +# include "vp9/encoder/vp9_variance.h" #endif -} #include "test/acm_random.h" namespace { @@ -309,6 +307,19 @@ INSTANTIATE_TEST_CASE_P( make_tuple(4, 3, variance16x8_c), make_tuple(4, 4, variance16x16_c))); +#if HAVE_NEON +const vp8_variance_fn_t variance8x8_neon = vp8_variance8x8_neon; +const vp8_variance_fn_t variance8x16_neon = vp8_variance8x16_neon; +const vp8_variance_fn_t variance16x8_neon = vp8_variance16x8_neon; +const vp8_variance_fn_t variance16x16_neon = vp8_variance16x16_neon; +INSTANTIATE_TEST_CASE_P( + NEON, VP8VarianceTest, + ::testing::Values(make_tuple(3, 3, variance8x8_neon), + make_tuple(3, 4, variance8x16_neon), + make_tuple(4, 3, variance16x8_neon), + make_tuple(4, 4, variance16x16_neon))); +#endif + #if HAVE_MMX const vp8_variance_fn_t variance4x4_mmx = vp8_variance4x4_mmx; const vp8_variance_fn_t variance8x8_mmx = vp8_variance8x8_mmx; diff --git a/libvpx/test/video_source.h b/libvpx/test/video_source.h index 3d01d39..6d1855a 100644 --- a/libvpx/test/video_source.h +++ b/libvpx/test/video_source.h @@ -184,9 +184,9 @@ class CompressedVideoSource { virtual const uint8_t *cxdata() const = 0; - virtual const unsigned int frame_size() const = 0; + virtual size_t frame_size() const = 0; - virtual const unsigned int frame_number() const = 0; + virtual unsigned int frame_number() const = 0; }; } // namespace libvpx_test diff --git a/libvpx/test/vp8_boolcoder_test.cc b/libvpx/test/vp8_boolcoder_test.cc index 0383af2..9cd1987 100644 --- a/libvpx/test/vp8_boolcoder_test.cc +++ b/libvpx/test/vp8_boolcoder_test.cc @@ -20,10 +20,8 @@ #include "third_party/googletest/src/include/gtest/gtest.h" #include "vpx/vpx_integer.h" -extern "C" { #include "vp8/encoder/boolhuff.h" #include "vp8/decoder/dboolhuff.h" -} namespace { const int num_tests = 10; @@ -37,15 +35,15 @@ const uint8_t secret_key[16] = { 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 }; -void encrypt_buffer(uint8_t *buffer, int size) { - for (int i = 0; i < size; ++i) { +void encrypt_buffer(uint8_t *buffer, size_t size) { + for (size_t i = 0; i < size; ++i) { buffer[i] ^= secret_key[i & 15]; } } void test_decrypt_cb(void *decrypt_state, const uint8_t *input, - uint8_t *output, int count) { - int offset = input - reinterpret_cast<uint8_t *>(decrypt_state); + uint8_t *output, int count) { + const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state); for (int i = 0; i < count; i++) { output[i] = input[i] ^ secret_key[(offset + i) & 15]; } diff --git a/libvpx/test/vp8_decrypt_test.cc b/libvpx/test/vp8_decrypt_test.cc index b092509..1b5b083 100644 --- a/libvpx/test/vp8_decrypt_test.cc +++ b/libvpx/test/vp8_decrypt_test.cc @@ -26,9 +26,9 @@ const uint8_t test_key[16] = { 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 }; -void encrypt_buffer(const uint8_t *src, uint8_t *dst, - int size, int offset = 0) { - for (int i = 0; i < size; ++i) { +void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size, + ptrdiff_t offset) { + for (size_t i = 0; i < size; ++i) { dst[i] = src[i] ^ test_key[(offset + i) & 15]; } } @@ -61,7 +61,7 @@ TEST(TestDecrypt, DecryptWorks) { #if CONFIG_DECRYPT std::vector<uint8_t> encrypted(video.frame_size()); - encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size()); + encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0); vp8_decrypt_init di = { test_decrypt_cb, &encrypted[0] }; decoder.Control(VP8D_SET_DECRYPTOR, &di); #endif // CONFIG_DECRYPT diff --git a/libvpx/test/vp8_fdct4x4_test.cc b/libvpx/test/vp8_fdct4x4_test.cc index c823436..e3c292e 100644 --- a/libvpx/test/vp8_fdct4x4_test.cc +++ b/libvpx/test/vp8_fdct4x4_test.cc @@ -1,13 +1,12 @@ /* -* Copyright (c) 2012 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. -*/ - + * Copyright (c) 2013 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 <math.h> #include <stddef.h> @@ -16,16 +15,12 @@ #include <string.h> #include <sys/types.h> - -extern "C" { #include "./vp8_rtcd.h" -} #include "test/acm_random.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "vpx/vpx_integer.h" - namespace { const int cospi8sqrt2minus1 = 20091; diff --git a/libvpx/test/vp9_boolcoder_test.cc b/libvpx/test/vp9_boolcoder_test.cc index 5edde90..c579ade 100644 --- a/libvpx/test/vp9_boolcoder_test.cc +++ b/libvpx/test/vp9_boolcoder_test.cc @@ -14,10 +14,8 @@ #include "third_party/googletest/src/include/gtest/gtest.h" -extern "C" { -#include "vp9/encoder/vp9_boolhuff.h" -#include "vp9/decoder/vp9_dboolhuff.h" -} +#include "vp9/decoder/vp9_reader.h" +#include "vp9/encoder/vp9_writer.h" #include "test/acm_random.h" #include "vpx/vpx_integer.h" diff --git a/libvpx/test/vp9_lossless_test.cc b/libvpx/test/vp9_lossless_test.cc index 30a3118..7c3ba9f 100644 --- a/libvpx/test/vp9_lossless_test.cc +++ b/libvpx/test/vp9_lossless_test.cc @@ -1,33 +1,35 @@ /* - Copyright (c) 2012 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. -*/ - + * Copyright (c) 2013 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 "./vpx_config.h" #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" #include "test/i420_video_source.h" #include "test/util.h" +#include "test/y4m_video_source.h" namespace { const int kMaxPsnr = 100; -class LossLessTest : public ::libvpx_test::EncoderTest, +class LosslessTestLarge : public ::libvpx_test::EncoderTest, public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { protected: - LossLessTest() : EncoderTest(GET_PARAM(0)), - psnr_(kMaxPsnr), - nframes_(0), - encoding_mode_(GET_PARAM(1)) { + LosslessTestLarge() + : EncoderTest(GET_PARAM(0)), + psnr_(kMaxPsnr), + nframes_(0), + encoding_mode_(GET_PARAM(1)) { } - virtual ~LossLessTest() {} + virtual ~LosslessTestLarge() {} virtual void SetUp() { InitializeConfig(); @@ -54,7 +56,7 @@ class LossLessTest : public ::libvpx_test::EncoderTest, libvpx_test::TestMode encoding_mode_; }; -TEST_P(LossLessTest, TestLossLessEncoding) { +TEST_P(LosslessTestLarge, TestLossLessEncoding) { const vpx_rational timebase = { 33333333, 1000000000 }; cfg_.g_timebase = timebase; cfg_.rc_target_bitrate = 2000; @@ -66,10 +68,28 @@ TEST_P(LossLessTest, TestLossLessEncoding) { // intentionally changed the dimension for better testing coverage libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, - timebase.den, timebase.num, 0, 30); + timebase.den, timebase.num, 0, 10); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + const double psnr_lossless = GetMinPsnr(); + EXPECT_GE(psnr_lossless, kMaxPsnr); +} + +TEST_P(LosslessTestLarge, TestLossLessEncoding444) { + libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 10); + + cfg_.g_profile = 1; + cfg_.g_timebase = video.timebase(); + cfg_.rc_target_bitrate = 2000; + cfg_.g_lag_in_frames = 25; + cfg_.rc_min_quantizer = 0; + cfg_.rc_max_quantizer = 0; + + init_flags_ = VPX_CODEC_USE_PSNR; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); const double psnr_lossless = GetMinPsnr(); EXPECT_GE(psnr_lossless, kMaxPsnr); } -VP9_INSTANTIATE_TEST_CASE(LossLessTest, ALL_TEST_MODES); + +VP9_INSTANTIATE_TEST_CASE(LosslessTestLarge, ALL_TEST_MODES); } // namespace diff --git a/libvpx/test/vp9_subtract_test.cc b/libvpx/test/vp9_subtract_test.cc index 332a839..d7df286 100644 --- a/libvpx/test/vp9_subtract_test.cc +++ b/libvpx/test/vp9_subtract_test.cc @@ -12,12 +12,10 @@ #include "test/acm_random.h" #include "test/clear_system_state.h" #include "test/register_state_check.h" -extern "C" { #include "./vpx_config.h" #include "./vp9_rtcd.h" #include "vp9/common/vp9_blockd.h" #include "vpx_mem/vpx_mem.h" -} typedef void (*subtract_fn_t)(int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, @@ -41,8 +39,8 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) { // FIXME(rbultje) split in its own file for (BLOCK_SIZE bsize = BLOCK_4X4; bsize < BLOCK_SIZES; bsize = static_cast<BLOCK_SIZE>(static_cast<int>(bsize) + 1)) { - const int block_width = 4 << b_width_log2(bsize); - const int block_height = 4 << b_height_log2(bsize); + const int block_width = 4 * num_4x4_blocks_wide_lookup[bsize]; + const int block_height = 4 * num_4x4_blocks_high_lookup[bsize]; int16_t *diff = reinterpret_cast<int16_t *>( vpx_memalign(16, sizeof(*diff) * block_width * block_height * 2)); uint8_t *pred = reinterpret_cast<uint8_t *>( diff --git a/libvpx/test/vp9_thread_test.cc b/libvpx/test/vp9_thread_test.cc index a8ce6e4..a78cdea 100644 --- a/libvpx/test/vp9_thread_test.cc +++ b/libvpx/test/vp9_thread_test.cc @@ -141,10 +141,12 @@ TEST(VP9DecodeMTTest, MTDecode2) { "68ede6abd66bae0a2edf2eb9232241b6" }, { "vp90-2-08-tile_1x4_frame_parallel.webm", "368ebc6ebf3a5e478d85b2c3149b2848" }, + { "vp90-2-08-tile_1x8_frame_parallel.webm", + "17e439da2388aff3a0f69cb22579c6c1" }, }; for (int i = 0; i < static_cast<int>(sizeof(files) / sizeof(files[0])); ++i) { - for (int t = 2; t <= 4; ++t) { + for (int t = 2; t <= 8; ++t) { EXPECT_STREQ(files[i].expected_md5, DecodeFile(files[i].name, t).c_str()) << "threads = " << t; } diff --git a/libvpx/test/webm_video_source.h b/libvpx/test/webm_video_source.h index 9fc8545..9d88ae3 100644 --- a/libvpx/test/webm_video_source.h +++ b/libvpx/test/webm_video_source.h @@ -14,7 +14,7 @@ #include <cstdlib> #include <new> #include <string> -#include "nestegg/include/nestegg/nestegg.h" +#include "third_party/nestegg/include/nestegg/nestegg.h" #include "test/video_source.h" namespace libvpx_test { @@ -90,8 +90,12 @@ class WebMVideoSource : public CompressedVideoSource { virtual ~WebMVideoSource() { if (input_file_) fclose(input_file_); - if (nestegg_ctx_) + if (nestegg_ctx_ != NULL) { + if (pkt_ != NULL) { + nestegg_free_packet(pkt_); + } nestegg_destroy(nestegg_ctx_); + } } virtual void Init() { @@ -104,7 +108,7 @@ class WebMVideoSource : public CompressedVideoSource { nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, input_file_}; - ASSERT_FALSE(nestegg_init(&nestegg_ctx_, io, NULL)) + ASSERT_FALSE(nestegg_init(&nestegg_ctx_, io, NULL, -1)) << "nestegg_init failed"; unsigned int n; @@ -136,8 +140,10 @@ class WebMVideoSource : public CompressedVideoSource { do { /* End of this packet, get another. */ - if (pkt_) + if (pkt_ != NULL) { nestegg_free_packet(pkt_); + pkt_ = NULL; + } int again = nestegg_read_packet(nestegg_ctx_, &pkt_); ASSERT_GE(again, 0) << "nestegg_read_packet failed"; @@ -163,8 +169,8 @@ class WebMVideoSource : public CompressedVideoSource { virtual const uint8_t *cxdata() const { return end_of_file_ ? NULL : buf_; } - virtual const unsigned int frame_size() const { return buf_sz_; } - virtual const unsigned int frame_number() const { return frame_; } + virtual size_t frame_size() const { return buf_sz_; } + virtual unsigned int frame_number() const { return frame_; } protected: std::string file_name_; diff --git a/libvpx/test/y4m_video_source.h b/libvpx/test/y4m_video_source.h new file mode 100644 index 0000000..7419043 --- /dev/null +++ b/libvpx/test/y4m_video_source.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2012 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. + */ +#ifndef TEST_Y4M_VIDEO_SOURCE_H_ +#define TEST_Y4M_VIDEO_SOURCE_H_ +#include <string> + +#include "test/video_source.h" +#include "./y4minput.h" + +namespace libvpx_test { + +// This class extends VideoSource to allow parsing of raw yv12 +// so that we can do actual file encodes. +class Y4mVideoSource : public VideoSource { + public: + Y4mVideoSource(const std::string &file_name, + unsigned int start, int limit) + : file_name_(file_name), + input_file_(NULL), + img_(new vpx_image_t()), + start_(start), + limit_(limit), + frame_(0), + framerate_numerator_(0), + framerate_denominator_(0), + y4m_() { + } + + virtual ~Y4mVideoSource() { + vpx_img_free(img_.get()); + CloseSource(); + } + + virtual void Begin() { + CloseSource(); + input_file_ = OpenTestDataFile(file_name_); + ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " + << file_name_; + + y4m_input_open(&y4m_, input_file_, NULL, 0, 0); + framerate_numerator_ = y4m_.fps_n; + framerate_denominator_ = y4m_.fps_d; + + frame_ = 0; + for (unsigned int i = 0; i < start_; i++) { + Next(); + } + + FillFrame(); + } + + virtual void Next() { + ++frame_; + FillFrame(); + } + + virtual vpx_image_t *img() const { + return (frame_ < limit_) ? img_.get() : NULL; + } + + // Models a stream where Timebase = 1/FPS, so pts == frame. + virtual vpx_codec_pts_t pts() const { return frame_; } + + virtual unsigned long duration() const { return 1; } + + virtual vpx_rational_t timebase() const { + const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ }; + return t; + } + + virtual unsigned int frame() const { return frame_; } + + virtual unsigned int limit() const { return limit_; } + + virtual void FillFrame() { + ASSERT_TRUE(input_file_ != NULL); + // Read a frame from input_file. + y4m_input_fetch_frame(&y4m_, input_file_, img_.get()); + } + + protected: + void CloseSource() { + y4m_input_close(&y4m_); + y4m_ = y4m_input(); + if (input_file_ != NULL) { + fclose(input_file_); + input_file_ = NULL; + } + } + + std::string file_name_; + FILE *input_file_; + testing::internal::scoped_ptr<vpx_image_t> img_; + unsigned int start_; + unsigned int limit_; + unsigned int frame_; + int framerate_numerator_; + int framerate_denominator_; + y4m_input y4m_; +}; + +} // namespace libvpx_test + +#endif // TEST_Y4M_VIDEO_SOURCE_H_ |