Add the CONFIG_SVT_AV1 cmake option
If CONFIG_SVT_AV1 (default: 1) is set to 0, third_party/SVT-AV1 won't be
used.
Bug: 359670383
Change-Id: Ibe9a86abb0b900ac389f522bafde587577edc340
diff --git a/aom_dsp/aom_dsp.cmake b/aom_dsp/aom_dsp.cmake
index b021b08..46e6da3 100644
--- a/aom_dsp/aom_dsp.cmake
+++ b/aom_dsp/aom_dsp.cmake
@@ -93,12 +93,16 @@
"${AOM_ROOT}/aom_dsp/x86/intrapred_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/loopfilter_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/blend_a64_mask_avx2.c"
- "${AOM_ROOT}/aom_dsp/x86/bitdepth_conversion_avx2.h"
- "${AOM_ROOT}/third_party/SVT-AV1/convolve_2d_avx2.h"
- "${AOM_ROOT}/third_party/SVT-AV1/convolve_avx2.h"
- "${AOM_ROOT}/third_party/SVT-AV1/EbMemory_AVX2.h"
- "${AOM_ROOT}/third_party/SVT-AV1/EbMemory_SSE4_1.h"
- "${AOM_ROOT}/third_party/SVT-AV1/synonyms.h")
+ "${AOM_ROOT}/aom_dsp/x86/bitdepth_conversion_avx2.h")
+
+if(CONFIG_SVT_AV1)
+ list(APPEND AOM_DSP_COMMON_INTRIN_AVX2
+ "${AOM_ROOT}/third_party/SVT-AV1/convolve_2d_avx2.h"
+ "${AOM_ROOT}/third_party/SVT-AV1/convolve_avx2.h"
+ "${AOM_ROOT}/third_party/SVT-AV1/EbMemory_AVX2.h"
+ "${AOM_ROOT}/third_party/SVT-AV1/EbMemory_SSE4_1.h"
+ "${AOM_ROOT}/third_party/SVT-AV1/synonyms.h")
+endif()
list(APPEND AOM_DSP_COMMON_INTRIN_NEON
"${AOM_ROOT}/aom_dsp/arm/aom_convolve_copy_neon.c"
diff --git a/av1/common/filter.h b/av1/common/filter.h
index 7073da2..d1b76bd 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -307,10 +307,14 @@
if (filter[1] | filter[6]) {
return 6;
}
+#if CONFIG_SVT_AV1
if (filter[2] | filter[5]) {
return 4;
}
return 2;
+#else
+ return 4;
+#endif
}
#ifdef __cplusplus
diff --git a/av1/common/x86/convolve_2d_avx2.c b/av1/common/x86/convolve_2d_avx2.c
index e3ba0f1..521326c 100644
--- a/av1/common/x86/convolve_2d_avx2.c
+++ b/av1/common/x86/convolve_2d_avx2.c
@@ -13,7 +13,9 @@
#include "config/av1_rtcd.h"
+#if CONFIG_SVT_AV1
#include "third_party/SVT-AV1/convolve_2d_avx2.h"
+#endif
#include "aom_dsp/x86/convolve_avx2.h"
#include "aom_dsp/aom_filter.h"
@@ -143,6 +145,7 @@
int32_t w, int32_t h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int32_t subpel_x_qn,
const int32_t subpel_y_qn, ConvolveParams *conv_params) {
+#if CONFIG_SVT_AV1
const int32_t tap_x = get_filter_tap(filter_params_x, subpel_x_qn);
const int32_t tap_y = get_filter_tap(filter_params_y, subpel_y_qn);
@@ -156,4 +159,9 @@
filter_params_x, filter_params_y,
subpel_x_qn, subpel_y_qn, conv_params);
}
+#else
+ convolve_2d_sr_general_avx2(src, src_stride, dst, dst_stride, w, h,
+ filter_params_x, filter_params_y, subpel_x_qn,
+ subpel_y_qn, conv_params);
+#endif
}
diff --git a/av1/common/x86/convolve_avx2.c b/av1/common/x86/convolve_avx2.c
index dddaa4b..d250d88 100644
--- a/av1/common/x86/convolve_avx2.c
+++ b/av1/common/x86/convolve_avx2.c
@@ -13,7 +13,9 @@
#include "config/av1_rtcd.h"
+#if CONFIG_SVT_AV1
#include "third_party/SVT-AV1/convolve_avx2.h"
+#endif
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/x86/convolve_avx2.h"
@@ -513,6 +515,7 @@
int32_t h,
const InterpFilterParams *filter_params_y,
const int32_t subpel_y_qn) {
+#if CONFIG_SVT_AV1
const int vert_tap = get_filter_tap(filter_params_y, subpel_y_qn);
if (vert_tap == 12) {
@@ -522,6 +525,10 @@
av1_convolve_y_sr_specialized_avx2(src, src_stride, dst, dst_stride, w, h,
filter_params_y, subpel_y_qn);
}
+#else
+ av1_convolve_y_sr_general_avx2(src, src_stride, dst, dst_stride, w, h,
+ filter_params_y, subpel_y_qn);
+#endif
}
static inline void av1_convolve_x_sr_general_avx2(
@@ -903,6 +910,7 @@
const InterpFilterParams *filter_params_x,
const int32_t subpel_x_qn,
ConvolveParams *conv_params) {
+#if CONFIG_SVT_AV1
const int horz_tap = get_filter_tap(filter_params_x, subpel_x_qn);
if (horz_tap == 12) {
@@ -913,4 +921,8 @@
filter_params_x, subpel_x_qn,
conv_params);
}
+#else
+ av1_convolve_x_sr_general_avx2(src, src_stride, dst, dst_stride, w, h,
+ filter_params_x, subpel_x_qn, conv_params);
+#endif
}
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 2f11828..ae0842c 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -75,6 +75,9 @@
set_aom_config_var(CONFIG_GCOV 0 "Enable gcov support.")
set_aom_config_var(CONFIG_GPROF 0 "Enable gprof support.")
set_aom_config_var(CONFIG_LIBYUV 1 "Enables libyuv scaling/conversion support.")
+# Set CONFIG_SVT_AV1 to 0 to avoid the BSD 3-Clause Clear License used by the
+# code in third_party/SVT-AV1/.
+set_aom_config_var(CONFIG_SVT_AV1 1 "Enables SVT-AV1 AVX2 convolution support.")
set_aom_config_var(CONFIG_AV1_HIGHBITDEPTH 1
"Build with high bitdepth support.")