mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-15 21:39:59 +02:00
Move the HuffmanCost() function to dsp lib
This is to help further optimizations. (like in https://gerrit.chromium.org/gerrit/#/c/69787/) There's a small slowdown (~0.5% at -z 9 quality) due to function pointer usage. Note that, for speed, it's important to return VP8LStreaks by value, and not pass a pointer. Change-Id: Id4167366765fb7fc5dff89c1fd75dee456737000
This commit is contained in:
@ -139,14 +139,24 @@ static WEBP_INLINE float VP8LFastSLog2(int v) {
|
||||
// -----------------------------------------------------------------------------
|
||||
// Huffman-cost related functions.
|
||||
|
||||
typedef double (*VP8LCostFunc)(const int* const population, int length);
|
||||
typedef double (*VP8LCostCombinedFunc)(const int* const X,
|
||||
const int* const Y,
|
||||
int length);
|
||||
typedef double (*VP8LCostFunc)(const int* population, int length);
|
||||
typedef double (*VP8LCostCombinedFunc)(const int* X, const int* Y, int length);
|
||||
|
||||
extern VP8LCostFunc VP8LExtraCost;
|
||||
extern VP8LCostCombinedFunc VP8LExtraCostCombined;
|
||||
|
||||
typedef struct { // small struct to hold counters
|
||||
int counts[2]; // index: 0=zero steak, 1=non-zero streak
|
||||
int streaks[2][2]; // [zero/non-zero][streak<3 / streak>=3]
|
||||
} VP8LStreaks;
|
||||
|
||||
typedef VP8LStreaks (*VP8LCostCountFunc)(const int* population, int length);
|
||||
typedef VP8LStreaks (*VP8LCostCombinedCountFunc)(const int* X, const int* Y,
|
||||
int length);
|
||||
|
||||
extern VP8LCostCountFunc VP8LHuffmanCostCount;
|
||||
extern VP8LCostCombinedCountFunc VP8LHuffmanCostCombinedCount;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PrefixEncode()
|
||||
|
||||
|
Reference in New Issue
Block a user