cbfstool: Update LZMA encoder to LZMA SDK 9.12
This removes almost all C++ code (except the wrapper) Change-Id: I0f84070e3b6dc57c98d49a53150a140479b3221f Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1799 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Stefan Reinauer
parent
a5b7067638
commit
2e200cde9a
109
util/cbfstool/lzma/lzma.hh
Normal file
109
util/cbfstool/lzma/lzma.hh
Normal file
@ -0,0 +1,109 @@
|
||||
#ifndef HHlzmaHH
|
||||
#define HHlzmaHH
|
||||
|
||||
#include <vector>
|
||||
|
||||
extern int LZMA_verbose;
|
||||
|
||||
extern unsigned LZMA_NumFastBytes;
|
||||
extern unsigned LZMA_AlgorithmNo;
|
||||
extern unsigned LZMA_PosStateBits;
|
||||
extern unsigned LZMA_LiteralPosStateBits;
|
||||
extern unsigned LZMA_LiteralContextBits;
|
||||
|
||||
/* decompress LZMA-compressed data. */
|
||||
const std::vector<unsigned char> LZMADeCompress
|
||||
(const unsigned char* data, std::size_t length);
|
||||
|
||||
const std::vector<unsigned char> LZMADeCompress
|
||||
(const unsigned char* data, std::size_t length, bool& ok);
|
||||
|
||||
static inline const std::vector<unsigned char> LZMADeCompress
|
||||
(const std::vector<unsigned char>& buf)
|
||||
{ return LZMADeCompress(&buf[0], buf.size()); }
|
||||
|
||||
static inline const std::vector<unsigned char> LZMADeCompress
|
||||
(const std::vector<unsigned char>& buf, bool& ok)
|
||||
{ return LZMADeCompress(&buf[0], buf.size(), ok); }
|
||||
|
||||
/* LZMA-compress data with current settings. */
|
||||
const std::vector<unsigned char> LZMACompress
|
||||
(const unsigned char* data, std::size_t length);
|
||||
|
||||
static inline const std::vector<unsigned char> LZMACompress
|
||||
(const std::vector<unsigned char>& buf)
|
||||
{ return LZMACompress(&buf[0], buf.size()); }
|
||||
|
||||
/* LZMA-compress data with given settings. */
|
||||
const std::vector<unsigned char> LZMACompress
|
||||
(const unsigned char* data, std::size_t length,
|
||||
unsigned pb,
|
||||
unsigned lp,
|
||||
unsigned lc);
|
||||
|
||||
static inline const std::vector<unsigned char> LZMACompress
|
||||
(const std::vector<unsigned char>& buf,
|
||||
unsigned pb,
|
||||
unsigned lp,
|
||||
unsigned lc)
|
||||
{ return LZMACompress(&buf[0], buf.size(), pb,lp,lc); }
|
||||
|
||||
const std::vector<unsigned char> LZMACompress(
|
||||
const unsigned char* data, std::size_t length,
|
||||
unsigned pb,
|
||||
unsigned lp,
|
||||
unsigned lc,
|
||||
unsigned dictionarysize);
|
||||
|
||||
static inline const std::vector<unsigned char> LZMACompress(
|
||||
const std::vector<unsigned char>& buf,
|
||||
unsigned pb,
|
||||
unsigned lp,
|
||||
unsigned lc,
|
||||
unsigned dictionarysize)
|
||||
{ return LZMACompress(&buf[0], buf.size(), pb,lp,lc,dictionarysize); }
|
||||
|
||||
/* LZMA-compress data with every settings (5*5*9 times), taking the best.
|
||||
* It will consume a lot of time and output useful statistics,
|
||||
* so a context parameter ("why") is also given.
|
||||
*/
|
||||
const std::vector<unsigned char> LZMACompressHeavy
|
||||
(const unsigned char* data, std::size_t length,
|
||||
const char* why = "?");
|
||||
|
||||
const std::vector<unsigned char> LZMACompressAuto
|
||||
(const unsigned char* data, std::size_t length,
|
||||
const char* why = "?");
|
||||
|
||||
static inline const std::vector<unsigned char> LZMACompressHeavy
|
||||
(const std::vector<unsigned char>& buf,
|
||||
const char* why = "?")
|
||||
{ return LZMACompressHeavy(&buf[0],buf.size(),why); }
|
||||
|
||||
static inline const std::vector<unsigned char> LZMACompressAuto
|
||||
(const std::vector<unsigned char>& buf,
|
||||
const char* why = "?")
|
||||
{ return LZMACompressAuto(&buf[0],buf.size(),why); }
|
||||
|
||||
const std::vector<unsigned char>
|
||||
DoLZMACompress(int HeavyLevel,
|
||||
const unsigned char* data,
|
||||
std::size_t length,
|
||||
const char* why = "?");
|
||||
|
||||
static inline const std::vector<unsigned char>
|
||||
DoLZMACompress(int HeavyLevel,
|
||||
const std::vector<unsigned char>& data, const char* why = "?")
|
||||
{ return DoLZMACompress(HeavyLevel, &data[0], data.size(), why); }
|
||||
|
||||
|
||||
/*
|
||||
LZMA compressed file format
|
||||
---------------------------
|
||||
Offset Size Description
|
||||
0 1 Special LZMA properties for compressed data
|
||||
1 4 Dictionary size (little endian)
|
||||
5 8 Uncompressed size (little endian). -1 means unknown size
|
||||
13 Compressed data
|
||||
*/
|
||||
#endif
|
Reference in New Issue
Block a user