ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
trees.c File Reference
#include "deflate.h"
+ Include dependency graph for trees.c:

Go to the source code of this file.

Classes

struct  static_tree_desc_s
 

Macros

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

Functions

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, const ct_data *ltree, const ct_data *dtree))
 
local unsigned bi_reverse OF ((unsigned value, int length))
 
local void tr_static_init ()
 
void ZLIB_INTERNAL _tr_init (deflate_state *s)
 
local void init_block (deflate_state *s)
 
local void pqdownheap (deflate_state *s, ct_data *tree, int k)
 
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 build_tree (deflate_state *s, tree_desc *desc)
 
local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
 
local void send_tree (deflate_state *s, ct_data *tree, int max_code)
 
local int build_bl_tree (deflate_state *s)
 
local void send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes)
 
void ZLIB_INTERNAL _tr_stored_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_flush_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 compress_block (deflate_state *s, const ct_data *ltree, const ct_data *dtree)
 
local int detect_data_type (deflate_state *s)
 
local unsigned bi_reverse (unsigned code, int len)
 
local void bi_flush (deflate_state *s)
 
local void bi_windup (deflate_state *s)
 

Variables

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 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_blbits [BL_CODES] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}
 
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 ct_data static_ltree [L_CODES+2]
 
local ct_data static_dtree [D_CODES]
 
uch _dist_code [DIST_CODE_LEN]
 
uch _length_code [MAX_MATCH-MIN_MATCH+1]
 
local int base_length [LENGTH_CODES]
 
local int base_dist [D_CODES]
 
local const static_tree_desc static_l_desc
 
local const static_tree_desc static_d_desc
 
local const static_tree_desc static_bl_desc
 

Macro Definition Documentation

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

Definition at line 80 of file trees.c.

View newest version in sPHENIX GitHub at line 80 of file trees.c

#define END_BLOCK   256

Definition at line 49 of file trees.c.

View newest version in sPHENIX GitHub at line 49 of file trees.c

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

#define MAX_BL_BITS   7

Definition at line 46 of file trees.c.

View newest version in sPHENIX GitHub at line 46 of file trees.c

#define pqremove (   s,
  tree,
  top 
)
Value:
{\
top = s->heap[SMALLEST]; \
s->heap[SMALLEST] = s->heap[s->heap_len--]; \
pqdownheap(s, tree, SMALLEST); \
}

Definition at line 429 of file trees.c.

View newest version in sPHENIX GitHub at line 429 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)); \
}

Definition at line 173 of file trees.c.

View newest version in sPHENIX GitHub at line 173 of file trees.c

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

#define REP_3_6   16

Definition at line 52 of file trees.c.

View newest version in sPHENIX GitHub at line 52 of file trees.c

Referenced by scan_tree(), and send_tree().

#define REPZ_11_138   18

Definition at line 58 of file trees.c.

View newest version in sPHENIX GitHub at line 58 of file trees.c

Referenced by scan_tree(), and send_tree().

#define REPZ_3_10   17

Definition at line 55 of file trees.c.

View newest version in sPHENIX GitHub at line 55 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) {\
int val = (int)value;\
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;\
}\
}

Definition at line 210 of file trees.c.

View newest version in sPHENIX GitHub at line 210 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 160 of file trees.c.

View newest version in sPHENIX GitHub at line 160 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]))

Definition at line 440 of file trees.c.

View newest version in sPHENIX GitHub at line 440 of file trees.c

Referenced by G4GeometryCellComp::operator()(), and pqdownheap().

#define SMALLEST   1

Definition at line 421 of file trees.c.

View newest version in sPHENIX GitHub at line 421 of file trees.c

Referenced by build_tree().

Function Documentation

void ZLIB_INTERNAL _tr_align ( deflate_state s)

Definition at line 895 of file trees.c.

View newest version in sPHENIX GitHub at line 895 of file trees.c

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

Referenced by deflate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ZLIB_INTERNAL _tr_flush_bits ( deflate_state s)

Definition at line 885 of file trees.c.

View newest version in sPHENIX GitHub at line 885 of file trees.c

References bi_flush().

