1 /* lzo1b_xx.c -- LZO1B compression public entry point
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
8 The LZO library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 The LZO library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with the LZO library; see the file COPYING.
20 If not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 Markus F.X.J. Oberhumer
24 <markus@oberhumer.com>
25 http://www.oberhumer.com/opensource/lzo/
32 /***********************************************************************
34 ************************************************************************/
36 static const lzo_compress_t
* const c_funcs
[9] =
38 &_lzo1b_1_compress_func
,
39 &_lzo1b_2_compress_func
,
40 &_lzo1b_3_compress_func
,
41 &_lzo1b_4_compress_func
,
42 &_lzo1b_5_compress_func
,
43 &_lzo1b_6_compress_func
,
44 &_lzo1b_7_compress_func
,
45 &_lzo1b_8_compress_func
,
46 &_lzo1b_9_compress_func
50 static lzo_compress_t
lzo1b_get_compress_func(int clevel
)
52 const lzo_compress_t
*f
;
54 if (clevel
< LZO1B_BEST_SPEED
|| clevel
> LZO1B_BEST_COMPRESSION
)
56 if (clevel
== LZO1B_DEFAULT_COMPRESSION
)
57 clevel
= LZO1B_BEST_SPEED
;
59 return (lzo_compress_t
) 0;
61 f
= c_funcs
[clevel
-1];
68 lzo1b_compress ( const lzo_bytep src
, lzo_uint src_len
,
69 lzo_bytep dst
, lzo_uintp dst_len
,
75 f
= lzo1b_get_compress_func(clevel
);
78 return _lzo1b_do_compress(src
,src_len
,dst
,dst_len
,wrkmem
,f
);
82 /* vim:set ts=4 sw=4 et: */