/lz4-3.4.0-2.7.6/examples/ |
D | frameCompress.c | 41 exit(1); in safe_fwrite() 62 compressResult_t result = { 1, 0, 0 }; /* result for an error */ in compress_file_internal() 79 safe_fwrite(outBuff, 1, headerSize, f_out); in compress_file_internal() 84 size_t const readSize = fread(inBuff, 1, IN_CHUNK_SIZE, f_in); in compress_file_internal() 98 safe_fwrite(outBuff, 1, compressedSize, f_out); in compress_file_internal() 112 safe_fwrite(outBuff, 1, compressedSize, f_out); in compress_file_internal() 135 compressResult_t result = { 1, 0, 0 }; /* == error (default) */ in compress_file() 159 case LZ4F_max64KB: return 1 << 16; in get_block_size() 160 case LZ4F_max256KB: return 1 << 18; in get_block_size() 161 case LZ4F_max1MB: return 1 << 20; in get_block_size() [all …]
|
D | blockStreaming_lineByLine.md | 26 (1) 30 | Line#1 | 34 {Out#1} 43 | Line#1 | Line#2 | 56 | Line#1 | Line#2 | Line#3 | 69 | .... | Line#X | Line#X+1 | 73 | {Out#X+1} 84 | .... | Line#X | Line#X+1 | Line#X+2 | 93 Next (see (1)), read first line to ringbuffer and compress it by `LZ4_compress_continue()`. 95 so it just compress the line without dependencies and generates compressed line {Out#1} to LZ4 comp… [all …]
|
D | compress_functions.c | 77 #define ID__LZ4_COMPRESS_DEFAULT 1 100 run_screaming(message, 1); in usage() 123 const int acceleration = 1; in bench() 133 if (rv < 1) in bench() 136 …According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); in bench() 138 for (int i=1; i<=iterations; i++) in bench() 146 if (rv < 1) in bench() 149 …According to memcmp(), the compressed dst we got doesn't match the known_good_dst... ruh roh.", 1); in bench() 151 for (int i=1; i<=iterations; i++) in bench() 159 if (rv < 1) in bench() [all …]
|
D | dictionaryRandomAccess.c | 17 BLOCK_BYTES = 1024, /* 1 KiB of uncompressed data in a block */ 18 DICTIONARY_BYTES = 1024, /* Load a 1 KiB dictionary */ 31 size_t written = fwrite(&i, sizeof(i), 1, fp); in write_int() 32 if (written != 1) { exit(10); } in write_int() 36 size_t written = fwrite(array, 1, arrayBytes, fp); in write_bin() 41 size_t read = fread(i, sizeof(*i), 1, fp); in read_int() 42 if (read != 1) { exit(12); } in read_int() 46 size_t read = fread(array, 1, arrayBytes, fp); in read_bin() 85 lz4Stream, inpBuf, cmpBuf, inpBytes, sizeof(cmpBuf), 1); in test_compress() 86 if(cmpBytes <= 0) { exit(1); } in test_compress() [all …]
|
D | HCStreaming_ringBuffer.c | 39 return fwrite(&i, sizeof(i), 1, fp); in write_int32() 44 return fwrite(array, 1, (size_t)arrayBytes, fp); in write_bin() 48 return fread(i, sizeof(*i), 1, fp); in read_int32() 53 return fread(array, 1, (size_t)arrayBytes, fp); in read_bin() 66 // Read random length ([1,MESSAGE_MAX_BYTES]) data to the ring buffer. in test_compress() 68 const int randomLength = (rand() % MESSAGE_MAX_BYTES) + 1; in test_compress() 105 if(r0 != 1 || cmpBytes <= 0) in test_decompress() 135 size_t result = 1; in compare() 140 const size_t r0 = fread(b0, 1, sizeof(b0), f0); in compare() 141 const size_t r1 = fread(b1, 1, sizeof(b1), f1); in compare() [all …]
|
D | blockStreaming_lineByLine.c | 18 return fwrite(&i, sizeof(i), 1, fp); in write_uint16() 23 return fwrite(array, 1, arrayBytes, fp); in write_bin() 28 return fread(i, sizeof(*i), 1, fp); in read_uint16() 33 return fread(array, 1, arrayBytes, fp); in read_bin() 55 const int randomLength = (rand() % messageMaxBytes) + 1; in test_compress() 68 lz4Stream, inpPtr, cmpBuf, inpBytes, cmpBufBytes, 1); in test_compress() 101 if (read_uint16(inpFp, &cmpBytes) != 1) break; in test_decompress() 133 const size_t r0 = fread(b0, 1, tempBufferBytes, f0); in compare() 134 const size_t r1 = fread(b1, 1, tempBufferBytes, f1); in compare() 165 snprintf(inpFilename, 256, "%s", argv[1]); in main() [all …]
|
D | blockStreaming_ringBuffer.c | 32 return fwrite(&i, sizeof(i), 1, fp); in write_int32() 36 return fwrite(array, 1, arrayBytes, fp); in write_bin() 40 return fread(i, sizeof(*i), 1, fp); in read_int32() 44 return fread(array, 1, arrayBytes, fp); in read_bin() 57 // Read random length ([1,MESSAGE_MAX_BYTES]) data to the ring buffer. in test_compress() 59 const int randomLength = (rand() % MESSAGE_MAX_BYTES) + 1; in test_compress() 94 if(r0 != 1 || cmpBytes <= 0) break; in test_decompress() 121 const size_t r0 = fread(b0, 1, sizeof(b0), f0); in compare() 122 const size_t r1 = fread(b1, 1, sizeof(b1), f1); in compare() 146 snprintf(inpFilename, 256, "%s", argv[1]); in main() [all …]
|
D | blockStreaming_doubleBuffer.c | 23 return fwrite(&i, sizeof(i), 1, fp); in write_int() 27 return fwrite(array, 1, arrayBytes, fp); in write_bin() 31 return fread(i, sizeof(*i), 1, fp); in read_int() 35 return fread(array, 1, arrayBytes, fp); in read_bin() 59 lz4Stream, inpPtr, cmpBuf, inpBytes, sizeof(cmpBuf), 1); in test_compress() 67 inpBufIndex = (inpBufIndex + 1) % 2; in test_compress() 90 if(readCount0 != 1 || cmpBytes <= 0) { in test_decompress() 110 decBufIndex = (decBufIndex + 1) % 2; in test_decompress() 150 snprintf(inpFilename, 256, "%s", argv[1]); in main() 151 snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[1], BLOCK_BYTES); in main() [all …]
|
D | blockStreaming_doubleBuffer.md | 23 Double buffer has two pages, "first" page (Page#1) and "second" page (Page#2). 28 Page#1 Page#2 30 | Block#1 | | 34 {Out#1} 42 | Block#1 | Block#2 | 75 so it just compress the line without dependencies and generates compressed block {Out#1} to LZ4 com… 76 After that, write {Out#1} to the file. 79 This time, LZ4 can use dependency to Block#1 to improve compression ratio.
|
D | dictionaryRandomAccess.md | 25 | Block#1 | 29 {Out#1} 46 If there are `N` blocks, then just before the last 4 bytes is `N + 1` 4 byte integers containing th… 51 | TEST | Block#1 | ... | Block#N | 4 | Offset#1 | ... | Offset#N | N+1 |
|
D | streaming_api_basics.md | 36 Example (1) : Block API, 4KiB Block 40 | Block #1 | Block #2 | #3 | #4 |... | 50 | Block #1 |Block #2 |... | 62 | Block #1 | Block #2 | #3 | #4 |... | 70 - In example (1), there is no dependency. 73 But still block #1 and #2 are compressed independently. 74 - In example (3), block #2 has dependency to #1, 75 also #3 has dependency to #2 and #1, #4 has #3, #2 and #1, and so on.
|
D | simple_buffer.c | 32 // 1) The return codes of LZ4_ functions are important. in main() 42 … needs to know how many bytes exist. Since we're using a string, we can use strlen() + 1 (for \0). in main() 43 const int src_size = (int)(strlen(src) + 1); in main() 49 run_screaming("Failed to allocate memory for *compressed_data.", 1); in main() 56 …negative result from LZ4_compress_default() indicates a failure trying to compress the data. ", 1); in main() 64 run_screaming("Failed to re-alloc memory for compressed_data. Sad :(", 1); in main() 78 run_screaming("Failed to allocate memory for *regen_buffer.", 1); in main() 91 run_screaming("Decompressed data is different from original! \n", 1); in main() 96 run_screaming("Validation failed. *src and *new_src are not identical.", 1); in main()
|
/lz4-3.4.0-2.7.6/programs/ |
D | lz4cli.c | 60 #define KB *(1U<<10) 61 #define MB *(1U<<20) 62 #define GB *(1U<<30) 73 static unsigned displayLevel = 2; /* 0 : no display ; 1: errors only ; 2 : downgradable normal ; … 84 DISPLAYLEVEL(1, "Error %i : ", error); \ 85 DISPLAYLEVEL(1, __VA_ARGS__); \ 86 DISPLAYLEVEL(1, "\n"); \ 113 DISPLAY( " -1 : Fast compression (default) \n"); in usage() 151 DISPLAY( "--fast[=#]: switch to ultra fast compression level (default: %i)\n", 1); in usage_advanced() 154 DISPLAY( " -b# : benchmark file(s), using # compression level (default : 1) \n"); in usage_advanced() [all …]
|
D | Makefile | 36 LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' <… 37 LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' <… 38 LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p'… 53 -Wpointer-arith -Wstrict-aliasing=1 65 # silent mode by default; verbose can be triggered by V=1 or VERBOSE=1 116 lz4.1: lz4.1.md $(LIBVER_SRC) 119 man: lz4.1 122 $(RM) lz4.1 125 man ./lz4.1 174 $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 [all …]
|
D | bench.c | 136 int const acceleration = (pThis->cLevel < 0) ? -pThis->cLevel + 1 : 1; in LZ4_compressBlockNoStream() 153 int const acceleration = (pThis->cLevel < 0) ? -pThis->cLevel + 1 : 1; in LZ4_compressBlockStream() 231 #define TIMELOOP_MICROSEC 1*1000000ULL /* 1 second */ 232 #define TIMELOOP_NANOSEC 1*1000000000ULL /* 1 second */ 235 #define DECOMP_MULT 1 /* test decompression DECOMP_MULT times longer than compression */ 237 #define KB *(1 <<10) 238 #define MB *(1 <<20) 239 #define GB *(1U<<30) 243 static const size_t maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t)(1ULL << ((sizeof(… 253 static U32 g_displayLevel = 2; /* 0 : no display; 1: errors; 2 : + result + interaction + war… [all …]
|
D | lz4io.c | 41 # define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */ 66 #define KB *(1 <<10) 67 #define MB *(1 <<20) 68 #define GB *(1U<<30) 95 static int g_displayLevel = 0; /* 0 : no display ; 1: errors ; 2 : + result + interaction + war… 106 #define LZ4IO_STATIC_ASSERT(c) { enum { LZ4IO_static_assert = 1/(int)(!!(c)) }; } /* use after … 140 DISPLAYLEVEL(1, "Error %i : ", error); \ 141 DISPLAYLEVEL(1, __VA_ARGS__); \ 142 DISPLAYLEVEL(1, " \n"); \ 165 ret->overwrite = 1; in LZ4IO_defaultPreferences() [all …]
|
D | datagen.c | 40 #define KB *(1 <<10) 50 #define LTSIZE (1<<LTLOG) 51 #define LTMASK (LTSIZE-1) 80 U32 const weight = (U32)((double)(LTSIZE - u) * ld) + 1; in RDG_fillLiteralDistrib() 112 size0 = (size_t)1 << (16 + size0 * 2); in RDG_genBlock() 113 size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/ in RDG_genBlock() 120 buffPtr[pos-1] = RDG_genChar(seed, lt); in RDG_genBlock() 126 pos=1; in RDG_genBlock() 137 U32 offset = RDG_RAND15BITS + 1; in RDG_genBlock() 185 fwrite(buff, 1, genBlockSize, stdout); /* should check potential write error */ in RDG_genOut()
|
/lz4-3.4.0-2.7.6/tests/ |
D | fuzzer.c | 77 #define NB_ATTEMPTS (1<<16) 78 #define COMPRESSIBLE_NOISE_LENGTH (1 << 21) 79 #define FUZ_MAX_BLOCK_SIZE (1 << 17) 80 #define FUZ_MAX_DICT_SIZE (1 << 15) 86 #define KB *(1U<<10) 87 #define MB *(1U<<20) 88 #define GB *(1U<<30) 129 while (v32) { v32 >>= 1; nbBits++; } in FUZ_highbit32() 163 size_t offset = (size_t)FUZ_RAND15BITS + 1; in FUZ_fillCompressibleNoiseBuffer() 164 while (offset > pos) offset >>= 1; in FUZ_fillCompressibleNoiseBuffer() [all …]
|
D | fullbench.c | 29 # define BMK_LEGACY_TIMER 1 63 #define KB *(1 <<10) 64 #define MB *(1 <<20) 65 #define GB *(1U<<30) 101 static int g_compressionTest = 1; 103 static int g_decompressionTest = 1; 121 g_pause = 1; in BMK_setPause() 139 requiredMem = (((requiredMem >> 26) + 1) << 26); in BMK_findMaxMem() 145 else requiredMem >>= 1; in BMK_findMaxMem() 152 else requiredMem >>= 1; in BMK_findMaxMem() [all …]
|
D | frametest.c | 59 dstPtr[1] = (BYTE)(value32 >> 8); in FUZ_writeLE32() 70 #define KB *(1U<<10) 71 #define MB *(1U<<20) 72 #define GB *(1U<<30) 143 size_t const offsetRand = FUZ_RAND15BITS + 1; in FUZ_fillCompressibleNoiseBuffer() 161 while (v32) {v32 >>= 1; nbBits ++;} in FUZ_highbit() 193 crcOrig = XXH64(CNBuffer, COMPRESSIBLE_NOISE_LENGTH, 1); in basicTests() 203 DISPLAYLEVEL(3, "LZ4F_compressBound(1 KB, autoFlush=1) = "); in basicTests() 207 autoFlushPrefs.autoFlush = 1; in basicTests() 208 cBound = LZ4F_compressBound(1 KB, &autoFlushPrefs); in basicTests() [all …]
|
D | checkTag.c | 32 * Example : tag v1.8.1.2 is compatible with version 1.8.1 33 * When tag and version are not compatible, program exits with error code 1. 44 * @return 1 if tag is compatible, 0 if not. 55 if (strncmp(LZ4_VERSION_STRING, tag+1, verLength)) return 0; in validate() 57 return 1; in validate() 63 const char* const tag = argv[1]; in main() 78 return 1; in main()
|
/lz4-3.4.0-2.7.6/lib/ |
D | lz4.c | 41 * in memory stack (0:default, fastest), or in memory heap (1:requires malloc()). 44 # define LZ4_HEAPMODE 1 51 #define LZ4_ACCELERATION_DEFAULT 1 68 * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). 74 * Prefer these methods in priority order (0 > 1 > 2) 82 # define LZ4_FORCE_MEMORY_ACCESS 1 105 # define LZ4_SRC_INCLUDED 1 174 #define likely(expr) expect((expr) != 0, 1) 183 # define LZ4_ALIGN_TEST 1 198 # define ALLOC_AND_ZERO(s) LZ4_calloc(1,s) [all …]
|
D | lz4hc.c | 43 * in stack (0:fastest), or in heap (1:requires malloc()). 47 # define LZ4HC_HEAPMODE 1 75 #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) 76 #define LZ4_OPT_NUM (1<<12) 103 if (startingOffset > 1 GB) { in LZ4HC_init_internal() 147 assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31)); in LZ4HC_countBack() 148 assert(match >= mMin); assert((size_t)(match - mMin) < (1U<<31)); in LZ4HC_countBack() 150 && (ip[back-1] == match[back-1]) ) in LZ4HC_countBack() 164 size_t const bitsToRotate = (rotate & (sizeof(pattern) - 1)) << 3; in LZ4HC_rotatePattern() 170 * pattern32 must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) */ [all …]
|
/lz4-3.4.0-2.7.6/ossfuzz/ |
D | fuzz_data_producer.c | 26 producer->size -= 1; in FUZZ_dataProducer_retrieve32() 27 return (uint32_t)data[size - 1]; in FUZZ_dataProducer_retrieve32() 40 return min + seed % (range + 1); in FUZZ_getRange_from_uint32() 53 info.blockSizeID = FUZZ_dataProducer_range32(producer, LZ4F_max64KB - 1, LZ4F_max4MB); in FUZZ_dataProducer_frameInfo() 70 prefs.autoFlush = FUZZ_dataProducer_range32(producer, 0, 1); in FUZZ_dataProducer_preferences() 71 prefs.favorDecSpeed = FUZZ_dataProducer_range32(producer, 0, 1); in FUZZ_dataProducer_preferences()
|
/lz4-3.4.0-2.7.6/contrib/gen_manual/ |
D | gen_manual.cpp | 50 s.erase(p+1); in trim() 108 int linenum, chapter = 1; in main() 118 return 1; in main() 121 version = string(argv[1]) + " Manual"; in main() 126 return 1; in main() 132 return 1; in main() 180 …comments[comments.size()-1] = comments[comments.size()-1].substr(0, comments[comments.size()-1].fi… in main() 188 …while (!comments.empty() && comments[comments.size()-1].empty()) comments.pop_back(); // remove em… in main() 209 for (l=1; l<comments.size(); l++) { in main() 226 for (l=1; l<comments.size(); l++) { in main() [all …]
|