Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
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
 

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

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

Variables

static int extra_lbits [29] = {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}
 
static int extra_dbits [30] = {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}
 
static int extra_blbits [19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}
 
static uch bl_order [19] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}
 
static ct_data static_ltree [(256+1+29)+2]
 
static ct_data static_dtree [30]
 
uch _dist_code [512]
 
uch _length_code [258-3+1]
 
static int base_length [29]
 
static int base_dist [30]
 
static static_tree_desc static_l_desc
 
static static_tree_desc static_d_desc
 
static static_tree_desc static_bl_desc
 

Class Documentation

struct static_tree_desc_s

Definition at line 155 of file deflate.c.

Collaboration diagram for static_tree_desc:
Collaboration graph
Class Members
int dummy
int elems
int extra_base
intf * extra_bits
int max_length
ct_data * static_tree

Macro Definition Documentation

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

Definition at line 81 of file trees.c.

#define END_BLOCK   256

Definition at line 50 of file trees.c.

#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--]; \
pqdownheap(s, tree, SMALLEST); \
}
#define SMALLEST
Definition: trees.c:424

Definition at line 432 of file trees.c.

#define put_short (   s,
 
)
Value:
{ \
put_byte(s, (uch)((w) & 0xff)); \
put_byte(s, (uch)((ush)(w) >> 8)); \
}
unsigned short ush
Definition: zutil.h:43
unsigned char uch
Definition: zutil.h:41

Definition at line 176 of file trees.c.

#define REP_3_6   16

Definition at line 53 of file trees.c.

#define REPZ_11_138   18

Definition at line 59 of file trees.c.

#define REPZ_3_10   17

Definition at line 56 of file trees.c.

#define send_bits (   s,
  value,
  length 
)
Value:
{ int len = length;\
if (s->bi_valid > (int)Buf_size - len) {\
int val = 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;\
}\
}
#define put_short(s, w)
Definition: trees.c:176
#define Buf_size
Definition: deflate.h:51
unsigned short ush
Definition: zutil.h:43

Definition at line 213 of file trees.c.

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

Definition at line 163 of file trees.c.

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

#define SMALLEST   1

Definition at line 424 of file trees.c.

Function Documentation

void _tr_align ( deflate_state s)

Definition at line 892 of file trees.c.

void _tr_flush_bits ( deflate_state s)

Definition at line 882 of file trees.c.

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

Definition at line 907 of file trees.c.

void _tr_init ( deflate_state s)

Definition at line 381 of file trees.c.

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

Definition at line 865 of file trees.c.

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

Definition at line 1010 of file trees.c.

static void bi_flush ( )
static
static void bi_flush ( deflate_state s)
static

Definition at line 1169 of file trees.c.

static unsigned bi_reverse ( )
static
static unsigned bi_reverse ( unsigned  code,
int  len 
)
static

Definition at line 1154 of file trees.c.

static void bi_windup ( )
static
static void bi_windup ( deflate_state s)
static

Definition at line 1186 of file trees.c.

static int build_bl_tree ( )
static
static int build_bl_tree ( deflate_state s)
static

Definition at line 801 of file trees.c.

static void build_tree ( )
static
static void build_tree ( deflate_state s,
tree_desc desc 
)
static

Definition at line 617 of file trees.c.

static void compress_block ( )
static
static void compress_block ( deflate_state s,
ct_data ltree,
ct_data dtree 
)
static

Definition at line 1060 of file trees.c.

static void copy_block ( )
static
static void copy_block ( deflate_state s,
charf buf,
unsigned  len,
int  header 
)
static

Definition at line 1205 of file trees.c.

static int detect_data_type ( )
static
static int detect_data_type ( deflate_state s)
static

Definition at line 1120 of file trees.c.

static void gen_bitlen ( )
static
static void gen_bitlen ( deflate_state s,
tree_desc desc 
)
static

Definition at line 488 of file trees.c.

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

Definition at line 575 of file trees.c.

static void init_block ( )
static
static void init_block ( deflate_state s)
static

Definition at line 409 of file trees.c.

static void pqdownheap ( )
static
static void pqdownheap ( deflate_state s,
ct_data tree,
int  k 
)
static

Definition at line 453 of file trees.c.

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

Definition at line 705 of file trees.c.

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

Definition at line 836 of file trees.c.

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

Definition at line 750 of file trees.c.

static void tr_static_init ( )
static

Definition at line 234 of file trees.c.

Variable Documentation

uch _dist_code[512 ]

Definition at line 98 of file trees.c.

uch _length_code[258-3+1]

Definition at line 104 of file trees.c.

int base_dist[30]
static

Definition at line 110 of file trees.c.

int base_length[29]
static

Definition at line 107 of file trees.c.

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

Definition at line 72 of file trees.c.

int extra_blbits[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}
static

Definition at line 69 of file trees.c.

int extra_dbits[30] = {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}
static

Definition at line 66 of file trees.c.

int extra_lbits[29] = {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}
static

Definition at line 63 of file trees.c.

static_tree_desc static_bl_desc
static
Initial value:
=
{( ct_data *)0, extra_blbits, 0, 19 , 7 }
static int extra_blbits[19]
Definition: trees.c:69

Definition at line 131 of file trees.c.

static_tree_desc static_d_desc
static
Initial value:
=
{static_dtree, extra_dbits, 0, 30 , 15 }
static ct_data static_dtree[30]
Definition: trees.c:93
static int extra_dbits[30]
Definition: trees.c:66

Definition at line 128 of file trees.c.

ct_data static_dtree[30]
static

Definition at line 93 of file trees.c.

static_tree_desc static_l_desc
static
Initial value:
=
{static_ltree, extra_lbits, 256 +1, ( 256 +1+ 29 ) , 15 }
static ct_data static_ltree[(256+1+29)+2]
Definition: trees.c:86
static int extra_lbits[29]
Definition: trees.c:63

Definition at line 125 of file trees.c.

ct_data static_ltree[(256+1+29)+2]
static

Definition at line 86 of file trees.c.