Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
98fb3dc
copy&paste error in cmake comment
pseyfert May 20, 2016
3b2f64a
rough draft for lzo
pseyfert May 20, 2016
404fad4
complete ifdef guards
pseyfert May 20, 2016
44876ec
lzo now might already work
pseyfert May 20, 2016
7406601
missing parenthesis in cmake file
pseyfert May 20, 2016
6ab47e2
first compilation round
pseyfert May 20, 2016
dfc4ed8
fix cmake file
pseyfert May 20, 2016
b665051
mixed up C and C++ compilation
pseyfert May 20, 2016
3ca2b7b
reorder typedefs and function declarations
pseyfert May 20, 2016
4a35f20
catching another typo
pseyfert May 20, 2016
d71df43
use root macro to extend cmake flags
pseyfert May 20, 2016
b6c8ad0
too stupidly copied and pasted
pseyfert May 20, 2016
32235d6
more copy&paste errors fixed
pseyfert May 20, 2016
744cace
attack compiler warnings
pseyfert May 21, 2016
cde6159
lz4 draft -- FindLZ4.cmake missing
pseyfert May 21, 2016
51be02b
fail on incompatible options
pseyfert May 21, 2016
2ef3aa8
syntax error
pseyfert May 21, 2016
ab06530
avoid type conversions and lzo types in lz4
pseyfert May 21, 2016
4218668
make compiler happy
pseyfert May 21, 2016
ea01847
specify failure reason and exclude checksum test
pseyfert May 21, 2016
089ac2c
reorganise cmake stuff
pseyfert May 21, 2016
49e45d4
accidentially ignored target size
pseyfert May 21, 2016
90f2f54
really dont use builtin lz4 if system one is requested
pseyfert May 21, 2016
c1893db
cmake corrections
pseyfert May 22, 2016
4eb7784
fiddle around with find lz4 module
pseyfert May 22, 2016
0aa6b74
zopfli draft
pseyfert May 22, 2016
3eed7df
make zopfli build
pseyfert May 22, 2016
13d5aa0
cut and paste zopfli down
pseyfert May 23, 2016
8f16cb5
excessive printout
pseyfert May 23, 2016
d61bd8a
draft brotli
pseyfert May 23, 2016
683eb90
catch first compiler errors with brotli
pseyfert May 23, 2016
057cb46
attacking more brotli errors
pseyfert May 23, 2016
6b43669
after compiler errors come linker errors
pseyfert May 23, 2016
340ca6b
some tests
pseyfert May 23, 2016
f6d3d6e
expose lzo configuration to -D flags in cmake
pseyfert May 26, 2016
c9790e4
add header comments
pseyfert May 26, 2016
28fda82
run astyle
pseyfert May 26, 2016
217c3c2
remove debugging output
pseyfert May 26, 2016
7755666
disable unused parameter warnings
pseyfert May 26, 2016
bd46e6d
Merge remote branch 'origin/master_compressions' into compression
pseyfert May 26, 2016
3abbe01
cleanup cmake
pseyfert May 26, 2016
890e38a
compiler warnings and dependency cleanup
pseyfert May 26, 2016
7d11843
compiler warnings
pseyfert May 26, 2016
31e80b7
remove lzo dependency from brotli by using adler32 from zlib
pseyfert May 26, 2016
4545179
add brotli documentation
pseyfert May 26, 2016
e0746d4
lz4 documentation
pseyfert May 26, 2016
7f7e53c
added acknowledgments since it is mainly copy and paste
pseyfert May 26, 2016
bc28b1b
copy and paste duplication
pseyfert May 26, 2016
c4b7152
super stupid copy&paste mistake
pseyfert May 30, 2016
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
Prev Previous commit
Next Next commit
rough draft for lzo
  • Loading branch information
