@img/sharp-libvips-dev-wasm32 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/include/aom/aom_decoder.h +1 -1
  2. package/include/aom/aom_encoder.h +7 -1
  3. package/include/aom/aom_image.h +24 -12
  4. package/include/aom/aom_integer.h +3 -3
  5. package/include/aom/aomcx.h +15 -0
  6. package/include/aom/aomdx.h +5 -2
  7. package/include/cgif.h +3 -0
  8. package/include/glib-2.0/gio/gappinfo.h +40 -25
  9. package/include/glib-2.0/gio/gasyncresult.h +1 -1
  10. package/include/glib-2.0/gio/gconverter.h +5 -0
  11. package/include/glib-2.0/gio/gdbusintrospection.h +1 -1
  12. package/include/glib-2.0/gio/gfile.h +16 -0
  13. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  14. package/include/glib-2.0/gio/gsettings.h +8 -0
  15. package/include/glib-2.0/gio/gvfs.h +2 -2
  16. package/include/glib-2.0/glib/gbookmarkfile.h +1 -1
  17. package/include/glib-2.0/glib/giochannel.h +2 -2
  18. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  19. package/include/glib-2.0/glib/gmacros.h +12 -5
  20. package/include/glib-2.0/glib/gmain.h +93 -7
  21. package/include/glib-2.0/glib/gqsort.h +8 -1
  22. package/include/glib-2.0/glib/gstrfuncs.h +0 -12
  23. package/include/glib-2.0/glib/gstrvbuilder.h +3 -0
  24. package/include/glib-2.0/glib/gunicode.h +1 -1
  25. package/include/glib-2.0/glib/gversionmacros.h +9 -0
  26. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  27. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  28. package/include/glib-2.0/gobject/gtype.h +6 -6
  29. package/include/hwy/abort.h +28 -0
  30. package/include/hwy/aligned_allocator.h +48 -1
  31. package/include/hwy/base.h +235 -34
  32. package/include/hwy/detect_compiler_arch.h +84 -10
  33. package/include/hwy/detect_targets.h +95 -29
  34. package/include/hwy/foreach_target.h +12 -1
  35. package/include/hwy/highway.h +205 -50
  36. package/include/hwy/ops/arm_neon-inl.h +841 -99
  37. package/include/hwy/ops/arm_sve-inl.h +413 -141
  38. package/include/hwy/ops/emu128-inl.h +373 -360
  39. package/include/hwy/ops/generic_ops-inl.h +804 -401
  40. package/include/hwy/ops/inside-inl.h +691 -0
  41. package/include/hwy/ops/ppc_vsx-inl.h +456 -166
  42. package/include/hwy/ops/rvv-inl.h +537 -249
  43. package/include/hwy/ops/scalar-inl.h +169 -79
  44. package/include/hwy/ops/set_macros-inl.h +106 -18
  45. package/include/hwy/ops/shared-inl.h +23 -0
  46. package/include/hwy/ops/wasm_128-inl.h +130 -108
  47. package/include/hwy/ops/x86_128-inl.h +1892 -577
  48. package/include/hwy/ops/x86_256-inl.h +625 -184
  49. package/include/hwy/ops/x86_512-inl.h +733 -131
  50. package/include/hwy/targets.h +22 -21
  51. package/include/hwy/timer-inl.h +3 -3
  52. package/include/hwy/timer.h +5 -1
  53. package/include/libheif/heif.h +170 -15
  54. package/include/libheif/heif_items.h +237 -0
  55. package/include/libheif/heif_properties.h +38 -2
  56. package/include/libheif/heif_regions.h +1 -1
  57. package/include/libheif/heif_version.h +2 -2
  58. package/include/resvg.h +2 -12
  59. package/include/vips/util.h +1 -2
  60. package/include/vips/version.h +4 -4
  61. package/include/webp/decode.h +58 -56
  62. package/include/webp/demux.h +25 -21
  63. package/include/webp/encode.h +44 -39
  64. package/include/webp/mux.h +76 -15
  65. package/include/webp/mux_types.h +2 -1
  66. package/include/webp/sharpyuv/sharpyuv.h +77 -8
  67. package/include/webp/types.h +29 -8
  68. package/include/zconf.h +1 -1
  69. package/include/zlib.h +12 -12
  70. package/lib/glib-2.0/include/glibconfig.h +2 -2
  71. package/lib/libaom.a +0 -0
  72. package/lib/libcgif.a +0 -0
  73. package/lib/libexif.a +0 -0
  74. package/lib/libexpat.a +0 -0
  75. package/lib/libffi.a +0 -0
  76. package/lib/libgio-2.0.a +0 -0
  77. package/lib/libglib-2.0.a +0 -0
  78. package/lib/libgmodule-2.0.a +0 -0
  79. package/lib/libgobject-2.0.a +0 -0
  80. package/lib/libgthread-2.0.a +0 -0
  81. package/lib/libheif.a +0 -0
  82. package/lib/libhwy.a +0 -0
  83. package/lib/libimagequant.a +0 -0
  84. package/lib/libjpeg.a +0 -0
  85. package/lib/liblcms2.a +0 -0
  86. package/lib/libresvg.a +0 -0
  87. package/lib/libsharpyuv.a +0 -0
  88. package/lib/libsharpyuv.la +4 -4
  89. package/lib/libspng.a +0 -0
  90. package/lib/libtiff.a +0 -0
  91. package/lib/libvips-cpp.a +0 -0
  92. package/lib/libvips.a +0 -0
  93. package/lib/libwebp.a +0 -0
  94. package/lib/libwebp.la +2 -2
  95. package/lib/libwebpdemux.a +0 -0
  96. package/lib/libwebpdemux.la +2 -2
  97. package/lib/libwebpmux.a +0 -0
  98. package/lib/libwebpmux.la +4 -4
  99. package/lib/libz.a +0 -0
  100. package/lib/pkgconfig/aom.pc +2 -2
  101. package/lib/pkgconfig/cgif.pc +1 -1
  102. package/lib/pkgconfig/gio-2.0.pc +1 -1
  103. package/lib/pkgconfig/glib-2.0.pc +1 -1
  104. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  105. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  106. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  107. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  108. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  109. package/lib/pkgconfig/libheif.pc +1 -10
  110. package/lib/pkgconfig/libhwy.pc +1 -1
  111. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  112. package/lib/pkgconfig/libwebp.pc +1 -1
  113. package/lib/pkgconfig/libwebpdemux.pc +1 -1
  114. package/lib/pkgconfig/libwebpmux.pc +1 -1
  115. package/lib/pkgconfig/vips-cpp.pc +1 -1
  116. package/lib/pkgconfig/vips.pc +1 -1
  117. package/lib/pkgconfig/zlib.pc +1 -1
  118. package/package.json +1 -1
  119. package/versions.json +10 -10
