ZLIB
Loading...
Searching...
No Matches
deflate.h File Reference

Internal compression state. More...

#include "zutil.h"

Go to the source code of this file.

Data Structures

struct  ct_data
 Data structure describing a single value and its code string. More...
 
struct  tree_desc
 
struct  deflate_state
 Deflate internal state. More...
 

Macros

#define GZIP
 
#define LENGTH_CODES   29
 
#define LITERALS   256
 
#define L_CODES   (LITERALS+1+LENGTH_CODES)
 
#define D_CODES   30
 
#define BL_CODES   19
 
#define HEAP_SIZE   (2*L_CODES+1)
 
#define MAX_BITS   15
 
#define Buf_size   16
 
#define INIT_STATE   42 /* zlib header -> BUSY_STATE */
 
#define GZIP_STATE   57 /* gzip header -> BUSY_STATE | EXTRA_STATE */
 
#define EXTRA_STATE   69 /* gzip extra block -> NAME_STATE */
 
#define NAME_STATE   73 /* gzip file name -> COMMENT_STATE */
 
#define COMMENT_STATE   91 /* gzip comment -> HCRC_STATE */
 
#define HCRC_STATE   103 /* gzip header CRC -> BUSY_STATE */
 
#define BUSY_STATE   113 /* deflate -> FINISH_STATE */
 
#define FINISH_STATE   666 /* stream complete */
 
#define Freq   fc.freq
 
#define Code   fc.code
 
#define Dad   dl.dad
 
#define Len   dl.len
 
#define put_byte(s, c)   {s->pending_buf[s->pending++] = (Bytef)(c);}
 
#define MIN_LOOKAHEAD   (MAX_MATCH+MIN_MATCH+1)
 
#define MAX_DIST(s)   ((s)->w_size-MIN_LOOKAHEAD)
 
#define WIN_INIT   MAX_MATCH
 
#define d_code(dist)    ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
 
#define _tr_tally_lit(s, c, flush)
 
#define _tr_tally_dist(s, distance, length, flush)
 
used by deflate.c:
#define max_insert_length   max_lazy_match
 Insert new strings in the hash table only if the match length is not greater than this length.
 

Typedefs

typedef ush Pos
 
typedef Pos FAR Posf
 
typedef unsigned IPos
 

Functions

void ZLIB_INTERNAL _tr_init (deflate_state *s)
 
int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
 
void ZLIB_INTERNAL _tr_flush_block (deflate_state *s, charf *buf, ulg stored_len, int last)
 
void ZLIB_INTERNAL _tr_flush_bits (deflate_state *s)
 
void ZLIB_INTERNAL _tr_align (deflate_state *s)
 
void ZLIB_INTERNAL _tr_stored_block (deflate_state *s, charf *buf, ulg stored_len, int last)
 

Variables

uch ZLIB_INTERNAL _length_code []
 
uch ZLIB_INTERNAL _dist_code []
 

Detailed Description

Internal compression state.

Copyright (C) 1995-2018 Jean-loup Gailly For conditions of distribution and use, see copyright notice in zlib.h

Warning
This file should not be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h.

Macro Definition Documentation

◆ _tr_tally_dist

#define _tr_tally_dist (   s,
  distance,
  length,
  flush 
)
Value:
{ uch len = (uch)(length); \
ush dist = (ush)(distance); \
s->sym_buf[s->sym_next++] = (uch)dist; \
s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
s->sym_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}

◆ _tr_tally_lit

#define _tr_tally_lit (   s,
  c,
  flush 
)
Value:
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->sym_next == s->sym_end); \
}

◆ max_insert_length

#define max_insert_length   max_lazy_match

Insert new strings in the hash table only if the match length is not greater than this length.

This saves time but degrades compression. max_insert_length is used only for compression levels <= 3.