Vahag Chakhoyan
Vahag Chakhoyan

Reputation: 779

ZSTD equivalent of ZLIB deflateInit2 method

In a c++ project I have a function using deflateInit2 method of ZLIB.

ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
                                     int  level,
                                     int  method,
                                     int  windowBits,
                                     int  memLevel,
                                     int  strategy));

Now I am trying to find a similar functionality for ZSTD. For example the windowBits part is resolved by calling the

ZSTD_CCtx_setParameter(this->context, ZSTD_c_windowLog, windowBits);

methon of ZSTD. The strategy also has such an equivalent. The main question concerns memLevel. How to specify something like memLevel ZLIB parameter for ZSTD?

Upvotes: 1

Views: 200

Answers (1)

Henrique Bucher
Henrique Bucher

Reputation: 4474

Use the parameter ZSTD_c_jobSize as in

ZSTD_CCtx_setParameter(this->context,ZSTD_c_jobSize,maxSize);

Job size must be a minimum of overlap size, or ZSTDMT_JOBSIZE_MIN (= 512 KB), whichever is largest.

https://zstd.docsforge.com/dev/api/ZSTD_cParameter/#ZSTD_c_jobSize

Upvotes: 1

Related Questions