@img/sharp-libvips-dev-wasm32 1.3.0-rc.6 → 1.3.0-rc.8

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 (153) hide show
  1. package/README.md +23 -23
  2. package/include/aom/aom_codec.h +1 -1
  3. package/include/aom/aom_decoder.h +4 -0
  4. package/include/aom/aom_encoder.h +19 -8
  5. package/include/aom/aom_ext_ratectrl.h +664 -0
  6. package/include/aom/aom_image.h +93 -30
  7. package/include/aom/aom_tpl.h +99 -0
  8. package/include/aom/aomcx.h +89 -16
  9. package/include/aom/aomdx.h +12 -0
  10. package/include/expat.h +14 -2
  11. package/include/expat_config.h +6 -3
  12. package/include/expat_external.h +3 -2
  13. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  14. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  15. package/include/glib-2.0/gio/gioenums.h +5 -4
  16. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  17. package/include/glib-2.0/glib/gmacros.h +3 -3
  18. package/include/glib-2.0/glib/gmarkup.h +10 -0
  19. package/include/glib-2.0/glib/gmem.h +4 -4
  20. package/include/glib-2.0/glib/gmessages.h +6 -8
  21. package/include/glib-2.0/glib/gsequence.h +2 -2
  22. package/include/glib-2.0/glib/gstrfuncs.h +190 -0
  23. package/include/glib-2.0/glib/gutils.h +9 -0
  24. package/include/glib-2.0/glib/gvarianttype.h +16 -16
  25. package/include/glib-2.0/glib/gversionmacros.h +22 -0
  26. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  27. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  28. package/include/glib-2.0/gobject/gsignal.h +5 -5
  29. package/include/glib-2.0/gobject/gtype.h +14 -14
  30. package/include/hwy/aligned_allocator.h +44 -2
  31. package/include/hwy/auto_tune.h +22 -6
  32. package/include/hwy/base.h +60 -90
  33. package/include/hwy/bit_set.h +410 -0
  34. package/include/hwy/cache_control.h +3 -2
  35. package/include/hwy/detect_compiler_arch.h +134 -14
  36. package/include/hwy/detect_targets.h +82 -36
  37. package/include/hwy/highway.h +15 -0
  38. package/include/hwy/nanobenchmark.h +12 -3
  39. package/include/hwy/ops/arm_neon-inl.h +96 -25
  40. package/include/hwy/ops/arm_sve-inl.h +250 -95
  41. package/include/hwy/ops/emu128-inl.h +12 -7
  42. package/include/hwy/ops/generic_ops-inl.h +271 -131
  43. package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
  44. package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
  45. package/include/hwy/ops/ppc_vsx-inl.h +99 -19
  46. package/include/hwy/ops/rvv-inl.h +239 -130
  47. package/include/hwy/ops/scalar-inl.h +22 -7
  48. package/include/hwy/ops/set_macros-inl.h +163 -107
  49. package/include/hwy/ops/wasm_128-inl.h +13 -22
  50. package/include/hwy/ops/x86_128-inl.h +223 -120
  51. package/include/hwy/ops/x86_256-inl.h +70 -134
  52. package/include/hwy/ops/x86_512-inl.h +130 -134
  53. package/include/hwy/print-inl.h +2 -0
  54. package/include/hwy/profiler.h +355 -264
  55. package/include/hwy/robust_statistics.h +3 -1
  56. package/include/hwy/timer.h +44 -0
  57. package/include/lcms2.h +34 -4
  58. package/include/libexif/exif-utils.h +1 -1
  59. package/include/libheif/heif.h +2 -0
  60. package/include/libheif/heif_color.h +127 -11
  61. package/include/libheif/heif_components.h +264 -0
  62. package/include/libheif/heif_context.h +2 -1
  63. package/include/libheif/heif_cxx.h +10 -10
  64. package/include/libheif/heif_decoding.h +51 -7
  65. package/include/libheif/heif_encoding.h +15 -9
  66. package/include/libheif/heif_error.h +9 -2
  67. package/include/libheif/heif_export.h +48 -0
  68. package/include/libheif/heif_image.h +81 -66
  69. package/include/libheif/heif_image_handle.h +2 -2
  70. package/include/libheif/heif_items.h +1 -1
  71. package/include/libheif/heif_library.h +8 -16
  72. package/include/libheif/heif_omaf.h +104 -0
  73. package/include/libheif/heif_plugin.h +16 -9
  74. package/include/libheif/heif_properties.h +250 -12
  75. package/include/libheif/heif_security.h +16 -4
  76. package/include/libheif/heif_sequences.h +86 -4
  77. package/include/libheif/heif_tiling.h +2 -2
  78. package/include/libheif/heif_uncompressed.h +44 -324
  79. package/include/libheif/heif_version.h +2 -2
  80. package/include/libpng16/png.h +7 -7
  81. package/include/libpng16/pngconf.h +1 -1
  82. package/include/libpng16/pnglibconf.h +1 -1
  83. package/include/png.h +7 -7
  84. package/include/pngconf.h +1 -1
  85. package/include/pnglibconf.h +1 -1
  86. package/include/tiffconf.h +9 -10
  87. package/include/tiffio.h +10 -9
  88. package/include/tiffvers.h +1 -1
  89. package/include/ultrahdr_api.h +5 -11
  90. package/include/vips/version.h +4 -4
  91. package/lib/glib-2.0/include/glibconfig.h +1 -3
  92. package/lib/libaom.a +0 -0
  93. package/lib/libcgif.a +0 -0
  94. package/lib/libexif.a +0 -0
  95. package/lib/libexif.la +1 -1
  96. package/lib/libexpat.a +0 -0
  97. package/lib/libexpat.la +3 -3
  98. package/lib/libffi.a +0 -0
  99. package/lib/libgio-2.0.a +0 -0
  100. package/lib/libglib-2.0.a +0 -0
  101. package/lib/libgmodule-2.0.a +0 -0
  102. package/lib/libgobject-2.0.a +0 -0
  103. package/lib/libgthread-2.0.a +0 -0
  104. package/lib/libheif.a +0 -0
  105. package/lib/libhwy.a +0 -0
  106. package/lib/libimagequant.a +0 -0
  107. package/lib/libjpeg.a +0 -0
  108. package/lib/liblcms2.a +0 -0
  109. package/lib/libpng.a +0 -0
  110. package/lib/libpng.la +2 -2
  111. package/lib/libpng16.a +0 -0
  112. package/lib/libpng16.la +2 -2
  113. package/lib/libresvg.a +0 -0
  114. package/lib/libsharpyuv.a +0 -0
  115. package/lib/libtiff.a +0 -0
  116. package/lib/libuhdr.a +0 -0
  117. package/lib/libvips-cpp.a +0 -0
  118. package/lib/libvips.a +0 -0
  119. package/lib/libwebp.a +0 -0
  120. package/lib/libwebpdecoder.a +0 -0
  121. package/lib/libwebpdemux.a +0 -0
  122. package/lib/libwebpmux.a +0 -0
  123. package/lib/libz.a +0 -0
  124. package/lib/pkgconfig/aom.pc +2 -2
  125. package/lib/pkgconfig/expat.pc +1 -1
  126. package/lib/pkgconfig/gio-2.0.pc +1 -1
  127. package/lib/pkgconfig/glib-2.0.pc +1 -1
  128. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  129. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  130. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  131. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  132. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  133. package/lib/pkgconfig/lcms2.pc +1 -1
  134. package/lib/pkgconfig/libexif.pc +1 -1
  135. package/lib/pkgconfig/libheif.pc +2 -2
  136. package/lib/pkgconfig/libhwy.pc +3 -4
  137. package/lib/pkgconfig/libpng.pc +1 -1
  138. package/lib/pkgconfig/libpng16.pc +1 -1
  139. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  140. package/lib/pkgconfig/libtiff-4.pc +2 -2
  141. package/lib/pkgconfig/libwebp.pc +1 -1
  142. package/lib/pkgconfig/libwebpdecoder.pc +11 -0
  143. package/lib/pkgconfig/libwebpmux.pc +1 -1
  144. package/lib/pkgconfig/vips-cpp.pc +1 -1
  145. package/lib/pkgconfig/vips.pc +1 -1
  146. package/package.json +1 -1
  147. package/versions.json +12 -12
  148. package/include/libheif/heif_uncompressed_types.h +0 -143
  149. package/lib/libsharpyuv.la +0 -41
  150. package/lib/libtiff.la +0 -41
  151. package/lib/libwebp.la +0 -41
  152. package/lib/libwebpdemux.la +0 -41
  153. package/lib/libwebpmux.la +0 -41