pseyfert committed May 23, 2016
commit 3b2f64a93cf38d20dcf22778a8afb7c7b9e243bb
1 change: 1 addition & 0 deletions cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ROOT_BUILD_OPTION(builtin_openssl OFF "Build OpenSSL internally, or use system O
ROOT_BUILD_OPTION(builtin_pcre OFF "Build included libpcre, or use system libpcre")
ROOT_BUILD_OPTION(builtin_zlib OFF "Build included libz, or use system libz")
ROOT_BUILD_OPTION(builtin_lzma OFF "Build included liblzma, or use system liblzma")
ROOT_BUILD_OPTION(lzo OFF "LZO support, requires liblzo2")
ROOT_BUILD_OPTION(builtin_davix OFF "Build the Davix library internally (downloading tarfile from the Web)")
ROOT_BUILD_OPTION(builtin_gsl OFF "Build the GSL library internally (downloading tarfile from the Web)")
ROOT_BUILD_OPTION(builtin_cfitsio OFF "Build the FITSIO library internally (downloading tarfile from the Web)")
Expand Down
5 changes: 5 additions & 0 deletions cmake/modules/RootConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ if(lzma)
else()
set(haslzmacompression undef)
endif()
if(lzo)
set(haslzocompression define)
else()
set(haslzocompression undef)
endif()
if(cocoa)
set(hascocoa define)
else()
Expand Down
14 changes: 14 additions & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,20 @@ if(xml)
endif()
endif()

#---Check for LZO------------------------------------------------------------------
if(lzo)
message(STATUS "Looking for LZO")
find_package(LZO)
if(NOT LZO_FOUND)
if(fail-on-missing)
message(FATAL_ERROR "lzo not found but required (lzo option enabled)")
else()
message(STATUS "lzo not found. Switching off lzo option")
set(lzo OFF CACHE BOOL "" FORCE)
endif()
endif()
endif()

#---Check for OpenSSL------------------------------------------------------------------
if(ssl OR builtin_openssl)
if(builtin_openssl)
Expand Down
10 changes: 9 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ if(cocoa)
endif()
add_subdirectory(zip)
add_subdirectory(lzma)
if(lzo)
add_subdirectory(lzo)
set(lzo_objects $<TARGET_OBJECTS:Lzo>)
set(lzo_library ${LZO_LIBRARY})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLZO")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLZO")
endif
add_subdirectory(base)

