annotate tremor/codebook.h @ 32926:7c205a5c2a9b

Remove parameter from appInitStruct() function. Since there is only one listItems structure variable (the global appMPlayer), there is no need to pass it to the function.
author ib
date Thu, 03 Mar 2011 13:13:20 +0000
parents e83eef58b30a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
1 /********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
2 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
4 * *
19251
cd6b211be811 Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents: 14280
diff changeset
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
cd6b211be811 Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents: 14280
diff changeset
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
cd6b211be811 Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents: 14280
diff changeset
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
cd6b211be811 Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents: 14280
diff changeset
8 * *
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
11 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
12 ********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
13
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
14 function: basic shared codebook operations
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
15
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
16 ********************************************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
17
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
18 #ifndef _V_CODEBOOK_H_
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
19 #define _V_CODEBOOK_H_
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
20
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
21 #include "ogg.h"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
22
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
23 /* This structure encapsulates huffman and VQ style encoding books; it
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
24 doesn't do anything specific to either.
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
25
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
26 valuelist/quantlist are nonNULL (and q_* significant) only if
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
27 there's entry->value mapping to be done.
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
28
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
29 If encode-side mapping must be done (and thus the entry needs to be
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
30 hunted), the auxiliary encode pointer will point to a decision
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
31 tree. This is true of both VQ and huffman, but is mostly useful
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
32 with VQ.
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
33
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
34 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
35
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
36 typedef struct static_codebook{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
37 long dim; /* codebook dimensions (elements per vector) */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
38 long entries; /* codebook entries */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
39 long *lengthlist; /* codeword lengths in bits */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
40
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
41 /* mapping ***************************************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
42 int maptype; /* 0=none
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
43 1=implicitly populated values from map column
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
44 2=listed arbitrary values */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
45
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
46 /* The below does a linear, single monotonic sequence mapping. */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
47 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
48 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
49 int q_quant; /* bits: 0 < quant <= 16 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
50 int q_sequencep; /* bitflag */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
51
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
52 long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
53 map == 2: list of dim*entries quantized entry vals
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
54 */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
55 } static_codebook;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
56
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
57 typedef struct codebook{
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
58 long dim; /* codebook dimensions (elements per vector) */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
59 long entries; /* codebook entries */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
60 long used_entries; /* populated codebook entries */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
61
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
62 /* the below are ordered by bitreversed codeword and only used
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
63 entries are populated */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
64 int binarypoint;
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
65 ogg_int32_t *valuelist; /* list of dim*entries actual entry values */
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
66 ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
67
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
68 int *dec_index;
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
69 char *dec_codelengths;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
70 ogg_uint32_t *dec_firsttable;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
71 int dec_firsttablen;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
72 int dec_maxlength;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
73
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
74 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
75 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
76
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
77 } codebook;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
78
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
79 extern void vorbis_staticbook_clear(static_codebook *b);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
80 extern void vorbis_staticbook_destroy(static_codebook *b);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
81 extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
82
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
83 extern void vorbis_book_clear(codebook *b);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
84 extern long _book_maptype1_quantvals(const static_codebook *b);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
85
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
86 extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
87
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
88 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
89 extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
90 oggpack_buffer *b,int n,int point);
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
91 extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
92 oggpack_buffer *b,int n,int point);
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
93 extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
94 oggpack_buffer *b,int n,int point);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
95 extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
29264
e83eef58b30a Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents: 19251
diff changeset
96 long off,int ch,
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
97 oggpack_buffer *b,int n,int point);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
98
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
99 extern int _ilog(unsigned int v);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
100
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
101
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
102 #endif