@@ -48,22 +48,14 @@ extern "C" {
48
48
  // 1.18 5 7 1 1 1 1
49
49
  // 1.19 6 7 2 1 1 1
50
50
  // 1.20 7 7 2 1 1 1
51
+ // 1.21 8 7 2 1 1 1
52
+ // 1.22 9 8 2 1 1 1
53
+ // 1.23 10 8 2 1 1 1
51
54
 
52
- #if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
53
- #ifdef LIBHEIF_EXPORTS
54
- #define LIBHEIF_API __declspec(dllexport)
55
- #else
56
- #define LIBHEIF_API __declspec(dllimport)
57
- #endif
58
- #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
59
- #ifdef LIBHEIF_EXPORTS
60
- #define LIBHEIF_API __attribute__((__visibility__("default")))
61
- #else
62
- #define LIBHEIF_API
63
- #endif
64
- #else
65
- #define LIBHEIF_API
66
- #endif
55
+ // The LIBHEIF_API export macro is defined in its own dependency-free header so
56
+ // that heif_error.h (which is needed by this header) can use it without
57
+ // creating an include cycle.
58
+ #include <libheif/heif_export.h>
67
59
 
68
60
  /**
69
61
  * Build a 32 bit integer from a 4-character code.
@@ -169,7 +161,7 @@ typedef enum heif_plugin_type
169
161
  typedef struct heif_plugin_info
170
162
  {
171
163
  int version; // version of this info struct
172
- enum heif_plugin_type type;
164
+ heif_plugin_type type;
173
165
  const void* plugin;
174
166
  void* internal_handle; // for internal use only
175
167
  } heif_plugin_info;
@@ -0,0 +1,104 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2026 Brad Hards <bradh@frogmouth.net>
4
+ * Copyright (c) 2026 Dirk Farin <dirk.farin@gmail.com>
5
+ *
6
+ * This file is part of libheif.
7
+ *
8
+ * libheif is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Lesser General Public License as
10
+ * published by the Free Software Foundation, either version 3 of
11
+ * the License, or (at your option) any later version.
12
+ *
13
+ * libheif is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public License
19
+ * along with libheif. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ #ifndef LIBHEIF_HEIF_OMAF_H
23
+ #define LIBHEIF_HEIF_OMAF_H
24
+
25
+ #include <libheif/heif_library.h>
26
+ #include <libheif/heif_error.h>
27
+ #include <libheif/heif_image.h>
28
+ #include <libheif/heif_image_handle.h>
29
+
30
+ #ifdef __cplusplus
31
+ extern "C" {
32
+ #endif
33
+
34
+ // ------------------------- OMAF projection information -------------------------
35
+ //
36
+ // ISO/IEC 23090-2 "Omnidirectional media format" describes formats for
37
+ // representing immersive / 360-degree imagery. The 'prfr' (projection format)
38
+ // item property records the kind of projection used by the encoded image.
39
+
40
+ /**
41
+ * OMAF Image projection.
42
+ *
43
+ * The image projection for most images is flat - it is projected as intended to be shown on
44
+ * a flat screen or print. For immersive or omnidirectional media (e.g. VR headsets, or
45
+ * equivalent), there are alternatives such as an equirectangular projection or cubemap projection.
46
+ *
47
+ * See ISO/IEC 23090-2 "Omnidirectional media format" for more information.
48
+ */
49
+ typedef enum heif_omaf_image_projection
50
+ {
51
+ /**
52
+ * Equirectangular projection.
53
+ */
54
+ heif_omaf_image_projection_equirectangular = 0x00,
55
+
56
+ /**
57
+ * Cube map.
58
+ */
59
+ heif_omaf_image_projection_cube_map = 0x01,
60
+
61
+ /*
62
+ * Values 2 through 31 are reserved in ISO/IEC 23090-2:2023 Table 10.
63
+ * Files may carry any of them; libheif passes the raw projection_type
64
+ * value through unchanged, so callers can log or round-trip it.
65
+ * Handle anything outside the named constants in a `default:` arm.
66
+ */
67
+
68
+ /**
69
+ * Flat projection. Also returned by the get-projection accessors when no
70
+ * projection information is present on the image, so callers can use
71
+ * `result == heif_omaf_image_projection_flat` to test for "no prfr box".
72
+ * 0xFF lies outside the prfr value range reserved by ISO 23090-2:2023
73
+ * Table 10, so it cannot collide with a value read from a file.
74
+ */
75
+ heif_omaf_image_projection_flat = 0xFF,
76
+ } heif_omaf_image_projection;
77
+
78
+
79
+ // To test whether projection information is present, compare the getter's
80
+ // result against heif_omaf_image_projection_flat.
81
+
82
+ LIBHEIF_API
83
+ heif_omaf_image_projection heif_image_handle_get_omaf_image_projection(const heif_image_handle* handle);
84
+
85
+ LIBHEIF_API
86
+ void heif_image_handle_set_omaf_image_projection(heif_image_handle* handle,
87
+ heif_omaf_image_projection image_projection);
88
+
89
+ // Variants operating on a heif_image (a decoded or about-to-be-encoded pixel
90
+ // image). Setting the projection on a heif_image before encoding causes the
91
+ // resulting image item to carry the corresponding prfr property.
92
+
93
+ LIBHEIF_API
94
+ heif_omaf_image_projection heif_image_get_omaf_image_projection(const heif_image* image);
95
+
96
+ LIBHEIF_API
97
+ void heif_image_set_omaf_image_projection(heif_image* image,
98
+ heif_omaf_image_projection image_projection);
99
+
100
+ #ifdef __cplusplus
101
+ }
102
+ #endif
103
+
104
+ #endif
@@ -45,8 +45,9 @@ extern "C" {
45
45
  // 1.15 3 3 2
46
46
  // 1.20 4 3 2
47
47
  // 1.21 5 4 2
48
+ // 1.22 6 4 2
48
49
 
49
- #define heif_decoder_plugin_latest_version 5
50
+ #define heif_decoder_plugin_latest_version 6
50
51
  #define heif_encoder_plugin_latest_version 4
51
52
 
52
53
  // The minimum plugin versions that can be used with this libheif version.
@@ -61,17 +62,23 @@ extern "C" {
61
62
 
62
63
  typedef struct heif_decoder_plugin_compressed_format_description
63
64
  {
64
- enum heif_compression_format format;
65
+ heif_compression_format format;
65
66
 
66
67
  } heif_decoder_plugin_compressed_format_description;
67
68
 
68
69
 
69
70
  typedef struct heif_decoder_plugin_options
70
71
  {
71
- enum heif_compression_format format;
72
+ heif_compression_format format;
72
73
  int strict_decoding; // bool
73
74
  int num_threads; // 0 - undefined, use decoder default
74
75
 
76
+ // --- added in plugin_api_version 6 ---
77
+ // Security limits the plugin must enforce for image allocations during decoding.
78
+ // The pointee must outlive the decoder instance (typically the context's limits).
79
+ // Only read by plugins reporting plugin_api_version >= 6.
80
+ const heif_security_limits* limits;
81
+
75
82
  } heif_decoder_plugin_options;
76
83
 
77
84
 
@@ -95,7 +102,7 @@ typedef struct heif_decoder_plugin
95
102
  // Query whether the plugin supports decoding of the given format
96
103
  // Result is a priority value. The plugin with the largest value wins.
97
104
  // Default priority is 100. Returning 0 indicates that the plugin cannot decode this format.
98
- int (* does_support_format)(enum heif_compression_format format);
105
+ int (* does_support_format)(heif_compression_format format);
99
106
 
100
107
  // Create a new decoder context for decoding an image
101
108
  heif_error (* new_decoder)(void** decoder);
@@ -191,7 +198,7 @@ typedef struct heif_encoder_plugin
191
198
  // --- version 1 functions ---
192
199
 
193
200
  // The compression format generated by this plugin.
194
- enum heif_compression_format compression_format;
201
+ heif_compression_format compression_format;
195
202
 
196
203
  // Short name of the encoder that can be used as command line parameter when selecting an encoder.
197
204
  // Hence, it should stay stable and not contain any version numbers that will change.
@@ -250,8 +257,8 @@ typedef struct heif_encoder_plugin
250
257
 
251
258
  // Replace the input colorspace/chroma with the one that is supported by the encoder and that
252
259
  // comes as close to the input colorspace/chroma as possible.
253
- void (* query_input_colorspace)(enum heif_colorspace* inout_colorspace,
254
- enum heif_chroma* inout_chroma);
260
+ void (* query_input_colorspace)(heif_colorspace* inout_colorspace,
261
+ heif_chroma* inout_chroma);
255
262
 
256
263
  // Encode an image.
257
264
  // After pushing an image into the encoder, you should call get_compressed_data() to
@@ -268,8 +275,8 @@ typedef struct heif_encoder_plugin
268
275
  // --- version 2 ---
269
276
 
270
277
  void (* query_input_colorspace2)(void* encoder,
271
- enum heif_colorspace* inout_colorspace,
272
- enum heif_chroma* inout_chroma);
278
+ heif_colorspace* inout_colorspace,
279
+ heif_chroma* inout_chroma);
273
280
 
274
281
  // --- version 3 ---
275
282
 
@@ -192,6 +192,256 @@ heif_error heif_item_get_property_uuid_type(const heif_context* context,
192
192
  uint8_t out_extended_type[16]);
193
193
 
194
194
 
195
+ // ------------------------- ISO/IEC 23001-17 properties -------------------------
196
+ //
197
+ // Imaging-metadata properties defined by ISO/IEC 23001-17 (uncompressed-image
198
+ // format) and currently surfaced on uncompressed images. They operate on a
199
+ // heif_image (the in-memory pixel image) rather than on (context, item_id) like
200
+ // the box-level property API above.
201
+
202
+
203
+ // --- Bayer / filter array pattern (cpat box)
204
+
205
+ typedef struct heif_bayer_pattern_pixel
206
+ {
207
+ uint32_t component_id;
208
+ float component_gain;
209
+ } heif_bayer_pattern_pixel;
210
+
211
+
212
+ // Set a Bayer / filter array pattern on an image.
213
+ // The pattern is a 2D array of component indices with dimensions pattern_width x pattern_height.
214
+ // The number of entries in patternPixels must be pattern_width * pattern_height.
215
+ // The component_index values are indices into the cmpd component definition table.
216
+ // On the encoder path, these indices are generated by heif_image_add_component() and the
217
+ // encoder adds reference components to cmpd for pattern entries that don't have image planes.
218
+ // On the decoder path, they come directly from the cpat box.
219
+ LIBHEIF_API
220
+ heif_error heif_image_set_bayer_pattern(heif_image*,
221
+ uint32_t bayer_component_id,
222
+ uint16_t pattern_width,
223
+ uint16_t pattern_height,
224
+ const heif_bayer_pattern_pixel* patternPixels);
225
+
226
+ // Add a reference-only component to the image's component description table for use as
227
+ // a Bayer pattern entry. The component is registered (its component_type appears in the
228
+ // cmpd box) but carries no pixel plane of its own — the actual pixel data lives in the
229
+ // single combined Bayer component (added with heif_image_add_component()).
230
+ //
231
+ // Use this for the per-cell colors that the Bayer pattern references (e.g. red, green,
232
+ // blue) when those colors have no standalone plane. Pass the returned component_id in
233
+ // heif_bayer_pattern_pixel::component_id of the patternPixels array given to
234
+ // heif_image_set_bayer_pattern().
235
+ //
236
+ // component_type: one of heif_cmpd_component_type_* (e.g. _red, _green, _blue).
237
+ // out_component_id: receives the minted component id. Must not be NULL.
238
+ LIBHEIF_API
239
+ heif_error heif_image_add_bayer_component(heif_image*,
240
+ uint16_t component_type,
241
+ uint32_t* out_component_id);
242
+
243
+ // Returns whether the image has a Bayer / filter array pattern.
244
+ // If the image has a pattern, out_pattern_width and out_pattern_height are set.
245
+ // Either output pointer may be NULL if the caller does not need that value.
246
+ LIBHEIF_API
247
+ int heif_image_get_bayer_pattern_size(const heif_image*,
248
+ uint32_t bayer_component_id,
249
+ uint16_t* out_pattern_width,
250
+ uint16_t* out_pattern_height);
251
+
252
+ // Get the Bayer / filter array pattern pixels.
253
+ // The caller must provide an array large enough for pattern_width * pattern_height entries
254
+ // (use heif_image_get_bayer_pattern_size() to query the dimensions first).
255
+ // Returns heif_error_Ok on success, or an error if no pattern is set.
256
+ LIBHEIF_API
257
+ heif_error heif_image_get_bayer_pattern(const heif_image*,
258
+ uint32_t bayer_component_id,
259
+ heif_bayer_pattern_pixel* out_patternPixels);
260
+
261
+
262
+ // --- Polarization pattern (ISO 23001-17, Section 6.1.5)
263
+
264
+ // Special float value indicating "no polarization filter" at a pattern position.
265
+ // On the wire this is the IEEE 754 bit pattern 0xFFFFFFFF (a signaling NaN).
266
+ // Test with heif_polarization_angle_is_no_filter() below, or with isnan()/std::isnan().
267
+
268
+ // Returns a float with the 0xFFFFFFFF bit pattern (NaN) representing "no polarization filter".
269
+ LIBHEIF_API
270
+ float heif_polarization_angle_no_filter(void);
271
+
272
+ // Returns non-zero if the given angle has the "no filter" bit pattern (0xFFFFFFFF).
273
+ LIBHEIF_API
274
+ int heif_polarization_angle_is_no_filter(float angle);
275
+
276
+ // Add a polarization pattern to an image.
277
+ // component_indices: array of component indices this pattern applies to (may be NULL if num_component_indices == 0,
278
+ // meaning the pattern applies to all components).
279
+ // polarization_angles: array of pattern_width * pattern_height float values.
280
+ // Each is an angle in degrees [0.0, 360.0), or heif_polarization_angle_no_filter() for "no filter".
281
+ // Multiple patterns can be added (one per distinct component group).
282
+ LIBHEIF_API
283
+ heif_error heif_image_add_polarization_pattern(heif_image*,
284
+ uint32_t num_component_indices,
285
+ const uint32_t* component_indices,
286
+ uint16_t pattern_width,
287
+ uint16_t pattern_height,
288
+ const float* polarization_angles);
289
+
290
+ // Returns the number of polarization patterns on this image (0 if none).
291
+ LIBHEIF_API
292
+ int heif_image_get_number_of_polarization_patterns(const heif_image*);
293
+
294
+ // Get the sizes/dimensions of a polarization pattern (to allocate arrays for the data query).
295
+ LIBHEIF_API
296
+ heif_error heif_image_get_polarization_pattern_info(const heif_image*,
297
+ int pattern_index,
298
+ uint32_t* out_num_component_indices,
299
+ uint16_t* out_pattern_width,
300
+ uint16_t* out_pattern_height);
301
+
302
+ // Get the actual data of a polarization pattern.
303
+ // Caller must provide pre-allocated arrays:
304
+ // out_component_indices: num_component_indices entries (may be NULL if num_component_indices == 0)
305
+ // out_polarization_angles: pattern_width * pattern_height entries
306
+ LIBHEIF_API
307
+ heif_error heif_image_get_polarization_pattern_data(const heif_image*,
308
+ int pattern_index,
309
+ uint32_t* out_component_indices,
310
+ float* out_polarization_angles);
311
+
312
+ // Find the polarization pattern index that applies to a given component index.
313
+ // Returns the pattern index (>= 0), or -1 if no pattern matches.
314
+ // A pattern with an empty component list (component_count == 0) matches all components.
315
+ LIBHEIF_API
316
+ int heif_image_get_polarization_pattern_index_for_component(const heif_image*,
317
+ uint32_t component_index);
318
+
319
+
320
+ // --- Sensor bad pixels map (ISO 23001-17, Section 6.1.7)
321
+
322
+ typedef struct heif_bad_pixel
323
+ {
324
+ uint32_t row; uint32_t column;
325
+ } heif_bad_pixel;
326
+
327
+ // Add a sensor bad pixels map to an image.
328
+ // component_indices: array of component indices this map applies to (may be NULL if num_component_indices == 0,
329
+ // meaning the map applies to all components).
330
+ // Multiple maps can be added (one per distinct component group with different defects).
331
+ LIBHEIF_API
332
+ heif_error heif_image_add_sensor_bad_pixels_map(heif_image*,
333
+ uint32_t num_component_indices,
334
+ const uint32_t* component_indices,
335
+ int correction_applied,
336
+ uint32_t num_bad_rows,
337
+ const uint32_t* bad_rows,
338
+ uint32_t num_bad_columns,
339
+ const uint32_t* bad_columns,
340
+ uint32_t num_bad_pixels,
341
+ const heif_bad_pixel* bad_pixels);
342
+
343
+ // Returns the number of sensor bad pixels maps on this image (0 if none).
344
+ LIBHEIF_API
345
+ int heif_image_get_number_of_sensor_bad_pixels_maps(const heif_image*);
346
+
347
+ // Get the sizes of a sensor bad pixels map (to allocate arrays for the data query).
348
+ LIBHEIF_API
349
+ heif_error heif_image_get_sensor_bad_pixels_map_info(const heif_image*,
350
+ int map_index,
351
+ uint32_t* out_num_component_indices,
352
+ int* out_correction_applied,
353
+ uint32_t* out_num_bad_rows,
354
+ uint32_t* out_num_bad_columns,
355
+ uint32_t* out_num_bad_pixels);
356
+
357
+ // Get the actual data of a sensor bad pixels map.
358
+ // Caller must provide pre-allocated arrays:
359
+ // out_component_indices: num_component_indices entries (may be NULL if num_component_indices == 0)
360
+ // out_bad_rows: num_bad_rows entries (may be NULL if num_bad_rows == 0)
361
+ // out_bad_columns: num_bad_columns entries (may be NULL if num_bad_columns == 0)
362
+ // out_bad_pixels: num_bad_pixels entries (may be NULL if num_bad_pixels == 0)
363
+ LIBHEIF_API
364
+ heif_error heif_image_get_sensor_bad_pixels_map_data(const heif_image*,
365
+ int map_index,
366
+ uint32_t* out_component_indices,
367
+ uint32_t* out_bad_rows,
368
+ uint32_t* out_bad_columns,
369
+ struct heif_bad_pixel* out_bad_pixels);
370
+
371
+
372
+ // --- Sensor non-uniformity correction (ISO 23001-17, Section 6.1.6)
373
+
374
+ // Add a sensor non-uniformity correction table to an image.
375
+ // component_indices: array of component indices this NUC applies to (may be NULL if num_component_indices == 0,
376
+ // meaning it applies to all components).
377
+ // nuc_gains and nuc_offsets: arrays of image_width * image_height float values.
378
+ // Correction equation: y = nuc_gain * x + nuc_offset.
379
+ // Multiple NUC tables can be added (one per distinct component group).
380
+ LIBHEIF_API
381
+ heif_error heif_image_add_sensor_nuc(heif_image*,
382
+ uint32_t num_component_indices,
383
+ const uint32_t* component_indices,
384
+ int nuc_is_applied,
385
+ uint32_t image_width,
386
+ uint32_t image_height,
387
+ const float* nuc_gains,
388
+ const float* nuc_offsets);
389
+
390
+ // Returns the number of sensor NUC tables on this image (0 if none).
391
+ LIBHEIF_API
392
+ int heif_image_get_number_of_sensor_nucs(const heif_image*);
393
+
394
+ // Get the sizes of a sensor NUC table (to allocate arrays for the data query).
395
+ LIBHEIF_API
396
+ heif_error heif_image_get_sensor_nuc_info(const heif_image*,
397
+ int nuc_index,
398
+ uint32_t* out_num_component_indices,
399
+ int* out_nuc_is_applied,
400
+ uint32_t* out_image_width,
401
+ uint32_t* out_image_height);
402
+
403
+ // Get the actual data of a sensor NUC table.
404
+ // Caller must provide pre-allocated arrays:
405
+ // out_component_indices: num_component_indices entries (may be NULL if num_component_indices == 0)
406
+ // out_nuc_gains: image_width * image_height entries
407
+ // out_nuc_offsets: image_width * image_height entries
408
+ LIBHEIF_API
409
+ heif_error heif_image_get_sensor_nuc_data(const heif_image*,
410
+ int nuc_index,
411
+ uint32_t* out_component_indices,
412
+ float* out_nuc_gains,
413
+ float* out_nuc_offsets);
414
+
415
+
416
+ // --- Chroma sample location (ISO 23091-2 / ITU-T H.273 + ISO 23001-17, Section 6.1.4) [cloc box]
417
+
418
+ typedef enum heif_chroma420_sample_location {
419
+ // values 0-5 according to ISO 23091-2 / ITU-T H.273
420
+ heif_chroma420_sample_location_00_05 = 0,
421
+ heif_chroma420_sample_location_05_05 = 1,
422
+ heif_chroma420_sample_location_00_00 = 2,
423
+ heif_chroma420_sample_location_05_00 = 3,
424
+ heif_chroma420_sample_location_00_10 = 4,
425
+ heif_chroma420_sample_location_05_10 = 5,
426
+
427
+ // value 6 according to ISO 23001-17
428
+ heif_chroma420_sample_location_00_00_01_00 = 6
429
+ } heif_chroma420_sample_location;
430
+
431
+ // Set the chroma sample location on an image.
432
+ // chroma_location must be in the range 0-6 (see heif_chroma420_sample_location).
433
+ LIBHEIF_API
434
+ heif_error heif_image_set_chroma_location(heif_image*, uint8_t chroma_location);
435
+
436
+ // Returns non-zero if the image has a chroma sample location set.
437
+ LIBHEIF_API
438
+ int heif_image_has_chroma_location(const heif_image*);
439
+
440
+ // Returns the chroma sample location (0-6), or 0 if none is set.
441
+ LIBHEIF_API
442
+ uint8_t heif_image_get_chroma_location(const heif_image*);
443
+
444
+
195
445
  // ------------------------- intrinsic and extrinsic matrices -------------------------
196
446
 
197
447
  typedef struct heif_camera_intrinsic_matrix
@@ -228,18 +478,6 @@ LIBHEIF_API
228
478
  heif_error heif_camera_extrinsic_matrix_get_rotation_matrix(const heif_camera_extrinsic_matrix*,
229
479
  double* out_matrix_row_major);
230
480
 
231
- #if HEIF_WITH_OMAF
232
- // ------------------------- OMAF projection information -------------------------
233
- LIBHEIF_API
234
- int heif_image_handle_has_omaf_image_projection(const heif_image_handle* handle);
235
-
236
- LIBHEIF_API
237
- heif_omaf_image_projection heif_image_handle_get_omaf_image_projection(const heif_image_handle* handle);
238
-
239
- LIBHEIF_API
240
- void heif_image_handle_set_omaf_image_projection(const heif_image_handle* handle, heif_omaf_image_projection image_projection);
241
- #endif
242
-
243
481
  #ifdef __cplusplus
244
482
  }
