mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-16 05:49:51 +02:00
Unify some entropy functions.
The code and logic is unified when computing bit entropy + Huffman cost. Speed-wise, we gain 8% for lossless encoding. Logic-wise, the beginning/end of the distributions are handled properly and the compression ratio does not change much. Change-Id: Ifa91d7d3e667c9a9a421faec4e845ecb6479a633
This commit is contained in:
@ -208,12 +208,9 @@ typedef struct { // small struct to hold counters
|
||||
int streaks[2][2]; // [zero/non-zero][streak<3 / streak>=3]
|
||||
} VP8LStreaks;
|
||||
|
||||
typedef VP8LStreaks (*VP8LCostCountFunc)(const uint32_t* population,
|
||||
int length);
|
||||
typedef VP8LStreaks (*VP8LCostCombinedCountFunc)(const uint32_t* X,
|
||||
const uint32_t* Y, int length);
|
||||
|
||||
extern VP8LCostCountFunc VP8LHuffmanCostCount;
|
||||
extern VP8LCostCombinedCountFunc VP8LHuffmanCostCombinedCount;
|
||||
|
||||
typedef struct { // small struct to hold bit entropy results
|
||||
@ -226,14 +223,28 @@ typedef struct { // small struct to hold bit entropy results
|
||||
|
||||
void VP8LBitEntropyInit(VP8LBitEntropy* const entropy);
|
||||
|
||||
// Get the combined symbol entropy for the distributions 'X' and 'Y'.
|
||||
// Get the combined symbol bit entropy and Huffman cost stats for the
|
||||
// distributions 'X' and 'Y'. Those results can then be refined according to
|
||||
// codec specific heuristics.
|
||||
void VP8LGetCombinedEntropyUnrefined(const uint32_t* const X,
|
||||
const uint32_t* const Y, int length,
|
||||
VP8LBitEntropy* bit_entropy,
|
||||
VP8LStreaks* stats);
|
||||
VP8LBitEntropy* const bit_entropy,
|
||||
VP8LStreaks* const stats);
|
||||
// Get the entropy for the distribution 'X'.
|
||||
void VP8LGetEntropyUnrefined(const uint32_t* const X, int length,
|
||||
VP8LBitEntropy* const bit_entropy,
|
||||
VP8LStreaks* const stats);
|
||||
|
||||
void VP8LBitsEntropyUnrefined(const uint32_t* const array, int n,
|
||||
VP8LBitEntropy* entropy);
|
||||
VP8LBitEntropy* const entropy);
|
||||
|
||||
typedef void (*GetEntropyUnrefinedHelperFunc)(uint32_t val, int i,
|
||||
uint32_t* const val_prev,
|
||||
int* const i_prev,
|
||||
VP8LBitEntropy* const bit_entropy,
|
||||
VP8LStreaks* const stats);
|
||||
// Internal function used by VP8LGet*EntropyUnrefined.
|
||||
extern GetEntropyUnrefinedHelperFunc VP8LGetEntropyUnrefinedHelper;
|
||||
|
||||
typedef void (*VP8LHistogramAddFunc)(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
|
Reference in New Issue
Block a user