/src/libwebp/src/webp/decode.h
Line | Count | Source |
1 | | // Copyright 2010 Google Inc. All Rights Reserved. |
2 | | // |
3 | | // Use of this source code is governed by a BSD-style license |
4 | | // that can be found in the COPYING file in the root of the source |
5 | | // tree. An additional intellectual property rights grant can be found |
6 | | // in the file PATENTS. All contributing project authors may |
7 | | // be found in the AUTHORS file in the root of the source tree. |
8 | | // ----------------------------------------------------------------------------- |
9 | | // |
10 | | // Main decoding functions for WebP images. |
11 | | // |
12 | | // Author: Skal (pascal.massimino@gmail.com) |
13 | | |
14 | | #ifndef WEBP_WEBP_DECODE_H_ |
15 | | #define WEBP_WEBP_DECODE_H_ |
16 | | |
17 | | #include <stddef.h> |
18 | | |
19 | | #include "./types.h" |
20 | | |
21 | | WEBP_ASSUME_UNSAFE_INDEXABLE_ABI |
22 | | |
23 | | #ifdef __cplusplus |
24 | | extern "C" { |
25 | | #endif |
26 | | |
27 | 12.3k | #define WEBP_DECODER_ABI_VERSION 0x0210 // MAJOR(8b) + MINOR(8b) |
28 | | |
29 | | // Note: forward declaring enumerations is not allowed in (strict) C and C++, |
30 | | // the types are left here for reference. |
31 | | // typedef enum VP8StatusCode VP8StatusCode; |
32 | | // typedef enum WEBP_CSP_MODE WEBP_CSP_MODE; |
33 | | typedef struct WebPRGBABuffer WebPRGBABuffer; |
34 | | typedef struct WebPYUVABuffer WebPYUVABuffer; |
35 | | typedef struct WebPDecBuffer WebPDecBuffer; |
36 | | typedef struct WebPIDecoder WebPIDecoder; |
37 | | typedef struct WebPBitstreamFeatures WebPBitstreamFeatures; |
38 | | typedef struct WebPDecoderOptions WebPDecoderOptions; |
39 | | typedef struct WebPDecoderConfig WebPDecoderConfig; |
40 | | |
41 | | // Return the decoder's version number, packed in hexadecimal using 8bits for |
42 | | // each of major/minor/revision. E.g: v2.5.7 is 0x020507. |
43 | | WEBP_EXTERN int WebPGetDecoderVersion(void); |
44 | | |
45 | | // Retrieve basic header information: width, height. |
46 | | // This function will also validate the header, returning true on success, |
47 | | // false otherwise. '*width' and '*height' are only valid on successful return. |
48 | | // Pointers 'width' and 'height' can be passed NULL if deemed irrelevant. |
49 | | // Note: The following chunk sequences (before the raw VP8/VP8L data) are |
50 | | // considered valid by this function: |
51 | | // RIFF + VP8(L) |
52 | | // RIFF + VP8X + (optional chunks) + VP8(L) |
53 | | // ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose. |
54 | | // VP8(L) <-- Not a valid WebP format: only allowed for internal purpose. |
55 | | WEBP_NODISCARD WEBP_EXTERN int WebPGetInfo( |
56 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
57 | | int* width, int* height); |
58 | | |
59 | | // Decodes WebP images pointed to by 'data' and returns RGBA samples, along |
60 | | // with the dimensions in *width and *height. The ordering of samples in |
61 | | // memory is R, G, B, A, R, G, B, A... in scan order (endian-independent). |
62 | | // The returned pointer should be deleted calling WebPFree(). |
63 | | // Returns NULL in case of error. |
64 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBA( |
65 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
66 | | int* width, int* height); |
67 | | |
68 | | // Same as WebPDecodeRGBA, but returning A, R, G, B, A, R, G, B... ordered data. |
69 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeARGB( |
70 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
71 | | int* width, int* height); |
72 | | |
73 | | // Same as WebPDecodeRGBA, but returning B, G, R, A, B, G, R, A... ordered data. |
74 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRA( |
75 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
76 | | int* width, int* height); |
77 | | |
78 | | // Same as WebPDecodeRGBA, but returning R, G, B, R, G, B... ordered data. |
79 | | // If the bitstream contains transparency, it is ignored. |
80 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGB( |
81 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
82 | | int* width, int* height); |
83 | | |
84 | | // Same as WebPDecodeRGB, but returning B, G, R, B, G, R... ordered data. |
85 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGR( |
86 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
87 | | int* width, int* height); |
88 | | |
89 | | // Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer |
90 | | // returned is the Y samples buffer. Upon return, *u and *v will point to |
91 | | // the U and V chroma data. These U and V buffers need NOT be passed to |
92 | | // WebPFree(), unlike the returned Y luma one. The dimension of the U and V |
93 | | // planes are both (*width + 1) / 2 and (*height + 1) / 2. |
94 | | // Upon return, the Y buffer has a stride returned as '*stride', while U and V |
95 | | // have a common stride returned as '*uv_stride'. |
96 | | // 'width' and 'height' may be NULL, the other pointers must not be. |
97 | | // Returns NULL in case of error. |
98 | | // (*) Also named Y'CbCr. See: https://en.wikipedia.org/wiki/YCbCr |
99 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeYUV( |
100 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
101 | | int* width, int* height, uint8_t** u, uint8_t** v, int* stride, |
102 | | int* uv_stride); |
103 | | |
104 | | // These five functions are variants of the above ones, that decode the image |
105 | | // directly into a pre-allocated buffer 'output_buffer'. The maximum storage |
106 | | // available in this buffer is indicated by 'output_buffer_size'. If this |
107 | | // storage is not sufficient (or an error occurred), NULL is returned. |
108 | | // Otherwise, output_buffer is returned, for convenience. |
109 | | // The parameter 'output_stride' specifies the distance (in bytes) |
110 | | // between scanlines. Hence, output_buffer_size is expected to be at least |
111 | | // output_stride x picture-height. A negative stride can be used to flip |
112 | | // the image vertically. In this case, the 'output_buffer' should point to |
113 | | // the start of the last row of the allocated buffer, and 'output_buffer_size' |
114 | | // should be at least abs(output_stride) x picture-height. |
115 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBAInto( |
116 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
117 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
118 | | size_t output_buffer_size, int output_stride); |
119 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeARGBInto( |
120 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
121 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
122 | | size_t output_buffer_size, int output_stride); |
123 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRAInto( |
124 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
125 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
126 | | size_t output_buffer_size, int output_stride); |
127 | | |
128 | | // RGB and BGR variants. Here too the transparency information, if present, |
129 | | // will be dropped and ignored. |
130 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeRGBInto( |
131 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
132 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
133 | | size_t output_buffer_size, int output_stride); |
134 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeBGRInto( |
135 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
136 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
137 | | size_t output_buffer_size, int output_stride); |
138 | | |
139 | | // WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly |
140 | | // into pre-allocated luma/chroma plane buffers. This function requires the |
141 | | // strides to be passed: one for the luma plane and one for each of the |
142 | | // chroma ones. The size of each plane buffer is passed as 'luma_size', |
143 | | // 'u_size' and 'v_size' respectively. |
144 | | // Pointer to the luma plane ('*luma') is returned or NULL if an error occurred |
145 | | // during decoding (or because some buffers were found to be too small). |
146 | | // Strides can be negative to flip the planes vertically. In this case, the |
147 | | // pointers ('luma', 'u', 'v') should point to the start of the last row of |
148 | | // the respective buffers. The sizes should be at least abs(luma_stride) x |
149 | | // height for the luma plane, and abs(u_stride) x ((height + 1) / 2) and |
150 | | // abs(v_stride) x ((height + 1) / 2) for the chroma planes. |
151 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPDecodeYUVInto( |
152 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
153 | | uint8_t* WEBP_COUNTED_BY(luma_size) luma, size_t luma_size, int luma_stride, |
154 | | uint8_t* WEBP_COUNTED_BY(u_size) u, size_t u_size, int u_stride, |
155 | | uint8_t* WEBP_COUNTED_BY(v_size) v, size_t v_size, int v_stride); |
156 | | |
157 | | //------------------------------------------------------------------------------ |
158 | | // Output colorspaces and buffer |
159 | | |
160 | | // Colorspaces |
161 | | // Note: the naming describes the byte-ordering of packed samples in memory. |
162 | | // For instance, MODE_BGRA relates to samples ordered as B,G,R,A,B,G,R,A,... |
163 | | // Non-capital names (e.g.:MODE_Argb) relates to pre-multiplied RGB channels. |
164 | | // RGBA-4444 and RGB-565 colorspaces are represented by following byte-order: |
165 | | // RGBA-4444: [r3 r2 r1 r0 g3 g2 g1 g0], [b3 b2 b1 b0 a3 a2 a1 a0], ... |
166 | | // RGB-565: [r4 r3 r2 r1 r0 g5 g4 g3], [g2 g1 g0 b4 b3 b2 b1 b0], ... |
167 | | // In the case WEBP_SWAP_16BITS_CSP is defined, the bytes are swapped for |
168 | | // these two modes: |
169 | | // RGBA-4444: [b3 b2 b1 b0 a3 a2 a1 a0], [r3 r2 r1 r0 g3 g2 g1 g0], ... |
170 | | // RGB-565: [g2 g1 g0 b4 b3 b2 b1 b0], [r4 r3 r2 r1 r0 g5 g4 g3], ... |
171 | | |
172 | | typedef enum WEBP_CSP_MODE { |
173 | | MODE_RGB = 0, |
174 | | MODE_RGBA = 1, |
175 | | MODE_BGR = 2, |
176 | | MODE_BGRA = 3, |
177 | | MODE_ARGB = 4, |
178 | | MODE_RGBA_4444 = 5, |
179 | | MODE_RGB_565 = 6, |
180 | | // RGB-premultiplied transparent modes (alpha value is preserved) |
181 | | MODE_rgbA = 7, |
182 | | MODE_bgrA = 8, |
183 | | MODE_Argb = 9, |
184 | | MODE_rgbA_4444 = 10, |
185 | | // YUV modes must come after RGB ones. |
186 | | MODE_YUV = 11, |
187 | | MODE_YUVA = 12, // yuv 4:2:0 |
188 | | MODE_LAST = 13 |
189 | | } WEBP_CSP_MODE; |
190 | | |
191 | | // Some useful macros: |
192 | 4.12k | static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { |
193 | 4.12k | return (mode == MODE_rgbA || mode == MODE_bgrA || mode == MODE_Argb || |
194 | 4.12k | mode == MODE_rgbA_4444); |
195 | 4.12k | } Unexecuted instantiation: buffer_dec.c:WebPIsPremultipliedMode Unexecuted instantiation: webp_dec.c:WebPIsPremultipliedMode vp8l_dec.c:WebPIsPremultipliedMode Line | Count | Source | 192 | 2.59k | static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { | 193 | 2.59k | return (mode == MODE_rgbA || mode == MODE_bgrA || mode == MODE_Argb || | 194 | 2.59k | mode == MODE_rgbA_4444); | 195 | 2.59k | } |
Unexecuted instantiation: vp8_dec.c:WebPIsPremultipliedMode Unexecuted instantiation: alpha_dec.c:WebPIsPremultipliedMode io_dec.c:WebPIsPremultipliedMode Line | Count | Source | 192 | 1.53k | static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { | 193 | 1.53k | return (mode == MODE_rgbA || mode == MODE_bgrA || mode == MODE_Argb || | 194 | 1.53k | mode == MODE_rgbA_4444); | 195 | 1.53k | } |
Unexecuted instantiation: tree_dec.c:WebPIsPremultipliedMode Unexecuted instantiation: quant_dec.c:WebPIsPremultipliedMode Unexecuted instantiation: frame_dec.c:WebPIsPremultipliedMode Unexecuted instantiation: alpha_processing.c:WebPIsPremultipliedMode Unexecuted instantiation: dec.c:WebPIsPremultipliedMode Unexecuted instantiation: dec_clip_tables.c:WebPIsPremultipliedMode Unexecuted instantiation: filters.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless.c:WebPIsPremultipliedMode Unexecuted instantiation: rescaler.c:WebPIsPremultipliedMode Unexecuted instantiation: upsampling.c:WebPIsPremultipliedMode Unexecuted instantiation: yuv.c:WebPIsPremultipliedMode Unexecuted instantiation: alpha_processing_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: dec_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: filters_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: rescaler_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: upsampling_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: yuv_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: alpha_processing_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: dec_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: upsampling_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: yuv_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: picture_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: picture_csp_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: webp_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: picture_tools_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: vp8l_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless_enc_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: lossless_enc_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: backward_references_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: histogram_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: backward_references_cost_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: picture_rescale_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: predictor_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: analysis_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: iterator_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: quant_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: filter_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: ssim.c:WebPIsPremultipliedMode Unexecuted instantiation: ssim_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: enc.c:WebPIsPremultipliedMode Unexecuted instantiation: enc_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: enc_sse41.c:WebPIsPremultipliedMode Unexecuted instantiation: cost_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: cost.c:WebPIsPremultipliedMode Unexecuted instantiation: cost_sse2.c:WebPIsPremultipliedMode Unexecuted instantiation: alpha_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: frame_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: syntax_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: tree_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: token_enc.c:WebPIsPremultipliedMode Unexecuted instantiation: bit_reader_utils.c:WebPIsPremultipliedMode Unexecuted instantiation: bit_writer_utils.c:WebPIsPremultipliedMode Unexecuted instantiation: color_cache_utils.c:WebPIsPremultipliedMode Unexecuted instantiation: filters_utils.c:WebPIsPremultipliedMode Unexecuted instantiation: palette.c:WebPIsPremultipliedMode Unexecuted instantiation: rescaler_utils.c:WebPIsPremultipliedMode Unexecuted instantiation: anim_encode.c:WebPIsPremultipliedMode Unexecuted instantiation: muxedit.c:WebPIsPremultipliedMode Unexecuted instantiation: muxinternal.c:WebPIsPremultipliedMode Unexecuted instantiation: muxread.c:WebPIsPremultipliedMode Unexecuted instantiation: demux.c:WebPIsPremultipliedMode |
196 | | |
197 | 876 | static WEBP_INLINE int WebPIsAlphaMode(WEBP_CSP_MODE mode) { |
198 | 876 | return (mode == MODE_RGBA || mode == MODE_BGRA || mode == MODE_ARGB || |
199 | 0 | mode == MODE_RGBA_4444 || mode == MODE_YUVA || |
200 | 0 | WebPIsPremultipliedMode(mode)); |
201 | 876 | } Unexecuted instantiation: buffer_dec.c:WebPIsAlphaMode Unexecuted instantiation: webp_dec.c:WebPIsAlphaMode Unexecuted instantiation: vp8l_dec.c:WebPIsAlphaMode Unexecuted instantiation: vp8_dec.c:WebPIsAlphaMode Unexecuted instantiation: alpha_dec.c:WebPIsAlphaMode Line | Count | Source | 197 | 876 | static WEBP_INLINE int WebPIsAlphaMode(WEBP_CSP_MODE mode) { | 198 | 876 | return (mode == MODE_RGBA || mode == MODE_BGRA || mode == MODE_ARGB || | 199 | 0 | mode == MODE_RGBA_4444 || mode == MODE_YUVA || | 200 | 0 | WebPIsPremultipliedMode(mode)); | 201 | 876 | } |
Unexecuted instantiation: tree_dec.c:WebPIsAlphaMode Unexecuted instantiation: quant_dec.c:WebPIsAlphaMode Unexecuted instantiation: frame_dec.c:WebPIsAlphaMode Unexecuted instantiation: alpha_processing.c:WebPIsAlphaMode Unexecuted instantiation: dec.c:WebPIsAlphaMode Unexecuted instantiation: dec_clip_tables.c:WebPIsAlphaMode Unexecuted instantiation: filters.c:WebPIsAlphaMode Unexecuted instantiation: lossless.c:WebPIsAlphaMode Unexecuted instantiation: rescaler.c:WebPIsAlphaMode Unexecuted instantiation: upsampling.c:WebPIsAlphaMode Unexecuted instantiation: yuv.c:WebPIsAlphaMode Unexecuted instantiation: alpha_processing_sse2.c:WebPIsAlphaMode Unexecuted instantiation: dec_sse2.c:WebPIsAlphaMode Unexecuted instantiation: filters_sse2.c:WebPIsAlphaMode Unexecuted instantiation: lossless_sse2.c:WebPIsAlphaMode Unexecuted instantiation: rescaler_sse2.c:WebPIsAlphaMode Unexecuted instantiation: upsampling_sse2.c:WebPIsAlphaMode Unexecuted instantiation: yuv_sse2.c:WebPIsAlphaMode Unexecuted instantiation: alpha_processing_sse41.c:WebPIsAlphaMode Unexecuted instantiation: dec_sse41.c:WebPIsAlphaMode Unexecuted instantiation: lossless_sse41.c:WebPIsAlphaMode Unexecuted instantiation: upsampling_sse41.c:WebPIsAlphaMode Unexecuted instantiation: yuv_sse41.c:WebPIsAlphaMode Unexecuted instantiation: picture_enc.c:WebPIsAlphaMode Unexecuted instantiation: picture_csp_enc.c:WebPIsAlphaMode Unexecuted instantiation: webp_enc.c:WebPIsAlphaMode Unexecuted instantiation: picture_tools_enc.c:WebPIsAlphaMode Unexecuted instantiation: vp8l_enc.c:WebPIsAlphaMode Unexecuted instantiation: lossless_enc.c:WebPIsAlphaMode Unexecuted instantiation: lossless_enc_sse2.c:WebPIsAlphaMode Unexecuted instantiation: lossless_enc_sse41.c:WebPIsAlphaMode Unexecuted instantiation: backward_references_enc.c:WebPIsAlphaMode Unexecuted instantiation: histogram_enc.c:WebPIsAlphaMode Unexecuted instantiation: backward_references_cost_enc.c:WebPIsAlphaMode Unexecuted instantiation: picture_rescale_enc.c:WebPIsAlphaMode Unexecuted instantiation: predictor_enc.c:WebPIsAlphaMode Unexecuted instantiation: analysis_enc.c:WebPIsAlphaMode Unexecuted instantiation: iterator_enc.c:WebPIsAlphaMode Unexecuted instantiation: quant_enc.c:WebPIsAlphaMode Unexecuted instantiation: filter_enc.c:WebPIsAlphaMode Unexecuted instantiation: ssim.c:WebPIsAlphaMode Unexecuted instantiation: ssim_sse2.c:WebPIsAlphaMode Unexecuted instantiation: enc.c:WebPIsAlphaMode Unexecuted instantiation: enc_sse2.c:WebPIsAlphaMode Unexecuted instantiation: enc_sse41.c:WebPIsAlphaMode Unexecuted instantiation: cost_enc.c:WebPIsAlphaMode Unexecuted instantiation: cost.c:WebPIsAlphaMode Unexecuted instantiation: cost_sse2.c:WebPIsAlphaMode Unexecuted instantiation: alpha_enc.c:WebPIsAlphaMode Unexecuted instantiation: frame_enc.c:WebPIsAlphaMode Unexecuted instantiation: syntax_enc.c:WebPIsAlphaMode Unexecuted instantiation: tree_enc.c:WebPIsAlphaMode Unexecuted instantiation: token_enc.c:WebPIsAlphaMode Unexecuted instantiation: bit_reader_utils.c:WebPIsAlphaMode Unexecuted instantiation: bit_writer_utils.c:WebPIsAlphaMode Unexecuted instantiation: color_cache_utils.c:WebPIsAlphaMode Unexecuted instantiation: filters_utils.c:WebPIsAlphaMode Unexecuted instantiation: palette.c:WebPIsAlphaMode Unexecuted instantiation: rescaler_utils.c:WebPIsAlphaMode Unexecuted instantiation: anim_encode.c:WebPIsAlphaMode Unexecuted instantiation: muxedit.c:WebPIsAlphaMode Unexecuted instantiation: muxinternal.c:WebPIsAlphaMode Unexecuted instantiation: muxread.c:WebPIsAlphaMode Unexecuted instantiation: demux.c:WebPIsAlphaMode |
202 | | |
203 | 1.51M | static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { |
204 | 1.51M | return (mode < MODE_YUV); |
205 | 1.51M | } buffer_dec.c:WebPIsRGBMode Line | Count | Source | 203 | 10.4k | static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { | 204 | 10.4k | return (mode < MODE_YUV); | 205 | 10.4k | } |
Unexecuted instantiation: webp_dec.c:WebPIsRGBMode Line | Count | Source | 203 | 1.50M | static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { | 204 | 1.50M | return (mode < MODE_YUV); | 205 | 1.50M | } |
Unexecuted instantiation: vp8_dec.c:WebPIsRGBMode Unexecuted instantiation: alpha_dec.c:WebPIsRGBMode Line | Count | Source | 203 | 876 | static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { | 204 | 876 | return (mode < MODE_YUV); | 205 | 876 | } |
Unexecuted instantiation: tree_dec.c:WebPIsRGBMode Unexecuted instantiation: quant_dec.c:WebPIsRGBMode Unexecuted instantiation: frame_dec.c:WebPIsRGBMode Unexecuted instantiation: alpha_processing.c:WebPIsRGBMode Unexecuted instantiation: dec.c:WebPIsRGBMode Unexecuted instantiation: dec_clip_tables.c:WebPIsRGBMode Unexecuted instantiation: filters.c:WebPIsRGBMode Unexecuted instantiation: lossless.c:WebPIsRGBMode Unexecuted instantiation: rescaler.c:WebPIsRGBMode Unexecuted instantiation: upsampling.c:WebPIsRGBMode Unexecuted instantiation: yuv.c:WebPIsRGBMode Unexecuted instantiation: alpha_processing_sse2.c:WebPIsRGBMode Unexecuted instantiation: dec_sse2.c:WebPIsRGBMode Unexecuted instantiation: filters_sse2.c:WebPIsRGBMode Unexecuted instantiation: lossless_sse2.c:WebPIsRGBMode Unexecuted instantiation: rescaler_sse2.c:WebPIsRGBMode Unexecuted instantiation: upsampling_sse2.c:WebPIsRGBMode Unexecuted instantiation: yuv_sse2.c:WebPIsRGBMode Unexecuted instantiation: alpha_processing_sse41.c:WebPIsRGBMode Unexecuted instantiation: dec_sse41.c:WebPIsRGBMode Unexecuted instantiation: lossless_sse41.c:WebPIsRGBMode Unexecuted instantiation: upsampling_sse41.c:WebPIsRGBMode Unexecuted instantiation: yuv_sse41.c:WebPIsRGBMode Unexecuted instantiation: picture_enc.c:WebPIsRGBMode Unexecuted instantiation: picture_csp_enc.c:WebPIsRGBMode Unexecuted instantiation: webp_enc.c:WebPIsRGBMode Unexecuted instantiation: picture_tools_enc.c:WebPIsRGBMode Unexecuted instantiation: vp8l_enc.c:WebPIsRGBMode Unexecuted instantiation: lossless_enc.c:WebPIsRGBMode Unexecuted instantiation: lossless_enc_sse2.c:WebPIsRGBMode Unexecuted instantiation: lossless_enc_sse41.c:WebPIsRGBMode Unexecuted instantiation: backward_references_enc.c:WebPIsRGBMode Unexecuted instantiation: histogram_enc.c:WebPIsRGBMode Unexecuted instantiation: backward_references_cost_enc.c:WebPIsRGBMode Unexecuted instantiation: picture_rescale_enc.c:WebPIsRGBMode Unexecuted instantiation: predictor_enc.c:WebPIsRGBMode Unexecuted instantiation: analysis_enc.c:WebPIsRGBMode Unexecuted instantiation: iterator_enc.c:WebPIsRGBMode Unexecuted instantiation: quant_enc.c:WebPIsRGBMode Unexecuted instantiation: filter_enc.c:WebPIsRGBMode Unexecuted instantiation: ssim.c:WebPIsRGBMode Unexecuted instantiation: ssim_sse2.c:WebPIsRGBMode Unexecuted instantiation: enc.c:WebPIsRGBMode Unexecuted instantiation: enc_sse2.c:WebPIsRGBMode Unexecuted instantiation: enc_sse41.c:WebPIsRGBMode Unexecuted instantiation: cost_enc.c:WebPIsRGBMode Unexecuted instantiation: cost.c:WebPIsRGBMode Unexecuted instantiation: cost_sse2.c:WebPIsRGBMode Unexecuted instantiation: alpha_enc.c:WebPIsRGBMode Unexecuted instantiation: frame_enc.c:WebPIsRGBMode Unexecuted instantiation: syntax_enc.c:WebPIsRGBMode Unexecuted instantiation: tree_enc.c:WebPIsRGBMode Unexecuted instantiation: token_enc.c:WebPIsRGBMode Unexecuted instantiation: bit_reader_utils.c:WebPIsRGBMode Unexecuted instantiation: bit_writer_utils.c:WebPIsRGBMode Unexecuted instantiation: color_cache_utils.c:WebPIsRGBMode Unexecuted instantiation: filters_utils.c:WebPIsRGBMode Unexecuted instantiation: palette.c:WebPIsRGBMode Unexecuted instantiation: rescaler_utils.c:WebPIsRGBMode Unexecuted instantiation: anim_encode.c:WebPIsRGBMode Unexecuted instantiation: muxedit.c:WebPIsRGBMode Unexecuted instantiation: muxinternal.c:WebPIsRGBMode Unexecuted instantiation: muxread.c:WebPIsRGBMode Unexecuted instantiation: demux.c:WebPIsRGBMode |
206 | | |
207 | | //------------------------------------------------------------------------------ |
208 | | // WebPDecBuffer: Generic structure for describing the output sample buffer. |
209 | | |
210 | | struct WebPRGBABuffer { // view as RGBA |
211 | | uint8_t* rgba; // pointer to RGBA samples |
212 | | int stride; // stride in bytes from one scanline to the next. |
213 | | size_t size; // total size of the *rgba buffer. |
214 | | }; |
215 | | |
216 | | struct WebPYUVABuffer { // view as YUVA |
217 | | uint8_t *y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples |
218 | | int y_stride; // luma stride |
219 | | int u_stride, v_stride; // chroma strides |
220 | | int a_stride; // alpha stride |
221 | | size_t y_size; // luma plane size |
222 | | size_t u_size, v_size; // chroma planes size |
223 | | size_t a_size; // alpha-plane size |
224 | | }; |
225 | | |
226 | | // Output buffer |
227 | | struct WebPDecBuffer { |
228 | | WEBP_CSP_MODE colorspace; // Colorspace. |
229 | | int width, height; // Dimensions. |
230 | | int is_external_memory; // If non-zero, 'internal_memory' pointer is not |
231 | | // used. If value is '2' or more, the external |
232 | | // memory is considered 'slow' and multiple |
233 | | // read/write will be avoided. |
234 | | union { |
235 | | WebPRGBABuffer RGBA; |
236 | | WebPYUVABuffer YUVA; |
237 | | } u; // Nameless union of buffer parameters. |
238 | | uint32_t pad[4]; // padding for later use |
239 | | |
240 | | uint8_t* private_memory; // Internally allocated memory (only when |
241 | | // is_external_memory is 0). Should not be used |
242 | | // externally, but accessed via the buffer union. |
243 | | }; |
244 | | |
245 | | // Internal, version-checked, entry point |
246 | | WEBP_NODISCARD WEBP_EXTERN int WebPInitDecBufferInternal(WebPDecBuffer*, int); |
247 | | |
248 | | // Initialize the structure as empty. Must be called before any other use. |
249 | | // Returns false in case of version mismatch |
250 | 5.68k | WEBP_NODISCARD static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) { |
251 | 5.68k | return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION); |
252 | 5.68k | } Unexecuted instantiation: buffer_dec.c:WebPInitDecBuffer webp_dec.c:WebPInitDecBuffer Line | Count | Source | 250 | 5.68k | WEBP_NODISCARD static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) { | 251 | 5.68k | return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION); | 252 | 5.68k | } |
Unexecuted instantiation: vp8l_dec.c:WebPInitDecBuffer Unexecuted instantiation: vp8_dec.c:WebPInitDecBuffer Unexecuted instantiation: alpha_dec.c:WebPInitDecBuffer Unexecuted instantiation: io_dec.c:WebPInitDecBuffer Unexecuted instantiation: tree_dec.c:WebPInitDecBuffer Unexecuted instantiation: quant_dec.c:WebPInitDecBuffer Unexecuted instantiation: frame_dec.c:WebPInitDecBuffer Unexecuted instantiation: alpha_processing.c:WebPInitDecBuffer Unexecuted instantiation: dec.c:WebPInitDecBuffer Unexecuted instantiation: dec_clip_tables.c:WebPInitDecBuffer Unexecuted instantiation: filters.c:WebPInitDecBuffer Unexecuted instantiation: lossless.c:WebPInitDecBuffer Unexecuted instantiation: rescaler.c:WebPInitDecBuffer Unexecuted instantiation: upsampling.c:WebPInitDecBuffer Unexecuted instantiation: yuv.c:WebPInitDecBuffer Unexecuted instantiation: alpha_processing_sse2.c:WebPInitDecBuffer Unexecuted instantiation: dec_sse2.c:WebPInitDecBuffer Unexecuted instantiation: filters_sse2.c:WebPInitDecBuffer Unexecuted instantiation: lossless_sse2.c:WebPInitDecBuffer Unexecuted instantiation: rescaler_sse2.c:WebPInitDecBuffer Unexecuted instantiation: upsampling_sse2.c:WebPInitDecBuffer Unexecuted instantiation: yuv_sse2.c:WebPInitDecBuffer Unexecuted instantiation: alpha_processing_sse41.c:WebPInitDecBuffer Unexecuted instantiation: dec_sse41.c:WebPInitDecBuffer Unexecuted instantiation: lossless_sse41.c:WebPInitDecBuffer Unexecuted instantiation: upsampling_sse41.c:WebPInitDecBuffer Unexecuted instantiation: yuv_sse41.c:WebPInitDecBuffer Unexecuted instantiation: picture_enc.c:WebPInitDecBuffer Unexecuted instantiation: picture_csp_enc.c:WebPInitDecBuffer Unexecuted instantiation: webp_enc.c:WebPInitDecBuffer Unexecuted instantiation: picture_tools_enc.c:WebPInitDecBuffer Unexecuted instantiation: vp8l_enc.c:WebPInitDecBuffer Unexecuted instantiation: lossless_enc.c:WebPInitDecBuffer Unexecuted instantiation: lossless_enc_sse2.c:WebPInitDecBuffer Unexecuted instantiation: lossless_enc_sse41.c:WebPInitDecBuffer Unexecuted instantiation: backward_references_enc.c:WebPInitDecBuffer Unexecuted instantiation: histogram_enc.c:WebPInitDecBuffer Unexecuted instantiation: backward_references_cost_enc.c:WebPInitDecBuffer Unexecuted instantiation: picture_rescale_enc.c:WebPInitDecBuffer Unexecuted instantiation: predictor_enc.c:WebPInitDecBuffer Unexecuted instantiation: analysis_enc.c:WebPInitDecBuffer Unexecuted instantiation: iterator_enc.c:WebPInitDecBuffer Unexecuted instantiation: quant_enc.c:WebPInitDecBuffer Unexecuted instantiation: filter_enc.c:WebPInitDecBuffer Unexecuted instantiation: ssim.c:WebPInitDecBuffer Unexecuted instantiation: ssim_sse2.c:WebPInitDecBuffer Unexecuted instantiation: enc.c:WebPInitDecBuffer Unexecuted instantiation: enc_sse2.c:WebPInitDecBuffer Unexecuted instantiation: enc_sse41.c:WebPInitDecBuffer Unexecuted instantiation: cost_enc.c:WebPInitDecBuffer Unexecuted instantiation: cost.c:WebPInitDecBuffer Unexecuted instantiation: cost_sse2.c:WebPInitDecBuffer Unexecuted instantiation: alpha_enc.c:WebPInitDecBuffer Unexecuted instantiation: frame_enc.c:WebPInitDecBuffer Unexecuted instantiation: syntax_enc.c:WebPInitDecBuffer Unexecuted instantiation: tree_enc.c:WebPInitDecBuffer Unexecuted instantiation: token_enc.c:WebPInitDecBuffer Unexecuted instantiation: bit_reader_utils.c:WebPInitDecBuffer Unexecuted instantiation: bit_writer_utils.c:WebPInitDecBuffer Unexecuted instantiation: color_cache_utils.c:WebPInitDecBuffer Unexecuted instantiation: filters_utils.c:WebPInitDecBuffer Unexecuted instantiation: palette.c:WebPInitDecBuffer Unexecuted instantiation: rescaler_utils.c:WebPInitDecBuffer Unexecuted instantiation: anim_encode.c:WebPInitDecBuffer Unexecuted instantiation: muxedit.c:WebPInitDecBuffer Unexecuted instantiation: muxinternal.c:WebPInitDecBuffer Unexecuted instantiation: muxread.c:WebPInitDecBuffer Unexecuted instantiation: demux.c:WebPInitDecBuffer |
253 | | |
254 | | // Free any memory associated with the buffer. Must always be called last. |
255 | | // Note: doesn't free the 'buffer' structure itself. |
256 | | WEBP_EXTERN void WebPFreeDecBuffer(WebPDecBuffer* buffer); |
257 | | |
258 | | //------------------------------------------------------------------------------ |
259 | | // Enumeration of the status codes |
260 | | |
261 | | typedef enum WEBP_NODISCARD VP8StatusCode { |
262 | | VP8_STATUS_OK = 0, |
263 | | VP8_STATUS_OUT_OF_MEMORY, |
264 | | VP8_STATUS_INVALID_PARAM, |
265 | | VP8_STATUS_BITSTREAM_ERROR, |
266 | | VP8_STATUS_UNSUPPORTED_FEATURE, |
267 | | VP8_STATUS_SUSPENDED, |
268 | | VP8_STATUS_USER_ABORT, |
269 | | VP8_STATUS_NOT_ENOUGH_DATA |
270 | | } VP8StatusCode; |
271 | | |
272 | | //------------------------------------------------------------------------------ |
273 | | // Incremental decoding |
274 | | // |
275 | | // This API allows streamlined decoding of partial data. |
276 | | // Picture can be incrementally decoded as data become available thanks to the |
277 | | // WebPIDecoder object. This object can be left in a SUSPENDED state if the |
278 | | // picture is only partially decoded, pending additional input. |
279 | | // Code example: |
280 | | /* |
281 | | WebPInitDecBuffer(&output_buffer); |
282 | | output_buffer.colorspace = mode; |
283 | | ... |
284 | | WebPIDecoder* idec = WebPINewDecoder(&output_buffer); |
285 | | while (additional_data_is_available) { |
286 | | // ... (get additional data in some new_data[] buffer) |
287 | | status = WebPIAppend(idec, new_data, new_data_size); |
288 | | if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) { |
289 | | break; // an error occurred. |
290 | | } |
291 | | |
292 | | // The above call decodes the current available buffer. |
293 | | // Part of the image can now be refreshed by calling |
294 | | // WebPIDecGetRGB()/WebPIDecGetYUVA() etc. |
295 | | } |
296 | | WebPIDelete(idec); |
297 | | */ |
298 | | |
299 | | // Creates a new incremental decoder with the supplied buffer parameter. |
300 | | // This output_buffer can be passed NULL, in which case a default output buffer |
301 | | // is used (with MODE_RGB). Otherwise, an internal reference to 'output_buffer' |
302 | | // is kept, which means that the lifespan of 'output_buffer' must be larger than |
303 | | // that of the returned WebPIDecoder object. |
304 | | // The supplied 'output_buffer' content MUST NOT be changed between calls to |
305 | | // WebPIAppend() or WebPIUpdate() unless 'output_buffer.is_external_memory' is |
306 | | // not set to 0. In such a case, it is allowed to modify the pointers, size and |
307 | | // stride of output_buffer.u.RGBA or output_buffer.u.YUVA, provided they remain |
308 | | // within valid bounds. |
309 | | // All other fields of WebPDecBuffer MUST remain constant between calls. |
310 | | // Returns NULL if the allocation failed. |
311 | | WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewDecoder( |
312 | | WebPDecBuffer* output_buffer); |
313 | | |
314 | | // This function allocates and initializes an incremental-decoder object, which |
315 | | // will output the RGB/A samples specified by 'csp' into a preallocated |
316 | | // buffer 'output_buffer'. The size of this buffer is at least |
317 | | // 'output_buffer_size' and the stride (distance in bytes between two scanlines) |
318 | | // is specified by 'output_stride'. |
319 | | // Additionally, output_buffer can be passed NULL in which case the output |
320 | | // buffer will be allocated automatically when the decoding starts. The |
321 | | // colorspace 'csp' is taken into account for allocating this buffer. All other |
322 | | // parameters are ignored. |
323 | | // Returns NULL if the allocation failed, or if some parameters are invalid. |
324 | | WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewRGB( |
325 | | WEBP_CSP_MODE csp, |
326 | | uint8_t* WEBP_COUNTED_BY(output_buffer_size) output_buffer, |
327 | | size_t output_buffer_size, int output_stride); |
328 | | |
329 | | // This function allocates and initializes an incremental-decoder object, which |
330 | | // will output the raw luma/chroma samples into a preallocated planes if |
331 | | // supplied. The luma plane is specified by its pointer 'luma', its size |
332 | | // 'luma_size' and its stride 'luma_stride'. Similarly, the chroma-u plane |
333 | | // is specified by the 'u', 'u_size' and 'u_stride' parameters, and the chroma-v |
334 | | // plane by 'v' and 'v_size'. And same for the alpha-plane. The 'a' pointer |
335 | | // can be pass NULL in case one is not interested in the transparency plane. |
336 | | // Conversely, 'luma' can be passed NULL if no preallocated planes are supplied. |
337 | | // In this case, the output buffer will be automatically allocated (using |
338 | | // MODE_YUVA) when decoding starts. All parameters are then ignored. |
339 | | // Returns NULL if the allocation failed or if a parameter is invalid. |
340 | | WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewYUVA( |
341 | | uint8_t* WEBP_COUNTED_BY(luma_size) luma, size_t luma_size, int luma_stride, |
342 | | uint8_t* WEBP_COUNTED_BY(u_size) u, size_t u_size, int u_stride, |
343 | | uint8_t* WEBP_COUNTED_BY(v_size) v, size_t v_size, int v_stride, |
344 | | uint8_t* WEBP_COUNTED_BY(a_size) a, size_t a_size, int a_stride); |
345 | | |
346 | | // Deprecated version of the above, without the alpha plane. |
347 | | // Kept for backward compatibility. |
348 | | WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPINewYUV( |
349 | | uint8_t* WEBP_COUNTED_BY(luma_size) luma, size_t luma_size, int luma_stride, |
350 | | uint8_t* WEBP_COUNTED_BY(u_size) u, size_t u_size, int u_stride, |
351 | | uint8_t* WEBP_COUNTED_BY(v_size) v, size_t v_size, int v_stride); |
352 | | |
353 | | // Deletes the WebPIDecoder object and associated memory. Must always be called |
354 | | // if WebPINewDecoder, WebPINewRGB or WebPINewYUV succeeded. |
355 | | WEBP_EXTERN void WebPIDelete(WebPIDecoder* idec); |
356 | | |
357 | | // Copies and decodes the next available data. Returns VP8_STATUS_OK when |
358 | | // the image is successfully decoded. Returns VP8_STATUS_SUSPENDED when more |
359 | | // data is expected. Returns error in other cases. |
360 | | WEBP_EXTERN VP8StatusCode WebPIAppend(WebPIDecoder* idec, |
361 | | const uint8_t* WEBP_COUNTED_BY(data_size) |
362 | | data, |
363 | | size_t data_size); |
364 | | |
365 | | // A variant of the above function to be used when data buffer contains |
366 | | // partial data from the beginning. In this case data buffer is not copied |
367 | | // to the internal memory. |
368 | | // Note that the value of the 'data' pointer can change between calls to |
369 | | // WebPIUpdate, for instance when the data buffer is resized to fit larger data. |
370 | | WEBP_EXTERN VP8StatusCode WebPIUpdate(WebPIDecoder* idec, |
371 | | const uint8_t* WEBP_COUNTED_BY(data_size) |
372 | | data, |
373 | | size_t data_size); |
374 | | |
375 | | // Returns the RGB/A image decoded so far. Returns NULL if output params |
376 | | // are not initialized yet. The RGB/A output type corresponds to the colorspace |
377 | | // specified during call to WebPINewDecoder() or WebPINewRGB(). |
378 | | // *last_y is the index of last decoded row in raster scan order. Some pointers |
379 | | // (*last_y, *width etc.) can be NULL if corresponding information is not |
380 | | // needed. The values in these pointers are only valid on successful (non-NULL) |
381 | | // return. |
382 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPIDecGetRGB(const WebPIDecoder* idec, |
383 | | int* last_y, int* width, |
384 | | int* height, int* stride); |
385 | | |
386 | | // Same as above function to get a YUVA image. Returns pointer to the luma |
387 | | // plane or NULL in case of error. If there is no alpha information |
388 | | // the alpha pointer '*a' will be returned NULL. |
389 | | WEBP_NODISCARD WEBP_EXTERN uint8_t* WebPIDecGetYUVA(const WebPIDecoder* idec, |
390 | | int* last_y, uint8_t** u, |
391 | | uint8_t** v, uint8_t** a, |
392 | | int* width, int* height, |
393 | | int* stride, int* uv_stride, |
394 | | int* a_stride); |
395 | | |
396 | | // Deprecated alpha-less version of WebPIDecGetYUVA(): it will ignore the |
397 | | // alpha information (if present). Kept for backward compatibility. |
398 | | WEBP_NODISCARD static WEBP_INLINE uint8_t* WebPIDecGetYUV( |
399 | | const WebPIDecoder* idec, int* last_y, uint8_t** u, uint8_t** v, int* width, |
400 | 0 | int* height, int* stride, int* uv_stride) { |
401 | 0 | return WebPIDecGetYUVA(idec, last_y, u, v, NULL, width, height, stride, |
402 | 0 | uv_stride, NULL); |
403 | 0 | } Unexecuted instantiation: buffer_dec.c:WebPIDecGetYUV Unexecuted instantiation: webp_dec.c:WebPIDecGetYUV Unexecuted instantiation: vp8l_dec.c:WebPIDecGetYUV Unexecuted instantiation: vp8_dec.c:WebPIDecGetYUV Unexecuted instantiation: alpha_dec.c:WebPIDecGetYUV Unexecuted instantiation: io_dec.c:WebPIDecGetYUV Unexecuted instantiation: tree_dec.c:WebPIDecGetYUV Unexecuted instantiation: quant_dec.c:WebPIDecGetYUV Unexecuted instantiation: frame_dec.c:WebPIDecGetYUV Unexecuted instantiation: alpha_processing.c:WebPIDecGetYUV Unexecuted instantiation: dec.c:WebPIDecGetYUV Unexecuted instantiation: dec_clip_tables.c:WebPIDecGetYUV Unexecuted instantiation: filters.c:WebPIDecGetYUV Unexecuted instantiation: lossless.c:WebPIDecGetYUV Unexecuted instantiation: rescaler.c:WebPIDecGetYUV Unexecuted instantiation: upsampling.c:WebPIDecGetYUV Unexecuted instantiation: yuv.c:WebPIDecGetYUV Unexecuted instantiation: alpha_processing_sse2.c:WebPIDecGetYUV Unexecuted instantiation: dec_sse2.c:WebPIDecGetYUV Unexecuted instantiation: filters_sse2.c:WebPIDecGetYUV Unexecuted instantiation: lossless_sse2.c:WebPIDecGetYUV Unexecuted instantiation: rescaler_sse2.c:WebPIDecGetYUV Unexecuted instantiation: upsampling_sse2.c:WebPIDecGetYUV Unexecuted instantiation: yuv_sse2.c:WebPIDecGetYUV Unexecuted instantiation: alpha_processing_sse41.c:WebPIDecGetYUV Unexecuted instantiation: dec_sse41.c:WebPIDecGetYUV Unexecuted instantiation: lossless_sse41.c:WebPIDecGetYUV Unexecuted instantiation: upsampling_sse41.c:WebPIDecGetYUV Unexecuted instantiation: yuv_sse41.c:WebPIDecGetYUV Unexecuted instantiation: picture_enc.c:WebPIDecGetYUV Unexecuted instantiation: picture_csp_enc.c:WebPIDecGetYUV Unexecuted instantiation: webp_enc.c:WebPIDecGetYUV Unexecuted instantiation: picture_tools_enc.c:WebPIDecGetYUV Unexecuted instantiation: vp8l_enc.c:WebPIDecGetYUV Unexecuted instantiation: lossless_enc.c:WebPIDecGetYUV Unexecuted instantiation: lossless_enc_sse2.c:WebPIDecGetYUV Unexecuted instantiation: lossless_enc_sse41.c:WebPIDecGetYUV Unexecuted instantiation: backward_references_enc.c:WebPIDecGetYUV Unexecuted instantiation: histogram_enc.c:WebPIDecGetYUV Unexecuted instantiation: backward_references_cost_enc.c:WebPIDecGetYUV Unexecuted instantiation: picture_rescale_enc.c:WebPIDecGetYUV Unexecuted instantiation: predictor_enc.c:WebPIDecGetYUV Unexecuted instantiation: analysis_enc.c:WebPIDecGetYUV Unexecuted instantiation: iterator_enc.c:WebPIDecGetYUV Unexecuted instantiation: quant_enc.c:WebPIDecGetYUV Unexecuted instantiation: filter_enc.c:WebPIDecGetYUV Unexecuted instantiation: ssim.c:WebPIDecGetYUV Unexecuted instantiation: ssim_sse2.c:WebPIDecGetYUV Unexecuted instantiation: enc.c:WebPIDecGetYUV Unexecuted instantiation: enc_sse2.c:WebPIDecGetYUV Unexecuted instantiation: enc_sse41.c:WebPIDecGetYUV Unexecuted instantiation: cost_enc.c:WebPIDecGetYUV Unexecuted instantiation: cost.c:WebPIDecGetYUV Unexecuted instantiation: cost_sse2.c:WebPIDecGetYUV Unexecuted instantiation: alpha_enc.c:WebPIDecGetYUV Unexecuted instantiation: frame_enc.c:WebPIDecGetYUV Unexecuted instantiation: syntax_enc.c:WebPIDecGetYUV Unexecuted instantiation: tree_enc.c:WebPIDecGetYUV Unexecuted instantiation: token_enc.c:WebPIDecGetYUV Unexecuted instantiation: bit_reader_utils.c:WebPIDecGetYUV Unexecuted instantiation: bit_writer_utils.c:WebPIDecGetYUV Unexecuted instantiation: color_cache_utils.c:WebPIDecGetYUV Unexecuted instantiation: filters_utils.c:WebPIDecGetYUV Unexecuted instantiation: palette.c:WebPIDecGetYUV Unexecuted instantiation: rescaler_utils.c:WebPIDecGetYUV Unexecuted instantiation: anim_encode.c:WebPIDecGetYUV Unexecuted instantiation: muxedit.c:WebPIDecGetYUV Unexecuted instantiation: muxinternal.c:WebPIDecGetYUV Unexecuted instantiation: muxread.c:WebPIDecGetYUV Unexecuted instantiation: demux.c:WebPIDecGetYUV |
404 | | |
405 | | // Generic call to retrieve information about the displayable area. |
406 | | // If non NULL, the left/right/width/height pointers are filled with the visible |
407 | | // rectangular area so far. |
408 | | // Returns NULL in case the incremental decoder object is in an invalid state. |
409 | | // Otherwise returns the pointer to the internal representation. This structure |
410 | | // is read-only, tied to WebPIDecoder's lifespan and should not be modified. |
411 | | WEBP_NODISCARD WEBP_EXTERN const WebPDecBuffer* WebPIDecodedArea( |
412 | | const WebPIDecoder* idec, int* left, int* top, int* width, int* height); |
413 | | |
414 | | //------------------------------------------------------------------------------ |
415 | | // Advanced decoding parametrization |
416 | | // |
417 | | // Code sample for using the advanced decoding API |
418 | | /* |
419 | | // A) Init a configuration object |
420 | | WebPDecoderConfig config; |
421 | | CHECK(WebPInitDecoderConfig(&config)); |
422 | | |
423 | | // B) optional: retrieve the bitstream's features. |
424 | | CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK); |
425 | | |
426 | | // C) Adjust 'config', if needed |
427 | | config.options.no_fancy_upsampling = 1; |
428 | | config.output.colorspace = MODE_BGRA; |
429 | | // etc. |
430 | | |
431 | | // Note that you can also make config.output point to an externally |
432 | | // supplied memory buffer, provided it's big enough to store the decoded |
433 | | // picture. Otherwise, config.output will just be used to allocate memory |
434 | | // and store the decoded picture. |
435 | | |
436 | | // D) Decode! |
437 | | CHECK(WebPDecode(data, data_size, &config) == VP8_STATUS_OK); |
438 | | |
439 | | // E) Decoded image is now in config.output (and config.output.u.RGBA) |
440 | | |
441 | | // F) Reclaim memory allocated in config's object. It's safe to call |
442 | | // this function even if the memory is external and wasn't allocated |
443 | | // by WebPDecode(). |
444 | | WebPFreeDecBuffer(&config.output); |
445 | | */ |
446 | | |
447 | | // Features gathered from the bitstream |
448 | | struct WebPBitstreamFeatures { |
449 | | int width; // Width in pixels, as read from the bitstream. |
450 | | int height; // Height in pixels, as read from the bitstream. |
451 | | int has_alpha; // True if the bitstream contains an alpha channel. |
452 | | int has_animation; // True if the bitstream is an animation. |
453 | | int format; // 0 = undefined (/mixed), 1 = lossy, 2 = lossless |
454 | | |
455 | | uint32_t pad[5]; // padding for later use |
456 | | }; |
457 | | |
458 | | // Internal, version-checked, entry point |
459 | | WEBP_EXTERN VP8StatusCode |
460 | | WebPGetFeaturesInternal(const uint8_t* WEBP_COUNTED_BY(data_size), |
461 | | size_t data_size, WebPBitstreamFeatures*, int); |
462 | | |
463 | | // Retrieve features from the bitstream. The *features structure is filled |
464 | | // with information gathered from the bitstream. |
465 | | // Returns VP8_STATUS_OK when the features are successfully retrieved. Returns |
466 | | // VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieve the |
467 | | // features from headers. Returns error in other cases. |
468 | | // Note: The following chunk sequences (before the raw VP8/VP8L data) are |
469 | | // considered valid by this function: |
470 | | // RIFF + VP8(L) |
471 | | // RIFF + VP8X + (optional chunks) + VP8(L) |
472 | | // ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose. |
473 | | // VP8(L) <-- Not a valid WebP format: only allowed for internal purpose. |
474 | | static WEBP_INLINE VP8StatusCode |
475 | | WebPGetFeatures(const uint8_t* WEBP_COUNTED_BY(data_size) data, |
476 | 2.62k | size_t data_size, WebPBitstreamFeatures* features) { |
477 | 2.62k | return WebPGetFeaturesInternal(data, data_size, features, |
478 | 2.62k | WEBP_DECODER_ABI_VERSION); |
479 | 2.62k | } Unexecuted instantiation: buffer_dec.c:WebPGetFeatures Unexecuted instantiation: webp_dec.c:WebPGetFeatures Unexecuted instantiation: vp8l_dec.c:WebPGetFeatures Unexecuted instantiation: vp8_dec.c:WebPGetFeatures Unexecuted instantiation: alpha_dec.c:WebPGetFeatures Unexecuted instantiation: io_dec.c:WebPGetFeatures Unexecuted instantiation: tree_dec.c:WebPGetFeatures Unexecuted instantiation: quant_dec.c:WebPGetFeatures Unexecuted instantiation: frame_dec.c:WebPGetFeatures Unexecuted instantiation: alpha_processing.c:WebPGetFeatures Unexecuted instantiation: dec.c:WebPGetFeatures Unexecuted instantiation: dec_clip_tables.c:WebPGetFeatures Unexecuted instantiation: filters.c:WebPGetFeatures Unexecuted instantiation: lossless.c:WebPGetFeatures Unexecuted instantiation: rescaler.c:WebPGetFeatures Unexecuted instantiation: upsampling.c:WebPGetFeatures Unexecuted instantiation: yuv.c:WebPGetFeatures Unexecuted instantiation: alpha_processing_sse2.c:WebPGetFeatures Unexecuted instantiation: dec_sse2.c:WebPGetFeatures Unexecuted instantiation: filters_sse2.c:WebPGetFeatures Unexecuted instantiation: lossless_sse2.c:WebPGetFeatures Unexecuted instantiation: rescaler_sse2.c:WebPGetFeatures Unexecuted instantiation: upsampling_sse2.c:WebPGetFeatures Unexecuted instantiation: yuv_sse2.c:WebPGetFeatures Unexecuted instantiation: alpha_processing_sse41.c:WebPGetFeatures Unexecuted instantiation: dec_sse41.c:WebPGetFeatures Unexecuted instantiation: lossless_sse41.c:WebPGetFeatures Unexecuted instantiation: upsampling_sse41.c:WebPGetFeatures Unexecuted instantiation: yuv_sse41.c:WebPGetFeatures Unexecuted instantiation: picture_enc.c:WebPGetFeatures Unexecuted instantiation: picture_csp_enc.c:WebPGetFeatures Unexecuted instantiation: webp_enc.c:WebPGetFeatures Unexecuted instantiation: picture_tools_enc.c:WebPGetFeatures Unexecuted instantiation: vp8l_enc.c:WebPGetFeatures Unexecuted instantiation: lossless_enc.c:WebPGetFeatures Unexecuted instantiation: lossless_enc_sse2.c:WebPGetFeatures Unexecuted instantiation: lossless_enc_sse41.c:WebPGetFeatures Unexecuted instantiation: backward_references_enc.c:WebPGetFeatures Unexecuted instantiation: histogram_enc.c:WebPGetFeatures Unexecuted instantiation: backward_references_cost_enc.c:WebPGetFeatures Unexecuted instantiation: picture_rescale_enc.c:WebPGetFeatures Unexecuted instantiation: predictor_enc.c:WebPGetFeatures Unexecuted instantiation: analysis_enc.c:WebPGetFeatures Unexecuted instantiation: iterator_enc.c:WebPGetFeatures Unexecuted instantiation: quant_enc.c:WebPGetFeatures Unexecuted instantiation: filter_enc.c:WebPGetFeatures Unexecuted instantiation: ssim.c:WebPGetFeatures Unexecuted instantiation: ssim_sse2.c:WebPGetFeatures Unexecuted instantiation: enc.c:WebPGetFeatures Unexecuted instantiation: enc_sse2.c:WebPGetFeatures Unexecuted instantiation: enc_sse41.c:WebPGetFeatures Unexecuted instantiation: cost_enc.c:WebPGetFeatures Unexecuted instantiation: cost.c:WebPGetFeatures Unexecuted instantiation: cost_sse2.c:WebPGetFeatures Unexecuted instantiation: alpha_enc.c:WebPGetFeatures Unexecuted instantiation: frame_enc.c:WebPGetFeatures Unexecuted instantiation: syntax_enc.c:WebPGetFeatures Unexecuted instantiation: tree_enc.c:WebPGetFeatures Unexecuted instantiation: token_enc.c:WebPGetFeatures Unexecuted instantiation: bit_reader_utils.c:WebPGetFeatures Unexecuted instantiation: bit_writer_utils.c:WebPGetFeatures Unexecuted instantiation: color_cache_utils.c:WebPGetFeatures Unexecuted instantiation: filters_utils.c:WebPGetFeatures Unexecuted instantiation: palette.c:WebPGetFeatures Unexecuted instantiation: rescaler_utils.c:WebPGetFeatures Unexecuted instantiation: anim_encode.c:WebPGetFeatures Unexecuted instantiation: muxedit.c:WebPGetFeatures Unexecuted instantiation: muxinternal.c:WebPGetFeatures Unexecuted instantiation: muxread.c:WebPGetFeatures Line | Count | Source | 476 | 2.62k | size_t data_size, WebPBitstreamFeatures* features) { | 477 | 2.62k | return WebPGetFeaturesInternal(data, data_size, features, | 478 | 2.62k | WEBP_DECODER_ABI_VERSION); | 479 | 2.62k | } |
|
480 | | |
481 | | // Decoding options |
482 | | struct WebPDecoderOptions { |
483 | | int bypass_filtering; // if true, skip the in-loop filtering |
484 | | int no_fancy_upsampling; // if true, use faster pointwise upsampler |
485 | | int use_cropping; // if true, cropping is applied _first_ |
486 | | int crop_left, crop_top; // top-left position for cropping. |
487 | | // Will be snapped to even values. |
488 | | int crop_width, crop_height; // dimension of the cropping area |
489 | | int use_scaling; // if true, scaling is applied _afterward_ |
490 | | int scaled_width, scaled_height; // final resolution. if one is 0, it is |
491 | | // guessed from the other one to keep the |
492 | | // original ratio. |
493 | | int use_threads; // if true, use multi-threaded decoding |
494 | | int dithering_strength; // dithering strength (0=Off, 100=full) |
495 | | int flip; // if true, flip output vertically |
496 | | int alpha_dithering_strength; // alpha dithering strength in [0..100] |
497 | | |
498 | | uint32_t pad[5]; // padding for later use |
499 | | }; |
500 | | |
501 | | // Main object storing the configuration for advanced decoding. |
502 | | struct WebPDecoderConfig { |
503 | | WebPBitstreamFeatures input; // Immutable bitstream features (optional) |
504 | | WebPDecBuffer output; // Output buffer (can point to external mem) |
505 | | WebPDecoderOptions options; // Decoding options |
506 | | }; |
507 | | |
508 | | // Internal, version-checked, entry point |
509 | | WEBP_NODISCARD WEBP_EXTERN int WebPInitDecoderConfigInternal(WebPDecoderConfig*, |
510 | | int); |
511 | | |
512 | | // Initialize the configuration as empty. This function must always be |
513 | | // called first, unless WebPGetFeatures() is to be called. |
514 | | // Returns false in case of mismatched version. |
515 | | WEBP_NODISCARD static WEBP_INLINE int WebPInitDecoderConfig( |
516 | 0 | WebPDecoderConfig* config) { |
517 | 0 | return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION); |
518 | 0 | } Unexecuted instantiation: buffer_dec.c:WebPInitDecoderConfig Unexecuted instantiation: webp_dec.c:WebPInitDecoderConfig Unexecuted instantiation: vp8l_dec.c:WebPInitDecoderConfig Unexecuted instantiation: vp8_dec.c:WebPInitDecoderConfig Unexecuted instantiation: alpha_dec.c:WebPInitDecoderConfig Unexecuted instantiation: io_dec.c:WebPInitDecoderConfig Unexecuted instantiation: tree_dec.c:WebPInitDecoderConfig Unexecuted instantiation: quant_dec.c:WebPInitDecoderConfig Unexecuted instantiation: frame_dec.c:WebPInitDecoderConfig Unexecuted instantiation: alpha_processing.c:WebPInitDecoderConfig Unexecuted instantiation: dec.c:WebPInitDecoderConfig Unexecuted instantiation: dec_clip_tables.c:WebPInitDecoderConfig Unexecuted instantiation: filters.c:WebPInitDecoderConfig Unexecuted instantiation: lossless.c:WebPInitDecoderConfig Unexecuted instantiation: rescaler.c:WebPInitDecoderConfig Unexecuted instantiation: upsampling.c:WebPInitDecoderConfig Unexecuted instantiation: yuv.c:WebPInitDecoderConfig Unexecuted instantiation: alpha_processing_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: dec_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: filters_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: lossless_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: rescaler_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: upsampling_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: yuv_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: alpha_processing_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: dec_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: lossless_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: upsampling_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: yuv_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: picture_enc.c:WebPInitDecoderConfig Unexecuted instantiation: picture_csp_enc.c:WebPInitDecoderConfig Unexecuted instantiation: webp_enc.c:WebPInitDecoderConfig Unexecuted instantiation: picture_tools_enc.c:WebPInitDecoderConfig Unexecuted instantiation: vp8l_enc.c:WebPInitDecoderConfig Unexecuted instantiation: lossless_enc.c:WebPInitDecoderConfig Unexecuted instantiation: lossless_enc_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: lossless_enc_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: backward_references_enc.c:WebPInitDecoderConfig Unexecuted instantiation: histogram_enc.c:WebPInitDecoderConfig Unexecuted instantiation: backward_references_cost_enc.c:WebPInitDecoderConfig Unexecuted instantiation: picture_rescale_enc.c:WebPInitDecoderConfig Unexecuted instantiation: predictor_enc.c:WebPInitDecoderConfig Unexecuted instantiation: analysis_enc.c:WebPInitDecoderConfig Unexecuted instantiation: iterator_enc.c:WebPInitDecoderConfig Unexecuted instantiation: quant_enc.c:WebPInitDecoderConfig Unexecuted instantiation: filter_enc.c:WebPInitDecoderConfig Unexecuted instantiation: ssim.c:WebPInitDecoderConfig Unexecuted instantiation: ssim_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: enc.c:WebPInitDecoderConfig Unexecuted instantiation: enc_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: enc_sse41.c:WebPInitDecoderConfig Unexecuted instantiation: cost_enc.c:WebPInitDecoderConfig Unexecuted instantiation: cost.c:WebPInitDecoderConfig Unexecuted instantiation: cost_sse2.c:WebPInitDecoderConfig Unexecuted instantiation: alpha_enc.c:WebPInitDecoderConfig Unexecuted instantiation: frame_enc.c:WebPInitDecoderConfig Unexecuted instantiation: syntax_enc.c:WebPInitDecoderConfig Unexecuted instantiation: tree_enc.c:WebPInitDecoderConfig Unexecuted instantiation: token_enc.c:WebPInitDecoderConfig Unexecuted instantiation: bit_reader_utils.c:WebPInitDecoderConfig Unexecuted instantiation: bit_writer_utils.c:WebPInitDecoderConfig Unexecuted instantiation: color_cache_utils.c:WebPInitDecoderConfig Unexecuted instantiation: filters_utils.c:WebPInitDecoderConfig Unexecuted instantiation: palette.c:WebPInitDecoderConfig Unexecuted instantiation: rescaler_utils.c:WebPInitDecoderConfig Unexecuted instantiation: anim_encode.c:WebPInitDecoderConfig Unexecuted instantiation: muxedit.c:WebPInitDecoderConfig Unexecuted instantiation: muxinternal.c:WebPInitDecoderConfig Unexecuted instantiation: muxread.c:WebPInitDecoderConfig Unexecuted instantiation: demux.c:WebPInitDecoderConfig |
519 | | |
520 | | // Returns true if 'config' is non-NULL and all configuration parameters are |
521 | | // within their valid ranges. |
522 | | WEBP_NODISCARD WEBP_EXTERN int WebPValidateDecoderConfig( |
523 | | const WebPDecoderConfig* config); |
524 | | |
525 | | // Instantiate a new incremental decoder object with the requested |
526 | | // configuration. The bitstream can be passed using 'data' and 'data_size' |
527 | | // parameter, in which case the features will be parsed and stored into |
528 | | // config->input. Otherwise, 'data' can be NULL and no parsing will occur. |
529 | | // Note that 'config' can be NULL too, in which case a default configuration |
530 | | // is used. If 'config' is not NULL, it must outlive the WebPIDecoder object |
531 | | // as some references to its fields will be used. No internal copy of 'config' |
532 | | // is made. |
533 | | // The return WebPIDecoder object must always be deleted calling WebPIDelete(). |
534 | | // Returns NULL in case of error (and config->status will then reflect |
535 | | // the error condition, if available). |
536 | | WEBP_NODISCARD WEBP_EXTERN WebPIDecoder* WebPIDecode( |
537 | | const uint8_t* WEBP_COUNTED_BY(data_size) data, size_t data_size, |
538 | | WebPDecoderConfig* config); |
539 | | |
540 | | // Non-incremental version. This version decodes the full data at once, taking |
541 | | // 'config' into account. Returns decoding status (which should be VP8_STATUS_OK |
542 | | // if the decoding was successful). Note that 'config' cannot be NULL. |
543 | | WEBP_EXTERN VP8StatusCode WebPDecode(const uint8_t* WEBP_COUNTED_BY(data_size) |
544 | | data, |
545 | | size_t data_size, |
546 | | WebPDecoderConfig* config); |
547 | | |
548 | | #ifdef __cplusplus |
549 | | } // extern "C" |
550 | | #endif |
551 | | |
552 | | #endif // WEBP_WEBP_DECODE_H_ |