245
483
  #endif
@@ -38,7 +38,7 @@ typedef struct heif_security_limits
38
38
  {
39
39
  uint8_t version;
40
40
 
41
- // --- version 1
41
+ // --- version 1 (v1.19.0)
42
42
 
43
43
  // Limit on the maximum image size to avoid allocating too much memory.
44
44
  // For example, setting this to 32768^2 pixels = 1 Gigapixels results
@@ -59,20 +59,32 @@ typedef struct heif_security_limits
59
59
 
60
60
  uint32_t max_children_per_box; // for all boxes that are not covered by other limits
61
61
 
62
- // --- version 2
62
+ // --- version 2 (v1.20.0)
63
63
 
64
64
  uint64_t max_total_memory;
65
65
  uint32_t max_sample_description_box_entries;
66
66
  uint32_t max_sample_group_description_box_entries;
67
67
 
68
- // --- version 3
68
+ // --- version 3 (v1.21.0)
69
69
 
70
70
  uint32_t max_sequence_frames;
71
71
  uint32_t max_number_of_file_brands;
72
72
 
73
- // --- version 4
73
+ // --- version 4 (v1.22.0)
74
74
 
75
75
  uint32_t max_bad_pixels;
76
+
77
+ // Upper bound (in bytes) on the pixel_size field of an uncompressed (ISO 23001-17)
78
+ // uncC box. Caps the byte stride between adjacent pixels and prevents pathological
79
+ // padding values from blowing up tile-size arithmetic.
80
+ uint32_t max_iso23001_17_pixel_size_bytes;
81
+
82
+ // Internal: when libheif derives a limits struct from another one (e.g. to
83
+ // tighten the maximum image size for a specific decode), this points back to
84
+ // the registered context whose total-memory budget the allocation should be
85
+ // accounted against. nullptr means "this is a root context" (the registered
86
+ // one). User code should leave this as nullptr; the field is set internally.
87
+ const struct heif_security_limits* parent;
76
88
  } heif_security_limits;
