-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
634 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function varargout = blosc2decode(varargin) | ||
% | ||
% output = blosc2decode(input,codec) | ||
% output = blosc2decode(input) | ||
% or | ||
% output = blosc2decode(input,info) | ||
% | ||
% Decompressing an blosc2-compressed byte-stream to recover the original data | ||
% This function depends on the ZMat toolbox (https://github.com/fangq/zmat) | ||
% | ||
% authors:Qianqian Fang (q.fang <at> neu.edu) | ||
% | ||
% input: | ||
% input: a string, int8/uint8 vector or numerical array to store blosc2-compressed data | ||
% codec: if the 2nd input is a string, it is treated as a compression method that | ||
% blosc2 supports, it can be one of: | ||
% 'blosc2blosclz', 'blosc2lz4', 'blosc2lz4hc', 'blosc2zlib' and 'blosc2zstd' | ||
% if no codec is specified, 'blosc2blosclz' method is assumed | ||
% info (optional): a struct produced by the zmat/blosc2encode function during | ||
% compression; if not given, the inputs/outputs will be treated as a | ||
% 1-D vector | ||
% | ||
% output: | ||
% output: the decompressed byte stream stored in a uint8 vector; if info is | ||
% given, output will restore the original data's type and dimensions | ||
% | ||
% examples: | ||
% [bytes, info]=blosc2encode(eye(10)); | ||
% orig=blosc2decode(bytes,info); | ||
% | ||
% license: | ||
% BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details | ||
% | ||
% -- this function is part of JSONLab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) | ||
% | ||
|
||
if (nargin == 0) | ||
error('you must provide at least 1 input'); | ||
end | ||
if (exist('zmat', 'file') == 2 || exist('zmat', 'file') == 3) | ||
if (nargin >= 2 && ischar(varargin{2})) | ||
[varargout{1:nargout}] = zmat(varargin{1}, 0, varargin{2:end}); | ||
elseif (nargin > 1) | ||
[varargout{1:nargout}] = zmat(varargin{1}, varargin{2:end}); | ||
else | ||
[varargout{1:nargout}] = zmat(varargin{1}, 0, 'blosc2blosclz', varargin{2:end}); | ||
end | ||
else | ||
error('you must install ZMat toolbox to use this feature: https://github.com/NeuroJSON/zmat'); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function varargout = blosc2encode(varargin) | ||
% | ||
% output = blosc2encode(input) | ||
% or | ||
% [output, info] = blosc2encode(input) | ||
% | ||
% Compress a string or a numerical array using LZ4-compression | ||
% | ||
% This function depends on the ZMat toolbox (https://github.com/fangq/zmat) | ||
% | ||
% authors:Qianqian Fang (q.fang <at> neu.edu) | ||
% | ||
% input: | ||
% input: the original data, can be a string, a numerical vector or array | ||
% | ||
% output: | ||
% output: the compressed byte stream stored in a uint8 vector | ||
% info: (optional) a struct storing the metadata of the input, see "help zmat" for details | ||
% | ||
% examples: | ||
% [bytes, info]=blosc2encode(eye(10)); | ||
% orig=blosc2decode(bytes,info); | ||
% | ||
% license: | ||
% BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details | ||
% | ||
% -- this function is part of JSONLab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) | ||
% | ||
|
||
if (nargin == 0) | ||
error('you must provide at least 1 input'); | ||
end | ||
|
||
if (exist('zmat', 'file') == 2 || exist('zmat', 'file') == 3) | ||
if (nargin > 1 && ischar(varargin{2})) | ||
[varargout{1:nargout}] = zmat(varargin{1}, 1, varargin{2:end}); | ||
else | ||
[varargout{1:nargout}] = zmat(varargin{1}, 1, 'blosc2blosclz', varargin{2:end}); | ||
end | ||
return | ||
else | ||
error('you must install ZMat toolbox to use this feature: https://github.com/NeuroJSON/zmat'); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.