Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zlib-ng 2.2.3 #109

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ else
endif


DEFINES += $(addprefix -I$(SOURCE_PATH),. brotli/include libcsc libdeflate xpack/common xz xz/api xz/check xz/common xz/lz xz/lzma xz/rangecoder zstd/lib zstd/lib/common)
DEFINES += $(addprefix -I$(SOURCE_PATH),. brotli/include libcsc libdeflate xpack/common xz xz/api xz/check xz/common xz/lz xz/lzma xz/rangecoder zstd/lib zstd/lib/common zlib-ng)
DEFINES += -DHAVE_CONFIG_H -DFL2_SINGLETHREAD
CODE_FLAGS += -Wno-unknown-pragmas -Wno-sign-compare -Wno-conversion

Expand Down Expand Up @@ -116,6 +116,23 @@ ZLIB_FILES = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/gzc
ZLIB_FILES += zlib/gzwrite.o zlib/infback.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o
ZLIB_FILES += zlib/uncompr.o zlib/zutil.o

ifeq "$(DONT_BUILD_ZLIB_NG)" "1"
DEFINES += -DBENCH_REMOVE_ZLIB_NG
else
ZLIB_NG_FILES = zlib-ng/adler32.o zlib-ng/crc32.o zlib-ng/deflate_medium.o zlib-ng/deflate_stored.o zlib-ng/inftrees.o zlib-ng/uncompr.o
ZLIB_NG_FILES += zlib-ng/compress.o zlib-ng/deflate.o zlib-ng/deflate_quick.o zlib-ng/functable.o zlib-ng/insert_string.o zlib-ng/zutil.o
ZLIB_NG_FILES += zlib-ng/cpu_features.o zlib-ng/deflate_fast.o zlib-ng/deflate_rle.o zlib-ng/infback.o zlib-ng/insert_string_roll.o
ZLIB_NG_FILES += zlib-ng/crc32_braid_comb.o zlib-ng/deflate_huff.o zlib-ng/deflate_slow.o zlib-ng/inflate.o zlib-ng/trees.o

ZLIB_NG_FILES += zlib-ng/arch/generic/adler32_c.o zlib-ng/arch/generic/chunkset_c.o zlib-ng/arch/generic/crc32_braid_c.o zlib-ng/arch/generic/slide_hash_c.o
ZLIB_NG_FILES += zlib-ng/arch/generic/adler32_fold_c.o zlib-ng/arch/generic/compare256_c.o zlib-ng/arch/generic/crc32_fold_c.o

# ZLIB_NG_FILES += zlib-ng/arch/x86/adler32_avx2.o zlib-ng/arch/x86/adler32_ssse3.o zlib-ng/arch/x86/chunkset_ssse3.o zlib-ng/arch/x86/crc32_vpclmulqdq.o
# ZLIB_NG_FILES += zlib-ng/arch/x86/adler32_avx512.o zlib-ng/arch/x86/chunkset_avx2.o zlib-ng/arch/x86/compare256_avx2.o zlib-ng/arch/x86/slide_hash_avx2.o
# ZLIB_NG_FILES += zlib-ng/arch/x86/adler32_avx512_vnni.o zlib-ng/arch/x86/chunkset_avx512.o zlib-ng/arch/x86/compare256_sse2.o zlib-ng/arch/x86/slide_hash_sse2.o
# ZLIB_NG_FILES += zlib-ng/arch/x86/adler32_sse42.o zlib-ng/arch/x86/chunkset_sse2.o zlib-ng/arch/x86/crc32_pclmulqdq.o zlib-ng/arch/x86/x86_features.o
endif

LZMAT_FILES = lzmat/lzmat_dec.o lzmat/lzmat_enc.o

LZRW_FILES = lzrw/lzrw1-a.o lzrw/lzrw1.o lzrw/lzrw2.o lzrw/lzrw3.o lzrw/lzrw3-a.o
Expand Down Expand Up @@ -359,7 +376,7 @@ $(NVCOMP_CPP_OBJ): %.cpp.o: %.cpp

_lzbench/lzbench.o: _lzbench/lzbench.cpp _lzbench/lzbench.h

