| OLD | NEW |
| 1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 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 // Lossless encoder: internal header. | 10 // Lossless encoder: internal header. |
| 11 // | 11 // |
| 12 // Author: Vikas Arora (vikaas.arora@gmail.com) | 12 // Author: Vikas Arora (vikaas.arora@gmail.com) |
| 13 | 13 |
| 14 #ifndef WEBP_ENC_VP8LI_H_ | 14 #ifndef WEBP_ENC_VP8LI_H_ |
| 15 #define WEBP_ENC_VP8LI_H_ | 15 #define WEBP_ENC_VP8LI_H_ |
| 16 | 16 |
| 17 #include "./backward_references.h" | 17 #include "./backward_references_enc.h" |
| 18 #include "./histogram.h" | 18 #include "./histogram_enc.h" |
| 19 #include "../utils/bit_writer.h" | 19 #include "../utils/bit_writer_utils.h" |
| 20 #include "../webp/encode.h" | 20 #include "../webp/encode.h" |
| 21 #include "../webp/format_constants.h" | 21 #include "../webp/format_constants.h" |
| 22 | 22 |
| 23 #ifdef __cplusplus | 23 #ifdef __cplusplus |
| 24 extern "C" { | 24 extern "C" { |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 // maximum value of transform_bits_ in VP8LEncoder. |
| 28 #define MAX_TRANSFORM_BITS 6 |
| 29 |
| 27 typedef struct { | 30 typedef struct { |
| 28 const WebPConfig* config_; // user configuration and parameters | 31 const WebPConfig* config_; // user configuration and parameters |
| 29 const WebPPicture* pic_; // input picture. | 32 const WebPPicture* pic_; // input picture. |
| 30 | 33 |
| 31 uint32_t* argb_; // Transformed argb image data. | 34 uint32_t* argb_; // Transformed argb image data. |
| 32 uint32_t* argb_scratch_; // Scratch memory for argb rows | 35 uint32_t* argb_scratch_; // Scratch memory for argb rows |
| 33 // (used for prediction). | 36 // (used for prediction). |
| 34 uint32_t* transform_data_; // Scratch memory for transform data. | 37 uint32_t* transform_data_; // Scratch memory for transform data. |
| 35 uint32_t* transform_mem_; // Currently allocated memory. | 38 uint32_t* transform_mem_; // Currently allocated memory. |
| 36 size_t transform_mem_size_; // Currently allocated memory size. | 39 size_t transform_mem_size_; // Currently allocated memory size. |
| 37 | 40 |
| 38 int current_width_; // Corresponds to packed image width. | 41 int current_width_; // Corresponds to packed image width. |
| 39 | 42 |
| 40 // Encoding parameters derived from quality parameter. | 43 // Encoding parameters derived from quality parameter. |
| 41 int histo_bits_; | 44 int histo_bits_; |
| 42 int transform_bits_; | 45 int transform_bits_; // <= MAX_TRANSFORM_BITS. |
| 43 int cache_bits_; // If equal to 0, don't use color cache. | 46 int cache_bits_; // If equal to 0, don't use color cache. |
| 44 | 47 |
| 45 // Encoding parameters derived from image characteristics. | 48 // Encoding parameters derived from image characteristics. |
| 46 int use_cross_color_; | 49 int use_cross_color_; |
| 47 int use_subtract_green_; | 50 int use_subtract_green_; |
| 48 int use_predict_; | 51 int use_predict_; |
| 49 int use_palette_; | 52 int use_palette_; |
| 50 int palette_size_; | 53 int palette_size_; |
| 51 uint32_t palette_[MAX_PALETTE_SIZE]; | 54 uint32_t palette_[MAX_PALETTE_SIZE]; |
| 52 | 55 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 66 int VP8LEncodeImage(const WebPConfig* const config, | 69 int VP8LEncodeImage(const WebPConfig* const config, |
| 67 const WebPPicture* const picture); | 70 const WebPPicture* const picture); |
| 68 | 71 |
| 69 // Encodes the main image stream using the supplied bit writer. | 72 // Encodes the main image stream using the supplied bit writer. |
| 70 // If 'use_cache' is false, disables the use of color cache. | 73 // If 'use_cache' is false, disables the use of color cache. |
| 71 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, | 74 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, |
| 72 const WebPPicture* const picture, | 75 const WebPPicture* const picture, |
| 73 VP8LBitWriter* const bw, int use_cache); | 76 VP8LBitWriter* const bw, int use_cache); |
| 74 | 77 |
| 75 //------------------------------------------------------------------------------ | 78 //------------------------------------------------------------------------------ |
| 79 // Image transforms in predictor.c. |
| 80 |
| 81 void VP8LResidualImage(int width, int height, int bits, int low_effort, |
| 82 uint32_t* const argb, uint32_t* const argb_scratch, |
| 83 uint32_t* const image, int near_lossless, int exact, |
| 84 int used_subtract_green); |
| 85 |
| 86 void VP8LColorSpaceTransform(int width, int height, int bits, int quality, |
| 87 uint32_t* const argb, uint32_t* image); |
| 88 |
| 89 //------------------------------------------------------------------------------ |
| 76 | 90 |
| 77 #ifdef __cplusplus | 91 #ifdef __cplusplus |
| 78 } // extern "C" | 92 } // extern "C" |
| 79 #endif | 93 #endif |
| 80 | 94 |
| 81 #endif /* WEBP_ENC_VP8LI_H_ */ | 95 #endif /* WEBP_ENC_VP8LI_H_ */ |
| OLD | NEW |