| OLD | NEW |
| 1 // Copyright 2010 Google Inc. All Rights Reserved. | 1 // Copyright 2010 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license | 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 | 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 | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 // | 9 // |
| 10 // Main decoding functions for WebP images. | 10 // Main decoding functions for WebP images. |
| 11 // | 11 // |
| 12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
| 13 | 13 |
| 14 #ifndef WEBP_WEBP_DECODE_H_ | 14 #ifndef WEBP_WEBP_DECODE_H_ |
| 15 #define WEBP_WEBP_DECODE_H_ | 15 #define WEBP_WEBP_DECODE_H_ |
| 16 | 16 |
| 17 #include "./types.h" | 17 #include "./types.h" |
| 18 | 18 |
| 19 #if defined(__cplusplus) || defined(c_plusplus) | 19 #ifdef __cplusplus |
| 20 extern "C" { | 20 extern "C" { |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #define WEBP_DECODER_ABI_VERSION 0x0201 // MAJOR(8b) + MINOR(8b) | 23 #define WEBP_DECODER_ABI_VERSION 0x0203 // MAJOR(8b) + MINOR(8b) |
| 24 | 24 |
| 25 // Note: forward declaring enumerations is not allowed in (strict) C and C++, | 25 // Note: forward declaring enumerations is not allowed in (strict) C and C++, |
| 26 // the types are left here for reference. | 26 // the types are left here for reference. |
| 27 // typedef enum VP8StatusCode VP8StatusCode; | 27 // typedef enum VP8StatusCode VP8StatusCode; |
| 28 // typedef enum WEBP_CSP_MODE WEBP_CSP_MODE; | 28 // typedef enum WEBP_CSP_MODE WEBP_CSP_MODE; |
| 29 typedef struct WebPRGBABuffer WebPRGBABuffer; | 29 typedef struct WebPRGBABuffer WebPRGBABuffer; |
| 30 typedef struct WebPYUVABuffer WebPYUVABuffer; | 30 typedef struct WebPYUVABuffer WebPYUVABuffer; |
| 31 typedef struct WebPDecBuffer WebPDecBuffer; | 31 typedef struct WebPDecBuffer WebPDecBuffer; |
| 32 typedef struct WebPIDecoder WebPIDecoder; | 32 typedef struct WebPIDecoder WebPIDecoder; |
| 33 typedef struct WebPBitstreamFeatures WebPBitstreamFeatures; | 33 typedef struct WebPBitstreamFeatures WebPBitstreamFeatures; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // by WebPDecode(). | 397 // by WebPDecode(). |
| 398 WebPFreeDecBuffer(&config.output); | 398 WebPFreeDecBuffer(&config.output); |
| 399 */ | 399 */ |
| 400 | 400 |
| 401 // Features gathered from the bitstream | 401 // Features gathered from the bitstream |
| 402 struct WebPBitstreamFeatures { | 402 struct WebPBitstreamFeatures { |
| 403 int width; // Width in pixels, as read from the bitstream. | 403 int width; // Width in pixels, as read from the bitstream. |
| 404 int height; // Height in pixels, as read from the bitstream. | 404 int height; // Height in pixels, as read from the bitstream. |
| 405 int has_alpha; // True if the bitstream contains an alpha channel. | 405 int has_alpha; // True if the bitstream contains an alpha channel. |
| 406 int has_animation; // True if the bitstream is an animation. | 406 int has_animation; // True if the bitstream is an animation. |
| 407 int format; // 0 = undefined (/mixed), 1 = lossy, 2 = lossless |
| 407 | 408 |
| 408 // Unused for now: | 409 // Unused for now: |
| 409 int bitstream_version; // should be 0 for now. TODO(later) | |
| 410 int no_incremental_decoding; // if true, using incremental decoding is not | 410 int no_incremental_decoding; // if true, using incremental decoding is not |
| 411 // recommended. | 411 // recommended. |
| 412 int rotate; // TODO(later) | 412 int rotate; // TODO(later) |
| 413 int uv_sampling; // should be 0 for now. TODO(later) | 413 int uv_sampling; // should be 0 for now. TODO(later) |
| 414 uint32_t pad[2]; // padding for later use | 414 uint32_t pad[2]; // padding for later use |
| 415 }; | 415 }; |
| 416 | 416 |
| 417 // Internal, version-checked, entry point | 417 // Internal, version-checked, entry point |
| 418 WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( | 418 WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( |
| 419 const uint8_t*, size_t, WebPBitstreamFeatures*, int); | 419 const uint8_t*, size_t, WebPBitstreamFeatures*, int); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 434 struct WebPDecoderOptions { | 434 struct WebPDecoderOptions { |
| 435 int bypass_filtering; // if true, skip the in-loop filtering | 435 int bypass_filtering; // if true, skip the in-loop filtering |
| 436 int no_fancy_upsampling; // if true, use faster pointwise upsampler | 436 int no_fancy_upsampling; // if true, use faster pointwise upsampler |
| 437 int use_cropping; // if true, cropping is applied _first_ | 437 int use_cropping; // if true, cropping is applied _first_ |
| 438 int crop_left, crop_top; // top-left position for cropping. | 438 int crop_left, crop_top; // top-left position for cropping. |
| 439 // Will be snapped to even values. | 439 // Will be snapped to even values. |
| 440 int crop_width, crop_height; // dimension of the cropping area | 440 int crop_width, crop_height; // dimension of the cropping area |
| 441 int use_scaling; // if true, scaling is applied _afterward_ | 441 int use_scaling; // if true, scaling is applied _afterward_ |
| 442 int scaled_width, scaled_height; // final resolution | 442 int scaled_width, scaled_height; // final resolution |
| 443 int use_threads; // if true, use multi-threaded decoding | 443 int use_threads; // if true, use multi-threaded decoding |
| 444 int dithering_strength; // dithering strength (0=Off, 100=full) |
| 444 | 445 |
| 445 // Unused for now: | 446 // Unused for now: |
| 446 int force_rotation; // forced rotation (to be applied _last_) | 447 int force_rotation; // forced rotation (to be applied _last_) |
| 447 int no_enhancement; // if true, discard enhancement layer | 448 int no_enhancement; // if true, discard enhancement layer |
| 448 uint32_t pad[6]; // padding for later use | 449 uint32_t pad[5]; // padding for later use |
| 449 }; | 450 }; |
| 450 | 451 |
| 451 // Main object storing the configuration for advanced decoding. | 452 // Main object storing the configuration for advanced decoding. |
| 452 struct WebPDecoderConfig { | 453 struct WebPDecoderConfig { |
| 453 WebPBitstreamFeatures input; // Immutable bitstream features (optional) | 454 WebPBitstreamFeatures input; // Immutable bitstream features (optional) |
| 454 WebPDecBuffer output; // Output buffer (can point to external mem) | 455 WebPDecBuffer output; // Output buffer (can point to external mem) |
| 455 WebPDecoderOptions options; // Decoding options | 456 WebPDecoderOptions options; // Decoding options |
| 456 }; | 457 }; |
| 457 | 458 |
| 458 // Internal, version-checked, entry point | 459 // Internal, version-checked, entry point |
| (...skipping 17 matching lines...) Expand all Loading... |
| 476 // the error condition). | 477 // the error condition). |
| 477 WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, size_t data_size, | 478 WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, size_t data_size, |
| 478 WebPDecoderConfig* config); | 479 WebPDecoderConfig* config); |
| 479 | 480 |
| 480 // Non-incremental version. This version decodes the full data at once, taking | 481 // Non-incremental version. This version decodes the full data at once, taking |
| 481 // 'config' into account. Returns decoding status (which should be VP8_STATUS_OK | 482 // 'config' into account. Returns decoding status (which should be VP8_STATUS_OK |
| 482 // if the decoding was successful). | 483 // if the decoding was successful). |
| 483 WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, size_t data_size, | 484 WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, size_t data_size, |
| 484 WebPDecoderConfig* config); | 485 WebPDecoderConfig* config); |
| 485 | 486 |
| 486 #if defined(__cplusplus) || defined(c_plusplus) | 487 #ifdef __cplusplus |
| 487 } // extern "C" | 488 } // extern "C" |
| 488 #endif | 489 #endif |
| 489 | 490 |
| 490 #endif /* WEBP_WEBP_DECODE_H_ */ | 491 #endif /* WEBP_WEBP_DECODE_H_ */ |
| OLD | NEW |