libvoipcodecs  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  * $Id: packing.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
18  */
19 
20 #ifndef __PACKING_H
21 #define __PACKING_H
22 
23 void packsplit(int *index, /* (i) the value to split */
24  int *firstpart, /* (o) the value specified by most
25  significant bits */
26  int *rest, /* (o) the value specified by least
27  significant bits */
28  int bitno_firstpart, /* (i) number of bits in most
29  significant part */
30  int bitno_total /* (i) number of bits in full range
31  of value */
32 );
33 
34 void packcombine(int *index, /* (i/o) the msb value in the combined value out */
35  int rest, /* (i) the lsb value */
36  int bitno_rest); /* (i) the number of bits in the lsb part */
37 
38 void dopack(uint8_t **bitstream, /* (i/o) on entrance pointer to
39  place in bitstream to pack
40  new data, on exit pointer
41  to place in bitstream to
42  pack future data */
43  int index, /* (i) the value to pack */
44  int bitno, /* (i) the number of bits that the
45  value will fit within */
46  int *pos); /* (i/o) write position in the current byte */
47 
48 void unpack(const uint8_t **bitstream, /* (i/o) on entrance pointer to
49  place in bitstream to
50  unpack new data from, on
51  exit pointer to place in
52  bitstream to unpack future
53  data from */
54  int *index, /* (o) resulting value */
55  int bitno, /* (i) number of bits used to
56  represent the value */
57  int *pos); /* (i/o) read position in the current byte */
58 
59 #endif