zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
trees.c File Reference
#include "deflate.h"

Go to the source code of this file.

Macros

#define Buf_size   (8 * 2*sizeof(char))
 
#define DIST_CODE_LEN   512 /* see definition of array dist_code below */
 
#define END_BLOCK   256
 
#define MAX_BL_BITS   7
 
#define pqremove(s, tree, top)
 
#define put_short(s, w)
 
#define REP_3_6   16
 
#define REPZ_11_138   18
 
#define REPZ_3_10   17
 
#define send_bits(s, value, length)
 
#define send_code(s, c, tree)   send_bits(s, tree[c].Code, tree[c].Len)
 
#define smaller(tree, n, m, depth)
 
#define SMALLEST   1
 

Functions

void ZLIB_INTERNAL _tr_align (deflate_state *s)
 
void ZLIB_INTERNAL _tr_flush_block (deflate_state *s, charf *buf, ulg stored_len, int last)
 
void ZLIB_INTERNAL _tr_init (deflate_state *s)
 
void ZLIB_INTERNAL _tr_stored_block (deflate_state *s, charf *buf, ulg stored_len, int last)
 
int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
 
local void bi_flush (deflate_state *s)
 
local unsigned bi_reverse (unsigned code, int len)
 
local void bi_windup (deflate_state *s)
 
local int build_bl_tree (deflate_state *s)
 
local void build_tree (deflate_state *s, tree_desc *desc)
 
local void compress_block (deflate_state *s, ct_data *ltree, ct_data *dtree)
 
local void copy_block (deflate_state *s, charf *buf, unsigned len, int header)
 
local int detect_data_type (deflate_state *s)
 
local void gen_bitlen (deflate_state *s, tree_desc *desc)
 
local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
 
local void init_block (deflate_state *s)
 
local void tr_static_init OF ((void))
 
local void init_block OF ((deflate_state *s))
 
local void pqdownheap OF ((deflate_state *s, ct_data *tree, int k))
 
local void gen_bitlen OF ((deflate_state *s, tree_desc *desc))
 
local void gen_codes OF ((ct_data *tree, int max_code, ushf *bl_count))
 
local void scan_tree OF ((deflate_state *s, ct_data *tree, int max_code))
 
local void send_all_trees OF ((deflate_state *s, int lcodes, int dcodes, int blcodes))
 
local void compress_block OF ((deflate_state *s, ct_data *ltree, ct_data *dtree))
 
local unsigned bi_reverse OF ((unsigned value, int length))
 
local void copy_block OF ((deflate_state *s, charf *buf, unsigned len, int header))
 
local void pqdownheap (deflate_state *s, ct_data *tree, int k)
 
local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
 
local void send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes)
 
local void send_tree (deflate_state *s, ct_data *tree, int max_code)
 
local void tr_static_init ()
 

Variables

uch _dist_code [DIST_CODE_LEN]
 
uch _length_code [MAX_MATCH-MIN_MATCH+1]
 
local int base_dist [D_CODES]
 
local int base_length [LENGTH_CODES]
 
local const uch bl_order [BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}
 
local const int extra_blbits [BL_CODES] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}
 
local const int extra_dbits [D_CODES] = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}
 
local const int extra_lbits [LENGTH_CODES] = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}
 
local static_tree_desc static_bl_desc
 
local static_tree_desc static_d_desc
 
local ct_data static_dtree [D_CODES]
 
local static_tree_desc static_l_desc
 
local ct_data static_ltree [L_CODES+2]
 

Macro Definition Documentation

#define Buf_size   (8 * 2*sizeof(char))

Definition at line 77 of file trees.c.

#define DIST_CODE_LEN   512 /* see definition of array dist_code below */

Definition at line 86 of file trees.c.

#define END_BLOCK   256

Definition at line 50 of file trees.c.

Referenced by _tr_align(), compress_block(), and init_block().

#define MAX_BL_BITS   7

Definition at line 47 of file trees.c.

#define pqremove (   s,
  tree,
  top 
)
Value:
{\
top = s->heap[SMALLEST]; \
s->heap[SMALLEST] = s->heap[s->heap_len--]; \
}
GLdouble s
Definition: glew.h:1376
#define SMALLEST
Definition: trees.c:430
local void pqdownheap(deflate_state *s, ct_data *tree, int k)
Definition: trees.c:459
GLfloat GLfloat GLfloat top
Definition: glew.h:13816

Definition at line 438 of file trees.c.

Referenced by build_tree().

#define put_short (   s,
  w 
)
Value:
{ \
put_byte(s, (uch)((w) & 0xff)); \
put_byte(s, (uch)((ush)(w) >> 8)); \
}
GLdouble s
Definition: glew.h:1376
unsigned char uch
Definition: zutil.h:34
unsigned short ush
Definition: zutil.h:36
#define put_byte(s, c)
Definition: deflate.h:275
GLint GLint GLint GLint GLint w
Definition: gl2ext.h:1215

