Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libvcodex/Vchuff/vchuff.h
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2003-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Phong Vo <[email protected]> *
18
* *
19
***********************************************************************/
20
#ifndef _VCHUFF_H
21
#define _VCHUFF_H 1
22
23
/* Types and functions to construct a static Huffman codes.
24
**
25
** Written By Kiem-Phong Vo
26
*/
27
28
/* A Huffman decoding trie is stored in Vchtrie_t.node and Vchtrie_t.size.
29
** size[p] > 0: a data byte has been decoded. In this case, size[p]
30
** is the number of bits that should be consumed to finish
31
** the bits corresponding to this byte. node[p] is the byte.
32
** size[p] < 0: need to recurse to the next level of the trie. In this
33
** case, -size[p] is the number of bits needed to index the
34
** next level. node[p] is the base of the next level.
35
** size[p] == 0: an undecipherable bit string. Data is likely corrupted.
36
*/
37
typedef struct _vchtrie_s
38
{ short* node; /* data or next trie base to look up */
39
short* size; /* >0: code sizes, 0: internal nodes */
40
short ntop; /* # of bits to index top trie level */
41
short trsz; /* allocated memory for the trie */
42
short next;
43
} Vchtrie_t;
44
45
_BEGIN_EXTERNS_
46
47
#if _BLD_vcodex && defined(__EXPORT__)
48
#define extern extern __EXPORT__
49
#endif
50
#if !_BLD_vcodex && defined(__IMPORT__)
51
#define extern extern __IMPORT__
52
#endif
53
54
extern Vcmethod_t* Vchuffman; /* Huffman compression */
55
extern Vcmethod_t* Vchuffgroup; /* Huffman with grouping */
56
extern Vcmethod_t* Vchuffpart; /* Huffman with partitioning */
57
58
#undef extern
59
60
#if _BLD_vcodex && defined(__EXPORT__)
61
#define extern __EXPORT__
62
#endif
63
64
extern ssize_t vchsize _ARG_((ssize_t, ssize_t*, ssize_t*, int*));
65
extern ssize_t vchbits _ARG_((ssize_t, ssize_t*, Vcbit_t*));
66
extern Vchtrie_t* vchbldtrie _ARG_((ssize_t, ssize_t*, Vcbit_t*));
67
extern Void_t vchdeltrie _ARG_((Vchtrie_t*));
68
extern ssize_t vchgetcode _ARG_((ssize_t, ssize_t*, ssize_t, Vcchar_t*, size_t));
69
extern ssize_t vchputcode _ARG_((ssize_t, ssize_t*, ssize_t, Vcchar_t*, size_t));
70
extern int vchcopy _ARG_((Vcodex_t*, ssize_t*, ssize_t*, ssize_t));
71
72
#undef extern
73
74
_END_EXTERNS_
75
76
#endif /*_VCHUFF_H*/
77
78