Lines Matching refs:ddict
43 const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict) in ZSTD_DDict_dictContent() argument
45 assert(ddict != NULL); in ZSTD_DDict_dictContent()
46 return ddict->dictContent; in ZSTD_DDict_dictContent()
49 size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict) in ZSTD_DDict_dictSize() argument
51 assert(ddict != NULL); in ZSTD_DDict_dictSize()
52 return ddict->dictSize; in ZSTD_DDict_dictSize()
55 void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) in ZSTD_copyDDictParameters() argument
59 assert(ddict != NULL); in ZSTD_copyDDictParameters()
60 dctx->dictID = ddict->dictID; in ZSTD_copyDDictParameters()
61 dctx->prefixStart = ddict->dictContent; in ZSTD_copyDDictParameters()
62 dctx->virtualStart = ddict->dictContent; in ZSTD_copyDDictParameters()
63 dctx->dictEnd = (const BYTE*)ddict->dictContent + ddict->dictSize; in ZSTD_copyDDictParameters()
69 if (ddict->entropyPresent) { in ZSTD_copyDDictParameters()
72 dctx->LLTptr = ddict->entropy.LLTable; in ZSTD_copyDDictParameters()
73 dctx->MLTptr = ddict->entropy.MLTable; in ZSTD_copyDDictParameters()
74 dctx->OFTptr = ddict->entropy.OFTable; in ZSTD_copyDDictParameters()
75 dctx->HUFptr = ddict->entropy.hufTable; in ZSTD_copyDDictParameters()
76 dctx->entropy.rep[0] = ddict->entropy.rep[0]; in ZSTD_copyDDictParameters()
77 dctx->entropy.rep[1] = ddict->entropy.rep[1]; in ZSTD_copyDDictParameters()
78 dctx->entropy.rep[2] = ddict->entropy.rep[2]; in ZSTD_copyDDictParameters()
87 ZSTD_loadEntropy_intoDDict(ZSTD_DDict* ddict, in ZSTD_loadEntropy_intoDDict() argument
90 ddict->dictID = 0; in ZSTD_loadEntropy_intoDDict()
91 ddict->entropyPresent = 0; in ZSTD_loadEntropy_intoDDict()
94 if (ddict->dictSize < 8) { in ZSTD_loadEntropy_intoDDict()
99 { U32 const magic = MEM_readLE32(ddict->dictContent); in ZSTD_loadEntropy_intoDDict()
106 ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE); in ZSTD_loadEntropy_intoDDict()
110 &ddict->entropy, ddict->dictContent, ddict->dictSize)), in ZSTD_loadEntropy_intoDDict()
112 ddict->entropyPresent = 1; in ZSTD_loadEntropy_intoDDict()
117 static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, in ZSTD_initDDict_internal() argument
123 ddict->dictBuffer = NULL; in ZSTD_initDDict_internal()
124 ddict->dictContent = dict; in ZSTD_initDDict_internal()
127 void* const internalBuffer = ZSTD_customMalloc(dictSize, ddict->cMem); in ZSTD_initDDict_internal()
128 ddict->dictBuffer = internalBuffer; in ZSTD_initDDict_internal()
129 ddict->dictContent = internalBuffer; in ZSTD_initDDict_internal()
133 ddict->dictSize = dictSize; in ZSTD_initDDict_internal()
134 …ddict->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endia… in ZSTD_initDDict_internal()
137 FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , ""); in ZSTD_initDDict_internal()
149 { ZSTD_DDict* const ddict = (ZSTD_DDict*) ZSTD_customMalloc(sizeof(ZSTD_DDict), customMem); in ZSTD_createDDict_advanced() local
150 if (ddict == NULL) return NULL; in ZSTD_createDDict_advanced()
151 ddict->cMem = customMem; in ZSTD_createDDict_advanced()
152 { size_t const initResult = ZSTD_initDDict_internal(ddict, in ZSTD_createDDict_advanced()
156 ZSTD_freeDDict(ddict); in ZSTD_createDDict_advanced()
159 return ddict; in ZSTD_createDDict_advanced()
192 ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer; in ZSTD_initStaticDDict() local
198 ZSTD_memcpy(ddict+1, dict, dictSize); /* local copy */ in ZSTD_initStaticDDict()
199 dict = ddict+1; in ZSTD_initStaticDDict()
201 if (ZSTD_isError( ZSTD_initDDict_internal(ddict, in ZSTD_initStaticDDict()
205 return ddict; in ZSTD_initStaticDDict()
209 size_t ZSTD_freeDDict(ZSTD_DDict* ddict) in ZSTD_freeDDict() argument
211 if (ddict==NULL) return 0; /* support free on NULL */ in ZSTD_freeDDict()
212 { ZSTD_customMem const cMem = ddict->cMem; in ZSTD_freeDDict()
213 ZSTD_customFree(ddict->dictBuffer, cMem); in ZSTD_freeDDict()
214 ZSTD_customFree(ddict, cMem); in ZSTD_freeDDict()
227 size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict) in ZSTD_sizeof_DDict() argument
229 if (ddict==NULL) return 0; /* support sizeof on NULL */ in ZSTD_sizeof_DDict()
230 return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ; in ZSTD_sizeof_DDict()
237 unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict) in ZSTD_getDictID_fromDDict() argument
239 if (ddict==NULL) return 0; in ZSTD_getDictID_fromDDict()
240 return ZSTD_getDictID_fromDict(ddict->dictContent, ddict->dictSize); in ZSTD_getDictID_fromDDict()