History log of /external/squashfs-tools/squashfs-tools/gzip_wrapper.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef50ceabd93384b842032e0f6abec2a10256bded 12-May-2014 Phillip Lougher <phillip@squashfs.org.uk> gzip-wrapper: Add support for different compression strategies with -Xstrategy

Last minute improvement before release. Add support to allow users to
try different compression strategies with zlib, not just the
Z_DEFAULT_STRATEGY.

-Xstrategy strategy1,strategy2,...,strategyN
Compress using strategy1,strategy2,...,strategyN in turn
and choose the best compression.
Available strategies: default, filtered, huffman_only,
run_length_encoded and fixed

I originally didn't implement this because I considered it too esoteric
to waste scarce development time on. What's the point in developing
something if no one is going to use it?

But, on reviewing open tickets on Sourceforge I discover someone asked
for this back in 2011, and I'd forgotten about it in the meantime. It's a
nice feature and if it looks like it might be used ...

So, here it is, a day's "heavy" coding and a delay in the release. But,
it's probably worth it.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
4e72afa42b28ec0981e46d1982d4b4a3764a51a9 11-May-2014 Phillip Lougher <phillip@squashfs.org.uk> gzip_wrapper: fix nasty speed/compression regression

Final pre-release tests threw up an odd regression in compression
and speed with the gzip_wrapper.c code. Sample filesystem compression
was ~0.025% (or 1Mbyte extra per 4Gbytes of compressed data) worse
than the previous Mksquashfs 4.2.

A git bisect rather unexpectedly narrowed the culprit down to this
line in gzip_wrapper.c

res = deflateInit2(stream, compression_level, Z_DEFLATED,
window_size, 9, Z_DEFAULT_STRATEGY);

This replaced the equivalent

res = deflateInit(stream, compression_level);

When the gzip_wrapper code was extended to allow the window_size
used in compression to be changed.

The culprit in the line is the 9, which is the amount of memory
deflate uses to compress the data. I took advantage of the fact
that deflateInit2() allows one to increase the memory usage from the
default of 8 (used by deflateInit()) to the maximum of 9. As explained
by the comments in zlib.h, this is supposed to increase speed.

From zlib.h

" The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but is
slow and reduces compression ratio; memLevel=9 uses maximum memory for
optimal speed. The default value is 8. See zconf.h for total memory usage
as a function of windowBits and memLevel. "

It in fact appears from my tests that increasing the value from 8 to 9
both reduces compression and reduces speed too. This is probably
a bug in zlib ...

Using the default value of 8, rather than 9, fixes the small compression
and speed regression observed.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
420660993551ae45c9fdf13f689b4e5e97cc423e 26-Jan-2014 Phillip Lougher <phillip@squashfs.org.uk> gzip_wrapper: fix -Xwindow-size option return value

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
0c84e6ffcd10f9eace6be2d4a085c25928ed77dd 05-Jan-2014 Phillip Lougher <phillip@squashfs.org.uk> gzip_wrapper: significantly improved implementation

Siginficantly improve the gzip compressor implementation
by adding support for two new compression options:

-Xcompression-level <compression-level>
<compression-level> should be 1 .. 9 (default 9)

-Xwindow-size <window-size>
<window-size> should be 8 .. 15 (default 15)

These two options allow the level of compression and window
size to be changed. Changing these can improve compression
speed and/or compression time memory requirements.

The defaults match the original unchangable compression parameters
used previously. These defaults represent maximum gzip compression
(at the expense of compresion speed and memory overhead), and so
alterring them will reduce compression achieved.

However, there are times where reduced compressed is desireable:

- times where the build time for experimental images is
paramount
- times where the build and/or target system is relatively weak,
and so will benefit from less aggressive compression
parameters.

It may well be the case that lower compression levels for gzip may
give better results than higher compression levels for algorithms which
are believed to be less demanding.

As usual, experimentation is the key to discovering which compression
algorithm and compression options are the best for your application.

Note: gzip compressed filesystems with the new options are
compatible with all earlier Squashfs implementations (kernel and unsquashfs),
back to the first release of Squashfs 4.0 in early 2009.

The only exception is appending: earlier versions of Mksquashfs will
*correctly* refuse to append to a gzipped filesystem created with the
above new compression options because it is unable to set the compression
options (i.e. it will use the unchangable default compression
parameters).

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
cb39504592e9531436375d35ca415ee8bfcb8ad5 22-Jun-2013 Phillip Lougher <phillip@squashfs.org.uk> gzip_wrapper: only set *error if an error occurs in gzip_uncompress()

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
8a4692825eb1840d52f2f921e40346d0f8c7e702 23-Jan-2013 Phillip Lougher <phillip@squashfs.org.uk> codec_wrappers: rename block_size in uncompress() to outsize

Rename block_size parameter in uncompress() call to outsize, as it
now holds the size of the output buffer, which can be less than
block_size.

Also in the wrappers where the uncompressed length is available
in the header, don't bother calling the codec if outsize is too
small.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
83d42a3fc898962aa1f1e8387f2ccb1114e0d294 01-Nov-2012 Phillip Lougher <phillip@squashfs.org.uk> Update email address

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
c70cfc289025599e3042ed15f9c3a0aaeb4ee272 08-Dec-2010 plougher <plougher> Add NULL usage function
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
3c765f0e6269d11c95accd03bb8dbb00e88a2721 24-Nov-2010 plougher <plougher> Add gzip_init()
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
501fdfa23260cbcdd72ec79fa3940cff13aaf682 23-Nov-2010 plougher <plougher> Change src/dest from char * to void *
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
23a6f30f9bcef494438dd8f1993fc22dcfb3708e 23-Nov-2010 plougher <plougher> Move gzip compressor ops definition to here, and make the wrapper
functions static
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
e80f5c85abc4160f60a384fffec759900147f494 25-Aug-2010 plougher <plougher> Fix copyright dates - these files didn't exist before 2009!
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
b552f0092251f472920f73e701bfd7fffe954327 07-Aug-2009 plougher <plougher> Add some comments.
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
4ab07197d7f0880945f1b15eb5507dde609c449c 30-Jul-2009 plougher <plougher> Add gzip uncompress function
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c
0c9f50e7fb8285ae1b6787033c9f220a9217fe9b 29-Jul-2009 plougher <plougher> Gzip compression wrapper functions.
/external/squashfs-tools/squashfs-tools/gzip_wrapper.c