77
89
 
78
90
 
@@ -82,7 +82,12 @@ int heif_context_number_of_sequence_tracks(const heif_context*);
82
82
 
83
83
  /**
84
84
  * Returns the IDs for each of the tracks stored in the HEIF file.
85
- * The output array must have heif_context_number_of_sequence_tracks() entries.
85
+ *
86
+ * The caller MUST allocate `out_track_id_array` with exactly
87
+ * heif_context_number_of_sequence_tracks() entries. The function writes
88
+ * that many IDs unconditionally. Passing a smaller array results in a
89
+ * buffer overflow (undefined behavior); there is no capacity parameter
90
+ * and no truncation.
86
91
  */
87
92
  LIBHEIF_API
88
93
  void heif_context_get_track_ids(const heif_context* ctx, uint32_t out_track_id_array[]);
@@ -154,6 +159,41 @@ int heif_track_has_alpha_channel(const heif_track*);
154
159
  LIBHEIF_API
155
160
  uint32_t heif_track_get_timescale(const heif_track*);
156
161
 
162
+ /**
163
+ * Special return value of `heif_track_get_number_of_repetitions()` indicating that
164
+ * the editlist requests indefinite repetition (the mvhd duration is the ISOBMFF
165
+ * "duration unknown" sentinel and the editlist is in repeat mode).
166
+ */
167
+ #define heif_sequence_track_number_of_repetitions_infinite 0xFFFFFFFFu
168
+
169
+ /**
170
+ * How many times the media segment should be played according to the track's edit list.
171
+ *
172
+ * Returns:
173
+ * - 0 if an edit list box is present but follows a pattern libheif does not interpret
174
+ * as a loop count. Callers should fall back to a single playback in that case.
175
+ * - 1 when no edit list is present. The media plays exactly once.
176
+ * - `heif_sequence_track_number_of_repetitions_infinite` (= UINT32_MAX) when the file
177
+ * signals indefinite playback (mvhd duration is the all-1s sentinel together with an
178
+ * editlist in repeat mode), or when the repetition count does not fit in uint32_t.
179
+ * - Otherwise the number of times the media segment is played.
180
+ *
181
+ * The reported value is informational; it does not change how
182
+ * `heif_track_decode_next_image()` walks samples. By default, that function applies
183
+ * the edit list and (for repeated playback) returns samples for every requested
184
+ * repetition; iterating until end-of-sequence on an infinite-loop file therefore
185
+ * never terminates.
186
+ *
187
+ * Clients that want to handle repetition themselves (e.g. to honor an "infinite"
188
+ * value with their own looping policy or to enforce an application-level cap) should
189
+ * set `heif_decoding_options::ignore_sequence_editlist` when calling
190
+ * `heif_track_decode_next_image()`. With that flag set, libheif plays the media
191
+ * timeline exactly once. Use the value returned by this function to decide how often
192
+ * to replay the track at the application level.
193
+ */
194
+ LIBHEIF_API
195
+ uint32_t heif_track_get_number_of_repetitions(const heif_track*);
196
+
157
197
 
