OLD | NEW |
1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
7 // | 7 // |
8 // WebP encoder: main interface | 8 // WebP encoder: main interface |
9 // | 9 // |
10 // Author: Skal (pascal.massimino@gmail.com) | 10 // Author: Skal (pascal.massimino@gmail.com) |
11 | 11 |
12 #ifndef WEBP_WEBP_ENCODE_H_ | 12 #ifndef WEBP_WEBP_ENCODE_H_ |
13 #define WEBP_WEBP_ENCODE_H_ | 13 #define WEBP_WEBP_ENCODE_H_ |
14 | 14 |
15 #include "./types.h" | 15 #include "./types.h" |
16 | 16 |
17 #if defined(__cplusplus) || defined(c_plusplus) | 17 #if defined(__cplusplus) || defined(c_plusplus) |
18 extern "C" { | 18 extern "C" { |
19 #endif | 19 #endif |
20 | 20 |
21 #define WEBP_ENCODER_ABI_VERSION 0x0200 // MAJOR(8b) + MINOR(8b) | 21 #define WEBP_ENCODER_ABI_VERSION 0x0201 // MAJOR(8b) + MINOR(8b) |
| 22 |
| 23 #if !(defined(__cplusplus) || defined(c_plusplus)) |
| 24 typedef enum WebPImageHint WebPImageHint; |
| 25 typedef enum WebPEncCSP WebPEncCSP; |
| 26 typedef enum WebPPreset WebPPreset; |
| 27 typedef enum WebPEncodingError WebPEncodingError; |
| 28 #endif |
| 29 typedef struct WebPConfig WebPConfig; |
| 30 typedef struct WebPPicture WebPPicture; // main structure for I/O |
| 31 typedef struct WebPAuxStats WebPAuxStats; |
| 32 typedef struct WebPMemoryWriter WebPMemoryWriter; |
22 | 33 |
23 // Return the encoder's version number, packed in hexadecimal using 8bits for | 34 // Return the encoder's version number, packed in hexadecimal using 8bits for |
24 // each of major/minor/revision. E.g: v2.5.7 is 0x020507. | 35 // each of major/minor/revision. E.g: v2.5.7 is 0x020507. |
25 WEBP_EXTERN(int) WebPGetEncoderVersion(void); | 36 WEBP_EXTERN(int) WebPGetEncoderVersion(void); |
26 | 37 |
27 //------------------------------------------------------------------------------ | 38 //------------------------------------------------------------------------------ |
28 // One-stop-shop call! No questions asked: | 39 // One-stop-shop call! No questions asked: |
29 | 40 |
30 // Returns the size of the compressed data (pointed to by *output), or 0 if | 41 // Returns the size of the compressed data (pointed to by *output), or 0 if |
31 // an error occurred. The compressed data must be released by the caller | 42 // an error occurred. The compressed data must be released by the caller |
(...skipping 27 matching lines...) Expand all Loading... |
59 int width, int height, int stride, | 70 int width, int height, int stride, |
60 uint8_t** output); | 71 uint8_t** output); |
61 WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra, | 72 WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra, |
62 int width, int height, int stride, | 73 int width, int height, int stride, |
63 uint8_t** output); | 74 uint8_t** output); |
64 | 75 |
65 //------------------------------------------------------------------------------ | 76 //------------------------------------------------------------------------------ |
66 // Coding parameters | 77 // Coding parameters |
67 | 78 |
68 // Image characteristics hint for the underlying encoder. | 79 // Image characteristics hint for the underlying encoder. |
69 typedef enum { | 80 enum WebPImageHint { |
70 WEBP_HINT_DEFAULT = 0, // default preset. | 81 WEBP_HINT_DEFAULT = 0, // default preset. |
71 WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot | 82 WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot |
72 WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting | 83 WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting |
73 WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc). | 84 WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc). |
74 WEBP_HINT_LAST | 85 WEBP_HINT_LAST |
75 } WebPImageHint; | 86 }; |
76 | 87 |
77 typedef struct { | 88 // Compression parameters. |
| 89 struct WebPConfig { |
78 int lossless; // Lossless encoding (0=lossy(default), 1=lossless). | 90 int lossless; // Lossless encoding (0=lossy(default), 1=lossless). |
79 float quality; // between 0 (smallest file) and 100 (biggest) | 91 float quality; // between 0 (smallest file) and 100 (biggest) |
80 int method; // quality/speed trade-off (0=fast, 6=slower-better) | 92 int method; // quality/speed trade-off (0=fast, 6=slower-better) |
81 | 93 |
82 WebPImageHint image_hint; // Hint for image type (lossless only for now). | 94 WebPImageHint image_hint; // Hint for image type (lossless only for now). |
83 | 95 |
84 // Parameters related to lossy compression only: | 96 // Parameters related to lossy compression only: |
85 int target_size; // if non-zero, set the desired target size in bytes. | 97 int target_size; // if non-zero, set the desired target size in bytes. |
86 // Takes precedence over the 'compression' parameter. | 98 // Takes precedence over the 'compression' parameter. |
87 float target_PSNR; // if non-zero, specifies the minimal distortion to | 99 float target_PSNR; // if non-zero, specifies the minimal distortion to |
(...skipping 14 matching lines...) Expand all Loading... |
102 int pass; // number of entropy-analysis passes (in [1..10]). | 114 int pass; // number of entropy-analysis passes (in [1..10]). |
103 | 115 |
104 int show_compressed; // if true, export the compressed picture back. | 116 int show_compressed; // if true, export the compressed picture back. |
105 // In-loop filtering is not applied. | 117 // In-loop filtering is not applied. |
106 int preprocessing; // preprocessing filter (0=none, 1=segment-smooth) | 118 int preprocessing; // preprocessing filter (0=none, 1=segment-smooth) |
107 int partitions; // log2(number of token partitions) in [0..3]. Default | 119 int partitions; // log2(number of token partitions) in [0..3]. Default |
108 // is set to 0 for easier progressive decoding. | 120 // is set to 0 for easier progressive decoding. |
109 int partition_limit; // quality degradation allowed to fit the 512k limit | 121 int partition_limit; // quality degradation allowed to fit the 512k limit |
110 // on prediction modes coding (0: no degradation, | 122 // on prediction modes coding (0: no degradation, |
111 // 100: maximum possible degradation). | 123 // 100: maximum possible degradation). |
| 124 int emulate_jpeg_size; // If true, compression parameters will be remapped |
| 125 // to better match the expected output size from |
| 126 // JPEG compression. Generally, the output size will |
| 127 // be similar but the degradation will be lower. |
| 128 int thread_level; // If non-zero, try and use multi-threaded encoding. |
| 129 int low_memory; // If set, reduce memory usage (but increase CPU use). |
112 | 130 |
113 uint32_t pad[8]; // padding for later use | 131 uint32_t pad[5]; // padding for later use |
114 } WebPConfig; | 132 }; |
115 | 133 |
116 // Enumerate some predefined settings for WebPConfig, depending on the type | 134 // Enumerate some predefined settings for WebPConfig, depending on the type |
117 // of source picture. These presets are used when calling WebPConfigPreset(). | 135 // of source picture. These presets are used when calling WebPConfigPreset(). |
118 typedef enum { | 136 enum WebPPreset { |
119 WEBP_PRESET_DEFAULT = 0, // default preset. | 137 WEBP_PRESET_DEFAULT = 0, // default preset. |
120 WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot | 138 WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot |
121 WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting | 139 WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting |
122 WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details | 140 WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details |
123 WEBP_PRESET_ICON, // small-sized colorful images | 141 WEBP_PRESET_ICON, // small-sized colorful images |
124 WEBP_PRESET_TEXT // text-like | 142 WEBP_PRESET_TEXT // text-like |
125 } WebPPreset; | 143 }; |
126 | 144 |
127 // Internal, version-checked, entry point | 145 // Internal, version-checked, entry point |
128 WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); | 146 WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); |
129 | 147 |
130 // Should always be called, to initialize a fresh WebPConfig structure before | 148 // Should always be called, to initialize a fresh WebPConfig structure before |
131 // modification. Returns false in case of version mismatch. WebPConfigInit() | 149 // modification. Returns false in case of version mismatch. WebPConfigInit() |
132 // must have succeeded before using the 'config' object. | 150 // must have succeeded before using the 'config' object. |
133 // Note that the default values are lossless=0 and quality=75. | 151 // Note that the default values are lossless=0 and quality=75. |
134 static WEBP_INLINE int WebPConfigInit(WebPConfig* config) { | 152 static WEBP_INLINE int WebPConfigInit(WebPConfig* config) { |
135 return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f, | 153 return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f, |
136 WEBP_ENCODER_ABI_VERSION); | 154 WEBP_ENCODER_ABI_VERSION); |
137 } | 155 } |
138 | 156 |
139 // This function will initialize the configuration according to a predefined | 157 // This function will initialize the configuration according to a predefined |
140 // set of parameters (referred to by 'preset') and a given quality factor. | 158 // set of parameters (referred to by 'preset') and a given quality factor. |
141 // This function can be called as a replacement to WebPConfigInit(). Will | 159 // This function can be called as a replacement to WebPConfigInit(). Will |
142 // return false in case of error. | 160 // return false in case of error. |
143 static WEBP_INLINE int WebPConfigPreset(WebPConfig* config, | 161 static WEBP_INLINE int WebPConfigPreset(WebPConfig* config, |
144 WebPPreset preset, float quality) { | 162 WebPPreset preset, float quality) { |
145 return WebPConfigInitInternal(config, preset, quality, | 163 return WebPConfigInitInternal(config, preset, quality, |
146 WEBP_ENCODER_ABI_VERSION); | 164 WEBP_ENCODER_ABI_VERSION); |
147 } | 165 } |
148 | 166 |
149 // Returns true if 'config' is non-NULL and all configuration parameters are | 167 // Returns true if 'config' is non-NULL and all configuration parameters are |
150 // within their valid ranges. | 168 // within their valid ranges. |
151 WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* config); | 169 WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* config); |
152 | 170 |
153 //------------------------------------------------------------------------------ | 171 //------------------------------------------------------------------------------ |
154 // Input / Output | 172 // Input / Output |
| 173 // Structure for storing auxiliary statistics (mostly for lossy encoding). |
155 | 174 |
156 typedef struct WebPPicture WebPPicture; // main structure for I/O | 175 struct WebPAuxStats { |
157 | |
158 // Structure for storing auxiliary statistics (mostly for lossy encoding). | |
159 typedef struct { | |
160 int coded_size; // final size | 176 int coded_size; // final size |
161 | 177 |
162 float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha | 178 float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha |
163 int block_count[3]; // number of intra4/intra16/skipped macroblocks | 179 int block_count[3]; // number of intra4/intra16/skipped macroblocks |
164 int header_bytes[2]; // approximate number of bytes spent for header | 180 int header_bytes[2]; // approximate number of bytes spent for header |
165 // and mode-partition #0 | 181 // and mode-partition #0 |
166 int residual_bytes[3][4]; // approximate number of bytes spent for | 182 int residual_bytes[3][4]; // approximate number of bytes spent for |
167 // DC/AC/uv coefficients for each (0..3) segments. | 183 // DC/AC/uv coefficients for each (0..3) segments. |
168 int segment_size[4]; // number of macroblocks in each segments | 184 int segment_size[4]; // number of macroblocks in each segments |
169 int segment_quant[4]; // quantizer values for each segments | 185 int segment_quant[4]; // quantizer values for each segments |
170 int segment_level[4]; // filtering strength for each segments [0..63] | 186 int segment_level[4]; // filtering strength for each segments [0..63] |
171 | 187 |
172 int alpha_data_size; // size of the transparency data | 188 int alpha_data_size; // size of the transparency data |
173 int layer_data_size; // size of the enhancement layer data | 189 int layer_data_size; // size of the enhancement layer data |
174 | 190 |
175 // lossless encoder statistics | 191 // lossless encoder statistics |
176 uint32_t lossless_features; // bit0:predictor bit1:cross-color transform | 192 uint32_t lossless_features; // bit0:predictor bit1:cross-color transform |
177 // bit2:subtract-green bit3:color indexing | 193 // bit2:subtract-green bit3:color indexing |
178 int histogram_bits; // number of precision bits of histogram | 194 int histogram_bits; // number of precision bits of histogram |
179 int transform_bits; // precision bits for transform | 195 int transform_bits; // precision bits for transform |
180 int cache_bits; // number of bits for color cache lookup | 196 int cache_bits; // number of bits for color cache lookup |
181 int palette_size; // number of color in palette, if used | 197 int palette_size; // number of color in palette, if used |
182 int lossless_size; // final lossless size | 198 int lossless_size; // final lossless size |
183 | 199 |
184 uint32_t pad[4]; // padding for later use | 200 uint32_t pad[4]; // padding for later use |
185 } WebPAuxStats; | 201 }; |
186 | 202 |
187 // Signature for output function. Should return true if writing was successful. | 203 // Signature for output function. Should return true if writing was successful. |
188 // data/data_size is the segment of data to write, and 'picture' is for | 204 // data/data_size is the segment of data to write, and 'picture' is for |
189 // reference (and so one can make use of picture->custom_ptr). | 205 // reference (and so one can make use of picture->custom_ptr). |
190 typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size, | 206 typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size, |
191 const WebPPicture* picture); | 207 const WebPPicture* picture); |
192 | 208 |
193 // WebPMemoryWrite: a special WebPWriterFunction that writes to memory using | 209 // WebPMemoryWrite: a special WebPWriterFunction that writes to memory using |
194 // the following WebPMemoryWriter object (to be set as a custom_ptr). | 210 // the following WebPMemoryWriter object (to be set as a custom_ptr). |
195 typedef struct { | 211 struct WebPMemoryWriter { |
196 uint8_t* mem; // final buffer (of size 'max_size', larger than 'size'). | 212 uint8_t* mem; // final buffer (of size 'max_size', larger than 'size'). |
197 size_t size; // final size | 213 size_t size; // final size |
198 size_t max_size; // total capacity | 214 size_t max_size; // total capacity |
199 uint32_t pad[1]; // padding for later use | 215 uint32_t pad[1]; // padding for later use |
200 } WebPMemoryWriter; | 216 }; |
201 | 217 |
202 // The following must be called first before any use. | 218 // The following must be called first before any use. |
203 WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer); | 219 WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer); |
204 | 220 |
205 // The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon | 221 // The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon |
206 // completion, writer.mem and writer.size will hold the coded data. | 222 // completion, writer.mem and writer.size will hold the coded data. |
| 223 // writer.mem must be freed using the call 'free(writer.mem)'. |
207 WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size, | 224 WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size, |
208 const WebPPicture* picture); | 225 const WebPPicture* picture); |
209 | 226 |
210 // Progress hook, called from time to time to report progress. It can return | 227 // Progress hook, called from time to time to report progress. It can return |
211 // false to request an abort of the encoding process, or true otherwise if | 228 // false to request an abort of the encoding process, or true otherwise if |
212 // everything is OK. | 229 // everything is OK. |
213 typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture); | 230 typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture); |
214 | 231 |
215 typedef enum { | 232 // Color spaces. |
| 233 enum WebPEncCSP { |
216 // chroma sampling | 234 // chroma sampling |
217 WEBP_YUV420 = 0, // 4:2:0 | 235 WEBP_YUV420 = 0, // 4:2:0 |
218 WEBP_YUV422 = 1, // 4:2:2 | 236 WEBP_YUV422 = 1, // 4:2:2 |
219 WEBP_YUV444 = 2, // 4:4:4 | 237 WEBP_YUV444 = 2, // 4:4:4 |
220 WEBP_YUV400 = 3, // grayscale | 238 WEBP_YUV400 = 3, // grayscale |
221 WEBP_CSP_UV_MASK = 3, // bit-mask to get the UV sampling factors | 239 WEBP_CSP_UV_MASK = 3, // bit-mask to get the UV sampling factors |
222 // alpha channel variants | 240 // alpha channel variants |
223 WEBP_YUV420A = 4, | 241 WEBP_YUV420A = 4, |
224 WEBP_YUV422A = 5, | 242 WEBP_YUV422A = 5, |
225 WEBP_YUV444A = 6, | 243 WEBP_YUV444A = 6, |
226 WEBP_YUV400A = 7, // grayscale + alpha | 244 WEBP_YUV400A = 7, // grayscale + alpha |
227 WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present | 245 WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present |
228 } WebPEncCSP; | 246 }; |
229 | 247 |
230 // Encoding error conditions. | 248 // Encoding error conditions. |
231 typedef enum { | 249 enum WebPEncodingError { |
232 VP8_ENC_OK = 0, | 250 VP8_ENC_OK = 0, |
233 VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects | 251 VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects |
234 VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits | 252 VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits |
235 VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL | 253 VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL |
236 VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid | 254 VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid |
237 VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height | 255 VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height |
238 VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k | 256 VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k |
239 VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M | 257 VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M |
240 VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes | 258 VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes |
241 VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G | 259 VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G |
242 VP8_ENC_ERROR_USER_ABORT, // abort request by user | 260 VP8_ENC_ERROR_USER_ABORT, // abort request by user |
243 VP8_ENC_ERROR_LAST // list terminator. always last. | 261 VP8_ENC_ERROR_LAST // list terminator. always last. |
244 } WebPEncodingError; | 262 }; |
245 | 263 |
246 // maximum width/height allowed (inclusive), in pixels | 264 // maximum width/height allowed (inclusive), in pixels |
247 #define WEBP_MAX_DIMENSION 16383 | 265 #define WEBP_MAX_DIMENSION 16383 |
248 | 266 |
249 // Main exchange structure (input samples, output bytes, statistics) | 267 // Main exchange structure (input samples, output bytes, statistics) |
250 struct WebPPicture { | 268 struct WebPPicture { |
251 | 269 |
252 // INPUT | 270 // INPUT |
253 ////////////// | 271 ////////////// |
254 // Main flag for encoder selecting between ARGB or YUV input. | 272 // Main flag for encoder selecting between ARGB or YUV input. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // object itself. | 359 // object itself. |
342 // Besides memory (which is reclaimed) all other fields of 'picture' are | 360 // Besides memory (which is reclaimed) all other fields of 'picture' are |
343 // preserved. | 361 // preserved. |
344 WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture); | 362 WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture); |
345 | 363 |
346 // Copy the pixels of *src into *dst, using WebPPictureAlloc. Upon return, | 364 // Copy the pixels of *src into *dst, using WebPPictureAlloc. Upon return, |
347 // *dst will fully own the copied pixels (this is not a view). | 365 // *dst will fully own the copied pixels (this is not a view). |
348 // Returns false in case of memory allocation error. | 366 // Returns false in case of memory allocation error. |
349 WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); | 367 WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); |
350 | 368 |
351 // Compute PSNR or SSIM distortion between two pictures. | 369 // Compute PSNR, SSIM or LSIM distortion metric between two pictures. |
352 // Result is in dB, stores in result[] in the Y/U/V/Alpha/All order. | 370 // Result is in dB, stores in result[] in the Y/U/V/Alpha/All order. |
353 // Returns false in case of error (pic1 and pic2 don't have same dimension, ...) | 371 // Returns false in case of error (src and ref don't have same dimension, ...) |
354 // Warning: this function is rather CPU-intensive. | 372 // Warning: this function is rather CPU-intensive. |
355 WEBP_EXTERN(int) WebPPictureDistortion( | 373 WEBP_EXTERN(int) WebPPictureDistortion( |
356 const WebPPicture* pic1, const WebPPicture* pic2, | 374 const WebPPicture* src, const WebPPicture* ref, |
357 int metric_type, // 0 = PSNR, 1 = SSIM | 375 int metric_type, // 0 = PSNR, 1 = SSIM, 2 = LSIM |
358 float result[5]); | 376 float result[5]); |
359 | 377 |
360 // self-crops a picture to the rectangle defined by top/left/width/height. | 378 // self-crops a picture to the rectangle defined by top/left/width/height. |
361 // Returns false in case of memory allocation error, or if the rectangle is | 379 // Returns false in case of memory allocation error, or if the rectangle is |
362 // outside of the source picture. | 380 // outside of the source picture. |
363 // The rectangle for the view is defined by the top-left corner pixel | 381 // The rectangle for the view is defined by the top-left corner pixel |
364 // coordinates (left, top) as well as its width and height. This rectangle | 382 // coordinates (left, top) as well as its width and height. This rectangle |
365 // must be fully be comprised inside the 'src' source picture. If the source | 383 // must be fully be comprised inside the 'src' source picture. If the source |
366 // picture uses the YUV420 colorspace, the top and left coordinates will be | 384 // picture uses the YUV420 colorspace, the top and left coordinates will be |
367 // snapped to even values. | 385 // snapped to even values. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // another is provided but they both incur some loss. | 472 // another is provided but they both incur some loss. |
455 WEBP_EXTERN(int) WebPEncode(const WebPConfig* config, WebPPicture* picture); | 473 WEBP_EXTERN(int) WebPEncode(const WebPConfig* config, WebPPicture* picture); |
456 | 474 |
457 //------------------------------------------------------------------------------ | 475 //------------------------------------------------------------------------------ |
458 | 476 |
459 #if defined(__cplusplus) || defined(c_plusplus) | 477 #if defined(__cplusplus) || defined(c_plusplus) |
460 } // extern "C" | 478 } // extern "C" |
461 #endif | 479 #endif |
462 | 480 |
463 #endif /* WEBP_WEBP_ENCODE_H_ */ | 481 #endif /* WEBP_WEBP_ENCODE_H_ */ |
OLD | NEW |