SpeexBits: Bit-stream manipulations


Classes

struct  SpeexBits

Functions

void speex_bits_init (SpeexBits *bits)
void speex_bits_init_buffer (SpeexBits *bits, void *buff, int buf_size)
void speex_bits_set_bit_buffer (SpeexBits *bits, void *buff, int buf_size)
void speex_bits_destroy (SpeexBits *bits)
void speex_bits_reset (SpeexBits *bits)
void speex_bits_rewind (SpeexBits *bits)
void speex_bits_read_from (SpeexBits *bits, char *bytes, int len)
void speex_bits_read_whole_bytes (SpeexBits *bits, char *bytes, int len)
int speex_bits_write (SpeexBits *bits, char *bytes, int max_len)
int speex_bits_write_whole_bytes (SpeexBits *bits, char *bytes, int max_len)
void speex_bits_pack (SpeexBits *bits, int data, int nbBits)
int speex_bits_unpack_signed (SpeexBits *bits, int nbBits)
unsigned int speex_bits_unpack_unsigned (SpeexBits *bits, int nbBits)
int speex_bits_nbytes (SpeexBits *bits)
unsigned int speex_bits_peek_unsigned (SpeexBits *bits, int nbBits)
int speex_bits_peek (SpeexBits *bits)
void speex_bits_advance (SpeexBits *bits, int n)
int speex_bits_remaining (SpeexBits *bits)
void speex_bits_insert_terminator (SpeexBits *bits)

Detailed Description

This is the structure that holds the bit-stream when encoding or decoding with Speex. It allows some manipulations as well.

Function Documentation

void speex_bits_advance ( SpeexBits bits,
int  n 
)

Advances the position of the "bit cursor" in the stream

Parameters:
bits Bit-stream to operate on
n Number of bits to advance

void speex_bits_destroy ( SpeexBits bits  ) 

Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.

void speex_bits_init ( SpeexBits bits  ) 

Initializes and allocates resources for a SpeexBits struct

void speex_bits_init_buffer ( SpeexBits bits,
void *  buff,
int  buf_size 
)

Initializes SpeexBits struct using a pre-allocated buffer

void speex_bits_insert_terminator ( SpeexBits bits  ) 

Insert a terminator so that the data can be sent as a packet while auto-detecting the number of frames in each packet

Parameters:
bits Bit-stream to operate on

int speex_bits_nbytes ( SpeexBits bits  ) 

Returns the number of bytes in the bit-stream, including the last one even if it is not "full"

Parameters:
bits Bit-stream to operate on
Returns:
Number of bytes in the stream

void speex_bits_pack ( SpeexBits bits,
int  data,
int  nbBits 
)

Append bits to the bit-stream

Parameters:
bits Bit-stream to operate on
data Value to append as integer
nbBits number of bits to consider in "data"

int speex_bits_peek ( SpeexBits bits  ) 

Get the value of the next bit in the stream, without modifying the "cursor" position

Parameters:
bits Bit-stream to operate on
Returns:
Value of the bit peeked (one bit only)

unsigned int speex_bits_peek_unsigned ( SpeexBits bits,
int  nbBits 
)

Same as speex_bits_unpack_unsigned, but without modifying the cursor position

Parameters:
bits Bit-stream to operate on
nbBits Number of bits to look for
Returns:
Value of the bits peeked, interpreted as unsigned

void speex_bits_read_from ( SpeexBits bits,
char *  bytes,
int  len 
)

Initializes the bit-stream from the data in an area of memory

void speex_bits_read_whole_bytes ( SpeexBits bits,
char *  bytes,
int  len 
)

Append bytes to the bit-stream

Parameters:
bits Bit-stream to operate on
bytes pointer to the bytes what will be appended
len Number of bytes of append

int speex_bits_remaining ( SpeexBits bits  ) 

Returns the number of bits remaining to be read in a stream

Parameters:
bits Bit-stream to operate on
Returns:
Number of bits that can still be read from the stream

void speex_bits_reset ( SpeexBits bits  ) 

Resets bits to initial value (just after initialization, erasing content)

void speex_bits_rewind ( SpeexBits bits  ) 

Rewind the bit-stream to the beginning (ready for read) without erasing the content

void speex_bits_set_bit_buffer ( SpeexBits bits,
void *  buff,
int  buf_size 
)

Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data)

int speex_bits_unpack_signed ( SpeexBits bits,
int  nbBits 
)

Interpret the next bits in the bit-stream as a signed integer

Parameters:
bits Bit-stream to operate on
nbBits Number of bits to interpret
Returns:
A signed integer represented by the bits read

unsigned int speex_bits_unpack_unsigned ( SpeexBits bits,
int  nbBits 
)

Interpret the next bits in the bit-stream as an unsigned integer

Parameters:
bits Bit-stream to operate on
nbBits Number of bits to interpret
Returns:
An unsigned integer represented by the bits read

int speex_bits_write ( SpeexBits bits,
char *  bytes,
int  max_len 
)

Write the content of a bit-stream to an area of memory

Parameters:
bits Bit-stream to operate on
bytes Memory location where to write the bits
max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
Returns:
Number of bytes written to the "bytes" buffer

int speex_bits_write_whole_bytes ( SpeexBits bits,
char *  bytes,
int  max_len 
)

Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream


Generated on Wed Feb 25 11:19:28 2009 for Speex by  doxygen 1.5.1