#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <limits.h>
Go to the source code of this file.
Classes | |
struct | stb_vorbis_alloc |
struct | stb_vorbis_info |
struct | Codebook |
struct | Floor0 |
struct | Floor1 |
union | Floor |
struct | Residue |
struct | MappingChannel |
struct | Mapping |
struct | Mode |
struct | CRCscan |
struct | ProbedPage |
struct | stb_vorbis |
struct | Point |
union | float_conv |
Macros | |
#define | STB_VORBIS_MAX_CHANNELS 16 |
#define | STB_VORBIS_PUSHDATA_CRC_COUNT 4 |
#define | STB_VORBIS_FAST_HUFFMAN_LENGTH 10 |
#define | STB_VORBIS_FAST_HUFFMAN_SHORT |
#define | STB_VORBIS_ENDIAN 0 |
#define | __forceinline |
#define | CHECK(f) ((void) 0) |
#define | MAX_BLOCKSIZE_LOG 13 |
#define | MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG) |
#define | TRUE 1 |
#define | FALSE 0 |
#define | FAST_HUFFMAN_TABLE_SIZE (1 << STB_VORBIS_FAST_HUFFMAN_LENGTH) |
#define | FAST_HUFFMAN_TABLE_MASK (FAST_HUFFMAN_TABLE_SIZE - 1) |
#define | IS_PUSH_MODE(f) ((f)->push_mode) |
#define | array_size_required(count, size) (count*(sizeof(void *)+(size))) |
#define | temp_alloc(f, size) (f->alloc.alloc_buffer ? setup_temp_malloc(f,size) : alloca(size)) |
#define | temp_free(f, p) 0 |
#define | temp_alloc_save(f) ((f)->temp_offset) |
#define | temp_alloc_restore(f, p) ((f)->temp_offset = (p)) |
#define | temp_block_array(f, count, size) make_block_array(temp_alloc(f,array_size_required(count,size)), count, size) |
#define | CRC32_POLY 0x04c11db7 |
#define | M_PI 3.14159265358979323846264f |
#define | NO_CODE 255 |
#define | STBV_CDECL |
#define | USE_MEMORY(z) ((z)->stream) |
#define | PAGEFLAG_continued_packet 1 |
#define | PAGEFLAG_first_page 2 |
#define | PAGEFLAG_last_page 4 |
#define | EOP (-1) |
#define | INVALID_BITS (-1) |
#define | DECODE_RAW(var, f, c) |
#define | DECODE(var, f, c) |
#define | DECODE_VQ(var, f, c) DECODE_RAW(var,f,c) |
#define | CODEBOOK_ELEMENT(c, off) (c->multiplicands[off]) |
#define | CODEBOOK_ELEMENT_FAST(c, off) (c->multiplicands[off]) |
#define | CODEBOOK_ELEMENT_BASE(c) (0) |
#define | LINE_OP(a, b) a *= b |
#define | LIBVORBIS_MDCT 0 |
#define | SAMPLE_unknown 0xffffffff |
#define | PLAYBACK_MONO 1 |
#define | PLAYBACK_LEFT 2 |
#define | PLAYBACK_RIGHT 4 |
#define | L (PLAYBACK_LEFT | PLAYBACK_MONO) |
#define | C (PLAYBACK_LEFT | PLAYBACK_RIGHT | PLAYBACK_MONO) |
#define | R (PLAYBACK_RIGHT | PLAYBACK_MONO) |
#define | FASTDEF(x) float_conv x |
#define | MAGIC(SHIFT) (1.5f * (1 << (23-SHIFT)) + 0.5f/(1 << SHIFT)) |
#define | ADDEND(SHIFT) (((150-SHIFT) << 23) + (1 << 22)) |
#define | FAST_SCALED_FLOAT_TO_INT(temp, x, s) (temp.f = (x) + MAGIC(s), temp.i - ADDEND(s)) |
#define | check_endianness() |
#define | BUFFER_SIZE 32 |
#define | BUFFER_SIZE 32 |
Typedefs | |
typedef struct stb_vorbis | stb_vorbis |
typedef unsigned char | uint8 |
typedef signed char | int8 |
typedef unsigned short | uint16 |
typedef signed short | int16 |
typedef unsigned int | uint32 |
typedef signed int | int32 |
typedef float | codetype |
typedef struct stb_vorbis | vorb |
typedef int16 | YTYPE |
typedef char | stb_vorbis_float_size_test [sizeof(float)==4 &&sizeof(int)==4] |
Functions | |
stb_vorbis_info | stb_vorbis_get_info (stb_vorbis *f) |
int | stb_vorbis_get_error (stb_vorbis *f) |
void | stb_vorbis_close (stb_vorbis *f) |
int | stb_vorbis_get_sample_offset (stb_vorbis *f) |
unsigned int | stb_vorbis_get_file_offset (stb_vorbis *f) |
stb_vorbis * | stb_vorbis_open_pushdata (const unsigned char *datablock, int datablock_length_in_bytes, int *datablock_memory_consumed_in_bytes, int *error, const stb_vorbis_alloc *alloc_buffer) |
int | stb_vorbis_decode_frame_pushdata (stb_vorbis *f, const unsigned char *datablock, int datablock_length_in_bytes, int *channels, float ***output, int *samples) |
void | stb_vorbis_flush_pushdata (stb_vorbis *f) |
int | stb_vorbis_decode_filename (const char *filename, int *channels, int *sample_rate, short **output) |
int | stb_vorbis_decode_memory (const unsigned char *mem, int len, int *channels, int *sample_rate, short **output) |
stb_vorbis * | stb_vorbis_open_memory (const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc_buffer) |
stb_vorbis * | stb_vorbis_open_filename (const char *filename, int *error, const stb_vorbis_alloc *alloc_buffer) |
stb_vorbis * | stb_vorbis_open_file (FILE *f, int close_handle_on_close, int *error, const stb_vorbis_alloc *alloc_buffer) |
stb_vorbis * | stb_vorbis_open_file_section (FILE *f, int close_handle_on_close, int *error, const stb_vorbis_alloc *alloc_buffer, unsigned int len) |
int | stb_vorbis_seek_frame (stb_vorbis *f, unsigned int sample_number) |
int | stb_vorbis_seek (stb_vorbis *f, unsigned int sample_number) |
void | stb_vorbis_seek_start (stb_vorbis *f) |
unsigned int | stb_vorbis_stream_length_in_samples (stb_vorbis *f) |
float | stb_vorbis_stream_length_in_seconds (stb_vorbis *f) |
int | stb_vorbis_get_frame_float (stb_vorbis *f, int *channels, float ***output) |
int | stb_vorbis_get_frame_short_interleaved (stb_vorbis *f, int num_c, short *buffer, int num_shorts) |
int | stb_vorbis_get_frame_short (stb_vorbis *f, int num_c, short **buffer, int num_samples) |
int | stb_vorbis_get_samples_float_interleaved (stb_vorbis *f, int channels, float *buffer, int num_floats) |
int | stb_vorbis_get_samples_float (stb_vorbis *f, int channels, float **buffer, int num_samples) |
int | stb_vorbis_get_samples_short_interleaved (stb_vorbis *f, int channels, short *buffer, int num_shorts) |
int | stb_vorbis_get_samples_short (stb_vorbis *f, int channels, short **buffer, int num_samples) |
static int | error (vorb *f, enum STBVorbisError e) |
static void * | make_block_array (void *mem, int count, int size) |
static void * | setup_malloc (vorb *f, int sz) |
static void | setup_free (vorb *f, void *p) |
static void * | setup_temp_malloc (vorb *f, int sz) |
static void | setup_temp_free (vorb *f, void *p, int sz) |
static void | crc32_init (void) |
static __forceinline uint32 | crc32_update (uint32 crc, uint8 byte) |
static unsigned int | bit_reverse (unsigned int n) |
static float | square (float x) |
static int | ilog (int32 n) |
static float | float32_unpack (uint32 x) |
static void | add_entry (Codebook *c, uint32 huff_code, int symbol, int count, int len, uint32 *values) |
static int | compute_codewords (Codebook *c, uint8 *len, int n, uint32 *values) |
static void | compute_accelerated_huffman (Codebook *c) |
static int STBV_CDECL | uint32_compare (const void *p, const void *q) |
static int | include_in_sort (Codebook *c, uint8 len) |
static void | compute_sorted_huffman (Codebook *c, uint8 *lengths, uint32 *values) |
static int | vorbis_validate (uint8 *data) |
static int | lookup1_values (int entries, int dim) |
static void | compute_twiddle_factors (int n, float *A, float *B, float *C) |
static void | compute_window (int n, float *window) |
static void | compute_bitreverse (int n, uint16 *rev) |
static int | init_blocksize (vorb *f, int b, int n) |
static void | neighbors (uint16 *x, int n, int *plow, int *phigh) |
static int STBV_CDECL | point_compare (const void *p, const void *q) |
static uint8 | get8 (vorb *z) |
static uint32 | get32 (vorb *f) |
static int | getn (vorb *z, uint8 *data, int n) |
static void | skip (vorb *z, int n) |
static int | set_file_offset (stb_vorbis *f, unsigned int loc) |
static int | capture_pattern (vorb *f) |
static int | start_page_no_capturepattern (vorb *f) |
static int | start_page (vorb *f) |
static int | start_packet (vorb *f) |
static int | maybe_start_packet (vorb *f) |
static int | next_segment (vorb *f) |
static int | get8_packet_raw (vorb *f) |
static int | get8_packet (vorb *f) |
static void | flush_packet (vorb *f) |
static uint32 | get_bits (vorb *f, int n) |
static __forceinline void | prep_huffman (vorb *f) |
static int | codebook_decode_scalar_raw (vorb *f, Codebook *c) |
static int | codebook_decode_start (vorb *f, Codebook *c) |
static int | codebook_decode (vorb *f, Codebook *c, float *output, int len) |
static int | codebook_decode_step (vorb *f, Codebook *c, float *output, int len, int step) |
static int | codebook_decode_deinterleave_repeat (vorb *f, Codebook *c, float **outputs, int ch, int *c_inter_p, int *p_inter_p, int len, int total_decode) |
static int | predict_point (int x, int x0, int x1, int y0, int y1) |
static __forceinline void | draw_line (float *output, int x0, int y0, int x1, int y1, int n) |
static int | residue_decode (vorb *f, Codebook *book, float *target, int offset, int n, int rtype) |
static void | decode_residue (vorb *f, float *residue_buffers[], int ch, int n, int rn, uint8 *do_not_decode) |
static void | imdct_step3_iter0_loop (int n, float *e, int i_off, int k_off, float *A) |
static void | imdct_step3_inner_r_loop (int lim, float *e, int d0, int k_off, float *A, int k1) |
static void | imdct_step3_inner_s_loop (int n, float *e, int i_off, int k_off, float *A, int a_off, int k0) |
static __forceinline void | iter_54 (float *z) |
static void | imdct_step3_inner_s_loop_ld654 (int n, float *e, int i_off, float *A, int base_n) |
static void | inverse_mdct (float *buffer, int n, vorb *f, int blocktype) |
static float * | get_window (vorb *f, int len) |
static int | do_floor (vorb *f, Mapping *map, int i, int n, float *target, YTYPE *finalY, uint8 *step2_flag) |
static int | vorbis_decode_initial (vorb *f, int *p_left_start, int *p_left_end, int *p_right_start, int *p_right_end, int *mode) |
static int | vorbis_decode_packet_rest (vorb *f, int *len, Mode *m, int left_start, int left_end, int right_start, int right_end, int *p_left) |
static int | vorbis_decode_packet (vorb *f, int *len, int *p_left, int *p_right) |
static int | vorbis_finish_frame (stb_vorbis *f, int len, int left, int right) |
static void | vorbis_pump_first_frame (stb_vorbis *f) |
static int | is_whole_packet_present (stb_vorbis *f, int end_page) |
static int | start_decoder (vorb *f) |
static void | vorbis_deinit (stb_vorbis *p) |
static void | vorbis_init (stb_vorbis *p, const stb_vorbis_alloc *z) |
static stb_vorbis * | vorbis_alloc (stb_vorbis *f) |
static int | vorbis_search_for_page_pushdata (vorb *f, uint8 *data, int data_len) |
static uint32 | vorbis_find_page (stb_vorbis *f, uint32 *end, uint32 *last) |
static int | get_seek_page_info (stb_vorbis *f, ProbedPage *z) |
static int | go_to_page_before (stb_vorbis *f, unsigned int limit_offset) |
static int | seek_to_sample_coarse (stb_vorbis *f, uint32 sample_number) |
static int | peek_decode_initial (vorb *f, int *p_left_start, int *p_left_end, int *p_right_start, int *p_right_end, int *mode) |
static void | copy_samples (short *dest, float *src, int len) |
static void | compute_samples (int mask, short *output, int num_c, float **data, int d_offset, int len) |
static void | compute_stereo_samples (short *output, int num_c, float **data, int d_offset, int len) |
static void | convert_samples_short (int buf_c, short **buffer, int b_offset, int data_c, float **data, int d_offset, int samples) |
static void | convert_channels_short_interleaved (int buf_c, short *buffer, int data_c, float **data, int d_offset, int len) |
Variables | |
static uint32 | crc_table [256] |
static uint8 | ogg_page_header [4] = { 0x4f, 0x67, 0x67, 0x53 } |
static float | inverse_db_table [256] |
static int8 | channel_position [7][6] |
#define __forceinline |
#define ADDEND | ( | SHIFT | ) | (((150-SHIFT) << 23) + (1 << 22)) |
#define array_size_required | ( | count, | |
size | |||
) | (count*(sizeof(void *)+(size))) |
#define BUFFER_SIZE 32 |
#define BUFFER_SIZE 32 |
#define C (PLAYBACK_LEFT | PLAYBACK_RIGHT | PLAYBACK_MONO) |
#define CHECK | ( | f | ) | ((void) 0) |
#define check_endianness | ( | ) |
#define CODEBOOK_ELEMENT | ( | c, | |
off | |||
) | (c->multiplicands[off]) |
#define CODEBOOK_ELEMENT_BASE | ( | c | ) | (0) |
#define CODEBOOK_ELEMENT_FAST | ( | c, | |
off | |||
) | (c->multiplicands[off]) |
#define CRC32_POLY 0x04c11db7 |
#define DECODE | ( | var, | |
f, | |||
c | |||
) |
#define DECODE_RAW | ( | var, | |
f, | |||
c | |||
) |
#define DECODE_VQ | ( | var, | |
f, | |||
c | |||
) | DECODE_RAW(var,f,c) |
#define EOP (-1) |
#define FALSE 0 |
#define FAST_HUFFMAN_TABLE_MASK (FAST_HUFFMAN_TABLE_SIZE - 1) |
#define FAST_HUFFMAN_TABLE_SIZE (1 << STB_VORBIS_FAST_HUFFMAN_LENGTH) |
#define FASTDEF | ( | x | ) | float_conv x |
#define INVALID_BITS (-1) |
#define IS_PUSH_MODE | ( | f | ) | ((f)->push_mode) |
#define L (PLAYBACK_LEFT | PLAYBACK_MONO) |
#define LIBVORBIS_MDCT 0 |
#define LINE_OP | ( | a, | |
b | |||
) | a *= b |
#define M_PI 3.14159265358979323846264f |
#define MAGIC | ( | SHIFT | ) | (1.5f * (1 << (23-SHIFT)) + 0.5f/(1 << SHIFT)) |
#define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG) |
#define MAX_BLOCKSIZE_LOG 13 |
#define NO_CODE 255 |
#define PAGEFLAG_continued_packet 1 |
#define PAGEFLAG_first_page 2 |
#define PAGEFLAG_last_page 4 |
#define PLAYBACK_LEFT 2 |
#define PLAYBACK_MONO 1 |
#define PLAYBACK_RIGHT 4 |
#define R (PLAYBACK_RIGHT | PLAYBACK_MONO) |
#define SAMPLE_unknown 0xffffffff |
#define STB_VORBIS_ENDIAN 0 |
#define STB_VORBIS_FAST_HUFFMAN_LENGTH 10 |
#define STB_VORBIS_FAST_HUFFMAN_SHORT |
#define STB_VORBIS_MAX_CHANNELS 16 |
#define STB_VORBIS_PUSHDATA_CRC_COUNT 4 |
#define STBV_CDECL |
#define temp_alloc | ( | f, | |
size | |||
) | (f->alloc.alloc_buffer ? setup_temp_malloc(f,size) : alloca(size)) |
#define temp_alloc_restore | ( | f, | |
p | |||
) | ((f)->temp_offset = (p)) |
#define temp_alloc_save | ( | f | ) | ((f)->temp_offset) |
#define temp_block_array | ( | f, | |
count, | |||
size | |||
) | make_block_array(temp_alloc(f,array_size_required(count,size)), count, size) |
#define temp_free | ( | f, | |
p | |||
) | 0 |
#define TRUE 1 |
#define USE_MEMORY | ( | z | ) | ((z)->stream) |
typedef float codetype |
typedef signed short int16 |
typedef signed int int32 |
typedef signed char int8 |
typedef struct stb_vorbis stb_vorbis |
typedef char stb_vorbis_float_size_test[sizeof(float)==4 &&sizeof(int)==4] |
typedef unsigned short uint16 |
typedef unsigned int uint32 |
typedef unsigned char uint8 |
typedef struct stb_vorbis vorb |
enum STBVorbisError |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void stb_vorbis_close | ( | stb_vorbis * | f | ) |
int stb_vorbis_decode_filename | ( | const char * | filename, |
int * | channels, | ||
int * | sample_rate, | ||
short ** | output | ||
) |
int stb_vorbis_decode_frame_pushdata | ( | stb_vorbis * | f, |
const unsigned char * | datablock, | ||
int | datablock_length_in_bytes, | ||
int * | channels, | ||
float *** | output, | ||
int * | samples | ||
) |
int stb_vorbis_decode_memory | ( | const unsigned char * | mem, |
int | len, | ||
int * | channels, | ||
int * | sample_rate, | ||
short ** | output | ||
) |
void stb_vorbis_flush_pushdata | ( | stb_vorbis * | f | ) |
int stb_vorbis_get_error | ( | stb_vorbis * | f | ) |
unsigned int stb_vorbis_get_file_offset | ( | stb_vorbis * | f | ) |
int stb_vorbis_get_frame_float | ( | stb_vorbis * | f, |
int * | channels, | ||
float *** | output | ||
) |
int stb_vorbis_get_frame_short | ( | stb_vorbis * | f, |
int | num_c, | ||
short ** | buffer, | ||
int | num_samples | ||
) |
int stb_vorbis_get_frame_short_interleaved | ( | stb_vorbis * | f, |
int | num_c, | ||
short * | buffer, | ||
int | num_shorts | ||
) |
stb_vorbis_info stb_vorbis_get_info | ( | stb_vorbis * | f | ) |
int stb_vorbis_get_sample_offset | ( | stb_vorbis * | f | ) |
int stb_vorbis_get_samples_float | ( | stb_vorbis * | f, |
int | channels, | ||
float ** | buffer, | ||
int | num_samples | ||
) |
int stb_vorbis_get_samples_float_interleaved | ( | stb_vorbis * | f, |
int | channels, | ||
float * | buffer, | ||
int | num_floats | ||
) |
int stb_vorbis_get_samples_short | ( | stb_vorbis * | f, |
int | channels, | ||
short ** | buffer, | ||
int | num_samples | ||
) |
int stb_vorbis_get_samples_short_interleaved | ( | stb_vorbis * | f, |
int | channels, | ||
short * | buffer, | ||
int | num_shorts | ||
) |
stb_vorbis * stb_vorbis_open_file | ( | FILE * | f, |
int | close_handle_on_close, | ||
int * | error, | ||
const stb_vorbis_alloc * | alloc_buffer | ||
) |
stb_vorbis * stb_vorbis_open_file_section | ( | FILE * | f, |
int | close_handle_on_close, | ||
int * | error, | ||
const stb_vorbis_alloc * | alloc_buffer, | ||
unsigned int | len | ||
) |
stb_vorbis * stb_vorbis_open_filename | ( | const char * | filename, |
int * | error, | ||
const stb_vorbis_alloc * | alloc_buffer | ||
) |
stb_vorbis * stb_vorbis_open_memory | ( | const unsigned char * | data, |
int | len, | ||
int * | error, | ||
const stb_vorbis_alloc * | alloc_buffer | ||
) |
stb_vorbis * stb_vorbis_open_pushdata | ( | const unsigned char * | datablock, |
int | datablock_length_in_bytes, | ||
int * | datablock_memory_consumed_in_bytes, | ||
int * | error, | ||
const stb_vorbis_alloc * | alloc_buffer | ||
) |
int stb_vorbis_seek | ( | stb_vorbis * | f, |
unsigned int | sample_number | ||
) |
int stb_vorbis_seek_frame | ( | stb_vorbis * | f, |
unsigned int | sample_number | ||
) |
void stb_vorbis_seek_start | ( | stb_vorbis * | f | ) |
unsigned int stb_vorbis_stream_length_in_samples | ( | stb_vorbis * | f | ) |
float stb_vorbis_stream_length_in_seconds | ( | stb_vorbis * | f | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |