@img/sharp-libvips-dev 1.1.0-rc2 → 1.1.0-rc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/include/aom/aom_codec.h +18 -1
  2. package/include/aom/aom_encoder.h +2 -0
  3. package/include/aom/aom_image.h +3 -1
  4. package/include/aom/aomcx.h +52 -12
  5. package/include/cairo/cairo-version.h +1 -1
  6. package/include/expat.h +4 -2
  7. package/include/expat_config.h +3 -3
  8. package/include/ffi.h +1 -1
  9. package/include/fontconfig/fontconfig.h +22 -2
  10. package/include/gio-unix-2.0/gio/gdesktopappinfo.h +1 -1
  11. package/include/gio-unix-2.0/gio/gunixmounts.h +95 -23
  12. package/include/glib-2.0/gio/gdbusconnection.h +65 -5
  13. package/include/glib-2.0/gio/gdebugcontroller.h +1 -1
  14. package/include/glib-2.0/gio/gfile.h +4 -0
  15. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  16. package/include/glib-2.0/gio/gioenums.h +14 -3
  17. package/include/glib-2.0/gio/gioenumtypes.h +3 -3
  18. package/include/glib-2.0/gio/giotypes.h +4 -4
  19. package/include/glib-2.0/gio/gmemorymonitor.h +1 -1
  20. package/include/glib-2.0/gio/gnetworkmonitor.h +1 -1
  21. package/include/glib-2.0/gio/gpowerprofilemonitor.h +1 -1
  22. package/include/glib-2.0/gio/gproxy.h +1 -1
  23. package/include/glib-2.0/gio/gproxyresolver.h +1 -1
  24. package/include/glib-2.0/gio/gresource.h +6 -0
  25. package/include/glib-2.0/gio/gtlsbackend.h +1 -1
  26. package/include/glib-2.0/gio/gvfs.h +3 -3
  27. package/include/glib-2.0/gio/gvolumemonitor.h +1 -1
  28. package/include/glib-2.0/girepository/gi-visibility.h +34 -0
  29. package/include/glib-2.0/girepository/gicallableinfo.h +12 -0
  30. package/include/glib-2.0/girepository/gitypes.h +1 -0
  31. package/include/glib-2.0/glib/garray.h +1 -1
  32. package/include/glib-2.0/glib/gerror.h +1 -1
  33. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  34. package/include/glib-2.0/glib/gmacros.h +3 -3
  35. package/include/glib-2.0/glib/gmain.h +79 -1
  36. package/include/glib-2.0/glib/gmem.h +3 -0
  37. package/include/glib-2.0/glib/goption.h +58 -36
  38. package/include/glib-2.0/glib/gqueue.h +1 -1
  39. package/include/glib-2.0/glib/grefstring.h +4 -0
  40. package/include/glib-2.0/glib/gstdio.h +65 -0
  41. package/include/glib-2.0/glib/gstrfuncs.h +4 -0
  42. package/include/glib-2.0/glib/gtestutils.h +65 -33
  43. package/include/glib-2.0/glib/gthread.h +2 -0
  44. package/include/glib-2.0/glib/gtypes.h +1 -1
  45. package/include/glib-2.0/glib/gunicode.h +21 -5
  46. package/include/glib-2.0/glib/gvariant.h +50 -13
  47. package/include/glib-2.0/glib/gvarianttype.h +62 -46
  48. package/include/glib-2.0/glib/gversionmacros.h +9 -0
  49. package/include/glib-2.0/glib-unix.h +21 -0
  50. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  51. package/include/glib-2.0/gobject/glib-enumtypes.h +1 -1
  52. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  53. package/include/glib-2.0/gobject/gobjectnotifyqueue.c +1 -1
  54. package/include/glib-2.0/gobject/gparam.h +4 -2
  55. package/include/glib-2.0/gobject/gsignal.h +22 -7
  56. package/include/glib-2.0/gobject/gtype.h +10 -4
  57. package/include/harfbuzz/hb-draw.h +1 -1
  58. package/include/harfbuzz/hb-face.h +15 -2
  59. package/include/harfbuzz/hb-ft.h +11 -1
  60. package/include/harfbuzz/hb-ot-shape.h +6 -0
  61. package/include/harfbuzz/hb-paint.h +1 -1
  62. package/include/harfbuzz/hb-shape.h +2 -0
  63. package/include/harfbuzz/hb-subset-serialize.h +83 -0
  64. package/include/harfbuzz/hb-subset.h +12 -0
  65. package/include/harfbuzz/hb-version.h +3 -3
  66. package/include/lcms2.h +7 -5
  67. package/include/lcms2_plugin.h +1 -1
  68. package/include/libexif/exif-byte-order.h +2 -0
  69. package/include/libexif/exif-content.h +2 -0
  70. package/include/libexif/exif-data-type.h +2 -0
  71. package/include/libexif/exif-data.h +3 -2
  72. package/include/libexif/exif-entry.h +2 -0
  73. package/include/libexif/exif-format.h +2 -0
  74. package/include/libexif/exif-ifd.h +2 -0
  75. package/include/libexif/exif-loader.h +2 -0
  76. package/include/libexif/exif-log.h +2 -0
  77. package/include/libexif/exif-mem.h +2 -0
  78. package/include/libexif/exif-mnote-data.h +2 -0
  79. package/include/libexif/exif-tag.h +2 -0
  80. package/include/libexif/exif-utils.h +2 -0
  81. package/include/libheif/heif.h +328 -26
  82. package/include/libheif/heif_cxx.h +18 -12
  83. package/include/libheif/heif_items.h +2 -2
  84. package/include/libheif/heif_properties.h +24 -4
  85. package/include/libheif/heif_version.h +2 -2
  86. package/include/libpng16/png.h +120 -12
  87. package/include/libpng16/pngconf.h +2 -3
  88. package/include/libpng16/pnglibconf.h +11 -2
  89. package/include/librsvg-2.0/librsvg/rsvg-features.h +1 -1
  90. package/include/librsvg-2.0/librsvg/rsvg-pixbuf.h +1 -1
  91. package/include/librsvg-2.0/librsvg/rsvg-version.h +2 -2
  92. package/include/librsvg-2.0/librsvg/rsvg.h +1 -1
  93. package/include/libxml2/libxml/xmlversion.h +4 -4
  94. package/include/pango-1.0/pango/pango-features.h +3 -3
  95. package/include/pango-1.0/pango/pango-font.h +31 -2
  96. package/include/pango-1.0/pango/pango-fontmap.h +4 -0
  97. package/include/pango-1.0/pango/pango-layout.h +10 -1
  98. package/include/pango-1.0/pango/pango-version-macros.h +52 -0
  99. package/include/pango-1.0/pango/pangofc-fontmap.h +6 -0
  100. package/include/pixman-1/pixman-version.h +3 -3
  101. package/include/png.h +120 -12
  102. package/include/pngconf.h +2 -3
  103. package/include/pnglibconf.h +11 -2
  104. package/include/vips/colour.h +2 -0
  105. package/include/vips/version.h +4 -4
  106. package/include/webp/encode.h +5 -4
  107. package/include/webp/sharpyuv/sharpyuv.h +14 -5
  108. package/include/webp/sharpyuv/sharpyuv_csp.h +5 -0
  109. package/include/webp/types.h +2 -2
  110. package/include/zlib.h +4 -4
  111. package/package.json +1 -1
  112. package/versions.json +19 -19
@@ -20,6 +20,8 @@
20
20
  * License along with this library; if not, write to the
21
21
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
22
  * Boston, MA 02110-1301 USA.
23
+ *
24
+ * SPDX-License-Identifier: LGPL-2.0-or-later
23
25
  */
24
26
 
25
27
  #ifndef LIBEXIF_EXIF_MEM_H
@@ -18,6 +18,8 @@
18
18
  * License along with this library; if not, write to the
19
19
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
20
  * Boston, MA 02110-1301 USA.
21
+ *
22
+ * SPDX-License-Identifier: LGPL-2.0-or-later
21
23
  */
22
24
 
23
25
  #ifndef LIBEXIF_EXIF_MNOTE_DATA_H
@@ -18,6 +18,8 @@
18
18
  * License along with this library; if not, write to the
19
19
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
20
  * Boston, MA 02110-1301 USA.
21
+ *
22
+ * SPDX-License-Identifier: LGPL-2.0-or-later
21
23
  */
22
24
 
23
25
  #ifndef LIBEXIF_EXIF_TAG_H
@@ -18,6 +18,8 @@
18
18
  * License along with this library; if not, write to the
19
19
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
20
  * Boston, MA 02110-1301 USA.
21
+ *
22
+ * SPDX-License-Identifier: LGPL-2.0-or-later
21
23
  */
22
24
 
23
25
  #ifndef LIBEXIF_EXIF_UTILS_H
@@ -52,8 +52,10 @@ extern "C" {
52
52
  // 1.14 3 5 1 1 1 1
53
53
  // 1.15 4 5 1 1 1 1
54
54
  // 1.16 5 6 1 1 1 1
55
+ // 1.18 5 7 1 1 1 1
56
+ // 1.19 6 7 2 1 1 1
55
57
 
56
- #if defined(_MSC_VER) && !defined(LIBHEIF_STATIC_BUILD)
58
+ #if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
57
59
  #ifdef LIBHEIF_EXPORTS
58
60
  #define LIBHEIF_API __declspec(dllexport)
59
61
  #else
@@ -133,7 +135,10 @@ enum heif_error_code
133
135
  heif_error_Color_profile_does_not_exist = 10,
134
136
 
135
137
  // Error loading a dynamic plugin
136
- heif_error_Plugin_loading_error = 11
138
+ heif_error_Plugin_loading_error = 11,
139
+
140
+ // Operation has been canceled
141
+ heif_error_Canceled = 12
137
142
  };
138
143
 
139
144
 
@@ -244,6 +249,11 @@ enum heif_suberror_code
244
249
  // icbr is only needed in some situations, this error is for those cases
245
250
  heif_suberror_No_icbr_box = 142,
246
251
 
252
+ heif_suberror_No_avcC_box = 143,
253
+
254
+ // we got a mini box, but could not read it properly
255
+ heif_suberror_Invalid_mini_box = 149,
256
+
247
257
  // Decompressing generic compression or header compression data failed (e.g. bitstream corruption)