@@ -21,7 +21,7 @@
21
21
  #ifndef LIBHEIF_HEIF_PROPERTIES_H
22
22
  #define LIBHEIF_HEIF_PROPERTIES_H
23
23
 
24
- #include "libheif/heif.h"
24
+ #include "heif.h"
25
25
 
26
26
  #ifdef __cplusplus
27
27
  extern "C" {
@@ -37,7 +37,8 @@ enum heif_item_property_type
37
37
  heif_item_property_type_transform_mirror = heif_fourcc('i', 'm', 'i', 'r'),
38
38
  heif_item_property_type_transform_rotation = heif_fourcc('i', 'r', 'o', 't'),
39
39
  heif_item_property_type_transform_crop = heif_fourcc('c', 'l', 'a', 'p'),
40
- heif_item_property_type_image_size = heif_fourcc('i', 's', 'p', 'e')
40
+ heif_item_property_type_image_size = heif_fourcc('i', 's', 'p', 'e'),
41
+ heif_item_property_type_uuid = heif_fourcc('u', 'u', 'i', 'd')
41
42
  };
42
43
 
43
44
  // Get the heif_property_id for a heif_item_id.
@@ -131,6 +132,41 @@ void heif_item_get_property_transform_crop_borders(const struct heif_context* co
131
132
  int image_width, int image_height,
132
133
  int* left, int* top, int* right, int* bottom);
133
134
 
135
+
136
+ /**
137
+ * @param context
138
+ * @param itemId The image item id to which this property belongs.
139
+ * @param fourcc_type The short four-cc type of the property to add.
140
+ * @param uuid_type If fourcc_type=='uuid', this should point to a 16-byte UUID type. It is ignored otherwise and can be NULL.
141
+ * @param data Data to insert for this property (including a full-box header, if required for this box).
142
+ * @param size Length of data in bytes.
143
+ * @param is_essential Whether this property is essential (boolean).
144
+ * @param out_propertyId Outputs the id of the inserted property. Can be NULL.
145
+ */
146
+ LIBHEIF_API
147
+ struct heif_error heif_item_add_raw_property(const struct heif_context* context,
148
+ heif_item_id itemId,
149
+ uint32_t fourcc_type,
150
+ const uint8_t* uuid_type,
151
+ const uint8_t* data, size_t size,
152
+ int is_essential,
153
+ heif_property_id* out_propertyId);
154
+
155
+ LIBHEIF_API
156
+ struct heif_error heif_item_get_property_raw_size(const struct heif_context* context,
157
+ heif_item_id itemId,
158
+ heif_property_id propertyId,
159
+ size_t* out_size);
160
+
161
+ /**
162
+ * @param data_out User-supplied array to write the property data to. The required size of the output array is given by heif_item_get_property_raw_size().
163
+ */
164
+ LIBHEIF_API
165
+ struct heif_error heif_item_get_property_raw_data(const struct heif_context* context,
166
+ heif_item_id itemId,
167
+ heif_property_id propertyId,
168
+ uint8_t* out_data);
169
+
134
170
  #ifdef __cplusplus
