libilbc 0.0.1
packing.h
1/*
2 * iLBC - a library for the iLBC codec
3 *
4 * packing.h - The iLBC low bit rate speech codec.
5 *
6 * Adapted by Steve Underwood <steveu@coppice.org> from the reference
7 * iLBC code supplied in RFC3951.
8 *
9 * Original code Copyright (C) The Internet Society (2004).
10 * All changes to produce this version Copyright (C) 2008 by Steve Underwood
11 * All Rights Reserved.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18#ifndef __PACKING_H
19#define __PACKING_H
20
21void packsplit(int *index, /* (i) the value to split */
22 int *firstpart, /* (o) the value specified by most
23 significant bits */
24 int *rest, /* (o) the value specified by least
25 significant bits */
26 int bitno_firstpart, /* (i) number of bits in most
27 significant part */
28 int bitno_total /* (i) number of bits in full range
29 of value */
30);
31
32void packcombine(int *index, /* (i/o) the msb value in the combined value out */
33 int rest, /* (i) the lsb value */
34 int bitno_rest); /* (i) the number of bits in the lsb part */
35
36void dopack(uint8_t **bitstream, /* (i/o) on entrance pointer to
37 place in bitstream to pack
38 new data, on exit pointer
39 to place in bitstream to
40 pack future data */
41 int index, /* (i) the value to pack */
42 int bitno, /* (i) the number of bits that the
43 value will fit within */
44 int *pos); /* (i/o) write position in the current byte */
45
46void unpack(const uint8_t **bitstream, /* (i/o) on entrance pointer to
47 place in bitstream to
48 unpack new data from, on
49 exit pointer to place in
50 bitstream to unpack future
51 data from */
52 int *index, /* (o) resulting value */
53 int bitno, /* (i) number of bits used to
54 represent the value */
55 int *pos); /* (i/o) read position in the current byte */
56
57#endif