lzbench: $(BZIP2_FILES) $(DENSITY_FILES) $(FASTLZMA2_OBJ) $(ZSTD_FILES) $(GLZA_FILES) $(LZSSE_FILES) $(LZFSE_FILES) $(XPACK_FILES) $(GIPFELI_FILES) $(XZ_FILES) $(LIBLZG_FILES) $(BRIEFLZ_FILES) $(LZF_FILES) $(LZRW_FILES) $(BROTLI_FILES) $(CSC_FILES) $(LZMA_FILES) $(ZLING_FILES) $(QUICKLZ_FILES) $(SNAPPY_FILES) $(ZLIB_FILES) $(LZHAM_FILES) $(LZO_FILES) $(UCL_FILES) $(LZMAT_FILES) $(LZ4_FILES) $(LIBDEFLATE_FILES) $(MISC_FILES) $(NVCOMP_FILES) $(LZBENCH_FILES)
lzbench: $(BZIP2_FILES) $(DENSITY_FILES) $(FASTLZMA2_OBJ) $(ZSTD_FILES) $(GLZA_FILES) $(LZSSE_FILES) $(LZFSE_FILES) $(XPACK_FILES) $(GIPFELI_FILES) $(XZ_FILES) $(LIBLZG_FILES) $(BRIEFLZ_FILES) $(LZF_FILES) $(LZRW_FILES) $(BROTLI_FILES) $(CSC_FILES) $(LZMA_FILES) $(ZLING_FILES) $(QUICKLZ_FILES) $(SNAPPY_FILES) $(ZLIB_FILES) $(ZLIB_NG_FILES) $(LZHAM_FILES) $(LZO_FILES) $(UCL_FILES) $(LZMAT_FILES) $(LZ4_FILES) $(LIBDEFLATE_FILES) $(MISC_FILES) $(NVCOMP_FILES) $(LZBENCH_FILES)
$(CXX) $^ -o $@ $(LDFLAGS)
@echo Linked GCC_VERSION=$(GCC_VERSION) CLANG_VERSION=$(CLANG_VERSION) COMPILER=$(COMPILER)

