@@ -37,7 +37,7 @@ extern "C" {
37
37
#include <stdint.h>
38
38
39
39
//#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)
41
41
42
42
// API versions table
43
43
//
@@ -232,6 +232,23 @@ enum heif_suberror_code
232
232
// Invalid specification of region item
233
233
heif_suberror_Invalid_region_data = 136 ,
234
234
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 ,
235
252
236
253
// --- Memory_allocation_error ---
237
254
@@ -240,6 +257,9 @@ enum heif_suberror_code
240
257
// security limits further.
241
258
heif_suberror_Security_limit_exceeded = 1000 ,
242
259
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 ,
243
263
244
264
// --- Usage_error ---
245
265
@@ -288,6 +308,8 @@ enum heif_suberror_code
288
308
289
309
heif_suberror_Unsupported_header_compression_method = 3005 ,
290
310
311
+ // Generically compressed data used an unsupported compression method
312
+ heif_suberror_Unsupported_generic_compression_method = 3006 ,
291
313
292
314
// --- Encoder_plugin_error ---
293
315
@@ -307,9 +329,10 @@ enum heif_suberror_code
307
329
308
330
// --- Plugin loading error ---
309
331
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
313
336
};
314
337
315
338
@@ -411,7 +434,14 @@ enum heif_compression_format
411
434
*
412
435
* See ISO/IEC 23008-12:2022 Section 6.10.2
413
436
*/
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
415
445
};
416
446
417
447
enum heif_chroma
@@ -567,6 +597,18 @@ enum heif_filetype_result
567
597
LIBHEIF_API
568
598
enum heif_filetype_result heif_check_filetype (const uint8_t * data , int len );
569
599
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
+
570
612
LIBHEIF_API
571
613
int heif_check_jpeg_filetype (const uint8_t * data , int len );
572
614
@@ -1371,6 +1413,44 @@ struct heif_error heif_image_get_nclx_color_profile(const struct heif_image* ima
1371
1413
struct heif_color_profile_nclx * * out_data );
1372
1414
1373
1415
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
+
1374
1454
// ========================= heif_image =========================
1375
1455
1376
1456
// 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*,
1714
1794
struct heif_writer * writer ,
1715
1795
void * userdata );
1716
1796
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 );
1717
1801
1718
1802
// ----- encoder -----
1719
1803
@@ -1904,7 +1988,7 @@ struct heif_error heif_encoder_get_parameter_integer(struct heif_encoder*,
1904
1988
const char * parameter_name ,
1905
1989
int * value );
1906
1990
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
1908
1992
LIBHEIF_API // DEPRECATED.
1909
1993
struct heif_error heif_encoder_parameter_integer_valid_range (struct heif_encoder * ,
1910
1994
const char * parameter_name ,
@@ -2019,6 +2103,11 @@ struct heif_encoding_options
2019
2103
// version 6 options
2020
2104
2021
2105
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 ;
2022
2111
};
2023
2112
2024
2113
LIBHEIF_API
@@ -2040,6 +2129,27 @@ struct heif_error heif_context_encode_image(struct heif_context*,
2040
2129
const struct heif_encoding_options * options ,
2041
2130
struct heif_image_handle * * out_image_handle );
2042
2131
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
+
2043
2153
LIBHEIF_API
2044
2154
struct heif_error heif_context_set_primary_image (struct heif_context * ,
2045
2155
struct heif_image_handle * image_handle );
@@ -2062,9 +2172,12 @@ struct heif_error heif_context_encode_thumbnail(struct heif_context*,
2062
2172
2063
2173
enum heif_metadata_compression
2064
2174
{
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
2068
2181
};
2069
2182
2070
2183
// 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,
2102
2215
const void * data , int size ,
2103
2216
const char * item_type , const char * content_type );
2104
2217
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
+
2105
2227
// --- heif_image allocation
2106
2228
2107
2229
/**
0 commit comments