aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lz/lz_encoder.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-09-03liblzma: Adjust default depth calculation for HC3 and HC4.Lasse Collin1-3/+4
It was 8 + nice_len / 4, now it is 4 + nice_len / 4. This allows faster settings at lower nice_len values, even though it seems that I won't use automatic depth calcuation with HC3 and HC4 in the presets.
2010-06-02Silence a bogus Valgrind warning.Lasse Collin1-1/+5
When using -O2 with GCC, it liked to swap two comparisons in one "if" statement. It's otherwise fine except that the latter part, which is seemingly never executed, got executed (nothing wrong with that) and then triggered warning in Valgrind about conditional jump depending on uninitialized variable. A few people find this annoying so do things a bit differently to avoid the warning.
2010-05-26Rename MIN() and MAX() to my_min() and my_max().Lasse Collin1-1/+1
This should avoid some minor portability issues.
2010-02-12Collection of language fixes to comments and docs.Lasse Collin1-1/+1
Thanks to Jonathan Nieder.
2009-11-14Fix a design error in liblzma API.Lasse Collin1-0/+17
Originally the idea was that using LZMA_FULL_FLUSH with Stream encoder would read the filter chain from the same array that was used to intialize the Stream encoder. Since most apps wouldn't use LZMA_FULL_FLUSH, most apps wouldn't need to keep the filter chain available after initializing the Stream encoder. However, due to my mistake, it actually required keeping the array always available. Since setting the new filter chain via the array used at initialization time is not a nice way to do it for a couple of reasons, this commit ditches it and introduces lzma_filters_update(). This new function replaces also the "persistent" flag used by LZMA2 (and to-be-designed Subblock filter), which was also an ugly thing to do. Thanks to Alexey Tourbin for reminding me about the problem that Stream encoder used to require keeping the filter chain allocated.
2009-10-02Make liblzma produce the same output on both endiannesses.Lasse Collin1-1/+6
Seems that it is a problem in some cases if the same version of XZ Utils produces different output on different endiannesses, so this commit fixes that problem. The output will still vary between different XZ Utils versions, but I cannot avoid that for now. This commit bloatens the code on big endian systems by 1 KiB, which should be OK since liblzma is bloated already. ;-)
2009-09-11Fix a couple of warnings.Lasse Collin1-4/+1
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin1-12/+5
Some minor documentation cleanups were made at the same time.
2009-02-08Add a separate internal function to initialize the CRC32Lasse Collin1-2/+2
table, which is used also by LZ encoder. This was needed because calling lzma_crc32() and ignoring the result is a no-op due to lzma_attr_pure.
2009-02-02Modify LZMA_API macro so that it works on Windows withLasse Collin1-1/+1
other compilers than MinGW. This may hurt readability of the API headers slightly, but I don't know any better way to do this.
2009-01-27Added initial support for preset dictionary for raw LZMA1Lasse Collin1-2/+16
and LZMA2. It is not supported by the .xz format or the xz command line tool yet.
2008-12-31Remove lzma_init() and other init functions from liblzma API.Lasse Collin1-0/+6
Half of developers were already forgetting to use these functions, which could have caused total breakage in some future liblzma version or even now if --enable-small was used. Now liblzma uses pthread_once() to do the initializations unless it has been built with --disable-threads which make these initializations thread-unsafe. When --enable-small isn't used, liblzma currently gets needlessly linked against libpthread (on systems that have it). While it is stupid for now, liblzma will need threads in future anyway, so this stupidity will be temporary only. When --enable-small is used, different code CRC32 and CRC64 is now used than without --enable-small. This made the resulting binary slightly smaller, but the main reason was to clean it up and to handle the lack of lzma_init_check(). The pkg-config file lzma.pc was renamed to liblzma.pc. I'm not sure if it works correctly and portably for static linking (Libs.private includes -pthread or other operating system specific flags). Hopefully someone complains if it is bad. lzma_rc_prices[] is now included as a precomputed array even with --enable-small. It's just 128 bytes now that it uses uint8_t instead of uint32_t. Smaller array seemed to be at least as fast as the more bloated uint32_t array on x86; hopefully it's not bad on other architectures.
2008-09-27Some API changes, bug fixes, cleanups etc.Lasse Collin1-16/+14
2008-09-17Miscellaneous LZ and LZMA encoder cleanupsLasse Collin1-2/+6
2008-09-13Renamed constants:Lasse Collin1-1/+1
- LZMA_VLI_VALUE_MAX -> LZMA_VLI_MAX - LZMA_VLI_VALUE_UNKNOWN -> LZMA_VLI_UNKNOWN - LZMA_HEADER_ERRRO -> LZMA_OPTIONS_ERROR
2008-09-06CommentsLasse Collin1-2/+1
2008-09-02Some fixes to LZ encoder.Lasse Collin1-10/+46
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin1-392/+388
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
2008-06-01Fix a buffer overflow in the LZMA encoder. It was due to myLasse Collin1-108/+5
misunderstanding of the code. There's no tiny fix for this problem, so I also cleaned up the code in general. This reduces the speed of the encoder 2-5 % in the fastest compression mode ("lzma -1"). High compression modes should have no noticeable performance difference. This commit breaks things (especially LZMA_SYNC_FLUSH) but I will fix them once the new format and LZMA2 has been roughly implemented. Plain LZMA won't support LZMA_SYNC_FLUSH at all and won't be supported in the new .lzma format. This may change still but this is what it looks like now. Support for known uncompressed size (that is, LZMA or LZMA2 without EOPM) is likely to go away. This means there will be API changes.
2008-04-25Prevent LZ encoder from hanging with known uncompressedlarhzu/v4.999.3alphaLasse Collin1-2/+7
size. The "fix" breaks LZMA_SYNC_FLUSH at end of stream with known uncompressed size, but since it currently seems likely that support for encoding with known uncompressed size will go away anyway, I'm not fixing this problem now.
2008-04-24Fix wrong return type (uint32_t -> bool).Lasse Collin1-1/+1
2008-04-24Fix data corruption in LZ encoder with LZMA_SYNC_FLUSH.Lasse Collin1-0/+16
2008-01-18Fix LZMA_SYNC_FLUSH handling in LZ and LZMA encoders.Lasse Collin1-8/+26
That code is now almost completely in LZ coder, where it can be shared with other LZ77-based algorithms in future.
2008-01-14Major changes to LZ encoder, LZMA encoder, and range encoder.Lasse Collin1-20/+118
These changes implement support for LZMA_SYNC_FLUSH in LZMA encoder, and move the temporary buffer needed by range encoder from lzma_range_encoder structure to lzma_lz_encoder.
2008-01-10Eliminate lzma_lz_encoder.must_move_pos. It's neededLasse Collin1-4/+2
only in one place which isn't performance criticial.
2007-12-09Imported to git.Lasse Collin1-0/+481