-
Notifications
You must be signed in to change notification settings - Fork 116
/
lz4hcencode.m
39 lines (37 loc) · 1.16 KB
/
lz4hcencode.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function varargout = lz4hcencode(varargin)
%
% output = lz4hcencode(input)
% or
% [output, info] = lz4hcencode(input)
%
% Compress a string or a numerical array using LZ4HC-compression
%
% This function depends on the ZMat toolbox (http://github.com/NeuroJSON/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]=lz4hcencode(eye(10));
% orig=lz4hcdecode(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)
[varargout{1:nargout}] = zmat(varargin{1}, 1, 'lz4hc', varargin{2:end});
return
else
error('you must install ZMat toolbox to use this feature: http://github.com/NeuroJSON/zmat');
end