</b><p> Same as ZSTD_compress_generic(),
but using only simple integral types as arguments.
Argument list is less expressive than ZSTD_{in,out}Buffer,
- but can be helpful for binders towards dynamic languages
+ but can be helpful for binders to dynamic languages
which have troubles handling structures containing memory pointers.
</p></pre><BR>
return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
}
+/*! ZSTDMT_initCStream_internal() :
+ * Private use only. Init streaming operation.
+ * expects params to be valid.
+ * must receive dict, or cdict, or none, but not both.
+ * @return : 0, or an error code */
+size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
+ const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
+ ZSTD_parameters params, unsigned long long pledgedSrcSize);
+
+
size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
ZSTD_outBuffer* output,
ZSTD_inBuffer* input,
if (cctx->compressionLevel != ZSTD_CLEVEL_CUSTOM)
params.cParams = ZSTD_getCParams(cctx->compressionLevel,
cctx->frameContentSize, 0 /* dictSize */);
- CHECK_F( ZSTD_resetCStream_internal(cctx, params, cctx->frameContentSize) );
+ if (cctx->nbThreads > 1) {
+ CHECK_F( ZSTDMT_initCStream_internal(cctx->mtctx, NULL, 0, cctx->cdict, params, cctx->frameContentSize) );
+ } else {
+ CHECK_F( ZSTD_resetCStream_internal(cctx, params, cctx->frameContentSize) );
+ } }
+
+ if (cctx->nbThreads > 1) {
+ DEBUGLOG(5, "starting ZSTDMT_compressStream_generic");
+ return ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp) ;
}
DEBUGLOG(5, "starting ZSTD_compressStream_generic");
CHECK_F( ZSTD_compressStream_generic(cctx, output, input, endOp) );
-
DEBUGLOG(5, "completing ZSTD_compress_generic");
return cctx->outBuffContentSize - cctx->outBuffFlushedSize; /* remaining to flush */
}
*dstPos = output.pos;
*srcPos = input.pos;
return cErr;
-
}
}
-static size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
- const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
- ZSTD_parameters params, unsigned long long pledgedSrcSize)
+size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
+ const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
+ ZSTD_parameters params, unsigned long long pledgedSrcSize)
{
/* params are supposed to be fully validated at this point */
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
return ZSTD_endStream(zcs->cctxPool->cctx[0], output);
return ZSTDMT_flushStream_internal(zcs, output, 1);
}
+
+size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
+ ZSTD_outBuffer* output,
+ ZSTD_inBuffer* input,
+ ZSTD_EndDirective endOp)
+{
+ CHECK_F (ZSTDMT_compressStream(mtctx, output, input));
+ switch(endOp)
+ {
+ case ZSTD_e_flush:
+ return ZSTDMT_flushStream(mtctx, output);
+ case ZSTD_e_end:
+ return ZSTDMT_endStream(mtctx, output);
+ case ZSTD_e_continue:
+ return 1;
+ default:
+ return ERROR(GENERIC);
+ }
+}
ZSTDLIB_API size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSDTMT_parameter parameter, unsigned value);
+/*! ZSTDMT_compressStream_generic() :
+ * Combines ZSTDMT_compressStream() with ZSTDMT_flushStream() or ZSTDMT_endStream()
+ * depending on flush directive
+ * @return : minimum amount of data still to be flushed
+ * 0 if fully flushed
+ * or an error code */
+ZSTDLIB_API size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
+ ZSTD_outBuffer* output,
+ ZSTD_inBuffer* input,
+ ZSTD_EndDirective endOp);
+
+
+
#if defined (__cplusplus)
}
#endif
* Same as ZSTD_compress_generic(),
* but using only simple integral types as arguments.
* Argument list is less expressive than ZSTD_{in,out}Buffer,
- * but can be helpful for binders towards dynamic languages
+ * but can be helpful for binders to dynamic languages
* which have troubles handling structures containing memory pointers.
*/
size_t ZSTD_compress_generic_simpleArgs (