From 406dcca98a12884e7267f8ee5b7649bfc0a9c882 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 30 Jun 2016 17:05:42 +0200 Subject: [PATCH] updated frame specification with recommended max window size --- zstd_frame_format.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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. -- 2.47.2