LZOTools
Documentation for LZOTools.
LZOTools.AbstractLZOAlgorithmLZOTools.LZO1LZOTools.LZO1ALZOTools.LZO1A_99LZOTools.LZO1BLZOTools.LZO1B_99LZOTools.LZO1CLZOTools.LZO1C_99LZOTools.LZO1C_999LZOTools.LZO1F_1LZOTools.LZO1F_999LZOTools.LZO1X_1LZOTools.LZO1X_1_11LZOTools.LZO1X_1_12LZOTools.LZO1X_1_15LZOTools.LZO1X_999LZOTools.LZO1Y_1LZOTools.LZO1Y_999LZOTools.LZO1Z_999LZOTools.LZO1_99LZOTools.LZO2A_999LZOTools.compressLZOTools.decompressLZOTools.max_compressed_lengthLZOTools.optimize!LZOTools.unsafe_compress!LZOTools.unsafe_decompress!LZOTools.unsafe_optimize!
LZOTools.AbstractLZOAlgorithm — TypeAbstractLZOAlgorithmAn abstract type from which specific LZO compression and decompression algorithms inherit.
LZOTools.LZO1 — TypeLZO1The LZO1 algorithm.
Keyword arguments
working_memory::Vector{UInt8} = zeros(UInt8, LZO1_WORKING_MEMORY_SIZE): a block of memory used for historical lookups.
LZOTools.LZO1A — TypeLZO1AThe 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_99The 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 — TypeLZO1BThe 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_99The 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 — TypeLZO1CThe 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_99The 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_999The 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_1The 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_999The 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_1The 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_11The 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_12The 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_15The 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_999The 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_1The 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_999The 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_999The 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_99The 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_999The 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"(alsoLZO1XorLZO, and is the default if no algorithm is given)LZO1, etc.LZO1_99LZO1ALZO1A_99LZO1B_1(alsoLZO1B)LZO1B_2LZO1B_3LZO1B_4LZO1B_5LZO1B_6LZO1B_7LZO1B_8LZO1B_9LZO1B_99LZO1B_999LZO1C_1(alsoLZO1C)LZO1C_2LZO1C_3LZO1C_4LZO1C_5LZO1C_6LZO1C_7LZO1C_8LZO1C_9LZO1C_99LZO1C_999LZO1F_1(alsoLZO1F)LZO1F_999LZO1X_1_11LZO1X_1_12LZO1X_1_15LZO1X_999LZO1Y_1(alsoLZO1Y)LZO1Y_999LZO1Z_999LZO2A_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(alsoLZO1ForLZO1F_999)LZO1Y_1(alsoLZO1YorLZO1Y_999)LZO1Z_999LZO2A_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)::IntCompute 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"(alsoLZO1XorLZO, and is the default if no algorithm is given)LZO1X_1_11LZO1X_1_12LZO1X_1_15LZO1X_999LZO1Y_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...])::IntCompress 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"(alsoLZO1XorLZO, and is the default if no algorithm is given)LZO1, etc.LZO1_99LZO1ALZO1A_99LZO1B_1(alsoLZO1B)LZO1B_2LZO1B_3LZO1B_4LZO1B_5LZO1B_6LZO1B_7LZO1B_8LZO1B_9LZO1B_99LZO1B_999LZO1C_1(alsoLZO1C)LZO1C_2LZO1C_3LZO1C_4LZO1C_5LZO1C_6LZO1C_7LZO1C_8LZO1C_9LZO1C_99LZO1C_999LZO1F_1(alsoLZO1F)LZO1F_999LZO1X_1_11LZO1X_1_12LZO1X_1_15LZO1X_999LZO1Y_1(alsoLZO1Y)LZO1Y_999LZO1Z_999LZO2A_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...])::IntDecompress 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(alsoLZO1ForLZO1F_999)LZO1Y_1(alsoLZO1YorLZO1Y_999)LZO1Z_999LZO2A_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...])::IntOptimize 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"(alsoLZO1XorLZO, and is the default if no algorithm is given)LZO1X_1_11LZO1X_1_12LZO1X_1_15LZO1X_999LZO1Y_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.