Referenced by deflatePrime(), and flush_pending().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 910 of file trees.c.

View newest version in sPHENIX GitHub at line 910 of file trees.c

References _tr_stored_block(), Assert, bi_windup(), build_bl_tree(), build_tree(), compress_block(), detect_data_type(), DYN_TREES, init_block(), send_all_trees(), send_bits, static_dtree, static_ltree, STATIC_TREES, internal_state::strm, Tracev, Z_FIXED, and Z_UNKNOWN.

+ Here is the call graph for this function:

void ZLIB_INTERNAL _tr_init ( deflate_state s)

Definition at line 378 of file trees.c.

View newest version in sPHENIX GitHub at line 378 of file trees.c

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

Referenced by deflateResetKeep().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 862 of file trees.c.

View newest version in sPHENIX GitHub at line 862 of file trees.c

References bi_windup(), L, put_short, send_bits, STORED_BLOCK, and zmemcpy().

Referenced by _tr_flush_block(), deflate(), and deflate_stored().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1013 of file trees.c.

View newest version in sPHENIX GitHub at line 1013 of file trees.c

References _length_code, Assert, d_code, D_CODES, extra_dbits, L, g4zmq::lc(), LITERALS, MAX_DIST, MAX_MATCH, and Tracev.

+ Here is the call graph for this function:

local void bi_flush ( deflate_state s)

Definition at line 1172 of file trees.c.

View newest version in sPHENIX GitHub at line 1172 of file trees.c

References put_byte, and put_short.

Referenced by _tr_align(), and _tr_flush_bits().

+ Here is the caller graph for this function:

local unsigned bi_reverse ( unsigned  code,
int  len 
)

Definition at line 1157 of file trees.c.

View newest version in sPHENIX GitHub at line 1157 of file trees.c

Referenced by gen_codes(), and tr_static_init().

+ Here is the caller graph for this function:

local void bi_windup ( deflate_state s)

Definition at line 1189 of file trees.c.

View newest version in sPHENIX GitHub at line 1189 of file trees.c

References put_byte, and put_short.

Referenced by _tr_flush_block(), and _tr_stored_block().

+ Here is the caller graph for this function:

local int build_bl_tree ( deflate_state s)

Definition at line 798 of file trees.c.

View newest version in sPHENIX GitHub at line 798 of file trees.c

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

Referenced by _tr_flush_block().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

local void build_tree ( deflate_state s,
tree_desc desc 
)

Definition at line 614 of file trees.c.

View newest version in sPHENIX GitHub at line 614 of file trees.c

References incremental_prev_tag::desc, tree_desc_s::dyn_tree, static_tree_desc_s::elems, Freq, gen_bitlen(), gen_codes(), HEAP_SIZE, m, tree_desc_s::max_code, n, pqdownheap(), pqremove, SMALLEST, tree_desc_s::stat_desc, static_tree_desc_s::static_tree, and propagation_timing::stree.

Referenced by _tr_flush_block(), and build_bl_tree().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

local void compress_block ( deflate_state s,
const ct_data ltree,
const ct_data dtree 
)

Definition at line 1063 of file trees.c.

View newest version in sPHENIX GitHub at line 1063 of file trees.c

References _length_code, Assert, base_dist, base_length, d_code, END_BLOCK, extra_dbits, extra_lbits, g4zmq::lc(), LITERALS, send_bits, send_code, and Tracecv.

Referenced by _tr_flush_block().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

local int detect_data_type ( deflate_state s)

Definition at line 1123 of file trees.c.

View newest version in sPHENIX GitHub at line 1123 of file trees.c

References LITERALS, n, Z_BINARY, and Z_TEXT.

Referenced by _tr_flush_block().

+ Here is the caller graph for this function:

local void gen_bitlen ( deflate_state s,
tree_desc desc 
)

Definition at line 485 of file trees.c.

View newest version in sPHENIX GitHub at line 485 of file trees.c

References tree_desc_s::dyn_tree, static_tree_desc_s::extra_base, static_tree_desc_s::extra_bits, f, for(), Acts::UnitConstants::h, HEAP_SIZE, Len, m, MAX_BITS, tree_desc_s::max_code, static_tree_desc_s::max_length, n, tree_desc_s::stat_desc, static_tree_desc_s::static_tree, propagation_timing::stree, and Tracev.

