Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/bitstream.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * bitstream.h - Bitstream composition and decomposition routines. | |
5 * | |
6 * Written by Steve Underwood <steveu@coppice.org> | |
7 * | |
8 * Copyright (C) 2006 Steve Underwood | |
9 * | |
10 * All rights reserved. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU Lesser General Public License version 2.1, | |
14 * as published by the Free Software Foundation. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU Lesser General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU Lesser General Public | |
22 * License along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 * $Id: bitstream.h,v 1.14.4.1 2009/12/28 12:20:47 steveu Exp $ | |
26 */ | |
27 | |
28 /*! \file */ | |
29 | |
30 #if !defined(_SPANDSP_BITSTREAM_H_) | |
31 #define _SPANDSP_BITSTREAM_H_ | |
32 | |
33 /*! \page bitstream_page Bitstream composition and decomposition | |
34 \section bitstream_page_sec_1 What does it do? | |
35 | |
36 \section bitstream_page_sec_2 How does it work? | |
37 */ | |
38 | |
39 /*! Bitstream handler state */ | |
40 typedef struct bitstream_state_s bitstream_state_t; | |
41 | |
42 #if defined(__cplusplus) | |
43 extern "C" | |
44 { | |
45 #endif | |
46 | |
47 /*! \brief Put a chunk of bits into the output buffer. | |
48 \param s A pointer to the bitstream context. | |
49 \param c A pointer to the bitstream output buffer. | |
50 \param value The value to be pushed into the output buffer. | |
51 \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */ | |
52 SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); | |
53 | |
54 /*! \brief Get a chunk of bits from the input buffer. | |
55 \param s A pointer to the bitstream context. | |
56 \param c A pointer to the bitstream input buffer. | |
57 \param bits The number of bits of value to be grabbed. 1 to 25 bits is valid. | |
58 \return The value retrieved from the input buffer. */ | |
59 SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits); | |
60 | |
61 /*! \brief Flush any residual bit to the output buffer. | |
62 \param s A pointer to the bitstream context. | |
63 \param c A pointer to the bitstream output buffer. */ | |
64 SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c); | |
65 | |
66 /*! \brief Initialise a bitstream context. | |
67 \param s A pointer to the bitstream context. | |
68 \param lsb_first TRUE if the bit stream is LSB first, else its MSB first. | |
69 \return A pointer to the bitstream context. */ | |
70 SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction); | |
71 | |
72 SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s); | |
73 | |
74 SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s); | |
75 | |
76 #if defined(__cplusplus) | |
77 } | |
78 #endif | |
79 | |
80 #endif | |
81 /*- End of file ------------------------------------------------------------*/ |