Compare commits
20 Commits
main
...
sandbox/ji
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1f303c27fd | ||
![]() |
5b5fbadeff | ||
![]() |
b752848ee1 | ||
![]() |
e5068cd5c7 | ||
![]() |
68e7e4d04b | ||
![]() |
0738390c19 | ||
![]() |
b89861a463 | ||
![]() |
3246fc04fb | ||
![]() |
2334f51d5f | ||
![]() |
9baa5c9973 | ||
![]() |
03568c313b | ||
![]() |
4273a52cec | ||
![]() |
761a7088ac | ||
![]() |
75b57d39d4 | ||
![]() |
8c8d16de6b | ||
![]() |
a5e47ade40 | ||
![]() |
c96ecc2ab7 | ||
![]() |
35731dca52 | ||
![]() |
67e64cbebf | ||
![]() |
f0d007abdc |
30
configure
vendored
30
configure
vendored
@ -34,16 +34,13 @@ Advanced options:
|
||||
${toggle_codec_srcs} in/exclude codec library source code
|
||||
${toggle_debug_libs} in/exclude debug version of libraries
|
||||
${toggle_static_msvcrt} use static MSVCRT (VS builds only)
|
||||
${toggle_vp9_highbitdepth} use VP9 high bit depth (10/12) profiles
|
||||
${toggle_vpx_highbitdepth} use VP9 high bit depth (10/12) profiles
|
||||
${toggle_better_hw_compatibility}
|
||||
enable encoder to produce streams with better
|
||||
hardware decoder compatibility
|
||||
${toggle_vp8} VP8 codec support
|
||||
${toggle_vp9} VP9 codec support
|
||||
${toggle_vp10} VP10 codec support
|
||||
${toggle_internal_stats} output of encoder internal stats for debug, if supported (encoders)
|
||||
${toggle_postproc} postprocessing
|
||||
${toggle_vp9_postproc} vp9 specific postprocessing
|
||||
${toggle_multithread} multithreaded encoding and decoding
|
||||
${toggle_spatial_resampling} spatial sampling (scaling) support
|
||||
${toggle_realtime_only} enable this option while building for real-time encoding
|
||||
@ -59,8 +56,6 @@ Advanced options:
|
||||
${toggle_postproc_visualizer} macro block / block level visualizers
|
||||
${toggle_multi_res_encoding} enable multiple-resolution encoding
|
||||
${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
|
||||
${toggle_vp9_temporal_denoising}
|
||||
enable vp9 temporal denoising
|
||||
${toggle_webm_io} enable input from and output to WebM container
|
||||
${toggle_libyuv} enable libyuv
|
||||
|
||||
@ -195,13 +190,8 @@ if [ ${doxy_major:-0} -ge 1 ]; then
|
||||
fi
|
||||
|
||||
# disable codecs when their source directory does not exist
|
||||
[ -d "${source_path}/vp8" ] || disable_feature vp8
|
||||
[ -d "${source_path}/vp9" ] || disable_feature vp9
|
||||
[ -d "${source_path}/vp10" ] || disable_feature vp10
|
||||
|
||||
# disable vp10 codec by default
|
||||
disable_feature vp10
|
||||
|
||||
# install everything except the sources, by default. sources will have
|
||||
# to be enabled when doing dist builds, since that's no longer a common
|
||||
# case.
|
||||
@ -218,16 +208,10 @@ enable_feature os_support
|
||||
enable_feature temporal_denoising
|
||||
|
||||
CODECS="
|
||||
vp8_encoder
|
||||
vp8_decoder
|
||||
vp9_encoder
|
||||
vp9_decoder
|
||||
vp10_encoder
|
||||
vp10_decoder
|
||||
"
|
||||
CODEC_FAMILIES="
|
||||
vp8
|
||||
vp9
|
||||
vp10
|
||||
"
|
||||
|
||||
@ -296,7 +280,6 @@ CONFIG_LIST="
|
||||
dc_recon
|
||||
runtime_cpu_detect
|
||||
postproc
|
||||
vp9_postproc
|
||||
multithread
|
||||
internal_stats
|
||||
${CODECS}
|
||||
@ -322,7 +305,7 @@ CONFIG_LIST="
|
||||
temporal_denoising
|
||||
vp9_temporal_denoising
|
||||
coefficient_range_checking
|
||||
vp9_highbitdepth
|
||||
vpx_highbitdepth
|
||||
better_hw_compatibility
|
||||
experimental
|
||||
size_limit
|
||||
@ -359,7 +342,6 @@ CMDLINE_SELECT="
|
||||
dequant_tokens
|
||||
dc_recon
|
||||
postproc
|
||||
vp9_postproc
|
||||
multithread
|
||||
internal_stats
|
||||
${CODECS}
|
||||
@ -383,7 +365,7 @@ CMDLINE_SELECT="
|
||||
vp9_temporal_denoising
|
||||
coefficient_range_checking
|
||||
better_hw_compatibility
|
||||
vp9_highbitdepth
|
||||
vpx_highbitdepth
|
||||
experimental
|
||||
"
|
||||
|
||||
@ -455,7 +437,7 @@ process_targets() {
|
||||
done
|
||||
enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
|
||||
enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
|
||||
! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
|
||||
! enabled postproc && DIST_DIR="${DIST_DIR}-nopost"
|
||||
! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
|
||||
! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
|
||||
DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
|
||||
@ -639,10 +621,6 @@ process_toolchain() {
|
||||
enable_feature dc_recon
|
||||
fi
|
||||
|
||||
if enabled internal_stats; then
|
||||
enable_feature vp9_postproc
|
||||
fi
|
||||
|
||||
# Enable the postbuild target if building for visual studio.
|
||||
case "$tgt_cc" in
|
||||
vs*) enable_feature msvs
|
||||
|
@ -83,7 +83,7 @@ static const arg_def_t speed_arg =
|
||||
static const arg_def_t aqmode_arg =
|
||||
ARG_DEF("aq", "aqmode", 1, "aq-mode off/on");
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static const struct arg_enum_list bitdepth_enum[] = {
|
||||
{"8", VPX_BITS_8},
|
||||
{"10", VPX_BITS_10},
|
||||
@ -94,7 +94,7 @@ static const struct arg_enum_list bitdepth_enum[] = {
|
||||
static const arg_def_t bitdepth_arg =
|
||||
ARG_DEF_ENUM("d", "bit-depth", 1, "Bit depth for codec 8, 10 or 12. ",
|
||||
bitdepth_enum);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
|
||||
static const arg_def_t *svc_args[] = {
|
||||
@ -108,7 +108,7 @@ static const arg_def_t *svc_args[] = {
|
||||
&output_rc_stats_arg,
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
&bitdepth_arg,
|
||||
#endif
|
||||
&speed_arg,
|
||||
@ -265,7 +265,7 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
enc_cfg->g_lag_in_frames = arg_parse_uint(&arg);
|
||||
} else if (arg_match(&arg, &rc_end_usage_arg, argi)) {
|
||||
enc_cfg->rc_end_usage = arg_parse_uint(&arg);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else if (arg_match(&arg, &bitdepth_arg, argi)) {
|
||||
enc_cfg->g_bit_depth = arg_parse_enum_or_int(&arg);
|
||||
switch (enc_cfg->g_bit_depth) {
|
||||
@ -285,7 +285,7 @@ static void parse_command_line(int argc, const char **argv_,
|
||||
die("Error: Invalid bit depth selected (%d)\n", enc_cfg->g_bit_depth);
|
||||
break;
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
++argj;
|
||||
}
|
||||
@ -634,7 +634,7 @@ int main(int argc, const char **argv) {
|
||||
parse_command_line(argc, argv, &app_input, &svc_ctx, &enc_cfg);
|
||||
|
||||
// Allocate image buffer
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (!vpx_img_alloc(&raw, enc_cfg.g_input_bit_depth == 8 ?
|
||||
VPX_IMG_FMT_I420 : VPX_IMG_FMT_I42016,
|
||||
enc_cfg.g_w, enc_cfg.g_h, 32)) {
|
||||
@ -644,7 +644,7 @@ int main(int argc, const char **argv) {
|
||||
if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, enc_cfg.g_w, enc_cfg.g_h, 32)) {
|
||||
die("Failed to allocate image %dx%d\n", enc_cfg.g_w, enc_cfg.g_h);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
if (!(infile = fopen(app_input.input_filename, "rb")))
|
||||
die("Failed to open %s for reading\n", app_input.input_filename);
|
||||
|
@ -492,13 +492,13 @@ int main(int argc, char **argv) {
|
||||
struct RateControlMetrics rc;
|
||||
int64_t cx_time = 0;
|
||||
const int min_args_base = 11;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
vpx_bit_depth_t bit_depth = VPX_BITS_8;
|
||||
int input_bit_depth = 8;
|
||||
const int min_args = min_args_base + 1;
|
||||
#else
|
||||
const int min_args = min_args_base;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
double sum_bitrate = 0.0;
|
||||
double sum_bitrate2 = 0.0;
|
||||
double framerate = 30.0;
|
||||
@ -506,7 +506,7 @@ int main(int argc, char **argv) {
|
||||
exec_name = argv[0];
|
||||
// Check usage and arguments.
|
||||
if (argc < min_args) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
die("Usage: %s <infile> <outfile> <codec_type(vp8/vp9)> <width> <height> "
|
||||
"<rate_num> <rate_den> <speed> <frame_drop_threshold> <mode> "
|
||||
"<Rate_0> ... <Rate_nlayers-1> <bit-depth> \n", argv[0]);
|
||||
@ -514,7 +514,7 @@ int main(int argc, char **argv) {
|
||||
die("Usage: %s <infile> <outfile> <codec_type(vp8/vp9)> <width> <height> "
|
||||
"<rate_num> <rate_den> <speed> <frame_drop_threshold> <mode> "
|
||||
"<Rate_0> ... <Rate_nlayers-1> \n", argv[0]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
encoder = get_vpx_encoder_by_name(argv[3]);
|
||||
@ -538,7 +538,7 @@ int main(int argc, char **argv) {
|
||||
die("Invalid number of arguments");
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
switch (strtol(argv[argc-1], NULL, 0)) {
|
||||
case 8:
|
||||
bit_depth = VPX_BITS_8;
|
||||
@ -565,7 +565,7 @@ int main(int argc, char **argv) {
|
||||
if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 32)) {
|
||||
die("Failed to allocate image", width, height);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
// Populate encoder configuration.
|
||||
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
|
||||
@ -578,13 +578,13 @@ int main(int argc, char **argv) {
|
||||
cfg.g_w = width;
|
||||
cfg.g_h = height;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (bit_depth != VPX_BITS_8) {
|
||||
cfg.g_bit_depth = bit_depth;
|
||||
cfg.g_input_bit_depth = input_bit_depth;
|
||||
cfg.g_profile = 2;
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
// Timebase format e.g. 30fps: numerator=1, demoninator = 30.
|
||||
cfg.g_timebase.num = strtol(argv[6], NULL, 0);
|
||||
@ -672,13 +672,13 @@ int main(int argc, char **argv) {
|
||||
cfg.ss_number_layers = 1;
|
||||
|
||||
// Initialize codec.
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (vpx_codec_enc_init(
|
||||
&codec, encoder->codec_interface(), &cfg,
|
||||
bit_depth == VPX_BITS_8 ? 0 : VPX_CODEC_USE_HIGHBITDEPTH))
|
||||
#else
|
||||
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
die_codec(&codec, "Failed to initialize encoder");
|
||||
|
||||
if (strncmp(encoder->name, "vp8", 3) == 0) {
|
||||
|
@ -121,7 +121,7 @@ TEST_P(ActiveMapRefreshTest, Test) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ActiveMapRefreshTest,
|
||||
::testing::Values(::libvpx_test::kRealTime),
|
||||
::testing::Range(5, 6));
|
||||
} // namespace
|
||||
|
@ -83,7 +83,7 @@ TEST_P(ActiveMapTest, Test) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ActiveMapTest,
|
||||
::testing::Values(::libvpx_test::kRealTime),
|
||||
::testing::Range(0, 6));
|
||||
} // namespace
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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 "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 {
|
||||
|
||||
// lookahead range: [kLookAheadMin, kLookAheadMax).
|
||||
const int kLookAheadMin = 5;
|
||||
const int kLookAheadMax = 26;
|
||||
|
||||
class AltRefTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
|
||||
virtual ~AltRefTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int pass) {
|
||||
altref_count_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(VP8E_SET_CPUUSED, 3);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
|
||||
}
|
||||
|
||||
int altref_count() const { return altref_count_; }
|
||||
|
||||
private:
|
||||
int altref_count_;
|
||||
};
|
||||
|
||||
TEST_P(AltRefTest, MonotonicTimestamps) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 1000;
|
||||
cfg_.g_lag_in_frames = GET_PARAM(1);
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
EXPECT_GE(altref_count(), 1);
|
||||
}
|
||||
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(AltRefTest,
|
||||
::testing::Range(kLookAheadMin, kLookAheadMax));
|
||||
} // namespace
|
@ -102,7 +102,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(AqSegmentTest,
|
||||
::testing::Values(::libvpx_test::kRealTime,
|
||||
::libvpx_test::kOnePassGood),
|
||||
::testing::Range(3, 9));
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "test/util.h"
|
||||
#include "test/y4m_video_source.h"
|
||||
#include "test/yuv_video_source.h"
|
||||
#include "vp9/encoder/vp9_ratectrl.h"
|
||||
#include "vp10/encoder/ratectrl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -50,9 +50,9 @@ const TestVideoParam kTestVectors[] = {
|
||||
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},
|
||||
{"rush_hour_444.y4m", 352, 288, 30, 1,
|
||||
8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
// Add list of profile 2/3 test videos here ...
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
|
||||
const TestEncodeParam kEncodeVectors[] = {
|
||||
@ -175,7 +175,7 @@ class ArfFreqTest
|
||||
if (min_arf_requested_)
|
||||
return min_arf_requested_;
|
||||
else
|
||||
return vp9_rc_get_default_min_gf_interval(
|
||||
return vp10_rc_get_default_min_gf_interval(
|
||||
test_video_param_.width, test_video_param_.height,
|
||||
(double)test_video_param_.framerate_num /
|
||||
test_video_param_.framerate_den);
|
||||
@ -224,13 +224,7 @@ TEST_P(ArfFreqTest, MinArfFreqTest) {
|
||||
delete(video);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
ArfFreqTest,
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kEncodeVectors),
|
||||
::testing::ValuesIn(kMinArfVectors));
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
# if CONFIG_VP10_ENCODER
|
||||
// TODO(angiebird): 25-29 fail in high bitdepth mode.
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
@ -248,5 +242,5 @@ VP10_INSTANTIATE_TEST_CASE(
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kEncodeVectors),
|
||||
::testing::ValuesIn(kMinArfVectors));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
} // namespace
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP9_ENCODER
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#endif
|
||||
|
||||
#include "test/acm_random.h"
|
||||
|
@ -78,9 +78,6 @@ TEST_P(BordersTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
|
||||
::libvpx_test::kTwoPassGood));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
|
||||
::libvpx_test::kTwoPassGood));
|
||||
} // namespace
|
||||
|
@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/md5_helper.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
const int kLegacyByteAlignment = 0;
|
||||
const int kLegacyYPlaneByteAlignment = 32;
|
||||
const int kNumPlanesToCheck = 3;
|
||||
const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
|
||||
const char kVP9Md5File[] = "vp90-2-02-size-lf-1920x1080.webm.md5";
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
||||
struct ByteAlignmentTestParam {
|
||||
int byte_alignment;
|
||||
vpx_codec_err_t expected_value;
|
||||
bool decode_remaining;
|
||||
};
|
||||
|
||||
const ByteAlignmentTestParam kBaTestParams[] = {
|
||||
{kLegacyByteAlignment, VPX_CODEC_OK, true},
|
||||
{32, VPX_CODEC_OK, true},
|
||||
{64, VPX_CODEC_OK, true},
|
||||
{128, VPX_CODEC_OK, true},
|
||||
{256, VPX_CODEC_OK, true},
|
||||
{512, VPX_CODEC_OK, true},
|
||||
{1024, VPX_CODEC_OK, true},
|
||||
{1, VPX_CODEC_INVALID_PARAM, false},
|
||||
{-2, VPX_CODEC_INVALID_PARAM, false},
|
||||
{4, VPX_CODEC_INVALID_PARAM, false},
|
||||
{16, VPX_CODEC_INVALID_PARAM, false},
|
||||
{255, VPX_CODEC_INVALID_PARAM, false},
|
||||
{2048, VPX_CODEC_INVALID_PARAM, false},
|
||||
};
|
||||
|
||||
// Class for testing byte alignment of reference buffers.
|
||||
class ByteAlignmentTest
|
||||
: public ::testing::TestWithParam<ByteAlignmentTestParam> {
|
||||
protected:
|
||||
ByteAlignmentTest()
|
||||
: video_(NULL),
|
||||
decoder_(NULL),
|
||||
md5_file_(NULL) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
|
||||
ASSERT_TRUE(video_ != NULL);
|
||||
video_->Init();
|
||||
video_->Begin();
|
||||
|
||||
const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
|
||||
ASSERT_TRUE(decoder_ != NULL);
|
||||
|
||||
OpenMd5File(kVP9Md5File);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
if (md5_file_ != NULL)
|
||||
fclose(md5_file_);
|
||||
|
||||
delete decoder_;
|
||||
delete video_;
|
||||
}
|
||||
|
||||
void SetByteAlignment(int byte_alignment, vpx_codec_err_t expected_value) {
|
||||
decoder_->Control(VP9_SET_BYTE_ALIGNMENT, byte_alignment, expected_value);
|
||||
}
|
||||
|
||||
vpx_codec_err_t DecodeOneFrame(int byte_alignment_to_check) {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
CheckDecodedFrames(byte_alignment_to_check);
|
||||
if (res == VPX_CODEC_OK)
|
||||
video_->Next();
|
||||
return res;
|
||||
}
|
||||
|
||||
vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) {
|
||||
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(byte_alignment_to_check);
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
// Check if |data| is aligned to |byte_alignment_to_check|.
|
||||
// |byte_alignment_to_check| must be a power of 2.
|
||||
void CheckByteAlignment(const uint8_t *data, int byte_alignment_to_check) {
|
||||
ASSERT_EQ(0u, reinterpret_cast<size_t>(data) % byte_alignment_to_check);
|
||||
}
|
||||
|
||||
// Iterate through the planes of the decoded frames and check for
|
||||
// alignment based off |byte_alignment_to_check|.
|
||||
void CheckDecodedFrames(int byte_alignment_to_check) {
|
||||
libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
|
||||
const vpx_image_t *img;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next()) != NULL) {
|
||||
if (byte_alignment_to_check == kLegacyByteAlignment) {
|
||||
CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
|
||||
} else {
|
||||
for (int i = 0; i < kNumPlanesToCheck; ++i) {
|
||||
CheckByteAlignment(img->planes[i], byte_alignment_to_check);
|
||||
}
|
||||
}
|
||||
CheckMd5(*img);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(fgalligan): Move the MD5 testing code into another class.
|
||||
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_;
|
||||
}
|
||||
|
||||
void CheckMd5(const vpx_image_t &img) {
|
||||
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";
|
||||
}
|
||||
|
||||
libvpx_test::WebMVideoSource *video_;
|
||||
libvpx_test::VP9Decoder *decoder_;
|
||||
FILE *md5_file_;
|
||||
};
|
||||
|
||||
TEST_F(ByteAlignmentTest, SwitchByteAlignment) {
|
||||
const int num_elements = 14;
|
||||
const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
|
||||
0, 1024, 32, 512, 64, 256, 128 };
|
||||
|
||||
for (int i = 0; i < num_elements; ++i) {
|
||||
SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame(byte_alignments[i]));
|
||||
}
|
||||
SetByteAlignment(byte_alignments[0], VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(byte_alignments[0]));
|
||||
}
|
||||
|
||||
TEST_P(ByteAlignmentTest, TestAlignment) {
|
||||
const ByteAlignmentTestParam t = GetParam();
|
||||
SetByteAlignment(t.byte_alignment, t.expected_value);
|
||||
if (t.decode_remaining)
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames(t.byte_alignment));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Alignments, ByteAlignmentTest,
|
||||
::testing::ValuesIn(kBaTestParams));
|
||||
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
} // namespace
|
@ -13,10 +13,10 @@
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
|
||||
#if CONFIG_VP10_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER || CONFIG_VP10_DECODER
|
||||
#if CONFIG_VP10_DECODER
|
||||
#include "vpx/vp8dx.h"
|
||||
#endif
|
||||
|
||||
@ -68,191 +68,6 @@ class CodecTestWith3Params : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
|
||||
};
|
||||
|
||||
/*
|
||||
* VP8 Codec Definitions
|
||||
*/
|
||||
#if CONFIG_VP8
|
||||
class VP8Decoder : public Decoder {
|
||||
public:
|
||||
VP8Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: Decoder(cfg, deadline) {}
|
||||
|
||||
VP8Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
|
||||
unsigned long deadline) // NOLINT
|
||||
: Decoder(cfg, flag, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return &vpx_codec_vp8_dx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP8Encoder : public Encoder {
|
||||
public:
|
||||
VP8Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return &vpx_codec_vp8_cx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP8CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP8CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
return CreateDecoder(cfg, 0, deadline);
|
||||
}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags,
|
||||
unsigned long deadline) const { // NOLINT
|
||||
#if CONFIG_VP8_DECODER
|
||||
return new VP8Decoder(cfg, flags, deadline);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return new VP8Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
|
||||
#else
|
||||
return VPX_CODEC_INCAPABLE;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
const libvpx_test::VP8CodecFactory kVP8;
|
||||
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)\
|
||||
INSTANTIATE_TEST_CASE_P(VP8, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP8)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)
|
||||
#endif // CONFIG_VP8
|
||||
|
||||
|
||||
/*
|
||||
* VP9 Codec Definitions
|
||||
*/
|
||||
#if CONFIG_VP9
|
||||
class VP9Decoder : public Decoder {
|
||||
public:
|
||||
VP9Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: Decoder(cfg, deadline) {}
|
||||
|
||||
VP9Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
|
||||
unsigned long deadline) // NOLINT
|
||||
: Decoder(cfg, flag, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return &vpx_codec_vp9_dx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP9Encoder : public Encoder {
|
||||
public:
|
||||
VP9Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return &vpx_codec_vp9_cx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP9CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP9CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
return CreateDecoder(cfg, 0, deadline);
|
||||
}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags,
|
||||
unsigned long deadline) const { // NOLINT
|
||||
#if CONFIG_VP9_DECODER
|
||||
return new VP9Decoder(cfg, flags, deadline);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return new VP9Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
|
||||
#elif CONFIG_VP10_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp10_cx_algo, cfg, usage);
|
||||
#else
|
||||
return VPX_CODEC_INCAPABLE;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
const libvpx_test::VP9CodecFactory kVP9;
|
||||
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)\
|
||||
INSTANTIATE_TEST_CASE_P(VP9, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP9)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)
|
||||
#endif // CONFIG_VP9
|
||||
|
||||
/*
|
||||
* VP10 Codec Definitions
|
||||
*/
|
||||
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ConfigTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ConfigTest() : EncoderTest(GET_PARAM(0)),
|
||||
frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
||||
virtual ~ConfigTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
frame_count_in_ = 0;
|
||||
frame_count_out_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
|
||||
++frame_count_in_;
|
||||
abort_ |= (frame_count_in_ >= frame_count_max_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
|
||||
++frame_count_out_;
|
||||
}
|
||||
|
||||
unsigned int frame_count_in_;
|
||||
unsigned int frame_count_out_;
|
||||
unsigned int frame_count_max_;
|
||||
};
|
||||
|
||||
TEST_P(ConfigTest, LagIsDisabled) {
|
||||
frame_count_max_ = 2;
|
||||
cfg_.g_lag_in_frames = 15;
|
||||
|
||||
libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
EXPECT_EQ(frame_count_in_, frame_count_out_);
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
|
||||
} // namespace
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP9_ENCODER
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#endif
|
||||
|
||||
#include "test/acm_random.h"
|
||||
|
@ -13,14 +13,14 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
#include "vp9/common/vp9_filter.h"
|
||||
#include "vp10/common/common.h"
|
||||
#include "vp10/common/filter.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
#include "vpx_dsp/vpx_filter.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
@ -189,7 +189,7 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr,
|
||||
output_width, output_height);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
@ -308,7 +308,7 @@ void highbd_filter_average_block2d_8_c(const uint16_t *src_ptr,
|
||||
highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride,
|
||||
output_width, output_height, bd);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
public:
|
||||
@ -320,7 +320,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
vpx_memalign(kDataAlignment, kOutputBufferSize));
|
||||
output_ref_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kOutputBufferSize));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
input16_ = reinterpret_cast<uint16_t*>(
|
||||
vpx_memalign(kDataAlignment,
|
||||
(kInputBufferSize + 1) * sizeof(uint16_t))) + 1;
|
||||
@ -340,7 +340,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
output_ = NULL;
|
||||
vpx_free(output_ref_);
|
||||
output_ref_ = NULL;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
vpx_free(input16_ - 1);
|
||||
input16_ = NULL;
|
||||
vpx_free(output16_);
|
||||
@ -375,7 +375,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
|
||||
virtual void SetUp() {
|
||||
UUT_ = GET_PARAM(2);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ != 0)
|
||||
mask_ = (1 << UUT_->use_highbd_) - 1;
|
||||
else
|
||||
@ -393,12 +393,12 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
for (int i = 0; i < kInputBufferSize; ++i) {
|
||||
if (i & 1) {
|
||||
input_[i] = 255;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
input16_[i] = mask_;
|
||||
#endif
|
||||
} else {
|
||||
input_[i] = prng.Rand8Extremes();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
input16_[i] = prng.Rand16() & mask_;
|
||||
#endif
|
||||
}
|
||||
@ -407,14 +407,14 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
|
||||
void SetConstantInput(int value) {
|
||||
memset(input_, value, kInputBufferSize);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
vpx_memset16(input16_, value, kInputBufferSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CopyOutputToRef() {
|
||||
memcpy(output_ref_, output_, kOutputBufferSize);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
memcpy(output16_ref_, output16_, kOutputBufferSize);
|
||||
#endif
|
||||
}
|
||||
@ -427,7 +427,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
}
|
||||
|
||||
uint8_t *input() const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
} else {
|
||||
@ -440,7 +440,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
}
|
||||
|
||||
uint8_t *output() const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
} else {
|
||||
@ -453,7 +453,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
}
|
||||
|
||||
uint8_t *output_ref() const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return output_ref_ + BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
} else {
|
||||
@ -466,7 +466,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
}
|
||||
|
||||
uint16_t lookup(uint8_t *list, int index) const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
return list[index];
|
||||
} else {
|
||||
@ -478,7 +478,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
}
|
||||
|
||||
void assign_val(uint8_t *list, int index, uint16_t val) const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
list[index] = (uint8_t) val;
|
||||
} else {
|
||||
@ -497,7 +497,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width,
|
||||
@ -524,7 +524,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width, output_height);
|
||||
@ -544,7 +544,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
static uint8_t* input_;
|
||||
static uint8_t* output_;
|
||||
static uint8_t* output_ref_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static uint16_t* input16_;
|
||||
static uint16_t* output16_;
|
||||
static uint16_t* output16_ref_;
|
||||
@ -555,7 +555,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
uint8_t* ConvolveTest::input_ = NULL;
|
||||
uint8_t* ConvolveTest::output_ = NULL;
|
||||
uint8_t* ConvolveTest::output_ref_ = NULL;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint16_t* ConvolveTest::input16_ = NULL;
|
||||
uint16_t* ConvolveTest::output16_ = NULL;
|
||||
uint16_t* ConvolveTest::output16_ref_ = NULL;
|
||||
@ -662,7 +662,7 @@ const int kNumFilters = 16;
|
||||
TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpKernel *filters =
|
||||
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
vp10_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
for (int i = 0; i < kNumFilters; i++) {
|
||||
const int p0 = filters[i][0] + filters[i][1];
|
||||
const int p1 = filters[i][2] + filters[i][3];
|
||||
@ -685,7 +685,7 @@ const int16_t kInvalidFilter[8] = { 0 };
|
||||
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t* ref;
|
||||
@ -700,7 +700,7 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpKernel *filters =
|
||||
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
vp10_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
@ -747,7 +747,7 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t* ref;
|
||||
@ -765,7 +765,7 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
uint16_t r;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
|
||||
r = prng.Rand8Extremes();
|
||||
} else {
|
||||
@ -782,7 +782,7 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpKernel *filters =
|
||||
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
vp10_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
@ -829,7 +829,7 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
TEST_P(ConvolveTest, FilterExtremes) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
@ -847,7 +847,7 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
uint16_t r;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
|
||||
r = prng.Rand8Extremes();
|
||||
} else {
|
||||
@ -866,7 +866,7 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
while (seed_val < 256) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * mask_);
|
||||
#else
|
||||
@ -884,7 +884,7 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpKernel *filters =
|
||||
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
vp10_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
wrapper_filter_block2d_8_c(in, kInputStride,
|
||||
@ -931,7 +931,7 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
const InterpKernel *const eighttap = vp9_filter_kernels[EIGHTTAP];
|
||||
const InterpKernel *const eighttap = vp10_filter_kernels[EIGHTTAP];
|
||||
|
||||
SetConstantInput(127);
|
||||
|
||||
@ -959,7 +959,7 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
#define WRAP(func, bd) \
|
||||
void wrap_ ## func ## _ ## bd(const uint8_t *src, ptrdiff_t src_stride, \
|
||||
uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
@ -1122,7 +1122,7 @@ INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && ARCH_X86_64
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const ConvolveFunctions convolve8_sse2(
|
||||
#if CONFIG_USE_X86INC
|
||||
wrap_convolve_copy_sse2_8, wrap_convolve_avg_sse2_8,
|
||||
@ -1227,7 +1227,7 @@ INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
|
||||
make_tuple(64, 32, &convolve8_sse2),
|
||||
make_tuple(32, 64, &convolve8_sse2),
|
||||
make_tuple(64, 64, &convolve8_sse2)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
|
@ -135,12 +135,6 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
CpuSpeedTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(0, 9));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(
|
||||
CpuSpeedTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
|
||||
|
134
test/cq_test.cc
134
test/cq_test.cc
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* 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 <cmath>
|
||||
#include <map>
|
||||
#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 {
|
||||
|
||||
// CQ level range: [kCQLevelMin, kCQLevelMax).
|
||||
const int kCQLevelMin = 4;
|
||||
const int kCQLevelMax = 63;
|
||||
const int kCQLevelStep = 8;
|
||||
const unsigned int kCQTargetBitrate = 2000;
|
||||
|
||||
class CQTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
public:
|
||||
// maps the cqlevel to the bitrate produced.
|
||||
typedef std::map<int, uint32_t> BitrateMap;
|
||||
|
||||
static void SetUpTestCase() {
|
||||
bitrates_.clear();
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
ASSERT_TRUE(!HasFailure())
|
||||
<< "skipping bitrate validation due to earlier failure.";
|
||||
uint32_t prev_actual_bitrate = kCQTargetBitrate;
|
||||
for (BitrateMap::const_iterator iter = bitrates_.begin();
|
||||
iter != bitrates_.end(); ++iter) {
|
||||
const uint32_t cq_actual_bitrate = iter->second;
|
||||
EXPECT_LE(cq_actual_bitrate, prev_actual_bitrate)
|
||||
<< "cq_level: " << iter->first
|
||||
<< ", bitrate should decrease with increase in CQ level.";
|
||||
prev_actual_bitrate = cq_actual_bitrate;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
CQTest() : EncoderTest(GET_PARAM(0)), cq_level_(GET_PARAM(1)) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
}
|
||||
|
||||
virtual ~CQTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
file_size_ = 0;
|
||||
psnr_ = 0.0;
|
||||
n_frames_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (cfg_.rc_end_usage == VPX_CQ) {
|
||||
encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
|
||||
}
|
||||
encoder->Control(VP8E_SET_CPUUSED, 3);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
|
||||
n_frames_++;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
file_size_ += pkt->data.frame.sz;
|
||||
}
|
||||
|
||||
double GetLinearPSNROverBitrate() const {
|
||||
double avg_psnr = log10(psnr_ / n_frames_) * 10.0;
|
||||
return pow(10.0, avg_psnr / 10.0) / file_size_;
|
||||
}
|
||||
|
||||
int cq_level() const { return cq_level_; }
|
||||
size_t file_size() const { return file_size_; }
|
||||
int n_frames() const { return n_frames_; }
|
||||
|
||||
static BitrateMap bitrates_;
|
||||
|
||||
private:
|
||||
int cq_level_;
|
||||
size_t file_size_;
|
||||
double psnr_;
|
||||
int n_frames_;
|
||||
};
|
||||
|
||||
CQTest::BitrateMap CQTest::bitrates_;
|
||||
|
||||
TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = kCQTargetBitrate;
|
||||
cfg_.g_lag_in_frames = 25;
|
||||
|
||||
cfg_.rc_end_usage = VPX_CQ;
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double cq_psnr_lin = GetLinearPSNROverBitrate();
|
||||
const unsigned int cq_actual_bitrate =
|
||||
static_cast<unsigned int>(file_size()) * 8 * 30 / (n_frames() * 1000);
|
||||
EXPECT_LE(cq_actual_bitrate, kCQTargetBitrate);
|
||||
bitrates_[cq_level()] = cq_actual_bitrate;
|
||||
|
||||
// try targeting the approximate same bitrate with VBR mode
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
cfg_.rc_target_bitrate = cq_actual_bitrate;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double vbr_psnr_lin = GetLinearPSNROverBitrate();
|
||||
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(CQTest,
|
||||
::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
} // namespace
|
@ -548,6 +548,7 @@ TEST_P(DatarateTestVP9Large, ChangingDropFrameThresh) {
|
||||
}
|
||||
|
||||
// Check basic rate targeting for 2 temporal layers.
|
||||
#if 0 // VP10 does not support multiple layers yet
|
||||
TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_buf_optimal_sz = 500;
|
||||
@ -679,6 +680,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) {
|
||||
ASSERT_LE(num_drops_, 130);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_TEMPORAL_DENOISING
|
||||
// Check basic datarate targeting, for a single bitrate, when denoiser is on.
|
||||
@ -967,12 +969,14 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc4threads) {
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
|
||||
}
|
||||
|
||||
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));
|
||||
VP9_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvc,
|
||||
::testing::Values(::libvpx_test::kRealTime),
|
||||
::testing::Range(5, 8));
|
||||
VP10_INSTANTIATE_TEST_CASE(DatarateTestVP9Large,
|
||||
::testing::Values(::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(2, 7));
|
||||
|
||||
/* VP10 does not support multiple layers yet.
|
||||
VP10_INSTANTIATE_TEST_CASE(DatarateOnePassCbrSvc,
|
||||
::testing::Values(::libvpx_test::kRealTime),
|
||||
::testing::Range(5, 8));
|
||||
*/
|
||||
} // namespace
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@ -258,15 +258,15 @@ void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
|
||||
|
||||
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type) {
|
||||
vp9_fht16x16_c(in, out, stride, tx_type);
|
||||
vp10_fht16x16_c(in, out, stride, tx_type);
|
||||
}
|
||||
|
||||
void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
|
||||
int tx_type) {
|
||||
vp9_iht16x16_256_add_c(in, dest, stride, tx_type);
|
||||
vp10_iht16x16_256_add_c(in, dest, stride, tx_type);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void idct16x16_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct16x16_256_add_c(in, out, stride, 10);
|
||||
}
|
||||
@ -286,11 +286,11 @@ void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
|
||||
}
|
||||
|
||||
void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10);
|
||||
vp10_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10);
|
||||
}
|
||||
|
||||
void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
|
||||
vp10_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12);
|
||||
}
|
||||
|
||||
void idct16x16_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
@ -318,7 +318,7 @@ void idct16x16_10_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct16x16_10_add_sse2(in, out, stride, 12);
|
||||
}
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
class Trans16x16TestBase {
|
||||
public:
|
||||
@ -339,7 +339,7 @@ class Trans16x16TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -350,7 +350,7 @@ class Trans16x16TestBase {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
test_input_block[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -364,7 +364,7 @@ class Trans16x16TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
@ -372,7 +372,7 @@ class Trans16x16TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -454,7 +454,7 @@ class Trans16x16TestBase {
|
||||
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -476,7 +476,7 @@ class Trans16x16TestBase {
|
||||
// clear reconstructed pixel buffers
|
||||
memset(dst, 0, kNumCoeffs * sizeof(uint8_t));
|
||||
memset(ref, 0, kNumCoeffs * sizeof(uint8_t));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
memset(dst16, 0, kNumCoeffs * sizeof(uint16_t));
|
||||
memset(ref16, 0, kNumCoeffs * sizeof(uint16_t));
|
||||
#endif
|
||||
@ -488,7 +488,7 @@ class Trans16x16TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
|
||||
tx_type_);
|
||||
@ -499,7 +499,7 @@ class Trans16x16TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
EXPECT_EQ(ref[j], dst[j]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
EXPECT_EQ(ref16[j], dst16[j]);
|
||||
@ -515,10 +515,10 @@ class Trans16x16TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
double out_r[kNumCoeffs];
|
||||
@ -529,12 +529,12 @@ class Trans16x16TestBase {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
in[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
in[j] = src16[j] - dst16[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,20 +544,20 @@ class Trans16x16TestBase {
|
||||
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
16));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
const uint32_t diff = dst[j] - src[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(1u, error)
|
||||
<< "Error: 16x16 IDCT has error " << error
|
||||
@ -570,14 +570,14 @@ class Trans16x16TestBase {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
const int eob = 10;
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
|
||||
const int16_t *scan = vp10_default_scan_orders[TX_16X16].scan;
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
@ -590,31 +590,31 @@ class Trans16x16TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
dst[j] = 0;
|
||||
ref[j] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
dst16[j] = 0;
|
||||
ref16[j] = 0;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ref_txfm(coeff, ref, pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
|
||||
#else
|
||||
const uint32_t diff = dst[j] - ref[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_EQ(0u, error)
|
||||
<< "Error: 16x16 IDCT Comparison has error " << error
|
||||
@ -646,7 +646,7 @@ class Trans16x16DCT
|
||||
fwd_txfm_ref = fdct16x16_ref;
|
||||
inv_txfm_ref = idct16x16_ref;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
switch (bit_depth_) {
|
||||
case VPX_BITS_10:
|
||||
inv_txfm_ref = idct16x16_10_ref;
|
||||
@ -713,7 +713,7 @@ class Trans16x16HT
|
||||
fwd_txfm_ref = fht16x16_ref;
|
||||
inv_txfm_ref = iht16x16_ref;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
switch (bit_depth_) {
|
||||
case VPX_BITS_10:
|
||||
inv_txfm_ref = iht16x16_10;
|
||||
@ -794,7 +794,7 @@ TEST_P(InvTrans16x16DCT, CompareReference) {
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
@ -806,35 +806,35 @@ INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht16x16_c, &iht16x16_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 3, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_c, &vp10_iht16x16_256_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
@ -842,7 +842,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
@ -851,17 +851,17 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,
|
||||
make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 0,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,
|
||||
make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 1,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,
|
||||
make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 2,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,
|
||||
make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_sse2, 3,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
@ -878,10 +878,13 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_c, 3,
|
||||
make_tuple(&vp10_fht16x16_sse2,
|
||||
&vp10_iht16x16_256_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_sse2,
|
||||
&vp10_iht16x16_256_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_sse2,
|
||||
&vp10_iht16x16_256_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_sse2, &vp10_iht16x16_256_add_c, 3,
|
||||
VPX_BITS_8)));
|
||||
// Optimizations take effect at a threshold of 3155, so we use a value close to
|
||||
// that to test both branches.
|
||||
@ -896,9 +899,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),
|
||||
make_tuple(&idct16x16_12,
|
||||
&idct16x16_256_add_12_sse2, 3167, VPX_BITS_12)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
@ -907,10 +910,13 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_msa, &vp9_iht16x16_256_add_msa, 3,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht16x16_msa,
|
||||
&vp10_iht16x16_256_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_msa,
|
||||
&vp10_iht16x16_256_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_msa,
|
||||
&vp10_iht16x16_256_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht16x16_msa,
|
||||
&vp10_iht16x16_256_add_msa, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
} // namespace
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@ -80,7 +80,7 @@ typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
||||
typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>
|
||||
Trans32x32Param;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void idct32x32_8(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 8);
|
||||
}
|
||||
@ -92,7 +92,7 @@ void idct32x32_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
void idct32x32_12(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 12);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> {
|
||||
public:
|
||||
@ -125,7 +125,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -137,7 +137,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
test_input_block[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -149,7 +149,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(fwd_txfm_(test_input_block, test_temp_block, 32));
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block,
|
||||
CONVERT_TO_BYTEPTR(dst16), 32));
|
||||
@ -157,7 +157,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -261,7 +261,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -275,7 +275,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
in[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -289,13 +289,13 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(coeff, dst, 32));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(coeff, CONVERT_TO_BYTEPTR(dst16), 32));
|
||||
#endif
|
||||
}
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -311,7 +311,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -335,9 +335,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_c,
|
||||
&vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -345,9 +345,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_c,
|
||||
&vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -355,9 +355,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -371,9 +371,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_sse2, &vpx_idct32x32_1024_add_c, 1,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_AVX2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -381,9 +381,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_AVX2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans32x32Test,
|
||||
::testing::Values(
|
||||
@ -391,5 +391,5 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_msa,
|
||||
&vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
} // namespace
|
||||
|
@ -133,7 +133,7 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
|
||||
vpx_codec_ctx_t dec;
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
|
||||
const uint32_t frame_size = static_cast<uint32_t>(video.frame_size());
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
EXPECT_EQ(VPX_CODEC_MEM_ERROR,
|
||||
vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0));
|
||||
#else
|
||||
|
@ -268,6 +268,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
|
||||
printf("}\n");
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VP10_INSTANTIATE_TEST_CASE(
|
||||
VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood));
|
||||
} // namespace
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vp9/common/vp9_reconinter.h"
|
||||
#include "vp9/encoder/vp9_context_tree.h"
|
||||
#include "vp9/encoder/vp9_denoiser.h"
|
||||
#include "vp10/common/reconinter.h"
|
||||
#include "vp10/encoder/context_tree.h"
|
||||
#include "vp10/encoder/denoiser.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
@ -197,6 +197,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
|
||||
}
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VP10_INSTANTIATE_TEST_CASE(
|
||||
VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime));
|
||||
} // namespace
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
|
||||
#if CONFIG_VP10_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
#include "vpx/vpx_encoder.h"
|
||||
@ -143,7 +143,7 @@ class Encoder {
|
||||
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 || CONFIG_VP10_ENCODER
|
||||
#if CONFIG_VP10_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();
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
#include "test/y4m_video_source.h"
|
||||
#include "vp9/vp9_dx_iface.h"
|
||||
#include "vp10/vp10_dx_iface.c"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -100,7 +100,7 @@ class VpxEncoderParmsGetToDecoder
|
||||
reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv);
|
||||
FrameWorkerData *const worker_data =
|
||||
reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1);
|
||||
VP9_COMMON *const common = &worker_data->pbi->common;
|
||||
VP10_COMMON *const common = &worker_data->pbi->common;
|
||||
|
||||
if (encode_parms.lossless) {
|
||||
EXPECT_EQ(0, common->base_qindex);
|
||||
@ -111,11 +111,7 @@ class VpxEncoderParmsGetToDecoder
|
||||
}
|
||||
EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode);
|
||||
if (encode_parms.error_resilient) {
|
||||
EXPECT_EQ(1, common->frame_parallel_decoding_mode);
|
||||
EXPECT_EQ(0, common->use_prev_frame_mvs);
|
||||
} else {
|
||||
EXPECT_EQ(encode_parms.frame_parallel,
|
||||
common->frame_parallel_decoding_mode);
|
||||
}
|
||||
EXPECT_EQ(encode_parms.color_range, common->color_range);
|
||||
EXPECT_EQ(encode_parms.cs, common->color_space);
|
||||
@ -147,7 +143,7 @@ TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) {
|
||||
delete video;
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
|
||||
VP10_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
|
||||
::testing::ValuesIn(kVP9EncodeParameterSet),
|
||||
::testing::ValuesIn(kVP9EncodePerfTestVectors));
|
||||
} // namespace
|
@ -48,7 +48,7 @@ const TestVideoParam kTestVectors[] = {
|
||||
{"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1},
|
||||
{"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
|
||||
{"park_joy_90p_8_440.yuv", 8, VPX_IMG_FMT_I440, VPX_BITS_8, 1},
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
{"park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016, VPX_BITS_10, 2},
|
||||
{"park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216, VPX_BITS_10, 3},
|
||||
{"park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416, VPX_BITS_10, 3},
|
||||
@ -57,7 +57,7 @@ const TestVideoParam kTestVectors[] = {
|
||||
{"park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216, VPX_BITS_12, 3},
|
||||
{"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, VPX_BITS_12, 3},
|
||||
{"park_joy_90p_12_440.yuv", 12, VPX_IMG_FMT_I44016, VPX_BITS_12, 3},
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
|
||||
// Encoding modes tested
|
||||
@ -181,13 +181,7 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
|
||||
delete(video);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
EndToEndTestLarge,
|
||||
::testing::ValuesIn(kEncodingModeVectors),
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kCpuUsedVectors));
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
# if CONFIG_VP10_ENCODER
|
||||
// TODO(angiebird): many fail in high bitdepth mode.
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
@ -205,5 +199,5 @@ VP10_INSTANTIATE_TEST_CASE(
|
||||
::testing::ValuesIn(kEncodingModeVectors),
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kCpuUsedVectors));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
} // namespace
|
@ -15,19 +15,19 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int kNumIterations = 1000;
|
||||
|
||||
typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff,
|
||||
@ -160,52 +160,52 @@ TEST_P(ErrorBlockTest, ExtremeValues) {
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_USE_X86INC
|
||||
int64_t wrap_vp9_highbd_block_error_8bit_c(const tran_low_t *coeff,
|
||||
int64_t wrap_vp10_highbd_block_error_8bit_c(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff,
|
||||
intptr_t block_size,
|
||||
int64_t *ssz, int bps) {
|
||||
assert(bps == 8);
|
||||
return vp9_highbd_block_error_8bit_c(coeff, dqcoeff, block_size, ssz);
|
||||
return vp10_highbd_block_error_8bit_c(coeff, dqcoeff, block_size, ssz);
|
||||
}
|
||||
|
||||
#if HAVE_SSE2
|
||||
int64_t wrap_vp9_highbd_block_error_8bit_sse2(const tran_low_t *coeff,
|
||||
int64_t wrap_vp10_highbd_block_error_8bit_sse2(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff,
|
||||
intptr_t block_size,
|
||||
int64_t *ssz, int bps) {
|
||||
assert(bps == 8);
|
||||
return vp9_highbd_block_error_8bit_sse2(coeff, dqcoeff, block_size, ssz);
|
||||
return vp10_highbd_block_error_8bit_sse2(coeff, dqcoeff, block_size, ssz);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, ErrorBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_8),
|
||||
make_tuple(&wrap_vp9_highbd_block_error_8bit_sse2,
|
||||
&wrap_vp9_highbd_block_error_8bit_c, VPX_BITS_8)));
|
||||
make_tuple(&vp10_highbd_block_error_sse2,
|
||||
&vp10_highbd_block_error_c, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_block_error_sse2,
|
||||
&vp10_highbd_block_error_c, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_block_error_sse2,
|
||||
&vp10_highbd_block_error_c, VPX_BITS_8),
|
||||
make_tuple(&wrap_vp10_highbd_block_error_8bit_sse2,
|
||||
&wrap_vp10_highbd_block_error_8bit_c, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_AVX
|
||||
int64_t wrap_vp9_highbd_block_error_8bit_avx(const tran_low_t *coeff,
|
||||
int64_t wrap_vp10_highbd_block_error_8bit_avx(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff,
|
||||
intptr_t block_size,
|
||||
int64_t *ssz, int bps) {
|
||||
assert(bps == 8);
|
||||
return vp9_highbd_block_error_8bit_avx(coeff, dqcoeff, block_size, ssz);
|
||||
return vp10_highbd_block_error_8bit_avx(coeff, dqcoeff, block_size, ssz);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX, ErrorBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&wrap_vp9_highbd_block_error_8bit_avx,
|
||||
&wrap_vp9_highbd_block_error_8bit_c, VPX_BITS_8)));
|
||||
make_tuple(&wrap_vp10_highbd_block_error_8bit_avx,
|
||||
&wrap_vp10_highbd_block_error_8bit_c, VPX_BITS_8)));
|
||||
#endif // HAVE_AVX
|
||||
|
||||
#endif // CONFIG_USE_X86INC
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
} // namespace
|
@ -590,12 +590,6 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
|
||||
}
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
|
||||
::testing::Values(true));
|
||||
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLargeCodecControls,
|
||||
ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
|
||||
::testing::Values(true));
|
||||
// SVC-related tests don't run for VP10 since SVC is not supported.
|
||||
VP10_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES,
|
||||
::testing::Values(false));
|
||||
|
@ -129,12 +129,6 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
|
||||
ASSERT_EQ(single_thr_md5, multi_thr_md5);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VPxEncoderThreadTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(1, 9));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(
|
||||
VPxEncoderThreadTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
|
@ -1,488 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/md5_helper.h"
|
||||
#include "test/test_vectors.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
|
||||
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];
|
||||
memset(ext_fb_list_[idx].data, 0, 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 to as free.
|
||||
// Returns < 0 on an error.
|
||||
int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) {
|
||||
if (fb == NULL) {
|
||||
EXPECT_TRUE(fb != NULL);
|
||||
return -1;
|
||||
}
|
||||
ExternalFrameBuffer *const ext_fb =
|
||||
reinterpret_cast<ExternalFrameBuffer*>(fb->priv);
|
||||
if (ext_fb == NULL) {
|
||||
EXPECT_TRUE(ext_fb != NULL);
|
||||
return -1;
|
||||
}
|
||||
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_;
|
||||
};
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
// 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 = vpx_codec_dec_cfg_t();
|
||||
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_;
|
||||
};
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
// 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 {
|
||||
#if CONFIG_WEBM_IO
|
||||
video = new libvpx_test::WebMVideoSource(filename);
|
||||
#else
|
||||
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
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));
|
||||
}
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test,
|
||||
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
|
||||
libvpx_test::kVP9TestVectors +
|
||||
libvpx_test::kNumVP9TestVectors));
|
||||
} // namespace
|
@ -14,13 +14,13 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@ -45,15 +45,15 @@ void fdct4x4_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
}
|
||||
|
||||
void fht4x4_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
|
||||
vp9_fht4x4_c(in, out, stride, tx_type);
|
||||
vp10_fht4x4_c(in, out, stride, tx_type);
|
||||
}
|
||||
|
||||
void fwht4x4_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type) {
|
||||
vp9_fwht4x4_c(in, out, stride);
|
||||
vp10_fwht4x4_c(in, out, stride);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void idct4x4_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct4x4_16_add_c(in, out, stride, 10);
|
||||
}
|
||||
@ -63,11 +63,11 @@ void idct4x4_12(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
}
|
||||
|
||||
void iht4x4_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 10);
|
||||
vp10_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 10);
|
||||
}
|
||||
|
||||
void iht4x4_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 12);
|
||||
vp10_highbd_iht4x4_16_add_c(in, out, stride, tx_type, 12);
|
||||
}
|
||||
|
||||
void iwht4x4_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
@ -87,7 +87,7 @@ void idct4x4_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct4x4_16_add_sse2(in, out, stride, 12);
|
||||
}
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
class Trans4x4TestBase {
|
||||
public:
|
||||
@ -108,7 +108,7 @@ class Trans4x4TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -119,7 +119,7 @@ class Trans4x4TestBase {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
test_input_block[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -132,7 +132,7 @@ class Trans4x4TestBase {
|
||||
test_temp_block, pitch_));
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block,
|
||||
CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
@ -140,7 +140,7 @@ class Trans4x4TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -224,7 +224,7 @@ class Trans4x4TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -236,7 +236,7 @@ class Trans4x4TestBase {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
in[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -249,7 +249,7 @@ class Trans4x4TestBase {
|
||||
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
@ -257,7 +257,7 @@ class Trans4x4TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -415,7 +415,7 @@ TEST_P(Trans4x4WHT, InvAccuracyCheck) {
|
||||
}
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
@ -427,83 +427,83 @@ INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht4x4_c, &iht4x4_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht4x4_c, &iht4x4_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4WHT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
make_tuple(&vp10_highbd_fwht4x4_c, &iwht4x4_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4WHT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_c,
|
||||
&vpx_idct4x4_16_add_neon, 0, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_c, &vp10_iht4x4_16_add_neon, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if CONFIG_USE_X86INC && HAVE_MMX && !CONFIG_VP9_HIGHBITDEPTH && \
|
||||
#if CONFIG_USE_X86INC && HAVE_MMX && !CONFIG_VPX_HIGHBITDEPTH && \
|
||||
!CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MMX, Trans4x4WHT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fwht4x4_mmx, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
make_tuple(&vp10_fwht4x4_mmx, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if CONFIG_USE_X86INC && HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && \
|
||||
#if CONFIG_USE_X86INC && HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && \
|
||||
!CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4WHT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_sse2, 0, VPX_BITS_8)));
|
||||
make_tuple(&vp10_fwht4x4_c, &vpx_iwht4x4_16_add_sse2, 0, VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
@ -512,13 +512,14 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2,
|
||||
&vp10_iht4x4_16_add_sse2, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
@ -532,13 +533,13 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_c, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
@ -546,9 +547,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans4x4HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht4x4_msa, &vp9_iht4x4_16_add_msa, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht4x4_msa, &vp10_iht4x4_16_add_msa, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
} // namespace
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
@ -87,10 +87,10 @@ void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
|
||||
}
|
||||
|
||||
void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
|
||||
vp9_fht8x8_c(in, out, stride, tx_type);
|
||||
vp10_fht8x8_c(in, out, stride, tx_type);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void idct8x8_10(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct8x8_64_add_c(in, out, stride, 10);
|
||||
}
|
||||
@ -100,11 +100,11 @@ void idct8x8_12(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
}
|
||||
|
||||
void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10);
|
||||
vp10_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10);
|
||||
}
|
||||
|
||||
void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
||||
vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
|
||||
vp10_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
|
||||
}
|
||||
|
||||
void idct8x8_10_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
@ -132,7 +132,7 @@ void idct8x8_64_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
||||
vpx_highbd_idct8x8_64_add_sse2(in, out, stride, 12);
|
||||
}
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
class FwdTrans8x8TestBase {
|
||||
public:
|
||||
@ -219,7 +219,7 @@ class FwdTrans8x8TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[64]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[64]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[64]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[64]);
|
||||
#endif
|
||||
@ -231,7 +231,7 @@ class FwdTrans8x8TestBase {
|
||||
src[j] = rnd.Rand8();
|
||||
dst[j] = rnd.Rand8();
|
||||
test_input_block[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand16() & mask_;
|
||||
dst16[j] = rnd.Rand16() & mask_;
|
||||
@ -256,7 +256,7 @@ class FwdTrans8x8TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
@ -264,7 +264,7 @@ class FwdTrans8x8TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -297,7 +297,7 @@ class FwdTrans8x8TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_temp_block[64]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[64]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[64]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[64]);
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[64]);
|
||||
#endif
|
||||
@ -317,7 +317,7 @@ class FwdTrans8x8TestBase {
|
||||
dst[j] = rnd.Rand8() % 2 ? 255 : 0;
|
||||
}
|
||||
test_input_block[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
if (i == 0) {
|
||||
src16[j] = mask_;
|
||||
@ -341,7 +341,7 @@ class FwdTrans8x8TestBase {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
@ -349,7 +349,7 @@ class FwdTrans8x8TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -385,7 +385,7 @@ class FwdTrans8x8TestBase {
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
#endif
|
||||
@ -399,7 +399,7 @@ class FwdTrans8x8TestBase {
|
||||
src[j] = rnd.Rand8() % 2 ? 255 : 0;
|
||||
dst[j] = src[j] > 0 ? 0 : 255;
|
||||
in[j] = src[j] - dst[j];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
|
||||
dst16[j] = src16[j] > 0 ? 0 : mask_;
|
||||
@ -414,7 +414,7 @@ class FwdTrans8x8TestBase {
|
||||
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
@ -422,7 +422,7 @@ class FwdTrans8x8TestBase {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
@ -472,11 +472,11 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
|
||||
#endif
|
||||
const int16_t *scan = vp9_default_scan_orders[TX_8X8].scan;
|
||||
const int16_t *scan = vp10_default_scan_orders[TX_8X8].scan;
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
@ -489,7 +489,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
dst[j] = 0;
|
||||
ref[j] = 0;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
dst16[j] = 0;
|
||||
ref16[j] = 0;
|
||||
@ -499,7 +499,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
ref_txfm(coeff, ref, pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
@ -508,7 +508,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
}
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
|
||||
#else
|
||||
@ -654,7 +654,7 @@ TEST_P(InvTrans8x8DCT, CompareReference) {
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
@ -666,53 +666,53 @@ INSTANTIATE_TEST_CASE_P(
|
||||
C, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 2, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_10, 3, VPX_BITS_10),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 1, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 2, VPX_BITS_12),
|
||||
make_tuple(&vp10_highbd_fht8x8_c, &iht8x8_12, 3, VPX_BITS_12),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_neon, &vpx_idct8x8_64_add_neon, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_c, &vp10_iht8x8_64_add_neon, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
@ -721,13 +721,14 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2,
|
||||
&vp10_iht8x8_64_add_sse2, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
@ -744,10 +745,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
||||
|
||||
// Optimizations take effect at a threshold of 6201, so we use a value close to
|
||||
// that to test both branches.
|
||||
@ -762,10 +763,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&idct8x8_10_add_12_sse2, 6225, VPX_BITS_12),
|
||||
make_tuple(&idct8x8_12,
|
||||
&idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_SSE2 && CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSSE3 && CONFIG_USE_X86INC && ARCH_X86_64 && \
|
||||
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
!CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
@ -773,7 +774,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
@ -781,9 +782,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 1, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 2, VPX_BITS_8),
|
||||
make_tuple(&vp10_fht8x8_msa, &vp10_iht8x8_64_add_msa, 3, VPX_BITS_8)));
|
||||
#endif // HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
} // namespace
|
||||
|
@ -17,7 +17,7 @@ class VP9FrameSizeTestsLarge
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
protected:
|
||||
VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP9),
|
||||
VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP10),
|
||||
expected_res_(VPX_CODEC_OK) {}
|
||||
virtual ~VP9FrameSizeTestsLarge() {}
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_pred_common.h"
|
||||
#include "vp10/common/blockd.h"
|
||||
#include "vp10/common/pred_common.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
@ -130,7 +130,7 @@ TEST_P(VP9IntraPredTest, IntraPredTests) {
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
#if CONFIG_USE_X86INC
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest,
|
||||
::testing::Values(
|
||||
@ -226,6 +226,6 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 12)));
|
||||
|
||||
#endif // CONFIG_USE_X86INC
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif // HAVE_SSE2
|
||||
} // namespace
|
@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
|
||||
struct DecodeParam {
|
||||
int threads;
|
||||
const char *filename;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
|
||||
return os << "threads: " << dp.threads << " file: " << dp.filename;
|
||||
}
|
||||
|
||||
class InvalidFileTest
|
||||
: public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
|
||||
protected:
|
||||
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
|
||||
|
||||
virtual ~InvalidFileTest() {
|
||||
if (res_file_ != NULL)
|
||||
fclose(res_file_);
|
||||
}
|
||||
|
||||
void OpenResFile(const std::string &res_file_name_) {
|
||||
res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);
|
||||
ASSERT_TRUE(res_file_ != NULL) << "Result file open failed. Filename: "
|
||||
<< res_file_name_;
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(
|
||||
const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::CompressedVideoSource &video,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
EXPECT_TRUE(res_file_ != NULL);
|
||||
int expected_res_dec;
|
||||
|
||||
// Read integer result.
|
||||
const int res = fscanf(res_file_, "%d", &expected_res_dec);
|
||||
EXPECT_NE(res, EOF) << "Read result data failed";
|
||||
|
||||
// Check results match.
|
||||
const DecodeParam input = GET_PARAM(1);
|
||||
if (input.threads > 1) {
|
||||
// The serial decode check is too strict for tile-threaded decoding as
|
||||
// there is no guarantee on the decode order nor which specific error
|
||||
// will take precedence. Currently a tile-level error is not forwarded so
|
||||
// the frame will simply be marked corrupt.
|
||||
EXPECT_TRUE(res_dec == expected_res_dec ||
|
||||
res_dec == VPX_CODEC_CORRUPT_FRAME)
|
||||
<< "Results don't match: frame number = " << video.frame_number()
|
||||
<< ". (" << decoder->DecodeError() << "). Expected: "
|
||||
<< expected_res_dec << " or " << VPX_CODEC_CORRUPT_FRAME;
|
||||
} else {
|
||||
EXPECT_EQ(expected_res_dec, res_dec)
|
||||
<< "Results don't match: frame number = " << video.frame_number()
|
||||
<< ". (" << decoder->DecodeError() << ")";
|
||||
}
|
||||
|
||||
return !HasFailure();
|
||||
}
|
||||
|
||||
void RunTest() {
|
||||
const DecodeParam input = GET_PARAM(1);
|
||||
libvpx_test::CompressedVideoSource *video = NULL;
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
cfg.threads = input.threads;
|
||||
const std::string filename = input.filename;
|
||||
|
||||
// Open compressed video file.
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video = new libvpx_test::IVFVideoSource(filename);
|
||||
} else if (filename.substr(filename.length() - 4, 4) == "webm") {
|
||||
#if CONFIG_WEBM_IO
|
||||
video = new libvpx_test::WebMVideoSource(filename);
|
||||
#else
|
||||
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
video->Init();
|
||||
|
||||
// Construct result file name. The file holds a list of expected integer
|
||||
// results, one for each decoded frame. Any result that doesn't match
|
||||
// the files list will cause a test failure.
|
||||
const std::string res_filename = filename + ".res";
|
||||
OpenResFile(res_filename);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video, cfg));
|
||||
delete video;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE *res_file_;
|
||||
};
|
||||
|
||||
TEST_P(InvalidFileTest, ReturnCode) {
|
||||
RunTest();
|
||||
}
|
||||
|
||||
const DecodeParam kVP9InvalidFileTests[] = {
|
||||
{1, "invalid-vp90-02-v2.webm"},
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf"},
|
||||
#endif
|
||||
{1, "invalid-vp90-03-v3.webm"},
|
||||
{1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf"},
|
||||
{1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf"},
|
||||
{1, "invalid-vp91-2-mixedrefcsp-444to420.ivf"},
|
||||
{1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf"},
|
||||
};
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,
|
||||
::testing::ValuesIn(kVP9InvalidFileTests));
|
||||
|
||||
// This class will include test vectors that are expected to fail
|
||||
// peek. However they are still expected to have no fatal failures.
|
||||
class InvalidFileInvalidPeekTest : public InvalidFileTest {
|
||||
protected:
|
||||
InvalidFileInvalidPeekTest() : InvalidFileTest() {}
|
||||
virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
|
||||
libvpx_test::CompressedVideoSource* /*video*/,
|
||||
const vpx_codec_err_t /*res_peek*/) {}
|
||||
};
|
||||
|
||||
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) {
|
||||
RunTest();
|
||||
}
|
||||
|
||||
const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
|
||||
{1, "invalid-vp90-01-v3.webm"},
|
||||
};
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
|
||||
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
|
||||
|
||||
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
|
||||
{4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm"},
|
||||
{4, "invalid-"
|
||||
"vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf"},
|
||||
{4, "invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf"},
|
||||
{2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf"},
|
||||
{4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf"},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
VP9MultiThreaded, InvalidFileTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(
|
||||
static_cast<const libvpx_test::CodecFactory*>(&libvpx_test::kVP9)),
|
||||
::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));
|
||||
} // namespace
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* 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 KeyframeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~KeyframeTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
kf_count_ = 0;
|
||||
kf_count_max_ = INT_MAX;
|
||||
kf_do_force_kf_ = false;
|
||||
set_cpu_used_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
if (kf_do_force_kf_)
|
||||
frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
|
||||
if (set_cpu_used_ && video->frame() == 1)
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
kf_pts_list_.push_back(pkt->data.frame.pts);
|
||||
kf_count_++;
|
||||
abort_ |= kf_count_ > kf_count_max_;
|
||||
}
|
||||
}
|
||||
|
||||
bool kf_do_force_kf_;
|
||||
int kf_count_;
|
||||
int kf_count_max_;
|
||||
std::vector<vpx_codec_pts_t> kf_pts_list_;
|
||||
int set_cpu_used_;
|
||||
};
|
||||
|
||||
TEST_P(KeyframeTest, TestRandomVideoSource) {
|
||||
// Validate that encoding the RandomVideoSource produces multiple keyframes.
|
||||
// This validates the results of the TestDisableKeyframes test.
|
||||
kf_count_max_ = 2; // early exit successful tests.
|
||||
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check if(GetParam() > 0)
|
||||
if (GET_PARAM(1) > 0)
|
||||
EXPECT_GT(kf_count_, 1);
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestDisableKeyframes) {
|
||||
cfg_.kf_mode = VPX_KF_DISABLED;
|
||||
kf_count_max_ = 1; // early exit failed tests.
|
||||
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
EXPECT_EQ(1, kf_count_);
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestForceKeyframe) {
|
||||
cfg_.kf_mode = VPX_KF_DISABLED;
|
||||
kf_do_force_kf_ = true;
|
||||
|
||||
::libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// verify that every third frame is a keyframe.
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
ASSERT_EQ(0, *iter % 3) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestKeyframeMaxDistance) {
|
||||
cfg_.kf_max_dist = 25;
|
||||
|
||||
::libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// verify that keyframe interval matches kf_max_dist
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
ASSERT_EQ(0, *iter % 25) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
cfg_.kf_mode = VPX_KF_AUTO;
|
||||
kf_do_force_kf_ = false;
|
||||
|
||||
// Force a deterministic speed step in Real Time mode, as the faster modes
|
||||
// may not produce a keyframe like we expect. This is necessary when running
|
||||
// on very slow environments (like Valgrind). The step -11 was determined
|
||||
// experimentally as the fastest mode that still throws the keyframe.
|
||||
if (deadline_ == VPX_DL_REALTIME)
|
||||
set_cpu_used_ = -11;
|
||||
|
||||
// This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
|
||||
// I check only the first 40 frames to make sure there's a keyframe at frame
|
||||
// 0 and 30.
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 40);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check
|
||||
if (GET_PARAM(1) > 0)
|
||||
EXPECT_EQ(2u, kf_pts_list_.size()) << " Not the right number of keyframes ";
|
||||
|
||||
// Verify that keyframes match the file keyframes in the file.
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
if (deadline_ == VPX_DL_REALTIME && *iter > 0)
|
||||
EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
|
||||
<< *iter;
|
||||
else
|
||||
EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(KeyframeTest, ALL_TEST_MODES);
|
||||
} // namespace
|
@ -123,11 +123,6 @@ TEST_P(LosslessTest, TestLossLessEncodingCtrl) {
|
||||
EXPECT_GE(psnr_lossless, kMaxPsnr);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(LosslessTest,
|
||||
::testing::Values(::libvpx_test::kRealTime,
|
||||
::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kTwoPassGood));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(LosslessTest,
|
||||
::testing::Values(::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kTwoPassGood));
|
@ -20,8 +20,8 @@
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_loopfilter.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/loopfilter.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
@ -34,7 +34,7 @@ const int kNumCoeffs = 1024;
|
||||
|
||||
const int number_of_iterations = 10000;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh,
|
||||
int count, int bd);
|
||||
@ -50,13 +50,13 @@ typedef void (*dual_loop_op_t)(uint8_t *s, int p, const uint8_t *blimit0,
|
||||
const uint8_t *limit0, const uint8_t *thresh0,
|
||||
const uint8_t *blimit1, const uint8_t *limit1,
|
||||
const uint8_t *thresh1);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
typedef std::tr1::tuple<loop_op_t, loop_op_t, int, int> loop8_param_t;
|
||||
typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t;
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void wrapper_vertical_16_sse2(uint16_t *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh,
|
||||
int count, int bd) {
|
||||
@ -104,11 +104,11 @@ void wrapper_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit,
|
||||
int count) {
|
||||
vpx_lpf_vertical_16_dual_c(s, p, blimit, limit, thresh);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_NEON_ASM
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
// No neon high bitdepth functions.
|
||||
#else
|
||||
void wrapper_vertical_16_neon(uint8_t *s, int p, const uint8_t *blimit,
|
||||
@ -134,10 +134,10 @@ void wrapper_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit,
|
||||
int count) {
|
||||
vpx_lpf_vertical_16_dual_c(s, p, blimit, limit, thresh);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON_ASM
|
||||
|
||||
#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
#if HAVE_MSA && (!CONFIG_VPX_HIGHBITDEPTH)
|
||||
void wrapper_vertical_16_msa(uint8_t *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh,
|
||||
int count) {
|
||||
@ -149,7 +149,7 @@ void wrapper_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit,
|
||||
int count) {
|
||||
vpx_lpf_vertical_16_c(s, p, blimit, limit, thresh);
|
||||
}
|
||||
#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
#endif // HAVE_MSA && (!CONFIG_VPX_HIGHBITDEPTH)
|
||||
|
||||
class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
|
||||
public:
|
||||
@ -194,14 +194,14 @@ class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
|
||||
TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = number_of_iterations;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
int32_t bd = bit_depth_;
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
@ -252,7 +252,7 @@ TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
}
|
||||
ref_s[j] = s[j];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count_, bd);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_, bd));
|
||||
@ -260,7 +260,7 @@ TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
@ -279,14 +279,14 @@ TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = number_of_iterations;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int32_t bd = bit_depth_;
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
|
||||
@ -324,7 +324,7 @@ TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
s[j] = rnd.Rand16() & mask_;
|
||||
ref_s[j] = s[j];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count_, bd);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_, bd));
|
||||
@ -332,7 +332,7 @@ TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
}
|
||||
@ -350,14 +350,14 @@ TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = number_of_iterations;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int32_t bd = bit_depth_;
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
@ -423,7 +423,7 @@ TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
}
|
||||
ref_s[j] = s[j];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1, bd);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
@ -435,7 +435,7 @@ TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
}
|
||||
@ -453,13 +453,13 @@ TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = number_of_iterations;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
@ -499,7 +499,7 @@ TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
s[j] = rnd.Rand16() & mask_;
|
||||
ref_s[j] = s[j];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int32_t bd = bit_depth_;
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1, bd);
|
||||
@ -512,7 +512,7 @@ TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
}
|
||||
@ -530,7 +530,7 @@ TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
@ -593,10 +593,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
make_tuple(&wrapper_vertical_16_sse2, &wrapper_vertical_16_c, 8, 1),
|
||||
make_tuple(&wrapper_vertical_16_dual_sse2,
|
||||
&wrapper_vertical_16_dual_c, 8, 1)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif
|
||||
|
||||
#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
#if HAVE_AVX2 && (!CONFIG_VPX_HIGHBITDEPTH)
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
@ -606,7 +606,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test9Param,
|
||||
::testing::Values(
|
||||
@ -646,11 +646,11 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_sse2,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
// No neon high bitdepth functions.
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
@ -689,10 +689,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_neon,
|
||||
&vpx_lpf_vertical_4_dual_c, 8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
#if HAVE_MSA && (!CONFIG_VPX_HIGHBITDEPTH)
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
@ -713,6 +713,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_msa,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
#endif // HAVE_MSA && (!CONFIG_VPX_HIGHBITDEPTH)
|
||||
|
||||
} // namespace
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vp10/common/blockd.h"
|
||||
#include "vp10/common/scan.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
@ -115,7 +115,7 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
|
||||
// quantization with maximum allowed step sizes
|
||||
test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
|
||||
for (int j = 1; j < last_nonzero_; ++j)
|
||||
test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]]
|
||||
test_coef_block1[vp10_default_scan_orders[tx_size_].scan[j]]
|
||||
= (output_ref_block[j] / 1828) * 1828;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ TEST_P(PartialIDctTest, ResultsMatch) {
|
||||
max_energy_leftover = 0;
|
||||
coef = 0;
|
||||
}
|
||||
test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] = coef;
|
||||
test_coef_block1[vp10_default_scan_orders[tx_size_].scan[j]] = coef;
|
||||
}
|
||||
|
||||
memcpy(test_coef_block2, test_coef_block1,
|
||||
@ -231,7 +231,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct4x4_1_add_c,
|
||||
TX_4X4, 1)));
|
||||
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, PartialIDctTest,
|
||||
::testing::Values(
|
||||
@ -259,9 +259,9 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct4x4_16_add_c,
|
||||
&vpx_idct4x4_1_add_neon,
|
||||
TX_4X4, 1)));
|
||||
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_NEON && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSE2 && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, PartialIDctTest,
|
||||
::testing::Values(
|
||||
@ -296,7 +296,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3 && CONFIG_USE_X86INC && ARCH_X86_64 && \
|
||||
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
!CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3_64, PartialIDctTest,
|
||||
::testing::Values(
|
||||
@ -306,7 +306,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
TX_8X8, 12)));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, PartialIDctTest,
|
||||
::testing::Values(
|
||||
@ -338,6 +338,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
&vpx_idct4x4_16_add_c,
|
||||
&vpx_idct4x4_1_add_msa,
|
||||
TX_4X4, 1)));
|
||||
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#endif // HAVE_MSA && !CONFIG_VPX_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
} // namespace
|
||||
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* 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 "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
typedef void (*PostProcFunc)(unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int cols,
|
||||
unsigned char *flimit,
|
||||
int size);
|
||||
|
||||
namespace {
|
||||
|
||||
class VP8PostProcessingFilterTest
|
||||
: public ::testing::TestWithParam<PostProcFunc> {
|
||||
public:
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
};
|
||||
|
||||
// Test routine for the VP8 post-processing function
|
||||
// vp8_post_proc_down_and_across_mb_row_c.
|
||||
|
||||
TEST_P(VP8PostProcessingFilterTest, FilterOutputCheck) {
|
||||
// Size of the underlying data block that will be filtered.
|
||||
const int block_width = 16;
|
||||
const int block_height = 16;
|
||||
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
const int input_width = block_width;
|
||||
const int input_height = block_height + 4;
|
||||
const int input_stride = input_width;
|
||||
const int input_size = input_width * input_height;
|
||||
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
const int output_width = block_width + 16;
|
||||
const int output_height = block_height;
|
||||
const int output_stride = output_width;
|
||||
const int output_size = output_width * output_height;
|
||||
|
||||
uint8_t *const src_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));
|
||||
uint8_t *const dst_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));
|
||||
|
||||
// Pointers to top-left pixel of block in the input and output images.
|
||||
uint8_t *const src_image_ptr = src_image + (input_stride << 1);
|
||||
uint8_t *const dst_image_ptr = dst_image + 8;
|
||||
uint8_t *const flimits =
|
||||
reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
|
||||
(void)memset(flimits, 255, block_width);
|
||||
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to value 1,
|
||||
// border pixels to value 10.
|
||||
(void)memset(src_image, 10, input_size);
|
||||
uint8_t *pixel_ptr = src_image_ptr;
|
||||
for (int i = 0; i < block_height; ++i) {
|
||||
for (int j = 0; j < block_width; ++j) {
|
||||
pixel_ptr[j] = 1;
|
||||
}
|
||||
pixel_ptr += input_stride;
|
||||
}
|
||||
|
||||
// Initialize pixels in the output to 99.
|
||||
(void)memset(dst_image, 99, output_size);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GetParam()(src_image_ptr, dst_image_ptr, input_stride,
|
||||
output_stride, block_width, flimits, 16));
|
||||
|
||||
static const uint8_t expected_data[block_height] = {
|
||||
4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4
|
||||
};
|
||||
|
||||
pixel_ptr = dst_image_ptr;
|
||||
for (int i = 0; i < block_height; ++i) {
|
||||
for (int j = 0; j < block_width; ++j) {
|
||||
EXPECT_EQ(expected_data[i], pixel_ptr[j])
|
||||
<< "VP8PostProcessingFilterTest failed with invalid filter output";
|
||||
}
|
||||
pixel_ptr += output_stride;
|
||||
}
|
||||
|
||||
vpx_free(src_image);
|
||||
vpx_free(dst_image);
|
||||
vpx_free(flimits);
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, VP8PostProcessingFilterTest,
|
||||
::testing::Values(vp8_post_proc_down_and_across_mb_row_c));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, VP8PostProcessingFilterTest,
|
||||
::testing::Values(vp8_post_proc_down_and_across_mb_row_sse2));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_CASE_P(MSA, VP8PostProcessingFilterTest,
|
||||
::testing::Values(vp8_post_proc_down_and_across_mb_row_msa));
|
||||
#endif
|
||||
|
||||
} // namespace
|
@ -8,196 +8,344 @@
|
||||
* 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 "./vpx_config.h"
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vp8/common/onyx.h"
|
||||
#include "vp8/encoder/block.h"
|
||||
#include "vp8/encoder/onyx_int.h"
|
||||
#include "vp8/encoder/quantize.h"
|
||||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const int kNumBlocks = 25;
|
||||
const int kNumBlockEntries = 16;
|
||||
|
||||
typedef void (*VP8Quantize)(BLOCK *b, BLOCKD *d);
|
||||
|
||||
typedef std::tr1::tuple<VP8Quantize, VP8Quantize> VP8QuantizeParam;
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
// Create and populate a VP8_COMP instance which has a complete set of
|
||||
// quantization inputs as well as a second MACROBLOCKD for output.
|
||||
class QuantizeTestBase {
|
||||
namespace {
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const int number_of_iterations = 100;
|
||||
|
||||
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
|
||||
int skip_block, const int16_t *zbin,
|
||||
const int16_t *round, const int16_t *quant,
|
||||
const int16_t *quant_shift,
|
||||
tran_low_t *qcoeff, tran_low_t *dqcoeff,
|
||||
const int16_t *dequant,
|
||||
uint16_t *eob, const int16_t *scan,
|
||||
const int16_t *iscan);
|
||||
typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
|
||||
QuantizeParam;
|
||||
|
||||
class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~QuantizeTestBase() {
|
||||
vp8_remove_compressor(&vp8_comp_);
|
||||
vp8_comp_ = NULL;
|
||||
vpx_free(macroblockd_dst_);
|
||||
macroblockd_dst_ = NULL;
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetupCompressor() {
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
|
||||
// The full configuration is necessary to generate the quantization tables.
|
||||
VP8_CONFIG vp8_config;
|
||||
memset(&vp8_config, 0, sizeof(vp8_config));
|
||||
|
||||
vp8_comp_ = vp8_create_compressor(&vp8_config);
|
||||
|
||||
// Set the tables based on a quantizer of 0.
|
||||
vp8_set_quantizer(vp8_comp_, 0);
|
||||
|
||||
// Set up all the block/blockd pointers for the mb in vp8_comp_.
|
||||
vp8cx_frame_init_quantizer(vp8_comp_);
|
||||
|
||||
// Copy macroblockd from the reference to get pre-set-up dequant values.
|
||||
macroblockd_dst_ = reinterpret_cast<MACROBLOCKD *>(
|
||||
vpx_memalign(32, sizeof(*macroblockd_dst_)));
|
||||
memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_));
|
||||
// Fix block pointers - currently they point to the blocks in the reference
|
||||
// structure.
|
||||
vp8_setup_block_dptrs(macroblockd_dst_);
|
||||
}
|
||||
|
||||
void UpdateQuantizer(int q) {
|
||||
vp8_set_quantizer(vp8_comp_, q);
|
||||
|
||||
memcpy(macroblockd_dst_, &vp8_comp_->mb.e_mbd, sizeof(*macroblockd_dst_));
|
||||
vp8_setup_block_dptrs(macroblockd_dst_);
|
||||
}
|
||||
|
||||
void FillCoeffConstant(int16_t c) {
|
||||
for (int i = 0; i < kNumBlocks * kNumBlockEntries; ++i) {
|
||||
vp8_comp_->mb.coeff[i] = c;
|
||||
}
|
||||
}
|
||||
|
||||
void FillCoeffRandom() {
|
||||
for (int i = 0; i < kNumBlocks * kNumBlockEntries; ++i) {
|
||||
vp8_comp_->mb.coeff[i] = rnd_.Rand8();
|
||||
}
|
||||
}
|
||||
|
||||
void CheckOutput() {
|
||||
EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.qcoeff, macroblockd_dst_->qcoeff,
|
||||
sizeof(*macroblockd_dst_->qcoeff) * kNumBlocks *
|
||||
kNumBlockEntries))
|
||||
<< "qcoeff mismatch";
|
||||
EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.dqcoeff, macroblockd_dst_->dqcoeff,
|
||||
sizeof(*macroblockd_dst_->dqcoeff) * kNumBlocks *
|
||||
kNumBlockEntries))
|
||||
<< "dqcoeff mismatch";
|
||||
EXPECT_EQ(0, memcmp(vp8_comp_->mb.e_mbd.eobs, macroblockd_dst_->eobs,
|
||||
sizeof(*macroblockd_dst_->eobs) * kNumBlocks))
|
||||
<< "eobs mismatch";
|
||||
}
|
||||
|
||||
VP8_COMP *vp8_comp_;
|
||||
MACROBLOCKD *macroblockd_dst_;
|
||||
|
||||
private:
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
class QuantizeTest : public QuantizeTestBase,
|
||||
public ::testing::TestWithParam<VP8QuantizeParam> {
|
||||
protected:
|
||||
virtual ~VP9QuantizeTest() {}
|
||||
virtual void SetUp() {
|
||||
SetupCompressor();
|
||||
asm_quant_ = GET_PARAM(0);
|
||||
c_quant_ = GET_PARAM(1);
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
void RunComparison() {
|
||||
for (int i = 0; i < kNumBlocks; ++i) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
c_quant_(&vp8_comp_->mb.block[i], &vp8_comp_->mb.e_mbd.block[i]));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
asm_quant_(&vp8_comp_->mb.block[i], ¯oblockd_dst_->block[i]));
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
CheckOutput();
|
||||
}
|
||||
|
||||
private:
|
||||
VP8Quantize asm_quant_;
|
||||
VP8Quantize c_quant_;
|
||||
protected:
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
QuantizeFunc quantize_op_;
|
||||
QuantizeFunc ref_quantize_op_;
|
||||
};
|
||||
|
||||
TEST_P(QuantizeTest, TestZeroInput) {
|
||||
FillCoeffConstant(0);
|
||||
RunComparison();
|
||||
}
|
||||
|
||||
TEST_P(QuantizeTest, TestLargeNegativeInput) {
|
||||
FillCoeffConstant(0);
|
||||
// Generate a qcoeff which contains 512/-512 (0x0100/0xFE00) to catch issues
|
||||
// like BUG=883 where the constant being compared was incorrectly initialized.
|
||||
vp8_comp_->mb.coeff[0] = -8191;
|
||||
RunComparison();
|
||||
}
|
||||
|
||||
TEST_P(QuantizeTest, TestRandomInput) {
|
||||
FillCoeffRandom();
|
||||
RunComparison();
|
||||
}
|
||||
|
||||
TEST_P(QuantizeTest, TestMultipleQ) {
|
||||
for (int q = 0; q < QINDEX_RANGE; ++q) {
|
||||
UpdateQuantizer(q);
|
||||
FillCoeffRandom();
|
||||
RunComparison();
|
||||
class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~VP9Quantize32Test() {}
|
||||
virtual void SetUp() {
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
QuantizeFunc quantize_op_;
|
||||
QuantizeFunc ref_quantize_op_;
|
||||
};
|
||||
|
||||
TEST_P(VP9QuantizeTest, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
const int skip_block = i == 0;
|
||||
const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
|
||||
const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
|
||||
const scan_order *scan_order = &vp10_scan_orders[sz][tx_type];
|
||||
const int count = (4 << sz) * (4 << sz); // 16, 64, 256
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9Quantize32Test, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
const int skip_block = i == 0;
|
||||
const TX_SIZE sz = TX_32X32;
|
||||
const TX_TYPE tx_type = (TX_TYPE)(i % 4);
|
||||
const scan_order *scan_order = &vp10_scan_orders[sz][tx_type];
|
||||
const int count = (4 << sz) * (4 << sz); // 1024
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9QuantizeTest, EOBCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
int skip_block = i == 0;
|
||||
TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
|
||||
TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
|
||||
const scan_order *scan_order = &vp10_scan_orders[sz][tx_type];
|
||||
int count = (4 << sz) * (4 << sz); // 16, 64, 256
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
// Two random entries
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9Quantize32Test, EOBCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
int skip_block = i == 0;
|
||||
TX_SIZE sz = TX_32X32;
|
||||
TX_TYPE tx_type = (TX_TYPE)(i % 4);
|
||||
const scan_order *scan_order = &vp10_scan_orders[sz][tx_type];
|
||||
int count = (4 << sz) * (4 << sz); // 1024
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
// Two random entries
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, QuantizeTest,
|
||||
SSE2, VP9QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vp8_fast_quantize_b_sse2, &vp8_fast_quantize_b_c),
|
||||
make_tuple(&vp8_regular_quantize_b_sse2, &vp8_regular_quantize_b_c)));
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_12)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9Quantize32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, QuantizeTest,
|
||||
::testing::Values(make_tuple(&vp8_fast_quantize_b_ssse3,
|
||||
&vp8_fast_quantize_b_c)));
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, QuantizeTest,
|
||||
::testing::Values(make_tuple(&vp8_regular_quantize_b_sse4_1,
|
||||
&vp8_regular_quantize_b_c)));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(NEON, QuantizeTest,
|
||||
::testing::Values(make_tuple(&vp8_fast_quantize_b_neon,
|
||||
&vp8_fast_quantize_b_c)));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vp8_fast_quantize_b_msa, &vp8_fast_quantize_b_c),
|
||||
make_tuple(&vp8_regular_quantize_b_msa, &vp8_regular_quantize_b_c)));
|
||||
#endif // HAVE_MSA
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
} // namespace
|
||||
|
@ -94,7 +94,7 @@ class RegisterStateCheck {
|
||||
} // namespace libvpx_test
|
||||
|
||||
#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP9) \
|
||||
&& !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
|
||||
&& !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP10
|
||||
|
||||
extern "C" {
|
||||
// Save the d8-d15 registers into store.
|
||||
|
@ -540,14 +540,13 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_CASE(ResizeTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ResizeTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ResizeInternalTest,
|
||||
::testing::Values(::libvpx_test::kOnePassBest));
|
||||
VP9_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ResizeRealtimeTest,
|
||||
::testing::Values(::libvpx_test::kRealTime),
|
||||
::testing::Range(5, 9));
|
||||
VP9_INSTANTIATE_TEST_CASE(ResizeCspTest,
|
||||
VP10_INSTANTIATE_TEST_CASE(ResizeCspTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
} // namespace
|
||||
|
@ -100,14 +100,14 @@ class SADTestBase : public ::testing::Test {
|
||||
source_data_ = source_data8_;
|
||||
reference_data_ = reference_data8_;
|
||||
second_pred_ = second_pred8_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
use_high_bit_depth_ = true;
|
||||
bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
|
||||
source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
|
||||
reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
|
||||
second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
@ -116,11 +116,11 @@ class SADTestBase : public ::testing::Test {
|
||||
}
|
||||
|
||||
virtual uint8_t *GetReference(int block_idx) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (use_high_bit_depth_)
|
||||
return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
|
||||
block_idx * kDataBlockSize);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
return reference_data_ + block_idx * kDataBlockSize;
|
||||
}
|
||||
|
||||
@ -130,21 +130,21 @@ class SADTestBase : public ::testing::Test {
|
||||
unsigned int sad = 0;
|
||||
const uint8_t *const reference8 = GetReference(block_idx);
|
||||
const uint8_t *const source8 = source_data_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint16_t *const reference16 =
|
||||
CONVERT_TO_SHORTPTR(GetReference(block_idx));
|
||||
const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
if (!use_high_bit_depth_) {
|
||||
sad += abs(source8[h * source_stride_ + w] -
|
||||
reference8[h * reference_stride_ + w]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
sad += abs(source16[h * source_stride_ + w] -
|
||||
reference16[h * reference_stride_ + w]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,12 +159,12 @@ class SADTestBase : public ::testing::Test {
|
||||
const uint8_t *const reference8 = GetReference(block_idx);
|
||||
const uint8_t *const source8 = source_data_;
|
||||
const uint8_t *const second_pred8 = second_pred_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const uint16_t *const reference16 =
|
||||
CONVERT_TO_SHORTPTR(GetReference(block_idx));
|
||||
const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
|
||||
const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
if (!use_high_bit_depth_) {
|
||||
@ -172,13 +172,13 @@ class SADTestBase : public ::testing::Test {
|
||||
reference8[h * reference_stride_ + w];
|
||||
const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
|
||||
sad += abs(source8[h * source_stride_ + w] - comp_pred);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
const int tmp = second_pred16[h * width_ + w] +
|
||||
reference16[h * reference_stride_ + w];
|
||||
const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
|
||||
sad += abs(source16[h * source_stride_ + w] - comp_pred);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,17 +187,17 @@ class SADTestBase : public ::testing::Test {
|
||||
|
||||
void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
|
||||
uint8_t *data8 = data;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
if (!use_high_bit_depth_) {
|
||||
data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
data16[h * stride + w] = fill_constant;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,17 +205,17 @@ class SADTestBase : public ::testing::Test {
|
||||
|
||||
void FillRandom(uint8_t *data, int stride) {
|
||||
uint8_t *data8 = data;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
if (!use_high_bit_depth_) {
|
||||
data8[h * stride + w] = rnd_.Rand8();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
data16[h * stride + w] = rnd_.Rand16() & mask_;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -498,7 +498,7 @@ const SadMxNParam c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_sad8x4_c, -1),
|
||||
make_tuple(4, 8, &vpx_sad4x8_c, -1),
|
||||
make_tuple(4, 4, &vpx_sad4x4_c, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64_c, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32_c, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64_c, 8),
|
||||
@ -538,7 +538,7 @@ const SadMxNParam c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4_c, 12),
|
||||
make_tuple(4, 8, &vpx_highbd_sad4x8_c, 12),
|
||||
make_tuple(4, 4, &vpx_highbd_sad4x4_c, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
|
||||
|
||||
@ -556,7 +556,7 @@ const SadMxNAvgParam avg_c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_sad8x4_avg_c, -1),
|
||||
make_tuple(4, 8, &vpx_sad4x8_avg_c, -1),
|
||||
make_tuple(4, 4, &vpx_sad4x4_avg_c, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64_avg_c, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32_avg_c, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64_avg_c, 8),
|
||||
@ -596,7 +596,7 @@ const SadMxNAvgParam avg_c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4_avg_c, 12),
|
||||
make_tuple(4, 8, &vpx_highbd_sad4x8_avg_c, 12),
|
||||
make_tuple(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
|
||||
|
||||
@ -614,7 +614,7 @@ const SadMxNx4Param x4d_c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_sad8x4x4d_c, -1),
|
||||
make_tuple(4, 8, &vpx_sad4x8x4d_c, -1),
|
||||
make_tuple(4, 4, &vpx_sad4x4x4d_c, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64x4d_c, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32x4d_c, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64x4d_c, 8),
|
||||
@ -654,7 +654,7 @@ const SadMxNx4Param x4d_c_tests[] = {
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4x4d_c, 12),
|
||||
make_tuple(4, 8, &vpx_highbd_sad4x8x4d_c, 12),
|
||||
make_tuple(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
|
||||
|
||||
@ -726,7 +726,7 @@ const SadMxNParam sse2_tests[] = {
|
||||
make_tuple(8, 4, &vpx_sad8x4_sse2, -1),
|
||||
make_tuple(4, 8, &vpx_sad4x8_sse2, -1),
|
||||
make_tuple(4, 4, &vpx_sad4x4_sse2, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64_sse2, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32_sse2, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64_sse2, 8),
|
||||
@ -760,7 +760,7 @@ const SadMxNParam sse2_tests[] = {
|
||||
make_tuple(8, 16, &vpx_highbd_sad8x16_sse2, 12),
|
||||
make_tuple(8, 8, &vpx_highbd_sad8x8_sse2, 12),
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4_sse2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
|
||||
|
||||
@ -778,7 +778,7 @@ const SadMxNAvgParam avg_sse2_tests[] = {
|
||||
make_tuple(8, 4, &vpx_sad8x4_avg_sse2, -1),
|
||||
make_tuple(4, 8, &vpx_sad4x8_avg_sse2, -1),
|
||||
make_tuple(4, 4, &vpx_sad4x4_avg_sse2, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64_avg_sse2, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32_avg_sse2, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64_avg_sse2, 8),
|
||||
@ -812,7 +812,7 @@ const SadMxNAvgParam avg_sse2_tests[] = {
|
||||
make_tuple(8, 16, &vpx_highbd_sad8x16_avg_sse2, 12),
|
||||
make_tuple(8, 8, &vpx_highbd_sad8x8_avg_sse2, 12),
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
|
||||
|
||||
@ -828,7 +828,7 @@ const SadMxNx4Param x4d_sse2_tests[] = {
|
||||
make_tuple(8, 16, &vpx_sad8x16x4d_sse2, -1),
|
||||
make_tuple(8, 8, &vpx_sad8x8x4d_sse2, -1),
|
||||
make_tuple(8, 4, &vpx_sad8x4x4d_sse2, -1),
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
make_tuple(64, 64, &vpx_highbd_sad64x64x4d_sse2, 8),
|
||||
make_tuple(64, 32, &vpx_highbd_sad64x32x4d_sse2, 8),
|
||||
make_tuple(32, 64, &vpx_highbd_sad32x64x4d_sse2, 8),
|
||||
@ -868,7 +868,7 @@ const SadMxNx4Param x4d_sse2_tests[] = {
|
||||
make_tuple(8, 4, &vpx_highbd_sad8x4x4d_sse2, 12),
|
||||
make_tuple(4, 8, &vpx_highbd_sad4x8x4d_sse2, 12),
|
||||
make_tuple(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
|
||||
#endif // CONFIG_USE_X86INC
|
||||
|
184
test/set_roi.cc
184
test/set_roi.cc
@ -1,184 +0,0 @@
|
||||
/*
|
||||
* 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 <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#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"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
|
||||
int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
|
||||
unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
|
||||
|
||||
const int internalq_trans[] = {
|
||||
0, 1, 2, 3, 4, 5, 7, 8,
|
||||
9, 10, 12, 13, 15, 17, 18, 19,
|
||||
20, 21, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 33, 35, 37, 39, 41,
|
||||
43, 45, 47, 49, 51, 53, 55, 57,
|
||||
59, 61, 64, 67, 70, 73, 76, 79,
|
||||
82, 85, 88, 91, 94, 97, 100, 103,
|
||||
106, 109, 112, 115, 118, 121, 124, 127,
|
||||
};
|
||||
|
||||
// Initialize elements of cpi with valid defaults.
|
||||
VP8_COMP cpi;
|
||||
cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
|
||||
cpi.cyclic_refresh_mode_enabled = 0;
|
||||
cpi.mb.e_mbd.segmentation_enabled = 0;
|
||||
cpi.mb.e_mbd.update_mb_segmentation_map = 0;
|
||||
cpi.mb.e_mbd.update_mb_segmentation_data = 0;
|
||||
cpi.common.mb_rows = 240 >> 4;
|
||||
cpi.common.mb_cols = 320 >> 4;
|
||||
const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols);
|
||||
memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data));
|
||||
|
||||
// Segment map
|
||||
cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
|
||||
// Allocate memory for the source memory map.
|
||||
unsigned char *roi_map =
|
||||
reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
|
||||
memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
|
||||
memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2));
|
||||
|
||||
// Do a test call with valid parameters.
|
||||
int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q, delta_lf,
|
||||
threshold);
|
||||
EXPECT_EQ(0, roi_retval)
|
||||
<< "vp8_set_roimap roi failed with default test parameters";
|
||||
|
||||
// Check that the values in the cpi structure get set as expected.
|
||||
if (roi_retval == 0) {
|
||||
// Check that the segment map got set.
|
||||
const int mapcompare = memcmp(roi_map, cpi.segmentation_map, mbs);
|
||||
EXPECT_EQ(0, mapcompare) << "segment map error";
|
||||
|
||||
// Check the q deltas (note the need to translate into
|
||||
// the interanl range of 0-127.
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
const int transq = internalq_trans[abs(delta_q[i])];
|
||||
if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
|
||||
EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
|
||||
<< "segment delta_q error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the loop filter deltas
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
|
||||
EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
|
||||
<< "segment delta_lf error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the breakout thresholds
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
unsigned int breakout =
|
||||
static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
|
||||
|
||||
if (threshold[i] != breakout) {
|
||||
EXPECT_EQ(threshold[i], breakout)
|
||||
<< "breakout threshold error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Segmentation, and segmentation update flages should be set.
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
|
||||
<< "segmentation_enabled error";
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
|
||||
<< "update_mb_segmentation_map error";
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
|
||||
<< "update_mb_segmentation_data error";
|
||||
|
||||
|
||||
// Try a range of delta q and lf parameters (some legal, some not)
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
int rand_deltas[4];
|
||||
int deltas_valid;
|
||||
rand_deltas[0] = rnd(160) - 80;
|
||||
rand_deltas[1] = rnd(160) - 80;
|
||||
rand_deltas[2] = rnd(160) - 80;
|
||||
rand_deltas[3] = rnd(160) - 80;
|
||||
|
||||
deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
|
||||
(abs(rand_deltas[1]) <= 63) &&
|
||||
(abs(rand_deltas[2]) <= 63) &&
|
||||
(abs(rand_deltas[3]) <= 63)) ? 0 : -1;
|
||||
|
||||
// Test with random delta q values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, rand_deltas,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
|
||||
|
||||
// One delta_q error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
|
||||
// Test with random loop filter values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
rand_deltas, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
|
||||
|
||||
// One delta loop filter error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
}
|
||||
|
||||
// Test that we report and error if cyclic refresh is enabled.
|
||||
cpi.cyclic_refresh_mode_enabled = 1;
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
|
||||
cpi.cyclic_refresh_mode_enabled = 0;
|
||||
|
||||
// Test invalid number of rows or colums.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
|
||||
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols - 1, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
|
||||
}
|
||||
|
||||
// Free allocated memory
|
||||
if (cpi.segmentation_map)
|
||||
vpx_free(cpi.segmentation_map);
|
||||
if (roi_map)
|
||||
vpx_free(roi_map);
|
||||
};
|
||||
|
||||
} // namespace
|
@ -1,233 +0,0 @@
|
||||
/*
|
||||
* 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 "./vpx_config.h"
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
|
||||
typedef void (*SixtapPredictFunc)(uint8_t *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
uint8_t *dst_ptr,
|
||||
int dst_pitch);
|
||||
|
||||
typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
|
||||
|
||||
class SixtapPredictTest
|
||||
: public ::testing::TestWithParam<SixtapPredictParam> {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
|
||||
dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(src_);
|
||||
src_ = NULL;
|
||||
vpx_free(dst_);
|
||||
dst_ = NULL;
|
||||
vpx_free(dst_c_);
|
||||
dst_c_ = NULL;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
|
||||
protected:
|
||||
// Make test arrays big enough for 16x16 functions. Six-tap filters
|
||||
// need 5 extra pixels outside of the macroblock.
|
||||
static const int kSrcStride = 21;
|
||||
static const int kDstStride = 16;
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kSrcSize = kSrcStride * kSrcStride + 1;
|
||||
static const int kDstSize = kDstStride * kDstStride;
|
||||
|
||||
virtual void SetUp() {
|
||||
width_ = GET_PARAM(0);
|
||||
height_ = GET_PARAM(1);
|
||||
sixtap_predict_ = GET_PARAM(2);
|
||||
memset(src_, 0, kSrcSize);
|
||||
memset(dst_, 0, kDstSize);
|
||||
memset(dst_c_, 0, kDstSize);
|
||||
}
|
||||
|
||||
int width_;
|
||||
int height_;
|
||||
SixtapPredictFunc sixtap_predict_;
|
||||
// The src stores the macroblock we will filter on, and makes it 1 byte larger
|
||||
// in order to test unaligned access. The result is stored in dst and dst_c(c
|
||||
// reference code result).
|
||||
static uint8_t* src_;
|
||||
static uint8_t* dst_;
|
||||
static uint8_t* dst_c_;
|
||||
};
|
||||
|
||||
uint8_t* SixtapPredictTest::src_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_c_ = NULL;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithPresetData) {
|
||||
// Test input
|
||||
static const uint8_t test_data[kSrcSize] = {
|
||||
216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,
|
||||
79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,
|
||||
48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,
|
||||
182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,
|
||||
148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,
|
||||
166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,
|
||||
167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,
|
||||
114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,
|
||||
182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,
|
||||
224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,
|
||||
148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,
|
||||
176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,
|
||||
64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,
|
||||
235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,
|
||||
148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,
|
||||
35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,
|
||||
209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,
|
||||
223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,
|
||||
24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,
|
||||
93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,
|
||||
49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
|
||||
135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,
|
||||
119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,
|
||||
93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,
|
||||
53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,
|
||||
198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52,
|
||||
134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202,
|
||||
75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16
|
||||
};
|
||||
|
||||
// Expected result
|
||||
static const uint8_t expected_dst[kDstSize] = {
|
||||
117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,
|
||||
105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,
|
||||
208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,
|
||||
159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,
|
||||
208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,
|
||||
100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,
|
||||
113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,
|
||||
255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,
|
||||
200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,
|
||||
76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,
|
||||
185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,
|
||||
161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,
|
||||
15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,
|
||||
84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,
|
||||
189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,
|
||||
224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,
|
||||
136, 85, 189, 46, 71, 200, 90
|
||||
};
|
||||
|
||||
uint8_t *src = const_cast<uint8_t*>(test_data);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
2, 2, dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j])
|
||||
<< "i==" << (i * width_ + j);
|
||||
}
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithRandomData) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int i = 0; i < kSrcSize; ++i)
|
||||
src_[i] = rnd.Rand8();
|
||||
|
||||
// Run tests for all possible offsets.
|
||||
for (int xoffset = 0; xoffset < 8; ++xoffset) {
|
||||
for (int yoffset = 0; yoffset < 8; ++yoffset) {
|
||||
// Call c reference function.
|
||||
// Move start point to next pixel to test if the function reads
|
||||
// unaligned data correctly.
|
||||
vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
xoffset, yoffset, dst_c_, kDstStride);
|
||||
|
||||
// Run test.
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
xoffset, yoffset, dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j])
|
||||
<< "i==" << (i * width_ + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
|
||||
#endif
|
||||
#if HAVE_MMX
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MMX, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
|
||||
#endif
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
|
||||
#endif
|
||||
} // namespace
|
@ -10,13 +10,13 @@
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp10/common/blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
typedef void (*SubtractFunc)(int rows, int cols,
|
@ -103,10 +103,6 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
|
||||
EXPECT_EQ(sf_count_, 1);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
|
||||
::testing::Values(::libvpx_test::kTwoPassGood),
|
||||
::testing::Values(0)));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
|
||||
::testing::Values(::libvpx_test::kTwoPassGood),
|
||||
::testing::Values(CONFIG_MISC_FIXES)));
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
|
||||
#include "vp9/decoder/vp9_decoder.h"
|
||||
#include "vp10/decoder/decoder.h"
|
||||
|
||||
#include "vpx/svc_context.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
|
@ -19,8 +19,8 @@ LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_444.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += park_joy_90p_8_440.yuv
|
||||
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += desktop_credits.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += niklas_1280_720_30.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += niklas_1280_720_30.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP10_ENCODER) += rush_hour_444.y4m
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += screendata.y4m
|
||||
|
||||
# Test vectors
|
||||
@ -708,7 +708,7 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-20-big_superframe-01.webm
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-20-big_superframe-01.webm.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-20-big_superframe-02.webm
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-20-big_superframe-02.webm.md5
|
||||
ifeq ($(CONFIG_VP9_HIGHBITDEPTH),yes)
|
||||
ifeq ($(CONFIG_VPX_HIGHBITDEPTH),yes)
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp92-2-20-10bit-yuv420.webm
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp92-2-20-10bit-yuv420.webm.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp92-2-20-12bit-yuv420.webm
|
||||
@ -725,7 +725,7 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp93-2-20-10bit-yuv444.webm
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp93-2-20-10bit-yuv444.webm.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp93-2-20-12bit-yuv444.webm
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp93-2-20-12bit-yuv444.webm.md5
|
||||
endif # CONFIG_VP9_HIGHBITDEPTH
|
||||
endif # CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
# Invalid files for testing libvpx error checking.
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += invalid-vp90-01-v3.webm
|
||||
|
104
test/test.mk
104
test/test.mk
@ -22,28 +22,19 @@ 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) += resize_test.cc
|
||||
##TODO(jimbankoski): Figure out why resize is failing.
|
||||
##LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += resize_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += yuv_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) += keyframe_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += byte_alignment_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += invalid_file_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_frame_parallel_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_refresh_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += frame_size_tests.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_lossless_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_end_to_end_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ethread_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += active_map_refresh_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += active_map_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += borders_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += cpu_speed_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += frame_size_tests.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += lossless_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += end_to_end_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += ethread_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.h
|
||||
@ -67,7 +58,6 @@ LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../tools_common.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_skip_loopfilter_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += decode_api_test.cc
|
||||
@ -75,13 +65,13 @@ LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += test_vector_test.cc
|
||||
|
||||
# Currently we only support decoder perf tests for vp9. Also they read from WebM
|
||||
# files, so WebM IO is required.
|
||||
ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP9_DECODER)$(CONFIG_WEBM_IO), \
|
||||
ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP10_DECODER)$(CONFIG_WEBM_IO), \
|
||||
yesyesyes)
|
||||
LIBVPX_TEST_SRCS-yes += decode_perf_test.cc
|
||||
endif
|
||||
|
||||
# encode perf tests are vp9 only
|
||||
ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_VP9_ENCODER), yesyes)
|
||||
ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_VP10_ENCODER), yesyes)
|
||||
LIBVPX_TEST_SRCS-yes += encode_perf_test.cc
|
||||
endif
|
||||
|
||||
@ -93,75 +83,41 @@ endif
|
||||
##
|
||||
ifeq ($(CONFIG_SHARED),)
|
||||
|
||||
## VP8
|
||||
ifeq ($(CONFIG_VP8),yes)
|
||||
## VP10
|
||||
ifeq ($(CONFIG_VP10),yes)
|
||||
|
||||
# These tests require both the encoder and decoder to be built.
|
||||
ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
|
||||
LIBVPX_TEST_SRCS-yes += vp8_boolcoder_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += vp8_fragments_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += vp8_decrypt_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += quantize_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += variance_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_fdct4x4_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += idct_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += vpx_scale_test.cc
|
||||
|
||||
ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_TEMPORAL_DENOISING),yesyes)
|
||||
LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp8_denoiser_sse2_test.cc
|
||||
endif
|
||||
|
||||
endif # VP8
|
||||
|
||||
## VP9
|
||||
ifeq ($(CONFIG_VP9),yes)
|
||||
|
||||
# These tests require both the encoder and decoder to be built.
|
||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),yesyes)
|
||||
ifeq ($(CONFIG_VP10_ENCODER)$(CONFIG_VP10_DECODER),yesyes)
|
||||
# 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
|
||||
LIBVPX_TEST_SRCS-yes += vp9_encoder_parms_get_to_decoder.cc
|
||||
LIBVPX_TEST_SRCS-yes += boolcoder_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += encoder_parms_get_to_decoder.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += convolve_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += lpf_8_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += vp9_intrapred_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_decrypt_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_thread_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_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) += variance_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_error_block_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_quantize_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_subtract_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += intrapred_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct16x16_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += dct32x32_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct4x4_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += fdct8x8_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += variance_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += quantize_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += subtract_test.cc
|
||||
|
||||
ifeq ($(CONFIG_VP9_ENCODER),yes)
|
||||
ifeq ($(CONFIG_VP10_ENCODER),yes)
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC) += svc_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += blockiness_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_INTERNAL_STATS) += consistency_test.cc
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_TEMPORAL_DENOISING),yesyes)
|
||||
LIBVPX_TEST_SRCS-$(HAVE_SSE2) += vp9_denoiser_sse2_test.cc
|
||||
ifeq ($(CONFIG_VP10_ENCODER)$(CONFIG_VP10_TEMPORAL_DENOISING),yesyes)
|
||||
LIBVPX_TEST_SRCS-$(HAVE_SSE2) += denoiser_sse2_test.cc
|
||||
endif
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_arf_freq_test.cc
|
||||
|
||||
endif # VP9
|
||||
|
||||
## VP10
|
||||
ifeq ($(CONFIG_VP10),yes)
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += arf_freq_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += vp10_inv_txfm_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
|
||||
@ -170,7 +126,7 @@ endif # VP10
|
||||
|
||||
## Multi-codec / unconditional whitebox tests.
|
||||
|
||||
ifeq ($(findstring yes,$(CONFIG_VP9_ENCODER)$(CONFIG_VP10_ENCODER)),yes)
|
||||
ifeq ($(findstring yes,$(CONFIG_VP10_ENCODER)$(CONFIG_VP10_ENCODER)),yes)
|
||||
LIBVPX_TEST_SRCS-yes += avg_test.cc
|
||||
endif
|
||||
|
||||
|
96
test/test.mk.bk
Normal file
96
test/test.mk.bk
Normal file
@ -0,0 +1,96 @@
|
||||
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 += 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
|
||||
|
||||
##
|
||||
## BLACK BOX TESTS
|
||||
##
|
||||
## Black box tests only use the public API.
|
||||
##
|
||||
LIBVPX_TEST_SRCS-yes += ../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) += 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_ENCODERS) += yuv_video_source.h
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += encode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += encode_test_driver.h
|
||||
|
||||
## IVF writing.
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../ivfenc.c ../ivfenc.h
|
||||
|
||||
## Y4m parsing.
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_test.cc ../y4menc.c ../y4menc.h
|
||||
|
||||
## WebM Parsing
|
||||
ifeq ($(CONFIG_WEBM_IO), yes)
|
||||
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser.cpp
|
||||
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvreader.cpp
|
||||
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvparser.hpp
|
||||
LIBWEBM_PARSER_SRCS += ../third_party/libwebm/mkvreader.hpp
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += $(LIBWEBM_PARSER_SRCS)
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../tools_common.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_skip_loopfilter_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += decode_api_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += test_vector_test.cc
|
||||
|
||||
# Currently we only support decoder perf tests for vp9. Also they read from WebM
|
||||
# files, so WebM IO is required.
|
||||
ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP10_DECODER)$(CONFIG_WEBM_IO), \
|
||||
yesyesyes)
|
||||
LIBVPX_TEST_SRCS-yes += decode_perf_test.cc
|
||||
endif
|
||||
|
||||
# encode perf tests are vp9 only
|
||||
ifeq ($(CONFIG_ENCODE_PERF_TESTS)$(CONFIG_VP10_ENCODER), yesyes)
|
||||
LIBVPX_TEST_SRCS-yes += encode_perf_test.cc
|
||||
endif
|
||||
|
||||
##
|
||||
## WHITE BOX TESTS
|
||||
##
|
||||
## Whitebox tests invoke functions not exposed via the public API. Certain
|
||||
## shared library builds don't make these functions accessible.
|
||||
##
|
||||
ifeq ($(CONFIG_SHARED),)
|
||||
|
||||
|
||||
## VP10
|
||||
ifeq ($(CONFIG_VP10),yes)
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += vp10_inv_txfm_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
|
||||
|
||||
endif # VP10
|
||||
|
||||
## Multi-codec / unconditional whitebox tests.
|
||||
|
||||
ifeq ($(findstring yes,$(CONFIG_VP9_ENCODER)$(CONFIG_VP10_ENCODER)),yes)
|
||||
LIBVPX_TEST_SRCS-yes += avg_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc
|
||||
|
||||
TEST_INTRA_PRED_SPEED_SRCS-yes := test_intra_pred_speed.cc
|
||||
TEST_INTRA_PRED_SPEED_SRCS-yes += ../md5_utils.h ../md5_utils.c
|
||||
|
||||
endif # CONFIG_SHARED
|
||||
|
||||
include $(SRC_PATH_BARE)/test/test-data.mk
|
@ -167,7 +167,7 @@ VP8_INSTANTIATE_TEST_CASE(
|
||||
|
||||
// Test VP9 decode in serial mode with single thread.
|
||||
#if CONFIG_VP9_DECODER
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VP10_INSTANTIATE_TEST_CASE(
|
||||
TestVectorTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(0), // Serial Mode.
|
||||
|
@ -230,12 +230,12 @@ const char *const kVP9TestVectors[] = {
|
||||
"vp90-2-19-skip-01.webm", "vp90-2-19-skip-02.webm",
|
||||
"vp91-2-04-yuv444.webm",
|
||||
"vp91-2-04-yuv422.webm", "vp91-2-04-yuv440.webm",
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
"vp92-2-20-10bit-yuv420.webm", "vp92-2-20-12bit-yuv420.webm",
|
||||
"vp93-2-20-10bit-yuv422.webm", "vp93-2-20-12bit-yuv422.webm",
|
||||
"vp93-2-20-10bit-yuv440.webm", "vp93-2-20-12bit-yuv440.webm",
|
||||
"vp93-2-20-10bit-yuv444.webm", "vp93-2-20-12bit-yuv444.webm",
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
"vp90-2-20-big_superframe-01.webm", "vp90-2-20-big_superframe-02.webm",
|
||||
RESIZE_TEST_VECTORS
|
||||
};
|
||||
|
@ -15,18 +15,6 @@
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
#if CONFIG_VP8_DECODER
|
||||
extern const int kNumVP8TestVectors;
|
||||
extern const char *const kVP8TestVectors[];
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
extern const int kNumVP9TestVectors;
|
||||
extern const char *const kVP9TestVectors[];
|
||||
extern const int kNumVP9TestVectorsResize;
|
||||
extern const char *const kVP9TestVectorsResize[];
|
||||
#endif // CONFIG_VP9_DECODER
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_TEST_VECTORS_H_
|
||||
|
@ -102,7 +102,6 @@ TEST_P(TileIndependenceTest, MD5Match) {
|
||||
ASSERT_STREQ(md5_fw_str, md5_inv_str);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Range(0, 2, 1));
|
||||
|
||||
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Range(0, 2, 1));
|
||||
|
||||
} // namespace
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/md5_helper.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx/vp8.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using std::string;
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
||||
void CheckUserPrivateData(void *user_priv, int *target) {
|
||||
// actual pointer value should be the same as expected.
|
||||
EXPECT_EQ(reinterpret_cast<void *>(target), user_priv) <<
|
||||
"user_priv pointer value does not match.";
|
||||
}
|
||||
|
||||
// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and
|
||||
// compares the user_priv from return img with the original user_priv to see if
|
||||
// they match. Both the pointer values and the values inside the addresses
|
||||
// should match.
|
||||
string DecodeFile(const string &filename) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
libvpx_test::WebMVideoSource video(filename);
|
||||
video.Init();
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
libvpx_test::VP9Decoder decoder(cfg, 0);
|
||||
|
||||
libvpx_test::MD5 md5;
|
||||
int frame_num = 0;
|
||||
for (video.Begin(); !::testing::Test::HasFailure() && video.cxdata();
|
||||
video.Next()) {
|
||||
void *user_priv = reinterpret_cast<void *>(&frame_num);
|
||||
const vpx_codec_err_t res =
|
||||
decoder.DecodeFrame(video.cxdata(), video.frame_size(),
|
||||
(frame_num == 0) ? NULL : user_priv);
|
||||
if (res != VPX_CODEC_OK) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
break;
|
||||
}
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img = NULL;
|
||||
|
||||
// Get decompressed data.
|
||||
while ((img = dec_iter.Next())) {
|
||||
if (frame_num == 0) {
|
||||
CheckUserPrivateData(img->user_priv, NULL);
|
||||
} else {
|
||||
CheckUserPrivateData(img->user_priv, &frame_num);
|
||||
|
||||
// Also test ctrl_get_reference api.
|
||||
struct vp9_ref_frame ref;
|
||||
// Randomly fetch a reference frame.
|
||||
ref.idx = rnd.Rand8() % 3;
|
||||
decoder.Control(VP9_GET_REFERENCE, &ref);
|
||||
|
||||
CheckUserPrivateData(ref.img.user_priv, NULL);
|
||||
}
|
||||
md5.Add(img);
|
||||
}
|
||||
|
||||
frame_num++;
|
||||
}
|
||||
return string(md5.Get());
|
||||
}
|
||||
|
||||
TEST(UserPrivTest, VideoDecode) {
|
||||
// no tiles or frame parallel; this exercises the decoding to test the
|
||||
// user_priv.
|
||||
EXPECT_STREQ("b35a1b707b28e82be025d960aba039bc",
|
||||
DecodeFile("vp90-2-03-size-226x226.webm").c_str());
|
||||
}
|
||||
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
} // namespace
|
@ -91,13 +91,13 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
|
||||
src[w * y * src_stride_coeff + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
diff = CONVERT_TO_SHORTPTR(ref)[w * y * ref_stride_coeff + x] -
|
||||
CONVERT_TO_SHORTPTR(src)[w * y * src_stride_coeff + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
|
||||
const int diff = r - src[w * y + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
|
||||
uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
|
||||
@ -155,7 +155,7 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
|
||||
const int diff = r - src16[w * y + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,12 +234,12 @@ class VarianceTest
|
||||
if (!use_high_bit_depth_) {
|
||||
src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_ * 2));
|
||||
ref_ = new uint8_t[block_size_ * 2];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, block_size_ * 2 * sizeof(uint16_t))));
|
||||
ref_ = CONVERT_TO_BYTEPTR(new uint16_t[block_size_ * 2]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
ASSERT_TRUE(ref_ != NULL);
|
||||
@ -249,11 +249,11 @@ class VarianceTest
|
||||
if (!use_high_bit_depth_) {
|
||||
vpx_free(src_);
|
||||
delete[] ref_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_free(CONVERT_TO_SHORTPTR(src_));
|
||||
delete[] CONVERT_TO_SHORTPTR(ref_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
@ -281,20 +281,20 @@ void VarianceTest<VarianceFunctionType>::ZeroTest() {
|
||||
for (int i = 0; i <= 255; ++i) {
|
||||
if (!use_high_bit_depth_) {
|
||||
memset(src_, i, block_size_);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(src_), i << (bit_depth_ - 8),
|
||||
block_size_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
for (int j = 0; j <= 255; ++j) {
|
||||
if (!use_high_bit_depth_) {
|
||||
memset(ref_, j, block_size_);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_), j << (bit_depth_ - 8),
|
||||
block_size_);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse;
|
||||
unsigned int var;
|
||||
@ -312,11 +312,11 @@ void VarianceTest<VarianceFunctionType>::RefTest() {
|
||||
if (!use_high_bit_depth_) {
|
||||
src_[j] = rnd_.Rand8();
|
||||
ref_[j] = rnd_.Rand8();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() && mask_;
|
||||
CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() && mask_;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
@ -344,11 +344,11 @@ void VarianceTest<VarianceFunctionType>::RefStrideTest() {
|
||||
if (!use_high_bit_depth_) {
|
||||
src_[src_ind] = rnd_.Rand8();
|
||||
ref_[ref_ind] = rnd_.Rand8();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() && mask_;
|
||||
CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() && mask_;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
@ -373,13 +373,13 @@ void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
|
||||
memset(src_, 255, block_size_);
|
||||
memset(ref_, 255, half);
|
||||
memset(ref_ + half, 0, half);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << (bit_depth_ - 8),
|
||||
block_size_);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << (bit_depth_ - 8), half);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse;
|
||||
unsigned int var;
|
||||
@ -512,7 +512,7 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
|
||||
const int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
|
||||
uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
|
||||
@ -527,7 +527,7 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
|
||||
const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -566,7 +566,7 @@ class SubpelVarianceTest
|
||||
src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
|
||||
sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
|
||||
ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
src_ = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(
|
||||
@ -576,7 +576,7 @@ class SubpelVarianceTest
|
||||
vpx_memalign(16, block_size_*sizeof(uint16_t))));
|
||||
ref_ = CONVERT_TO_BYTEPTR(
|
||||
new uint16_t[block_size_ + width_ + height_ + 1]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
ASSERT_TRUE(sec_ != NULL);
|
||||
@ -588,12 +588,12 @@ class SubpelVarianceTest
|
||||
vpx_free(src_);
|
||||
delete[] ref_;
|
||||
vpx_free(sec_);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_free(CONVERT_TO_SHORTPTR(src_));
|
||||
delete[] CONVERT_TO_SHORTPTR(ref_);
|
||||
vpx_free(CONVERT_TO_SHORTPTR(sec_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
@ -625,7 +625,7 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
|
||||
for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
|
||||
ref_[j] = rnd_.Rand8();
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
for (int j = 0; j < block_size_; j++) {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
|
||||
@ -633,7 +633,7 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
|
||||
for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
|
||||
CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
unsigned int var1;
|
||||
@ -663,14 +663,14 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
|
||||
memset(src_ + half, 255, half);
|
||||
memset(ref_, 255, half);
|
||||
memset(ref_ + half, 0, half + width_ + height_ + 1);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(src_), mask_, half);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(src_) + half, 0, half);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, half);
|
||||
vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, mask_,
|
||||
half + width_ + height_ + 1);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
unsigned int var1;
|
||||
@ -697,7 +697,7 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
|
||||
for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
|
||||
ref_[j] = rnd_.Rand8();
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
} else {
|
||||
for (int j = 0; j < block_size_; j++) {
|
||||
CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
|
||||
@ -706,7 +706,7 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
|
||||
for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
|
||||
CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
unsigned int var1;
|
||||
@ -805,7 +805,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_c, 0),
|
||||
make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_c, 0)));
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
typedef MseTest<VarianceMxNFunc> VpxHBDMseTest;
|
||||
typedef VarianceTest<VarianceMxNFunc> VpxHBDVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
|
||||
@ -966,7 +966,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_c, 12),
|
||||
make_tuple(2, 3, &vpx_highbd_12_sub_pixel_avg_variance4x8_c, 12),
|
||||
make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_MMX
|
||||
INSTANTIATE_TEST_CASE_P(MMX, VpxMseTest,
|
||||
@ -1053,7 +1053,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_sse, 0)));
|
||||
#endif // CONFIG_USE_X86INC
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
/* TODO(debargha): This test does not support the highbd version
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VpxHBDMseTest,
|
||||
@ -1179,7 +1179,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_sse2, 8),
|
||||
make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_sse2, 8)));
|
||||
#endif // CONFIG_USE_X86INC
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* 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 <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "vp8/decoder/dboolhuff.h"
|
||||
#include "vp8/encoder/boolhuff.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
namespace {
|
||||
const int num_tests = 10;
|
||||
|
||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
|
||||
// with whatever internal state the decryptor uses. For testing we'll just
|
||||
// xor with a constant key, and decrypt_state will point to the start of
|
||||
// the original buffer.
|
||||
const uint8_t secret_key[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
|
||||
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) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST(VP8, TestBitIO) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int n = 0; n < num_tests; ++n) {
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
const int kBitsToTest = 1000;
|
||||
uint8_t probas[kBitsToTest];
|
||||
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
const int parity = i & 1;
|
||||
probas[i] =
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
(method == 3) ? rnd.Rand8() :
|
||||
(method == 4) ? (parity ? 0 : 255) :
|
||||
// alternate between low and high proba:
|
||||
(method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
|
||||
(method == 6) ?
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
}
|
||||
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
|
||||
const int random_seed = 6432;
|
||||
const int kBufferSize = 10000;
|
||||
ACMRandom bit_rnd(random_seed);
|
||||
BOOL_CODER bw;
|
||||
uint8_t bw_buffer[kBufferSize];
|
||||
vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
|
||||
|
||||
int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
if (bit_method == 2) {
|
||||
bit = (i & 1);
|
||||
} else if (bit_method == 3) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
vp8_encode_bool(&bw, bit, static_cast<int>(probas[i]));
|
||||
}
|
||||
|
||||
vp8_stop_encode(&bw);
|
||||
|
||||
BOOL_DECODER br;
|
||||
encrypt_buffer(bw_buffer, kBufferSize);
|
||||
vp8dx_start_decode(&br, bw_buffer, kBufferSize,
|
||||
test_decrypt_cb,
|
||||
reinterpret_cast<void *>(bw_buffer));
|
||||
bit_rnd.Reset(random_seed);
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
if (bit_method == 2) {
|
||||
bit = (i & 1);
|
||||
} else if (bit_method == 3) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
|
||||
<< "pos: "<< i << " / " << kBitsToTest
|
||||
<< " bit_method: " << bit_method
|
||||
<< " method: " << method;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
|
||||
namespace {
|
||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
|
||||
// with whatever internal state the decryptor uses. For testing we'll just
|
||||
// xor with a constant key, and decrypt_state will point to the start of
|
||||
// the original buffer.
|
||||
const uint8_t test_key[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
|
||||
uint8_t *output, int count) {
|
||||
encrypt_buffer(input, output, count,
|
||||
input - reinterpret_cast<uint8_t *>(decrypt_state));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
TEST(TestDecrypt, DecryptWorksVp8) {
|
||||
libvpx_test::IVFVideoSource video("vp80-00-comprehensive-001.ivf");
|
||||
video.Init();
|
||||
|
||||
vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t();
|
||||
VP8Decoder decoder(dec_cfg, 0);
|
||||
|
||||
video.Begin();
|
||||
|
||||
// no decryption
|
||||
vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
|
||||
// decrypt frame
|
||||
video.Next();
|
||||
|
||||
std::vector<uint8_t> encrypted(video.frame_size());
|
||||
encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
|
||||
vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
|
||||
decoder.Control(VPXD_SET_DECRYPTOR, &di);
|
||||
|
||||
res = decoder.DecodeFrame(&encrypted[0], encrypted.size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
}
|
||||
|
||||
} // namespace libvpx_test
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <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 "vp8/encoder/denoising.h"
|
||||
#include "vp8/common/reconinter.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
|
||||
const int kNumPixels = 16 * 16;
|
||||
class VP8DenoiserTest : public ::testing::TestWithParam<int> {
|
||||
public:
|
||||
virtual ~VP8DenoiserTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
increase_denoising_ = GetParam();
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
int increase_denoising_;
|
||||
};
|
||||
|
||||
TEST_P(VP8DenoiserTest, BitexactCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 4000;
|
||||
const int stride = 16;
|
||||
|
||||
// Allocate the space for input and output,
|
||||
// where sig_block_c/_sse2 is the block to be denoised,
|
||||
// mc_avg_block is the denoised reference block,
|
||||
// avg_block_c is the denoised result from C code,
|
||||
// avg_block_sse2 is the denoised result from SSE2 code.
|
||||
DECLARE_ALIGNED(16, uint8_t, sig_block_c[kNumPixels]);
|
||||
// Since in VP8 denoiser, the source signal will be changed,
|
||||
// we need another copy of the source signal as the input of sse2 code.
|
||||
DECLARE_ALIGNED(16, uint8_t, sig_block_sse2[kNumPixels]);
|
||||
DECLARE_ALIGNED(16, uint8_t, mc_avg_block[kNumPixels]);
|
||||
DECLARE_ALIGNED(16, uint8_t, avg_block_c[kNumPixels]);
|
||||
DECLARE_ALIGNED(16, uint8_t, avg_block_sse2[kNumPixels]);
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Generate random motion magnitude, 20% of which exceed the threshold.
|
||||
const int motion_magnitude_ran =
|
||||
rnd.Rand8() % static_cast<int>(MOTION_MAGNITUDE_THRESHOLD * 1.2);
|
||||
|
||||
// Initialize a test block with random number in range [0, 255].
|
||||
for (int j = 0; j < kNumPixels; ++j) {
|
||||
int temp = 0;
|
||||
sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
|
||||
// The pixels in mc_avg_block are generated by adding a random
|
||||
// number in range [-19, 19] to corresponding pixels in sig_block.
|
||||
temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) *
|
||||
(rnd.Rand8() % 20);
|
||||
// Clip.
|
||||
mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
|
||||
}
|
||||
|
||||
// Test denosiser on Y component.
|
||||
ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_c(
|
||||
mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
|
||||
motion_magnitude_ran, increase_denoising_));
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_sse2(
|
||||
mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
|
||||
motion_magnitude_ran, increase_denoising_));
|
||||
|
||||
// Check bitexactness.
|
||||
for (int h = 0; h < 16; ++h) {
|
||||
for (int w = 0; w < 16; ++w) {
|
||||
EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]);
|
||||
}
|
||||
}
|
||||
|
||||
// Test denoiser on UV component.
|
||||
ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_c(
|
||||
mc_avg_block, stride, avg_block_c, stride, sig_block_c, stride,
|
||||
motion_magnitude_ran, increase_denoising_));
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(vp8_denoiser_filter_uv_sse2(
|
||||
mc_avg_block, stride, avg_block_sse2, stride, sig_block_sse2, stride,
|
||||
motion_magnitude_ran, increase_denoising_));
|
||||
|
||||
// Check bitexactness.
|
||||
for (int h = 0; h < 16; ++h) {
|
||||
for (int w = 0; w < 16; ++w) {
|
||||
EXPECT_EQ(avg_block_c[h * stride + w], avg_block_sse2[h * stride + w]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test for all block size.
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, VP8DenoiserTest, ::testing::Values(0, 1));
|
||||
} // namespace
|
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const int cospi8sqrt2minus1 = 20091;
|
||||
const int sinpi8sqrt2 = 35468;
|
||||
|
||||
void reference_idct4x4(const int16_t *input, int16_t *output) {
|
||||
const int16_t *ip = input;
|
||||
int16_t *op = output;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const int a1 = ip[0] + ip[8];
|
||||
const int b1 = ip[0] - ip[8];
|
||||
const int temp1 = (ip[4] * sinpi8sqrt2) >> 16;
|
||||
const int temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
|
||||
const int c1 = temp1 - temp2;
|
||||
const int temp3 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
|
||||
const int temp4 = (ip[12] * sinpi8sqrt2) >> 16;
|
||||
const int d1 = temp3 + temp4;
|
||||
op[0] = a1 + d1;
|
||||
op[12] = a1 - d1;
|
||||
op[4] = b1 + c1;
|
||||
op[8] = b1 - c1;
|
||||
++ip;
|
||||
++op;
|
||||
}
|
||||
ip = output;
|
||||
op = output;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const int a1 = ip[0] + ip[2];
|
||||
const int b1 = ip[0] - ip[2];
|
||||
const int temp1 = (ip[1] * sinpi8sqrt2) >> 16;
|
||||
const int temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
|
||||
const int c1 = temp1 - temp2;
|
||||
const int temp3 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
|
||||
const int temp4 = (ip[3] * sinpi8sqrt2) >> 16;
|
||||
const int d1 = temp3 + temp4;
|
||||
op[0] = (a1 + d1 + 4) >> 3;
|
||||
op[3] = (a1 - d1 + 4) >> 3;
|
||||
op[1] = (b1 + c1 + 4) >> 3;
|
||||
op[2] = (b1 - c1 + 4) >> 3;
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
}
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST(VP8FdctTest, SignBiasCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int16_t test_input_block[16];
|
||||
int16_t test_output_block[16];
|
||||
const int pitch = 8;
|
||||
int count_sign_block[16][2];
|
||||
const int count_test_block = 1000000;
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
|
||||
|
||||
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (test_output_block[j] < 0)
|
||||
++count_sign_block[j][0];
|
||||
else if (test_output_block[j] > 0)
|
||||
++count_sign_block[j][1];
|
||||
}
|
||||
}
|
||||
|
||||
bool bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-15, 15].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
|
||||
|
||||
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (test_output_block[j] < 0)
|
||||
++count_sign_block[j][0];
|
||||
else if (test_output_block[j] > 0)
|
||||
++count_sign_block[j][1];
|
||||
}
|
||||
}
|
||||
|
||||
bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
|
||||
};
|
||||
|
||||
TEST(VP8FdctTest, RoundTripErrorCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int max_error = 0;
|
||||
double total_error = 0;
|
||||
const int count_test_block = 1000000;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int16_t test_input_block[16];
|
||||
int16_t test_temp_block[16];
|
||||
int16_t test_output_block[16];
|
||||
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
|
||||
|
||||
const int pitch = 8;
|
||||
vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
|
||||
reference_idct4x4(test_temp_block, test_output_block);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
const int diff = test_input_block[j] - test_output_block[j];
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1, max_error )
|
||||
<< "Error: FDCT/IDCT has an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block, total_error)
|
||||
<< "Error: FDCT/IDCT has average roundtrip error > 1 per block";
|
||||
};
|
||||
|
||||
} // namespace
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class VP8FramgmentsTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
protected:
|
||||
VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}
|
||||
virtual ~VP8FramgmentsTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
const unsigned long init_flags = // NOLINT(runtime/int)
|
||||
VPX_CODEC_USE_OUTPUT_PARTITION;
|
||||
InitializeConfig();
|
||||
SetMode(::libvpx_test::kRealTime);
|
||||
set_init_flags(init_flags);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(VP8FramgmentsTest, TestFragmentsEncodeDecode) {
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
} // namespace
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
|
||||
namespace {
|
||||
// In a real use the 'decrypt_state' parameter will be a pointer to a struct
|
||||
// with whatever internal state the decryptor uses. For testing we'll just
|
||||
// xor with a constant key, and decrypt_state will point to the start of
|
||||
// the original buffer.
|
||||
const uint8_t test_key[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
|
||||
uint8_t *output, int count) {
|
||||
encrypt_buffer(input, output, count,
|
||||
input - reinterpret_cast<uint8_t *>(decrypt_state));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
TEST(TestDecrypt, DecryptWorksVp9) {
|
||||
libvpx_test::IVFVideoSource video("vp90-2-05-resize.ivf");
|
||||
video.Init();
|
||||
|
||||
vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t();
|
||||
VP9Decoder decoder(dec_cfg, 0);
|
||||
|
||||
video.Begin();
|
||||
|
||||
// no decryption
|
||||
vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
|
||||
// decrypt frame
|
||||
video.Next();
|
||||
|
||||
std::vector<uint8_t> encrypted(video.frame_size());
|
||||
encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
|
||||
vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
|
||||
decoder.Control(VPXD_SET_DECRYPTOR, &di);
|
||||
|
||||
res = decoder.DecodeFrame(&encrypted[0], encrypted.size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
}
|
||||
|
||||
} // namespace libvpx_test
|
@ -1,220 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/md5_helper.h"
|
||||
#include "test/util.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using std::string;
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
||||
struct PauseFileList {
|
||||
const char *name;
|
||||
// md5 sum for decoded frames which does not include skipped frames.
|
||||
const char *expected_md5;
|
||||
const int pause_frame_num;
|
||||
};
|
||||
|
||||
// Decodes |filename| with |num_threads|. Pause at the specified frame_num,
|
||||
// seek to next key frame and then continue decoding until the end. Return
|
||||
// the md5 of the decoded frames which does not include skipped frames.
|
||||
string DecodeFileWithPause(const string &filename, int num_threads,
|
||||
int pause_num) {
|
||||
libvpx_test::WebMVideoSource video(filename);
|
||||
video.Init();
|
||||
int in_frames = 0;
|
||||
int out_frames = 0;
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = {0};
|
||||
cfg.threads = num_threads;
|
||||
vpx_codec_flags_t flags = 0;
|
||||
flags |= VPX_CODEC_USE_FRAME_THREADING;
|
||||
libvpx_test::VP9Decoder decoder(cfg, flags, 0);
|
||||
|
||||
libvpx_test::MD5 md5;
|
||||
video.Begin();
|
||||
|
||||
do {
|
||||
++in_frames;
|
||||
const vpx_codec_err_t res =
|
||||
decoder.DecodeFrame(video.cxdata(), video.frame_size());
|
||||
if (res != VPX_CODEC_OK) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
break;
|
||||
}
|
||||
|
||||
// Pause at specified frame number.
|
||||
if (in_frames == pause_num) {
|
||||
// Flush the decoder and then seek to next key frame.
|
||||
decoder.DecodeFrame(NULL, 0);
|
||||
video.SeekToNextKeyFrame();
|
||||
} else {
|
||||
video.Next();
|
||||
}
|
||||
|
||||
// Flush the decoder at the end of the video.
|
||||
if (!video.cxdata())
|
||||
decoder.DecodeFrame(NULL, 0);
|
||||
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next())) {
|
||||
++out_frames;
|
||||
md5.Add(img);
|
||||
}
|
||||
} while (video.cxdata() != NULL);
|
||||
|
||||
EXPECT_EQ(in_frames, out_frames) <<
|
||||
"Input frame count does not match output frame count";
|
||||
|
||||
return string(md5.Get());
|
||||
}
|
||||
|
||||
void DecodeFilesWithPause(const PauseFileList files[]) {
|
||||
for (const PauseFileList *iter = files; iter->name != NULL; ++iter) {
|
||||
SCOPED_TRACE(iter->name);
|
||||
for (int t = 2; t <= 8; ++t) {
|
||||
EXPECT_EQ(iter->expected_md5,
|
||||
DecodeFileWithPause(iter->name, t, iter->pause_frame_num))
|
||||
<< "threads = " << t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VP9MultiThreadedFrameParallel, PauseSeekResume) {
|
||||
// vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
|
||||
// one key frame for every ten frames.
|
||||
static const PauseFileList files[] = {
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"6ea7c3875d67252e7caf2bc6e75b36b1", 6 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"4bb634160c7356a8d7d4299b6dc83a45", 12 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"89772591e6ef461f9fa754f916c78ed8", 26 },
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
DecodeFilesWithPause(files);
|
||||
}
|
||||
|
||||
struct FileList {
|
||||
const char *name;
|
||||
// md5 sum for decoded frames which does not include corrupted frames.
|
||||
const char *expected_md5;
|
||||
// Expected number of decoded frames which does not include corrupted frames.
|
||||
const int expected_frame_count;
|
||||
};
|
||||
|
||||
// Decodes |filename| with |num_threads|. Return the md5 of the decoded
|
||||
// frames which does not include corrupted frames.
|
||||
string DecodeFile(const string &filename, int num_threads,
|
||||
int expected_frame_count) {
|
||||
libvpx_test::WebMVideoSource video(filename);
|
||||
video.Init();
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
cfg.threads = num_threads;
|
||||
const vpx_codec_flags_t flags = VPX_CODEC_USE_FRAME_THREADING;
|
||||
libvpx_test::VP9Decoder decoder(cfg, flags, 0);
|
||||
|
||||
libvpx_test::MD5 md5;
|
||||
video.Begin();
|
||||
|
||||
int out_frames = 0;
|
||||
do {
|
||||
const vpx_codec_err_t res =
|
||||
decoder.DecodeFrame(video.cxdata(), video.frame_size());
|
||||
// TODO(hkuang): frame parallel mode should return an error on corruption.
|
||||
if (res != VPX_CODEC_OK) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
break;
|
||||
}
|
||||
|
||||
video.Next();
|
||||
|
||||
// Flush the decoder at the end of the video.
|
||||
if (!video.cxdata())
|
||||
decoder.DecodeFrame(NULL, 0);
|
||||
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next())) {
|
||||
++out_frames;
|
||||
md5.Add(img);
|
||||
}
|
||||
} while (video.cxdata() != NULL);
|
||||
|
||||
EXPECT_EQ(expected_frame_count, out_frames) <<
|
||||
"Input frame count does not match expected output frame count";
|
||||
|
||||
return string(md5.Get());
|
||||
}
|
||||
|
||||
void DecodeFiles(const FileList files[]) {
|
||||
for (const FileList *iter = files; iter->name != NULL; ++iter) {
|
||||
SCOPED_TRACE(iter->name);
|
||||
for (int t = 2; t <= 8; ++t) {
|
||||
EXPECT_EQ(iter->expected_md5,
|
||||
DecodeFile(iter->name, t, iter->expected_frame_count))
|
||||
<< "threads = " << t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VP9MultiThreadedFrameParallel, InvalidFileTest) {
|
||||
static const FileList files[] = {
|
||||
// invalid-vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
|
||||
// one key frame for every ten frames. The 11th frame has corrupted data.
|
||||
{ "invalid-vp90-2-07-frame_parallel-1.webm",
|
||||
"0549d0f45f60deaef8eb708e6c0eb6cb", 30 },
|
||||
// invalid-vp90-2-07-frame_parallel-2.webm is a 40 frame video file with
|
||||
// one key frame for every ten frames. The 1st and 31st frames have
|
||||
// corrupted data.
|
||||
{ "invalid-vp90-2-07-frame_parallel-2.webm",
|
||||
"6a1f3cf6f9e7a364212fadb9580d525e", 20 },
|
||||
// invalid-vp90-2-07-frame_parallel-3.webm is a 40 frame video file with
|
||||
// one key frame for every ten frames. The 5th and 13th frames have
|
||||
// corrupted data.
|
||||
{ "invalid-vp90-2-07-frame_parallel-3.webm",
|
||||
"8256544308de926b0681e04685b98677", 27 },
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
DecodeFiles(files);
|
||||
}
|
||||
|
||||
TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {
|
||||
static const FileList files[] = {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{ "vp92-2-20-10bit-yuv420.webm",
|
||||
"a16b99df180c584e8db2ffeda987d293", 10 },
|
||||
#endif
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
DecodeFiles(files);
|
||||
}
|
||||
#endif // CONFIG_WEBM_IO
|
||||
} // namespace
|
@ -1,351 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9/common/vp9_scan.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const int number_of_iterations = 100;
|
||||
|
||||
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
|
||||
int skip_block, const int16_t *zbin,
|
||||
const int16_t *round, const int16_t *quant,
|
||||
const int16_t *quant_shift,
|
||||
tran_low_t *qcoeff, tran_low_t *dqcoeff,
|
||||
const int16_t *dequant,
|
||||
uint16_t *eob, const int16_t *scan,
|
||||
const int16_t *iscan);
|
||||
typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
|
||||
QuantizeParam;
|
||||
|
||||
class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~VP9QuantizeTest() {}
|
||||
virtual void SetUp() {
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
QuantizeFunc quantize_op_;
|
||||
QuantizeFunc ref_quantize_op_;
|
||||
};
|
||||
|
||||
class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~VP9Quantize32Test() {}
|
||||
virtual void SetUp() {
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int mask_;
|
||||
QuantizeFunc quantize_op_;
|
||||
QuantizeFunc ref_quantize_op_;
|
||||
};
|
||||
|
||||
TEST_P(VP9QuantizeTest, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
const int skip_block = i == 0;
|
||||
const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
|
||||
const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
|
||||
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
|
||||
const int count = (4 << sz) * (4 << sz); // 16, 64, 256
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9Quantize32Test, OperationCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
const int skip_block = i == 0;
|
||||
const TX_SIZE sz = TX_32X32;
|
||||
const TX_TYPE tx_type = (TX_TYPE)(i % 4);
|
||||
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
|
||||
const int count = (4 << sz) * (4 << sz); // 1024
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9QuantizeTest, EOBCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
int skip_block = i == 0;
|
||||
TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16
|
||||
TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3);
|
||||
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
|
||||
int count = (4 << sz) * (4 << sz); // 16, 64, 256
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
// Two random entries
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
|
||||
TEST_P(VP9Quantize32Test, EOBCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]);
|
||||
DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]);
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < number_of_iterations; ++i) {
|
||||
int skip_block = i == 0;
|
||||
TX_SIZE sz = TX_32X32;
|
||||
TX_TYPE tx_type = (TX_TYPE)(i % 4);
|
||||
const scan_order *scan_order = &vp9_scan_orders[sz][tx_type];
|
||||
int count = (4 << sz) * (4 << sz); // 1024
|
||||
int err_count = 0;
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
// Two random entries
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
dequant_ptr[j] = rnd.Rand16();
|
||||
}
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
}
|
||||
err_count_total += err_count;
|
||||
}
|
||||
EXPECT_EQ(0, err_count_total)
|
||||
<< "Error: Quantization Test, C output doesn't match SSE2 output. "
|
||||
<< "First failed at test case " << first_failure;
|
||||
}
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_12)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9Quantize32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace
|
@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 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/md5_helper.h"
|
||||
#include "test/util.h"
|
||||
#include "test/webm_video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kVp9TestFile[] = "vp90-2-08-tile_1x8_frame_parallel.webm";
|
||||
const char kVp9Md5File[] = "vp90-2-08-tile_1x8_frame_parallel.webm.md5";
|
||||
|
||||
// Class for testing shutting off the loop filter.
|
||||
class SkipLoopFilterTest {
|
||||
public:
|
||||
SkipLoopFilterTest()
|
||||
: video_(NULL),
|
||||
decoder_(NULL),
|
||||
md5_file_(NULL) {}
|
||||
|
||||
~SkipLoopFilterTest() {
|
||||
if (md5_file_ != NULL)
|
||||
fclose(md5_file_);
|
||||
delete decoder_;
|
||||
delete video_;
|
||||
}
|
||||
|
||||
// If |threads| > 0 then set the decoder with that number of threads.
|
||||
void Init(int num_threads) {
|
||||
expected_md5_[0] = '\0';
|
||||
junk_[0] = '\0';
|
||||
video_ = new libvpx_test::WebMVideoSource(kVp9TestFile);
|
||||
ASSERT_TRUE(video_ != NULL);
|
||||
video_->Init();
|
||||
video_->Begin();
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
if (num_threads > 0)
|
||||
cfg.threads = num_threads;
|
||||
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
|
||||
ASSERT_TRUE(decoder_ != NULL);
|
||||
|
||||
OpenMd5File(kVp9Md5File);
|
||||
}
|
||||
|
||||
// Set the VP9 skipLoopFilter control value.
|
||||
void SetSkipLoopFilter(int value, vpx_codec_err_t expected_value) {
|
||||
decoder_->Control(VP9_SET_SKIP_LOOP_FILTER, value, expected_value);
|
||||
}
|
||||
|
||||
vpx_codec_err_t DecodeOneFrame() {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
if (res == VPX_CODEC_OK) {
|
||||
ReadMd5();
|
||||
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;
|
||||
ReadMd5();
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
// Checks if MD5 matches or doesn't.
|
||||
void CheckMd5(bool matches) {
|
||||
libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
|
||||
const vpx_image_t *img = dec_iter.Next();
|
||||
CheckMd5Vpx(*img, matches);
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO(fgalligan): Move the MD5 testing code into another class.
|
||||
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;
|
||||
}
|
||||
|
||||
// Reads the next line of the MD5 file.
|
||||
void ReadMd5() {
|
||||
ASSERT_TRUE(md5_file_ != NULL);
|
||||
const int res = fscanf(md5_file_, "%s %s", expected_md5_, junk_);
|
||||
ASSERT_NE(EOF, res) << "Read md5 data failed";
|
||||
expected_md5_[32] = '\0';
|
||||
}
|
||||
|
||||
// Checks if the last read MD5 matches |img| or doesn't.
|
||||
void CheckMd5Vpx(const vpx_image_t &img, bool matches) {
|
||||
::libvpx_test::MD5 md5_res;
|
||||
md5_res.Add(&img);
|
||||
const char *const actual_md5 = md5_res.Get();
|
||||
|
||||
// Check MD5.
|
||||
if (matches)
|
||||
ASSERT_STREQ(expected_md5_, actual_md5) << "MD5 checksums don't match";
|
||||
else
|
||||
ASSERT_STRNE(expected_md5_, actual_md5) << "MD5 checksums match";
|
||||
}
|
||||
|
||||
libvpx_test::WebMVideoSource *video_;
|
||||
libvpx_test::VP9Decoder *decoder_;
|
||||
FILE *md5_file_;
|
||||
char expected_md5_[33];
|
||||
char junk_[128];
|
||||
};
|
||||
|
||||
TEST(SkipLoopFilterTest, ShutOffLoopFilter) {
|
||||
const int non_zero_value = 1;
|
||||
const int num_threads = 0;
|
||||
SkipLoopFilterTest skip_loop_filter;
|
||||
skip_loop_filter.Init(num_threads);
|
||||
skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
|
||||
skip_loop_filter.CheckMd5(false);
|
||||
}
|
||||
|
||||
TEST(SkipLoopFilterTest, ShutOffLoopFilterSingleThread) {
|
||||
const int non_zero_value = 1;
|
||||
const int num_threads = 1;
|
||||
SkipLoopFilterTest skip_loop_filter;
|
||||
skip_loop_filter.Init(num_threads);
|
||||
skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
|
||||
skip_loop_filter.CheckMd5(false);
|
||||
}
|
||||
|
||||
TEST(SkipLoopFilterTest, ShutOffLoopFilter8Threads) {
|
||||
const int non_zero_value = 1;
|
||||
const int num_threads = 8;
|
||||
SkipLoopFilterTest skip_loop_filter;
|
||||
skip_loop_filter.Init(num_threads);
|
||||
skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
|
||||
skip_loop_filter.CheckMd5(false);
|
||||
}
|
||||
|
||||
TEST(SkipLoopFilterTest, WithLoopFilter) {
|
||||
const int non_zero_value = 1;
|
||||
const int num_threads = 0;
|
||||
SkipLoopFilterTest skip_loop_filter;
|
||||
skip_loop_filter.Init(num_threads);
|
||||
skip_loop_filter.SetSkipLoopFilter(non_zero_value, VPX_CODEC_OK);
|
||||
skip_loop_filter.SetSkipLoopFilter(0, VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
|
||||
skip_loop_filter.CheckMd5(true);
|
||||
}
|
||||
|
||||
TEST(SkipLoopFilterTest, ToggleLoopFilter) {
|
||||
const int num_threads = 0;
|
||||
SkipLoopFilterTest skip_loop_filter;
|
||||
skip_loop_filter.Init(num_threads);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
skip_loop_filter.SetSkipLoopFilter(i % 2, VPX_CODEC_OK);
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeOneFrame());
|
||||
}
|
||||
ASSERT_EQ(VPX_CODEC_OK, skip_loop_filter.DecodeRemainingFrames());
|
||||
skip_loop_filter.CheckMd5(false);
|
||||
}
|
||||
|
||||
} // namespace
|
@ -1,326 +0,0 @@
|
||||
/*
|
||||
* 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 <string>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/md5_helper.h"
|
||||
#if CONFIG_WEBM_IO
|
||||
#include "test/webm_video_source.h"
|
||||
#endif
|
||||
#include "vpx_util/vpx_thread.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using std::string;
|
||||
|
||||
class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
|
||||
protected:
|
||||
virtual ~VPxWorkerThreadTest() {}
|
||||
virtual void SetUp() {
|
||||
vpx_get_worker_interface()->init(&worker_);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
vpx_get_worker_interface()->end(&worker_);
|
||||
}
|
||||
|
||||
void Run(VPxWorker* worker) {
|
||||
const bool synchronous = GetParam();
|
||||
if (synchronous) {
|
||||
vpx_get_worker_interface()->execute(worker);
|
||||
} else {
|
||||
vpx_get_worker_interface()->launch(worker);
|
||||
}
|
||||
}
|
||||
|
||||
VPxWorker worker_;
|
||||
};
|
||||
|
||||
int ThreadHook(void* data, void* return_value) {
|
||||
int* const hook_data = reinterpret_cast<int*>(data);
|
||||
*hook_data = 5;
|
||||
return *reinterpret_cast<int*>(return_value);
|
||||
}
|
||||
|
||||
TEST_P(VPxWorkerThreadTest, HookSuccess) {
|
||||
// should be a no-op.
|
||||
EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
|
||||
|
||||
int hook_data = 0;
|
||||
int return_value = 1; // return successfully from the hook
|
||||
worker_.hook = ThreadHook;
|
||||
worker_.data1 = &hook_data;
|
||||
worker_.data2 = &return_value;
|
||||
|
||||
Run(&worker_);
|
||||
EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
|
||||
EXPECT_FALSE(worker_.had_error);
|
||||
EXPECT_EQ(5, hook_data);
|
||||
|
||||
// should be a no-op.
|
||||
EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(VPxWorkerThreadTest, HookFailure) {
|
||||
EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
|
||||
|
||||
int hook_data = 0;
|
||||
int return_value = 0; // return failure from the hook
|
||||
worker_.hook = ThreadHook;
|
||||
worker_.data1 = &hook_data;
|
||||
worker_.data2 = &return_value;
|
||||
|
||||
Run(&worker_);
|
||||
EXPECT_FALSE(vpx_get_worker_interface()->sync(&worker_));
|
||||
EXPECT_EQ(1, worker_.had_error);
|
||||
|
||||
// Ensure _reset() clears the error and _launch() can be called again.
|
||||
return_value = 1;
|
||||
EXPECT_NE(vpx_get_worker_interface()->reset(&worker_), 0);
|
||||
EXPECT_FALSE(worker_.had_error);
|
||||
vpx_get_worker_interface()->launch(&worker_);
|
||||
EXPECT_NE(vpx_get_worker_interface()->sync(&worker_), 0);
|
||||
EXPECT_FALSE(worker_.had_error);
|
||||
}
|
||||
|
||||
TEST_P(VPxWorkerThreadTest, EndWithoutSync) {
|
||||
// Create a large number of threads to increase the chances of detecting a
|
||||
// race. Doing more work in the hook is no guarantee as any race would occur
|
||||
// post hook execution in the main thread loop driver.
|
||||
static const int kNumWorkers = 64;
|
||||
VPxWorker workers[kNumWorkers];
|
||||
int hook_data[kNumWorkers];
|
||||
int return_value[kNumWorkers];
|
||||
|
||||
for (int n = 0; n < kNumWorkers; ++n) {
|
||||
vpx_get_worker_interface()->init(&workers[n]);
|
||||
return_value[n] = 1; // return successfully from the hook
|
||||
workers[n].hook = ThreadHook;
|
||||
workers[n].data1 = &hook_data[n];
|
||||
workers[n].data2 = &return_value[n];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int n = 0; n < kNumWorkers; ++n) {
|
||||
EXPECT_NE(vpx_get_worker_interface()->reset(&workers[n]), 0);
|
||||
hook_data[n] = 0;
|
||||
}
|
||||
|
||||
for (int n = 0; n < kNumWorkers; ++n) {
|
||||
Run(&workers[n]);
|
||||
}
|
||||
|
||||
for (int n = kNumWorkers - 1; n >= 0; --n) {
|
||||
vpx_get_worker_interface()->end(&workers[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(VPxWorkerThreadTest, TestInterfaceAPI) {
|
||||
EXPECT_EQ(0, vpx_set_worker_interface(NULL));
|
||||
EXPECT_TRUE(vpx_get_worker_interface() != NULL);
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
VPxWorkerInterface winterface = *vpx_get_worker_interface();
|
||||
switch (i) {
|
||||
default:
|
||||
case 0: winterface.init = NULL; break;
|
||||
case 1: winterface.reset = NULL; break;
|
||||
case 2: winterface.sync = NULL; break;
|
||||
case 3: winterface.launch = NULL; break;
|
||||
case 4: winterface.execute = NULL; break;
|
||||
case 5: winterface.end = NULL; break;
|
||||
}
|
||||
EXPECT_EQ(0, vpx_set_worker_interface(&winterface));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Multi-threaded decode tests
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
struct FileList {
|
||||
const char *name;
|
||||
const char *expected_md5;
|
||||
};
|
||||
|
||||
// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.
|
||||
string DecodeFile(const string& filename, int num_threads) {
|
||||
libvpx_test::WebMVideoSource video(filename);
|
||||
video.Init();
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
cfg.threads = num_threads;
|
||||
libvpx_test::VP9Decoder decoder(cfg, 0);
|
||||
|
||||
libvpx_test::MD5 md5;
|
||||
for (video.Begin(); video.cxdata(); video.Next()) {
|
||||
const vpx_codec_err_t res =
|
||||
decoder.DecodeFrame(video.cxdata(), video.frame_size());
|
||||
if (res != VPX_CODEC_OK) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
|
||||
break;
|
||||
}
|
||||
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img = NULL;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next())) {
|
||||
md5.Add(img);
|
||||
}
|
||||
}
|
||||
return string(md5.Get());
|
||||
}
|
||||
|
||||
void DecodeFiles(const FileList files[]) {
|
||||
for (const FileList *iter = files; iter->name != NULL; ++iter) {
|
||||
SCOPED_TRACE(iter->name);
|
||||
for (int t = 1; t <= 8; ++t) {
|
||||
EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t))
|
||||
<< "threads = " << t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Trivial serialized thread worker interface implementation.
|
||||
// Note any worker that requires synchronization between other workers will
|
||||
// hang.
|
||||
namespace impl {
|
||||
|
||||
void Init(VPxWorker *const worker) { memset(worker, 0, sizeof(*worker)); }
|
||||
int Reset(VPxWorker *const /*worker*/) { return 1; }
|
||||
int Sync(VPxWorker *const worker) { return !worker->had_error; }
|
||||
|
||||
void Execute(VPxWorker *const worker) {
|
||||
worker->had_error |= !worker->hook(worker->data1, worker->data2);
|
||||
}
|
||||
|
||||
void Launch(VPxWorker *const worker) { Execute(worker); }
|
||||
void End(VPxWorker *const /*worker*/) {}
|
||||
|
||||
} // namespace impl
|
||||
|
||||
TEST(VPxWorkerThreadTest, TestSerialInterface) {
|
||||
static const VPxWorkerInterface serial_interface = {
|
||||
impl::Init, impl::Reset, impl::Sync, impl::Launch, impl::Execute, impl::End
|
||||
};
|
||||
// TODO(jzern): Avoid using a file that will use the row-based thread
|
||||
// loopfilter, with the simple serialized implementation it will hang. This is
|
||||
// due to its expectation that rows will be run in parallel as they wait on
|
||||
// progress in the row above before proceeding.
|
||||
static const char expected_md5[] = "b35a1b707b28e82be025d960aba039bc";
|
||||
static const char filename[] = "vp90-2-03-size-226x226.webm";
|
||||
VPxWorkerInterface default_interface = *vpx_get_worker_interface();
|
||||
|
||||
EXPECT_NE(vpx_set_worker_interface(&serial_interface), 0);
|
||||
EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
|
||||
|
||||
// Reset the interface.
|
||||
EXPECT_NE(vpx_set_worker_interface(&default_interface), 0);
|
||||
EXPECT_EQ(expected_md5, DecodeFile(filename, 2));
|
||||
}
|
||||
|
||||
TEST(VP9DecodeMultiThreadedTest, NoTilesNonFrameParallel) {
|
||||
// no tiles or frame parallel; this exercises loop filter threading.
|
||||
EXPECT_EQ("b35a1b707b28e82be025d960aba039bc",
|
||||
DecodeFile("vp90-2-03-size-226x226.webm", 2));
|
||||
}
|
||||
|
||||
TEST(VP9DecodeMultiThreadedTest, FrameParallel) {
|
||||
static const FileList files[] = {
|
||||
{ "vp90-2-08-tile_1x2_frame_parallel.webm",
|
||||
"68ede6abd66bae0a2edf2eb9232241b6" },
|
||||
{ "vp90-2-08-tile_1x4_frame_parallel.webm",
|
||||
"368ebc6ebf3a5e478d85b2c3149b2848" },
|
||||
{ "vp90-2-08-tile_1x8_frame_parallel.webm",
|
||||
"17e439da2388aff3a0f69cb22579c6c1" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DecodeFiles(files);
|
||||
}
|
||||
|
||||
TEST(VP9DecodeMultiThreadedTest, FrameParallelResize) {
|
||||
static const FileList files[] = {
|
||||
{ "vp90-2-14-resize-fp-tiles-1-16.webm",
|
||||
"0cd5e632c326297e975f38949c31ea94" },
|
||||
{ "vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm",
|
||||
"5c78a96a42e7f4a4f6b2edcdb791e44c" },
|
||||
{ "vp90-2-14-resize-fp-tiles-1-2.webm",
|
||||
"e030450ae85c3277be2a418769df98e2" },
|
||||
{ "vp90-2-14-resize-fp-tiles-1-4.webm",
|
||||
"312eed4e2b64eb7a4e7f18916606a430" },
|
||||
{ "vp90-2-14-resize-fp-tiles-16-1.webm",
|
||||
"1755c16d8af16a9cb3fe7338d90abe52" },
|
||||
{ "vp90-2-14-resize-fp-tiles-16-2.webm",
|
||||
"500300592d3fcb6f12fab25e48aaf4df" },
|
||||
{ "vp90-2-14-resize-fp-tiles-16-4.webm",
|
||||
"47c48379fa6331215d91c67648e1af6e" },
|
||||
{ "vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm",
|
||||
"eecf17290739bc708506fa4827665989" },
|
||||
{ "vp90-2-14-resize-fp-tiles-16-8.webm",
|
||||
"29b6bb54e4c26b5ca85d5de5fed94e76" },
|
||||
{ "vp90-2-14-resize-fp-tiles-1-8.webm",
|
||||
"1b6f175e08cd82cf84bb800ac6d1caa3" },
|
||||
{ "vp90-2-14-resize-fp-tiles-2-16.webm",
|
||||
"ca3b03e4197995d8d5444ede7a6c0804" },
|
||||
{ "vp90-2-14-resize-fp-tiles-2-1.webm",
|
||||
"99aec065369d70bbb78ccdff65afed3f" },
|
||||
{ "vp90-2-14-resize-fp-tiles-2-4.webm",
|
||||
"22d0ebdb49b87d2920a85aea32e1afd5" },
|
||||
{ "vp90-2-14-resize-fp-tiles-2-8.webm",
|
||||
"c2115cf051c62e0f7db1d4a783831541" },
|
||||
{ "vp90-2-14-resize-fp-tiles-4-16.webm",
|
||||
"c690d7e1719b31367564cac0af0939cb" },
|
||||
{ "vp90-2-14-resize-fp-tiles-4-1.webm",
|
||||
"a926020b2cc3e15ad4cc271853a0ff26" },
|
||||
{ "vp90-2-14-resize-fp-tiles-4-2.webm",
|
||||
"42699063d9e581f1993d0cf890c2be78" },
|
||||
{ "vp90-2-14-resize-fp-tiles-4-8.webm",
|
||||
"7f76d96036382f45121e3d5aa6f8ec52" },
|
||||
{ "vp90-2-14-resize-fp-tiles-8-16.webm",
|
||||
"76a43fcdd7e658542913ea43216ec55d" },
|
||||
{ "vp90-2-14-resize-fp-tiles-8-1.webm",
|
||||
"8e3fbe89486ca60a59299dea9da91378" },
|
||||
{ "vp90-2-14-resize-fp-tiles-8-2.webm",
|
||||
"ae96f21f21b6370cc0125621b441fc52" },
|
||||
{ "vp90-2-14-resize-fp-tiles-8-4.webm",
|
||||
"3eb4f24f10640d42218f7fd7b9fd30d4" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DecodeFiles(files);
|
||||
}
|
||||
|
||||
TEST(VP9DecodeMultiThreadedTest, NonFrameParallel) {
|
||||
static const FileList files[] = {
|
||||
{ "vp90-2-08-tile_1x2.webm", "570b4a5d5a70d58b5359671668328a16" },
|
||||
{ "vp90-2-08-tile_1x4.webm", "988d86049e884c66909d2d163a09841a" },
|
||||
{ "vp90-2-08-tile_1x8.webm", "0941902a52e9092cb010905eab16364c" },
|
||||
{ "vp90-2-08-tile-4x1.webm", "06505aade6647c583c8e00a2f582266f" },
|
||||
{ "vp90-2-08-tile-4x4.webm", "85c2299892460d76e2c600502d52bfe2" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DecodeFiles(files);
|
||||
}
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Synchronous, VPxWorkerThreadTest, ::testing::Bool());
|
||||
|
||||
} // namespace
|
@ -1,255 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
|
||||
namespace {
|
||||
|
||||
typedef void (*ExtendFrameBorderFunc)(YV12_BUFFER_CONFIG *ybf);
|
||||
typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf,
|
||||
YV12_BUFFER_CONFIG *dst_ybf);
|
||||
|
||||
class VpxScaleBase {
|
||||
public:
|
||||
virtual ~VpxScaleBase() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
|
||||
void ResetImage(int width, int height) {
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
memset(&img_, 0, sizeof(img_));
|
||||
ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&img_, width_, height_,
|
||||
VP8BORDERINPIXELS));
|
||||
memset(img_.buffer_alloc, kBufFiller, img_.frame_size);
|
||||
FillPlane(img_.y_buffer, img_.y_crop_width, img_.y_crop_height,
|
||||
img_.y_stride);
|
||||
FillPlane(img_.u_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
FillPlane(img_.v_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
|
||||
memset(&ref_img_, 0, sizeof(ref_img_));
|
||||
ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&ref_img_, width_, height_,
|
||||
VP8BORDERINPIXELS));
|
||||
memset(ref_img_.buffer_alloc, kBufFiller, ref_img_.frame_size);
|
||||
|
||||
memset(&cpy_img_, 0, sizeof(cpy_img_));
|
||||
ASSERT_EQ(0, vp8_yv12_alloc_frame_buffer(&cpy_img_, width_, height_,
|
||||
VP8BORDERINPIXELS));
|
||||
memset(cpy_img_.buffer_alloc, kBufFiller, cpy_img_.frame_size);
|
||||
ReferenceCopyFrame();
|
||||
}
|
||||
|
||||
void DeallocImage() {
|
||||
vp8_yv12_de_alloc_frame_buffer(&img_);
|
||||
vp8_yv12_de_alloc_frame_buffer(&ref_img_);
|
||||
vp8_yv12_de_alloc_frame_buffer(&cpy_img_);
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kBufFiller = 123;
|
||||
static const int kBufMax = kBufFiller - 1;
|
||||
|
||||
static void FillPlane(uint8_t *buf, int width, int height, int stride) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
buf[x + (y * stride)] = (x + (width * y)) % kBufMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ExtendPlane(uint8_t *buf, int crop_width, int crop_height,
|
||||
int width, int height, int stride, int padding) {
|
||||
// Copy the outermost visible pixel to a distance of at least 'padding.'
|
||||
// The buffers are allocated such that there may be excess space outside the
|
||||
// padding. As long as the minimum amount of padding is achieved it is not
|
||||
// necessary to fill this space as well.
|
||||
uint8_t *left = buf - padding;
|
||||
uint8_t *right = buf + crop_width;
|
||||
const int right_extend = padding + (width - crop_width);
|
||||
const int bottom_extend = padding + (height - crop_height);
|
||||
|
||||
// Fill the border pixels from the nearest image pixel.
|
||||
for (int y = 0; y < crop_height; ++y) {
|
||||
memset(left, left[padding], padding);
|
||||
memset(right, right[-1], right_extend);
|
||||
left += stride;
|
||||
right += stride;
|
||||
}
|
||||
|
||||
left = buf - padding;
|
||||
uint8_t *top = left - (stride * padding);
|
||||
// The buffer does not always extend as far as the stride.
|
||||
// Equivalent to padding + width + padding.
|
||||
const int extend_width = padding + crop_width + right_extend;
|
||||
|
||||
// The first row was already extended to the left and right. Copy it up.
|
||||
for (int y = 0; y < padding; ++y) {
|
||||
memcpy(top, left, extend_width);
|
||||
top += stride;
|
||||
}
|
||||
|
||||
uint8_t *bottom = left + (crop_height * stride);
|
||||
for (int y = 0; y < bottom_extend; ++y) {
|
||||
memcpy(bottom, left + (crop_height - 1) * stride, extend_width);
|
||||
bottom += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void ReferenceExtendBorder() {
|
||||
ExtendPlane(ref_img_.y_buffer,
|
||||
ref_img_.y_crop_width, ref_img_.y_crop_height,
|
||||
ref_img_.y_width, ref_img_.y_height,
|
||||
ref_img_.y_stride,
|
||||
ref_img_.border);
|
||||
ExtendPlane(ref_img_.u_buffer,
|
||||
ref_img_.uv_crop_width, ref_img_.uv_crop_height,
|
||||
ref_img_.uv_width, ref_img_.uv_height,
|
||||
ref_img_.uv_stride,
|
||||
ref_img_.border / 2);
|
||||
ExtendPlane(ref_img_.v_buffer,
|
||||
ref_img_.uv_crop_width, ref_img_.uv_crop_height,
|
||||
ref_img_.uv_width, ref_img_.uv_height,
|
||||
ref_img_.uv_stride,
|
||||
ref_img_.border / 2);
|
||||
}
|
||||
|
||||
void ReferenceCopyFrame() {
|
||||
// Copy img_ to ref_img_ and extend frame borders. This will be used for
|
||||
// verifying extend_fn_ as well as copy_frame_fn_.
|
||||
EXPECT_EQ(ref_img_.frame_size, img_.frame_size);
|
||||
for (int y = 0; y < img_.y_crop_height; ++y) {
|
||||
for (int x = 0; x < img_.y_crop_width; ++x) {
|
||||
ref_img_.y_buffer[x + y * ref_img_.y_stride] =
|
||||
img_.y_buffer[x + y * img_.y_stride];
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < img_.uv_crop_height; ++y) {
|
||||
for (int x = 0; x < img_.uv_crop_width; ++x) {
|
||||
ref_img_.u_buffer[x + y * ref_img_.uv_stride] =
|
||||
img_.u_buffer[x + y * img_.uv_stride];
|
||||
ref_img_.v_buffer[x + y * ref_img_.uv_stride] =
|
||||
img_.v_buffer[x + y * img_.uv_stride];
|
||||
}
|
||||
}
|
||||
|
||||
ReferenceExtendBorder();
|
||||
}
|
||||
|
||||
void CompareImages(const YV12_BUFFER_CONFIG actual) {
|
||||
EXPECT_EQ(ref_img_.frame_size, actual.frame_size);
|
||||
EXPECT_EQ(0, memcmp(ref_img_.buffer_alloc, actual.buffer_alloc,
|
||||
ref_img_.frame_size));
|
||||
}
|
||||
|
||||
YV12_BUFFER_CONFIG img_;
|
||||
YV12_BUFFER_CONFIG ref_img_;
|
||||
YV12_BUFFER_CONFIG cpy_img_;
|
||||
int width_;
|
||||
int height_;
|
||||
};
|
||||
|
||||
class ExtendBorderTest
|
||||
: public VpxScaleBase,
|
||||
public ::testing::TestWithParam<ExtendFrameBorderFunc> {
|
||||
public:
|
||||
virtual ~ExtendBorderTest() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
extend_fn_ = GetParam();
|
||||
}
|
||||
|
||||
void ExtendBorder() {
|
||||
ASM_REGISTER_STATE_CHECK(extend_fn_(&img_));
|
||||
}
|
||||
|
||||
void RunTest() {
|
||||
#if ARCH_ARM
|
||||
// Some arm devices OOM when trying to allocate the largest buffers.
|
||||
static const int kNumSizesToTest = 6;
|
||||
#else
|
||||
static const int kNumSizesToTest = 7;
|
||||
#endif
|
||||
static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
|
||||
for (int h = 0; h < kNumSizesToTest; ++h) {
|
||||
for (int w = 0; w < kNumSizesToTest; ++w) {
|
||||
ResetImage(kSizesToTest[w], kSizesToTest[h]);
|
||||
ExtendBorder();
|
||||
ReferenceExtendBorder();
|
||||
CompareImages(img_);
|
||||
DeallocImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExtendFrameBorderFunc extend_fn_;
|
||||
};
|
||||
|
||||
TEST_P(ExtendBorderTest, ExtendBorder) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunTest());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,
|
||||
::testing::Values(vp8_yv12_extend_frame_borders_c));
|
||||
|
||||
class CopyFrameTest
|
||||
: public VpxScaleBase,
|
||||
public ::testing::TestWithParam<CopyFrameFunc> {
|
||||
public:
|
||||
virtual ~CopyFrameTest() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
copy_frame_fn_ = GetParam();
|
||||
}
|
||||
|
||||
void CopyFrame() {
|
||||
ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));
|
||||
}
|
||||
|
||||
void RunTest() {
|
||||
#if ARCH_ARM
|
||||
// Some arm devices OOM when trying to allocate the largest buffers.
|
||||
static const int kNumSizesToTest = 6;
|
||||
#else
|
||||
static const int kNumSizesToTest = 7;
|
||||
#endif
|
||||
static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
|
||||
for (int h = 0; h < kNumSizesToTest; ++h) {
|
||||
for (int w = 0; w < kNumSizesToTest; ++w) {
|
||||
ResetImage(kSizesToTest[w], kSizesToTest[h]);
|
||||
ReferenceCopyFrame();
|
||||
CopyFrame();
|
||||
CompareImages(cpy_img_);
|
||||
DeallocImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CopyFrameFunc copy_frame_fn_;
|
||||
};
|
||||
|
||||
TEST_P(CopyFrameTest, CopyFrame) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunTest());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,
|
||||
::testing::Values(vp8_yv12_copy_frame_c));
|
||||
} // namespace
|
@ -16,11 +16,11 @@
|
||||
|
||||
#include "./tools_common.h"
|
||||
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
|
||||
#if CONFIG_VP10_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER || CONFIG_VP10_DECODER
|
||||
#if CONFIG_VP10_DECODER
|
||||
#include "vpx/vp8dx.h"
|
||||
#endif
|
||||
|
||||
@ -136,14 +136,6 @@ static const VpxInterface vpx_encoders[] = {
|
||||
#if CONFIG_VP10_ENCODER
|
||||
{"vp10", VP10_FOURCC, &vpx_codec_vp10_cx},
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP8_ENCODER
|
||||
{"vp8", VP8_FOURCC, &vpx_codec_vp8_cx},
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
{"vp9", VP9_FOURCC, &vpx_codec_vp9_cx},
|
||||
#endif
|
||||
};
|
||||
|
||||
int get_vpx_encoder_count(void) {
|
||||
@ -171,14 +163,6 @@ const VpxInterface *get_vpx_encoder_by_name(const char *name) {
|
||||
#if CONFIG_DECODERS
|
||||
|
||||
static const VpxInterface vpx_decoders[] = {
|
||||
#if CONFIG_VP8_DECODER
|
||||
{"vp8", VP8_FOURCC, &vpx_codec_vp8_dx},
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_DECODER
|
||||
{"vp9", VP9_FOURCC, &vpx_codec_vp9_dx},
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP10_DECODER
|
||||
{"vp10", VP10_FOURCC, &vpx_codec_vp10_dx},
|
||||
#endif
|
||||
@ -286,7 +270,7 @@ double sse_to_psnr(double samples, double peak, double sse) {
|
||||
}
|
||||
|
||||
// TODO(debargha): Consolidate the functions below into a separate file.
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static void highbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
int input_shift) {
|
||||
// Note the offset is 1 less than half.
|
||||
@ -499,4 +483,4 @@ void vpx_img_downshift(vpx_image_t *dst, vpx_image_t *src,
|
||||
lowbd_img_downshift(dst, src, down_shift);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
@ -151,7 +151,7 @@ int vpx_img_read(vpx_image_t *img, FILE *file);
|
||||
|
||||
double sse_to_psnr(double samples, double peak, double mse);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vpx_img_upshift(vpx_image_t *dst, vpx_image_t *src, int input_shift);
|
||||
void vpx_img_downshift(vpx_image_t *dst, vpx_image_t *src, int down_shift);
|
||||
void vpx_img_truncate_16_to_8(vpx_image_t *dst, vpx_image_t *src);
|
||||
|
@ -81,15 +81,6 @@ void vp10_free_ref_frame_buffers(BufferPool *pool) {
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_free_postproc_buffers(VP10_COMMON *cm) {
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
vpx_free_frame_buffer(&cm->post_proc_buffer);
|
||||
vpx_free_frame_buffer(&cm->post_proc_buffer_int);
|
||||
#else
|
||||
(void)cm;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp10_free_context_buffers(VP10_COMMON *cm) {
|
||||
cm->free_mi(cm);
|
||||
free_seg_map(cm);
|
||||
|
@ -192,7 +192,7 @@ typedef struct macroblockd {
|
||||
PARTITION_CONTEXT *above_seg_context;
|
||||
PARTITION_CONTEXT left_seg_context[8];
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
/* Bit depth: 8, 10, 12 */
|
||||
int bd;
|
||||
#endif
|
||||
|
@ -65,7 +65,7 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
|
||||
#define VP10_SYNC_CODE_1 0x83
|
||||
#define VP10_SYNC_CODE_2 0x43
|
||||
|
||||
#define VP9_FRAME_MARKER 0x2
|
||||
#define VPX_FRAME_MARKER 0x2
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -35,7 +35,7 @@ const vpx_prob vp10_cat5_prob[] = { 180, 157, 141, 134, 130 };
|
||||
const vpx_prob vp10_cat6_prob[] = {
|
||||
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
|
||||
};
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
const vpx_prob vp10_cat1_prob_high10[] = { 159 };
|
||||
const vpx_prob vp10_cat2_prob_high10[] = { 165, 145 };
|
||||
const vpx_prob vp10_cat3_prob_high10[] = { 173, 148, 140 };
|
||||
|
@ -59,7 +59,7 @@ DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat4_prob[4]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat5_prob[5]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat6_prob[14]);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat1_prob_high10[1]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat2_prob_high10[2]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat3_prob_high10[3]);
|
||||
@ -72,7 +72,7 @@ DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat3_prob_high12[3]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat4_prob_high12[4]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat5_prob_high12[5]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, vp10_cat6_prob_high12[18]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#define EOB_MODEL_TOKEN 3
|
||||
|
||||
@ -86,16 +86,16 @@ typedef struct {
|
||||
|
||||
// indexed by token value
|
||||
extern const vp10_extra_bit vp10_extra_bits[ENTROPY_TOKENS];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
extern const vp10_extra_bit vp10_extra_bits_high10[ENTROPY_TOKENS];
|
||||
extern const vp10_extra_bit vp10_extra_bits_high12[ENTROPY_TOKENS];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#define DCT_MAX_VALUE 16384
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
#define DCT_MAX_VALUE_HIGH10 65536
|
||||
#define DCT_MAX_VALUE_HIGH12 262144
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
/* Coefficients are predicted via a 3-dimensional probability table. */
|
||||
|
||||
|
@ -100,10 +100,10 @@ typedef enum {
|
||||
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms
|
||||
|
||||
typedef enum {
|
||||
VP9_LAST_FLAG = 1 << 0,
|
||||
VP9_GOLD_FLAG = 1 << 1,
|
||||
VP9_ALT_FLAG = 1 << 2,
|
||||
} VP9_REFFRAME;
|
||||
VPX_LAST_FLAG = 1 << 0,
|
||||
VPX_GOLD_FLAG = 1 << 1,
|
||||
VPX_ALT_FLAG = 1 << 2,
|
||||
} VPX_REFFRAME;
|
||||
|
||||
typedef enum {
|
||||
PLANE_TYPE_Y = 0,
|
||||
|
@ -18,7 +18,7 @@ int vp10_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
|
||||
vp10_free_internal_frame_buffers(list);
|
||||
|
||||
list->num_internal_frame_buffers =
|
||||
VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
VPX_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
list->int_fb =
|
||||
(InternalFrameBuffer *)vpx_calloc(list->num_internal_frame_buffers,
|
||||
sizeof(*list->int_fb));
|
||||
|
@ -251,7 +251,7 @@ void vp10_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
|
||||
int stride, int tx_type, int bd) {
|
||||
const highbd_transform_2d IHT_4[] = {
|
||||
@ -495,4 +495,4 @@ void vp10_highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
@ -30,13 +30,13 @@ typedef struct {
|
||||
transform_1d cols, rows; // vertical and horizontal
|
||||
} transform_2d;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
typedef void (*highbd_transform_1d)(const tran_low_t*, tran_low_t*, int bd);
|
||||
|
||||
typedef struct {
|
||||
highbd_transform_1d cols, rows; // vertical and horizontal
|
||||
} highbd_transform_2d;
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
void vp10_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob);
|
||||
@ -52,7 +52,7 @@ void vp10_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
|
||||
void vp10_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, int eob, TX_TYPE tx_type);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, int bd);
|
||||
void vp10_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
@ -74,7 +74,7 @@ void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
|
||||
void vp10_highbd_inv_txfm_add_32x32(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, int eob, int bd,
|
||||
TX_TYPE tx_type);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
@ -395,7 +395,7 @@ static void filter_selectively_vert_row2(int subsampling_factor,
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static void highbd_filter_selectively_vert_row2(int subsampling_factor,
|
||||
uint16_t *s, int pitch,
|
||||
unsigned int mask_16x16_l,
|
||||
@ -494,7 +494,7 @@ static void highbd_filter_selectively_vert_row2(int subsampling_factor,
|
||||
mask_4x4_int_1 >>= 1;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
static void filter_selectively_horiz(uint8_t *s, int pitch,
|
||||
unsigned int mask_16x16,
|
||||
@ -592,7 +592,7 @@ static void filter_selectively_horiz(uint8_t *s, int pitch,
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static void highbd_filter_selectively_horiz(uint16_t *s, int pitch,
|
||||
unsigned int mask_16x16,
|
||||
unsigned int mask_8x8,
|
||||
@ -696,7 +696,7 @@ static void highbd_filter_selectively_horiz(uint16_t *s, int pitch,
|
||||
mask_4x4_int >>= count;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
// This function ors into the current lfm structure, where to do loop
|
||||
// filters for the specific mi we are looking at. It uses information
|
||||
@ -1143,7 +1143,7 @@ static void filter_selectively_vert(uint8_t *s, int pitch,
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static void highbd_filter_selectively_vert(uint16_t *s, int pitch,
|
||||
unsigned int mask_16x16,
|
||||
unsigned int mask_8x8,
|
||||
@ -1180,7 +1180,7 @@ static void highbd_filter_selectively_vert(uint16_t *s, int pitch,
|
||||
mask_4x4_int >>= 1;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
void vp10_filter_block_plane_non420(VP10_COMMON *cm,
|
||||
struct macroblockd_plane *plane,
|
||||
@ -1280,7 +1280,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
|
||||
|
||||
// Disable filtering on the leftmost column
|
||||
border_mask = ~(mi_col == 0);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_vert(CONVERT_TO_SHORTPTR(dst->buf),
|
||||
dst->stride,
|
||||
@ -1305,7 +1305,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
|
||||
mask_4x4_c & border_mask,
|
||||
mask_4x4_int[r],
|
||||
&cm->lf_info, &lfl[r << 3]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
dst->buf += 8 * dst->stride;
|
||||
mi_8x8 += row_step_stride;
|
||||
}
|
||||
@ -1329,7 +1329,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
|
||||
mask_8x8_r = mask_8x8[r];
|
||||
mask_4x4_r = mask_4x4[r];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
||||
dst->stride,
|
||||
@ -1354,7 +1354,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
|
||||
mask_4x4_r,
|
||||
mask_4x4_int_r,
|
||||
&cm->lf_info, &lfl[r << 3]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
dst->buf += 8 * dst->stride;
|
||||
}
|
||||
}
|
||||
@ -1381,7 +1381,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
|
||||
unsigned int mask_4x4_int_l = mask_4x4_int & 0xffff;
|
||||
|
||||
// Disable filtering on the leftmost column.
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_vert_row2(
|
||||
plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride,
|
||||
@ -1396,7 +1396,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
|
||||
filter_selectively_vert_row2(
|
||||
plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l,
|
||||
mask_4x4_l, mask_4x4_int_l, &cm->lf_info, &lfm->lfl_y[r << 3]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
dst->buf += 16 * dst->stride;
|
||||
mask_16x16 >>= 16;
|
||||
mask_8x8 >>= 16;
|
||||
@ -1426,7 +1426,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
|
||||
mask_4x4_r = mask_4x4 & 0xff;
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_horiz(
|
||||
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r,
|
||||
@ -1441,7 +1441,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
|
||||
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
|
||||
&lfm->lfl_y[r << 3]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
dst->buf += 8 * dst->stride;
|
||||
mask_16x16 >>= 8;
|
||||
@ -1486,7 +1486,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
||||
unsigned int mask_4x4_int_l = mask_4x4_int & 0xff;
|
||||
|
||||
// Disable filtering on the leftmost column.
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_vert_row2(
|
||||
plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride,
|
||||
@ -1503,7 +1503,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
||||
plane->subsampling_x, dst->buf, dst->stride,
|
||||
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
|
||||
&lfm->lfl_uv[r << 1]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
dst->buf += 16 * dst->stride;
|
||||
mask_16x16 >>= 8;
|
||||
@ -1542,7 +1542,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
||||
mask_4x4_r = mask_4x4 & 0xf;
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
||||
dst->stride, mask_16x16_r, mask_8x8_r,
|
||||
@ -1557,7 +1557,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
||||
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||
mask_4x4_r, mask_4x4_int_r, &cm->lf_info,
|
||||
&lfm->lfl_uv[r << 1]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
dst->buf += 8 * dst->stride;
|
||||
mask_16x16 >>= 4;
|
||||
|
@ -93,7 +93,7 @@ typedef struct {
|
||||
/* assorted loopfilter functions which get used elsewhere */
|
||||
struct VP10Common;
|
||||
struct macroblockd;
|
||||
struct VP9LfSyncData;
|
||||
struct VP10LfSyncData;
|
||||
|
||||
// This function sets up the bit masks for the entire 64x64 region represented
|
||||
// by mi_row, mi_col.
|
||||
|
@ -1,394 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
|
||||
#include "vp10/common/onyxc_int.h"
|
||||
#include "vp10/common/postproc.h"
|
||||
|
||||
// TODO(jackychen): Replace this function with SSE2 code. There is
|
||||
// one SSE2 implementation in vp8, so will consider how to share it
|
||||
// between vp8 and vp9.
|
||||
static void filter_by_weight(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int block_size, int src_weight) {
|
||||
const int dst_weight = (1 << MFQE_PRECISION) - src_weight;
|
||||
const int rounding_bit = 1 << (MFQE_PRECISION - 1);
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < block_size; r++) {
|
||||
for (c = 0; c < block_size; c++) {
|
||||
dst[c] = (src[c] * src_weight + dst[c] * dst_weight + rounding_bit)
|
||||
>> MFQE_PRECISION;
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_filter_by_weight8x8_c(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int src_weight) {
|
||||
filter_by_weight(src, src_stride, dst, dst_stride, 8, src_weight);
|
||||
}
|
||||
|
||||
void vp10_filter_by_weight16x16_c(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int src_weight) {
|
||||
filter_by_weight(src, src_stride, dst, dst_stride, 16, src_weight);
|
||||
}
|
||||
|
||||
static void filter_by_weight32x32(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int weight) {
|
||||
vp10_filter_by_weight16x16(src, src_stride, dst, dst_stride, weight);
|
||||
vp10_filter_by_weight16x16(src + 16, src_stride, dst + 16, dst_stride,
|
||||
weight);
|
||||
vp10_filter_by_weight16x16(src + src_stride * 16, src_stride,
|
||||
dst + dst_stride * 16, dst_stride, weight);
|
||||
vp10_filter_by_weight16x16(src + src_stride * 16 + 16, src_stride,
|
||||
dst + dst_stride * 16 + 16, dst_stride, weight);
|
||||
}
|
||||
|
||||
static void filter_by_weight64x64(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int weight) {
|
||||
filter_by_weight32x32(src, src_stride, dst, dst_stride, weight);
|
||||
filter_by_weight32x32(src + 32, src_stride, dst + 32,
|
||||
dst_stride, weight);
|
||||
filter_by_weight32x32(src + src_stride * 32, src_stride,
|
||||
dst + dst_stride * 32, dst_stride, weight);
|
||||
filter_by_weight32x32(src + src_stride * 32 + 32, src_stride,
|
||||
dst + dst_stride * 32 + 32, dst_stride, weight);
|
||||
}
|
||||
|
||||
static void apply_ifactor(const uint8_t *y, int y_stride, uint8_t *yd,
|
||||
int yd_stride, const uint8_t *u, const uint8_t *v,
|
||||
int uv_stride, uint8_t *ud, uint8_t *vd,
|
||||
int uvd_stride, BLOCK_SIZE block_size,
|
||||
int weight) {
|
||||
if (block_size == BLOCK_16X16) {
|
||||
vp10_filter_by_weight16x16(y, y_stride, yd, yd_stride, weight);
|
||||
vp10_filter_by_weight8x8(u, uv_stride, ud, uvd_stride, weight);
|
||||
vp10_filter_by_weight8x8(v, uv_stride, vd, uvd_stride, weight);
|
||||
} else if (block_size == BLOCK_32X32) {
|
||||
filter_by_weight32x32(y, y_stride, yd, yd_stride, weight);
|
||||
vp10_filter_by_weight16x16(u, uv_stride, ud, uvd_stride, weight);
|
||||
vp10_filter_by_weight16x16(v, uv_stride, vd, uvd_stride, weight);
|
||||
} else if (block_size == BLOCK_64X64) {
|
||||
filter_by_weight64x64(y, y_stride, yd, yd_stride, weight);
|
||||
filter_by_weight32x32(u, uv_stride, ud, uvd_stride, weight);
|
||||
filter_by_weight32x32(v, uv_stride, vd, uvd_stride, weight);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jackychen): Determine whether replace it with assembly code.
|
||||
static void copy_mem8x8(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride) {
|
||||
int r;
|
||||
for (r = 0; r < 8; r++) {
|
||||
memcpy(dst, src, 8);
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_mem16x16(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride) {
|
||||
int r;
|
||||
for (r = 0; r < 16; r++) {
|
||||
memcpy(dst, src, 16);
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_mem32x32(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride) {
|
||||
copy_mem16x16(src, src_stride, dst, dst_stride);
|
||||
copy_mem16x16(src + 16, src_stride, dst + 16, dst_stride);
|
||||
copy_mem16x16(src + src_stride * 16, src_stride,
|
||||
dst + dst_stride * 16, dst_stride);
|
||||
copy_mem16x16(src + src_stride * 16 + 16, src_stride,
|
||||
dst + dst_stride * 16 + 16, dst_stride);
|
||||
}
|
||||
|
||||
void copy_mem64x64(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride) {
|
||||
copy_mem32x32(src, src_stride, dst, dst_stride);
|
||||
copy_mem32x32(src + 32, src_stride, dst + 32, dst_stride);
|
||||
copy_mem32x32(src + src_stride * 32, src_stride,
|
||||
dst + src_stride * 32, dst_stride);
|
||||
copy_mem32x32(src + src_stride * 32 + 32, src_stride,
|
||||
dst + src_stride * 32 + 32, dst_stride);
|
||||
}
|
||||
|
||||
static void copy_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
|
||||
int y_stride, int uv_stride, uint8_t *yd, uint8_t *ud,
|
||||
uint8_t *vd, int yd_stride, int uvd_stride,
|
||||
BLOCK_SIZE bs) {
|
||||
if (bs == BLOCK_16X16) {
|
||||
copy_mem16x16(y, y_stride, yd, yd_stride);
|
||||
copy_mem8x8(u, uv_stride, ud, uvd_stride);
|
||||
copy_mem8x8(v, uv_stride, vd, uvd_stride);
|
||||
} else if (bs == BLOCK_32X32) {
|
||||
copy_mem32x32(y, y_stride, yd, yd_stride);
|
||||
copy_mem16x16(u, uv_stride, ud, uvd_stride);
|
||||
copy_mem16x16(v, uv_stride, vd, uvd_stride);
|
||||
} else {
|
||||
copy_mem64x64(y, y_stride, yd, yd_stride);
|
||||
copy_mem32x32(u, uv_stride, ud, uvd_stride);
|
||||
copy_mem32x32(v, uv_stride, vd, uvd_stride);
|
||||
}
|
||||
}
|
||||
|
||||
static void get_thr(BLOCK_SIZE bs, int qdiff, int *sad_thr, int *vdiff_thr) {
|
||||
const int adj = qdiff >> MFQE_PRECISION;
|
||||
if (bs == BLOCK_16X16) {
|
||||
*sad_thr = 7 + adj;
|
||||
} else if (bs == BLOCK_32X32) {
|
||||
*sad_thr = 6 + adj;
|
||||
} else { // BLOCK_64X64
|
||||
*sad_thr = 5 + adj;
|
||||
}
|
||||
*vdiff_thr = 125 + qdiff;
|
||||
}
|
||||
|
||||
static void mfqe_block(BLOCK_SIZE bs, const uint8_t *y, const uint8_t *u,
|
||||
const uint8_t *v, int y_stride, int uv_stride,
|
||||
uint8_t *yd, uint8_t *ud, uint8_t *vd, int yd_stride,
|
||||
int uvd_stride, int qdiff) {
|
||||
int sad, sad_thr, vdiff, vdiff_thr;
|
||||
uint32_t sse;
|
||||
|
||||
get_thr(bs, qdiff, &sad_thr, &vdiff_thr);
|
||||
|
||||
if (bs == BLOCK_16X16) {
|
||||
vdiff = (vpx_variance16x16(y, y_stride, yd, yd_stride, &sse) + 128) >> 8;
|
||||
sad = (vpx_sad16x16(y, y_stride, yd, yd_stride) + 128) >> 8;
|
||||
} else if (bs == BLOCK_32X32) {
|
||||
vdiff = (vpx_variance32x32(y, y_stride, yd, yd_stride, &sse) + 512) >> 10;
|
||||
sad = (vpx_sad32x32(y, y_stride, yd, yd_stride) + 512) >> 10;
|
||||
} else /* if (bs == BLOCK_64X64) */ {
|
||||
vdiff = (vpx_variance64x64(y, y_stride, yd, yd_stride, &sse) + 2048) >> 12;
|
||||
sad = (vpx_sad64x64(y, y_stride, yd, yd_stride) + 2048) >> 12;
|
||||
}
|
||||
|
||||
// vdiff > sad * 3 means vdiff should not be too small, otherwise,
|
||||
// it might be a lighting change in smooth area. When there is a
|
||||
// lighting change in smooth area, it is dangerous to do MFQE.
|
||||
if (sad > 1 && vdiff > sad * 3) {
|
||||
const int weight = 1 << MFQE_PRECISION;
|
||||
int ifactor = weight * sad * vdiff / (sad_thr * vdiff_thr);
|
||||
// When ifactor equals weight, no MFQE is done.
|
||||
if (ifactor > weight) {
|
||||
ifactor = weight;
|
||||
}
|
||||
apply_ifactor(y, y_stride, yd, yd_stride, u, v, uv_stride, ud, vd,
|
||||
uvd_stride, bs, ifactor);
|
||||
} else {
|
||||
// Copy the block from current frame (i.e., no mfqe is done).
|
||||
copy_block(y, u, v, y_stride, uv_stride, yd, ud, vd,
|
||||
yd_stride, uvd_stride, bs);
|
||||
}
|
||||
}
|
||||
|
||||
static int mfqe_decision(MODE_INFO *mi, BLOCK_SIZE cur_bs) {
|
||||
// Check the motion in current block(for inter frame),
|
||||
// or check the motion in the correlated block in last frame (for keyframe).
|
||||
const int mv_len_square = mi->mbmi.mv[0].as_mv.row *
|
||||
mi->mbmi.mv[0].as_mv.row +
|
||||
mi->mbmi.mv[0].as_mv.col *
|
||||
mi->mbmi.mv[0].as_mv.col;
|
||||
const int mv_threshold = 100;
|
||||
return mi->mbmi.mode >= NEARESTMV && // Not an intra block
|
||||
cur_bs >= BLOCK_16X16 &&
|
||||
mv_len_square <= mv_threshold;
|
||||
}
|
||||
|
||||
// Process each partiton in a super block, recursively.
|
||||
static void mfqe_partition(VP10_COMMON *cm, MODE_INFO *mi, BLOCK_SIZE bs,
|
||||
const uint8_t *y, const uint8_t *u,
|
||||
const uint8_t *v, int y_stride, int uv_stride,
|
||||
uint8_t *yd, uint8_t *ud, uint8_t *vd,
|
||||
int yd_stride, int uvd_stride) {
|
||||
int mi_offset, y_offset, uv_offset;
|
||||
const BLOCK_SIZE cur_bs = mi->mbmi.sb_type;
|
||||
const int qdiff = cm->base_qindex - cm->postproc_state.last_base_qindex;
|
||||
const int bsl = b_width_log2_lookup[bs];
|
||||
PARTITION_TYPE partition = partition_lookup[bsl][cur_bs];
|
||||
const BLOCK_SIZE subsize = get_subsize(bs, partition);
|
||||
|
||||
if (cur_bs < BLOCK_8X8) {
|
||||
// If there are blocks smaller than 8x8, it must be on the boundary.
|
||||
return;
|
||||
}
|
||||
// No MFQE on blocks smaller than 16x16
|
||||
if (bs == BLOCK_16X16) {
|
||||
partition = PARTITION_NONE;
|
||||
}
|
||||
if (bs == BLOCK_64X64) {
|
||||
mi_offset = 4;
|
||||
y_offset = 32;
|
||||
uv_offset = 16;
|
||||
} else {
|
||||
mi_offset = 2;
|
||||
y_offset = 16;
|
||||
uv_offset = 8;
|
||||
}
|
||||
switch (partition) {
|
||||
BLOCK_SIZE mfqe_bs, bs_tmp;
|
||||
case PARTITION_HORZ:
|
||||
if (bs == BLOCK_64X64) {
|
||||
mfqe_bs = BLOCK_64X32;
|
||||
bs_tmp = BLOCK_32X32;
|
||||
} else {
|
||||
mfqe_bs = BLOCK_32X16;
|
||||
bs_tmp = BLOCK_16X16;
|
||||
}
|
||||
if (mfqe_decision(mi, mfqe_bs)) {
|
||||
// Do mfqe on the first square partition.
|
||||
mfqe_block(bs_tmp, y, u, v, y_stride, uv_stride,
|
||||
yd, ud, vd, yd_stride, uvd_stride, qdiff);
|
||||
// Do mfqe on the second square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset, u + uv_offset, v + uv_offset,
|
||||
y_stride, uv_stride, yd + y_offset, ud + uv_offset,
|
||||
vd + uv_offset, yd_stride, uvd_stride, qdiff);
|
||||
}
|
||||
if (mfqe_decision(mi + mi_offset * cm->mi_stride, mfqe_bs)) {
|
||||
// Do mfqe on the first square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset * y_stride, u + uv_offset * uv_stride,
|
||||
v + uv_offset * uv_stride, y_stride, uv_stride,
|
||||
yd + y_offset * yd_stride, ud + uv_offset * uvd_stride,
|
||||
vd + uv_offset * uvd_stride, yd_stride, uvd_stride, qdiff);
|
||||
// Do mfqe on the second square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset * y_stride + y_offset,
|
||||
u + uv_offset * uv_stride + uv_offset,
|
||||
v + uv_offset * uv_stride + uv_offset, y_stride,
|
||||
uv_stride, yd + y_offset * yd_stride + y_offset,
|
||||
ud + uv_offset * uvd_stride + uv_offset,
|
||||
vd + uv_offset * uvd_stride + uv_offset,
|
||||
yd_stride, uvd_stride, qdiff);
|
||||
}
|
||||
break;
|
||||
case PARTITION_VERT:
|
||||
if (bs == BLOCK_64X64) {
|
||||
mfqe_bs = BLOCK_32X64;
|
||||
bs_tmp = BLOCK_32X32;
|
||||
} else {
|
||||
mfqe_bs = BLOCK_16X32;
|
||||
bs_tmp = BLOCK_16X16;
|
||||
}
|
||||
if (mfqe_decision(mi, mfqe_bs)) {
|
||||
// Do mfqe on the first square partition.
|
||||
mfqe_block(bs_tmp, y, u, v, y_stride, uv_stride,
|
||||
yd, ud, vd, yd_stride, uvd_stride, qdiff);
|
||||
// Do mfqe on the second square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset * y_stride, u + uv_offset * uv_stride,
|
||||
v + uv_offset * uv_stride, y_stride, uv_stride,
|
||||
yd + y_offset * yd_stride, ud + uv_offset * uvd_stride,
|
||||
vd + uv_offset * uvd_stride, yd_stride, uvd_stride, qdiff);
|
||||
}
|
||||
if (mfqe_decision(mi + mi_offset, mfqe_bs)) {
|
||||
// Do mfqe on the first square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset, u + uv_offset, v + uv_offset,
|
||||
y_stride, uv_stride, yd + y_offset, ud + uv_offset,
|
||||
vd + uv_offset, yd_stride, uvd_stride, qdiff);
|
||||
// Do mfqe on the second square partition.
|
||||
mfqe_block(bs_tmp, y + y_offset * y_stride + y_offset,
|
||||
u + uv_offset * uv_stride + uv_offset,
|
||||
v + uv_offset * uv_stride + uv_offset, y_stride,
|
||||
uv_stride, yd + y_offset * yd_stride + y_offset,
|
||||
ud + uv_offset * uvd_stride + uv_offset,
|
||||
vd + uv_offset * uvd_stride + uv_offset,
|
||||
yd_stride, uvd_stride, qdiff);
|
||||
}
|
||||
break;
|
||||
case PARTITION_NONE:
|
||||
if (mfqe_decision(mi, cur_bs)) {
|
||||
// Do mfqe on this partition.
|
||||
mfqe_block(cur_bs, y, u, v, y_stride, uv_stride,
|
||||
yd, ud, vd, yd_stride, uvd_stride, qdiff);
|
||||
} else {
|
||||
// Copy the block from current frame(i.e., no mfqe is done).
|
||||
copy_block(y, u, v, y_stride, uv_stride, yd, ud, vd,
|
||||
yd_stride, uvd_stride, bs);
|
||||
}
|
||||
break;
|
||||
case PARTITION_SPLIT:
|
||||
// Recursion on four square partitions, e.g. if bs is 64X64,
|
||||
// then look into four 32X32 blocks in it.
|
||||
mfqe_partition(cm, mi, subsize, y, u, v, y_stride, uv_stride, yd, ud, vd,
|
||||
yd_stride, uvd_stride);
|
||||
mfqe_partition(cm, mi + mi_offset, subsize, y + y_offset, u + uv_offset,
|
||||
v + uv_offset, y_stride, uv_stride, yd + y_offset,
|
||||
ud + uv_offset, vd + uv_offset, yd_stride, uvd_stride);
|
||||
mfqe_partition(cm, mi + mi_offset * cm->mi_stride, subsize,
|
||||
y + y_offset * y_stride, u + uv_offset * uv_stride,
|
||||
v + uv_offset * uv_stride, y_stride, uv_stride,
|
||||
yd + y_offset * yd_stride, ud + uv_offset * uvd_stride,
|
||||
vd + uv_offset * uvd_stride, yd_stride, uvd_stride);
|
||||
mfqe_partition(cm, mi + mi_offset * cm->mi_stride + mi_offset,
|
||||
subsize, y + y_offset * y_stride + y_offset,
|
||||
u + uv_offset * uv_stride + uv_offset,
|
||||
v + uv_offset * uv_stride + uv_offset, y_stride,
|
||||
uv_stride, yd + y_offset * yd_stride + y_offset,
|
||||
ud + uv_offset * uvd_stride + uv_offset,
|
||||
vd + uv_offset * uvd_stride + uv_offset,
|
||||
yd_stride, uvd_stride);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_mfqe(VP10_COMMON *cm) {
|
||||
int mi_row, mi_col;
|
||||
// Current decoded frame.
|
||||
const YV12_BUFFER_CONFIG *show = cm->frame_to_show;
|
||||
// Last decoded frame and will store the MFQE result.
|
||||
YV12_BUFFER_CONFIG *dest = &cm->post_proc_buffer;
|
||||
// Loop through each super block.
|
||||
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MI_BLOCK_SIZE) {
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
|
||||
MODE_INFO *mi;
|
||||
MODE_INFO *mi_local = cm->mi + (mi_row * cm->mi_stride + mi_col);
|
||||
// Motion Info in last frame.
|
||||
MODE_INFO *mi_prev = cm->postproc_state.prev_mi +
|
||||
(mi_row * cm->mi_stride + mi_col);
|
||||
const uint32_t y_stride = show->y_stride;
|
||||
const uint32_t uv_stride = show->uv_stride;
|
||||
const uint32_t yd_stride = dest->y_stride;
|
||||
const uint32_t uvd_stride = dest->uv_stride;
|
||||
const uint32_t row_offset_y = mi_row << 3;
|
||||
const uint32_t row_offset_uv = mi_row << 2;
|
||||
const uint32_t col_offset_y = mi_col << 3;
|
||||
const uint32_t col_offset_uv = mi_col << 2;
|
||||
const uint8_t *y = show->y_buffer + row_offset_y * y_stride +
|
||||
col_offset_y;
|
||||
const uint8_t *u = show->u_buffer + row_offset_uv * uv_stride +
|
||||
col_offset_uv;
|
||||
const uint8_t *v = show->v_buffer + row_offset_uv * uv_stride +
|
||||
col_offset_uv;
|
||||
uint8_t *yd = dest->y_buffer + row_offset_y * yd_stride + col_offset_y;
|
||||
uint8_t *ud = dest->u_buffer + row_offset_uv * uvd_stride +
|
||||
col_offset_uv;
|
||||
uint8_t *vd = dest->v_buffer + row_offset_uv * uvd_stride +
|
||||
col_offset_uv;
|
||||
if (frame_is_intra_only(cm)) {
|
||||
mi = mi_prev;
|
||||
} else {
|
||||
mi = mi_local;
|
||||
}
|
||||
mfqe_partition(cm, mi, BLOCK_64X64, y, u, v, y_stride, uv_stride, yd, ud,
|
||||
vd, yd_stride, uvd_stride);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef VP10_COMMON_MFQE_H_
|
||||
#define VP10_COMMON_MFQE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Multiframe Quality Enhancement.
|
||||
// The aim for MFQE is to replace pixel blocks in the current frame with
|
||||
// the correlated pixel blocks (with higher quality) in the last frame.
|
||||
// The replacement can only be taken in stationary blocks by checking
|
||||
// the motion of the blocks and other conditions such as the SAD of
|
||||
// the current block and correlated block, the variance of the block
|
||||
// difference, etc.
|
||||
void vp10_mfqe(struct VP10Common *cm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // VP10_COMMON_MFQE_H_
|
@ -24,31 +24,31 @@ void vp10_iht4x4_16_add_msa(const int16_t *input, uint8_t *dst,
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VP9_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
VP9_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
VP9_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VP9_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
VPX_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
@ -26,42 +26,42 @@ void vp10_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
VP9_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
VP9_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
VP9_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
VP9_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
break;
|
||||
default:
|
||||
@ -74,7 +74,7 @@ void vp10_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
|
||||
SRARI_H4_SH(in4, in5, in6, in7, 5);
|
||||
|
||||
/* add block and store 8x8 */
|
||||
VP9_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
|
||||
VPX_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
|
||||
dst += (4 * dst_stride);
|
||||
VP9_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
|
||||
VPX_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
|
||||
}
|
||||
|
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 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 "./vp10_rtcd.h"
|
||||
#include "vp10/common/onyxc_int.h"
|
||||
#include "vpx_dsp/mips/macros_msa.h"
|
||||
|
||||
static void filter_by_weight8x8_msa(const uint8_t *src_ptr, int32_t src_stride,
|
||||
uint8_t *dst_ptr, int32_t dst_stride,
|
||||
int32_t src_weight) {
|
||||
int32_t dst_weight = (1 << MFQE_PRECISION) - src_weight;
|
||||
int32_t row;
|
||||
uint64_t src0_d, src1_d, dst0_d, dst1_d;
|
||||
v16i8 src0 = { 0 };
|
||||
v16i8 src1 = { 0 };
|
||||
v16i8 dst0 = { 0 };
|
||||
v16i8 dst1 = { 0 };
|
||||
v8i16 src_wt, dst_wt, res_h_r, res_h_l, src_r, src_l, dst_r, dst_l;
|
||||
|
||||
src_wt = __msa_fill_h(src_weight);
|
||||
dst_wt = __msa_fill_h(dst_weight);
|
||||
|
||||
for (row = 2; row--;) {
|
||||
LD2(src_ptr, src_stride, src0_d, src1_d);
|
||||
src_ptr += (2 * src_stride);
|
||||
LD2(dst_ptr, dst_stride, dst0_d, dst1_d);
|
||||
INSERT_D2_SB(src0_d, src1_d, src0);
|
||||
INSERT_D2_SB(dst0_d, dst1_d, dst0);
|
||||
|
||||
LD2(src_ptr, src_stride, src0_d, src1_d);
|
||||
src_ptr += (2 * src_stride);
|
||||
LD2((dst_ptr + 2 * dst_stride), dst_stride, dst0_d, dst1_d);
|
||||
INSERT_D2_SB(src0_d, src1_d, src1);
|
||||
INSERT_D2_SB(dst0_d, dst1_d, dst1);
|
||||
|
||||
UNPCK_UB_SH(src0, src_r, src_l);
|
||||
UNPCK_UB_SH(dst0, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
dst0 = (v16i8)__msa_pckev_b((v16i8)res_h_l, (v16i8)res_h_r);
|
||||
ST8x2_UB(dst0, dst_ptr, dst_stride);
|
||||
dst_ptr += (2 * dst_stride);
|
||||
|
||||
UNPCK_UB_SH(src1, src_r, src_l);
|
||||
UNPCK_UB_SH(dst1, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
dst1 = (v16i8)__msa_pckev_b((v16i8)res_h_l, (v16i8)res_h_r);
|
||||
ST8x2_UB(dst1, dst_ptr, dst_stride);
|
||||
dst_ptr += (2 * dst_stride);
|
||||
}
|
||||
}
|
||||
|
||||
static void filter_by_weight16x16_msa(const uint8_t *src_ptr,
|
||||
int32_t src_stride,
|
||||
uint8_t *dst_ptr,
|
||||
int32_t dst_stride,
|
||||
int32_t src_weight) {
|
||||
int32_t dst_weight = (1 << MFQE_PRECISION) - src_weight;
|
||||
int32_t row;
|
||||
v16i8 src0, src1, src2, src3, dst0, dst1, dst2, dst3;
|
||||
v8i16 src_wt, dst_wt, res_h_r, res_h_l, src_r, src_l, dst_r, dst_l;
|
||||
|
||||
src_wt = __msa_fill_h(src_weight);
|
||||
dst_wt = __msa_fill_h(dst_weight);
|
||||
|
||||
for (row = 4; row--;) {
|
||||
LD_SB4(src_ptr, src_stride, src0, src1, src2, src3);
|
||||
src_ptr += (4 * src_stride);
|
||||
LD_SB4(dst_ptr, dst_stride, dst0, dst1, dst2, dst3);
|
||||
|
||||
UNPCK_UB_SH(src0, src_r, src_l);
|
||||
UNPCK_UB_SH(dst0, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
PCKEV_ST_SB(res_h_r, res_h_l, dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
|
||||
UNPCK_UB_SH(src1, src_r, src_l);
|
||||
UNPCK_UB_SH(dst1, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
PCKEV_ST_SB(res_h_r, res_h_l, dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
|
||||
UNPCK_UB_SH(src2, src_r, src_l);
|
||||
UNPCK_UB_SH(dst2, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
PCKEV_ST_SB(res_h_r, res_h_l, dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
|
||||
UNPCK_UB_SH(src3, src_r, src_l);
|
||||
UNPCK_UB_SH(dst3, dst_r, dst_l);
|
||||
res_h_r = (src_r * src_wt);
|
||||
res_h_r += (dst_r * dst_wt);
|
||||
res_h_l = (src_l * src_wt);
|
||||
res_h_l += (dst_l * dst_wt);
|
||||
SRARI_H2_SH(res_h_r, res_h_l, MFQE_PRECISION);
|
||||
PCKEV_ST_SB(res_h_r, res_h_l, dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_filter_by_weight8x8_msa(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int src_weight) {
|
||||
filter_by_weight8x8_msa(src, src_stride, dst, dst_stride, src_weight);
|
||||
}
|
||||
|
||||
void vp10_filter_by_weight16x16_msa(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int src_weight) {
|
||||
filter_by_weight16x16_msa(src, src_stride, dst, dst_stride, src_weight);
|
||||
}
|
@ -24,10 +24,6 @@
|
||||
#include "vp10/common/quant_common.h"
|
||||
#include "vp10/common/tile_common.h"
|
||||
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
#include "vp10/common/postproc.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -143,7 +139,7 @@ typedef struct VP10Common {
|
||||
int subsampling_x;
|
||||
int subsampling_y;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
int use_highbitdepth; // Marks if we need to use 16bit frame buffers.
|
||||
#endif
|
||||
|
||||
@ -167,11 +163,6 @@ typedef struct VP10Common {
|
||||
|
||||
int new_fb_idx;
|
||||
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
YV12_BUFFER_CONFIG post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG post_proc_buffer_int;
|
||||
#endif
|
||||
|
||||
FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/
|
||||
FRAME_TYPE frame_type;
|
||||
|
||||
@ -275,10 +266,6 @@ typedef struct VP10Common {
|
||||
vpx_bit_depth_t bit_depth;
|
||||
vpx_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer
|
||||
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
struct postproc_state postproc_state;
|
||||
#endif
|
||||
|
||||
int error_resilient_mode;
|
||||
|
||||
int log2_tile_cols, log2_tile_rows;
|
||||
|
@ -1,746 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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 <stdio.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
#include "./vp10_rtcd.h"
|
||||
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/system_state.h"
|
||||
#include "vpx_scale/vpx_scale.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
|
||||
#include "vp10/common/onyxc_int.h"
|
||||
#include "vp10/common/postproc.h"
|
||||
#include "vp10/common/textblit.h"
|
||||
|
||||
#if CONFIG_VP9_POSTPROC
|
||||
static const short kernel5[] = {
|
||||
1, 1, 4, 1, 1
|
||||
};
|
||||
|
||||
const short vp10_rv[] = {
|
||||
8, 5, 2, 2, 8, 12, 4, 9, 8, 3,
|
||||
0, 3, 9, 0, 0, 0, 8, 3, 14, 4,
|
||||
10, 1, 11, 14, 1, 14, 9, 6, 12, 11,
|
||||
8, 6, 10, 0, 0, 8, 9, 0, 3, 14,
|
||||
8, 11, 13, 4, 2, 9, 0, 3, 9, 6,
|
||||
1, 2, 3, 14, 13, 1, 8, 2, 9, 7,
|
||||
3, 3, 1, 13, 13, 6, 6, 5, 2, 7,
|
||||
11, 9, 11, 8, 7, 3, 2, 0, 13, 13,
|
||||
14, 4, 12, 5, 12, 10, 8, 10, 13, 10,
|
||||
4, 14, 4, 10, 0, 8, 11, 1, 13, 7,
|
||||
7, 14, 6, 14, 13, 2, 13, 5, 4, 4,
|
||||
0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
|
||||
8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
|
||||
3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
|
||||
3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
|
||||
13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
|
||||
5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
|
||||
9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
|
||||
4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
|
||||
3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
|
||||
11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
|
||||
5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
|
||||
0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
|
||||
10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
|
||||
4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
|
||||
0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
|
||||
8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
|
||||
3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
|
||||
3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
|
||||
13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
|
||||
5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
|
||||
9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
|
||||
4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
|
||||
3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
|
||||
11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
|
||||
5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
|
||||
0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
|
||||
10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
|
||||
4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
|
||||
3, 8, 3, 7, 8, 5, 11, 4, 12, 3,
|
||||
11, 9, 14, 8, 14, 13, 4, 3, 1, 2,
|
||||
14, 6, 5, 4, 4, 11, 4, 6, 2, 1,
|
||||
5, 8, 8, 12, 13, 5, 14, 10, 12, 13,
|
||||
0, 9, 5, 5, 11, 10, 13, 9, 10, 13,
|
||||
};
|
||||
|
||||
static const uint8_t q_diff_thresh = 20;
|
||||
static const uint8_t last_q_thresh = 170;
|
||||
|
||||
void vp10_post_proc_down_and_across_c(const uint8_t *src_ptr,
|
||||
uint8_t *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit) {
|
||||
uint8_t const *p_src;
|
||||
uint8_t *p_dst;
|
||||
int row, col, i, v, kernel;
|
||||
int pitch = src_pixels_per_line;
|
||||
uint8_t d[8];
|
||||
(void)dst_pixels_per_line;
|
||||
|
||||
for (row = 0; row < rows; row++) {
|
||||
/* post_proc_down for one row */
|
||||
p_src = src_ptr;
|
||||
p_dst = dst_ptr;
|
||||
|
||||
for (col = 0; col < cols; col++) {
|
||||
kernel = 4;
|
||||
v = p_src[col];
|
||||
|
||||
for (i = -2; i <= 2; i++) {
|
||||
if (abs(v - p_src[col + i * pitch]) > flimit)
|
||||
goto down_skip_convolve;
|
||||
|
||||
kernel += kernel5[2 + i] * p_src[col + i * pitch];
|
||||
}
|
||||
|
||||
v = (kernel >> 3);
|
||||
down_skip_convolve:
|
||||
p_dst[col] = v;
|
||||
}
|
||||
|
||||
/* now post_proc_across */
|
||||
p_src = dst_ptr;
|
||||
p_dst = dst_ptr;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
d[i] = p_src[i];
|
||||
|
||||
for (col = 0; col < cols; col++) {
|
||||
kernel = 4;
|
||||
v = p_src[col];
|
||||
|
||||
d[col & 7] = v;
|
||||
|
||||
for (i = -2; i <= 2; i++) {
|
||||
if (abs(v - p_src[col + i]) > flimit)
|
||||
goto across_skip_convolve;
|
||||
|
||||
kernel += kernel5[2 + i] * p_src[col + i];
|
||||
}
|
||||
|
||||
d[col & 7] = (kernel >> 3);
|
||||
across_skip_convolve:
|
||||
|
||||
if (col >= 2)
|
||||
p_dst[col - 2] = d[(col - 2) & 7];
|
||||
}
|
||||
|
||||
/* handle the last two pixels */
|
||||
p_dst[col - 2] = d[(col - 2) & 7];
|
||||
p_dst[col - 1] = d[(col - 1) & 7];
|
||||
|
||||
|
||||
/* next row */
|
||||
src_ptr += pitch;
|
||||
dst_ptr += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void vp10_highbd_post_proc_down_and_across_c(const uint16_t *src_ptr,
|
||||
uint16_t *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit) {
|
||||
uint16_t const *p_src;
|
||||
uint16_t *p_dst;
|
||||
int row, col, i, v, kernel;
|
||||
int pitch = src_pixels_per_line;
|
||||
uint16_t d[8];
|
||||
|
||||
for (row = 0; row < rows; row++) {
|
||||
// post_proc_down for one row.
|
||||
p_src = src_ptr;
|
||||
p_dst = dst_ptr;
|
||||
|
||||
for (col = 0; col < cols; col++) {
|
||||
kernel = 4;
|
||||
v = p_src[col];
|
||||
|
||||
for (i = -2; i <= 2; i++) {
|
||||
if (abs(v - p_src[col + i * pitch]) > flimit)
|
||||
goto down_skip_convolve;
|
||||
|
||||
kernel += kernel5[2 + i] * p_src[col + i * pitch];
|
||||
}
|
||||
|
||||
v = (kernel >> 3);
|
||||
|
||||
down_skip_convolve:
|
||||
p_dst[col] = v;
|
||||
}
|
||||
|
||||
/* now post_proc_across */
|
||||
p_src = dst_ptr;
|
||||
p_dst = dst_ptr;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
d[i] = p_src[i];
|
||||
|
||||
for (col = 0; col < cols; col++) {
|
||||
kernel = 4;
|
||||
v = p_src[col];
|
||||
|
||||
d[col & 7] = v;
|
||||
|
||||
for (i = -2; i <= 2; i++) {
|
||||
if (abs(v - p_src[col + i]) > flimit)
|
||||
goto across_skip_convolve;
|
||||
|
||||
kernel += kernel5[2 + i] * p_src[col + i];
|
||||
}
|
||||
|
||||
d[col & 7] = (kernel >> 3);
|
||||
|
||||
across_skip_convolve:
|
||||
if (col >= 2)
|
||||
p_dst[col - 2] = d[(col - 2) & 7];
|
||||
}
|
||||
|
||||
/* handle the last two pixels */
|
||||
p_dst[col - 2] = d[(col - 2) & 7];
|
||||
p_dst[col - 1] = d[(col - 1) & 7];
|
||||
|
||||
|
||||
/* next row */
|
||||
src_ptr += pitch;
|
||||
dst_ptr += dst_pixels_per_line;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
static int q2mbl(int x) {
|
||||
if (x < 20) x = 20;
|
||||
|
||||
x = 50 + (x - 50) * 10 / 8;
|
||||
return x * x / 3;
|
||||
}
|
||||
|
||||
void vp10_mbpost_proc_across_ip_c(uint8_t *src, int pitch,
|
||||
int rows, int cols, int flimit) {
|
||||
int r, c, i;
|
||||
uint8_t *s = src;
|
||||
uint8_t d[16];
|
||||
|
||||
for (r = 0; r < rows; r++) {
|
||||
int sumsq = 0;
|
||||
int sum = 0;
|
||||
|
||||
for (i = -8; i <= 6; i++) {
|
||||
sumsq += s[i] * s[i];
|
||||
sum += s[i];
|
||||
d[i + 8] = 0;
|
||||
}
|
||||
|
||||
for (c = 0; c < cols + 8; c++) {
|
||||
int x = s[c + 7] - s[c - 8];
|
||||
int y = s[c + 7] + s[c - 8];
|
||||
|
||||
sum += x;
|
||||
sumsq += x * y;
|
||||
|
||||
d[c & 15] = s[c];
|
||||
|
||||
if (sumsq * 15 - sum * sum < flimit) {
|
||||
d[c & 15] = (8 + sum + s[c]) >> 4;
|
||||
}
|
||||
|
||||
s[c - 8] = d[(c - 8) & 15];
|
||||
}
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void vp10_highbd_mbpost_proc_across_ip_c(uint16_t *src, int pitch,
|
||||
int rows, int cols, int flimit) {
|
||||
int r, c, i;
|
||||
|
||||
uint16_t *s = src;
|
||||
uint16_t d[16];
|
||||
|
||||
|
||||
for (r = 0; r < rows; r++) {
|
||||
int sumsq = 0;
|
||||
int sum = 0;
|
||||
|
||||
for (i = -8; i <= 6; i++) {
|
||||
sumsq += s[i] * s[i];
|
||||
sum += s[i];
|
||||
d[i + 8] = 0;
|
||||
}
|
||||
|
||||
for (c = 0; c < cols + 8; c++) {
|
||||
int x = s[c + 7] - s[c - 8];
|
||||
int y = s[c + 7] + s[c - 8];
|
||||
|
||||
sum += x;
|
||||
sumsq += x * y;
|
||||
|
||||
d[c & 15] = s[c];
|
||||
|
||||
if (sumsq * 15 - sum * sum < flimit) {
|
||||
d[c & 15] = (8 + sum + s[c]) >> 4;
|
||||
}
|
||||
|
||||
s[c - 8] = d[(c - 8) & 15];
|
||||
}
|
||||
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
void vp10_mbpost_proc_down_c(uint8_t *dst, int pitch,
|
||||
int rows, int cols, int flimit) {
|
||||
int r, c, i;
|
||||
const short *rv3 = &vp10_rv[63 & rand()]; // NOLINT
|
||||
|
||||
for (c = 0; c < cols; c++) {
|
||||
uint8_t *s = &dst[c];
|
||||
int sumsq = 0;
|
||||
int sum = 0;
|
||||
uint8_t d[16];
|
||||
const short *rv2 = rv3 + ((c * 17) & 127);
|
||||
|
||||
for (i = -8; i <= 6; i++) {
|
||||
sumsq += s[i * pitch] * s[i * pitch];
|
||||
sum += s[i * pitch];
|
||||
}
|
||||
|
||||
for (r = 0; r < rows + 8; r++) {
|
||||
sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch];
|
||||
sum += s[7 * pitch] - s[-8 * pitch];
|
||||
d[r & 15] = s[0];
|
||||
|
||||
if (sumsq * 15 - sum * sum < flimit) {
|
||||
d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4;
|
||||
}
|
||||
|
||||
s[-8 * pitch] = d[(r - 8) & 15];
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void vp10_highbd_mbpost_proc_down_c(uint16_t *dst, int pitch,
|
||||
int rows, int cols, int flimit) {
|
||||
int r, c, i;
|
||||
const int16_t *rv3 = &vp10_rv[63 & rand()]; // NOLINT
|
||||
|
||||
for (c = 0; c < cols; c++) {
|
||||
uint16_t *s = &dst[c];
|
||||
int sumsq = 0;
|
||||
int sum = 0;
|
||||
uint16_t d[16];
|
||||
const int16_t *rv2 = rv3 + ((c * 17) & 127);
|
||||
|
||||
for (i = -8; i <= 6; i++) {
|
||||
sumsq += s[i * pitch] * s[i * pitch];
|
||||
sum += s[i * pitch];
|
||||
}
|
||||
|
||||
for (r = 0; r < rows + 8; r++) {
|
||||
sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch];
|
||||
sum += s[7 * pitch] - s[-8 * pitch];
|
||||
d[r & 15] = s[0];
|
||||
|
||||
if (sumsq * 15 - sum * sum < flimit) {
|
||||
d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4;
|
||||
}
|
||||
|
||||
s[-8 * pitch] = d[(r - 8) & 15];
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
|
||||
YV12_BUFFER_CONFIG *post,
|
||||
int q,
|
||||
int low_var_thresh,
|
||||
int flag) {
|
||||
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
|
||||
int ppl = (int)(level + .5);
|
||||
(void) low_var_thresh;
|
||||
(void) flag;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (source->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
vp10_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->y_buffer),
|
||||
CONVERT_TO_SHORTPTR(post->y_buffer),
|
||||
source->y_stride, post->y_stride,
|
||||
source->y_height, source->y_width,
|
||||
ppl);
|
||||
|
||||
vp10_highbd_mbpost_proc_across_ip(CONVERT_TO_SHORTPTR(post->y_buffer),
|
||||
post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_highbd_mbpost_proc_down(CONVERT_TO_SHORTPTR(post->y_buffer),
|
||||
post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->u_buffer),
|
||||
CONVERT_TO_SHORTPTR(post->u_buffer),
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width,
|
||||
ppl);
|
||||
vp10_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->v_buffer),
|
||||
CONVERT_TO_SHORTPTR(post->v_buffer),
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width,
|
||||
ppl);
|
||||
} else {
|
||||
vp10_post_proc_down_and_across(source->y_buffer, post->y_buffer,
|
||||
source->y_stride, post->y_stride,
|
||||
source->y_height, source->y_width, ppl);
|
||||
|
||||
vp10_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_post_proc_down_and_across(source->u_buffer, post->u_buffer,
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
vp10_post_proc_down_and_across(source->v_buffer, post->v_buffer,
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
}
|
||||
#else
|
||||
vp10_post_proc_down_and_across(source->y_buffer, post->y_buffer,
|
||||
source->y_stride, post->y_stride,
|
||||
source->y_height, source->y_width, ppl);
|
||||
|
||||
vp10_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
|
||||
post->y_width, q2mbl(q));
|
||||
|
||||
vp10_post_proc_down_and_across(source->u_buffer, post->u_buffer,
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
vp10_post_proc_down_and_across(source->v_buffer, post->v_buffer,
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
void vp10_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
|
||||
int q) {
|
||||
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
|
||||
+ 0.0065 + 0.5);
|
||||
int i;
|
||||
|
||||
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
|
||||
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
|
||||
const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
|
||||
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
|
||||
|
||||
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
|
||||
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
assert((src->flags & YV12_FLAG_HIGHBITDEPTH) ==
|
||||
(dst->flags & YV12_FLAG_HIGHBITDEPTH));
|
||||
if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
vp10_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(srcs[i]),
|
||||
CONVERT_TO_SHORTPTR(dsts[i]),
|
||||
src_strides[i], dst_strides[i],
|
||||
src_heights[i], src_widths[i], ppl);
|
||||
} else {
|
||||
vp10_post_proc_down_and_across(srcs[i], dsts[i],
|
||||
src_strides[i], dst_strides[i],
|
||||
src_heights[i], src_widths[i], ppl);
|
||||
}
|
||||
#else
|
||||
vp10_post_proc_down_and_across(srcs[i], dsts[i],
|
||||
src_strides[i], dst_strides[i],
|
||||
src_heights[i], src_widths[i], ppl);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
|
||||
int q) {
|
||||
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
|
||||
+ 0.0065 + 0.5);
|
||||
int i;
|
||||
|
||||
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
|
||||
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
|
||||
const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
|
||||
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
|
||||
|
||||
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
|
||||
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
const int src_stride = src_strides[i];
|
||||
const int src_width = src_widths[i] - 4;
|
||||
const int src_height = src_heights[i] - 4;
|
||||
const int dst_stride = dst_strides[i];
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
assert((src->flags & YV12_FLAG_HIGHBITDEPTH) ==
|
||||
(dst->flags & YV12_FLAG_HIGHBITDEPTH));
|
||||
if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
const uint16_t *const src_plane = CONVERT_TO_SHORTPTR(
|
||||
srcs[i] + 2 * src_stride + 2);
|
||||
uint16_t *const dst_plane = CONVERT_TO_SHORTPTR(
|
||||
dsts[i] + 2 * dst_stride + 2);
|
||||
vp10_highbd_post_proc_down_and_across(src_plane, dst_plane, src_stride,
|
||||
dst_stride, src_height, src_width,
|
||||
ppl);
|
||||
} else {
|
||||
const uint8_t *const src_plane = srcs[i] + 2 * src_stride + 2;
|
||||
uint8_t *const dst_plane = dsts[i] + 2 * dst_stride + 2;
|
||||
|
||||
vp10_post_proc_down_and_across(src_plane, dst_plane, src_stride,
|
||||
dst_stride, src_height, src_width, ppl);
|
||||
}
|
||||
#else
|
||||
const uint8_t *const src_plane = srcs[i] + 2 * src_stride + 2;
|
||||
uint8_t *const dst_plane = dsts[i] + 2 * dst_stride + 2;
|
||||
vp10_post_proc_down_and_across(src_plane, dst_plane, src_stride, dst_stride,
|
||||
src_height, src_width, ppl);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static double gaussian(double sigma, double mu, double x) {
|
||||
return 1 / (sigma * sqrt(2.0 * 3.14159265)) *
|
||||
(exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
|
||||
}
|
||||
|
||||
static void fillrd(struct postproc_state *state, int q, int a) {
|
||||
char char_dist[300];
|
||||
|
||||
double sigma;
|
||||
int ai = a, qi = q, i;
|
||||
|
||||
vpx_clear_system_state();
|
||||
|
||||
sigma = ai + .5 + .6 * (63 - qi) / 63.0;
|
||||
|
||||
/* set up a lookup table of 256 entries that matches
|
||||
* a gaussian distribution with sigma determined by q.
|
||||
*/
|
||||
{
|
||||
int next, j;
|
||||
|
||||
next = 0;
|
||||
|
||||
for (i = -32; i < 32; i++) {
|
||||
int a_i = (int)(0.5 + 256 * gaussian(sigma, 0, i));
|
||||
|
||||
if (a_i) {
|
||||
for (j = 0; j < a_i; j++) {
|
||||
char_dist[next + j] = (char) i;
|
||||
}
|
||||
|
||||
next = next + j;
|
||||
}
|
||||
}
|
||||
|
||||
for (; next < 256; next++)
|
||||
char_dist[next] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3072; i++) {
|
||||
state->noise[i] = char_dist[rand() & 0xff]; // NOLINT
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
state->blackclamp[i] = -char_dist[0];
|
||||
state->whiteclamp[i] = -char_dist[0];
|
||||
state->bothclamp[i] = -2 * char_dist[0];
|
||||
}
|
||||
|
||||
state->last_q = q;
|
||||
state->last_noise = a;
|
||||
}
|
||||
|
||||
void vp10_plane_add_noise_c(uint8_t *start, char *noise,
|
||||
char blackclamp[16],
|
||||
char whiteclamp[16],
|
||||
char bothclamp[16],
|
||||
unsigned int width, unsigned int height, int pitch) {
|
||||
unsigned int i, j;
|
||||
|
||||
// TODO(jbb): why does simd code use both but c doesn't, normalize and
|
||||
// fix..
|
||||
(void) bothclamp;
|
||||
for (i = 0; i < height; i++) {
|
||||
uint8_t *pos = start + i * pitch;
|
||||
char *ref = (char *)(noise + (rand() & 0xff)); // NOLINT
|
||||
|
||||
for (j = 0; j < width; j++) {
|
||||
if (pos[j] < blackclamp[0])
|
||||
pos[j] = blackclamp[0];
|
||||
|
||||
if (pos[j] > 255 + whiteclamp[0])
|
||||
pos[j] = 255 + whiteclamp[0];
|
||||
|
||||
pos[j] += ref[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void swap_mi_and_prev_mi(VP10_COMMON *cm) {
|
||||
// Current mip will be the prev_mip for the next frame.
|
||||
MODE_INFO *temp = cm->postproc_state.prev_mip;
|
||||
cm->postproc_state.prev_mip = cm->mip;
|
||||
cm->mip = temp;
|
||||
|
||||
// Update the upper left visible macroblock ptrs.
|
||||
cm->mi = cm->mip + cm->mi_stride + 1;
|
||||
cm->postproc_state.prev_mi = cm->postproc_state.prev_mip + cm->mi_stride + 1;
|
||||
}
|
||||
|
||||
int vp10_post_proc_frame(struct VP10Common *cm,
|
||||
YV12_BUFFER_CONFIG *dest, vp10_ppflags_t *ppflags) {
|
||||
const int q = VPXMIN(105, cm->lf.filter_level * 2);
|
||||
const int flags = ppflags->post_proc_flag;
|
||||
YV12_BUFFER_CONFIG *const ppbuf = &cm->post_proc_buffer;
|
||||
struct postproc_state *const ppstate = &cm->postproc_state;
|
||||
|
||||
if (!cm->frame_to_show)
|
||||
return -1;
|
||||
|
||||
if (!flags) {
|
||||
*dest = *cm->frame_to_show;
|
||||
return 0;
|
||||
}
|
||||
|
||||
vpx_clear_system_state();
|
||||
|
||||
// Alloc memory for prev_mip in the first frame.
|
||||
if (cm->current_video_frame == 1) {
|
||||
cm->postproc_state.last_base_qindex = cm->base_qindex;
|
||||
cm->postproc_state.last_frame_valid = 1;
|
||||
ppstate->prev_mip = vpx_calloc(cm->mi_alloc_size, sizeof(*cm->mip));
|
||||
if (!ppstate->prev_mip) {
|
||||
return 1;
|
||||
}
|
||||
ppstate->prev_mi = ppstate->prev_mip + cm->mi_stride + 1;
|
||||
memset(ppstate->prev_mip, 0,
|
||||
cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip));
|
||||
}
|
||||
|
||||
// Allocate post_proc_buffer_int if needed.
|
||||
if ((flags & VP9D_MFQE) && !cm->post_proc_buffer_int.buffer_alloc) {
|
||||
if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) {
|
||||
const int width = ALIGN_POWER_OF_TWO(cm->width, 4);
|
||||
const int height = ALIGN_POWER_OF_TWO(cm->height, 4);
|
||||
|
||||
if (vpx_alloc_frame_buffer(&cm->post_proc_buffer_int, width, height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
cm->use_highbitdepth,
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
VP9_ENC_BORDER_IN_PIXELS,
|
||||
cm->byte_alignment) < 0) {
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate MFQE framebuffer");
|
||||
}
|
||||
|
||||
// Ensure that postproc is set to all 0s so that post proc
|
||||
// doesn't pull random data in from edge.
|
||||
memset(cm->post_proc_buffer_int.buffer_alloc, 128,
|
||||
cm->post_proc_buffer.frame_size);
|
||||
}
|
||||
}
|
||||
|
||||
if (vpx_realloc_frame_buffer(&cm->post_proc_buffer, cm->width, cm->height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
cm->use_highbitdepth,
|
||||
#endif
|
||||
VP9_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
|
||||
NULL, NULL, NULL) < 0)
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate post-processing buffer");
|
||||
|
||||
if ((flags & VP9D_MFQE) && cm->current_video_frame >= 2 &&
|
||||
cm->postproc_state.last_frame_valid && cm->bit_depth == 8 &&
|
||||
cm->postproc_state.last_base_qindex <= last_q_thresh &&
|
||||
cm->base_qindex - cm->postproc_state.last_base_qindex >= q_diff_thresh) {
|
||||
vp10_mfqe(cm);
|
||||
// TODO(jackychen): Consider whether enable deblocking by default
|
||||
// if mfqe is enabled. Need to take both the quality and the speed
|
||||
// into consideration.
|
||||
if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) {
|
||||
vp8_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int);
|
||||
}
|
||||
if ((flags & VP9D_DEMACROBLOCK) && cm->post_proc_buffer_int.buffer_alloc) {
|
||||
deblock_and_de_macro_block(&cm->post_proc_buffer_int, ppbuf,
|
||||
q + (ppflags->deblocking_level - 5) * 10,
|
||||
1, 0);
|
||||
} else if (flags & VP9D_DEBLOCK) {
|
||||
vp10_deblock(&cm->post_proc_buffer_int, ppbuf, q);
|
||||
} else {
|
||||
vp8_yv12_copy_frame(&cm->post_proc_buffer_int, ppbuf);
|
||||
}
|
||||
} else if (flags & VP9D_DEMACROBLOCK) {
|
||||
deblock_and_de_macro_block(cm->frame_to_show, ppbuf,
|
||||
q + (ppflags->deblocking_level - 5) * 10, 1, 0);
|
||||
} else if (flags & VP9D_DEBLOCK) {
|
||||
vp10_deblock(cm->frame_to_show, ppbuf, q);
|
||||
} else {
|
||||
vp8_yv12_copy_frame(cm->frame_to_show, ppbuf);
|
||||
}
|
||||
|
||||
cm->postproc_state.last_base_qindex = cm->base_qindex;
|
||||
cm->postproc_state.last_frame_valid = 1;
|
||||
|
||||
if (flags & VP9D_ADDNOISE) {
|
||||
const int noise_level = ppflags->noise_level;
|
||||
if (ppstate->last_q != q ||
|
||||
ppstate->last_noise != noise_level) {
|
||||
fillrd(ppstate, 63 - q, noise_level);
|
||||
}
|
||||
|
||||
vp10_plane_add_noise(ppbuf->y_buffer, ppstate->noise, ppstate->blackclamp,
|
||||
ppstate->whiteclamp, ppstate->bothclamp,
|
||||
ppbuf->y_width, ppbuf->y_height, ppbuf->y_stride);
|
||||
}
|
||||
|
||||
*dest = *ppbuf;
|
||||
|
||||
/* handle problem with extending borders */
|
||||
dest->y_width = cm->width;
|
||||
dest->y_height = cm->height;
|
||||
dest->uv_width = dest->y_width >> cm->subsampling_x;
|
||||
dest->uv_height = dest->y_height >> cm->subsampling_y;
|
||||
|
||||
swap_mi_and_prev_mi(cm);
|
||||
return 0;
|
||||
}
|
||||
#endif // CONFIG_VP9_POSTPROC
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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 VP10_COMMON_POSTPROC_H_
|
||||
#define VP10_COMMON_POSTPROC_H_
|
||||
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vp10/common/blockd.h"
|
||||
#include "vp10/common/mfqe.h"
|
||||
#include "vp10/common/ppflags.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct postproc_state {
|
||||
int last_q;
|
||||
int last_noise;
|
||||
char noise[3072];
|
||||
int last_base_qindex;
|
||||
int last_frame_valid;
|
||||
MODE_INFO *prev_mip;
|
||||
MODE_INFO *prev_mi;
|
||||
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
||||
};
|
||||
|
||||
struct VP10Common;
|
||||
|
||||
#define MFQE_PRECISION 4
|
||||
|
||||
int vp10_post_proc_frame(struct VP10Common *cm,
|
||||
YV12_BUFFER_CONFIG *dest, vp10_ppflags_t *flags);
|
||||
|
||||
void vp10_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
||||
|
||||
void vp10_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // VP10_COMMON_POSTPROC_H_
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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 VP10_COMMON_PPFLAGS_H_
|
||||
#define VP10_COMMON_PPFLAGS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
VP9D_NOFILTERING = 0,
|
||||
VP9D_DEBLOCK = 1 << 0,
|
||||
VP9D_DEMACROBLOCK = 1 << 1,
|
||||
VP9D_ADDNOISE = 1 << 2,
|
||||
VP9D_DEBUG_TXT_FRAME_INFO = 1 << 3,
|
||||
VP9D_DEBUG_TXT_MBLK_MODES = 1 << 4,
|
||||
VP9D_DEBUG_TXT_DC_DIFF = 1 << 5,
|
||||
VP9D_DEBUG_TXT_RATE_INFO = 1 << 6,
|
||||
VP9D_DEBUG_DRAW_MV = 1 << 7,
|
||||
VP9D_DEBUG_CLR_BLK_MODES = 1 << 8,
|
||||
VP9D_DEBUG_CLR_FRM_REF_BLKS = 1 << 9,
|
||||
VP9D_MFQE = 1 << 10
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int post_proc_flag;
|
||||
int deblocking_level;
|
||||
int noise_level;
|
||||
} vp10_ppflags_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // VP10_COMMON_PPFLAGS_H_
|
@ -47,7 +47,7 @@ static const int16_t dc_qlookup[QINDEX_RANGE] = {
|
||||
1022, 1058, 1098, 1139, 1184, 1232, 1282, 1336,
|
||||
};
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static const int16_t dc_qlookup_10[QINDEX_RANGE] = {
|
||||
4, 9, 10, 13, 15, 17, 20, 22,
|
||||
25, 28, 31, 34, 37, 40, 43, 47,
|
||||
@ -154,7 +154,7 @@ static const int16_t ac_qlookup[QINDEX_RANGE] = {
|
||||
1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828,
|
||||
};
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static const int16_t ac_qlookup_10[QINDEX_RANGE] = {
|
||||
4, 9, 11, 13, 16, 18, 21, 24,
|
||||
27, 30, 33, 37, 40, 44, 48, 51,
|
||||
@ -227,7 +227,7 @@ static const int16_t ac_qlookup_12[QINDEX_RANGE] = {
|
||||
#endif
|
||||
|
||||
int16_t vp10_dc_quant(int qindex, int delta, vpx_bit_depth_t bit_depth) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
switch (bit_depth) {
|
||||
case VPX_BITS_8:
|
||||
return dc_qlookup[clamp(qindex + delta, 0, MAXQ)];
|
||||
@ -246,7 +246,7 @@ int16_t vp10_dc_quant(int qindex, int delta, vpx_bit_depth_t bit_depth) {
|
||||
}
|
||||
|
||||
int16_t vp10_ac_quant(int qindex, int delta, vpx_bit_depth_t bit_depth) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
switch (bit_depth) {
|
||||
case VPX_BITS_8:
|
||||
return ac_qlookup[clamp(qindex + delta, 0, MAXQ)];
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vp10/common/reconinter.h"
|
||||
#include "vp10/common/reconintra.h"
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const MV *src_mv,
|
||||
@ -40,7 +40,7 @@ void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
high_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
|
||||
sf, w, h, ref, kernel, sf->x_step_q4, sf->y_step_q4, bd);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
void vp10_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
@ -112,7 +112,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
|
||||
pre += (scaled_mv.row >> SUBPEL_BITS) * pre_buf->stride
|
||||
+ (scaled_mv.col >> SUBPEL_BITS);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
high_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
|
||||
subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys,
|
||||
@ -124,7 +124,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
|
||||
#else
|
||||
inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
|
||||
subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane,
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
const uint8_t *pre =
|
||||
&pd->pre[ref].buf[(ir * pd->pre[ref].stride + ic) << 2];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
vp10_highbd_build_inter_predictor(pre, pd->pre[ref].stride,
|
||||
dst, pd->dst.stride,
|
||||
@ -171,7 +171,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane,
|
||||
kernel, MV_PRECISION_Q3,
|
||||
mi_col * MI_SIZE + 4 * ic,
|
||||
mi_row * MI_SIZE + 4 * ir);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
|
||||
kernel[subpel_x], xs, kernel[subpel_y], ys, w, h);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static INLINE void high_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int subpel_x,
|
||||
@ -46,7 +46,7 @@ static INLINE void high_inter_predictor(const uint8_t *src, int src_stride,
|
||||
src, src_stride, dst, dst_stride,
|
||||
kernel[subpel_x], xs, kernel[subpel_y], ys, w, h, bd);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
static INLINE int round_mv_comp_q4(int value) {
|
||||
return (value < 0 ? value - 2 : value + 2) / 4;
|
||||
@ -83,9 +83,9 @@ static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd,
|
||||
// If the MV points so far into the UMV border that no visible pixels
|
||||
// are used for reconstruction, the subpel part of the MV can be
|
||||
// discarded and the MV limited to 16 pixels with equivalent results.
|
||||
const int spel_left = (VP9_INTERP_EXTEND + bw) << SUBPEL_BITS;
|
||||
const int spel_left = (VPX_INTERP_EXTEND + bw) << SUBPEL_BITS;
|
||||
const int spel_right = spel_left - SUBPEL_SHIFTS;
|
||||
const int spel_top = (VP9_INTERP_EXTEND + bh) << SUBPEL_BITS;
|
||||
const int spel_top = (VPX_INTERP_EXTEND + bh) << SUBPEL_BITS;
|
||||
const int spel_bottom = spel_top - SUBPEL_SHIFTS;
|
||||
MV clamped_mv = {
|
||||
src_mv->row * (1 << (1 - ss_y)),
|
||||
@ -156,7 +156,7 @@ void vp10_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
enum mv_precision precision,
|
||||
int x, int y);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const MV *mv_q3,
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/vpx_once.h"
|
||||
@ -196,13 +196,13 @@ typedef void (*intra_pred_fn)(uint8_t *dst, ptrdiff_t stride,
|
||||
static intra_pred_fn pred[INTRA_MODES][TX_SIZES];
|
||||
static intra_pred_fn dc_pred[2][2][TX_SIZES];
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
typedef void (*intra_high_pred_fn)(uint16_t *dst, ptrdiff_t stride,
|
||||
const uint16_t *above, const uint16_t *left,
|
||||
int bd);
|
||||
static intra_high_pred_fn pred_high[INTRA_MODES][4];
|
||||
static intra_high_pred_fn dc_pred_high[2][2][4];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
static void vp10_init_intra_predictors_internal(void) {
|
||||
#define INIT_NO_4X4(p, type) \
|
||||
@ -235,7 +235,7 @@ static void vp10_init_intra_predictors_internal(void) {
|
||||
INIT_ALL_SIZES(dc_pred[1][0], dc_left);
|
||||
INIT_ALL_SIZES(dc_pred[1][1], dc);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
INIT_ALL_SIZES(pred_high[V_PRED], highbd_v);
|
||||
INIT_ALL_SIZES(pred_high[H_PRED], highbd_h);
|
||||
#if CONFIG_MISC_FIXES
|
||||
@ -256,7 +256,7 @@ static void vp10_init_intra_predictors_internal(void) {
|
||||
INIT_ALL_SIZES(dc_pred_high[0][1], highbd_dc_top);
|
||||
INIT_ALL_SIZES(dc_pred_high[1][0], highbd_dc_left);
|
||||
INIT_ALL_SIZES(dc_pred_high[1][1], highbd_dc);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
#undef intra_pred_allsizes
|
||||
}
|
||||
@ -268,7 +268,7 @@ static INLINE void memset16(uint16_t *dst, int val, int n) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
||||
const uint8_t *ref8,
|
||||
int ref_stride,
|
||||
@ -501,7 +501,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
||||
xd->bd);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // CONFIG_VPX_HIGHBITDEPTH
|
||||
|
||||
static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
||||
int ref_stride, uint8_t *dst, int dst_stride,
|
||||
@ -754,7 +754,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
build_intra_predictors_high(xd, ref, ref_stride, dst, dst_stride, mode,
|
||||
tx_size,
|
||||
@ -775,7 +775,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
||||
x, y, plane);
|
||||
#else // CONFIG_MISC_FIXES
|
||||
(void) bhl_in;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
build_intra_predictors_high(xd, ref, ref_stride, dst, dst_stride, mode,
|
||||
tx_size, have_top, have_left, have_right,
|
||||
|
@ -44,7 +44,7 @@ MV32 vp10_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf) {
|
||||
return res;
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_setup_scale_factors_for_frame(struct scale_factors *sf,
|
||||
int other_w, int other_h,
|
||||
int this_w, int this_h,
|
||||
@ -119,7 +119,7 @@ void vp10_setup_scale_factors_for_frame(struct scale_factors *sf,
|
||||
// 2D subpel motion always gets filtered in both directions
|
||||
sf->predict[1][1][0] = vpx_convolve8;
|
||||
sf->predict[1][1][1] = vpx_convolve8_avg;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
if (use_highbd) {
|
||||
if (sf->x_step_q4 == 16) {
|
||||
if (sf->y_step_q4 == 16) {
|
||||
|
@ -32,14 +32,14 @@ struct scale_factors {
|
||||
int (*scale_value_y)(int val, const struct scale_factors *sf);
|
||||
|
||||
convolve_fn_t predict[2][2][2]; // horiz, vert, avg
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
highbd_convolve_fn_t highbd_predict[2][2][2]; // horiz, vert, avg
|
||||
#endif
|
||||
};
|
||||
|
||||
MV32 vp10_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
void vp10_setup_scale_factors_for_frame(struct scale_factors *sf,
|
||||
int other_w, int other_h,
|
||||
int this_w, int this_h,
|
||||
|
@ -34,7 +34,7 @@ static INLINE void mutex_lock(pthread_mutex_t *const mutex) {
|
||||
}
|
||||
#endif // CONFIG_MULTITHREAD
|
||||
|
||||
static INLINE void sync_read(VP9LfSync *const lf_sync, int r, int c) {
|
||||
static INLINE void sync_read(VP10LfSync *const lf_sync, int r, int c) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
const int nsync = lf_sync->sync_range;
|
||||
|
||||
@ -54,7 +54,7 @@ static INLINE void sync_read(VP9LfSync *const lf_sync, int r, int c) {
|
||||
#endif // CONFIG_MULTITHREAD
|
||||
}
|
||||
|
||||
static INLINE void sync_write(VP9LfSync *const lf_sync, int r, int c,
|
||||
static INLINE void sync_write(VP10LfSync *const lf_sync, int r, int c,
|
||||
const int sb_cols) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
const int nsync = lf_sync->sync_range;
|
||||
@ -92,7 +92,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
|
||||
VP10_COMMON *const cm,
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
int start, int stop, int y_only,
|
||||
VP9LfSync *const lf_sync) {
|
||||
VP10LfSync *const lf_sync) {
|
||||
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
||||
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
|
||||
int mi_row, mi_col;
|
||||
@ -146,7 +146,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
|
||||
}
|
||||
|
||||
// Row-based multi-threaded loopfilter hook
|
||||
static int loop_filter_row_worker(VP9LfSync *const lf_sync,
|
||||
static int loop_filter_row_worker(VP10LfSync *const lf_sync,
|
||||
LFWorkerData *const lf_data) {
|
||||
thread_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, lf_data->planes,
|
||||
lf_data->start, lf_data->stop, lf_data->y_only,
|
||||
@ -159,7 +159,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame,
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
int start, int stop, int y_only,
|
||||
VPxWorker *workers, int nworkers,
|
||||
VP9LfSync *lf_sync) {
|
||||
VP10LfSync *lf_sync) {
|
||||
const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
|
||||
// Number of superblock rows and cols
|
||||
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
|
||||
@ -220,7 +220,7 @@ void vp10_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
|
||||
int frame_filter_level,
|
||||
int y_only, int partial_frame,
|
||||
VPxWorker *workers, int num_workers,
|
||||
VP9LfSync *lf_sync) {
|
||||
VP10LfSync *lf_sync) {
|
||||
int start_mi_row, end_mi_row, mi_rows_to_filter;
|
||||
|
||||
if (!frame_filter_level) return;
|
||||
@ -254,7 +254,7 @@ static INLINE int get_sync_range(int width) {
|
||||
}
|
||||
|
||||
// Allocate memory for lf row synchronization
|
||||
void vp10_loop_filter_alloc(VP9LfSync *lf_sync, VP10_COMMON *cm, int rows,
|
||||
void vp10_loop_filter_alloc(VP10LfSync *lf_sync, VP10_COMMON *cm, int rows,
|
||||
int width, int num_workers) {
|
||||
lf_sync->rows = rows;
|
||||
#if CONFIG_MULTITHREAD
|
||||
@ -291,7 +291,7 @@ void vp10_loop_filter_alloc(VP9LfSync *lf_sync, VP10_COMMON *cm, int rows,
|
||||
}
|
||||
|
||||
// Deallocate lf synchronization related mutex and data
|
||||
void vp10_loop_filter_dealloc(VP9LfSync *lf_sync) {
|
||||
void vp10_loop_filter_dealloc(VP10LfSync *lf_sync) {
|
||||
if (lf_sync != NULL) {
|
||||
#if CONFIG_MULTITHREAD
|
||||
int i;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user