Commit 2fad096b for libheif

commit 2fad096b5a2e0dd14c4da8626ef55310fadc4218
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Mon Oct 26 09:06:14 2026 +0100

    svt encoder: do not pad odd image sizes with SVT-AV1 >= 3.0.0 (#1945)

    SVT-AV1 supports odd image sizes since v3.0.0 and lowered the minimum
    size from 64 to 4 pixels (1 pixel since v4.2.0). Only pad to the
    minimum size, so that no clap box is needed in the common case.
    Firefox does not display AVIF images with a clap property.

diff --git a/libheif/plugins/encoder_svt.cc b/libheif/plugins/encoder_svt.cc
index 566e34f4..81eae25c 100644
--- a/libheif/plugins/encoder_svt.cc
+++ b/libheif/plugins/encoder_svt.cc
@@ -702,7 +702,20 @@ void svt_query_encoded_size(void* encoder_raw, uint32_t input_width, uint32_t in
 {
   auto* encoder = (encoder_struct_svt*) encoder_raw;

-  // SVT-AV1 (as of version 1.2.1) can only create image sizes matching the chroma format. Add padding if necessary.
+#if SVT_AV1_CHECK_VERSION(3, 0, 0)
+  // SVT-AV1 >= 3.0.0 supports odd image sizes. Minimum size is 4 (1 since v4.2.0).
+
+#if SVT_AV1_CHECK_VERSION(4, 2, 0)
+  const uint32_t min_size = 1;
+#else
+  const uint32_t min_size = 4;
+#endif
+
+  (void) encoder;
+  *encoded_width = std::max(input_width, min_size);
+  *encoded_height = std::max(input_height, min_size);
+#else
+  // Older SVT-AV1 versions can only create image sizes matching the chroma format and at least 64 pixels. Add padding if necessary.

   if (input_width < 64) {
     *encoded_width = 64;
@@ -723,6 +736,7 @@ void svt_query_encoded_size(void* encoder_raw, uint32_t input_width, uint32_t in
   else {
     *encoded_height = input_height;
   }
+#endif
 }