Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: xz/src/liblzma/lzma/lzma_encoder_presets.c

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file lzma_encoder_presets.c
4 /// \brief Encoder presets
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #include "common.h"
14
15
16 extern LZMA_API(lzma_bool)
17 lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
18 {
19 const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK;
20 const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK;
21 const uint32_t supported_flags = LZMA_PRESET_EXTREME;
22
23 if (level > 9 || (flags & ~supported_flags))
24 return true;
25
26 const uint32_t dict_shift = level <= 1 ? 16 : level + 17;
27 options->dict_size = UINT32_C(1) << dict_shift;
28
29 options->preset_dict = NULL;
30 options->preset_dict_size = 0;
31
32 options->lc = LZMA_LC_DEFAULT;
33 options->lp = LZMA_LP_DEFAULT;
34 options->pb = LZMA_PB_DEFAULT;
35
36 options->mode = level <= 2 ? LZMA_MODE_FAST : LZMA_MODE_NORMAL;
37
38 options->nice_len = level == 0 ? 8 : level <= 5 ? 32 : 64;
39 options->mf = level <= 1 ? LZMA_MF_HC3 : level <= 2 ? LZMA_MF_HC4
40 : LZMA_MF_BT4;
41 options->depth = 0;
42
43 if (flags & LZMA_PRESET_EXTREME) {
44 options->lc = 4; // FIXME?
45 options->mode = LZMA_MODE_NORMAL;
46 options->mf = LZMA_MF_BT4;
47 options->nice_len = 273;
48 options->depth = 512;
49 }
50
51 return false;
52 }
OLDNEW
« no previous file with comments | « xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c ('k') | xz/src/liblzma/lzma/lzma_encoder_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698