256 | 5.38k | } Line | Count | Source | 69 | 365 | { | 70 | 365 | const lzo_bytep ip; | 71 | 365 | #if (DD_BITS > 0) | 72 | 365 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 365 | lzo_xint dv; | 74 | 365 | #endif | 75 | 365 | unsigned drun = 0; | 76 | 365 | #endif | 77 | 365 | lzo_bytep op; | 78 | 365 | const lzo_bytep const in_end = in + in_len; | 79 | 365 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 365 | const lzo_bytep ii; | 81 | | #if defined(LZO_HAVE_R1) | 82 | | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 365 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 365 | #if (LZO_DETERMINISTIC) | 104 | 365 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 365 | #endif | 106 | | | 107 | | | 108 | 365 | op = out; | 109 | 365 | ip = in; | 110 | 365 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 365 | #if (DD_BITS > 0) | 114 | 365 | DVAL_FIRST(dv,ip); | 115 | 365 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 365 | ip++; | 117 | 365 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 365 | assert(ip < ip_end); | 123 | 365 | for (;;) | 124 | 4.25M | { | 125 | 4.25M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 4.25M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 4.25M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 4.25M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 4.25M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 4.25M | #endif | 143 | | | 144 | 4.25M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 4.25M | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 4.25M | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 4.25M | #endif | 150 | | | 151 | 4.25M | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 3.87M | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 3.87M | if (++ip >= ip_end) | 166 | 74 | break; | 167 | 3.87M | #if (DD_BITS > 0) | 168 | 3.87M | DVAL_NEXT(dv,ip); | 169 | 3.87M | #endif | 170 | 3.87M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 374k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 374k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 374k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 374k | #endif | 188 | | | 189 | 374k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 374k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | | #endif | 203 | | | 204 | 374k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 373k | assert(ii == ip); | 209 | | | 210 | 373k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 365 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 365 | if (pd(in_end,ii) > 0) | 249 | 300 | { | 250 | 300 | lzo_uint t = pd(in_end,ii); | 251 | 300 | op = STORE_RUN(op,ii,t); | 252 | 300 | } | 253 | | | 254 | 365 | *out_len = pd(op, out); | 255 | 365 | return LZO_E_OK; /* compression went ok */ | 256 | 365 | } |
Line | Count | Source | 69 | 340 | { | 70 | 340 | const lzo_bytep ip; | 71 | 340 | #if (DD_BITS > 0) | 72 | 340 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 340 | lzo_xint dv; | 74 | 340 | #endif | 75 | 340 | unsigned drun = 0; | 76 | 340 | #endif | 77 | 340 | lzo_bytep op; | 78 | 340 | const lzo_bytep const in_end = in + in_len; | 79 | 340 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 340 | const lzo_bytep ii; | 81 | 340 | #if defined(LZO_HAVE_R1) | 82 | 340 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 340 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 340 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 340 | #if (LZO_DETERMINISTIC) | 104 | 340 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 340 | #endif | 106 | | | 107 | | | 108 | 340 | op = out; | 109 | 340 | ip = in; | 110 | 340 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 340 | #if (DD_BITS > 0) | 114 | 340 | DVAL_FIRST(dv,ip); | 115 | 340 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 340 | ip++; | 117 | 340 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 340 | assert(ip < ip_end); | 123 | 340 | for (;;) | 124 | 2.02M | { | 125 | 2.02M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 2.02M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 2.02M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 2.02M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 2.02M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 2.02M | #endif | 143 | | | 144 | 2.02M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 2.02M | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 2.02M | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 2.02M | #endif | 150 | | | 151 | 2.02M | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 1.90M | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 1.90M | if (++ip >= ip_end) | 166 | 69 | break; | 167 | 1.90M | #if (DD_BITS > 0) | 168 | 1.90M | DVAL_NEXT(dv,ip); | 169 | 1.90M | #endif | 170 | 1.90M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 117k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 117k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 117k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 117k | #endif | 188 | | | 189 | 117k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 117k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | | #endif | 203 | | | 204 | 117k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 116k | assert(ii == ip); | 209 | | | 210 | 116k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 340 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 340 | if (pd(in_end,ii) > 0) | 249 | 272 | { | 250 | 272 | lzo_uint t = pd(in_end,ii); | 251 | 272 | op = STORE_RUN(op,ii,t); | 252 | 272 | } | 253 | | | 254 | 340 | *out_len = pd(op, out); | 255 | 340 | return LZO_E_OK; /* compression went ok */ | 256 | 340 | } |
Line | Count | Source | 69 | 323 | { | 70 | 323 | const lzo_bytep ip; | 71 | | #if (DD_BITS > 0) | 72 | | #if defined(__LZO_HASH_INCREMENTAL) | 73 | | lzo_xint dv; | 74 | | #endif | 75 | | unsigned drun = 0; | 76 | | #endif | 77 | 323 | lzo_bytep op; | 78 | 323 | const lzo_bytep const in_end = in + in_len; | 79 | 323 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 323 | const lzo_bytep ii; | 81 | 323 | #if defined(LZO_HAVE_R1) | 82 | 323 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 323 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 323 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 323 | #if (LZO_DETERMINISTIC) | 104 | 323 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 323 | #endif | 106 | | | 107 | | | 108 | 323 | op = out; | 109 | 323 | ip = in; | 110 | 323 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | | #if (DD_BITS > 0) | 114 | | DVAL_FIRST(dv,ip); | 115 | | UPDATE_D(dict,drun,dv,ip,in); | 116 | | ip++; | 117 | | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | 323 | ip++; | 120 | 323 | #endif | 121 | | | 122 | 323 | assert(ip < ip_end); | 123 | 323 | for (;;) | 124 | 947k | { | 125 | 947k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 947k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | 947k | #if (DD_BITS == 0) | 131 | 947k | lzo_uint dindex; | 132 | 947k | #endif | 133 | 947k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 947k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 947k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 947k | #endif | 143 | | | 144 | 947k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 48.4k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 48.4k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 48.4k | #endif | 150 | | | 151 | 48.4k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 865k | literal: | 162 | 865k | #if (DD_BITS == 0) | 163 | 865k | UPDATE_I(dict,0,dindex,ip,in); | 164 | 865k | #endif | 165 | 865k | if (++ip >= ip_end) | 166 | 93 | break; | 167 | | #if (DD_BITS > 0) | 168 | | DVAL_NEXT(dv,ip); | 169 | | #endif | 170 | 864k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 864k | match: | 179 | 82.2k | #if (DD_BITS == 0) | 180 | 82.2k | UPDATE_I(dict,0,dindex,ip,in); | 181 | 82.2k | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 82.2k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 82.2k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 82.2k | #endif | 188 | | | 189 | 82.2k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 82.2k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 82.2k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 82.2k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 82.2k | #endif | 203 | | | 204 | 82.2k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 82.0k | assert(ii == ip); | 209 | | | 210 | 82.0k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 323 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 323 | if (pd(in_end,ii) > 0) | 249 | 281 | { | 250 | 281 | lzo_uint t = pd(in_end,ii); | 251 | 281 | op = STORE_RUN(op,ii,t); | 252 | 281 | } | 253 | | | 254 | 323 | *out_len = pd(op, out); | 255 | 323 | return LZO_E_OK; /* compression went ok */ | 256 | 323 | } |
Line | Count | Source | 69 | 298 | { | 70 | 298 | const lzo_bytep ip; | 71 | | #if (DD_BITS > 0) | 72 | | #if defined(__LZO_HASH_INCREMENTAL) | 73 | | lzo_xint dv; | 74 | | #endif | 75 | | unsigned drun = 0; | 76 | | #endif | 77 | 298 | lzo_bytep op; | 78 | 298 | const lzo_bytep const in_end = in + in_len; | 79 | 298 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 298 | const lzo_bytep ii; | 81 | 298 | #if defined(LZO_HAVE_R1) | 82 | 298 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 298 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 298 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 298 | #if (LZO_DETERMINISTIC) | 104 | 298 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 298 | #endif | 106 | | | 107 | | | 108 | 298 | op = out; | 109 | 298 | ip = in; | 110 | 298 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | | #if (DD_BITS > 0) | 114 | | DVAL_FIRST(dv,ip); | 115 | | UPDATE_D(dict,drun,dv,ip,in); | 116 | | ip++; | 117 | | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | 298 | ip++; | 120 | 298 | #endif | 121 | | | 122 | 298 | assert(ip < ip_end); | 123 | 298 | for (;;) | 124 | 1.33M | { | 125 | 1.33M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 1.33M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | 1.33M | #if (DD_BITS == 0) | 131 | 1.33M | lzo_uint dindex; | 132 | 1.33M | #endif | 133 | 1.33M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 1.33M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 1.33M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 1.33M | #endif | 143 | | | 144 | 1.33M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 88.7k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 88.7k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 88.7k | #endif | 150 | | | 151 | 88.7k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 1.25M | literal: | 162 | 1.25M | #if (DD_BITS == 0) | 163 | 1.25M | UPDATE_I(dict,0,dindex,ip,in); | 164 | 1.25M | #endif | 165 | 1.25M | if (++ip >= ip_end) | 166 | 91 | break; | 167 | | #if (DD_BITS > 0) | 168 | | DVAL_NEXT(dv,ip); | 169 | | #endif | 170 | 1.25M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 1.25M | match: | 179 | 79.4k | #if (DD_BITS == 0) | 180 | 79.4k | UPDATE_I(dict,0,dindex,ip,in); | 181 | 79.4k | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 79.4k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 79.4k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 79.4k | #endif | 188 | | | 189 | 79.4k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 79.4k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 79.4k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 79.4k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 79.4k | #endif | 203 | | | 204 | 79.4k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 79.2k | assert(ii == ip); | 209 | | | 210 | 79.2k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 298 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 298 | if (pd(in_end,ii) > 0) | 249 | 273 | { | 250 | 273 | lzo_uint t = pd(in_end,ii); | 251 | 273 | op = STORE_RUN(op,ii,t); | 252 | 273 | } | 253 | | | 254 | 298 | *out_len = pd(op, out); | 255 | 298 | return LZO_E_OK; /* compression went ok */ | 256 | 298 | } |
Line | Count | Source | 69 | 342 | { | 70 | 342 | const lzo_bytep ip; | 71 | | #if (DD_BITS > 0) | 72 | | #if defined(__LZO_HASH_INCREMENTAL) | 73 | | lzo_xint dv; | 74 | | #endif | 75 | | unsigned drun = 0; | 76 | | #endif | 77 | 342 | lzo_bytep op; | 78 | 342 | const lzo_bytep const in_end = in + in_len; | 79 | 342 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 342 | const lzo_bytep ii; | 81 | 342 | #if defined(LZO_HAVE_R1) | 82 | 342 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 342 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 342 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 342 | #if (LZO_DETERMINISTIC) | 104 | 342 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 342 | #endif | 106 | | | 107 | | | 108 | 342 | op = out; | 109 | 342 | ip = in; | 110 | 342 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | | #if (DD_BITS > 0) | 114 | | DVAL_FIRST(dv,ip); | 115 | | UPDATE_D(dict,drun,dv,ip,in); | 116 | | ip++; | 117 | | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | 342 | ip++; | 120 | 342 | #endif | 121 | | | 122 | 342 | assert(ip < ip_end); | 123 | 342 | for (;;) | 124 | 3.83M | { | 125 | 3.83M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 3.83M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | 3.83M | #if (DD_BITS == 0) | 131 | 3.83M | lzo_uint dindex; | 132 | 3.83M | #endif | 133 | 3.83M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 3.83M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 3.83M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 3.83M | #endif | 143 | | | 144 | 3.83M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 194k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 194k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 194k | #endif | 150 | | | 151 | 194k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 3.68M | literal: | 162 | 3.68M | #if (DD_BITS == 0) | 163 | 3.68M | UPDATE_I(dict,0,dindex,ip,in); | 164 | 3.68M | #endif | 165 | 3.68M | if (++ip >= ip_end) | 166 | 136 | break; | 167 | | #if (DD_BITS > 0) | 168 | | DVAL_NEXT(dv,ip); | 169 | | #endif | 170 | 3.68M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 3.68M | match: | 179 | 152k | #if (DD_BITS == 0) | 180 | 152k | UPDATE_I(dict,0,dindex,ip,in); | 181 | 152k | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 152k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 152k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 152k | #endif | 188 | | | 189 | 152k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 152k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 152k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 152k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 152k | #endif | 203 | | | 204 | 152k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 152k | assert(ii == ip); | 209 | | | 210 | 152k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 342 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 342 | if (pd(in_end,ii) > 0) | 249 | 310 | { | 250 | 310 | lzo_uint t = pd(in_end,ii); | 251 | 310 | op = STORE_RUN(op,ii,t); | 252 | 310 | } | 253 | | | 254 | 342 | *out_len = pd(op, out); | 255 | 342 | return LZO_E_OK; /* compression went ok */ | 256 | 342 | } |
Line | Count | Source | 69 | 315 | { | 70 | 315 | const lzo_bytep ip; | 71 | 315 | #if (DD_BITS > 0) | 72 | 315 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 315 | lzo_xint dv; | 74 | 315 | #endif | 75 | 315 | unsigned drun = 0; | 76 | 315 | #endif | 77 | 315 | lzo_bytep op; | 78 | 315 | const lzo_bytep const in_end = in + in_len; | 79 | 315 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 315 | const lzo_bytep ii; | 81 | 315 | #if defined(LZO_HAVE_R1) | 82 | 315 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 315 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 315 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 315 | #if (LZO_DETERMINISTIC) | 104 | 315 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 315 | #endif | 106 | | | 107 | | | 108 | 315 | op = out; | 109 | 315 | ip = in; | 110 | 315 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 315 | #if (DD_BITS > 0) | 114 | 315 | DVAL_FIRST(dv,ip); | 115 | 315 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 315 | ip++; | 117 | 315 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 315 | assert(ip < ip_end); | 123 | 315 | for (;;) | 124 | 851k | { | 125 | 851k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 851k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 851k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 851k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 851k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 851k | #endif | 143 | | | 144 | 851k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 828k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 743k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 743k | if (++ip >= ip_end) | 166 | 68 | break; | 167 | 743k | #if (DD_BITS > 0) | 168 | 743k | DVAL_NEXT(dv,ip); | 169 | 743k | #endif | 170 | 743k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 108k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 108k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 108k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 108k | #endif | 188 | | | 189 | 108k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 108k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 108k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 108k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 108k | #endif | 203 | | | 204 | 108k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 108k | assert(ii == ip); | 209 | | | 210 | 108k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 315 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 315 | if (pd(in_end,ii) > 0) | 249 | 286 | { | 250 | 286 | lzo_uint t = pd(in_end,ii); | 251 | 286 | op = STORE_RUN(op,ii,t); | 252 | 286 | } | 253 | | | 254 | 315 | *out_len = pd(op, out); | 255 | 315 | return LZO_E_OK; /* compression went ok */ | 256 | 315 | } |
Line | Count | Source | 69 | 313 | { | 70 | 313 | const lzo_bytep ip; | 71 | 313 | #if (DD_BITS > 0) | 72 | 313 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 313 | lzo_xint dv; | 74 | 313 | #endif | 75 | 313 | unsigned drun = 0; | 76 | 313 | #endif | 77 | 313 | lzo_bytep op; | 78 | 313 | const lzo_bytep const in_end = in + in_len; | 79 | 313 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 313 | const lzo_bytep ii; | 81 | 313 | #if defined(LZO_HAVE_R1) | 82 | 313 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 313 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 313 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 313 | #if (LZO_DETERMINISTIC) | 104 | 313 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 313 | #endif | 106 | | | 107 | | | 108 | 313 | op = out; | 109 | 313 | ip = in; | 110 | 313 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 313 | #if (DD_BITS > 0) | 114 | 313 | DVAL_FIRST(dv,ip); | 115 | 313 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 313 | ip++; | 117 | 313 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 313 | assert(ip < ip_end); | 123 | 313 | for (;;) | 124 | 801k | { | 125 | 801k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 801k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 801k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 801k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 801k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 801k | #endif | 143 | | | 144 | 801k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 785k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 721k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 721k | if (++ip >= ip_end) | 166 | 67 | break; | 167 | 721k | #if (DD_BITS > 0) | 168 | 721k | DVAL_NEXT(dv,ip); | 169 | 721k | #endif | 170 | 721k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 79.6k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 79.6k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 79.6k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 79.6k | #endif | 188 | | | 189 | 79.6k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 79.6k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 79.6k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 79.6k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 79.6k | #endif | 203 | | | 204 | 79.6k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 79.4k | assert(ii == ip); | 209 | | | 210 | 79.4k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 313 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 313 | if (pd(in_end,ii) > 0) | 249 | 280 | { | 250 | 280 | lzo_uint t = pd(in_end,ii); | 251 | 280 | op = STORE_RUN(op,ii,t); | 252 | 280 | } | 253 | | | 254 | 313 | *out_len = pd(op, out); | 255 | 313 | return LZO_E_OK; /* compression went ok */ | 256 | 313 | } |
Line | Count | Source | 69 | 310 | { | 70 | 310 | const lzo_bytep ip; | 71 | 310 | #if (DD_BITS > 0) | 72 | 310 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 310 | lzo_xint dv; | 74 | 310 | #endif | 75 | 310 | unsigned drun = 0; | 76 | 310 | #endif | 77 | 310 | lzo_bytep op; | 78 | 310 | const lzo_bytep const in_end = in + in_len; | 79 | 310 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 310 | const lzo_bytep ii; | 81 | 310 | #if defined(LZO_HAVE_R1) | 82 | 310 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 310 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 310 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 310 | #if (LZO_DETERMINISTIC) | 104 | 310 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 310 | #endif | 106 | | | 107 | | | 108 | 310 | op = out; | 109 | 310 | ip = in; | 110 | 310 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 310 | #if (DD_BITS > 0) | 114 | 310 | DVAL_FIRST(dv,ip); | 115 | 310 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 310 | ip++; | 117 | 310 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 310 | assert(ip < ip_end); | 123 | 310 | for (;;) | 124 | 860k | { | 125 | 860k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 860k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 860k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 860k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 860k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 860k | #endif | 143 | | | 144 | 860k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 844k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 778k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 778k | if (++ip >= ip_end) | 166 | 58 | break; | 167 | 778k | #if (DD_BITS > 0) | 168 | 778k | DVAL_NEXT(dv,ip); | 169 | 778k | #endif | 170 | 778k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 81.6k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 81.6k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 81.6k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 81.6k | #endif | 188 | | | 189 | 81.6k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 81.6k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 81.6k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 81.6k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 81.6k | #endif | 203 | | | 204 | 81.6k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 81.4k | assert(ii == ip); | 209 | | | 210 | 81.4k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 310 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 310 | if (pd(in_end,ii) > 0) | 249 | 287 | { | 250 | 287 | lzo_uint t = pd(in_end,ii); | 251 | 287 | op = STORE_RUN(op,ii,t); | 252 | 287 | } | 253 | | | 254 | 310 | *out_len = pd(op, out); | 255 | 310 | return LZO_E_OK; /* compression went ok */ | 256 | 310 | } |
Line | Count | Source | 69 | 302 | { | 70 | 302 | const lzo_bytep ip; | 71 | 302 | #if (DD_BITS > 0) | 72 | 302 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 302 | lzo_xint dv; | 74 | 302 | #endif | 75 | 302 | unsigned drun = 0; | 76 | 302 | #endif | 77 | 302 | lzo_bytep op; | 78 | 302 | const lzo_bytep const in_end = in + in_len; | 79 | 302 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 302 | const lzo_bytep ii; | 81 | 302 | #if defined(LZO_HAVE_R1) | 82 | 302 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 302 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 302 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 302 | #if (LZO_DETERMINISTIC) | 104 | 302 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 302 | #endif | 106 | | | 107 | | | 108 | 302 | op = out; | 109 | 302 | ip = in; | 110 | 302 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 302 | #if (DD_BITS > 0) | 114 | 302 | DVAL_FIRST(dv,ip); | 115 | 302 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 302 | ip++; | 117 | 302 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 302 | assert(ip < ip_end); | 123 | 302 | for (;;) | 124 | 754k | { | 125 | 754k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 754k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 754k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 754k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 754k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 754k | #endif | 143 | | | 144 | 754k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 735k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 680k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 680k | if (++ip >= ip_end) | 166 | 64 | break; | 167 | 680k | #if (DD_BITS > 0) | 168 | 680k | DVAL_NEXT(dv,ip); | 169 | 680k | #endif | 170 | 680k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 73.9k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 73.9k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 73.9k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 73.9k | #endif | 188 | | | 189 | 73.9k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 73.9k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 73.9k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 73.9k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 73.9k | #endif | 203 | | | 204 | 73.9k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 73.7k | assert(ii == ip); | 209 | | | 210 | 73.7k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 302 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 302 | if (pd(in_end,ii) > 0) | 249 | 273 | { | 250 | 273 | lzo_uint t = pd(in_end,ii); | 251 | 273 | op = STORE_RUN(op,ii,t); | 252 | 273 | } | 253 | | | 254 | 302 | *out_len = pd(op, out); | 255 | 302 | return LZO_E_OK; /* compression went ok */ | 256 | 302 | } |
Line | Count | Source | 69 | 317 | { | 70 | 317 | const lzo_bytep ip; | 71 | 317 | #if (DD_BITS > 0) | 72 | 317 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 317 | lzo_xint dv; | 74 | 317 | #endif | 75 | 317 | unsigned drun = 0; | 76 | 317 | #endif | 77 | 317 | lzo_bytep op; | 78 | 317 | const lzo_bytep const in_end = in + in_len; | 79 | 317 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 317 | const lzo_bytep ii; | 81 | 317 | #if defined(LZO_HAVE_R1) | 82 | 317 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 317 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 317 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 317 | #if (LZO_DETERMINISTIC) | 104 | 317 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 317 | #endif | 106 | | | 107 | | | 108 | 317 | op = out; | 109 | 317 | ip = in; | 110 | 317 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 317 | #if (DD_BITS > 0) | 114 | 317 | DVAL_FIRST(dv,ip); | 115 | 317 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 317 | ip++; | 117 | 317 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 317 | assert(ip < ip_end); | 123 | 317 | for (;;) | 124 | 1.12M | { | 125 | 1.12M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 1.12M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 1.12M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 1.12M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 1.12M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 1.12M | #endif | 143 | | | 144 | 1.12M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 1.11M | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 1.03M | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 1.03M | if (++ip >= ip_end) | 166 | 70 | break; | 167 | 1.03M | #if (DD_BITS > 0) | 168 | 1.03M | DVAL_NEXT(dv,ip); | 169 | 1.03M | #endif | 170 | 1.03M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 90.1k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 90.1k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 90.1k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 90.1k | #endif | 188 | | | 189 | 90.1k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 90.1k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 90.1k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 90.1k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 90.1k | #endif | 203 | | | 204 | 90.1k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 89.9k | assert(ii == ip); | 209 | | | 210 | 89.9k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 317 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 317 | if (pd(in_end,ii) > 0) | 249 | 286 | { | 250 | 286 | lzo_uint t = pd(in_end,ii); | 251 | 286 | op = STORE_RUN(op,ii,t); | 252 | 286 | } | 253 | | | 254 | 317 | *out_len = pd(op, out); | 255 | 317 | return LZO_E_OK; /* compression went ok */ | 256 | 317 | } |
Line | Count | Source | 69 | 349 | { | 70 | 349 | const lzo_bytep ip; | 71 | 349 | #if (DD_BITS > 0) | 72 | 349 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 349 | lzo_xint dv; | 74 | 349 | #endif | 75 | 349 | unsigned drun = 0; | 76 | 349 | #endif | 77 | 349 | lzo_bytep op; | 78 | 349 | const lzo_bytep const in_end = in + in_len; | 79 | 349 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 349 | const lzo_bytep ii; | 81 | 349 | #if defined(LZO_HAVE_R1) | 82 | 349 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 349 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 349 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 349 | #if (LZO_DETERMINISTIC) | 104 | 349 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 349 | #endif | 106 | | | 107 | | | 108 | 349 | op = out; | 109 | 349 | ip = in; | 110 | 349 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 349 | #if (DD_BITS > 0) | 114 | 349 | DVAL_FIRST(dv,ip); | 115 | 349 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 349 | ip++; | 117 | 349 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 349 | assert(ip < ip_end); | 123 | 349 | for (;;) | 124 | 717k | { | 125 | 717k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 717k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 717k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 717k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 717k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 717k | #endif | 143 | | | 144 | 717k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 717k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 717k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 717k | #endif | 150 | | | 151 | 717k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 635k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 635k | if (++ip >= ip_end) | 166 | 75 | break; | 167 | 635k | #if (DD_BITS > 0) | 168 | 635k | DVAL_NEXT(dv,ip); | 169 | 635k | #endif | 170 | 635k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 82.3k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 82.3k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 82.3k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 82.3k | #endif | 188 | | | 189 | 82.3k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 82.3k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 82.3k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 82.3k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 82.3k | #endif | 203 | | | 204 | 82.3k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 82.0k | assert(ii == ip); | 209 | | | 210 | 82.0k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 349 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 349 | if (pd(in_end,ii) > 0) | 249 | 309 | { | 250 | 309 | lzo_uint t = pd(in_end,ii); | 251 | 309 | op = STORE_RUN(op,ii,t); | 252 | 309 | } | 253 | | | 254 | 349 | *out_len = pd(op, out); | 255 | 349 | return LZO_E_OK; /* compression went ok */ | 256 | 349 | } |
Line | Count | Source | 69 | 351 | { | 70 | 351 | const lzo_bytep ip; | 71 | 351 | #if (DD_BITS > 0) | 72 | 351 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 351 | lzo_xint dv; | 74 | 351 | #endif | 75 | 351 | unsigned drun = 0; | 76 | 351 | #endif | 77 | 351 | lzo_bytep op; | 78 | 351 | const lzo_bytep const in_end = in + in_len; | 79 | 351 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 351 | const lzo_bytep ii; | 81 | 351 | #if defined(LZO_HAVE_R1) | 82 | 351 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 351 | #endif | 84 | | #if defined(LZO_HAVE_M3) | 85 | | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | | #endif | 87 | | | 88 | 351 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | 351 | #if (LZO_DETERMINISTIC) | 104 | 351 | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | 351 | #endif | 106 | | | 107 | | | 108 | 351 | op = out; | 109 | 351 | ip = in; | 110 | 351 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 351 | #if (DD_BITS > 0) | 114 | 351 | DVAL_FIRST(dv,ip); | 115 | 351 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 351 | ip++; | 117 | 351 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 351 | assert(ip < ip_end); | 123 | 351 | for (;;) | 124 | 777k | { | 125 | 777k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 777k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 777k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 777k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 777k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 777k | #endif | 143 | | | 144 | 777k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 777k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 708k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 708k | if (++ip >= ip_end) | 166 | 67 | break; | 167 | 708k | #if (DD_BITS > 0) | 168 | 708k | DVAL_NEXT(dv,ip); | 169 | 708k | #endif | 170 | 708k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 68.8k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 68.8k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 68.8k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 68.8k | #endif | 188 | | | 189 | 68.8k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 68.8k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 68.8k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 68.8k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 68.8k | #endif | 203 | | | 204 | 68.8k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 68.6k | assert(ii == ip); | 209 | | | 210 | 68.6k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 351 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 351 | if (pd(in_end,ii) > 0) | 249 | 313 | { | 250 | 313 | lzo_uint t = pd(in_end,ii); | 251 | 313 | op = STORE_RUN(op,ii,t); | 252 | 313 | } | 253 | | | 254 | 351 | *out_len = pd(op, out); | 255 | 351 | return LZO_E_OK; /* compression went ok */ | 256 | 351 | } |
Line | Count | Source | 69 | 391 | { | 70 | 391 | const lzo_bytep ip; | 71 | | #if (DD_BITS > 0) | 72 | | #if defined(__LZO_HASH_INCREMENTAL) | 73 | | lzo_xint dv; | 74 | | #endif | 75 | | unsigned drun = 0; | 76 | | #endif | 77 | 391 | lzo_bytep op; | 78 | 391 | const lzo_bytep const in_end = in + in_len; | 79 | 391 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 391 | const lzo_bytep ii; | 81 | 391 | #if defined(LZO_HAVE_R1) | 82 | 391 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 391 | #endif | 84 | 391 | #if defined(LZO_HAVE_M3) | 85 | 391 | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | 391 | #endif | 87 | | | 88 | 391 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | | #if (LZO_DETERMINISTIC) | 104 | | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | | #endif | 106 | | | 107 | | | 108 | 391 | op = out; | 109 | 391 | ip = in; | 110 | 391 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | | #if (DD_BITS > 0) | 114 | | DVAL_FIRST(dv,ip); | 115 | | UPDATE_D(dict,drun,dv,ip,in); | 116 | | ip++; | 117 | | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | 391 | ip++; | 120 | 391 | #endif | 121 | | | 122 | 391 | assert(ip < ip_end); | 123 | 391 | for (;;) | 124 | 6.27M | { | 125 | 6.27M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 6.27M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | 6.27M | #if (DD_BITS == 0) | 131 | 6.27M | lzo_uint dindex; | 132 | 6.27M | #endif | 133 | 6.27M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 6.27M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 6.27M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 6.27M | #endif | 143 | | | 144 | 6.27M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 218k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 218k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 218k | #endif | 150 | | | 151 | 218k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 6.15M | literal: | 162 | 6.15M | #if (DD_BITS == 0) | 163 | 6.15M | UPDATE_I(dict,0,dindex,ip,in); | 164 | 6.15M | #endif | 165 | 6.15M | if (++ip >= ip_end) | 166 | 116 | break; | 167 | | #if (DD_BITS > 0) | 168 | | DVAL_NEXT(dv,ip); | 169 | | #endif | 170 | 6.15M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 6.15M | match: | 179 | 119k | #if (DD_BITS == 0) | 180 | 119k | UPDATE_I(dict,0,dindex,ip,in); | 181 | 119k | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 119k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 119k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 119k | #endif | 188 | | | 189 | 119k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 119k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 119k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 119k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 119k | #endif | 203 | | | 204 | 119k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 118k | assert(ii == ip); | 209 | | | 210 | 118k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 391 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 391 | if (pd(in_end,ii) > 0) | 249 | 334 | { | 250 | 334 | lzo_uint t = pd(in_end,ii); | 251 | 334 | op = STORE_RUN(op,ii,t); | 252 | 334 | } | 253 | | | 254 | 391 | *out_len = pd(op, out); | 255 | 391 | return LZO_E_OK; /* compression went ok */ | 256 | 391 | } |
Line | Count | Source | 69 | 324 | { | 70 | 324 | const lzo_bytep ip; | 71 | 324 | #if (DD_BITS > 0) | 72 | 324 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 324 | lzo_xint dv; | 74 | 324 | #endif | 75 | 324 | unsigned drun = 0; | 76 | 324 | #endif | 77 | 324 | lzo_bytep op; | 78 | 324 | const lzo_bytep const in_end = in + in_len; | 79 | 324 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 324 | const lzo_bytep ii; | 81 | 324 | #if defined(LZO_HAVE_R1) | 82 | 324 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 324 | #endif | 84 | 324 | #if defined(LZO_HAVE_M3) | 85 | 324 | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | 324 | #endif | 87 | | | 88 | 324 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | | #if (LZO_DETERMINISTIC) | 104 | | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | | #endif | 106 | | | 107 | | | 108 | 324 | op = out; | 109 | 324 | ip = in; | 110 | 324 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 324 | #if (DD_BITS > 0) | 114 | 324 | DVAL_FIRST(dv,ip); | 115 | 324 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 324 | ip++; | 117 | 324 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 324 | assert(ip < ip_end); | 123 | 324 | for (;;) | 124 | 787k | { | 125 | 787k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 787k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 787k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 787k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 787k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 787k | #endif | 143 | | | 144 | 787k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 773k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 726k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 726k | if (++ip >= ip_end) | 166 | 66 | break; | 167 | 726k | #if (DD_BITS > 0) | 168 | 726k | DVAL_NEXT(dv,ip); | 169 | 726k | #endif | 170 | 726k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 60.2k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 60.2k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 60.2k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 60.2k | #endif | 188 | | | 189 | 60.2k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 60.2k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 60.2k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 60.2k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 60.2k | #endif | 203 | | | 204 | 60.2k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 59.9k | assert(ii == ip); | 209 | | | 210 | 59.9k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 324 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 324 | if (pd(in_end,ii) > 0) | 249 | 292 | { | 250 | 292 | lzo_uint t = pd(in_end,ii); | 251 | 292 | op = STORE_RUN(op,ii,t); | 252 | 292 | } | 253 | | | 254 | 324 | *out_len = pd(op, out); | 255 | 324 | return LZO_E_OK; /* compression went ok */ | 256 | 324 | } |
Line | Count | Source | 69 | 362 | { | 70 | 362 | const lzo_bytep ip; | 71 | 362 | #if (DD_BITS > 0) | 72 | 362 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 362 | lzo_xint dv; | 74 | 362 | #endif | 75 | 362 | unsigned drun = 0; | 76 | 362 | #endif | 77 | 362 | lzo_bytep op; | 78 | 362 | const lzo_bytep const in_end = in + in_len; | 79 | 362 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 362 | const lzo_bytep ii; | 81 | 362 | #if defined(LZO_HAVE_R1) | 82 | 362 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 362 | #endif | 84 | 362 | #if defined(LZO_HAVE_M3) | 85 | 362 | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | 362 | #endif | 87 | | | 88 | 362 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | | #if (LZO_DETERMINISTIC) | 104 | | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | | #endif | 106 | | | 107 | | | 108 | 362 | op = out; | 109 | 362 | ip = in; | 110 | 362 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 362 | #if (DD_BITS > 0) | 114 | 362 | DVAL_FIRST(dv,ip); | 115 | 362 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 362 | ip++; | 117 | 362 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 362 | assert(ip < ip_end); | 123 | 362 | for (;;) | 124 | 992k | { | 125 | 992k | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 992k | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 992k | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 992k | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 992k | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 992k | #endif | 143 | | | 144 | 992k | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 992k | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 992k | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 992k | #endif | 150 | | | 151 | 992k | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 947k | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 947k | if (++ip >= ip_end) | 166 | 77 | break; | 167 | 947k | #if (DD_BITS > 0) | 168 | 947k | DVAL_NEXT(dv,ip); | 169 | 947k | #endif | 170 | 947k | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 45.1k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 45.1k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 45.1k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 45.1k | #endif | 188 | | | 189 | 45.1k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 45.1k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 45.1k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 45.1k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 45.1k | #endif | 203 | | | 204 | 45.1k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 44.8k | assert(ii == ip); | 209 | | | 210 | 44.8k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 362 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 362 | if (pd(in_end,ii) > 0) | 249 | 325 | { | 250 | 325 | lzo_uint t = pd(in_end,ii); | 251 | 325 | op = STORE_RUN(op,ii,t); | 252 | 325 | } | 253 | | | 254 | 362 | *out_len = pd(op, out); | 255 | 362 | return LZO_E_OK; /* compression went ok */ | 256 | 362 | } |
Line | Count | Source | 69 | 383 | { | 70 | 383 | const lzo_bytep ip; | 71 | 383 | #if (DD_BITS > 0) | 72 | 383 | #if defined(__LZO_HASH_INCREMENTAL) | 73 | 383 | lzo_xint dv; | 74 | 383 | #endif | 75 | 383 | unsigned drun = 0; | 76 | 383 | #endif | 77 | 383 | lzo_bytep op; | 78 | 383 | const lzo_bytep const in_end = in + in_len; | 79 | 383 | const lzo_bytep const ip_end = in + in_len - MIN_LOOKAHEAD; | 80 | 383 | const lzo_bytep ii; | 81 | 383 | #if defined(LZO_HAVE_R1) | 82 | 383 | const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */ | 83 | 383 | #endif | 84 | 383 | #if defined(LZO_HAVE_M3) | 85 | 383 | lzo_bytep m3 = out + 1; /* pointer after last m3/m4 match */ | 86 | 383 | #endif | 87 | | | 88 | 383 | lzo_dict_p const dict = (lzo_dict_p) wrkmem; | 89 | | | 90 | | | 91 | | #if (LZO_COLLECT_STATS) | 92 | | lzo_stats->r_bits = R_BITS; | 93 | | lzo_stats->m3o_bits = M3O_BITS; | 94 | | lzo_stats->dd_bits = DD_BITS; | 95 | | lzo_stats->clevel = CLEVEL; | 96 | | lzo_stats->d_bits = D_BITS; | 97 | | lzo_stats->min_lookahead = MIN_LOOKAHEAD; | 98 | | lzo_stats->max_lookbehind = MAX_LOOKBEHIND; | 99 | | lzo_stats->compress_id = LZO_PP_MACRO_EXPAND(COMPRESS_ID); | 100 | | #endif | 101 | | | 102 | | /* init dictionary */ | 103 | | #if (LZO_DETERMINISTIC) | 104 | | BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE); | 105 | | #endif | 106 | | | 107 | | | 108 | 383 | op = out; | 109 | 383 | ip = in; | 110 | 383 | ii = ip; /* point to start of current literal run */ | 111 | | | 112 | | | 113 | 383 | #if (DD_BITS > 0) | 114 | 383 | DVAL_FIRST(dv,ip); | 115 | 383 | UPDATE_D(dict,drun,dv,ip,in); | 116 | 383 | ip++; | 117 | 383 | DVAL_NEXT(dv,ip); | 118 | | #else | 119 | | ip++; | 120 | | #endif | 121 | | | 122 | 383 | assert(ip < ip_end); | 123 | 383 | for (;;) | 124 | 1.10M | { | 125 | 1.10M | const lzo_bytep m_pos; | 126 | | #if !defined(NDEBUG) | 127 | | const lzo_bytep m_pos_sav = NULL; | 128 | | #endif | 129 | 1.10M | LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); | 130 | | #if (DD_BITS == 0) | 131 | | lzo_uint dindex; | 132 | | #endif | 133 | 1.10M | lzo_uint m_len; | 134 | | | 135 | | | 136 | | /*********************************************************************** | 137 | | // search for a match | 138 | | ************************************************************************/ | 139 | | | 140 | 1.10M | #if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE) | 141 | 1.10M | # define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch" | 142 | 1.10M | #endif | 143 | | | 144 | 1.10M | #include LZO_SEARCH_MATCH_INCLUDE_FILE | 145 | | | 146 | | | 147 | 0 | #if !defined(LZO_TEST_MATCH_INCLUDE_FILE) | 148 | 0 | # define LZO_TEST_MATCH_INCLUDE_FILE "lzo1b_tm.ch" | 149 | 0 | #endif | 150 | | | 151 | 1.10M | #include LZO_TEST_MATCH_INCLUDE_FILE | 152 | | | 153 | | | 154 | | | 155 | | /*********************************************************************** | 156 | | // found a literal | 157 | | ************************************************************************/ | 158 | | | 159 | | | 160 | | /* a literal */ | 161 | 1.05M | literal: | 162 | | #if (DD_BITS == 0) | 163 | | UPDATE_I(dict,0,dindex,ip,in); | 164 | | #endif | 165 | 1.05M | if (++ip >= ip_end) | 166 | 83 | break; | 167 | 1.05M | #if (DD_BITS > 0) | 168 | 1.05M | DVAL_NEXT(dv,ip); | 169 | 1.05M | #endif | 170 | 1.05M | continue; | 171 | | | 172 | | | 173 | | | 174 | | /*********************************************************************** | 175 | | // found a match | 176 | | ************************************************************************/ | 177 | | | 178 | 52.0k | match: | 179 | | #if (DD_BITS == 0) | 180 | | UPDATE_I(dict,0,dindex,ip,in); | 181 | | #endif | 182 | | /* we have found a match of at least M2_MIN_LEN */ | 183 | | | 184 | | | 185 | 52.0k | #if !defined(LZO_CODE_RUN_INCLUDE_FILE) | 186 | 52.0k | # define LZO_CODE_RUN_INCLUDE_FILE "lzo1b_cr.ch" | 187 | 52.0k | #endif | 188 | | | 189 | 52.0k | #include LZO_CODE_RUN_INCLUDE_FILE | 190 | | | 191 | | | 192 | | /* ii now points to the start of the current match */ | 193 | 52.0k | assert(ii == ip); | 194 | | | 195 | | | 196 | | /*********************************************************************** | 197 | | // code the match | 198 | | ************************************************************************/ | 199 | | | 200 | 52.0k | #if !defined(LZO_CODE_MATCH_INCLUDE_FILE) | 201 | 52.0k | # define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch" | 202 | 52.0k | #endif | 203 | | | 204 | 52.0k | #include LZO_CODE_MATCH_INCLUDE_FILE | 205 | | | 206 | | | 207 | | /* ii now points to the start of the next literal run */ | 208 | 51.7k | assert(ii == ip); | 209 | | | 210 | 51.7k | } | 211 | | | 212 | | | 213 | | /*********************************************************************** | 214 | | // end of block | 215 | | ************************************************************************/ | 216 | | | 217 | 383 | assert(ip <= in_end); | 218 | | | 219 | | #if (LZO_COLLECT_STATS) | 220 | | { | 221 | | lzo_uint i; | 222 | | const lzo_bytep p; | 223 | | | 224 | | for (i = 0; i < D_SIZE; i++) | 225 | | { | 226 | | p = dict[i]; | 227 | | if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end)) | 228 | | lzo_stats->unused_dict_entries++; | 229 | | } | 230 | | lzo_stats->unused_dict_entries_percent = | 231 | | 100.0 * lzo_stats->unused_dict_entries / D_SIZE; | 232 | | } | 233 | | #endif | 234 | | | 235 | | | 236 | | #if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE) | 237 | | /* return if op == out to indicate that we | 238 | | * couldn't compress and didn't copy anything. | 239 | | */ | 240 | | if (op == out) | 241 | | { | 242 | | *out_len = 0; | 243 | | return LZO_E_NOT_COMPRESSIBLE; | 244 | | } | 245 | | #endif | 246 | | | 247 | | /* store the final literal run */ | 248 | 383 | if (pd(in_end,ii) > 0) | 249 | 334 | { | 250 | 334 | lzo_uint t = pd(in_end,ii); | 251 | 334 | op = STORE_RUN(op,ii,t); | 252 | 334 | } | 253 | | | 254 | 383 | *out_len = pd(op, out); | 255 | 383 | return LZO_E_OK; /* compression went ok */ | 256 | 383 | } |
|