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.h" |
18 #include "./histogram.h" | 18 #include "./histogram.h" |
19 #include "../utils/bit_writer.h" | 19 #include "../utils/bit_writer.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 typedef struct { | 27 typedef struct { |
28 const WebPConfig* config_; // user configuration and parameters | 28 const WebPConfig* config_; // user configuration and parameters |
29 const WebPPicture* pic_; // input picture. | 29 const WebPPicture* pic_; // input picture. |
30 | 30 |
31 uint32_t* argb_; // Transformed argb image data. | 31 uint32_t* argb_; // Transformed argb image data. |
32 uint32_t* argb_scratch_; // Scratch memory for argb rows | 32 uint32_t* argb_scratch_; // Scratch memory for argb rows |
33 // (used for prediction). | 33 // (used for prediction). |
34 uint32_t* transform_data_; // Scratch memory for transform data. | 34 uint32_t* transform_data_; // Scratch memory for transform data. |
35 int current_width_; // Corresponds to packed image width. | 35 uint32_t* transform_mem_; // Currently allocated memory. |
| 36 size_t transform_mem_size_; // Currently allocated memory size. |
| 37 |
| 38 int current_width_; // Corresponds to packed image width. |
36 | 39 |
37 // Encoding parameters derived from quality parameter. | 40 // Encoding parameters derived from quality parameter. |
38 int histo_bits_; | 41 int histo_bits_; |
39 int transform_bits_; | 42 int transform_bits_; |
40 int cache_bits_; // If equal to 0, don't use color cache. | 43 int cache_bits_; // If equal to 0, don't use color cache. |
41 | 44 |
42 // Encoding parameters derived from image characteristics. | 45 // Encoding parameters derived from image characteristics. |
43 int use_cross_color_; | 46 int use_cross_color_; |
44 int use_subtract_green_; | 47 int use_subtract_green_; |
45 int use_predict_; | 48 int use_predict_; |
(...skipping 11 matching lines...) Expand all Loading... |
57 //------------------------------------------------------------------------------ | 60 //------------------------------------------------------------------------------ |
58 // internal functions. Not public. | 61 // internal functions. Not public. |
59 | 62 |
60 // Encodes the picture. | 63 // Encodes the picture. |
61 // Returns 0 if config or picture is NULL or picture doesn't have valid argb | 64 // Returns 0 if config or picture is NULL or picture doesn't have valid argb |
62 // input. | 65 // input. |
63 int VP8LEncodeImage(const WebPConfig* const config, | 66 int VP8LEncodeImage(const WebPConfig* const config, |
64 const WebPPicture* const picture); | 67 const WebPPicture* const picture); |
65 | 68 |
66 // Encodes the main image stream using the supplied bit writer. | 69 // Encodes the main image stream using the supplied bit writer. |
| 70 // If 'use_cache' is false, disables the use of color cache. |
67 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, | 71 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, |
68 const WebPPicture* const picture, | 72 const WebPPicture* const picture, |
69 VP8LBitWriter* const bw); | 73 VP8LBitWriter* const bw, int use_cache); |
70 | 74 |
71 //------------------------------------------------------------------------------ | 75 //------------------------------------------------------------------------------ |
72 | 76 |
73 #ifdef __cplusplus | 77 #ifdef __cplusplus |
74 } // extern "C" | 78 } // extern "C" |
75 #endif | 79 #endif |
76 | 80 |
77 #endif /* WEBP_ENC_VP8LI_H_ */ | 81 #endif /* WEBP_ENC_VP8LI_H_ */ |
OLD | NEW |