#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.
|
#define | STB_VORBIS_INCLUDE_STB_VORBIS_H |
|
#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 |
|
|
enum | STBVorbisError {
VORBIS__no_error,
VORBIS_need_more_data =1,
VORBIS_invalid_api_mixing,
VORBIS_outofmem,
VORBIS_feature_not_supported,
VORBIS_too_many_channels,
VORBIS_file_open_failure,
VORBIS_seek_without_length,
VORBIS_unexpected_eof =10,
VORBIS_seek_invalid,
VORBIS_invalid_setup =20,
VORBIS_invalid_stream,
VORBIS_missing_capture_pattern =30,
VORBIS_invalid_stream_structure_version,
VORBIS_continued_packet_flag_invalid,
VORBIS_incorrect_stream_serial_number,
VORBIS_invalid_first_page,
VORBIS_bad_packet_type,
VORBIS_cant_find_last_page,
VORBIS_seek_failed
} |
|
enum | { VORBIS_packet_id = 1,
VORBIS_packet_comment = 3,
VORBIS_packet_setup = 5
} |
|
|
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) |
|
int | 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 int | 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) |
|
◆ __forceinline
◆ ADDEND
#define ADDEND |
( |
|
SHIFT | ) |
(((150-SHIFT) << 23) + (1 << 22)) |
◆ array_size_required
#define array_size_required |
( |
|
count, |
|
|
|
size |
|
) |
| (count*(sizeof(void *)+(size))) |
◆ BUFFER_SIZE [1/2]
◆ BUFFER_SIZE [2/2]
◆ CHECK
#define CHECK |
( |
|
f | ) |
((void) 0) |
◆ check_endianness
#define check_endianness |
( |
| ) |
|
◆ CODEBOOK_ELEMENT
#define CODEBOOK_ELEMENT |
( |
|
c, |
|
|
|
off |
|
) |
| (c->multiplicands[off]) |
◆ CODEBOOK_ELEMENT_BASE
#define CODEBOOK_ELEMENT_BASE |
( |
|
c | ) |
(0) |
◆ CODEBOOK_ELEMENT_FAST
#define CODEBOOK_ELEMENT_FAST |
( |
|
c, |
|
|
|
off |
|
) |
| (c->multiplicands[off]) |
◆ CRC32_POLY
#define CRC32_POLY 0x04c11db7 |
◆ DECODE
#define DECODE |
( |
|
var, |
|
|
|
f, |
|
|
|
c |
|
) |
| |
Value:
if (c->sparse) var = c->sorted_values[var];
Definition at line 1697 of file stb_vorbis.c.
◆ DECODE_RAW
#define DECODE_RAW |
( |
|
var, |
|
|
|
f, |
|
|
|
c |
|
) |
| |
Value:
prep_huffman(f); \
var = c->fast_huffman[var]; \
if (var >= 0) { \
int n = c->codeword_lengths[var]; \
f->acc >>= n; \
f->valid_bits -= n; \
if (f->valid_bits < 0) { f->valid_bits = 0; var = -1; } \
} else { \
}
Definition at line 1660 of file stb_vorbis.c.
◆ DECODE_VQ
#define DECODE_VQ |
( |
|
var, |
|
|
|
f, |
|
|
|
c |
|
) |
| DECODE_RAW(var,f,c) |
◆ EOP
◆ FALSE
◆ FAST_HUFFMAN_TABLE_MASK
◆ FAST_HUFFMAN_TABLE_SIZE
◆ FAST_SCALED_FLOAT_TO_INT
◆ FASTDEF
◆ INVALID_BITS
#define INVALID_BITS (-1) |
◆ IS_PUSH_MODE
#define IS_PUSH_MODE |
( |
|
f | ) |
((f)->push_mode) |
◆ LIBVORBIS_MDCT
◆ LINE_OP
#define LINE_OP |
( |
|
a, |
|
|
|
b |
|
) |
| a *= b |
◆ M_PI
#define M_PI 3.14159265358979323846264f |
◆ MAGIC
#define MAGIC |
( |
|
SHIFT | ) |
(1.5f * (1 << (23-SHIFT)) + 0.5f/(1 << SHIFT)) |
◆ MAX_BLOCKSIZE
◆ MAX_BLOCKSIZE_LOG
#define MAX_BLOCKSIZE_LOG 13 |
◆ NO_CODE
◆ PAGEFLAG_continued_packet
#define PAGEFLAG_continued_packet 1 |
◆ PAGEFLAG_first_page
#define PAGEFLAG_first_page 2 |
◆ PAGEFLAG_last_page
#define PAGEFLAG_last_page 4 |
◆ PLAYBACK_LEFT
◆ PLAYBACK_MONO
◆ PLAYBACK_RIGHT
◆ SAMPLE_unknown
#define SAMPLE_unknown 0xffffffff |
◆ STB_VORBIS_ENDIAN
#define STB_VORBIS_ENDIAN 0 |
◆ STB_VORBIS_FAST_HUFFMAN_LENGTH
#define STB_VORBIS_FAST_HUFFMAN_LENGTH 10 |
◆ STB_VORBIS_FAST_HUFFMAN_SHORT
#define STB_VORBIS_FAST_HUFFMAN_SHORT |
◆ STB_VORBIS_INCLUDE_STB_VORBIS_H
#define STB_VORBIS_INCLUDE_STB_VORBIS_H |
◆ STB_VORBIS_MAX_CHANNELS
#define STB_VORBIS_MAX_CHANNELS 16 |
◆ STB_VORBIS_PUSHDATA_CRC_COUNT
#define STB_VORBIS_PUSHDATA_CRC_COUNT 4 |
◆ STBV_CDECL
◆ temp_alloc
#define temp_alloc |
( |
|
f, |
|
|
|
size |
|
) |
| (f->alloc.alloc_buffer ? setup_temp_malloc(f,size) : alloca(size)) |
◆ temp_alloc_restore
#define temp_alloc_restore |
( |
|
f, |
|
|
|
p |
|
) |
| ((f)->temp_offset = (p)) |
◆ temp_alloc_save
#define temp_alloc_save |
( |
|
f | ) |
((f)->temp_offset) |
◆ temp_block_array
◆ temp_free
#define temp_free |
( |
|
f, |
|
|
|
p |
|
) |
| 0 |
◆ TRUE
◆ USE_MEMORY
#define USE_MEMORY |
( |
|
z | ) |
((z)->stream) |
◆ codetype
◆ int16
typedef signed short int16 |
◆ int32
◆ int8
◆ stb_vorbis
◆ stb_vorbis_float_size_test
typedef char stb_vorbis_float_size_test[sizeof(float)==4 &&sizeof(int)==4] |
◆ uint16
◆ uint32
◆ uint8
typedef unsigned char uint8 |
◆ vorb
◆ YTYPE
◆ anonymous enum
Enumerator |
---|
VORBIS_packet_id | |
VORBIS_packet_comment | |
VORBIS_packet_setup | |
Definition at line 1592 of file stb_vorbis.c.
◆ STBVorbisError
Enumerator |
---|
VORBIS__no_error | |
VORBIS_need_more_data | |
VORBIS_invalid_api_mixing | |
VORBIS_outofmem | |
VORBIS_feature_not_supported | |
VORBIS_too_many_channels | |
VORBIS_file_open_failure | |
VORBIS_seek_without_length | |
VORBIS_unexpected_eof | |
VORBIS_seek_invalid | |
VORBIS_invalid_setup | |
VORBIS_invalid_stream | |
VORBIS_missing_capture_pattern | |
VORBIS_invalid_stream_structure_version | |
VORBIS_continued_packet_flag_invalid | |
VORBIS_incorrect_stream_serial_number | |
VORBIS_invalid_first_page | |
VORBIS_bad_packet_type | |
VORBIS_cant_find_last_page | |
VORBIS_seek_failed | |
Definition at line 342 of file stb_vorbis.c.
◆ add_entry()
◆ bit_reverse()
static unsigned int bit_reverse |
( |
unsigned int |
n | ) |
|
|
static |
◆ capture_pattern()
static int capture_pattern |
( |
vorb * |
f | ) |
|
|
static |
◆ codebook_decode()
Definition at line 1738 of file stb_vorbis.c.
1744 #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK
1748 for (
i=0;
i < len; ++
i) {
1762 for (
i=0;
i < len; ++
i) {
1769 for (
i=0;
i < len; ++
i) {
Referenced by residue_decode().
◆ codebook_decode_deinterleave_repeat()
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 |
Definition at line 1808 of file stb_vorbis.c.
1810 int c_inter = *c_inter_p;
1811 int p_inter = *p_inter_p;
1817 while (total_decode > 0) {
1820 #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK
1821 assert(!c->
sparse || z < c->sorted_entries);
1833 if (c_inter + p_inter*ch + effective > len * ch) {
1834 effective = len*ch - (p_inter*ch - c_inter);
1837 #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK
1840 for (
i=0;
i < effective; ++
i) {
1843 if (outputs[c_inter])
1844 outputs[c_inter][p_inter] += val;
1845 if (++c_inter == ch) { c_inter = 0; ++p_inter; }
1854 for (
i=0;
i < effective; ++
i) {
1856 if (outputs[c_inter])
1857 outputs[c_inter][p_inter] += val;
1858 if (++c_inter == ch) { c_inter = 0; ++p_inter; }
1862 for (
i=0;
i < effective; ++
i) {
1864 if (outputs[c_inter])
1865 outputs[c_inter][p_inter] += val;
1866 if (++c_inter == ch) { c_inter = 0; ++p_inter; }
1871 total_decode -= effective;
1873 *c_inter_p = c_inter;
1874 *p_inter_p = p_inter;
Referenced by decode_residue().
◆ codebook_decode_scalar_raw()
◆ codebook_decode_start()
◆ codebook_decode_step()
Definition at line 1777 of file stb_vorbis.c.
1784 #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK
1787 for (
i=0;
i < len; ++
i) {
1790 output[
i*step] += val;
1799 for (
i=0;
i < len; ++
i) {
1801 output[
i*step] += val;
Referenced by residue_decode().
◆ compute_accelerated_huffman()
◆ compute_bitreverse()
◆ compute_codewords()
Definition at line 1042 of file stb_vorbis.c.
1047 memset(available, 0,
sizeof(available));
1049 for (k=0; k < n; ++k)
if (len[k] <
NO_CODE)
break;
1054 for (
i=1;
i <= len[k]; ++
i)
1055 available[
i] = 1
U << (32-
i);
1060 for (
i=k+1;
i < n; ++
i) {
1070 while (
z > 0 && !available[
z]) --
z;
1071 if (
z == 0) {
return FALSE; }
1073 assert(
z >= 0 &&
z < 32);
1078 assert(len[
i] >= 0 && len[
i] < 32);
1079 for (
y=len[
i];
y >
z; --
y) {
1080 assert(available[
y] == 0);
1081 available[
y] = res + (1 << (32-
y));
Referenced by start_decoder().
◆ compute_samples()
static void compute_samples |
( |
int |
mask, |
|
|
short * |
output, |
|
|
int |
num_c, |
|
|
float ** |
data, |
|
|
int |
d_offset, |
|
|
int |
len |
|
) |
| |
|
static |
Definition at line 5049 of file stb_vorbis.c.
5051 #define BUFFER_SIZE 32
5057 if (o + n > len) n = len - o;
5058 for (
j=0;
j < num_c; ++
j) {
5060 for (
i=0;
i < n; ++
i)
5064 for (
i=0;
i < n; ++
i) {
5067 if ((
unsigned int) (
v + 32768) > 65535)
5068 v =
v < 0 ? -32768 : 32767;
Referenced by convert_samples_short().
◆ compute_sorted_huffman()
◆ compute_stereo_samples()
static void compute_stereo_samples |
( |
short * |
output, |
|
|
int |
num_c, |
|
|
float ** |
data, |
|
|
int |
d_offset, |
|
|
int |
len |
|
) |
| |
|
static |
Definition at line 5074 of file stb_vorbis.c.
5076 #define BUFFER_SIZE 32
5081 for (o = 0; o < len; o += BUFFER_SIZE >> 1) {
5085 if (o + n > len) n = len - o;
5086 for (
j=0;
j < num_c; ++
j) {
5089 for (
i=0;
i < n; ++
i) {
5094 for (
i=0;
i < n; ++
i) {
5098 for (
i=0;
i < n; ++
i) {
5103 for (
i=0;
i < (n<<1); ++
i) {
5106 if ((
unsigned int) (
v + 32768) > 65535)
5107 v =
v < 0 ? -32768 : 32767;
Referenced by convert_channels_short_interleaved().
◆ compute_twiddle_factors()
static void compute_twiddle_factors |
( |
int |
n, |
|
|
float * |
A, |
|
|
float * |
B, |
|
|
float * |
C |
|
) |
| |
|
static |
Definition at line 1208 of file stb_vorbis.c.
1210 int n4 = n >> 2, n8 = n >> 3;
1213 for (k=k2=0; k < n4; ++k,k2+=2) {
1214 A[k2 ] = (float) cos(4*k*
M_PI/n);
1215 A[k2+1] = (float) -sin(4*k*
M_PI/n);
1216 B[k2 ] = (float) cos((k2+1)*
M_PI/n/2) * 0.5f;
1217 B[k2+1] = (float) sin((k2+1)*
M_PI/n/2) * 0.5f;
1219 for (k=k2=0; k < n8; ++k,k2+=2) {
1220 C[k2 ] = (float) cos(2*(k2+1)*
M_PI/n);
1221 C[k2+1] = (float) -sin(2*(k2+1)*
M_PI/n);
Referenced by init_blocksize().
◆ compute_window()
static void compute_window |
( |
int |
n, |
|
|
float * |
window |
|
) |
| |
|
static |
◆ convert_channels_short_interleaved()
static void convert_channels_short_interleaved |
( |
int |
buf_c, |
|
|
short * |
buffer, |
|
|
int |
data_c, |
|
|
float ** |
data, |
|
|
int |
d_offset, |
|
|
int |
len |
|
) |
| |
|
static |
◆ convert_samples_short()
static void convert_samples_short |
( |
int |
buf_c, |
|
|
short ** |
buffer, |
|
|
int |
b_offset, |
|
|
int |
data_c, |
|
|
float ** |
data, |
|
|
int |
d_offset, |
|
|
int |
samples |
|
) |
| |
|
static |
◆ copy_samples()
static void copy_samples |
( |
short * |
dest, |
|
|
float * |
src, |
|
|
int |
len |
|
) |
| |
|
static |
◆ crc32_init()
◆ crc32_update()
◆ decode_residue()
static void decode_residue |
( |
vorb * |
f, |
|
|
float * |
residue_buffers[], |
|
|
int |
ch, |
|
|
int |
n, |
|
|
int |
rn, |
|
|
uint8 * |
do_not_decode |
|
) |
| |
|
static |
Definition at line 2045 of file stb_vorbis.c.
2050 int c =
r->classbook;
2052 int n_read =
r->end -
r->begin;
2053 int part_read = n_read /
r->part_size;
2055 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2063 for (
i=0;
i < ch; ++
i)
2064 if (!do_not_decode[
i])
2065 memset(residue_buffers[
i], 0,
sizeof(
float) * n);
2067 if (rtype == 2 && ch != 1) {
2068 for (
j=0;
j < ch; ++
j)
2069 if (!do_not_decode[
j])
2074 for (pass=0; pass < 8; ++pass) {
2075 int pcount = 0, class_set = 0;
2077 while (pcount < part_read) {
2078 int z =
r->begin + pcount*
r->part_size;
2079 int c_inter = (
z & 1), p_inter =
z>>1;
2084 if (
q ==
EOP)
goto done;
2085 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2086 part_classdata[0][class_set] =
r->classdata[
q];
2088 for (
i=classwords-1;
i >= 0; --
i) {
2089 classifications[0][
i+pcount] =
q %
r->classifications;
2090 q /=
r->classifications;
2094 for (
i=0;
i < classwords && pcount < part_read; ++
i, ++pcount) {
2095 int z =
r->begin + pcount*
r->part_size;
2096 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2097 int c = part_classdata[0][class_set][
i];
2099 int c = classifications[0][pcount];
2101 int b =
r->residue_books[c][pass];
2104 #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK
2118 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2122 }
else if (ch == 1) {
2123 while (pcount < part_read) {
2124 int z =
r->begin + pcount*
r->part_size;
2125 int c_inter = 0, p_inter =
z;
2130 if (
q ==
EOP)
goto done;
2131 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2132 part_classdata[0][class_set] =
r->classdata[
q];
2134 for (
i=classwords-1;
i >= 0; --
i) {
2135 classifications[0][
i+pcount] =
q %
r->classifications;
2136 q /=
r->classifications;
2140 for (
i=0;
i < classwords && pcount < part_read; ++
i, ++pcount) {
2141 int z =
r->begin + pcount*
r->part_size;
2142 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2143 int c = part_classdata[0][class_set][
i];
2145 int c = classifications[0][pcount];
2147 int b =
r->residue_books[c][pass];
2158 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2163 while (pcount < part_read) {
2164 int z =
r->begin + pcount*
r->part_size;
2165 int c_inter =
z % ch, p_inter =
z/ch;
2170 if (
q ==
EOP)
goto done;
2171 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2172 part_classdata[0][class_set] =
r->classdata[
q];
2174 for (
i=classwords-1;
i >= 0; --
i) {
2175 classifications[0][
i+pcount] =
q %
r->classifications;
2176 q /=
r->classifications;
2180 for (
i=0;
i < classwords && pcount < part_read; ++
i, ++pcount) {
2181 int z =
r->begin + pcount*
r->part_size;
2182 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2183 int c = part_classdata[0][class_set][
i];
2185 int c = classifications[0][pcount];
2187 int b =
r->residue_books[c][pass];
2198 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2208 for (pass=0; pass < 8; ++pass) {
2209 int pcount = 0, class_set=0;
2210 while (pcount < part_read) {
2212 for (
j=0;
j < ch; ++
j) {
2213 if (!do_not_decode[
j]) {
2217 if (temp ==
EOP)
goto done;
2218 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2219 part_classdata[
j][class_set] =
r->classdata[temp];
2221 for (
i=classwords-1;
i >= 0; --
i) {
2222 classifications[
j][
i+pcount] = temp %
r->classifications;
2223 temp /=
r->classifications;
2229 for (
i=0;
i < classwords && pcount < part_read; ++
i, ++pcount) {
2230 for (
j=0;
j < ch; ++
j) {
2231 if (!do_not_decode[
j]) {
2232 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2233 int c = part_classdata[
j][class_set][
i];
2235 int c = classifications[
j][pcount];
2237 int b =
r->residue_books[c][pass];
2239 float *
target = residue_buffers[
j];
2240 int offset =
r->begin + pcount *
r->part_size;
2241 int n =
r->part_size;
2249 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
2256 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
Referenced by vorbis_decode_packet_rest().
◆ do_floor()
◆ draw_line()
Definition at line 1977 of file stb_vorbis.c.
1987 #ifdef STB_VORBIS_DIVIDE_TABLE
1988 if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) {
1990 base = -integer_divide_table[ady][adx];
1993 base = integer_divide_table[ady][adx];
2010 ady -= abs(base) * adx;
2014 for (++
x;
x < x1; ++
x) {
Referenced by do_floor().
◆ error()
Definition at line 865 of file stb_vorbis.c.
Referenced by codebook_decode_deinterleave_repeat(), codebook_decode_scalar_raw(), codebook_decode_start(), do_floor(), DSoundError(), init_blocksize(), is_whole_packet_present(), maybe_start_packet(), next_segment(), seek_to_sample_coarse(), start_decoder(), start_packet(), start_page(), start_page_no_capturepattern(), stb_vorbis_decode_filename(), stb_vorbis_decode_frame_pushdata(), stb_vorbis_decode_memory(), stb_vorbis_get_frame_float(), stb_vorbis_open_file(), stb_vorbis_open_file_section(), stb_vorbis_open_filename(), stb_vorbis_open_memory(), stb_vorbis_open_pushdata(), stb_vorbis_seek_frame(), stb_vorbis_seek_start(), stb_vorbis_stream_length_in_samples(), Sys_Error(), vorbis_decode_initial(), and vorbis_decode_packet_rest().
◆ float32_unpack()
static float float32_unpack |
( |
uint32 |
x | ) |
|
|
static |
Definition at line 1013 of file stb_vorbis.c.
1016 uint32 mantissa =
x & 0x1fffff;
1018 uint32 exp = (
x & 0x7fe00000) >> 21;
1019 double res = sign ? -(double)mantissa : (
double)mantissa;
1020 return (
float) ldexp((
float)res, exp-788);
Referenced by start_decoder().
◆ flush_packet()
◆ get32()
◆ get8()
◆ get8_packet()
◆ get8_packet_raw()
static int get8_packet_raw |
( |
vorb * |
f | ) |
|
|
static |
◆ get_bits()
◆ get_seek_page_info()
Definition at line 4528 of file stb_vorbis.c.
4530 uint8 header[27], lacing[255];
4537 getn(f, header, 27);
4538 if (header[0] !=
'O' || header[1] !=
'g' || header[2] !=
'g' || header[3] !=
'S')
4540 getn(f, lacing, header[26]);
4544 for (
i=0;
i < header[26]; ++
i)
4548 z->page_end =
z->page_start + 27 + header[26] + len;
4551 z->last_decoded_sample = header[6] + (header[7] << 8) + (header[8] << 16) + (header[9] << 24);
Referenced by seek_to_sample_coarse().
◆ get_window()
static float* get_window |
( |
vorb * |
f, |
|
|
int |
len |
|
) |
| |
|
static |
◆ getn()
◆ go_to_page_before()
◆ ilog()
Definition at line 983 of file stb_vorbis.c.
985 static signed char log2_4[16] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4 };
991 if (n < (1 << 4))
return 0 + log2_4[n ];
992 else if (n < (1 << 9))
return 5 + log2_4[n >> 5];
993 else return 10 + log2_4[n >> 10];
994 else if (n < (1 << 24))
995 if (n < (1 << 19))
return 15 + log2_4[n >> 15];
996 else return 20 + log2_4[n >> 20];
997 else if (n < (1 << 29))
return 25 + log2_4[n >> 25];
998 else return 30 + log2_4[n >> 30];
Referenced by compute_bitreverse(), inverse_mdct(), peek_decode_initial(), start_decoder(), vorbis_decode_initial(), and vorbis_decode_packet_rest().
◆ imdct_step3_inner_r_loop()
static void imdct_step3_inner_r_loop |
( |
int |
lim, |
|
|
float * |
e, |
|
|
int |
d0, |
|
|
int |
k_off, |
|
|
float * |
A, |
|
|
int |
k1 |
|
) |
| |
|
static |
Definition at line 2431 of file stb_vorbis.c.
2434 float k00_20, k01_21;
2437 float *e2 = e0 + k_off;
2439 for (
i=lim >> 2;
i > 0; --
i) {
2440 k00_20 = e0[-0] - e2[-0];
2441 k01_21 = e0[-1] - e2[-1];
2444 e2[-0] = (k00_20)*
A[0] - (k01_21) *
A[1];
2445 e2[-1] = (k01_21)*
A[0] + (k00_20) *
A[1];
2449 k00_20 = e0[-2] - e2[-2];
2450 k01_21 = e0[-3] - e2[-3];
2453 e2[-2] = (k00_20)*
A[0] - (k01_21) *
A[1];
2454 e2[-3] = (k01_21)*
A[0] + (k00_20) *
A[1];
2458 k00_20 = e0[-4] - e2[-4];
2459 k01_21 = e0[-5] - e2[-5];
2462 e2[-4] = (k00_20)*
A[0] - (k01_21) *
A[1];
2463 e2[-5] = (k01_21)*
A[0] + (k00_20) *
A[1];
2467 k00_20 = e0[-6] - e2[-6];
2468 k01_21 = e0[-7] - e2[-7];
2471 e2[-6] = (k00_20)*
A[0] - (k01_21) *
A[1];
2472 e2[-7] = (k01_21)*
A[0] + (k00_20) *
A[1];
Referenced by inverse_mdct().
◆ imdct_step3_inner_s_loop()
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 |
Definition at line 2481 of file stb_vorbis.c.
2486 float A2 =
A[0+a_off];
2487 float A3 =
A[0+a_off+1];
2488 float A4 =
A[0+a_off*2+0];
2489 float A5 =
A[0+a_off*2+1];
2490 float A6 =
A[0+a_off*3+0];
2491 float A7 =
A[0+a_off*3+1];
2495 float *ee0 = e +i_off;
2496 float *ee2 = ee0+k_off;
2498 for (
i=n;
i > 0; --
i) {
2499 k00 = ee0[ 0] - ee2[ 0];
2500 k11 = ee0[-1] - ee2[-1];
2501 ee0[ 0] = ee0[ 0] + ee2[ 0];
2502 ee0[-1] = ee0[-1] + ee2[-1];
2503 ee2[ 0] = (k00) * A0 - (k11) * A1;
2504 ee2[-1] = (k11) * A0 + (k00) * A1;
2506 k00 = ee0[-2] - ee2[-2];
2507 k11 = ee0[-3] - ee2[-3];
2508 ee0[-2] = ee0[-2] + ee2[-2];
2509 ee0[-3] = ee0[-3] + ee2[-3];
2510 ee2[-2] = (k00) * A2 - (k11) * A3;
2511 ee2[-3] = (k11) * A2 + (k00) * A3;
2513 k00 = ee0[-4] - ee2[-4];
2514 k11 = ee0[-5] - ee2[-5];
2515 ee0[-4] = ee0[-4] + ee2[-4];
2516 ee0[-5] = ee0[-5] + ee2[-5];
2517 ee2[-4] = (k00) * A4 - (k11) * A5;
2518 ee2[-5] = (k11) * A4 + (k00) * A5;
2520 k00 = ee0[-6] - ee2[-6];
2521 k11 = ee0[-7] - ee2[-7];
2522 ee0[-6] = ee0[-6] + ee2[-6];
2523 ee0[-7] = ee0[-7] + ee2[-7];
2524 ee2[-6] = (k00) * A6 - (k11) * A7;
2525 ee2[-7] = (k11) * A6 + (k00) * A7;
Referenced by inverse_mdct().
◆ imdct_step3_inner_s_loop_ld654()
static void imdct_step3_inner_s_loop_ld654 |
( |
int |
n, |
|
|
float * |
e, |
|
|
int |
i_off, |
|
|
float * |
A, |
|
|
int |
base_n |
|
) |
| |
|
static |
Definition at line 2564 of file stb_vorbis.c.
2566 int a_off = base_n >> 3;
2567 float A2 =
A[0+a_off];
2568 float *
z = e + i_off;
2569 float *base =
z - 16 * n;
2574 k00 =
z[-0] -
z[-8];
2575 k11 =
z[-1] -
z[-9];
2576 z[-0] =
z[-0] +
z[-8];
2577 z[-1] =
z[-1] +
z[-9];
2581 k00 =
z[ -2] -
z[-10];
2582 k11 =
z[ -3] -
z[-11];
2583 z[ -2] =
z[ -2] +
z[-10];
2584 z[ -3] =
z[ -3] +
z[-11];
2585 z[-10] = (k00+k11) * A2;
2586 z[-11] = (k11-k00) * A2;
2588 k00 =
z[-12] -
z[ -4];
2589 k11 =
z[ -5] -
z[-13];
2590 z[ -4] =
z[ -4] +
z[-12];
2591 z[ -5] =
z[ -5] +
z[-13];
2595 k00 =
z[-14] -
z[ -6];
2596 k11 =
z[ -7] -
z[-15];
2597 z[ -6] =
z[ -6] +
z[-14];
2598 z[ -7] =
z[ -7] +
z[-15];
2599 z[-14] = (k00+k11) * A2;
2600 z[-15] = (k00-k11) * A2;
Referenced by inverse_mdct().
◆ imdct_step3_iter0_loop()
static void imdct_step3_iter0_loop |
( |
int |
n, |
|
|
float * |
e, |
|
|
int |
i_off, |
|
|
int |
k_off, |
|
|
float * |
A |
|
) |
| |
|
static |
Definition at line 2386 of file stb_vorbis.c.
2388 float *ee0 = e + i_off;
2389 float *ee2 = ee0 + k_off;
2392 assert((n & 3) == 0);
2393 for (
i=(n>>2);
i > 0; --
i) {
2394 float k00_20, k01_21;
2395 k00_20 = ee0[ 0] - ee2[ 0];
2396 k01_21 = ee0[-1] - ee2[-1];
2399 ee2[ 0] = k00_20 *
A[0] - k01_21 *
A[1];
2400 ee2[-1] = k01_21 *
A[0] + k00_20 *
A[1];
2403 k00_20 = ee0[-2] - ee2[-2];
2404 k01_21 = ee0[-3] - ee2[-3];
2407 ee2[-2] = k00_20 *
A[0] - k01_21 *
A[1];
2408 ee2[-3] = k01_21 *
A[0] + k00_20 *
A[1];
2411 k00_20 = ee0[-4] - ee2[-4];
2412 k01_21 = ee0[-5] - ee2[-5];
2415 ee2[-4] = k00_20 *
A[0] - k01_21 *
A[1];
2416 ee2[-5] = k01_21 *
A[0] + k00_20 *
A[1];
2419 k00_20 = ee0[-6] - ee2[-6];
2420 k01_21 = ee0[-7] - ee2[-7];
2423 ee2[-6] = k00_20 *
A[0] - k01_21 *
A[1];
2424 ee2[-7] = k01_21 *
A[0] + k00_20 *
A[1];
Referenced by inverse_mdct().
◆ include_in_sort()
◆ init_blocksize()
◆ inverse_mdct()
static void inverse_mdct |
( |
float * |
buffer, |
|
|
int |
n, |
|
|
vorb * |
f, |
|
|
int |
blocktype |
|
) |
| |
|
static |
Definition at line 2608 of file stb_vorbis.c.
2610 int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, l;
2614 float *buf2 = (
float *)
temp_alloc(f, n2 *
sizeof(*buf2));
2617 float *
A = f->
A[blocktype];
2639 float *d,*e, *
AA, *e_stop;
2644 while (e != e_stop) {
2645 d[1] = (e[0] *
AA[0] - e[2]*
AA[1]);
2646 d[0] = (e[0] *
AA[1] + e[2]*
AA[0]);
2654 d[1] = (-e[2] *
AA[0] - -e[0]*
AA[1]);
2655 d[0] = (-e[2] *
AA[1] + -e[0]*
AA[0]);
2673 float *
AA = &
A[n2-8];
2674 float *d0,*d1, *e0, *e1;
2683 float v40_20, v41_21;
2685 v41_21 = e0[1] - e1[1];
2686 v40_20 = e0[0] - e1[0];
2687 d0[1] = e0[1] + e1[1];
2688 d0[0] = e0[0] + e1[0];
2689 d1[1] = v41_21*
AA[4] - v40_20*
AA[5];
2690 d1[0] = v40_20*
AA[4] + v41_21*
AA[5];
2692 v41_21 = e0[3] - e1[3];
2693 v40_20 = e0[2] - e1[2];
2694 d0[3] = e0[3] + e1[3];
2695 d0[2] = e0[2] + e1[2];
2696 d1[3] = v41_21*
AA[0] - v40_20*
AA[1];
2697 d1[2] = v40_20*
AA[0] + v41_21*
AA[1];
2729 for (; l < (ld-3)>>1; ++l) {
2730 int k0 = n >> (l+2), k0_2 = k0>>1;
2731 int lim = 1 << (l+1);
2733 for (
i=0;
i < lim; ++
i)
2737 for (; l < ld-6; ++l) {
2738 int k0 = n >> (l+2), k1 = 1 << (l+3), k0_2 = k0>>1;
2739 int rlim = n >> (l+6),
r;
2740 int lim = 1 << (l+1);
2744 for (
r=rlim;
r > 0; --
r) {
2769 float *d0 = &
v[n4-4];
2770 float *d1 = &
v[n2-4];
2800 float *
C = f->
C[blocktype];
2807 float a02,a11,b0,b1,b2,b3;
2812 b0 =
C[1]*a02 +
C[0]*a11;
2813 b1 =
C[1]*a11 -
C[0]*a02;
2826 b0 =
C[3]*a02 +
C[2]*a11;
2827 b1 =
C[3]*a11 -
C[2]*a02;
2854 float *d0,*d1,*d2,*d3;
2856 float *
B = f->
B[blocktype] + n2 - 8;
2857 float *e = buf2 + n2 - 8;
2865 p3 = e[6]*
B[7] - e[7]*
B[6];
2866 p2 = -e[6]*
B[6] - e[7]*
B[7];
2873 p1 = e[4]*
B[5] - e[5]*
B[4];
2874 p0 = -e[4]*
B[4] - e[5]*
B[5];
2881 p3 = e[2]*
B[3] - e[3]*
B[2];
2882 p2 = -e[2]*
B[2] - e[3]*
B[3];
2889 p1 = e[0]*
B[1] - e[1]*
B[0];
2890 p0 = -e[0]*
B[0] - e[1]*
B[1];
Referenced by vorbis_decode_packet_rest().
◆ is_whole_packet_present()
◆ iter_54()
◆ lookup1_values()
static int lookup1_values |
( |
int |
entries, |
|
|
int |
dim |
|
) |
| |
|
static |
Definition at line 1197 of file stb_vorbis.c.
1199 int r = (
int) floor(exp((
float) log((
float) entries) / dim));
1200 if ((
int) floor(pow((
float)
r+1, dim)) <= entries)
1202 assert(pow((
float)
r+1, dim) > entries);
1203 assert((
int) floor(pow((
float)
r, dim)) <= entries);
Referenced by start_decoder().
◆ make_block_array()
Definition at line 894 of file stb_vorbis.c.
897 void ** p = (
void **) mem;
898 char *
q = (
char *) (p +
count);
◆ maybe_start_packet()
static int maybe_start_packet |
( |
vorb * |
f | ) |
|
|
static |
◆ neighbors()
◆ next_segment()
static int next_segment |
( |
vorb * |
f | ) |
|
|
static |
◆ peek_decode_initial()
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 |
◆ point_compare()
◆ predict_point()
◆ prep_huffman()
◆ residue_decode()
◆ seek_to_sample_coarse()
Definition at line 4585 of file stb_vorbis.c.
4588 int i, start_seg_with_known_loc, end_pos, page_start;
4589 uint32 delta, stream_length, padding;
4590 double offset = 0, bytes_per_sample = 0;
4602 if (sample_number < padding)
4605 sample_number -= padding;
4615 assert(
right.last_decoded_sample != ~0
U);
4628 if (delta <= 65536) {
4636 bytes_per_sample = data_bytes /
right.last_decoded_sample;
4642 if (error < 0 && error > -8000)
error = -8000;
4643 offset +=
error * 2;
4649 if (offset >
right.page_start - 65536)
4650 offset =
right.page_start - 65536;
4688 assert(end_pos >= 0);
4691 for (
i = end_pos;
i > 0; --
i)
4695 start_seg_with_known_loc =
i;
4716 f->
next_seg = start_seg_with_known_loc;
4718 for (
i = 0;
i < start_seg_with_known_loc;
i++)
Referenced by stb_vorbis_seek_frame().
◆ set_file_offset()
◆ setup_free()
◆ setup_malloc()
◆ setup_temp_free()
◆ setup_temp_malloc()
◆ skip()
◆ square()
static float square |
( |
float |
x | ) |
|
|
static |
◆ start_decoder()
static int start_decoder |
( |
vorb * |
f | ) |
|
|
static |
Definition at line 3561 of file stb_vorbis.c.
3564 int len,
i,
j,k, max_submaps = 0;
3565 int longest_floorlist=0;
3619 #ifndef STB_VORBIS_NO_PUSHDATA_API
3644 int ordered, sorted_count;
3670 int current_entry = 0;
3671 int current_length =
get_bits(f,5) + 1;
3672 while (current_entry < c->entries) {
3673 int limit = c->
entries - current_entry;
3676 memset(lengths + current_entry, current_length, n);
3686 if (lengths[
j] == 32)
3709 sorted_count = total;
3712 #ifndef STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH
3791 #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK
3793 int len, sparse = c->
sparse;
3803 for (
j=0;
j < len; ++
j) {
3808 float val = mults[off];
3838 #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK
3851 for (
i=0;
i <
x; ++
i) {
3884 for (
j=0;
j <= max_class; ++
j) {
3924 if (g->
values > longest_floorlist)
3925 longest_floorlist = g->
values;
3935 uint8 residue_cascade[64];
3946 for (
j=0;
j <
r->classifications; ++
j) {
3951 residue_cascade[
j] = high_bits*8 + low_bits;
3953 r->residue_books = (short (*)[8])
setup_malloc(f,
sizeof(
r->residue_books[0]) *
r->classifications);
3955 for (
j=0;
j <
r->classifications; ++
j) {
3956 for (k=0; k < 8; ++k) {
3957 if (residue_cascade[
j] & (1 << k)) {
3961 r->residue_books[
j][k] = -1;
3975 for (k=classwords-1; k >= 0; --k) {
3976 r->classdata[
j][k] = temp %
r->classifications;
3977 temp /=
r->classifications;
4053 #ifdef STB_VORBIS_NO_DEFER_FLOOR
4064 #ifdef STB_VORBIS_DIVIDE_TABLE
4065 if (integer_divide_table[1][1]==0)
4066 for (
i=0;
i < DIVTAB_NUMER; ++
i)
4067 for (
j=1;
j < DIVTAB_DENOM; ++
j)
4068 integer_divide_table[
i][
j] =
i /
j;
4077 int i,max_part_read=0;
4080 int n_read =
r->end -
r->begin;
4081 int part_read = n_read /
r->part_size;
4082 if (part_read > max_part_read)
4083 max_part_read = part_read;
4085 #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
4086 classify_mem = f->
channels * (
sizeof(
void*) + max_part_read *
sizeof(
uint8 *));
4088 classify_mem = f->
channels * (
sizeof(
void*) + max_part_read *
sizeof(
int *));
Referenced by stb_vorbis_open_file_section(), stb_vorbis_open_memory(), and stb_vorbis_open_pushdata().
◆ start_packet()
static int start_packet |
( |
vorb * |
f | ) |
|
|
static |
◆ start_page()
◆ start_page_no_capturepattern()
static int start_page_no_capturepattern |
( |
vorb * |
f | ) |
|
|
static |
◆ stb_vorbis_close()
◆ stb_vorbis_decode_filename()
int stb_vorbis_decode_filename |
( |
const char * |
filename, |
|
|
int * |
channels, |
|
|
int * |
sample_rate, |
|
|
short ** |
output |
|
) |
| |
Definition at line 5219 of file stb_vorbis.c.
5221 int data_len, offset, total, limit,
error;
5224 if (
v ==
NULL)
return -1;
5225 limit =
v->channels * 4096;
5228 *sample_rate =
v->sample_rate;
5229 offset = data_len = 0;
5231 data = (
short *) malloc(total *
sizeof(*data));
5240 offset += n *
v->channels;
5241 if (offset + limit > total) {
5244 data2 = (
short *) realloc(data, total *
sizeof(*data));
5245 if (data2 ==
NULL) {
◆ stb_vorbis_decode_frame_pushdata()
int stb_vorbis_decode_frame_pushdata |
( |
stb_vorbis * |
f, |
|
|
const unsigned char * |
datablock, |
|
|
int |
datablock_length_in_bytes, |
|
|
int * |
channels, |
|
|
float *** |
output, |
|
|
int * |
samples |
|
) |
| |
◆ stb_vorbis_decode_memory()
int stb_vorbis_decode_memory |
( |
const unsigned char * |
mem, |
|
|
int |
len, |
|
|
int * |
channels, |
|
|
int * |
sample_rate, |
|
|
short ** |
output |
|
) |
| |
Definition at line 5259 of file stb_vorbis.c.
5261 int data_len, offset, total, limit,
error;
5264 if (
v ==
NULL)
return -1;
5265 limit =
v->channels * 4096;
5268 *sample_rate =
v->sample_rate;
5269 offset = data_len = 0;
5271 data = (
short *) malloc(total *
sizeof(*data));
5280 offset += n *
v->channels;
5281 if (offset + limit > total) {
5284 data2 = (
short *) realloc(data, total *
sizeof(*data));
5285 if (data2 ==
NULL) {
◆ stb_vorbis_flush_pushdata()
◆ stb_vorbis_get_error()
◆ stb_vorbis_get_file_offset()
◆ stb_vorbis_get_frame_float()
int stb_vorbis_get_frame_float |
( |
stb_vorbis * |
f, |
|
|
int * |
channels, |
|
|
float *** |
output |
|
) |
| |
◆ stb_vorbis_get_frame_short()
◆ stb_vorbis_get_frame_short_interleaved()
int stb_vorbis_get_frame_short_interleaved |
( |
stb_vorbis * |
f, |
|
|
int |
num_c, |
|
|
short * |
buffer, |
|
|
int |
num_shorts |
|
) |
| |
◆ stb_vorbis_get_info()
◆ stb_vorbis_get_sample_offset()
◆ stb_vorbis_get_samples_float()
int stb_vorbis_get_samples_float |
( |
stb_vorbis * |
f, |
|
|
int |
channels, |
|
|
float ** |
buffer, |
|
|
int |
num_samples |
|
) |
| |
Definition at line 5326 of file stb_vorbis.c.
5332 while (n < num_samples) {
5335 if (n+k >= num_samples) k = num_samples - n;
5337 for (
i=0;
i <
z; ++
i)
5340 memset(
buffer[
i]+n, 0,
sizeof(
float) * k);
5344 if (n == num_samples)
◆ stb_vorbis_get_samples_float_interleaved()
int stb_vorbis_get_samples_float_interleaved |
( |
stb_vorbis * |
f, |
|
|
int |
channels, |
|
|
float * |
buffer, |
|
|
int |
num_floats |
|
) |
| |
Definition at line 5299 of file stb_vorbis.c.
5309 if (n+k >= len) k = len - n;
5310 for (
j=0;
j < k; ++
j) {
5311 for (
i=0;
i <
z; ++
i)
◆ stb_vorbis_get_samples_short()
int stb_vorbis_get_samples_short |
( |
stb_vorbis * |
f, |
|
|
int |
channels, |
|
|
short ** |
buffer, |
|
|
int |
num_samples |
|
) |
| |
Definition at line 5199 of file stb_vorbis.c.
5207 if (n+k >= len) k = len - n;
5212 if (n == len)
break;
◆ stb_vorbis_get_samples_short_interleaved()
int stb_vorbis_get_samples_short_interleaved |
( |
stb_vorbis * |
f, |
|
|
int |
channels, |
|
|
short * |
buffer, |
|
|
int |
num_shorts |
|
) |
| |
Definition at line 5178 of file stb_vorbis.c.
5187 if (n+k >= len) k = len - n;
5193 if (n == len)
break;
◆ stb_vorbis_open_file()
Definition at line 4953 of file stb_vorbis.c.
4955 unsigned int len, start;
4956 start = (
unsigned int) ftell(file);
4957 fseek(file, 0, SEEK_END);
4958 len = (
unsigned int) (ftell(file) - start);
4959 fseek(file, start, SEEK_SET);
Referenced by stb_vorbis_open_filename().
◆ stb_vorbis_open_file_section()
◆ stb_vorbis_open_filename()
◆ stb_vorbis_open_memory()
◆ stb_vorbis_open_pushdata()
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 |
|
) |
| |
◆ stb_vorbis_seek()
Definition at line 4799 of file stb_vorbis.c.
4808 assert(sample_number > frame_start);
◆ stb_vorbis_seek_frame()
Definition at line 4760 of file stb_vorbis.c.
4762 uint32 max_frame_samples;
4776 int left_start, left_end, right_start, right_end,
mode, frame_samples;
4780 frame_samples = right_start - left_start;
4781 if (f->
current_loc + frame_samples > sample_number) {
4783 }
else if (f->
current_loc + frame_samples + max_frame_samples > sample_number) {
Referenced by stb_vorbis_seek().
◆ stb_vorbis_seek_start()
◆ stb_vorbis_stream_length_in_samples()
unsigned int stb_vorbis_stream_length_in_samples |
( |
stb_vorbis * |
f | ) |
|
◆ stb_vorbis_stream_length_in_seconds()
float stb_vorbis_stream_length_in_seconds |
( |
stb_vorbis * |
f | ) |
|
◆ uint32_compare()
◆ vorbis_alloc()
◆ vorbis_decode_initial()
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 |
◆ vorbis_decode_packet()
static int vorbis_decode_packet |
( |
vorb * |
f, |
|
|
int * |
len, |
|
|
int * |
p_left, |
|
|
int * |
p_right |
|
) |
| |
|
static |
◆ vorbis_decode_packet_rest()
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 |
Definition at line 3159 of file stb_vorbis.c.
3163 int zero_channel[256];
3164 int really_zero_channel[256];
3177 int s =
map->chan[
i].mux, floor;
3179 floor =
map->submap_floor[
s];
3186 uint8 step2_flag[256];
3187 static int range_list[4] = { 256, 128, 86, 64 };
3197 int csub = (1 << cbits)-1;
3203 for (k=0; k < cdim; ++k) {
3205 cval = cval >> cbits;
3210 finalY[offset++] = temp;
3212 finalY[offset++] = 0;
3216 step2_flag[0] = step2_flag[1] = 1;
3218 int low, high, pred, highroom, lowroom, room, val;
3224 highroom =
range - pred;
3226 if (highroom < lowroom)
3227 room = highroom * 2;
3231 step2_flag[low] = step2_flag[high] = 1;
3234 if (highroom > lowroom)
3235 finalY[
j] = val - lowroom + pred;
3237 finalY[
j] = pred - val + highroom - 1;
3240 finalY[
j] = pred - ((val+1)>>1);
3242 finalY[
j] = pred + (val>>1);
3249 #ifdef STB_VORBIS_NO_DEFER_FLOOR
3250 do_floor(f,
map,
i, n, f->floor_buffers[
i], finalY, step2_flag);
3260 zero_channel[
i] =
TRUE;
3274 memcpy(really_zero_channel, zero_channel,
sizeof(really_zero_channel[0]) * f->
channels);
3275 for (
i=0;
i <
map->coupling_steps; ++
i)
3276 if (!zero_channel[
map->chan[
i].magnitude] || !zero_channel[
map->chan[
i].angle]) {
3277 zero_channel[
map->chan[
i].magnitude] = zero_channel[
map->chan[
i].angle] =
FALSE;
3282 for (
i=0;
i <
map->submaps; ++
i) {
3285 uint8 do_not_decode[256];
3288 if (
map->chan[
j].mux ==
i) {
3289 if (zero_channel[
j]) {
3290 do_not_decode[ch] =
TRUE;
3291 residue_buffers[ch] =
NULL;
3293 do_not_decode[ch] =
FALSE;
3299 r =
map->submap_residue[
i];
3308 for (
i =
map->coupling_steps-1;
i >= 0; --
i) {
3312 for (
j=0;
j < n2; ++
j) {
3316 m2 = m[
j], a2 = m[
j] - a[
j];
3318 a2 = m[
j], m2 = m[
j] + a[
j];
3321 m2 = m[
j], a2 = m[
j] + a[
j];
3323 a2 = m[
j], m2 = m[
j] - a[
j];
3331 #ifndef STB_VORBIS_NO_DEFER_FLOOR
3333 if (really_zero_channel[
i]) {
3341 if (really_zero_channel[
i]) {
3344 for (
j=0;
j < n2; ++
j)
3374 left_start = right_start;
3375 *p_left = left_start;
3378 *p_left = left_start;
3396 if (current_end < f->current_loc + (right_end-left_start)) {
3397 if (current_end < f->current_loc) {
3404 if (*len > right_end) *len = right_end;
Referenced by vorbis_decode_packet().
◆ vorbis_deinit()
◆ vorbis_find_page()
◆ vorbis_finish_frame()
◆ vorbis_init()
◆ vorbis_pump_first_frame()
◆ vorbis_search_for_page_pushdata()
static int vorbis_search_for_page_pushdata |
( |
vorb * |
f, |
|
|
uint8 * |
data, |
|
|
int |
data_len |
|
) |
| |
|
static |
Definition at line 4239 of file stb_vorbis.c.
4248 if (data_len < 4)
return 0;
4251 for (
i=0;
i < data_len; ++
i) {
4252 if (data[
i] == 0x4f) {
4257 if (
i+26 >= data_len ||
i+27+data[
i+26] >= data_len) {
4264 len = 27 + data[
i+26];
4265 for (
j=0;
j < data[
i+26]; ++
j)
4266 len += data[
i+27+
j];
4269 for (
j=0;
j < 22; ++
j)
4272 for ( ;
j < 26; ++
j)
4278 f->
scan[n].
goal_crc = data[
i+22] + (data[
i+23] << 8) + (data[
i+24]<<16) + (data[
i+25]<<24);
4281 if (data[
i+27+data[
i+26]-1] == 255)
4284 f->
scan[n].
sample_loc = data[
i+6] + (data[
i+7] << 8) + (data[
i+ 8]<<16) + (data[
i+ 9]<<24);
4299 if (m > data_len - n) m = data_len - n;
4302 for (
j=0;
j < m; ++
j)
Referenced by stb_vorbis_decode_frame_pushdata().
◆ vorbis_validate()
static int vorbis_validate |
( |
uint8 * |
data | ) |
|
|
static |
Definition at line 1189 of file stb_vorbis.c.
1191 static uint8 vorbis[6] = {
'v',
'o',
'r',
'b',
'i',
's' };
1192 return memcmp(data, vorbis, 6) == 0;
Referenced by start_decoder().
◆ channel_position
int8 channel_position[7][6] |
|
static |
◆ crc_table
◆ inverse_db_table
float inverse_db_table[256] |
|
static |
◆ ogg_page_header
uint8 ogg_page_header[4] = { 0x4f, 0x67, 0x67, 0x53 } |
|
static |
uint32 known_loc_for_packet
static int vorbis_decode_packet(vorb *f, int *len, int *p_left, int *p_right)
GLdouble GLdouble GLdouble y2
int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buffer, int num_shorts)
static int get8_packet(vorb *f)
static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values)
@ VORBIS_file_open_failure
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)
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 void * setup_temp_malloc(vorb *f, int sz)
CONST PIXELFORMATDESCRIPTOR int
#define DECODE(var, f, c)
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)
#define temp_alloc_save(f)
static int vorbis_search_for_page_pushdata(vorb *f, uint8 *data, int data_len)
static __forceinline uint32 crc32_update(uint32 crc, uint8 byte)
static void compute_samples(int mask, short *output, int num_c, float **data, int d_offset, int len)
static int start_decoder(vorb *f)
#define U(a, b, c, d, k, s)
static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
static __forceinline void prep_huffman(vorb *f)
#define STB_VORBIS_PUSHDATA_CRC_COUNT
uint32 last_decoded_sample
static void flush_packet(vorb *f)
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 start_page(vorb *f)
static void copy_samples(short *dest, float *src, int len)
static void vorbis_deinit(stb_vorbis *p)
static int get_seek_page_info(stb_vorbis *f, ProbedPage *z)
int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number)
#define FAST_HUFFMAN_TABLE_SIZE
#define CODEBOOK_ELEMENT_FAST(c, off)
#define DECODE_RAW(var, f, c)
GLdouble GLdouble GLdouble q
static int maybe_start_packet(vorb *f)
int16 * finalY[STB_VORBIS_MAX_CHANNELS]
static int codebook_decode(vorb *f, Codebook *c, float *output, int len)
uint8 class_dimensions[16]
int end_seg_with_known_loc
static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A, int base_n)
static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset)
int16 fast_huffman[FAST_HUFFMAN_TABLE_SIZE]
static __forceinline void iter_54(float *z)
static int lookup1_values(int entries, int dim)
static uint8 get8(vorb *z)
float * channel_buffers[STB_VORBIS_MAX_CHANNELS]
#define PAGEFLAG_continued_packet
static int is_whole_packet_present(stb_vorbis *f, int end_page)
@ VORBIS_incorrect_stream_serial_number
static void skip(vorb *z, int n)
static uint8 ogg_page_header[4]
static void neighbors(uint16 *x, int n, int *plow, int *phigh)
static int residue_decode(vorb *f, Codebook *book, float *target, int offset, int n, int rtype)
static int do_floor(vorb *f, Mapping *map, int i, int n, float *target, YTYPE *finalY, uint8 *step2_flag)
#define STB_VORBIS_MAX_CHANNELS
@ VORBIS_cant_find_last_page
void stb_vorbis_close(stb_vorbis *f)
static void compute_window(int n, float *window)
@ VORBIS_too_many_channels
#define PAGEFLAG_last_page
@ VORBIS_continued_packet_flag_invalid
uint32 first_audio_page_offset
static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
static int getn(vorb *z, uint8 *data, int n)
int stb_vorbis_seek_start(stb_vorbis *f)
static int codebook_decode_start(vorb *f, Codebook *c)
int alloc_buffer_length_in_bytes
static void compute_stereo_samples(short *output, int num_c, float **data, int d_offset, int len)
static void convert_channels_short_interleaved(int buf_c, short *buffer, int data_c, float **data, int d_offset, int len)
int discard_samples_deferred
@ VORBIS_invalid_stream_structure_version
static int set_file_offset(stb_vorbis *f, unsigned int loc)
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 float * get_window(vorb *f, int len)
static void imdct_step3_iter0_loop(int n, float *e, int i_off, int k_off, float *A)
@ VORBIS_seek_without_length
static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
static void crc32_init(void)
static void compute_twiddle_factors(int n, float *A, float *B, float *C)
#define temp_alloc_restore(f, p)
uint8 partition_class_list[32]
CRCscan scan[STB_VORBIS_PUSHDATA_CRC_COUNT]
stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc_buffer)
#define FAST_HUFFMAN_TABLE_MASK
static void compute_accelerated_huffman(Codebook *c)
@ VORBIS_missing_capture_pattern
static int error(vorb *f, enum STBVorbisError e)
unsigned int setup_memory_required
@ VORBIS_feature_not_supported
unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
static void add_entry(Codebook *c, uint32 huff_code, int symbol, int count, int len, uint32 *values)
channel_t channels[MAX_CHANNELS]
static int start_packet(vorb *f)
static void setup_free(vorb *f, void *p)
stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close, int *error, const stb_vorbis_alloc *alloc_buffer)
#define CODEBOOK_ELEMENT_BASE(c)
uint8 sorted_order[31 *8+2]
unsigned int setup_memory_required
static void * setup_malloc(vorb *f, int sz)
static void convert_samples_short(int buf_c, short **buffer, int b_offset, int data_c, float **data, int d_offset, int samples)
float * previous_window[STB_VORBIS_MAX_CHANNELS]
int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output)
unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f)
#define PAGEFLAG_first_page
#define STB_VORBIS_FAST_HUFFMAN_LENGTH
static float float32_unpack(uint32 x)
static uint32 get32(vorb *f)
static void setup_temp_free(vorb *f, void *p, int sz)
unsigned int setup_temp_memory_required
static int STBV_CDECL uint32_compare(const void *p, const void *q)
#define check_endianness()
static int start_page_no_capturepattern(vorb *f)
static int STBV_CDECL point_compare(const void *p, const void *q)
#define temp_block_array(f, count, size)
#define FAST_SCALED_FLOAT_TO_INT(temp, x, s)
enum STBVorbisError error
uint8 class_masterbooks[16]
int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples)
float * outputs[STB_VORBIS_MAX_CHANNELS]
static int include_in_sort(Codebook *c, uint8 len)
static void imdct_step3_inner_r_loop(int lim, float *e, int d0, int k_off, float *A, int k1)
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)
#define temp_alloc(f, size)
unsigned int setup_temp_memory_required
static int init_blocksize(vorb *f, int b, int n)
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 compute_bitreverse(int n, uint16 *rev)
static int codebook_decode_scalar_raw(vorb *f, Codebook *c)
static int codebook_decode_step(vorb *f, Codebook *c, float *output, int len, int step)
GLdouble GLdouble GLdouble w
uint8 class_subclasses[16]
unsigned int temp_memory_required
int16 subclass_books[16][8]
static uint32 vorbis_find_page(stb_vorbis *f, uint32 *end, uint32 *last)
static uint32 crc_table[256]
static unsigned int bit_reverse(unsigned int n)
@ VORBIS_invalid_first_page
static int get8_packet_raw(vorb *f)
uint32 * sorted_codewords
static float square(float x)
static int vorbis_validate(uint8 *data)
void stb_vorbis_flush_pushdata(stb_vorbis *f)
#define STB_VORBIS_FAST_HUFFMAN_SHORT
stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc_buffer)
static int compute_codewords(Codebook *c, uint8 *len, int n, uint32 *values)
static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int rn, uint8 *do_not_decode)
static int next_segment(vorb *f)
static int8 channel_position[7][6]
static float inverse_db_table[256]
static uint32 get_bits(vorb *f, int n)
unsigned int temp_memory_required
#define DECODE_VQ(var, f, c)
static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
@ VORBIS_invalid_api_mixing
static stb_vorbis * vorbis_alloc(stb_vorbis *f)
uint8 neighbors[31 *8+2][2]
static int vorbis_pump_first_frame(stb_vorbis *f)
static int capture_pattern(vorb *f)