Skip to content

Minimizing memory requirements for Decompression? #2093

@dciliske

Description

@dciliske

Main questions:

  • Does decompression require referencing previously used input data?
  • If it does not reference previous input data, is a working buffer (other than the destination) required when writing to a fully allocated output buffer, aka non-streaming mode?
  • If no additional working buffer is required, is there some way to perform a decompression using an input stream with a fixed output block?

Context:
I'm working on a new generation bootloader for an embedded device and would like to use zstd for image compression. Going through all the documentation and API, I feel like I'm in a bit of a hole. For context, I have two main blocks of memory I can use: main memory 2-32MB, and internal SRAM 32-512kB.

The image is read over a non-memory mapped serial stream. The destination, however, is a fixed block buffer.

What is unclear is whether the decompressor needs to reuse previously read input data. If it does not, then it should be possible to stream decompress without the intermediate window buffer.

I think I can solve my issue by doing an in-place decompression akin to how it is done in the Linux Kernel. However, there is a non-negligible performance penalty for this, as this potentially doubles the the bandwidth used for main memory, and introduces yet another copy-then-move operation on startup.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions