Made more improvements to the compression algorithms.
The default compression mode for wimcapture is now LZX compression in
- its default mode, which is the the same as '--compress=maximum'.
+ its default mode, which is the same as '--compress=maximum'.
You can now specify an optional integer compression level to the
'--compress' or '--solid-compress' options; e.g. '--compress=lzx:75'.
const wimlib_tchar *image_name_or_num);
/**
+ * @ingroup G_general
+ *
* Sets the file to which the library will print error and warning messages.
*
* This version of the function takes a C library <c>FILE *</c> opened for
wimlib_set_error_file(FILE *fp);
/**
+ * @ingroup G_general
+ *
* Sets the path to the file to which the library will print error and warning
* messages. The library will open this file for appending.
*
* wimlib_create_compressor().
*
* @param ctype
- * Compression type for which to set the default compression level. Or, if
- * this is the special value -1, the default compression levels for all
- * known compression types will be set.
+ * Compression type for which to set the default compression level, as one
+ * of the ::wimlib_compression_type constants. Or, if this is the special
+ * value -1, the default compression levels for all known compression types
+ * will be set.
* @param compression_level
* The default compression level to set. If 0, the "default default" level
* is restored. Otherwise, a higher value indicates higher compression.
* @p ctype was neither a supported compression type nor -1.
*/
extern int
-wimlib_set_default_compression_level(enum wimlib_compression_type ctype,
- unsigned int compression_level);
+wimlib_set_default_compression_level(int ctype, unsigned int compression_level);
/**
* Returns the approximate number of bytes needed to allocate a compressor with
/* Representation of a Lempel-Ziv match. */
struct lz_match {
+
/* The number of bytes matched. */
u32 len;
}
WIMLIBAPI int
-wimlib_set_default_compression_level(enum wimlib_compression_type ctype,
- unsigned int compression_level)
+wimlib_set_default_compression_level(int ctype, unsigned int compression_level)
{
- if ((int)ctype == -1) {
+ if (ctype == -1) {
for (int i = 0; i < ARRAY_LEN(default_compression_levels); i++)
default_compression_levels[i] = compression_level;
} else {
interval = next_interval;
}
- /* We're already visited the current lcp-interval. */
+ /* We've already visited the current lcp-interval. */
/* Extract the LCP of this lcp-interval. */
lcp = intervals[interval] & LZ_LCPIT_LCP_MASK;
};
}
-/* This is similar to lzx_choose_near_optimal_match() in lzx-compress.c.
+/* This is similar to lzx_choose_near_optimal_item() in lzx-compress.c.
* Read that one if you want to understand it. */
static struct lz_match
-lzms_get_near_optimal_match(struct lzms_compressor *ctx)
+lzms_get_near_optimal_item(struct lzms_compressor *ctx)
{
u32 num_matches;
struct lz_match *matches;
static void
lzms_encode(struct lzms_compressor *ctx)
{
- struct lz_match match;
+ struct lz_match item;
/* Load window into the match-finder. */
lz_mf_load_window(ctx->mf, ctx->window, ctx->window_size);
ctx->optimum_end_idx = 0;
while (ctx->cur_window_pos != ctx->window_size) {
- match = lzms_get_near_optimal_match(ctx);
- if (match.len <= 1)
+ item = lzms_get_near_optimal_item(ctx);
+ if (item.len <= 1)
lzms_encode_literal(ctx, ctx->window[ctx->cur_window_pos]);
else
- lzms_encode_lz_match(ctx, match.len, match.offset);
+ lzms_encode_lz_match(ctx, item.len, item.offset);
}
}
* that position at previous positions in the window. With LZX, the minimum
* match length is 2 and the maximum match length is 257. The only restriction
* on offsets is that LZX does not allow the last 2 bytes of the window to match
- * the the beginning of the window.
+ * the beginning of the window.
*
* There are a number of algorithms that can be used for this, including hash
* chains, binary trees, and suffix arrays. Binary trees generally work well