93 * The function must be called typically after ZSTD_createCCtx() but __before ZSTDMT_init*() !__ |
93 * The function must be called typically after ZSTD_createCCtx() but __before ZSTDMT_init*() !__ |
94 * Parameters not explicitly reset by ZSTDMT_init*() remain the same in consecutive compression sessions. |
94 * Parameters not explicitly reset by ZSTDMT_init*() remain the same in consecutive compression sessions. |
95 * @return : 0, or an error code (which can be tested using ZSTD_isError()) */ |
95 * @return : 0, or an error code (which can be tested using ZSTD_isError()) */ |
96 ZSTDLIB_API size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter, unsigned value); |
96 ZSTDLIB_API size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter, unsigned value); |
97 |
97 |
|
98 /* ZSTDMT_getMTCtxParameter() : |
|
99 * Query the ZSTDMT_CCtx for a parameter value. |
|
100 * @return : 0, or an error code (which can be tested using ZSTD_isError()) */ |
|
101 ZSTDLIB_API size_t ZSTDMT_getMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter, unsigned* value); |
|
102 |
98 |
103 |
99 /*! ZSTDMT_compressStream_generic() : |
104 /*! ZSTDMT_compressStream_generic() : |
100 * Combines ZSTDMT_compressStream() with optional ZSTDMT_flushStream() or ZSTDMT_endStream() |
105 * Combines ZSTDMT_compressStream() with optional ZSTDMT_flushStream() or ZSTDMT_endStream() |
101 * depending on flush directive. |
106 * depending on flush directive. |
102 * @return : minimum amount of data still to be flushed |
107 * @return : minimum amount of data still to be flushed |
112 /* ======================================================== |
117 /* ======================================================== |
113 * === Private interface, for use by ZSTD_compress.c === |
118 * === Private interface, for use by ZSTD_compress.c === |
114 * === Not exposed in libzstd. Never invoke directly === |
119 * === Not exposed in libzstd. Never invoke directly === |
115 * ======================================================== */ |
120 * ======================================================== */ |
116 |
121 |
|
122 /*! ZSTDMT_toFlushNow() |
|
123 * Tell how many bytes are ready to be flushed immediately. |
|
124 * Probe the oldest active job (not yet entirely flushed) and check its output buffer. |
|
125 * If return 0, it means there is no active job, |
|
126 * or, it means oldest job is still active, but everything produced has been flushed so far, |
|
127 * therefore flushing is limited by speed of oldest job. */ |
|
128 size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx); |
|
129 |
|
130 /*! ZSTDMT_CCtxParam_setMTCtxParameter() |
|
131 * like ZSTDMT_setMTCtxParameter(), but into a ZSTD_CCtx_Params */ |
117 size_t ZSTDMT_CCtxParam_setMTCtxParameter(ZSTD_CCtx_params* params, ZSTDMT_parameter parameter, unsigned value); |
132 size_t ZSTDMT_CCtxParam_setMTCtxParameter(ZSTD_CCtx_params* params, ZSTDMT_parameter parameter, unsigned value); |
118 |
133 |
119 /* ZSTDMT_CCtxParam_setNbWorkers() |
134 /*! ZSTDMT_CCtxParam_setNbWorkers() |
120 * Set nbWorkers, and clamp it. |
135 * Set nbWorkers, and clamp it. |
121 * Also reset jobSize and overlapLog */ |
136 * Also reset jobSize and overlapLog */ |
122 size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers); |
137 size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers); |
123 |
138 |
124 /*! ZSTDMT_updateCParams_whileCompressing() : |
139 /*! ZSTDMT_updateCParams_whileCompressing() : |
125 * Updates only a selected set of compression parameters, to remain compatible with current frame. |
140 * Updates only a selected set of compression parameters, to remain compatible with current frame. |
126 * New parameters will be applied to next compression job. */ |
141 * New parameters will be applied to next compression job. */ |
127 void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams); |
142 void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams); |
128 |
143 |
129 /* ZSTDMT_getNbWorkers(): |
144 /*! ZSTDMT_getFrameProgression(): |
130 * @return nb threads currently active in mtctx. |
145 * tells how much data has been consumed (input) and produced (output) for current frame. |
131 * mtctx must be valid */ |
146 * able to count progression inside worker threads. |
132 unsigned ZSTDMT_getNbWorkers(const ZSTDMT_CCtx* mtctx); |
|
133 |
|
134 /* ZSTDMT_getFrameProgression(): |
|
135 * tells how much data has been consumed (input) and produced (output) for current frame. |
|
136 * able to count progression inside worker threads. |
|
137 */ |
147 */ |
138 ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx); |
148 ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx); |
139 |
149 |
140 |
150 |
141 /*! ZSTDMT_initCStream_internal() : |
151 /*! ZSTDMT_initCStream_internal() : |