@@ -37,7 +37,7 @@ extern "C" {
3737#include <stdint.h>
3838
3939//#include <libheif/heif_version.h>
40- #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (17 <<16) | (6 <<8) | 0)
40+ #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (18 <<16) | (1 <<8) | 0)
4141
4242// API versions table
4343//
@@ -232,6 +232,23 @@ enum heif_suberror_code
232232 // Invalid specification of region item
233233 heif_suberror_Invalid_region_data = 136 ,
234234
235+ // Image has no ispe property
236+ heif_suberror_No_ispe_property = 137 ,
237+
238+ heif_suberror_Camera_intrinsic_matrix_undefined = 138 ,
239+
240+ heif_suberror_Camera_extrinsic_matrix_undefined = 139 ,
241+
242+ // Invalid JPEG 2000 codestream - usually a missing marker
243+ heif_suberror_Invalid_J2K_codestream = 140 ,
244+
245+ heif_suberror_No_vvcC_box = 141 ,
246+
247+ // icbr is only needed in some situations, this error is for those cases
248+ heif_suberror_No_icbr_box = 142 ,
249+
250+ // Decompressing generic compression or header compression data failed (e.g. bitstream corruption)
251+ heif_suberror_Decompression_invalid_data = 150 ,
235252
236253 // --- Memory_allocation_error ---
237254
@@ -240,6 +257,9 @@ enum heif_suberror_code
240257 // security limits further.
241258 heif_suberror_Security_limit_exceeded = 1000 ,
242259
260+ // There was an error from the underlying compression / decompression library.
261+ // One possibility is lack of resources (e.g. memory).
262+ heif_suberror_Compression_initialisation_error = 1001 ,
243263
244264 // --- Usage_error ---
245265
@@ -288,6 +308,8 @@ enum heif_suberror_code
288308
289309 heif_suberror_Unsupported_header_compression_method = 3005 ,
290310
311+ // Generically compressed data used an unsupported compression method
312+ heif_suberror_Unsupported_generic_compression_method = 3006 ,
291313
292314 // --- Encoder_plugin_error ---
293315
@@ -307,9 +329,10 @@ enum heif_suberror_code
307329
308330 // --- Plugin loading error ---
309331
310- heif_suberror_Plugin_loading_error = 6000 , // a specific plugin file cannot be loaded
311- heif_suberror_Plugin_is_not_loaded = 6001 , // trying to remove a plugin that is not loaded
312- heif_suberror_Cannot_read_plugin_directory = 6002 // error while scanning the directory for plugins
332+ heif_suberror_Plugin_loading_error = 6000 , // a specific plugin file cannot be loaded
333+ heif_suberror_Plugin_is_not_loaded = 6001 , // trying to remove a plugin that is not loaded
334+ heif_suberror_Cannot_read_plugin_directory = 6002 , // error while scanning the directory for plugins
335+ heif_suberror_No_matching_decoder_installed = 6003 // no decoder found for that compression format
313336};
314337
315338
@@ -411,7 +434,14 @@ enum heif_compression_format
411434 *
412435 * See ISO/IEC 23008-12:2022 Section 6.10.2
413436 */
414- heif_compression_mask = 9
437+ heif_compression_mask = 9 ,
438+ /**
439+ * High Throughput JPEG 2000 (HT-J2K) compression.
440+ *
441+ * The encapsulation of HT-J2K is specified in ISO/IEC 15444-16:2021.
442+ * The core encoding is defined in ISO/IEC 15444-15, or ITU-T T.814.
443+ */
444+ heif_compression_HTJ2K = 10
415445};
416446
417447enum heif_chroma
@@ -567,6 +597,18 @@ enum heif_filetype_result
567597LIBHEIF_API
568598enum heif_filetype_result heif_check_filetype (const uint8_t * data , int len );
569599
600+ /**
601+ * Check the filetype box content for a supported file type.
602+ *
603+ * <p>The data is assumed to start from the start of the `ftyp` box.
604+ *
605+ * <p>This function checks the compatible brands.
606+ *
607+ * @returns heif_error_ok if a supported brand is found, or other error if not.
608+ */
609+ LIBHEIF_API
610+ struct heif_error heif_has_compatible_filetype (const uint8_t * data , int len );
611+
570612LIBHEIF_API
571613int heif_check_jpeg_filetype (const uint8_t * data , int len );
572614
@@ -1371,6 +1413,44 @@ struct heif_error heif_image_get_nclx_color_profile(const struct heif_image* ima
13711413 struct heif_color_profile_nclx * * out_data );
13721414
13731415
1416+ // ------------------------- intrinsic and extrinsic matrices -------------------------
1417+
1418+ struct heif_camera_intrinsic_matrix
1419+ {
1420+ double focal_length_x ;
1421+ double focal_length_y ;
1422+ double principal_point_x ;
1423+ double principal_point_y ;
1424+ double skew ;
1425+ };
1426+
1427+
1428+ LIBHEIF_API
1429+ int heif_image_handle_has_camera_intrinsic_matrix (const struct heif_image_handle * handle );
1430+
1431+ LIBHEIF_API
1432+ struct heif_error heif_image_handle_get_camera_intrinsic_matrix (const struct heif_image_handle * handle ,
1433+ struct heif_camera_intrinsic_matrix * out_matrix );
1434+
1435+
1436+ struct heif_camera_extrinsic_matrix ;
1437+
1438+ LIBHEIF_API
1439+ int heif_image_handle_has_camera_extrinsic_matrix (const struct heif_image_handle * handle );
1440+
1441+ LIBHEIF_API
1442+ struct heif_error heif_image_handle_get_camera_extrinsic_matrix (const struct heif_image_handle * handle ,
1443+ struct heif_camera_extrinsic_matrix * * out_matrix );
1444+
1445+ LIBHEIF_API
1446+ void heif_camera_extrinsic_matrix_release (struct heif_camera_extrinsic_matrix * );
1447+
1448+ LIBHEIF_API
1449+ struct heif_error heif_camera_extrinsic_matrix_get_rotation_matrix (const struct heif_camera_extrinsic_matrix * ,
1450+ double * out_matrix_row_major );
1451+
1452+
1453+
13741454// ========================= heif_image =========================
13751455
13761456// An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
@@ -1714,6 +1794,10 @@ struct heif_error heif_context_write(struct heif_context*,
17141794 struct heif_writer * writer ,
17151795 void * userdata );
17161796
1797+ // Add a compatible brand that is now added automatically by libheif when encoding images (e.g. some application brands like 'geo1').
1798+ LIBHEIF_API
1799+ void heif_context_add_compatible_brand (struct heif_context * ctx ,
1800+ heif_brand2 compatible_brand );
17171801
17181802// ----- encoder -----
17191803
@@ -1904,7 +1988,7 @@ struct heif_error heif_encoder_get_parameter_integer(struct heif_encoder*,
19041988 const char * parameter_name ,
19051989 int * value );
19061990
1907- // TOD-O : name should be changed to heif_encoder_get_valid_integer_parameter_range
1991+ // TO-DO : name should be changed to heif_encoder_get_valid_integer_parameter_range
19081992LIBHEIF_API // DEPRECATED.
19091993struct heif_error heif_encoder_parameter_integer_valid_range (struct heif_encoder * ,
19101994 const char * parameter_name ,
@@ -2019,6 +2103,11 @@ struct heif_encoding_options
20192103 // version 6 options
20202104
20212105 struct heif_color_conversion_options color_conversion_options ;
2106+
2107+ // version 7 options
2108+
2109+ // Set this to true to use compressed form of uncC where possible
2110+ uint8_t prefer_uncC_short_form ;
20222111};
20232112
20242113LIBHEIF_API
@@ -2040,6 +2129,27 @@ struct heif_error heif_context_encode_image(struct heif_context*,
20402129 const struct heif_encoding_options * options ,
20412130 struct heif_image_handle * * out_image_handle );
20422131
2132+ /**
2133+ * @brief Encodes an array of images into a grid.
2134+ *
2135+ * @param ctx The file context
2136+ * @param tiles User allocated array of images that will form the grid.
2137+ * @param rows The number of rows in the grid.
2138+ * @param columns The number of columns in the grid.
2139+ * @param encoder Defines the encoder to use. See heif_context_get_encoder_for_format()
2140+ * @param input_options Optional, may be nullptr.
2141+ * @param out_image_handle Returns a handle to the grid. The caller is responsible for freeing it.
2142+ * @return Returns an error if ctx, tiles, or encoder is nullptr. If rows or columns is 0.
2143+ */
2144+ LIBHEIF_API
2145+ struct heif_error heif_context_encode_grid (struct heif_context * ctx ,
2146+ struct heif_image * * tiles ,
2147+ uint16_t rows ,
2148+ uint16_t columns ,
2149+ struct heif_encoder * encoder ,
2150+ const struct heif_encoding_options * input_options ,
2151+ struct heif_image_handle * * out_image_handle );
2152+
20432153LIBHEIF_API
20442154struct heif_error heif_context_set_primary_image (struct heif_context * ,
20452155 struct heif_image_handle * image_handle );
@@ -2062,9 +2172,12 @@ struct heif_error heif_context_encode_thumbnail(struct heif_context*,
20622172
20632173enum heif_metadata_compression
20642174{
2065- heif_metadata_compression_off ,
2066- heif_metadata_compression_auto ,
2067- heif_metadata_compression_deflate
2175+ heif_metadata_compression_off = 0 ,
2176+ heif_metadata_compression_auto = 1 ,
2177+ heif_metadata_compression_unknown = 2 , // only used when reading unknown method from input file
2178+ heif_metadata_compression_deflate = 3 ,
2179+ heif_metadata_compression_zlib = 4 , // do not use for header data
2180+ heif_metadata_compression_brotli = 5
20682181};
20692182
20702183// Assign 'thumbnail_image' as the thumbnail image of 'master_image'.
@@ -2102,6 +2215,15 @@ struct heif_error heif_context_add_generic_metadata(struct heif_context* ctx,
21022215 const void * data , int size ,
21032216 const char * item_type , const char * content_type );
21042217
2218+ // Add generic metadata with item_type "uri ". Items with this type do not have a content_type, but
2219+ // an item_uri_type and they have no content_encoding (they are always stored uncompressed).
2220+ LIBHEIF_API
2221+ struct heif_error heif_context_add_generic_uri_metadata (struct heif_context * ctx ,
2222+ const struct heif_image_handle * image_handle ,
2223+ const void * data , int size ,
2224+ const char * item_uri_type ,
2225+ heif_item_id * out_item_id );
2226+
21052227// --- heif_image allocation
21062228
21072229/**
0 commit comments