zenilib: zenilib/jni/external/libvorbis/vq/localcodebook.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
localcodebook.h
Go to the documentation of this file.
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10 * *
11 ********************************************************************
12
13 function: basic shared codebook operations
14 last mod: $Id: localcodebook.h 16959 2010-03-10 16:03:11Z xiphmont $
15
16 ********************************************************************/
17
18 #ifndef _V_CODEBOOK_H_
19 #define _V_CODEBOOK_H_
20
21 #include <ogg/ogg.h>
22
23 /* This structure encapsulates huffman and VQ style encoding books; it
24 doesn't do anything specific to either.
25
26 valuelist/quantlist are nonNULL (and q_* significant) only if
27 there's entry->value mapping to be done.
28
29 If encode-side mapping must be done (and thus the entry needs to be
30 hunted), the auxiliary encode pointer will point to a decision
31 tree. This is true of both VQ and huffman, but is mostly useful
32 with VQ.
33
34 */
35
36 typedef struct static_codebook{
37 long dim; /* codebook dimensions (elements per vector) */
38 long entries; /* codebook entries */
39 long *lengthlist; /* codeword lengths in bits */
40
41 /* mapping ***************************************************************/
42 int maptype; /* 0=none
43 1=implicitly populated values from map column
44 2=listed arbitrary values */
45
46 /* The below does a linear, single monotonic sequence mapping. */
47 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
48 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
49 int q_quant; /* bits: 0 < quant <= 16 */
50 int q_sequencep; /* bitflag */
51
52 long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
53 map == 2: list of dim*entries quantized entry vals
54 */
55 int allocedp;
56 } static_codebook;
57
58 typedef struct codebook{
59 long dim; /* codebook dimensions (elements per vector) */
60 long entries; /* codebook entries */
61 long used_entries; /* populated codebook entries */
62 static_codebook *c;
63
64 /* for encode, the below are entry-ordered, fully populated */
65 /* for decode, the below are ordered by bitreversed codeword and only
66 used entries are populated */
67 float *valuelist; /* list of dim*entries actual entry values */
68 ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
69
70 int *dec_index; /* only used if sparseness collapsed */
71 char *dec_codelengths;
72 ogg_uint32_t *dec_firsttable;
73 int dec_firsttablen;
74 int dec_maxlength;
75
76 /* The current encoder uses only centered, integer-only lattice books. */
77 int quantvals;
78 int minval;
79 int delta;
80
81 } codebook;
82
83 extern void vorbis_staticbook_clear(static_codebook *b);
84 extern void vorbis_staticbook_destroy(static_codebook *b);
85 extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
86 extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
87 extern void vorbis_book_clear(codebook *b);
88
89 extern float *_book_unquantize(const static_codebook *b,int n,int *map);
90 extern float *_book_logdist(const static_codebook *b,float *vals);
91 extern float _float32_unpack(long val);
92 extern long _float32_pack(float val);
93 extern int _best(codebook *book, float *a, int step);
94 extern int _ilog(unsigned int v);
95 extern long _book_maptype1_quantvals(const static_codebook *b);
96
97 extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
98 extern long vorbis_book_codeword(codebook *book,int entry);
99 extern long vorbis_book_codelen(codebook *book,int entry);
100
101
102
103 extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
104 extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
105
106 extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
107
108 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
109 extern long vorbis_book_decodevs_add(codebook *book, float *a,
110 oggpack_buffer *b,int n);
111 extern long vorbis_book_decodev_set(codebook *book, float *a,
112 oggpack_buffer *b,int n);
113 extern long vorbis_book_decodev_add(codebook *book, float *a,
114 oggpack_buffer *b,int n);
115 extern long vorbis_book_decodevv_add(codebook *book, float **a,
116 long off,int ch,
117 oggpack_buffer *b,int n);
118
119
120
121 #endif
val
GLuint const GLfloat * val
Definition: glew.h:2715
vorbis_book_codeword
long vorbis_book_codeword(codebook *book, int entry)
Definition: sharedbook.c:430
codebook::dim
long dim
Definition: codebook.h:59
static_codebook
Definition: codebook.h:36
static_codebook::dim
long dim
Definition: codebook.h:37
vorbis_staticbook_destroy
void vorbis_staticbook_destroy(static_codebook *b)
Definition: sharedbook.c:261
vorbis_book_decodevs_add
long vorbis_book_decodevs_add(codebook *book, float *a, oggpack_buffer *b, int n)
Definition: codebook.c:370
vorbis_book_encode
int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b)
Definition: codebook.c:274
n
GLclampd n
Definition: glew.h:7287
vorbis_book_codelen
long vorbis_book_codelen(codebook *book, int entry)
Definition: sharedbook.c:437
codebook::dec_firsttable
ogg_uint32_t * dec_firsttable
Definition: codebook.h:72
a
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8736
codebook::dec_codelengths
char * dec_codelengths
Definition: codebook.h:71
codebook::codelist
ogg_uint32_t * codelist
Definition: codebook.h:68
static_codebook::q_sequencep
int q_sequencep
Definition: codebook.h:50
ogg.h
codebook::valuelist
float * valuelist
Definition: codebook.h:67
vorbis_book_init_decode
int vorbis_book_init_decode(codebook *dest, const static_codebook *source)
Definition: sharedbook.c:313
codebook::c
static_codebook * c
Definition: localcodebook.h:62
vorbis_staticbook_clear
void vorbis_staticbook_clear(static_codebook *b)
static_codebook::lengthlist
long * lengthlist
Definition: codebook.h:39
vorbis_book_decode
long vorbis_book_decode(codebook *book, oggpack_buffer *b)
Definition: codebook.c:358
vorbis_staticbook_pack
int vorbis_staticbook_pack(const static_codebook *c, oggpack_buffer *opb)
Definition: codebook.c:30
codebook::used_entries
long used_entries
Definition: codebook.h:61
_book_unquantize
float * _book_unquantize(const static_codebook *b, int n, int *map)
Definition: sharedbook.c:196
vorbis_book_clear
void vorbis_book_clear(codebook *b)
Definition: sharedbook.c:270
static_codebook::quantlist
long * quantlist
Definition: codebook.h:52
_float32_unpack
float _float32_unpack(long val)
Definition: sharedbook.c:62
vorbis_book_besterror
int vorbis_book_besterror(codebook *book, float *a, int step, int addmul)
v
const GLdouble * v
Definition: glew.h:1377
static_codebook::q_quant
int q_quant
Definition: codebook.h:49
c
const GLfloat * c
Definition: glew.h:14913
_best
int _best(codebook *book, float *a, int step)
Definition: bookutil.c:25
vorbis_book_decodev_add
long vorbis_book_decodev_add(codebook *book, float *a, oggpack_buffer *b, int n)
Definition: codebook.c:389
codebook
Definition: codebook.h:58
static_codebook::entries
long entries
Definition: codebook.h:38
_float32_pack
long _float32_pack(float val)
Definition: sharedbook.c:47
oggpack_buffer
Definition: ogg.h:32
_ilog
int _ilog(unsigned int v)
Definition: sharedbook.c:29
codebook
struct codebook codebook
ogg_uint32_t
unsigned int ogg_uint32_t
Definition: config_types.h:22
codebook::dec_index
int * dec_index
Definition: codebook.h:70
static_codebook::maptype
int maptype
Definition: codebook.h:42
vorbis_book_init_encode
int vorbis_book_init_encode(codebook *dest, const static_codebook *source)
Definition: sharedbook.c:283
codebook::dec_maxlength
int dec_maxlength
Definition: codebook.h:74
codebook::delta
int delta
Definition: codebook.h:79
_book_logdist
float * _book_logdist(const static_codebook *b, float *vals)
static_codebook::q_delta
long q_delta
Definition: codebook.h:48
_book_maptype1_quantvals
long _book_maptype1_quantvals(const static_codebook *b)
Definition: sharedbook.c:163
static_codebook
struct static_codebook static_codebook
b
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
static_codebook::q_min
long q_min
Definition: codebook.h:47
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:268
vorbis_book_decodevv_add
long vorbis_book_decodevv_add(codebook *book, float **a, long offset, int ch, oggpack_buffer *b, int n)
Definition: codebook.c:457
static_codebook::allocedp
int allocedp
Definition: codebook.h:55
vorbis_book_decodev_set
long vorbis_book_decodev_set(codebook *book, float *a, oggpack_buffer *b, int n)
Definition: codebook.c:434
source
GLsizei GLsizei GLchar * source
Definition: gl2ext.h:994
codebook::quantvals
int quantvals
Definition: codebook.h:77
codebook::minval
int minval
Definition: codebook.h:78
codebook::entries
long entries
Definition: codebook.h:60
codebook::dec_firsttablen
int dec_firsttablen
Definition: codebook.h:73
vorbis_staticbook_unpack
static_codebook * vorbis_staticbook_unpack(oggpack_buffer *opb)
Definition: codebook.c:149