Q- How to use a Prehistory buffer with deflateSetDictionary

I have a requirement that while doing raw deflate, zlib is provided with a prehistory buffer of 4KB to seed dictionary. The input Data CHUNK Size is also 4KB and prehistory needs to be used for each one of them, and every 4KB data from file is independently compressed. I have doubts about window size and where is Dictionary loaded in Window (at position 0) Following are some questions.

  1. Should my Window size here be 8KB [4KB for Prehistory + 4KB for history produced with Raw Data]
  2. Is it correct that while using deflateSetDictionary, the first 4KB of window will be loaded with Dictionary(pre-history) buffer and next 4KB in window will be filled as raw data is compressed

Read more here: https://stackoverflow.com/questions/68490655/q-how-to-use-a-prehistory-buffer-with-deflatesetdictionary

Content Attribution

This content was originally published by Bhanu at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: