mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-09 08:47:31 +09:00
aom: update libaom to 0ec86ac7ae1e32a7e70410fa4972a655ec3670a4
This commit is contained in:
parent
bc3f20e378
commit
eb361970c5
438 changed files with 52661 additions and 21905 deletions
1
third_party/aom/test/acm_random.h
vendored
1
third_party/aom/test/acm_random.h
vendored
|
|
@ -26,6 +26,7 @@ class ACMRandom {
|
|||
|
||||
void Reset(int seed) { random_.Reseed(seed); }
|
||||
|
||||
// Generates a random 31-bit unsigned integer from [0, 2^31).
|
||||
uint32_t Rand31(void) {
|
||||
return random_.Generate(testing::internal::Random::kMaxRange);
|
||||
}
|
||||
|
|
|
|||
2
third_party/aom/test/active_map_test.cc
vendored
2
third_party/aom/test/active_map_test.cc
vendored
|
|
@ -37,7 +37,7 @@ class ActiveMapTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, cpu_used_);
|
||||
} else if (video->frame() == 3) {
|
||||
aom_active_map_t map = aom_active_map_t();
|
||||
|
|
|
|||
2
third_party/aom/test/aq_segment_test.cc
vendored
2
third_party/aom/test/aq_segment_test.cc
vendored
|
|
@ -35,7 +35,7 @@ class AqSegmentTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(AV1E_SET_AQ_MODE, aq_mode_);
|
||||
encoder->Control(AV1E_SET_DELTAQ_MODE, deltaq_mode_);
|
||||
|
|
|
|||
4
third_party/aom/test/arf_freq_test.cc
vendored
4
third_party/aom/test/arf_freq_test.cc
vendored
|
|
@ -9,6 +9,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
|
|
@ -185,7 +187,7 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) {
|
|||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
if (cfg_.g_bit_depth > 8) init_flags_ |= AOM_CODEC_USE_HIGHBITDEPTH;
|
||||
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
|
||||
std::unique_ptr<libaom_test::VideoSource> video;
|
||||
if (is_extension_y4m(test_video_param_.filename)) {
|
||||
video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
kFrames));
|
||||
|
|
|
|||
105
third_party/aom/test/av1_convolve_2d_test.cc
vendored
105
third_party/aom/test/av1_convolve_2d_test.cc
vendored
|
|
@ -12,13 +12,14 @@
|
|||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
#include "test/av1_convolve_2d_test_util.h"
|
||||
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::AV1Convolve2D::AV1Convolve2DSrTest;
|
||||
using libaom_test::AV1Convolve2D::AV1JntConvolve2DTest;
|
||||
using libaom_test::AV1HighbdConvolve2D::AV1HighbdConvolve2DSrTest;
|
||||
using libaom_test::AV1HighbdConvolve2D::AV1HighbdJntConvolve2DTest;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST_P(AV1Convolve2DSrTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(0)); }
|
||||
|
|
@ -89,68 +90,72 @@ INSTANTIATE_TEST_CASE_P(NEON_COPY, AV1Convolve2DSrTest,
|
|||
TEST_P(AV1JntConvolve2DTest, CheckOutput) { RunCheckOutput(GET_PARAM(0)); }
|
||||
TEST_P(AV1JntConvolve2DTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(0)); }
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C_COPY, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_2d_copy_c, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(C_COPY, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_2d_copy_c, 0, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_x_c, 1, 0));
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_dist_wtd_convolve_x_c, 1, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_y_c, 0, 1));
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_dist_wtd_convolve_y_c, 0, 1));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_COPY, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_jnt_convolve_2d_copy_sse2, 0, 0));
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_x_sse2, 1, 0));
|
||||
av1_dist_wtd_convolve_2d_copy_sse2, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_2d_sse2, 1, 1));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_y_sse2, 0, 1));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_x_sse2, 1, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_2d_ssse3, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_y_sse2, 0, 1));
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_2d_ssse3, 1, 1));
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_COPY, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_jnt_convolve_2d_copy_avx2, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_x_avx2, 1, 0));
|
||||
av1_dist_wtd_convolve_2d_copy_avx2, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_x_avx2, 1, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_y_avx2, 0, 1));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_y_avx2, 0, 1));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_2d_avx2, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_2d_avx2, 1, 1));
|
||||
#endif // HAVE_AVX2
|
||||
#endif // HAVE_SSE4_1
|
||||
#endif // HAVE_SSSE3
|
||||
#endif // HAVE_SSE2
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(NEON_COPY, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_jnt_convolve_2d_copy_neon, 0, 0));
|
||||
av1_dist_wtd_convolve_2d_copy_neon, 0, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_2d_neon, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_x_neon, 1, 0));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_2d_neon, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(NEON_X, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_x_neon, 1, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(av1_jnt_convolve_y_neon, 0, 1));
|
||||
INSTANTIATE_TEST_CASE_P(NEON_Y, AV1JntConvolve2DTest,
|
||||
libaom_test::AV1Convolve2D::BuildParams(
|
||||
av1_dist_wtd_convolve_y_neon, 0, 1));
|
||||
#endif // HAVE_NEON
|
||||
|
||||
TEST_P(AV1HighbdConvolve2DSrTest, CheckOutput) { RunCheckOutput(GET_PARAM(1)); }
|
||||
|
|
@ -209,41 +214,41 @@ TEST_P(AV1HighbdJntConvolve2DTest, DISABLED_Speed) {
|
|||
|
||||
INSTANTIATE_TEST_CASE_P(C_X, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_x_c, 1, 0));
|
||||
av1_highbd_dist_wtd_convolve_x_c, 1, 0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C_Y, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_y_c, 0, 1));
|
||||
av1_highbd_dist_wtd_convolve_y_c, 0, 1));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C_COPY, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_2d_copy_c, 0, 0));
|
||||
av1_highbd_dist_wtd_convolve_2d_copy_c, 0, 0));
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1_COPY, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_2d_copy_sse4_1, 0, 0));
|
||||
av1_highbd_dist_wtd_convolve_2d_copy_sse4_1, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_2d_sse4_1, 1, 1));
|
||||
av1_highbd_dist_wtd_convolve_2d_sse4_1, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1_X, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_x_sse4_1, 1, 0));
|
||||
av1_highbd_dist_wtd_convolve_x_sse4_1, 1, 0));
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1_Y, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_y_sse4_1, 0, 1));
|
||||
av1_highbd_dist_wtd_convolve_y_sse4_1, 0, 1));
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_COPY, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_2d_copy_avx2, 0, 0));
|
||||
av1_highbd_dist_wtd_convolve_2d_copy_avx2, 0, 0));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_2d_avx2, 1, 1));
|
||||
av1_highbd_dist_wtd_convolve_2d_avx2, 1, 1));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_X, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_x_avx2, 1, 0));
|
||||
av1_highbd_dist_wtd_convolve_x_avx2, 1, 0));
|
||||
INSTANTIATE_TEST_CASE_P(AVX2_Y, AV1HighbdJntConvolve2DTest,
|
||||
libaom_test::AV1HighbdConvolve2D::BuildParams(
|
||||
av1_highbd_jnt_convolve_y_avx2, 0, 1));
|
||||
av1_highbd_dist_wtd_convolve_y_avx2, 0, 1));
|
||||
#endif // HAVE_AVX2
|
||||
#endif // HAVE_SSE4_1
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
ConvolveParams conv_params2 =
|
||||
get_conv_params_no_round(do_average, 0, output2, MAX_SB_SIZE, 1, 8);
|
||||
|
||||
// Test special case where jnt_comp_avg is not used
|
||||
conv_params1.use_jnt_comp_avg = 0;
|
||||
conv_params2.use_jnt_comp_avg = 0;
|
||||
// Test special case where dist_wtd_comp_avg is not used
|
||||
conv_params1.use_dist_wtd_comp_avg = 0;
|
||||
conv_params2.use_dist_wtd_comp_avg = 0;
|
||||
|
||||
const int subx_range = has_subx ? 16 : 1;
|
||||
const int suby_range = has_suby ? 16 : 1;
|
||||
|
|
@ -211,9 +211,10 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
// Choose random locations within the source block
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
|
||||
av1_jnt_convolve_2d_c(input + offset_r * w + offset_c, w, output8_1,
|
||||
MAX_SB_SIZE, out_w, out_h, filter_params_x,
|
||||
filter_params_y, subx, suby, &conv_params1);
|
||||
av1_dist_wtd_convolve_2d_c(input + offset_r * w + offset_c, w,
|
||||
output8_1, MAX_SB_SIZE, out_w, out_h,
|
||||
filter_params_x, filter_params_y, subx,
|
||||
suby, &conv_params1);
|
||||
test_impl(input + offset_r * w + offset_c, w, output8_2,
|
||||
MAX_SB_SIZE, out_w, out_h, filter_params_x,
|
||||
filter_params_y, subx, suby, &conv_params2);
|
||||
|
|
@ -222,7 +223,7 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
for (int j = 0; j < out_w; ++j) {
|
||||
int idx = i * MAX_SB_SIZE + j;
|
||||
ASSERT_EQ(output1[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for av1_jnt_convolve_2d\n"
|
||||
<< "Mismatch at unit tests for av1_dist_wtd_convolve_2d\n"
|
||||
<< out_w << "x" << out_h << " Pixel mismatch at index "
|
||||
<< idx << " = (" << i << ", " << j
|
||||
<< "), sub pixel offset = (" << suby << ", " << subx << ")";
|
||||
|
|
@ -247,8 +248,8 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
// Test different combination of fwd and bck offset weights
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
conv_params1.use_jnt_comp_avg = 1;
|
||||
conv_params2.use_jnt_comp_avg = 1;
|
||||
conv_params1.use_dist_wtd_comp_avg = 1;
|
||||
conv_params2.use_dist_wtd_comp_avg = 1;
|
||||
conv_params1.fwd_offset = quant_dist_lookup_table[k][l][0];
|
||||
conv_params1.bck_offset = quant_dist_lookup_table[k][l][1];
|
||||
conv_params2.fwd_offset = quant_dist_lookup_table[k][l][0];
|
||||
|
|
@ -259,10 +260,10 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
// Choose random locations within the source block
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
|
||||
av1_jnt_convolve_2d_c(input + offset_r * w + offset_c, w,
|
||||
output8_1, MAX_SB_SIZE, out_w, out_h,
|
||||
filter_params_x, filter_params_y, subx,
|
||||
suby, &conv_params1);
|
||||
av1_dist_wtd_convolve_2d_c(input + offset_r * w + offset_c, w,
|
||||
output8_1, MAX_SB_SIZE, out_w, out_h,
|
||||
filter_params_x, filter_params_y,
|
||||
subx, suby, &conv_params1);
|
||||
test_impl(input + offset_r * w + offset_c, w, output8_2,
|
||||
MAX_SB_SIZE, out_w, out_h, filter_params_x,
|
||||
filter_params_y, subx, suby, &conv_params2);
|
||||
|
|
@ -272,7 +273,7 @@ void AV1JntConvolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
|
|||
int idx = i * MAX_SB_SIZE + j;
|
||||
ASSERT_EQ(output1[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for "
|
||||
"av1_jnt_convolve_2d\n"
|
||||
"av1_dist_wtd_convolve_2d\n"
|
||||
<< out_w << "x" << out_h << " Pixel mismatch at index "
|
||||
<< idx << " = (" << i << ", " << j
|
||||
<< "), sub pixel offset = (" << suby << ", " << subx
|
||||
|
|
@ -333,7 +334,7 @@ void AV1JntConvolve2DTest::RunSpeedTest(convolve_2d_func test_impl) {
|
|||
ConvolveParams conv_params =
|
||||
get_conv_params_no_round(do_average, 0, output, MAX_SB_SIZE, 1, 8);
|
||||
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
|
||||
// Choose random locations within the source block
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
|
||||
|
|
@ -540,8 +541,8 @@ void AV1HighbdJntConvolve2DTest::RunSpeedTest(
|
|||
ConvolveParams conv_params =
|
||||
get_conv_params_no_round(do_average, 0, output, MAX_SB_SIZE, 1, bd);
|
||||
|
||||
// Test special case where jnt_comp_avg is not used
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
// Test special case where dist_wtd_comp_avg is not used
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
|
||||
subx = 0;
|
||||
suby = 0;
|
||||
|
|
@ -601,9 +602,9 @@ void AV1HighbdJntConvolve2DTest::RunCheckOutput(
|
|||
ConvolveParams conv_params2 = get_conv_params_no_round(
|
||||
do_average, 0, output2, MAX_SB_SIZE, 1, bd);
|
||||
|
||||
// Test special case where jnt_comp_avg is not used
|
||||
conv_params1.use_jnt_comp_avg = 0;
|
||||
conv_params2.use_jnt_comp_avg = 0;
|
||||
// Test special case where dist_wtd_comp_avg is not used
|
||||
conv_params1.use_dist_wtd_comp_avg = 0;
|
||||
conv_params2.use_dist_wtd_comp_avg = 0;
|
||||
|
||||
const int subx_range = has_subx ? 16 : 1;
|
||||
const int suby_range = has_suby ? 16 : 1;
|
||||
|
|
@ -612,10 +613,10 @@ void AV1HighbdJntConvolve2DTest::RunCheckOutput(
|
|||
// Choose random locations within the source block
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
|
||||
av1_highbd_jnt_convolve_2d_c(input + offset_r * w + offset_c, w,
|
||||
output16_1, MAX_SB_SIZE, out_w, out_h,
|
||||
filter_params_x, filter_params_y, subx,
|
||||
suby, &conv_params1, bd);
|
||||
av1_highbd_dist_wtd_convolve_2d_c(
|
||||
input + offset_r * w + offset_c, w, output16_1, MAX_SB_SIZE,
|
||||
out_w, out_h, filter_params_x, filter_params_y, subx, suby,
|
||||
&conv_params1, bd);
|
||||
test_impl(input + offset_r * w + offset_c, w, output16_2,
|
||||
MAX_SB_SIZE, out_w, out_h, filter_params_x,
|
||||
filter_params_y, subx, suby, &conv_params2, bd);
|
||||
|
|
@ -648,8 +649,8 @@ void AV1HighbdJntConvolve2DTest::RunCheckOutput(
|
|||
// Test different combination of fwd and bck offset weights
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
conv_params1.use_jnt_comp_avg = 1;
|
||||
conv_params2.use_jnt_comp_avg = 1;
|
||||
conv_params1.use_dist_wtd_comp_avg = 1;
|
||||
conv_params2.use_dist_wtd_comp_avg = 1;
|
||||
conv_params1.fwd_offset = quant_dist_lookup_table[k][l][0];
|
||||
conv_params1.bck_offset = quant_dist_lookup_table[k][l][1];
|
||||
conv_params2.fwd_offset = quant_dist_lookup_table[k][l][0];
|
||||
|
|
@ -662,7 +663,7 @@ void AV1HighbdJntConvolve2DTest::RunCheckOutput(
|
|||
// Choose random locations within the source block
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
|
||||
av1_highbd_jnt_convolve_2d_c(
|
||||
av1_highbd_dist_wtd_convolve_2d_c(
|
||||
input + offset_r * w + offset_c, w, output16_1, MAX_SB_SIZE,
|
||||
out_w, out_h, filter_params_x, filter_params_y, subx, suby,
|
||||
&conv_params1, bd);
|
||||
|
|
|
|||
14
third_party/aom/test/av1_convolve_scale_test.cc
vendored
14
third_party/aom/test/av1_convolve_scale_test.cc
vendored
|
|
@ -32,9 +32,9 @@ const int kHPad = 32;
|
|||
const int kXStepQn = 16;
|
||||
const int kYStepQn = 20;
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
|
||||
enum NTaps { EIGHT_TAP, TEN_TAP, TWELVE_TAP };
|
||||
int NTapsToInt(NTaps ntaps) { return 8 + static_cast<int>(ntaps) * 2; }
|
||||
|
|
@ -286,13 +286,13 @@ class ConvolveScaleTestBase : public ::testing::Test {
|
|||
}
|
||||
|
||||
void SetConvParamOffset(int i, int j, int is_compound, int do_average,
|
||||
int use_jnt_comp_avg) {
|
||||
int use_dist_wtd_comp_avg) {
|
||||
if (i == -1 && j == -1) {
|
||||
convolve_params_.use_jnt_comp_avg = use_jnt_comp_avg;
|
||||
convolve_params_.use_dist_wtd_comp_avg = use_dist_wtd_comp_avg;
|
||||
convolve_params_.is_compound = is_compound;
|
||||
convolve_params_.do_average = do_average;
|
||||
} else {
|
||||
convolve_params_.use_jnt_comp_avg = use_jnt_comp_avg;
|
||||
convolve_params_.use_dist_wtd_comp_avg = use_dist_wtd_comp_avg;
|
||||
convolve_params_.fwd_offset = quant_dist_lookup_table[i][j][0];
|
||||
convolve_params_.bck_offset = quant_dist_lookup_table[i][j][1];
|
||||
convolve_params_.is_compound = is_compound;
|
||||
|
|
@ -312,12 +312,12 @@ class ConvolveScaleTestBase : public ::testing::Test {
|
|||
|
||||
is_compound = 1;
|
||||
for (int do_average = 0; do_average < 2; do_average++) {
|
||||
for (int use_jnt_comp_avg = 0; use_jnt_comp_avg < 2;
|
||||
use_jnt_comp_avg++) {
|
||||
for (int use_dist_wtd_comp_avg = 0; use_dist_wtd_comp_avg < 2;
|
||||
use_dist_wtd_comp_avg++) {
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
SetConvParamOffset(j, k, is_compound, do_average,
|
||||
use_jnt_comp_avg);
|
||||
use_dist_wtd_comp_avg);
|
||||
Prep(&rnd);
|
||||
RunOne(true);
|
||||
RunOne(false);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
|
|
@ -95,7 +97,7 @@ class AVxEncoderParmsGetToDecoder
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_COLOR_PRIMARIES, encode_parms.color_primaries);
|
||||
encoder->Control(AV1E_SET_TRANSFER_CHARACTERISTICS,
|
||||
encode_parms.transfer_characteristics);
|
||||
|
|
@ -146,7 +148,7 @@ class AVxEncoderParmsGetToDecoder
|
|||
TEST_P(AVxEncoderParmsGetToDecoder, BitstreamParms) {
|
||||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video(
|
||||
std::unique_ptr<libaom_test::VideoSource> video(
|
||||
new libaom_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames));
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
|
||||
|
|
|
|||
6
third_party/aom/test/av1_fwd_txfm1d_test.cc
vendored
6
third_party/aom/test/av1_fwd_txfm1d_test.cc
vendored
|
|
@ -13,12 +13,12 @@
|
|||
#include "test/av1_txfm_test.h"
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::input_base;
|
||||
using libaom_test::reference_hybrid_1d;
|
||||
using libaom_test::TYPE_ADST;
|
||||
using libaom_test::TYPE_DCT;
|
||||
using libaom_test::TYPE_IDTX;
|
||||
using libaom_test::TYPE_TXFM;
|
||||
using libaom_test::input_base;
|
||||
using libaom_test::reference_hybrid_1d;
|
||||
|
||||
namespace {
|
||||
const int txfm_type_num = 3;
|
||||
|
|
@ -56,7 +56,7 @@ TEST(av1_fwd_txfm1d, av1_cospi_arr_data) {
|
|||
for (int i = 0; i < 7; i++) {
|
||||
for (int j = 0; j < 64; j++) {
|
||||
EXPECT_EQ(av1_cospi_arr_data[i][j],
|
||||
(int32_t)round(cos(M_PI * j / 128) * (1 << (cos_bit_min + i))));
|
||||
(int32_t)round(cos(PI * j / 128) * (1 << (cos_bit_min + i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
third_party/aom/test/av1_fwd_txfm2d_test.cc
vendored
9
third_party/aom/test/av1_fwd_txfm2d_test.cc
vendored
|
|
@ -23,10 +23,10 @@
|
|||
#include "av1/encoder/hybrid_fwd_txfm.h"
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::TYPE_TXFM;
|
||||
using libaom_test::bd;
|
||||
using libaom_test::compute_avg_abs_error;
|
||||
using libaom_test::input_base;
|
||||
using libaom_test::TYPE_TXFM;
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
|
@ -507,5 +507,12 @@ INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdFwdTxfm2dTest,
|
|||
Combine(ValuesIn(Highbd_fwd_txfm_for_sse4_1),
|
||||
Values(av1_highbd_fwd_txfm)));
|
||||
#endif // HAVE_SSE4_1
|
||||
#if HAVE_AVX2
|
||||
static TX_SIZE Highbd_fwd_txfm_for_avx2[] = { TX_8X8, TX_16X16, TX_32X32,
|
||||
TX_64X64, TX_8X16, TX_16X8 };
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, AV1HighbdFwdTxfm2dTest,
|
||||
Combine(ValuesIn(Highbd_fwd_txfm_for_avx2),
|
||||
Values(av1_highbd_fwd_txfm)));
|
||||
#endif // HAVE_AVX2
|
||||
} // namespace
|
||||
|
|
|
|||
2
third_party/aom/test/av1_highbd_iht_test.cc
vendored
2
third_party/aom/test/av1_highbd_iht_test.cc
vendored
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using ::testing::tuple;
|
||||
|
||||
typedef void (*HbdHtFunc)(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd);
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ const int kPerfIters = 1000;
|
|||
const int kVPad = 32;
|
||||
const int kHPad = 32;
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
|
||||
template <typename Pixel>
|
||||
class TestImage {
|
||||
|
|
|
|||
4
third_party/aom/test/av1_inv_txfm2d_test.cc
vendored
4
third_party/aom/test/av1_inv_txfm2d_test.cc
vendored
|
|
@ -24,11 +24,11 @@
|
|||
#include "test/util.h"
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::InvTxfm2dFunc;
|
||||
using libaom_test::LbdInvTxfm2dFunc;
|
||||
using libaom_test::bd;
|
||||
using libaom_test::compute_avg_abs_error;
|
||||
using libaom_test::input_base;
|
||||
using libaom_test::InvTxfm2dFunc;
|
||||
using libaom_test::LbdInvTxfm2dFunc;
|
||||
|
||||
using ::testing::Combine;
|
||||
using ::testing::Range;
|
||||
|
|
|
|||
215
third_party/aom/test/av1_nn_predict_test.cc
vendored
Normal file
215
third_party/aom/test/av1_nn_predict_test.cc
vendored
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/aom_timer.h"
|
||||
#include "av1/encoder/ml.h"
|
||||
#include "config/aom_config.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
#include "test/util.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
|
||||
namespace {
|
||||
typedef void (*NnPredict_Func)(const float *const input_nodes,
|
||||
const NN_CONFIG *const nn_config,
|
||||
float *const output);
|
||||
|
||||
typedef ::testing::tuple<const NnPredict_Func> NnPredictTestParam;
|
||||
|
||||
const float epsilon = 1e-3f; // Error threshold for functional equivalence
|
||||
|
||||
class NnPredictTest : public ::testing::TestWithParam<NnPredictTestParam> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
const int MAX_NODES2 = NN_MAX_NODES_PER_LAYER * NN_MAX_NODES_PER_LAYER;
|
||||
// Allocate two massive buffers on the heap for edge weights and node bias
|
||||
// Then set-up the double-dimension arrays pointing into the big buffers
|
||||
weights_buf = (float *)aom_malloc(MAX_NODES2 * (NN_MAX_HIDDEN_LAYERS + 1) *
|
||||
sizeof(*weights_buf));
|
||||
bias_buf =
|
||||
(float *)aom_malloc(NN_MAX_NODES_PER_LAYER *
|
||||
(NN_MAX_HIDDEN_LAYERS + 1) * sizeof(*bias_buf));
|
||||
ASSERT_NE(weights_buf, nullptr);
|
||||
ASSERT_NE(bias_buf, nullptr);
|
||||
for (int i = 0; i < NN_MAX_HIDDEN_LAYERS + 1; i++) {
|
||||
weights[i] = &weights_buf[i * MAX_NODES2];
|
||||
bias[i] = &bias_buf[i * NN_MAX_NODES_PER_LAYER];
|
||||
}
|
||||
target_func_ = GET_PARAM(0);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
aom_free(weights_buf);
|
||||
aom_free(bias_buf);
|
||||
}
|
||||
void RunNnPredictTest(const NN_CONFIG *const shape);
|
||||
void RunNnPredictSpeedTest(const NN_CONFIG *const shape, const int run_times);
|
||||
void RunNnPredictTest_all(const NN_CONFIG *const shapes,
|
||||
const int num_shapes);
|
||||
void RunNnPredictSpeedTest_all(const NN_CONFIG *const shapes,
|
||||
const int num_shapes, const int run_times);
|
||||
|
||||
private:
|
||||
NnPredict_Func target_func_;
|
||||
libaom_test::ACMRandom rng_;
|
||||
float *weights[NN_MAX_HIDDEN_LAYERS + 1] = { 0 };
|
||||
float *bias[NN_MAX_HIDDEN_LAYERS + 1] = { 0 };
|
||||
float *weights_buf = nullptr, *bias_buf = nullptr;
|
||||
};
|
||||
|
||||
void NnPredictTest::RunNnPredictTest(const NN_CONFIG *const shape) {
|
||||
libaom_test::ClearSystemState();
|
||||
float inputs[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
float outputs_test[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
float outputs_ref[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
|
||||
NN_CONFIG nn_config;
|
||||
memcpy(&nn_config, shape, sizeof(nn_config));
|
||||
|
||||
char shape_str[32] = { 0 };
|
||||
snprintf(shape_str, sizeof(shape_str), "%d", shape->num_inputs);
|
||||
for (int layer = 0; layer < shape->num_hidden_layers; layer++)
|
||||
snprintf(&shape_str[strlen(shape_str)],
|
||||
sizeof(shape_str) - strlen(shape_str), "x%d",
|
||||
shape->num_hidden_nodes[layer]);
|
||||
snprintf(&shape_str[strlen(shape_str)], sizeof(shape_str) - strlen(shape_str),
|
||||
"x%d", shape->num_outputs);
|
||||
|
||||
for (int i = 0; i < NN_MAX_HIDDEN_LAYERS + 1; i++) {
|
||||
nn_config.weights[i] = weights[i];
|
||||
nn_config.bias[i] = bias[i];
|
||||
}
|
||||
|
||||
for (int iter = 0; iter < 10000 && !HasFatalFailure(); ++iter) {
|
||||
for (int node = 0; node < shape->num_inputs; node++) {
|
||||
inputs[node] = ((float)rng_.Rand31() - (1 << 30)) / (1u << 31);
|
||||
}
|
||||
for (int layer = 0; layer < shape->num_hidden_layers; layer++) {
|
||||
for (int node = 0; node < NN_MAX_NODES_PER_LAYER; node++) {
|
||||
bias[layer][node] = ((float)rng_.Rand31() - (1 << 30)) / (1u << 31);
|
||||
}
|
||||
for (int node = 0; node < NN_MAX_NODES_PER_LAYER * NN_MAX_NODES_PER_LAYER;
|
||||
node++) {
|
||||
weights[layer][node] = ((float)rng_.Rand31() - (1 << 30)) / (1u << 31);
|
||||
}
|
||||
}
|
||||
// Now the outputs:
|
||||
int layer = shape->num_hidden_layers;
|
||||
for (int node = 0; node < NN_MAX_NODES_PER_LAYER; node++) {
|
||||
bias[layer][node] = ((float)rng_.Rand31() - (1 << 30)) / (1u << 31);
|
||||
}
|
||||
for (int node = 0; node < NN_MAX_NODES_PER_LAYER * NN_MAX_NODES_PER_LAYER;
|
||||
node++) {
|
||||
weights[layer][node] = ((float)rng_.Rand31() - (1 << 30)) / (1u << 31);
|
||||
}
|
||||
|
||||
av1_nn_predict_c(inputs, &nn_config, outputs_ref);
|
||||
target_func_(inputs, &nn_config, outputs_test);
|
||||
libaom_test::ClearSystemState();
|
||||
|
||||
for (int node = 0; node < shape->num_outputs; node++) {
|
||||
if (outputs_ref[node] < epsilon) {
|
||||
ASSERT_LE(outputs_test[node], epsilon)
|
||||
<< "Reference output was near-zero, test output was not ("
|
||||
<< shape_str << ")";
|
||||
} else {
|
||||
const float error = outputs_ref[node] - outputs_test[node];
|
||||
const float relative_error = fabsf(error / outputs_ref[node]);
|
||||
ASSERT_LE(relative_error, epsilon)
|
||||
<< "Excessive relative error between reference and test ("
|
||||
<< shape_str << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NnPredictTest::RunNnPredictSpeedTest(const NN_CONFIG *const shape,
|
||||
const int run_times) {
|
||||
libaom_test::ClearSystemState();
|
||||
float inputs[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
float outputs_test[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
float outputs_ref[NN_MAX_NODES_PER_LAYER] = { 0 };
|
||||
|
||||
NN_CONFIG nn_config;
|
||||
memcpy(&nn_config, shape, sizeof(nn_config));
|
||||
|
||||
for (int i = 0; i < NN_MAX_HIDDEN_LAYERS; i++) {
|
||||
nn_config.weights[i] = weights[i];
|
||||
nn_config.bias[i] = bias[i];
|
||||
}
|
||||
// Don't bother actually changing the values for inputs/weights/bias: it
|
||||
// shouldn't make any difference for a speed test.
|
||||
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
av1_nn_predict_c(inputs, &nn_config, outputs_ref);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
target_func_(inputs, &nn_config, outputs_test);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
libaom_test::ClearSystemState();
|
||||
const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
|
||||
printf("%d", shape->num_inputs);
|
||||
for (int layer = 0; layer < shape->num_hidden_layers; layer++)
|
||||
printf("x%d", shape->num_hidden_nodes[layer]);
|
||||
printf("x%d: ", shape->num_outputs);
|
||||
printf("%7.2f/%7.2fns (%3.2f)\n", time1, time2, time1 / time2);
|
||||
}
|
||||
|
||||
// This is all the neural network shapes observed executed in a few different
|
||||
// runs of the encoder. It also conveniently covers all the kernels
|
||||
// implemented.
|
||||
static const NN_CONFIG shapes[] = {
|
||||
{ 10, 16, 1, { 64 }, { 0 }, { 0 } }, { 12, 1, 1, { 12 }, { 0 }, { 0 } },
|
||||
{ 12, 1, 1, { 24 }, { 0 }, { 0 } }, { 12, 1, 1, { 32 }, { 0 }, { 0 } },
|
||||
{ 18, 4, 1, { 24 }, { 0 }, { 0 } }, { 18, 4, 1, { 32 }, { 0 }, { 0 } },
|
||||
{ 4, 1, 1, { 16 }, { 0 }, { 0 } }, { 8, 1, 1, { 16 }, { 0 }, { 0 } },
|
||||
{ 8, 4, 1, { 16 }, { 0 }, { 0 } }, { 8, 1, 1, { 24 }, { 0 }, { 0 } },
|
||||
{ 8, 1, 1, { 32 }, { 0 }, { 0 } }, { 8, 1, 1, { 64 }, { 0 }, { 0 } },
|
||||
{ 9, 3, 1, { 32 }, { 0 }, { 0 } }, { 4, 4, 1, { 8 }, { 0 }, { 0 } },
|
||||
};
|
||||
|
||||
void NnPredictTest::RunNnPredictTest_all(const NN_CONFIG *const shapes,
|
||||
const int num_shapes) {
|
||||
for (int i = 0; i < num_shapes; i++) RunNnPredictTest(&shapes[i]);
|
||||
}
|
||||
|
||||
void NnPredictTest::RunNnPredictSpeedTest_all(const NN_CONFIG *const shapes,
|
||||
const int num_shapes,
|
||||
const int run_times) {
|
||||
for (int i = 0; i < num_shapes; i++)
|
||||
NnPredictTest::RunNnPredictSpeedTest(&shapes[i], run_times);
|
||||
}
|
||||
|
||||
TEST_P(NnPredictTest, RandomValues) {
|
||||
RunNnPredictTest_all(shapes, sizeof(shapes) / sizeof(*shapes));
|
||||
}
|
||||
|
||||
TEST_P(NnPredictTest, DISABLED_Speed) {
|
||||
RunNnPredictSpeedTest_all(shapes, sizeof(shapes) / sizeof(*shapes), 10000000);
|
||||
}
|
||||
|
||||
#if HAVE_SSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSE3, NnPredictTest,
|
||||
::testing::Values(av1_nn_predict_sse3));
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom_ports/aom_timer.h"
|
||||
|
|
|
|||
4
third_party/aom/test/av1_txfm_test.cc
vendored
4
third_party/aom/test/av1_txfm_test.cc
vendored
|
|
@ -94,7 +94,7 @@ double Sqrt2 = pow(2, 0.5);
|
|||
double invSqrt2 = 1 / pow(2, 0.5);
|
||||
|
||||
double dct_matrix(double n, double k, int size) {
|
||||
return cos(M_PI * (2 * n + 1) * k / (2 * size));
|
||||
return cos(PI * (2 * n + 1) * k / (2 * size));
|
||||
}
|
||||
|
||||
void reference_dct_1d(const double *in, double *out, int size) {
|
||||
|
|
@ -179,7 +179,7 @@ void reference_adst_1d(const double *in, double *out, int size) {
|
|||
for (int k = 0; k < size; ++k) {
|
||||
out[k] = 0;
|
||||
for (int n = 0; n < size; ++n) {
|
||||
out[k] += in[n] * sin(M_PI * (2 * n + 1) * (2 * k + 1) / (4 * size));
|
||||
out[k] += in[n] * sin(PI * (2 * n + 1) * (2 * k + 1) / (4 * size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
third_party/aom/test/av1_txfm_test.h
vendored
4
third_party/aom/test/av1_txfm_test.h
vendored
|
|
@ -29,14 +29,14 @@
|
|||
#include "av1/common/enums.h"
|
||||
|
||||
namespace libaom_test {
|
||||
typedef enum {
|
||||
enum {
|
||||
TYPE_DCT = 0,
|
||||
TYPE_ADST,
|
||||
TYPE_IDTX,
|
||||
TYPE_IDCT,
|
||||
TYPE_IADST,
|
||||
TYPE_LAST
|
||||
} TYPE_TXFM;
|
||||
} UENUM1BYTE(TYPE_TXFM);
|
||||
|
||||
int get_txfm1d_size(TX_SIZE tx_size);
|
||||
|
||||
|
|
|
|||
40
third_party/aom/test/blend_a64_mask_test.cc
vendored
40
third_party/aom/test/blend_a64_mask_test.cc
vendored
|
|
@ -86,6 +86,7 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<BlendA64Func> {
|
|||
w_ = block_size_wide[block_size];
|
||||
h_ = block_size_high[block_size];
|
||||
run_times = run_times > 1 ? run_times / w_ : 1;
|
||||
ASSERT_GT(run_times, 0);
|
||||
subx_ = subx;
|
||||
suby_ = suby;
|
||||
|
||||
|
|
@ -248,13 +249,13 @@ TEST_P(BlendA64MaskTest8B, DISABLED_Speed) {
|
|||
INSTANTIATE_TEST_CASE_P(SSE4_1, BlendA64MaskTest8B,
|
||||
::testing::Values(TestFuncs(
|
||||
aom_blend_a64_mask_c, aom_blend_a64_mask_sse4_1)));
|
||||
#endif // HAVE_AVX2
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, BlendA64MaskTest8B,
|
||||
::testing::Values(TestFuncs(aom_blend_a64_mask_sse4_1,
|
||||
aom_blend_a64_mask_avx2)));
|
||||
#endif // HAVE_SSE4_1
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// 8 bit _d16 version
|
||||
|
|
@ -482,6 +483,7 @@ class BlendA64MaskTestHBD_d16
|
|||
static const int kSrcMaxBitsMaskHBD = (1 << 16) - 1;
|
||||
|
||||
void Execute(const uint16_t *p_src0, const uint16_t *p_src1, int run_times) {
|
||||
ASSERT_GT(run_times, 0) << "Cannot run 0 iterations of the test.";
|
||||
ConvolveParams conv_params;
|
||||
conv_params.round_0 = (bit_depth_ == 12) ? ROUND0_BITS + 2 : ROUND0_BITS;
|
||||
conv_params.round_1 = COMPOUND_ROUND1_BITS;
|
||||
|
|
@ -566,11 +568,45 @@ TEST_P(BlendA64MaskTestHBD_d16, DISABLED_SaturatedValues) {
|
|||
}
|
||||
}
|
||||
}
|
||||
TEST_P(BlendA64MaskTestHBD_d16, DISABLED_Speed) {
|
||||
const int kRunTimes = 10000000;
|
||||
for (int bsize = 0; bsize < BLOCK_SIZES_ALL; ++bsize) {
|
||||
for (bit_depth_ = 8; bit_depth_ <= 12; bit_depth_ += 2) {
|
||||
for (int i = 0; i < kBufSize; ++i) {
|
||||
dst_ref_[i] = rng_.Rand12() % (1 << bit_depth_);
|
||||
dst_tst_[i] = rng_.Rand12() % (1 << bit_depth_);
|
||||
|
||||
src0_[i] = rng_.Rand16();
|
||||
src1_[i] = rng_.Rand16();
|
||||
}
|
||||
|
||||
for (int i = 0; i < kMaxMaskSize; ++i)
|
||||
mask_[i] = rng_(AOM_BLEND_A64_MAX_ALPHA + 1);
|
||||
|
||||
RunOneTest(bsize, 1, 1, kRunTimes);
|
||||
RunOneTest(bsize, 0, 0, kRunTimes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, BlendA64MaskTestHBD_d16,
|
||||
::testing::Values(TestFuncsHBD_d16(aom_highbd_blend_a64_d16_mask_c, NULL)));
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, BlendA64MaskTestHBD_d16,
|
||||
::testing::Values(TestFuncsHBD_d16(aom_highbd_blend_a64_d16_mask_c,
|
||||
aom_highbd_blend_a64_d16_mask_sse4_1)));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, BlendA64MaskTestHBD_d16,
|
||||
::testing::Values(TestFuncsHBD_d16(aom_highbd_blend_a64_d16_mask_c,
|
||||
aom_highbd_blend_a64_d16_mask_avx2)));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
// TODO(slavarnway): Enable the following in the avx2 commit. (56501)
|
||||
#if 0
|
||||
#if HAVE_AVX2
|
||||
|
|
|
|||
2
third_party/aom/test/borders_test.cc
vendored
2
third_party/aom/test/borders_test.cc
vendored
|
|
@ -33,7 +33,7 @@ class BordersTestLarge
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, 1);
|
||||
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);
|
||||
|
|
|
|||
4
third_party/aom/test/cdef_test.cc
vendored
4
third_party/aom/test/cdef_test.cc
vendored
|
|
@ -116,7 +116,7 @@ void test_cdef(int bsize, int iterations, cdef_filter_block_func cdef,
|
|||
ref_cdef(depth == 8 ? (uint8_t *)ref_d : 0, ref_d, size,
|
||||
s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE,
|
||||
pristrength, secstrength, dir, pridamping,
|
||||
secdamping, bsize, (1 << depth) - 1, depth - 8);
|
||||
secdamping, bsize, depth - 8);
|
||||
// If cdef and ref_cdef are the same, we're just testing
|
||||
// speed
|
||||
if (cdef != ref_cdef)
|
||||
|
|
@ -124,7 +124,7 @@ void test_cdef(int bsize, int iterations, cdef_filter_block_func cdef,
|
|||
cdef(depth == 8 ? (uint8_t *)d : 0, d, size,
|
||||
s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE,
|
||||
pristrength, secstrength, dir, pridamping,
|
||||
secdamping, bsize, (1 << depth) - 1, depth - 8));
|
||||
secdamping, bsize, depth - 8));
|
||||
if (ref_cdef != cdef) {
|
||||
for (pos = 0; pos < max_pos && !error; pos++) {
|
||||
error = ref_d[pos] != d[pos];
|
||||
|
|
|
|||
2
third_party/aom/test/cfl_test.cc
vendored
2
third_party/aom/test/cfl_test.cc
vendored
|
|
@ -84,7 +84,7 @@ class CFLTest {
|
|||
tx_size = tx;
|
||||
width = tx_size_wide[tx_size];
|
||||
height = tx_size_high[tx_size];
|
||||
rnd(ACMRandom::DeterministicSeed());
|
||||
rnd.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
64
third_party/aom/test/comp_avg_pred_test.cc
vendored
64
third_party/aom/test/comp_avg_pred_test.cc
vendored
|
|
@ -11,62 +11,66 @@
|
|||
|
||||
#include "test/comp_avg_pred_test.h"
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::AV1DISTWTDCOMPAVG::AV1DISTWTDCOMPAVGTest;
|
||||
using libaom_test::AV1DISTWTDCOMPAVG::AV1DISTWTDCOMPAVGUPSAMPLEDTest;
|
||||
using libaom_test::AV1DISTWTDCOMPAVG::AV1HighBDDISTWTDCOMPAVGTest;
|
||||
using libaom_test::AV1DISTWTDCOMPAVG::AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::AV1JNTCOMPAVG::AV1HighBDJNTCOMPAVGTest;
|
||||
using libaom_test::AV1JNTCOMPAVG::AV1HighBDJNTCOMPAVGUPSAMPLEDTest;
|
||||
using libaom_test::AV1JNTCOMPAVG::AV1JNTCOMPAVGTest;
|
||||
using libaom_test::AV1JNTCOMPAVG::AV1JNTCOMPAVGUPSAMPLEDTest;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST_P(AV1JNTCOMPAVGTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(0)); }
|
||||
TEST_P(AV1DISTWTDCOMPAVGTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(0)); }
|
||||
|
||||
TEST_P(AV1JNTCOMPAVGTest, CheckOutput) { RunCheckOutput(GET_PARAM(0)); }
|
||||
TEST_P(AV1DISTWTDCOMPAVGTest, CheckOutput) { RunCheckOutput(GET_PARAM(0)); }
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, AV1JNTCOMPAVGTest,
|
||||
libaom_test::AV1JNTCOMPAVG::BuildParams(aom_jnt_comp_avg_pred_ssse3));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, AV1DISTWTDCOMPAVGTest,
|
||||
libaom_test::AV1DISTWTDCOMPAVG::BuildParams(
|
||||
aom_dist_wtd_comp_avg_pred_ssse3));
|
||||
#endif
|
||||
|
||||
TEST_P(AV1JNTCOMPAVGUPSAMPLEDTest, DISABLED_Speed) {
|
||||
TEST_P(AV1DISTWTDCOMPAVGUPSAMPLEDTest, DISABLED_Speed) {
|
||||
RunSpeedTest(GET_PARAM(0));
|
||||
}
|
||||
|
||||
TEST_P(AV1JNTCOMPAVGUPSAMPLEDTest, CheckOutput) {
|
||||
TEST_P(AV1DISTWTDCOMPAVGUPSAMPLEDTest, CheckOutput) {
|
||||
RunCheckOutput(GET_PARAM(0));
|
||||
}
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, AV1JNTCOMPAVGUPSAMPLEDTest,
|
||||
libaom_test::AV1JNTCOMPAVG::BuildParams(
|
||||
aom_jnt_comp_avg_upsampled_pred_ssse3));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, AV1DISTWTDCOMPAVGUPSAMPLEDTest,
|
||||
libaom_test::AV1DISTWTDCOMPAVG::BuildParams(
|
||||
aom_dist_wtd_comp_avg_upsampled_pred_ssse3));
|
||||
#endif
|
||||
|
||||
TEST_P(AV1HighBDJNTCOMPAVGTest, DISABLED_Speed) { RunSpeedTest(GET_PARAM(1)); }
|
||||
|
||||
TEST_P(AV1HighBDJNTCOMPAVGTest, CheckOutput) { RunCheckOutput(GET_PARAM(1)); }
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, AV1HighBDJNTCOMPAVGTest,
|
||||
libaom_test::AV1JNTCOMPAVG::BuildParams(
|
||||
aom_highbd_jnt_comp_avg_pred_sse2, 1));
|
||||
#endif
|
||||
|
||||
TEST_P(AV1HighBDJNTCOMPAVGUPSAMPLEDTest, DISABLED_Speed) {
|
||||
TEST_P(AV1HighBDDISTWTDCOMPAVGTest, DISABLED_Speed) {
|
||||
RunSpeedTest(GET_PARAM(1));
|
||||
}
|
||||
|
||||
TEST_P(AV1HighBDJNTCOMPAVGUPSAMPLEDTest, CheckOutput) {
|
||||
TEST_P(AV1HighBDDISTWTDCOMPAVGTest, CheckOutput) {
|
||||
RunCheckOutput(GET_PARAM(1));
|
||||
}
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, AV1HighBDJNTCOMPAVGUPSAMPLEDTest,
|
||||
libaom_test::AV1JNTCOMPAVG::BuildParams(
|
||||
aom_highbd_jnt_comp_avg_upsampled_pred_sse2));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, AV1HighBDDISTWTDCOMPAVGTest,
|
||||
libaom_test::AV1DISTWTDCOMPAVG::BuildParams(
|
||||
aom_highbd_dist_wtd_comp_avg_pred_sse2, 1));
|
||||
#endif
|
||||
|
||||
TEST_P(AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest, DISABLED_Speed) {
|
||||
RunSpeedTest(GET_PARAM(1));
|
||||
}
|
||||
|
||||
TEST_P(AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest, CheckOutput) {
|
||||
RunCheckOutput(GET_PARAM(1));
|
||||
}
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest,
|
||||
libaom_test::AV1DISTWTDCOMPAVG::BuildParams(
|
||||
aom_highbd_dist_wtd_comp_avg_upsampled_pred_sse2));
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
262
third_party/aom/test/comp_avg_pred_test.h
vendored
262
third_party/aom/test/comp_avg_pred_test.h
vendored
|
|
@ -25,72 +25,73 @@
|
|||
namespace libaom_test {
|
||||
const int kMaxSize = 128 + 32; // padding
|
||||
|
||||
namespace AV1JNTCOMPAVG {
|
||||
namespace AV1DISTWTDCOMPAVG {
|
||||
|
||||
typedef void (*jntcompavg_func)(uint8_t *comp_pred, const uint8_t *pred,
|
||||
int width, int height, const uint8_t *ref,
|
||||
int ref_stride,
|
||||
const JNT_COMP_PARAMS *jcp_param);
|
||||
typedef void (*distwtdcompavg_func)(uint8_t *comp_pred, const uint8_t *pred,
|
||||
int width, int height, const uint8_t *ref,
|
||||
int ref_stride,
|
||||
const DIST_WTD_COMP_PARAMS *jcp_param);
|
||||
|
||||
typedef void (*jntcompavgupsampled_func)(
|
||||
typedef void (*distwtdcompavgupsampled_func)(
|
||||
MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col,
|
||||
const MV *const mv, uint8_t *comp_pred, const uint8_t *pred, int width,
|
||||
int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref,
|
||||
int ref_stride, const JNT_COMP_PARAMS *jcp_param, int subpel_search);
|
||||
int ref_stride, const DIST_WTD_COMP_PARAMS *jcp_param, int subpel_search);
|
||||
|
||||
typedef void (*highbdjntcompavgupsampled_func)(
|
||||
typedef void (*highbddistwtdcompavgupsampled_func)(
|
||||
MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col,
|
||||
const MV *const mv, uint8_t *comp_pred8, const uint8_t *pred8, int width,
|
||||
int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref8,
|
||||
int ref_stride, int bd, const JNT_COMP_PARAMS *jcp_param,
|
||||
int ref_stride, int bd, const DIST_WTD_COMP_PARAMS *jcp_param,
|
||||
int subpel_search);
|
||||
|
||||
typedef ::testing::tuple<jntcompavg_func, BLOCK_SIZE> JNTCOMPAVGParam;
|
||||
typedef ::testing::tuple<distwtdcompavg_func, BLOCK_SIZE> DISTWTDCOMPAVGParam;
|
||||
|
||||
typedef ::testing::tuple<jntcompavgupsampled_func, BLOCK_SIZE>
|
||||
JNTCOMPAVGUPSAMPLEDParam;
|
||||
typedef ::testing::tuple<distwtdcompavgupsampled_func, BLOCK_SIZE>
|
||||
DISTWTDCOMPAVGUPSAMPLEDParam;
|
||||
|
||||
typedef ::testing::tuple<int, jntcompavg_func, BLOCK_SIZE>
|
||||
HighbdJNTCOMPAVGParam;
|
||||
typedef ::testing::tuple<int, distwtdcompavg_func, BLOCK_SIZE>
|
||||
HighbdDISTWTDCOMPAVGParam;
|
||||
|
||||
typedef ::testing::tuple<int, highbdjntcompavgupsampled_func, BLOCK_SIZE>
|
||||
HighbdJNTCOMPAVGUPSAMPLEDParam;
|
||||
typedef ::testing::tuple<int, highbddistwtdcompavgupsampled_func, BLOCK_SIZE>
|
||||
HighbdDISTWTDCOMPAVGUPSAMPLEDParam;
|
||||
|
||||
::testing::internal::ParamGenerator<JNTCOMPAVGParam> BuildParams(
|
||||
jntcompavg_func filter) {
|
||||
::testing::internal::ParamGenerator<DISTWTDCOMPAVGParam> BuildParams(
|
||||
distwtdcompavg_func filter) {
|
||||
return ::testing::Combine(::testing::Values(filter),
|
||||
::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
|
||||
}
|
||||
|
||||
::testing::internal::ParamGenerator<JNTCOMPAVGUPSAMPLEDParam> BuildParams(
|
||||
jntcompavgupsampled_func filter) {
|
||||
::testing::internal::ParamGenerator<DISTWTDCOMPAVGUPSAMPLEDParam> BuildParams(
|
||||
distwtdcompavgupsampled_func filter) {
|
||||
return ::testing::Combine(::testing::Values(filter),
|
||||
::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
|
||||
}
|
||||
|
||||
::testing::internal::ParamGenerator<HighbdJNTCOMPAVGParam> BuildParams(
|
||||
jntcompavg_func filter, int is_hbd) {
|
||||
::testing::internal::ParamGenerator<HighbdDISTWTDCOMPAVGParam> BuildParams(
|
||||
distwtdcompavg_func filter, int is_hbd) {
|
||||
(void)is_hbd;
|
||||
return ::testing::Combine(::testing::Range(8, 13, 2),
|
||||
::testing::Values(filter),
|
||||
::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
|
||||
}
|
||||
|
||||
::testing::internal::ParamGenerator<HighbdJNTCOMPAVGUPSAMPLEDParam> BuildParams(
|
||||
highbdjntcompavgupsampled_func filter) {
|
||||
::testing::internal::ParamGenerator<HighbdDISTWTDCOMPAVGUPSAMPLEDParam>
|
||||
BuildParams(highbddistwtdcompavgupsampled_func filter) {
|
||||
return ::testing::Combine(::testing::Range(8, 13, 2),
|
||||
::testing::Values(filter),
|
||||
::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
|
||||
}
|
||||
|
||||
class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
|
||||
class AV1DISTWTDCOMPAVGTest
|
||||
: public ::testing::TestWithParam<DISTWTDCOMPAVGParam> {
|
||||
public:
|
||||
~AV1JNTCOMPAVGTest() {}
|
||||
~AV1DISTWTDCOMPAVGTest() {}
|
||||
void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
|
||||
void TearDown() { libaom_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunCheckOutput(jntcompavg_func test_impl) {
|
||||
void RunCheckOutput(distwtdcompavg_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(1);
|
||||
|
||||
|
|
@ -107,27 +108,27 @@ class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
for (int ii = 0; ii < 2; ii++) {
|
||||
for (int jj = 0; jj < 4; jj++) {
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
|
||||
aom_jnt_comp_avg_pred_c(output, pred8 + offset_r * w + offset_c, in_w,
|
||||
in_h, ref8 + offset_r * w + offset_c, in_w,
|
||||
&jnt_comp_params);
|
||||
aom_dist_wtd_comp_avg_pred_c(output, pred8 + offset_r * w + offset_c,
|
||||
in_w, in_h, ref8 + offset_r * w + offset_c,
|
||||
in_w, &dist_wtd_comp_params);
|
||||
test_impl(output2, pred8 + offset_r * w + offset_c, in_w, in_h,
|
||||
ref8 + offset_r * w + offset_c, in_w, &jnt_comp_params);
|
||||
ref8 + offset_r * w + offset_c, in_w, &dist_wtd_comp_params);
|
||||
|
||||
for (int i = 0; i < in_h; ++i) {
|
||||
for (int j = 0; j < in_w; ++j) {
|
||||
int idx = i * in_w + j;
|
||||
ASSERT_EQ(output[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for AV1JNTCOMPAVGTest\n"
|
||||
<< "Mismatch at unit tests for AV1DISTWTDCOMPAVGTest\n"
|
||||
<< in_w << "x" << in_h << " Pixel mismatch at index " << idx
|
||||
<< " = (" << i << ", " << j << ")";
|
||||
}
|
||||
|
|
@ -135,7 +136,7 @@ class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
|
|||
}
|
||||
}
|
||||
}
|
||||
void RunSpeedTest(jntcompavg_func test_impl) {
|
||||
void RunSpeedTest(distwtdcompavg_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(1);
|
||||
|
||||
|
|
@ -152,49 +153,49 @@ class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
|
||||
const int num_loops = 1000000000 / (in_w + in_h);
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
aom_jnt_comp_avg_pred_c(output, pred8, in_w, in_h, ref8, in_w,
|
||||
&jnt_comp_params);
|
||||
aom_dist_wtd_comp_avg_pred_c(output, pred8, in_w, in_h, ref8, in_w,
|
||||
&dist_wtd_comp_params);
|
||||
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
printf("jntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("distwtdcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time / num_loops);
|
||||
|
||||
aom_usec_timer timer1;
|
||||
aom_usec_timer_start(&timer1);
|
||||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
test_impl(output2, pred8, in_w, in_h, ref8, in_w, &jnt_comp_params);
|
||||
test_impl(output2, pred8, in_w, in_h, ref8, in_w, &dist_wtd_comp_params);
|
||||
|
||||
aom_usec_timer_mark(&timer1);
|
||||
const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
|
||||
printf("jntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("distwtdcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time1 / num_loops);
|
||||
}
|
||||
|
||||
libaom_test::ACMRandom rnd_;
|
||||
}; // class AV1JNTCOMPAVGTest
|
||||
}; // class AV1DISTWTDCOMPAVGTest
|
||||
|
||||
class AV1JNTCOMPAVGUPSAMPLEDTest
|
||||
: public ::testing::TestWithParam<JNTCOMPAVGUPSAMPLEDParam> {
|
||||
class AV1DISTWTDCOMPAVGUPSAMPLEDTest
|
||||
: public ::testing::TestWithParam<DISTWTDCOMPAVGUPSAMPLEDParam> {
|
||||
public:
|
||||
~AV1JNTCOMPAVGUPSAMPLEDTest() {}
|
||||
~AV1DISTWTDCOMPAVGUPSAMPLEDTest() {}
|
||||
void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
|
||||
void TearDown() { libaom_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunCheckOutput(jntcompavgupsampled_func test_impl) {
|
||||
void RunCheckOutput(distwtdcompavgupsampled_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(1);
|
||||
|
||||
|
|
@ -211,37 +212,40 @@ class AV1JNTCOMPAVGUPSAMPLEDTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
int sub_x_q3, sub_y_q3;
|
||||
int subpel_search;
|
||||
for (subpel_search = 1; subpel_search <= 2; ++subpel_search) {
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
|
||||
for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
|
||||
for (int ii = 0; ii < 2; ii++) {
|
||||
for (int jj = 0; jj < 4; jj++) {
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
dist_wtd_comp_params.fwd_offset =
|
||||
quant_dist_lookup_table[ii][jj][0];
|
||||
dist_wtd_comp_params.bck_offset =
|
||||
quant_dist_lookup_table[ii][jj][1];
|
||||
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
|
||||
|
||||
aom_jnt_comp_avg_upsampled_pred_c(
|
||||
aom_dist_wtd_comp_avg_upsampled_pred_c(
|
||||
NULL, NULL, 0, 0, NULL, output,
|
||||
pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3,
|
||||
sub_y_q3, ref8 + offset_r * w + offset_c, in_w,
|
||||
&jnt_comp_params, subpel_search);
|
||||
&dist_wtd_comp_params, subpel_search);
|
||||
test_impl(NULL, NULL, 0, 0, NULL, output2,
|
||||
pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3,
|
||||
sub_y_q3, ref8 + offset_r * w + offset_c, in_w,
|
||||
&jnt_comp_params, subpel_search);
|
||||
&dist_wtd_comp_params, subpel_search);
|
||||
|
||||
for (int i = 0; i < in_h; ++i) {
|
||||
for (int j = 0; j < in_w; ++j) {
|
||||
int idx = i * in_w + j;
|
||||
ASSERT_EQ(output[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for "
|
||||
"AV1JNTCOMPAVGUPSAMPLEDTest\n"
|
||||
"AV1DISTWTDCOMPAVGUPSAMPLEDTest\n"
|
||||
<< in_w << "x" << in_h << " Pixel mismatch at index "
|
||||
<< idx << " = (" << i << ", " << j
|
||||
<< "), sub pixel offset = (" << sub_y_q3 << ", "
|
||||
|
|
@ -254,7 +258,7 @@ class AV1JNTCOMPAVGUPSAMPLEDTest
|
|||
}
|
||||
}
|
||||
}
|
||||
void RunSpeedTest(jntcompavgupsampled_func test_impl) {
|
||||
void RunSpeedTest(distwtdcompavgupsampled_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(1);
|
||||
|
||||
|
|
@ -271,11 +275,11 @@ class AV1JNTCOMPAVGUPSAMPLEDTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
|
||||
int sub_x_q3 = 0;
|
||||
int sub_y_q3 = 0;
|
||||
|
|
@ -283,16 +287,16 @@ class AV1JNTCOMPAVGUPSAMPLEDTest
|
|||
const int num_loops = 1000000000 / (in_w + in_h);
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
int subpel_search = 2; // set to 1 to test 4-tap filter.
|
||||
int subpel_search = USE_8_TAPS; // set to USE_4_TAPS to test 4-tap filter.
|
||||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
aom_jnt_comp_avg_upsampled_pred_c(NULL, NULL, 0, 0, NULL, output, pred8,
|
||||
in_w, in_h, sub_x_q3, sub_y_q3, ref8,
|
||||
in_w, &jnt_comp_params, subpel_search);
|
||||
aom_dist_wtd_comp_avg_upsampled_pred_c(
|
||||
NULL, NULL, 0, 0, NULL, output, pred8, in_w, in_h, sub_x_q3, sub_y_q3,
|
||||
ref8, in_w, &dist_wtd_comp_params, subpel_search);
|
||||
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
printf("jntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("distwtdcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time / num_loops);
|
||||
|
||||
aom_usec_timer timer1;
|
||||
|
|
@ -300,27 +304,27 @@ class AV1JNTCOMPAVGUPSAMPLEDTest
|
|||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
test_impl(NULL, NULL, 0, 0, NULL, output2, pred8, in_w, in_h, sub_x_q3,
|
||||
sub_y_q3, ref8, in_w, &jnt_comp_params, subpel_search);
|
||||
sub_y_q3, ref8, in_w, &dist_wtd_comp_params, subpel_search);
|
||||
|
||||
aom_usec_timer_mark(&timer1);
|
||||
const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
|
||||
printf("jntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("distwtdcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time1 / num_loops);
|
||||
}
|
||||
|
||||
libaom_test::ACMRandom rnd_;
|
||||
}; // class AV1JNTCOMPAVGUPSAMPLEDTest
|
||||
}; // class AV1DISTWTDCOMPAVGUPSAMPLEDTest
|
||||
|
||||
class AV1HighBDJNTCOMPAVGTest
|
||||
: public ::testing::TestWithParam<HighbdJNTCOMPAVGParam> {
|
||||
class AV1HighBDDISTWTDCOMPAVGTest
|
||||
: public ::testing::TestWithParam<HighbdDISTWTDCOMPAVGParam> {
|
||||
public:
|
||||
~AV1HighBDJNTCOMPAVGTest() {}
|
||||
~AV1HighBDDISTWTDCOMPAVGTest() {}
|
||||
void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
|
||||
|
||||
void TearDown() { libaom_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunCheckOutput(jntcompavg_func test_impl) {
|
||||
void RunCheckOutput(distwtdcompavg_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(0);
|
||||
|
|
@ -337,31 +341,31 @@ class AV1HighBDJNTCOMPAVGTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
for (int ii = 0; ii < 2; ii++) {
|
||||
for (int jj = 0; jj < 4; jj++) {
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
|
||||
aom_highbd_jnt_comp_avg_pred_c(
|
||||
aom_highbd_dist_wtd_comp_avg_pred_c(
|
||||
CONVERT_TO_BYTEPTR(output),
|
||||
CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w, in_h,
|
||||
CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w,
|
||||
&jnt_comp_params);
|
||||
&dist_wtd_comp_params);
|
||||
test_impl(CONVERT_TO_BYTEPTR(output2),
|
||||
CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
|
||||
in_h, CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c,
|
||||
in_w, &jnt_comp_params);
|
||||
in_w, &dist_wtd_comp_params);
|
||||
|
||||
for (int i = 0; i < in_h; ++i) {
|
||||
for (int j = 0; j < in_w; ++j) {
|
||||
int idx = i * in_w + j;
|
||||
ASSERT_EQ(output[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for AV1HighBDJNTCOMPAVGTest\n"
|
||||
<< "Mismatch at unit tests for AV1HighBDDISTWTDCOMPAVGTest\n"
|
||||
<< in_w << "x" << in_h << " Pixel mismatch at index " << idx
|
||||
<< " = (" << i << ", " << j << ")";
|
||||
}
|
||||
|
|
@ -369,7 +373,7 @@ class AV1HighBDJNTCOMPAVGTest
|
|||
}
|
||||
}
|
||||
}
|
||||
void RunSpeedTest(jntcompavg_func test_impl) {
|
||||
void RunSpeedTest(distwtdcompavg_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(0);
|
||||
|
|
@ -386,24 +390,24 @@ class AV1HighBDJNTCOMPAVGTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
|
||||
const int num_loops = 1000000000 / (in_w + in_h);
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
aom_highbd_jnt_comp_avg_pred_c(
|
||||
aom_highbd_dist_wtd_comp_avg_pred_c(
|
||||
CONVERT_TO_BYTEPTR(output), CONVERT_TO_BYTEPTR(pred8), in_w, in_h,
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, &jnt_comp_params);
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, &dist_wtd_comp_params);
|
||||
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
printf("highbdjntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("highbddistwtdcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time / num_loops);
|
||||
|
||||
aom_usec_timer timer1;
|
||||
|
|
@ -411,33 +415,33 @@ class AV1HighBDJNTCOMPAVGTest
|
|||
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
test_impl(CONVERT_TO_BYTEPTR(output2), CONVERT_TO_BYTEPTR(pred8), in_w,
|
||||
in_h, CONVERT_TO_BYTEPTR(ref8), in_w, &jnt_comp_params);
|
||||
in_h, CONVERT_TO_BYTEPTR(ref8), in_w, &dist_wtd_comp_params);
|
||||
|
||||
aom_usec_timer_mark(&timer1);
|
||||
const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
|
||||
printf("highbdjntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
printf("highbddistwtdcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time1 / num_loops);
|
||||
}
|
||||
|
||||
libaom_test::ACMRandom rnd_;
|
||||
}; // class AV1HighBDJNTCOMPAVGTest
|
||||
}; // class AV1HighBDDISTWTDCOMPAVGTest
|
||||
|
||||
class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
||||
: public ::testing::TestWithParam<HighbdJNTCOMPAVGUPSAMPLEDParam> {
|
||||
class AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest
|
||||
: public ::testing::TestWithParam<HighbdDISTWTDCOMPAVGUPSAMPLEDParam> {
|
||||
public:
|
||||
~AV1HighBDJNTCOMPAVGUPSAMPLEDTest() {}
|
||||
~AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest() {}
|
||||
void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
|
||||
void TearDown() { libaom_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void RunCheckOutput(highbdjntcompavgupsampled_func test_impl) {
|
||||
void RunCheckOutput(highbddistwtdcompavgupsampled_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(0);
|
||||
uint16_t pred8[kMaxSize * kMaxSize];
|
||||
uint16_t ref8[kMaxSize * kMaxSize];
|
||||
uint16_t output[kMaxSize * kMaxSize];
|
||||
uint16_t output2[kMaxSize * kMaxSize];
|
||||
DECLARE_ALIGNED(16, uint16_t, output[kMaxSize * kMaxSize]);
|
||||
DECLARE_ALIGNED(16, uint16_t, output2[kMaxSize * kMaxSize]);
|
||||
|
||||
for (int i = 0; i < h; ++i)
|
||||
for (int j = 0; j < w; ++j) {
|
||||
|
|
@ -447,39 +451,42 @@ class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
int sub_x_q3, sub_y_q3;
|
||||
int subpel_search;
|
||||
for (subpel_search = 1; subpel_search <= 2; ++subpel_search) {
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
|
||||
for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
|
||||
for (int ii = 0; ii < 2; ii++) {
|
||||
for (int jj = 0; jj < 4; jj++) {
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
dist_wtd_comp_params.fwd_offset =
|
||||
quant_dist_lookup_table[ii][jj][0];
|
||||
dist_wtd_comp_params.bck_offset =
|
||||
quant_dist_lookup_table[ii][jj][1];
|
||||
|
||||
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
|
||||
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
|
||||
|
||||
aom_highbd_jnt_comp_avg_upsampled_pred_c(
|
||||
aom_highbd_dist_wtd_comp_avg_upsampled_pred_c(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output),
|
||||
CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
|
||||
in_h, sub_x_q3, sub_y_q3,
|
||||
CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w, bd,
|
||||
&jnt_comp_params, subpel_search);
|
||||
&dist_wtd_comp_params, subpel_search);
|
||||
test_impl(NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output2),
|
||||
CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c,
|
||||
in_w, in_h, sub_x_q3, sub_y_q3,
|
||||
CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c,
|
||||
in_w, bd, &jnt_comp_params, subpel_search);
|
||||
in_w, bd, &dist_wtd_comp_params, subpel_search);
|
||||
|
||||
for (int i = 0; i < in_h; ++i) {
|
||||
for (int j = 0; j < in_w; ++j) {
|
||||
int idx = i * in_w + j;
|
||||
ASSERT_EQ(output[idx], output2[idx])
|
||||
<< "Mismatch at unit tests for "
|
||||
"AV1HighBDJNTCOMPAVGUPSAMPLEDTest\n"
|
||||
"AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest\n"
|
||||
<< in_w << "x" << in_h << " Pixel mismatch at index "
|
||||
<< idx << " = (" << i << ", " << j
|
||||
<< "), sub pixel offset = (" << sub_y_q3 << ", "
|
||||
|
|
@ -492,14 +499,14 @@ class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
|||
}
|
||||
}
|
||||
}
|
||||
void RunSpeedTest(highbdjntcompavgupsampled_func test_impl) {
|
||||
void RunSpeedTest(highbddistwtdcompavgupsampled_func test_impl) {
|
||||
const int w = kMaxSize, h = kMaxSize;
|
||||
const int block_idx = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(0);
|
||||
uint16_t pred8[kMaxSize * kMaxSize];
|
||||
uint16_t ref8[kMaxSize * kMaxSize];
|
||||
uint16_t output[kMaxSize * kMaxSize];
|
||||
uint16_t output2[kMaxSize * kMaxSize];
|
||||
DECLARE_ALIGNED(16, uint16_t, output[kMaxSize * kMaxSize]);
|
||||
DECLARE_ALIGNED(16, uint16_t, output2[kMaxSize * kMaxSize]);
|
||||
|
||||
for (int i = 0; i < h; ++i)
|
||||
for (int j = 0; j < w; ++j) {
|
||||
|
|
@ -509,27 +516,28 @@ class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
|||
const int in_w = block_size_wide[block_idx];
|
||||
const int in_h = block_size_high[block_idx];
|
||||
|
||||
JNT_COMP_PARAMS jnt_comp_params;
|
||||
jnt_comp_params.use_jnt_comp_avg = 1;
|
||||
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
|
||||
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
|
||||
|
||||
jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
|
||||
dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
|
||||
int sub_x_q3 = 0;
|
||||
int sub_y_q3 = 0;
|
||||
const int num_loops = 1000000000 / (in_w + in_h);
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
int subpel_search = 2; // set to 1 to test 4-tap filter.
|
||||
int subpel_search = USE_8_TAPS; // set to USE_4_TAPS to test 4-tap filter.
|
||||
for (int i = 0; i < num_loops; ++i)
|
||||
aom_highbd_jnt_comp_avg_upsampled_pred_c(
|
||||
aom_highbd_dist_wtd_comp_avg_upsampled_pred_c(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output),
|
||||
CONVERT_TO_BYTEPTR(pred8), in_w, in_h, sub_x_q3, sub_y_q3,
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, bd, &jnt_comp_params, subpel_search);
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, bd, &dist_wtd_comp_params,
|
||||
subpel_search);
|
||||
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
printf("highbdjntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
|
||||
1000.0 * elapsed_time / num_loops);
|
||||
printf("highbddistwtdcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w,
|
||||
in_h, 1000.0 * elapsed_time / num_loops);
|
||||
|
||||
aom_usec_timer timer1;
|
||||
aom_usec_timer_start(&timer1);
|
||||
|
|
@ -537,19 +545,19 @@ class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
|||
for (int i = 0; i < num_loops; ++i)
|
||||
test_impl(NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output2),
|
||||
CONVERT_TO_BYTEPTR(pred8), in_w, in_h, sub_x_q3, sub_y_q3,
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, bd, &jnt_comp_params,
|
||||
CONVERT_TO_BYTEPTR(ref8), in_w, bd, &dist_wtd_comp_params,
|
||||
subpel_search);
|
||||
|
||||
aom_usec_timer_mark(&timer1);
|
||||
const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
|
||||
printf("highbdjntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w,
|
||||
printf("highbddistwtdcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w,
|
||||
in_h, 1000.0 * elapsed_time1 / num_loops);
|
||||
}
|
||||
|
||||
libaom_test::ACMRandom rnd_;
|
||||
}; // class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
|
||||
}; // class AV1HighBDDISTWTDCOMPAVGUPSAMPLEDTest
|
||||
|
||||
} // namespace AV1JNTCOMPAVG
|
||||
} // namespace AV1DISTWTDCOMPAVG
|
||||
} // namespace libaom_test
|
||||
|
||||
#endif // AOM_TEST_COMP_AVG_PRED_TEST_H_
|
||||
|
|
|
|||
37
third_party/aom/test/comp_mask_variance_test.cc
vendored
37
third_party/aom/test/comp_mask_variance_test.cc
vendored
|
|
@ -34,7 +34,7 @@ typedef void (*comp_mask_pred_func)(uint8_t *comp_pred, const uint8_t *pred,
|
|||
int ref_stride, const uint8_t *mask,
|
||||
int mask_stride, int invert_mask);
|
||||
|
||||
#if HAVE_SSSE3 || HAVE_AV2
|
||||
#if HAVE_SSSE3 || HAVE_SSE2 || HAVE_AV2
|
||||
const BLOCK_SIZE kValidBlockSize[] = {
|
||||
BLOCK_8X8, BLOCK_8X16, BLOCK_8X32, BLOCK_16X8, BLOCK_16X16,
|
||||
BLOCK_16X32, BLOCK_32X8, BLOCK_32X16, BLOCK_32X32,
|
||||
|
|
@ -191,7 +191,8 @@ void AV1CompMaskUpVarianceTest::RunCheckOutput(comp_mask_pred_func test_impl,
|
|||
const int h = block_size_high[bsize];
|
||||
int wedge_types = (1 << get_wedge_bits_lookup(bsize));
|
||||
int subpel_search;
|
||||
for (subpel_search = 1; subpel_search <= 2; ++subpel_search) {
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
// loop through subx and suby
|
||||
for (int sub = 0; sub < 8 * 8; ++sub) {
|
||||
int subx = sub & 0x7;
|
||||
|
|
@ -231,7 +232,7 @@ void AV1CompMaskUpVarianceTest::RunSpeedTest(comp_mask_pred_func test_impl,
|
|||
const int num_loops = 1000000000 / (w + h);
|
||||
comp_mask_pred_func funcs[2] = { &aom_comp_mask_pred_c, test_impl };
|
||||
double elapsed_time[2] = { 0 };
|
||||
int subpel_search = 2; // set to 1 to test 4-tap filter.
|
||||
int subpel_search = USE_8_TAPS; // set to USE_4_TAPS to test 4-tap filter.
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
|
|
@ -458,6 +459,7 @@ AV1HighbdCompMaskUpVarianceTest::~AV1HighbdCompMaskUpVarianceTest() { ; }
|
|||
|
||||
void AV1HighbdCompMaskUpVarianceTest::RunCheckOutput(
|
||||
highbd_comp_mask_pred_func test_impl, BLOCK_SIZE bsize, int inv) {
|
||||
(void)test_impl;
|
||||
int bd_ = GET_PARAM(2);
|
||||
const int w = block_size_wide[bsize];
|
||||
const int h = block_size_high[bsize];
|
||||
|
|
@ -480,19 +482,24 @@ void AV1HighbdCompMaskUpVarianceTest::RunCheckOutput(
|
|||
const uint8_t *mask =
|
||||
av1_get_contiguous_soft_mask(wedge_index, 1, bsize);
|
||||
|
||||
aom_highbd_comp_mask_pred = aom_highbd_comp_mask_pred_c; // ref
|
||||
aom_highbd_comp_mask_upsampled_pred(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(comp_pred1_),
|
||||
CONVERT_TO_BYTEPTR(pred_), w, h, subx, suby,
|
||||
CONVERT_TO_BYTEPTR(ref_), MAX_SB_SIZE, mask, w, inv, bd_,
|
||||
subpel_search);
|
||||
// ref
|
||||
aom_highbd_upsampled_pred_c(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(comp_pred1_), w, h, subx,
|
||||
suby, CONVERT_TO_BYTEPTR(ref_), MAX_SB_SIZE, bd_, subpel_search);
|
||||
|
||||
aom_highbd_comp_mask_pred_c(
|
||||
CONVERT_TO_BYTEPTR(comp_pred1_), CONVERT_TO_BYTEPTR(pred_), w, h,
|
||||
CONVERT_TO_BYTEPTR(comp_pred1_), w, mask, w, inv);
|
||||
|
||||
// test
|
||||
aom_highbd_upsampled_pred(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(comp_pred2_), w, h, subx,
|
||||
suby, CONVERT_TO_BYTEPTR(ref_), MAX_SB_SIZE, bd_, subpel_search);
|
||||
|
||||
aom_highbd_comp_mask_pred(
|
||||
CONVERT_TO_BYTEPTR(comp_pred2_), CONVERT_TO_BYTEPTR(pred_), w, h,
|
||||
CONVERT_TO_BYTEPTR(comp_pred2_), w, mask, w, inv);
|
||||
|
||||
aom_highbd_comp_mask_pred = test_impl; // test
|
||||
aom_highbd_comp_mask_upsampled_pred(
|
||||
NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(comp_pred2_),
|
||||
CONVERT_TO_BYTEPTR(pred_), w, h, subx, suby,
|
||||
CONVERT_TO_BYTEPTR(ref_), MAX_SB_SIZE, mask, w, inv, bd_,
|
||||
subpel_search);
|
||||
ASSERT_EQ(CheckResult(w, h), true)
|
||||
<< " wedge " << wedge_index << " inv " << inv << "sub (" << subx
|
||||
<< "," << suby << ")";
|
||||
|
|
|
|||
249
third_party/aom/test/convolve_test.cc
vendored
249
third_party/aom/test/convolve_test.cc
vendored
|
|
@ -273,6 +273,8 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
|||
input_ = reinterpret_cast<uint8_t *>(
|
||||
aom_memalign(kDataAlignment, kInputBufferSize + 1)) +
|
||||
1;
|
||||
ref8_ = reinterpret_cast<uint8_t *>(
|
||||
aom_memalign(kDataAlignment, kOutputStride * kMaxDimension));
|
||||
output_ = reinterpret_cast<uint8_t *>(
|
||||
aom_memalign(kDataAlignment, kOutputBufferSize));
|
||||
output_ref_ = reinterpret_cast<uint8_t *>(
|
||||
|
|
@ -280,6 +282,8 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
|||
input16_ = reinterpret_cast<uint16_t *>(aom_memalign(
|
||||
kDataAlignment, (kInputBufferSize + 1) * sizeof(uint16_t))) +
|
||||
1;
|
||||
ref16_ = reinterpret_cast<uint16_t *>(aom_memalign(
|
||||
kDataAlignment, kOutputStride * kMaxDimension * sizeof(uint16_t)));
|
||||
output16_ = reinterpret_cast<uint16_t *>(
|
||||
aom_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
|
||||
output16_ref_ = reinterpret_cast<uint16_t *>(
|
||||
|
|
@ -291,12 +295,16 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
|||
static void TearDownTestCase() {
|
||||
aom_free(input_ - 1);
|
||||
input_ = NULL;
|
||||
aom_free(ref8_);
|
||||
ref8_ = NULL;
|
||||
aom_free(output_);
|
||||
output_ = NULL;
|
||||
aom_free(output_ref_);
|
||||
output_ref_ = NULL;
|
||||
aom_free(input16_ - 1);
|
||||
input16_ = NULL;
|
||||
aom_free(ref16_);
|
||||
ref16_ = NULL;
|
||||
aom_free(output16_);
|
||||
output16_ = NULL;
|
||||
aom_free(output16_ref_);
|
||||
|
|
@ -449,18 +457,22 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
|||
|
||||
const ConvolveFunctions *UUT_;
|
||||
static uint8_t *input_;
|
||||
static uint8_t *ref8_;
|
||||
static uint8_t *output_;
|
||||
static uint8_t *output_ref_;
|
||||
static uint16_t *input16_;
|
||||
static uint16_t *ref16_;
|
||||
static uint16_t *output16_;
|
||||
static uint16_t *output16_ref_;
|
||||
int mask_;
|
||||
};
|
||||
|
||||
uint8_t *ConvolveTest::input_ = NULL;
|
||||
uint8_t *ConvolveTest::ref8_ = NULL;
|
||||
uint8_t *ConvolveTest::output_ = NULL;
|
||||
uint8_t *ConvolveTest::output_ref_ = NULL;
|
||||
uint16_t *ConvolveTest::input16_ = NULL;
|
||||
uint16_t *ConvolveTest::ref16_ = NULL;
|
||||
uint16_t *ConvolveTest::output16_ = NULL;
|
||||
uint16_t *ConvolveTest::output16_ref_ = NULL;
|
||||
|
||||
|
|
@ -486,26 +498,28 @@ const int kNumFilterBanks = SWITCHABLE_FILTERS;
|
|||
const int kNumFilters = 16;
|
||||
|
||||
TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter);
|
||||
const InterpFilterParams *filter_params =
|
||||
av1_get_interp_filter_params_with_block_size(filter, 8);
|
||||
if (filter_params->taps != SUBPEL_TAPS) continue;
|
||||
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];
|
||||
const int p2 = filters[i][4] + filters[i][5];
|
||||
const int p3 = filters[i][6] + filters[i][7];
|
||||
EXPECT_LE(p0, 128);
|
||||
EXPECT_LE(p1, 128);
|
||||
EXPECT_LE(p2, 128);
|
||||
EXPECT_LE(p3, 128);
|
||||
EXPECT_LE(p0 + p3, 128);
|
||||
EXPECT_LE(p0 + p3 + p1, 128);
|
||||
EXPECT_LE(p0 + p3 + p1 + p2, 128);
|
||||
EXPECT_EQ(p0 + p1 + p2 + p3, 128);
|
||||
int subpel_search;
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter,
|
||||
subpel_search);
|
||||
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];
|
||||
const int p2 = filters[i][4] + filters[i][5];
|
||||
const int p3 = filters[i][6] + filters[i][7];
|
||||
EXPECT_LE(p0, 128);
|
||||
EXPECT_LE(p1, 128);
|
||||
EXPECT_LE(p2, 128);
|
||||
EXPECT_LE(p3, 128);
|
||||
EXPECT_LE(p0 + p3, 128);
|
||||
EXPECT_LE(p0 + p3 + p1, 128);
|
||||
EXPECT_LE(p0 + p3 + p1 + p2, 128);
|
||||
EXPECT_EQ(p0 + p1 + p2 + p3, 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -515,53 +529,51 @@ const int16_t kInvalidFilter[8] = { 0 };
|
|||
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
ref = ref8_;
|
||||
} else {
|
||||
ref = CONVERT_TO_BYTEPTR(ref16);
|
||||
ref = CONVERT_TO_BYTEPTR(ref16_);
|
||||
}
|
||||
int subpel_search;
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter,
|
||||
subpel_search);
|
||||
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, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter);
|
||||
const InterpFilterParams *filter_params =
|
||||
av1_get_interp_filter_params_with_block_size(filter, 8);
|
||||
if (filter_params->taps != SUBPEL_TAPS) continue;
|
||||
if (filter_x && filter_y)
|
||||
continue;
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
16, filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->copy_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
|
||||
kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
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, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
CheckGuardBlocks();
|
||||
|
||||
if (filter_x && filter_y)
|
||||
continue;
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
16, filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride, filters[filter_x],
|
||||
16, kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->copy_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
0, kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -570,13 +582,11 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
|||
TEST_P(ConvolveTest, FilterExtremes) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
ref = ref8_;
|
||||
} else {
|
||||
ref = CONVERT_TO_BYTEPTR(ref16);
|
||||
ref = CONVERT_TO_BYTEPTR(ref16_);
|
||||
}
|
||||
|
||||
// Populate ref and out with some random data
|
||||
|
|
@ -609,41 +619,43 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
|||
seed_val++;
|
||||
}
|
||||
if (axis) seed_val += 8;
|
||||
int subpel_search;
|
||||
for (subpel_search = USE_4_TAPS; subpel_search <= USE_8_TAPS;
|
||||
++subpel_search) {
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks;
|
||||
++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter,
|
||||
subpel_search);
|
||||
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, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
if (filter_x && filter_y)
|
||||
continue;
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->v8_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->copy_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
|
||||
kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter);
|
||||
const InterpFilterParams *filter_params =
|
||||
av1_get_interp_filter_params_with_block_size(filter, 8);
|
||||
if (filter_params->taps != SUBPEL_TAPS) continue;
|
||||
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, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
if (filter_x && filter_y)
|
||||
continue;
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->v8_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->copy_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
|
||||
kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -674,13 +686,11 @@ TEST_P(ConvolveTest, DISABLED_Copy_Speed) {
|
|||
TEST_P(ConvolveTest, DISABLED_Speed) {
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
ref = ref8_;
|
||||
} else {
|
||||
ref = CONVERT_TO_BYTEPTR(ref16);
|
||||
ref = CONVERT_TO_BYTEPTR(ref16_);
|
||||
}
|
||||
|
||||
// Populate ref and out with some random data
|
||||
|
|
@ -700,7 +710,7 @@ TEST_P(ConvolveTest, DISABLED_Speed) {
|
|||
|
||||
const InterpFilter filter = (InterpFilter)1;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter);
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter, USE_8_TAPS);
|
||||
wrapper_filter_average_block2d_8_c(in, kInputStride, filters[1], filters[1],
|
||||
out, kOutputStride, Width(), Height());
|
||||
|
||||
|
|
@ -712,11 +722,8 @@ TEST_P(ConvolveTest, DISABLED_Speed) {
|
|||
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
|
||||
const InterpFilter filter = (InterpFilter)filter_bank;
|
||||
const InterpKernel *filters =
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter);
|
||||
const InterpFilterParams *filter_params =
|
||||
av1_get_interp_filter_params_with_block_size(filter, 8);
|
||||
if (filter_params->taps != SUBPEL_TAPS) continue;
|
||||
|
||||
(const InterpKernel *)av1_get_interp_filter_kernel(filter,
|
||||
USE_8_TAPS);
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
if (filter_x && filter_y) continue;
|
||||
|
|
@ -805,18 +812,22 @@ const ConvolveParam kArrayConvolve_c[] = {
|
|||
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));
|
||||
|
||||
#if HAVE_SSE2 && ARCH_X86_64
|
||||
const ConvolveFunctions convolve8_sse2(wrap_convolve_copy_sse2_8,
|
||||
wrap_convolve8_horiz_sse2_8,
|
||||
wrap_convolve8_vert_sse2_8, 8);
|
||||
const ConvolveFunctions convolve10_sse2(wrap_convolve_copy_sse2_10,
|
||||
wrap_convolve8_horiz_sse2_10,
|
||||
wrap_convolve8_vert_sse2_10, 10);
|
||||
const ConvolveFunctions convolve12_sse2(wrap_convolve_copy_sse2_12,
|
||||
wrap_convolve8_horiz_sse2_12,
|
||||
wrap_convolve8_vert_sse2_12, 12);
|
||||
const ConvolveFunctions convolve8_sse2(aom_convolve_copy_c,
|
||||
aom_convolve8_horiz_sse2,
|
||||
aom_convolve8_vert_sse2, 0);
|
||||
const ConvolveFunctions wrap_convolve8_sse2(wrap_convolve_copy_sse2_8,
|
||||
wrap_convolve8_horiz_sse2_8,
|
||||
wrap_convolve8_vert_sse2_8, 8);
|
||||
const ConvolveFunctions wrap_convolve10_sse2(wrap_convolve_copy_sse2_10,
|
||||
wrap_convolve8_horiz_sse2_10,
|
||||
wrap_convolve8_vert_sse2_10, 10);
|
||||
const ConvolveFunctions wrap_convolve12_sse2(wrap_convolve_copy_sse2_12,
|
||||
wrap_convolve8_horiz_sse2_12,
|
||||
wrap_convolve8_vert_sse2_12, 12);
|
||||
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2),
|
||||
ALL_SIZES(convolve10_sse2),
|
||||
ALL_SIZES(convolve12_sse2) };
|
||||
ALL_SIZES(wrap_convolve8_sse2),
|
||||
ALL_SIZES(wrap_convolve10_sse2),
|
||||
ALL_SIZES(wrap_convolve12_sse2) };
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_sse2));
|
||||
#endif
|
||||
|
|
|
|||
64
third_party/aom/test/corner_match_test.cc
vendored
64
third_party/aom/test/corner_match_test.cc
vendored
|
|
@ -24,9 +24,13 @@ namespace AV1CornerMatch {
|
|||
|
||||
using libaom_test::ACMRandom;
|
||||
|
||||
typedef double (*ComputeCrossCorrFunc)(unsigned char *im1, int stride1, int x1,
|
||||
int y1, unsigned char *im2, int stride2,
|
||||
int x2, int y2);
|
||||
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
typedef tuple<int> CornerMatchParam;
|
||||
typedef tuple<int, ComputeCrossCorrFunc> CornerMatchParam;
|
||||
|
||||
class AV1CornerMatchTest : public ::testing::TestWithParam<CornerMatchParam> {
|
||||
public:
|
||||
|
|
@ -36,19 +40,24 @@ class AV1CornerMatchTest : public ::testing::TestWithParam<CornerMatchParam> {
|
|||
virtual void TearDown();
|
||||
|
||||
protected:
|
||||
void RunCheckOutput();
|
||||
void RunCheckOutput(int run_times);
|
||||
ComputeCrossCorrFunc target_func;
|
||||
|
||||
libaom_test::ACMRandom rnd_;
|
||||
};
|
||||
|
||||
AV1CornerMatchTest::~AV1CornerMatchTest() {}
|
||||
void AV1CornerMatchTest::SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
|
||||
void AV1CornerMatchTest::SetUp() {
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
target_func = GET_PARAM(1);
|
||||
}
|
||||
void AV1CornerMatchTest::TearDown() { libaom_test::ClearSystemState(); }
|
||||
|
||||
void AV1CornerMatchTest::RunCheckOutput() {
|
||||
void AV1CornerMatchTest::RunCheckOutput(int run_times) {
|
||||
const int w = 128, h = 128;
|
||||
const int num_iters = 10000;
|
||||
int i, j;
|
||||
aom_usec_timer ref_timer, test_timer;
|
||||
|
||||
uint8_t *input1 = new uint8_t[w * h];
|
||||
uint8_t *input2 = new uint8_t[w * h];
|
||||
|
|
@ -80,21 +89,54 @@ void AV1CornerMatchTest::RunCheckOutput() {
|
|||
|
||||
double res_c =
|
||||
compute_cross_correlation_c(input1, w, x1, y1, input2, w, x2, y2);
|
||||
double res_sse4 =
|
||||
compute_cross_correlation_sse4_1(input1, w, x1, y1, input2, w, x2, y2);
|
||||
double res_simd = target_func(input1, w, x1, y1, input2, w, x2, y2);
|
||||
|
||||
ASSERT_EQ(res_sse4, res_c);
|
||||
if (run_times > 1) {
|
||||
aom_usec_timer_start(&ref_timer);
|
||||
for (j = 0; j < run_times; j++) {
|
||||
compute_cross_correlation_c(input1, w, x1, y1, input2, w, x2, y2);
|
||||
}
|
||||
aom_usec_timer_mark(&ref_timer);
|
||||
const int elapsed_time_c =
|
||||
static_cast<int>(aom_usec_timer_elapsed(&ref_timer));
|
||||
|
||||
aom_usec_timer_start(&test_timer);
|
||||
for (j = 0; j < run_times; j++) {
|
||||
target_func(input1, w, x1, y1, input2, w, x2, y2);
|
||||
}
|
||||
aom_usec_timer_mark(&test_timer);
|
||||
const int elapsed_time_simd =
|
||||
static_cast<int>(aom_usec_timer_elapsed(&test_timer));
|
||||
|
||||
printf(
|
||||
"c_time=%d \t simd_time=%d \t "
|
||||
"gain=%d\n",
|
||||
elapsed_time_c, elapsed_time_simd,
|
||||
(elapsed_time_c / elapsed_time_simd));
|
||||
} else {
|
||||
ASSERT_EQ(res_simd, res_c);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] input1;
|
||||
delete[] input2;
|
||||
}
|
||||
|
||||
TEST_P(AV1CornerMatchTest, CheckOutput) { RunCheckOutput(); }
|
||||
TEST_P(AV1CornerMatchTest, CheckOutput) { RunCheckOutput(1); }
|
||||
TEST_P(AV1CornerMatchTest, DISABLED_Speed) { RunCheckOutput(100000); }
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, AV1CornerMatchTest,
|
||||
::testing::Values(make_tuple(0), make_tuple(1)));
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, AV1CornerMatchTest,
|
||||
::testing::Values(make_tuple(0, compute_cross_correlation_sse4_1),
|
||||
make_tuple(1, compute_cross_correlation_sse4_1)));
|
||||
#endif
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, AV1CornerMatchTest,
|
||||
::testing::Values(make_tuple(0, compute_cross_correlation_avx2),
|
||||
make_tuple(1, compute_cross_correlation_avx2)));
|
||||
#endif
|
||||
} // namespace AV1CornerMatch
|
||||
|
||||
} // namespace test_libaom
|
||||
|
|
|
|||
2
third_party/aom/test/cpu_speed_test.cc
vendored
2
third_party/aom/test/cpu_speed_test.cc
vendored
|
|
@ -46,7 +46,7 @@ class CpuSpeedTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(AV1E_SET_TUNE_CONTENT, tune_content_);
|
||||
if (encoding_mode_ != ::libaom_test::kRealTime) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class AV1DecodeMultiThreadedTest
|
|||
|
||||
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video,
|
||||
libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_);
|
||||
encoder->Control(AV1E_SET_TILE_ROWS, n_tile_rows_);
|
||||
encoder->Control(AV1E_SET_NUM_TG, n_tile_groups_);
|
||||
|
|
|
|||
2
third_party/aom/test/decode_perf_test.cc
vendored
2
third_party/aom/test/decode_perf_test.cc
vendored
|
|
@ -122,7 +122,7 @@ class AV1NewEncodeDecodePerfTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, speed_);
|
||||
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, 2);
|
||||
|
|
|
|||
174
third_party/aom/test/dr_prediction_test.cc
vendored
174
third_party/aom/test/dr_prediction_test.cc
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
|
|
@ -135,7 +135,7 @@ struct DrPredFunc {
|
|||
template <typename Pixel, typename FuncType>
|
||||
class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
|
||||
protected:
|
||||
static const int kMaxNumTests = 100000;
|
||||
static const int kMaxNumTests = 10000;
|
||||
static const int kIterations = 10;
|
||||
static const int kDstStride = 64;
|
||||
static const int kDstSize = kDstStride * kDstStride;
|
||||
|
|
@ -162,6 +162,7 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
|
|||
|
||||
for (int i = 0; i < kDstSize; ++i) {
|
||||
dst_ref_[i] = 0;
|
||||
dst_tst_[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +171,7 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
|
|||
void Predict(bool speedtest, int tx) {
|
||||
const int kNumTests = speedtest ? kMaxNumTests : 1;
|
||||
aom_usec_timer timer;
|
||||
|
||||
int tst_time = 0;
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int k = 0; k < kNumTests; ++k) {
|
||||
params_.ref_fn(dst_ref_, dst_stride_, bw_, bh_, above_, left_,
|
||||
|
|
@ -179,32 +180,39 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
|
|||
aom_usec_timer_mark(&timer);
|
||||
const int ref_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
|
||||
aom_usec_timer_start(&timer);
|
||||
if (params_.tst_fn) {
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int k = 0; k < kNumTests; ++k) {
|
||||
ASM_REGISTER_STATE_CHECK(params_.tst_fn(dst_tst_, dst_stride_, bw_, bh_,
|
||||
above_, left_, upsample_above_,
|
||||
upsample_left_, dx_, dy_, bd_));
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
tst_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
} else {
|
||||
for (int i = 0; i < kDstSize; ++i) {
|
||||
dst_ref_[i] = dst_tst_[i];
|
||||
}
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int tst_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
|
||||
OutputTimes(kNumTests, ref_time, tst_time, tx);
|
||||
}
|
||||
|
||||
void RunTest(bool speedtest, int p_angle) {
|
||||
for (int i = 0; i < kBufSize; ++i) {
|
||||
above_data_[i] = left_data_[i] = (1 << bd_) - 1;
|
||||
void RunTest(bool speedtest, bool needsaturation, int p_angle) {
|
||||
if (needsaturation) {
|
||||
for (int i = 0; i < kBufSize; ++i) {
|
||||
above_data_[i] = left_data_[i] = (1 << bd_) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int tx = 0; tx < TX_SIZES_ALL; ++tx) {
|
||||
if (params_.tst_fn == NULL) {
|
||||
for (int i = 0; i < kDstSize; ++i) {
|
||||
dst_tst_[i] = (1 << bd_) - 1;
|
||||
dst_ref_[i] = (1 << bd_) - 1;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < kDstSize; ++i) {
|
||||
dst_ref_[i] = 0;
|
||||
dst_tst_[i] = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -282,26 +290,11 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
|
|||
class LowbdDrPredTest : public DrPredTest<uint8_t, DrPred> {};
|
||||
|
||||
TEST_P(LowbdDrPredTest, SaturatedValues) {
|
||||
for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) {
|
||||
enable_upsample_ = iter & 1;
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int angle = start_angle_; angle < stop_angle_; ++angle) {
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
if (dx_ && dy_) RunTest(false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(LowbdDrPredTest, DISABLED_Speed) {
|
||||
const int angles[] = { 3, 45, 87 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const int angle = angles[i] + start_angle_;
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
printf("enable_upsample: %d angle: %d ~~~~~~~~~~~~~~~\n",
|
||||
enable_upsample_, angle);
|
||||
if (dx_ && dy_) RunTest(true, angle);
|
||||
if (dx_ && dy_) RunTest(false, true, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -320,26 +313,11 @@ INSTANTIATE_TEST_CASE_P(
|
|||
class HighbdDrPredTest : public DrPredTest<uint16_t, DrPred_Hbd> {};
|
||||
|
||||
TEST_P(HighbdDrPredTest, SaturatedValues) {
|
||||
for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) {
|
||||
enable_upsample_ = iter & 1;
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int angle = start_angle_; angle < stop_angle_; ++angle) {
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
if (dx_ && dy_) RunTest(false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(HighbdDrPredTest, DISABLED_Speed) {
|
||||
const int angles[] = { 3, 45, 87 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const int angle = angles[i] + start_angle_;
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
printf("enable_upsample: %d angle: %d ~~~~~~~~~~~~~~~\n",
|
||||
enable_upsample_, angle);
|
||||
if (dx_ && dy_) RunTest(true, angle);
|
||||
if (dx_ && dy_) RunTest(false, true, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -366,4 +344,112 @@ INSTANTIATE_TEST_CASE_P(
|
|||
DrPredFunc<DrPred_Hbd>(&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_c>,
|
||||
NULL, AOM_BITS_12, kZ3Start)));
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, LowbdDrPredTest,
|
||||
::testing::Values(DrPredFunc<DrPred>(&z1_wrapper<av1_dr_prediction_z1_c>,
|
||||
&z1_wrapper<av1_dr_prediction_z1_avx2>,
|
||||
AOM_BITS_8, kZ1Start),
|
||||
DrPredFunc<DrPred>(&z2_wrapper<av1_dr_prediction_z2_c>,
|
||||
&z2_wrapper<av1_dr_prediction_z2_avx2>,
|
||||
AOM_BITS_8, kZ2Start),
|
||||
DrPredFunc<DrPred>(&z3_wrapper<av1_dr_prediction_z3_c>,
|
||||
&z3_wrapper<av1_dr_prediction_z3_avx2>,
|
||||
AOM_BITS_8, kZ3Start)));
|
||||
|
||||
TEST_P(LowbdDrPredTest, DISABLED_Speed) {
|
||||
const int angles[] = { 3, 45, 87 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const int angle = angles[i] + start_angle_;
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
printf("enable_upsample: %d angle: %d ~~~~~~~~~~~~~~~\n",
|
||||
enable_upsample_, angle);
|
||||
if (dx_ && dy_) RunTest(true, false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(LowbdDrPredTest, OperationCheck) {
|
||||
if (params_.tst_fn == NULL) return;
|
||||
// const int angles[] = { 3, 45, 81, 87, 93, 100, 145, 187, 199, 260 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int angle = start_angle_; angle < stop_angle_; ++angle) {
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
if (dx_ && dy_) RunTest(false, false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, HighbdDrPredTest,
|
||||
::testing::Values(DrPredFunc<DrPred_Hbd>(
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_c>,
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_avx2>,
|
||||
AOM_BITS_8, kZ1Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_c>,
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_avx2>,
|
||||
AOM_BITS_10, kZ1Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_c>,
|
||||
&z1_wrapper_hbd<av1_highbd_dr_prediction_z1_avx2>,
|
||||
AOM_BITS_12, kZ1Start),
|
||||
/* TODO(https://crbug.com/aomedia/2288)
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_c>,
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_avx2>,
|
||||
AOM_BITS_8, kZ2Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_c>,
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_avx2>,
|
||||
AOM_BITS_10, kZ2Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_c>,
|
||||
&z2_wrapper_hbd<av1_highbd_dr_prediction_z2_avx2>,
|
||||
AOM_BITS_12, kZ2Start),
|
||||
*/
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_c>,
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_avx2>,
|
||||
AOM_BITS_8, kZ3Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_c>,
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_avx2>,
|
||||
AOM_BITS_10, kZ3Start),
|
||||
DrPredFunc<DrPred_Hbd>(
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_c>,
|
||||
&z3_wrapper_hbd<av1_highbd_dr_prediction_z3_avx2>,
|
||||
AOM_BITS_12, kZ3Start)));
|
||||
|
||||
TEST_P(HighbdDrPredTest, DISABLED_Speed) {
|
||||
const int angles[] = { 3, 45, 87 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int angle = angles[i] + start_angle_;
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
printf("enable_upsample: %d angle: %d ~~~~~~~~~~~~~~~\n",
|
||||
enable_upsample_, angle);
|
||||
if (dx_ && dy_) RunTest(true, false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(HighbdDrPredTest, OperationCheck) {
|
||||
if (params_.tst_fn == NULL) return;
|
||||
// const int angles[] = { 3, 45, 81, 87, 93, 100, 145, 187, 199, 260 };
|
||||
for (enable_upsample_ = 0; enable_upsample_ < 2; ++enable_upsample_) {
|
||||
for (int angle = start_angle_; angle < stop_angle_; angle++) {
|
||||
dx_ = av1_get_dx(angle);
|
||||
dy_ = av1_get_dy(angle);
|
||||
if (dx_ && dy_) RunTest(false, false, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
3
third_party/aom/test/ec_test.cc
vendored
3
third_party/aom/test/ec_test.cc
vendored
|
|
@ -22,7 +22,6 @@ TEST(EC_TEST, random_ec_test) {
|
|||
int sz;
|
||||
int i;
|
||||
int ret;
|
||||
unsigned int sym;
|
||||
unsigned int seed;
|
||||
unsigned char *ptr;
|
||||
uint32_t ptr_sz;
|
||||
|
|
@ -90,6 +89,8 @@ TEST(EC_TEST, random_ec_test) {
|
|||
<< " (Random seed: " << seed << ").\n";
|
||||
for (j = 0; j < sz; j++) {
|
||||
int dec_method;
|
||||
unsigned int sym = data[j] + 1; // Initialize sym to an invalid value.
|
||||
|
||||
if (CDF_SHIFT == 0) {
|
||||
dec_method = 3 + (rand() & 1);
|
||||
} else {
|
||||
|
|
|
|||
340
third_party/aom/test/edge_detect_test.cc
vendored
Normal file
340
third_party/aom/test/edge_detect_test.cc
vendored
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "av1/encoder/rdopt.h"
|
||||
#include "test/util.h"
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using ::testing::get;
|
||||
using ::testing::tuple;
|
||||
|
||||
static int get_pix(uint8_t *buf, int i, bool high_bd) {
|
||||
if (high_bd) {
|
||||
return *CONVERT_TO_SHORTPTR(buf + i);
|
||||
} else {
|
||||
return buf[i];
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the (i, j) value from the input; if i or j is outside of the width
|
||||
* or height, the nearest pixel value is returned.
|
||||
*/
|
||||
static int get_nearest_pix(const int *buf, int w, int h, int i, int j) {
|
||||
int offset = AOMMAX(AOMMIN(i, w - 1), 0) + w * AOMMAX(AOMMIN(j, h - 1), 0);
|
||||
return buf[offset];
|
||||
}
|
||||
|
||||
/** Given the image data, creates a new image with padded values, so an
|
||||
* 8-tap filter can be convolved. The padded value is the same as the closest
|
||||
* value in the image. Returns a pointer to the start of the image in the
|
||||
* padded data. Must be freed with free_pad_8tap. The output will be either
|
||||
* 8-bit or 16-bit, depending on the high bit-depth (high_bd) field.
|
||||
*/
|
||||
static uint8_t *pad_8tap_convolve(const int *data, int w, int h, bool high_bd) {
|
||||
// SIMD optimizations require the width to be a multiple of 8 and the height
|
||||
// to be multiples of 4.
|
||||
assert(w % 8 == 0);
|
||||
assert(h % 4 == 0);
|
||||
// For an 8-tap filter, we need to pad with 3 lines on top and on the left,
|
||||
// and 4 lines on the right and bottom, for 7 extra lines.
|
||||
const int pad_w = w + 7;
|
||||
const int pad_h = h + 7;
|
||||
|
||||
uint8_t *dst;
|
||||
if (high_bd) {
|
||||
dst =
|
||||
CONVERT_TO_BYTEPTR(aom_memalign(32, sizeof(uint16_t) * pad_w * pad_h));
|
||||
} else {
|
||||
dst = (uint8_t *)aom_memalign(32, sizeof(uint8_t) * pad_w * pad_h);
|
||||
}
|
||||
for (int j = 0; j < pad_h; ++j) {
|
||||
for (int i = 0; i < pad_w; ++i) {
|
||||
const int v = get_nearest_pix(data, w, h, i - 3, j - 3);
|
||||
if (high_bd) {
|
||||
*CONVERT_TO_SHORTPTR(dst + i + j * pad_w) = v;
|
||||
} else {
|
||||
dst[i + j * pad_w] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst + (w + 7) * 3 + 3;
|
||||
}
|
||||
|
||||
static int stride_8tap(int width) { return width + 7; }
|
||||
|
||||
static void free_pad_8tap(uint8_t *padded, int width, bool high_bd) {
|
||||
if (high_bd) {
|
||||
aom_free(CONVERT_TO_SHORTPTR(padded - (width + 7) * 3 - 3));
|
||||
} else {
|
||||
aom_free(padded - (width + 7) * 3 - 3);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t *malloc_bd(int num_entries, bool high_bd) {
|
||||
const int bytes_per_entry = high_bd ? sizeof(uint16_t) : sizeof(uint8_t);
|
||||
|
||||
uint8_t *buf = (uint8_t *)aom_memalign(32, bytes_per_entry * num_entries);
|
||||
if (high_bd) {
|
||||
return CONVERT_TO_BYTEPTR(buf);
|
||||
} else {
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
static void free_bd(uint8_t *p, bool high_bd) {
|
||||
if (high_bd) {
|
||||
aom_free(CONVERT_TO_SHORTPTR(p));
|
||||
} else {
|
||||
aom_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
class EdgeDetectBrightnessTest :
|
||||
// Parameters are (brightness, width, height, high bit depth representation,
|
||||
// bit depth).
|
||||
public ::testing::TestWithParam<tuple<int, int, int, bool, int> > {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// Allocate a (width by height) array of luma values in orig_.
|
||||
// padded_ will be filled by the pad() call, which adds a border around
|
||||
// the orig_. The output_ array has enough space for the computation.
|
||||
const int brightness = GET_PARAM(0);
|
||||
const int width = GET_PARAM(1);
|
||||
const int height = GET_PARAM(2);
|
||||
const bool high_bd = GET_PARAM(3);
|
||||
|
||||
// Create the padded image of uniform brightness.
|
||||
int *orig = (int *)malloc(width * height * sizeof(int));
|
||||
for (int i = 0; i < width * height; ++i) {
|
||||
orig[i] = brightness;
|
||||
}
|
||||
input_ = pad_8tap_convolve(orig, width, height, high_bd);
|
||||
free(orig);
|
||||
output_ = malloc_bd(width * height, high_bd);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
const int width = GET_PARAM(1);
|
||||
const bool high_bd = GET_PARAM(3);
|
||||
free_pad_8tap(input_, width, high_bd);
|
||||
free_bd(output_, high_bd);
|
||||
}
|
||||
|
||||
// Skip the tests where brightness exceeds the bit-depth; we run into this
|
||||
// issue because of gtest's limitation on valid combinations of test
|
||||
// parameters. Also skip the tests where bit depth is greater than 8, but
|
||||
// high bit depth representation is not set.
|
||||
bool should_skip() const {
|
||||
const int brightness = GET_PARAM(0);
|
||||
const int bd = GET_PARAM(4);
|
||||
if (brightness >= (1 << bd)) {
|
||||
return true;
|
||||
}
|
||||
const bool high_bd = GET_PARAM(3);
|
||||
if (bd > 8 && !high_bd) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t *input_;
|
||||
uint8_t *output_;
|
||||
};
|
||||
|
||||
TEST_P(EdgeDetectBrightnessTest, BlurUniformBrightness) {
|
||||
// Some combination of parameters are non-sensical, due to limitations
|
||||
// of the testing framework. Ignore these.
|
||||
if (should_skip()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For varying levels of brightness, the algorithm should
|
||||
// produce the same output.
|
||||
const int brightness = GET_PARAM(0);
|
||||
const int width = GET_PARAM(1);
|
||||
const int height = GET_PARAM(2);
|
||||
const bool high_bd = GET_PARAM(3);
|
||||
const int bd = GET_PARAM(4);
|
||||
|
||||
gaussian_blur(input_, stride_8tap(width), width, height, output_, high_bd,
|
||||
bd);
|
||||
for (int i = 0; i < width * height; ++i) {
|
||||
ASSERT_EQ(brightness, get_pix(output_, i, high_bd));
|
||||
}
|
||||
}
|
||||
|
||||
// No edges on a uniformly bright image.
|
||||
TEST_P(EdgeDetectBrightnessTest, DetectUniformBrightness) {
|
||||
if (should_skip()) {
|
||||
return;
|
||||
}
|
||||
const int width = GET_PARAM(1);
|
||||
const int height = GET_PARAM(2);
|
||||
const bool high_bd = GET_PARAM(3);
|
||||
const int bd = GET_PARAM(4);
|
||||
|
||||
ASSERT_EQ(0, av1_edge_exists(input_, stride_8tap(width), width, height,
|
||||
high_bd, bd));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ImageBrightnessTests, EdgeDetectBrightnessTest,
|
||||
::testing::Combine(
|
||||
// Brightness
|
||||
::testing::Values(0, 1, 2, 127, 128, 129, 254, 255,
|
||||
256, 511, 512, 1023, 1024, 2048,
|
||||
4095),
|
||||
// Width
|
||||
::testing::Values(8, 16, 32),
|
||||
// Height
|
||||
::testing::Values(4, 8, 12, 32),
|
||||
// High bit depth representation
|
||||
::testing::Bool(),
|
||||
// Bit depth
|
||||
::testing::Values(8, 10, 12)));
|
||||
|
||||
class EdgeDetectImageTest :
|
||||
// Parameters are (width, height, high bit depth representation, bit depth).
|
||||
public ::testing::TestWithParam<tuple<int, int, bool, int> > {
|
||||
protected:
|
||||
// Skip the tests where bit depth is greater than 8, but high bit depth
|
||||
// representation is not set (limitation of testing framework).
|
||||
bool should_skip() const {
|
||||
const bool high_bd = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(3);
|
||||
return bd > 8 && !high_bd;
|
||||
}
|
||||
};
|
||||
|
||||
// Generate images with black on one side and white on the other.
|
||||
TEST_P(EdgeDetectImageTest, BlackWhite) {
|
||||
// Some combination of parameters are non-sensical, due to limitations
|
||||
// of the testing framework. Ignore these.
|
||||
if (should_skip()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int width = GET_PARAM(0);
|
||||
const int height = GET_PARAM(1);
|
||||
const bool high_bd = GET_PARAM(2);
|
||||
const int bd = GET_PARAM(3);
|
||||
|
||||
const int white = (1 << bd) - 1;
|
||||
int *orig = (int *)malloc(width * height * sizeof(int));
|
||||
for (int j = 0; j < height; ++j) {
|
||||
for (int i = 0; i < width; ++i) {
|
||||
if (i < width / 2) {
|
||||
orig[i + j * width] = 0;
|
||||
} else {
|
||||
orig[i + j * width] = white;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint8_t *padded = pad_8tap_convolve(orig, width, height, high_bd);
|
||||
free(orig);
|
||||
// Value should be between 556 and 560.
|
||||
ASSERT_LE(556, av1_edge_exists(padded, stride_8tap(width), width, height,
|
||||
high_bd, bd));
|
||||
ASSERT_GE(560, av1_edge_exists(padded, stride_8tap(width), width, height,
|
||||
high_bd, bd));
|
||||
|
||||
free_pad_8tap(padded, width, high_bd);
|
||||
}
|
||||
|
||||
// Hardcoded blur tests.
|
||||
static const int luma[32] = { 241, 147, 7, 90, 184, 103, 28, 186,
|
||||
2, 248, 49, 242, 114, 146, 127, 22,
|
||||
121, 228, 167, 108, 158, 174, 41, 168,
|
||||
214, 99, 184, 109, 114, 247, 117, 119 };
|
||||
static const uint8_t expected[] = { 161, 138, 119, 118, 123, 118, 113, 122,
|
||||
143, 140, 134, 133, 134, 126, 116, 114,
|
||||
147, 149, 145, 142, 143, 138, 126, 118,
|
||||
164, 156, 148, 144, 148, 148, 138, 126 };
|
||||
|
||||
static void hardcoded_blur_test_aux(const bool high_bd) {
|
||||
const int w = 8;
|
||||
const int h = 4;
|
||||
for (int bd = 8; bd <= 12; bd += 2) {
|
||||
// Skip the tests where bit depth is greater than 8, but high bit depth
|
||||
// representation is not set.
|
||||
if (bd > 8 && !high_bd) {
|
||||
break;
|
||||
}
|
||||
uint8_t *output = malloc_bd(w * h, high_bd);
|
||||
uint8_t *padded = pad_8tap_convolve(luma, w, h, high_bd);
|
||||
gaussian_blur(padded, stride_8tap(w), w, h, output, high_bd, bd);
|
||||
for (int i = 0; i < w * h; ++i) {
|
||||
ASSERT_EQ(expected[i], get_pix(output, i, high_bd));
|
||||
}
|
||||
free_pad_8tap(padded, w, high_bd);
|
||||
free_bd(output, high_bd);
|
||||
|
||||
// If we multiply the inputs by a constant factor, the output should not
|
||||
// vary more than 0.5 * factor.
|
||||
for (int c = 2; c < (1 << (bd - 8)); ++c) {
|
||||
int scaled_luma[32];
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
scaled_luma[i] = luma[i] * c;
|
||||
}
|
||||
uint8_t *output = malloc_bd(w * h, high_bd);
|
||||
uint8_t *padded = pad_8tap_convolve(scaled_luma, w, h, high_bd);
|
||||
gaussian_blur(padded, stride_8tap(w), w, h, output, high_bd, bd);
|
||||
for (int i = 0; i < w * h; ++i) {
|
||||
ASSERT_GE(c / 2, abs(expected[i] * c - get_pix(output, i, high_bd)));
|
||||
}
|
||||
free_pad_8tap(padded, w, high_bd);
|
||||
free_bd(output, high_bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EdgeDetectImageTest, HardcodedBlurTest) {
|
||||
hardcoded_blur_test_aux(false);
|
||||
hardcoded_blur_test_aux(true);
|
||||
}
|
||||
|
||||
TEST(EdgeDetectImageTest, SobelTest) {
|
||||
// Randomly generated 3x3. Compute Sobel for middle value.
|
||||
const uint8_t buf[9] = { 241, 147, 7, 90, 184, 103, 28, 186, 2 };
|
||||
const int stride = 3;
|
||||
bool high_bd = false;
|
||||
sobel_xy result = sobel(buf, stride, 1, 1, high_bd);
|
||||
ASSERT_EQ(234, result.x);
|
||||
ASSERT_EQ(140, result.y);
|
||||
|
||||
// Verify it works for 8-bit values in a high bit-depth buffer.
|
||||
const uint16_t buf8_16[9] = { 241, 147, 7, 90, 184, 103, 28, 186, 2 };
|
||||
high_bd = true;
|
||||
result = sobel(CONVERT_TO_BYTEPTR(buf8_16), stride, 1, 1, high_bd);
|
||||
ASSERT_EQ(234, result.x);
|
||||
ASSERT_EQ(140, result.y);
|
||||
|
||||
// Verify it works for high bit-depth values as well.
|
||||
const uint16_t buf16[9] = { 241, 147, 7, 90, 184, 2003, 1028, 186, 2 };
|
||||
result = sobel(CONVERT_TO_BYTEPTR(buf16), stride, 1, 1, high_bd);
|
||||
ASSERT_EQ(-2566, result.x);
|
||||
ASSERT_EQ(-860, result.y);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EdgeDetectImages, EdgeDetectImageTest,
|
||||
::testing::Combine(
|
||||
// Width
|
||||
::testing::Values(8, 16, 32),
|
||||
// Height
|
||||
::testing::Values(4, 8, 12, 32),
|
||||
// High bit depth representation
|
||||
::testing::Bool(),
|
||||
// Bit depth
|
||||
::testing::Values(8, 10, 12)));
|
||||
} // namespace
|
||||
5
third_party/aom/test/encode_test_driver.cc
vendored
5
third_party/aom/test/encode_test_driver.cc
vendored
|
|
@ -9,6 +9,7 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
|
@ -192,7 +193,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
|||
cfg_.g_pass = AOM_RC_LAST_PASS;
|
||||
|
||||
BeginPassHook(pass);
|
||||
testing::internal::scoped_ptr<Encoder> encoder(
|
||||
std::unique_ptr<Encoder> encoder(
|
||||
codec_->CreateEncoder(cfg_, init_flags_, &stats_));
|
||||
ASSERT_TRUE(encoder.get() != NULL);
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
|||
|
||||
ASSERT_FALSE(::testing::Test::HasFatalFailure());
|
||||
|
||||
testing::internal::scoped_ptr<Decoder> decoder(
|
||||
std::unique_ptr<Decoder> decoder(
|
||||
codec_->CreateDecoder(dec_cfg, 0 /* flags */));
|
||||
#if CONFIG_AV1_DECODER
|
||||
if (decoder->IsAV1()) {
|
||||
|
|
|
|||
13
third_party/aom/test/end_to_end_test.cc
vendored
13
third_party/aom/test/end_to_end_test.cc
vendored
|
|
@ -9,6 +9,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
|
|
@ -51,6 +53,13 @@ typedef struct {
|
|||
unsigned int profile;
|
||||
} TestVideoParam;
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const TestVideoParam &test_arg) {
|
||||
return os << "TestVideoParam { filename:" << test_arg.filename
|
||||
<< " input_bit_depth:" << test_arg.input_bit_depth
|
||||
<< " fmt:" << test_arg.fmt << " bit_depth:" << test_arg.bit_depth
|
||||
<< " profile:" << test_arg.profile << "}";
|
||||
}
|
||||
|
||||
const TestVideoParam kTestVectors[] = {
|
||||
{ "park_joy_90p_8_420.y4m", 8, AOM_IMG_FMT_I420, AOM_BITS_8, 0 },
|
||||
{ "park_joy_90p_8_422.y4m", 8, AOM_IMG_FMT_I422, AOM_BITS_8, 2 },
|
||||
|
|
@ -120,7 +129,7 @@ class EndToEndTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, 4);
|
||||
encoder->Control(AOME_SET_CPUUSED, cpu_used_);
|
||||
|
|
@ -155,7 +164,7 @@ class EndToEndTest
|
|||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
if (cfg_.g_bit_depth > 8) init_flags_ |= AOM_CODEC_USE_HIGHBITDEPTH;
|
||||
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
|
||||
std::unique_ptr<libaom_test::VideoSource> video;
|
||||
if (is_extension_y4m(test_video_param_.filename)) {
|
||||
video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
kFrames));
|
||||
|
|
|
|||
19
third_party/aom/test/error_resilience_test.cc
vendored
19
third_party/aom/test/error_resilience_test.cc
vendored
|
|
@ -145,6 +145,23 @@ class ErrorResilienceTestLarge
|
|||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) {
|
||||
// Check that the encode frame flags are correctly reflected
|
||||
// in the output frame flags.
|
||||
const int encode_flags = pkt->data.frame.flags >> 16;
|
||||
if ((encode_flags & (AOM_EFLAG_NO_UPD_LAST | AOM_EFLAG_NO_UPD_GF |
|
||||
AOM_EFLAG_NO_UPD_ARF)) ==
|
||||
(AOM_EFLAG_NO_UPD_LAST | AOM_EFLAG_NO_UPD_GF | AOM_EFLAG_NO_UPD_ARF)) {
|
||||
ASSERT_TRUE(!!(pkt->data.frame.flags & AOM_FRAME_IS_DROPPABLE));
|
||||
}
|
||||
if (encode_flags & AOM_EFLAG_SET_S_FRAME) {
|
||||
ASSERT_TRUE(!!(pkt->data.frame.flags & AOM_FRAME_IS_SWITCH));
|
||||
}
|
||||
if (encode_flags & AOM_EFLAG_ERROR_RESILIENT) {
|
||||
ASSERT_TRUE(!!(pkt->data.frame.flags & AOM_FRAME_IS_ERROR_RESILIENT));
|
||||
}
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_) return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
|
|
@ -342,7 +359,7 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
|
|||
|
||||
// Set an arbitrary set of error frames same as droppable frames.
|
||||
unsigned int num_droppable_frames = 3;
|
||||
unsigned int droppable_frame_list[] = { 5, 10, 13 };
|
||||
unsigned int droppable_frame_list[] = { 5, 11, 13 };
|
||||
SetDroppableFrames(num_droppable_frames, droppable_frame_list);
|
||||
SetErrorFrames(num_droppable_frames, droppable_frame_list);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
|
|
|||
166
third_party/aom/test/ethread_test.cc
vendored
166
third_party/aom/test/ethread_test.cc
vendored
|
|
@ -20,14 +20,15 @@
|
|||
|
||||
namespace {
|
||||
class AVxEncoderThreadTest
|
||||
: public ::libaom_test::CodecTestWith4Params<libaom_test::TestMode, int,
|
||||
int, int>,
|
||||
: public ::libaom_test::CodecTestWith5Params<libaom_test::TestMode, int,
|
||||
int, int, int>,
|
||||
public ::libaom_test::EncoderTest {
|
||||
protected:
|
||||
AVxEncoderThreadTest()
|
||||
: EncoderTest(GET_PARAM(0)), encoder_initialized_(false),
|
||||
encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)),
|
||||
tile_cols_(GET_PARAM(3)), tile_rows_(GET_PARAM(4)) {
|
||||
tile_cols_(GET_PARAM(3)), tile_rows_(GET_PARAM(4)),
|
||||
row_mt_(GET_PARAM(5)) {
|
||||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t();
|
||||
cfg.w = 1280;
|
||||
|
|
@ -119,87 +120,87 @@ class AVxEncoderThreadTest
|
|||
"niklas_640_480_30.yuv", AOM_IMG_FMT_I420, 640, 480, 30, 1, 15, 21);
|
||||
cfg_.rc_target_bitrate = 1000;
|
||||
|
||||
// Encode using single thread.
|
||||
row_mt_ = 0;
|
||||
cfg_.g_threads = 1;
|
||||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> single_thr_size_enc;
|
||||
std::vector<std::string> single_thr_md5_enc;
|
||||
std::vector<std::string> single_thr_md5_dec;
|
||||
single_thr_size_enc = size_enc_;
|
||||
single_thr_md5_enc = md5_enc_;
|
||||
single_thr_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
if (row_mt_ == 0) {
|
||||
// Encode using single thread.
|
||||
cfg_.g_threads = 1;
|
||||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> single_thr_size_enc;
|
||||
std::vector<std::string> single_thr_md5_enc;
|
||||
std::vector<std::string> single_thr_md5_dec;
|
||||
single_thr_size_enc = size_enc_;
|
||||
single_thr_md5_enc = md5_enc_;
|
||||
single_thr_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
|
||||
// Encode using multiple threads.
|
||||
cfg_.g_threads = 4;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr_size_enc;
|
||||
std::vector<std::string> multi_thr_md5_enc;
|
||||
std::vector<std::string> multi_thr_md5_dec;
|
||||
multi_thr_size_enc = size_enc_;
|
||||
multi_thr_md5_enc = md5_enc_;
|
||||
multi_thr_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
// Encode using multiple threads.
|
||||
cfg_.g_threads = 4;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr_size_enc;
|
||||
std::vector<std::string> multi_thr_md5_enc;
|
||||
std::vector<std::string> multi_thr_md5_dec;
|
||||
multi_thr_size_enc = size_enc_;
|
||||
multi_thr_md5_enc = md5_enc_;
|
||||
multi_thr_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
|
||||
// Check that the vectors are equal.
|
||||
ASSERT_EQ(single_thr_size_enc, multi_thr_size_enc);
|
||||
ASSERT_EQ(single_thr_md5_enc, multi_thr_md5_enc);
|
||||
ASSERT_EQ(single_thr_md5_dec, multi_thr_md5_dec);
|
||||
// Check that the vectors are equal.
|
||||
ASSERT_EQ(single_thr_size_enc, multi_thr_size_enc);
|
||||
ASSERT_EQ(single_thr_md5_enc, multi_thr_md5_enc);
|
||||
ASSERT_EQ(single_thr_md5_dec, multi_thr_md5_dec);
|
||||
} else if (row_mt_ == 1) {
|
||||
// Encode using multiple threads row-mt enabled.
|
||||
cfg_.g_threads = 2;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr2_row_mt_size_enc;
|
||||
std::vector<std::string> multi_thr2_row_mt_md5_enc;
|
||||
std::vector<std::string> multi_thr2_row_mt_md5_dec;
|
||||
multi_thr2_row_mt_size_enc = size_enc_;
|
||||
multi_thr2_row_mt_md5_enc = md5_enc_;
|
||||
multi_thr2_row_mt_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
|
||||
// Encode using multiple threads row-mt enabled.
|
||||
row_mt_ = 1;
|
||||
cfg_.g_threads = 2;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr2_row_mt_size_enc;
|
||||
std::vector<std::string> multi_thr2_row_mt_md5_enc;
|
||||
std::vector<std::string> multi_thr2_row_mt_md5_dec;
|
||||
multi_thr2_row_mt_size_enc = size_enc_;
|
||||
multi_thr2_row_mt_md5_enc = md5_enc_;
|
||||
multi_thr2_row_mt_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
// Disable threads=3 test for now to reduce the time so that the nightly
|
||||
// test would not time out.
|
||||
// cfg_.g_threads = 3;
|
||||
// ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// std::vector<size_t> multi_thr3_row_mt_size_enc;
|
||||
// std::vector<std::string> multi_thr3_row_mt_md5_enc;
|
||||
// std::vector<std::string> multi_thr3_row_mt_md5_dec;
|
||||
// multi_thr3_row_mt_size_enc = size_enc_;
|
||||
// multi_thr3_row_mt_md5_enc = md5_enc_;
|
||||
// multi_thr3_row_mt_md5_dec = md5_dec_;
|
||||
// size_enc_.clear();
|
||||
// md5_enc_.clear();
|
||||
// md5_dec_.clear();
|
||||
// Check that the vectors are equal.
|
||||
// ASSERT_EQ(multi_thr3_row_mt_size_enc, multi_thr2_row_mt_size_enc);
|
||||
// ASSERT_EQ(multi_thr3_row_mt_md5_enc, multi_thr2_row_mt_md5_enc);
|
||||
// ASSERT_EQ(multi_thr3_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
|
||||
|
||||
// Disable threads=3 test for now to reduce the time so that the nightly
|
||||
// test would not time out.
|
||||
// cfg_.g_threads = 3;
|
||||
// ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// std::vector<size_t> multi_thr3_row_mt_size_enc;
|
||||
// std::vector<std::string> multi_thr3_row_mt_md5_enc;
|
||||
// std::vector<std::string> multi_thr3_row_mt_md5_dec;
|
||||
// multi_thr3_row_mt_size_enc = size_enc_;
|
||||
// multi_thr3_row_mt_md5_enc = md5_enc_;
|
||||
// multi_thr3_row_mt_md5_dec = md5_dec_;
|
||||
// size_enc_.clear();
|
||||
// md5_enc_.clear();
|
||||
// md5_dec_.clear();
|
||||
// Check that the vectors are equal.
|
||||
// ASSERT_EQ(multi_thr3_row_mt_size_enc, multi_thr2_row_mt_size_enc);
|
||||
// ASSERT_EQ(multi_thr3_row_mt_md5_enc, multi_thr2_row_mt_md5_enc);
|
||||
// ASSERT_EQ(multi_thr3_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
|
||||
cfg_.g_threads = 4;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr4_row_mt_size_enc;
|
||||
std::vector<std::string> multi_thr4_row_mt_md5_enc;
|
||||
std::vector<std::string> multi_thr4_row_mt_md5_dec;
|
||||
multi_thr4_row_mt_size_enc = size_enc_;
|
||||
multi_thr4_row_mt_md5_enc = md5_enc_;
|
||||
multi_thr4_row_mt_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
|
||||
cfg_.g_threads = 4;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
std::vector<size_t> multi_thr4_row_mt_size_enc;
|
||||
std::vector<std::string> multi_thr4_row_mt_md5_enc;
|
||||
std::vector<std::string> multi_thr4_row_mt_md5_dec;
|
||||
multi_thr4_row_mt_size_enc = size_enc_;
|
||||
multi_thr4_row_mt_md5_enc = md5_enc_;
|
||||
multi_thr4_row_mt_md5_dec = md5_dec_;
|
||||
size_enc_.clear();
|
||||
md5_enc_.clear();
|
||||
md5_dec_.clear();
|
||||
|
||||
// Check that the vectors are equal.
|
||||
ASSERT_EQ(multi_thr4_row_mt_size_enc, multi_thr2_row_mt_size_enc);
|
||||
ASSERT_EQ(multi_thr4_row_mt_md5_enc, multi_thr2_row_mt_md5_enc);
|
||||
ASSERT_EQ(multi_thr4_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
|
||||
// Check that the vectors are equal.
|
||||
ASSERT_EQ(multi_thr4_row_mt_size_enc, multi_thr2_row_mt_size_enc);
|
||||
ASSERT_EQ(multi_thr4_row_mt_md5_enc, multi_thr2_row_mt_md5_enc);
|
||||
ASSERT_EQ(multi_thr4_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
|
||||
}
|
||||
}
|
||||
|
||||
bool encoder_initialized_;
|
||||
|
|
@ -233,14 +234,15 @@ TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) {
|
|||
AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest,
|
||||
::testing::Values(::libaom_test::kTwoPassGood),
|
||||
::testing::Range(2, 4), ::testing::Values(0, 2),
|
||||
::testing::Values(0, 1));
|
||||
::testing::Values(0, 1), ::testing::Values(0, 1));
|
||||
|
||||
// Test cpu_used 0 and 1.
|
||||
AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge,
|
||||
::testing::Values(::libaom_test::kTwoPassGood,
|
||||
::libaom_test::kOnePassGood),
|
||||
::testing::Range(0, 2), ::testing::Values(0, 1, 2, 6),
|
||||
::testing::Values(0, 1, 2, 6));
|
||||
::testing::Values(0, 1, 2, 6),
|
||||
::testing::Values(0, 1));
|
||||
|
||||
class AVxEncoderThreadLSTest : public AVxEncoderThreadTest {
|
||||
virtual void SetTileSize(libaom_test::Encoder *encoder) {
|
||||
|
|
@ -269,5 +271,5 @@ AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge,
|
|||
::testing::Values(::libaom_test::kTwoPassGood,
|
||||
::libaom_test::kOnePassGood),
|
||||
::testing::Range(0, 4), ::testing::Values(0, 6),
|
||||
::testing::Values(0, 6));
|
||||
::testing::Values(0, 6), ::testing::Values(0, 1));
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "common/tools_common.h"
|
||||
#include "config/aom_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
|
|
@ -57,7 +58,7 @@ class ExternalFrameBufferList {
|
|||
|
||||
// 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
|
||||
// frame buffer is in use by libaom. Finally sets |fb| to point to the
|
||||
// external frame buffer. Returns < 0 on an error.
|
||||
int GetFreeFrameBuffer(size_t min_size, aom_codec_frame_buffer_t *fb) {
|
||||
EXPECT_TRUE(fb != NULL);
|
||||
|
|
@ -113,9 +114,9 @@ class ExternalFrameBufferList {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Checks that the ximage data is contained within the external frame buffer
|
||||
// private data passed back in the ximage.
|
||||
void CheckXImageFrameBuffer(const aom_image_t *img) {
|
||||
// Checks that the aom_image_t data is contained within the external frame
|
||||
// buffer private data passed back in the aom_image_t.
|
||||
void CheckImageFrameBuffer(const aom_image_t *img) {
|
||||
if (img->fb_priv != NULL) {
|
||||
const struct ExternalFrameBuffer *const ext_fb =
|
||||
reinterpret_cast<ExternalFrameBuffer *>(img->fb_priv);
|
||||
|
|
@ -157,7 +158,7 @@ class ExternalFrameBufferList {
|
|||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
||||
// Callback used by libvpx to request the application to return a frame
|
||||
// Callback used by libaom to request the application to return a frame
|
||||
// buffer of at least |min_size| in bytes.
|
||||
int get_aom_frame_buffer(void *user_priv, size_t min_size,
|
||||
aom_codec_frame_buffer_t *fb) {
|
||||
|
|
@ -166,7 +167,7 @@ int get_aom_frame_buffer(void *user_priv, size_t min_size,
|
|||
return fb_list->GetFreeFrameBuffer(min_size, fb);
|
||||
}
|
||||
|
||||
// Callback used by libvpx to tell the application that |fb| is not needed
|
||||
// Callback used by libaom to tell the application that |fb| is not needed
|
||||
// anymore.
|
||||
int release_aom_frame_buffer(void *user_priv, aom_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferList *const fb_list =
|
||||
|
|
@ -217,7 +218,7 @@ class ExternalFrameBufferMD5Test
|
|||
const libaom_test::CompressedVideoSource &video,
|
||||
libaom_test::Decoder *decoder) {
|
||||
if (num_buffers_ > 0 && video.frame_number() == 0) {
|
||||
// Have libvpx use frame buffers we create.
|
||||
// Have libaom use frame buffers we create.
|
||||
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
|
||||
ASSERT_EQ(AOM_CODEC_OK,
|
||||
decoder->SetFrameBufferFunctions(GetAV1FrameBuffer,
|
||||
|
|
@ -243,7 +244,23 @@ class ExternalFrameBufferMD5Test
|
|||
expected_md5[32] = '\0';
|
||||
|
||||
::libaom_test::MD5 md5_res;
|
||||
md5_res.Add(&img);
|
||||
#if !CONFIG_LOWBITDEPTH
|
||||
const aom_img_fmt_t shifted_fmt =
|
||||
(aom_img_fmt)(img.fmt & ~AOM_IMG_FMT_HIGHBITDEPTH);
|
||||
if (img.bit_depth == 8 && shifted_fmt != img.fmt) {
|
||||
aom_image_t *img_shifted =
|
||||
aom_img_alloc(NULL, shifted_fmt, img.d_w, img.d_h, 16);
|
||||
img_shifted->bit_depth = img.bit_depth;
|
||||
img_shifted->monochrome = img.monochrome;
|
||||
aom_img_downshift(img_shifted, &img, 0);
|
||||
md5_res.Add(img_shifted);
|
||||
aom_img_free(img_shifted);
|
||||
} else {
|
||||
#endif
|
||||
md5_res.Add(&img);
|
||||
#if !CONFIG_LOWBITDEPTH
|
||||
}
|
||||
#endif
|
||||
const char *const actual_md5 = md5_res.Get();
|
||||
|
||||
// Check md5 match.
|
||||
|
|
@ -279,16 +296,16 @@ class ExternalFrameBufferMD5Test
|
|||
};
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
const char kAV1TestFile[] = "av1-1-b8-01-size-226x226.ivf";
|
||||
const char kAV1TestFile[] = "av1-1-b8-03-sizeup.mkv";
|
||||
const char kAV1NonRefTestFile[] = "av1-1-b8-01-size-226x226.ivf";
|
||||
|
||||
// Class for testing passing in external frame buffers to libvpx.
|
||||
// Class for testing passing in external frame buffers to libaom.
|
||||
class ExternalFrameBufferTest : public ::testing::Test {
|
||||
protected:
|
||||
ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
video_ = new libaom_test::IVFVideoSource(kAV1TestFile);
|
||||
video_ = new libaom_test::WebMVideoSource(kAV1TestFile);
|
||||
ASSERT_TRUE(video_ != NULL);
|
||||
video_->Init();
|
||||
video_->Begin();
|
||||
|
|
@ -305,7 +322,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
|||
video_ = NULL;
|
||||
}
|
||||
|
||||
// Passes the external frame buffer information to libvpx.
|
||||
// Passes the external frame buffer information to libaom.
|
||||
aom_codec_err_t SetFrameBufferFunctions(
|
||||
int num_buffers, aom_get_frame_buffer_cb_fn_t cb_get,
|
||||
aom_release_frame_buffer_cb_fn_t cb_release) {
|
||||
|
|
@ -342,11 +359,11 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
|||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next()) != NULL) {
|
||||
fb_list_.CheckXImageFrameBuffer(img);
|
||||
fb_list_.CheckImageFrameBuffer(img);
|
||||
}
|
||||
}
|
||||
|
||||
libaom_test::IVFVideoSource *video_;
|
||||
libaom_test::CompressedVideoSource *video_;
|
||||
libaom_test::AV1Decoder *decoder_;
|
||||
int num_buffers_;
|
||||
ExternalFrameBufferList fb_list_;
|
||||
|
|
@ -373,12 +390,13 @@ class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
|
|||
#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
|
||||
// Libaom 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, DISABLED_ExtFBMD5Match) {
|
||||
TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
|
||||
const std::string filename = GET_PARAM(kVideoNameParam);
|
||||
aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t();
|
||||
|
||||
// Number of buffers equals #AOM_MAXIMUM_REF_BUFFERS +
|
||||
// #AOM_MAXIMUM_WORK_BUFFERS + four jitter buffers.
|
||||
|
|
@ -388,7 +406,7 @@ TEST_P(ExternalFrameBufferMD5Test, DISABLED_ExtFBMD5Match) {
|
|||
set_num_buffers(num_buffers);
|
||||
|
||||
// Open compressed video file.
|
||||
testing::internal::scoped_ptr<libaom_test::CompressedVideoSource> video;
|
||||
std::unique_ptr<libaom_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video.reset(new libaom_test::IVFVideoSource(filename));
|
||||
} else {
|
||||
|
|
@ -407,8 +425,12 @@ TEST_P(ExternalFrameBufferMD5Test, DISABLED_ExtFBMD5Match) {
|
|||
const std::string md5_filename = filename + ".md5";
|
||||
OpenMD5File(md5_filename);
|
||||
|
||||
// Set decode config.
|
||||
cfg.allow_lowbitdepth = CONFIG_LOWBITDEPTH;
|
||||
set_cfg(cfg);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
|
||||
}
|
||||
|
||||
#if CONFIG_WEBM_IO
|
||||
|
|
@ -434,7 +456,7 @@ TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
|
|||
ASSERT_EQ(AOM_CODEC_OK, DecodeRemainingFrames());
|
||||
}
|
||||
|
||||
TEST_F(ExternalFrameBufferTest, DISABLED_NotEnoughBuffers) {
|
||||
TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
|
||||
// Minimum number of external frame buffers for AV1 is
|
||||
// #AOM_MAXIMUM_REF_BUFFERS + #AOM_MAXIMUM_WORK_BUFFERS. Most files will
|
||||
// only use 5 frame buffers at one time.
|
||||
|
|
@ -448,7 +470,7 @@ TEST_F(ExternalFrameBufferTest, DISABLED_NotEnoughBuffers) {
|
|||
ASSERT_EQ(AOM_CODEC_MEM_ERROR, DecodeRemainingFrames());
|
||||
}
|
||||
|
||||
TEST_F(ExternalFrameBufferTest, DISABLED_NoRelease) {
|
||||
TEST_F(ExternalFrameBufferTest, NoRelease) {
|
||||
const int num_buffers = AOM_MAXIMUM_REF_BUFFERS + AOM_MAXIMUM_WORK_BUFFERS;
|
||||
ASSERT_EQ(AOM_CODEC_OK,
|
||||
SetFrameBufferFunctions(num_buffers, get_aom_frame_buffer,
|
||||
|
|
|
|||
2
third_party/aom/test/filterintra_test.cc
vendored
2
third_party/aom/test/filterintra_test.cc
vendored
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using ::testing::tuple;
|
||||
|
||||
typedef void (*Predictor)(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
|
||||
const uint8_t *above, const uint8_t *left, int mode);
|
||||
|
|
|
|||
2
third_party/aom/test/frame_size_tests.cc
vendored
2
third_party/aom/test/frame_size_tests.cc
vendored
|
|
@ -35,7 +35,7 @@ class AV1FrameSizeTests : public ::testing::Test,
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, 7);
|
||||
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);
|
||||
|
|
|
|||
4
third_party/aom/test/hiprec_convolve_test.cc
vendored
4
third_party/aom/test/hiprec_convolve_test.cc
vendored
|
|
@ -12,11 +12,11 @@
|
|||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
#include "test/hiprec_convolve_test_util.h"
|
||||
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::AV1HighbdHiprecConvolve::AV1HighbdHiprecConvolveTest;
|
||||
using libaom_test::AV1HiprecConvolve::AV1HiprecConvolveTest;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ static void generate_kernels(ACMRandom *rnd, InterpKernel hkernel,
|
|||
hkernel[2] = hkernel[4] =
|
||||
WIENER_FILT_TAP2_MINV +
|
||||
rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
|
||||
hkernel[3] = -(hkernel[0] + hkernel[1] + hkernel[2]);
|
||||
hkernel[3] = -2 * (hkernel[0] + hkernel[1] + hkernel[2]);
|
||||
hkernel[7] = 0;
|
||||
|
||||
vkernel[0] = vkernel[6] =
|
||||
|
|
@ -43,7 +43,7 @@ static void generate_kernels(ACMRandom *rnd, InterpKernel hkernel,
|
|||
vkernel[2] = vkernel[4] =
|
||||
WIENER_FILT_TAP2_MINV +
|
||||
rnd->PseudoUniform(WIENER_FILT_TAP2_MAXV + 1 - WIENER_FILT_TAP2_MINV);
|
||||
vkernel[3] = -(vkernel[0] + vkernel[1] + vkernel[2]);
|
||||
vkernel[3] = -2 * (vkernel[0] + vkernel[1] + vkernel[2]);
|
||||
vkernel[7] = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
146
third_party/aom/test/horver_correlation_test.cc
vendored
Normal file
146
third_party/aom/test/horver_correlation_test.cc
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
typedef void (*HorverFunc)(const int16_t *diff, int stride, int w, int h,
|
||||
float *hcorr, float *vcorr);
|
||||
|
||||
typedef ::testing::tuple<const HorverFunc> HorverTestParam;
|
||||
|
||||
class HorverTest : public ::testing::TestWithParam<HorverTestParam> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
data_buf_ = (int16_t *)aom_malloc(MAX_SB_SQUARE * sizeof(int16_t));
|
||||
ASSERT_NE(data_buf_, nullptr);
|
||||
target_func_ = GET_PARAM(0);
|
||||
}
|
||||
virtual void TearDown() { aom_free(data_buf_); }
|
||||
void RunHorverTest(void);
|
||||
void RunHorverTest_ExtremeValues(void);
|
||||
void RunHorverSpeedTest(int run_times);
|
||||
|
||||
private:
|
||||
HorverFunc target_func_;
|
||||
ACMRandom rng_;
|
||||
int16_t *data_buf_;
|
||||
};
|
||||
|
||||
void HorverTest::RunHorverTest(void) {
|
||||
for (int block_size = 0; block_size < BLOCK_SIZES_ALL; block_size++) {
|
||||
const int w = block_size_wide[block_size];
|
||||
const int h = block_size_high[block_size];
|
||||
for (int iter = 0; iter < 1000 && !HasFatalFailure(); ++iter) {
|
||||
float hcorr_ref = 0.0, vcorr_ref = 0.0;
|
||||
float hcorr_test = 0.0, vcorr_test = 0.0;
|
||||
|
||||
for (int i = 0; i < MAX_SB_SQUARE; ++i) {
|
||||
data_buf_[i] = (rng_.Rand16() % (1 << 12)) - (1 << 11);
|
||||
}
|
||||
|
||||
av1_get_horver_correlation_full_c(data_buf_, MAX_SB_SIZE, w, h,
|
||||
&hcorr_ref, &vcorr_ref);
|
||||
|
||||
target_func_(data_buf_, MAX_SB_SIZE, w, h, &hcorr_test, &vcorr_test);
|
||||
|
||||
ASSERT_LE(fabs(hcorr_ref - hcorr_test), 1e-6)
|
||||
<< "hcorr incorrect (" << w << "x" << h << ")";
|
||||
ASSERT_LE(fabs(vcorr_ref - vcorr_test), 1e-6)
|
||||
<< "vcorr incorrect (" << w << "x" << h << ")";
|
||||
}
|
||||
// printf("(%3dx%-3d) passed\n", w, h);
|
||||
}
|
||||
}
|
||||
|
||||
void HorverTest::RunHorverSpeedTest(int run_times) {
|
||||
for (int i = 0; i < MAX_SB_SQUARE; ++i) {
|
||||
data_buf_[i] = rng_.Rand16() % (1 << 12);
|
||||
}
|
||||
|
||||
for (int block_size = 0; block_size < BLOCK_SIZES_ALL; block_size++) {
|
||||
const int w = block_size_wide[block_size];
|
||||
const int h = block_size_high[block_size];
|
||||
float hcorr_ref = 0.0, vcorr_ref = 0.0;
|
||||
float hcorr_test = 0.0, vcorr_test = 0.0;
|
||||
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
av1_get_horver_correlation_full_c(data_buf_, MAX_SB_SIZE, w, h,
|
||||
&hcorr_ref, &vcorr_ref);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
target_func_(data_buf_, MAX_SB_SIZE, w, h, &hcorr_test, &vcorr_test);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
|
||||
printf("%3dx%-3d:%7.2f/%7.2fns (%3.2f)\n", w, h, time1, time2,
|
||||
time1 / time2);
|
||||
}
|
||||
}
|
||||
|
||||
void HorverTest::RunHorverTest_ExtremeValues(void) {
|
||||
for (int i = 0; i < MAX_SB_SQUARE; ++i) {
|
||||
// Most of get_horver_test is squaring and summing, so simply saturating
|
||||
// the whole buffer is mostly likely to cause an overflow.
|
||||
data_buf_[i] = (1 << 12) - 1;
|
||||
}
|
||||
|
||||
for (int block_size = 0; block_size < BLOCK_SIZES_ALL; block_size++) {
|
||||
const int w = block_size_wide[block_size];
|
||||
const int h = block_size_high[block_size];
|
||||
float hcorr_ref = 0.0, vcorr_ref = 0.0;
|
||||
float hcorr_test = 0.0, vcorr_test = 0.0;
|
||||
|
||||
av1_get_horver_correlation_full_c(data_buf_, MAX_SB_SIZE, w, h, &hcorr_ref,
|
||||
&vcorr_ref);
|
||||
target_func_(data_buf_, MAX_SB_SIZE, w, h, &hcorr_test, &vcorr_test);
|
||||
|
||||
ASSERT_LE(fabs(hcorr_ref - hcorr_test), 1e-6) << "hcorr incorrect";
|
||||
ASSERT_LE(fabs(vcorr_ref - vcorr_test), 1e-6) << "vcorr incorrect";
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(HorverTest, RandomValues) { RunHorverTest(); }
|
||||
|
||||
TEST_P(HorverTest, ExtremeValues) { RunHorverTest_ExtremeValues(); }
|
||||
|
||||
TEST_P(HorverTest, DISABLED_Speed) { RunHorverSpeedTest(100000); }
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, HorverTest,
|
||||
::testing::Values(av1_get_horver_correlation_full_sse4_1));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, HorverTest, ::testing::Values(av1_get_horver_correlation_full_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace
|
||||
10
third_party/aom/test/horz_superres_test.cc
vendored
10
third_party/aom/test/horz_superres_test.cc
vendored
|
|
@ -9,6 +9,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "av1/encoder/encoder.h"
|
||||
|
|
@ -125,7 +127,7 @@ class HorzSuperresEndToEndTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, 4);
|
||||
|
||||
|
|
@ -152,7 +154,7 @@ class HorzSuperresEndToEndTest
|
|||
double GetPsnrThreshold() { return kPSNRThresholds[test_video_idx_]; }
|
||||
|
||||
void DoTest() {
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
|
||||
std::unique_ptr<libaom_test::VideoSource> video;
|
||||
video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
test_video_param_.limit));
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
|
|
@ -248,7 +250,7 @@ class HorzSuperresQThreshEndToEndTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, 0);
|
||||
|
||||
|
|
@ -275,7 +277,7 @@ class HorzSuperresQThreshEndToEndTest
|
|||
double GetPsnrThreshold() { return kPSNRThresholds[test_video_idx_]; }
|
||||
|
||||
void DoTest() {
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
|
||||
std::unique_ptr<libaom_test::VideoSource> video;
|
||||
video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
test_video_param_.limit));
|
||||
ASSERT_TRUE(video.get() != NULL);
|
||||
|
|
|
|||
4
third_party/aom/test/intrapred_test.cc
vendored
4
third_party/aom/test/intrapred_test.cc
vendored
|
|
@ -197,8 +197,8 @@ TEST_P(LowbdIntraPredTest, Bitexact) {
|
|||
highbd_entry(type, 32, 16, opt, bd), highbd_entry(type, 32, 32, opt, bd)
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Low Bit Depth Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
// Low Bit Depth Tests
|
||||
|
||||
#define lowbd_entry(type, width, height, opt) \
|
||||
IntraPredFunc<IntraPred>(&aom_##type##_predictor_##width##x##height##_##opt, \
|
||||
|
|
|
|||
15
third_party/aom/test/invalid_file_test.cc
vendored
15
third_party/aom/test/invalid_file_test.cc
vendored
|
|
@ -44,6 +44,11 @@ class InvalidFileTest : public ::libaom_test::DecoderTest,
|
|||
<< "Result file open failed. Filename: " << res_file_name;
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const aom_image_t &img,
|
||||
const unsigned int /*frame_number*/) {
|
||||
EXPECT_NE(img.fb_priv, nullptr);
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(
|
||||
const aom_codec_err_t res_dec,
|
||||
const libaom_test::CompressedVideoSource &video,
|
||||
|
|
@ -108,12 +113,22 @@ TEST_P(InvalidFileTest, ReturnCode) { RunTest(); }
|
|||
|
||||
const DecodeParam kAV1InvalidFileTests[] = {
|
||||
{ 1, "invalid-bug-1814.ivf" },
|
||||
{ 1, "invalid-chromium-906381.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-9288.ivf" },
|
||||
{ 4, "invalid-oss-fuzz-9463.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-9482.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-9720.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10061.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10227.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10389.ivf" },
|
||||
{ 4, "invalid-oss-fuzz-10555.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10705.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10723.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-10779.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-11477.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-11479.ivf" },
|
||||
{ 1, "invalid-oss-fuzz-11523.ivf" },
|
||||
};
|
||||
|
||||
AV1_INSTANTIATE_TEST_CASE(InvalidFileTest,
|
||||
|
|
|
|||
5
third_party/aom/test/lightfield_test.sh
vendored
5
third_party/aom/test/lightfield_test.sh
vendored
|
|
@ -50,13 +50,14 @@ lightfield_test() {
|
|||
# be decoded by an AV1 decoder.
|
||||
local bs_decoder="${LIBAOM_BIN_PATH}/lightfield_bitstream_parsing${AOM_TEST_EXE_SUFFIX}"
|
||||
local tl_file="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.ivf"
|
||||
local tl_text_file="${LIBAOM_TEST_DATA_PATH}/vase10x10_tiles.txt"
|
||||
if [ ! -x "${bs_decoder}" ]; then
|
||||
elog "${bs_decoder} does not exist or is not executable."
|
||||
return 1
|
||||
fi
|
||||
|
||||
eval "${AOM_TEST_PREFIX}" "${bs_decoder}" "${lf_file}" "${tl_file}" \
|
||||
"${num_references}" ${devnull}
|
||||
"${num_references}" "${tl_text_file}" ${devnull}
|
||||
|
||||
[ -e "${tl_file}" ] || return 1
|
||||
|
||||
|
|
@ -82,7 +83,7 @@ lightfield_test() {
|
|||
fi
|
||||
|
||||
eval "${AOM_TEST_PREFIX}" "${ref_decoder}" "${lf_file}" "${tl_reffile}" \
|
||||
"${num_references}" ${devnull}
|
||||
"${num_references}" "${tl_text_file}" ${devnull}
|
||||
|
||||
[ -e "${tl_reffile}" ] || return 1
|
||||
|
||||
|
|
|
|||
2
third_party/aom/test/lossless_test.cc
vendored
2
third_party/aom/test/lossless_test.cc
vendored
|
|
@ -40,7 +40,7 @@ class LosslessTestLarge
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
// Only call Control if quantizer > 0 to verify that using quantizer
|
||||
// alone will activate lossless
|
||||
if (cfg_.rc_max_quantizer > 0 || cfg_.rc_min_quantizer > 0) {
|
||||
|
|
|
|||
6
third_party/aom/test/motion_vector_test.cc
vendored
6
third_party/aom/test/motion_vector_test.cc
vendored
|
|
@ -9,6 +9,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/codec_factory.h"
|
||||
|
|
@ -60,7 +62,7 @@ class MotionVectorTestLarge
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, cpu_used_);
|
||||
encoder->Control(AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST, mv_test_mode_);
|
||||
if (encoding_mode_ != ::libaom_test::kRealTime) {
|
||||
|
|
@ -90,7 +92,7 @@ TEST_P(MotionVectorTestLarge, OverallTest) {
|
|||
cfg_.g_profile = 0;
|
||||
init_flags_ = AOM_CODEC_USE_PSNR;
|
||||
|
||||
testing::internal::scoped_ptr<libaom_test::VideoSource> video;
|
||||
std::unique_ptr<libaom_test::VideoSource> video;
|
||||
video.reset(new libaom_test::YUVVideoSource(
|
||||
"niklas_640_480_30.yuv", AOM_IMG_FMT_I420, width, height, 30, 1, 0, 3));
|
||||
|
||||
|
|
|
|||
206
third_party/aom/test/pickrst_test.cc
vendored
206
third_party/aom/test/pickrst_test.cc
vendored
|
|
@ -11,19 +11,20 @@
|
|||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/function_equivalence_test.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/util.h"
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/aom_timer.h"
|
||||
#include "av1/encoder/pickrst.h"
|
||||
using libaom_test::FunctionEquivalenceTest;
|
||||
|
||||
#define MAX_DATA_BLOCK 384
|
||||
|
||||
namespace {
|
||||
namespace pickrst_test_lowbd {
|
||||
static const int kIterations = 100;
|
||||
|
||||
typedef int64_t (*lowbd_pixel_proj_error_func)(
|
||||
|
|
@ -31,8 +32,6 @@ typedef int64_t (*lowbd_pixel_proj_error_func)(
|
|||
const uint8_t *dat8, int dat_stride, int32_t *flt0, int flt0_stride,
|
||||
int32_t *flt1, int flt1_stride, int xq[2], const sgr_params_type *params);
|
||||
|
||||
typedef libaom_test::FuncParam<lowbd_pixel_proj_error_func> TestFuncs;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 8 bit
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -46,13 +45,17 @@ class PixelProjErrorTest
|
|||
virtual void SetUp() {
|
||||
target_func_ = GET_PARAM(0);
|
||||
src_ = (uint8_t *)(aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK *
|
||||
sizeof(uint8_t)));
|
||||
sizeof(*src_)));
|
||||
ASSERT_NE(src_, nullptr);
|
||||
dgd_ = (uint8_t *)(aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK *
|
||||
sizeof(uint8_t)));
|
||||
sizeof(*dgd_)));
|
||||
ASSERT_NE(dgd_, nullptr);
|
||||
flt0_ = (int32_t *)(aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK *
|
||||
sizeof(int32_t)));
|
||||
sizeof(*flt0_)));
|
||||
ASSERT_NE(flt0_, nullptr);
|
||||
flt1_ = (int32_t *)(aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK *
|
||||
sizeof(int32_t)));
|
||||
sizeof(*flt1_)));
|
||||
ASSERT_NE(flt1_, nullptr);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
aom_free(src_);
|
||||
|
|
@ -60,19 +63,19 @@ class PixelProjErrorTest
|
|||
aom_free(flt0_);
|
||||
aom_free(flt1_);
|
||||
}
|
||||
void runPixelProjErrorTest(int32_t run_times);
|
||||
void runPixelProjErrorTest_ExtremeValues();
|
||||
void RunPixelProjErrorTest(int32_t run_times);
|
||||
void RunPixelProjErrorTest_ExtremeValues();
|
||||
|
||||
private:
|
||||
lowbd_pixel_proj_error_func target_func_;
|
||||
ACMRandom rng_;
|
||||
libaom_test::ACMRandom rng_;
|
||||
uint8_t *src_;
|
||||
uint8_t *dgd_;
|
||||
int32_t *flt0_;
|
||||
int32_t *flt1_;
|
||||
};
|
||||
|
||||
void PixelProjErrorTest::runPixelProjErrorTest(int32_t run_times) {
|
||||
void PixelProjErrorTest::RunPixelProjErrorTest(int32_t run_times) {
|
||||
int h_end = run_times != 1 ? 128 : (rng_.Rand16() % MAX_DATA_BLOCK) + 1;
|
||||
int v_end = run_times != 1 ? 128 : (rng_.Rand16() % MAX_DATA_BLOCK) + 1;
|
||||
const int dgd_stride = MAX_DATA_BLOCK;
|
||||
|
|
@ -124,7 +127,7 @@ void PixelProjErrorTest::runPixelProjErrorTest(int32_t run_times) {
|
|||
}
|
||||
}
|
||||
|
||||
void PixelProjErrorTest::runPixelProjErrorTest_ExtremeValues() {
|
||||
void PixelProjErrorTest::RunPixelProjErrorTest_ExtremeValues() {
|
||||
const int h_start = 0;
|
||||
int h_end = 192;
|
||||
const int v_start = 0;
|
||||
|
|
@ -165,13 +168,13 @@ void PixelProjErrorTest::runPixelProjErrorTest_ExtremeValues() {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_P(PixelProjErrorTest, RandomValues) { runPixelProjErrorTest(1); }
|
||||
TEST_P(PixelProjErrorTest, RandomValues) { RunPixelProjErrorTest(1); }
|
||||
|
||||
TEST_P(PixelProjErrorTest, ExtremeValues) {
|
||||
runPixelProjErrorTest_ExtremeValues();
|
||||
RunPixelProjErrorTest_ExtremeValues();
|
||||
}
|
||||
|
||||
TEST_P(PixelProjErrorTest, DISABLED_Speed) { runPixelProjErrorTest(200000); }
|
||||
TEST_P(PixelProjErrorTest, DISABLED_Speed) { RunPixelProjErrorTest(200000); }
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, PixelProjErrorTest,
|
||||
|
|
@ -184,4 +187,171 @@ INSTANTIATE_TEST_CASE_P(AVX2, PixelProjErrorTest,
|
|||
::testing::Values(av1_lowbd_pixel_proj_error_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace
|
||||
} // namespace pickrst_test_lowbd
|
||||
|
||||
namespace pickrst_test_highbd {
|
||||
static const int kIterations = 100;
|
||||
|
||||
typedef int64_t (*highbd_pixel_proj_error_func)(
|
||||
const uint8_t *src8, int width, int height, int src_stride,
|
||||
const uint8_t *dat8, int dat_stride, int32_t *flt0, int flt0_stride,
|
||||
int32_t *flt1, int flt1_stride, int xq[2], const sgr_params_type *params);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// High bit-depth
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef ::testing::tuple<const highbd_pixel_proj_error_func>
|
||||
PixelProjErrorTestParam;
|
||||
|
||||
class PixelProjHighbdErrorTest
|
||||
: public ::testing::TestWithParam<PixelProjErrorTestParam> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
target_func_ = GET_PARAM(0);
|
||||
src_ =
|
||||
(uint16_t *)aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*src_));
|
||||
ASSERT_NE(src_, nullptr);
|
||||
dgd_ =
|
||||
(uint16_t *)aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*dgd_));
|
||||
ASSERT_NE(dgd_, nullptr);
|
||||
flt0_ =
|
||||
(int32_t *)aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*flt0_));
|
||||
ASSERT_NE(flt0_, nullptr);
|
||||
flt1_ =
|
||||
(int32_t *)aom_malloc(MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*flt1_));
|
||||
ASSERT_NE(flt1_, nullptr);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
aom_free(src_);
|
||||
aom_free(dgd_);
|
||||
aom_free(flt0_);
|
||||
aom_free(flt1_);
|
||||
}
|
||||
void RunPixelProjErrorTest(int32_t run_times);
|
||||
void RunPixelProjErrorTest_ExtremeValues();
|
||||
|
||||
private:
|
||||
highbd_pixel_proj_error_func target_func_;
|
||||
libaom_test::ACMRandom rng_;
|
||||
uint16_t *src_;
|
||||
uint16_t *dgd_;
|
||||
int32_t *flt0_;
|
||||
int32_t *flt1_;
|
||||
};
|
||||
|
||||
void PixelProjHighbdErrorTest::RunPixelProjErrorTest(int32_t run_times) {
|
||||
int h_end = run_times != 1 ? 128 : (rng_.Rand16() % MAX_DATA_BLOCK) + 1;
|
||||
int v_end = run_times != 1 ? 128 : (rng_.Rand16() % MAX_DATA_BLOCK) + 1;
|
||||
const int dgd_stride = MAX_DATA_BLOCK;
|
||||
const int src_stride = MAX_DATA_BLOCK;
|
||||
const int flt0_stride = MAX_DATA_BLOCK;
|
||||
const int flt1_stride = MAX_DATA_BLOCK;
|
||||
sgr_params_type params;
|
||||
int xq[2];
|
||||
const int iters = run_times == 1 ? kIterations : 4;
|
||||
for (int iter = 0; iter < iters && !HasFatalFailure(); ++iter) {
|
||||
int64_t err_ref = 0, err_test = 1;
|
||||
for (int i = 0; i < MAX_DATA_BLOCK * MAX_DATA_BLOCK; ++i) {
|
||||
dgd_[i] = rng_.Rand16() % (1 << 12);
|
||||
src_[i] = rng_.Rand16() % (1 << 12);
|
||||
flt0_[i] = rng_.Rand15Signed();
|
||||
flt1_[i] = rng_.Rand15Signed();
|
||||
}
|
||||
xq[0] = rng_.Rand8() % (1 << SGRPROJ_PRJ_BITS);
|
||||
xq[1] = rng_.Rand8() % (1 << SGRPROJ_PRJ_BITS);
|
||||
params.r[0] = run_times == 1 ? (rng_.Rand8() % MAX_RADIUS) : (iter % 2);
|
||||
params.r[1] = run_times == 1 ? (rng_.Rand8() % MAX_RADIUS) : (iter / 2);
|
||||
params.s[0] = run_times == 1 ? (rng_.Rand8() % MAX_RADIUS) : (iter % 2);
|
||||
params.s[1] = run_times == 1 ? (rng_.Rand8() % MAX_RADIUS) : (iter / 2);
|
||||
uint8_t *dgd8 = CONVERT_TO_BYTEPTR(dgd_);
|
||||
uint8_t *src8 = CONVERT_TO_BYTEPTR(src_);
|
||||
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
err_ref = av1_highbd_pixel_proj_error_c(
|
||||
src8, h_end, v_end, src_stride, dgd8, dgd_stride, flt0_, flt0_stride,
|
||||
flt1_, flt1_stride, xq, ¶ms);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
err_test =
|
||||
target_func_(src8, h_end, v_end, src_stride, dgd8, dgd_stride, flt0_,
|
||||
flt0_stride, flt1_, flt1_stride, xq, ¶ms);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
if (run_times > 10) {
|
||||
printf("r0 %d r1 %d %3dx%-3d:%7.2f/%7.2fns (%3.2f)\n", params.r[0],
|
||||
params.r[1], h_end, v_end, time1, time2, time1 / time2);
|
||||
}
|
||||
ASSERT_EQ(err_ref, err_test);
|
||||
}
|
||||
}
|
||||
|
||||
void PixelProjHighbdErrorTest::RunPixelProjErrorTest_ExtremeValues() {
|
||||
const int h_start = 0;
|
||||
int h_end = 192;
|
||||
const int v_start = 0;
|
||||
int v_end = 192;
|
||||
const int dgd_stride = MAX_DATA_BLOCK;
|
||||
const int src_stride = MAX_DATA_BLOCK;
|
||||
const int flt0_stride = MAX_DATA_BLOCK;
|
||||
const int flt1_stride = MAX_DATA_BLOCK;
|
||||
sgr_params_type params;
|
||||
int xq[2];
|
||||
const int iters = kIterations;
|
||||
for (int iter = 0; iter < iters && !HasFatalFailure(); ++iter) {
|
||||
int64_t err_ref = 0, err_test = 1;
|
||||
for (int i = 0; i < MAX_DATA_BLOCK * MAX_DATA_BLOCK; ++i) {
|
||||
dgd_[i] = 0;
|
||||
src_[i] = (1 << 12) - 1;
|
||||
flt0_[i] = rng_.Rand15Signed();
|
||||
flt1_[i] = rng_.Rand15Signed();
|
||||
}
|
||||
xq[0] = rng_.Rand8() % (1 << SGRPROJ_PRJ_BITS);
|
||||
xq[1] = rng_.Rand8() % (1 << SGRPROJ_PRJ_BITS);
|
||||
params.r[0] = rng_.Rand8() % MAX_RADIUS;
|
||||
params.r[1] = rng_.Rand8() % MAX_RADIUS;
|
||||
params.s[0] = rng_.Rand8() % MAX_RADIUS;
|
||||
params.s[1] = rng_.Rand8() % MAX_RADIUS;
|
||||
uint8_t *dgd8 = CONVERT_TO_BYTEPTR(dgd_);
|
||||
uint8_t *src8 = CONVERT_TO_BYTEPTR(src_);
|
||||
|
||||
err_ref = av1_highbd_pixel_proj_error_c(
|
||||
src8, h_end - h_start, v_end - v_start, src_stride, dgd8, dgd_stride,
|
||||
flt0_, flt0_stride, flt1_, flt1_stride, xq, ¶ms);
|
||||
|
||||
err_test = target_func_(src8, h_end - h_start, v_end - v_start, src_stride,
|
||||
dgd8, dgd_stride, flt0_, flt0_stride, flt1_,
|
||||
flt1_stride, xq, ¶ms);
|
||||
|
||||
ASSERT_EQ(err_ref, err_test);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(PixelProjHighbdErrorTest, RandomValues) { RunPixelProjErrorTest(1); }
|
||||
|
||||
TEST_P(PixelProjHighbdErrorTest, ExtremeValues) {
|
||||
RunPixelProjErrorTest_ExtremeValues();
|
||||
}
|
||||
|
||||
TEST_P(PixelProjHighbdErrorTest, DISABLED_Speed) {
|
||||
RunPixelProjErrorTest(200000);
|
||||
}
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, PixelProjHighbdErrorTest,
|
||||
::testing::Values(av1_highbd_pixel_proj_error_sse4_1));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, PixelProjHighbdErrorTest,
|
||||
::testing::Values(av1_highbd_pixel_proj_error_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace pickrst_test_highbd
|
||||
|
|
|
|||
2
third_party/aom/test/qm_test.cc
vendored
2
third_party/aom/test/qm_test.cc
vendored
|
|
@ -33,7 +33,7 @@ class QMTest
|
|||
|
||||
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
|
||||
::libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
|
||||
encoder->Control(AV1E_SET_ENABLE_QM, 1);
|
||||
encoder->Control(AV1E_SET_QM_MIN, qm_min_);
|
||||
|
|
|
|||
46
third_party/aom/test/quantize_func_test.cc
vendored
46
third_party/aom/test/quantize_func_test.cc
vendored
|
|
@ -63,7 +63,7 @@ void highbd_quan64x64_wrapper(QUAN_PARAM_LIST) {
|
|||
HBD_QUAN_FUNC;
|
||||
}
|
||||
|
||||
typedef enum { TYPE_B, TYPE_DC, TYPE_FP } QuantType;
|
||||
enum { TYPE_B, TYPE_DC, TYPE_FP } UENUM1BYTE(QuantType);
|
||||
|
||||
using ::testing::tuple;
|
||||
typedef tuple<QuantizeFunc, QuantizeFunc, TX_SIZE, QuantType, aom_bit_depth_t>
|
||||
|
|
@ -286,19 +286,29 @@ TEST_P(QuantizeTest, DISABLED_Speed) {
|
|||
const int16_t *quant_shift = qtab_->quant.y_quant_shift[q];
|
||||
const int16_t *dequant = qtab_->dequant.y_dequant_QTX[q];
|
||||
const int kNumTests = 5000000;
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer timer, simd_timer;
|
||||
|
||||
FillCoeffRandom();
|
||||
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int n = 0; n < kNumTests; ++n) {
|
||||
quant_(coeff_ptr, n_coeffs, zbin, round_fp, quant_fp, quant_shift, qcoeff,
|
||||
dqcoeff, dequant, eob, sc->scan, sc->iscan);
|
||||
quant_ref_(coeff_ptr, n_coeffs, zbin, round_fp, quant_fp, quant_shift,
|
||||
qcoeff, dqcoeff, dequant, eob, sc->scan, sc->iscan);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
|
||||
aom_usec_timer_start(&simd_timer);
|
||||
for (int n = 0; n < kNumTests; ++n) {
|
||||
quant_(coeff_ptr, n_coeffs, zbin, round_fp, quant_fp, quant_shift, qcoeff,
|
||||
dqcoeff, dequant, eob, sc->scan, sc->iscan);
|
||||
}
|
||||
aom_usec_timer_mark(&simd_timer);
|
||||
|
||||
const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
|
||||
printf("Elapsed time: %d us\n", elapsed_time);
|
||||
const int simd_elapsed_time =
|
||||
static_cast<int>(aom_usec_timer_elapsed(&simd_timer));
|
||||
printf("c_time = %d \t simd_time = %d \t Gain = %d \n", elapsed_time,
|
||||
simd_elapsed_time, (elapsed_time / simd_elapsed_time));
|
||||
}
|
||||
|
||||
using ::testing::make_tuple;
|
||||
|
|
@ -398,14 +408,12 @@ INSTANTIATE_TEST_CASE_P(SSE2, QuantizeTest,
|
|||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, QuantizeTest,
|
||||
::testing::Values(make_tuple(&aom_quantize_b_c, &aom_quantize_b_ssse3,
|
||||
TX_16X16, TYPE_B, AOM_BITS_8)));
|
||||
|
||||
// Like libvpx, the ssse3 and avx quantize tests do not pass.
|
||||
// https://bugs.chromium.org/p/webm/issues/detail?id=1448
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
DISABLED_SSSE3_32x32, QuantizeTest,
|
||||
::testing::Values(make_tuple(&aom_quantize_b_32x32_c,
|
||||
&aom_quantize_b_32x32_ssse3, TX_16X16, TYPE_B,
|
||||
TX_16X16, TYPE_B, AOM_BITS_8),
|
||||
make_tuple(&aom_quantize_b_32x32_c,
|
||||
&aom_quantize_b_32x32_ssse3, TX_32X32, TYPE_B,
|
||||
AOM_BITS_8),
|
||||
make_tuple(&aom_quantize_b_64x64_c,
|
||||
&aom_quantize_b_64x64_ssse3, TX_64X64, TYPE_B,
|
||||
AOM_BITS_8)));
|
||||
|
||||
#endif // HAVE_SSSE3 && ARCH_X86_64
|
||||
|
|
@ -413,13 +421,11 @@ INSTANTIATE_TEST_CASE_P(
|
|||
#if HAVE_AVX && ARCH_X86_64
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX, QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx, TX_16X16, TYPE_B,
|
||||
AOM_BITS_8),
|
||||
// Although these tests will not pass against _c, test them against each
|
||||
// other so there is some minor checking.
|
||||
make_tuple(&aom_quantize_b_32x32_ssse3, &aom_quantize_b_32x32_avx,
|
||||
TX_32X32, TYPE_B, AOM_BITS_8)));
|
||||
::testing::Values(make_tuple(&aom_quantize_b_c, &aom_quantize_b_avx,
|
||||
TX_16X16, TYPE_B, AOM_BITS_8),
|
||||
make_tuple(&aom_quantize_b_32x32_c,
|
||||
&aom_quantize_b_32x32_avx, TX_32X32, TYPE_B,
|
||||
AOM_BITS_8)));
|
||||
|
||||
#endif // HAVE_AVX && ARCH_X86_64
|
||||
} // namespace
|
||||
|
|
|
|||
2
third_party/aom/test/resize_test.cc
vendored
2
third_party/aom/test/resize_test.cc
vendored
|
|
@ -297,7 +297,7 @@ class ResizeInternalTestLarge : public ResizeTest {
|
|||
|
||||
virtual void PSNRPktHook(const aom_codec_cx_pkt_t *pkt) {
|
||||
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.5);
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 3.0);
|
||||
}
|
||||
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
|
|
|
|||
257
third_party/aom/test/sad_test.cc
vendored
257
third_party/aom/test/sad_test.cc
vendored
|
|
@ -35,22 +35,25 @@ typedef uint32_t (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
|
|||
const uint8_t *second_pred);
|
||||
typedef ::testing::tuple<int, int, SadMxNAvgFunc, int> SadMxNAvgParam;
|
||||
|
||||
typedef void (*JntCompAvgFunc)(uint8_t *comp_pred, const uint8_t *pred,
|
||||
int width, int height, const uint8_t *ref,
|
||||
int ref_stride,
|
||||
const JNT_COMP_PARAMS *jcp_param);
|
||||
typedef ::testing::tuple<int, int, JntCompAvgFunc, int> JntCompAvgParam;
|
||||
typedef void (*DistWtdCompAvgFunc)(uint8_t *comp_pred, const uint8_t *pred,
|
||||
int width, int height, const uint8_t *ref,
|
||||
int ref_stride,
|
||||
const DIST_WTD_COMP_PARAMS *jcp_param);
|
||||
typedef ::testing::tuple<int, int, DistWtdCompAvgFunc, int> DistWtdCompAvgParam;
|
||||
|
||||
typedef unsigned int (*JntSadMxhFunc)(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride,
|
||||
int width, int height);
|
||||
typedef ::testing::tuple<int, int, JntSadMxhFunc, int> JntSadMxhParam;
|
||||
typedef unsigned int (*DistWtdSadMxhFunc)(const uint8_t *src_ptr,
|
||||
int src_stride,
|
||||
const uint8_t *ref_ptr,
|
||||
int ref_stride, int width,
|
||||
int height);
|
||||
typedef ::testing::tuple<int, int, DistWtdSadMxhFunc, int> DistWtdSadMxhParam;
|
||||
|
||||
typedef uint32_t (*JntSadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride,
|
||||
const uint8_t *second_pred,
|
||||
const JNT_COMP_PARAMS *jcp_param);
|
||||
typedef ::testing::tuple<int, int, JntSadMxNAvgFunc, int> JntSadMxNAvgParam;
|
||||
typedef uint32_t (*DistWtdSadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride,
|
||||
const uint8_t *second_pred,
|
||||
const DIST_WTD_COMP_PARAMS *jcp_param);
|
||||
typedef ::testing::tuple<int, int, DistWtdSadMxNAvgFunc, int>
|
||||
DistWtdSadMxNAvgParam;
|
||||
|
||||
typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *const ref_ptr[], int ref_stride,
|
||||
|
|
@ -203,7 +206,7 @@ class SADTestBase : public ::testing::Test {
|
|||
return sad;
|
||||
}
|
||||
|
||||
void ReferenceJntCompAvg(int block_idx) {
|
||||
void ReferenceDistWtdCompAvg(int block_idx) {
|
||||
const uint8_t *const reference8 = GetReference(block_idx);
|
||||
const uint8_t *const second_pred8 = second_pred_;
|
||||
uint8_t *const comp_pred8 = comp_pred_;
|
||||
|
|
@ -228,7 +231,7 @@ class SADTestBase : public ::testing::Test {
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int ReferenceJntSADavg(int block_idx) {
|
||||
unsigned int ReferenceDistWtdSADavg(int block_idx) {
|
||||
unsigned int sad = 0;
|
||||
const uint8_t *const reference8 = GetReference(block_idx);
|
||||
const uint8_t *const source8 = source_data_;
|
||||
|
|
@ -305,7 +308,7 @@ class SADTestBase : public ::testing::Test {
|
|||
static uint8_t *comp_pred_test_;
|
||||
static uint8_t *comp_pred8_test_;
|
||||
static uint16_t *comp_pred16_test_;
|
||||
JNT_COMP_PARAMS jcp_param_;
|
||||
DIST_WTD_COMP_PARAMS jcp_param_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
|
@ -391,13 +394,15 @@ class SADavgTest : public ::testing::WithParamInterface<SadMxNAvgParam>,
|
|||
}
|
||||
};
|
||||
|
||||
class JntCompAvgTest : public ::testing::WithParamInterface<JntCompAvgParam>,
|
||||
public SADTestBase {
|
||||
class DistWtdCompAvgTest
|
||||
: public ::testing::WithParamInterface<DistWtdCompAvgParam>,
|
||||
public SADTestBase {
|
||||
public:
|
||||
JntCompAvgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
DistWtdCompAvgTest()
|
||||
: SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
|
||||
protected:
|
||||
void jnt_comp_avg(int block_idx) {
|
||||
void dist_wtd_comp_avg(int block_idx) {
|
||||
const uint8_t *const reference = GetReference(block_idx);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(comp_pred_test_, second_pred_, width_,
|
||||
|
|
@ -411,8 +416,8 @@ class JntCompAvgTest : public ::testing::WithParamInterface<JntCompAvgParam>,
|
|||
jcp_param_.fwd_offset = quant_dist_lookup_table[j][i][0];
|
||||
jcp_param_.bck_offset = quant_dist_lookup_table[j][i][1];
|
||||
|
||||
ReferenceJntCompAvg(0);
|
||||
jnt_comp_avg(0);
|
||||
ReferenceDistWtdCompAvg(0);
|
||||
dist_wtd_comp_avg(0);
|
||||
|
||||
for (int y = 0; y < height_; ++y)
|
||||
for (int x = 0; x < width_; ++x)
|
||||
|
|
@ -423,10 +428,10 @@ class JntCompAvgTest : public ::testing::WithParamInterface<JntCompAvgParam>,
|
|||
}
|
||||
};
|
||||
|
||||
class JntSADTest : public ::testing::WithParamInterface<JntSadMxhParam>,
|
||||
public SADTestBase {
|
||||
class DistWtdSADTest : public ::testing::WithParamInterface<DistWtdSadMxhParam>,
|
||||
public SADTestBase {
|
||||
public:
|
||||
JntSADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
DistWtdSADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
|
||||
protected:
|
||||
unsigned int SAD(int block_idx) {
|
||||
|
|
@ -455,13 +460,14 @@ class JntSADTest : public ::testing::WithParamInterface<JntSadMxhParam>,
|
|||
}
|
||||
};
|
||||
|
||||
class JntSADavgTest : public ::testing::WithParamInterface<JntSadMxNAvgParam>,
|
||||
public SADTestBase {
|
||||
class DistWtdSADavgTest
|
||||
: public ::testing::WithParamInterface<DistWtdSadMxNAvgParam>,
|
||||
public SADTestBase {
|
||||
public:
|
||||
JntSADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
DistWtdSADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
|
||||
|
||||
protected:
|
||||
unsigned int jnt_SAD_avg(int block_idx) {
|
||||
unsigned int dist_wtd_SAD_avg(int block_idx) {
|
||||
unsigned int ret;
|
||||
const uint8_t *const reference = GetReference(block_idx);
|
||||
|
||||
|
|
@ -477,8 +483,8 @@ class JntSADavgTest : public ::testing::WithParamInterface<JntSadMxNAvgParam>,
|
|||
jcp_param_.fwd_offset = quant_dist_lookup_table[j][i][0];
|
||||
jcp_param_.bck_offset = quant_dist_lookup_table[j][i][1];
|
||||
|
||||
const unsigned int reference_sad = ReferenceJntSADavg(0);
|
||||
const unsigned int exp_sad = jnt_SAD_avg(0);
|
||||
const unsigned int reference_sad = ReferenceDistWtdSADavg(0);
|
||||
const unsigned int exp_sad = dist_wtd_SAD_avg(0);
|
||||
|
||||
ASSERT_EQ(reference_sad, exp_sad);
|
||||
}
|
||||
|
|
@ -608,19 +614,19 @@ TEST_P(SADavgTest, ShortSrc) {
|
|||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntCompAvgTest, MaxRef) {
|
||||
TEST_P(DistWtdCompAvgTest, MaxRef) {
|
||||
FillConstant(reference_data_, reference_stride_, mask_);
|
||||
FillConstant(second_pred_, width_, 0);
|
||||
CheckCompAvg();
|
||||
}
|
||||
|
||||
TEST_P(JntCompAvgTest, MaxSecondPred) {
|
||||
TEST_P(DistWtdCompAvgTest, MaxSecondPred) {
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
FillConstant(second_pred_, width_, mask_);
|
||||
CheckCompAvg();
|
||||
}
|
||||
|
||||
TEST_P(JntCompAvgTest, ShortRef) {
|
||||
TEST_P(DistWtdCompAvgTest, ShortRef) {
|
||||
const int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
FillRandom(reference_data_, reference_stride_);
|
||||
|
|
@ -629,7 +635,7 @@ TEST_P(JntCompAvgTest, ShortRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntCompAvgTest, UnalignedRef) {
|
||||
TEST_P(DistWtdCompAvgTest, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
const int tmp_stride = reference_stride_;
|
||||
|
|
@ -640,19 +646,19 @@ TEST_P(JntCompAvgTest, UnalignedRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADTest, MaxRef) {
|
||||
TEST_P(DistWtdSADTest, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
FillConstant(reference_data_, reference_stride_, mask_);
|
||||
CheckSAD();
|
||||
}
|
||||
|
||||
TEST_P(JntSADTest, MaxSrc) {
|
||||
TEST_P(DistWtdSADTest, MaxSrc) {
|
||||
FillConstant(source_data_, source_stride_, mask_);
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
CheckSAD();
|
||||
}
|
||||
|
||||
TEST_P(JntSADTest, ShortRef) {
|
||||
TEST_P(DistWtdSADTest, ShortRef) {
|
||||
const int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
|
|
@ -661,7 +667,7 @@ TEST_P(JntSADTest, ShortRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADTest, UnalignedRef) {
|
||||
TEST_P(DistWtdSADTest, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
const int tmp_stride = reference_stride_;
|
||||
|
|
@ -672,7 +678,7 @@ TEST_P(JntSADTest, UnalignedRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADTest, ShortSrc) {
|
||||
TEST_P(DistWtdSADTest, ShortSrc) {
|
||||
const int tmp_stride = source_stride_;
|
||||
source_stride_ >>= 1;
|
||||
int test_count = 2000;
|
||||
|
|
@ -685,20 +691,20 @@ TEST_P(JntSADTest, ShortSrc) {
|
|||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADavgTest, MaxRef) {
|
||||
TEST_P(DistWtdSADavgTest, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
FillConstant(reference_data_, reference_stride_, mask_);
|
||||
FillConstant(second_pred_, width_, 0);
|
||||
CheckSAD();
|
||||
}
|
||||
TEST_P(JntSADavgTest, MaxSrc) {
|
||||
TEST_P(DistWtdSADavgTest, MaxSrc) {
|
||||
FillConstant(source_data_, source_stride_, mask_);
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
FillConstant(second_pred_, width_, 0);
|
||||
CheckSAD();
|
||||
}
|
||||
|
||||
TEST_P(JntSADavgTest, ShortRef) {
|
||||
TEST_P(DistWtdSADavgTest, ShortRef) {
|
||||
const int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
|
|
@ -708,7 +714,7 @@ TEST_P(JntSADavgTest, ShortRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADavgTest, UnalignedRef) {
|
||||
TEST_P(DistWtdSADavgTest, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
const int tmp_stride = reference_stride_;
|
||||
|
|
@ -720,7 +726,7 @@ TEST_P(JntSADavgTest, UnalignedRef) {
|
|||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(JntSADavgTest, ShortSrc) {
|
||||
TEST_P(DistWtdSADavgTest, ShortSrc) {
|
||||
const int tmp_stride = source_stride_;
|
||||
source_stride_ >>= 1;
|
||||
int test_count = 2000;
|
||||
|
|
@ -947,47 +953,48 @@ const SadMxNAvgParam avg_c_tests[] = {
|
|||
INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
|
||||
|
||||
// TODO(chengchen): add highbd tests
|
||||
const JntCompAvgParam jnt_comp_avg_c_tests[] = {
|
||||
make_tuple(128, 128, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(128, 64, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 128, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 64, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 32, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 64, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 32, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 16, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 32, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 16, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 8, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 16, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 8, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 4, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(4, 8, &aom_jnt_comp_avg_pred_c, -1),
|
||||
make_tuple(4, 4, &aom_jnt_comp_avg_pred_c, -1),
|
||||
const DistWtdCompAvgParam dist_wtd_comp_avg_c_tests[] = {
|
||||
make_tuple(128, 128, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(128, 64, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 128, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 64, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(64, 32, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 64, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 32, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(32, 16, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 32, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 16, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(16, 8, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 16, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 8, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(8, 4, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(4, 8, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
make_tuple(4, 4, &aom_dist_wtd_comp_avg_pred_c, -1),
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, JntCompAvgTest,
|
||||
::testing::ValuesIn(jnt_comp_avg_c_tests));
|
||||
INSTANTIATE_TEST_CASE_P(C, DistWtdCompAvgTest,
|
||||
::testing::ValuesIn(dist_wtd_comp_avg_c_tests));
|
||||
|
||||
const JntSadMxNAvgParam jnt_avg_c_tests[] = {
|
||||
make_tuple(128, 128, &aom_jnt_sad128x128_avg_c, -1),
|
||||
make_tuple(128, 64, &aom_jnt_sad128x64_avg_c, -1),
|
||||
make_tuple(64, 128, &aom_jnt_sad64x128_avg_c, -1),
|
||||
make_tuple(64, 64, &aom_jnt_sad64x64_avg_c, -1),
|
||||
make_tuple(64, 32, &aom_jnt_sad64x32_avg_c, -1),
|
||||
make_tuple(32, 64, &aom_jnt_sad32x64_avg_c, -1),
|
||||
make_tuple(32, 32, &aom_jnt_sad32x32_avg_c, -1),
|
||||
make_tuple(32, 16, &aom_jnt_sad32x16_avg_c, -1),
|
||||
make_tuple(16, 32, &aom_jnt_sad16x32_avg_c, -1),
|
||||
make_tuple(16, 16, &aom_jnt_sad16x16_avg_c, -1),
|
||||
make_tuple(16, 8, &aom_jnt_sad16x8_avg_c, -1),
|
||||
make_tuple(8, 16, &aom_jnt_sad8x16_avg_c, -1),
|
||||
make_tuple(8, 8, &aom_jnt_sad8x8_avg_c, -1),
|
||||
make_tuple(8, 4, &aom_jnt_sad8x4_avg_c, -1),
|
||||
make_tuple(4, 8, &aom_jnt_sad4x8_avg_c, -1),
|
||||
make_tuple(4, 4, &aom_jnt_sad4x4_avg_c, -1),
|
||||
const DistWtdSadMxNAvgParam dist_wtd_avg_c_tests[] = {
|
||||
make_tuple(128, 128, &aom_dist_wtd_sad128x128_avg_c, -1),
|
||||
make_tuple(128, 64, &aom_dist_wtd_sad128x64_avg_c, -1),
|
||||
make_tuple(64, 128, &aom_dist_wtd_sad64x128_avg_c, -1),
|
||||
make_tuple(64, 64, &aom_dist_wtd_sad64x64_avg_c, -1),
|
||||
make_tuple(64, 32, &aom_dist_wtd_sad64x32_avg_c, -1),
|
||||
make_tuple(32, 64, &aom_dist_wtd_sad32x64_avg_c, -1),
|
||||
make_tuple(32, 32, &aom_dist_wtd_sad32x32_avg_c, -1),
|
||||
make_tuple(32, 16, &aom_dist_wtd_sad32x16_avg_c, -1),
|
||||
make_tuple(16, 32, &aom_dist_wtd_sad16x32_avg_c, -1),
|
||||
make_tuple(16, 16, &aom_dist_wtd_sad16x16_avg_c, -1),
|
||||
make_tuple(16, 8, &aom_dist_wtd_sad16x8_avg_c, -1),
|
||||
make_tuple(8, 16, &aom_dist_wtd_sad8x16_avg_c, -1),
|
||||
make_tuple(8, 8, &aom_dist_wtd_sad8x8_avg_c, -1),
|
||||
make_tuple(8, 4, &aom_dist_wtd_sad8x4_avg_c, -1),
|
||||
make_tuple(4, 8, &aom_dist_wtd_sad4x8_avg_c, -1),
|
||||
make_tuple(4, 4, &aom_dist_wtd_sad4x4_avg_c, -1),
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, JntSADavgTest, ::testing::ValuesIn(jnt_avg_c_tests));
|
||||
INSTANTIATE_TEST_CASE_P(C, DistWtdSADavgTest,
|
||||
::testing::ValuesIn(dist_wtd_avg_c_tests));
|
||||
|
||||
const SadMxNx4Param x4d_c_tests[] = {
|
||||
make_tuple(128, 128, &aom_sad128x128x4d_c, -1),
|
||||
|
|
@ -1251,7 +1258,7 @@ INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
|
|||
#if HAVE_SSSE3
|
||||
// Note: These are named sse2, but part of ssse3 file and only built and linked
|
||||
// when ssse3 is enabled.
|
||||
const JntSadMxhParam jnt_sad_sse2_tests[] = {
|
||||
const DistWtdSadMxhParam dist_wtd_sad_sse2_tests[] = {
|
||||
make_tuple(4, 4, &aom_sad4xh_sse2, -1),
|
||||
make_tuple(4, 8, &aom_sad4xh_sse2, -1),
|
||||
make_tuple(8, 4, &aom_sad8xh_sse2, -1),
|
||||
|
|
@ -1275,8 +1282,8 @@ const JntSadMxhParam jnt_sad_sse2_tests[] = {
|
|||
make_tuple(16, 64, &aom_sad16xh_sse2, -1),
|
||||
make_tuple(64, 16, &aom_sad64xh_sse2, -1),
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, JntSADTest,
|
||||
::testing::ValuesIn(jnt_sad_sse2_tests));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, DistWtdSADTest,
|
||||
::testing::ValuesIn(dist_wtd_sad_sse2_tests));
|
||||
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
|
|
@ -1285,49 +1292,49 @@ INSTANTIATE_TEST_CASE_P(SSE2, JntSADTest,
|
|||
#endif // HAVE_SSE3
|
||||
|
||||
#if HAVE_SSSE3
|
||||
const JntCompAvgParam jnt_comp_avg_ssse3_tests[] = {
|
||||
make_tuple(128, 128, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(128, 64, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 128, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 64, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 32, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 64, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 32, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 16, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 32, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 8, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 16, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 8, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 4, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(4, 8, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(4, 4, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_jnt_comp_avg_pred_ssse3, -1),
|
||||
const DistWtdCompAvgParam dist_wtd_comp_avg_ssse3_tests[] = {
|
||||
make_tuple(128, 128, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(128, 64, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 128, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 64, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(64, 32, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 64, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 32, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(32, 16, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 32, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 8, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 16, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 8, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(8, 4, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(4, 8, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(4, 4, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_dist_wtd_comp_avg_pred_ssse3, -1),
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, JntCompAvgTest,
|
||||
::testing::ValuesIn(jnt_comp_avg_ssse3_tests));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, DistWtdCompAvgTest,
|
||||
::testing::ValuesIn(dist_wtd_comp_avg_ssse3_tests));
|
||||
|
||||
const JntSadMxNAvgParam jnt_avg_ssse3_tests[] = {
|
||||
make_tuple(128, 128, &aom_jnt_sad128x128_avg_ssse3, -1),
|
||||
make_tuple(128, 64, &aom_jnt_sad128x64_avg_ssse3, -1),
|
||||
make_tuple(64, 128, &aom_jnt_sad64x128_avg_ssse3, -1),
|
||||
make_tuple(64, 64, &aom_jnt_sad64x64_avg_ssse3, -1),
|
||||
make_tuple(64, 32, &aom_jnt_sad64x32_avg_ssse3, -1),
|
||||
make_tuple(32, 64, &aom_jnt_sad32x64_avg_ssse3, -1),
|
||||
make_tuple(32, 32, &aom_jnt_sad32x32_avg_ssse3, -1),
|
||||
make_tuple(32, 16, &aom_jnt_sad32x16_avg_ssse3, -1),
|
||||
make_tuple(16, 32, &aom_jnt_sad16x32_avg_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_jnt_sad16x16_avg_ssse3, -1),
|
||||
make_tuple(16, 8, &aom_jnt_sad16x8_avg_ssse3, -1),
|
||||
make_tuple(8, 16, &aom_jnt_sad8x16_avg_ssse3, -1),
|
||||
make_tuple(8, 8, &aom_jnt_sad8x8_avg_ssse3, -1),
|
||||
make_tuple(8, 4, &aom_jnt_sad8x4_avg_ssse3, -1),
|
||||
make_tuple(4, 8, &aom_jnt_sad4x8_avg_ssse3, -1),
|
||||
make_tuple(4, 4, &aom_jnt_sad4x4_avg_ssse3, -1),
|
||||
const DistWtdSadMxNAvgParam dist_wtd_avg_ssse3_tests[] = {
|
||||
make_tuple(128, 128, &aom_dist_wtd_sad128x128_avg_ssse3, -1),
|
||||
make_tuple(128, 64, &aom_dist_wtd_sad128x64_avg_ssse3, -1),
|
||||
make_tuple(64, 128, &aom_dist_wtd_sad64x128_avg_ssse3, -1),
|
||||
make_tuple(64, 64, &aom_dist_wtd_sad64x64_avg_ssse3, -1),
|
||||
make_tuple(64, 32, &aom_dist_wtd_sad64x32_avg_ssse3, -1),
|
||||
make_tuple(32, 64, &aom_dist_wtd_sad32x64_avg_ssse3, -1),
|
||||
make_tuple(32, 32, &aom_dist_wtd_sad32x32_avg_ssse3, -1),
|
||||
make_tuple(32, 16, &aom_dist_wtd_sad32x16_avg_ssse3, -1),
|
||||
make_tuple(16, 32, &aom_dist_wtd_sad16x32_avg_ssse3, -1),
|
||||
make_tuple(16, 16, &aom_dist_wtd_sad16x16_avg_ssse3, -1),
|
||||
make_tuple(16, 8, &aom_dist_wtd_sad16x8_avg_ssse3, -1),
|
||||
make_tuple(8, 16, &aom_dist_wtd_sad8x16_avg_ssse3, -1),
|
||||
make_tuple(8, 8, &aom_dist_wtd_sad8x8_avg_ssse3, -1),
|
||||
make_tuple(8, 4, &aom_dist_wtd_sad8x4_avg_ssse3, -1),
|
||||
make_tuple(4, 8, &aom_dist_wtd_sad4x8_avg_ssse3, -1),
|
||||
make_tuple(4, 4, &aom_dist_wtd_sad4x4_avg_ssse3, -1),
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, JntSADavgTest,
|
||||
::testing::ValuesIn(jnt_avg_ssse3_tests));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, DistWtdSADavgTest,
|
||||
::testing::ValuesIn(dist_wtd_avg_ssse3_tests));
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using libaom_test::ACMRandom;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
|
||||
typedef void (*SgrFunc)(const uint8_t *dat8, int width, int height, int stride,
|
||||
int eps, const int *xqd, uint8_t *dst8, int dst_stride,
|
||||
|
|
|
|||
2
third_party/aom/test/simd_cmp_impl.h
vendored
2
third_party/aom/test/simd_cmp_impl.h
vendored
|
|
@ -471,7 +471,7 @@ typedef struct {
|
|||
|
||||
#define MAP(name) \
|
||||
{ \
|
||||
#name, reinterpret_cast < fptr > (c_##name), \
|
||||
#name, reinterpret_cast < fptr > (c_##name), \
|
||||
reinterpret_cast < fptr > (name) \
|
||||
}
|
||||
|
||||
|
|
|
|||
170
third_party/aom/test/sum_squares_test.cc
vendored
170
third_party/aom/test/sum_squares_test.cc
vendored
|
|
@ -27,6 +27,10 @@
|
|||
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::FunctionEquivalenceTest;
|
||||
using ::testing::Combine;
|
||||
using ::testing::Range;
|
||||
using ::testing::Values;
|
||||
using ::testing::ValuesIn;
|
||||
|
||||
namespace {
|
||||
const int kNumIterations = 10000;
|
||||
|
|
@ -225,4 +229,170 @@ INSTANTIATE_TEST_CASE_P(SSE2, SumSquares1DTest,
|
|||
aom_sum_squares_i16_c, aom_sum_squares_i16_sse2)));
|
||||
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
typedef int64_t (*sse_func)(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int width, int height);
|
||||
typedef libaom_test::FuncParam<sse_func> TestSSEFuncs;
|
||||
|
||||
typedef ::testing::tuple<TestSSEFuncs, int> SSETestParam;
|
||||
|
||||
class SSETest : public ::testing::TestWithParam<SSETestParam> {
|
||||
public:
|
||||
virtual ~SSETest() {}
|
||||
virtual void SetUp() {
|
||||
params_ = GET_PARAM(0);
|
||||
width_ = GET_PARAM(1);
|
||||
isHbd_ = params_.ref_func == aom_highbd_sse_c;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
src_ = reinterpret_cast<uint8_t *>(aom_memalign(32, 256 * 256 * 2));
|
||||
ref_ = reinterpret_cast<uint8_t *>(aom_memalign(32, 256 * 256 * 2));
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
ASSERT_TRUE(ref_ != NULL);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libaom_test::ClearSystemState();
|
||||
aom_free(src_);
|
||||
aom_free(ref_);
|
||||
}
|
||||
void RunTest(int isRandom, int width, int height, int run_times);
|
||||
|
||||
void GenRandomData(int width, int height, int stride) {
|
||||
uint16_t *pSrc = (uint16_t *)src_;
|
||||
uint16_t *pRef = (uint16_t *)ref_;
|
||||
const int msb = 11; // Up to 12 bit input
|
||||
const int limit = 1 << (msb + 1);
|
||||
for (int ii = 0; ii < height; ii++) {
|
||||
for (int jj = 0; jj < width; jj++) {
|
||||
if (!isHbd_) {
|
||||
src_[ii * stride + jj] = rnd_.Rand8();
|
||||
ref_[ii * stride + jj] = rnd_.Rand8();
|
||||
} else {
|
||||
pSrc[ii * stride + jj] = rnd_(limit);
|
||||
pRef[ii * stride + jj] = rnd_(limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GenExtremeData(int width, int height, int stride, uint8_t *data,
|
||||
int16_t val) {
|
||||
uint16_t *pData = (uint16_t *)data;
|
||||
for (int ii = 0; ii < height; ii++) {
|
||||
for (int jj = 0; jj < width; jj++) {
|
||||
if (!isHbd_) {
|
||||
data[ii * stride + jj] = (uint8_t)val;
|
||||
} else {
|
||||
pData[ii * stride + jj] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
int isHbd_;
|
||||
int width_;
|
||||
TestSSEFuncs params_;
|
||||
uint8_t *src_;
|
||||
uint8_t *ref_;
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
void SSETest::RunTest(int isRandom, int width, int height, int run_times) {
|
||||
int failed = 0;
|
||||
aom_usec_timer ref_timer, test_timer;
|
||||
for (int k = 0; k < 3; k++) {
|
||||
int stride = 4 << rnd_(7); // Up to 256 stride
|
||||
while (stride < width) { // Make sure it's valid
|
||||
stride = 4 << rnd_(7);
|
||||
}
|
||||
if (isRandom) {
|
||||
GenRandomData(width, height, stride);
|
||||
} else {
|
||||
const int msb = isHbd_ ? 12 : 8; // Up to 12 bit input
|
||||
const int limit = (1 << msb) - 1;
|
||||
if (k == 0) {
|
||||
GenExtremeData(width, height, stride, src_, 0);
|
||||
GenExtremeData(width, height, stride, ref_, limit);
|
||||
} else {
|
||||
GenExtremeData(width, height, stride, src_, limit);
|
||||
GenExtremeData(width, height, stride, ref_, 0);
|
||||
}
|
||||
}
|
||||
int64_t res_ref, res_tst;
|
||||
uint8_t *pSrc = src_;
|
||||
uint8_t *pRef = ref_;
|
||||
if (isHbd_) {
|
||||
pSrc = CONVERT_TO_BYTEPTR(src_);
|
||||
pRef = CONVERT_TO_BYTEPTR(ref_);
|
||||
}
|
||||
res_ref = params_.ref_func(pSrc, stride, pRef, stride, width, height);
|
||||
res_tst = params_.tst_func(pSrc, stride, pRef, stride, width, height);
|
||||
if (run_times > 1) {
|
||||
aom_usec_timer_start(&ref_timer);
|
||||
for (int j = 0; j < run_times; j++) {
|
||||
params_.ref_func(pSrc, stride, pRef, stride, width, height);
|
||||
}
|
||||
aom_usec_timer_mark(&ref_timer);
|
||||
const int elapsed_time_c =
|
||||
static_cast<int>(aom_usec_timer_elapsed(&ref_timer));
|
||||
|
||||
aom_usec_timer_start(&test_timer);
|
||||
for (int j = 0; j < run_times; j++) {
|
||||
params_.tst_func(pSrc, stride, pRef, stride, width, height);
|
||||
}
|
||||
aom_usec_timer_mark(&test_timer);
|
||||
const int elapsed_time_simd =
|
||||
static_cast<int>(aom_usec_timer_elapsed(&test_timer));
|
||||
|
||||
printf(
|
||||
"c_time=%d \t simd_time=%d \t "
|
||||
"gain=%d\n",
|
||||
elapsed_time_c, elapsed_time_simd,
|
||||
(elapsed_time_c / elapsed_time_simd));
|
||||
} else {
|
||||
if (!failed) {
|
||||
failed = res_ref != res_tst;
|
||||
EXPECT_EQ(res_ref, res_tst)
|
||||
<< "Error:" << (isHbd_ ? "hbd " : " ") << k << " SSE Test ["
|
||||
<< width << "x" << height
|
||||
<< "] C output does not match optimized output.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(SSETest, OperationCheck) {
|
||||
for (int height = 4; height <= 128; height += 4) {
|
||||
RunTest(1, width_, height, 1); // GenRandomData
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(SSETest, ExtremeValues) {
|
||||
for (int height = 4; height <= 128; height += 4) {
|
||||
RunTest(0, width_, height, 1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(SSETest, DISABLED_Speed) {
|
||||
for (int height = 4; height <= 128; height += 4) {
|
||||
RunTest(1, width_, height, 100);
|
||||
}
|
||||
}
|
||||
#if HAVE_SSE4_1
|
||||
TestSSEFuncs sse_sse4[] = { TestSSEFuncs(&aom_sse_c, &aom_sse_sse4_1),
|
||||
TestSSEFuncs(&aom_highbd_sse_c,
|
||||
&aom_highbd_sse_sse4_1) };
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, SSETest,
|
||||
Combine(ValuesIn(sse_sse4), Range(4, 129, 4)));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
|
||||
TestSSEFuncs sse_avx2[] = { TestSSEFuncs(&aom_sse_c, &aom_sse_avx2),
|
||||
TestSSEFuncs(&aom_highbd_sse_c,
|
||||
&aom_highbd_sse_avx2) };
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, SSETest,
|
||||
Combine(ValuesIn(sse_avx2), Range(4, 129, 4)));
|
||||
#endif // HAVE_AVX2
|
||||
} // namespace
|
||||
|
|
|
|||
2
third_party/aom/test/superframe_test.cc
vendored
2
third_party/aom/test/superframe_test.cc
vendored
|
|
@ -45,7 +45,7 @@ class SuperframeTest
|
|||
|
||||
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video,
|
||||
libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(AOME_SET_CPUUSED, 2);
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_);
|
||||
|
|
|
|||
27
third_party/aom/test/test-data.sha1
vendored
27
third_party/aom/test/test-data.sha1
vendored
|
|
@ -2,12 +2,32 @@ d5dfb0151c9051f8c85999255645d7a23916d3c0 *hantro_collage_w352h288.yuv
|
|||
b87815bf86020c592ccc7a846ba2e28ec8043902 *hantro_odd.yuv
|
||||
26b7f64399b84db4b4c9c915d743ec5c2619d4b9 *invalid-bug-1814.ivf
|
||||
d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-bug-1814.ivf.res
|
||||
09aa07e5325b3bb5462182eb30b8ecc914630740 *invalid-chromium-906381.ivf
|
||||
09d2af8dd22201dd8d48e5dcfcaed281ff9422c7 *invalid-chromium-906381.ivf.res
|
||||
fa06784f23751d8c37be94160fb821e855199af4 *invalid-oss-fuzz-10061.ivf
|
||||
b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10061.ivf.res
|
||||
c9e06c4c7fb7d69fd635a1f606a5e478d60e99cf *invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf
|
||||
88e18e61bd2b7457b4c71ebefbdff0029c41cc04 *invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf.res
|
||||
91a5bedeb4832c1c2900736cc0f644bb63971bbc *invalid-oss-fuzz-10227.ivf
|
||||
b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10227.ivf.res
|
||||
b2d0a29a65879436bf483d04865faca7d11cc2ee *invalid-oss-fuzz-10389.ivf
|
||||
9655e6275888547ecd1f14e20e08ce4891372e76 *invalid-oss-fuzz-10389.ivf.res
|
||||
11df8e9a068669c678097d460b63609d3da73828 *invalid-oss-fuzz-10555.ivf
|
||||
b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10555.ivf.res
|
||||
cf5945085fe85456a1f74bf4cc7998b88b3f4b62 *invalid-oss-fuzz-10705.ivf
|
||||
758671858368ffd2a2c0727898de5661f7cf7d68 *invalid-oss-fuzz-10705.ivf.res
|
||||
88e29851122cca3f336824f7fa4d9f757f91110c *invalid-oss-fuzz-10723.ivf
|
||||
1af486cd2cc83ebeddc76ca7a1c512cc0ec568d5 *invalid-oss-fuzz-10723.ivf.res
|
||||
0784acc8931090ec24eba752d6c27e359e68fe7d *invalid-oss-fuzz-10779.ivf
|
||||
5d9474c0309b7ca09a182d888f73b37a8fe1362c *invalid-oss-fuzz-10779.ivf.res
|
||||
7d37be9357f89a100ced694aee1ca5a6fad35ba9 *invalid-oss-fuzz-11477.ivf
|
||||
15932651aacfc4622f0910f728f3f95e08e1753d *invalid-oss-fuzz-11477.ivf.res
|
||||
1674787c38ddf82a2e5c804203f04f56a304e8e0 *invalid-oss-fuzz-11479.ivf
|
||||
1af486cd2cc83ebeddc76ca7a1c512cc0ec568d5 *invalid-oss-fuzz-11479.ivf.res
|
||||
b1a45514f0c59be03c9991cd04882426b9b930fa *invalid-oss-fuzz-11523.ivf
|
||||
7c44ac1723c14d98bcb888fbf118c959511519ba *invalid-oss-fuzz-11523.ivf.res
|
||||
ccbe4081557eb44820a0e6337c4a094421826b9a *invalid-oss-fuzz-9288.ivf
|
||||
67c54283fe1a26ccf02cc991e4f9a1eea3ac5e78 *invalid-oss-fuzz-9288.ivf.res
|
||||
c0960f032484579f967881cc025b71cfd7a79ee1 *invalid-oss-fuzz-9463.ivf
|
||||
d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-oss-fuzz-9463.ivf.res
|
||||
f448caf378e250b7eea4fa2d1c3cd7ef4a3211ce *invalid-oss-fuzz-9482.ivf
|
||||
|
|
@ -505,3 +525,10 @@ e69e41fee40b408b6eebcc79f266a95f2ee24f9e *av1-1-b8-03-sizedown.mkv
|
|||
8de81b170635d456602dc8923a8b39c534d01fa8 *av1-1-b8-03-sizeup.mkv.md5
|
||||
d3ed7de0aa8c155fe35e0f5f4203240710d31383 *park_joy_90p_8_420_monochrome.y4m
|
||||
5b3f0907407b809aa66b62cb080feda8c92454ca *park_joy_90p_8_420_vertical_csp.y4m
|
||||
caf8b6a5f1a5bcb38afae8a54a08c4f4459aafa3 *vase10x10_tiles.txt
|
||||
e14825f50ff845b8a6932c64cb254007a0b5e3a1 *av1-1-b8-22-svc-L2T1.ivf
|
||||
0f75f2ac44e61fc83be70c955410fa378e433237 *av1-1-b8-22-svc-L2T1.ivf.md5
|
||||
e94687eb0e90179b3800b6d5e11eb7e9bfb34eec *av1-1-b8-22-svc-L1T2.ivf
|
||||
2bc12b16385ea14323bc79607fb8dfbd7edaf8ef *av1-1-b8-22-svc-L1T2.ivf.md5
|
||||
32ef2f14ee9cb11a24a22934f4c065e926e5d236 *av1-1-b8-22-svc-L2T2.ivf
|
||||
f476a10ff06d750129f8229755d51e17ff141b2a *av1-1-b8-22-svc-L2T2.ivf.md5
|
||||
|
|
|
|||
31
third_party/aom/test/test.cmake
vendored
31
third_party/aom/test/test.cmake
vendored
|
|
@ -170,6 +170,7 @@ if(NOT BUILD_SHARED_LIBS)
|
|||
"${AOM_ROOT}/test/av1_fwd_txfm2d_test.cc"
|
||||
"${AOM_ROOT}/test/av1_inv_txfm1d_test.cc"
|
||||
"${AOM_ROOT}/test/av1_inv_txfm2d_test.cc"
|
||||
"${AOM_ROOT}/test/av1_nn_predict_test.cc"
|
||||
"${AOM_ROOT}/test/av1_round_shift_array_test.cc"
|
||||
"${AOM_ROOT}/test/av1_txfm_test.cc"
|
||||
"${AOM_ROOT}/test/av1_txfm_test.h"
|
||||
|
|
@ -179,10 +180,12 @@ if(NOT BUILD_SHARED_LIBS)
|
|||
"${AOM_ROOT}/test/comp_avg_pred_test.cc"
|
||||
"${AOM_ROOT}/test/comp_avg_pred_test.h"
|
||||
"${AOM_ROOT}/test/comp_mask_variance_test.cc"
|
||||
"${AOM_ROOT}/test/edge_detect_test.cc"
|
||||
"${AOM_ROOT}/test/encodetxb_test.cc"
|
||||
"${AOM_ROOT}/test/error_block_test.cc"
|
||||
"${AOM_ROOT}/test/fft_test.cc"
|
||||
"${AOM_ROOT}/test/fwht4x4_test.cc"
|
||||
"${AOM_ROOT}/test/horver_correlation_test.cc"
|
||||
"${AOM_ROOT}/test/masked_sad_test.cc"
|
||||
"${AOM_ROOT}/test/masked_variance_test.cc"
|
||||
"${AOM_ROOT}/test/motion_vector_test.cc"
|
||||
|
|
@ -230,13 +233,6 @@ if(ENABLE_TESTS)
|
|||
"make sure it's in your PATH.")
|
||||
endif()
|
||||
|
||||
if(MSVC) # Force static run time to avoid collisions with googletest.
|
||||
include("${AOM_ROOT}/build/cmake/msvc_runtime.cmake")
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(AOM_DISABLE_GTEST_CMAKE 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS AND APPLE) # Silence an RPATH warning.
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
endif()
|
||||
|
|
@ -244,15 +240,16 @@ if(ENABLE_TESTS)
|
|||
include_directories(
|
||||
"${AOM_ROOT}/third_party/googletest/src/googletest/include")
|
||||
|
||||
if(AOM_DISABLE_GTEST_CMAKE)
|
||||
include_directories("${AOM_ROOT}/third_party/googletest/src/googletest")
|
||||
add_library(
|
||||
gtest
|
||||
STATIC
|
||||
"${AOM_ROOT}/third_party/googletest/src/googletest/src/gtest-all.cc")
|
||||
include_directories("${AOM_ROOT}/third_party/googletest/src/googletest")
|
||||
add_library(
|
||||
aom_gtest
|
||||
STATIC "${AOM_ROOT}/third_party/googletest/src/googletest/src/gtest-all.cc")
|
||||
if(MSVC OR WIN32)
|
||||
target_compile_definitions(aom_gtest PRIVATE GTEST_OS_WINDOWS=1)
|
||||
elseif(CONFIG_MULTITHREAD AND CMAKE_USE_PTHREADS_INIT)
|
||||
target_compile_definitions(aom_gtest PRIVATE GTEST_HAS_PTHREAD=1)
|
||||
else()
|
||||
add_subdirectory("${AOM_ROOT}/third_party/googletest/src/googletest"
|
||||
EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(aom_gtest PRIVATE GTEST_HAS_PTHREAD=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -304,12 +301,12 @@ function(setup_aom_test_targets)
|
|||
add_executable(test_intra_pred_speed ${AOM_TEST_INTRA_PRED_SPEED_SOURCES}
|
||||
$<TARGET_OBJECTS:aom_common_app_util>)
|
||||
target_link_libraries(test_intra_pred_speed ${AOM_LIB_LINK_TYPE} aom
|
||||
gtest)
|
||||
aom_gtest)
|
||||
list(APPEND AOM_APP_TARGETS test_intra_pred_speed)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(test_libaom ${AOM_LIB_LINK_TYPE} aom gtest)
|
||||
target_link_libraries(test_libaom ${AOM_LIB_LINK_TYPE} aom aom_gtest)
|
||||
|
||||
if(CONFIG_LIBYUV)
|
||||
target_sources(test_libaom PRIVATE $<TARGET_OBJECTS:yuv>)
|
||||
|
|
|
|||
59
third_party/aom/test/test_data_util.cmake
vendored
59
third_party/aom/test/test_data_util.cmake
vendored
|
|
@ -12,20 +12,6 @@
|
|||
list(APPEND AOM_TEST_DATA_FILE_NAMES
|
||||
"hantro_collage_w352h288.yuv"
|
||||
"hantro_odd.yuv"
|
||||
"invalid-bug-1814.ivf"
|
||||
"invalid-bug-1814.ivf.res"
|
||||
"invalid-oss-fuzz-10061.ivf"
|
||||
"invalid-oss-fuzz-10061.ivf.res"
|
||||
"invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf"
|
||||
"invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf.res"
|
||||
"invalid-oss-fuzz-10227.ivf"
|
||||
"invalid-oss-fuzz-10227.ivf.res"
|
||||
"invalid-oss-fuzz-9463.ivf"
|
||||
"invalid-oss-fuzz-9463.ivf.res"
|
||||
"invalid-oss-fuzz-9482.ivf"
|
||||
"invalid-oss-fuzz-9482.ivf.res"
|
||||
"invalid-oss-fuzz-9720.ivf"
|
||||
"invalid-oss-fuzz-9720.ivf.res"
|
||||
"park_joy_90p_10_420.y4m"
|
||||
"park_joy_90p_10_422.y4m"
|
||||
"park_joy_90p_10_444.y4m"
|
||||
|
|
@ -43,7 +29,8 @@ list(APPEND AOM_TEST_DATA_FILE_NAMES
|
|||
"rush_hour_444.y4m"
|
||||
"screendata.y4m"
|
||||
"niklas_640_480_30.yuv"
|
||||
"vase10x10.yuv")
|
||||
"vase10x10.yuv"
|
||||
"vase10x10_tiles.txt")
|
||||
|
||||
if(ENABLE_DECODE_PERF_TESTS AND CONFIG_AV1_ENCODER)
|
||||
list(APPEND AOM_TEST_DATA_FILE_NAMES "niklas_1280_720_30.yuv")
|
||||
|
|
@ -512,7 +499,47 @@ if(CONFIG_AV1_DECODER)
|
|||
"av1-1-b8-03-sizeup.mkv"
|
||||
"av1-1-b8-03-sizeup.mkv.md5"
|
||||
"av1-1-b8-03-sizedown.mkv"
|
||||
"av1-1-b8-03-sizedown.mkv.md5")
|
||||
"av1-1-b8-03-sizedown.mkv.md5"
|
||||
"av1-1-b8-22-svc-L2T1.ivf"
|
||||
"av1-1-b8-22-svc-L2T1.ivf.md5"
|
||||
"av1-1-b8-22-svc-L1T2.ivf"
|
||||
"av1-1-b8-22-svc-L1T2.ivf.md5"
|
||||
"av1-1-b8-22-svc-L2T2.ivf"
|
||||
"av1-1-b8-22-svc-L2T2.ivf.md5"
|
||||
"invalid-bug-1814.ivf"
|
||||
"invalid-bug-1814.ivf.res"
|
||||
"invalid-chromium-906381.ivf"
|
||||
"invalid-chromium-906381.ivf.res"
|
||||
"invalid-oss-fuzz-10061.ivf"
|
||||
"invalid-oss-fuzz-10061.ivf.res"
|
||||
"invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf"
|
||||
"invalid-oss-fuzz-10117-mc-buf-use-highbd.ivf.res"
|
||||
"invalid-oss-fuzz-10227.ivf"
|
||||
"invalid-oss-fuzz-10227.ivf.res"
|
||||
"invalid-oss-fuzz-10389.ivf"
|
||||
"invalid-oss-fuzz-10389.ivf.res"
|
||||
"invalid-oss-fuzz-10555.ivf"
|
||||
"invalid-oss-fuzz-10555.ivf.res"
|
||||
"invalid-oss-fuzz-10705.ivf"
|
||||
"invalid-oss-fuzz-10705.ivf.res"
|
||||
"invalid-oss-fuzz-10723.ivf"
|
||||
"invalid-oss-fuzz-10723.ivf.res"
|
||||
"invalid-oss-fuzz-10779.ivf"
|
||||
"invalid-oss-fuzz-10779.ivf.res"
|
||||
"invalid-oss-fuzz-11477.ivf"
|
||||
"invalid-oss-fuzz-11477.ivf.res"
|
||||
"invalid-oss-fuzz-11479.ivf"
|
||||
"invalid-oss-fuzz-11479.ivf.res"
|
||||
"invalid-oss-fuzz-11523.ivf"
|
||||
"invalid-oss-fuzz-11523.ivf.res"
|
||||
"invalid-oss-fuzz-9288.ivf"
|
||||
"invalid-oss-fuzz-9288.ivf.res"
|
||||
"invalid-oss-fuzz-9463.ivf"
|
||||
"invalid-oss-fuzz-9463.ivf.res"
|
||||
"invalid-oss-fuzz-9482.ivf"
|
||||
"invalid-oss-fuzz-9482.ivf.res"
|
||||
"invalid-oss-fuzz-9720.ivf"
|
||||
"invalid-oss-fuzz-9720.ivf.res")
|
||||
endif()
|
||||
|
||||
if(ENABLE_ENCODE_PERF_TESTS AND CONFIG_AV1_ENCODER)
|
||||
|
|
|
|||
3
third_party/aom/test/test_vector_test.cc
vendored
3
third_party/aom/test/test_vector_test.cc
vendored
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
|
@ -116,7 +117,7 @@ TEST_P(TestVectorTest, MD5Match) {
|
|||
SCOPED_TRACE(str);
|
||||
|
||||
// Open compressed video file.
|
||||
testing::internal::scoped_ptr<libaom_test::CompressedVideoSource> video;
|
||||
std::unique_ptr<libaom_test::CompressedVideoSource> video;
|
||||
if (filename.substr(filename.length() - 3, 3) == "ivf") {
|
||||
video.reset(new libaom_test::IVFVideoSource(filename));
|
||||
} else if (filename.substr(filename.length() - 4, 4) == "webm" ||
|
||||
|
|
|
|||
3
third_party/aom/test/test_vectors.cc
vendored
3
third_party/aom/test/test_vectors.cc
vendored
|
|
@ -132,7 +132,8 @@ const char *const kAV1TestVectors[] = {
|
|||
"av1-1-b8-01-size-66x32.ivf", "av1-1-b8-01-size-66x34.ivf",
|
||||
"av1-1-b8-01-size-66x64.ivf", "av1-1-b8-01-size-66x66.ivf",
|
||||
"av1-1-b8-02-allintra.ivf", "av1-1-b8-03-sizedown.mkv",
|
||||
"av1-1-b8-03-sizeup.mkv"
|
||||
"av1-1-b8-03-sizeup.mkv", "av1-1-b8-22-svc-L1T2.ivf",
|
||||
"av1-1-b8-22-svc-L2T1.ivf", "av1-1-b8-22-svc-L2T2.ivf"
|
||||
};
|
||||
const int kNumAV1TestVectors = NELEMENTS(kAV1TestVectors);
|
||||
#endif // CONFIG_AV1_DECODER
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class TileIndependenceTest
|
|||
|
||||
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video,
|
||||
libaom_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_);
|
||||
encoder->Control(AV1E_SET_TILE_ROWS, n_tile_rows_);
|
||||
SetCpuUsed(encoder);
|
||||
|
|
|
|||
140
third_party/aom/test/variance_test.cc
vendored
140
third_party/aom/test/variance_test.cc
vendored
|
|
@ -43,10 +43,10 @@ typedef unsigned int (*SubpixAvgVarMxNFunc)(const uint8_t *a, int a_stride,
|
|||
typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
|
||||
const uint8_t *b, int b_stride);
|
||||
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
|
||||
typedef unsigned int (*JntSubpixAvgVarMxNFunc)(
|
||||
typedef unsigned int (*DistWtdSubpixAvgVarMxNFunc)(
|
||||
const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b,
|
||||
int b_stride, uint32_t *sse, const uint8_t *second_pred,
|
||||
const JNT_COMP_PARAMS *jcp_param);
|
||||
const DIST_WTD_COMP_PARAMS *jcp_param);
|
||||
typedef uint32_t (*ObmcSubpelVarFunc)(const uint8_t *pre, int pre_stride,
|
||||
int xoffset, int yoffset,
|
||||
const int32_t *wsrc, const int32_t *mask,
|
||||
|
|
@ -216,10 +216,10 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
|
|||
return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h)));
|
||||
}
|
||||
|
||||
static uint32_t jnt_subpel_avg_variance_ref(
|
||||
static uint32_t dist_wtd_subpel_avg_variance_ref(
|
||||
const uint8_t *ref, const uint8_t *src, const uint8_t *second_pred, int l2w,
|
||||
int l2h, int xoff, int yoff, uint32_t *sse_ptr, bool use_high_bit_depth,
|
||||
aom_bit_depth_t bit_depth, JNT_COMP_PARAMS *jcp_param) {
|
||||
aom_bit_depth_t bit_depth, DIST_WTD_COMP_PARAMS *jcp_param) {
|
||||
int64_t se = 0;
|
||||
uint64_t sse = 0;
|
||||
const int w = 1 << l2w;
|
||||
|
|
@ -709,7 +709,7 @@ class SubpelVarianceTest
|
|||
uint8_t *ref_;
|
||||
uint8_t *sec_;
|
||||
TestParams<FunctionType> params_;
|
||||
JNT_COMP_PARAMS jcp_param_;
|
||||
DIST_WTD_COMP_PARAMS jcp_param_;
|
||||
|
||||
// some relay helpers
|
||||
bool use_high_bit_depth() const { return params_.use_high_bit_depth; }
|
||||
|
|
@ -820,7 +820,7 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
|
|||
}
|
||||
|
||||
template <>
|
||||
void SubpelVarianceTest<JntSubpixAvgVarMxNFunc>::RefTest() {
|
||||
void SubpelVarianceTest<DistWtdSubpixAvgVarMxNFunc>::RefTest() {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
if (!use_high_bit_depth()) {
|
||||
|
|
@ -849,7 +849,7 @@ void SubpelVarianceTest<JntSubpixAvgVarMxNFunc>::RefTest() {
|
|||
ASM_REGISTER_STATE_CHECK(var1 = params_.func(ref_, width() + 0, x, y,
|
||||
src_, width(), &sse1,
|
||||
sec_, &jcp_param_));
|
||||
var2 = jnt_subpel_avg_variance_ref(
|
||||
var2 = dist_wtd_subpel_avg_variance_ref(
|
||||
ref_, src_, sec_, params_.log2width, params_.log2height, x, y,
|
||||
&sse2, use_high_bit_depth(), params_.bit_depth, &jcp_param_);
|
||||
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
|
||||
|
|
@ -1022,7 +1022,8 @@ typedef MainTestClass<VarianceMxNFunc> AvxMseTest;
|
|||
typedef MainTestClass<VarianceMxNFunc> AvxVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixVarMxNFunc> AvxSubpelVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> AvxSubpelAvgVarianceTest;
|
||||
typedef SubpelVarianceTest<JntSubpixAvgVarMxNFunc> AvxJntSubpelAvgVarianceTest;
|
||||
typedef SubpelVarianceTest<DistWtdSubpixAvgVarMxNFunc>
|
||||
AvxDistWtdSubpelAvgVarianceTest;
|
||||
typedef ObmcVarianceTest<ObmcSubpelVarFunc> AvxObmcSubpelVarianceTest;
|
||||
|
||||
TEST_P(AvxSseTest, RefSse) { RefTestSse(); }
|
||||
|
|
@ -1039,7 +1040,7 @@ TEST_P(SumOfSquaresTest, Ref) { RefTest(); }
|
|||
TEST_P(AvxSubpelVarianceTest, Ref) { RefTest(); }
|
||||
TEST_P(AvxSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
|
||||
TEST_P(AvxSubpelAvgVarianceTest, Ref) { RefTest(); }
|
||||
TEST_P(AvxJntSubpelAvgVarianceTest, Ref) { RefTest(); }
|
||||
TEST_P(AvxDistWtdSubpelAvgVarianceTest, Ref) { RefTest(); }
|
||||
TEST_P(AvxObmcSubpelVarianceTest, Ref) { RefTest(); }
|
||||
TEST_P(AvxObmcSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
|
||||
TEST_P(AvxObmcSubpelVarianceTest, DISABLED_Speed) { SpeedTest(); }
|
||||
|
|
@ -1121,36 +1122,35 @@ INSTANTIATE_TEST_CASE_P(
|
|||
SubpelAvgVarianceParams(2, 3, &aom_sub_pixel_avg_variance4x8_c, 0),
|
||||
SubpelAvgVarianceParams(2, 2, &aom_sub_pixel_avg_variance4x4_c, 0)));
|
||||
|
||||
typedef TestParams<JntSubpixAvgVarMxNFunc> JntSubpelAvgVarianceParams;
|
||||
typedef TestParams<DistWtdSubpixAvgVarMxNFunc> DistWtdSubpelAvgVarianceParams;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, AvxJntSubpelAvgVarianceTest,
|
||||
::testing::Values(
|
||||
JntSubpelAvgVarianceParams(6, 6, &aom_jnt_sub_pixel_avg_variance64x64_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(6, 5, &aom_jnt_sub_pixel_avg_variance64x32_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 6, &aom_jnt_sub_pixel_avg_variance32x64_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 5, &aom_jnt_sub_pixel_avg_variance32x32_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 4, &aom_jnt_sub_pixel_avg_variance32x16_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 5, &aom_jnt_sub_pixel_avg_variance16x32_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 4, &aom_jnt_sub_pixel_avg_variance16x16_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 3, &aom_jnt_sub_pixel_avg_variance16x8_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(3, 4, &aom_jnt_sub_pixel_avg_variance8x16_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(3, 3, &aom_jnt_sub_pixel_avg_variance8x8_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(3, 2, &aom_jnt_sub_pixel_avg_variance8x4_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(2, 3, &aom_jnt_sub_pixel_avg_variance4x8_c,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(2, 2, &aom_jnt_sub_pixel_avg_variance4x4_c,
|
||||
0)));
|
||||
C, AvxDistWtdSubpelAvgVarianceTest,
|
||||
::testing::Values(DistWtdSubpelAvgVarianceParams(
|
||||
6, 6, &aom_dist_wtd_sub_pixel_avg_variance64x64_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
6, 5, &aom_dist_wtd_sub_pixel_avg_variance64x32_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 6, &aom_dist_wtd_sub_pixel_avg_variance32x64_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 5, &aom_dist_wtd_sub_pixel_avg_variance32x32_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 4, &aom_dist_wtd_sub_pixel_avg_variance32x16_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 5, &aom_dist_wtd_sub_pixel_avg_variance16x32_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 4, &aom_dist_wtd_sub_pixel_avg_variance16x16_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 3, &aom_dist_wtd_sub_pixel_avg_variance16x8_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 4, &aom_dist_wtd_sub_pixel_avg_variance8x16_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 3, &aom_dist_wtd_sub_pixel_avg_variance8x8_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 2, &aom_dist_wtd_sub_pixel_avg_variance8x4_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
2, 3, &aom_dist_wtd_sub_pixel_avg_variance4x8_c, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
2, 2, &aom_dist_wtd_sub_pixel_avg_variance4x4_c, 0)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, AvxObmcSubpelVarianceTest,
|
||||
|
|
@ -1840,44 +1840,34 @@ INSTANTIATE_TEST_CASE_P(
|
|||
0)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, AvxJntSubpelAvgVarianceTest,
|
||||
SSSE3, AvxDistWtdSubpelAvgVarianceTest,
|
||||
::testing::Values(
|
||||
JntSubpelAvgVarianceParams(6, 6,
|
||||
&aom_jnt_sub_pixel_avg_variance64x64_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(6, 5,
|
||||
&aom_jnt_sub_pixel_avg_variance64x32_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 6,
|
||||
&aom_jnt_sub_pixel_avg_variance32x64_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 5,
|
||||
&aom_jnt_sub_pixel_avg_variance32x32_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(5, 4,
|
||||
&aom_jnt_sub_pixel_avg_variance32x16_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 5,
|
||||
&aom_jnt_sub_pixel_avg_variance16x32_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 4,
|
||||
&aom_jnt_sub_pixel_avg_variance16x16_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(4, 3,
|
||||
&aom_jnt_sub_pixel_avg_variance16x8_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(3, 4,
|
||||
&aom_jnt_sub_pixel_avg_variance8x16_ssse3,
|
||||
0),
|
||||
JntSubpelAvgVarianceParams(3, 3,
|
||||
&aom_jnt_sub_pixel_avg_variance8x8_ssse3, 0),
|
||||
JntSubpelAvgVarianceParams(3, 2,
|
||||
&aom_jnt_sub_pixel_avg_variance8x4_ssse3, 0),
|
||||
JntSubpelAvgVarianceParams(2, 3,
|
||||
&aom_jnt_sub_pixel_avg_variance4x8_ssse3, 0),
|
||||
JntSubpelAvgVarianceParams(2, 2,
|
||||
&aom_jnt_sub_pixel_avg_variance4x4_ssse3,
|
||||
0)));
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
6, 6, &aom_dist_wtd_sub_pixel_avg_variance64x64_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
6, 5, &aom_dist_wtd_sub_pixel_avg_variance64x32_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 6, &aom_dist_wtd_sub_pixel_avg_variance32x64_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 5, &aom_dist_wtd_sub_pixel_avg_variance32x32_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
5, 4, &aom_dist_wtd_sub_pixel_avg_variance32x16_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 5, &aom_dist_wtd_sub_pixel_avg_variance16x32_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 4, &aom_dist_wtd_sub_pixel_avg_variance16x16_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
4, 3, &aom_dist_wtd_sub_pixel_avg_variance16x8_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 4, &aom_dist_wtd_sub_pixel_avg_variance8x16_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 3, &aom_dist_wtd_sub_pixel_avg_variance8x8_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
3, 2, &aom_dist_wtd_sub_pixel_avg_variance8x4_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
2, 3, &aom_dist_wtd_sub_pixel_avg_variance4x8_ssse3, 0),
|
||||
DistWtdSubpelAvgVarianceParams(
|
||||
2, 2, &aom_dist_wtd_sub_pixel_avg_variance4x4_ssse3, 0)));
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
|
|
|
|||
4
third_party/aom/test/warp_filter_test.cc
vendored
4
third_party/aom/test/warp_filter_test.cc
vendored
|
|
@ -10,11 +10,11 @@
|
|||
*/
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
#include "test/warp_filter_test_util.h"
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
using libaom_test::ACMRandom;
|
||||
using libaom_test::AV1HighbdWarpFilter::AV1HighbdWarpFilterTest;
|
||||
using libaom_test::AV1WarpFilter::AV1WarpFilterTest;
|
||||
using ::testing::make_tuple;
|
||||
using ::testing::tuple;
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
|||
20
third_party/aom/test/warp_filter_test_util.cc
vendored
20
third_party/aom/test/warp_filter_test_util.cc
vendored
|
|
@ -149,7 +149,7 @@ void AV1WarpFilterTest::RunSpeedTest(warp_affine_func test_impl) {
|
|||
int do_average = 0;
|
||||
|
||||
conv_params = get_conv_params_no_round(do_average, 0, dsta, out_w, 1, bd);
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
|
||||
const int num_loops = 1000000000 / (out_w + out_h);
|
||||
aom_usec_timer timer;
|
||||
|
|
@ -222,9 +222,9 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
|
|||
conv_params = get_conv_params(0, 0, bd);
|
||||
}
|
||||
if (jj >= 4) {
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
} else {
|
||||
conv_params.use_jnt_comp_avg = 1;
|
||||
conv_params.use_dist_wtd_comp_avg = 1;
|
||||
conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
}
|
||||
|
|
@ -236,9 +236,9 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
|
|||
get_conv_params_no_round(do_average, 0, dstb, out_w, 1, bd);
|
||||
}
|
||||
if (jj >= 4) {
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
} else {
|
||||
conv_params.use_jnt_comp_avg = 1;
|
||||
conv_params.use_dist_wtd_comp_avg = 1;
|
||||
conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ void AV1HighbdWarpFilterTest::RunSpeedTest(highbd_warp_affine_func test_impl) {
|
|||
sub_x = 0;
|
||||
sub_y = 0;
|
||||
int do_average = 0;
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
conv_params = get_conv_params_no_round(do_average, 0, dsta, out_w, 1, bd);
|
||||
|
||||
const int num_loops = 1000000000 / (out_w + out_h);
|
||||
|
|
@ -419,9 +419,9 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
|
|||
conv_params = get_conv_params(0, 0, bd);
|
||||
}
|
||||
if (jj >= 4) {
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
} else {
|
||||
conv_params.use_jnt_comp_avg = 1;
|
||||
conv_params.use_dist_wtd_comp_avg = 1;
|
||||
conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
}
|
||||
|
|
@ -436,9 +436,9 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
|
|||
get_conv_params_no_round(do_average, 0, dstb, out_w, 1, bd);
|
||||
}
|
||||
if (jj >= 4) {
|
||||
conv_params.use_jnt_comp_avg = 0;
|
||||
conv_params.use_dist_wtd_comp_avg = 0;
|
||||
} else {
|
||||
conv_params.use_jnt_comp_avg = 1;
|
||||
conv_params.use_dist_wtd_comp_avg = 1;
|
||||
conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
|
||||
conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
|
||||
}
|
||||
|
|
|
|||
410
third_party/aom/test/wiener_test.cc
vendored
410
third_party/aom/test/wiener_test.cc
vendored
|
|
@ -13,32 +13,33 @@
|
|||
|
||||
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
|
||||
|
||||
#include "test/function_equivalence_test.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/util.h"
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/aom_timer.h"
|
||||
#include "av1/encoder/pickrst.h"
|
||||
|
||||
#define MAX_WIENER_BLOCK 384
|
||||
#define MAX_DATA_BLOCK (MAX_WIENER_BLOCK + WIENER_WIN)
|
||||
using libaom_test::FunctionEquivalenceTest;
|
||||
|
||||
namespace {
|
||||
// 8-bit-depth tests
|
||||
namespace wiener_lowbd {
|
||||
|
||||
static void compute_stats_win_opt_c(int wiener_win, const uint8_t *dgd,
|
||||
const uint8_t *src, int h_start, int h_end,
|
||||
int v_start, int v_end, int dgd_stride,
|
||||
int src_stride, double *M, double *H) {
|
||||
int src_stride, int64_t *M, int64_t *H) {
|
||||
ASSERT_TRUE(wiener_win == WIENER_WIN || wiener_win == WIENER_WIN_CHROMA);
|
||||
int i, j, k, l, m, n;
|
||||
const int pixel_count = (h_end - h_start) * (v_end - v_start);
|
||||
const int wiener_win2 = wiener_win * wiener_win;
|
||||
const int wiener_halfwin = (wiener_win >> 1);
|
||||
const double avg =
|
||||
find_average(dgd, h_start, h_end, v_start, v_end, dgd_stride);
|
||||
uint8_t avg = find_average(dgd, h_start, h_end, v_start, v_end, dgd_stride);
|
||||
|
||||
std::vector<std::vector<int64_t> > M_int(wiener_win,
|
||||
std::vector<int64_t>(wiener_win, 0));
|
||||
|
|
@ -75,16 +76,16 @@ static void compute_stats_win_opt_c(int wiener_win, const uint8_t *dgd,
|
|||
}
|
||||
}
|
||||
|
||||
const double avg_square_sum = avg * avg * pixel_count;
|
||||
const int64_t avg_square_sum = (int64_t)avg * (int64_t)avg * pixel_count;
|
||||
for (k = 0; k < wiener_win; k++) {
|
||||
for (l = 0; l < wiener_win; l++) {
|
||||
M[l * wiener_win + k] =
|
||||
M_int[l][k] + avg_square_sum - avg * (sumX + sumY[k][l]);
|
||||
M_int[l][k] + avg_square_sum - (int64_t)avg * (sumX + sumY[k][l]);
|
||||
for (m = 0; m < wiener_win; m++) {
|
||||
for (n = 0; n < wiener_win; n++) {
|
||||
H[(l * wiener_win + k) * wiener_win2 + m * wiener_win + n] =
|
||||
H_int[(l * wiener_win + k)][n * 8 + m] + avg_square_sum -
|
||||
avg * (sumY[k][l] + sumY[n][m]);
|
||||
(int64_t)avg * (sumY[k][l] + sumY[n][m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,7 +94,8 @@ static void compute_stats_win_opt_c(int wiener_win, const uint8_t *dgd,
|
|||
|
||||
void compute_stats_opt_c(int wiener_win, const uint8_t *dgd, const uint8_t *src,
|
||||
int h_start, int h_end, int v_start, int v_end,
|
||||
int dgd_stride, int src_stride, double *M, double *H) {
|
||||
int dgd_stride, int src_stride, int64_t *M,
|
||||
int64_t *H) {
|
||||
if (wiener_win == WIENER_WIN || wiener_win == WIENER_WIN_CHROMA) {
|
||||
compute_stats_win_opt_c(wiener_win, dgd, src, h_start, h_end, v_start,
|
||||
v_end, dgd_stride, src_stride, M, H);
|
||||
|
|
@ -104,13 +106,10 @@ void compute_stats_opt_c(int wiener_win, const uint8_t *dgd, const uint8_t *src,
|
|||
}
|
||||
|
||||
static const int kIterations = 100;
|
||||
static const double min_error = (double)(0.01);
|
||||
typedef void (*compute_stats_Func)(int wiener_win, const uint8_t *dgd,
|
||||
const uint8_t *src, int h_start, int h_end,
|
||||
int v_start, int v_end, int dgd_stride,
|
||||
int src_stride, double *M, double *H);
|
||||
|
||||
typedef libaom_test::FuncParam<compute_stats_Func> TestFuncs;
|
||||
int src_stride, int64_t *M, int64_t *H);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 8 bit
|
||||
|
|
@ -120,24 +119,34 @@ typedef ::testing::tuple<const compute_stats_Func> WienerTestParam;
|
|||
|
||||
class WienerTest : public ::testing::TestWithParam<WienerTestParam> {
|
||||
public:
|
||||
virtual void SetUp() { target_func_ = GET_PARAM(0); }
|
||||
void runWienerTest(const int32_t wiener_win, int32_t run_times);
|
||||
void runWienerTest_ExtremeValues(const int32_t wiener_win);
|
||||
virtual void SetUp() {
|
||||
src_buf = (uint8_t *)aom_memalign(
|
||||
32, MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*src_buf));
|
||||
dgd_buf = (uint8_t *)aom_memalign(
|
||||
32, MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*dgd_buf));
|
||||
target_func_ = GET_PARAM(0);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
aom_free(src_buf);
|
||||
aom_free(dgd_buf);
|
||||
}
|
||||
void RunWienerTest(const int32_t wiener_win, int32_t run_times);
|
||||
void RunWienerTest_ExtremeValues(const int32_t wiener_win);
|
||||
|
||||
private:
|
||||
compute_stats_Func target_func_;
|
||||
ACMRandom rng_;
|
||||
libaom_test::ACMRandom rng_;
|
||||
uint8_t *src_buf;
|
||||
uint8_t *dgd_buf;
|
||||
};
|
||||
|
||||
void WienerTest::runWienerTest(const int32_t wiener_win, int32_t run_times) {
|
||||
void WienerTest::RunWienerTest(const int32_t wiener_win, int32_t run_times) {
|
||||
const int32_t wiener_halfwin = wiener_win >> 1;
|
||||
const int32_t wiener_win2 = wiener_win * wiener_win;
|
||||
DECLARE_ALIGNED(32, uint8_t, dgd_buf[MAX_DATA_BLOCK * MAX_DATA_BLOCK]);
|
||||
DECLARE_ALIGNED(32, uint8_t, src_buf[MAX_DATA_BLOCK * MAX_DATA_BLOCK]);
|
||||
DECLARE_ALIGNED(32, double, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
const int h_start = ((rng_.Rand16() % (MAX_WIENER_BLOCK / 2)) & (~7));
|
||||
int h_end =
|
||||
run_times != 1 ? 256 : ((rng_.Rand16() % MAX_WIENER_BLOCK) & (~7)) + 8;
|
||||
|
|
@ -177,19 +186,18 @@ void WienerTest::runWienerTest(const int32_t wiener_win, int32_t run_times) {
|
|||
}
|
||||
int failed = 0;
|
||||
for (int i = 0; i < wiener_win2; ++i) {
|
||||
if (fabs(M_ref[i] - M_test[i]) > min_error) {
|
||||
if (M_ref[i] != M_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d M iter %d [%4d] ref %6.0f test %6.0f \n", wiener_win,
|
||||
iter, i, M_ref[i], M_test[i]);
|
||||
printf("win %d M iter %d [%4d] ref %6" PRId64 " test %6" PRId64 " \n",
|
||||
wiener_win, iter, i, M_ref[i], M_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ASSERT_EQ(failed, 0);
|
||||
for (int i = 0; i < wiener_win2 * wiener_win2; ++i) {
|
||||
if (fabs(H_ref[i] - H_test[i]) > min_error) {
|
||||
if (H_ref[i] != H_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d H iter %d [%4d] ref %6.0f test %6.0f \n", wiener_win,
|
||||
iter, i, H_ref[i], H_test[i]);
|
||||
printf("win %d H iter %d [%4d] ref %6" PRId64 " test %6" PRId64 " \n",
|
||||
wiener_win, iter, i, H_ref[i], H_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -197,15 +205,13 @@ void WienerTest::runWienerTest(const int32_t wiener_win, int32_t run_times) {
|
|||
}
|
||||
}
|
||||
|
||||
void WienerTest::runWienerTest_ExtremeValues(const int32_t wiener_win) {
|
||||
void WienerTest::RunWienerTest_ExtremeValues(const int32_t wiener_win) {
|
||||
const int32_t wiener_halfwin = wiener_win >> 1;
|
||||
const int32_t wiener_win2 = wiener_win * wiener_win;
|
||||
DECLARE_ALIGNED(32, uint8_t, dgd_buf[MAX_DATA_BLOCK * MAX_DATA_BLOCK]);
|
||||
DECLARE_ALIGNED(32, uint8_t, src_buf[MAX_DATA_BLOCK * MAX_DATA_BLOCK]);
|
||||
DECLARE_ALIGNED(32, double, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, double, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
const int h_start = 16;
|
||||
const int h_end = MAX_WIENER_BLOCK;
|
||||
const int v_start = 16;
|
||||
|
|
@ -229,19 +235,18 @@ void WienerTest::runWienerTest_ExtremeValues(const int32_t wiener_win) {
|
|||
|
||||
int failed = 0;
|
||||
for (int i = 0; i < wiener_win2; ++i) {
|
||||
if (fabs(M_ref[i] - M_test[i]) > min_error) {
|
||||
if (M_ref[i] != M_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d M iter %d [%4d] ref %6.0f test %6.0f \n", wiener_win,
|
||||
iter, i, M_ref[i], M_test[i]);
|
||||
printf("win %d M iter %d [%4d] ref %6" PRId64 " test %6" PRId64 " \n",
|
||||
wiener_win, iter, i, M_ref[i], M_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ASSERT_EQ(failed, 0);
|
||||
for (int i = 0; i < wiener_win2 * wiener_win2; ++i) {
|
||||
if (fabs(H_ref[i] - H_test[i]) > min_error) {
|
||||
if (H_ref[i] != H_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d H iter %d [%4d] ref %6.0f test %6.0f \n", wiener_win,
|
||||
iter, i, H_ref[i], H_test[i]);
|
||||
printf("win %d H iter %d [%4d] ref %6" PRId64 " test %6" PRId64 " \n",
|
||||
wiener_win, iter, i, H_ref[i], H_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -250,18 +255,18 @@ void WienerTest::runWienerTest_ExtremeValues(const int32_t wiener_win) {
|
|||
}
|
||||
|
||||
TEST_P(WienerTest, RandomValues) {
|
||||
runWienerTest(WIENER_WIN, 1);
|
||||
runWienerTest(WIENER_WIN_CHROMA, 1);
|
||||
RunWienerTest(WIENER_WIN, 1);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 1);
|
||||
}
|
||||
|
||||
TEST_P(WienerTest, ExtremeValues) {
|
||||
runWienerTest_ExtremeValues(WIENER_WIN);
|
||||
runWienerTest_ExtremeValues(WIENER_WIN_CHROMA);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN_CHROMA);
|
||||
}
|
||||
|
||||
TEST_P(WienerTest, DISABLED_Speed) {
|
||||
runWienerTest(WIENER_WIN, 200);
|
||||
runWienerTest(WIENER_WIN_CHROMA, 200);
|
||||
RunWienerTest(WIENER_WIN, 200);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 200);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, WienerTest, ::testing::Values(compute_stats_opt_c));
|
||||
|
|
@ -277,4 +282,303 @@ INSTANTIATE_TEST_CASE_P(AVX2, WienerTest,
|
|||
::testing::Values(av1_compute_stats_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace
|
||||
} // namespace wiener_lowbd
|
||||
|
||||
// High bit-depth tests:
|
||||
namespace wiener_highbd {
|
||||
|
||||
static void compute_stats_highbd_win_opt_c(int wiener_win, const uint8_t *dgd8,
|
||||
const uint8_t *src8, int h_start,
|
||||
int h_end, int v_start, int v_end,
|
||||
int dgd_stride, int src_stride,
|
||||
int64_t *M, int64_t *H,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
ASSERT_TRUE(wiener_win == WIENER_WIN || wiener_win == WIENER_WIN_CHROMA);
|
||||
int i, j, k, l, m, n;
|
||||
const int pixel_count = (h_end - h_start) * (v_end - v_start);
|
||||
const int wiener_win2 = wiener_win * wiener_win;
|
||||
const int wiener_halfwin = (wiener_win >> 1);
|
||||
const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
const uint16_t *dgd = CONVERT_TO_SHORTPTR(dgd8);
|
||||
const uint16_t avg =
|
||||
find_average_highbd(dgd, h_start, h_end, v_start, v_end, dgd_stride);
|
||||
|
||||
std::vector<std::vector<int64_t> > M_int(wiener_win,
|
||||
std::vector<int64_t>(wiener_win, 0));
|
||||
std::vector<std::vector<int64_t> > H_int(
|
||||
wiener_win * wiener_win, std::vector<int64_t>(wiener_win * 8, 0));
|
||||
std::vector<std::vector<int32_t> > sumY(wiener_win,
|
||||
std::vector<int32_t>(wiener_win, 0));
|
||||
|
||||
memset(M, 0, sizeof(*M) * wiener_win2);
|
||||
memset(H, 0, sizeof(*H) * wiener_win2 * wiener_win2);
|
||||
|
||||
int64_t sumX = 0;
|
||||
const uint16_t *dgd_win = dgd - wiener_halfwin * dgd_stride - wiener_halfwin;
|
||||
|
||||
for (i = v_start; i < v_end; i++) {
|
||||
for (j = h_start; j < h_end; j += 2) {
|
||||
const uint16_t X1 = src[i * src_stride + j];
|
||||
const uint16_t X2 = src[i * src_stride + j + 1];
|
||||
sumX += X1 + X2;
|
||||
|
||||
const uint16_t *dgd_ij = dgd_win + i * dgd_stride + j;
|
||||
for (k = 0; k < wiener_win; k++) {
|
||||
for (l = 0; l < wiener_win; l++) {
|
||||
const uint16_t *dgd_ijkl = dgd_ij + k * dgd_stride + l;
|
||||
int64_t *H_int_temp = &H_int[(l * wiener_win + k)][0];
|
||||
const uint16_t D1 = dgd_ijkl[0];
|
||||
const uint16_t D2 = dgd_ijkl[1];
|
||||
sumY[k][l] += D1 + D2;
|
||||
M_int[l][k] += D1 * X1 + D2 * X2;
|
||||
for (m = 0; m < wiener_win; m++) {
|
||||
for (n = 0; n < wiener_win; n++) {
|
||||
H_int_temp[m * 8 + n] += D1 * dgd_ij[n + dgd_stride * m] +
|
||||
D2 * dgd_ij[n + dgd_stride * m + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t bit_depth_divider = 1;
|
||||
if (bit_depth == AOM_BITS_12)
|
||||
bit_depth_divider = 16;
|
||||
else if (bit_depth == AOM_BITS_10)
|
||||
bit_depth_divider = 4;
|
||||
|
||||
const int64_t avg_square_sum = (int64_t)avg * (int64_t)avg * pixel_count;
|
||||
for (k = 0; k < wiener_win; k++) {
|
||||
for (l = 0; l < wiener_win; l++) {
|
||||
M[l * wiener_win + k] =
|
||||
(M_int[l][k] +
|
||||
(avg_square_sum - (int64_t)avg * (sumX + sumY[k][l]))) /
|
||||
bit_depth_divider;
|
||||
for (m = 0; m < wiener_win; m++) {
|
||||
for (n = 0; n < wiener_win; n++) {
|
||||
H[(l * wiener_win + k) * wiener_win2 + m * wiener_win + n] =
|
||||
(H_int[(l * wiener_win + k)][n * 8 + m] +
|
||||
(avg_square_sum - (int64_t)avg * (sumY[k][l] + sumY[n][m]))) /
|
||||
bit_depth_divider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void compute_stats_highbd_opt_c(int wiener_win, const uint8_t *dgd,
|
||||
const uint8_t *src, int h_start, int h_end,
|
||||
int v_start, int v_end, int dgd_stride,
|
||||
int src_stride, int64_t *M, int64_t *H,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
if (wiener_win == WIENER_WIN || wiener_win == WIENER_WIN_CHROMA) {
|
||||
compute_stats_highbd_win_opt_c(wiener_win, dgd, src, h_start, h_end,
|
||||
v_start, v_end, dgd_stride, src_stride, M, H,
|
||||
bit_depth);
|
||||
} else {
|
||||
av1_compute_stats_highbd_c(wiener_win, dgd, src, h_start, h_end, v_start,
|
||||
v_end, dgd_stride, src_stride, M, H, bit_depth);
|
||||
}
|
||||
}
|
||||
|
||||
static const int kIterations = 100;
|
||||
typedef void (*compute_stats_Func)(int wiener_win, const uint8_t *dgd,
|
||||
const uint8_t *src, int h_start, int h_end,
|
||||
int v_start, int v_end, int dgd_stride,
|
||||
int src_stride, int64_t *M, int64_t *H,
|
||||
aom_bit_depth_t bit_depth);
|
||||
|
||||
typedef ::testing::tuple<const compute_stats_Func> WienerTestParam;
|
||||
|
||||
class WienerTestHighbd : public ::testing::TestWithParam<WienerTestParam> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
src_buf = (uint16_t *)aom_memalign(
|
||||
32, MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*src_buf));
|
||||
dgd_buf = (uint16_t *)aom_memalign(
|
||||
32, MAX_DATA_BLOCK * MAX_DATA_BLOCK * sizeof(*dgd_buf));
|
||||
target_func_ = GET_PARAM(0);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
aom_free(src_buf);
|
||||
aom_free(dgd_buf);
|
||||
}
|
||||
void RunWienerTest(const int32_t wiener_win, int32_t run_times,
|
||||
aom_bit_depth_t bit_depth);
|
||||
void RunWienerTest_ExtremeValues(const int32_t wiener_win,
|
||||
aom_bit_depth_t bit_depth);
|
||||
|
||||
private:
|
||||
compute_stats_Func target_func_;
|
||||
libaom_test::ACMRandom rng_;
|
||||
uint16_t *src_buf;
|
||||
uint16_t *dgd_buf;
|
||||
};
|
||||
|
||||
void WienerTestHighbd::RunWienerTest(const int32_t wiener_win,
|
||||
int32_t run_times,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
const int32_t wiener_halfwin = wiener_win >> 1;
|
||||
const int32_t wiener_win2 = wiener_win * wiener_win;
|
||||
DECLARE_ALIGNED(32, int64_t, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
const int h_start = ((rng_.Rand16() % (MAX_WIENER_BLOCK / 2)) & (~7));
|
||||
const int h_end =
|
||||
run_times != 1 ? 256 : ((rng_.Rand16() % MAX_WIENER_BLOCK) & (~7)) + 8;
|
||||
const int v_start = ((rng_.Rand16() % (MAX_WIENER_BLOCK / 2)) & (~7));
|
||||
const int v_end =
|
||||
run_times != 1 ? 256 : ((rng_.Rand16() % MAX_WIENER_BLOCK) & (~7)) + 8;
|
||||
const int dgd_stride = h_end;
|
||||
const int src_stride = MAX_DATA_BLOCK;
|
||||
const int iters = run_times == 1 ? kIterations : 2;
|
||||
for (int iter = 0; iter < iters && !HasFatalFailure(); ++iter) {
|
||||
for (int i = 0; i < MAX_DATA_BLOCK * MAX_DATA_BLOCK; ++i) {
|
||||
dgd_buf[i] = rng_.Rand16() % (1 << bit_depth);
|
||||
src_buf[i] = rng_.Rand16() % (1 << bit_depth);
|
||||
}
|
||||
const uint8_t *dgd8 = CONVERT_TO_BYTEPTR(
|
||||
dgd_buf + wiener_halfwin * MAX_DATA_BLOCK + wiener_halfwin);
|
||||
const uint8_t *src8 = CONVERT_TO_BYTEPTR(src_buf);
|
||||
|
||||
aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
av1_compute_stats_highbd_c(wiener_win, dgd8, src8, h_start, h_end,
|
||||
v_start, v_end, dgd_stride, src_stride, M_ref,
|
||||
H_ref, bit_depth);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
aom_usec_timer_start(&timer);
|
||||
for (int i = 0; i < run_times; ++i) {
|
||||
target_func_(wiener_win, dgd8, src8, h_start, h_end, v_start, v_end,
|
||||
dgd_stride, src_stride, M_test, H_test, bit_depth);
|
||||
}
|
||||
aom_usec_timer_mark(&timer);
|
||||
const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
|
||||
if (run_times > 10) {
|
||||
printf("win %d bd %d %3dx%-3d:%7.2f/%7.2fns", wiener_win, bit_depth,
|
||||
h_end, v_end, time1, time2);
|
||||
printf("(%3.2f)\n", time1 / time2);
|
||||
}
|
||||
int failed = 0;
|
||||
for (int i = 0; i < wiener_win2; ++i) {
|
||||
if (M_ref[i] != M_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d bd %d M iter %d [%4d] ref %6" PRId64 " test %6" PRId64
|
||||
" \n",
|
||||
wiener_win, bit_depth, iter, i, M_ref[i], M_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < wiener_win2 * wiener_win2; ++i) {
|
||||
if (H_ref[i] != H_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d bd %d H iter %d [%4d] ref %6" PRId64 " test %6" PRId64
|
||||
" \n",
|
||||
wiener_win, bit_depth, iter, i, H_ref[i], H_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(failed, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void WienerTestHighbd::RunWienerTest_ExtremeValues(const int32_t wiener_win,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
const int32_t wiener_halfwin = wiener_win >> 1;
|
||||
const int32_t wiener_win2 = wiener_win * wiener_win;
|
||||
DECLARE_ALIGNED(32, int64_t, M_ref[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_ref[WIENER_WIN2 * WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, M_test[WIENER_WIN2]);
|
||||
DECLARE_ALIGNED(32, int64_t, H_test[WIENER_WIN2 * WIENER_WIN2]);
|
||||
const int h_start = 16;
|
||||
const int h_end = MAX_WIENER_BLOCK;
|
||||
const int v_start = 16;
|
||||
const int v_end = MAX_WIENER_BLOCK;
|
||||
const int dgd_stride = h_end;
|
||||
const int src_stride = MAX_DATA_BLOCK;
|
||||
const int iters = 1;
|
||||
for (int iter = 0; iter < iters && !HasFatalFailure(); ++iter) {
|
||||
for (int i = 0; i < MAX_DATA_BLOCK * MAX_DATA_BLOCK; ++i) {
|
||||
dgd_buf[i] = ((uint16_t)1 << bit_depth) - 1;
|
||||
src_buf[i] = ((uint16_t)1 << bit_depth) - 1;
|
||||
}
|
||||
const uint8_t *dgd8 = CONVERT_TO_BYTEPTR(
|
||||
dgd_buf + wiener_halfwin * MAX_DATA_BLOCK + wiener_halfwin);
|
||||
const uint8_t *src8 = CONVERT_TO_BYTEPTR(src_buf);
|
||||
|
||||
av1_compute_stats_highbd_c(wiener_win, dgd8, src8, h_start, h_end, v_start,
|
||||
v_end, dgd_stride, src_stride, M_ref, H_ref,
|
||||
bit_depth);
|
||||
|
||||
target_func_(wiener_win, dgd8, src8, h_start, h_end, v_start, v_end,
|
||||
dgd_stride, src_stride, M_test, H_test, bit_depth);
|
||||
|
||||
int failed = 0;
|
||||
for (int i = 0; i < wiener_win2; ++i) {
|
||||
if (M_ref[i] != M_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d bd %d M iter %d [%4d] ref %6" PRId64 " test %6" PRId64
|
||||
" \n",
|
||||
wiener_win, bit_depth, iter, i, M_ref[i], M_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < wiener_win2 * wiener_win2; ++i) {
|
||||
if (H_ref[i] != H_test[i]) {
|
||||
failed = 1;
|
||||
printf("win %d bd %d H iter %d [%4d] ref %6" PRId64 " test %6" PRId64
|
||||
" \n",
|
||||
wiener_win, bit_depth, iter, i, H_ref[i], H_test[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(failed, 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(WienerTestHighbd, RandomValues) {
|
||||
RunWienerTest(WIENER_WIN, 1, AOM_BITS_8);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 1, AOM_BITS_8);
|
||||
RunWienerTest(WIENER_WIN, 1, AOM_BITS_10);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 1, AOM_BITS_10);
|
||||
RunWienerTest(WIENER_WIN, 1, AOM_BITS_12);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 1, AOM_BITS_12);
|
||||
}
|
||||
|
||||
TEST_P(WienerTestHighbd, ExtremeValues) {
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN, AOM_BITS_8);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN_CHROMA, AOM_BITS_8);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN, AOM_BITS_10);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN_CHROMA, AOM_BITS_10);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN, AOM_BITS_12);
|
||||
RunWienerTest_ExtremeValues(WIENER_WIN_CHROMA, AOM_BITS_12);
|
||||
}
|
||||
|
||||
TEST_P(WienerTestHighbd, DISABLED_Speed) {
|
||||
RunWienerTest(WIENER_WIN, 200, AOM_BITS_8);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 200, AOM_BITS_8);
|
||||
RunWienerTest(WIENER_WIN, 200, AOM_BITS_10);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 200, AOM_BITS_10);
|
||||
RunWienerTest(WIENER_WIN, 200, AOM_BITS_12);
|
||||
RunWienerTest(WIENER_WIN_CHROMA, 200, AOM_BITS_12);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, WienerTestHighbd,
|
||||
::testing::Values(compute_stats_highbd_opt_c));
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, WienerTestHighbd,
|
||||
::testing::Values(av1_compute_stats_highbd_sse4_1));
|
||||
#endif // HAVE_SSE4_1
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, WienerTestHighbd,
|
||||
::testing::Values(av1_compute_stats_highbd_avx2));
|
||||
#endif // HAVE_AVX2
|
||||
|
||||
} // namespace wiener_highbd
|
||||
|
|
|
|||
6
third_party/aom/test/y4m_video_source.h
vendored
6
third_party/aom/test/y4m_video_source.h
vendored
|
|
@ -11,6 +11,7 @@
|
|||
#ifndef AOM_TEST_Y4M_VIDEO_SOURCE_H_
|
||||
#define AOM_TEST_Y4M_VIDEO_SOURCE_H_
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "common/y4minput.h"
|
||||
|
|
@ -41,7 +42,8 @@ class Y4mVideoSource : public VideoSource {
|
|||
|
||||
virtual void ReadSourceToStart() {
|
||||
ASSERT_TRUE(input_file_ != NULL);
|
||||
ASSERT_FALSE(y4m_input_open(&y4m_, input_file_, NULL, 0, 0));
|
||||
ASSERT_FALSE(
|
||||
y4m_input_open(&y4m_, input_file_, NULL, 0, AOM_CSP_UNKNOWN, 0));
|
||||
framerate_numerator_ = y4m_.fps_n;
|
||||
framerate_denominator_ = y4m_.fps_d;
|
||||
frame_ = 0;
|
||||
|
|
@ -109,7 +111,7 @@ class Y4mVideoSource : public VideoSource {
|
|||
|
||||
std::string file_name_;
|
||||
FILE *input_file_;
|
||||
testing::internal::scoped_ptr<aom_image_t> img_;
|
||||
std::unique_ptr<aom_image_t> img_;
|
||||
unsigned int start_;
|
||||
unsigned int limit_;
|
||||
unsigned int frame_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue