| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef WEBP_ENC_VP8LI_ENC_H_ |
| 15 |
#define WEBP_ENC_VP8LI_ENC_H_ |
| 16 |
|
| 17 |
#ifdef HAVE_CONFIG_H |
| 18 |
#include "src/webp/config.h" |
| 19 |
#endif |
| 20 |
|
| 21 |
|
| 22 |
#ifndef WEBP_NEAR_LOSSLESS |
| 23 |
#define WEBP_NEAR_LOSSLESS 1 |
| 24 |
#endif |
| 25 |
|
| 26 |
#include "src/enc/backward_references_enc.h" |
| 27 |
#include "src/enc/histogram_enc.h" |
| 28 |
#include "src/utils/bit_writer_utils.h" |
| 29 |
#include "src/webp/encode.h" |
| 30 |
#include "src/webp/format_constants.h" |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
#define MAX_TRANSFORM_BITS 6 |
| 38 |
|
| 39 |
typedef enum { |
| 40 |
kEncoderNone = 0, |
| 41 |
kEncoderARGB, |
| 42 |
kEncoderNearLossless, |
| 43 |
kEncoderPalette |
| 44 |
} VP8LEncoderARGBContent; |
| 45 |
|
| 46 |
typedef struct { |
| 47 |
const WebPConfig* config_; |
| 48 |
const WebPPicture* pic_; |
| 49 |
|
| 50 |
uint32_t* argb_; |
| 51 |
VP8LEncoderARGBContent argb_content_; |
| 52 |
uint32_t* argb_scratch_; |
| 53 |
|
| 54 |
uint32_t* transform_data_; |
| 55 |
uint32_t* transform_mem_; |
| 56 |
size_t transform_mem_size_; |
| 57 |
|
| 58 |
int current_width_; |
| 59 |
|
| 60 |
|
| 61 |
int histo_bits_; |
| 62 |
int transform_bits_; |
| 63 |
int cache_bits_; |
| 64 |
|
| 65 |
|
| 66 |
int use_cross_color_; |
| 67 |
int use_subtract_green_; |
| 68 |
int use_predict_; |
| 69 |
int use_palette_; |
| 70 |
int palette_size_; |
| 71 |
uint32_t palette_[MAX_PALETTE_SIZE]; |
| 72 |
|
| 73 |
uint32_t palette_sorted_[MAX_PALETTE_SIZE]; |
| 74 |
|
| 75 |
|
| 76 |
struct VP8LBackwardRefs refs_[4]; |
| 77 |
VP8LHashChain hash_chain_; |
| 78 |
|
| 79 |
} VP8LEncoder; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
int VP8LEncodeImage(const WebPConfig* const config, |
| 88 |
const WebPPicture* const picture); |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
int VP8LEncodeStream(const WebPConfig* const config, |
| 93 |
const WebPPicture* const picture, VP8LBitWriter* const bw); |
| 94 |
|
| 95 |
#if (WEBP_NEAR_LOSSLESS == 1) |
| 96 |
|
| 97 |
|
| 98 |
int VP8ApplyNearLossless(const WebPPicture* const picture, int quality, |
| 99 |
uint32_t* const argb_dst); |
| 100 |
#endif |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
int VP8LResidualImage(int width, int height, int bits, int low_effort, |
| 108 |
uint32_t* const argb, uint32_t* const argb_scratch, |
| 109 |
uint32_t* const image, int near_lossless, int exact, |
| 110 |
int used_subtract_green, const WebPPicture* const pic, |
| 111 |
int percent_range, int* const percent); |
| 112 |
|
| 113 |
int VP8LColorSpaceTransform(int width, int height, int bits, int quality, |
| 114 |
uint32_t* const argb, uint32_t* image, |
| 115 |
const WebPPicture* const pic, int percent_range, |
| 116 |
int* const percent); |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
#ifdef __cplusplus |
| 121 |
} |
| 122 |
#endif |
| 123 |
|
| 124 |
#endif |