From: Yann Collet Date: Thu, 30 Jun 2016 15:05:42 +0000 (+0200) Subject: updated frame specification with recommended max window size X-Git-Tag: v0.7.2^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=406dcca98a12884e7267f8ee5b7649bfc0a9c882;p=thirdparty%2Fzstd.git updated frame specification with recommended max window size --- diff --git a/zstd_frame_format.md b/zstd_frame_format.md index d27b2c76d..61b5aef58 100644 --- a/zstd_frame_format.md +++ b/zstd_frame_format.md @@ -194,11 +194,11 @@ __WD byte__ (Window Descriptor) Provides guarantees on maximum back-reference distance that will be used within compressed data. -This information can then be used by decoder to allocate enough memory. +This information is useful for decoders to allocate enough memory. -| BitNb | 7-3 | 0-2 | -| ------- | -------- | -------- | -|FieldName| Exponent | Mantissa | +| BitNb | 7-3 | 0-2 | +| --------- | -------- | -------- | +| FieldName | Exponent | Mantissa | Maximum distance is given by the following formulae : ``` @@ -207,12 +207,18 @@ windowBase = 1 << windowLog; windowAdd = (windowBase / 8) * Mantissa; windowSize = windowBase + windowAdd; ``` +The minimum window size is 1 KB. +The maximum value is (15*(2^38))-1 bytes, which is almost 1.875 TB. + `WD` byte is optional. It's not present in `single segment` mode. +In which case, the maximum back-reference distance is the content size itself, which can be any value from 1 to 2^64-1 bytes (16 EB). -In order to preserve decoder from unreasonable memory requirement, +In order to preserve decoder from unreasonable memory requirements, a decoder can refuse a compressed frame which requests a memory size beyond decoder's authorized range. +For better interoperability, decoders are recommended to be compatible with window sizes up to 8 MB. Encoders are recommended to not request more than 8 MB. It's just a recommendation, decoders are free to accept or refuse larger or lower values. + __Frame Content Size__ This is the original (uncompressed) size.