/[packages]/cauldron/xz/current/SOURCES/xz-5.0.0-text-tune.patch
ViewVC logotype

Contents of /cauldron/xz/current/SOURCES/xz-5.0.0-text-tune.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download)
Sat Jan 8 13:39:49 2011 UTC (10 years, 8 months ago) by blino
File size: 3663 byte(s)
imported package xz
1 --- xz-5.0.0/src/liblzma/api/lzma/container.h.text~ 2010-10-23 16:47:33.000000000 +0200
2 +++ xz-5.0.0/src/liblzma/api/lzma/container.h 2010-12-14 23:57:08.628431579 +0100
3 @@ -43,7 +43,7 @@
4 /*
5 * Preset flags
6 *
7 - * Currently only one flag is defined.
8 + * Currently only two flags are defined.
9 */
10
11 /**
12 @@ -59,6 +59,13 @@
13 */
14 #define LZMA_PRESET_EXTREME (UINT32_C(1) << 31)
15
16 +/**
17 + * \brief Text compression preset
18 + *
19 + * TODO
20 + */
21 +#define LZMA_PRESET_TEXT (UINT32_C(1) << 18)
22 +
23
24 /**
25 * \brief Calculate approximate memory usage of easy encoder
26 --- xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c.text~ 2010-10-23 16:47:33.000000000 +0200
27 +++ xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c 2010-12-15 01:01:27.610442970 +0100
28 @@ -18,7 +18,7 @@ lzma_lzma_preset(lzma_options_lzma *opti
29 {
30 const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK;
31 const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK;
32 - const uint32_t supported_flags = LZMA_PRESET_EXTREME;
33 + const uint32_t supported_flags = LZMA_PRESET_EXTREME | LZMA_PRESET_TEXT;
34
35 if (level > 9 || (flags & ~supported_flags))
36 return true;
37 @@ -57,5 +57,18 @@ lzma_lzma_preset(lzma_options_lzma *opti
38 }
39 }
40
41 + if (flags & LZMA_PRESET_TEXT) {
42 + if (level == 0)
43 + options->lc = 3;
44 + else
45 + options->lc = 4;
46 + options->lp = 0;
47 + options->pb = 0;
48 + options->mode = LZMA_MODE_NORMAL;
49 + options->nice_len = 273;
50 + options->mf = LZMA_MF_BT4;
51 + options->depth = 512;
52 + }
53 +
54 return false;
55 }
56 --- xz-5.0.0/src/xz/args.c.text~ 2010-10-23 16:47:33.000000000 +0200
57 +++ xz-5.0.0/src/xz/args.c 2010-12-14 23:57:08.639432696 +0100
58 @@ -76,6 +76,7 @@ parse_real(args_info *args, int argc, ch
59 OPT_NO_ADJUST,
60 OPT_INFO_MEMORY,
61 OPT_ROBOT,
62 + OPT_TEXT,
63 };
64
65 static const char short_opts[]
66 @@ -113,6 +114,8 @@ parse_real(args_info *args, int argc, ch
67 { "extreme", no_argument, NULL, 'e' },
68 { "fast", no_argument, NULL, '0' },
69 { "best", no_argument, NULL, '9' },
70 + { "text", no_argument, NULL, OPT_TEXT },
71 +
72
73 // Filters
74 { "lzma1", optional_argument, NULL, OPT_LZMA1 },
75 @@ -401,6 +404,10 @@ parse_real(args_info *args, int argc, ch
76 opt_auto_adjust = false;
77 break;
78
79 + case OPT_TEXT:
80 + coder_set_text();
81 + break;
82 +
83 default:
84 message_try_help();
85 tuklib_exit(E_ERROR, E_ERROR, false);
86 --- xz-5.0.0/src/xz/coder.c.text~ 2010-10-23 16:47:33.000000000 +0200
87 +++ xz-5.0.0/src/xz/coder.c 2010-12-14 23:57:08.640432976 +0100
88 @@ -47,6 +47,9 @@ static size_t preset_number = 6;
89 /// compression ratio.
90 static bool preset_extreme = false;
91
92 +/// TODO: Description..
93 +static bool preset_text = false;
94 +
95 /// Integrity check type
96 static lzma_check check;
97
98 @@ -89,6 +92,14 @@ coder_set_extreme(void)
99
100
101 extern void
102 +coder_set_text(void)
103 +{
104 + preset_text = true;
105 + return;
106 +}
107 +
108 +
109 +extern void
110 coder_add_filter(lzma_vli id, void *options)
111 {
112 if (filters_count == LZMA_FILTERS_MAX)
113 @@ -137,6 +148,9 @@ coder_set_compression_settings(void)
114 if (preset_extreme)
115 preset_number |= LZMA_PRESET_EXTREME;
116
117 + if (preset_text)
118 + preset_number |= LZMA_PRESET_TEXT;
119 +
120 if (lzma_lzma_preset(&opt_lzma, preset_number))
121 message_bug();
122
123 --- xz-5.0.0/src/xz/coder.h.text~ 2010-10-23 16:47:33.000000000 +0200
124 +++ xz-5.0.0/src/xz/coder.h 2010-12-14 23:57:08.649682731 +0100
125 @@ -51,6 +51,9 @@ extern void coder_set_preset(size_t new_
126 /// Enable extreme mode
127 extern void coder_set_extreme(void);
128
129 +/// Enable text mode
130 +extern void coder_set_text(void);
131 +
132 /// Add a filter to the custom filter chain
133 extern void coder_add_filter(lzma_vli id, void *options);
134

  ViewVC Help
Powered by ViewVC 1.1.28