Expand All @@ -376,4 +393,4 @@ lzbench: $(BZIP2_FILES) $(DENSITY_FILES) $(FASTLZMA2_OBJ) $(ZSTD_FILES) $(GLZA_F
$(CXX) $(CFLAGS) $< -c -o $@

clean:
rm -rf lzbench lzbench.exe *.o _lzbench/*.o bzip2/*.o fast-lzma2/*.o slz/*.o zstd/lib/*.o zstd/lib/*.a zstd/lib/common/*.o zstd/lib/compress/*.o zstd/lib/decompress/*.o zstd/lib/dictBuilder/*.o lzsse/lzsse2/*.o lzsse/lzsse4/*.o lzsse/lzsse8/*.o lzfse/*.o xpack/lib/*.o blosclz/*.o gipfeli/*.o xz/*.o xz/common/*.o xz/check/*.o xz/lzma/*.o xz/lz/*.o xz/rangecoder/*.o liblzg/*.o lzlib/*.o brieflz/*.o brotli/common/*.o brotli/enc/*.o brotli/dec/*.o libcsc/*.o wflz/*.o lzjb/*.o lzma/*.o density/buffers/*.o density/algorithms/*.o density/algorithms/cheetah/core/*.o density/algorithms/*.o density/algorithms/lion/forms/*.o density/algorithms/lion/core/*.o density/algorithms/chameleon/core/*.o density/*.o density/structure/*.o pithy/*.o glza/*.o libzling/*.o yappy/*.o shrinker/*.o fastlz/*.o ucl/*.o zlib/*.o lzham/*.o lzmat/*.o lz4/*.o crush/*.o lzf/*.o lzrw/*.o lzo/*.o snappy/*.o quicklz/*.o tornado/*.o libdeflate/lib/*.o libdeflate/lib/x86/*.o libdeflate/lib/arm/*.o nakamichi/*.o nvcomp/*.o
rm -rf lzbench lzbench.exe *.o _lzbench/*.o bzip2/*.o fast-lzma2/*.o slz/*.o zstd/lib/*.o zstd/lib/*.a zstd/lib/common/*.o zstd/lib/compress/*.o zstd/lib/decompress/*.o zstd/lib/dictBuilder/*.o lzsse/lzsse2/*.o lzsse/lzsse4/*.o lzsse/lzsse8/*.o lzfse/*.o xpack/lib/*.o blosclz/*.o gipfeli/*.o xz/*.o xz/common/*.o xz/check/*.o xz/lzma/*.o xz/lz/*.o xz/rangecoder/*.o liblzg/*.o lzlib/*.o brieflz/*.o brotli/common/*.o brotli/enc/*.o brotli/dec/*.o libcsc/*.o wflz/*.o lzjb/*.o lzma/*.o density/buffers/*.o density/algorithms/*.o density/algorithms/cheetah/core/*.o density/algorithms/*.o density/algorithms/lion/forms/*.o density/algorithms/lion/core/*.o density/algorithms/chameleon/core/*.o density/*.o density/structure/*.o pithy/*.o glza/*.o libzling/*.o yappy/*.o shrinker/*.o fastlz/*.o ucl/*.o zlib/*.o zlib-ng/*.o zlib-ng/arch/generic/*.o zlib-ng/arch/x86/*.o lzham/*.o lzmat/*.o lz4/*.o crush/*.o lzf/*.o lzrw/*.o lzo/*.o snappy/*.o quicklz/*.o tornado/*.o libdeflate/lib/*.o libdeflate/lib/x86/*.o libdeflate/lib/arm/*.o nakamichi/*.o nvcomp/*.o
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ see the [CompFuzz Results](https://github.com/nemequ/compfuzz/wiki/Results) page
- [yalz77 2015-09-19](https://github.com/ivan-tkatchev/yalz77) - WARNING: A SEGFAULT was encountered with gcc 13.3.0 on the 32-bit ARM (arm-linux-gnueabi) target
- [yappy 2014-03-22](https://encode.su/threads/2825-Yappy-(working)-compressor) - WARNING: A SEGFAULT was encountered with gcc 13.3.0 on the 32-bit ARM (arm-linux-gnueabi)
- [zlib 1.2.11](http://zlib.net)
- [zlib-ng 2.2.3](https://github.com/zlib-ng/zlib-ng)
- [zling 2018-10-12](https://github.com/richox/libzling) - according to the author using libzling in a production environment is not a good idea
- [zstd 1.5.5](https://github.com/facebook/zstd)
- [nvcomp 1.2.3](https://github.com/NVIDIA/nvcomp) - If CUDA is available.
Expand Down
26 changes: 26 additions & 0 deletions _lzbench/compressors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,32 @@ int64_t lzbench_zlib_decompress(char *inbuf, size_t insize, char *outbuf, size_t

#endif

#ifndef BENCH_REMOVE_ZLIB_NG

#undef z_const
#undef Z_NULL

#include "zlib-ng/zlib-ng.h"

int64_t lzbench_zlib_ng_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t level, size_t, char*)
{
uLongf zcomplen = insize;
int err = zng_compress2((uint8_t*)outbuf, &zcomplen, (uint8_t*)inbuf, insize, level);
if (err != Z_OK)
return 0;
return zcomplen;
}

int64_t lzbench_zlib_ng_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*)
{
uLongf zdecomplen = outsize;
int err = zng_uncompress((uint8_t*)outbuf, &zdecomplen, (uint8_t*)inbuf, insize);
if (err != Z_OK)
return 0;
return outsize;
}

#endif


#if !defined(BENCH_REMOVE_SLZ) && !defined(BENCH_REMOVE_ZLIB)
Expand Down
9 changes: 9 additions & 0 deletions _lzbench/compressors.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,15 @@ int64_t lzbench_return_0(char *inbuf, size_t insize, char *outbuf, size_t outsiz
#endif


#ifndef BENCH_REMOVE_ZLIB_NG
int64_t lzbench_zlib_ng_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
int64_t lzbench_zlib_ng_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
#else
#define lzbench_zlib_ng_compress NULL
#define lzbench_zlib_ng_decompress NULL
#endif


#ifndef BENCH_REMOVE_ZLING
int64_t lzbench_zling_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
int64_t lzbench_zling_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
Expand Down
3 changes: 2 additions & 1 deletion _lzbench/lzbench.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ typedef struct



#define LZBENCH_COMPRESSOR_COUNT 72
#define LZBENCH_COMPRESSOR_COUNT 73

static const compressor_desc_t comp_desc[LZBENCH_COMPRESSOR_COUNT] =
{
Expand Down Expand Up @@ -210,6 +210,7 @@ static const compressor_desc_t comp_desc[LZBENCH_COMPRESSOR_COUNT] =
{ "yalz77", "2015-09-19", 1, 12, 0, 0, lzbench_yalz77_compress, lzbench_yalz77_decompress, NULL, NULL },
{ "yappy", "2014-03-22", 0, 99, 0, 0, lzbench_yappy_compress, lzbench_yappy_decompress, lzbench_yappy_init, NULL },
{ "zlib", "1.2.11", 1, 9, 0, 0, lzbench_zlib_compress, lzbench_zlib_decompress, NULL, NULL },
{ "zlib-ng", "2.2.3", 1, 9, 0, 0, lzbench_zlib_ng_compress, lzbench_zlib_ng_decompress, NULL, NULL },
{ "zling", "2018-10-12", 0, 4, 0, 0, lzbench_zling_compress, lzbench_zling_decompress, NULL, NULL },
{ "zstd", "1.5.5", 1, 22, 0, 0, lzbench_zstd_compress, lzbench_zstd_decompress, lzbench_zstd_init, lzbench_zstd_deinit },
{ "zstd_fast", "1.5.5", -5, -1, 0, 0, lzbench_zstd_compress, lzbench_zstd_decompress, lzbench_zstd_init, lzbench_zstd_deinit },
Expand Down
19 changes: 19 additions & 0 deletions zlib-ng/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(C) 1995-2024 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.
Loading