summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog5
-rw-r--r--NEWS17
-rw-r--r--compress.cc7
-rwxr-xr-xconfigure2
-rw-r--r--doc/plzip.18
-rw-r--r--doc/plzip.info44
-rw-r--r--doc/plzip.texi35
-rw-r--r--lzip.h12
-rw-r--r--main.cc44
9 files changed, 99 insertions, 75 deletions
diff --git a/ChangeLog b/ChangeLog
index 2982fa4..993d0fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-25 Antonio Diaz Diaz <antonio@gnu.org>
+
+ * Version 1.4-pre1 released.
+ * Option '-0' now uses the fast encoder of lzlib 1.7-pre1.
+
2015-01-22 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.3 released.
diff --git a/NEWS b/NEWS
index 9e04ba7..cc65644 100644
--- a/NEWS
+++ b/NEWS
@@ -1,14 +1,5 @@
-Changes in version 1.3:
+Changes in version 1.4:
-Testing of a non-seekable file or of standard input now uses up to 30
-MiB less memory per thread.
-
-"-dvvv" and "-tvvv" now show the dictionary size of the first member,
-producing the same output as lzip for single-member files.
-
-Chapters "Memory requirements" and "Minimum file sizes" have been added
-to the manual.
-
-The targets "install-compress", "install-strip-compress",
-"install-info-compress" and "install-man-compress" have been added to
-the Makefile.
+The option "-0" has been modified to use the new fast encoder of lzlib
+1.7-pre1, achieving a compression speed and ratio comparable to those of
+pigz's default compression level.
diff --git a/compress.cc b/compress.cc
index 4e32b87..424e090 100644
--- a/compress.cc
+++ b/compress.cc
@@ -375,8 +375,11 @@ extern "C" void * cworker( void * arg )
Packet * const packet = courier.distribute_packet();
if( !packet ) break; // no more packets to process
- const int dict_size = std::max( LZ_min_dictionary_size(),
- std::min( dictionary_size, packet->size ) );
+ int dict_size;
+ if( dictionary_size == 65535 && match_len_limit == 16 )
+ dict_size = dictionary_size;
+ else dict_size = std::max( LZ_min_dictionary_size(),
+ std::min( dictionary_size, packet->size ) );
LZ_Encoder * const encoder =
LZ_compress_open( dict_size, match_len_limit, LLONG_MAX );
if( !encoder || LZ_compress_errno( encoder ) != LZ_ok )
diff --git a/configure b/configure
index 896eafc..538f294 100755
--- a/configure
+++ b/configure
@@ -6,7 +6,7 @@
# to copy, distribute and modify it.
pkgname=plzip
-pkgversion=1.3
+pkgversion=1.4-pre1
progname=plzip
srctrigger=doc/${pkgname}.texi
diff --git a/doc/plzip.1 b/doc/plzip.1
index 1722eb7..9fb2220 100644
--- a/doc/plzip.1
+++ b/doc/plzip.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
-.TH PLZIP "1" "January 2015" "plzip 1.3" "User Commands"
+.TH PLZIP "1" "February 2015" "plzip 1.4-pre1" "User Commands"
.SH NAME
plzip \- reduces the size of files
.SH SYNOPSIS
@@ -54,11 +54,11 @@ test compressed file integrity
\fB\-v\fR, \fB\-\-verbose\fR
be verbose (a 2nd \fB\-v\fR gives more)
.TP
-\fB\-1\fR .. \fB\-9\fR
+\fB\-0\fR .. \fB\-9\fR
set compression level [default 6]
.TP
\fB\-\-fast\fR
-alias for \fB\-1\fR
+alias for \fB\-0\fR
.TP
\fB\-\-best\fR
alias for \fB\-9\fR
@@ -84,7 +84,7 @@ Plzip home page: http://www.nongnu.org/lzip/plzip.html
Copyright \(co 2009 Laszlo Ersek.
.br
Copyright \(co 2015 Antonio Diaz Diaz.
-Using Lzlib 1.6
+Using Lzlib 1.7\-pre1
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/plzip.info b/doc/plzip.info
index 7e83ab0..e8bfe0d 100644
--- a/doc/plzip.info
+++ b/doc/plzip.info
@@ -11,7 +11,7 @@ File: plzip.info, Node: Top, Next: Introduction, Up: (dir)
Plzip Manual
************
-This manual is for Plzip (version 1.3, 22 January 2015).
+This manual is for Plzip (version 1.4-pre1, 25 February 2015).
* Menu:
@@ -116,7 +116,7 @@ compressed files is also supported.
WARNING! Even if plzip is bug-free, other causes may result in a
corrupt compressed file (bugs in the system libraries, memory errors,
-etc). Therefore, if the data you are going to compress is important,
+etc). Therefore, if the data you are going to compress are important,
give the '--keep' option to plzip and do not remove the original file
until you verify the compressed file with a command like
'plzip -cd file.lz | cmp file -'.
@@ -180,8 +180,9 @@ The format for running plzip is:
Set the size of the input data blocks, in bytes. The input file
will be divided in chunks of this size before compression is
performed. Valid values range from 8 KiB to 1 GiB. Default value
- is two times the dictionary size. Plzip will reduce the dictionary
- size if it is larger than the chosen data size.
+ is two times the dictionary size, except for option '-0' where it
+ defaults to 1 MiB. Plzip will reduce the dictionary size if it is
+ larger than the chosen data size.
'-c'
'--stdout'
@@ -267,10 +268,10 @@ The format for running plzip is:
verbosity level, showing status, compression ratio, dictionary
size, decompressed size, and compressed size.
-'-1 .. -9'
+'-0 .. -9'
Set the compression parameters (dictionary size and match length
limit) as shown in the table below. Note that '-9' can be much
- slower than '-1'. These options have no effect when decompressing.
+ slower than '-0'. These options have no effect when decompressing.
The bidimensional parameter space of LZMA can't be mapped to a
linear scale optimal for all files. If your files are large, very
@@ -279,6 +280,7 @@ The format for running plzip is:
performance.
Level Dictionary size Match length limit
+ -0 64 KiB 16 bytes
-1 1 MiB 5 bytes
-2 1.5 MiB 6 bytes
-3 2 MiB 8 bytes
@@ -372,8 +374,8 @@ additional information before, between, or after them.
'Lzma stream'
The lzma stream, finished by an end of stream marker. Uses default
- values for encoder properties. See the lzip manual for a full
- description.
+ values for encoder properties. *Note Stream format: (lzip)Stream
+ format, for a complete description.
'CRC32 (4 bytes)'
CRC of the uncompressed original data.
@@ -397,8 +399,11 @@ File: plzip.info, Node: Memory requirements, Next: Minimum file sizes, Prev:
The amount of memory required *per thread* is approximately the
following:
- * For compression; 11 times the dictionary size plus 3 times the
- data size (*note --data-size::).
+ * For compression at level -0; 1.5 MiB plus 3 times the data size
+ (*note --data-size::).
+
+ * For compression at other levels; 11 times the dictionary size plus
+ 3 times the data size.
* For decompression of a regular (seekable) file to another regular
file, or for testing of a regular file; the dictionary size. Note
@@ -439,6 +444,7 @@ default data size for each level:
Processors 2 4 8 16 64 256
-------------------------------------------------------------------------
Level
+-0 2 MiB 4 MiB 8 MiB 16 MiB 64 MiB 256 MiB
-1 4 MiB 8 MiB 16 MiB 32 MiB 128 MiB 512 MiB
-2 6 MiB 12 MiB 24 MiB 48 MiB 192 MiB 768 MiB
-3 8 MiB 16 MiB 32 MiB 64 MiB 256 MiB 1 GiB
@@ -489,15 +495,15 @@ Concept index

Tag Table:
Node: Top221
-Node: Introduction988
-Node: Program design5284
-Node: Invoking plzip6873
-Ref: --data-size7287
-Node: File format12414
-Node: Memory requirements14930
-Node: Minimum file sizes15907
-Node: Problems17758
-Node: Concept index18294
+Node: Introduction994
+Node: Program design5291
+Node: Invoking plzip6880
+Ref: --data-size7294
+Node: File format12518
+Node: Memory requirements15061
+Node: Minimum file sizes16130
+Node: Problems18052
+Node: Concept index18588

End Tag Table
diff --git a/doc/plzip.texi b/doc/plzip.texi
index 64b608c..1c2d42c 100644
--- a/doc/plzip.texi
+++ b/doc/plzip.texi
@@ -6,8 +6,8 @@
@finalout
@c %**end of header
-@set UPDATED 22 January 2015
-@set VERSION 1.3
+@set UPDATED 25 February 2015
+@set VERSION 1.4-pre1
@dircategory Data Compression
@direntry
@@ -142,7 +142,7 @@ compressed files is also supported.
WARNING! Even if plzip is bug-free, other causes may result in a corrupt
compressed file (bugs in the system libraries, memory errors, etc).
-Therefore, if the data you are going to compress is important, give the
+Therefore, if the data you are going to compress are important, give the
@samp{--keep} option to plzip and do not remove the original file until
you verify the compressed file with a command like
@w{@samp{plzip -cd file.lz | cmp file -}}.
@@ -210,8 +210,9 @@ Print the version number of plzip on the standard output and exit.
Set the size of the input data blocks, in bytes. The input file will be
divided in chunks of this size before compression is performed. Valid
values range from 8 KiB to 1 GiB. Default value is two times the
-dictionary size. Plzip will reduce the dictionary size if it is larger
-than the chosen data size.
+dictionary size, except for option @samp{-0} where it defaults to 1 MiB.
+Plzip will reduce the dictionary size if it is larger than the chosen
+data size.
@item -c
@itemx --stdout
@@ -290,10 +291,10 @@ When decompressing or testing, further -v's (up to 4) increase the
verbosity level, showing status, compression ratio, dictionary size,
decompressed size, and compressed size.
-@item -1 .. -9
+@item -0 .. -9
Set the compression parameters (dictionary size and match length limit)
as shown in the table below. Note that @samp{-9} can be much slower than
-@samp{-1}. These options have no effect when decompressing.
+@samp{-0}. These options have no effect when decompressing.
The bidimensional parameter space of LZMA can't be mapped to a linear
scale optimal for all files. If your files are large, very repetitive,
@@ -303,6 +304,7 @@ performance.
@multitable {Level} {Dictionary size} {Match length limit}
@item Level @tab Dictionary size @tab Match length limit
+@item -0 @tab 64 KiB @tab 16 bytes
@item -1 @tab 1 MiB @tab 5 bytes
@item -2 @tab 1.5 MiB @tab 6 bytes
@item -3 @tab 2 MiB @tab 8 bytes
@@ -403,8 +405,16 @@ Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@*
Valid values for dictionary size range from 4 KiB to 512 MiB.
@item Lzma stream
-The lzma stream, finished by an end of stream marker. Uses default values
-for encoder properties. See the lzip manual for a full description.
+The lzma stream, finished by an end of stream marker. Uses default
+values for encoder properties.
+@ifnothtml
+@xref{Stream format,,,lzip},
+@end ifnothtml
+@ifhtml
+See
+@uref{http://www.nongnu.org/lzip/manual/lzip_manual.html#Stream-format,,Stream format}
+@end ifhtml
+for a complete description.
@item CRC32 (4 bytes)
CRC of the uncompressed original data.
@@ -429,10 +439,14 @@ following:
@itemize @bullet
@item
-For compression; 11 times the dictionary size plus 3 times the data size
+For compression at level -0; 1.5 MiB plus 3 times the data size
(@pxref{--data-size}).
@item
+For compression at other levels; 11 times the dictionary size plus 3
+times the data size.
+
+@item
For decompression of a regular (seekable) file to another regular file,
or for testing of a regular file; the dictionary size. Note that regular
files with more than 1024 bytes of trailing garbage are treated as
@@ -475,6 +489,7 @@ data size for each level:
@multitable {Processors} {512 MiB} {512 MiB} {512 MiB} {512 MiB} {512 MiB} {512 MiB}
@headitem Processors @tab 2 @tab 4 @tab 8 @tab 16 @tab 64 @tab 256
@item Level
+@item -0 @tab 2 MiB @tab 4 MiB @tab 8 MiB @tab 16 MiB @tab 64 MiB @tab 256 MiB
@item -1 @tab 4 MiB @tab 8 MiB @tab 16 MiB @tab 32 MiB @tab 128 MiB @tab 512 MiB
@item -2 @tab 6 MiB @tab 12 MiB @tab 24 MiB @tab 48 MiB @tab 192 MiB @tab 768 MiB
@item -3 @tab 8 MiB @tab 16 MiB @tab 32 MiB @tab 64 MiB @tab 256 MiB @tab 1 GiB
diff --git a/lzip.h b/lzip.h
index 37209c8..7b4f591 100644
--- a/lzip.h
+++ b/lzip.h
@@ -69,9 +69,9 @@ const uint8_t magic_string[4] = { 0x4C, 0x5A, 0x49, 0x50 }; // "LZIP"
struct File_header
{
- uint8_t data[6]; // 0-3 magic bytes
- // 4 version
- // 5 coded_dict_size
+ uint8_t data[6]; /* 0-3 magic bytes */
+ /* 4 version */
+ /* 5 coded_dict_size */
enum { size = 6 };
void set_magic() { std::memcpy( data, magic_string, 4 ); data[4] = 1; }
@@ -111,9 +111,9 @@ struct File_header
struct File_trailer
{
- uint8_t data[20]; // 0-3 CRC32 of the uncompressed data
- // 4-11 size of the uncompressed data
- // 12-19 member size including header and trailer
+ uint8_t data[20]; /* 0-3 CRC32 of the uncompressed data */
+ /* 4-11 size of the uncompressed data */
+ /* 12-19 member size including header and trailer */
enum { size = 20 };
diff --git a/main.cc b/main.cc
index 5e5524d..23247cf 100644
--- a/main.cc
+++ b/main.cc
@@ -82,8 +82,8 @@ struct { const char * from; const char * to; } const known_extensions[] = {
struct Lzma_options
{
- int dictionary_size; // 4 KiB .. 512 MiB
- int match_len_limit; // 5 .. 273
+ int dictionary_size; /* 4 KiB .. 512 MiB */
+ int match_len_limit; /* 5 .. 273 */
};
enum Mode { m_compress, m_decompress, m_test };
@@ -116,8 +116,8 @@ void show_help( const long num_online )
" -s, --dictionary-size=<bytes> set dictionary size limit in bytes [8 MiB]\n"
" -t, --test test compressed file integrity\n"
" -v, --verbose be verbose (a 2nd -v gives more)\n"
- " -1 .. -9 set compression level [default 6]\n"
- " --fast alias for -1\n"
+ " -0 .. -9 set compression level [default 6]\n"
+ " --fast alias for -0\n"
" --best alias for -9\n", num_online );
if( verbosity >= 1 )
{
@@ -385,14 +385,14 @@ void cleanup_and_fail( const int retval )
namespace {
- // Set permissions, owner and times.
+ /* Set permissions, owner and times. */
void close_and_set_permissions( const struct stat * const in_statsp )
{
bool warning = false;
if( in_statsp )
{
const mode_t mode = in_statsp->st_mode;
- // fchown will in many cases return with EPERM, which can be safely ignored.
+ /* fchown will in many cases return with EPERM, which can be safely ignored. */
if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 )
{ if( fchmod( outfd, mode ) != 0 ) warning = true; }
else
@@ -482,7 +482,7 @@ void show_progress( const int packet_size,
const Pretty_print * const p,
const unsigned long long cfile_size )
{
- static unsigned long long csize = 0; // file_size / 100
+ static unsigned long long csize = 0; /* file_size / 100 */
static unsigned long long pos = 0;
static const Pretty_print * pp = 0;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -511,16 +511,16 @@ int main( const int argc, const char * const argv[] )
to the corresponding LZMA compression modes. */
const Lzma_options option_mapping[] =
{
- { 1 << 20, 5 }, // -0
- { 1 << 20, 5 }, // -1
- { 3 << 19, 6 }, // -2
- { 1 << 21, 8 }, // -3
- { 3 << 20, 12 }, // -4
- { 1 << 22, 20 }, // -5
- { 1 << 23, 36 }, // -6
- { 1 << 24, 68 }, // -7
- { 3 << 23, 132 }, // -8
- { 1 << 25, 273 } }; // -9
+ { 65535, 16 }, /* -0 */
+ { 1 << 20, 5 }, /* -1 */
+ { 3 << 19, 6 }, /* -2 */
+ { 1 << 21, 8 }, /* -3 */
+ { 3 << 20, 12 }, /* -4 */
+ { 1 << 22, 20 }, /* -5 */
+ { 1 << 23, 36 }, /* -6 */
+ { 1 << 24, 68 }, /* -7 */
+ { 3 << 23, 132 }, /* -8 */
+ { 1 << 25, 273 } }; /* -9 */
Lzma_options encoder_options = option_mapping[6]; // default = "-6"
std::string input_filename;
std::string default_output_filename;
@@ -584,7 +584,7 @@ int main( const int argc, const char * const argv[] )
for( ; argind < parser.arguments(); ++argind )
{
const int code = parser.code( argind );
- if( !code ) break; // no more options
+ if( !code ) break; /* no more options */
const char * const arg = parser.argument( argind ).c_str();
switch( code )
{
@@ -615,7 +615,7 @@ int main( const int argc, const char * const argv[] )
case 'V': show_version(); return 0;
default : internal_error( "uncaught option." );
}
- } // end process options
+ } /* end process options */
#if defined(__MSVCRT__) || defined(__OS2__)
setmode( STDIN_FILENO, O_BINARY );
@@ -626,7 +626,11 @@ int main( const int argc, const char * const argv[] )
outfd = -1;
if( data_size <= 0 )
- data_size = 2 * std::max( 65536, encoder_options.dictionary_size );
+ {
+ if( encoder_options.dictionary_size == 65535 &&
+ encoder_options.match_len_limit == 16 ) data_size = 1 << 20;
+ else data_size = 2 * std::max( 65536, encoder_options.dictionary_size );
+ }
else if( data_size < encoder_options.dictionary_size )
encoder_options.dictionary_size =
std::max( data_size, LZ_min_dictionary_size() );