source: main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_mems.h@ 25147

Last change on this file since 25147 was 25147, checked in by kjdon, 12 years ago

merged 64_bit_Greenstone branch into trunk, rev 25139

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 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 mg_u_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, mg_u_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, mg_u_long pos, mems_bitio_state * bs);
54
55
56
57void BIO_Mems_Unary_Encode (mg_u_long val, mems_bitio_state * bs,
58 mg_u_long *bits);
59mg_u_long BIO_Mems_Unary_Decode (mems_bitio_state * bs,
60 mg_u_long *bits);
61
62
63
64void BIO_Mems_Binary_Encode (mg_u_long val, mg_u_long b,
65 mems_bitio_state * bs, mg_u_long *bits);
66mg_u_long BIO_Mems_Binary_Decode (mg_u_long b, mems_bitio_state * bs,
67 mg_u_long *bits);
68
69
70
71void BIO_Mems_Gamma_Encode (mg_u_long val, mems_bitio_state * bs,
72 mg_u_long *bits);
73mg_u_long BIO_Mems_Gamma_Decode (mems_bitio_state * bs, mg_u_long *bits);
74
75
76
77void BIO_Mems_Delta_Encode (mg_u_long val, mems_bitio_state * bs,
78 mg_u_long *bits);
79mg_u_long BIO_Mems_Delta_Decode (mems_bitio_state * bs, mg_u_long *bits);
80
81
82void BIO_Mems_Elias_Encode (mg_u_long val, mg_u_long b, double s,
83 mems_bitio_state * bs, mg_u_long *bits);
84mg_u_long BIO_Mems_Elias_Decode (mg_u_long b, double s,
85 mems_bitio_state * bs, mg_u_long *bits);
86
87
88void BIO_Mems_Bblock_Encode (mg_u_long val, mg_u_long b,
89 mems_bitio_state * bs, mg_u_long *bits);
90mg_u_long BIO_Mems_Bblock_Decode (mg_u_long b, mems_bitio_state * bs,
91 mg_u_long *bits);
92
93
94void BIO_Mems_Decode_Seek (mg_u_long pos, mems_bitio_state * bs);
95
96
97#endif
Note: See TracBrowser for help on using the repository browser.