LZOTools
Documentation for LZOTools.
LZOTools.AbstractLZOAlgorithm
LZOTools.LZO1
LZOTools.LZO1A
LZOTools.LZO1A_99
LZOTools.LZO1B
LZOTools.LZO1B_99
LZOTools.LZO1C
LZOTools.LZO1C_99
LZOTools.LZO1C_999
LZOTools.LZO1F_1
LZOTools.LZO1F_999
LZOTools.LZO1X_1
LZOTools.LZO1X_1_11
LZOTools.LZO1X_1_12
LZOTools.LZO1X_1_15
LZOTools.LZO1X_999
LZOTools.LZO1Y_1
LZOTools.LZO1Y_999
LZOTools.LZO1Z_999
LZOTools.LZO1_99
LZOTools.LZO2A_999
LZOTools.compress
LZOTools.decompress
LZOTools.max_compressed_length
LZOTools.optimize!
LZOTools.unsafe_compress!
LZOTools.unsafe_decompress!
LZOTools.unsafe_optimize!
LZOTools.AbstractLZOAlgorithm
— TypeAbstractLZOAlgorithm
An abstract type from which specific LZO compression and decompression algorithms inherit.
LZOTools.LZO1
— TypeLZO1
The LZO1 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1A
— TypeLZO1A
The LZO1A algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1A_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1A_99
— TypeLZO1A_99
The LZO1A_99 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1A_99_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1B
— TypeLZO1B
The LZO1B algorithm.
Keyword arguments
compression_level::Int = -1
: compression level 1-9, with 9 producing the maximum compression ratio and 1 running the fastest, and where -1 chooses the default (1).working_memory::Vector{UInt8} = zeros(UInt8, LZO1B_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1B_99
— TypeLZO1B_99
The LZO1B_99 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1B_99_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1C
— TypeLZO1C
The LZO1C algorithm.
Keyword arguments
compression_level::Int = -1
: compression level 1-9, with 9 producing the maximum compression ratio and 1 running the fastest, and where -1 chooses the default (1).working_memory::Vector{UInt8} = zeros(UInt8, LZO1C_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1C_99
— TypeLZO1C_99
The LZO1C_99 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1C_99_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1C_999
— TypeLZO1C_999
The LZO1C_999 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1C_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1F_1
— TypeLZO1F_1
The LZO1F_1 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1F_1_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1F_999
— TypeLZO1F_999
The LZO1F_999 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1F_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1X_1
— TypeLZO1X_1
The LZO1X_1 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1X_1_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1X_1_11
— TypeLZO1X_1_11
The LZO1X111 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1X_1_11_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1X_1_12
— TypeLZO1X_1_12
The LZO1X112 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1X_1_12_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1X_1_15
— TypeLZO1X_1_15
The LZO1X115 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1X_1_15_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1X_999
— TypeLZO1X_999
The LZO1X_999 algorithm.
Keyword arguments
compression_level::Int = 8
: compression level 1-8, with 8 producing the maximum compression ratio and 1 running the fastest.working_memory::Vector{UInt8} = zeros(UInt8, LZO1X_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1Y_1
— TypeLZO1Y_1
The LZO1Y_1 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1Y_1_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1Y_999
— TypeLZO1Y_999
The LZO1Y_999 algorithm.
Keyword arguments
compression_level::Int = 8
: compression level 1-8, with 8 producing the maximum compression ratio and 1 running the fastest.working_memory::Vector{UInt8} = zeros(UInt8, LZO1Y_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1Z_999
— TypeLZO1Z_999
The LZO1Z_999 algorithm.
Keyword arguments
compression_level::Int = 8
: compression level 1-8, with 8 producing the maximum compression ratio and 1 running the fastest.working_memory::Vector{UInt8} = zeros(UInt8, LZO1Z_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO1_99
— TypeLZO1_99
The LZO1_99 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1_99_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.LZO2A_999
— TypeLZO2A_999
The LZO2A_999 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO2A_999_WORKING_MEMORY_SIZE)
: a block of memory used for historical lookups.
LZOTools.compress
— Methodcompress([algorithm], src::AbstractVector{UInt8}; [kwargs...])::Vector{UInt8}
Compress src
using LZO algorithm algorithm
.
Returns a Vector{UInt8}
loaded with the compressed version of src
.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported compression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
orLZO
, and is the default if no algorithm is given)LZO1
, etc.LZO1_99
LZO1A
LZO1A_99
LZO1B_1
(alsoLZO1B
)LZO1B_2
LZO1B_3
LZO1B_4
LZO1B_5
LZO1B_6
LZO1B_7
LZO1B_8
LZO1B_9
LZO1B_99
LZO1B_999
LZO1C_1
(alsoLZO1C
)LZO1C_2
LZO1C_3
LZO1C_4
LZO1C_5
LZO1C_6
LZO1C_7
LZO1C_8
LZO1C_9
LZO1C_99
LZO1C_999
LZO1F_1
(alsoLZO1F
)LZO1F_999
LZO1X_1_11
LZO1X_1_12
LZO1X_1_15
LZO1X_999
LZO1Y_1
(alsoLZO1Y
)LZO1Y_999
LZO1Z_999
LZO2A_999
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.
LZOTools.decompress
— Methoddecompress([algorithm], src::AbstractVector{UInt8}; [kwargs...])::Vector{UInt8}
Decompress src
using LZO algorithm algorithm
. Only available for algorithms with safe decompression functions defined.
Returns a Vector{UInt8}
loaded with the decompressed version of src
.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported decompression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
,LZO
,LZO1X_1_11
,LZO1X_1_12
,LZO1X_1_15
, orLZO1X_999
, and is the default if no algorithm is given)LZO1B_1
(alsoLZO1B
,LZO1B_2
,LZO1B_3
,LZO1B_4
,LZO1B_5
,LZO1B_6
,LZO1B_7
,LZO1B_8
,LZO1B_9
,LZO1B_99
, orLZO1B_999
)LZO1C_1
(alsoLZO1C
,LZO1C_2
,LZO1C_3
,LZO1C_4
,LZO1C_5
,LZO1C_6
,LZO1C_7
,LZO1C_8
,LZO1C_9
,LZO1C_99
, orLZO1C_999
)LZO1F_1
(alsoLZO1F
orLZO1F_999
)LZO1Y_1
(alsoLZO1Y
orLZO1Y_999
)LZO1Z_999
LZO2A_999
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.
LZOTools.max_compressed_length
— Methodmax_compressed_length(algo, n)::Int
Compute the maximum length that will result from compressing n
bytes using LZO algorithm algo
.
The worst-case scenario is a single super-long literal, in which case the input has to be emitted in its entirety (n bytes) plus the appropriate commands to start a long literal (n/255 bytes + a constant depending on n) plus the end of stream command (3 bytes). However, the liblzo2 authors suggest the following formula for most algorithms.
LZOTools.optimize!
— Methodoptimize!([algorithm], src::AbstractVector{UInt8}; [kwargs...])::Vector{UInt8}
Optimize the already compressed src
in-place using LZO algorithm algorithm
, returning the resized and optimized src
.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported compression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
orLZO
, and is the default if no algorithm is given)LZO1X_1_11
LZO1X_1_12
LZO1X_1_15
LZO1X_999
LZO1Y_1
(alsoLZO1Y
)LZO1Y_999
!!! warn Match the compression algorithm with the optimization algorithm Undefined behavior occurs if the algorithm passed to optimize
does not match the algorithm passed to compress
when src
was generated.
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.
Optimizing compressed data involves splitting "long" literal copy commands into one "short" and one "long" run, then embedding the "short" literal copy into the the previous history copy command, thereby saving up to two bytes from each "long" literal copy command. The particular circumstances under which this optimization can occur happens in only about 1% of literal copy commands and can save at most about 1% of that command's total length, so optimization is only recommended when a 0.01% improvement in compression ratio is absolutely necessary. Also note that any increase in compression ratio achieved through optimization marginally increases the processing time required to decompress the data.
LZOTools.unsafe_compress!
— Methodunsafe_compress!([algorithm], dest, src; [kwargs...])::Int
Compress src
to dest
using LZO algorithm algorithm
, returning the number of bytes loaded into dest
.
The method is "unsafe" in that it does not check to see if the compressed output can fit into dest
before proceeding, and may write out of bounds or crash your program if the number of bytes required to compress src
is larger than the number of bytes available in dest
. The method returns the number of bytes written to dest
, which may be greater than length(dest)
.
Both dest
and src
must have pointer
and length
methods defined, and the memory of dest
has to be writable or else undefined behavior will occur.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported compression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
orLZO
, and is the default if no algorithm is given)LZO1
, etc.LZO1_99
LZO1A
LZO1A_99
LZO1B_1
(alsoLZO1B
)LZO1B_2
LZO1B_3
LZO1B_4
LZO1B_5
LZO1B_6
LZO1B_7
LZO1B_8
LZO1B_9
LZO1B_99
LZO1B_999
LZO1C_1
(alsoLZO1C
)LZO1C_2
LZO1C_3
LZO1C_4
LZO1C_5
LZO1C_6
LZO1C_7
LZO1C_8
LZO1C_9
LZO1C_99
LZO1C_999
LZO1F_1
(alsoLZO1F
)LZO1F_999
LZO1X_1_11
LZO1X_1_12
LZO1X_1_15
LZO1X_999
LZO1Y_1
(alsoLZO1Y
)LZO1Y_999
LZO1Z_999
LZO2A_999
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.
LZOTools.unsafe_decompress!
— Methodunsafe_decompress!([algorithm], dest, src; [kwargs...])::Int
Decompress src
to dest
using LZO algorithm algorithm
, returning the number of bytes loaded into dest
.
The method is "unsafe" in that it does not check to see if the decompressed output can fit into dest
before proceeding, and may write out of bounds or crash your program if the number of bytes required to decompress src
is larger than the number of bytes available in dest
. The method returns the number of bytes written to dest
, which may be greater than length(dest)
.
Both dest
and src
have to have pointer
and length
methods defined, and the memory of dest
has to be writable or else undefined behavior will occur.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported decompression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
,LZO
,LZO1X_1_11
,LZO1X_1_12
,LZO1X_1_15
, orLZO1X_999
, and is the default if no algorithm is given)LZO1
(alsoLZO1_99
)LZO1A
(alsoLZO1A_99
)LZO1B_1
(alsoLZO1B
,LZO1B_2
,LZO1B_3
,LZO1B_4
,LZO1B_5
,LZO1B_6
,LZO1B_7
,LZO1B_8
,LZO1B_9
,LZO1B_99
, orLZO1B_999
)LZO1C_1
(alsoLZO1C
,LZO1C_2
,LZO1C_3
,LZO1C_4
,LZO1C_5
,LZO1C_6
,LZO1C_7
,LZO1C_8
,LZO1C_9
,LZO1C_99
, orLZO1C_999
)LZO1F_1
(alsoLZO1F
orLZO1F_999
)LZO1Y_1
(alsoLZO1Y
orLZO1Y_999
)LZO1Z_999
LZO2A_999
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.
LZOTools.unsafe_optimize!
— Methodunsafe_optimize!([algorithm], dest, src; [kwargs...])::Int
Optimize the already compressed src
in-place by decompressing to dest
using LZO algorithm algorithm
.
The method is "unsafe" in that it does not check to see if the decompressed output can fit into dest
before proceeding, and may write out of bounds or crash your program if the number of bytes required to decompress src
is larger than the number of bytes available in dest
. The method returns the number of bytes written to dest
, which may be greater than length(dest)
.
Both dest
and src
have to have pointer
and length
methods defined, and the memory of both have to be writable or else undefined behavior will occur.
The algorithm
argument, if given, can be an instance of an AbstractLZOAlgorithm
, a Type{<:AbstractLZOAlgorithm}
, or a Symbol
or String
that names an LZO algorithm. The supported compression algorithm types are listed below–the symbol and string versions are the same, case-sensitive characters as the type name:
LZO1X_1
,:LZO1X_1
, or"LZO1X_1"
(alsoLZO1X
orLZO
, and is the default if no algorithm is given)LZO1X_1_11
LZO1X_1_12
LZO1X_1_15
LZO1X_999
LZO1Y_1
(alsoLZO1Y
)LZO1Y_999
!!! warn Match the compression algorithm with the optimization algorithm Undefined behavior occurs if the algorithm passed to optimize
does not match the algorithm passed to compress
when src
was generated.
Keyword arguments kwargs
, if given, are passed to the algorithm struct constructors. See the documentation for the specific algorithm type for more information about valid keyword arguments and defaults.