@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.
- package/README.md +23 -23
- package/include/aom/aom_codec.h +1 -1
- package/include/aom/aom_decoder.h +4 -0
- package/include/aom/aom_encoder.h +19 -8
- package/include/aom/aom_ext_ratectrl.h +664 -0
- package/include/aom/aom_image.h +93 -30
- package/include/aom/aom_tpl.h +99 -0
- package/include/aom/aomcx.h +89 -16
- package/include/aom/aomdx.h +12 -0
- package/include/expat.h +14 -2
- package/include/expat_config.h +6 -3
- package/include/expat_external.h +3 -2
- package/include/glib-2.0/gio/gdbusconnection.h +2 -8
- package/include/glib-2.0/gio/gio-visibility.h +34 -0
- package/include/glib-2.0/gio/gioenums.h +5 -4
- package/include/glib-2.0/glib/glib-visibility.h +34 -0
- package/include/glib-2.0/glib/gmacros.h +3 -3
- package/include/glib-2.0/glib/gmarkup.h +10 -0
- package/include/glib-2.0/glib/gmem.h +4 -4
- package/include/glib-2.0/glib/gmessages.h +6 -8
- package/include/glib-2.0/glib/gsequence.h +2 -2
- package/include/glib-2.0/glib/gstrfuncs.h +190 -0
- package/include/glib-2.0/glib/gutils.h +9 -0
- package/include/glib-2.0/glib/gvarianttype.h +16 -16
- package/include/glib-2.0/glib/gversionmacros.h +22 -0
- package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
- package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
- package/include/glib-2.0/gobject/gsignal.h +5 -5
- package/include/glib-2.0/gobject/gtype.h +14 -14
- package/include/hwy/aligned_allocator.h +44 -2
- package/include/hwy/auto_tune.h +22 -6
- package/include/hwy/base.h +60 -90
- package/include/hwy/bit_set.h +410 -0
- package/include/hwy/cache_control.h +3 -2
- package/include/hwy/detect_compiler_arch.h +134 -14
- package/include/hwy/detect_targets.h +82 -36
- package/include/hwy/highway.h +15 -0
- package/include/hwy/nanobenchmark.h +12 -3
- package/include/hwy/ops/arm_neon-inl.h +96 -25
- package/include/hwy/ops/arm_sve-inl.h +250 -95
- package/include/hwy/ops/emu128-inl.h +12 -7
- package/include/hwy/ops/generic_ops-inl.h +271 -131
- package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
- package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
- package/include/hwy/ops/ppc_vsx-inl.h +99 -19
- package/include/hwy/ops/rvv-inl.h +239 -130
- package/include/hwy/ops/scalar-inl.h +22 -7
- package/include/hwy/ops/set_macros-inl.h +163 -107
- package/include/hwy/ops/wasm_128-inl.h +13 -22
- package/include/hwy/ops/x86_128-inl.h +223 -120
- package/include/hwy/ops/x86_256-inl.h +70 -134
- package/include/hwy/ops/x86_512-inl.h +130 -134
- package/include/hwy/print-inl.h +2 -0
- package/include/hwy/profiler.h +355 -264
- package/include/hwy/robust_statistics.h +3 -1
- package/include/hwy/timer.h +44 -0
- package/include/lcms2.h +34 -4
- package/include/libexif/exif-utils.h +1 -1
- package/include/libheif/heif.h +2 -0
- package/include/libheif/heif_color.h +127 -11
- package/include/libheif/heif_components.h +264 -0
- package/include/libheif/heif_context.h +2 -1
- package/include/libheif/heif_cxx.h +10 -10
- package/include/libheif/heif_decoding.h +51 -7
- package/include/libheif/heif_encoding.h +15 -9
- package/include/libheif/heif_error.h +9 -2
- package/include/libheif/heif_export.h +48 -0
- package/include/libheif/heif_image.h +81 -66
- package/include/libheif/heif_image_handle.h +2 -2
- package/include/libheif/heif_items.h +1 -1
- package/include/libheif/heif_library.h +8 -16
- package/include/libheif/heif_omaf.h +104 -0
- package/include/libheif/heif_plugin.h +16 -9
- package/include/libheif/heif_properties.h +250 -12
- package/include/libheif/heif_security.h +16 -4
- package/include/libheif/heif_sequences.h +86 -4
- package/include/libheif/heif_tiling.h +2 -2
- package/include/libheif/heif_uncompressed.h +44 -324
- package/include/libheif/heif_version.h +2 -2
- package/include/libpng16/png.h +7 -7
- package/include/libpng16/pngconf.h +1 -1
- package/include/libpng16/pnglibconf.h +1 -1
- package/include/png.h +7 -7
- package/include/pngconf.h +1 -1
- package/include/pnglibconf.h +1 -1
- package/include/tiffconf.h +9 -10
- package/include/tiffio.h +10 -9
- package/include/tiffvers.h +1 -1
- package/include/ultrahdr_api.h +5 -11
- package/include/vips/version.h +4 -4
- package/lib/glib-2.0/include/glibconfig.h +1 -3
- package/lib/libaom.a +0 -0
- package/lib/libcgif.a +0 -0
- package/lib/libexif.a +0 -0
- package/lib/libexif.la +1 -1
- package/lib/libexpat.a +0 -0
- package/lib/libexpat.la +3 -3
- package/lib/libffi.a +0 -0
- package/lib/libgio-2.0.a +0 -0
- package/lib/libglib-2.0.a +0 -0
- package/lib/libgmodule-2.0.a +0 -0
- package/lib/libgobject-2.0.a +0 -0
- package/lib/libgthread-2.0.a +0 -0
- package/lib/libheif.a +0 -0
- package/lib/libhwy.a +0 -0
- package/lib/libimagequant.a +0 -0
- package/lib/libjpeg.a +0 -0
- package/lib/liblcms2.a +0 -0
- package/lib/libpng.a +0 -0
- package/lib/libpng.la +2 -2
- package/lib/libpng16.a +0 -0
- package/lib/libpng16.la +2 -2
- package/lib/libresvg.a +0 -0
- package/lib/libsharpyuv.a +0 -0
- package/lib/libtiff.a +0 -0
- package/lib/libuhdr.a +0 -0
- package/lib/libvips-cpp.a +0 -0
- package/lib/libvips.a +0 -0
- package/lib/libwebp.a +0 -0
- package/lib/libwebpdecoder.a +0 -0
- package/lib/libwebpdemux.a +0 -0
- package/lib/libwebpmux.a +0 -0
- package/lib/libz.a +0 -0
- package/lib/pkgconfig/aom.pc +2 -2
- package/lib/pkgconfig/expat.pc +1 -1
- package/lib/pkgconfig/gio-2.0.pc +1 -1
- package/lib/pkgconfig/glib-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
- package/lib/pkgconfig/gobject-2.0.pc +1 -1
- package/lib/pkgconfig/gthread-2.0.pc +1 -1
- package/lib/pkgconfig/lcms2.pc +1 -1
- package/lib/pkgconfig/libexif.pc +1 -1
- package/lib/pkgconfig/libheif.pc +2 -2
- package/lib/pkgconfig/libhwy.pc +3 -4
- package/lib/pkgconfig/libpng.pc +1 -1
- package/lib/pkgconfig/libpng16.pc +1 -1
- package/lib/pkgconfig/libsharpyuv.pc +1 -1
- package/lib/pkgconfig/libtiff-4.pc +2 -2
- package/lib/pkgconfig/libwebp.pc +1 -1
- package/lib/pkgconfig/libwebpdecoder.pc +11 -0
- package/lib/pkgconfig/libwebpmux.pc +1 -1
- package/lib/pkgconfig/vips-cpp.pc +1 -1
- package/lib/pkgconfig/vips.pc +1 -1
- package/package.json +1 -1
- package/versions.json +12 -12
- package/include/libheif/heif_uncompressed_types.h +0 -143
- package/lib/libsharpyuv.la +0 -41
- package/lib/libtiff.la +0 -41
- package/lib/libwebp.la +0 -41
- package/lib/libwebpdemux.la +0 -41
- package/lib/libwebpmux.la +0 -41
|
@@ -323,8 +323,8 @@ namespace heif {
|
|
|
323
323
|
|
|
324
324
|
// throws Error
|
|
325
325
|
void create(int width, int height,
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
heif_colorspace colorspace,
|
|
327
|
+
heif_chroma chroma);
|
|
328
328
|
|
|
329
329
|
// throws Error
|
|
330
330
|
void add_plane(enum heif_channel channel,
|
|
@@ -391,14 +391,14 @@ namespace heif {
|
|
|
391
391
|
{
|
|
392
392
|
public:
|
|
393
393
|
static std::vector<EncoderDescriptor>
|
|
394
|
-
get_encoder_descriptors(
|
|
394
|
+
get_encoder_descriptors(heif_compression_format format_filter,
|
|
395
395
|
const char* name_filter) noexcept;
|
|
396
396
|
|
|
397
397
|
std::string get_name() const noexcept;
|
|
398
398
|
|
|
399
399
|
std::string get_id_name() const noexcept;
|
|
400
400
|
|
|
401
|
-
|
|
401
|
+
heif_compression_format get_compression_format() const noexcept;
|
|
402
402
|
|
|
403
403
|
// DEPRECATED: typo in function name
|
|
404
404
|
bool supportes_lossy_compression() const noexcept;
|
|
@@ -453,7 +453,7 @@ namespace heif {
|
|
|
453
453
|
{
|
|
454
454
|
public:
|
|
455
455
|
// throws Error
|
|
456
|
-
Encoder(
|
|
456
|
+
Encoder(heif_compression_format format);
|
|
457
457
|
|
|
458
458
|
// throws Error
|
|
459
459
|
void set_lossy_quality(int quality);
|
|
@@ -859,8 +859,8 @@ namespace heif {
|
|
|
859
859
|
|
|
860
860
|
|
|
861
861
|
inline void Image::create(int width, int height,
|
|
862
|
-
|
|
863
|
-
|
|
862
|
+
heif_colorspace colorspace,
|
|
863
|
+
heif_chroma chroma)
|
|
864
864
|
{
|
|
865
865
|
heif_image* image;
|
|
866
866
|
Error err = Error(heif_image_create(width, height, colorspace, chroma, &image));
|
|
@@ -1023,7 +1023,7 @@ namespace heif {
|
|
|
1023
1023
|
|
|
1024
1024
|
|
|
1025
1025
|
inline std::vector<EncoderDescriptor>
|
|
1026
|
-
EncoderDescriptor::get_encoder_descriptors(
|
|
1026
|
+
EncoderDescriptor::get_encoder_descriptors(heif_compression_format format_filter,
|
|
1027
1027
|
const char* name_filter) noexcept
|
|
1028
1028
|
{
|
|
1029
1029
|
int maxDescriptors = 10;
|
|
@@ -1066,7 +1066,7 @@ namespace heif {
|
|
|
1066
1066
|
return heif_encoder_descriptor_get_id_name(m_descriptor);
|
|
1067
1067
|
}
|
|
1068
1068
|
|
|
1069
|
-
inline
|
|
1069
|
+
inline heif_compression_format EncoderDescriptor::get_compression_format() const noexcept
|
|
1070
1070
|
{
|
|
1071
1071
|
return heif_encoder_descriptor_get_compression_format(m_descriptor);
|
|
1072
1072
|
}
|
|
@@ -1103,7 +1103,7 @@ namespace heif {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
1105
1105
|
|
|
1106
|
-
inline Encoder::Encoder(
|
|
1106
|
+
inline Encoder::Encoder(heif_compression_format format)
|
|
1107
1107
|
{
|
|
1108
1108
|
heif_encoder* encoder;
|
|
1109
1109
|
Error err = Error(heif_context_get_encoder_for_format(nullptr, format, &encoder));
|
|
@@ -39,11 +39,18 @@ extern "C" {
|
|
|
39
39
|
LIBHEIF_API
|
|
40
40
|
void heif_context_set_max_decoding_threads(heif_context* ctx, int max_threads);
|
|
41
41
|
|
|
42
|
+
// Returns the current maximum number of background threads used for parallel tile decoding.
|
|
43
|
+
// This reflects either the library default or the value last passed to
|
|
44
|
+
// heif_context_set_max_decoding_threads().
|
|
45
|
+
// If 'ctx' is NULL, the library default is returned.
|
|
46
|
+
LIBHEIF_API
|
|
47
|
+
int heif_context_get_max_decoding_threads(const heif_context* ctx);
|
|
48
|
+
|
|
42
49
|
// Quick check whether there is a decoder available for the given format.
|
|
43
50
|
// Note that the decoder still may not be able to decode all variants of that format.
|
|
44
51
|
// You will have to query that further (todo) or just try to decode and check the returned error.
|
|
45
52
|
LIBHEIF_API
|
|
46
|
-
int heif_have_decoder_for_format(
|
|
53
|
+
int heif_have_decoder_for_format(heif_compression_format format);
|
|
47
54
|
|
|
48
55
|
|
|
49
56
|
typedef enum heif_progress_step
|
|
@@ -64,11 +71,11 @@ typedef struct heif_decoding_options
|
|
|
64
71
|
uint8_t ignore_transformations;
|
|
65
72
|
|
|
66
73
|
// Any of the progress functions may be called from background threads.
|
|
67
|
-
void (* start_progress)(
|
|
74
|
+
void (* start_progress)(heif_progress_step step, int max_progress, void* progress_user_data);
|
|
68
75
|
|
|
69
|
-
void (* on_progress)(
|
|
76
|
+
void (* on_progress)(heif_progress_step step, int progress, void* progress_user_data);
|
|
70
77
|
|
|
71
|
-
void (* end_progress)(
|
|
78
|
+
void (* end_progress)(heif_progress_step step, void* progress_user_data);
|
|
72
79
|
|
|
73
80
|
void* progress_user_data;
|
|
74
81
|
|
|
@@ -107,10 +114,47 @@ typedef struct heif_decoding_options
|
|
|
107
114
|
// If enabled, it will decode the media timeline, ignoring the sequence tracks edit-list.
|
|
108
115
|
int ignore_sequence_editlist; // bool
|
|
109
116
|
|
|
117
|
+
// Requested NCLX color profile of the decoded output image. If the input
|
|
118
|
+
// image's NCLX differs, libheif will color-convert the pixels accordingly
|
|
119
|
+
// (e.g. YCbCr matrix, primaries, range) so the result matches what is
|
|
120
|
+
// requested here.
|
|
121
|
+
//
|
|
122
|
+
// When set to NULL, the behavior depends on the flag
|
|
123
|
+
// output_image_nclx_profile_passthrough below: by default NULL means
|
|
124
|
+
// "convert to sRGB"; with the passthrough flag enabled, NULL means
|
|
125
|
+
// "keep the input image's NCLX".
|
|
110
126
|
heif_color_profile_nclx* output_image_nclx_profile;
|
|
111
127
|
|
|
112
128
|
int num_library_threads; // 0 = let libheif decide (TODO, currently ignored)
|
|
113
129
|
int num_codec_threads; // 0 = use decoder default
|
|
130
|
+
|
|
131
|
+
// version 9 options
|
|
132
|
+
|
|
133
|
+
// If enabled, libheif will attempt to work around known broken-input quirks
|
|
134
|
+
// (e.g. Sony HIF files where the NCLX `colr` box disagrees with the HEVC VUI
|
|
135
|
+
// on the YCbCr range flag). Default: false (strict spec-conformant behavior).
|
|
136
|
+
uint8_t autocorrect_broken_input;
|
|
137
|
+
|
|
138
|
+
// version 10 options
|
|
139
|
+
|
|
140
|
+
// Controls the meaning of output_image_nclx_profile == NULL.
|
|
141
|
+
//
|
|
142
|
+
// When false (default), a NULL output_image_nclx_profile means "convert the
|
|
143
|
+
// decoded image to sRGB" (BT.709 primaries, sRGB transfer, BT.601 matrix,
|
|
144
|
+
// full-range). For HDR inputs (e.g. BT.2100 PQ) this silently discards the
|
|
145
|
+
// original color volume.
|
|
146
|
+
//
|
|
147
|
+
// When true, a NULL output_image_nclx_profile means "keep the input image's
|
|
148
|
+
// NCLX". The decoded image carries the input file's primaries / transfer /
|
|
149
|
+
// matrix / range, and no extra color-space conversion is performed solely
|
|
150
|
+
// because the output NCLX was unspecified. If a YCbCr<->RGB colorspace
|
|
151
|
+
// conversion fires for another reason, the input NCLX is used to drive that
|
|
152
|
+
// conversion (so the result is tagged consistently with the source).
|
|
153
|
+
//
|
|
154
|
+
// Although this flag is off by default to preserve historical behavior, new
|
|
155
|
+
// code that wants to preserve HDR through decode should generally enable it.
|
|
156
|
+
// Setting output_image_nclx_profile to a non-NULL value overrides this flag.
|
|
157
|
+
uint8_t output_image_nclx_profile_passthrough;
|
|
114
158
|
} heif_decoding_options;
|
|
115
159
|
|
|
116
160
|
|
|
@@ -136,7 +180,7 @@ typedef struct heif_decoder_descriptor heif_decoder_descriptor;
|
|
|
136
180
|
// The number of decoders is returned, which are not more than 'count' if (out_decoders != nullptr).
|
|
137
181
|
// By setting out_decoders==nullptr, you can query the number of decoders, 'count' is ignored.
|
|
138
182
|
LIBHEIF_API
|
|
139
|
-
int heif_get_decoder_descriptors(
|
|
183
|
+
int heif_get_decoder_descriptors(heif_compression_format format_filter,
|
|
140
184
|
const heif_decoder_descriptor** out_decoders,
|
|
141
185
|
int count);
|
|
142
186
|
|
|
@@ -161,8 +205,8 @@ const char* heif_decoder_descriptor_get_id_name(const heif_decoder_descriptor*);
|
|
|
161
205
|
LIBHEIF_API
|
|
162
206
|
heif_error heif_decode_image(const heif_image_handle* in_handle,
|
|
163
207
|
heif_image** out_img,
|
|
164
|
-
|
|
165
|
-
|
|
208
|
+
heif_colorspace colorspace,
|
|
209
|
+
heif_chroma chroma,
|
|
166
210
|
const heif_decoding_options* options);
|
|
167
211
|
|
|
168
212
|
#ifdef __cplusplus
|
|
@@ -33,7 +33,11 @@ extern "C" {
|
|
|
33
33
|
#include <libheif/heif_context.h>
|
|
34
34
|
#include <libheif/heif_brands.h>
|
|
35
35
|
#include <libheif/heif_color.h>
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
// Forward declaration. The full definition lives in heif_uncompressed.h.
|
|
38
|
+
// heif_encoding_options only stores a pointer, so a forward typedef is enough here
|
|
39
|
+
// and avoids a circular include (heif_uncompressed.h pulls in heif.h, which pulls in this header).
|
|
40
|
+
typedef struct heif_unci_image_parameters heif_unci_image_parameters;
|
|
37
41
|
|
|
38
42
|
|
|
39
43
|
// ----- encoder -----
|
|
@@ -56,7 +60,7 @@ typedef struct heif_encoder_parameter heif_encoder_parameter;
|
|
|
56
60
|
// Note that the encoder may be limited to a certain subset of features (e.g. only 8 bit, only lossy).
|
|
57
61
|
// You will have to query the specific capabilities further.
|
|
58
62
|
LIBHEIF_API
|
|
59
|
-
int heif_have_encoder_for_format(
|
|
63
|
+
int heif_have_encoder_for_format(heif_compression_format format);
|
|
60
64
|
|
|
61
65
|
// Get a list of available encoders. You can filter the encoders by compression format and name.
|
|
62
66
|
// Use format_filter==heif_compression_undefined and name_filter==NULL as wildcards.
|
|
@@ -65,7 +69,7 @@ int heif_have_encoder_for_format(enum heif_compression_format format);
|
|
|
65
69
|
// By setting out_encoders==nullptr, you can query the number of encoders, 'count' is ignored.
|
|
66
70
|
// Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
|
|
67
71
|
LIBHEIF_API
|
|
68
|
-
int heif_get_encoder_descriptors(
|
|
72
|
+
int heif_get_encoder_descriptors(heif_compression_format format_filter,
|
|
69
73
|
const char* name_filter,
|
|
70
74
|
const heif_encoder_descriptor** out_encoders,
|
|
71
75
|
int count);
|
|
@@ -80,7 +84,7 @@ LIBHEIF_API
|
|
|
80
84
|
const char* heif_encoder_descriptor_get_id_name(const heif_encoder_descriptor*);
|
|
81
85
|
|
|
82
86
|
LIBHEIF_API
|
|
83
|
-
|
|
87
|
+
heif_compression_format
|
|
84
88
|
heif_encoder_descriptor_get_compression_format(const heif_encoder_descriptor*);
|
|
85
89
|
|
|
86
90
|
LIBHEIF_API
|
|
@@ -100,7 +104,7 @@ heif_error heif_context_get_encoder(heif_context* context,
|
|
|
100
104
|
// for this format, the encoder with the highest plugin priority will be returned.
|
|
101
105
|
LIBHEIF_API
|
|
102
106
|
heif_error heif_context_get_encoder_for_format(heif_context* context,
|
|
103
|
-
|
|
107
|
+
heif_compression_format format,
|
|
104
108
|
heif_encoder**);
|
|
105
109
|
|
|
106
110
|
/**
|
|
@@ -315,9 +319,11 @@ typedef struct heif_encoding_options
|
|
|
315
319
|
|
|
316
320
|
// version 8 options
|
|
317
321
|
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
|
|
322
|
+
// Optional 'unci'-specific encoding parameters (compression method, and future fields
|
|
323
|
+
// such as interleave type and padding).
|
|
324
|
+
//
|
|
325
|
+
// Default: nullptr
|
|
326
|
+
const heif_unci_image_parameters* unci_parameters;
|
|
321
327
|
|
|
322
328
|
// TODO: we should add a flag to force MIAF compatible outputs. E.g. this will put restrictions on grid tile sizes and
|
|
323
329
|
// might add a clap box when the grid output size does not match the color subsampling factors.
|
|
@@ -407,7 +413,7 @@ int heif_encoder_descriptor_supportes_lossless_compression(const heif_encoder_de
|
|
|
407
413
|
// Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
|
|
408
414
|
LIBHEIF_API
|
|
409
415
|
int heif_context_get_encoder_descriptors(heif_context*, // TODO: why do we need this parameter?
|
|
410
|
-
|
|
416
|
+
heif_compression_format format_filter,
|
|
411
417
|
const char* name_filter,
|
|
412
418
|
const heif_encoder_descriptor** out_encoders,
|
|
413
419
|
int count);
|
|
@@ -28,6 +28,8 @@ extern "C" {
|
|
|
28
28
|
#include <stddef.h>
|
|
29
29
|
#include <stdint.h>
|
|
30
30
|
|
|
31
|
+
#include <libheif/heif_export.h>
|
|
32
|
+
|
|
31
33
|
|
|
32
34
|
typedef enum heif_error_code
|
|
33
35
|
{
|
|
@@ -191,6 +193,11 @@ typedef enum heif_suberror_code
|
|
|
191
193
|
|
|
192
194
|
heif_suberror_No_moov_box = 151,
|
|
193
195
|
|
|
196
|
+
// The colr (NCLX) box and the codec bitstream VUI/color signalling disagree.
|
|
197
|
+
// Per ISO/IEC 14496-12 and ISO/IEC 23000-22 (MIAF) the colr box takes precedence,
|
|
198
|
+
// but the conflict is reported as a warning.
|
|
199
|
+
heif_suberror_NCLX_colr_VUI_mismatch = 152,
|
|
200
|
+
|
|
194
201
|
// --- Memory_allocation_error ---
|
|
195
202
|
|
|
196
203
|
// A security limit preventing unreasonable memory allocations was exceeded by the input file.
|
|
@@ -284,10 +291,10 @@ typedef enum heif_suberror_code
|
|
|
284
291
|
typedef struct heif_error
|
|
285
292
|
{
|
|
286
293
|
// main error category
|
|
287
|
-
|
|
294
|
+
heif_error_code code;
|
|
288
295
|
|
|
289
296
|
// more detailed error code
|
|
290
|
-
|
|
297
|
+
heif_suberror_code subcode;
|
|
291
298
|
|
|
292
299
|
// textual error message (is always defined, you do not have to check for NULL)
|
|
293
300
|
const char* message;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2026 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_EXPORT_H
|
|
22
|
+
#define LIBHEIF_HEIF_EXPORT_H
|
|
23
|
+
|
|
24
|
+
// LIBHEIF_API marks the symbols that are exported from the shared library.
|
|
25
|
+
//
|
|
26
|
+
// This macro lives in its own tiny, dependency-free header so that every
|
|
27
|
+
// public header can pull it in without creating include cycles. In particular,
|
|
28
|
+
// heif_library.h and heif_error.h are mutually dependent (heif_library.h needs
|
|
29
|
+
// the heif_error type while heif_error.h needs LIBHEIF_API), so the macro
|
|
30
|
+
// cannot live in either of them if both are to compile standalone.
|
|
31
|
+
|
|
32
|
+
#if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
|
|
33
|
+
#ifdef LIBHEIF_EXPORTS
|
|
34
|
+
#define LIBHEIF_API __declspec(dllexport)
|
|
35
|
+
#else
|
|
36
|
+
#define LIBHEIF_API __declspec(dllimport)
|
|
37
|
+
#endif
|
|
38
|
+
#elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
|
|
39
|
+
#ifdef LIBHEIF_EXPORTS
|
|
40
|
+
#define LIBHEIF_API __attribute__((__visibility__("default")))
|
|
41
|
+
#else
|
|
42
|
+
#define LIBHEIF_API
|
|
43
|
+
#endif
|
|
44
|
+
#else
|
|
45
|
+
#define LIBHEIF_API
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#endif // LIBHEIF_HEIF_EXPORT_H
|
|
@@ -31,10 +31,29 @@ extern "C" {
|
|
|
31
31
|
#include <stdint.h>
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
// The heif_chroma enum describes pixel layout (planar vs interleaved, and any
|
|
35
|
+
// YUV chroma subsampling). It does NOT describe pixel semantics; the semantic
|
|
36
|
+
// interpretation of the planes comes from heif_colorspace.
|
|
37
|
+
//
|
|
38
|
+
// heif_chroma_planar covers "one or more planar components, no subsampling".
|
|
39
|
+
// It is used for:
|
|
40
|
+
// - heif_colorspace_monochrome (single luma plane)
|
|
41
|
+
// - heif_colorspace_filter_array (single CFA mosaic plane)
|
|
42
|
+
// - heif_colorspace_custom (any number of planar components)
|
|
43
|
+
// For heif_colorspace_RGB the historical name heif_chroma_444 is the
|
|
44
|
+
// canonical form for planar RGB. heif_chroma_planar is accepted as a
|
|
45
|
+
// synonym at the C API boundary and is internally canonicalized to
|
|
46
|
+
// heif_chroma_444 so existing callers and internal code paths keep seeing
|
|
47
|
+
// heif_chroma_444 on read-back. Callers should also accept a returned
|
|
48
|
+
// heif_chroma_planar as a synonym. We might switch to this as the
|
|
49
|
+
// canonical name in the future.
|
|
50
|
+
//
|
|
51
|
+
// The YUV subsampling names (heif_chroma_420 / _422 / _444) are kept for
|
|
52
|
+
// heif_colorspace_YCbCr.
|
|
34
53
|
typedef enum heif_chroma
|
|
35
54
|
{
|
|
36
55
|
heif_chroma_undefined = 99,
|
|
37
|
-
|
|
56
|
+
heif_chroma_planar = 0,
|
|
38
57
|
heif_chroma_420 = 1,
|
|
39
58
|
heif_chroma_422 = 2,
|
|
40
59
|
heif_chroma_444 = 3,
|
|
@@ -50,6 +69,11 @@ typedef enum heif_chroma
|
|
|
50
69
|
#define heif_chroma_interleaved_24bit heif_chroma_interleaved_RGB
|
|
51
70
|
#define heif_chroma_interleaved_32bit heif_chroma_interleaved_RGBA
|
|
52
71
|
|
|
72
|
+
// Legacy alias for heif_chroma_planar. The name "monochrome" was misleading
|
|
73
|
+
// for non-grayscale planar layouts (filter_array, custom); use
|
|
74
|
+
// heif_chroma_planar in new code.
|
|
75
|
+
#define heif_chroma_monochrome heif_chroma_planar
|
|
76
|
+
|
|
53
77
|
|
|
54
78
|
typedef enum heif_colorspace
|
|
55
79
|
{
|
|
@@ -63,6 +87,8 @@ typedef enum heif_colorspace
|
|
|
63
87
|
|
|
64
88
|
// heif_colorspace_RGB should be used with one of these heif_chroma values:
|
|
65
89
|
// * heif_chroma_444 (for planar RGB)
|
|
90
|
+
// * heif_chroma_planar is accepted as a synonym and is internally canonicalized to heif_chroma_444.
|
|
91
|
+
// It is the preferred, future-proof value.
|
|
66
92
|
// * heif_chroma_interleaved_RGB
|
|
67
93
|
// * heif_chroma_interleaved_RGBA
|
|
68
94
|
// * heif_chroma_interleaved_RRGGBB_BE
|
|
@@ -71,15 +97,21 @@ typedef enum heif_colorspace
|
|
|
71
97
|
// * heif_chroma_interleaved_RRGGBBAA_LE
|
|
72
98
|
heif_colorspace_RGB = 1,
|
|
73
99
|
|
|
74
|
-
// heif_colorspace_monochrome should only be used with heif_chroma =
|
|
100
|
+
// heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_planar.
|
|
75
101
|
heif_colorspace_monochrome = 2,
|
|
76
102
|
|
|
77
|
-
// Indicates that this image has
|
|
78
|
-
|
|
103
|
+
// Indicates that this image has a special, custom arrangement of components.
|
|
104
|
+
// For example, it can have several monochrome channels or just a depth component with no color image.
|
|
105
|
+
// Images of this type are always planar and use heif_chroma_planar.
|
|
106
|
+
heif_colorspace_custom = 3,
|
|
79
107
|
|
|
108
|
+
// Images of this type are filter-array (CFA / Bayer) mosaics. The single
|
|
109
|
+
// mosaicked plane is described as heif_chroma_planar.
|
|
80
110
|
heif_colorspace_filter_array = 4
|
|
81
111
|
} heif_colorspace;
|
|
82
112
|
|
|
113
|
+
#define heif_colorspace_nonvisual heif_colorspace_custom
|
|
114
|
+
|
|
83
115
|
typedef enum heif_channel
|
|
84
116
|
{
|
|
85
117
|
heif_channel_Y = 0,
|
|
@@ -96,41 +128,6 @@ typedef enum heif_channel
|
|
|
96
128
|
heif_channel_unknown = 65535
|
|
97
129
|
} heif_channel;
|
|
98
130
|
|
|
99
|
-
#if HEIF_WITH_OMAF
|
|
100
|
-
/**
|
|
101
|
-
* OMAF Image projection.
|
|
102
|
-
*
|
|
103
|
-
* The image projection for most images is flat - it is projected as intended to be shown on
|
|
104
|
-
* a flat screen or print. For immersive or omnidirectional media (e.g. VR headsets, or
|
|
105
|
-
* equivalent), there are alternatives such as an equirectangular projection or cubemap projection.
|
|
106
|
-
*
|
|
107
|
-
* See ISO/IEC 23090-2 "Omnidirectional media format" for more information.
|
|
108
|
-
*/
|
|
109
|
-
typedef enum heif_omaf_image_projection
|
|
110
|
-
{
|
|
111
|
-
/**
|
|
112
|
-
* Equirectangular projection.
|
|
113
|
-
*/
|
|
114
|
-
heif_omaf_image_projection_equirectangular = 0x00,
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Cube map.
|
|
118
|
-
*/
|
|
119
|
-
heif_omaf_image_projection_cube_map = 0x01,
|
|
120
|
-
|
|
121
|
-
/* Values 2 through 31 are reserved in ISO/IEC 23090-2:2023 Table 10. */
|
|
122
|
-
/**
|
|
123
|
-
* Projection is specified, but not recognised.
|
|
124
|
-
*/
|
|
125
|
-
heif_omaf_image_projection_unknown = 0xFE,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Flat projection, assumed if no projection information provided.
|
|
129
|
-
*/
|
|
130
|
-
heif_omaf_image_projection_flat = 0xFF,
|
|
131
|
-
} heif_omaf_image_projection;
|
|
132
|
-
#endif
|
|
133
|
-
|
|
134
131
|
// An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
|
|
135
132
|
// and bit depths.
|
|
136
133
|
|
|
@@ -139,6 +136,9 @@ typedef enum heif_omaf_image_projection
|
|
|
139
136
|
// containing the interleaved R,G,B values.
|
|
140
137
|
|
|
141
138
|
// Planar RGB images are specified as heif_colorspace_RGB / heif_chroma_444.
|
|
139
|
+
// heif_chroma_planar is accepted as a synonym and is internally canonicalized
|
|
140
|
+
// to heif_chroma_444 so heif_image_get_chroma_format() always returns
|
|
141
|
+
// heif_chroma_444 for planar RGB.
|
|
142
142
|
|
|
143
143
|
typedef struct heif_image heif_image;
|
|
144
144
|
typedef struct heif_image_handle heif_image_handle;
|
|
@@ -147,11 +147,11 @@ typedef struct heif_security_limits heif_security_limits;
|
|
|
147
147
|
|
|
148
148
|
// Get the colorspace format of the image.
|
|
149
149
|
LIBHEIF_API
|
|
150
|
-
|
|
150
|
+
heif_colorspace heif_image_get_colorspace(const heif_image*);
|
|
151
151
|
|
|
152
152
|
// Get the chroma format of the image.
|
|
153
153
|
LIBHEIF_API
|
|
154
|
-
|
|
154
|
+
heif_chroma heif_image_get_chroma_format(const heif_image*);
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
157
|
* Get the width of a specified image channel.
|
|
@@ -161,7 +161,7 @@ enum heif_chroma heif_image_get_chroma_format(const heif_image*);
|
|
|
161
161
|
* @return the width of the channel in pixels, or -1 the channel does not exist in the image
|
|
162
162
|
*/
|
|
163
163
|
LIBHEIF_API
|
|
164
|
-
int heif_image_get_width(const heif_image* img,
|
|
164
|
+
int heif_image_get_width(const heif_image* img, heif_channel channel);
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* Get the height of a specified image channel.
|
|
@@ -171,12 +171,13 @@ int heif_image_get_width(const heif_image* img, enum heif_channel channel);
|
|
|
171
171
|
* @return the height of the channel in pixels, or -1 the channel does not exist in the image
|
|
172
172
|
*/
|
|
173
173
|
LIBHEIF_API
|
|
174
|
-
int heif_image_get_height(const heif_image* img,
|
|
174
|
+
int heif_image_get_height(const heif_image* img, heif_channel channel);
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
* Get the width of the
|
|
177
|
+
* Get the logical width of the image.
|
|
178
178
|
*
|
|
179
|
-
*
|
|
179
|
+
* For well-formed images this equals the size of the main channel (the Y channel
|
|
180
|
+
* in YCbCr or mono, or the RGB channels). Subsampled chroma channels may be smaller.
|
|
180
181
|
*
|
|
181
182
|
* @param img the image to get the primary width for
|
|
182
183
|
* @return the width in pixels
|
|
@@ -185,9 +186,10 @@ LIBHEIF_API
|
|
|
185
186
|
int heif_image_get_primary_width(const heif_image* img);
|
|
186
187
|
|
|
187
188
|
/**
|
|
188
|
-
* Get the height of the
|
|
189
|
+
* Get the logical height of the image.
|
|
189
190
|
*
|
|
190
|
-
*
|
|
191
|
+
* For well-formed images this equals the size of the main channel (the Y channel
|
|
192
|
+
* in YCbCr or mono, or the RGB channels). Subsampled chroma channels may be smaller.
|
|
191
193
|
*
|
|
192
194
|
* @param img the image to get the primary height for
|
|
193
195
|
* @return the height in pixels
|
|
@@ -195,6 +197,27 @@ int heif_image_get_primary_width(const heif_image* img);
|
|
|
195
197
|
LIBHEIF_API
|
|
196
198
|
int heif_image_get_primary_height(const heif_image* img);
|
|
197
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Crop the image in place by removing margins from each edge.
|
|
202
|
+
*
|
|
203
|
+
* The four parameters specify the number of pixels to remove from each side,
|
|
204
|
+
* not absolute pixel coordinates. For example, to crop a 100x100 image down
|
|
205
|
+
* to its central 80x80 region, pass `left=10, right=10, top=10, bottom=10`.
|
|
206
|
+
* Passing all zeros leaves the image unchanged.
|
|
207
|
+
*
|
|
208
|
+
* The resulting image has dimensions `(w - left - right) x (h - top - bottom)`,
|
|
209
|
+
* which must be at least 1x1. All four values must be non-negative and the
|
|
210
|
+
* sums `left + right` and `top + bottom` must each be strictly less than the
|
|
211
|
+
* corresponding image dimension; otherwise `heif_error_Usage_error` /
|
|
212
|
+
* `heif_suberror_Invalid_parameter_value` is returned and the image is left
|
|
213
|
+
* unchanged.
|
|
214
|
+
*
|
|
215
|
+
* @param img the image to crop (modified in place on success)
|
|
216
|
+
* @param left number of pixels to remove from the left edge
|
|
217
|
+
* @param right number of pixels to remove from the right edge
|
|
218
|
+
* @param top number of pixels to remove from the top edge
|
|
219
|
+
* @param bottom number of pixels to remove from the bottom edge
|
|
220
|
+
*/
|
|
198
221
|
LIBHEIF_API
|
|
199
222
|
heif_error heif_image_crop(heif_image* img,
|
|
200
223
|
int left, int right, int top, int bottom);
|
|
@@ -212,7 +235,7 @@ heif_error heif_image_extract_area(const heif_image*,
|
|
|
212
235
|
// Especially for HDR images, this is probably not what you want. Have a look at
|
|
213
236
|
// heif_image_get_bits_per_pixel_range() instead.
|
|
214
237
|
LIBHEIF_API
|
|
215
|
-
int heif_image_get_bits_per_pixel(const heif_image*,
|
|
238
|
+
int heif_image_get_bits_per_pixel(const heif_image*, heif_channel channel);
|
|
216
239
|
|
|
217
240
|
// Get the number of bits per pixel in the given image channel. This function returns
|
|
218
241
|
// the number of bits used for representing the pixel value, which might be smaller
|
|
@@ -221,10 +244,10 @@ int heif_image_get_bits_per_pixel(const heif_image*, enum heif_channel channel);
|
|
|
221
244
|
// are reserved for storage. For interleaved RGBA with 12 bit, this function also returns
|
|
222
245
|
// '12', not '48' or '64' (heif_image_get_bits_per_pixel returns 64 in this case).
|
|
223
246
|
LIBHEIF_API
|
|
224
|
-
int heif_image_get_bits_per_pixel_range(const heif_image*,
|
|
247
|
+
int heif_image_get_bits_per_pixel_range(const heif_image*, heif_channel channel);
|
|
225
248
|
|
|
226
249
|
LIBHEIF_API
|
|
227
|
-
int heif_image_has_channel(const heif_image*,
|
|
250
|
+
int heif_image_has_channel(const heif_image*, heif_channel channel);
|
|
228
251
|
|
|
229
252
|
// Get a pointer to the actual pixel data.
|
|
230
253
|
// The 'out_stride' is returned as "bytes per line".
|
|
@@ -233,13 +256,13 @@ int heif_image_has_channel(const heif_image*, enum heif_channel channel);
|
|
|
233
256
|
// Deprecated, use the safer version heif_image_get_plane_readonly2() instead.
|
|
234
257
|
LIBHEIF_API
|
|
235
258
|
const uint8_t* heif_image_get_plane_readonly(const heif_image*,
|
|
236
|
-
|
|
259
|
+
heif_channel channel,
|
|
237
260
|
int* out_stride);
|
|
238
261
|
|
|
239
262
|
// Deprecated, use the safer version heif_image_get_plane2() instead.
|
|
240
263
|
LIBHEIF_API
|
|
241
264
|
uint8_t* heif_image_get_plane(heif_image*,
|
|
242
|
-
|
|
265
|
+
heif_channel channel,
|
|
243
266
|
int* out_stride);
|
|
244
267
|
|
|
245
268
|
// These are safer variants of the two functions above.
|
|
@@ -248,12 +271,12 @@ uint8_t* heif_image_get_plane(heif_image*,
|
|
|
248
271
|
// The changed 'stride' parameter type eliminates this common error.
|
|
249
272
|
LIBHEIF_API
|
|
250
273
|
const uint8_t* heif_image_get_plane_readonly2(const heif_image*,
|
|
251
|
-
|
|
274
|
+
heif_channel channel,
|
|
252
275
|
size_t* out_stride);
|
|
253
276
|
|
|
254
277
|
LIBHEIF_API
|
|
255
278
|
uint8_t* heif_image_get_plane2(heif_image*,
|
|
256
|
-
|
|
279
|
+
heif_channel channel,
|
|
257
280
|
size_t* out_stride);
|
|
258
281
|
|
|
259
282
|
|
|
@@ -302,14 +325,6 @@ void heif_image_set_pixel_aspect_ratio(heif_image*, uint32_t aspect_h, uint32_t
|
|
|
302
325
|
LIBHEIF_API
|
|
303
326
|
void heif_image_handle_set_pixel_aspect_ratio(heif_image_handle*, uint32_t aspect_h, uint32_t aspect_v);
|
|
304
327
|
|
|
305
|
-
#if HEIF_WITH_OMAF
|
|
306
|
-
LIBHEIF_API
|
|
307
|
-
heif_omaf_image_projection heif_image_get_omaf_image_projection(const heif_image*);
|
|
308
|
-
|
|
309
|
-
LIBHEIF_API
|
|
310
|
-
void heif_image_set_omaf_image_projection(const heif_image*, heif_omaf_image_projection image_projection);
|
|
311
|
-
#endif
|
|
312
|
-
|
|
313
328
|
// --- heif_image allocation
|
|
314
329
|
|
|
315
330
|
/**
|
|
@@ -327,8 +342,8 @@ void heif_image_set_omaf_image_projection(const heif_image*, heif_omaf_image_pro
|
|
|
327
342
|
*/
|
|
328
343
|
LIBHEIF_API
|
|
329
344
|
heif_error heif_image_create(int width, int height,
|
|
330
|
-
|
|
331
|
-
|
|
345
|
+
heif_colorspace colorspace,
|
|
346
|
+
heif_chroma chroma,
|
|
332
347
|
heif_image** out_image);
|
|
333
348
|
|
|
334
349
|
/**
|
|
@@ -361,7 +376,7 @@ heif_error heif_image_create(int width, int height,
|
|
|
361
376
|
*/
|
|
362
377
|
LIBHEIF_API
|
|
363
378
|
heif_error heif_image_add_plane(heif_image* image,
|
|
364
|
-
|
|
379
|
+
heif_channel channel,
|
|
365
380
|
int width, int height, int bit_depth);
|
|
366
381
|
|
|
367
382
|
/*
|
|
@@ -370,7 +385,7 @@ heif_error heif_image_add_plane(heif_image* image,
|
|
|
370
385
|
*/
|
|
371
386
|
LIBHEIF_API
|
|
372
387
|
heif_error heif_image_add_plane_safe(heif_image* image,
|
|
373
|
-
|
|
388
|
+
heif_channel channel,
|
|
374
389
|
int width, int height, int bit_depth,
|
|
375
390
|
const heif_security_limits* limits);
|
|
376
391
|
|
|
@@ -91,8 +91,8 @@ int heif_image_handle_get_chroma_bits_per_pixel(const heif_image_handle*);
|
|
|
91
91
|
// You can still request the output in your preferred colorspace, but this may involve an internal conversion.
|
|
92
92
|
LIBHEIF_API
|
|
93
93
|
heif_error heif_image_handle_get_preferred_decoding_colorspace(const heif_image_handle* image_handle,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
heif_colorspace* out_colorspace,
|
|
95
|
+
heif_chroma* out_chroma);
|
|
96
96
|
|
|
97
97
|
// Get the image width from the 'ispe' box. This is the original image size without
|
|
98
98
|
// any transformations applied to it. Do not use this unless you know exactly what
|
|
@@ -61,7 +61,7 @@ int heif_context_get_list_of_item_IDs(const heif_context* ctx,
|
|
|
61
61
|
* Gets the item type.
|
|
62
62
|
*
|
|
63
63
|
* Usually, this is a four character code (e.g. `mime` or `uri `), but it can theoretically be
|
|
64
|
-
* any 4-byte number. Thus, the type is returned as an integer. You can use
|
|
64
|
+
* any 4-byte number. Thus, the type is returned as an integer. You can use #heif_fourcc to map
|
|
65
65
|
* between the two representations.
|
|
66
66
|
*
|
|
67
67
|
* @param ctx the file context
|