UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
oodle2.h
Go to the documentation of this file.
1
2//===================================================
3// Oodle2 Core header
4// (C) Copyright 1994-2022 Epic Games Tools LLC
5//===================================================
6
7#ifndef __OODLE2_H_INCLUDED__
8#define __OODLE2_H_INCLUDED__
9
10#ifndef OODLE2_PUBLIC_HEADER
11#define OODLE2_PUBLIC_HEADER 1
12#endif
13
14#ifndef __OODLE2BASE_H_INCLUDED__
15#include "oodle2base.h"
16#endif
17
18#ifdef _MSC_VER
19#pragma pack(push, Oodle, 8)
20
21#pragma warning(push)
22#pragma warning(disable : 4127) // conditional is constant
23#endif
24
25// header version :
26// the DLL is incompatible when MAJOR is bumped
27// MINOR is for internal revs and bug fixes that don't affect API compatibility
28#define OODLE2_VERSION_MAJOR 9
29#define OODLE2_VERSION_MINOR 13
30
31// OodleVersion string is 1 . MAJOR . MINOR
32// don't make it from macros cuz the doc tool has to parse the string literal
33
34#define OodleVersion "2.9.13" /*
35*/
36
37//-----------------------------------------------------
38// OodleLZ
39
40#if 0
41#define OODLE_ALLOW_DEPRECATED_COMPRESSORS /* If you need to encode with the deprecated compressors, define this before including oodle2.h
42
43 You may still decode with them without defining this.
44*/
45#endif
46
47// Default verbosity selection of 0 will not even log when it sees corruption
48typedef enum OodleLZ_Verbosity
56/* Verbosity of LZ functions
57 LZ functions print information to the function set by $OodleCore_Plugins_SetPrintf
58 or $OodleXLog_Printf if using OodleX.
59*/
63typedef enum OodleLZ_Compressor
66 OodleLZ_Compressor_None = 3, // None = memcpy, pass through uncompressed bytes
67
68 // NEW COMPRESSORS :
69 OodleLZ_Compressor_Kraken = 8, // Fast decompression and high compression ratios, amazing!
70 OodleLZ_Compressor_Leviathan = 13,// Leviathan = Kraken's big brother with higher compression, slightly slower decompression.
71 OodleLZ_Compressor_Mermaid = 9, // Mermaid is between Kraken & Selkie - crazy fast, still decent compression.
72 OodleLZ_Compressor_Selkie = 11, // Selkie is a super-fast relative of Mermaid. For maximum decode speed.
73 OodleLZ_Compressor_Hydra = 12, // Hydra, the many-headed beast = Leviathan, Kraken, Mermaid, or Selkie (see $OodleLZ_About_Hydra)
74
75#ifdef OODLE_ALLOW_DEPRECATED_COMPRESSORS
76 OodleLZ_Compressor_BitKnit = 10, // no longer supported as of Oodle 2.9.0
77 OodleLZ_Compressor_LZB16 = 4, // DEPRECATED but still supported
78 OodleLZ_Compressor_LZNA = 7, // no longer supported as of Oodle 2.9.0
79 OodleLZ_Compressor_LZH = 0, // no longer supported as of Oodle 2.9.0
80 OodleLZ_Compressor_LZHLW = 1, // no longer supported as of Oodle 2.9.0
81 OodleLZ_Compressor_LZNIB = 2, // no longer supported as of Oodle 2.9.0
82 OodleLZ_Compressor_LZBLW = 5, // no longer supported as of Oodle 2.9.0
83 OodleLZ_Compressor_LZA = 6, // no longer supported as of Oodle 2.9.0
84#endif
89/* Selection of compression algorithm.
90
91 Each compressor provides a different balance of speed vs compression ratio.
92
93 New Oodle users should only use the new sea monster family of compressors.
94
95 The OODLE_ALLOW_DEPRECATED_COMPRESSORS set of compressors is no longer supported
96 as of Oodle 2.9.0 ; see $Oodle_FAQ_deprecated_compressors
97
98 The sea monsters are all fuzz safe and use whole-block quantum (not the 16k quantum)
99 ($OodleLZ_Compressor_UsesWholeBlockQuantum)
100
101 If you need to encode the deprecated compressors, define $OODLE_ALLOW_DEPRECATED_COMPRESSORS before
102 including oodle2.h
103
104 See $Oodle_FAQ_WhichLZ for a quick FAQ on which compressor to use
105
106 See $OodleLZ_About for discussion of how to choose a compressor.
107*/
117/* Bool enum
118*/
126/* Bool enum for the LZ decoder - should it check CRC before decoding or not?
127
128 NOTE : the CRC's in the LZH decompress checks are the CRC's of the *compressed* bytes. This allows checking the CRc
129 prior to decompression, so corrupted data cannot be fed to the compressor.
130
131 To use OodleLZ_CheckCRC_Yes, the compressed data must have been made with $(OodleLZ_CompressOptions:sendQuantumCRCs) set to true.
132
133 If you want a CRC of the raw bytes, there is one optionally stored in the $OodleLZ_SeekTable and can be confirmed with
134 $OodleLZ_CheckSeekTableCRCs
135*/
136
138typedef enum OodleLZ_Profile
140 OodleLZ_Profile_Main=0, // Main profile (all current features allowed)
141 OodleLZ_Profile_Reduced=1, // Reduced profile (Kraken only, limited feature set)
144/* Decode profile to target */
145
146// Not flagged for idoc and done using a #define since it's internal (testing) use only
147#define OodleLZ_Profile_Internal_Custom ((OodleLZ_Profile)100)
149OO_COMPILER_ASSERT( sizeof(OodleLZ_Profile) == 4 );
158/* Return value for $OodleDecompressCallback
159 return OodleDecompressCallbackRet_Cancel to abort the in-progress decompression
160*/
163/* User-provided callback for decompression
164
165 $:userdata the data you passed for _pcbData_
166 $:rawBuf the decompressed buffer
167 $:rawLen the total decompressed length
168 $:compBuf the compressed buffer
169 $:compBufferSize the total compressed length
170 $:rawDone number of bytes in rawBuf decompressed so far
171 $:compUsed number of bytes in compBuf consumed so far
172
173 OodleDecompressCallback is called incrementally during decompression.
174*/
176typedef enum OodleLZ_CompressionLevel
178 OodleLZ_CompressionLevel_None=0, // don't compress, just copy raw bytes
179 OodleLZ_CompressionLevel_SuperFast=1, // super fast mode, lower compression ratio
180 OodleLZ_CompressionLevel_VeryFast=2, // fastest LZ mode with still decent compression ratio
181 OodleLZ_CompressionLevel_Fast=3, // fast - good for daily use
182 OodleLZ_CompressionLevel_Normal=4, // standard medium speed LZ mode
184 OodleLZ_CompressionLevel_Optimal1=5, // optimal parse level 1 (faster optimal encoder)
185 OodleLZ_CompressionLevel_Optimal2=6, // optimal parse level 2 (recommended baseline optimal encoder)
186 OodleLZ_CompressionLevel_Optimal3=7, // optimal parse level 3 (slower optimal encoder)
187 OodleLZ_CompressionLevel_Optimal4=8, // optimal parse level 4 (very slow optimal encoder)
188 OodleLZ_CompressionLevel_Optimal5=9, // optimal parse level 5 (don't care about encode speed, maximum compression)
190 OodleLZ_CompressionLevel_HyperFast1=-1, // faster than SuperFast, less compression
191 OodleLZ_CompressionLevel_HyperFast2=-2, // faster than HyperFast1, less compression
192 OodleLZ_CompressionLevel_HyperFast3=-3, // faster than HyperFast2, less compression
193 OodleLZ_CompressionLevel_HyperFast4=-4, // fastest, less compression
194
195 // aliases :
204/* Selection of compression encoder complexity
205
206 Higher numerical value of CompressionLevel = slower compression, but smaller compressed data.
207
208 The compressed stream is always decodable with the same decompressors.
209 CompressionLevel controls the amount of work the encoder does to find the best compressed bit stream.
210 CompressionLevel does not primary affect decode speed, it trades off encode speed for compressed bit stream quality.
211
212 I recommend starting with OodleLZ_CompressionLevel_Normal, then try up or down if you want
213 faster encoding or smaller output files.
214
215 The Optimal levels are good for distribution when you compress rarely and decompress often;
216 they provide very high compression ratios but are slow to encode. Optimal2 is the recommended level
217 to start with of the optimal levels.
218 Optimal4 and 5 are not recommended for common use, they are very slow and provide the maximum compression ratio,
219 but the gain over Optimal3 is usually small.
220
221 The HyperFast levels have negative numeric CompressionLevel values.
222 They are faster than SuperFast for when you're encoder CPU time constrained or want
223 something closer to symmetric compression vs. decompression time.
224 The HyperFast levels are currently only available in Kraken, Mermaid & Selkie.
225 Higher levels of HyperFast are faster to encode, eg. HyperFast4 is the fastest.
226
227 The CompressionLevel does not affect decode speed much. Higher compression level does not mean
228 slower to decode. To trade off decode speed vs ratio, use _spaceSpeedTradeoffBytes_ in $OodleLZ_CompressOptions
229
230*/
234typedef enum OodleLZ_Jobify
236 OodleLZ_Jobify_Default=0, // Use compressor default for level of internal job usage
237 OodleLZ_Jobify_Disable=1, // Don't use jobs at all
238 OodleLZ_Jobify_Normal=2, // Try to balance parallelism with increased memory usage
239 OodleLZ_Jobify_Aggressive=3, // Maximize parallelism even when doing so requires large amounts of memory
244/* Controls the amount of internal threading in $OodleLZ_Compress calls
245
246 Once you install a pluggable job system via $OodleCore_Plugins_SetJobSystem, Oodle can internally break
247 heavy-weight compression tasks into smaller jobs that can run in parallel. This can speed up
248 compression of large blocks of data at Optimal1 and higher levels substantially.
249
250 The trade-off is that running more jobs concurrently rather than sequentially can greatly increase
251 memory requirements when there are multiple outstanding memory-intensive jobs.
252
253 OodleLZ_Jobify_Default lets the compressor decide; typically compressors will default to "Normal"
254 when a pluggable job system has been installed, and "Disable" otherwise.
255
256 OodleLZ_Jobify_Disable disables use of internal jobs entirely; all compression work is done on
257 the calling thread. This minimizes the amount of memory used, and is also appropriate when you're
258 getting parallelism in other ways, e.g. by running OodleLZ_Compress on many threads yourself.
259
260 OodleLZ_Jobify_Normal uses jobs to increase compressor parallelism and speeds up compression of
261 large blocks of data, but avoids handing out many concurrent jobs for tasks that are memory-intensive.
262
263 OodleLZ_Jobify_Aggressive will use concurrent jobs even for highly memory-intensive tasks. This
264 can speed up things further, but at a potentially significant increase in the amount of memory used
265 by Oodle.
266
267*/
269#define OODLELZ_LOCALDICTIONARYSIZE_MAX (1<<30) /* Maximum value of maxLocalDictionarySize in OodleLZ_CompressOptions
271
272#define OODLELZ_SPACESPEEDTRADEOFFBYTES_DEFAULT (256) /* Default value of spaceSpeedTradeoffBytes in OodleLZ_CompressOptions
273 Changes how the encoder makes decisions in the bit stream
274 Higher spaceSpeedTradeoffBytes favors decode speed more (larger compressed files)
275 Lower spaceSpeedTradeoffBytes favors smaller compressed files (slower decoder)
276 Goes in a power of 2 scale; so try 64,128 and 512,1024
277 (OODLELZ_SPACESPEEDTRADEOFFBYTES_DEFAULT/2) or (OODLELZ_SPACESPEEDTRADEOFFBYTES_DEFAULT*2)
283 OO_U32 unused_was_verbosity; // unused ; was verbosity (set to zero)
284 OO_S32 minMatchLen; // minimum match length ; cannot be used to reduce a compressor's default MML, but can be higher. On some types of data, a large MML (6 or 8) is a space-speed win.
285 OO_BOOL seekChunkReset; // whether chunks should be independent, for seeking and parallelism
286 OO_S32 seekChunkLen; // length of independent seek chunks (if seekChunkReset) ; must be a power of 2 and >= $OODLELZ_BLOCK_LEN ; you can use $OodleLZ_MakeSeekChunkLen
287 OodleLZ_Profile profile; // decoder profile to target (set to zero)
288 OO_S32 dictionarySize; // sets a maximum offset for matches, if lower than the maximum the format supports. <= 0 means infinite (use whole buffer). Often power of 2 but doesn't have to be.
289 OO_S32 spaceSpeedTradeoffBytes; // this is a number of bytes; I must gain at least this many bytes of compressed size to accept a speed-decreasing decision
290 OO_S32 unused_was_maxHuffmansPerChunk; // unused ; was maxHuffmansPerChunk
291 OO_BOOL sendQuantumCRCs; // should the encoder send a CRC of each compressed quantum, for integrity checks; this is necessary if you want to use OodleLZ_CheckCRC_Yes on decode
292 OO_S32 maxLocalDictionarySize; // (Optimals) size of local dictionary before needing a long range matcher. This does not set a window size for the decoder; it's useful to limit memory use and time taken in the encoder. maxLocalDictionarySize must be a power of 2. Must be <= OODLELZ_LOCALDICTIONARYSIZE_MAX
293 OO_BOOL makeLongRangeMatcher; // (Optimals) should the encoder find matches beyond maxLocalDictionarySize using an LRM
294 OO_S32 matchTableSizeLog2; //(non-Optimals) when variable, sets the size of the match finder structure (often a hash table) ; use 0 for the compressor's default
295
296 OodleLZ_Jobify jobify; // controls internal job usage by compressors
297 void * jobifyUserPtr; // user pointer passed through to RunJob and WaitJob callbacks
298
299 OO_S32 farMatchMinLen; // far matches must be at least this len
300 OO_S32 farMatchOffsetLog2; // if not zero, the log2 of an offset that must meet farMatchMinLen
301
302 OO_U32 reserved[4]; // reserved space for adding more options; zero these!
304/* Options for the compressor
305
306 Typically filled by calling $OodleLZ_CompressOptions_GetDefault , then individual options may be modified, like :
307
308 OodleLZ_CompressOptions my_options = *OodleLZ_CompressOptions_GetDefault()
309
310 To ensure you have set up the options correctly, call $OodleLZ_CompressOptions_Validate.
311
312 _unused_was_verbosity_ : place holder, set to zero
313
314 _minMatchLen_ : rarely useful. Default value of 0 means let the compressor decide. On some types of data,
315 bumping this up to 4,6, or 8 can improve decode speed with little effect on compression ratio. Most of the
316 Oodle compressors use a default MML of 4 at levels below 7, and MML 3 at levels >= 7. If you want to keep MML 4
317 at the higher levels, set _minMatchLen_ here to 4. _minMatchLen_ cannot be used to reduce the base MML of the compressor, only to increase it.
318
319 _seekChunkReset_ must be true if you want the decode to be able to run "Wide", with pieces that can be
320 decoded independently (not keeping previous pieces in memory for match references).
321
322 _seekChunkLen_ : length of independent seek chunks (if seekChunkReset) ; must be a power of 2 and >= $OODLELZ_BLOCK_LEN ; you can use $OodleLZ_MakeSeekChunkLen
323
324 _profile_ : tells the encoder to target alternate bitstream profile. Default value of zero for normal use.
325
326 _dictionarySize_ : limits the encoder to partial buffer access for matches. Can be useful for decoding incrementally
327 without keeping the entire output buffer in memory.
328
329 _spaceSpeedTradeoffBytes_ is a way to trade off compression ratio for decode speed. If you make it smaller,
330 you get more compression ratio and slower decodes. It's the number of bytes that a decision must save to
331 be worth a slower decode. Default is 256 (OODLELZ_SPACESPEEDTRADEOFFBYTES_DEFAULT). So that means the encoder must be able to save >= 256 bytes to
332 accept something that will slow down decoding (like adding another Huffman table). The typical range is
333 64-1024.
334
335 Lower _spaceSpeedTradeoffBytes_ = more compression, slower decode
336 Higher _spaceSpeedTradeoffBytes_ = less compression, faster decode
337
338 _spaceSpeedTradeoffBytes_ is the primary parameter for controlling Hydra. The default value of 256 will make
339 Hydra decodes that are just a little bit faster than Kraken. You get Kraken speeds around 200, and Mermaid
340 speeds around 1200.
341
342 At the extreme, a _spaceSpeedTradeoffBytes_ of zero would mean all you care about is compression ratio, not decode
343 speed, you want the encoder to make the smallest possible output. (you cannot actually set zero, as zero values
344 always mean "use default" in this struct; you never really want zero anyway)
345 Generally _spaceSpeedTradeoffBytes_ below 16 provides diminishing gains in size with pointless decode speed loss.
346
347 _spaceSpeedTradeoffBytes_ is on sort of powers of 2 scale, so you might want to experiment with 32,64,128,256,512
348
349 _spaceSpeedTradeoffBytes_ outside the range [16 - 2048] is not recommended.
350
351 _unused_was_maxHuffmansPerChunk_ : place holder, set to zero
352
353 _sendQuantumCRCs_ : send hashes of the compressed data to verify in the decoder; not recommended, if you need data
354 verification, use your own system outside of Oodle. DEPRECATED, not recommended. For backwards compatibility only.
355
356 _maxLocalDictionarySize_ : only applies to optimal parsers at level >= Optimal2. This limits the encoder memory use.
357 Making it larger = more compression, higher memory use. Matches within maxLocalDictionarySize are found exactly,
358 outside the maxLocalDictionarySize window an approximate long range matcher is used.
359
360 _makeLongRangeMatcher_ : whether an LRM should be used to find matches outside the _maxLocalDictionarySize_ window
361 (Optimal levels only)
362
363 _matchTableSizeLog2_ : for non-optimal levels (level <= Normal), controls the hash table size. Making this very
364 small can sometimes boost encoder speed. For the very fastest encoding, use the SuperFast level and change
365 _matchTableSizeLog2_ to 12 or 13.
366
367 _matchTableSizeLog2_ should usually be left zero to use the encoder's default
368
369 _matchTableSizeLog2_ allows you to limit memory use of the non-Optimal encoder levels. Memory use is roughly
370 ( 1 MB + 4 << matchTableSizeLog2 )
371
372 _jobify_ tells compressors how to use internal jobs for compression tasks. Jobs can be run in parallel using the
373 job system plugins set with $OodleCore_Plugins_SetJobSystem. Not all compressors or compression level support
374 jobs, but the slower ones generally do. The default value of jobify is to use a thread system if one is installed.
375
376 _farMatchMinLen_ and _farMatchOffsetLog2_ can be used to tune the encoded stream for a known cache size on the
377 decoding hardware. If set, then offsets with log2 greater or each to _farMatchOffsetLog2_ must have a minimum
378 length of _farMatchMinLen_. For example to target a machine with a 2 MB cache, set _farMatchOffsetLog2_ to 21,
379 and _farMatchMinLen_ to something large, like 16 or 20.
380
381 Without _farMatchMinLen_ and _farMatchOffsetLog2_ set, the Oodle encoders tune for a blend of cache sizes that works
382 well on most machines. _dictionarySize_ can also be used to tune for cache size, but cuts off all matches
383 beyond a certain distance. That may be more appropriate when you don't want to go out of cache at all.
384 _farMatchMinLen_ can only be used to make the standard blend target more restrictive; it can reduce the target cache size
385 but can't make it larger (or it can raise min match len outside cache but can't make it shorter).
386
387 For help on setting up OodleLZ_CompressOptions contact support at oodle@radgametools.com
388
389 NOTE : fields you do not set should always be zero initialized. In particular the _reserved_ fields should be zeroed.
390 Zero always means "use default" and is a future-portable initialization value.
392 If you set fields to zero to mean "use default" you can call $OodleLZ_CompressOptions_Validate to change them
393 to default values. This is done automatically internally if you don't do it explicitly.
394
396
398{
404/* ThreadPhase for threaded Oodle decode
406 Check $OodleLZ_Compressor_CanDecodeThreadPhased
407 (currently only used by Kraken)
408
409 See $OodleLZ_About_ThreadPhasedDecode
410
411*/
412
413typedef enum OodleLZ_FuzzSafe
414{
418/* OodleLZ_FuzzSafe (deprecated)
419
420 About fuzz safety:
421
422 Fuzz Safe decodes will not crash on corrupt data. They may or may not return failure, and produce garbage output.
423
424 Fuzz safe decodes will not read out of bounds. They won't put data on the stack or previously in memory
425 into the output buffer.
427 As of Oodle 2.9.0 all compressors supported are fuzzsafe, so OodleLZ_FuzzSafe_Yes should always be used and this
428 enum is deprecated.
430*/
431
432#define OODLELZ_BLOCK_LEN (1<<18) /* The number of raw bytes per "seek chunk"
433 Seek chunks can be decompressed independently if $(OodleLZ_CompressOptions:seekChunkReset) is set.
435
436#define OODLELZ_BLOCK_MAXIMUM_EXPANSION (2)
437#define OODLELZ_BLOCK_MAX_COMPLEN (OODLELZ_BLOCK_LEN+OODLELZ_BLOCK_MAXIMUM_EXPANSION) /* Maximum expansion per $OODLELZ_BLOCK_LEN is 1 byte.
438 Note that the compressed buffer must be allocated bigger than this (use $OodleLZ_GetCompressedBufferSizeNeeded)
440
441#define OODLELZ_QUANTUM_LEN (1<<14) /* Minimum decompression quantum (for old legacy codecs only)
443 Deprecated.
444
445 The new sea monster family of compressors use a whole block quantum (OODLELZ_BLOCK_LEN).
446 Check $OodleLZ_Compressor_UsesWholeBlockQuantum
447*/
448
449// 5 byte expansion per-quantum with CRC's
450#define OODLELZ_QUANTUM_MAXIMUM_EXPANSION (5)
451
452#define OODLELZ_QUANTUM_MAX_COMPLEN (OODLELZ_QUANTUM_LEN+OODLELZ_QUANTUM_MAXIMUM_EXPANSION)
453
454#define OODLELZ_SEEKCHUNKLEN_MIN OODLELZ_BLOCK_LEN
455#define OODLELZ_SEEKCHUNKLEN_MAX (1<<29) // half GB
456
459 OO_S32 decodedCount; // number of uncompressed bytes decoded
460 OO_S32 compBufUsed; // number of compressed bytes consumed
462
463 OO_S32 curQuantumRawLen; // tells you the current quantum size. you must have at least this much room available in the output buffer to be able to decode anything.
464 OO_S32 curQuantumCompLen; // if you didn't pass in enough data, nothing will decode (decodedCount will be 0), and this will tell you how much is needed
466/* Output value of $OodleLZDecoder_DecodeSome
468
469//---------------------------------------------
471//=======================================================
474{
475 OodleLZ_Compressor compressor; // which compressor was used
476 OO_BOOL seekChunksIndependent; // are the seek chunks independent, or must they be decompressed in sequence
477
478 OO_S64 totalRawLen; // total uncompressed data lenth
479 OO_S64 totalCompLen; // sum of seekChunkCompLens
481 OO_S32 numSeekChunks; // derived from rawLen & seekChunkLen
482 OO_S32 seekChunkLen; // multiple of OODLELZ_BLOCK_LEN
484 OO_U32 * seekChunkCompLens; // array of compressed lengths of seek chunks
485 OO_U32 * rawCRCs; // crc of the raw bytes of the chunk (optional; NULL unless $OodleLZSeekTable_Flags_MakeRawCRCs was specified)
489{
491 OodleLZSeekTable_Flags_MakeRawCRCs = 1, // make the _rawCRCs_ member of $OodleLZ_SeekTable
494
495//=====================================================
496
497
499{
500 OO_S32 m_OodleLZ_LW_LRM_step; // LZHLW LRM : bytes between LRM entries
501 OO_S32 m_OodleLZ_LW_LRM_hashLength; // LZHLW LRM : bytes hashed for each LRM entries
502 OO_S32 m_OodleLZ_LW_LRM_jumpbits; // LZHLW LRM : bits of hash used for jump table
503
504 OO_S32 m_OodleLZ_Decoder_Max_Stack_Size; // if OodleLZ_Decompress needs to allocator a Decoder object, and it's smaller than this size, it's put on the stack instead of the heap
506 OO_S32 m_OodleLZ_BackwardsCompatible_MajorVersion; // if you need to encode streams that can be read with an older version of Oodle, set this to the Oodle2 MAJOR version number that you need compatibility with. eg to be compatible with oodle 2.7.3 you would put 7 here
507
508 OO_U32 m_oodle_header_version; // = OODLE_HEADER_VERSION
509
511/* OodleConfigValues
512
513 Struct of user-settable low level config values. See $Oodle_SetConfigValues.
514
515 May have different defaults per platform.
516*/
517
519/* Get $OodleConfigValues
520
521 $:ptr filled with OodleConfigValues
522
523 Gets the current $OodleConfigValues.
525 May be different per platform.
529/* Set $OodleConfigValues
530
531 $:ptr your desired OodleConfigValues
533 Sets the global $OodleConfigValues from your struct.
534
535 You should call $Oodle_GetConfigValues to fill the struct, then change the values you
536 want to change, then call $Oodle_SetConfigValues.
537
538 This should generally be done before doing anything with Oodle (eg. even before OodleX_Init).
539 Changing OodleConfigValues after Oodle has started has undefined effects.
540*/
541
542typedef enum Oodle_UsageWarnings
543{
548/* Whether Oodle usage warnings are enable or disabled. */
549
551/* Enables or disables Oodle usage warnings.
552
553 $:state whether usage warnings should be enabled or disabled.
554
555 Usage warnings are enabled by default and try to be low-noise, but in case you want to
556 disable them, this is how.
557
558 This should generally be done once at startup. Setting this state while there are Oodle
559 calls running on other threads has undefined results.
560*/
561
562// function pointers to mallocs needed :
563
565/* Function pointer type for OodleMallocAligned
567 $:bytes number of bytes to allocate
568 $:alignment required alignment of returned pointer
569 $:return pointer to memory allocated (must not be NULL)
570
571 _alignment_ will always be a power of two
572
573 _alignment_ will always be >= $OODLE_MALLOC_MINIMUM_ALIGNMENT
574
575*/
576
578/* Function pointer type for OodleFree
579
580 $:return pointer to memory to free
581
582*/
583
587/* Set the function pointers for allocation needed by Oodle2 Core
589 If these are not set, the default implementation on most platforms uses the C stdlib.
590 On Microsoft platforms the default implementation uses HeapAlloc.
591
592 These must not be changed once they are set! Set them once then don't change them.
593
594 NOTE: if you are using Oodle Ext, do NOT call this. OodleX_Init will install an allocator for Oodle Core. Do not mix your own allocator with the OodleX allocator. See $OodleXAPI_Malloc.
595
596 If you want to ensure that Oodle is not doing any allocations, you can call OodleCore_Plugins_SetAllocators(NULL,NULL);
597 If you do that, then any time Oodle needs to allocate memory internally, it will stop the process.
598 It is STRONGLY not recommended that you ship that way. You can verify that Oodle is not allocating, but then leave some
599 fallback allocator installed when you actually ship just in case.
600
601 Also note that on many consoles the standard allocation practices may not
602 leave much heap memory for the C stdlib malloc. In this case Oodle may fail to allocate.
603
604*/
605
607/* Function pointer type for OodleCore_Plugins_SetJobSystem
608
609 $:dependencies array of handles of other pending jobs. All guaranteed to be nonzero.
610 $:num_dependencies number of dependencies. Guaranteed to be no more than OODLE_JOB_MAX_DEPENDENCIES.
611 $:user_ptr is passed through from the OodleLZ_CompressOptions.
612 $:return handle to the async job, or 0 if it was run synchronously
613
614 RunJob will call fp_job(job_data)
615
616 it may be done on a thread, or it may run the function synchronously and return 0, indicating the job is already done.
617 The returned OO_U64 is a handle passed to WaitJob, unless it is 0, in which case WaitJob won't get called.
618
619 fp_job should not run until all the dependencies are done. This function should not delete the dependencies.
620
621 RunJob must be callable from within an Oodle Job, i.e. jobs may spawn their own sub-jobs directly.
622 However, the matching WaitJob calls will only ever occur on the thread that called the
623 internally threaded Oodle API function.
624
625 See $Oodle_About_Job_Threading_Plugins
626*/
627
629/* Function pointer type for OodleCore_Plugins_SetJobSystem
631 $:job_handle a job handle returned from RunJob. Never 0.
632 $:user_ptr is passed through from the OodleLZ_CompressOptions.
633
634 Waits until the job specified by job_handle is done and cleans up any associated resources. Oodle
635 will call WaitJob exactly once for every RunJob call that didn't return 0.
636
637 If job_handle was already completed, this should clean it up without waiting.
638
639 A handle value should not be reused by another RunJob until WaitJob has been done with that value.
640
641 WaitJob will not be called from running jobs. It will be only be called from the original thread that
642 invoked Oodle. If you are running Oodle from a worker thread, ensure that that thread is allowed to wait
643 on other job threads.
644
645 See $Oodle_About_Job_Threading_Plugins
646*/
647
651/* DEPRECATED use OodleCore_Plugins_SetJobSystemAndCount instead
652
653 See $OodleCore_Plugins_SetJobSystemAndCount
654*/
655
656
661/* Set the function pointers for async job system needed by Oodle2 Core
662
663 $:fp_RunJob pointer to RunJob function
664 $:fp_WaitJob pointer to WaitJob function
665 $:target_parallelism goal of number of jobs to run simultaneously
666
667 If these are not set, the default implementation runs jobs synchronously on the calling thread.
668
669 These must not be changed once they are set! Set them once then don't change them.
670
671 _target_parallelism_ allows you to tell Oodle how many Jobs it should try to keep in flight at once.
672 Depending on the operation it may not be able to split work into this many jobs (so fewer will be used),
673 but it will not exceed this count.
674
675 For Oodle Data LZ work, typically _target_parallelism_ is usually best at the number of hardware cores
676 not including hyper threads).
677
678 For Oodle Texture BCN encoding work, _target_parallelism_ is usually best as the full number of hyper cores.
679
680 In some cases you may wish to reduce _target_parallelism_ by 1 or 2 cores to leave some of the CPU free for
681 other work.
682
683 For example on a CPU with 16 cores and 32 hardware threads, for LZ work you might set _target_parallelism_ to 15
684 when calling OodleCorePlugins. For BC7 encoding you might set _target_parallelism_ to 30 when calling OodleTexPlugins.
685
686 NOTE : if you are using Oodle Ext, do NOT call this. OodleX_Init will install a job system for Oodle Core.
687 Note OodleX only installs automatically to Oodle Core, not Net or Tex. See example_jobify.cpp for manual
688 plugin.
689
690 Replaces deprecated $OodleCore_Plugins_SetJobSystem
692 See $Oodle_About_Job_Threading_Plugins
693*/
694
695// the main func pointer for log :
696OODEFFUNC typedef void (OODLE_CALLBACK t_fp_OodleCore_Plugin_Printf)(int verboseLevel,const char * file,int line,const char * fmt,...);
697/* Function pointer to Oodle Core printf
698
699 $:verboseLevel verbosity of the message; 0-2 ; lower = more important
700 $:file C file that sent the message
701 $:line C line that sent the message
702 $:fmt vararg printf format string
703
704 The logging function installed here must parse varargs like printf.
705
706 _verboseLevel_ may be used to omit verbose messages.
707*/
708
710/* Install the callback used by Oodle Core for logging
711
712 $:fp_rrRawPrintf function pointer to your log function; may be NULL to disable all logging
713 $:return returns the previous function pointer
714
715 Use this function to install your own printf for Oodle Core.
716
717 The default implementation in debug builds, if you install nothing, uses the C stdio printf for logging.
718 On Microsoft platforms, it uses OutputDebugString and not stdio.
719
720 To disable all logging, call OodleCore_Plugins_SetPrintf(NULL)
721
722 WARNING : this function is NOT thread safe! It should be done only once and done in a place where the caller can guarantee thread safety.
723
724 In the debug build of Oodle, you can install OodleCore_Plugin_Printf_Verbose to get more verbose logging
725
727
728OODEFFUNC typedef OO_BOOL (OODLE_CALLBACK t_fp_OodleCore_Plugin_DisplayAssertion)(const char * file,const int line,const char * function,const char * message);
729/* Function pointer to Oodle Core assert callback
730
731 $:file C file that triggered the assert
732 $:line C line that triggered the assert
733 $:function C function that triggered the assert (may be NULL)
734 $:message assert message
735 $:return true to break execution at the assertion site, false to continue
736
737 This callback is called by Oodle Core when it detects an assertion condition.
738
739 This will only happen in debug builds.
740
741
742*/
743
745/* Install the callback used by Oodle Core for asserts
747 $:fp_rrDisplayAssertion function pointer to your assert display function
748 $:return returns the previous function pointer
750 Use this function to install your own display for Oodle Core assertions.
751 This will only happen in debug builds.
752
753 The default implementation in debug builds, if you install nothing, uses the C stderr printf for logging,
754 except on Microsoft platforms where it uses OutputDebugString.
755
756 WARNING : this function is NOT thread safe! It should be done only once and done in a place where the caller can guarantee thread safety.
757
759
760//=============================================================
761
765OOFUNC1 void OOFUNC2 OodleCore_Plugin_Printf_Default(int verboseLevel,const char * file,int line,const char * fmt,...);
766OOFUNC1 void OOFUNC2 OodleCore_Plugin_Printf_Verbose(int verboseLevel,const char * file,int line,const char * fmt,...);
767OOFUNC1 OO_BOOL OOFUNC2 OodleCore_Plugin_DisplayAssertion_Default(const char * file,const int line,const char * function,const char * message);
770
771//=============================================================
772
773//----------------------------------------------
774// OodleLZ
775
776#define OODLELZ_FAILED (0) /* Return value of OodleLZ_Decompress on failure
777*/
778
779//=======================================================
780
782 const void * rawBuf,OO_SINTa rawLen,void * compBuf,
785 const void * dictionaryBase OODEFAULT(NULL),
786 const void * lrm OODEFAULT(NULL),
787 void * scratchMem OODEFAULT(NULL),
789/* Compress some data from memory to memory, synchronously, with OodleLZ
790
791 $:compressor which OodleLZ variant to use in compression
792 $:rawBuf raw data to compress
793 $:rawLen number of bytes in rawBuf to compress
794 $:compBuf pointer to write compressed data to. MUST be at least $OodleLZ_GetCompressedBufferSizeNeeded bytes
795 $:level OodleLZ_CompressionLevel controls how much CPU effort is put into maximizing compression
796 $:pOptions (optional) options; if NULL, $OodleLZ_CompressOptions_GetDefault is used
797 $:dictionaryBase (optional) if not NULL, provides preceding data to prime the dictionary; must be contiguous with rawBuf, the data between the pointers _dictionaryBase_ and _rawBuf_ is used as the preconditioning data. The exact same precondition must be passed to encoder and decoder.
798 $:lrm (optional) long range matcher
799 $:scratchMem (optional) pointer to scratch memory
800 $:scratchSize (optional) size of scratch memory (see $OodleLZ_GetCompressScratchMemBound)
801 $:return size of compressed data written, or $OODLELZ_FAILED for failure
802
803 Performs synchronous memory to memory LZ compression.
804
805 In tools and when compressing large inputs in one call, consider using
806 $OodleXLZ_Compress_AsyncAndWait (in the Oodle2 Ext lib) instead to get parallelism. Alternatively,
807 chop the data into small fixed size chunks (we recommend at least 256KiB, i.e. 262144 bytes) and
808 call compress on each of them, which decreases compression ratio but makes for trivial parallel
809 compression and decompression.
810
811 You can compress a large buffer in several calls by setting _dictionaryBase_ to the start
812 of the buffer, and then making _rawBuf_ and _rawLen_ select portions of that buffer. As long
813 as _rawLen_ is a multiple of $OODLELZ_BLOCK_LEN, the compressed chunks can simply be
814 concatenated together.
815
816 The buffer that _compBuf_ points to must have a certain minimum size that is returned by
817 $OodleLZ_GetCompressedBufferSizeNeeded. This size is always more than _rawLen_, usually by a few bytes
818 for every 256kb of input data. The "compressed" data can end up slightly larger than the input due to
819 internal stream headers.
821 If _scratchMem_ is provided, it will be used for the compressor's scratch memory needs before OodleMalloc is
822 called. If the scratch is big enough, no malloc will be done. If the scratch is not big enough, the compress
823 will not fail, instead OodleMalloc will be used. OodleMalloc should not return null. There is currently no way
824 to make compress fail cleanly due to using too much memory, it must either succeed or abort the process.
825
826 If _scratchSize_ is at least $OodleLZ_GetCompressScratchMemBound , additional allocations will not be needed.
827
828 See $OodleLZ_About for tips on setting the compression options.
829
830 If _dictionaryBase_ is provided, the backup distance from _rawBuf_ must be a multiple of $OODLELZ_BLOCK_LEN
831
832 If $(OodleLZ_CompressOptions:seekChunkReset) is enabled, and _dictionaryBase_ is not NULL or _rawBuf_ , then the
833 seek chunk boundaries are relative to _dictionaryBase_, not to _rawBuf_.
834
835*/
836
837// Decompress returns raw (decompressed) len received
838// Decompress returns 0 (OODLELZ_FAILED) if it detects corruption
843 void * decBufBase OODEFAULT(NULL),
850 );
851/* Decompress a some data from memory to memory, synchronously.
852
853 $:compBuf pointer to compressed data
854 $:compBufSize number of compressed bytes available (must be greater or equal to the number consumed)
855 $:rawBuf pointer to output uncompressed data into
856 $:rawLen number of uncompressed bytes to output
857 $:fuzzSafe (optional) should the decode fail if it contains non-fuzz safe codecs?
858 $:checkCRC (optional) if data could be corrupted and you want to know about it, pass OodleLZ_CheckCRC_Yes
859 $:verbosity (optional) if not OodleLZ_Verbosity_None, logs some info
860 $:decBufBase (optional) if not NULL, provides preceding data to prime the dictionary; must be contiguous with rawBuf, the data between the pointers _dictionaryBase_ and _rawBuf_ is used as the preconditioning data. The exact same precondition must be passed to encoder and decoder. The decBufBase must be a reset point.
861 $:decBufSize (optional) size of decode buffer starting at decBufBase, if 0, _rawLen_ is assumed
862 $:fpCallback (optional) OodleDecompressCallback to call incrementally as decode proceeds
863 $:callbackUserData (optional) passed as userData to fpCallback
864 $:decoderMemory (optional) pre-allocated memory for the Decoder, of size _decoderMemorySize_
865 $:decoderMemorySize (optional) size of the buffer at _decoderMemory_; must be at least $OodleLZDecoder_MemorySizeNeeded bytes to be used
866 $:threadPhase (optional) for threaded decode; see $OodleLZ_About_ThreadPhasedDecode (default OodleLZ_Decode_Unthreaded)
867 $:return the number of decompressed bytes output, $OODLELZ_FAILED (0) if none can be decompressed
868
869 Decodes data encoded with any $OodleLZ_Compressor.
870
871 Note : _rawLen_ must be the actual number of bytes to output, the same as the number that were encoded with the corresponding
872 OodleLZ_Compress size. You must store this somewhere in your own header and pass it in to this call. _compBufSize_ does NOT
873 need to be the exact number of compressed bytes, is the number of bytes available in the buffer, it must be greater or equal to
874 the actual compressed length.
875
876 Note that the new compressors (Kraken, Mermaid, Selkie, Leviathan) are all fuzz safe and you can use OodleLZ_FuzzSafe_Yes
877 with them and no padding of the decode target buffer.
878
879 If checkCRC is OodleLZ_CheckCRC_Yes, then corrupt data will be detected and the decode aborted.
880 If checkCRC is OodleLZ_CheckCRC_No, then corruption might result in invalid data, but no detection of any error (garbage in, garbage out).
881
882 If corruption is possible, _fuzzSafe_ is No and _checkCRC_ is OodleLZ_CheckCRC_No, $OodleLZ_GetDecodeBufferSize must be used to allocate
883 _rawBuf_ large enough to prevent overrun.
884
885 With the legacy LZB16 codec, $OodleLZ_GetDecodeBufferSize should be used to ensure _rawBuf_ is large enough,
886 even when corruption is not possible (when fuzzSafe is No).
887
888 _compBuf_ and _rawBuf_ are allowed to overlap for "in place" decoding, but then _rawBuf_ must be allocated to
889 the size given by $OodleLZ_GetInPlaceDecodeBufferSize , and the compressed data must be at the end of that buffer.
890
891 An easy way to take the next step to parallel decoding is with $OodleXLZ_Decompress_MakeSeekTable_Wide_Async (in the Oodle2 Ext lib)
892
893 NOTE : the return value is the *total* number of decompressed bytes output so far. If rawBuf is > decBufBase, that means
894 the initial inset of (rawBuf - decBufBase) is included! (eg. you won't just get _rawLen_)
895
896 If _decBufBase_ is provided, the backup distance from _rawBuf_ must be a multiple of $OODLELZ_BLOCK_LEN
897
898 About fuzz safety:
899
900 OodleLZ_Decompress is guaranteed not to crash even if the data is corrupted when _fuzzSafe_ is set to OodleLZ_FuzzSafe_Yes.
901 When _fuzzSafe_ is Yes, the target buffer (_rawBuf_ and _rawLen_) will never be overrun. Note that corrupted data might not
902 be detected (the return value might indicate success).
903
904 Fuzz Safe decodes will not crash on corrupt data. They may or may not return failure, and produce garbage output.
905
906 Fuzz safe decodes will not read out of bounds. They won't put data on the stack or previously in memory
907 into the output buffer.
909 Fuzz safe decodes will not output more than the uncompressed size. (eg. the output buffer does not need to
910 be padded like OodleLZ_GetDecodeBufferSize)
911
912 If you ask for a fuzz safe decode and the compressor doesn't satisfy OodleLZ_Compressor_CanDecodeFuzzSafe
913 then it will return failure.
914
915 The _fuzzSafe_ argument should always be OodleLZ_FuzzSafe_Yes as of Oodle 2.9.0 ; older compressors did not
916 support fuzz safety but they now all do.
917
918 Use of OodleLZ_FuzzSafe_No is deprecated.
919
920*/
921
922
923//-------------------------------------------
924// Incremental Decoder functions :
925
926struct _OodleLZDecoder;
927typedef struct _OodleLZDecoder OodleLZDecoder;
928/* Opaque type for OodleLZDecoder
929
930 See $OodleLZDecoder_Create
931*/
932
933
935/* Create a OodleLZDecoder
936
937 $:compressor the type of data you will decode; use $OodleLZ_Compressor_Invalid if unknown
938 $:rawLen total raw bytes of the decode (or <= 0 for any/unknown, but Reset for each buffer)
939 $:memory (optional) provide memory for the OodleLZDecoder object (not the window)
940 $:memorySize (optional) if memory is provided, this is its size in bytes
941 $:return the OodleLZDecoder
942
943 If memory is provided, it must be of size $OodleLZDecoder_MemorySizeNeeded. If it is NULL it will be
944 allocated with the malloc specified by $OodleAPI_OodleCore_Plugins.
945
946 Free with $OodleLZDecoder_Destroy. You should Destroy even if you passed in the memory.
947
948 Providing _compressor_ lets the OodleLZDecoder be the minimum size needed for that type of data.
949 If you pass $OodleLZ_Compressor_Invalid, then any type of data may be decoded, and the Decoder is allocated
950 large enought to handle any of them.
951
952 If you are going to pass _rawLen_ to OodleLZDecoder_Reset , then you can pass 0 to _rawLen_ here. To make a Decoder
953 to use with many buffer sizes, pass either <= 0 (for infinite) or the largest buffer size you can see. Then call
954 Reset() with the correct buffer size before starting to decode each buffer.
955
956 See $OodleLZDecoder_DecodeSome for more.
957*/
958
960/* If you want to provide the memory needed by $OodleLZDecoder_Create , this tells you how big it must be.
961
962 $:compressor the type of data you will decode; use $OodleLZ_Compressor_Invalid if unknown
963 $:rawLen should almost always be -1, which supports any size of raw data decompression
964 $:return bytes to allocate or reserve, 0 for failure
965
966 NOTE : using $OodleLZ_Compressor_Invalid lets you decode any time of compressed data.
967 It requests as much memory as the largest compressor. This may be a *lot* more than your data needs;
968 try to use the correct compressor type.
969
970 If _rawLen_ is -1 (default) then the Decoder object created can be used on any length of raw data
971 decompression. If _rawLen_ is specified here, then you can only use it to decode data shorter than
972 the length you specified here. This use case is very rare, contact support for details.
973*/
974
976/* Returns the size of the decoder needed for ThreadPhased decode
977
978 For use with $OodleLZ_Decode_ThreadPhase
979 See $OodleLZ_About_ThreadPhasedDecode
980*/
981
983/* Pairs with $OodleLZDecoder_Create
984
985 You should always call Destroy even if you provided the memory for $OodleLZDecoder_Create
986*/
987
988// Reset decoder - can reset to the start of any OODLELZ_BLOCK_LEN chunk
990/* Reset an OodleLZDecoder to restart at given pos
991
992 $:decoder the OodleLZDecoder, made by $OodleLZDecoder_Create
993 $:decPos position to reset to; must be a multiple of OODLELZ_BLOCK_LEN
994 $:decLen (optional) if not zero, change the length of the data we expect to decode
995 $:return true for success
996
997 If you are seeking in a packed stream, you must seek to a seek chunk reset point, as was made at compress time.
998
999 That is, $(OodleLZ_CompressOptions:seekChunkReset) must have been true, and
1000 _decPos_ must be a multiple of $(OodleLZ_CompressOptions:seekChunkLen) that was used at compress time.
1001
1002 You can use $OodleLZ_GetChunkCompressor to verify that you are at a valid
1003 independent chunk start point.
1004
1005*/
1006
1007// returns false if corruption detected
1011
1012 // the decode sliding window : we output here & read from this for matches
1013 void * decBuf,
1015 OO_SINTa decBufferSize, // decBufferSize should be the result of OodleLZDecoder_MakeDecodeBufferSize()
1016 OO_SINTa decBufAvail, // usually Size - Pos, but maybe less if you have pending IO flushes
1017
1018 // compressed data :
1019 const void * compPtr,
1021
1026
1027 );
1028/* Incremental decode some LZ compressed data
1029
1030 $:decoder the OodleLZDecoder, made by $OodleLZDecoder_Create
1031 $:out filled with results
1032 $:decBuf the decode buffer (window)
1033 $:decBufPos the current position in the buffer
1034 $:decBufferSize size of decBuf ; this must be either equal to the total decompressed size (_rawLen_ passed to $OodleLZDecoder_Create) or the result of $OodleLZDecoder_MakeValidCircularWindowSize
1035 $:decBufAvail the number of bytes available after decBufPos in decBuf ; usually (decBufferSize - decBufPos), but can be less
1036 $:compPtr pointer to compressed data to read
1037 $:compAvail number of compressed bytes available at compPtr
1038 $:fuzzSafe (optional) should the decode be fuzz safe
1039 $:checkCRC (optional) if data could be corrupted and you want to know about it, pass OodleLZ_CheckCRC_Yes
1040 $:verbosity (optional) if not OodleLZ_Verbosity_None, logs some info
1041 $:threadPhase (optional) for threaded decode; see $OodleLZ_About_ThreadPhasedDecode (default OodleLZ_Decode_Unthreaded)
1042 $:return true if success, false if invalid arguments or data is encountered
1043
1044 Decodes data encoded with an OodleLZ compressor.
1045
1046 Decodes an integer number of quanta; quanta are $OODLELZ_QUANTUM_LEN uncompressed bytes.
1047
1048 _decBuf_ can either be a circular window or the whole _rawLen_ array.
1049 In either case, _decBufPos_ should be in the range [0,_decBufferSize_).
1050 If _decBuf_ is a circular window, then _decBufferSize_ should come from $OodleLZDecoder_MakeValidCircularWindowSize.
1051
1052 (circular windows are deprecated as of 2.9.0)
1053
1054 NOTE : all the new LZ codecs (Kraken, etc.) do not do circular windows. They can do sliding windows, see lz_test_11 in $example_lz.
1055 They should always have decBufferSize = total raw size, even if the decode buffer is smaller than that.
1056
1057 NOTE : insufficient data provided (with _compAvail_ > 0 but not enough to decode a quantum) is a *success* case
1058 (return value of true), even though nothing is decoded. A return of false always indicates a non-recoverable error.
1059
1060 If _decBufAvail_ or _compAvail_ is insufficient for any decompression, the "curQuantum" fields of $OodleLZ_DecodeSome_Out
1061 will tell you how much you must provide to proceed. That is, if enough compressed bytes are provided to get a quantum header, but not enough to decode a quantum, this
1062 function returns true and fills out the $OodleLZ_DecodeSome_Out structure with the size of the quantum.
1063
1064 See $OodleLZ_Decompress about fuzz safety.
1065
1066 NOTE : DecodeSome expect to decode either one full quantum (of len $OODLELZ_QUANTUM_LEN) or up to the length of the total buffer specified in the
1067call to $OodleLZDecoder_Create or $OodleLZDecoder_Reset. That total buffer length
1068must match what was use during compression (or be a seek-chunk portion thereof).
1069That is, you cannot decompress partial streams in intervals smaller than
1070$OODLELZ_QUANTUM_LEN except for the final partial quantum at the end of the stream.
1071
1072*/
1073
1074// pass in how much you want to alloc and it will tell you a valid size as close that as possible
1075// the main use is just to call OodleLZDecoder_MakeDecodeBufferSize(0) to get the min size; the min size is a good size
1077/* Get a valid "Window" size for an LZ
1078
1079 $:compressor which compressor you will be decoding
1080 $:minWindowSize (optional) minimum size of the window
1081
1082 NOTE: circular windows are deprecated as of 2.9.0
1083
1084 Most common usage is OodleLZDecoder_MakeValidCircularWindowSize(0) to get the minimum window size.
1085
1086 Only compressors which pass $OodleLZ_Compressor_CanDecodeInCircularWindow can be decoded in a circular window.
1087
1088 WARNING : this is NOT the size to malloc the window! you need to call $OodleLZ_GetDecodeBufferSize() and
1089 pass in the window size to get the malloc size.
1090*/
1091
1092//=======================================================
1093
1094//=======================================================
1095
1096#define OODLELZ_SEEKPOINTCOUNT_DEFAULT 16
1097
1099/* Compute a valid seekChunkLen
1100
1101 $:rawLen total length of uncompressed data
1102 $:desiredSeekPointCount desired number of seek chunks
1103 $:return a valid seekChunkLen for use in $OodleLZ_CreateSeekTable
1104
1105 Returns a seekChunkLen which is close to (rawLen/desiredSeekPointCount) but is a power of two multiple of $OODLELZ_BLOCK_LEN
1106
1107 _desiredSeekPointCount_ = 16 is good for parallel decompression.
1108 (OODLELZ_SEEKPOINTCOUNT_DEFAULT)
1109*/
1110
1112/* Compute the number of seek chunks
1113
1114 $:rawLen total length of uncompressed data
1115 $:seekChunkLen the length of a seek chunk (eg from $OodleLZ_MakeSeekChunkLen)
1116 $:return the number of seek chunks
1117
1118 returns (rawLen+seekChunkLen-1)/seekChunkLen
1119*/
1120
1122/* Tells you the size in bytes to allocate the seekTable before calling $OodleLZ_FillSeekTable
1123
1124 $:numSeekChunks number of seek chunks (eg from $OodleLZ_GetNumSeekChunks)
1125 $:flags options that will be passed to $OodleLZ_CreateSeekTable
1126 $:return size in bytes of memory needed for seek table
1127
1128 If you wish to provide the memory for the seek table yourself, you may call this to get the required size,
1129 allocate the memory, and then simply point a $OodleLZ_SeekTable at your memory.
1130 Then use $OodleLZ_FillSeekTable to fill it out.
1131
1132 Do NOT use sizeof(OodleLZ_SeekTable) !
1133*/
1134
1136/* scan compressed LZ stream to fill the seek table
1137
1138 $:pTable pointer to table to be filled
1139 $:flags options
1140 $:seekChunkLen the length of a seek chunk (eg from $OodleLZ_MakeSeekChunkLen)
1141 $:rawBuf (optional) uncompressed buffer; used to compute the _rawCRCs_ member of $OodleLZ_SeekTable
1142 $:rawLen size of rawBuf
1143 $:compBuf compressed buffer
1144 $:compLen size of compBuf
1145 $:return true for success
1146
1147 _pTable_ must be able to hold at least $OodleLZ_GetSeekTableMemorySizeNeeded
1148
1149 _seekChunkLen_ must be a multiple of $OODLELZ_BLOCK_LEN.
1150 _seekChunkLen_ must match what was in CompressOptions when the buffer was made, or any integer multiple thereof.
1151*/
1152
1155/* allocate a table, then scan compressed LZ stream to fill the seek table
1156
1157 $:flags options
1158 $:seekChunkLen the length of a seek chunk (eg from $OodleLZ_MakeSeekChunkLen)
1159 $:rawBuf (optional) uncompressed buffer; used to compute the _rawCRCs_ member of $OodleLZ_SeekTable
1160 $:rawLen size of rawBuf
1161 $:compBuf compressed buffer
1162 $:compLen size of compBuf
1163 $:return pointer to table if succeeded, null if failed
1164
1165 Same as $OodleLZ_FillSeekTable , but allocates the memory for you. Use $OodleLZ_FreeSeekTable to free.
1166
1167 _seekChunkLen_ must be a multiple of $OODLELZ_BLOCK_LEN.
1168 _seekChunkLen_ must match what was in CompressOptions when the buffer was made, or any integer multiple thereof.
1169
1170*/
1171
1173/* Frees a table allocated by $OodleLZ_CreateSeekTable
1175
1177/* Check the CRC's in seekTable vs rawBuf
1178
1179 $:rawBuf uncompressed buffer
1180 $:rawLen size of rawBuf
1181 $:seekTable result of $OodleLZ_CreateSeekTable
1182 $:return true if the CRC's check out
1183
1184 Note that $OodleLZ_Decompress option of $OodleLZ_CheckCRC checks the CRC of *compressed* data,
1185 this call checks the CRC of the *raw* (uncompressed) data.
1186
1187 OodleLZ data contains a CRC of the compressed data if it was made with $(OodleLZ_CompressOptions:sendQuantumCRCs).
1188 The SeekTable contains a CRC of the raw data if it was made with $OodleLZSeekTable_Flags_MakeRawCRCs.
1189
1190 Checking the CRC of compressed data is faster, but does not verify that the decompress succeeded.
1191*/
1192
1194/* Find the seek entry that contains a raw position
1195
1196 $:rawPos uncompressed position to look for
1197 $:seekTable result of $OodleLZ_CreateSeekTable
1198 $:return a seek entry index
1199
1200 returns the index of the chunk that contains _rawPos_
1201*/
1202
1204/* Get the compressed position of a seek entry
1205
1206 $:seekI seek entry index , in [0,numSeekEntries)
1207 $:seekTable result of $OodleLZ_CreateSeekTable
1208 $:return compressed buffer position of the start of this seek entry
1209
1210
1211*/
1212
1213//=============================================================
1214
1216/* Provides a string naming a $OodleLZ_CompressionLevel compressSelect
1217*/
1218
1220/* Provides a string naming a $OodleLZ_Compressor compressor
1222
1224/* Provides a string naming a $OodleLZ_Jobify enum
1225*/
1226
1230/* Provides a pointer to default compression options
1231
1232 $:compressor deprecated, ignored
1233 $:lzLevel deprecated, ignored
1234
1235 Use to fill your own $OodleLZ_CompressOptions then change individual fields.
1236
1237*/
1238
1239// after you fiddle with options, call this to ensure they are allowed
1241/* Clamps the values in _pOptions_ to be in valid range
1242
1243*/
1244
1245// inline functions for compressor property queries
1247
1249/* OodleLZ_Compressor properties helper.
1250
1251 Tells you if this compressor is "whole block quantum" ; must decode in steps of
1252 $OODLELZ_BLOCK_LEN , not $OODLELZ_QUANTUM_LEN like others.
1253*/
1255/* OodleLZ_Compressor properties helper.
1256
1257 Tells you if this compressor is "LargeWindow" or not, meaning it can benefit from
1258 a Long-Range-Matcher and windows larger than $OODLELZ_BLOCK_LEN
1259*/
1261/* OodleLZ_Compressor properties helper.
1262
1263 Tells you if this compressor can be decoded using a fixed size circular window.
1264 deprecated as of 2.9.0
1265*/
1267/* OodleLZ_Compressor properties helper.
1268
1269 Tells you if this compressor can be used with the $OodleLZ_Decode_ThreadPhase.
1270
1271 See $OodleLZ_About_ThreadPhasedDecode
1272*/
1274/* OodleLZ_Compressor properties helper.
1275
1276 Tells you if this compressor can be used with "in-place" decoding.
1277
1278 This is now always true (all compressors support in-place decoding). The function is left
1279 for backward compatibility.
1280
1281 All compressors in the future will support in-place, you don't need to check this property.
1282
1283*/
1285/* OodleLZ_Compressor properties helper.
1286
1287 Tells you if this compressor must decode contiguous ranges of buffer with the same Decoder.
1288
1289 That is, most of the compressors can be Reset and restart on any block, not just seek blocks,
1290 as long as the correct window data is provided. That is, if this returns false then the only
1291 state required across a non-reset block is the dictionary of previously decoded data.
1292
1293 But if OodleLZ_Compressor_MustDecodeWithoutResets returns true, then you cannot do that,
1294 because the Decoder object must carry state across blocks (except reset blocks).
1295
1296 This does not apply to seek points - you can always reset and restart decompression at a seek point.
1297*/
1299/* OodleLZ_Compressor properties helper.
1301 Tells you if this compressor is "fuzz safe" which means it can accept corrupted data
1302 and won't crash or overrun any buffers.
1303*/
1304
1306/* OodleLZ_Compressor properties helper.
1307
1308 Tells you if this compressor obeys $(OodleLZ_CompressOptions:dictionarySize) which limits
1309 match references to a finite bound. (eg. for sliding window decompression).
1310
1311 All the new codecs do (Kraken,Mermaid,Selkie,Leviathan). Some old codecs don't.
1312*/
1313//=====================================================================
1314
1315#define OODLELZ_COMPRESSOR_MASK(c) (((OO_U32)1)<<((OO_S32)(c)))
1316// OODLELZ_COMPRESSOR_BOOLBIT : extract a value of 1 or 0 so it maps to "bool"
1317#define OODLELZ_COMPRESSOR_BOOLBIT(s,c) (((s)>>(OO_S32)(c))&1)
1318
1320{
1321 const OO_U32 set =
1328}
1329
1348
1350{
1351 #ifdef OODLE_ALLOW_DEPRECATED_COMPRESSORS
1352 const OO_U32 set =
1362 #else
1363 // all new compressors respect dictionarySize
1377
1379{
1380 // all compressors can now decode in place :
1382}
1383
1385{
1386 #ifdef OODLE_ALLOW_DEPRECATED_COMPRESSORS
1387 const OO_U32 set =
1390 #else
1391 const OO_U32 set = 0;
1392 #endif
1393
1395}
1396
1398{
1399 // all but LZH and LZB16 now are large window
1401}
1402
1404{
1412 #endif
1413
1415}
1416
1418
1419//=======================================================
1420
1421
1422#define OODLELZ_SCRATCH_MEM_NO_BOUND (-1) /* Scratch mem size when bound is unknown.
1423 Installed allocator may be used no matter how much scratch mem you provide.
1424*/
1425
1427{
1428 OodleLZ_CompressScratchMemBoundType_WorstCase = 0, // Worst-case memory use estimate
1429 OodleLZ_CompressScratchMemBoundType_Typical = 1, // Typical memory use estimate; with this much scratch memory, allocations might still happen, but rarely.
1430
1433/* Type of scratch memory bound to compute.
1434
1435 $OodleLZ_CompressScratchMemBoundType_WorstCase provides a worst-case estimate for the amount
1436 of scratch memory required for compression. If at least this much scratch memory is provided
1437 to the compression functions, they are guaranteed to make no allocations of their own. Some
1438 compression levels don't have simple worst-case memory use guarantees and will return
1439 $OODLELZ_SCRATCH_MEM_NO_BOUND for this type of query.
1440
1441 $OodleLZ_CompressScratchMemBoundType_Typical returns a scratch memory estimate that will
1442 be sufficient for most compression calls to not require additional memory, even when no
1443 hard guarantees exist. Even so, a good estimate may not be available, in which case
1444 $OODLELZ_SCRATCH_MEM_NO_BOUND is returned.
1445*/
1446
1452 );
1453/* Return the maximum amount of scratch mem that will be needed by OodleLZ_Compress
1454
1455 $:compressor which OodleLZ variant to use in compression
1456 $:level OodleLZ_CompressionLevel controls how much CPU effort is put into maximizing compression
1457 $:rawLen maximum number of bytes you will compress (plus dictionary backup)
1458 $:pOptions (optional) options; if NULL, $OodleLZ_CompressOptions_GetDefault is used
1459
1460 If you pass scratch mem to $OodleLZ_Compress of this size, it is gauranteed to do no allocations.
1461 (normally if it runs out of scratch mem, it falls back to the installed allocator)
1462
1463 For _rawLen_ pass at least the maximum size you will ever encode. If your data is divided into chunks,
1464 pass the chunk size. If you will encode full buffers of unbounded size, pass -1.
1465
1466 The options must be the same as when you call $OodleLZ_Compress
1467
1468 Some options and levels may not have simple finite bounds. Then $OODLELZ_SCRATCH_MEM_NO_BOUND is returned
1469 and the call to $OodleLZ_Compress may use the allocator even if infinite scratch memory is provided.
1470 Currently this applies to all the Optimal levels.
1471
1472 When OODLELZ_SCRATCH_MEM_NO_BOUND is returned, you can still pass in scratch mem which will be used before
1473 going to the plugin allocator.
1474
1475*/
1476
1483 );
1484/* Return an estimate for the amount of scratch mem used by OodleLZ_Compress
1485
1486 $:compressor which OodleLZ variant to use in compression
1487 $:level OodleLZ_CompressionLevel controls how much CPU effort is put into maximizing compression
1488 $:boundType Type of memory estimate to return.
1489 $:rawLen maximum number of bytes you will compress (plus dictionary backup)
1490 $:pOptions (optional) options; if NULL, $OodleLZ_CompressOptions_GetDefault is used
1491
1492 Returns either a worst-case or typical scratch memory estimate for the given compressor, options
1493 and input size.
1495 When a worst-case scratch memory estimate exists, passing that much scratch memory to
1496 $OodleLZ_Compress is guaranteed to not do any allocations, provided the parameters match those
1497 of the compression call.
1498
1499 "Typical" memory bounds are not hard guarantees but will usually not result in any extra allocations.
1500
1501 For _rawLen_ pass at least the maximum size you will ever encode. If your data is divided into chunks,
1502 pass the chunk size. If you will encode full buffers of unbounded size, pass -1.
1503
1504 Some options and levels may not have simple finite bounds. Then $OODLELZ_SCRATCH_MEM_NO_BOUND is returned
1505 and the call to $OodleLZ_Compress may use the allocator even if infinite scratch memory is provided.
1506 Currently this applies to all the Optimal levels.
1507
1508 When OODLELZ_SCRATCH_MEM_NO_BOUND is returned, you can still pass in scratch mem which will be used before
1509 going to the plugin allocator.
1510
1511*/
1512
1513// get maximum expanded size for compBuf alloc :
1514// (note this is actually larger than the maximum compressed stream, it includes trash padding)
1516/* Return the size you must malloc the compressed buffer
1517
1518 $:compressor compressor used; OodleLZ_Compressor_Invalid to make it enough for any compressor
1519 $:rawSize uncompressed size you will compress into this buffer
1520
1521 The _compBuf_ passed to $OodleLZ_Compress must be allocated at least this big.
1522
1523 note this is actually larger than the maximum size of a compressed stream, it includes overrun padding.
1524
1525*/
1526
1527// decBuf needs to be a little larger than rawLen,
1528// this will tell you exactly how much :
1530/* Get the size you must malloc the decode (raw) buffer
1531
1532 $:compressor compressor used; OodleLZ_Compressor_Invalid to make it enough for any compressor
1533 $:rawSize uncompressed (raw) size without padding
1534 $:corruptionPossible true if it is possible for the decoder to get corrupted data
1535 $:return size of buffer to malloc; slightly larger than rawSize if padding is needed
1536
1537 As of Oodle 2.9.0 this function is not required. For all new codecs you can just use the size of the
1538 uncompressed data for the decode buffer size (_rawSize_), no padding is needed.
1539
1540 Note that LZB16 is still supported in 2.9.0 but does require padding when used in a circular
1541 window (which is deprecated).
1542
1543 This padding is necessary for the older compressors when FuzzSafe_No is used. The old compressors
1544 and FuzzSafe_No are no longer supported.
1545
1546 If _corruptionPossible_ is true, a slightly larger buffer size is returned.
1547
1548 If _corruptionPossible_ is false, then you must ensure that the decoder does not get corrupted data,
1549 either by passing $OodleLZ_CheckCRC_Yes , or by your own mechanism.
1550
1551 Note about possible overrun in LZ decoding (applies to the old non-fuzz-safe compressors) :
1552 as long as the compresseddata is not corrupted,
1553 and you decode either the entire compressed buffer, or an integer number of "seek chunks" ($OODLELZ_BLOCK_LEN),
1554 then there will be no overrun. So you can decode LZ data in place and it won't stomp any following bytes.
1555 If those conditions are not true (eg. decoding only part of a larger compressed stream, decoding
1556 around a circular window, decoding data that may be corrupted), then there may be some limited amount of
1557 overrun on decode, as returned by $OodleLZ_GetDecodeBufferSize.
1558
1559
1560*/
1561
1562// OodleLZ_GetInPlaceDecodeBufferSize :
1563// after compressing, ask how big the in-place buffer needs to be
1565/* Get the size of buffer needed for "in place" decode
1567 $:compressor compressor used; OodleLZ_Compressor_Invalid to make it enough for any compressor
1568 $:compLen compressed data length
1569 $:rawLen decompressed data length
1570 $:return size of buffer needed for "in place" decode ; slighly larger than rawLen
1571
1572 To do an "in place" decode, allocate a buffer of this size (or larger). Read the compressed data into the end of
1573 the buffer, and decompress to the front of the buffer. The size returned here guarantees that the writes to the
1574 front of the buffer don't conflict with the reads from the end.
1575
1576 If _compressor_ is one of the new codecs (Kraken,Mermaid,Selkie,Leviathan), the padding for in place decodes can be
1577 very small indeed. It is assumed you will be passing FuzzSafe_Yes to the decompress call.
1578
1579 If _compLen_ is unknown, you want an in place buffer size that can accomodate any compressed data, then
1580 pass compLen = 0.
1581
1582 See $OodleLZ_Decompress for more.
1583*/
1584
1585// GetCompressedStepForRawStep is at OODLELZ_QUANTUM_LEN granularity
1586// returns how many packed bytes to step to get the desired raw count step
1588 const void * compPtr, OO_SINTa compAvail,
1592/* How many bytes to step a compressed pointer to advance a certain uncompressed amount
1593
1594 $:compPtr current compressed pointer
1595 $:compAvail compressed bytes available at compPtr
1596 $:startRawPos initial raw pos (corresponding to compPtr)
1597 $:rawSeekBytes the desired step in raw bytes, must be a multiple of $OODLELZ_QUANTUM_LEN or $OODLELZ_BLOCK_LEN
1598 $:pEndRawPos (optional) filled with the end raw pos actually reached
1599 $:pIndependent (optional) filled with a bool that is true if the current chunk is independent from previous
1600 $:return the number of compressed bytes to step
1601
1602 You should try to use GetCompressedStepForRawStep only at block granularity - both _startRawPos_ and
1603 _rawSeekBytes_ should be multiples of OODLELZ_BLOCK_LEN (except at the end of the stream). As long as you
1604 do that, then *pEndRawPos will = startRawPos + rawSeekBytes.
1605
1606 You can use it at quantum granularity (OODLELZ_QUANTUM_LEN), but there are some caveats. You cannot step
1607 quanta inside uncompressed blocks, only in normal LZ blocks. If you try to seek quanta inside an uncompressed
1608 block, you will get *pEndRawPos = the end of the block.
1609
1610 You can only resume seeking from *pEndRawPos .
1611
1612 returns 0 for valid not-enough-data case
1613 returns -1 for error
1614
1615 If _compAvail_ is not the whole compressed buffer, then the returned step may be less than the amount you requested.
1616 eg. if the compressed data in _compAvail_ does not contain enough data to make a step of _rawSeekBytes_ a smaller
1617 step will be taken.
1618 NOTE : *can* return comp step > comp avail !
1619
1620
1621*/
1622
1625/* ask who compressed all chunks in this buf chunk
1626
1627 $:compBuf pointer to compressed data; must be the start of compressed buffer, or a step of $OODLELZ_BLOCK_LEN raw bytes
1628 $:compBufSize size of _compBuf_
1629 $:rawLen rawlen of data in _compBuf_
1630 $:return the $OodleLZ_Compressor used to encode this chunk
1631
1632 returns a simple compressor (for example OodleLZ_Compressor_Kraken) if that was used on all chunks
1633
1634 returns OodleLZ_Compressor_Hydra if different NewLZ encoders were used (for example Kraken+Mermaid)
1635
1636 returns OodleLZ_Compressor_Count if a heterogenous mix of compressors was used (not just NewLZ)
1637
1638 returns OodleLZ_Compressor_Invalid on error
1639
1640 note this is only for this chunk - later chunks may have different compressors (eg. with Hydra)
1641 if you compressed all chunks the same it's up to you to store that info in your header
1642
1643 returns OodleLZ_Compressor_Invalid if _compBufSize_ is too small or any chunk is corrupt
1644*/
1649/* ask who compressed this chunk
1650
1651 $:compChunkPtr pointer to compressed data; must be the start of compressed buffer, or a step of $OODLELZ_BLOCK_LEN raw bytes
1652 $:compBufAvail number of bytes at _compChunkPtr_ available to read
1653 $:pIndependent (optional) filled with a bool for whether this chunk is independent of predecessors
1654 $:return the $OodleLZ_Compressor used to encode this chunk
1655
1656 note this is only for this chunk - later chunks may have different compressors (eg. with Hydra)
1657 if you compressed all chunks the same it's up to you to store that info in your header
1659 Use $OodleLZ_GetAllChunksCompressor for data that might be mixed compressors.
1660
1661 This replaces the deprecated function $OodleLZ_GetChunkCompressor
1662
1663 returns OodleLZ_Compressor_Invalid if _compBufAvail_ is too small or the chunk is corrupt
1664*/
1665
1669/* Deprecated entry point for backwards compatibility
1670
1671 Use $OodleLZ_GetFirstChunkCompressor or $OodleLZ_GetAllChunksCompressor
1672
1673*/
1674
1675//=======================================================
1677#define OODLE_HEADER_VERSION ((46<<24)|(OODLE2_VERSION_MAJOR<<16)|(OODLE2_VERSION_MINOR<<8)|(OO_U32)sizeof(OodleLZ_SeekTable)) /* OODLE_HEADER_VERSION is used to ensure the Oodle header matches the lib. Don't copy the value of this macro, it will change when
1678 the header is rev'ed.
1679
1680 This is what you pass to $OodleX_Init or $Oodle_CheckVersion
1681*/
1682
1684/* Check the Oodle lib version against the header you are compiling with
1685
1686 $:oodle_header_version pass $OODLE_HEADER_VERSION here
1687 $:pOodleLibVersion (optional) filled with the Oodle lib version
1688 $:return false if $OODLE_HEADER_VERSION is not compatible with this lib
1689
1690 If you use the Oodle2 Ext lib,, $OodleX_Init does it for you. But if you want to check that you have a
1691 compatible lib before trying to Init, then use this.
1692*/
1693
1695/* Log the Oodle version & copyright
1696
1697 Uses the log set with $OodleCore_Plugins_SetPrintf
1698*/
1699
1700// define old names so they still compile :
1701#define OODLECORE_PLUGIN_JOB_MAX_DEPENDENCIES OODLE_JOB_MAX_DEPENDENCIES
1702#define t_fp_OodleCore_Plugin_Job t_fp_Oodle_Job
1703
1704#ifdef _MSC_VER
1705#pragma warning(pop)
1706#pragma pack(pop, Oodle)
1707#endif
1708
1709#endif // __OODLE2_H_INCLUDED__
OO_S32 maxLocalDictionarySize
Definition oodle2.h:284
OodleLZ_CompressScratchMemBoundType
Definition oodle2.h:1406
@ OodleLZ_CompressScratchMemBoundType_Force32
Definition oodle2.h:1410
@ OodleLZ_CompressScratchMemBoundType_Typical
Definition oodle2.h:1408
@ OodleLZ_CompressScratchMemBoundType_WorstCase
Definition oodle2.h:1407
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetInPlaceDecodeBufferSize(OodleLZ_Compressor compressor, OO_SINTa compLen, OO_SINTa rawLen)
#define OODLELZ_COMPRESSOR_BOOLBIT(s, c)
Definition oodle2.h:1298
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_Compress(OodleLZ_Compressor compressor, const void *rawBuf, OO_SINTa rawLen, void *compBuf, OodleLZ_CompressionLevel level, const OodleLZ_CompressOptions *pOptions OODEFAULT(NULL), const void *dictionaryBase OODEFAULT(NULL), const void *lrm OODEFAULT(NULL), void *scratchMem OODEFAULT(NULL), OO_SINTa scratchSize OODEFAULT(0))
OOFUNC1 OO_BOOL OOFUNC2 OodleCore_Plugin_DisplayAssertion_Default(const char *file, const int line, const char *function, const char *message)
OO_BOOL OodleLZ_Compressor_RespectsDictionarySize(OodleLZ_Compressor compressor)
Definition oodle2.h:1330
OOFUNC1 OO_BOOL OOFUNC2 OodleLZDecoder_Reset(OodleLZDecoder *decoder, OO_SINTa decPos, OO_SINTa decLen OODEFAULT(0))
OO_BOOL OodleLZ_Compressor_CanDecodeInCircularWindow(OodleLZ_Compressor compressor)
Definition oodle2.h:1365
OOFUNC1 OO_BOOL OOFUNC2 OodleLZDecoder_DecodeSome(OodleLZDecoder *decoder, OodleLZ_DecodeSome_Out *out, void *decBuf, OO_SINTa decBufPos, OO_SINTa decBufferSize, OO_SINTa decBufAvail, const void *compPtr, OO_SINTa compAvail, OodleLZ_FuzzSafe fuzzSafe OODEFAULT(OodleLZ_FuzzSafe_No), OodleLZ_CheckCRC checkCRC OODEFAULT(OodleLZ_CheckCRC_No), OodleLZ_Verbosity verbosity OODEFAULT(OodleLZ_Verbosity_None), OodleLZ_Decode_ThreadPhase threadPhase OODEFAULT(OodleLZ_Decode_Unthreaded))
OODEFFUNC typedef const OO_U8 OO_SINTa const OO_U8 OO_SINTa OO_SINTa rawDone
Definition oodle2.h:161
OodleLZ_Jobify jobify
Definition oodle2.h:288
OOFUNC1 void OOFUNC2 OodleCore_Plugins_SetJobSystem(t_fp_OodleCore_Plugin_RunJob *fp_RunJob, t_fp_OodleCore_Plugin_WaitJob *fp_WaitJob)
OOFUNC1 OO_S32 OOFUNC2 OodleLZDecoder_MakeValidCircularWindowSize(OodleLZ_Compressor compressor, OO_S32 minWindowSize OODEFAULT(0))
OO_S64 totalRawLen
Definition oodle2.h:460
OodleLZ_CheckCRC
Definition oodle2.h:120
@ OodleLZ_CheckCRC_Force32
Definition oodle2.h:123
@ OodleLZ_CheckCRC_No
Definition oodle2.h:121
@ OodleLZ_CheckCRC_Yes
Definition oodle2.h:122
OOFUNC1 OodleLZ_SeekTable *OOFUNC2 OodleLZ_CreateSeekTable(OodleLZSeekTable_Flags flags, OO_S32 seekChunkLen, const void *rawBuf, OO_SINTa rawLen, const void *compBuf, OO_SINTa compLen)
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetDecodeBufferSize(OodleLZ_Compressor compressor, OO_SINTa rawSize, OO_BOOL corruptionPossible)
OO_BOOL OodleLZ_Compressor_CanDecodeFuzzSafe(OodleLZ_Compressor compressor)
Definition oodle2.h:1311
OODEFFUNC typedef const OO_U8 * rawBuf
Definition oodle2.h:161
OodleLZ_CompressionLevel
Definition oodle2.h:176
@ OodleLZ_CompressionLevel_Optimal3
Definition oodle2.h:185
@ OodleLZ_CompressionLevel_Optimal4
Definition oodle2.h:186
@ OodleLZ_CompressionLevel_Min
Definition oodle2.h:198
@ OodleLZ_CompressionLevel_HyperFast4
Definition oodle2.h:192
@ OodleLZ_CompressionLevel_Invalid
Definition oodle2.h:201
@ OodleLZ_CompressionLevel_Optimal2
Definition oodle2.h:184
@ OodleLZ_CompressionLevel_HyperFast
Definition oodle2.h:195
@ OodleLZ_CompressionLevel_Optimal5
Definition oodle2.h:187
@ OodleLZ_CompressionLevel_Fast
Definition oodle2.h:180
@ OodleLZ_CompressionLevel_Force32
Definition oodle2.h:200
@ OodleLZ_CompressionLevel_VeryFast
Definition oodle2.h:179
@ OodleLZ_CompressionLevel_None
Definition oodle2.h:177
@ OodleLZ_CompressionLevel_HyperFast3
Definition oodle2.h:191
@ OodleLZ_CompressionLevel_SuperFast
Definition oodle2.h:178
@ OodleLZ_CompressionLevel_HyperFast2
Definition oodle2.h:190
@ OodleLZ_CompressionLevel_Optimal
Definition oodle2.h:196
@ OodleLZ_CompressionLevel_Normal
Definition oodle2.h:181
@ OodleLZ_CompressionLevel_Max
Definition oodle2.h:197
@ OodleLZ_CompressionLevel_Optimal1
Definition oodle2.h:183
@ OodleLZ_CompressionLevel_HyperFast1
Definition oodle2.h:189
OOFUNC1 void OOFUNC2 Oodle_LogHeader(void)
OO_S32 unused_was_maxHuffmansPerChunk
Definition oodle2.h:282
Oodle_UsageWarnings
Definition oodle2.h:525
@ Oodle_UsageWarnings_Force32
Definition oodle2.h:528
@ Oodle_UsageWarnings_Enabled
Definition oodle2.h:526
@ Oodle_UsageWarnings_Disabled
Definition oodle2.h:527
OODEFFUNC typedef const int const char const char * message
Definition oodle2.h:710
OODEFFUNC typedef const char * file
Definition oodle2.h:678
OODEFFUNC typedef const char int const char * fmt
Definition oodle2.h:678
OOFUNC1 const char *OOFUNC2 OodleLZ_Jobify_GetName(OodleLZ_Jobify jobify)
OOFUNC1 void OOFUNC2 OodleCore_Plugin_Free_Default(void *ptr)
OOFUNC1 OodleLZDecoder *OOFUNC2 OodleLZDecoder_Create(OodleLZ_Compressor compressor, OO_S64 rawLen, void *memory, OO_SINTa memorySize)
OOFUNC1 void OOFUNC2 OodleCore_Plugin_WaitJob_Default(OO_U64 job_handle, void *user_ptr)
OOFUNC1 const char *OOFUNC2 OodleLZ_Compressor_GetName(OodleLZ_Compressor compressor)
OOFUNC1 const OodleLZ_CompressOptions *OOFUNC2 OodleLZ_CompressOptions_GetDefault(OodleLZ_Compressor compressor OODEFAULT(OodleLZ_Compressor_Invalid), OodleLZ_CompressionLevel lzLevel OODEFAULT(OodleLZ_CompressionLevel_Normal))
OODEFFUNC typedef const char int const char OOFUNC1 t_fp_OodleCore_Plugin_Printf *OOFUNC2 OodleCore_Plugins_SetPrintf(t_fp_OodleCore_Plugin_Printf *fp_rrRawPrintf)
OODEFFUNC typedef const OO_U8 OO_SINTa const OO_U8 * compBuf
Definition oodle2.h:161
OOFUNC1 void OOFUNC2 Oodle_SetConfigValues(const OodleConfigValues *ptr)
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetSeekTableMemorySizeNeeded(OO_S32 numSeekChunks, OodleLZSeekTable_Flags flags)
OODEFFUNC typedef const OO_U8 OO_SINTa rawLen
Definition oodle2.h:161
OodleLZ_Decode_ThreadPhase
Definition oodle2.h:390
@ OodleLZ_Decode_ThreadPhaseAll
Definition oodle2.h:393
@ OodleLZ_Decode_ThreadPhase2
Definition oodle2.h:392
@ OodleLZ_Decode_Unthreaded
Definition oodle2.h:394
@ OodleLZ_Decode_ThreadPhase1
Definition oodle2.h:391
OO_S32 curQuantumCompLen
Definition oodle2.h:446
OO_S32 m_OodleLZ_LW_LRM_jumpbits
Definition oodle2.h:484
OOFUNC1 void OOFUNC2 OodleCore_Plugin_Printf_Default(int verboseLevel, const char *file, int line, const char *fmt,...)
OOFUNC1 OodleLZ_Compressor OOFUNC2 OodleLZ_GetAllChunksCompressor(const void *compBuf, OO_SINTa compBufSize, OO_SINTa rawLen)
OodleLZ_Profile
Definition oodle2.h:138
@ OodleLZ_Profile_Main
Definition oodle2.h:139
@ OodleLZ_Profile_Reduced
Definition oodle2.h:140
@ OodleLZ_Profile_Force32
Definition oodle2.h:141
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetCompressScratchMemBound(OodleLZ_Compressor compressor, OodleLZ_CompressionLevel level, OO_SINTa rawLen, const OodleLZ_CompressOptions *pOptions OODEFAULT(NULL))
OODEFSTART OO_BOOL OodleLZ_Compressor_UsesWholeBlockQuantum(OodleLZ_Compressor compressor)
Definition oodle2.h:1349
OO_S32 numSeekChunks
Definition oodle2.h:463
OOFUNC1 void OOFUNC2 OodleCore_Plugin_Printf_Verbose(int verboseLevel, const char *file, int line, const char *fmt,...)
OOFUNC1 OO_S32 OOFUNC2 OodleLZDecoder_MemorySizeNeeded(OodleLZ_Compressor compressor OODEFAULT(OodleLZ_Compressor_Invalid), OO_SINTa rawLen OODEFAULT(-1))
OOFUNC1 OO_BOOL OOFUNC2 Oodle_CheckVersion(OO_U32 oodle_header_version, OO_U32 *pOodleLibVersion OODEFAULT(NULL))
OOFUNC1 OodleLZ_Compressor OOFUNC2 OodleLZ_GetChunkCompressor(const void *compChunkPtr, OO_SINTa compBufAvail, OO_BOOL *pIndependent)
OOFUNC1 void OOFUNC2 Oodle_SetUsageWarnings(Oodle_UsageWarnings state)
OODEFFUNC typedef void *OODLE_CALLBACK t_fp_OodleCore_Plugin_MallocAligned(OO_SINTa bytes, OO_S32 alignment)
OODEFFUNC typedef void * job_data
Definition oodle2.h:588
OOFUNC1 OO_S32 OOFUNC2 OodleLZ_FindSeekEntry(OO_S64 rawPos, const OodleLZ_SeekTable *seekTable)
OODEFFUNC typedef const OO_U8 OO_SINTa const OO_U8 OO_SINTa OO_SINTa OO_SINTa compUsed
Definition oodle2.h:161
OOFUNC1 OO_S64 OOFUNC2 OodleLZ_GetSeekEntryPackedPos(OO_S32 seekI, const OodleLZ_SeekTable *seekTable)
OODEFFUNC typedef const int const char * function
Definition oodle2.h:710
OO_BOOL sendQuantumCRCs
Definition oodle2.h:283
OodleDecompressCallbackRet
Definition oodle2.h:151
@ OodleDecompressCallbackRet_Cancel
Definition oodle2.h:153
@ OodleDecompressCallbackRet_Invalid
Definition oodle2.h:154
@ OodleDecompressCallbackRet_Continue
Definition oodle2.h:152
@ OodleDecompressCallbackRet_Force32
Definition oodle2.h:155
OOFUNC1 OO_BOOL OOFUNC2 OodleLZ_FillSeekTable(OodleLZ_SeekTable *pTable, OodleLZSeekTable_Flags flags, OO_S32 seekChunkLen, const void *rawBuf, OO_SINTa rawLen, const void *compBuf, OO_SINTa compLen)
OO_U32 reserved[4]
Definition oodle2.h:294
OO_S32 m_OodleLZ_BackwardsCompatible_MajorVersion
Definition oodle2.h:488
OO_S32 dictionarySize
Definition oodle2.h:280
OodleLZ_Profile profile
Definition oodle2.h:279
OO_S32 m_OodleLZ_LW_LRM_hashLength
Definition oodle2.h:483
OOFUNC1 OO_BOOL OOFUNC2 OodleLZ_CheckSeekTableCRCs(const void *rawBuf, OO_SINTa rawLen, const OodleLZ_SeekTable *seekTable)
OOFUNC1 void *OOFUNC2 OodleCore_Plugin_MallocAligned_Default(OO_SINTa size, OO_S32 alignment)
OO_U32 m_oodle_header_version
Definition oodle2.h:490
OO_S64 totalCompLen
Definition oodle2.h:461
OOFUNC1 OodleLZ_Compressor OOFUNC2 OodleLZ_GetFirstChunkCompressor(const void *compChunkPtr, OO_SINTa compBufAvail, OO_BOOL *pIndependent)
OOFUNC1 void OOFUNC2 OodleLZ_CompressOptions_Validate(OodleLZ_CompressOptions *pOptions)
OOSTRUCT OodleLZ_DecodeSome_Out
Definition oodle2.h:440
OO_BOOL makeLongRangeMatcher
Definition oodle2.h:285
OO_S32 m_OodleLZ_Decoder_Max_Stack_Size
Definition oodle2.h:486
OOINLINEFUNC OO_BOOL OodleLZ_Compressor_IsNewLZFamily(OodleLZ_Compressor compressor)
Definition oodle2.h:1300
OO_S32 minMatchLen
Definition oodle2.h:276
OOFUNC1 const char *OOFUNC2 OodleLZ_CompressionLevel_GetName(OodleLZ_CompressionLevel compressSelect)
OOFUNC1 void OOFUNC2 Oodle_GetConfigValues(OodleConfigValues *ptr)
OO_BOOL OodleLZ_Compressor_CanDecodeInPlace(OodleLZ_Compressor compressor)
Definition oodle2.h:1359
OO_BOOL seekChunksIndependent
Definition oodle2.h:458
OOFUNC1 OO_U64 OOFUNC2 OodleCore_Plugin_RunJob_Default(t_fp_Oodle_Job *fp_job, void *job_data, OO_U64 *dependencies, int num_dependencies, void *user_ptr)
OodleLZ_Compressor
Definition oodle2.h:63
@ OodleLZ_Compressor_Invalid
Definition oodle2.h:64
@ OodleLZ_Compressor_Kraken
Definition oodle2.h:68
@ OodleLZ_Compressor_None
Definition oodle2.h:65
@ OodleLZ_Compressor_Selkie
Definition oodle2.h:71
@ OodleLZ_Compressor_Count
Definition oodle2.h:85
@ OodleLZ_Compressor_Leviathan
Definition oodle2.h:69
@ OodleLZ_Compressor_Force32
Definition oodle2.h:86
@ OodleLZ_Compressor_Mermaid
Definition oodle2.h:70
@ OodleLZ_Compressor_Hydra
Definition oodle2.h:72
OO_S32 matchTableSizeLog2
Definition oodle2.h:286
OOFUNC1 void OOFUNC2 OodleCore_Plugins_SetAllocators(t_fp_OodleCore_Plugin_MallocAligned *fp_OodleMallocAligned, t_fp_OodleCore_Plugin_Free *fp_OodleFree)
OOSTRUCT OodleConfigValues
Definition oodle2.h:481
OO_S32 seekChunkLen
Definition oodle2.h:278
OodleLZSeekTable_Flags
Definition oodle2.h:471
@ OodleLZSeekTable_Flags_MakeRawCRCs
Definition oodle2.h:473
@ OodleLZSeekTable_Flags_None
Definition oodle2.h:472
@ OodleLZSeekTable_Flags_Force32
Definition oodle2.h:474
OOFUNC1 void OOFUNC2 OodleCore_Plugins_SetJobSystemAndCount(t_fp_OodleCore_Plugin_RunJob *fp_RunJob, t_fp_OodleCore_Plugin_WaitJob *fp_WaitJob, int target_parallelism)
OOFUNC1 void OOFUNC2 OodleLZ_FreeSeekTable(OodleLZ_SeekTable *pTable)
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
OO_BOOL OodleLZ_Compressor_UsesLargeWindow(OodleLZ_Compressor compressor)
Definition oodle2.h:1378
OOFUNC1 OO_S32 OOFUNC2 OodleLZ_ThreadPhased_BlockDecoderMemorySizeNeeded(void)
OodleLZ_FuzzSafe
Definition oodle2.h:406
@ OodleLZ_FuzzSafe_Yes
Definition oodle2.h:408
@ OodleLZ_FuzzSafe_No
Definition oodle2.h:407
OO_S32 m_OodleLZ_Small_Buffer_LZ_Fallback_Size_Unused
Definition oodle2.h:487
struct _OodleLZDecoder OodleLZDecoder
Definition oodle2.h:908
OO_U32 * rawCRCs
Definition oodle2.h:467
void * jobifyUserPtr
Definition oodle2.h:289
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetCompressedBufferSizeNeeded(OodleLZ_Compressor compressor, OO_SINTa rawSize)
OOFUNC1 void OOFUNC2 OodleLZDecoder_Destroy(OodleLZDecoder *decoder)
OodleLZ_Verbosity
Definition oodle2.h:48
@ OodleLZ_Verbosity_Some
Definition oodle2.h:51
@ OodleLZ_Verbosity_Minimal
Definition oodle2.h:50
@ OodleLZ_Verbosity_Force32
Definition oodle2.h:53
@ OodleLZ_Verbosity_Lots
Definition oodle2.h:52
@ OodleLZ_Verbosity_None
Definition oodle2.h:49
OO_BOOL OodleLZ_Compressor_CanDecodeThreadPhased(OodleLZ_Compressor compressor)
Definition oodle2.h:1354
OOFUNC1 OO_S32 OOFUNC2 OodleLZ_GetNumSeekChunks(OO_S64 rawLen, OO_S32 seekChunkLen)
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetCompressScratchMemBoundEx(OodleLZ_Compressor compressor, OodleLZ_CompressionLevel level, OodleLZ_CompressScratchMemBoundType boundType, OO_SINTa rawLen, const OodleLZ_CompressOptions *pOptions OODEFAULT(NULL))
OO_S32 farMatchOffsetLog2
Definition oodle2.h:292
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_Decompress(const void *compBuf, OO_SINTa compBufSize, void *rawBuf, OO_SINTa rawLen, OodleLZ_FuzzSafe fuzzSafe OODEFAULT(OodleLZ_FuzzSafe_Yes), OodleLZ_CheckCRC checkCRC OODEFAULT(OodleLZ_CheckCRC_No), OodleLZ_Verbosity verbosity OODEFAULT(OodleLZ_Verbosity_None), void *decBufBase OODEFAULT(NULL), OO_SINTa decBufSize OODEFAULT(0), OodleDecompressCallback *fpCallback OODEFAULT(NULL), void *callbackUserData OODEFAULT(NULL), void *decoderMemory OODEFAULT(NULL), OO_SINTa decoderMemorySize OODEFAULT(0), OodleLZ_Decode_ThreadPhase threadPhase OODEFAULT(OodleLZ_Decode_Unthreaded))
OO_S32 spaceSpeedTradeoffBytes
Definition oodle2.h:281
OOSTRUCT OodleLZ_SeekTable
Definition oodle2.h:456
OO_U32 * seekChunkCompLens
Definition oodle2.h:466
OO_BOOL OodleLZ_Compressor_MustDecodeWithoutResets(OodleLZ_Compressor compressor)
Definition oodle2.h:1384
OOFUNC1 OO_S32 OOFUNC2 OodleLZ_MakeSeekChunkLen(OO_S64 rawLen, OO_S32 desiredSeekPointCount)
OODEFFUNC typedef const char int line
Definition oodle2.h:678
OO_S32 curQuantumRawLen
Definition oodle2.h:445
OOSTRUCT OodleLZ_CompressOptions
Definition oodle2.h:274
#define OODLELZ_COMPRESSOR_MASK(c)
Definition oodle2.h:1296
OODEFFUNC typedef const OO_U8 OO_SINTa const OO_U8 OO_SINTa compBufferSize
Definition oodle2.h:161
OO_S32 farMatchMinLen
Definition oodle2.h:291
OodleLZ_PackedRawOverlap
Definition oodle2.h:111
@ OodleLZ_PackedRawOverlap_Yes
Definition oodle2.h:113
@ OodleLZ_PackedRawOverlap_No
Definition oodle2.h:112
@ OodleLZ_PackedRawOverlap_Force32
Definition oodle2.h:114
OO_S32 compBufUsed
Definition oodle2.h:442
OOFUNC1 OO_SINTa OOFUNC2 OodleLZ_GetCompressedStepForRawStep(const void *compPtr, OO_SINTa compAvail, OO_SINTa startRawPos, OO_SINTa rawSeekBytes, OO_SINTa *pEndRawPos OODEFAULT(NULL), OO_BOOL *pIndependent OODEFAULT(NULL))
OODEFFUNC typedef void OO_U64 * dependencies
Definition oodle2.h:588
OO_BOOL seekChunkReset
Definition oodle2.h:277
OODEFFUNC typedef void OO_U64 int void * user_ptr
Definition oodle2.h:588
OOFUNC1 t_fp_OodleCore_Plugin_DisplayAssertion *OOFUNC2 OodleCore_Plugins_SetAssertion(t_fp_OodleCore_Plugin_DisplayAssertion *fp_rrDisplayAssertion)
OODEFFUNC typedef void OO_U64 int num_dependencies
Definition oodle2.h:588
OodleLZ_Jobify
Definition oodle2.h:234
@ OodleLZ_Jobify_Normal
Definition oodle2.h:237
@ OodleLZ_Jobify_Force32
Definition oodle2.h:241
@ OodleLZ_Jobify_Aggressive
Definition oodle2.h:238
@ OodleLZ_Jobify_Disable
Definition oodle2.h:236
@ OodleLZ_Jobify_Count
Definition oodle2.h:239
@ OodleLZ_Jobify_Default
Definition oodle2.h:235
#define NULL
Definition oodle2base.h:134
#define OODEFEND
Definition oodle2base.h:71
intptr_t OO_SINTa
Definition oodle2base.h:39
int32_t OO_S32
Definition oodle2base.h:33
int32_t OO_BOOL
Definition oodle2base.h:41
int64_t OO_S64
Definition oodle2base.h:35
#define OODEFAULT(val)
Definition oodle2base.h:72
#define OODEFFUNC
Definition oodle2base.h:69
#define t_fp_Oodle_Job
Definition oodle2base.h:154
#define OOFUNC2
Definition oodle2base.h:124
uint64_t OO_U64
Definition oodle2base.h:36
uint32_t OO_U32
Definition oodle2base.h:34
#define OODLE_CALLBACK
Definition oodle2base.h:126
uint8_t OO_U8
Definition oodle2base.h:30
#define OODEFSTART
Definition oodle2base.h:70
#define OO_COMPILER_ASSERT(exp)
Definition oodle2base.h:109
#define OOFUNC1
Definition oodle2base.h:123
GLenum GLuint GLint level
Definition AndroidOpenGLFunctions.h:46
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const void OO_SINTa void OodleLZ_CompressionLevel const OodleLZ_CompressOptions * pOptions
Definition OodleDataCompressionFormat.cpp:94
t_fp_OodleCore_Plugin_Free * fp_OodleFree
Definition OodleDataCompressionFormat.cpp:100
const void OO_SINTa rawLen
Definition OodleDataCompressionFormat.cpp:92
const void OO_SINTa void * compBuf
Definition OodleDataCompressionFormat.cpp:92
const void * rawBuf
Definition OodleDataCompressionFormat.cpp:92
const void OO_SINTa void OodleLZ_CompressionLevel const OodleLZ_CompressOptions const void const void * lrm
Definition OodleDataCompressionFormat.cpp:96
const void OO_SINTa void OodleLZ_CompressionLevel const OodleLZ_CompressOptions const void * dictionaryBase
Definition OodleDataCompressionFormat.cpp:95