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 libnxz #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
33 changes: 31 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ ifeq (1,$(filter 1,$(shell [ "$(COMPILER)" = "gcc" ] && expr $(GCC_VERSION) \< 6
DONT_BUILD_ZLING ?= 1
endif

# libnxz requires the NX GZIP accelerator
ifeq ($(wildcard /dev/crypto/nx-gzip),)
DONT_BUILD_LIBNXZ ?= 1
endif

# detect Windows
ifneq (,$(filter Windows%,$(OS)))
ifeq ($(COMPILER),clang)
Expand Down Expand Up @@ -181,6 +186,30 @@ MISC_FILES += lzlib/lzlib.o blosclz/blosclz.o blosclz/fastcopy.o slz/slz.o

LZBENCH_FILES = _lzbench/lzbench.o _lzbench/compressors.o _lzbench/csc_codec.o

ifeq "$(DONT_BUILD_LIBNXZ)" "1"
DEFINES += -DBENCH_REMOVE_LIBNXZ
else
LDFLAGS += -ldl
DEFINES += -Ipower-gzip/inc_nx -DZLIB_PATH='"power-gzip/lib/libz.so"'
LIBNXZ_FILES = power-gzip/lib/nx_zlib.o
LIBNXZ_FILES += power-gzip/lib/gzip_vas.o
LIBNXZ_FILES += power-gzip/lib/nx_inflate.o
LIBNXZ_FILES += power-gzip/lib/crc32_ppc.o
LIBNXZ_FILES += power-gzip/lib/nx_dht_builtin.o
LIBNXZ_FILES += power-gzip/lib/nx_adler32.o
LIBNXZ_FILES += power-gzip/lib/nx_uncompr.o
LIBNXZ_FILES += power-gzip/lib/nx_compress.o
#LIBNXZ_FILES += power-gzip/lib/nx_adler_combine.o
LIBNXZ_FILES += power-gzip/lib/nx_deflate.o
LIBNXZ_FILES += power-gzip/lib/nx_dht.o
LIBNXZ_FILES += power-gzip/lib/nx_utils.o
LIBNXZ_FILES += power-gzip/lib/nx_dhtgen.o
LIBNXZ_FILES += power-gzip/lib/nx_dht_decomp.o
LIBNXZ_FILES += power-gzip/lib/nx_crc.o
LIBNXZ_FILES += power-gzip/lib/sw_zlib.o
LIBNXZ_FILES += power-gzip/lib/crc32_ppc_asm.S
endif

ifeq "$(DONT_BUILD_BZIP2)" "1"
DEFINES += -DBENCH_REMOVE_BZIP2
else
Expand Down Expand Up @@ -353,7 +382,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) $(LZHAM_FILES) $(LZO_FILES) $(UCL_FILES) $(LZMAT_FILES) $(LZ4_FILES) $(LIBDEFLATE_FILES) $(MISC_FILES) $(NVCOMP_FILES) $(LIBNXZ_FILES) $(LZBENCH_FILES)
$(CXX) $^ -o $@ $(LDFLAGS)
@echo Linked GCC_VERSION=$(GCC_VERSION) CLANG_VERSION=$(CLANG_VERSION) COMPILER=$(COMPILER)

Expand All @@ -370,4 +399,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 lizard/*.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 lzham/*.o lzmat/*.o lizard/*.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 power-gzip/lib/*.o
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ see the [CompFuzz Results](https://github.com/nemequ/compfuzz/wiki/Results) page
- [gipfeli 2016-07-13](https://github.com/google/gipfeli)
- [glza 0.8](https://encode.su/threads/2427-GLZA)
- [libdeflate v1.6](https://github.com/ebiggers/libdeflate)
- [libnxz 0.63](https://github.com/libnxz/power-gzip)
- [lizard v1.0 (formerly lz5)](https://github.com/inikep/lizard)
- [lz4/lz4hc v1.9.3](https://github.com/lz4/lz4)
- [lzf 3.6](http://software.schmorp.de/pkg/liblzf.html)
Expand Down
20 changes: 20 additions & 0 deletions _lzbench/compressors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,26 @@ int64_t lzbench_libdeflate_decompress(char *inbuf, size_t insize, char *outbuf,



#ifndef BENCH_REMOVE_LIBNXZ
#include "power-gzip/libnxz.h"

int64_t lzbench_libnxz_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t level, size_t, char*)
{
// Only supports level=6 (see nx_deflateInit2_)
nx_compress2((unsigned char *)outbuf, (ulong *)&outsize,
(const unsigned char *)inbuf, (ulong)insize,
(int)level);
return outsize;
}
int64_t lzbench_libnxz_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*)
{
nx_uncompress2((unsigned char *)outbuf, (ulong *)&outsize,
(const unsigned char *)inbuf, (ulong *)&insize);
return outsize;
}
#endif


#ifndef BENCH_REMOVE_LIZARD
#include "lizard/lizard_compress.h"
#include "lizard/lizard_decompress.h"
Expand Down
9 changes: 9 additions & 0 deletions _lzbench/compressors.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ int64_t lzbench_return_0(char *inbuf, size_t insize, char *outbuf, size_t outsiz
#endif


#ifndef BENCH_REMOVE_LIBNXZ
int64_t lzbench_libnxz_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t level, size_t, char*);
int64_t lzbench_libnxz_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
#else
#define lzbench_libnxz_compress NULL
#define lzbench_libnxz_decompress NULL
#endif


#ifndef BENCH_REMOVE_LIZARD
int64_t lzbench_lizard_compress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t level, size_t, char*);
int64_t lzbench_lizard_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t, size_t, char*);
Expand Down
7 changes: 4 additions & 3 deletions _lzbench/lzbench.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ typedef struct



#define LZBENCH_COMPRESSOR_COUNT 73
#define LZBENCH_COMPRESSOR_COUNT 74

static const compressor_desc_t comp_desc[LZBENCH_COMPRESSOR_COUNT] =
{
Expand All @@ -156,6 +156,7 @@ static const compressor_desc_t comp_desc[LZBENCH_COMPRESSOR_COUNT] =
{ "gipfeli", "2016-07-13", 0, 0, 0, 0, lzbench_gipfeli_compress, lzbench_gipfeli_decompress, NULL, NULL },
{ "glza", "0.8", 0, 0, 0, 0, lzbench_glza_compress, lzbench_glza_decompress, NULL, NULL },
{ "libdeflate", "1.9", 1, 12, 0, 0, lzbench_libdeflate_compress, lzbench_libdeflate_decompress, NULL, NULL },
{ "libnxz", "0.63", 6, 6, 0, 0, lzbench_libnxz_compress, lzbench_libnxz_decompress, NULL, NULL },
{ "lz4", "1.9.3", 0, 0, 0, 0, lzbench_lz4_compress, lzbench_lz4_decompress, NULL, NULL },
{ "lz4fast", "1.9.3", 1, 99, 0, 0, lzbench_lz4fast_compress, lzbench_lz4_decompress, NULL, NULL },
{ "lz4hc", "1.9.3", 1, 12, 0, 0, lzbench_lz4hc_compress, lzbench_lz4_decompress, NULL, NULL },
Expand Down Expand Up @@ -226,14 +227,14 @@ static const alias_desc_t alias_desc[LZBENCH_ALIASES_COUNT] =
"lzrw,1,3,4,5/lzsse4fast/lzsse8fast/lzvn/pithy,0,3,6,9/quicklz,1,2/shrinker/snappy/tornado,1,2,3/zstd,1,2,3,4,5" }, // default alias
#if !defined(__arm__) && !defined(__aarch64__)
{ "all", "blosclz,1,3,6,9/brieflz,1,3,6,8/brotli,0,2,5,8,11/bzip2,1,5,9/" \
"crush,0,1,2/csc,1,3,5/density,1,2,3/fastlz,1,2/fastlzma2,1,3,5,8,10/gipfeli/libdeflate,1,3,6,9,12/lizard,10,12,15,19,20,22,25,29,30,32,35,39,40,42,45,49/lz4/lz4fast,3,17/lz4hc,1,4,9,12/" \
"crush,0,1,2/csc,1,3,5/density,1,2,3/fastlz,1,2/fastlzma2,1,3,5,8,10/gipfeli/libdeflate,1,3,6,9,12/libnxz,1,3,6,9/lizard,10,12,15,19,20,22,25,29,30,32,35,39,40,42,45,49/lz4/lz4fast,3,17/lz4hc,1,4,9,12/" \
"lzf,0,1/lzfse/lzg,1,4,6,8/lzham,0,1/lzjb/lzlib,0,3,6,9/lzma,0,2,4,5,9/lzo1/lzo1a/lzo1b,1,3,6,9,99,999/lzo1c,1,3,6,9,99,999/lzo1f/lzo1x/lzo1y/lzo1z/lzo2a/" \
"lzrw,1,3,4,5/lzsse2,1,6,12,16/lzsse4,1,6,12,16/lzsse8,1,6,12,16/lzvn/pithy,0,3,6,9/quicklz,1,2,3/slz_gzip/snappy/tornado,1,2,3,4,5,6,7,10,13,16/" \
"ucl_nrv2b,1,6,9/ucl_nrv2d,1,6,9/ucl_nrv2e,1,6,9/xpack,1,6,9/xz,0,3,6,9/yalz77,1,4,8,12/yappy,1,10,100/zlib,1,6,9/zling,0,1,2,3,4/zstd,1,2,5,8,11,15,18,22/" \
"shrinker/wflz/lzmat" }, // these can SEGFAULT
#else
{ "all", "blosclz,1,3,6,9/brieflz,1,3,6,8/brotli,0,2,5,8/bzip2,1,5,9/" \
"crush,0,1,2/csc,1,3,5/density,1,2,3/fastlz,1,2/gipfeli/libdeflate,1,3,6,9,12/lizard,10,12,15,20,22,25,30,32,35,40,42,45/lz4/lz4fast,3,17/lz4hc,1,4,9/" \
"crush,0,1,2/csc,1,3,5/density,1,2,3/fastlz,1,2/gipfeli/libdeflate,1,3,6,9,12/libnxz,1,3,6,9/lizard,10,12,15,20,22,25,30,32,35,40,42,45/lz4/lz4fast,3,17/lz4hc,1,4,9/" \
"lzf,0,1/lzfse/lzg,1,4,6,8/lzham,0,1/lzjb/lzlib,0,3,6,9/lzma,0,2,4,5/lzo1/lzo1a/lzo1b,1,3,6,9,99,999/lzo1c,1,3,6,9,99,999/lzo1f/lzo1x/lzo1y/lzo1z/lzo2a/" \
"lzrw,1,3,4,5/lzsse2,1,6,12,16/lzsse4,1,6,12,16/lzsse8,1,6,12,16/lzvn/pithy,0,3,6,9/quicklz,1,2,3/slz_gzip/snappy/tornado,1,2,3,4,5,6,7,10,13,16/" \
"ucl_nrv2b,1,6,9/ucl_nrv2d,1,6,9/ucl_nrv2e,1,6,9/xpack,1,6,9/xz,0,3,6,9/yalz77,1,4,8,12/yappy,1,10,100/zlib,1,6,9/zling,0,1,2,3,4/zstd,1,2,5,8,11,15,18,22/" \
Expand Down
13 changes: 13 additions & 0 deletions power-gzip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.o
*.a
*.d
*.diff
*.log
*.patch
*.so.*
*.so
*~
config.status
configure.scan
autom4te.cache
config.mk
43 changes: 43 additions & 0 deletions power-gzip/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
language: c

matrix:
include:
- name: "linux-ppc64le-gcc-9"
os: linux
dist: bionic
arch: ppc64le
compiler: gcc-9
env:
- CXX="g++-9"
- PKG_CC="gcc-9 g++-9"
- name: "linux-ppc64le-gcc-10"
os: linux
dist: bionic
arch: ppc64le
compiler: gcc-10
env:
- CXX="g++-10"
- PKG_CC="gcc-10 g++-10"
- name: "linux-ppc64le-gcc-11"
os: linux
dist: focal
arch: ppc64le
compiler: gcc-11
env:
- CXX="g++-11"
- PKG_CC="gcc-11 g++-11"

before_install:
- sudo add-apt-repository universe
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update
- travis_wait 5 sudo apt-get -y install ${PKG_CC} doxygen graphviz

script:
- mkdir $(pwd)/install
- ./configure --prefix=$(pwd)/install
- make -j$(nproc)
- make -j$(nproc) -C test build-TESTS
- make -j$(nproc) bench
- make -j$(nproc) -C selftest all
- make -j$(nproc) install
46 changes: 46 additions & 0 deletions power-gzip/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
EMPTY_AUTOMAKE_TARGETS=selftest

ACLOCAL_AMFLAGS = -I m4

include aminclude.am

# List of directories built by default.
SUBDIRS = lib test samples

DIST_SUBDIRS = doc inc_nx oct

dist_doc_DATA = licenses/APACHE-2.0.txt licenses/gpl-2.0.txt

include_HEADERS = libnxz.h

if DX_COND_doc
doc_target = doc
endif DX_COND_doc

VALGRIND_FLAGS="--leak-check=full \
--suppressions=$(abs_top_srcdir)/test/valgrind.supp \
--error-exitcode=1"

all: $(SUBDIRS) $(doc_target)

$(SUBDIRS):
@if [ -d $@ ]; then \
$(MAKE) -C $@ || exit 1; \
fi

bench: $(SUBDIRS)
$(MAKE) -C samples $@

valgrind-check: $(SUBDIRS)
$(MAKE) -C test check \
LOG_COMPILER="${VALGRIND}" LOG_FLAGS=$(VALGRIND_FLAGS)

if DX_COND_doc
doc: doc/libnxz.doxy
doxygen $<

MOSTLYCLEANFILES = $(DX_CLEANFILES)
endif DX_COND_doc

selftest:
$(MAKE) $(AM_MAKEFLAGS)-C $(abs_srcdir)/$@ run_tests
Loading