libg722_1  0.0.1
bitstream.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "g722_1/g722_1.h"
#include "bitstream.h"

Functions

void g722_1_bitstream_put (g722_1_bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
 Put a chunk of bits into the output buffer. More...
 
uint32_t g722_1_bitstream_get (g722_1_bitstream_state_t *s, const uint8_t **c, int bits)
 Get a chunk of bits from the input buffer. More...
 
void g722_1_bitstream_flush (g722_1_bitstream_state_t *s, uint8_t **c)
 Flush any residual bit to the output buffer. More...
 
g722_1_bitstream_state_tg722_1_bitstream_init (g722_1_bitstream_state_t *s)
 Initialise a bitstream context. More...
 

Function Documentation

void g722_1_bitstream_flush ( g722_1_bitstream_state_t s,
uint8_t **  c 
)

Flush any residual bit to the output buffer.

Parameters
sA pointer to the bitstream context.
cA pointer to the bitstream output buffer.

References g722_1_bitstream_state_t::bitstream, and g722_1_bitstream_state_t::residue.

uint32_t g722_1_bitstream_get ( g722_1_bitstream_state_t s,
const uint8_t **  c,
int  bits 
)

Get a chunk of bits from the input buffer.

Parameters
sA pointer to the bitstream context.
cA pointer to the bitstream input buffer.
bitsThe number of bits of value to be grabbed. 1 to 32 bits is valid.
Returns
The value retrieved from the input buffer.

References g722_1_bitstream_state_t::bitstream, and g722_1_bitstream_state_t::residue.

g722_1_bitstream_state_t* g722_1_bitstream_init ( g722_1_bitstream_state_t s)

Initialise a bitstream context.

Parameters
sA pointer to the bitstream context.
Returns
A pointer to the bitstream context.

References g722_1_bitstream_state_t::bitstream, and g722_1_bitstream_state_t::residue.

Referenced by g722_1_decode(), and g722_1_fillin().

void g722_1_bitstream_put ( g722_1_bitstream_state_t s,
uint8_t **  c,
uint32_t  value,
int  bits 
)

Put a chunk of bits into the output buffer.

Parameters
sA pointer to the bitstream context.
cA pointer to the bitstream output buffer.
valueThe value to be pushed into the output buffer.
bitsThe number of bits of value to be pushed. 1 to 32 bits is valid.

References g722_1_bitstream_state_t::bitstream, and g722_1_bitstream_state_t::residue.