158
198
  // --- reading visual tracks
159
199
 
@@ -177,8 +217,8 @@ heif_error heif_track_get_image_resolution(const heif_track*, uint16_t* out_widt
177
217
  LIBHEIF_API
178
218
  heif_error heif_track_decode_next_image(heif_track* track,
179
219
  heif_image** out_img,
180
- enum heif_colorspace colorspace,
181
- enum heif_chroma chroma,
220
+ heif_colorspace colorspace,
221
+ heif_chroma chroma,
182
222
  const heif_decoding_options* options);
183
223
 
184
224
  /**
@@ -352,6 +392,23 @@ typedef enum heif_sequence_gop_structure
352
392
  } heif_sequence_gop_structure;
353
393
 
354
394
 
395
+ // Describes the intent of the encoded sequence content. Encoder plugins may
396
+ // use this to choose different default tunings (e.g. perceptual quality vs.
397
+ // rate-distortion) for slide-show-style image sequences vs. video.
398
+ //
399
+ // Pass `_auto` to let libheif pick a value. Today libheif derives the kind
400
+ // from the track's handler type (`pict` -> image_sequence, `vide` -> video);
401
+ // in the future it may use additional input signals (e.g. frame rate or
402
+ // frame-to-frame similarity). Plugins never see `_auto`: libheif resolves it
403
+ // to a concrete kind before passing the options to the encoder plugin.
404
+ typedef enum heif_sequence_content_kind
405
+ {
406
+ heif_sequence_content_kind_auto = 0,
407
+ heif_sequence_content_kind_image_sequence = 1,
408
+ heif_sequence_content_kind_video = 2
409
+ } heif_sequence_content_kind;
410
+
411
+
355
412
  typedef struct heif_sequence_encoding_options
356
413
  {
357
414
  uint8_t version;
@@ -371,12 +428,32 @@ typedef struct heif_sequence_encoding_options
371
428
  int keyframe_distance_max; // 0 - undefined
372
429
 
373
430
  int save_alpha_channel;
431
+
432
+ // version 3 options
433
+
434
+ // Intent of the encoded content. Encoder plugins may use this to choose
435
+ // different tunings for slide-show-style image sequences vs. video.
436
+ // Set to `_auto` (the default) to let libheif pick. libheif resolves the
437
+ // value to a concrete kind before passing the options to the encoder
438
+ // plugin, so plugins never see `_auto`.
439
+ enum heif_sequence_content_kind content_kind;
374
440
  } heif_sequence_encoding_options;
375
441
 
376
442
 
377
443
  LIBHEIF_API
378
444
  heif_sequence_encoding_options* heif_sequence_encoding_options_alloc(void);
379
445
 
446
+ /**
447
+ * Copy fields from `src` into `dst`, respecting both structs' version numbers.
448
+ * Only fields present in `min(dst->version, src->version)` are copied, so this
449
+ * is safe when libheif and the caller were built against different header
450
+ * versions of `heif_sequence_encoding_options`. Pass NULL `src` to leave `dst`
451
+ * unchanged.
452
+ */
453
+ LIBHEIF_API
454
+ void heif_sequence_encoding_options_copy(heif_sequence_encoding_options* dst,
455
+ const heif_sequence_encoding_options* src);
456
+
380
457
  LIBHEIF_API
381
458
  void heif_sequence_encoding_options_release(heif_sequence_encoding_options*);
382
459
 
@@ -610,7 +687,12 @@ size_t heif_track_get_number_of_track_reference_types(const heif_track*);
610
687
 
611
688
  /**
612
689
  * List the reference types used in this track.
613
- * The passed array must have heif_track_get_number_of_track_reference_types() entries.
690
+ *
691
+ * The caller MUST allocate `out_reference_types` with exactly
692
+ * heif_track_get_number_of_track_reference_types() entries. The function
693
+ * writes that many values unconditionally. Passing a smaller array
694
+ * results in a buffer overflow (undefined behavior); there is no
695
+ * capacity parameter and no truncation.
614
696
  */
615
697
  LIBHEIF_API
616
698
  void heif_track_get_track_reference_types(const heif_track*, uint32_t out_reference_types[]);