123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #ifndef WEBP_ENC_HISTOGRAM_H_
- #define WEBP_ENC_HISTOGRAM_H_
- #include <string.h>
- #include "./backward_references_enc.h"
- #include "../webp/format_constants.h"
- #include "../webp/types.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define VP8L_NON_TRIVIAL_SYM (0xffffffff)
- typedef struct {
-
-
- uint32_t* literal_;
- uint32_t red_[NUM_LITERAL_CODES];
- uint32_t blue_[NUM_LITERAL_CODES];
- uint32_t alpha_[NUM_LITERAL_CODES];
-
- uint32_t distance_[NUM_DISTANCE_CODES];
- int palette_code_bits_;
- uint32_t trivial_symbol_;
-
- double bit_cost_;
- double literal_cost_;
- double red_cost_;
- double blue_cost_;
- } VP8LHistogram;
- typedef struct {
- int size;
- int max_size;
- VP8LHistogram** histograms;
- } VP8LHistogramSet;
- void VP8LHistogramCreate(VP8LHistogram* const p,
- const VP8LBackwardRefs* const refs,
- int palette_code_bits);
- int VP8LGetHistogramSize(int palette_code_bits);
- void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits);
- void VP8LHistogramStoreRefs(const VP8LBackwardRefs* const refs,
- VP8LHistogram* const histo);
- void VP8LFreeHistogram(VP8LHistogram* const histo);
- void VP8LFreeHistogramSet(VP8LHistogramSet* const histo);
- VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits);
- VP8LHistogram* VP8LAllocateHistogram(int cache_bits);
- void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo,
- const PixOrCopy* const v);
- static WEBP_INLINE int VP8LHistogramNumCodes(int palette_code_bits) {
- return NUM_LITERAL_CODES + NUM_LENGTH_CODES +
- ((palette_code_bits > 0) ? (1 << palette_code_bits) : 0);
- }
- int VP8LGetHistoImageSymbols(int xsize, int ysize,
- const VP8LBackwardRefs* const refs,
- int quality, int low_effort,
- int histogram_bits, int cache_bits,
- VP8LHistogramSet* const image_in,
- VP8LHistogramSet* const tmp_histos,
- uint16_t* const histogram_symbols);
- double VP8LBitsEntropy(const uint32_t* const array, int n,
- uint32_t* const trivial_symbol);
- double VP8LHistogramEstimateBits(const VP8LHistogram* const p);
- #ifdef __cplusplus
- }
- #endif
- #endif
|