Home | History | Annotate | Download | only in enc
      1 // Copyright 2012 Google Inc. All Rights Reserved.
      2 //
      3 // This code is licensed under the same terms as WebM:
      4 //  Software License Agreement:  http://www.webmproject.org/license/software/
      5 //  Additional IP Rights Grant:  http://www.webmproject.org/license/additional/
      6 // -----------------------------------------------------------------------------
      7 //
      8 // Lossless encoder: internal header.
      9 //
     10 // Author: Vikas Arora (vikaas.arora (at) gmail.com)
     11 
     12 #ifndef WEBP_ENC_VP8LI_H_
     13 #define WEBP_ENC_VP8LI_H_
     14 
     15 #include "./histogram.h"
     16 #include "../utils/bit_writer.h"
     17 #include "webp/encode.h"
     18 #include "webp/format_constants.h"
     19 
     20 #if defined(__cplusplus) || defined(c_plusplus)
     21 extern "C" {
     22 #endif
     23 
     24 typedef struct {
     25   const WebPConfig* config_;    // user configuration and parameters
     26   const WebPPicture* pic_;      // input picture.
     27 
     28   uint32_t* argb_;              // Transformed argb image data.
     29   uint32_t* argb_scratch_;      // Scratch memory for argb rows
     30                                 // (used for prediction).
     31   uint32_t* transform_data_;    // Scratch memory for transform data.
     32   int       current_width_;     // Corresponds to packed image width.
     33 
     34   // Encoding parameters derived from quality parameter.
     35   int histo_bits_;
     36   int transform_bits_;
     37   int cache_bits_;        // If equal to 0, don't use color cache.
     38 
     39   // Encoding parameters derived from image characteristics.
     40   int use_cross_color_;
     41   int use_subtract_green_;
     42   int use_predict_;
     43   int use_palette_;
     44   int palette_size_;
     45   uint32_t palette_[MAX_PALETTE_SIZE];
     46 } VP8LEncoder;
     47 
     48 //------------------------------------------------------------------------------
     49 // internal functions. Not public.
     50 
     51 // Encodes the picture.
     52 // Returns 0 if config or picture is NULL or picture doesn't have valid argb
     53 // input.
     54 int VP8LEncodeImage(const WebPConfig* const config,
     55                     const WebPPicture* const picture);
     56 
     57 // Encodes the main image stream using the supplied bit writer.
     58 WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
     59                                    const WebPPicture* const picture,
     60                                    VP8LBitWriter* const bw);
     61 
     62 //------------------------------------------------------------------------------
     63 
     64 #if defined(__cplusplus) || defined(c_plusplus)
     65 }    // extern "C"
     66 #endif
     67 
     68 #endif  /* WEBP_ENC_VP8LI_H_ */
     69