set(objectlibs $<TARGET_OBJECTS:Base>
Expand All @@ -43,6 +50,7 @@ set(objectlibs $<TARGET_OBJECTS:Base>
$<TARGET_OBJECTS:TextInput>
${macosx_objects}
${unix_objects}
${lzo_objects}
${winnt_objects})

#---Generation of RGitCommit.h-----------------------------------------------------------
Expand Down Expand Up @@ -101,7 +109,7 @@ add_subdirectory(utils)
ROOT_LINKER_LIBRARY(Core
$<TARGET_OBJECTS:BaseTROOT>
${objectlibs}
LIBRARIES ${PCRE_LIBRARIES} ${LZMA_LIBRARIES} ${ZLIB_LIBRARY}
LIBRARIES ${PCRE_LIBRARIES} ${lzo_library} ${LZMA_LIBRARIES} ${ZLIB_LIBRARY}
${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${corelinklibs} )

if(cling)
Expand Down
3 changes: 2 additions & 1 deletion core/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ ROOT_EXECUTABLE(rootcling src/LinkdefReader.cxx src/DictSelectionReader.cxx
${macosx_objects}
${unix_objects}
${winnt_objects}
LIBRARIES ${PCRE_LIBRARIES} ${LZMA_LIBRARIES} ${ZLIB_LIBRARY}
${lzo_objects}
LIBRARIES ${PCRE_LIBRARIES} ${lzo_library} ${LZMA_LIBRARIES} ${ZLIB_LIBRARY}
${CLING_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
${corelinklibs})

Expand Down
6 changes: 6 additions & 0 deletions core/zip/inc/Compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace ROOT {
// and memory when compressing. LZMA memory usage is particularly
// high for compression levels 8 and 9.
//
// TODO: add comment for lzo,lz4,zopfli,brotli
//
// The current algorithms support level 1 to 9. The higher
// the level the greater the compression and more CPU time
// and memory resources used during compression. Level 0
Expand All @@ -34,6 +36,10 @@ namespace ROOT {
kZLIB,
kLZMA,
kOldCompressionAlgo,
kLZO,
kLZ4,
kZOPFLI,
kBROTLI,
// if adding new algorithm types,
// keep this enum value last
kUndefinedCompressionAlgorithm
Expand Down
30 changes: 30 additions & 0 deletions core/zip/src/Bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
#include "zlib.h"
#include "RConfigure.h"
#include "ZipLZMA.h"
#ifdef LZO
#include "ZipLZO.h"
#else
void R__zipLZO(int cxlevel, int *srcsize, char *src, int *tgtsize, char *tgt, int *irep) {
R__error("ROOT built without LZO support");
return ;
}
#endif

#include <stdio.h>
#include <assert.h>
Expand Down Expand Up @@ -287,11 +295,17 @@ struct bits_internal_state {
and when R__zipMultipleAlgorithm is called with its last argument set to 0.
R__ZipMode = 1 : ZLIB compression algorithm is used (default)
R__ZipMode = 2 : LZMA compression algorithm is used
R__ZipMode = 4 : LZO compression algorithm is used
R__ZipMode = 5 : LZ4 compression algorithm is used
R__ZipMode = 6 : ZOPFLI compression algorithm is used
R__ZipMode = 7 : BROTLI compression algorithm is used
R__ZipMode = 0 or 3 : a very old compression algorithm is used
(the very old algorithm is supported for backward compatibility)
The LZMA algorithm requires the external XZ package be installed when linking
is done. LZMA typically has significantly higher compression factors, but takes
more CPU time and memory resources while compressing.

TODO: add comments for lzo,lz4,zopfli,brotli
*/
int R__ZipMode = 1;

Expand Down Expand Up @@ -583,6 +597,22 @@ void R__zipMultipleAlgorithm(int cxlevel, int *srcsize, char *src, int *tgtsize,
if (compressionAlgorithm == 2) {
R__zipLZMA(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
} else if (compressionAlgorithm == 4) {
// The LZO compression algorithm
R__zipLZO(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
} else if (compressionAlgorithm == 5) {
// The LZ4 compression algorithm
R__zipLZ4(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
} else if (compressionAlgorithm == 5) {
// The ZOPFLI compression algorithm
R__zipZOPFLI(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
} else if (compressionAlgorithm == 6) {
// The BROTLI compression algorithm
R__zipBROTLI(cxlevel, srcsize, src, tgtsize, tgt, irep);
return;
}

// The very old algorithm for backward compatibility
Expand Down
66 changes: 62 additions & 4 deletions core/zip/src/ZInflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ static const int qflag = 0;
#include "zlib.h"
#include "RConfigure.h"
#include "ZipLZMA.h"
#ifdef LZO
#include "ZipLZO.h"
#else
void R__unzipLZO(int *srcsize, unsigned char *src, int *tgtsize, unsigned char *tgt, int *irep) {
fprintf(stderr,
"R__unzipLZO: ROOT built without LZO\n");
return;
}
#endif
#include "ZipLZ4.h"
#include "ZipZOPFLI.h"
#include "ZipBROTLI.h"


/* inflate.c -- put in the public domain by Mark Adler
Expand Down Expand Up @@ -1130,10 +1142,33 @@ int R__unzip_header(int *srcsize, uch *src, int *tgtsize)
/* C H E C K H E A D E R */
if (!(src[0] == 'Z' && src[1] == 'L' && src[2] == Z_DEFLATED) &&
!(src[0] == 'C' && src[1] == 'S' && src[2] == Z_DEFLATED) &&
!(src[0] == 'X' && src[1] == 'Z' && src[2] == 0)) {
!(src[0] == 'X' && src[1] == 'Z' && src[2] == 0) &&
!(src[0] == 'L' && src[1] == 'Z') &&
!(src[0] == 'L' && src[1] == '4') &&
!(src[0] == 'B' && src[1] == 'R') &&
!(src[0] == 'Z' && src[1] == 'P')) {
fprintf(stderr, "Error R__unzip_header: error in header\n");
return 1;
}
#ifndef LZO
if (src[0] == 'L' && src[1] == 'Z') {
fprintf(stderr, "Error R__unzip_header: ROOT built without LZO\n");
return 2;
}
#endif
#ifndef LZ4
if (src[0] == 'L' && src[1] == '4') {
fprintf(stderr, "Error R__unzip_header: ROOT built without LZ4\n");
return 2;
}
#endif
/// ZOPFLI is decompressed with zlib, no check needed
#ifndef BROTLI
if (src[0] == 'B' && src[1] == 'R') {
fprintf(stderr, "Error R__unzip_header: ROOT built without BROTLI\n");
return 2;
}
#endif

*srcsize = HDRSIZE + ((long)src[3] | ((long)src[4] << 8) | ((long)src[5] << 16));
*tgtsize = (long)src[6] | ((long)src[7] << 8) | ((long)src[8] << 16);
Expand All @@ -1159,10 +1194,33 @@ void R__unzip(int *srcsize, uch *src, int *tgtsize, uch *tgt, int *irep)
/* C H E C K H E A D E R */
if (!(src[0] == 'Z' && src[1] == 'L' && src[2] == Z_DEFLATED) &&
!(src[0] == 'C' && src[1] == 'S' && src[2] == Z_DEFLATED) &&
!(src[0] == 'X' && src[1] == 'Z' && src[2] == 0)) {
fprintf(stderr,"Error R__unzip: error in header\n");
return;
!(src[0] == 'X' && src[1] == 'Z' && src[2] == 0) &&
!(src[0] == 'L' && src[1] == 'Z') &&
!(src[0] == 'L' && src[1] == '4') &&
!(src[0] == 'B' && src[1] == 'R') &&
!(src[0] == 'Z' && src[1] == 'P')) {
fprintf(stderr, "Error R__unzip: error in header\n");
return 1;
}
#ifndef LZO
if (src[0] == 'L' && src[1] == 'Z') {
fprintf(stderr, "Error R__unzip: ROOT built without LZO\n");
return 2;
}
#endif
#ifndef LZ4
if (src[0] == 'L' && src[1] == '4') {
fprintf(stderr, "Error R__unzip: ROOT built without LZ4\n");
return 2;
}
#endif
/// ZOPFLI is decompressed with zlib, no check needed
#ifndef BROTLI
if (src[0] == 'B' && src[1] == 'R') {
fprintf(stderr, "Error R__unzip: ROOT built without BROTLI\n");
return 2;
}
#endif

ibufptr = src + HDRSIZE;
ibufcnt = (long)src[3] | ((long)src[4] << 8) | ((long)src[5] << 16);
Expand Down