@img/sharp-libvips-dev-wasm32 1.3.0-rc.7 → 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/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 +1 -1
- package/include/expat_config.h +3 -3
- 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/gversionmacros.h +9 -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/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 +74 -2
- package/include/libheif/heif_tiling.h +2 -2
- package/include/libheif/heif_uncompressed.h +44 -332
- package/include/libheif/heif_version.h +2 -2
- package/include/vips/version.h +4 -4
- package/lib/glib-2.0/include/glibconfig.h +2 -4
- package/lib/libaom.a +0 -0
- package/lib/libcgif.a +0 -0
- package/lib/libexif.a +0 -0
- package/lib/libexpat.a +0 -0
- package/lib/libexpat.la +1 -1
- 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/libpng16.a +0 -0
- 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/libheif.pc +2 -2
- package/lib/pkgconfig/vips-cpp.pc +1 -1
- package/lib/pkgconfig/vips.pc +1 -1
- package/package.json +1 -1
- package/versions.json +8 -8
- package/include/libheif/heif_uncompressed_types.h +0 -143
|
@@ -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
|
|
@@ -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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
#
|
|
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
|
-
|
|
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
|