135
171
  }
136
172
  #endif
@@ -22,7 +22,7 @@
22
22
  #ifndef LIBHEIF_HEIF_REGIONS_H
23
23
  #define LIBHEIF_HEIF_REGIONS_H
24
24
 
25
- #include "libheif/heif.h"
25
+ #include "heif.h"
26
26
 
27
27
  #ifdef __cplusplus
28
28
  extern "C" {
@@ -28,10 +28,10 @@
28
28
  #define LIBHEIF_HEIF_VERSION_H
29
29
 
30
30
  /* Numeric representation of the version */
31
- #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (17<<16) | (6<<8) | 0)
31
+ #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (18<<16) | (2<<8) | 0)
32
32
 
33
33
  /* Version string */
34
- #define LIBHEIF_VERSION "1.17.6"
34
+ #define LIBHEIF_VERSION "1.18.2"
35
35
 
36
36
  #define LIBHEIF_PLUGIN_DIRECTORY "/src/build/target/lib/libheif"
37
37
 
package/include/resvg.h CHANGED
@@ -17,9 +17,9 @@
17
17
  #include <stdint.h>
18
18
 
19
19
  #define RESVG_MAJOR_VERSION 0
20
- #define RESVG_MINOR_VERSION 40
20
+ #define RESVG_MINOR_VERSION 43
21
21
  #define RESVG_PATCH_VERSION 0
22
- #define RESVG_VERSION "0.40.0"
22
+ #define RESVG_VERSION "0.43.0"
23
23
 
24
24
  /**
25
25
  * @brief List of possible errors.
@@ -384,16 +384,6 @@ bool resvg_is_image_empty(const resvg_render_tree *tree);
384
384
  */
385
385
  resvg_size resvg_get_image_size(const resvg_render_tree *tree);
386
386
 
387
- /**
388
- * @brief Returns an image viewbox.
389
- *
390
- * The `viewBox` attribute in SVG.
391
- *
392
- * @param tree Render tree.
393
- * @return Image viewbox.
394
- */
395
- resvg_rect resvg_get_image_viewbox(const resvg_render_tree *tree);
396
-
397
387
  /**
398
388
  * @brief Returns an image bounding box.
399
389
  *
@@ -335,8 +335,7 @@ int vips__file_write(void *data, size_t size, size_t nmemb, FILE *stream);
335
335
  /* TODO(kleisauke): VIPS_API is required by the magick module.
336
336
  */
337
337
  VIPS_API
338
- gint64 vips__get_bytes(const char *filename,
339
- unsigned char buf[], gint64 len);
338
+ gint64 vips__get_bytes(const char *filename, unsigned char buf[], gint64 len);
340
339
  int vips__fgetc(FILE *fp);
341
340
 
342
341
  GValue *vips__gvalue_ref_string_new(const char *text);
@@ -4,16 +4,16 @@
4
4
  #ifndef VIPS_VERSION_H
5
5
  #define VIPS_VERSION_H
6
6
 
7
- #define VIPS_VERSION "8.15.2"
8
- #define VIPS_VERSION_STRING "8.15.2"
7
+ #define VIPS_VERSION "8.15.3"
8
+ #define VIPS_VERSION_STRING "8.15.3"
9
9
  #define VIPS_MAJOR_VERSION (8)
10
10
  #define VIPS_MINOR_VERSION (15)
11
- #define VIPS_MICRO_VERSION (2)
11
+ #define VIPS_MICRO_VERSION (3)
12
12
 
13
13
  /* The ABI version, as used for library versioning.
14
14
  */
15
15
  #define VIPS_LIBRARY_CURRENT (59)
16
- #define VIPS_LIBRARY_REVISION (2)
16
+ #define VIPS_LIBRARY_REVISION (3)
17
17
  #define VIPS_LIBRARY_AGE (17)
18
18
 
19
19
  #define VIPS_CONFIG "enable debug: false\nenable deprecated: false\nenable modules: false\nenable cplusplus: true\nenable RAD load/save: true\nenable Analyze7 load/save: true\nenable PPM load/save: true\nenable GIF load: true\nuse fftw for FFTs: false\nSIMD support with highway: true\nICC profile support with lcms: true\nzlib: true\ntext rendering with pangocairo: false\nfont file support with fontconfig: false\nEXIF metadata support with libexif: true\nJPEG load/save with libjpeg: true\nJXL load/save with libjxl: false (dynamic module: false)\nJPEG2000 load/save with OpenJPEG: false\nPNG load/save with libspng: true\nPNG load/save with libpng: false\nselected quantisation package: imagequant\nTIFF load/save with libtiff: true\nimage pyramid save with libarchive: false\nHEIC/AVIF load/save with libheif: true (dynamic module: false)\nWebP load/save with libwebp: true\nPDF load with PDFium: false\nPDF load with poppler-glib: false (dynamic module: false)\nSVG load with librsvg: false\nSVG load with resvg: true (dynamic module: false)\nEXR load with OpenEXR: false\nOpenSlide load: false (dynamic module: false)\nMatlab load with libmatio: false\nNIfTI load/save with niftiio: false\nFITS load/save with cfitsio: false\nGIF save with cgif: true\nselected Magick package: none (dynamic module: false)\nMagick API version: none\nMagick load: false\nMagick save: false"
@@ -48,34 +48,33 @@ WEBP_EXTERN int WebPGetDecoderVersion(void);
48
48
  // RIFF + VP8X + (optional chunks) + VP8(L)
49
49
  // ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose.
50
50
  // VP8(L) <-- Not a valid WebP format: only allowed for internal purpose.
51
- WEBP_EXTERN int WebPGetInfo(const uint8_t* data, size_t data_size,
52
- int* width, int* height);
51
+ WEBP_NODISCARD WEBP_EXTERN int WebPGetInfo(
52
+ const uint8_t* data, size_t data_size, int* width, int* height);
53
53
 
54
54
  // Decodes WebP images pointed to by 'data' and returns RGBA samples, along
55
55
  // with the dimensions in *width and *height. The ordering of samples in
56
56
  // memory is R, G, B, A, R, G, B, A... in scan order (endian-independent).
57
57
  // The returned pointer should be deleted calling WebPFree().
58
58
  // Returns NULL in case of error.
59
- WEBP_EXTERN uint8_t* WebPDecodeRGBA(const uint8_t* data, size_t data_size,
60
- int* width, int* height);
59
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBA(
60
+ const uint8_t* data, size_t data_size, int* width, int* height);
61
61
 
62
62
  // Same as WebPDecodeRGBA, but returning A, R, G, B, A, R, G, B... ordered data.
63
- WEBP_EXTERN uint8_t* WebPDecodeARGB(const uint8_t* data, size_t data_size,
64
- int* width, int* height);
63
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeARGB(
64
+ const uint8_t* data, size_t data_size, int* width, int* height);
65
65
 
66
66
  // Same as WebPDecodeRGBA, but returning B, G, R, A, B, G, R, A... ordered data.
67
- WEBP_EXTERN uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size,
68
- int* width, int* height);
67
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRA(
68
+ const uint8_t* data, size_t data_size, int* width, int* height);
69
69
 
