Skip to content

Commit 09ea6b3

Browse files
committed
WIP: try SVT-AV1 pre 3.0
1 parent 906a8a5 commit 09ea6b3

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

cmake/Modules/LocalSvt.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(AVIF_SVT_GIT_TAG "v2.3.0")
1+
set(AVIF_SVT_GIT_TAG "a1db9475bd19cae409322874d0f8cdc5c93c328d")
22

33
set(LIB_FILENAME "${AVIF_SOURCE_DIR}/ext/SVT-AV1/Bin/Release/${AVIF_LIBRARY_PREFIX}SvtAv1Enc${CMAKE_STATIC_LIBRARY_SUFFIX}")
44

@@ -45,6 +45,8 @@ else()
4545
GIT_TAG "${AVIF_SVT_GIT_TAG}"
4646
UPDATE_COMMAND ""
4747
GIT_SHALLOW ON
48+
PATCH_COMMAND
49+
sed -i.bak -e "s/SVT_AV1_VERSION_MAJOR 2/SVT_AV1_VERSION_MAJOR 3/g" Source/API/EbSvtAv1.h
4850
)
4951

5052
set(BUILD_DEC OFF CACHE BOOL "")
@@ -57,6 +59,11 @@ else()
5759
set(CMAKE_OUTPUT_DIRECTORY_ORIG "${CMAKE_OUTPUT_DIRECTORY}")
5860
set(CMAKE_OUTPUT_DIRECTORY "${SVT_BINARY_DIR}" CACHE INTERNAL "")
5961

62+
# For now, this creates compilation issues:
63+
# _deps/svt-build/libSvtAv1Enc.a: error adding symbols: file format not recognized
64+
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
65+
set(SVT_AV1_LTO OFF)
66+
6067
avif_fetchcontent_populate_cmake(svt)
6168

6269
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_ORIG} CACHE STRING "" FORCE)

src/codec_svt.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
114114
// See https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/1697.
115115
memset(svt_config, 0, sizeof(EbSvtAv1EncConfiguration));
116116

117+
#if SVT_AV1_CHECK_VERSION(3, 0, 0)
118+
res = svt_av1_enc_init_handle(&codec->internal->svt_encoder, svt_config);
119+
#else
117120
res = svt_av1_enc_init_handle(&codec->internal->svt_encoder, NULL, svt_config);
121+
#endif
118122
if (res != EB_ErrorNone) {
119123
goto cleanup;
120124
}
@@ -125,14 +129,18 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
125129
svt_config->is_16bit_pipeline = image->depth > 8;
126130
#endif
127131

132+
#if !SVT_AV1_CHECK_VERSION(1, 5, 0)
128133
// Follow comment in svt header: set if input is HDR10 BT2020 using SMPTE ST2084 (PQ).
129134
svt_config->high_dynamic_range_input = (image->depth == 10 && image->colorPrimaries == AVIF_COLOR_PRIMARIES_BT2020 &&
130135
image->transferCharacteristics == AVIF_TRANSFER_CHARACTERISTICS_SMPTE2084 &&
131136
image->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_BT2020_NCL);
137+
#endif
132138

133139
svt_config->source_width = image->width;
134140
svt_config->source_height = image->height;
135-
svt_config->logical_processors = encoder->maxThreads;
141+
#if SVT_AV1_CHECK_VERSION(3, 0, 0)
142+
svt_config->level_of_parallelism = encoder->maxThreads;
143+
#endif
136144
svt_config->enable_adaptive_quantization = 2;
137145
// disable 2-pass
138146
#if SVT_AV1_CHECK_VERSION(0, 9, 0)

0 commit comments

Comments
 (0)