1 /* lzo1a_99.c -- implementation of the LZO1A-99 algorithm
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/
30 #define COMPRESS_ID 99
36 /***********************************************************************
38 ************************************************************************/
40 #define LZO_NEED_DICT_H 1
44 /***********************************************************************
45 // compression internal entry point.
46 ************************************************************************/
49 _lzo1a_do_compress ( const lzo_bytep in
, lzo_uint in_len
,
50 lzo_bytep out
, lzo_uintp out_len
,
56 /* don't try to compress a block that's too short */
62 else if (in_len
<= MIN_LOOKAHEAD
+ 1)
64 #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
66 r
= LZO_E_NOT_COMPRESSIBLE
;
68 *out_len
= pd(STORE_RUN(out
,in
,in_len
), out
);
69 r
= (*out_len
> in_len
) ? LZO_E_OK
: LZO_E_ERROR
;
73 r
= func(in
,in_len
,out
,out_len
,wrkmem
);
79 /***********************************************************************
81 ************************************************************************/
83 #if !defined(COMPRESS_ID)
84 #define COMPRESS_ID _LZO_ECONCAT2(DD_BITS,CLEVEL)
88 #define LZO_CODE_MATCH_INCLUDE_FILE "lzo1a_cm.ch"
92 /***********************************************************************
94 ************************************************************************/
96 #define LZO_COMPRESS \
97 LZO_PP_ECONCAT3(lzo1a_,COMPRESS_ID,_compress)
99 #define LZO_COMPRESS_FUNC \
100 LZO_PP_ECONCAT3(_lzo1a_,COMPRESS_ID,_compress_func)
103 /***********************************************************************
105 ************************************************************************/
108 LZO_COMPRESS ( const lzo_bytep in
, lzo_uint in_len
,
109 lzo_bytep out
, lzo_uintp out_len
,
112 return _lzo1a_do_compress(in
,in_len
,out
,out_len
,wrkmem
,do_compress
);
116 /* vim:set ts=4 sw=4 et: */