70
70
  // Same as WebPDecodeRGBA, but returning R, G, B, R, G, B... ordered data.
71
71
  // If the bitstream contains transparency, it is ignored.
72
- WEBP_EXTERN uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size,
73
- int* width, int* height);
72
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGB(
73
+ const uint8_t* data, size_t data_size, int* width, int* height);
74
74
 
75
75
  // Same as WebPDecodeRGB, but returning B, G, R, B, G, R... ordered data.
76
- WEBP_EXTERN uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
77
- int* width, int* height);
78
-
76
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGR(
77
+ const uint8_t* data, size_t data_size, int* width, int* height);
79
78
 
80
79
  // Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer
81
80
  // returned is the Y samples buffer. Upon return, *u and *v will point to
@@ -87,10 +86,9 @@ WEBP_EXTERN uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
87
86
  // 'width' and 'height' may be NULL, the other pointers must not be.
88
87
  // Returns NULL in case of error.
89
88
  // (*) Also named Y'CbCr. See: https://en.wikipedia.org/wiki/YCbCr
90
- WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
91
- int* width, int* height,
92
- uint8_t** u, uint8_t** v,
93
- int* stride, int* uv_stride);
89
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeYUV(
90
+ const uint8_t* data, size_t data_size, int* width, int* height,
91
+ uint8_t** u, uint8_t** v, int* stride, int* uv_stride);
94
92
 
95
93
  // These five functions are variants of the above ones, that decode the image
96
94
  // directly into a pre-allocated buffer 'output_buffer'. The maximum storage
@@ -100,22 +98,22 @@ WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
100
98
  // The parameter 'output_stride' specifies the distance (in bytes)
101
99
  // between scanlines. Hence, output_buffer_size is expected to be at least
102
100
  // output_stride x picture-height.
