Skip to content

Commit

Permalink
Implement vectorized adler32 and optimized slhash
Browse files Browse the repository at this point in the history
Should give a little speed increase over normal zlib, especially on Neon.

This is basically a merge of https://github.com/kaffeemonster/zlib/tree/slhash

Change-Id: I86ba9ca19c16ec940afb5a9ac2c941b5071ac0c2

Signed-off-by: Jim Huang <jserv@0xlab.org>
  • Loading branch information
arco authored and jserv committed Dec 30, 2011
1 parent 69e5801 commit 13bf40a
Show file tree
Hide file tree
Showing 120 changed files with 6,778 additions and 13,944 deletions.
19 changes: 19 additions & 0 deletions .gitignore
@@ -0,0 +1,19 @@
*.diff
*.patch
*.orig
*.rej

*~
*.a
*.lo
*.o
*.dylib

/example
/example64
/examplesh
/libz.so*
/minigzip
/minigzip64
/minigzipsh
/zlib.pc
3 changes: 2 additions & 1 deletion Android.mk
Expand Up @@ -20,7 +20,8 @@ zlib_files := \
inflate.c \
infback.c \
inftrees.c \
inffast.c
inffast.c \
slhash.c

LOCAL_MODULE := libz
LOCAL_MODULE_TAGS := optional
Expand Down
50 changes: 49 additions & 1 deletion ChangeLog
@@ -1,12 +1,60 @@

ChangeLog file for zlib

Changes in 1.2.5.2 (xx Sep 2011)
-

Changes in 1.2.5.1 (10 Sep 2011)
- Update FAQ entry on shared builds (#13)
- Avoid symbolic argument to chmod in Makefile.in
- Fix bug and add consts in contrib/puff [Oberhumer]
- Update contrib/puff/zeros.raw test file to have all block types
- Add full coverage test for puff in contrib/puff/Makefile
- Fix static-only-build install in Makefile.in
- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
- Add libz.a dependency to shared in Makefile.in for parallel builds
- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
- Replace $(...) with `...` in configure for non-bash sh [Bowler]
- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
- Add solaris* to Linux* in configure to allow gcc use [Groffen]
- Add *bsd* to Linux* case in configure [Bar-Lev]
- Add inffast.obj to dependencies in win32/Makefile.msc
- Correct spelling error in deflate.h [Kohler]
- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
- Add test to configure for GNU C looking for gcc in output of $cc -v
- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
- Make stronger test in zconf.h to include unistd.h for LFS
- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
- Fix zlib.h LFS support when Z_PREFIX used
- Add updated as400 support (removed from old) [Monnerat]
- Avoid deflate sensitivity to volatile input data
- Avoid division in adler32_combine for NO_DIVIDE
- Clarify the use of Z_FINISH with deflateBound() amount of space
- Set binary for output file in puff.c
- Use u4 type for crc_table to avoid conversion warnings
- Apply casts in zlib.h to avoid conversion warnings
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
- Improve inflateSync() documentation to note indeterminancy
- Add deflatePending() function to return the amount of pending output
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
- Add a check in configure for stdarg.h, use for gzprintf()
- Check that pointers fit in ints when gzprint() compiled old style
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
- Add debug records in assmebler code [Londer]
- Update RFC references to use http://tools.ietf.org/html/... [Li]
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]

Changes in 1.2.5 (19 Apr 2010)
- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
- Default to libdir as sharedlibdir in configure [Nieder]
- Update copyright dates on modified source files
- Update trees.c to be able to generate modified trees.h
- Exit configure for MinGW, suggesting win32/Makefile.gcc
- Check for NULL path in gz_open [Homurlu]

Changes in 1.2.4.5 (18 Apr 2010)
- Set sharedlibdir in configure [Torok]
Expand Down Expand Up @@ -261,7 +309,7 @@ Changes in 1.2.3.4 (21 Dec 2009)
- Clear bytes after deflate lookahead to avoid use of uninitialized data
- Change a limit in inftrees.c to be more transparent to Coverity Prevent
- Update win32/zlib.def with exported symbols from zlib.h
- Correct spelling error in zlib.h [Willem]
- Correct spelling errors in zlib.h [Willem, Sobrado]
- Allow Z_BLOCK for deflate() to force a new block
- Allow negative bits in inflatePrime() to delete existing bit buffer
- Add Z_TREES flush option to inflate() to return at end of trees
Expand Down
8 changes: 5 additions & 3 deletions FAQ
Expand Up @@ -84,8 +84,10 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html

13. How can I make a Unix shared library?

make clean
./configure -s
By default a shared (and a static) library is built for Unix. So:

make distclean
./configure
make

14. How do I install a shared zlib library on Unix?
Expand Down Expand Up @@ -325,7 +327,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
correctly points to the zlib specification in RFC 1950 for the "deflate"
transfer encoding, there have been reports of servers and browsers that
incorrectly produce or expect raw deflate data per the deflate
specficiation in RFC 1951, most notably Microsoft. So even though the
specification in RFC 1951, most notably Microsoft. So even though the
"deflate" transfer encoding using the zlib format would be the more
efficient approach (and in fact exactly what the zlib format was designed
for), using the "gzip" transfer encoding is probably more reliable due to
Expand Down
11 changes: 11 additions & 0 deletions INDEX
Expand Up @@ -16,15 +16,25 @@ zlib.map Linux symbol information
zlib.pc.in Template for pkg-config descriptor
zlib2ansi perl script to convert source files for C++ compilation

