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

Side by Side Diff: third_party/zlib/deflate.h

Issue 552123005: Integrate SIMD optimisations for zlib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issues in fallback (non-SIMD) code Created 6 years, 3 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
OLDNEW
1 /* deflate.h -- internal compression state 1 /* deflate.h -- internal compression state
2 * Copyright (C) 1995-2010 Jean-loup Gailly 2 * Copyright (C) 1995-2010 Jean-loup Gailly
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6 /* WARNING: this file should *not* be used by applications. It is 6 /* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is 7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h. 8 subject to change. Applications should only use zlib.h.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Bytef *pending_buf; /* output still pending */ 100 Bytef *pending_buf; /* output still pending */
101 ulg pending_buf_size; /* size of pending_buf */ 101 ulg pending_buf_size; /* size of pending_buf */
102 Bytef *pending_out; /* next pending byte to output to the stream */ 102 Bytef *pending_out; /* next pending byte to output to the stream */
103 uInt pending; /* nb of bytes in the pending buffer */ 103 uInt pending; /* nb of bytes in the pending buffer */
104 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 104 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
105 gz_headerp gzhead; /* gzip header information to write */ 105 gz_headerp gzhead; /* gzip header information to write */
106 uInt gzindex; /* where in extra, name, or comment */ 106 uInt gzindex; /* where in extra, name, or comment */
107 Byte method; /* STORED (for zip only) or DEFLATED */ 107 Byte method; /* STORED (for zip only) or DEFLATED */
108 int last_flush; /* value of flush param for previous deflate call */ 108 int last_flush; /* value of flush param for previous deflate call */
109 109
110 #ifdef HAVE_PCLMULQDQ
111 unsigned __attribute__((aligned(16))) crc0[4 * 5];
112 #endif
113
110 /* used by deflate.c: */ 114 /* used by deflate.c: */
111 115
112 uInt w_size; /* LZ77 window size (32K by default) */ 116 uInt w_size; /* LZ77 window size (32K by default) */
113 uInt w_bits; /* log2(w_size) (8..16) */ 117 uInt w_bits; /* log2(w_size) (8..16) */
114 uInt w_mask; /* w_size - 1 */ 118 uInt w_mask; /* w_size - 1 */
115 119
116 Bytef *window; 120 Bytef *window;
117 /* Sliding window. Input bytes are read into the second half of the window, 121 /* Sliding window. Input bytes are read into the second half of the window,
118 * and move to the first half later to keep a dictionary of at least wSize 122 * and move to the first half later to keep a dictionary of at least wSize
119 * bytes. With this organization, matches are limited to a distance of 123 * bytes. With this organization, matches are limited to a distance of
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ 341 s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
338 s->dyn_dtree[d_code(dist)].Freq++; \ 342 s->dyn_dtree[d_code(dist)].Freq++; \
339 flush = (s->last_lit == s->lit_bufsize-1); \ 343 flush = (s->last_lit == s->lit_bufsize-1); \
340 } 344 }
341 #else 345 #else
342 # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) 346 # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
343 # define _tr_tally_dist(s, distance, length, flush) \ 347 # define _tr_tally_dist(s, distance, length, flush) \
344 flush = _tr_tally(s, distance, length) 348 flush = _tr_tally(s, distance, length)
345 #endif 349 #endif
346 350
351 /* ===========================================================================
352 * Update a hash value with the given input byte
353 * IN assertion: all calls to to UPDATE_HASH are made with consecutive
354 * input characters, so that a running hash key can be computed from the
355 * previous key instead of complete recalculation each time.
356 */
357 #ifdef USE_SSE4_2_CRC_HASH
agl 2014/09/23 21:41:40 don't define internal macros in public headers.
358 #define UPDATE_HASH(s,h,i) (\
359 {\
360 if (s->level < 6) \
361 h = (3483 * (s->window[i]) +\
362 23081* (s->window[i+1]) +\
363 6954 * (s->window[i+2]) +\
364 20947* (s->window[i+3])) & s->hash_mask;\
365 else\
366 h = (25881* (s->window[i]) +\
367 24674* (s->window[i+1]) +\
368 25811* (s->window[i+2])) & s->hash_mask;\
369 })
370 #else
371 #define UPDATE_HASH(s,h,i) (h = (((h)<<s->hash_shift) ^ (s->window[i + (MIN_MATC H-1)])) & s->hash_mask)
372 #endif
373
347 #endif /* DEFLATE_H */ 374 #endif /* DEFLATE_H */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698