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 (at) gmail.com) 13 14 #ifndef WEBP_ENC_VP8LI_H_ 15 #define WEBP_ENC_VP8LI_H_ 16 17 #include "./histogram.h" 18 #include "../utils/bit_writer.h" 19 #include "../webp/encode.h" 20 #include "../webp/format_constants.h" 21 22 #if defined(__cplusplus) || defined(c_plusplus) 23 extern "C" { 24 #endif 25 26 typedef struct { 27 const WebPConfig* config_; // user configuration and parameters 28 const WebPPicture* pic_; // input picture. 29 30 uint32_t* argb_; // Transformed argb image data. 31 uint32_t* argb_scratch_; // Scratch memory for argb rows 32 // (used for prediction). 33 uint32_t* transform_data_; // Scratch memory for transform data. 34 int current_width_; // Corresponds to packed image width. 35 36 // Encoding parameters derived from quality parameter. 37 int histo_bits_; 38 int transform_bits_; 39 int cache_bits_; // If equal to 0, don't use color cache. 40 41 // Encoding parameters derived from image characteristics. 42 int use_cross_color_; 43 int use_subtract_green_; 44 int use_predict_; 45 int use_palette_; 46 int palette_size_; 47 uint32_t palette_[MAX_PALETTE_SIZE]; 48 } VP8LEncoder; 49 50 //------------------------------------------------------------------------------ 51 // internal functions. Not public. 52 53 // Encodes the picture. 54 // Returns 0 if config or picture is NULL or picture doesn't have valid argb 55 // input. 56 int VP8LEncodeImage(const WebPConfig* const config, 57 const WebPPicture* const picture); 58 59 // Encodes the main image stream using the supplied bit writer. 60 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, 61 const WebPPicture* const picture, 62 VP8LBitWriter* const bw); 63 64 //------------------------------------------------------------------------------ 65 66 #if defined(__cplusplus) || defined(c_plusplus) 67 } // extern "C" 68 #endif 69 70 #endif /* WEBP_ENC_VP8LI_H_ */ 71