alpha/ files for the alpha platform
amiga/ makefiles for Amiga SAS C
arm/ files for the arm platform
as400/ makefiles for AS/400
bfin/ files for the bfin platform
doc/ documentation for formats and algorithms
mips/ files for the mips platform
ia64/ files for the ia64 platform
msdos/ makefiles for MSDOS
nintendods/ makefile for Nintendo DS
old/ makefiles for various architectures and zlib documentation
files that have not yet been updated for zlib 1.2.x
parisc/ files for the parisc platform
ppc/ files for the ppc platform
qnx/ makefiles for QNX
sparc/ files for the sparc platform
watcom/ makefiles for OpenWatcom
win32/ makefiles for Windows
x86/ files for the x86 platform

zlib public header files (required for library use):
zconf.h
Expand All @@ -50,6 +60,7 @@ inflate.c
inflate.h
inftrees.c
inftrees.h
slhash.c
trees.c
trees.h
uncompr.c
Expand Down
38 changes: 22 additions & 16 deletions Makefile.in
@@ -1,5 +1,5 @@
# Makefile for zlib
# Copyright (C) 1995-2010 Jean-loup Gailly.
# Copyright (C) 1995-2011 Jean-loup Gailly.
# For conditions of distribution and use, see copyright notice in zlib.h

# To compile and test, type:
Expand Down Expand Up @@ -32,7 +32,7 @@ CPP=$(CC) -E

STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.5
SHAREDLIBV=libz.so.1.2.5.2
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)

Expand All @@ -53,10 +53,10 @@ mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig

OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
OBJC = adler32.o compress.o crc32.o deflate.o slhash.o gzclose.o gzlib.o gzread.o \
gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o

PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \
PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo slhash.lo gzclose.lo gzlib.lo gzread.lo \
gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo

# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
Expand Down Expand Up @@ -136,7 +136,7 @@ minigzip64.o: minigzip.c zlib.h zconf.h
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
-@mv objs/$*.o $@

$(SHAREDLIBV): $(PIC_OBJS)
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
Expand Down Expand Up @@ -168,14 +168,16 @@ install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
cp $(STATICLIB) $(DESTDIR)$(libdir)
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
-@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
chmod 755 $(SHAREDLIBV); \
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
-@if test -n "$(SHAREDLIBV)"; then \
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
($(LDCONFIG) || true) >/dev/null 2>&1; \
fi
cp zlib.3 $(DESTDIR)$(man3dir)
Expand All @@ -193,7 +195,7 @@ install: install-libs
uninstall:
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
cd $(DESTDIR)$(libdir); rm -f libz.a; \
if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
cd $(DESTDIR)$(man3dir); rm -f zlib.3
Expand Down Expand Up @@ -236,21 +238,25 @@ depend:

# DO NOT DELETE THIS LINE -- make depend depends on it.

adler32.o zutil.o: zutil.h zlib.h zconf.h
adler32.o: adler32.c ppc/adler32.c arm/adler32.c x86/adler32.c alpha/adler32.c mips/adler32.c bfin/adler32.c ia64/adler32.c sparc/adler32.c zutil.h zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h
gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
crc32.o: zutil.h zlib.h zconf.h crc32.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
slhash.o: slhash.c x86/slhash.c arm/slhash.c ppc/slhash.c bfin/slhash.c alpha/slhash.c mips/slhash.c parisc/slhash.c ia64/slhash.c deflate.h zutil.h zlib.h zconf.h
infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h

adler32.lo zutil.lo: zutil.h zlib.h zconf.h
adler32.lo: adler32.c ppc/adler32.c arm/adler32.c x86/adler32.c alpha/adler32.c mips/adler32.c bfin/adler32.c ia64/adler32.c sparc/adler32.c zutil.h zlib.h zconf.h
zutil.lo: zutil.h zlib.h zconf.h
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
crc32.lo: zutil.h zlib.h zconf.h crc32.h
deflate.lo: deflate.h zutil.h zlib.h zconf.h
slhash.lo: slhash.c x86/slhash.c arm/slhash.c ppc/slhash.c bfin/slhash.c alpha/slhash.c mips/slhash.c parisc/slhash.c ia64/slhash.c deflate.h zutil.h zlib.h zconf.h
infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
Expand Down
20 changes: 0 additions & 20 deletions NOTICE

This file was deleted.

10 changes: 5 additions & 5 deletions README
@@ -1,10 +1,10 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.2.5 is a general purpose data compression library. All the code is
zlib 1.2.5.2 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
and rfc1952.txt (gzip format).
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
rfc1952 (gzip format).

All functions of the compression library are documented in the file zlib.h
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
Expand All @@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .

The changes made in version 1.2.5 are documented in the file ChangeLog.
The changes made in version 1.2.5.2 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory contrib/ .

Expand Down Expand Up @@ -84,7 +84,7 @@ Acknowledgments:

Copyright notice:

(C) 1995-2010 Jean-loup Gailly and Mark Adler
(C) 1995-2011 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
Expand Down
4 changes: 2 additions & 2 deletions ThirdPartyProject.prop
@@ -1,7 +1,7 @@
# Copyright 2010 Google Inc. All Rights Reserved.
#Fri Jul 16 10:03:09 PDT 2010
currentVersion=1.2.3
version=1.2.3
currentVersion=1.2.5
version=1.2.5
isNative=true
name=zlib
keywords=zlib
Expand Down

0 comments on commit 13bf40a

Please sign in to comment.