xref: /plan9/sys/src/games/mp3enc/tables.h (revision 8f5875f3e9b20916b4c52ad4336922bc8653eb7b)
1 /*
2  *	MPEG layer 3 tables include file
3  *
4  *	Copyright (c) 1999 Albert L Faber
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef LAME_TABLES_H
23 #define LAME_TABLES_H
24 
25 #include "machine.h"
26 
27 typedef struct {
28     unsigned char  no;
29     unsigned char  width;
30     unsigned char  minval_2;
31     float          quiet_thr;
32     float          norm;
33     float          bark;
34 } type1_t;
35 
36 typedef struct {
37     unsigned char  no;
38     unsigned char  width;
39     float          quiet_thr;
40     float          norm;
41     float          SNR;
42     float          bark;
43 } type2_t;
44 
45 typedef struct {
46     unsigned int  no     :  5;
47     unsigned int  cbw    :  3;
48     unsigned int  bu     :  6;
49     unsigned int  bo     :  6;
50     unsigned int  w1_576 : 10;
51     unsigned int  w2_576 : 10;
52 } type34_t;
53 
54 typedef struct {
55     size_t                 len1;
56     const type1_t*  const  tab1;
57     size_t                 len2;
58     const type2_t*  const  tab2;
59     size_t                 len3;
60     const type34_t* const  tab3;
61     size_t                 len4;
62     const type34_t* const  tab4;
63 } type5_t;
64 
65 extern const type5_t  table5 [6];
66 
67 
68 
69 #define HTN	34
70 
71 struct huffcodetab {
72     const int    xlen; 	        /* max. x-index+			*/
73     const int    linmax;	/* max number to be stored in linbits	*/
74     const short*   table;	        /* pointer to array[xlen][ylen]		*/
75     const char*  hlen;	        /* pointer to array[xlen][ylen]		*/
76 };
77 
78 extern const struct huffcodetab ht [HTN];
79     /* global memory block			*/
80     /* array of all huffcodtable headers	*/
81     /* 0..31 Huffman code table 0..31		*/
82     /* 32,33 count1-tables			*/
83 
84 extern const char t32l [];
85 extern const char t33l [];
86 
87 extern const unsigned int   largetbl    [16*16];
88 extern const unsigned int   table23       [3*3];
89 extern const unsigned int   table56       [4*4];
90 #endif /* LAME_TABLES_H */
91