Definition at line 181 of file trees.c.

Referenced by bi_flush(), bi_windup(), and copy_block().

#define REP_3_6   16

Definition at line 53 of file trees.c.

Referenced by scan_tree(), and send_tree().

#define REPZ_11_138   18

Definition at line 59 of file trees.c.

Referenced by scan_tree(), and send_tree().

#define REPZ_3_10   17

Definition at line 56 of file trees.c.

Referenced by scan_tree(), and send_tree().

#define send_bits (   s,
  value,
  length 
)
Value:
{ int len = length;\
if (s->bi_valid > (int)Buf_size - len) {\
s->bi_buf |= (ush)val << s->bi_valid;\
put_short(s, s->bi_buf);\
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
s->bi_valid += len - Buf_size;\
} else {\
s->bi_buf |= (ush)(value) << s->bi_valid;\
s->bi_valid += len;\
}\
}
GLuint const GLfloat * val
Definition: glew.h:2715
GLdouble s
Definition: glew.h:1376
GLenum GLsizei len
Definition: glew.h:7035
if(!yyg->yy_init)
#define put_short(s, w)
Definition: trees.c:181
int
Definition: SDL_systhread.c:37
GLsizei GLsizei * length
Definition: gl2ext.h:792
unsigned short ush
Definition: zutil.h:36
EGLSurface EGLint void ** value
Definition: eglext.h:301
#define Buf_size
Definition: trees.c:77

Definition at line 218 of file trees.c.

Referenced by _tr_align(), _tr_flush_block(), _tr_stored_block(), compress_block(), send_all_trees(), and send_tree().

#define send_code (   s,
  c,
  tree 
)    send_bits(s, tree[c].Code, tree[c].Len)

Definition at line 168 of file trees.c.

Referenced by _tr_align(), compress_block(), and send_tree().

