Skip to content

Commit 4bc4cfb

Browse files
stefantalpalarufarindk
authored andcommitted
support SVT-AV1 3.0.0
1 parent 367aabf commit 4bc4cfb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libheif/plugins/encoder_svt.cc

+14
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,11 @@ struct heif_error svt_encode_image(void* encoder_raw, const struct heif_image* i
678678
EbSvtAv1EncConfiguration svt_config;
679679
memset(&svt_config, 0, sizeof(EbSvtAv1EncConfiguration));
680680

681+
#if SVT_AV1_CHECK_VERSION(3, 0, 0)
682+
res = svt_av1_enc_init_handle(&svt_encoder, &svt_config);
683+
#else
681684
res = svt_av1_enc_init_handle(&svt_encoder, nullptr, &svt_config);
685+
#endif
682686
if (res != EB_ErrorNone) {
683687
//goto cleanup;
684688
return heif_error_codec_library_error;
@@ -698,7 +702,9 @@ struct heif_error svt_encode_image(void* encoder_raw, const struct heif_image* i
698702
auto nclx_deleter = std::unique_ptr<heif_color_profile_nclx, void (*)(heif_color_profile_nclx*)>(nclx, heif_nclx_color_profile_free);
699703

700704
if (nclx) {
705+
#if !SVT_AV1_CHECK_VERSION(3, 0, 0)
701706
svt_config.color_description_present_flag = true;
707+
#endif
702708
#if SVT_AV1_VERSION_MAJOR >= 1
703709
svt_config.color_primaries = static_cast<EbColorPrimaries>(nclx->color_primaries);
704710
svt_config.transfer_characteristics = static_cast<EbTransferCharacteristics>(nclx->transfer_characteristics);
@@ -712,20 +718,28 @@ struct heif_error svt_encode_image(void* encoder_raw, const struct heif_image* i
712718
#endif
713719

714720

721+
#if !SVT_AV1_CHECK_VERSION(3, 0, 0)
715722
// Follow comment in svt header: set if input is HDR10 BT2020 using SMPTE ST2084.
716723
svt_config.high_dynamic_range_input = (bitdepth_y == 10 && // TODO: should this be >8 ?
717724
nclx->color_primaries == heif_color_primaries_ITU_R_BT_2020_2_and_2100_0 &&
718725
nclx->transfer_characteristics == heif_transfer_characteristic_ITU_R_BT_2100_0_PQ &&
719726
nclx->matrix_coefficients == heif_matrix_coefficients_ITU_R_BT_2020_2_non_constant_luminance);
727+
#endif
720728
}
721729
else {
730+
#if !SVT_AV1_CHECK_VERSION(3, 0, 0)
722731
svt_config.color_description_present_flag = false;
732+
#endif
723733
}
724734

725735

726736
svt_config.source_width = encoded_width;
727737
svt_config.source_height = encoded_height;
738+
#if SVT_AV1_CHECK_VERSION(3, 0, 0)
739+
svt_config.level_of_parallelism = encoder->threads;
740+
#else
728741
svt_config.logical_processors = encoder->threads;
742+
#endif
729743

730744
// disable 2-pass
731745
svt_config.rc_stats_buffer = SvtAv1FixedBuf {nullptr, 0};

0 commit comments

Comments
 (0)