mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
histogram_enc: make VP8LGetHistogramSize static
This function is unused outside of histogram_enc.c. Change-Id: I527f54408383d0bc9d04878ca397a3d044b350de
This commit is contained in:
parent
cc7ff5459a
commit
fbd93896a6
@ -30,10 +30,18 @@
|
||||
// Maximum number of histograms allowed in greedy combining algorithm.
|
||||
#define MAX_HISTO_GREEDY 100
|
||||
|
||||
// Return the size of the histogram for a given cache_bits.
|
||||
static int GetHistogramSize(int cache_bits) {
|
||||
const int literal_size = VP8LHistogramNumCodes(cache_bits);
|
||||
const size_t total_size = sizeof(VP8LHistogram) + sizeof(int) * literal_size;
|
||||
assert(total_size <= (size_t)0x7fffffff);
|
||||
return (int)total_size;
|
||||
}
|
||||
|
||||
static void HistogramClear(VP8LHistogram* const p) {
|
||||
uint32_t* const literal = p->literal_;
|
||||
const int cache_bits = p->palette_code_bits_;
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
const int histo_size = GetHistogramSize(cache_bits);
|
||||
memset(p, 0, histo_size);
|
||||
p->palette_code_bits_ = cache_bits;
|
||||
p->literal_ = literal;
|
||||
@ -51,20 +59,13 @@ static void HistogramCopy(const VP8LHistogram* const src,
|
||||
uint32_t* const dst_literal = dst->literal_;
|
||||
const int dst_cache_bits = dst->palette_code_bits_;
|
||||
const int literal_size = VP8LHistogramNumCodes(dst_cache_bits);
|
||||
const int histo_size = VP8LGetHistogramSize(dst_cache_bits);
|
||||
const int histo_size = GetHistogramSize(dst_cache_bits);
|
||||
assert(src->palette_code_bits_ == dst_cache_bits);
|
||||
memcpy(dst, src, histo_size);
|
||||
dst->literal_ = dst_literal;
|
||||
memcpy(dst->literal_, src->literal_, literal_size * sizeof(*dst->literal_));
|
||||
}
|
||||
|
||||
int VP8LGetHistogramSize(int cache_bits) {
|
||||
const int literal_size = VP8LHistogramNumCodes(cache_bits);
|
||||
const size_t total_size = sizeof(VP8LHistogram) + sizeof(int) * literal_size;
|
||||
assert(total_size <= (size_t)0x7fffffff);
|
||||
return (int)total_size;
|
||||
}
|
||||
|
||||
void VP8LFreeHistogram(VP8LHistogram* const histo) {
|
||||
WebPSafeFree(histo);
|
||||
}
|
||||
@ -109,7 +110,7 @@ void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits,
|
||||
|
||||
VP8LHistogram* VP8LAllocateHistogram(int cache_bits) {
|
||||
VP8LHistogram* histo = NULL;
|
||||
const int total_size = VP8LGetHistogramSize(cache_bits);
|
||||
const int total_size = GetHistogramSize(cache_bits);
|
||||
uint8_t* const memory = (uint8_t*)WebPSafeMalloc(total_size, sizeof(*memory));
|
||||
if (memory == NULL) return NULL;
|
||||
histo = (VP8LHistogram*)memory;
|
||||
@ -123,7 +124,7 @@ VP8LHistogram* VP8LAllocateHistogram(int cache_bits) {
|
||||
static void HistogramSetResetPointers(VP8LHistogramSet* const set,
|
||||
int cache_bits) {
|
||||
int i;
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
const int histo_size = GetHistogramSize(cache_bits);
|
||||
uint8_t* memory = (uint8_t*) (set->histograms);
|
||||
memory += set->max_size * sizeof(*set->histograms);
|
||||
for (i = 0; i < set->max_size; ++i) {
|
||||
@ -137,7 +138,7 @@ static void HistogramSetResetPointers(VP8LHistogramSet* const set,
|
||||
|
||||
// Returns the total size of the VP8LHistogramSet.
|
||||
static size_t HistogramSetTotalSize(int size, int cache_bits) {
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
const int histo_size = GetHistogramSize(cache_bits);
|
||||
return (sizeof(VP8LHistogramSet) + size * (sizeof(VP8LHistogram*) +
|
||||
histo_size + WEBP_ALIGN_CST));
|
||||
}
|
||||
|
@ -64,9 +64,6 @@ void VP8LHistogramCreate(VP8LHistogram* const p,
|
||||
const VP8LBackwardRefs* const refs,
|
||||
int palette_code_bits);
|
||||
|
||||
// Return the size of the histogram for a given cache_bits.
|
||||
int VP8LGetHistogramSize(int cache_bits);
|
||||
|
||||
// Set the palette_code_bits and reset the stats.
|
||||
// If init_arrays is true, the arrays are also filled with 0's.
|
||||
void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits,
|
||||
|
Loading…
Reference in New Issue
Block a user