103
- WEBP_EXTERN uint8_t* WebPDecodeRGBAInto(
101
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBAInto(
104
102
  const uint8_t* data, size_t data_size,
105
103
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
106
- WEBP_EXTERN uint8_t* WebPDecodeARGBInto(
104
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeARGBInto(
107
105
  const uint8_t* data, size_t data_size,
108
106
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
109
- WEBP_EXTERN uint8_t* WebPDecodeBGRAInto(
107
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRAInto(
110
108
  const uint8_t* data, size_t data_size,
111
109
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
112
110
 
113
111
  // RGB and BGR variants. Here too the transparency information, if present,
114
112
  // will be dropped and ignored.
115
- WEBP_EXTERN uint8_t* WebPDecodeRGBInto(
113
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBInto(
116
114
  const uint8_t* data, size_t data_size,
117
115
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
118
- WEBP_EXTERN uint8_t* WebPDecodeBGRInto(
116
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRInto(
119
117
  const uint8_t* data, size_t data_size,
120
118
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
121
119
 
@@ -126,7 +124,7 @@ WEBP_EXTERN uint8_t* WebPDecodeBGRInto(
126
124
  // 'u_size' and 'v_size' respectively.
127
125
  // Pointer to the luma plane ('*luma') is returned or NULL if an error occurred
128
126
  // during decoding (or because some buffers were found to be too small).
129
- WEBP_EXTERN uint8_t* WebPDecodeYUVInto(
127
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeYUVInto(
130
128
  const uint8_t* data, size_t data_size,
131
129
  uint8_t* luma, size_t luma_size, int luma_stride,
132
130
  uint8_t* u, size_t u_size, int u_stride,
@@ -217,11 +215,11 @@ struct WebPDecBuffer {
217
215
  };
218
216
 
219
217
  // Internal, version-checked, entry point
220
- WEBP_EXTERN int WebPInitDecBufferInternal(WebPDecBuffer*, int);
218
+ WEBP_NODISCARD WEBP_EXTERN int WebPInitDecBufferInternal(WebPDecBuffer*, int);
221
219
 
222
220
  // Initialize the structure as empty. Must be called before any other use.
223
221
  // Returns false in case of version mismatch
224
- static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) {
222
+ WEBP_NODISCARD static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) {
225
223
  return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION);
226
224
  }
227
225
 
@@ -232,7 +230,7 @@ WEBP_EXTERN void WebPFreeDecBuffer(WebPDecBuffer* buffer);
232
230
  //------------------------------------------------------------------------------
233
231
  // Enumeration of the status codes
234
232
 
235
- typedef enum VP8StatusCode {
233
+ typedef enum WEBP_NODISCARD VP8StatusCode {
236
234
  VP8_STATUS_OK = 0,
237
235
  VP8_STATUS_OUT_OF_MEMORY,
238
236
  VP8_STATUS_INVALID_PARAM,
@@ -251,23 +249,24 @@ typedef enum VP8StatusCode {
251
249
  // WebPIDecoder object. This object can be left in a SUSPENDED state if the
252
250
  // picture is only partially decoded, pending additional input.
253
251
  // Code example:
254
- //
255
- // WebPInitDecBuffer(&output_buffer);
256
- // output_buffer.colorspace = mode;
257
- // ...
258
- // WebPIDecoder* idec = WebPINewDecoder(&output_buffer);
259
- // while (additional_data_is_available) {
260
- // // ... (get additional data in some new_data[] buffer)
261
- // status = WebPIAppend(idec, new_data, new_data_size);
262
- // if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
263
- // break; // an error occurred.
264
- // }
265
- //
266
- // // The above call decodes the current available buffer.
267
- // // Part of the image can now be refreshed by calling
268
- // // WebPIDecGetRGB()/WebPIDecGetYUVA() etc.
269
- // }
270
- // WebPIDelete(idec);
252
+ /*
253
+ WebPInitDecBuffer(&output_buffer);
254
+ output_buffer.colorspace = mode;
255
+ ...
256
+ WebPIDecoder* idec = WebPINewDecoder(&output_buffer);
257
+ while (additional_data_is_available) {
258
+ // ... (get additional data in some new_data[] buffer)
259
+ status = WebPIAppend(idec, new_data, new_data_size);
260
+ if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
261
+ break; // an error occurred.
262
+ }
263
+
264
+ // The above call decodes the current available buffer.
265
+ // Part of the image can now be refreshed by calling
266
+ // WebPIDecGetRGB()/WebPIDecGetYUVA() etc.
267
+ }
268
+ WebPIDelete(idec);
269
+ */
271
270
 
272
271
  // Creates a new incremental decoder with the supplied buffer parameter.
273
272
  // This output_buffer can be passed NULL, in which case a default output buffer
@@ -281,7 +280,8 @@ typedef enum VP8StatusCode {
281
280
  // within valid bounds.
282
281
  // All other fields of WebPDecBuffer MUST remain constant between calls.
283
282
  // Returns NULL if the allocation failed.
284
- WEBP_EXTERN WebPIDecoder* WebPINewDecoder(WebPDecBuffer* output_buffer);
283
+ WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewDecoder(
284
+ WebPDecBuffer* output_buffer);
285
285
 
286
286
  // This function allocates and initializes an incremental-decoder object, which
287
287
  // will output the RGB/A samples specified by 'csp' into a preallocated
@@ -293,7 +293,7 @@ WEBP_EXTERN WebPIDecoder* WebPINewDecoder(WebPDecBuffer* output_buffer);
293
293
  // colorspace 'csp' is taken into account for allocating this buffer. All other
294
294
  // parameters are ignored.
295
295
  // Returns NULL if the allocation failed, or if some parameters are invalid.
296
- WEBP_EXTERN WebPIDecoder* WebPINewRGB(
296
+ WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewRGB(
297
297
  WEBP_CSP_MODE csp,
298
298
  uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
299
299
 
@@ -308,7 +308,7 @@ WEBP_EXTERN WebPIDecoder* WebPINewRGB(
308
308
  // In this case, the output buffer will be automatically allocated (using
309
309
  // MODE_YUVA) when decoding starts. All parameters are then ignored.
310
310
  // Returns NULL if the allocation failed or if a parameter is invalid.
311
- WEBP_EXTERN WebPIDecoder* WebPINewYUVA(
311
+ WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewYUVA(
312
312
  uint8_t* luma, size_t luma_size, int luma_stride,
313
313
  uint8_t* u, size_t u_size, int u_stride,
314
314
  uint8_t* v, size_t v_size, int v_stride,
@@ -316,7 +316,7 @@ WEBP_EXTERN WebPIDecoder* WebPINewYUVA(
316
316
 
317
317
  // Deprecated version of the above, without the alpha plane.
318
318
  // Kept for backward compatibility.
319
- WEBP_EXTERN WebPIDecoder* WebPINewYUV(
319
+ WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewYUV(
320
320
  uint8_t* luma, size_t luma_size, int luma_stride,
321
321
  uint8_t* u, size_t u_size, int u_stride,
322
322
  uint8_t* v, size_t v_size, int v_stride);
@@ -346,21 +346,21 @@ WEBP_EXTERN VP8StatusCode WebPIUpdate(
346
346
  // (*last_y, *width etc.) can be NULL if corresponding information is not
347
347
  // needed. The values in these pointers are only valid on successful (non-NULL)
348
348
  // return.
349
- WEBP_EXTERN uint8_t* WebPIDecGetRGB(
349
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPIDecGetRGB(
350
350
  const WebPIDecoder* idec, int* last_y,
351
351
  int* width, int* height, int* stride);
352
352
 
353
353
  // Same as above function to get a YUVA image. Returns pointer to the luma
354
354
  // plane or NULL in case of error. If there is no alpha information
355
355
  // the alpha pointer '*a' will be returned NULL.
356
- WEBP_EXTERN uint8_t* WebPIDecGetYUVA(
356
+ WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPIDecGetYUVA(
357
357
  const WebPIDecoder* idec, int* last_y,
358
358
  uint8_t** u, uint8_t** v, uint8_t** a,
359
359
  int* width, int* height, int* stride, int* uv_stride, int* a_stride);
360
360
 
361
361
  // Deprecated alpha-less version of WebPIDecGetYUVA(): it will ignore the
362
362
  // alpha information (if present). Kept for backward compatibility.
363
- static WEBP_INLINE uint8_t* WebPIDecGetYUV(
363
+ WEBP_NODISCARD static WEBP_INLINE uint8_t* WebPIDecGetYUV(
364
364
  const WebPIDecoder* idec, int* last_y, uint8_t** u, uint8_t** v,
365
365
  int* width, int* height, int* stride, int* uv_stride) {
366
366
  return WebPIDecGetYUVA(idec, last_y, u, v, NULL, width, height,
@@ -373,7 +373,7 @@ static WEBP_INLINE uint8_t* WebPIDecGetYUV(
373
373
  // Returns NULL in case the incremental decoder object is in an invalid state.
374
374
  // Otherwise returns the pointer to the internal representation. This structure
375
375
  // is read-only, tied to WebPIDecoder's lifespan and should not be modified.
376
- WEBP_EXTERN const WebPDecBuffer* WebPIDecodedArea(
376
+ WEBP_NODISCARD WEBP_EXTERN const WebPDecBuffer* WebPIDecodedArea(
377
377
  const WebPIDecoder* idec, int* left, int* top, int* width, int* height);
378
378
 
379
379
  //------------------------------------------------------------------------------
@@ -389,7 +389,7 @@ WEBP_EXTERN const WebPDecBuffer* WebPIDecodedArea(
389
389
  CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK);
390
390
 
391
391
  // C) Adjust 'config', if needed
392
- config.no_fancy_upsampling = 1;
392
+ config.options.no_fancy_upsampling = 1;
393
393
  config.output.colorspace = MODE_BGRA;
394
394
  // etc.
395
395
 
@@ -468,12 +468,14 @@ struct WebPDecoderConfig {
468
468
  };
469
469
 
470
470
  // Internal, version-checked, entry point
471
- WEBP_EXTERN int WebPInitDecoderConfigInternal(WebPDecoderConfig*, int);
471
+ WEBP_NODISCARD WEBP_EXTERN int WebPInitDecoderConfigInternal(WebPDecoderConfig*,
472
+ int);
472
473
 
473
474
  // Initialize the configuration as empty. This function must always be
474
475
  // called first, unless WebPGetFeatures() is to be called.
475
476
  // Returns false in case of mismatched version.
476
- static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) {
477
+ WEBP_NODISCARD static WEBP_INLINE int WebPInitDecoderConfig(
478
+ WebPDecoderConfig* config) {
477
479
  return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION);
478
480
  }
479
481
 
@@ -488,8 +490,8 @@ static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) {
488
490
  // The return WebPIDecoder object must always be deleted calling WebPIDelete().
489
491
  // Returns NULL in case of error (and config->status will then reflect
490
492
  // the error condition, if available).
491
- WEBP_EXTERN WebPIDecoder* WebPIDecode(const uint8_t* data, size_t data_size,
492
- WebPDecoderConfig* config);
493
+ WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPIDecode(
494
+ const uint8_t* data, size_t data_size, WebPDecoderConfig* config);
493
495
 
494
496
  // Non-incremental version. This version decodes the full data at once, taking
495
497
  // 'config' into account. Returns decoding status (which should be VP8_STATUS_OK
@@ -50,6 +50,7 @@
50
50
 
51
51
  #include "./decode.h" // for WEBP_CSP_MODE
52
52
  #include "./mux_types.h"
53
+ #include "./types.h"
53
54
 
54
55
  #ifdef __cplusplus
55
56
  extern "C" {
@@ -85,13 +86,13 @@ typedef enum WebPDemuxState {
85
86
  } WebPDemuxState;
86
87
 
87
88
  // Internal, version-checked, entry point
88
- WEBP_EXTERN WebPDemuxer* WebPDemuxInternal(
89
+ WEBP_NODISCARD WEBP_EXTERN WebPDemuxer* WebPDemuxInternal(
89
90
  const WebPData*, int, WebPDemuxState*, int);
90
91
 
91
92
  // Parses the full WebP file given by 'data'. For single images the WebP file
92
93
  // header alone or the file header and the chunk header may be absent.
93
94
  // Returns a WebPDemuxer object on successful parse, NULL otherwise.
94
- static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
95
+ WEBP_NODISCARD static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
95
96
  return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION);
96
97
  }
97
98
 
@@ -103,7 +104,7 @@ static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
103
104
  // If this data is volatile, the demuxer object should be deleted (by calling
104
105
  // WebPDemuxDelete()) and WebPDemuxPartial() called again on the new data.
105
106
  // This is usually an inexpensive operation.
106
- static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
107
+ WEBP_NODISCARD static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
107
108
  const WebPData* data, WebPDemuxState* state) {
108
109
  return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
109
110
  }
@@ -164,14 +165,14 @@ struct WebPIterator {
164
165
  // Returns false if 'dmux' is NULL or frame 'frame_number' is not present.
165
166
  // Call WebPDemuxReleaseIterator() when use of the iterator is complete.
166
167
  // NOTE: 'dmux' must persist for the lifetime of 'iter'.
167
- WEBP_EXTERN int WebPDemuxGetFrame(
168
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxGetFrame(
168
169
  const WebPDemuxer* dmux, int frame_number, WebPIterator* iter);
169
170
 
170
171
  // Sets 'iter->fragment' to point to the next ('iter->frame_num' + 1) or
171
172
  // previous ('iter->frame_num' - 1) frame. These functions do not loop.
172
173
  // Returns true on success, false otherwise.
173
- WEBP_EXTERN int WebPDemuxNextFrame(WebPIterator* iter);
174
- WEBP_EXTERN int WebPDemuxPrevFrame(WebPIterator* iter);
174
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxNextFrame(WebPIterator* iter);
175
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxPrevFrame(WebPIterator* iter);
175
176
 
176
177
  // Releases any memory associated with 'iter'.
177
178
  // Must be called before any subsequent calls to WebPDemuxGetChunk() on the same
@@ -202,15 +203,16 @@ struct WebPChunkIterator {
202
203
  // payloads are accessed through WebPDemuxGetFrame() and related functions.
203
204
  // Call WebPDemuxReleaseChunkIterator() when use of the iterator is complete.
204
205
  // NOTE: 'dmux' must persist for the lifetime of the iterator.
205
- WEBP_EXTERN int WebPDemuxGetChunk(const WebPDemuxer* dmux,
206
- const char fourcc[4], int chunk_number,
207
- WebPChunkIterator* iter);
206
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxGetChunk(const WebPDemuxer* dmux,
207
+ const char fourcc[4],
208
+ int chunk_number,
209
+ WebPChunkIterator* iter);
208
210
 
209
211
  // Sets 'iter->chunk' to point to the next ('iter->chunk_num' + 1) or previous
210
212
  // ('iter->chunk_num' - 1) chunk. These functions do not loop.
211
213
  // Returns true on success, false otherwise.
212
- WEBP_EXTERN int WebPDemuxNextChunk(WebPChunkIterator* iter);
213
- WEBP_EXTERN int WebPDemuxPrevChunk(WebPChunkIterator* iter);
214
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxNextChunk(WebPChunkIterator* iter);
215
+ WEBP_NODISCARD WEBP_EXTERN int WebPDemuxPrevChunk(WebPChunkIterator* iter);
214
216
 
215
217
  // Releases any memory associated with 'iter'.
216
218
  // Must be called before destroying the associated WebPDemuxer with
@@ -257,21 +259,21 @@ struct WebPAnimDecoderOptions {
257
259
  };
258
260
 
259
261
  // Internal, version-checked, entry point.
260
- WEBP_EXTERN int WebPAnimDecoderOptionsInitInternal(
262
+ WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderOptionsInitInternal(
261
263
  WebPAnimDecoderOptions*, int);
262
264
 
263
265
  // Should always be called, to initialize a fresh WebPAnimDecoderOptions
264
266
  // structure before modification. Returns false in case of version mismatch.
265
267
  // WebPAnimDecoderOptionsInit() must have succeeded before using the
266
268
  // 'dec_options' object.
267
- static WEBP_INLINE int WebPAnimDecoderOptionsInit(
269
+ WEBP_NODISCARD static WEBP_INLINE int WebPAnimDecoderOptionsInit(
268
270
  WebPAnimDecoderOptions* dec_options) {
269
271
  return WebPAnimDecoderOptionsInitInternal(dec_options,
270
272
  WEBP_DEMUX_ABI_VERSION);
271
273
  }
272
274
 
273
275
  // Internal, version-checked, entry point.
274
- WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal(
276
+ WEBP_NODISCARD WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal(
275
277
  const WebPData*, const WebPAnimDecoderOptions*, int);
276
278
 
277
279
  // Creates and initializes a WebPAnimDecoder object.
@@ -284,7 +286,7 @@ WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal(
284
286
  // Returns:
285
287
  // A pointer to the newly created WebPAnimDecoder object, or NULL in case of
286
288
  // parsing error, invalid option or memory error.
287
- static WEBP_INLINE WebPAnimDecoder* WebPAnimDecoderNew(
289
+ WEBP_NODISCARD static WEBP_INLINE WebPAnimDecoder* WebPAnimDecoderNew(
288
290
  const WebPData* webp_data, const WebPAnimDecoderOptions* dec_options) {
289
291
  return WebPAnimDecoderNewInternal(webp_data, dec_options,
290
292
  WEBP_DEMUX_ABI_VERSION);
@@ -306,8 +308,8 @@ struct WebPAnimInfo {
306
308
  // info - (out) global information fetched from the animation.
307
309
  // Returns:
308
310
  // True on success.
309
- WEBP_EXTERN int WebPAnimDecoderGetInfo(const WebPAnimDecoder* dec,
310
- WebPAnimInfo* info);
311
+ WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderGetInfo(
312
+ const WebPAnimDecoder* dec, WebPAnimInfo* info);
311
313
 
312
314
  // Fetch the next frame from 'dec' based on options supplied to
313
315
  // WebPAnimDecoderNew(). This will be a fully reconstructed canvas of size
@@ -321,8 +323,9 @@ WEBP_EXTERN int WebPAnimDecoderGetInfo(const WebPAnimDecoder* dec,
321
323
  // Returns:
322
324
  // False if any of the arguments are NULL, or if there is a parsing or
323
325
  // decoding error, or if there are no more frames. Otherwise, returns true.
324
- WEBP_EXTERN int WebPAnimDecoderGetNext(WebPAnimDecoder* dec,
325
- uint8_t** buf, int* timestamp);
326
+ WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderGetNext(WebPAnimDecoder* dec,
327
+ uint8_t** buf,
328
+ int* timestamp);
326
329
 
327
330
  // Check if there are more frames left to decode.
328
331
  // Parameters:
@@ -330,7 +333,8 @@ WEBP_EXTERN int WebPAnimDecoderGetNext(WebPAnimDecoder* dec,
330
333
  // Returns:
331
334
  // True if 'dec' is not NULL and some frames are yet to be decoded.
332
335
  // Otherwise, returns false.
333
- WEBP_EXTERN int WebPAnimDecoderHasMoreFrames(const WebPAnimDecoder* dec);
336
+ WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderHasMoreFrames(
337
+ const WebPAnimDecoder* dec);
334
338
 
335
339
  // Resets the WebPAnimDecoder object, so that next call to
336
340
  // WebPAnimDecoderGetNext() will restart decoding from 1st frame. This would be
@@ -348,7 +352,7 @@ WEBP_EXTERN void WebPAnimDecoderReset(WebPAnimDecoder* dec);
348
352
  //
349
353
  // Parameters:
350
354
  // dec - (in) decoder instance from which the demuxer object is to be fetched.
351
- WEBP_EXTERN const WebPDemuxer* WebPAnimDecoderGetDemuxer(
355
+ WEBP_NODISCARD WEBP_EXTERN const WebPDemuxer* WebPAnimDecoderGetDemuxer(
352
356
  const WebPAnimDecoder* dec);
353
357
 
354
358
  // Deletes the WebPAnimDecoder object.