1 // Copyright 2012 Google Inc. All Rights Reserved.
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 // -----------------------------------------------------------------------------
10 // Lossless encoder: internal header.
12 // Author: Vikas Arora (vikaas.arora@gmail.com)
14 #ifndef WEBP_ENC_VP8LI_H_
15 #define WEBP_ENC_VP8LI_H_
17 #include "./backward_references.h"
18 #include "./histogram.h"
19 #include "../utils/bit_writer.h"
20 #include "../webp/encode.h"
21 #include "../webp/format_constants.h"
28 const WebPConfig
* config_
; // user configuration and parameters
29 const WebPPicture
* pic_
; // input picture.
31 uint32_t* argb_
; // Transformed argb image data.
32 uint32_t* argb_scratch_
; // Scratch memory for argb rows
33 // (used for prediction).
34 uint32_t* transform_data_
; // Scratch memory for transform data.
35 int current_width_
; // Corresponds to packed image width.
37 // Encoding parameters derived from quality parameter.
40 int cache_bits_
; // If equal to 0, don't use color cache.
42 // Encoding parameters derived from image characteristics.
44 int use_subtract_green_
;
48 uint32_t palette_
[MAX_PALETTE_SIZE
];
50 // Some 'scratch' (potentially large) objects.
51 struct VP8LBackwardRefs refs_
[2]; // Backward Refs array corresponding to
53 VP8LHashChain hash_chain_
; // HashChain data for constructing
54 // backward references.
57 //------------------------------------------------------------------------------
58 // internal functions. Not public.
60 // Encodes the picture.
61 // Returns 0 if config or picture is NULL or picture doesn't have valid argb
63 int VP8LEncodeImage(const WebPConfig
* const config
,
64 const WebPPicture
* const picture
);
66 // Encodes the main image stream using the supplied bit writer.
67 WebPEncodingError
VP8LEncodeStream(const WebPConfig
* const config
,
68 const WebPPicture
* const picture
,
69 VP8LBitWriter
* const bw
);
71 //------------------------------------------------------------------------------
77 #endif /* WEBP_ENC_VP8LI_H_ */