248
258
  heif_suberror_Decompression_invalid_data = 150,
249
259
 
@@ -308,6 +318,8 @@ enum heif_suberror_code
308
318
  // Generically compressed data used an unsupported compression method
309
319
  heif_suberror_Unsupported_generic_compression_method = 3006,
310
320
 
321
+ heif_suberror_Unsupported_essential_property = 3007,
322
+
311
323
  // --- Encoder_plugin_error ---
312
324
 
313
325
  heif_suberror_Unsupported_bit_depth = 4000,
@@ -398,7 +410,7 @@ enum heif_compression_format
398
410
  */
399
411
  heif_compression_AV1 = 4,
400
412
  /**
401
- * VVC compression. (Currently unused in libheif.)
413
+ * VVC compression.
402
414
  *
403
415
  * The compression format is defined in ISO/IEC 23090-3. This is equivalent to H.266.
404
416
  *
@@ -408,7 +420,7 @@ enum heif_compression_format
408
420
  /**
409
421
  * EVC compression. (Currently unused in libheif.)
410
422
  *
411
- * The compression format is defined in ISO/IEC 23094-1. This is equivalent to H.266.
423
+ * The compression format is defined in ISO/IEC 23094-1.
412
424
  *
413
425
  * The encapsulation is defined in ISO/IEC 23008-12:2022 Annex M.
414
426
  */
@@ -423,7 +435,7 @@ enum heif_compression_format
423
435
  /**
424
436
  * Uncompressed encoding.
425
437
  *
426
- * This is defined in ISO/IEC 23001-17:2023 (Final Draft International Standard).
438
+ * This is defined in ISO/IEC 23001-17:2024.
427
439
  */
428
440
  heif_compression_uncompressed = 8,
429
441
  /**
@@ -482,7 +494,10 @@ enum heif_colorspace
482
494
  heif_colorspace_RGB = 1,
483
495
 
484
496
  // heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_monochrome
485
- heif_colorspace_monochrome = 2
497
+ heif_colorspace_monochrome = 2,
498
+
499
+ // Indicates that this image has no visual channels.
500
+ heif_colorspace_nonvisual = 3
486
501
  };
487
502
 
488
503
  enum heif_channel
@@ -494,9 +509,21 @@ enum heif_channel
494
509
  heif_channel_G = 4,
495
510
  heif_channel_B = 5,
496
511
  heif_channel_Alpha = 6,
497
- heif_channel_interleaved = 10
512
+ heif_channel_interleaved = 10,
513
+ heif_channel_filter_array = 11,
514
+ heif_channel_depth = 12,
515
+ heif_channel_disparity = 13
498
516
  };
499
517
 
518
+ enum heif_metadata_compression
519
+ {
520
+ heif_metadata_compression_off = 0,
521
+ heif_metadata_compression_auto = 1,
522
+ heif_metadata_compression_unknown = 2, // only used when reading unknown method from input file
523
+ heif_metadata_compression_deflate = 3,
524
+ heif_metadata_compression_zlib = 4, // do not use for header data
525
+ heif_metadata_compression_brotli = 5
526
+ };
500
527
 
501
528
  // ========================= library initialization ======================
502
529
 
@@ -536,6 +563,10 @@ struct heif_error heif_init(struct heif_init_params*);
536
563
  * You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
537
564
  * These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
538
565
  *
566
+ * Note: heif_deinit() must not be called after exit(), for example in a global C++ object's destructor.
567
+ * If you do, global variables in libheif might have already been released when heif_deinit() is running,
568
+ * leading to a crash.
569
+ *
539
570
  * \sa heif_init()
540
571
  */
541
572
  LIBHEIF_API
@@ -749,6 +780,13 @@ typedef uint32_t heif_brand2;
749
780
  */
750
781
  #define heif_brand2_mif2 heif_fourcc('m','i','f','2')
751
782
 
