mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
move MIN/MAX_HISTO_BITS to format_constants.h
(under the name MAX_HUFFMAN_BITS, since the specs read: int huffman_bits = ReadBits(3) + 2; ) Change-Id: Ifc66576bbd8e48518d3d78a3f515f851cf1883dc
This commit is contained in:
parent
8130c4cc64
commit
2a3ab6f925
@ -28,8 +28,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define PALETTE_KEY_RIGHT_SHIFT 22 // Key for 1K buffer.
|
#define PALETTE_KEY_RIGHT_SHIFT 22 // Key for 1K buffer.
|
||||||
#define MAX_HUFF_IMAGE_SIZE (16 * 1024 * 1024)
|
#define MAX_HUFF_IMAGE_SIZE (16 * 1024 * 1024)
|
||||||
#define MIN_HISTO_BITS 2
|
|
||||||
#define MAX_HISTO_BITS 9
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Palette
|
// Palette
|
||||||
@ -517,7 +515,8 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
|
|||||||
VP8LBackwardRefs refs;
|
VP8LBackwardRefs refs;
|
||||||
uint16_t* const histogram_symbols =
|
uint16_t* const histogram_symbols =
|
||||||
(uint16_t*)malloc(histogram_image_xysize * sizeof(*histogram_symbols));
|
(uint16_t*)malloc(histogram_image_xysize * sizeof(*histogram_symbols));
|
||||||
assert(histogram_bits >= MIN_HISTO_BITS && histogram_bits <= MAX_HISTO_BITS);
|
assert(histogram_bits >= MIN_HUFFMAN_BITS);
|
||||||
|
assert(histogram_bits <= MAX_HUFFMAN_BITS);
|
||||||
if (histogram_image == NULL || histogram_symbols == NULL) goto Error;
|
if (histogram_image == NULL || histogram_symbols == NULL) goto Error;
|
||||||
|
|
||||||
// Calculate backward references from ARGB image.
|
// Calculate backward references from ARGB image.
|
||||||
@ -894,8 +893,8 @@ static int GetHistoBits(const WebPConfig* const config,
|
|||||||
if (huff_image_size <= MAX_HUFF_IMAGE_SIZE) break;
|
if (huff_image_size <= MAX_HUFF_IMAGE_SIZE) break;
|
||||||
++histo_bits;
|
++histo_bits;
|
||||||
}
|
}
|
||||||
return (histo_bits < MIN_HISTO_BITS) ? MIN_HISTO_BITS :
|
return (histo_bits < MIN_HUFFMAN_BITS) ? MIN_HUFFMAN_BITS :
|
||||||
(histo_bits > MAX_HISTO_BITS) ? MAX_HISTO_BITS : histo_bits;
|
(histo_bits > MAX_HUFFMAN_BITS) ? MAX_HUFFMAN_BITS : histo_bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitEncParams(VP8LEncoder* const enc) {
|
static void InitEncParams(VP8LEncoder* const enc) {
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
#define NUM_DISTANCE_CODES 40
|
#define NUM_DISTANCE_CODES 40
|
||||||
#define CODE_LENGTH_CODES 19
|
#define CODE_LENGTH_CODES 19
|
||||||
|
|
||||||
|
#define MIN_HUFFMAN_BITS 2 // min number of Huffman bits
|
||||||
|
#define MAX_HUFFMAN_BITS 9 // max number of Huffman bits
|
||||||
|
|
||||||
#define TRANSFORM_PRESENT 1 // The bit to be written when next data
|
#define TRANSFORM_PRESENT 1 // The bit to be written when next data
|
||||||
// to be read is a transform.
|
// to be read is a transform.
|
||||||
#define NUM_TRANSFORMS 4 // Maximum number of allowed transform
|
#define NUM_TRANSFORMS 4 // Maximum number of allowed transform
|
||||||
|
Loading…
Reference in New Issue
Block a user