@img/sharp-libvips-dev 1.2.0-rc.3 → 1.2.0-rc.4
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/include/fontconfig/fontconfig.h +12 -2
- package/include/glib-2.0/girepository/girepository.h +3 -0
- package/include/glib-2.0/glib/gmarkup.h +4 -0
- package/include/libheif/heif.h +16 -2603
- package/include/libheif/heif_aux_images.h +182 -0
- package/include/libheif/heif_brands.h +373 -0
- package/include/libheif/heif_color.h +357 -0
- package/include/libheif/heif_context.h +329 -0
- package/include/libheif/heif_cxx.h +6 -6
- package/include/libheif/heif_decoding.h +162 -0
- package/include/libheif/heif_encoding.h +391 -0
- package/include/libheif/heif_entity_groups.h +60 -0
- package/include/libheif/heif_error.h +302 -0
- package/include/libheif/heif_image.h +352 -0
- package/include/libheif/heif_image_handle.h +120 -0
- package/include/libheif/heif_items.h +45 -45
- package/include/libheif/heif_library.h +216 -0
- package/include/libheif/heif_metadata.h +133 -0
- package/include/libheif/heif_plugin.h +53 -41
- package/include/libheif/heif_properties.h +73 -36
- package/include/libheif/heif_regions.h +95 -95
- package/include/libheif/heif_security.h +102 -0
- package/include/libheif/heif_sequences.h +577 -0
- package/include/libheif/heif_tai_timestamps.h +202 -0
- package/include/libheif/heif_tiling.h +137 -0
- package/include/libheif/heif_uncompressed.h +109 -0
- 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/pango-1.0/pango/pango-attributes.h +1 -1
- package/include/pango-1.0/pango/pango-features.h +2 -2
- package/include/png.h +7 -7
- package/include/pngconf.h +1 -1
- package/include/pnglibconf.h +1 -1
- package/include/vips/version.h +4 -4
- package/package.json +1 -1
- package/versions.json +5 -5
|
@@ -345,9 +345,9 @@ namespace heif {
|
|
|
345
345
|
|
|
346
346
|
bool has_channel(enum heif_channel channel) const noexcept;
|
|
347
347
|
|
|
348
|
-
const uint8_t* get_plane(enum heif_channel channel,
|
|
348
|
+
const uint8_t* get_plane(enum heif_channel channel, size_t* out_stride) const noexcept;
|
|
349
349
|
|
|
350
|
-
uint8_t* get_plane(enum heif_channel channel,
|
|
350
|
+
uint8_t* get_plane(enum heif_channel channel, size_t* out_stride) noexcept;
|
|
351
351
|
|
|
352
352
|
// throws Error
|
|
353
353
|
void set_nclx_color_profile(const ColorProfile_nclx&);
|
|
@@ -906,14 +906,14 @@ namespace heif {
|
|
|
906
906
|
return heif_image_has_channel(m_image.get(), channel);
|
|
907
907
|
}
|
|
908
908
|
|
|
909
|
-
inline const uint8_t* Image::get_plane(enum heif_channel channel,
|
|
909
|
+
inline const uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) const noexcept
|
|
910
910
|
{
|
|
911
|
-
return
|
|
911
|
+
return heif_image_get_plane_readonly2(m_image.get(), channel, out_stride);
|
|
912
912
|
}
|
|
913
913
|
|
|
914
|
-
inline uint8_t* Image::get_plane(enum heif_channel channel,
|
|
914
|
+
inline uint8_t* Image::get_plane(enum heif_channel channel, size_t* out_stride) noexcept
|
|
915
915
|
{
|
|
916
|
-
return
|
|
916
|
+
return heif_image_get_plane2(m_image.get(), channel, out_stride);
|
|
917
917
|
}
|
|
918
918
|
|
|
919
919
|
inline void Image::set_nclx_color_profile(const ColorProfile_nclx& nclx)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2025 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_DECODING_H
|
|
22
|
+
#define LIBHEIF_HEIF_DECODING_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <libheif/heif_library.h>
|
|
29
|
+
#include <libheif/heif_image.h>
|
|
30
|
+
#include <libheif/heif_context.h>
|
|
31
|
+
#include <libheif/heif_color.h>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// If the maximum threads number is set to 0, the image tiles are decoded in the main thread.
|
|
35
|
+
// This is different from setting it to 1, which will generate a single background thread to decode the tiles.
|
|
36
|
+
// Note that this setting only affects libheif itself. The codecs itself may still use multi-threaded decoding.
|
|
37
|
+
// You can use it, for example, in cases where you are decoding several images in parallel anyway you thus want
|
|
38
|
+
// to minimize parallelism in each decoder.
|
|
39
|
+
LIBHEIF_API
|
|
40
|
+
void heif_context_set_max_decoding_threads(heif_context* ctx, int max_threads);
|
|
41
|
+
|
|
42
|
+
// Quick check whether there is a decoder available for the given format.
|
|
43
|
+
// Note that the decoder still may not be able to decode all variants of that format.
|
|
44
|
+
// You will have to query that further (todo) or just try to decode and check the returned error.
|
|
45
|
+
LIBHEIF_API
|
|
46
|
+
int heif_have_decoder_for_format(enum heif_compression_format format);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
enum heif_progress_step
|
|
50
|
+
{
|
|
51
|
+
heif_progress_step_total = 0,
|
|
52
|
+
heif_progress_step_load_tile = 1
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
typedef struct heif_decoding_options
|
|
57
|
+
{
|
|
58
|
+
uint8_t version;
|
|
59
|
+
|
|
60
|
+
// version 1 options
|
|
61
|
+
|
|
62
|
+
// Ignore geometric transformations like cropping, rotation, mirroring.
|
|
63
|
+
// Default: false (do not ignore).
|
|
64
|
+
uint8_t ignore_transformations;
|
|
65
|
+
|
|
66
|
+
// Any of the progress functions may be called from background threads.
|
|
67
|
+
void (* start_progress)(enum heif_progress_step step, int max_progress, void* progress_user_data);
|
|
68
|
+
|
|
69
|
+
void (* on_progress)(enum heif_progress_step step, int progress, void* progress_user_data);
|
|
70
|
+
|
|
71
|
+
void (* end_progress)(enum heif_progress_step step, void* progress_user_data);
|
|
72
|
+
|
|
73
|
+
void* progress_user_data;
|
|
74
|
+
|
|
75
|
+
// version 2 options
|
|
76
|
+
|
|
77
|
+
uint8_t convert_hdr_to_8bit;
|
|
78
|
+
|
|
79
|
+
// version 3 options
|
|
80
|
+
|
|
81
|
+
// When enabled, an error is returned for invalid input. Otherwise, it will try its best and
|
|
82
|
+
// add decoding warnings to the decoded heif_image. Default is non-strict.
|
|
83
|
+
uint8_t strict_decoding;
|
|
84
|
+
|
|
85
|
+
// version 4 options
|
|
86
|
+
|
|
87
|
+
// name_id of the decoder to use for the decoding.
|
|
88
|
+
// If set to NULL (default), the highest priority decoder is chosen.
|
|
89
|
+
// The priority is defined in the plugin.
|
|
90
|
+
const char* decoder_id;
|
|
91
|
+
|
|
92
|
+
// version 5 options
|
|
93
|
+
|
|
94
|
+
heif_color_conversion_options color_conversion_options;
|
|
95
|
+
|
|
96
|
+
// version 6 options
|
|
97
|
+
|
|
98
|
+
int (* cancel_decoding)(void* progress_user_data);
|
|
99
|
+
|
|
100
|
+
// version 7 options
|
|
101
|
+
|
|
102
|
+
// When set to NULL, default options will be used
|
|
103
|
+
heif_color_conversion_options_ext* color_conversion_options_ext;
|
|
104
|
+
} heif_decoding_options;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// Allocate decoding options and fill with default values.
|
|
108
|
+
// Note: you should always get the decoding options through this function since the
|
|
109
|
+
// option structure may grow in size in future versions.
|
|
110
|
+
LIBHEIF_API
|
|
111
|
+
heif_decoding_options* heif_decoding_options_alloc(void);
|
|
112
|
+
|
|
113
|
+
LIBHEIF_API
|
|
114
|
+
void heif_decoding_options_copy(heif_decoding_options* dst,
|
|
115
|
+
const heif_decoding_options* src);
|
|
116
|
+
|
|
117
|
+
LIBHEIF_API
|
|
118
|
+
void heif_decoding_options_free(heif_decoding_options*);
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
typedef struct heif_decoder_descriptor heif_decoder_descriptor;
|
|
122
|
+
|
|
123
|
+
// Get a list of available decoders. You can filter the encoders by compression format.
|
|
124
|
+
// Use format_filter==heif_compression_undefined to get all available decoders.
|
|
125
|
+
// The returned list of decoders is sorted by their priority (which is a plugin property).
|
|
126
|
+
// The number of decoders is returned, which are not more than 'count' if (out_decoders != nullptr).
|
|
127
|
+
// By setting out_decoders==nullptr, you can query the number of decoders, 'count' is ignored.
|
|
128
|
+
LIBHEIF_API
|
|
129
|
+
int heif_get_decoder_descriptors(enum heif_compression_format format_filter,
|
|
130
|
+
const heif_decoder_descriptor** out_decoders,
|
|
131
|
+
int count);
|
|
132
|
+
|
|
133
|
+
// Return a long, descriptive name of the decoder (including version information).
|
|
134
|
+
LIBHEIF_API
|
|
135
|
+
const char* heif_decoder_descriptor_get_name(const heif_decoder_descriptor*);
|
|
136
|
+
|
|
137
|
+
// Return a short, symbolic name for identifying the decoder.
|
|
138
|
+
// This name should stay constant over different decoder versions.
|
|
139
|
+
// Note: the returned ID may be NULL for old plugins that don't support this yet.
|
|
140
|
+
LIBHEIF_API
|
|
141
|
+
const char* heif_decoder_descriptor_get_id_name(const heif_decoder_descriptor*);
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// Decode an heif_image_handle into the actual pixel image and also carry out
|
|
145
|
+
// all geometric transformations specified in the HEIF file (rotation, cropping, mirroring).
|
|
146
|
+
//
|
|
147
|
+
// If colorspace or chroma is set to heif_colorspace_undefined or heif_chroma_undefined,
|
|
148
|
+
// respectively, the original colorspace is taken.
|
|
149
|
+
// Decoding options may be NULL. If you want to supply options, always use
|
|
150
|
+
// heif_decoding_options_alloc() to get the structure.
|
|
151
|
+
LIBHEIF_API
|
|
152
|
+
heif_error heif_decode_image(const heif_image_handle* in_handle,
|
|
153
|
+
heif_image** out_img,
|
|
154
|
+
enum heif_colorspace colorspace,
|
|
155
|
+
enum heif_chroma chroma,
|
|
156
|
+
const heif_decoding_options* options);
|
|
157
|
+
|
|
158
|
+
#ifdef __cplusplus
|
|
159
|
+
}
|
|
160
|
+
#endif
|
|
161
|
+
|
|
162
|
+
#endif
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2025 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_ENCODING_H
|
|
22
|
+
#define LIBHEIF_HEIF_ENCODING_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include <stdint.h>
|
|
30
|
+
|
|
31
|
+
#include <libheif/heif_library.h>
|
|
32
|
+
#include <libheif/heif_image.h>
|
|
33
|
+
#include <libheif/heif_context.h>
|
|
34
|
+
#include <libheif/heif_brands.h>
|
|
35
|
+
#include <libheif/heif_color.h>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// ----- encoder -----
|
|
39
|
+
|
|
40
|
+
// The encoder used for actually encoding an image.
|
|
41
|
+
typedef struct heif_encoder heif_encoder;
|
|
42
|
+
|
|
43
|
+
// A description of the encoder's capabilities and name.
|
|
44
|
+
typedef struct heif_encoder_descriptor heif_encoder_descriptor;
|
|
45
|
+
|
|
46
|
+
// A configuration parameter of the encoder. Each encoder implementation may have a different
|
|
47
|
+
// set of parameters. For the most common settings (e.q. quality), special functions to set
|
|
48
|
+
// the parameters are provided.
|
|
49
|
+
typedef struct heif_encoder_parameter heif_encoder_parameter;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// Quick check whether there is an enoder available for the given format.
|
|
53
|
+
// Note that the encoder may be limited to a certain subset of features (e.g. only 8 bit, only lossy).
|
|
54
|
+
// You will have to query the specific capabilities further.
|
|
55
|
+
LIBHEIF_API
|
|
56
|
+
int heif_have_encoder_for_format(enum heif_compression_format format);
|
|
57
|
+
|
|
58
|
+
// Get a list of available encoders. You can filter the encoders by compression format and name.
|
|
59
|
+
// Use format_filter==heif_compression_undefined and name_filter==NULL as wildcards.
|
|
60
|
+
// The returned list of encoders is sorted by their priority (which is a plugin property).
|
|
61
|
+
// The number of encoders is returned, which are not more than 'count' if (out_encoders != nullptr).
|
|
62
|
+
// By setting out_encoders==nullptr, you can query the number of encoders, 'count' is ignored.
|
|
63
|
+
// Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
|
|
64
|
+
LIBHEIF_API
|
|
65
|
+
int heif_get_encoder_descriptors(enum heif_compression_format format_filter,
|
|
66
|
+
const char* name_filter,
|
|
67
|
+
const heif_encoder_descriptor** out_encoders,
|
|
68
|
+
int count);
|
|
69
|
+
|
|
70
|
+
// Return a long, descriptive name of the encoder (including version information).
|
|
71
|
+
LIBHEIF_API
|
|
72
|
+
const char* heif_encoder_descriptor_get_name(const heif_encoder_descriptor*);
|
|
73
|
+
|
|
74
|
+
// Return a short, symbolic name for identifying the encoder.
|
|
75
|
+
// This name should stay constant over different encoder versions.
|
|
76
|
+
LIBHEIF_API
|
|
77
|
+
const char* heif_encoder_descriptor_get_id_name(const heif_encoder_descriptor*);
|
|
78
|
+
|
|
79
|
+
LIBHEIF_API
|
|
80
|
+
enum heif_compression_format
|
|
81
|
+
heif_encoder_descriptor_get_compression_format(const heif_encoder_descriptor*);
|
|
82
|
+
|
|
83
|
+
LIBHEIF_API
|
|
84
|
+
int heif_encoder_descriptor_supports_lossy_compression(const heif_encoder_descriptor*);
|
|
85
|
+
|
|
86
|
+
LIBHEIF_API
|
|
87
|
+
int heif_encoder_descriptor_supports_lossless_compression(const heif_encoder_descriptor*);
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// Get an encoder instance that can be used to actually encode images from a descriptor.
|
|
91
|
+
LIBHEIF_API
|
|
92
|
+
heif_error heif_context_get_encoder(heif_context* context,
|
|
93
|
+
const heif_encoder_descriptor*,
|
|
94
|
+
heif_encoder** out_encoder);
|
|
95
|
+
|
|
96
|
+
// Get an encoder for the given compression format. If there are several encoder plugins
|
|
97
|
+
// for this format, the encoder with the highest plugin priority will be returned.
|
|
98
|
+
LIBHEIF_API
|
|
99
|
+
heif_error heif_context_get_encoder_for_format(heif_context* context,
|
|
100
|
+
enum heif_compression_format format,
|
|
101
|
+
heif_encoder**);
|
|
102
|
+
|
|
103
|
+
// You have to release the encoder after use.
|
|
104
|
+
LIBHEIF_API
|
|
105
|
+
void heif_encoder_release(heif_encoder*);
|
|
106
|
+
|
|
107
|
+
// Get the encoder name from the encoder itself.
|
|
108
|
+
LIBHEIF_API
|
|
109
|
+
const char* heif_encoder_get_name(const heif_encoder*);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// --- Encoder Parameters ---
|
|
113
|
+
|
|
114
|
+
// Libheif supports settings parameters through specialized functions and through
|
|
115
|
+
// generic functions by parameter name. Sometimes, the same parameter can be set
|
|
116
|
+
// in both ways.
|
|
117
|
+
// We consider it best practice to use the generic parameter functions only in
|
|
118
|
+
// dynamically generated user interfaces, as no guarantees are made that some specific
|
|
119
|
+
// parameter names are supported by all plugins.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// Set a 'quality' factor (0-100). How this is mapped to actual encoding parameters is
|
|
123
|
+
// encoder dependent.
|
|
124
|
+
LIBHEIF_API
|
|
125
|
+
heif_error heif_encoder_set_lossy_quality(heif_encoder*, int quality);
|
|
126
|
+
|
|
127
|
+
LIBHEIF_API
|
|
128
|
+
heif_error heif_encoder_set_lossless(heif_encoder*, int enable);
|
|
129
|
+
|
|
130
|
+
// level should be between 0 (= none) to 4 (= full)
|
|
131
|
+
LIBHEIF_API
|
|
132
|
+
heif_error heif_encoder_set_logging_level(heif_encoder*, int level);
|
|
133
|
+
|
|
134
|
+
// Get a generic list of encoder parameters.
|
|
135
|
+
// Each encoder may define its own, additional set of parameters.
|
|
136
|
+
// You do not have to free the returned list.
|
|
137
|
+
LIBHEIF_API
|
|
138
|
+
const heif_encoder_parameter* const* heif_encoder_list_parameters(heif_encoder*);
|
|
139
|
+
|
|
140
|
+
// Return the parameter name.
|
|
141
|
+
LIBHEIF_API
|
|
142
|
+
const char* heif_encoder_parameter_get_name(const heif_encoder_parameter*);
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
enum heif_encoder_parameter_type
|
|
146
|
+
{
|
|
147
|
+
heif_encoder_parameter_type_integer = 1,
|
|
148
|
+
heif_encoder_parameter_type_boolean = 2,
|
|
149
|
+
heif_encoder_parameter_type_string = 3
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Return the parameter type.
|
|
153
|
+
LIBHEIF_API
|
|
154
|
+
enum heif_encoder_parameter_type heif_encoder_parameter_get_type(const heif_encoder_parameter*);
|
|
155
|
+
|
|
156
|
+
// DEPRECATED. Use heif_encoder_parameter_get_valid_integer_values() instead.
|
|
157
|
+
LIBHEIF_API
|
|
158
|
+
heif_error heif_encoder_parameter_get_valid_integer_range(const heif_encoder_parameter*,
|
|
159
|
+
int* have_minimum_maximum,
|
|
160
|
+
int* minimum, int* maximum);
|
|
161
|
+
|
|
162
|
+
// If integer is limited by a range, have_minimum and/or have_maximum will be != 0 and *minimum, *maximum is set.
|
|
163
|
+
// If integer is limited by a fixed set of values, *num_valid_values will be >0 and *out_integer_array is set.
|
|
164
|
+
LIBHEIF_API
|
|
165
|
+
heif_error heif_encoder_parameter_get_valid_integer_values(const heif_encoder_parameter*,
|
|
166
|
+
int* have_minimum, int* have_maximum,
|
|
167
|
+
int* minimum, int* maximum,
|
|
168
|
+
int* num_valid_values,
|
|
169
|
+
const int** out_integer_array);
|
|
170
|
+
|
|
171
|
+
LIBHEIF_API
|
|
172
|
+
heif_error heif_encoder_parameter_get_valid_string_values(const heif_encoder_parameter*,
|
|
173
|
+
const char* const** out_stringarray);
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
LIBHEIF_API
|
|
177
|
+
heif_error heif_encoder_set_parameter_integer(heif_encoder*,
|
|
178
|
+
const char* parameter_name,
|
|
179
|
+
int value);
|
|
180
|
+
|
|
181
|
+
LIBHEIF_API
|
|
182
|
+
heif_error heif_encoder_get_parameter_integer(heif_encoder*,
|
|
183
|
+
const char* parameter_name,
|
|
184
|
+
int* value);
|
|
185
|
+
|
|
186
|
+
// TODO: name should be changed to heif_encoder_get_valid_integer_parameter_range
|
|
187
|
+
LIBHEIF_API // DEPRECATED.
|
|
188
|
+
heif_error heif_encoder_parameter_integer_valid_range(heif_encoder*,
|
|
189
|
+
const char* parameter_name,
|
|
190
|
+
int* have_minimum_maximum,
|
|
191
|
+
int* minimum, int* maximum);
|
|
192
|
+
|
|
193
|
+
LIBHEIF_API
|
|
194
|
+
heif_error heif_encoder_set_parameter_boolean(heif_encoder*,
|
|
195
|
+
const char* parameter_name,
|
|
196
|
+
int value);
|
|
197
|
+
|
|
198
|
+
LIBHEIF_API
|
|
199
|
+
heif_error heif_encoder_get_parameter_boolean(heif_encoder*,
|
|
200
|
+
const char* parameter_name,
|
|
201
|
+
int* value);
|
|
202
|
+
|
|
203
|
+
LIBHEIF_API
|
|
204
|
+
heif_error heif_encoder_set_parameter_string(heif_encoder*,
|
|
205
|
+
const char* parameter_name,
|
|
206
|
+
const char* value);
|
|
207
|
+
|
|
208
|
+
LIBHEIF_API
|
|
209
|
+
heif_error heif_encoder_get_parameter_string(heif_encoder*,
|
|
210
|
+
const char* parameter_name,
|
|
211
|
+
char* value, int value_size);
|
|
212
|
+
|
|
213
|
+
// returns a NULL-terminated list of valid strings or NULL if all values are allowed
|
|
214
|
+
LIBHEIF_API
|
|
215
|
+
heif_error heif_encoder_parameter_string_valid_values(heif_encoder*,
|
|
216
|
+
const char* parameter_name,
|
|
217
|
+
const char* const** out_stringarray);
|
|
218
|
+
|
|
219
|
+
LIBHEIF_API
|
|
220
|
+
heif_error heif_encoder_parameter_integer_valid_values(heif_encoder*,
|
|
221
|
+
const char* parameter_name,
|
|
222
|
+
int* have_minimum, int* have_maximum,
|
|
223
|
+
int* minimum, int* maximum,
|
|
224
|
+
int* num_valid_values,
|
|
225
|
+
const int** out_integer_array);
|
|
226
|
+
|
|
227
|
+
// Set a parameter of any type to the string value.
|
|
228
|
+
// Integer values are parsed from the string.
|
|
229
|
+
// Boolean values can be "true"/"false"/"1"/"0"
|
|
230
|
+
//
|
|
231
|
+
// x265 encoder specific note:
|
|
232
|
+
// When using the x265 encoder, you may pass any of its parameters by
|
|
233
|
+
// prefixing the parameter name with 'x265:'. Hence, to set the 'ctu' parameter,
|
|
234
|
+
// you will have to set 'x265:ctu' in libheif.
|
|
235
|
+
// Note that there is no checking for valid parameters when using the prefix.
|
|
236
|
+
LIBHEIF_API
|
|
237
|
+
heif_error heif_encoder_set_parameter(heif_encoder*,
|
|
238
|
+
const char* parameter_name,
|
|
239
|
+
const char* value);
|
|
240
|
+
|
|
241
|
+
// Get the current value of a parameter of any type as a human readable string.
|
|
242
|
+
// The returned string is compatible with heif_encoder_set_parameter().
|
|
243
|
+
LIBHEIF_API
|
|
244
|
+
heif_error heif_encoder_get_parameter(heif_encoder*,
|
|
245
|
+
const char* parameter_name,
|
|
246
|
+
char* value_ptr, int value_size);
|
|
247
|
+
|
|
248
|
+
// Query whether a specific parameter has a default value.
|
|
249
|
+
LIBHEIF_API
|
|
250
|
+
int heif_encoder_has_default(heif_encoder*,
|
|
251
|
+
const char* parameter_name);
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
// The orientation values are defined equal to the EXIF Orientation tag.
|
|
255
|
+
enum heif_orientation
|
|
256
|
+
{
|
|
257
|
+
heif_orientation_normal = 1,
|
|
258
|
+
heif_orientation_flip_horizontally = 2,
|
|
259
|
+
heif_orientation_rotate_180 = 3,
|
|
260
|
+
heif_orientation_flip_vertically = 4,
|
|
261
|
+
heif_orientation_rotate_90_cw_then_flip_horizontally = 5,
|
|
262
|
+
heif_orientation_rotate_90_cw = 6,
|
|
263
|
+
heif_orientation_rotate_90_cw_then_flip_vertically = 7,
|
|
264
|
+
heif_orientation_rotate_270_cw = 8
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
typedef struct heif_encoding_options
|
|
269
|
+
{
|
|
270
|
+
uint8_t version;
|
|
271
|
+
|
|
272
|
+
// version 1 options
|
|
273
|
+
|
|
274
|
+
uint8_t save_alpha_channel; // default: true
|
|
275
|
+
|
|
276
|
+
// version 2 options
|
|
277
|
+
|
|
278
|
+
// DEPRECATED. This option is not required anymore. Its value will be ignored.
|
|
279
|
+
uint8_t macOS_compatibility_workaround;
|
|
280
|
+
|
|
281
|
+
// version 3 options
|
|
282
|
+
|
|
283
|
+
uint8_t save_two_colr_boxes_when_ICC_and_nclx_available; // default: false
|
|
284
|
+
|
|
285
|
+
// version 4 options
|
|
286
|
+
|
|
287
|
+
// Set this to the NCLX parameters to be used in the output image or set to NULL
|
|
288
|
+
// when the same parameters as in the input image should be used.
|
|
289
|
+
heif_color_profile_nclx* output_nclx_profile;
|
|
290
|
+
|
|
291
|
+
uint8_t macOS_compatibility_workaround_no_nclx_profile;
|
|
292
|
+
|
|
293
|
+
// version 5 options
|
|
294
|
+
|
|
295
|
+
// libheif will generate irot/imir boxes to match these orientations
|
|
296
|
+
enum heif_orientation image_orientation;
|
|
297
|
+
|
|
298
|
+
// version 6 options
|
|
299
|
+
|
|
300
|
+
heif_color_conversion_options color_conversion_options;
|
|
301
|
+
|
|
302
|
+
// version 7 options
|
|
303
|
+
|
|
304
|
+
// Set this to true to use compressed form of uncC where possible.
|
|
305
|
+
uint8_t prefer_uncC_short_form;
|
|
306
|
+
|
|
307
|
+
// TODO: we should add a flag to force MIAF compatible outputs. E.g. this will put restrictions on grid tile sizes and
|
|
308
|
+
// might add a clap box when the grid output size does not match the color subsampling factors.
|
|
309
|
+
// Since some of these constraints have to be known before actually encoding the image, "forcing MIAF compatibility"
|
|
310
|
+
// could also be a flag in the heif_context.
|
|
311
|
+
} heif_encoding_options;
|
|
312
|
+
|
|
313
|
+
LIBHEIF_API
|
|
314
|
+
heif_encoding_options* heif_encoding_options_alloc(void);
|
|
315
|
+
|
|
316
|
+
LIBHEIF_API
|
|
317
|
+
void heif_encoding_options_copy(heif_encoding_options* dst, const heif_encoding_options* src);
|
|
318
|
+
|
|
319
|
+
LIBHEIF_API
|
|
320
|
+
void heif_encoding_options_free(heif_encoding_options*);
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
// Compress the input image.
|
|
324
|
+
// Returns a handle to the coded image in 'out_image_handle' unless out_image_handle = NULL.
|
|
325
|
+
// 'options' should be NULL for now.
|
|
326
|
+
// The first image added to the context is also automatically set the primary image, but
|
|
327
|
+
// you can change the primary image later with heif_context_set_primary_image().
|
|
328
|
+
LIBHEIF_API
|
|
329
|
+
heif_error heif_context_encode_image(heif_context*,
|
|
330
|
+
const heif_image* image,
|
|
331
|
+
heif_encoder* encoder,
|
|
332
|
+
const heif_encoding_options* options,
|
|
333
|
+
heif_image_handle** out_image_handle);
|
|
334
|
+
|
|
335
|
+
// offsets[] should either be NULL (all offsets==0) or an array of size 2*nImages with x;y offset pairs.
|
|
336
|
+
// If background_rgba is NULL, the background is transparent.
|
|
337
|
+
LIBHEIF_API
|
|
338
|
+
heif_error heif_context_add_overlay_image(heif_context* ctx,
|
|
339
|
+
uint32_t image_width,
|
|
340
|
+
uint32_t image_height,
|
|
341
|
+
uint16_t nImages,
|
|
342
|
+
const heif_item_id* image_ids,
|
|
343
|
+
int32_t* offsets,
|
|
344
|
+
const uint16_t background_rgba[4],
|
|
345
|
+
heif_image_handle** out_iovl_image_handle);
|
|
346
|
+
|
|
347
|
+
LIBHEIF_API
|
|
348
|
+
heif_error heif_context_set_primary_image(heif_context*,
|
|
349
|
+
heif_image_handle* image_handle);
|
|
350
|
+
|
|
351
|
+
// Set the major brand of the file.
|
|
352
|
+
// If this function is not called, the major brand is determined automatically from
|
|
353
|
+
// the image or sequence content.
|
|
354
|
+
LIBHEIF_API
|
|
355
|
+
void heif_context_set_major_brand(heif_context* ctx,
|
|
356
|
+
heif_brand2 major_brand);
|
|
357
|
+
|
|
358
|
+
// Add a compatible brand that is now added automatically by libheif when encoding images (e.g. some application brands like 'geo1').
|
|
359
|
+
LIBHEIF_API
|
|
360
|
+
void heif_context_add_compatible_brand(heif_context* ctx,
|
|
361
|
+
heif_brand2 compatible_brand);
|
|
362
|
+
|
|
363
|
+
// --- deprecated functions ---
|
|
364
|
+
|
|
365
|
+
// DEPRECATED, typo in function name
|
|
366
|
+
LIBHEIF_API
|
|
367
|
+
int heif_encoder_descriptor_supportes_lossy_compression(const heif_encoder_descriptor*);
|
|
368
|
+
|
|
369
|
+
// DEPRECATED, typo in function name
|
|
370
|
+
LIBHEIF_API
|
|
371
|
+
int heif_encoder_descriptor_supportes_lossless_compression(const heif_encoder_descriptor*);
|
|
372
|
+
|
|
373
|
+
// DEPRECATED: use heif_get_encoder_descriptors() instead.
|
|
374
|
+
// Get a list of available encoders. You can filter the encoders by compression format and name.
|
|
375
|
+
// Use format_filter==heif_compression_undefined and name_filter==NULL as wildcards.
|
|
376
|
+
// The returned list of encoders is sorted by their priority (which is a plugin property).
|
|
377
|
+
// The number of encoders is returned, which are not more than 'count' if (out_encoders != nullptr).
|
|
378
|
+
// By setting out_encoders==nullptr, you can query the number of encoders, 'count' is ignored.
|
|
379
|
+
// Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
|
|
380
|
+
LIBHEIF_API
|
|
381
|
+
int heif_context_get_encoder_descriptors(heif_context*, // TODO: why do we need this parameter?
|
|
382
|
+
enum heif_compression_format format_filter,
|
|
383
|
+
const char* name_filter,
|
|
384
|
+
const heif_encoder_descriptor** out_encoders,
|
|
385
|
+
int count);
|
|
386
|
+
|
|
387
|
+
#ifdef __cplusplus
|
|
388
|
+
}
|
|
389
|
+
#endif
|
|
390
|
+
|
|
391
|
+
#endif
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2025 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_ENTITY_GROUPS_H
|
|
22
|
+
#define LIBHEIF_HEIF_ENTITY_GROUPS_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include "libheif/heif_library.h"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// ------------------------- entity groups ------------------------
|
|
32
|
+
|
|
33
|
+
typedef uint32_t heif_entity_group_id;
|
|
34
|
+
|
|
35
|
+
typedef struct heif_entity_group
|
|
36
|
+
{
|
|
37
|
+
heif_entity_group_id entity_group_id;
|
|
38
|
+
uint32_t entity_group_type; // this is a FourCC constant
|
|
39
|
+
heif_item_id* entities;
|
|
40
|
+
uint32_t num_entities;
|
|
41
|
+
} heif_entity_group;
|
|
42
|
+
|
|
43
|
+
// Use 0 for `type_filter` or `item_filter` to disable the filter.
|
|
44
|
+
// Returns an array of heif_entity_group structs with *out_num_groups entries.
|
|
45
|
+
LIBHEIF_API
|
|
46
|
+
heif_entity_group* heif_context_get_entity_groups(const heif_context*,
|
|
47
|
+
uint32_t type_filter,
|
|
48
|
+
heif_item_id item_filter,
|
|
49
|
+
int* out_num_groups);
|
|
50
|
+
|
|
51
|
+
// Release an array of entity groups returned by heif_context_get_entity_groups().
|
|
52
|
+
LIBHEIF_API
|
|
53
|
+
void heif_entity_groups_release(heif_entity_group*, int num_groups);
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#ifdef __cplusplus
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
#endif
|