vp8li.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright 2012 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. // Lossless encoder: internal header.
  11. //
  12. // Author: Vikas Arora (vikaas.arora@gmail.com)
  13. #ifndef WEBP_ENC_VP8LI_H_
  14. #define WEBP_ENC_VP8LI_H_
  15. #include "./backward_references.h"
  16. #include "./histogram.h"
  17. #include "../utils/bit_writer.h"
  18. #include "../webp/encode.h"
  19. #include "../webp/format_constants.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. typedef struct {
  24. const WebPConfig* config_; // user configuration and parameters
  25. const WebPPicture* pic_; // input picture.
  26. uint32_t* argb_; // Transformed argb image data.
  27. uint32_t* argb_scratch_; // Scratch memory for argb rows
  28. // (used for prediction).
  29. uint32_t* transform_data_; // Scratch memory for transform data.
  30. int current_width_; // Corresponds to packed image width.
  31. // Encoding parameters derived from quality parameter.
  32. int histo_bits_;
  33. int transform_bits_;
  34. int cache_bits_; // If equal to 0, don't use color cache.
  35. // Encoding parameters derived from image characteristics.
  36. int use_cross_color_;
  37. int use_subtract_green_;
  38. int use_predict_;
  39. int use_palette_;
  40. int palette_size_;
  41. uint32_t palette_[MAX_PALETTE_SIZE];
  42. // Some 'scratch' (potentially large) objects.
  43. struct VP8LBackwardRefs refs_[2]; // Backward Refs array corresponding to
  44. // LZ77 & RLE coding.
  45. VP8LHashChain hash_chain_; // HashChain data for constructing
  46. // backward references.
  47. } VP8LEncoder;
  48. //------------------------------------------------------------------------------
  49. // internal functions. Not public.
  50. // Encodes the picture.
  51. // Returns 0 if config or picture is NULL or picture doesn't have valid argb
  52. // input.
  53. int VP8LEncodeImage(const WebPConfig* const config,
  54. const WebPPicture* const picture);
  55. // Encodes the main image stream using the supplied bit writer.
  56. WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
  57. const WebPPicture* const picture,
  58. VP8LBitWriter* const bw);
  59. //------------------------------------------------------------------------------
  60. #ifdef __cplusplus
  61. } // extern "C"
  62. #endif
  63. #endif /* WEBP_ENC_VP8LI_H_ */