aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoyuan Yang <byang@debian.org>2021-11-07 08:50:18 -0500
committerBoyuan Yang <byang@debian.org>2021-11-07 08:50:18 -0500
commit320ef65362608ee1148c299d8d5d7618af34e470 (patch)
treec47911c219d1e35b8b0771e9e0176eff0e0d08ec /tests
parent2381d803c76105f44717d75f089ec37f51e5cfe4 (diff)
downloadlibgav1-320ef65362608ee1148c299d8d5d7618af34e470.tar.gz
libgav1-320ef65362608ee1148c299d8d5d7618af34e470.tar.bz2
libgav1-320ef65362608ee1148c299d8d5d7618af34e470.zip
New upstream version 0.17.0
Diffstat (limited to 'tests')
-rw-r--r--tests/block_utils.cc12
-rw-r--r--tests/data/five-frames.ivfbin0 -> 883 bytes
-rw-r--r--tests/data/ivf-header-and-truncated-frame-headerbin0 -> 36 bytes
-rw-r--r--tests/data/ivf-header-onlybin0 -> 32 bytes
-rw-r--r--tests/data/ivf-signature-only1
-rw-r--r--tests/data/one-frame-large-timestamp.ivfbin0 -> 608 bytes
-rw-r--r--tests/data/one-frame-truncated.ivfbin0 -> 100 bytes
-rw-r--r--tests/data/one-frame.ivfbin0 -> 608 bytes
-rw-r--r--tests/libgav1_tests.cmake755
-rw-r--r--tests/utils.cc77
-rw-r--r--tests/utils.h19
11 files changed, 857 insertions, 7 deletions
diff --git a/tests/block_utils.cc b/tests/block_utils.cc
index 96833a2..07337c4 100644
--- a/tests/block_utils.cc
+++ b/tests/block_utils.cc
@@ -23,6 +23,7 @@ namespace libgav1 {
namespace test_utils {
namespace {
+#define LIBGAV1_DEBUG_FORMAT_CODE "x"
template <typename Pixel>
void PrintBlockDiff(const Pixel* block1, const Pixel* block2, int width,
int height, int stride1, int stride2,
@@ -35,15 +36,17 @@ void PrintBlockDiff(const Pixel* block1, const Pixel* block2, int width,
for (int x = 0; x < print_width; ++x) {
if (x >= width) {
if (block1[x] == block2[x]) {
- printf("[%*d] ", field_width, block1[x]);
+ printf("[%*" LIBGAV1_DEBUG_FORMAT_CODE "] ", field_width, block1[x]);
} else {
- printf("[*%*d] ", field_width - 1, block1[x]);
+ printf("[*%*" LIBGAV1_DEBUG_FORMAT_CODE "] ", field_width - 1,
+ block1[x]);
}
} else {
if (block1[x] == block2[x]) {
- printf("%*d ", field_width, block1[x]);
+ printf("%*" LIBGAV1_DEBUG_FORMAT_CODE " ", field_width, block1[x]);
} else {
- printf("*%*d ", field_width - 1, block1[x]);
+ printf("*%*" LIBGAV1_DEBUG_FORMAT_CODE " ", field_width - 1,
+ block1[x]);
}
}
}
@@ -52,6 +55,7 @@ void PrintBlockDiff(const Pixel* block1, const Pixel* block2, int width,
block2 += stride2;
}
}
+#undef LIBGAV1_DEBUG_FORMAT_CODE
} // namespace
diff --git a/tests/data/five-frames.ivf b/tests/data/five-frames.ivf
new file mode 100644
index 0000000..08bc6db
--- /dev/null
+++ b/tests/data/five-frames.ivf
Binary files differ
diff --git a/tests/data/ivf-header-and-truncated-frame-header b/tests/data/ivf-header-and-truncated-frame-header
new file mode 100644
index 0000000..c6d7a6a
--- /dev/null
+++ b/tests/data/ivf-header-and-truncated-frame-header
Binary files differ
diff --git a/tests/data/ivf-header-only b/tests/data/ivf-header-only
new file mode 100644
index 0000000..e751f36
--- /dev/null
+++ b/tests/data/ivf-header-only
Binary files differ
diff --git a/tests/data/ivf-signature-only b/tests/data/ivf-signature-only
new file mode 100644
index 0000000..8550ef8
--- /dev/null
+++ b/tests/data/ivf-signature-only
@@ -0,0 +1 @@
+DKIF
diff --git a/tests/data/one-frame-large-timestamp.ivf b/tests/data/one-frame-large-timestamp.ivf
new file mode 100644
index 0000000..44886da
--- /dev/null
+++ b/tests/data/one-frame-large-timestamp.ivf
Binary files differ
diff --git a/tests/data/one-frame-truncated.ivf b/tests/data/one-frame-truncated.ivf
new file mode 100644
index 0000000..94e5b09
--- /dev/null
+++ b/tests/data/one-frame-truncated.ivf
Binary files differ
diff --git a/tests/data/one-frame.ivf b/tests/data/one-frame.ivf
new file mode 100644
index 0000000..436e461
--- /dev/null
+++ b/tests/data/one-frame.ivf
Binary files differ
diff --git a/tests/libgav1_tests.cmake b/tests/libgav1_tests.cmake
index ac2fb2e..2b3f41c 100644
--- a/tests/libgav1_tests.cmake
+++ b/tests/libgav1_tests.cmake
@@ -69,14 +69,56 @@ list(APPEND libgav1_tests_utils_sources
list(APPEND libgav1_tests_utils_test_sources
"${libgav1_root}/tests/utils_test.cc")
+list(APPEND libgav1_array_2d_test_sources
+ "${libgav1_source}/utils/array_2d_test.cc")
list(APPEND libgav1_average_blend_test_sources
"${libgav1_source}/dsp/average_blend_test.cc")
+list(APPEND libgav1_block_parameters_holder_test_sources
+ "${libgav1_source}/utils/block_parameters_holder_test.cc")
+list(APPEND libgav1_blocking_counter_test_sources
+ "${libgav1_source}/utils/blocking_counter_test.cc")
+list(APPEND libgav1_buffer_pool_test_sources
+ "${libgav1_source}/buffer_pool_test.cc")
list(APPEND libgav1_cdef_test_sources "${libgav1_source}/dsp/cdef_test.cc")
+list(
+ APPEND libgav1_common_test_sources "${libgav1_source}/utils/common_test.cc")
+list(APPEND libgav1_common_avx2_test_sources
+ "${libgav1_source}/dsp/x86/common_avx2.h"
+ "${libgav1_source}/dsp/x86/common_avx2.inc"
+ "${libgav1_source}/dsp/x86/common_avx2_test.cc"
+ "${libgav1_source}/dsp/x86/common_sse4.inc")
+list(APPEND libgav1_common_neon_test_sources
+ "${libgav1_source}/dsp/arm/common_neon_test.cc")
+list(APPEND libgav1_common_sse4_test_sources
+ "${libgav1_source}/dsp/x86/common_sse4.h"
+ "${libgav1_source}/dsp/x86/common_sse4.inc"
+ "${libgav1_source}/dsp/x86/common_sse4_test.cc")
list(APPEND libgav1_convolve_test_sources
"${libgav1_source}/dsp/convolve_test.cc")
+list(APPEND libgav1_cpu_test_sources "${libgav1_source}/utils/cpu_test.cc")
+list(APPEND libgav1_c_decoder_test_sources "${libgav1_source}/c_decoder_test.c")
+list(APPEND libgav1_c_version_test_sources "${libgav1_source}/c_version_test.c")
+list(APPEND libgav1_decoder_test_sources "${libgav1_source}/decoder_test.cc")
+list(APPEND libgav1_decoder_buffer_test_sources
+ "${libgav1_source}/decoder_buffer_test.cc")
list(APPEND libgav1_distance_weighted_blend_test_sources
"${libgav1_source}/dsp/distance_weighted_blend_test.cc")
list(APPEND libgav1_dsp_test_sources "${libgav1_source}/dsp/dsp_test.cc")
+list(APPEND libgav1_entropy_decoder_test_sources
+ "${libgav1_source}/utils/entropy_decoder_test.cc"
+ "${libgav1_source}/utils/entropy_decoder_test_data.inc")
+list(APPEND libgav1_file_reader_test_sources
+ "${libgav1_examples}/file_reader_test.cc"
+ "${libgav1_examples}/file_reader_test_common.cc"
+ "${libgav1_examples}/file_reader_test_common.h")
+list(APPEND libgav1_film_grain_test_sources
+ "${libgav1_source}/film_grain_test.cc")
+list(APPEND libgav1_file_reader_factory_test_sources
+ "${libgav1_examples}/file_reader_factory_test.cc")
+list(APPEND libgav1_file_writer_test_sources
+ "${libgav1_examples}/file_writer_test.cc")
+list(APPEND libgav1_internal_frame_buffer_list_test_sources
+ "${libgav1_source}/internal_frame_buffer_list_test.cc")
list(APPEND libgav1_intra_edge_test_sources
"${libgav1_source}/dsp/intra_edge_test.cc")
list(APPEND libgav1_intrapred_cfl_test_sources
@@ -103,8 +145,44 @@ list(APPEND libgav1_super_res_test_sources
"${libgav1_source}/dsp/super_res_test.cc")
list(APPEND libgav1_weight_mask_test_sources
"${libgav1_source}/dsp/weight_mask_test.cc")
+list(
+ APPEND libgav1_memory_test_sources "${libgav1_source}/utils/memory_test.cc")
list(APPEND libgav1_obmc_test_sources "${libgav1_source}/dsp/obmc_test.cc")
+list(APPEND libgav1_obu_parser_test_sources
+ "${libgav1_source}/obu_parser_test.cc")
+list(APPEND libgav1_post_filter_test_sources
+ "${libgav1_source}/post_filter_test.cc")
+list(APPEND libgav1_prediction_mask_test_sources
+ "${libgav1_source}/prediction_mask_test.cc")
+list(
+ APPEND libgav1_quantizer_test_sources "${libgav1_source}/quantizer_test.cc")
+list(APPEND libgav1_queue_test_sources "${libgav1_source}/utils/queue_test.cc")
+list(APPEND libgav1_raw_bit_reader_test_sources
+ "${libgav1_source}/utils/raw_bit_reader_test.cc")
+list(APPEND libgav1_reconstruction_test_sources
+ "${libgav1_source}/reconstruction_test.cc")
+list(APPEND libgav1_residual_buffer_pool_test_sources
+ "${libgav1_source}/residual_buffer_pool_test.cc")
+list(APPEND libgav1_scan_test_sources "${libgav1_source}/scan_test.cc")
+list(APPEND libgav1_segmentation_map_test_sources
+ "${libgav1_source}/utils/segmentation_map_test.cc")
+list(APPEND libgav1_segmentation_test_sources
+ "${libgav1_source}/utils/segmentation_test.cc")
+list(APPEND libgav1_stack_test_sources "${libgav1_source}/utils/stack_test.cc")
+list(APPEND libgav1_symbol_decoder_context_test_sources
+ "${libgav1_source}/symbol_decoder_context_test.cc")
+list(APPEND libgav1_threadpool_test_sources
+ "${libgav1_source}/utils/threadpool_test.cc")
+list(APPEND libgav1_threading_strategy_test_sources
+ "${libgav1_source}/threading_strategy_test.cc")
+list(APPEND libgav1_unbounded_queue_test_sources
+ "${libgav1_source}/utils/unbounded_queue_test.cc")
+list(
+ APPEND libgav1_vector_test_sources "${libgav1_source}/utils/vector_test.cc")
+list(APPEND libgav1_version_test_sources "${libgav1_source}/version_test.cc")
list(APPEND libgav1_warp_test_sources "${libgav1_source}/dsp/warp_test.cc")
+list(APPEND libgav1_warp_prediction_test_sources
+ "${libgav1_source}/warp_prediction_test.cc")
macro(libgav1_add_tests_targets)
if(NOT LIBGAV1_ENABLE_TESTS)
@@ -157,6 +235,343 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ array_2d_test
+ SOURCES
+ ${libgav1_array_2d_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ block_parameters_holder_test
+ SOURCES
+ ${libgav1_block_parameters_holder_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ blocking_counter_test
+ SOURCES
+ ${libgav1_blocking_counter_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ if(libgav1_have_avx2)
+ libgav1_add_executable(TEST
+ NAME
+ common_avx2_test
+ SOURCES
+ ${libgav1_common_avx2_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+ endif()
+
+ if(libgav1_have_neon)
+ libgav1_add_executable(TEST
+ NAME
+ common_neon_test
+ SOURCES
+ ${libgav1_common_neon_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_tests_block_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+ endif()
+
+ if(libgav1_have_sse4)
+ libgav1_add_executable(TEST
+ NAME
+ common_sse4_test
+ SOURCES
+ ${libgav1_common_sse4_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+ endif()
+
+ libgav1_add_executable(TEST
+ NAME
+ common_test
+ SOURCES
+ ${libgav1_common_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ cpu_test
+ SOURCES
+ ${libgav1_cpu_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ entropy_decoder_test
+ SOURCES
+ ${libgav1_entropy_decoder_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ file_reader_test
+ SOURCES
+ ${libgav1_file_reader_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_dsp
+ libgav1_file_reader
+ libgav1_utils
+ libgav1_tests_utils
+ LIB_DEPS
+ absl::strings
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ file_reader_factory_test
+ SOURCES
+ ${libgav1_file_reader_factory_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_file_reader
+ libgav1_utils
+ LIB_DEPS
+ absl::memory
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ film_grain_test
+ SOURCES
+ ${libgav1_film_grain_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_tests_block_utils
+ libgav1_tests_utils
+ libgav1_utils
+ LIB_DEPS
+ absl::str_format_internal
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ memory_test
+ SOURCES
+ ${libgav1_memory_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ absl::base
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ queue_test
+ SOURCES
+ ${libgav1_queue_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ segmentation_map_test
+ SOURCES
+ ${libgav1_segmentation_map_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ segmentation_test
+ SOURCES
+ ${libgav1_segmentation_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ stack_test
+ SOURCES
+ ${libgav1_stack_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ symbol_decoder_context_test
+ SOURCES
+ ${libgav1_symbol_decoder_context_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ threadpool_test
+ SOURCES
+ ${libgav1_threadpool_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ absl::synchronization
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ unbounded_queue_test
+ SOURCES
+ ${libgav1_unbounded_queue_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
tests_utils_test
SOURCES
${libgav1_tests_utils_test_sources}
@@ -169,11 +584,43 @@ macro(libgav1_add_tests_targets)
libgav1_tests_utils
libgav1_utils
LIB_DEPS
+ absl::strings
absl::time
${libgav1_common_test_absl_deps}
libgav1_gtest
libgav1_gtest_main)
+ libgav1_add_executable(TEST
+ NAME
+ vector_test
+ SOURCES
+ ${libgav1_vector_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ version_test
+ SOURCES
+ ${libgav1_version_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ ${libgav1_dependency}
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
libgav1_add_library(TEST
NAME
libgav1_tests_block_utils
@@ -214,7 +661,6 @@ macro(libgav1_add_tests_targets)
libgav1_tests_utils
libgav1_utils
LIB_DEPS
- absl::str_format_internal
absl::strings
absl::time
${libgav1_common_test_absl_deps}
@@ -223,6 +669,24 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ buffer_pool_test
+ SOURCES
+ ${libgav1_buffer_pool_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
cdef_test
SOURCES
${libgav1_cdef_test_sources}
@@ -266,6 +730,60 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ c_decoder_test
+ SOURCES
+ ${libgav1_c_decoder_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_include_paths}
+ LIB_DEPS
+ ${libgav1_dependency})
+
+ libgav1_add_executable(TEST
+ NAME
+ c_version_test
+ SOURCES
+ ${libgav1_c_version_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_include_paths}
+ LIB_DEPS
+ ${libgav1_dependency})
+
+ libgav1_add_executable(TEST
+ NAME
+ decoder_test
+ SOURCES
+ ${libgav1_decoder_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ ${libgav1_dependency}
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ decoder_buffer_test
+ SOURCES
+ ${libgav1_decoder_buffer_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ LIB_DEPS
+ ${libgav1_dependency}
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
distance_weighted_blend_test
SOURCES
${libgav1_distance_weighted_blend_test_sources}
@@ -279,7 +797,7 @@ macro(libgav1_add_tests_targets)
libgav1_tests_utils
libgav1_utils
LIB_DEPS
- absl::str_format_internal
+ absl::strings
absl::time
${libgav1_common_test_absl_deps}
libgav1_gtest
@@ -308,6 +826,29 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ file_writer_test
+ SOURCES
+ ${libgav1_file_writer_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_file_writer
+ libgav1_tests_utils
+ libgav1_utils
+ LIB_DEPS
+ absl::memory
+ absl::strings
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
intrapred_cfl_test
SOURCES
${libgav1_intrapred_cfl_test_sources}
@@ -435,6 +976,24 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ internal_frame_buffer_list_test
+ SOURCES
+ ${libgav1_internal_frame_buffer_list_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
loop_filter_test
SOURCES
${libgav1_loop_filter_test_sources}
@@ -490,7 +1049,7 @@ macro(libgav1_add_tests_targets)
libgav1_tests_utils
libgav1_utils
LIB_DEPS
- absl::str_format_internal
+ absl::strings
absl::time
${libgav1_common_test_absl_deps}
libgav1_gtest
@@ -562,6 +1121,158 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ obu_parser_test
+ SOURCES
+ ${libgav1_obu_parser_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ post_filter_test
+ SOURCES
+ ${libgav1_post_filter_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_tests_block_utils
+ libgav1_tests_utils
+ libgav1_utils
+ LIB_DEPS
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ prediction_mask_test
+ SOURCES
+ ${libgav1_prediction_mask_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_tests_utils
+ libgav1_utils
+ LIB_DEPS
+ absl::strings
+ absl::time
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ quantizer_test
+ SOURCES
+ ${libgav1_quantizer_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ raw_bit_reader_test
+ SOURCES
+ ${libgav1_raw_bit_reader_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ reconstruction_test
+ SOURCES
+ ${libgav1_reconstruction_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_tests_block_utils
+ libgav1_tests_utils
+ libgav1_utils
+ ${libgav1_test_objlib_deps}
+ LIB_DEPS
+ absl::strings
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ residual_buffer_pool_test
+ SOURCES
+ ${libgav1_residual_buffer_pool_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ ${libgav1_test_objlib_deps}
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
+ scan_test
+ SOURCES
+ ${libgav1_scan_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_utils
+ ${libgav1_test_objlib_deps}
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
super_res_test
SOURCES
${libgav1_super_res_test_sources}
@@ -583,6 +1294,26 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ threading_strategy_test
+ SOURCES
+ ${libgav1_threading_strategy_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ ${libgav1_test_objlib_deps}
+ LIB_DEPS
+ absl::str_format_internal
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
warp_test
SOURCES
${libgav1_warp_test_sources}
@@ -605,6 +1336,24 @@ macro(libgav1_add_tests_targets)
libgav1_add_executable(TEST
NAME
+ warp_prediction_test
+ SOURCES
+ ${libgav1_warp_prediction_test_sources}
+ DEFINES
+ ${libgav1_defines}
+ INCLUDES
+ ${libgav1_test_include_paths}
+ OBJLIB_DEPS
+ libgav1_decoder
+ libgav1_dsp
+ libgav1_utils
+ LIB_DEPS
+ ${libgav1_common_test_absl_deps}
+ libgav1_gtest
+ libgav1_gtest_main)
+
+ libgav1_add_executable(TEST
+ NAME
weight_mask_test
SOURCES
${libgav1_weight_mask_test_sources}
diff --git a/tests/utils.cc b/tests/utils.cc
index b73cf01..e91ea87 100644
--- a/tests/utils.cc
+++ b/tests/utils.cc
@@ -21,6 +21,7 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "gtest/gtest.h"
#include "src/dsp/dsp.h"
@@ -30,6 +31,30 @@
namespace libgav1 {
namespace test_utils {
+namespace {
+
+int CloseFile(FILE* stream) { return fclose(stream); }
+
+bool ReadFileToString(absl::string_view file_name, std::string* const string) {
+ using FilePtr = std::unique_ptr<FILE, decltype(&CloseFile)>;
+ FilePtr file(fopen(std::string(file_name).c_str(), "rb"), &CloseFile);
+ if (file == nullptr) return false;
+
+ do {
+ int c = fgetc(file.get());
+ if (ferror(file.get()) != 0) return false;
+
+ if (c != EOF) {
+ string->append(1, static_cast<char>(c));
+ } else {
+ break;
+ }
+ } while (true);
+
+ return true;
+}
+
+} // namespace
void ResetDspTable(const int bitdepth) {
dsp::Dsp* const dsp = dsp_internal::GetWritableDspTable(bitdepth);
@@ -116,5 +141,57 @@ void CheckMd5Digest(const char name[], const char function_name[],
EXPECT_STREQ(expected_digest, actual_digest);
}
+namespace {
+
+std::string GetSourceDir() {
+#if defined(__ANDROID__)
+ // Test files must be manually supplied. This path is frequently
+ // available on development devices.
+ return std::string("/data/local/tmp/tests/data");
+#elif defined(LIBGAV1_FLAGS_SRCDIR)
+ return std::string(LIBGAV1_FLAGS_SRCDIR) + "/tests/data";
+#else
+ return std::string(".");
+#endif // defined(__ANDROID__)
+}
+
+std::string GetTempDir() {
+ const char* path = getenv("TMPDIR");
+ if (path == nullptr || path[0] == '\0') path = getenv("TEMP");
+ if (path != nullptr && path[0] != '\0') return std::string(path);
+
+#if defined(__ANDROID__)
+ return std::string("/data/local/tmp");
+#elif defined(LIBGAV1_FLAGS_TMPDIR)
+ return std::string(LIBGAV1_FLAGS_TMPDIR);
+#else
+ return std::string(".");
+#endif // defined(__ANDROID__)
+}
+
+} // namespace
+
+std::string GetTestInputFilePath(absl::string_view file_name) {
+ const char* const path = getenv("LIBGAV1_TEST_DATA_PATH");
+ if (path != nullptr && path[0] != '\0') {
+ return std::string(path) + "/" + std::string(file_name);
+ }
+ return GetSourceDir() + "/" + std::string(file_name);
+}
+
+std::string GetTestOutputFilePath(absl::string_view file_name) {
+ return GetTempDir() + "/" + std::string(file_name);
+}
+
+void GetTestData(absl::string_view file_name, const bool is_output_file,
+ std::string* const output) {
+ ASSERT_NE(output, nullptr);
+ const std::string absolute_file_path = is_output_file
+ ? GetTestOutputFilePath(file_name)
+ : GetTestInputFilePath(file_name);
+
+ ASSERT_TRUE(ReadFileToString(absolute_file_path, output));
+}
+
} // namespace test_utils
} // namespace libgav1
diff --git a/tests/utils.h b/tests/utils.h
index b3062da..4d73070 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -22,6 +22,7 @@
#include <string>
#include "absl/base/config.h"
+#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "src/gav1/decoder_buffer.h"
#include "src/utils/memory.h"
@@ -132,6 +133,24 @@ void CheckMd5Digest(const char name[], const char function_name[],
const char expected_digest[], const char actual_digest[],
absl::Duration elapsed_time);
+//------------------------------------------------------------------------------
+// Reads the test data from |file_name| as a string into |output|. The
+// |is_output_file| argument controls the expansion of |file_name| to its full
+// path. When |is_output_file| is true GetTestData() reads from
+// utils.cc::GetTempDir(), and when it is false the file is read from
+// utils.cc::GetSourceDir().
+void GetTestData(absl::string_view file_name, bool is_output_file,
+ std::string* output);
+
+//------------------------------------------------------------------------------
+// Returns the full path to |file_name| from libgav1/tests/data.
+std::string GetTestInputFilePath(absl::string_view file_name);
+
+//------------------------------------------------------------------------------
+// Returns the full path to |file_name| in a location where the file can be
+// opened for writing.
+std::string GetTestOutputFilePath(absl::string_view file_name);
+
} // namespace test_utils
} // namespace libgav1