@img/sharp-libvips-dev 1.0.2 → 1.0.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/README.md +1 -2
- package/include/aom/aom_decoder.h +1 -1
- package/include/aom/aom_encoder.h +7 -1
- package/include/aom/aom_image.h +24 -12
- package/include/aom/aom_integer.h +3 -3
- package/include/aom/aomcx.h +15 -0
- package/include/aom/aomdx.h +5 -2
- package/include/archive.h +7 -5
- package/include/archive_entry.h +5 -3
- package/include/cgif.h +3 -0
- package/include/freetype2/freetype/config/ftoption.h +1 -1
- package/include/fribidi/fribidi-config.h +2 -2
- package/include/fribidi/fribidi-unicode-version.h +3 -3
- package/include/glib-2.0/gio/gappinfo.h +40 -25
- package/include/glib-2.0/gio/gasyncresult.h +1 -1
- package/include/glib-2.0/gio/gconverter.h +5 -0
- package/include/glib-2.0/gio/gdbusintrospection.h +1 -1
- package/include/glib-2.0/gio/gfile.h +16 -0
- package/include/glib-2.0/gio/gio-visibility.h +34 -0
- package/include/glib-2.0/gio/gsettings.h +8 -0
- package/include/glib-2.0/gio/gvfs.h +2 -2
- package/include/glib-2.0/girepository/gi-visibility.h +34 -0
- package/include/glib-2.0/glib/gbookmarkfile.h +1 -1
- package/include/glib-2.0/glib/giochannel.h +2 -2
- package/include/glib-2.0/glib/glib-visibility.h +34 -0
- package/include/glib-2.0/glib/gmacros.h +12 -5
- package/include/glib-2.0/glib/gmain.h +93 -7
- package/include/glib-2.0/glib/gqsort.h +8 -1
- package/include/glib-2.0/glib/gstrfuncs.h +0 -12
- package/include/glib-2.0/glib/gstrvbuilder.h +3 -0
- package/include/glib-2.0/glib/gunicode.h +1 -1
- 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/gtype.h +6 -6
- package/include/harfbuzz/hb-buffer.h +6 -0
- package/include/harfbuzz/hb-common.h +6 -9
- package/include/harfbuzz/hb-cplusplus.hh +8 -11
- package/include/harfbuzz/hb-subset.h +17 -4
- package/include/harfbuzz/hb-version.h +3 -3
- package/include/hwy/abort.h +28 -0
- package/include/hwy/aligned_allocator.h +48 -1
- package/include/hwy/base.h +235 -34
- package/include/hwy/detect_compiler_arch.h +84 -10
- package/include/hwy/detect_targets.h +95 -29
- package/include/hwy/foreach_target.h +12 -1
- package/include/hwy/highway.h +205 -50
- package/include/hwy/ops/arm_neon-inl.h +841 -99
- package/include/hwy/ops/arm_sve-inl.h +413 -141
- package/include/hwy/ops/emu128-inl.h +373 -360
- package/include/hwy/ops/generic_ops-inl.h +804 -401
- package/include/hwy/ops/inside-inl.h +691 -0
- package/include/hwy/ops/ppc_vsx-inl.h +456 -166
- package/include/hwy/ops/rvv-inl.h +537 -249
- package/include/hwy/ops/scalar-inl.h +169 -79
- package/include/hwy/ops/set_macros-inl.h +106 -18
- package/include/hwy/ops/shared-inl.h +23 -0
- package/include/hwy/ops/wasm_128-inl.h +130 -108
- package/include/hwy/ops/x86_128-inl.h +1892 -577
- package/include/hwy/ops/x86_256-inl.h +625 -184
- package/include/hwy/ops/x86_512-inl.h +733 -131
- package/include/hwy/targets.h +22 -21
- package/include/hwy/timer-inl.h +3 -3
- package/include/hwy/timer.h +5 -1
- package/include/libheif/heif.h +170 -15
- package/include/libheif/heif_items.h +237 -0
- package/include/libheif/heif_properties.h +38 -2
- package/include/libheif/heif_regions.h +1 -1
- package/include/libheif/heif_version.h +2 -2
- package/include/libpng16/pnglibconf.h +1 -1
- package/include/librsvg-2.0/librsvg/rsvg-cairo.h +1 -1
- package/include/librsvg-2.0/librsvg/rsvg-features.h +3 -4
- package/include/librsvg-2.0/librsvg/rsvg-pixbuf.h +235 -0
- package/include/librsvg-2.0/librsvg/rsvg-version.h +3 -3
- package/include/librsvg-2.0/librsvg/rsvg.h +55 -176
- package/include/libxml2/libxml/HTMLparser.h +12 -19
- package/include/libxml2/libxml/c14n.h +1 -12
- package/include/libxml2/libxml/debugXML.h +1 -1
- package/include/libxml2/libxml/encoding.h +9 -0
- package/include/libxml2/libxml/entities.h +12 -1
- package/include/libxml2/libxml/hash.h +19 -0
- package/include/libxml2/libxml/list.h +2 -2
- package/include/libxml2/libxml/nanohttp.h +17 -0
- package/include/libxml2/libxml/parser.h +61 -55
- package/include/libxml2/libxml/parserInternals.h +9 -1
- package/include/libxml2/libxml/pattern.h +6 -0
- package/include/libxml2/libxml/tree.h +32 -12
- package/include/libxml2/libxml/uri.h +11 -0
- package/include/libxml2/libxml/valid.h +29 -2
- package/include/libxml2/libxml/xinclude.h +7 -0
- package/include/libxml2/libxml/xmlIO.h +21 -4
- package/include/libxml2/libxml/xmlerror.h +14 -0
- package/include/libxml2/libxml/xmlexports.h +111 -15
- package/include/libxml2/libxml/xmlmemory.h +8 -45
- package/include/libxml2/libxml/xmlreader.h +2 -0
- package/include/libxml2/libxml/xmlsave.h +5 -0
- package/include/libxml2/libxml/xmlunicode.h +165 -1
- package/include/libxml2/libxml/xmlversion.h +15 -179
- package/include/libxml2/libxml/xmlwriter.h +1 -0
- package/include/libxml2/libxml/xpath.h +4 -0
- package/include/pango-1.0/pango/pango-features.h +3 -3
- package/include/pango-1.0/pango/pango-item.h +4 -2
- package/include/pango-1.0/pango/pango-version-macros.h +25 -0
- package/include/pango-1.0/pango/pangofc-font.h +2 -1
- package/include/pnglibconf.h +1 -1
- package/include/vips/util.h +1 -2
- package/include/vips/version.h +4 -4
- package/include/webp/decode.h +58 -56
- package/include/webp/demux.h +25 -21
- package/include/webp/encode.h +44 -39
- package/include/webp/mux.h +76 -15
- package/include/webp/mux_types.h +2 -1
- package/include/webp/sharpyuv/sharpyuv.h +77 -8
- package/include/webp/types.h +29 -8
- package/include/zconf.h +1 -1
- package/include/zlib.h +12 -12
- package/package.json +1 -1
- package/versions.json +14 -15
package/include/webp/decode.h
CHANGED
|
@@ -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(
|
|
52
|
-
|
|
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(
|
|
60
|
-
|
|
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(
|
|
64
|
-
|
|
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(
|
|
68
|
-
|
|
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(
|
|
73
|
-
|
|
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(
|
|
77
|
-
|
|
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(
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
|
|
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(
|
|
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*,
|
|
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(
|
|
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(
|
|
492
|
-
|
|
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
|
package/include/webp/demux.h
CHANGED
|
@@ -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
|
-
|
|
207
|
-
|
|
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(
|
|
310
|
-
|
|
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
|
-
|
|
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(
|
|
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.
|
package/include/webp/encode.h
CHANGED
|
@@ -164,13 +164,14 @@ typedef enum WebPPreset {
|
|
|
164
164
|
} WebPPreset;
|
|
165
165
|
|
|
166
166
|
// Internal, version-checked, entry point
|
|
167
|
-
WEBP_EXTERN int WebPConfigInitInternal(WebPConfig*, WebPPreset,
|
|
167
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPConfigInitInternal(WebPConfig*, WebPPreset,
|
|
168
|
+
float, int);
|
|
168
169
|
|
|
169
170
|
// Should always be called, to initialize a fresh WebPConfig structure before
|
|
170
171
|
// modification. Returns false in case of version mismatch. WebPConfigInit()
|
|
171
172
|
// must have succeeded before using the 'config' object.
|
|
172
173
|
// Note that the default values are lossless=0 and quality=75.
|
|
173
|
-
static WEBP_INLINE int WebPConfigInit(WebPConfig* config) {
|
|
174
|
+
WEBP_NODISCARD static WEBP_INLINE int WebPConfigInit(WebPConfig* config) {
|
|
174
175
|
return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f,
|
|
175
176
|
WEBP_ENCODER_ABI_VERSION);
|
|
176
177
|
}
|
|
@@ -179,8 +180,9 @@ static WEBP_INLINE int WebPConfigInit(WebPConfig* config) {
|
|
|
179
180
|
// set of parameters (referred to by 'preset') and a given quality factor.
|
|
180
181
|
// This function can be called as a replacement to WebPConfigInit(). Will
|
|
181
182
|
// return false in case of error.
|
|
182
|
-
static WEBP_INLINE int WebPConfigPreset(WebPConfig* config,
|
|
183
|
-
|
|
183
|
+
WEBP_NODISCARD static WEBP_INLINE int WebPConfigPreset(WebPConfig* config,
|
|
184
|
+
WebPPreset preset,
|
|
185
|
+
float quality) {
|
|
184
186
|
return WebPConfigInitInternal(config, preset, quality,
|
|
185
187
|
WEBP_ENCODER_ABI_VERSION);
|
|
186
188
|
}
|
|
@@ -191,11 +193,12 @@ static WEBP_INLINE int WebPConfigPreset(WebPConfig* config,
|
|
|
191
193
|
// speed and final compressed size.
|
|
192
194
|
// This function will overwrite several fields from config: 'method', 'quality'
|
|
193
195
|
// and 'lossless'. Returns false in case of parameter error.
|
|
194
|
-
WEBP_EXTERN int WebPConfigLosslessPreset(WebPConfig* config,
|
|
196
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPConfigLosslessPreset(WebPConfig* config,
|
|
197
|
+
int level);
|
|
195
198
|
|
|
196
199
|
// Returns true if 'config' is non-NULL and all configuration parameters are
|
|
197
200
|
// within their valid ranges.
|
|
198
|
-
WEBP_EXTERN int WebPValidateConfig(const WebPConfig* config);
|
|
201
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPValidateConfig(const WebPConfig* config);
|
|
199
202
|
|
|
200
203
|
//------------------------------------------------------------------------------
|
|
201
204
|
// Input / Output
|
|
@@ -255,8 +258,8 @@ WEBP_EXTERN void WebPMemoryWriterClear(WebPMemoryWriter* writer);
|
|
|
255
258
|
// The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon
|
|
256
259
|
// completion, writer.mem and writer.size will hold the coded data.
|
|
257
260
|
// writer.mem must be freed by calling WebPMemoryWriterClear.
|
|
258
|
-
WEBP_EXTERN int WebPMemoryWrite(
|
|
259
|
-
|
|
261
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPMemoryWrite(
|
|
262
|
+
const uint8_t* data, size_t data_size, const WebPPicture* picture);
|
|
260
263
|
|
|
261
264
|
// Progress hook, called from time to time to report progress. It can return
|
|
262
265
|
// false to request an abort of the encoding process, or true otherwise if
|
|
@@ -364,13 +367,13 @@ struct WebPPicture {
|
|
|
364
367
|
};
|
|
365
368
|
|
|
366
369
|
// Internal, version-checked, entry point
|
|
367
|
-
WEBP_EXTERN int WebPPictureInitInternal(WebPPicture*, int);
|
|
370
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureInitInternal(WebPPicture*, int);
|
|
368
371
|
|
|
369
372
|
// Should always be called, to initialize the structure. Returns false in case
|
|
370
373
|
// of version mismatch. WebPPictureInit() must have succeeded before using the
|
|
371
374
|
// 'picture' object.
|
|
372
375
|
// Note that, by default, use_argb is false and colorspace is WEBP_YUV420.
|
|
373
|
-
static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) {
|
|
376
|
+
WEBP_NODISCARD static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) {
|
|
374
377
|
return WebPPictureInitInternal(picture, WEBP_ENCODER_ABI_VERSION);
|
|
375
378
|
}
|
|
376
379
|
|
|
@@ -381,7 +384,7 @@ static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) {
|
|
|
381
384
|
// Allocate y/u/v buffers as per colorspace/width/height specification.
|
|
382
385
|
// Note! This function will free the previous buffer if needed.
|
|
383
386
|
// Returns false in case of memory error.
|
|
384
|
-
WEBP_EXTERN int WebPPictureAlloc(WebPPicture* picture);
|
|
387
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureAlloc(WebPPicture* picture);
|
|
385
388
|
|
|
386
389
|
// Release the memory allocated by WebPPictureAlloc() or WebPPictureImport*().
|
|
387
390
|
// Note that this function does _not_ free the memory used by the 'picture'
|
|
@@ -394,7 +397,8 @@ WEBP_EXTERN void WebPPictureFree(WebPPicture* picture);
|
|
|
394
397
|
// will fully own the copied pixels (this is not a view). The 'dst' picture need
|
|
395
398
|
// not be initialized as its content is overwritten.
|
|
396
399
|
// Returns false in case of memory allocation error.
|
|
397
|
-
WEBP_EXTERN int WebPPictureCopy(const WebPPicture* src,
|
|
400
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureCopy(const WebPPicture* src,
|
|
401
|
+
WebPPicture* dst);
|
|
398
402
|
|
|
399
403
|
// Compute the single distortion for packed planes of samples.
|
|
400
404
|
// 'src' will be compared to 'ref', and the raw distortion stored into
|
|
@@ -403,19 +407,18 @@ WEBP_EXTERN int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst);
|
|
|
403
407
|
// 'x_step' is the horizontal stride (in bytes) between samples.
|
|
404
408
|
// 'src/ref_stride' is the byte distance between rows.
|
|
405
409
|
// Returns false in case of error (bad parameter, memory allocation error, ...).
|
|
406
|
-
WEBP_EXTERN int WebPPlaneDistortion(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
float* distortion, float* result);
|
|
410
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPlaneDistortion(
|
|
411
|
+
const uint8_t* src, size_t src_stride,
|
|
412
|
+
const uint8_t* ref, size_t ref_stride, int width, int height, size_t x_step,
|
|
413
|
+
int type, // 0 = PSNR, 1 = SSIM, 2 = LSIM
|
|
414
|
+
float* distortion, float* result);
|
|
412
415
|
|
|
413
416
|
// Compute PSNR, SSIM or LSIM distortion metric between two pictures. Results
|
|
414
417
|
// are in dB, stored in result[] in the B/G/R/A/All order. The distortion is
|
|
415
418
|
// always performed using ARGB samples. Hence if the input is YUV(A), the
|
|
416
419
|
// picture will be internally converted to ARGB (just for the measurement).
|
|
417
420
|
// Warning: this function is rather CPU-intensive.
|
|
418
|
-
WEBP_EXTERN int WebPPictureDistortion(
|
|
421
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureDistortion(
|
|
419
422
|
const WebPPicture* src, const WebPPicture* ref,
|
|
420
423
|
int metric_type, // 0 = PSNR, 1 = SSIM, 2 = LSIM
|
|
421
424
|
float result[5]);
|
|
@@ -428,8 +431,8 @@ WEBP_EXTERN int WebPPictureDistortion(
|
|
|
428
431
|
// must be fully be comprised inside the 'src' source picture. If the source
|
|
429
432
|
// picture uses the YUV420 colorspace, the top and left coordinates will be
|
|
430
433
|
// snapped to even values.
|
|
431
|
-
WEBP_EXTERN int WebPPictureCrop(
|
|
432
|
-
|
|
434
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureCrop(
|
|
435
|
+
WebPPicture* picture, int left, int top, int width, int height);
|
|
433
436
|
|
|
434
437
|
// Extracts a view from 'src' picture into 'dst'. The rectangle for the view
|
|
435
438
|
// is defined by the top-left corner pixel coordinates (left, top) as well
|
|
@@ -442,9 +445,9 @@ WEBP_EXTERN int WebPPictureCrop(WebPPicture* picture,
|
|
|
442
445
|
// with WebPPictureInit() if it is different from 'src', since its content will
|
|
443
446
|
// be overwritten.
|
|
444
447
|
// Returns false in case of invalid parameters.
|
|
445
|
-
WEBP_EXTERN int WebPPictureView(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureView(
|
|
449
|
+
const WebPPicture* src, int left, int top, int width, int height,
|
|
450
|
+
WebPPicture* dst);
|
|
448
451
|
|
|
449
452
|
// Returns true if the 'picture' is actually a view and therefore does
|
|
450
453
|
// not own the memory for pixels.
|
|
@@ -455,29 +458,30 @@ WEBP_EXTERN int WebPPictureIsView(const WebPPicture* picture);
|
|
|
455
458
|
// dimension will be calculated preserving the aspect ratio.
|
|
456
459
|
// No gamma correction is applied.
|
|
457
460
|
// Returns false in case of error (invalid parameter or insufficient memory).
|
|
458
|
-
WEBP_EXTERN int WebPPictureRescale(WebPPicture* picture,
|
|
461
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureRescale(WebPPicture* picture,
|
|
462
|
+
int width, int height);
|
|
459
463
|
|
|
460
464
|
// Colorspace conversion function to import RGB samples.
|
|
461
465
|
// Previous buffer will be free'd, if any.
|
|
462
466
|
// *rgb buffer should have a size of at least height * rgb_stride.
|
|
463
467
|
// Returns false in case of memory error.
|
|
464
|
-
WEBP_EXTERN int WebPPictureImportRGB(
|
|
468
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportRGB(
|
|
465
469
|
WebPPicture* picture, const uint8_t* rgb, int rgb_stride);
|
|
466
470
|
// Same, but for RGBA buffer.
|
|
467
|
-
WEBP_EXTERN int WebPPictureImportRGBA(
|
|
471
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportRGBA(
|
|
468
472
|
WebPPicture* picture, const uint8_t* rgba, int rgba_stride);
|
|
469
473
|
// Same, but for RGBA buffer. Imports the RGB direct from the 32-bit format
|
|
470
474
|
// input buffer ignoring the alpha channel. Avoids needing to copy the data
|
|
471
475
|
// to a temporary 24-bit RGB buffer to import the RGB only.
|
|
472
|
-
WEBP_EXTERN int WebPPictureImportRGBX(
|
|
476
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportRGBX(
|
|
473
477
|
WebPPicture* picture, const uint8_t* rgbx, int rgbx_stride);
|
|
474
478
|
|
|
475
479
|
// Variants of the above, but taking BGR(A|X) input.
|
|
476
|
-
WEBP_EXTERN int WebPPictureImportBGR(
|
|
480
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportBGR(
|
|
477
481
|
WebPPicture* picture, const uint8_t* bgr, int bgr_stride);
|
|
478
|
-
WEBP_EXTERN int WebPPictureImportBGRA(
|
|
482
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportBGRA(
|
|
479
483
|
WebPPicture* picture, const uint8_t* bgra, int bgra_stride);
|
|
480
|
-
WEBP_EXTERN int WebPPictureImportBGRX(
|
|
484
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureImportBGRX(
|
|
481
485
|
WebPPicture* picture, const uint8_t* bgrx, int bgrx_stride);
|
|
482
486
|
|
|
483
487
|
// Converts picture->argb data to the YUV420A format. The 'colorspace'
|
|
@@ -486,24 +490,24 @@ WEBP_EXTERN int WebPPictureImportBGRX(
|
|
|
486
490
|
// non-opaque transparent values is detected, and 'colorspace' will be
|
|
487
491
|
// adjusted accordingly. Note that this method is lossy.
|
|
488
492
|
// Returns false in case of error.
|
|
489
|
-
WEBP_EXTERN int WebPPictureARGBToYUVA(
|
|
490
|
-
|
|
493
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureARGBToYUVA(
|
|
494
|
+
WebPPicture* picture, WebPEncCSP /*colorspace = WEBP_YUV420*/);
|
|
491
495
|
|
|
492
496
|
// Same as WebPPictureARGBToYUVA(), but the conversion is done using
|
|
493
497
|
// pseudo-random dithering with a strength 'dithering' between
|
|
494
498
|
// 0.0 (no dithering) and 1.0 (maximum dithering). This is useful
|
|
495
499
|
// for photographic picture.
|
|
496
|
-
WEBP_EXTERN int WebPPictureARGBToYUVADithered(
|
|
500
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureARGBToYUVADithered(
|
|
497
501
|
WebPPicture* picture, WebPEncCSP colorspace, float dithering);
|
|
498
502
|
|
|
499
|
-
// Performs 'sharp' RGBA->YUVA420 downsampling and colorspace conversion
|
|
503
|
+
// Performs 'sharp' RGBA->YUVA420 downsampling and colorspace conversion
|
|
500
504
|
// Downsampling is handled with extra care in case of color clipping. This
|
|
501
505
|
// method is roughly 2x slower than WebPPictureARGBToYUVA() but produces better
|
|
502
506
|
// and sharper YUV representation.
|
|
503
507
|
// Returns false in case of error.
|
|
504
|
-
WEBP_EXTERN int WebPPictureSharpARGBToYUVA(WebPPicture* picture);
|
|
508
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureSharpARGBToYUVA(WebPPicture* picture);
|
|
505
509
|
// kept for backward compatibility:
|
|
506
|
-
WEBP_EXTERN int WebPPictureSmartARGBToYUVA(WebPPicture* picture);
|
|
510
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureSmartARGBToYUVA(WebPPicture* picture);
|
|
507
511
|
|
|
508
512
|
// Converts picture->yuv to picture->argb and sets picture->use_argb to true.
|
|
509
513
|
// The input format must be YUV_420 or YUV_420A. The conversion from YUV420 to
|
|
@@ -511,7 +515,7 @@ WEBP_EXTERN int WebPPictureSmartARGBToYUVA(WebPPicture* picture);
|
|
|
511
515
|
// Note that the use of this colorspace is discouraged if one has access to the
|
|
512
516
|
// raw ARGB samples, since using YUV420 is comparatively lossy.
|
|
513
517
|
// Returns false in case of error.
|
|
514
|
-
WEBP_EXTERN int WebPPictureYUVAToARGB(WebPPicture* picture);
|
|
518
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPPictureYUVAToARGB(WebPPicture* picture);
|
|
515
519
|
|
|
516
520
|
// Helper function: given a width x height plane of RGBA or YUV(A) samples
|
|
517
521
|
// clean-up or smoothen the YUV or RGB samples under fully transparent area,
|
|
@@ -541,7 +545,8 @@ WEBP_EXTERN void WebPBlendAlpha(WebPPicture* picture, uint32_t background_rgb);
|
|
|
541
545
|
// the former for lossy encoding, and the latter for lossless encoding
|
|
542
546
|
// (when config.lossless is true). Automatic conversion from one format to
|
|
543
547
|
// another is provided but they both incur some loss.
|
|
544
|
-
WEBP_EXTERN int WebPEncode(const WebPConfig* config,
|
|
548
|
+
WEBP_NODISCARD WEBP_EXTERN int WebPEncode(const WebPConfig* config,
|
|
549
|
+
WebPPicture* picture);
|
|
545
550
|
|
|
546
551
|
//------------------------------------------------------------------------------
|
|
547
552
|
|