Mercurial > mplayer.hg
annotate tremor/codebook.h @ 26084:ec5749eb6f5f
Fill sh_sub_t.lang in lavf, mkv and ogg demuxers. Use it for printing subtitle
track language.
author | eugeni |
---|---|
date | Fri, 29 Feb 2008 17:25:39 +0000 |
parents | cd6b211be811 |
children | e83eef58b30a |
rev | line source |
---|---|
14280 | 1 /******************************************************************** |
2 * * | |
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * | |
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 | 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 | |
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 } static_codebook; | |
56 | |
57 typedef 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 | |
79 extern void vorbis_staticbook_clear(static_codebook *b); | |
80 extern void vorbis_staticbook_destroy(static_codebook *b); | |
81 extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); | |
82 | |
83 extern void vorbis_book_clear(codebook *b); | |
84 extern long _book_maptype1_quantvals(const static_codebook *b); | |
85 | |
86 extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); | |
87 | |
88 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); | |
89 extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, | |
90 oggpack_buffer *b,int n,int point); | |
91 extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, | |
92 oggpack_buffer *b,int n,int point); | |
93 extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, | |
94 oggpack_buffer *b,int n,int point); | |
95 extern 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 | |
99 extern int _ilog(unsigned int v); | |
100 | |
101 | |
102 #endif |