Mercurial > mplayer.hg
comparison tremor/codebook.h @ 14280:8631a3803289
internal Tremor decoder for Ogg/Vorbis
author | henry |
---|---|
date | Thu, 30 Dec 2004 12:11:32 +0000 |
parents | |
children | cd6b211be811 |
comparison
equal
deleted
inserted
replaced
14279:b4b202086260 | 14280:8631a3803289 |
---|---|
1 /******************************************************************** | |
2 * * | |
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * | |
4 * * | |
5 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * | |
6 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * | |
7 * ALL REDISTRIBUTION RIGHTS RESERVED. * | |
8 * * | |
9 ******************************************************************** | |
10 | |
11 function: basic shared codebook operations | |
12 | |
13 ********************************************************************/ | |
14 | |
15 #ifndef _V_CODEBOOK_H_ | |
16 #define _V_CODEBOOK_H_ | |
17 | |
18 #include "ogg.h" | |
19 | |
20 /* This structure encapsulates huffman and VQ style encoding books; it | |
21 doesn't do anything specific to either. | |
22 | |
23 valuelist/quantlist are nonNULL (and q_* significant) only if | |
24 there's entry->value mapping to be done. | |
25 | |
26 If encode-side mapping must be done (and thus the entry needs to be | |
27 hunted), the auxiliary encode pointer will point to a decision | |
28 tree. This is true of both VQ and huffman, but is mostly useful | |
29 with VQ. | |
30 | |
31 */ | |
32 | |
33 typedef struct static_codebook{ | |
34 long dim; /* codebook dimensions (elements per vector) */ | |
35 long entries; /* codebook entries */ | |
36 long *lengthlist; /* codeword lengths in bits */ | |
37 | |
38 /* mapping ***************************************************************/ | |
39 int maptype; /* 0=none | |
40 1=implicitly populated values from map column | |
41 2=listed arbitrary values */ | |
42 | |
43 /* The below does a linear, single monotonic sequence mapping. */ | |
44 long q_min; /* packed 32 bit float; quant value 0 maps to minval */ | |
45 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */ | |
46 int q_quant; /* bits: 0 < quant <= 16 */ | |
47 int q_sequencep; /* bitflag */ | |
48 | |
49 long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map | |
50 map == 2: list of dim*entries quantized entry vals | |
51 */ | |
52 } static_codebook; | |
53 | |
54 typedef struct codebook{ | |
55 long dim; /* codebook dimensions (elements per vector) */ | |
56 long entries; /* codebook entries */ | |
57 long used_entries; /* populated codebook entries */ | |
58 | |
59 /* the below are ordered by bitreversed codeword and only used | |
60 entries are populated */ | |
61 int binarypoint; | |
62 ogg_int32_t *valuelist; /* list of dim*entries actual entry values */ | |
63 ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */ | |
64 | |
65 int *dec_index; | |
66 char *dec_codelengths; | |
67 ogg_uint32_t *dec_firsttable; | |
68 int dec_firsttablen; | |
69 int dec_maxlength; | |
70 | |
71 long q_min; /* packed 32 bit float; quant value 0 maps to minval */ | |
72 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */ | |
73 | |
74 } codebook; | |
75 | |
76 extern void vorbis_staticbook_clear(static_codebook *b); | |
77 extern void vorbis_staticbook_destroy(static_codebook *b); | |
78 extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); | |
79 | |
80 extern void vorbis_book_clear(codebook *b); | |
81 extern long _book_maptype1_quantvals(const static_codebook *b); | |
82 | |
83 extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); | |
84 | |
85 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); | |
86 extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, | |
87 oggpack_buffer *b,int n,int point); | |
88 extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, | |
89 oggpack_buffer *b,int n,int point); | |
90 extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, | |
91 oggpack_buffer *b,int n,int point); | |
92 extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a, | |
93 long off,int ch, | |
94 oggpack_buffer *b,int n,int point); | |
95 | |
96 extern int _ilog(unsigned int v); | |
97 | |
98 | |
99 #endif |