}
-#define DISPLAYUPDATE(l, ...) if (g_displayLevel>=l) { \
- if (ZDICT_clockSpan(displayClock) > refreshRate) \
- { displayClock = clock(); DISPLAY(__VA_ARGS__); \
- if (g_displayLevel>=4) fflush(stdout); } }
-static const clock_t refreshRate = CLOCKS_PER_SEC * 3 / 10;
-
static size_t ZDICT_trainBuffer(dictItem* dictList, U32 dictListSize,
const void* const buffer, size_t bufferSize, /* buffer must end with noisy guard band */
const size_t* fileSizes, unsigned nbFiles,
U32* filePos = (U32*)malloc(nbFiles * sizeof(*filePos));
size_t result = 0;
clock_t displayClock = 0;
+ clock_t const refreshRate = CLOCKS_PER_SEC * 3 / 10;
+
+# define DISPLAYUPDATE(l, ...) if (g_displayLevel>=l) { \
+ if (ZDICT_clockSpan(displayClock) > refreshRate) \
+ { displayClock = clock(); DISPLAY(__VA_ARGS__); \
+ if (g_displayLevel>=4) fflush(stdout); } }
/* init */
DISPLAYLEVEL(2, "\r%70s\r", ""); /* clean display line */
The tree depth is 4, since its smallest element uses 4 bits.
Value `5` will not be listed, nor will values above `5`.
Values from `0` to `4` will be listed using `Weight` instead of `Number_of_Bits`.
-Weight formula is :
+Weight formula is :
```
Weight = Number_of_Bits ? (Max_Number_of_Bits + 1 - Number_of_Bits) : 0
```
_Codes_ are FSE compressed,
and interleaved with raw additional bits in the same bitstream.
-##### Literals length codes
+##### Literals length codes
Literals length codes are values ranging from `0` to `35` included.
They define lengths from 0 to 131071 bytes.
Dictionary format
-----------------
-`zstd` is compatible with "pure content" dictionaries, free of any format restriction.
+`zstd` is compatible with "raw content" dictionaries, free of any format restriction.
But dictionaries created by `zstd --train` follow a format, described here.
-__Pre-requisites__ : a dictionary has a known length,
+__Pre-requisites__ : a dictionary has a size,
defined either by a buffer limit, or a file size.
| `Magic_Number` | `Dictionary_ID` | `Entropy_Tables` | `Content` |
- high range : >= (2^31)
__`Entropy_Tables`__ : following the same format as a [compressed blocks].
- They are stored in following order :
- Huffman tables for literals, FSE table for offsets,
- FSE table for match lengths, and FSE table for literals lengths.
- It's finally followed by 3 offset values, populating recent offsets,
- stored in order, 4-bytes little-endian each, for a total of 12 bytes.
+ They are stored in following order :
+ Huffman tables for literals, FSE table for offsets,
+ FSE table for match lengths, and FSE table for literals lengths.
+ It's finally followed by 3 offset values, populating recent offsets,
+ stored in order, 4-bytes little-endian each, for a total of 12 bytes.
-__`Content`__ : Where the actual dictionary content is.
- Content size depends on Dictionary size.
+__`Content`__ : The rest of the dictionary is its content.
+ The content act as a "past" in front of data to compress or decompress.
[compressed blocks]: #the-format-of-compressed_block
Version changes
---------------
+- 0.2.1 : clarify field names, by Przemyslaw Skibinski
- 0.2.0 : numerous format adjustments for zstd v0.8
- 0.1.2 : limit Huffman tree depth to 11 bits
- 0.1.1 : reserved dictID ranges