summaryrefslogtreecommitdiffstats
path: root/third_party/aom/test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/test')
-rwxr-xr-xthird_party/aom/test/av1_c_vs_simd_encode.sh38
-rw-r--r--third_party/aom/test/dr_prediction_test.cc68
-rw-r--r--third_party/aom/test/encode_api_test.cc48
-rw-r--r--third_party/aom/test/resize_test.cc69
-rw-r--r--third_party/aom/test/variance_test.cc6
-rw-r--r--third_party/aom/test/warp_filter_test.cc6
6 files changed, 171 insertions, 64 deletions
diff --git a/third_party/aom/test/av1_c_vs_simd_encode.sh b/third_party/aom/test/av1_c_vs_simd_encode.sh
index 296204d118..897ac081c1 100755
--- a/third_party/aom/test/av1_c_vs_simd_encode.sh
+++ b/third_party/aom/test/av1_c_vs_simd_encode.sh
@@ -104,16 +104,16 @@ av1_c_vs_simd_enc_verify_environment () {
# }
# Echo AOM_SIMD_CAPS_MASK for different instruction set architecture.
-avx512f() {
+avx2() {
echo "0x1FF"
}
-avx2() {
- echo "0x0FF"
+avx() {
+ echo "0x17F"
}
-avx() {
- echo "0x07F"
+sse4_2() {
+ echo "0x13F"
}
sse4_1() {
@@ -443,21 +443,21 @@ av1_test_generic() {
done
}
-# This function encodes AV1 bitstream by enabling SSE2, SSE3, SSSE3, SSE4_1, AVX, AVX2 as there are
-# no functions with MMX, SSE and AVX512 specialization.
+# This function encodes AV1 bitstream by enabling SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2 as
+# there are no functions with MMX, SSE and AVX512 specialization.
# The value of environment variable 'AOM_SIMD_CAPS_MASK' controls enabling of different instruction
# set extension optimizations. The value of the flag 'AOM_SIMD_CAPS_MASK' and the corresponding
# instruction set extension optimization enabled are as follows:
-# AVX512 AVX2 AVX SSE4_1 SSSE3 SSE3 SSE2 SSE MMX
-# 1 1 1 1 1 1 1 1 1 -> 0x1FF -> Enable AVX512 and lower variants
-# 0 1 1 1 1 1 1 1 1 -> 0x0FF -> Enable AVX2 and lower variants
-# 0 0 1 1 1 1 1 1 1 -> 0x07F -> Enable AVX and lower variants
-# 0 0 0 1 1 1 1 1 1 -> 0x03F -> Enable SSE4_1 and lower variants
-# 0 0 0 0 1 1 1 1 1 -> 0x01F -> Enable SSSE3 and lower variants
-# 0 0 0 0 0 1 1 1 1 -> 0x00F -> Enable SSE3 and lower variants
-# 0 0 0 0 0 0 1 1 1 -> 0x007 -> Enable SSE2 and lower variants
-# 0 0 0 0 0 0 0 1 1 -> 0x003 -> Enable SSE and lower variants
-# 0 0 0 0 0 0 0 0 1 -> 0x001 -> Enable MMX
+# SSE4_2 AVX2 AVX SSE4_1 SSSE3 SSE3 SSE2 SSE MMX
+# 1 1 1 1 1 1 1 1 1 -> 0x1FF -> Enable AVX2 and lower variants
+# 1 0 1 1 1 1 1 1 1 -> 0x17F -> Enable AVX and lower variants
+# 1 0 0 1 1 1 1 1 1 -> 0x13F -> Enable SSE4_2 and lower variants
+# 0 0 0 1 1 1 1 1 1 -> 0x03F -> Enable SSE4_1 and lower variants
+# 0 0 0 0 1 1 1 1 1 -> 0x01F -> Enable SSSE3 and lower variants
+# 0 0 0 0 0 1 1 1 1 -> 0x00F -> Enable SSE3 and lower variants
+# 0 0 0 0 0 0 1 1 1 -> 0x007 -> Enable SSE2 and lower variants
+# 0 0 0 0 0 0 0 1 1 -> 0x003 -> Enable SSE and lower variants
+# 0 0 0 0 0 0 0 0 1 -> 0x001 -> Enable MMX
## NOTE: In x86_64 platform, it is not possible to enable sse/mmx/c using "AOM_SIMD_CAPS_MASK" as
# all x86_64 platforms implement sse2.
av1_test_x86() {
@@ -478,8 +478,8 @@ av1_test_x86() {
local cmake_command="cmake $LIBAOM_SOURCE_DIR"
fi
- # Available x86 isa variants: "avx2 avx sse4_1 ssse3 sse3 sse2"
- local x86_isa_variants="avx2 sse4_1 sse2"
+ # Available x86 isa variants: "avx2 avx sse4_2 sse4_1 ssse3 sse3 sse2"
+ local x86_isa_variants="avx2 sse4_2 sse2"
echo "Build for x86: ${target}"
if ! av1_enc_build "${target}" "${cmake_command}"; then
diff --git a/third_party/aom/test/dr_prediction_test.cc b/third_party/aom/test/dr_prediction_test.cc
index 3865810e9b..c23b08e481 100644
--- a/third_party/aom/test/dr_prediction_test.cc
+++ b/third_party/aom/test/dr_prediction_test.cc
@@ -10,6 +10,7 @@
*/
#include <tuple>
+#include <vector>
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
@@ -18,6 +19,7 @@
#include "aom_mem/aom_mem.h"
#include "aom_ports/aom_timer.h"
+#include "aom_ports/sanitizer.h"
#include "av1/common/blockd.h"
#include "av1/common/pred_common.h"
#include "av1/common/reconintra.h"
@@ -149,8 +151,6 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
protected:
static const int kMaxNumTests = 10000;
static const int kIterations = 10;
- static const int kDstStride = 64;
- static const int kDstSize = kDstStride * kDstStride;
static const int kOffset = 16;
static const int kBufSize = ((2 * MAX_TX_SIZE) << 1) + 16;
@@ -161,9 +161,6 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
start_angle_ = params_.start_angle;
stop_angle_ = start_angle_ + 90;
- dst_ref_ = &dst_ref_data_[0];
- dst_tst_ = &dst_tst_data_[0];
- dst_stride_ = kDstStride;
above_ = &above_data_[kOffset];
left_ = &left_data_[kOffset];
@@ -171,16 +168,12 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
above_data_[i] = rng_.Rand8();
left_data_[i] = rng_.Rand8();
}
-
- for (int i = 0; i < kDstSize; ++i) {
- dst_ref_[i] = 0;
- dst_tst_[i] = 0;
- }
}
~DrPredTest() override = default;
- void Predict(bool speedtest, int tx) {
+ void Predict(bool speedtest, int tx, Pixel *dst_ref, Pixel *dst_tst,
+ int dst_stride) {
const int kNumTests = speedtest ? kMaxNumTests : 1;
aom_usec_timer timer;
int tst_time = 0;
@@ -189,7 +182,7 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
aom_usec_timer_start(&timer);
for (int k = 0; k < kNumTests; ++k) {
- params_.ref_fn(dst_ref_, dst_stride_, bw_, bh_, above_, left_,
+ params_.ref_fn(dst_ref, dst_stride, bw_, bh_, above_, left_,
upsample_above_, upsample_left_, dx_, dy_, bd_);
}
aom_usec_timer_mark(&timer);
@@ -198,15 +191,17 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
if (params_.tst_fn) {
aom_usec_timer_start(&timer);
for (int k = 0; k < kNumTests; ++k) {
- API_REGISTER_STATE_CHECK(params_.tst_fn(dst_tst_, dst_stride_, bw_, bh_,
+ API_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];
+ for (int r = 0; r < bh_; ++r) {
+ for (int c = 0; c < bw_; ++c) {
+ dst_tst[r * dst_stride + c] = dst_ref[r * dst_stride + c];
+ }
}
}
@@ -222,18 +217,6 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
}
}
for (int tx = 0; tx < TX_SIZES_ALL; ++tx) {
- if (params_.tst_fn == nullptr) {
- 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;
- }
- }
-
bw_ = tx_size_wide[kTxSize[tx]];
bh_ = tx_size_high[kTxSize[tx]];
@@ -246,12 +229,31 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
upsample_above_ = upsample_left_ = 0;
}
- Predict(speedtest, tx);
+ // Add additional padding to allow detection of over reads/writes when
+ // the transform width is equal to MAX_TX_SIZE.
+ const int dst_stride = MAX_TX_SIZE + 16;
+ std::vector<Pixel> dst_ref(dst_stride * bh_);
+ std::vector<Pixel> dst_tst(dst_stride * bh_);
+
+ for (int r = 0; r < bh_; ++r) {
+ ASAN_POISON_MEMORY_REGION(&dst_ref[r * dst_stride + bw_],
+ (dst_stride - bw_) * sizeof(Pixel));
+ ASAN_POISON_MEMORY_REGION(&dst_tst[r * dst_stride + bw_],
+ (dst_stride - bw_) * sizeof(Pixel));
+ }
+
+ Predict(speedtest, tx, dst_ref.data(), dst_tst.data(), dst_stride);
+
+ for (int r = 0; r < bh_; ++r) {
+ ASAN_UNPOISON_MEMORY_REGION(&dst_ref[r * dst_stride + bw_],
+ (dst_stride - bw_) * sizeof(Pixel));
+ ASAN_UNPOISON_MEMORY_REGION(&dst_tst[r * dst_stride + bw_],
+ (dst_stride - bw_) * sizeof(Pixel));
+ }
for (int r = 0; r < bh_; ++r) {
for (int c = 0; c < bw_; ++c) {
- ASSERT_EQ(dst_ref_[r * dst_stride_ + c],
- dst_tst_[r * dst_stride_ + c])
+ ASSERT_EQ(dst_ref[r * dst_stride + c], dst_tst[r * dst_stride + c])
<< bw_ << "x" << bh_ << " r: " << r << " c: " << c
<< " dx: " << dx_ << " dy: " << dy_
<< " upsample_above: " << upsample_above_
@@ -292,18 +294,12 @@ class DrPredTest : public ::testing::TestWithParam<DrPredFunc<FuncType> > {
}
}
- Pixel dst_ref_data_[kDstSize];
- Pixel dst_tst_data_[kDstSize];
-
Pixel left_data_[kBufSize];
Pixel dummy_data_[kBufSize];
Pixel above_data_[kBufSize];
- Pixel *dst_ref_;
- Pixel *dst_tst_;
Pixel *above_;
Pixel *left_;
- int dst_stride_;
int enable_upsample_;
int upsample_above_;
diff --git a/third_party/aom/test/encode_api_test.cc b/third_party/aom/test/encode_api_test.cc
index aa4084f9e4..605743f9be 100644
--- a/third_party/aom/test/encode_api_test.cc
+++ b/third_party/aom/test/encode_api_test.cc
@@ -654,6 +654,52 @@ TEST(EncodeAPI, AllIntraMode) {
cfg.kf_max_dist = 1;
EXPECT_EQ(AOM_CODEC_INVALID_PARAM, aom_codec_enc_init(&enc, iface, &cfg, 0));
}
-#endif
+
+TEST(EncodeAPI, AllIntraAndUsePsnr) {
+ aom_codec_iface_t *iface = aom_codec_av1_cx();
+ aom_codec_enc_cfg_t cfg;
+ ASSERT_EQ(aom_codec_enc_config_default(iface, &cfg, AOM_USAGE_ALL_INTRA),
+ AOM_CODEC_OK);
+
+ aom_codec_ctx_t enc;
+ ASSERT_EQ(aom_codec_enc_init(&enc, iface, &cfg, AOM_CODEC_USE_PSNR),
+ AOM_CODEC_OK);
+
+ aom_image_t *image = CreateGrayImage(AOM_IMG_FMT_I420, cfg.g_w, cfg.g_h);
+ ASSERT_NE(image, nullptr);
+
+ ASSERT_EQ(aom_codec_encode(&enc, image, 0, 1, 0), AOM_CODEC_OK);
+ const aom_codec_cx_pkt_t *pkt;
+ aom_codec_iter_t iter = nullptr;
+ while ((pkt = aom_codec_get_cx_data(&enc, &iter)) != nullptr) {
+ if (pkt->kind != AOM_CODEC_CX_FRAME_PKT) {
+ ASSERT_EQ(pkt->kind, AOM_CODEC_PSNR_PKT);
+ }
+ }
+
+ aom_img_free(image);
+ ASSERT_EQ(aom_codec_destroy(&enc), AOM_CODEC_OK);
+}
+
+// A test that reproduces bug aomedia:3534.
+TEST(EncodeAPI, AllIntraAndNoRefLast) {
+ aom_codec_iface_t *iface = aom_codec_av1_cx();
+ aom_codec_enc_cfg_t cfg;
+ ASSERT_EQ(aom_codec_enc_config_default(iface, &cfg, AOM_USAGE_ALL_INTRA),
+ AOM_CODEC_OK);
+
+ aom_codec_ctx_t enc;
+ ASSERT_EQ(aom_codec_enc_init(&enc, iface, &cfg, 0), AOM_CODEC_OK);
+
+ aom_image_t *image = CreateGrayImage(AOM_IMG_FMT_I420, cfg.g_w, cfg.g_h);
+ ASSERT_NE(image, nullptr);
+
+ ASSERT_EQ(aom_codec_encode(&enc, image, 0, 1, AOM_EFLAG_NO_REF_LAST),
+ AOM_CODEC_OK);
+
+ aom_img_free(image);
+ ASSERT_EQ(aom_codec_destroy(&enc), AOM_CODEC_OK);
+}
+#endif // !CONFIG_REALTIME_ONLY
} // namespace
diff --git a/third_party/aom/test/resize_test.cc b/third_party/aom/test/resize_test.cc
index 7bad45300a..755d4e3d02 100644
--- a/third_party/aom/test/resize_test.cc
+++ b/third_party/aom/test/resize_test.cc
@@ -11,15 +11,17 @@
#include <climits>
#include <vector>
+
+#include "aom/aomcx.h"
#include "aom_dsp/aom_dsp_common.h"
-#include "common/tools_common.h"
#include "av1/encoder/encoder.h"
+#include "common/tools_common.h"
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/i420_video_source.h"
-#include "test/video_source.h"
#include "test/util.h"
+#include "test/video_source.h"
#include "test/y4m_video_source.h"
// Enable(1) or Disable(0) writing of the compressed bitstream.
@@ -403,7 +405,7 @@ class ResizeRealtimeTest
ResizeRealtimeTest()
: EncoderTest(GET_PARAM(0)), num_threads_(GET_PARAM(3)),
set_scale_mode_(false), set_scale_mode2_(false),
- set_scale_mode3_(false) {}
+ set_scale_mode3_(false), is_screen_(false) {}
~ResizeRealtimeTest() override = default;
void PreEncodeFrameHook(libaom_test::VideoSource *video,
@@ -415,6 +417,8 @@ class ResizeRealtimeTest
encoder->Control(AV1E_SET_ENABLE_OBMC, 0);
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 1);
+ if (is_screen_)
+ encoder->Control(AV1E_SET_TUNE_CONTENT, AOM_CONTENT_SCREEN);
}
if (set_scale_mode_) {
struct aom_scaling_mode mode;
@@ -508,6 +512,7 @@ class ResizeRealtimeTest
bool set_scale_mode_;
bool set_scale_mode2_;
bool set_scale_mode3_;
+ bool is_screen_;
};
// Check the AOME_SET_SCALEMODE control by downsizing to
@@ -740,6 +745,7 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30, 1,
0, 400);
+ init_flags_ = AOM_CODEC_USE_PSNR;
cfg_.g_w = 640;
cfg_.g_h = 480;
change_bitrate_ = true;
@@ -795,6 +801,63 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
#endif
}
+// Verify the dynamic resizer behavior for real time, 1 pass CBR mode for
+// screen content mode. Start at low target bitrate, raise the bitrate in the
+// middle of the clip (at frame# = frame_change_bitrate_), scaling-up should
+// occur after bitrate is increased.
+TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRateScreen) {
+ ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
+ 30, 1, 0, 300);
+ init_flags_ = AOM_CODEC_USE_PSNR;
+ cfg_.g_w = 352;
+ cfg_.g_h = 288;
+ change_bitrate_ = true;
+ frame_change_bitrate_ = 120;
+ set_scale_mode_ = false;
+ set_scale_mode2_ = false;
+ set_scale_mode3_ = false;
+ mismatch_psnr_ = 0.0;
+ mismatch_nframes_ = 0;
+ is_screen_ = true;
+ DefaultConfig();
+ // Disable dropped frames.
+ cfg_.rc_dropframe_thresh = 0;
+ // Starting bitrate low.
+ cfg_.rc_target_bitrate = 100;
+ cfg_.rc_resize_mode = RESIZE_DYNAMIC;
+ cfg_.g_forced_max_frame_width = 1280;
+ cfg_.g_forced_max_frame_height = 1280;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+
+ unsigned int last_w = cfg_.g_w;
+ unsigned int last_h = cfg_.g_h;
+ unsigned int frame_number = 0;
+ int resize_down_count = 0;
+ for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
+ info != frame_info_list_.end(); ++info) {
+ if (info->w != last_w || info->h != last_h) {
+ if (frame_number < frame_change_bitrate_) {
+ // Verify that resize down occurs, before bitrate is increased.
+ ASSERT_LT(info->w, last_w);
+ ASSERT_LT(info->h, last_h);
+ resize_down_count++;
+ }
+ last_w = info->w;
+ last_h = info->h;
+ }
+ frame_number++;
+ }
+
+#if CONFIG_AV1_DECODER
+ // Verify that we get at least 1 resize event in this test.
+ ASSERT_GE(resize_down_count, 1)
+ << "Resizing down should occur at lease once.";
+ EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
+#else
+ printf("Warning: AV1 decoder unavailable, unable to check resize count!\n");
+#endif
+}
+
class ResizeCspTest : public ResizeTest {
protected:
#if WRITE_COMPRESSED_STREAM
diff --git a/third_party/aom/test/variance_test.cc b/third_party/aom/test/variance_test.cc
index a493a1f4cb..e31f8f820c 100644
--- a/third_party/aom/test/variance_test.cc
+++ b/third_party/aom/test/variance_test.cc
@@ -2165,11 +2165,7 @@ INSTANTIATE_TEST_SUITE_P(
MseParams(4, 4, &aom_highbd_10_mse16x16_sve, 10),
MseParams(4, 3, &aom_highbd_10_mse16x8_sve, 10),
MseParams(3, 4, &aom_highbd_10_mse8x16_sve, 10),
- MseParams(3, 3, &aom_highbd_10_mse8x8_sve, 10),
- MseParams(4, 4, &aom_highbd_8_mse16x16_sve, 8),
- MseParams(4, 3, &aom_highbd_8_mse16x8_sve, 8),
- MseParams(3, 4, &aom_highbd_8_mse8x16_sve, 8),
- MseParams(3, 3, &aom_highbd_8_mse8x8_sve, 8)));
+ MseParams(3, 3, &aom_highbd_10_mse8x8_sve, 10)));
#endif // HAVE_SVE
const VarianceParams kArrayHBDVariance_c[] = {
diff --git a/third_party/aom/test/warp_filter_test.cc b/third_party/aom/test/warp_filter_test.cc
index f0be7d226b..8844ba77ca 100644
--- a/third_party/aom/test/warp_filter_test.cc
+++ b/third_party/aom/test/warp_filter_test.cc
@@ -88,6 +88,12 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
SVE, AV1WarpFilterTest,
libaom_test::AV1WarpFilter::BuildParams(av1_warp_affine_sve));
+
+#if CONFIG_AV1_HIGHBITDEPTH
+INSTANTIATE_TEST_SUITE_P(
+ SVE, AV1HighbdWarpFilterTest,
+ libaom_test::AV1HighbdWarpFilter::BuildParams(av1_highbd_warp_affine_sve));
+#endif // CONFIG_AV1_HIGHBITDEPTH
#endif // HAVE_SVE
} // namespace