783
+ /**
784
+ * HEIF image structural brand (`mif3`).
785
+ *
786
+ * This indicates the low-overhead (ftyp+mini) structure.
787
+ */
788
+ #define heif_brand2_mif3 heif_fourcc('m','i','f','3')
789
+
752
790
  /**
753
791
  * HEIF image sequence structural brand (`msf1`).
754
792
  *
@@ -850,6 +888,10 @@ typedef uint32_t heif_brand2;
850
888
  LIBHEIF_API
851
889
  heif_brand2 heif_read_main_brand(const uint8_t* data, int len);
852
890
 
891
+ // input data should be at least 16 bytes
892
+ LIBHEIF_API
893
+ heif_brand2 heif_read_minor_version_brand(const uint8_t* data, int len);
894
+
853
895
  // 'brand_fourcc' must be 4 character long, but need not be 0-terminated
854
896
  LIBHEIF_API
855
897
  heif_brand2 heif_fourcc_to_brand(const char* brand_fourcc);
@@ -912,15 +954,33 @@ LIBHEIF_API
912
954
  void heif_context_free(struct heif_context*);
913
955
 
914
956
 
957
+
915
958
  struct heif_reading_options;
916
959
 
917
960
  enum heif_reader_grow_status
918
961
  {
919
- heif_reader_grow_status_size_reached, // requested size has been reached, we can read until this point
920
- heif_reader_grow_status_timeout, // size has not been reached yet, but it may still grow further
921
- heif_reader_grow_status_size_beyond_eof // size has not been reached and never will. The file has grown to its full size
962
+ heif_reader_grow_status_size_reached, // requested size has been reached, we can read until this point
963
+ heif_reader_grow_status_timeout, // size has not been reached yet, but it may still grow further (deprecated)
964
+ heif_reader_grow_status_size_beyond_eof, // size has not been reached and never will. The file has grown to its full size
965
+ heif_reader_grow_status_error // an error has occurred
922
966
  };
923
967
 
968
+ struct heif_reader_range_request_result
969
+ {
970
+ enum heif_reader_grow_status status; // should not return 'heif_reader_grow_status_timeout'
971
+
972
+ // Indicates up to what position the file has been read.
973
+ // If we cannot read the whole file range (status == 'heif_reader_grow_status_size_beyond_eof'), this is the actual end position.
974
+ // On the other hand, it may be that the reader was reading more data than requested. In that case, it should indicate the full size here
975
+ // and libheif may decide to make use of the additional data (e.g. for filling 'tili' offset tables).
976
+ uint64_t range_end;
977
+
978
+ // for status == 'heif_reader_grow_status_error'
979
+ int reader_error_code; // a reader specific error code
980
+ const char* reader_error_msg; // libheif will call heif_reader.release_error_msg on this if it is not NULL
981
+ };
982
+
983
+
924
984
  struct heif_reader
925
985
  {
926
986
  // API version supported by this reader
@@ -929,7 +989,7 @@ struct heif_reader
929
989
  // --- version 1 functions ---
930
990
  int64_t (* get_position)(void* userdata);
931
991
 
932
- // The functions read(), and seek() return heif_error_ok on success.
992
+ // The functions read(), and seek() return 0 on success.
933
993
  // Generally, libheif will make sure that we do not read past the file size.
934
994
  int (* read)(void* data,
935
995
  size_t size,
@@ -947,6 +1007,47 @@ struct heif_reader
947
1007
  // detection whether the target_size is above the (fixed) file length
948
1008
  // (in this case, return 'size_beyond_eof').
949
1009
  enum heif_reader_grow_status (* wait_for_file_size)(int64_t target_size, void* userdata);
1010
+
1011
+ // --- version 2 functions ---
1012
+
1013
+ // These two functions are for applications that want to stream HEIF files on demand.
1014
+ // For example, a large HEIF file that is served over HTTPS and we only want to download
1015
+ // it partially to decode individual tiles.
1016
+ // If you do not have this use case, you do not have to implement these functions and
1017
+ // you can set them to NULL. For simple linear loading, you may use the 'wait_for_file_size'
1018
+ // function above instead.
1019
+
1020
+ // If this function is defined, libheif will often request a file range before accessing it.
1021
+ // The purpose of this function is that libheif will usually read very small chunks of data with the
1022
+ // read() callback above. However, it is inefficient to request such a small chunk of data over a network
1023
+ // and the network delay will significantly increase the decoding time.
1024
+ // Thus, libheif will call request_range() with a larger block of data that should be preloaded and the
1025
+ // subsequent read() calls will work within the requested ranges.
1026
+ //
1027
+ // Note: `end_pos` is one byte after the last position to be read.
1028
+ // You should return
1029
+ // - 'heif_reader_grow_status_size_reached' if the requested range is available, or
1030
+ // - 'heif_reader_grow_status_size_beyond_eof' if the requested range exceeds the file size
1031
+ // (the valid part of the range has been read).
1032
+ struct heif_reader_range_request_result (*request_range)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1033
+
1034
+ // libheif might issue hints when it assumes that a file range might be needed in the future.
1035
+ // This may happen, for example, when your are doing selective tile accesses and libheif proposes
1036
+ // to preload offset pointer tables.
1037
+ // Another difference to request_file_range() is that this call should be non-blocking.
1038
+ // If you preload any data, do this in a background thread.
1039
+ void (*preload_range_hint)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1040
+
1041
+ // If libheif does not need access to a file range anymore, it may call this function to
1042
+ // give a hint to the reader that it may release the range from a cache.
1043
+ // If you do not maintain a file cache that wants to reduce its size dynamically, you do not
1044
+ // need to implement this function.
1045
+ void (*release_file_range)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1046
+
1047
+ // Release an error message that was returned by heif_reader in an earlier call.
1048
+ // If this function is NULL, the error message string will not be released.
1049
+ // This is a viable option if you are only returning static strings.
1050
+ void (*release_error_msg)(const char* msg);
950
1051
  };
951
1052
 
952
1053
 
@@ -1015,6 +1116,9 @@ LIBHEIF_API
1015
1116
  void heif_context_debug_dump_boxes_to_file(struct heif_context* ctx, int fd);
1016
1117
 
1017
1118
 
1119
+ // Set the maximum image size security limit. This function will set the maximum image area (number of pixels)
1120
+ // to maximum_width ^ 2. Alternatively to using this function, you can also set the maximum image area
1121
+ // in the security limits structure returned by heif_context_get_security_limits().
1018
1122
  LIBHEIF_API
1019
1123
  void heif_context_set_maximum_image_size_limit(struct heif_context* ctx, int maximum_width);
1020
1124
 
@@ -1027,6 +1131,53 @@ LIBHEIF_API
1027
1131
  void heif_context_set_max_decoding_threads(struct heif_context* ctx, int max_threads);
1028
1132
 
1029
1133
 
1134
+ // --- security limits
1135
+
1136
+ // If you set a limit to 0, the limit is disabled.
1137
+ struct heif_security_limits {
1138
+ uint8_t version;
1139
+
1140
+ // --- version 1
1141
+
1142
+ // Limit on the maximum image size to avoid allocating too much memory.
1143
+ // For example, setting this to 32768^2 pixels = 1 Gigapixels results
1144
+ // in 1.5 GB memory need for YUV-4:2:0 or 4 GB for RGB32.
1145
+ uint64_t max_image_size_pixels;
1146
+ uint64_t max_number_of_tiles;
1147
+ uint32_t max_bayer_pattern_pixels;
1148
+ uint32_t max_items;
1149
+
1150
+ uint32_t max_color_profile_size;
1151
+ uint64_t max_memory_block_size;
1152
+
1153
+ uint32_t max_components;
1154
+
1155
+ uint32_t max_iloc_extents_per_item;
1156
+ uint32_t max_size_entity_group;
1157
+
1158
+ uint32_t max_children_per_box; // for all boxes that are not covered by other limits
1159
+ };
1160
+
1161
+ // The global security limits are the default for new heif_contexts.
1162
+ // These global limits cannot be changed, but you can override the limits for a specific heif_context.
1163
+ LIBHEIF_API
1164
+ const struct heif_security_limits* heif_get_global_security_limits();
1165
+
1166
+ // Returns a set of fully disabled security limits. Use with care and only after user confirmation.
1167
+ LIBHEIF_API
1168
+ const struct heif_security_limits* heif_get_disabled_security_limits();
1169
+
1170
+ // Returns the security limits for a heif_context.
1171
+ // By default, the limits are set to the global limits, but you can change them in the returned object.
1172
+ LIBHEIF_API
1173
+ struct heif_security_limits* heif_context_get_security_limits(const struct heif_context*);
1174
+
1175
+ // Overwrites the security limits of a heif_context.
1176
+ // This is a convenience function to easily copy limits.
1177
+ LIBHEIF_API
1178
+ struct heif_error heif_context_set_security_limits(struct heif_context*, const struct heif_security_limits*);
1179
+
1180
+
1030
1181
  // ========================= heif_image_handle =========================
1031
1182
 
1032
1183
  // An heif_image_handle is a handle to a logical image in the HEIF file.
@@ -1062,17 +1213,21 @@ LIBHEIF_API
1062
1213
  int heif_image_handle_is_premultiplied_alpha(const struct heif_image_handle*);
1063
1214
 
1064
1215
  // Returns -1 on error, e.g. if this information is not present in the image.
1216
+ // Only defined for images coded in the YCbCr or monochrome colorspace.
1065
1217
  LIBHEIF_API
1066
1218
  int heif_image_handle_get_luma_bits_per_pixel(const struct heif_image_handle*);
1067
1219
 
1068
1220
  // Returns -1 on error, e.g. if this information is not present in the image.
1221
+ // Only defined for images coded in the YCbCr colorspace.
1069
1222
  LIBHEIF_API
1070
1223
  int heif_image_handle_get_chroma_bits_per_pixel(const struct heif_image_handle*);
1071
1224
 
1072
1225
  // Return the colorspace that libheif proposes to use for decoding.
1073
1226
  // Usually, these will be either YCbCr or Monochrome, but it may also propose RGB for images
1074
- // encoded with matrix_coefficients=0.
1227
+ // encoded with matrix_coefficients=0 or for images coded natively in RGB.
1075
1228
  // It may also return *_undefined if the file misses relevant information to determine this without decoding.
1229
+ // These are only proposed values that avoid colorspace conversions as much as possible.
1230
+ // You can still request the output in your preferred colorspace, but this may involve an internal conversion.
1076
1231
  LIBHEIF_API
1077
1232
  struct heif_error heif_image_handle_get_preferred_decoding_colorspace(const struct heif_image_handle* image_handle,
1078
1233
  enum heif_colorspace* out_colorspace,
@@ -1099,6 +1254,86 @@ LIBHEIF_API
1099
1254
  struct heif_context* heif_image_handle_get_context(const struct heif_image_handle* handle);
1100
1255
 
1101
1256
 
1257
+ struct heif_image_tiling
1258
+ {
1259
+ int version;
1260
+
1261
+ // --- version 1
1262
+
1263
+ uint32_t num_columns;
1264
+ uint32_t num_rows;
1265
+ uint32_t tile_width;
1266
+ uint32_t tile_height;
1267
+
1268
+ uint32_t image_width;
1269
+ uint32_t image_height;
1270
+
1271
+ // Position of the top left tile.
1272
+ // Usually, this is (0;0), but if a tiled image is rotated or cropped, it may be that the top left tile should be placed at a negative position.
1273
+ // The offsets define this negative shift.
1274
+ uint32_t top_offset;
1275
+ uint32_t left_offset;
1276
+
1277
+ uint8_t number_of_extra_dimensions; // 0 for normal images, 1 for volumetric (3D), ...
1278
+ uint32_t extra_dimension_size[8]; // size of extra dimensions (first 8 dimensions)
1279
+ };
1280
+
1281
+
1282
+ // If 'process_image_transformations' is true, this returns modified sizes.
1283
+ // If it is false, the top_offset and left_offset will always be (0;0).
1284
+ LIBHEIF_API
1285
+ struct heif_error heif_image_handle_get_image_tiling(const struct heif_image_handle* handle, int process_image_transformations, struct heif_image_tiling* out_tiling);
1286
+
1287
+
1288
+ // For grid images, return the image item ID of a specific grid tile.
1289
+ // If 'process_image_transformations' is true, the tile positions are given in the transformed image coordinate system and
1290
+ // are internally mapped to the original image tile positions.
1291
+ LIBHEIF_API
1292
+ struct heif_error heif_image_handle_get_grid_image_tile_id(const struct heif_image_handle* handle,
1293
+ int process_image_transformations,
1294
+ uint32_t tile_x, uint32_t tile_y,
1295
+ heif_item_id* out_tile_item_id);
1296
+
1297
+
1298
+ struct heif_decoding_options;
1299
+
1300
+ // The tile position is given in tile indices, not in pixel coordinates.
1301
+ // If the image transformations are processed (option->ignore_image_transformations==false), the tile position
1302
+ // is given in the transformed coordinates.
1303
+ LIBHEIF_API
1304
+ struct heif_error heif_image_handle_decode_image_tile(const struct heif_image_handle* in_handle,
1305
+ struct heif_image** out_img,
1306
+ enum heif_colorspace colorspace,
1307
+ enum heif_chroma chroma,
1308
+ const struct heif_decoding_options* options,
1309
+ uint32_t tile_x, uint32_t tile_y);
1310
+
1311
+
1312
+ // ------------------------- entity groups ------------------------
1313
+
1314
+ typedef uint32_t heif_entity_group_id;
1315
+
1316
+ struct heif_entity_group
1317
+ {
1318
+ heif_entity_group_id entity_group_id;
1319
+ uint32_t entity_group_type; // this is a FourCC constant
1320
+ heif_item_id* entities;
1321
+ uint32_t num_entities;
1322
+ };
1323
+
1324
+ // Use 0 for `type_filter` or `item_filter` to disable the filter.
1325
+ // Returns an array of heif_entity_group structs with *out_num_groups entries.
1326
+ LIBHEIF_API
1327
+ struct heif_entity_group* heif_context_get_entity_groups(const struct heif_context*,
1328
+ uint32_t type_filter,
1329
+ heif_item_id item_filter,
1330
+ int* out_num_groups);
1331
+
1332
+ // Release an array of entity groups returned by heif_context_get_entity_groups().
1333
+ LIBHEIF_API
1334
+ void heif_entity_groups_release(struct heif_entity_group*, int num_groups);
1335
+
1336
+
1102
1337
  // ------------------------- depth images -------------------------
1103
1338
 
1104
1339
  LIBHEIF_API
@@ -1394,13 +1629,17 @@ struct heif_color_profile_nclx* heif_nclx_color_profile_alloc(void);
1394
1629
  LIBHEIF_API
1395
1630
  void heif_nclx_color_profile_free(struct heif_color_profile_nclx* nclx_profile);
1396
1631
 
1397
-
1632
+ // Note: in early versions of HEIF, there could only be one color profile per image. However, this has been changed.
1633
+ // This function will now return ICC if one is present and NCLX only if there is no ICC.
1634
+ // You may better avoid this function and simply query for NCLX and ICC directly.
1398
1635
  LIBHEIF_API
1399
1636
  enum heif_color_profile_type heif_image_get_color_profile_type(const struct heif_image* image);
1400
1637
 
1638
+ // Returns the size of the ICC profile if one is assigned to the image. Otherwise, it returns 0.
1401
1639
  LIBHEIF_API
1402
1640
  size_t heif_image_get_raw_color_profile_size(const struct heif_image* image);
1403
1641
 
1642
+ // Returns the ICC profile if one is assigned to the image. Otherwise, it returns an error.
1404
1643
  LIBHEIF_API
1405
1644
  struct heif_error heif_image_get_raw_color_profile(const struct heif_image* image,
1406
1645
  void* out_data);
@@ -1482,8 +1721,10 @@ enum heif_chroma_upsampling_algorithm
1482
1721
  heif_chroma_upsampling_bilinear = 2
1483
1722
  };
1484
1723
 
1724
+
1485
1725
  struct heif_color_conversion_options
1486
1726
  {
1727
+ // 'version' must be 1.
1487
1728
  uint8_t version;
1488
1729
 
1489
1730
  // --- version 1 options
@@ -1498,8 +1739,15 @@ struct heif_color_conversion_options
1498
1739
  // Set this field to 'true' if you want to make sure that the specified algorithm is used even
1499
1740
  // at the cost of slightly higher computation times.
1500
1741
  uint8_t only_use_preferred_chroma_algorithm;
1742
+
1743
+ // --- Note that we cannot extend this struct because it is embedded in
1744
+ // other structs (heif_decoding_options and heif_encoding_options).
1501
1745
  };
1502
1746
 
1747
+ // Assumes that it is a version=1 struct.
1748
+ LIBHEIF_API
1749
+ void heif_color_conversion_options_set_defaults(struct heif_color_conversion_options*);
1750
+
1503
1751
 
1504
1752
  struct heif_decoding_options
1505
1753
  {
@@ -1511,6 +1759,7 @@ struct heif_decoding_options
1511
1759
  // Default: false (do not ignore).
1512
1760
  uint8_t ignore_transformations;
1513
1761
 
1762
+ // Any of the progress functions may be called from background threads.
1514
1763
  void (* start_progress)(enum heif_progress_step step, int max_progress, void* progress_user_data);
1515
1764
 
1516
1765
  void (* on_progress)(enum heif_progress_step step, int progress, void* progress_user_data);
@@ -1536,10 +1785,13 @@ struct heif_decoding_options
1536
1785
  // The priority is defined in the plugin.
1537
1786
  const char* decoder_id;
1538
1787
 
1539
-
1540
1788
  // version 5 options
1541
1789
 
1542
1790
  struct heif_color_conversion_options color_conversion_options;
1791
+
1792
+ // version 6 options
1793
+
1794
+ int (* cancel_decoding)(void* progress_user_data);
1543
1795
  };
1544
1796
 
1545
1797
 
@@ -1629,7 +1881,6 @@ struct heif_error heif_image_crop(struct heif_image* img,
1629
1881
  LIBHEIF_API
1630
1882
  int heif_image_get_bits_per_pixel(const struct heif_image*, enum heif_channel channel);
1631
1883
 
1632
-
1633
1884
  // Get the number of bits per pixel in the given image channel. This function returns
1634
1885
  // the number of bits used for representing the pixel value, which might be smaller
1635
1886
  // than the number of bits used in memory.
@@ -1646,6 +1897,7 @@ int heif_image_has_channel(const struct heif_image*, enum heif_channel channel);
1646
1897
  // The 'out_stride' is returned as "bytes per line".
1647
1898
  // When out_stride is NULL, no value will be written.
1648
1899
  // Returns NULL if a non-existing channel was given.
1900
+ // TODO: it would be better if the 'stride' parameter would be size_t to prevent integer overflows when this value is multiplicated with large y coordinates.
1649
1901
  LIBHEIF_API
1650
1902
  const uint8_t* heif_image_get_plane_readonly(const struct heif_image*,
1651
1903
  enum heif_channel channel,
@@ -1657,6 +1909,7 @@ uint8_t* heif_image_get_plane(struct heif_image*,
1657
1909
  int* out_stride);
1658
1910
 
1659
1911
 
1912
+
1660
1913
  struct heif_scaling_options;
1661
1914
 
1662
1915
  // Currently, heif_scaling_options is not defined yet. Pass a NULL pointer.
@@ -1666,6 +1919,12 @@ struct heif_error heif_image_scale_image(const struct heif_image* input,
1666
1919
  int width, int height,
1667
1920
  const struct heif_scaling_options* options);
1668
1921
 
1922
+ // Extends the image size to match the given size by extending the right and bottom borders.
1923
+ // The border areas are filled with zero.
1924
+ LIBHEIF_API
1925
+ struct heif_error heif_image_extend_to_size_fill_with_zero(struct heif_image* image,
1926
+ uint32_t width, uint32_t height);
1927
+
1669
1928
  // The color profile is not attached to the image handle because we might need it
1670
1929
  // for color space transform and encoding.
1671
1930
  LIBHEIF_API
@@ -1719,6 +1978,10 @@ int heif_image_has_content_light_level(const struct heif_image*);
1719
1978
  LIBHEIF_API
1720
1979
  void heif_image_get_content_light_level(const struct heif_image*, struct heif_content_light_level* out);
1721
1980
 
1981
+ // Returns whether the image has 'content light level' information. If 0 is returned, the output is not filled.
1982
+ LIBHEIF_API
1983
+ int heif_image_handle_get_content_light_level(const struct heif_image_handle*, struct heif_content_light_level* out);
1984
+
1722
1985
  LIBHEIF_API
1723
1986
  void heif_image_set_content_light_level(const struct heif_image*, const struct heif_content_light_level* in);
1724
1987
 
@@ -1745,15 +2008,27 @@ struct heif_decoded_mastering_display_colour_volume
1745
2008
  double min_display_mastering_luminance;
1746
2009
  };
1747
2010
 
2011
+ struct heif_ambient_viewing_environment
2012
+ {
2013
+ uint32_t ambient_illumination;
2014
+ uint16_t ambient_light_x;
2015
+ uint16_t ambient_light_y;
2016
+ };
2017
+
1748
2018
  LIBHEIF_API
1749
2019
  int heif_image_has_mastering_display_colour_volume(const struct heif_image*);
1750
2020
 
1751
2021
  LIBHEIF_API
1752
2022
  void heif_image_get_mastering_display_colour_volume(const struct heif_image*, struct heif_mastering_display_colour_volume* out);
1753
2023
 
2024
+ // Returns whether the image has 'mastering display colour volume' information. If 0 is returned, the output is not filled.
2025
+ LIBHEIF_API
2026
+ int heif_image_handle_get_mastering_display_colour_volume(const struct heif_image_handle*, struct heif_mastering_display_colour_volume* out);
2027
+
1754
2028
  LIBHEIF_API
1755
2029
  void heif_image_set_mastering_display_colour_volume(const struct heif_image*, const struct heif_mastering_display_colour_volume* in);
1756
2030
 
2031
+
1757
2032
  // Converts the internal numeric representation of heif_mastering_display_colour_volume to the
1758
2033
  // normalized values, collected in heif_decoded_mastering_display_colour_volume.
1759
2034
  // Values that are out-of-range are decoded to 0, indicating an undefined value (as specified in ISO/IEC 23008-2).
@@ -1764,6 +2039,10 @@ struct heif_error heif_mastering_display_colour_volume_decode(const struct heif_
1764
2039
  LIBHEIF_API
1765
2040
  void heif_image_get_pixel_aspect_ratio(const struct heif_image*, uint32_t* aspect_h, uint32_t* aspect_v);
1766
2041
 
2042
+ // Returns whether the image has 'pixel aspect ratio information' information. If 0 is returned, the output is filled with the 1:1 default.
2043
+ LIBHEIF_API
2044
+ int heif_image_handle_get_pixel_aspect_ratio(const struct heif_image_handle*, uint32_t* aspect_h, uint32_t* aspect_v);
2045
+
1767
2046
  LIBHEIF_API
1768
2047
  void heif_image_set_pixel_aspect_ratio(struct heif_image*, uint32_t aspect_h, uint32_t aspect_v);
1769
2048
 
@@ -2103,8 +2382,13 @@ struct heif_encoding_options
2103
2382
 
2104
2383
  // version 7 options
2105
2384
 
2106
- // Set this to true to use compressed form of uncC where possible
2385
+ // Set this to true to use compressed form of uncC where possible.
2107
2386
  uint8_t prefer_uncC_short_form;
2387
+
2388
+ // TODO: we should add a flag to force MIAF compatible outputs. E.g. this will put restrictions on grid tile sizes and
2389
+ // might add a clap box when the grid output size does not match the color subsampling factors.
2390
+ // Since some of these constraints have to be known before actually encoding the image, "forcing MIAF compatibility"
2391
+ // could also be a flag in the heif_context.
2108
2392
  };
2109
2393
 
2110
2394
  LIBHEIF_API
@@ -2147,6 +2431,34 @@ struct heif_error heif_context_encode_grid(struct heif_context* ctx,
2147
2431
  const struct heif_encoding_options* input_options,
2148
2432
  struct heif_image_handle** out_image_handle);
2149
2433
 
2434
+ LIBHEIF_API
2435
+ struct heif_error heif_context_add_grid_image(struct heif_context* ctx,
2436
+ uint32_t image_width,
2437
+ uint32_t image_height,
2438
+ uint32_t tile_columns,
2439
+ uint32_t tile_rows,
2440
+ const struct heif_encoding_options* encoding_options,
2441
+ struct heif_image_handle** out_grid_image_handle);
2442
+
2443
+ LIBHEIF_API
2444
+ struct heif_error heif_context_add_image_tile(struct heif_context* ctx,
2445
+ struct heif_image_handle* tiled_image,
2446
+ uint32_t tile_x, uint32_t tile_y,
2447
+ const struct heif_image* image,
2448
+ struct heif_encoder* encoder);
2449
+
2450
+ // offsets[] should either be NULL (all offsets==0) or an array of size 2*nImages with x;y offset pairs.
2451
+ // If background_rgba is NULL, the background is transparent.
2452
+ LIBHEIF_API
2453
+ struct heif_error heif_context_add_overlay_image(struct heif_context* ctx,
2454
+ uint32_t image_width,
2455
+ uint32_t image_height,
2456
+ uint16_t nImages,
2457
+ const heif_item_id* image_ids,
2458
+ int32_t* offsets,
2459
+ const uint16_t background_rgba[4],
2460
+ struct heif_image_handle** out_iovl_image_handle);
2461
+
2150
2462
  LIBHEIF_API
2151
2463
  struct heif_error heif_context_set_primary_image(struct heif_context*,
2152
2464
  struct heif_image_handle* image_handle);
@@ -2167,16 +2479,6 @@ struct heif_error heif_context_encode_thumbnail(struct heif_context*,
2167
2479
  int bbox_size,
2168
2480
  struct heif_image_handle** out_thumb_image_handle);
2169
2481
 
2170
- enum heif_metadata_compression
2171
- {
2172
- heif_metadata_compression_off = 0,
2173
- heif_metadata_compression_auto = 1,
2174
- heif_metadata_compression_unknown = 2, // only used when reading unknown method from input file
2175
- heif_metadata_compression_deflate = 3,
2176
- heif_metadata_compression_zlib = 4, // do not use for header data
2177
- heif_metadata_compression_brotli = 5
2178
- };
2179
-
2180
2482
  // Assign 'thumbnail_image' as the thumbnail image of 'master_image'.
2181
2483
  LIBHEIF_API
2182
2484
  struct heif_error heif_context_assign_thumbnail(struct heif_context*,