summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/vorbis/tremor/codebook.h
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/vorbis/tremor/codebook.h') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/codebook.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/vorbis/tremor/codebook.h b/core/multimedia/opieplayer/vorbis/tremor/codebook.h
new file mode 100644
index 0000000..14f6538
--- a/dev/null
+++ b/core/multimedia/opieplayer/vorbis/tremor/codebook.h
@@ -0,0 +1,102 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: basic shared codebook operations
15
16 ********************************************************************/
17
18#ifndef _V_CODEBOOK_H_
19#define _V_CODEBOOK_H_
20
21#include "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
36typedef 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} static_codebook;
56
57typedef struct codebook{
58 long dim; /* codebook dimensions (elements per vector) */
59 long entries; /* codebook entries */
60 long used_entries; /* populated codebook entries */
61
62 /* the below are ordered by bitreversed codeword and only used
63 entries are populated */
64 int binarypoint;
65 ogg_int32_t *valuelist; /* list of dim*entries actual entry values */
66 ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
67
68 int *dec_index;
69 char *dec_codelengths;
70 ogg_uint32_t *dec_firsttable;
71 int dec_firsttablen;
72 int dec_maxlength;
73
74 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
75 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
76
77} codebook;
78
79extern void vorbis_staticbook_clear(static_codebook *b);
80extern void vorbis_staticbook_destroy(static_codebook *b);
81extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
82
83extern void vorbis_book_clear(codebook *b);
84extern long _book_maptype1_quantvals(const static_codebook *b);
85
86extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
87
88extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
89extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
90 oggpack_buffer *b,int n,int point);
91extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
92 oggpack_buffer *b,int n,int point);
93extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
94 oggpack_buffer *b,int n,int point);
95extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
96 long off,int ch,
97 oggpack_buffer *b,int n,int point);
98
99extern int _ilog(unsigned int v);
100
101
102#endif