Commit 7414b387 for libheif
commit 7414b38767d59c1d34e106e74532584bc327a9a1
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Sun May 17 18:49:40 2026 +0200
remove ENABLE_EXPERIMENTAL_MINI_FORMAT flag
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e34b00a..4a98f0ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -550,8 +550,6 @@ option(WITH_HEADER_COMPRESSION OFF)
option(ENABLE_MULTITHREADING_SUPPORT "Switch off for platforms without multithreading support" ON)
option(ENABLE_PARALLEL_TILE_DECODING "Will launch multiple decoders to decode tiles in parallel (requires ENABLE_MULTITHREADING_SUPPORT)" ON)
-option(ENABLE_EXPERIMENTAL_MINI_FORMAT "Enable experimental (draft) low-overhead box format (likely reduced interoperability)." OFF)
-
if (WITH_REDUCED_VISIBILITY)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
else ()
diff --git a/examples/heif_enc.cc b/examples/heif_enc.cc
index a26ec3d4..e1c3cb79 100644
--- a/examples/heif_enc.cc
+++ b/examples/heif_enc.cc
@@ -125,9 +125,7 @@ bool force_enc_htj2k = false;
bool use_tiling = false;
bool encode_sequence = false;
bool option_unif = false;
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
bool option_mini = false;
-#endif
bool use_video_handler = false;
bool option_component_content_ids = false;
heif_orientation transform = heif_orientation_normal;
@@ -239,9 +237,7 @@ const int OPTION_RAW = 1045;
const int OPTION_DO_ROTATE = 1046;
const int OPTION_DO_FLIP_H = 1047;
const int OPTION_DO_FLIP_V = 1048;
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
const int OPTION_MINI = 1049;
-#endif
#if HEIF_ENABLE_EXPERIMENTAL_FEATURES
@@ -424,9 +420,7 @@ static option long_options[] = {
{(char* const) "omaf-image-projection", required_argument, nullptr, OPTION_SET_OMAF_IMAGE_PROJECTION},
{(char* const) "add-compatible-brand", required_argument, nullptr, OPTION_ADD_COMPATIBLE_BRAND},
{(char* const) "unif", no_argument, nullptr, OPTION_UNIF},
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
{(char* const) "mini", no_argument, nullptr, OPTION_MINI},
-#endif
{(char* const) "raw", no_argument, nullptr, OPTION_RAW},
{(char* const) "raw-width", required_argument, nullptr, OPTION_RAW_WIDTH},
{(char* const) "raw-height", required_argument, nullptr, OPTION_RAW_HEIGHT},
@@ -493,9 +487,7 @@ void show_help(const char* argv0)
#endif
<< " --add-compatible-brand BRAND add a compatible brand to the output file (4 characters)\n"
<< " --unif use unified ID namespace (adds 'unif' compatible brand)\n"
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
- << " --mini use compact 'mini' box format (experimental)\n"
-#endif
+ << " --mini use compact 'mini' box format\n"
<< "\n"
<< "codecs:\n"
<< " -A, --avif encode as AVIF (not needed if output filename with .avif suffix is provided)\n"
@@ -1893,11 +1885,9 @@ int main(int argc, char** argv)
case OPTION_UNIF:
option_unif = true;
break;
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
case OPTION_MINI:
option_mini = true;
break;
-#endif
case OPTION_RAW:
force_raw_input = true;
break;
@@ -2019,11 +2009,9 @@ int main(int argc, char** argv)
heif_context_set_unif(context.get(), 1);
}
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
if (option_mini) {
heif_context_set_write_mini_format(context.get(), 1);
}
-#endif
#define MAX_ENCODERS 10
diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt
index 3b5b9887..b6182c6f 100644
--- a/libheif/CMakeLists.txt
+++ b/libheif/CMakeLists.txt
@@ -331,12 +331,9 @@ if (WITH_UNCOMPRESSED_CODEC)
codecs/uncompressed/unc_encoder_rgb_block_pixel_interleave.h)
endif ()
-if (ENABLE_EXPERIMENTAL_MINI_FORMAT)
- target_compile_definitions(heif PUBLIC ENABLE_EXPERIMENTAL_MINI_FORMAT=1)
- target_sources(heif PRIVATE
- mini.h
- mini.cc)
-endif ()
+target_sources(heif PRIVATE
+ mini.h
+ mini.cc)
target_sources(heif PRIVATE
omaf_boxes.h
diff --git a/libheif/api/libheif/heif_brands.cc b/libheif/api/libheif/heif_brands.cc
index f5d14ed7..8ba42014 100644
--- a/libheif/api/libheif/heif_brands.cc
+++ b/libheif/api/libheif/heif_brands.cc
@@ -257,7 +257,6 @@ const char* heif_get_file_mime_type(const uint8_t* data, int len)
else if (mainBrand == heif_brand2_avcs) {
return "image/avcs";
}
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
else if (mainBrand == heif_brand2_mif3) {
heif_brand2 minorBrand = heif_read_minor_version_brand(data, len);
if (minorBrand == heif_brand2_avif) {
@@ -272,7 +271,6 @@ const char* heif_get_file_mime_type(const uint8_t* data, int len)
// There could be other options in here, like VVC or J2K
return "image/heif";
}
-#endif
else if (mainBrand == heif_brand2_j2ki) {
return "image/hej2k";
}
@@ -357,11 +355,9 @@ heif_error heif_has_compatible_filetype(const uint8_t* data, int len)
heif_brand2_jpeg,
heif_brand2_miaf,
heif_brand2_mif1,
- heif_brand2_mif2
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
- , heif_brand2_mif3
-#endif
- ,heif_brand2_msf1,
+ heif_brand2_mif2,
+ heif_brand2_mif3,
+ heif_brand2_msf1,
heif_brand2_isom,
heif_brand2_mp41,
heif_brand2_mp42
diff --git a/libheif/api/libheif/heif_brands.h b/libheif/api/libheif/heif_brands.h
index 85177ced..68cd89f9 100644
--- a/libheif/api/libheif/heif_brands.h
+++ b/libheif/api/libheif/heif_brands.h
@@ -250,7 +250,6 @@ typedef uint32_t heif_brand2;
#define heif_brand2_avci heif_fourcc('a','v','c','i')
#define heif_brand2_avcs heif_fourcc('a','v','c','s')
-//NEWAPI
/**
* Unified ID namespace (`unif`) brand.
*
diff --git a/libheif/api/libheif/heif_context.cc b/libheif/api/libheif/heif_context.cc
index 862195be..04cb516f 100644
--- a/libheif/api/libheif/heif_context.cc
+++ b/libheif/api/libheif/heif_context.cc
@@ -254,9 +254,7 @@ static heif_error heif_file_writer_write(heif_context* ctx,
void heif_context_set_write_mini_format(heif_context* ctx, int enable)
{
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
ctx->context->set_write_mini_format(enable != 0);
-#endif
}
diff --git a/libheif/api/libheif/heif_context.h b/libheif/api/libheif/heif_context.h
index a9d35e9d..0965f539 100644
--- a/libheif/api/libheif/heif_context.h
+++ b/libheif/api/libheif/heif_context.h
@@ -303,7 +303,8 @@ void heif_context_debug_dump_boxes_to_file(heif_context* ctx, int fd);
// When enabled, the output file will use a single 'mini' box instead of the standard
// meta+mdat box structure, if the file content is compatible with the mini format.
// If the content cannot be represented as a mini box, the standard format is used as fallback.
-// Requires ENABLE_EXPERIMENTAL_MINI_FORMAT to be enabled at compile time.
+// Note: the mini box format is defined by a draft amendment to ISO/IEC 23008-12
+// and may have reduced interoperability with other readers.
// Default: disabled.
LIBHEIF_API
void heif_context_set_write_mini_format(heif_context*, int enable);
diff --git a/libheif/api/libheif/heif_error.h b/libheif/api/libheif/heif_error.h
index 85916ba4..c0de48f1 100644
--- a/libheif/api/libheif/heif_error.h
+++ b/libheif/api/libheif/heif_error.h
@@ -191,7 +191,6 @@ typedef enum heif_suberror_code
heif_suberror_No_moov_box = 151,
- //NEWAPI
// The colr (NCLX) box and the codec bitstream VUI/color signalling disagree.
// Per ISO/IEC 14496-12 and ISO/IEC 23000-22 (MIAF) the colr box takes precedence,
// but the conflict is reported as a warning.
diff --git a/libheif/box.cc b/libheif/box.cc
index 49dfc55d..d36f22bf 100644
--- a/libheif/box.cc
+++ b/libheif/box.cc
@@ -752,11 +752,9 @@ Error Box::read(BitstreamRange& range, std::shared_ptr<Box>* result, const heif_
break;
#endif
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
case fourcc("mini"):
box = std::make_shared<Box_mini>();
break;
-#endif
case fourcc("mdat"):
// avoid generating a 'Box_other'
diff --git a/libheif/context.cc b/libheif/context.cc
index c0b7312a..ceb43f14 100644
--- a/libheif/context.cc
+++ b/libheif/context.cc
@@ -522,12 +522,10 @@ std::string HeifContext::debug_dump_item_data() const
}
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
void HeifContext::set_write_mini_format(bool enable)
{
m_heif_file->set_write_mini_format(enable);
}
-#endif
static bool item_type_is_image(uint32_t item_type, const std::string& content_type)
diff --git a/libheif/context.h b/libheif/context.h
index 3976d466..498e0130 100644
--- a/libheif/context.h
+++ b/libheif/context.h
@@ -142,9 +142,7 @@ public:
[[nodiscard]] Error write(StreamWriter& writer);
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
void set_write_mini_format(bool enable);
-#endif
// Create all boxes necessary for an empty HEIF file.
// Note that this is no valid HEIF file, since some boxes (e.g. pitm) are generated, but
diff --git a/libheif/file.cc b/libheif/file.cc
index d7786ef3..460a45a3 100644
--- a/libheif/file.cc
+++ b/libheif/file.cc
@@ -31,9 +31,7 @@
#include "codecs/avif_boxes.h"
#include "codecs/hevc_boxes.h"
#include "sequences/seq_boxes.h"
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
#include "mini.h"
-#endif
#include <cstdint>
#include <fstream>
@@ -258,7 +256,6 @@ void HeifFile::derive_box_versions()
void HeifFile::write(StreamWriter& writer)
{
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
if (m_write_mini_format) {
std::string reason;
if (Box_mini::can_convert_to_mini(this, reason)) {
@@ -289,15 +286,12 @@ void HeifFile::write(StreamWriter& writer)
}
// Fall through to normal write if conversion fails
}
-#endif
for (auto& box : m_top_level_boxes) {
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
if (box == nullptr) {
// Either mini or meta will be null, just ignore that one
continue;
}
-#endif
Error err = box->write(writer);
(void)err; // TODO: error ?
}
@@ -328,12 +322,10 @@ std::string HeifFile::debug_dump_boxes() const
bool first = true;
for (const auto& box : m_top_level_boxes) {
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
if (box == nullptr) {
// Either mini or meta will be null, just ignore that one
continue;
}
-#endif
// dump box content for debugging
if (first) {
@@ -478,9 +470,7 @@ Error HeifFile::parse_heif_file()
!m_ftyp_box->has_compatible_brand(heif_brand2_mif1) &&
!m_ftyp_box->has_compatible_brand(heif_brand2_avif) &&
!m_ftyp_box->has_compatible_brand(heif_brand2_1pic) &&
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
!(m_ftyp_box->get_major_brand() == heif_brand2_mif3) &&
-#endif
!m_ftyp_box->has_compatible_brand(heif_brand2_jpeg) &&
!m_ftyp_box->has_compatible_brand(heif_brand2_isom) &&
!m_ftyp_box->has_compatible_brand(heif_brand2_mp42) &&
@@ -494,7 +484,6 @@ Error HeifFile::parse_heif_file()
sstr.str());
}
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
m_mini_box = m_file_layout->get_mini_box();
m_top_level_boxes.push_back(m_mini_box);
@@ -505,7 +494,6 @@ Error HeifFile::parse_heif_file()
}
return Error::Ok;
}
-#endif
m_meta_box = m_file_layout->get_meta_box();
if (m_meta_box) {
diff --git a/libheif/file.h b/libheif/file.h
index 87e8b95a..a9871884 100644
--- a/libheif/file.h
+++ b/libheif/file.h
@@ -96,10 +96,8 @@ public:
void write(StreamWriter& writer);
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
void set_write_mini_format(bool enable) { m_write_mini_format = enable; }
bool get_write_mini_format() const { return m_write_mini_format; }
-#endif
int get_num_images() const { return static_cast<int>(m_infe_boxes.size()); }
@@ -273,10 +271,8 @@ private:
std::shared_ptr<Box_ftyp> m_ftyp_box;
std::shared_ptr<Box_hdlr> m_hdlr_box;
std::shared_ptr<Box_meta> m_meta_box;
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
std::shared_ptr<Box_mini> m_mini_box; // meta alternative
bool m_write_mini_format = false;
-#endif
std::shared_ptr<Box_iloc> m_iloc_box;
std::shared_ptr<Box_idat> m_idat_box;
diff --git a/libheif/file_layout.cc b/libheif/file_layout.cc
index 4ce83cf6..709aa8ae 100644
--- a/libheif/file_layout.cc
+++ b/libheif/file_layout.cc
@@ -159,7 +159,6 @@ Error FileLayout::read(const std::shared_ptr<StreamReader>& stream, const heif_s
meta_found = true;
}
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
// TODO: this is basically the same as the meta box case above, with different error handling.
if (box_header.get_short_type() == fourcc("mini")) {
const uint64_t mini_box_start = next_box_start;
@@ -195,7 +194,6 @@ Error FileLayout::read(const std::shared_ptr<StreamReader>& stream, const heif_s
mini_found = true;
}
-#endif
if (box_header.get_short_type() == fourcc("moov")) {
const uint64_t moov_box_start = next_box_start;
diff --git a/libheif/file_layout.h b/libheif/file_layout.h
index d7aaf145..c45a624d 100644
--- a/libheif/file_layout.h
+++ b/libheif/file_layout.h
@@ -24,9 +24,7 @@
#include "error.h"
#include "bitstream.h"
#include "box.h"
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
#include "mini.h"
-#endif
#include <memory>
#include <vector>
@@ -61,9 +59,7 @@ public:
std::shared_ptr<Box_meta> get_meta_box() { return m_meta_box; }
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
std::shared_ptr<Box_mini> get_mini_box() { return m_mini_box; }
-#endif
std::shared_ptr<Box_moov> get_moov_box() { return m_moov_box; }
@@ -79,9 +75,7 @@ private:
std::shared_ptr<Box_ftyp> m_ftyp_box;
std::shared_ptr<Box_meta> m_meta_box;
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
std::shared_ptr<Box_mini> m_mini_box;
-#endif
std::shared_ptr<Box_moov> m_moov_box;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4278af8c..c07590c9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -76,12 +76,10 @@ else()
message(INFO "Disabling JPEG 2000 encoder tests because no JPEG 2000 codec is enabled")
endif()
-if (ENABLE_EXPERIMENTAL_MINI_FORMAT)
- if (NOT WITH_REDUCED_VISIBILITY)
- add_libheif_test(mini_box)
- endif()
- add_libheif_test(mini_decode)
+if (NOT WITH_REDUCED_VISIBILITY)
+ add_libheif_test(mini_box)
endif()
+add_libheif_test(mini_decode)
if (NOT WITH_REDUCED_VISIBILITY)
add_libheif_test(omaf_boxes)
diff --git a/tests/component_descriptions.cc b/tests/component_descriptions.cc
index c08b35c5..b6f45b2b 100644
--- a/tests/component_descriptions.cc
+++ b/tests/component_descriptions.cc
@@ -215,11 +215,8 @@ TEST_CASE("unci with cpat: handle and decoded image agree on component IDs")
}
-// The following three test cases load files in the experimental low-overhead MINI box
-// format (lightning_mini.heif, simple_osm_tile_meta.avif, simple_osm_tile_alpha.avif).
-// The mini box is only parsed when ENABLE_EXPERIMENTAL_MINI_FORMAT is compiled in
-// (consistent with mini_box / mini_decode which are CMake-gated the same way).
-#if ENABLE_EXPERIMENTAL_MINI_FORMAT
+// The following three test cases load files in the low-overhead MINI box format
+// (lightning_mini.heif, simple_osm_tile_meta.avif, simple_osm_tile_alpha.avif).
TEST_CASE("HEVC YUV 4:2:0 component IDs match between handle and decoded image")
{
@@ -378,4 +375,3 @@ TEST_CASE("AVIF with alpha: handle exposes alpha as the 4th component")
heif_compression_AV1);
}
-#endif // ENABLE_EXPERIMENTAL_MINI_FORMAT