zstd icon indicating copy to clipboard operation
zstd copied to clipboard

Add Public API to Extract Sequences from Frame

Open felixhandte opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. We now have ZSTD_compressSequences(), which lets us go from sequences to a frame, but we do not have the reverse, a function that takes a frame and returns the sequences it's composed of.

Such a function would potentially be a useful analysis and debugging tool.

Describe the solution you'd like

size_t ZSTD_extractSequences(
    ZSTD_Sequence* seqs, size_t* seqsSize,
    void* literals, size_t* literalsSize,
    const void* src, size_t srcSize,
    ZSTD_sequenceFormat_e seqFormat);

or similar.

You could also eventually imagine a streaming version.

Describe alternatives you've considered We do have [ZSTD_generateSequences()], which you could use on a frame after decompressing it to generate new sequences for the same content. But that's not really the same thing.

Edit to add: we need to also provide a buffer into which the extracted literals can be placed.

felixhandte avatar Feb 27 '23 21:02 felixhandte