module

Hwaro::Content::Processors::WebpEncoder::Lossless

Constants

CHAIN_DEPTH = 32

Backward-reference search: hash-chain depth and window (pixels).

CODE_LENGTH_ORDER = {17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}

Code-length code symbols in the order their lengths are sent.

HASH_BITS = 16
MAX_MATCH = 4096
MIN_MATCH = 3
WINDOW = 1 << 18

Instance methods

encode(argb : Slice(UInt32), width : Int32, height : Int32, has_alpha : Bool) : Bytes

A VP8L chunk payload: header, subtract-green transform, one prefix-code group.

Source
encode_alpha(alpha : Bytes, width : Int32, height : Int32) : Bytes

An ALPH chunk payload: the alpha plane, through whichever prediction filter (none, horizontal, vertical, gradient) codes smallest, as the green channel of a header-less VP8L stream.

Source
huffman_lengths(freq : Array(Int32), limit : Int32) : Array(Int32)

Huffman code lengths no longer than limit: an over-long tree is rebuilt with rare symbols' counts raised until it fits (libwebp's approach). A lone symbol gets length 1.

Source

Nested types