Referenced by build_tree().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 571 of file trees.c.

View newest version in sPHENIX GitHub at line 571 of file trees.c

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

Referenced by build_tree(), and tr_static_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

local void init_block ( deflate_state s)

Definition at line 406 of file trees.c.

View newest version in sPHENIX GitHub at line 406 of file trees.c

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

Referenced by _tr_flush_block(), and _tr_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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, const ct_data *ltree, const ct_data *dtree)  )
local unsigned bi_reverse OF ( (unsigned value, int length)  )
local void pqdownheap ( deflate_state s,
ct_data tree,
int  k 
)

Definition at line 450 of file trees.c.

View newest version in sPHENIX GitHub at line 450 of file trees.c

References k, smaller, and v.

Referenced by build_tree().

+ Here is the caller graph for this function:

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

Definition at line 702 of file trees.c.

View newest version in sPHENIX GitHub at line 702 of file trees.c

References n, REP_3_6, REPZ_11_138, and REPZ_3_10.

Referenced by build_bl_tree().

+ Here is the caller graph for this function:

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

Definition at line 833 of file trees.c.

View newest version in sPHENIX GitHub at line 833 of file trees.c

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

Referenced by _tr_flush_block().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 747 of file trees.c.

View newest version in sPHENIX GitHub at line 747 of file trees.c

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

Referenced by send_all_trees().

+ Here is the caller graph for this function:

local void tr_static_init ( )

Definition at line 231 of file trees.c.

View newest version in sPHENIX GitHub at line 231 of file trees.c

References _dist_code, _length_code, Assert, base_dist, base_length, bi_reverse(), D_CODES, static_tree_desc_s::extra_bits, extra_blbits, extra_dbits, extra_lbits, gen_codes(), L_CODES, BTOF::length, LENGTH_CODES, MAX_BITS, n, static_bl_desc, static_d_desc, static_dtree, static_l_desc, static_ltree, and static_tree_desc_s::static_tree.

Referenced by _tr_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

uch _dist_code[DIST_CODE_LEN]

Definition at line 97 of file trees.c.

View newest version in sPHENIX GitHub at line 97 of file trees.c

Referenced by tr_static_init().

uch _length_code[MAX_MATCH-MIN_MATCH+1]

Definition at line 103 of file trees.c.

View newest version in sPHENIX GitHub at line 103 of file trees.c

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

local int base_dist[D_CODES]

Definition at line 109 of file trees.c.

View newest version in sPHENIX GitHub at line 109 of file trees.c

local int base_length[LENGTH_CODES]

Definition at line 106 of file trees.c.

View newest version in sPHENIX GitHub at line 106 of file trees.c

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 71 of file trees.c.

View newest version in sPHENIX GitHub at line 71 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 68 of file trees.c.

View newest version in sPHENIX GitHub at line 68 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 65 of file trees.c.

View newest version in sPHENIX GitHub at line 65 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 62 of file trees.c.

View newest version in sPHENIX GitHub at line 62 of file trees.c

Referenced by compress_block(), and tr_static_init().

local const static_tree_desc static_bl_desc
Initial value:

Definition at line 130 of file trees.c.

View newest version in sPHENIX GitHub at line 130 of file trees.c

Referenced by _tr_init(), and tr_static_init().

local const static_tree_desc static_d_desc
Initial value:

Definition at line 127 of file trees.c.

View newest version in sPHENIX GitHub at line 127 of file trees.c

Referenced by _tr_init(), and tr_static_init().

local ct_data static_dtree[D_CODES]

Definition at line 92 of file trees.c.

View newest version in sPHENIX GitHub at line 92 of file trees.c

local const static_tree_desc static_l_desc
Initial value:

Definition at line 124 of file trees.c.

View newest version in sPHENIX GitHub at line 124 of file trees.c

Referenced by _tr_init(), and tr_static_init().

local ct_data static_ltree[L_CODES+2]

Definition at line 85 of file trees.c.

View newest version in sPHENIX GitHub at line 85 of file trees.c