Lines Matching defs:dictionary
282 buffer_t dictionary = kBuffNull;
295 /* Create dictionary */
296 DISPLAYLEVEL(3, "creating dictionary for unit tests \n");
297 dictionary = FUZ_createDictionary(CNBuffer, CNBufferSize / 3, 16 KB, 48 KB);
298 if (!dictionary.start) {
299 DISPLAY("Error creating dictionary, aborting \n");
302 dictID = ZDICT_getDictID(dictionary.start, dictionary.filled);
1084 DISPLAYLEVEL(3, "test%3i : digested dictionary : ", testNb++);
1085 { ZSTD_CDict* const cdict = ZSTD_createCDict(dictionary.start, dictionary.filled, 1 /*byRef*/ );
1113 DISPLAYLEVEL(4, "test%3i : check Dictionary ID : ", testNb++);
1120 DISPLAYLEVEL(3, "test%3i : decompress %u bytes with digested dictionary : ", testNb++, (unsigned)CNBufferSize);
1121 { ZSTD_DDict* const ddict = ZSTD_createDDict(dictionary.start, dictionary.filled);
1153 DISPLAYLEVEL(3, "test%3i : dictionary source size and level : ", testNb++);
1158 CHECK_Z( ZSTD_DCtx_loadDictionary_byReference(dctx, dictionary.start, dictionary.filled) );
1160 ZSTD_CDict* const cdict = ZSTD_createCDict(dictionary.start, dictionary.filled, level);
1195 CHECK_Z( ZSTD_CCtx_loadDictionary(zc, dictionary.start, dictionary.filled) );
1198 DISPLAYLEVEL(3, "test%3i : ZSTD_decompressStream() with dictionary : ", testNb++);
1201 /* We should fail to decompress without a dictionary. */
1208 /* We should succeed to decompress with the dictionary. */
1210 CHECK_Z( ZSTD_DCtx_loadDictionary(dctx, dictionary.start, dictionary.filled) );
1216 /* The dictionary should persist across calls. */
1222 /* The dictionary should not be cleared by ZSTD_reset_session_only. */
1229 /* When we reset the context the dictionary is cleared. */
1240 DISPLAYLEVEL(3, "test%3i : ZSTD_resetDStream() with dictionary : ", testNb++);
1243 /* We should succeed to decompress with the dictionary. */
1245 CHECK_Z( ZSTD_DCtx_loadDictionary(dctx, dictionary.start, dictionary.filled) );
1251 /* The dictionary should not be cleared by ZSTD_resetDStream(). */
1258 /* The dictionary should be cleared by ZSTD_initDStream(). */
1272 ZSTD_DDict* ddict = ZSTD_createDDict(dictionary.start, dictionary.filled);
1304 CHECK_Z( ZSTD_DCtx_refPrefix_advanced(dctx, dictionary.start, dictionary.filled, ZSTD_dct_auto) );
1320 DISPLAYLEVEL(3, "test%3i : ZSTD_initDStream*() with dictionary : ", testNb++);
1323 ZSTD_DDict* ddict = ZSTD_createDDict(dictionary.start, dictionary.filled);
1325 /* We should succeed to decompress with the dictionary. */
1326 CHECK_Z( ZSTD_initDStream_usingDict(dctx, dictionary.start, dictionary.filled) );
1328 /* The dictionary should persist across calls. */
1345 { ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBufferSize, dictionary.filled);
1347 ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictionary.start, dictionary.filled, ZSTD_dlm_byRef, ZSTD_dct_auto, cParams, ZSTD_defaultCMem);
1371 dictionary : ", testNb++);
1373 if (!ZSTD_isError(r)) goto _output_error; /* must fail : dictionary not used */
1378 CHECK_Z( ZSTD_CCtx_refPrefix(zc, dictionary.start, dictionary.filled) );
1391 CHECK_Z( ZSTD_DCtx_refPrefix(zd, dictionary.start, dictionary.filled) );
1403 DISPLAYLEVEL(3, "test%3i : decompress without dictionary (should fail): ", testNb++);
1405 if (!ZSTD_isError(r)) goto _output_error; /* must fail : dictionary not used */
1421 DISPLAYLEVEL(3, "test%3i : decompress without dictionary (should work): ", testNb++);
1429 CHECK_Z( ZSTD_initCStream_advanced(zc, dictionary.start, dictionary.filled, params, 0 /* pledgedSrcSize==0 means "empty" when params.fParams.contentSizeFlag is set */) );
1496 /* Complex multithreading + dictionary test */
1505 DISPLAYLEVEL(3, "test%3i : compress %u bytes with multiple threads + dictionary : ", testNb++, (unsigned)srcSize);
1519 { ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, 4 KB, dictionary.filled); /* intentionally lies on estimatedSrcSize, to push cdict into targeting a small window size */
1520 ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictionary.start, dictionary.filled, ZSTD_dlm_byRef, ZSTD_dct_fullDict, cParams, ZSTD_defaultCMem);
1531 DISPLAYLEVEL(3, "test%3i : decompress large frame created from multiple threads + dictionary : ", testNb++);
1541 CHECK_Z( ZSTD_initDStream_usingDict(dstream, dictionary.start, dictionary.filled) );
1551 DISPLAYLEVEL(3, "test%3i : check dictionary FSE tables can represent every code : ", testNb++);
1563 cdict = ZSTD_createCDict_advanced(dictionary.start, dictionary.filled, ZSTD_dlm_byRef, ZSTD_dct_fullDict, cParams, ZSTD_defaultCMem);
1564 ddict = ZSTD_createDDict(dictionary.start, dictionary.filled);
1831 DISPLAYLEVEL(3, "test%3i : dictionary + uncompressible block + reusing tables checks offset table validity: ", testNb++);
1833 dictionary.start, dictionary.filled,
1835 ZSTD_getCParams(3, 0, dictionary.filled),
1861 memcpy(inbuf + inbufpos, (BYTE*)dictionary.start + 256, cursegmentlen);
1866 memcpy(inbuf + inbufpos, (BYTE*)dictionary.start + 128, cursegmentlen);
1872 ret = ZSTD_decompress_usingDict(zd, checkbuf, inbufsize, outbuf, ret, dictionary.start, dictionary.filled);
1884 DISPLAYLEVEL(3, "test%3i : dictionary + small blocks + reusing tables checks offset table validity: ", testNb++);
1886 dictionary.start, dictionary.filled,
1888 ZSTD_getCParams(3, 0, dictionary.filled),
1907 /* Write several very long offset matches into the dictionary */
1909 ZSTD_inBuffer in = {(BYTE*)dictionary.start + offset, 128, 0};
1915 CHECK_Z(ZSTD_decompress_usingDict(zd, decodedBuffer, CNBufferSize, out.dst, out.pos, dictionary.start, dictionary.filled));
2319 /* Generate large dictionary */
2516 FUZ_freeDictionary(dictionary);
2694 /* random dictionary selection */
2753 if (!dictSize /* don't reset if dictionary : could be different */ && (FUZ_rand(&lseed) & 1)) {
2797 CHECK_Z( ZSTD_initDStream(zd_noise) ); /* note : no dictionary */
2975 /* random dictionary selection */
2986 DISPLAYLEVEL(5, "t%u: with dictionary of size : %u \n", testNb, (unsigned)dictSize);
3192 if (!dictSize /* don't reset if dictionary : could be different */ && (FUZ_rand(&lseed) & 1)) {
3197 DISPLAYLEVEL(5, "using dictionary of size %u \n", (unsigned)dictSize);