lzo: update to 2.09
[tomato.git] / release / src / router / lzo / src / config2a.h
blob17c8281d62cc3a614806b3b3abab58b8e44e8805
1 /* config2a.h -- configuration for the LZO2A algorithm
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
6 All Rights Reserved.
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/
29 /* WARNING: this file should *not* be used by applications. It is
30 part of the implementation of the library and is subject
31 to change.
35 #ifndef __LZO_CONFIG2A_H
36 #define __LZO_CONFIG2A_H 1
38 #include "lzo_conf.h"
39 #include <lzo/lzo2a.h>
42 /***********************************************************************
43 // algorithm configuration
44 ************************************************************************/
46 /* dictionary depth (0 - 6) - this only affects the compressor.
47 * 0 is fastest, 6 is best compression ratio */
48 #if !defined(DDBITS)
49 # define DDBITS 0
50 #endif
52 /* compression level (1 - 9) - this only affects the compressor.
53 * 1 is fastest, 9 is best compression ratio */
54 #if !defined(CLEVEL)
55 # define CLEVEL 1 /* fastest by default */
56 #endif
59 /* check configuration */
60 #if (DDBITS < 0 || DDBITS > 6)
61 # error "invalid DDBITS"
62 #endif
63 #if (CLEVEL < 1 || CLEVEL > 9)
64 # error "invalid CLEVEL"
65 #endif
68 /***********************************************************************
69 // internal configuration
70 ************************************************************************/
72 #if 1
73 #define SWD_N 8191 /* size of ring buffer */
74 #else
75 #define SWD_N 16383 /* size of ring buffer */
76 #endif
78 #define M1_MIN_LEN 2
79 #define M1_MAX_LEN 5
80 #define M2_MIN_LEN 3
81 #define M3_MIN_LEN 3
84 /* add a special code so that the decompressor can detect the
85 * end of the compressed data block (overhead is 3 bytes per block) */
86 #define LZO_EOF_CODE 1
88 #undef LZO_DETERMINISTIC
91 /***********************************************************************
92 // algorithm internal configuration
93 ************************************************************************/
95 /* choose the hashing strategy */
96 #ifndef LZO_HASH
97 #define LZO_HASH LZO_HASH_LZO_INCREMENTAL_A
98 #endif
100 /* config */
101 #define DD_BITS DDBITS
102 #ifndef D_BITS
103 #define D_BITS 14
104 #endif
108 /***********************************************************************
109 // optimization and debugging
110 ************************************************************************/
112 /* Collect statistics */
113 #if 0 && !defined(LZO_COLLECT_STATS)
114 # define LZO_COLLECT_STATS 1
115 #endif
118 /***********************************************************************
120 ************************************************************************/
122 /* get bits */
123 #define _NEEDBITS \
124 { _NEEDBYTE; b |= ((lzo_uint32_t) _NEXTBYTE) << k; k += 8; assert(k <= 32); }
125 #define NEEDBITS(j) { assert((j) < 8); if (k < (j)) _NEEDBITS }
127 /* set bits */
128 #define SETBITS(j,x) { b |= ((lzo_uint32_t)(x)) << k; k += (j); assert(k <= 32); }
130 /* access bits */
131 #define MASKBITS(j) (b & ((((lzo_uint32_t)1 << (j)) - 1)))
133 /* drop bits */
134 #define DUMPBITS(j) { assert(k >= j); b >>= (j); k -= (j); }
138 #endif /* already included */
141 /* vim:set ts=4 sw=4 et: */