source: trunk/gsdl3/src/packages/mg/lib/bitio_mems.h@ 13654

Last change on this file since 13654 was 13654, checked in by kjdon, 17 years ago

tidied up the top comments, removed Ids, and old log messages

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/**************************************************************************
2 *
3 * bitio_mems.h -- Functions for bitio to memory (random access)
4 * Copyright (C) 1994 Neil Sharman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 **************************************************************************
21 *
22 * This file contains function definitions for doing bitwise input and output
23 * of numbers on an array of chars. These routines are slower than the ones
24 * in "mem" files. but with these routines you can mix reads and writes, or
25 * multiple writes, on the array of chars at the same time and guarantee
26 * them to work, also you can seek to a point and do a write. The decode and
27 * encode functions cannot detect when the end off the character is reached
28 * and just continue processing.
29 *
30 **************************************************************************/
31
32#ifndef H_BITIO_MEMS
33#define H_BITIO_MEMS
34
35
36
37typedef struct mems_bitio_state
38 {
39 unsigned char *Base;
40 unsigned long pos;
41 }
42mems_bitio_state;
43
44
45/* NOTE : All bytes are filled high bit first */
46
47
48void BIO_Mems_Encode_Start (char *buf, unsigned long pos, mems_bitio_state * bs);
49void BIO_Mems_Encode_Done (mems_bitio_state * bs);
50
51
52
53void BIO_Mems_Decode_Start (void *buf, unsigned long pos, mems_bitio_state * bs);
54
55
56
57void BIO_Mems_Unary_Encode (unsigned long val, mems_bitio_state * bs,
58 unsigned long *bits);
59unsigned long BIO_Mems_Unary_Decode (mems_bitio_state * bs,
60 unsigned long *bits);
61
62
63
64void BIO_Mems_Binary_Encode (unsigned long val, unsigned long b,
65 mems_bitio_state * bs, unsigned long *bits);
66unsigned long BIO_Mems_Binary_Decode (unsigned long b, mems_bitio_state * bs,
67 unsigned long *bits);
68
69
70
71void BIO_Mems_Gamma_Encode (unsigned long val, mems_bitio_state * bs,
72 unsigned long *bits);
73unsigned long BIO_Mems_Gamma_Decode (mems_bitio_state * bs, unsigned long *bits);
74
75
76
77void BIO_Mems_Delta_Encode (unsigned long val, mems_bitio_state * bs,
78 unsigned long *bits);
79unsigned long BIO_Mems_Delta_Decode (mems_bitio_state * bs, unsigned long *bits);
80
81
82void BIO_Mems_Elias_Encode (unsigned long val, unsigned long b, double s,
83 mems_bitio_state * bs, unsigned long *bits);
84unsigned long BIO_Mems_Elias_Decode (unsigned long b, double s,
85 mems_bitio_state * bs, unsigned long *bits);
86
87
88void BIO_Mems_Bblock_Encode (unsigned long val, unsigned long b,
89 mems_bitio_state * bs, unsigned long *bits);
90unsigned long BIO_Mems_Bblock_Decode (unsigned long b, mems_bitio_state * bs,
91 unsigned long *bits);
92
93
94void BIO_Mems_Decode_Seek (unsigned long pos, mems_bitio_state * bs);
95
96
97#endif
Note: See TracBrowser for help on using the repository browser.