Franco Bosi
Franco Bosi

Reputation: 29

Deflate Format: differences between type blocks

I am currently trying to write a compressor and decompressor with the same purpose as the RFC Deflate specification.

I'm not able to understand the difference between how blocks are composed in the compression with fixed tables and dynamic tables. The file is processed by LZ77 generating (distance, length) + literal.

I am confused on the difference between fixed tables and the table we send in the dynamic mode, and how the two blocks use them to encode data.

I'm currently reading Data Compression: The Complete Reference. Any advice will be helpful.

Upvotes: 2

Views: 267

Answers (1)

Mark Adler
Mark Adler

Reputation: 112502

Since you are trying to compress, you would pick the smaller of the two. zlib's deflate computes what the size of a fixed block, a dynamic block, and a stored block would be, and emits the smallest of the three.

If you are encoding a fixed block, you encode using the fixed code for literal/lengths and distances. This code is provided in the RFC.

Upvotes: 1

Related Questions