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

Last change on this file since 3745 was 3745, checked in by mdewsnip, 21 years ago

Addition of MG package for search and retrieval

  • 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 * $Id: bitio_mems.h 3745 2003-02-20 21:20:24Z mdewsnip $
21 *
22 **************************************************************************
23 *
24 * This file contains function definitions for doing bitwise input and output
25 * of numbers on an array of chars. These routines are slower than the ones
26 * in "mem" files. but with these routines you can mix reads and writes, or
27 * multiple writes, on the array of chars at the same time and guarantee
28 * them to work, also you can seek to a point and do a write. The decode and
29 * encode functions cannot detect when the end off the character is reached
30 * and just continue processing.
31 *
32 **************************************************************************/
33
34#ifndef H_BITIO_MEMS
35#define H_BITIO_MEMS
36
37
38
39typedef struct mems_bitio_state
40 {
41 unsigned char *Base;
42 unsigned long pos;
43 }
44mems_bitio_state;
45
46
47/* NOTE : All bytes are filled high bit first */
48
49
50void BIO_Mems_Encode_Start (char *buf, unsigned long pos, mems_bitio_state * bs);
51void BIO_Mems_Encode_Done (mems_bitio_state * bs);
52
53
54
55void BIO_Mems_Decode_Start (void *buf, unsigned long pos, mems_bitio_state * bs);
56
57
58
59void BIO_Mems_Unary_Encode (unsigned long val, mems_bitio_state * bs,
60 unsigned long *bits);
61unsigned long BIO_Mems_Unary_Decode (mems_bitio_state * bs,
62 unsigned long *bits);
63
64
65
66void BIO_Mems_Binary_Encode (unsigned long val, unsigned long b,
67 mems_bitio_state * bs, unsigned long *bits);
68unsigned long BIO_Mems_Binary_Decode (unsigned long b, mems_bitio_state * bs,
69 unsigned long *bits);
70
71
72
73void BIO_Mems_Gamma_Encode (unsigned long val, mems_bitio_state * bs,
74 unsigned long *bits);
75unsigned long BIO_Mems_Gamma_Decode (mems_bitio_state * bs, unsigned long *bits);
76
77
78
79void BIO_Mems_Delta_Encode (unsigned long val, mems_bitio_state * bs,
80 unsigned long *bits);
81unsigned long BIO_Mems_Delta_Decode (mems_bitio_state * bs, unsigned long *bits);
82
83
84void BIO_Mems_Elias_Encode (unsigned long val, unsigned long b, double s,
85 mems_bitio_state * bs, unsigned long *bits);
86unsigned long BIO_Mems_Elias_Decode (unsigned long b, double s,
87 mems_bitio_state * bs, unsigned long *bits);
88
89
90void BIO_Mems_Bblock_Encode (unsigned long val, unsigned long b,
91 mems_bitio_state * bs, unsigned long *bits);
92unsigned long BIO_Mems_Bblock_Decode (unsigned long b, mems_bitio_state * bs,
93 unsigned long *bits);
94
95
96void BIO_Mems_Decode_Seek (unsigned long pos, mems_bitio_state * bs);
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.