summaryrefslogtreecommitdiff
path: root/deflate_p.h
AgeCommit message (Collapse)Author
2021-06-04Move MIN() macro to zbuild.hMika Lindqvist
2020-11-02Fixed casting warnings when comparing MAX_DIST.Nathan Moinvaziri
deflate_medium.c(127,76): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data
2020-11-02Fixed conversion warning when calling zng_tr_tally_dist. Signature for dist ↵Nathan Moinvaziri
and len now match zng_emit_dist. deflate.c(1575,67): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data deflate_fast.c(60,94): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data deflate_medium.c(39,102): warning C4244: 'function': conversion from 'int' to 'unsigned char', possible loss of data deflate_slow.c(75,101): warning C4244: 'function': conversion from 'unsigned int' to 'unsigned char', possible loss of data
2020-08-31Rename ZLIB_INTERNAL to Z_INTERNAL for consistency.Nathan Moinvaziri
2020-08-27Fix more conversion warnings related to s->bi_valid, stored_len and misc.Hans Kristian Rosbach
2020-08-27Fix some of the old and new conversion warnings in deflate*Hans Kristian Rosbach
2020-08-26Revert "zng_tr_tally_lit: disable -Wtype-limits"Ilya Leoshkevich
This makes MSVC unhappy: https://github.com/zlib-ng/zlib-ng/pull/726#issuecomment-681128124 D:\a\zlib-ng\zlib-ng\deflate_p.h(36,9): warning C4068: unknown pragma 'GCC' [D:\a\zlib-ng\zlib-ng\zlib.vcxproj] This reverts commit 24c442c606d9121da64b25693c9bb1a898b3553f.
2020-08-23zng_tr_tally_lit: disable -Wtype-limitsIlya Leoshkevich
Some gcc versions complain that parameter c is always less than MAX_MATCH-MIN_MATCH, and therefore the assertion that checks for this is useless, but in reality some day MIN_MATCH and MAX_MATCH can change. So disable the warning around the assertion.
2020-06-08Move Tracev flush statement into flush_pending.Nathan Moinvaziri
2020-06-08Move Tracevv statements when emitting literal to zng_tr_tally_lit.Nathan Moinvaziri
2020-05-30Remove IPos typedef which also helps to reduce casting warnings.Nathan Moinvaziri
2020-05-30Fixed dist casting warnings in zng_tr_tally_dist.Nathan Moinvaziri
deflate_p.h(42,37): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data deflate_p.h(43,42): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
2020-04-30Standardize insert_string functionality across architectures. Added ↵Nathan Moinvaziri
unaligned conditionally compiled code for insert_string and quick_insert_string. Unify sse42 crc32 assembly between insert_string and quick_insert_string. Modified quick_insert_string to work across architectures.
2020-03-13Clean up zng_tr_tally code.Nathan Moinvaziri
2020-02-07Fixed formatting, 4 spaces for code intent, 2 spaces for preprocessor ↵Nathan Moinvaziri
indent, initial function brace on the same line as definition, removed extraneous spaces and new lines.
2019-07-18Add zng_ prefix to internal functions to avoid linking conflicts with zlib. ↵Nathan Moinvaziri
(#363)
2019-03-01ARM: check cpu feature once at init timeSebastian Pop
This makes the checks for arm cpu features as inexpensive as on the x86 side by calling the runtime feature detection once in deflate/inflate init and then storing the result in a global variable.
2018-12-13return an index for hash map collisions in insert_stringSebastian Pop
The current version of insert_string_c and variations for sse2, arm, and aarch64 in zlib-ng has changed semantics from the original code of INSERT_STRING macro in zlib: #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) The code of INSERT_STRING assigns match_head with the content of s->head[s->ins_h]. In zlib-ng, the assignment to match_head happens in the caller of insert_string(). zlib-ng's insert_string_*() functions return 0 instead of str+idx in case of collision, i.e., when if (s->head[s->ins_h] == str+idx). The effect of returning 0 instead of the content of s->head[s->ins_h] is that the search for a longest_match through s->prev[] chains will be cut short when arriving at 0. This leads to a shorter compression time at the expense of a worse compression rate: returning 0 cuts out the search space. With this patch: Performance counter stats for './minigzip -9 llvm.tar': 13422.379017 task-clock (msec) # 1.000 CPUs utilized 20 context-switches # 0.001 K/sec 0 cpu-migrations # 0.000 K/sec 130 page-faults # 0.010 K/sec 58,926,104,511 cycles # 4.390 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 77,543,740,646 instructions # 1.32 insns per cycle 17,158,892,214 branches # 1278.379 M/sec 198,433,680 branch-misses # 1.16% of all branches 13.423365095 seconds time elapsed 45408 -rw-rw-r-- 1 spop spop 46493896 Dec 11 11:47 llvm.tar.gz Without this patch the compressed file is larger: Performance counter stats for './minigzip -9 llvm.tar': 13459.342312 task-clock (msec) # 1.000 CPUs utilized 25 context-switches # 0.002 K/sec 0 cpu-migrations # 0.000 K/sec 129 page-faults # 0.010 K/sec 59,088,391,808 cycles # 4.390 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 77,600,766,958 instructions # 1.31 insns per cycle 17,486,130,785 branches # 1299.182 M/sec 196,281,761 branch-misses # 1.12% of all branches 13.463512830 seconds time elapsed 45408 -rw-rw-r-- 1 spop spop 46493896 Dec 11 11:48 llvm.tar.gz
2018-01-31Adapt code to support PREFIX macros and update build scriptsMika Lindqvist
2017-08-24Fix that s->prev is not used uninitialized in insert_string_*Mika Lindqvist
2017-04-24Add a struct func_table and function functableInit.Hans Kristian Rosbach
The struct contains pointers to select functions to be used by the rest of zlib, and the init function selects what functions will be used depending on what optimizations has been compiled in and what instruction-sets are available at runtime. Tests done on a haswell cpu running minigzip -6 compression of a 40M file shows a 2.5% decrease in branches, and a 25-30% reduction in iTLB-loads. The reduction i iTLB-loads is likely mostly due to the inability to inline functions. This also causes a slight performance regression of around 1%, this might still be worth it to make it much easier to implement new optimized functions for various architectures and instruction sets. The performance penalty will get smaller for functions that get more alternative implementations to choose from, since there is no need to add more branches to every call of the function. Today insert_string has 1 branch to choose insert_string_sse or insert_string_c, but if we also add for example insert_string_sse4 then that would have needed another branch, and it would probably at some point hinder effective inlining too.
2017-03-24Add support for ARM ACLE instructions.Mika Lindqvist
2017-02-16Type cleanup...Mika Lindqvist
* uInt -> unsigned int * ulg -> unsigned long
2017-02-06Avoid use of DEBUG macro -- change to ZLIB_DEBUG.Mark Adler
2017-02-06Speed up deflation for level 0 (storing).Mark Adler
The previous code slid the window and the hash table and copied every input byte three times in order to just write the data as stored blocks with no compression. This commit minimizes sliding and copying, especially for large input and output buffers. Level 0 compression is now more than 20 times faster than before the commit. Most of the speedup is due to deferring hash table slides until deflateParams() is called to change the compression level away from 0. More speedup is due to copying directly from next_in to next_out when the amounts of available input data and output space permit it, avoiding the intermediate pending buffer. Additionally, only the last 32K of the used input data is copied back to the sliding window when large input buffers are provided.
2017-01-31Replace Z_NULL with NULL. Fix incorrect uses of NULL/Z_NULL.Mika Lindqvist
2017-01-30Merge insert_string and bulk_insert_str.Mika Lindqvist
** Partial merge of this commit, based on a8c94e9f5a3b9d3c62182bcf84e72304a3c1a6e5 Excludes changes to fill_window_sse.c, changes to fill_window_c() in deflate.c and several unrelated changes in the commit.
2017-01-30local -> staticMika Lindqvist
* local -> static * Normalize and cleanup line-endings * Fix warnings under Visual Studio. * Whitespace cleanup *** This patch has been edited to merge cleanly and to exclude type changes. Based on 8d7a7c3b82c6e38734bd504dac800b148ab410d0 "Type Cleanup"
2016-07-04Don't update prev if old head is same as new.Mika Lindqvist
2015-11-25Merge pull request #56 from Dead2/hacknslash2Hans Kristian Rosbach
Improvements for MSVC and backport fixes from zlib upstream and intel's fork
2015-11-09Fix uninitialized variableJoergen Ibsen
2015-11-04Split insert_string_sse into separate file in arch folder.Hans Kristian Rosbach
2015-11-02Add support for MSVC crc32 intrinsicMat Berchtold
2015-06-26Whitespace cleanupHans Kristian Rosbach
2015-06-24Make insert_string_sse more similar to insert_string_c.Hans Kristian Rosbach
2015-06-24Split deflate.cMika Lindqvist
* Separate common inlines and macros to deflate_p.h * Separate deflate_fast related code to deflate_fast.c * Separate deflate_medium related code to deflate_medium.c * Separate deflate_slow related code to deflate_slow.c