mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
header clean-up
remove unused VP8LHistogramRemove function make HistogramEstimateBitsHeader static Change-Id: I0dc6a6f4c41d3c5f55a8153cd7d710c9f84582a7
This commit is contained in:
parent
8130c4cc64
commit
23d34f3142
@ -88,8 +88,7 @@ VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits) {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void VP8LConvertPopulationCountTableToBitEstimates(
|
void VP8LConvertPopulationCountTableToBitEstimates(
|
||||||
int num_symbols, const int* const population_counts,
|
int num_symbols, const int population_counts[], double output[]) {
|
||||||
double* const output) {
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
int nonzeros = 0;
|
int nonzeros = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -206,9 +205,6 @@ double VP8LHistogramEstimateBitsBulk(const VP8LHistogram* const p) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
double VP8LHistogramEstimateBits(const VP8LHistogram* const p) {
|
|
||||||
return VP8LHistogramEstimateBitsHeader(p) + VP8LHistogramEstimateBitsBulk(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the cost encode the rle-encoded entropy code.
|
// Returns the cost encode the rle-encoded entropy code.
|
||||||
// The constants in this function are experimental.
|
// The constants in this function are experimental.
|
||||||
@ -249,7 +245,8 @@ static double HuffmanCost(const int* const population, int length) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
double VP8LHistogramEstimateBitsHeader(const VP8LHistogram* const p) {
|
// Estimates the Huffman dictionary + other block overhead size.
|
||||||
|
static double HistogramEstimateBitsHeader(const VP8LHistogram* const p) {
|
||||||
return HuffmanCost(&p->alpha_[0], 256) +
|
return HuffmanCost(&p->alpha_[0], 256) +
|
||||||
HuffmanCost(&p->red_[0], 256) +
|
HuffmanCost(&p->red_[0], 256) +
|
||||||
HuffmanCost(&p->literal_[0], VP8LHistogramNumCodes(p)) +
|
HuffmanCost(&p->literal_[0], VP8LHistogramNumCodes(p)) +
|
||||||
@ -257,6 +254,10 @@ double VP8LHistogramEstimateBitsHeader(const VP8LHistogram* const p) {
|
|||||||
HuffmanCost(&p->distance_[0], NUM_DISTANCE_CODES);
|
HuffmanCost(&p->distance_[0], NUM_DISTANCE_CODES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double VP8LHistogramEstimateBits(const VP8LHistogram* const p) {
|
||||||
|
return HistogramEstimateBitsHeader(p) + VP8LHistogramEstimateBitsBulk(p);
|
||||||
|
}
|
||||||
|
|
||||||
static void HistogramBuildImage(int xsize, int histo_bits,
|
static void HistogramBuildImage(int xsize, int histo_bits,
|
||||||
const VP8LBackwardRefs* const backward_refs,
|
const VP8LBackwardRefs* const backward_refs,
|
||||||
VP8LHistogramSet* const image) {
|
VP8LHistogramSet* const image) {
|
||||||
|
@ -76,10 +76,6 @@ void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo,
|
|||||||
// approximately maps to.
|
// approximately maps to.
|
||||||
double VP8LHistogramEstimateBits(const VP8LHistogram* const p);
|
double VP8LHistogramEstimateBits(const VP8LHistogram* const p);
|
||||||
|
|
||||||
// This function estimates the Huffman dictionary + other block overhead
|
|
||||||
// size for creating a new deflate block.
|
|
||||||
double VP8LHistogramEstimateBitsHeader(const VP8LHistogram* const p);
|
|
||||||
|
|
||||||
// This function estimates the cost in bits excluding the bits needed to
|
// This function estimates the cost in bits excluding the bits needed to
|
||||||
// represent the entropy code itself.
|
// represent the entropy code itself.
|
||||||
double VP8LHistogramEstimateBitsBulk(const VP8LHistogram* const p);
|
double VP8LHistogramEstimateBitsBulk(const VP8LHistogram* const p);
|
||||||
@ -100,34 +96,13 @@ static WEBP_INLINE void VP8LHistogramAdd(VP8LHistogram* const p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WEBP_INLINE void VP8LHistogramRemove(VP8LHistogram* const p,
|
|
||||||
const VP8LHistogram* const a) {
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < PIX_OR_COPY_CODES_MAX; ++i) {
|
|
||||||
p->literal_[i] -= a->literal_[i];
|
|
||||||
assert(p->literal_[i] >= 0);
|
|
||||||
}
|
|
||||||
for (i = 0; i < NUM_DISTANCE_CODES; ++i) {
|
|
||||||
p->distance_[i] -= a->distance_[i];
|
|
||||||
assert(p->distance_[i] >= 0);
|
|
||||||
}
|
|
||||||
for (i = 0; i < 256; ++i) {
|
|
||||||
p->red_[i] -= a->red_[i];
|
|
||||||
p->blue_[i] -= a->blue_[i];
|
|
||||||
p->alpha_[i] -= a->alpha_[i];
|
|
||||||
assert(p->red_[i] >= 0);
|
|
||||||
assert(p->blue_[i] >= 0);
|
|
||||||
assert(p->alpha_[i] >= 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static WEBP_INLINE int VP8LHistogramNumCodes(const VP8LHistogram* const p) {
|
static WEBP_INLINE int VP8LHistogramNumCodes(const VP8LHistogram* const p) {
|
||||||
return 256 + NUM_LENGTH_CODES +
|
return 256 + NUM_LENGTH_CODES +
|
||||||
((p->palette_code_bits_ > 0) ? (1 << p->palette_code_bits_) : 0);
|
((p->palette_code_bits_ > 0) ? (1 << p->palette_code_bits_) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VP8LConvertPopulationCountTableToBitEstimates(
|
void VP8LConvertPopulationCountTableToBitEstimates(
|
||||||
int n, const int* const population_counts, double* const output);
|
int num_symbols, const int population_counts[], double output[]);
|
||||||
|
|
||||||
// Builds the histogram image.
|
// Builds the histogram image.
|
||||||
int VP8LGetHistoImageSymbols(int xsize, int ysize,
|
int VP8LGetHistoImageSymbols(int xsize, int ysize,
|
||||||
|
Loading…
Reference in New Issue
Block a user