/// Maximum size of the dynamic table. The maximum number of code structures is /// 1924, which is the sum of 1332 for literal/length codes and 592 for distance /// codes. These values were found by exhaustive searches using the program /// examples/enough.c found in the zlib distributions. The arguments to that /// program are the number of symbols, the initial root table size, and the /// maximum bit length of a code. "enough 286 10 15" for literal/length codes /// returns 1332, and "enough 30 9 15" for distance codes returns 592. /// The initial root table size (10 or 9) is found in the fifth argument of the /// inflate_table() calls in inflate.c and infback.c. If the root table size is /// changed, then these maximum sizes would be need to be recalculated and /// updated. #[allow(unused)] pub(crate) const ENOUGH: usize = ENOUGH_LENS + ENOUGH_DISTS; pub(crate) const ENOUGH_LENS: usize = 1332; pub(crate) const ENOUGH_DISTS: usize = 592;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pubenum DeflateFlush { #[default] /// if flush is set to `NoFlush`, that allows deflate to decide how much data /// to accumulate before producing output, in order to maximize compression.
NoFlush = 0,
/// If flush is set to `PartialFlush`, all pending output is flushed to the /// output buffer, but the output is not aligned to a byte boundary. All of the /// input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. /// This completes the current deflate block and follows it with an empty fixed /// codes block that is 10 bits long. This assures that enough bytes are output /// in order for the decompressor to finish the block before the empty fixed /// codes block.
PartialFlush = 1,
/// If the parameter flush is set to `SyncFlush`, all pending output is /// flushed to the output buffer and the output is aligned on a byte boundary, so /// that the decompressor can get all input data available so far. (In /// particular avail_in is zero after the call if enough output space has been /// provided before the call.) Flushing may degrade compression for some /// compression algorithms and so it should be used only when necessary. This /// completes the current deflate block and follows it with an empty stored block /// that is three bits plus filler bits to the next byte, followed by four bytes /// (00 00 ff ff).
SyncFlush = 2,
/// If flush is set to `FullFlush`, all output is flushed as with /// Z_SYNC_FLUSH, and the compression state is reset so that decompression can /// restart from this point if previous compressed data has been damaged or if /// random access is desired. Using `FullFlush` too often can seriously degrade /// compression.
FullFlush = 3,
/// If the parameter flush is set to `Finish`, pending input is processed, /// pending output is flushed and deflate returns with `StreamEnd` if there was /// enough output space. If deflate returns with `Ok` or `BufError`, this /// function must be called again with `Finish` and more output space (updated /// avail_out) but no more input data, until it returns with `StreamEnd` or an /// error. After deflate has returned `StreamEnd`, the only possible operations /// on the stream are deflateReset or deflateEnd. /// /// `Finish` can be used in the first deflate call after deflateInit if all the /// compression is to be done in a single step. In order to complete in one /// call, avail_out must be at least the value returned by deflateBound (see /// below). Then deflate is guaranteed to return `StreamEnd`. If not enough /// output space is provided, deflate will not return `StreamEnd`, and it must /// be called again as described above.
Finish = 4,
/// If flush is set to `Block`, a deflate block is completed and emitted, as /// for `SyncFlush`, but the output is not aligned on a byte boundary, and up to /// seven bits of the current block are held to be written as the next byte after /// the next deflate block is completed. In this case, the decompressor may not /// be provided enough bits at this point in order to complete decompression of /// the data provided so far to the compressor. It may need to wait for the next /// block to be emitted. This is for advanced applications that need to control /// the emission of deflate blocks.
Block = 5,
}
impl TryFrom<i32> for DeflateFlush { type Error = ();
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] pub(crate) struct Code { /// operation, extra bits, table bits pub op: u8, /// bits in this part of the code pub bits: u8, /// offset in table or code value pub val: u16,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.