Paraslash Audio Streaming | |
About News Download Documentation Development |
Bitstream API for the wma decoder. More...
#include <regex.h>
#include "para.h"
#include "error.h"
#include "string.h"
#include "wma.h"
#include "portable_io.h"
#include "bitstream.h"
Functions | |
void | init_vlc (struct vlc *vlc, int nb_bits, int nb_codes, const void *bits, const void *codes, int codes_size) |
Build VLC decoding tables suitable for use with get_vlc(). More... | |
void | free_vlc (struct vlc *vlc) |
Deallocate all resources of a VLC table. More... | |
int | get_vlc (struct getbit_context *gbc, const struct vlc *vlc) |
Parse a vlc code. More... | |
Bitstream API for the wma decoder.
void init_vlc | ( | struct vlc * | vlc, |
int | nb_bits, | ||
int | nb_codes, | ||
const void * | bits, | ||
const void * | codes, | ||
int | codes_size | ||
) |
Build VLC decoding tables suitable for use with get_vlc().
vlc | The structure to be initialized. |
nb_bits | Set the decoding table size (2^nb_bits) entries. |
nb_codes | Number of vlc codes. |
bits | Table which gives the size (in bits) of each vlc code. |
codes | Table which gives the bit pattern of of each vlc code. |
codes_size | The number of bytes of each entry of the codes tables. |
The bigger nb_bits is, the faster is the decoding. But it should not be too big to save memory and L1 cache. '9' is a good compromise.
The wrap and size parameters allow to use any memory configuration and types (byte/word/long) to store the bits and codes tables.
References vlc::bits, PARA_INFO_LOG, vlc::table, vlc::table_allocated, and vlc::table_size.
void free_vlc | ( | struct vlc * | vlc | ) |
Deallocate all resources of a VLC table.
vlc | Pointer to an initialized vlc structure. |
The table given by vlc must have been initialized earlier via init_vlc().
References freep(), and vlc::table.
int get_vlc | ( | struct getbit_context * | gbc, |
const struct vlc * | vlc | ||
) |
Parse a vlc code.
gbc | The getbit context structure. |
vlc | The vlc tables to use. |