#define smaller (   tree,
  n,
  m,
  depth 
)
Value:
(tree[n].Freq < tree[m].Freq || \
(tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
GLclampd n
Definition: glew.h:7287
GLint GLenum GLsizei GLsizei GLsizei depth
Definition: gl2ext.h:845
#define m(i, j)

Definition at line 449 of file trees.c.

Referenced by pqdownheap().

#define SMALLEST   1

Definition at line 430 of file trees.c.

Referenced by build_tree().

Function Documentation

void ZLIB_INTERNAL _tr_align ( deflate_state s)

Definition at line 896 of file trees.c.

References bi_flush(), END_BLOCK, send_bits, send_code, static_ltree, and STATIC_TREES.

Referenced by deflate().

void ZLIB_INTERNAL _tr_init ( deflate_state s)

Definition at line 386 of file trees.c.

References init_block(), static_bl_desc, static_d_desc, static_l_desc, and tr_static_init().

Referenced by deflateReset().

void ZLIB_INTERNAL _tr_stored_block ( deflate_state s,
charf buf,
ulg  stored_len,
int  last 
)

Definition at line 871 of file trees.c.

References copy_block(), send_bits, and STORED_BLOCK.

Referenced by _tr_flush_block(), and deflate().

int ZLIB_INTERNAL _tr_tally ( deflate_state s,
unsigned  dist,
unsigned  lc 
)

Definition at line 1026 of file trees.c.

References _length_code, Assert, d_code, D_CODES, extra_dbits, LITERALS, MAX_DIST, MAX_MATCH, and Tracev.

local void bi_flush ( deflate_state s)

Definition at line 1186 of file trees.c.

References put_byte, and put_short.

Referenced by _tr_align().

local unsigned bi_reverse ( unsigned  code,
int  len 
)

Definition at line 1171 of file trees.c.

Referenced by gen_codes(), and tr_static_init().

local void bi_windup ( deflate_state s)

Definition at line 1203 of file trees.c.

References put_byte, and put_short.

Referenced by _tr_flush_block(), and copy_block().

local int build_bl_tree ( deflate_state s)

Definition at line 807 of file trees.c.

References BL_CODES, bl_order, build_tree(), scan_tree(), and Tracev.

Referenced by _tr_flush_block().

local void compress_block ( deflate_state s,
ct_data ltree,
ct_data dtree 
)
local void copy_block ( deflate_state s,
charf buf,
unsigned  len,
int  header 
)

Definition at line 1222 of file trees.c.

References bi_windup(), put_byte, and put_short.

Referenced by _tr_stored_block().

local int detect_data_type ( deflate_state s)

Definition at line 1137 of file trees.c.

References LITERALS, Z_BINARY, and Z_TEXT.

Referenced by _tr_flush_block().

local void gen_bitlen ( deflate_state s,
tree_desc desc 
)

Definition at line 494 of file trees.c.

References bits, tree_desc_s::dyn_tree, for(), HEAP_SIZE, Len, m, MAX_BITS, tree_desc_s::max_code, tree_desc_s::stat_desc, and Trace.

Referenced by build_tree().

local void gen_codes ( ct_data tree,
int  max_code,
ushf bl_count 
)

Definition at line 581 of file trees.c.

References Assert, bi_reverse(), bits, Code, MAX_BITS, static_ltree, Tracecv, and Tracev.

Referenced by build_tree(), and tr_static_init().

local void init_block ( deflate_state s)

Definition at line 415 of file trees.c.

References BL_CODES, D_CODES, END_BLOCK, for(), and L_CODES.

Referenced by _tr_flush_block(), and _tr_init().

local void gen_codes OF ( (ct_data *tree, int max_code, ushf *bl_count)  )
local void scan_tree OF ( (deflate_state *s, ct_data *tree, int max_code)  )
local void send_all_trees OF ( (deflate_state *s, int lcodes, int dcodes, int blcodes)  )
local void compress_block OF ( (deflate_state *s, ct_data *ltree, ct_data *dtree)  )
local unsigned bi_reverse OF ( (unsigned value, int length )
local void copy_block OF ( (deflate_state *s, charf *buf, unsigned len, int header )
local void pqdownheap ( deflate_state s,
ct_data tree,
int  k 
)

Definition at line 459 of file trees.c.

References j, k, and smaller.

Referenced by build_tree().

local void scan_tree ( deflate_state s,
ct_data tree,
int  max_code 
)

Definition at line 711 of file trees.c.

References REP_3_6, REPZ_11_138, and REPZ_3_10.

Referenced by build_bl_tree().

local void send_all_trees ( deflate_state s,
int  lcodes,
int  dcodes,
int  blcodes 
)

Definition at line 842 of file trees.c.

References Assert, BL_CODES, bl_order, send_bits, send_tree(), and Tracev.

Referenced by _tr_flush_block().

local void send_tree ( deflate_state s,
ct_data tree,
int  max_code 
)

Definition at line 756 of file trees.c.

References Assert, REP_3_6, REPZ_11_138, REPZ_3_10, send_bits, and send_code.

Referenced by send_all_trees().

Variable Documentation

uch _dist_code[DIST_CODE_LEN]

Definition at line 103 of file trees.c.

uch _length_code[MAX_MATCH-MIN_MATCH+1]

Definition at line 109 of file trees.c.

local int base_dist[D_CODES]

Definition at line 115 of file trees.c.

Referenced by compress_block(), and tr_static_init().

local int base_length[LENGTH_CODES]

Definition at line 112 of file trees.c.

Referenced by compress_block(), and tr_static_init().

local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}

Definition at line 72 of file trees.c.

Referenced by build_bl_tree(), and send_all_trees().

local const int extra_blbits[BL_CODES] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}

Definition at line 69 of file trees.c.

Referenced by tr_static_init().

local const int extra_dbits[D_CODES] = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}

Definition at line 66 of file trees.c.

Referenced by _tr_tally(), compress_block(), and tr_static_init().

local const int extra_lbits[LENGTH_CODES] = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}

Definition at line 63 of file trees.c.

Referenced by compress_block(), and tr_static_init().

local static_tree_desc static_bl_desc
Initial value:
=
#define BL_CODES
Definition: deflate.h:42
#define MAX_BL_BITS
Definition: trees.c:47
local const int extra_blbits[BL_CODES]
Definition: trees.c:69

Definition at line 136 of file trees.c.

Referenced by _tr_init(), and tr_static_init().

local static_tree_desc static_d_desc
Initial value:
=
local const int extra_dbits[D_CODES]
Definition: trees.c:66
local ct_data static_dtree[D_CODES]
Definition: trees.c:98
#define MAX_BITS
Definition: deflate.h:48
#define D_CODES
Definition: deflate.h:39

Definition at line 133 of file trees.c.

Referenced by _tr_init(), and tr_static_init().

local ct_data static_dtree[D_CODES]

Definition at line 98 of file trees.c.

Referenced by _tr_flush_block(), and tr_static_init().

local static_tree_desc static_l_desc
Initial value:
=
#define MAX_BITS
Definition: deflate.h:48
#define LITERALS
Definition: deflate.h:33
local const int extra_lbits[LENGTH_CODES]
Definition: trees.c:63
local ct_data static_ltree[L_CODES+2]
Definition: trees.c:91
#define L_CODES
Definition: deflate.h:36

Definition at line 130 of file trees.c.

Referenced by _tr_init(), and tr_static_init().

local ct_data static_ltree[L_CODES+2]

Definition at line 91 of file trees.c.

Referenced by _tr_align(), _tr_flush_block(), gen_codes(), and tr_static_init().