60 Commits

Author SHA1 Message Date
Jeffrey Bush a0fcab84a7 Merge pull request #34 from nemequ/master
Fix some warnings
2020-01-05 14:12:32 -05:00
mingkuang b92e6b9c4a add VS ARM64 support 2019-12-20 10:59:41 +08:00
Evan Nemerson 82b3971669 Fix detection of GCC >= 4.7 in diagnostic handling macros 2017-03-21 12:51:36 -07:00
Evan Nemerson f05faa7226 Add macros for disabling warnings on ICC
ICC defines __GNUC__ and __GNUC_MINOR__, but doesn't support GCC's
diagnostic pragmas (#pragma GCC diagnostic ...).  Instead, it supports
the MSVC-style pragmas, but the warning numbers are different.  Luckily
ICC doesn't seem to be very aggressive with their warnings; the only
warnings from ICC were about the GCC-style pragmas not being unknown,
and even those aren't on by default.  This patch effectively disables
the pragmas in ms-compress to disable warnings, and now ms-compress
compiles cleanly with -diag-warning=all on ICC 17.
2017-03-21 12:36:27 -07:00
Jeffrey Bush e5d8cc5f43 Fixed big endian handling when running without unaligned access. Additionally removed PDP endian code as there is no way to test it and may have been wrong. Also properly indented various other defines in the internal header.
Working on #32.
2016-07-20 16:51:30 -07:00
Jeffrey Bush 158667afbc GCC didn't have maybe-uninitialized before v4.7. Fixes #30. 2016-06-15 16:16:35 -07:00
Evan Nemerson f59818a94c Check that size is not 0 before calling memcpy. 2016-02-02 10:09:57 -08:00
Jeffrey Bush 741130c5e5 Added Array.h. 2016-01-19 23:12:02 -08:00
Jeffrey Bush 805467dd07 Now the Xpress Dictionary uses an array that chooses to be either stack-based or heap-based, reducing the stack memory usage of Xpress Huffman compression by up to 1.25 MB when MSCOMP_WITHOUT_LARGE_STACK is defined.
The Xpress compressor tells the dictionary to always use the stack since it uses only much less memory.
2016-01-19 22:00:50 -08:00
Jeffrey Bush e2f37457b4 Added LARGE_STACK feature that when disabled (using #define MSCOMP_WITHOUT_LARGE_STACK) will cause various large variables to be heap-based instead of stack-based. Now in use by LZNT1Dictionary (512-768 kb reduction in stack usage) and HuffmanEncoder::CreateCodesSlow (512 kb reduction in stack usage, but only in very rare cases).
Also fixed some code to not produce warnings in MSVC.
2016-01-19 21:46:42 -08:00
Jeffrey Bush 35271887b5 Change the checks in the Huffman Decoder so that invalid data doesn't cause buffer overflows. Fixes #28. 2016-01-19 20:12:32 -08:00
Jeffrey Bush b3f657bd76 Reverting some changes accidentally made by the merge. 2016-01-19 11:58:43 -08:00
Jeffrey Bush 8fe5ffdd36 Merge branch 'master' of github.com:coderforlife/ms-compress
# Conflicts:
#	src/xpress_compress.cpp
2016-01-19 11:53:52 -08:00
Evan Nemerson 4e263b55e3 Don't redefine common preprocessor macros
Sometimes these macros are defined by a build system (especially
_CRT_SECURE_NO_WARNINGS).  If ms-compress is embedded in another
project which defines these macros by default it will cause the
compiler to emit warnings about redefining macros.
2015-11-14 20:27:08 -08:00
Jeffrey Bush 73ce174b24 Additional checks in Xpress Dictionary Fill and Add. Should fix #20. 2015-09-28 03:34:01 -07:00
Jeffrey Bush 4fca365f4c Allow null input/output buffers if available is 0, fixing #19. 2015-09-28 03:25:57 -07:00
Jeffrey Bush 8ba2fb0949 Possible fix to #17.
Because the inflate methods return MSCOMP_STREAM_END or MSCOMP_POSSIBLE_STREAM_END instead of MSCOMP_OK when they are at a stopping point, MSCOMP_OK actually becomes an error message (that gets translated to MSCOMP_BUF_ERROR). A similar method was already in use for ALL_AT_ONCE_WRAPPER_COMPRESS.
2015-09-15 23:31:44 -07:00
Jeffrey Bush 90829b848d Fixed whitespace. 2015-09-15 23:01:24 -07:00
Jeffrey Bush e22df7d307 Added a buffer offerflow check fixing #18. 2015-09-15 22:50:33 -07:00
coderforlife 78101d2eba Improved byte-order detection and usage. 2015-09-11 12:01:17 -07:00
coderforlife 254f814428 Fixed problem with general header compling in regular C. 2015-09-11 12:00:35 -07:00
coderforlife a179b8d46c Removed one of the restricted pointers that caused GCC pre-4.9.2 to fail to compile. 2015-05-28 19:09:18 -07:00
Jeffrey Bush 39f51004b8 Added restrict to many pointers in LZNT1. Does not seem to have helped or hurt performance with GCC so leaving them in. May try to add them to other algorithms eventually. 2015-05-25 16:32:25 -07:00
Jeffrey Bush 73af8f022c Fixed problems with non-unaligned access methods that produced the wrong byte order and updated Xpress Huffman compression to be able to use non-unaligned accesses. 2015-04-17 16:24:02 -07:00
Jeffrey Bush 3ab0ab7c9f Minor update. 2015-04-17 15:20:05 -07:00
Jeffrey Bush 837a292aec Added a new compile time configuration option MSCOMP_WITHOUT_UNALIGNED_ACCESS that makes it so there are no unaligned accesses to work on #15. This is not yet complete - Xpress Huffman compression still has many unaligned accesses. 2015-04-17 15:14:13 -07:00
Jeffrey Bush 1cfac269a8 Finally fixed #4. The problem is that on Windows the stack is 4-byte aligned and GCC assumes (for some optimizations) 16-byte alignment. A GCC stack alignment fix was added to functions that needed it.
Also increased XPRESS Huffman max compressed size which helps #14.
2015-03-19 20:52:50 -07:00
Jeffrey Bush 1095f73d1e Addressed some bugs with XPRESS Huffman compression of uncompromisable data and decompression of invalid data. This partially helps #14. 2015-03-18 14:25:54 -07:00
Jeffrey Bush 66e93e7581 Fixing some warnings with gcc -Wextra -pedantic -Wuninitialized. The remaining warnings are mostly about variadic macros. 2015-03-18 12:56:44 -07:00
Jeffrey Bush 941fbb4860 Minor changes. 2015-03-18 12:02:06 -07:00
Jeffrey Bush ce1d61cf62 Forgot to commit sorting.h when re-adding package-merge algorithm. Fixes #12. 2015-03-18 11:47:21 -07:00
Jeffrey Bush e877ca5554 Corrected XPRESS Huffman compression to max size and added checks to make sure it always stays under the max size. In addition many other changes were made for improved performance. 2015-03-17 22:39:05 -07:00
Jeffrey Bush 14d766a224 The SSE copy method was actually incorrect (more needed to be copied initially and the input needed to be shifted back). Once these were fixed it was slower than the original fast copy so it was removed. 2015-03-17 22:35:41 -07:00
Jeffrey Bush dce8c3ac6a Played around with SSE optimizations like prefetch and 128-bit copies. I couldn't get prefetching to really help during decompression but 128-bit copies helped in XPRESS (Huffman) decompression. 2015-03-16 15:11:55 -07:00
Jeffrey Bush fdc815abef Removed old code from HuffmanDecoder 2015-03-16 14:59:02 -07:00
Jeffrey Bush e99e328faf Removing Peek_Not0 and updating Peek to work really fast for 0 and non-0. Few other minor Huffman decoder changes. 2015-03-13 18:34:09 -07:00
Jeffrey Bush 3b3e29ed69 Adding comment about bzip2 inspiration and removing sorting library. 2015-03-13 18:32:35 -07:00
Jeffrey Bush 7b7ed8cbf4 Completely changed the Huffman encoder to use an algorithm inspired by bzip2. This increases compression speed by more than 100%! That is its twice as fast! Downside is that compression ratio is slightly worse (but just barely: 32.792% to 32.853% or 167kb in 269MB). It also uses less stack (total 17kb). 2015-03-13 18:25:24 -07:00
Jeffrey Bush 345d9752b4 Improved the package-merge algorithm on the Huffman Encoder to use stack memory (its a lot of it - 519 kb now!). This improves its speed quite a bit (compression speed increases by 25%). 2015-03-13 18:20:07 -07:00
Jeffrey Bush 511e1215ae More improvements to XPRESS Huffman decompression speed. 2015-03-13 00:43:59 -07:00
Jeffrey Bush 5308b1b2f8 Made FAST_COPY a little more compatible and fixed a new bug in XPRESS decompression. 2015-03-12 21:06:55 -07:00
Jeffrey Bush b4264bb650 Improved the speed of the XPRESS Huffman decompressor, mainly by adding a fast decompression loop, along improving HuffmanDecoder and InputBitstream. 2015-03-12 20:43:14 -07:00
Jeffrey Bush 8efdeb1012 Updated comments in internal.h to describe undefined values from the intrinsic functions and many other things. 2015-03-12 20:41:55 -07:00
Jeffrey Bush da4fd73e24 Updated comments slightly. 2015-03-12 17:57:06 -07:00
Jeffrey Bush 6fa0409de5 Generalized the fast-copy routine used by decompressors (along with fixing some length-checks). Also added ASSERT_ALWAYS which does both assert and ALWAYS on the given command. 2015-03-12 17:55:24 -07:00
Jeffrey Bush bb8562fe8b Made highbit/log2 function use compiler intrinsics if available. If not available it uses a slower method than before (but no static table). 2015-03-11 21:54:48 -07:00
Jeffrey Bush f305590ff2 WindowsPos should always be inlined. 2015-03-11 20:01:45 -07:00
Jeffrey Bush 32a8ce209b Found which loop was causing the access violation with GCC tree-vectorization and put it into the source so tree-vectorization is not disabled globally. Also improved Huffman encoder slightly, mainly by changing merge sort to use insertion sort when "small". 2015-03-11 20:01:04 -07:00
Jeffrey Bush 4fea9774b9 Fixed #10. 2015-03-05 23:40:39 -08:00
Jeffrey Bush b24b7b8bf4 Improved XpressDictionary to skip pathological cases (hoping to find a match after searching a bunch) and a new hash function. These were inspired by zlib. 2015-03-05 16:25:01 -08:00