r1005: Increase the number of displayed digits for resample audio dialog box
[cinelerra_cv/mob.git] / toolame-02l / common.h
blobae59aeada187a32474270c09155e091120f52ae9
1 #ifndef COMMON_DOT_H
2 #define COMMON_DOT_H
4 #ifndef EXIT_SUCCESS
5 #define EXIT_SUCCESS 0
6 #endif
8 #ifndef EXIT_FAILURE
9 #define EXIT_FAILURE 1
10 #endif
12 #define FLOAT float
14 #ifndef FALSE
15 #define FALSE 0
16 #endif
18 #ifndef TRUE
19 #define TRUE 1
20 #endif
22 #define NULL_CHAR '\0'
24 #define MAX_U_32_NUM 0xFFFFFFFF
25 #ifndef PI
26 #define PI 3.14159265358979
27 #endif
28 #define PI2 PI/2
29 #define PI4 PI/4
30 #define PI64 PI/64
31 #define LN_TO_LOG10 0.2302585093
33 #define VOL_REF_NUM 0
34 #define MPEG_AUDIO_ID 1
35 #define MPEG_PHASE2_LSF 0 /* 1995-07-11 SHN */
36 #define MAC_WINDOW_SIZE 24
38 #define MONO 1
39 #define STEREO 2
40 #define BITS_IN_A_BYTE 8
41 #define WORD 16
42 #define MAX_NAME_SIZE 255
43 #define SBLIMIT 32
44 #define SSLIMIT 18
45 #define FFT_SIZE 1024
46 #define HAN_SIZE 512
47 #define SCALE_BLOCK 12
48 #define SCALE_RANGE 64
49 #define SCALE 32768
50 #define CRC16_POLYNOMIAL 0x8005
51 #define CRC8_POLYNOMIAL 0x1D
53 /* MPEG Header Definitions - Mode Values */
55 #define MPG_MD_STEREO 0
56 #define MPG_MD_JOINT_STEREO 1
57 #define MPG_MD_DUAL_CHANNEL 2
58 #define MPG_MD_MONO 3
60 /* Mode Extension */
62 #define MPG_MD_LR_LR 0
63 #define MPG_MD_LR_I 1
64 #define MPG_MD_MS_LR 2
65 #define MPG_MD_MS_I 3
68 /* "bit_stream.h" Definitions */
70 #define MINIMUM 4 /* Minimum size of the buffer in bytes */
71 #define MAX_LENGTH 32 /* Maximum length of word written or
72 read from bit stream */
73 #define READ_MODE 0
74 #define WRITE_MODE 1
75 #define ALIGNING 8
76 #define BINARY 0
77 #define ASCII 1
79 #define BUFFER_SIZE 4096
81 #define FLOAT8 float
82 #define MIN(A, B) ((A) < (B) ? (A) : (B))
83 #define MAX(A, B) ((A) > (B) ? (A) : (B))
84 /***********************************************************************
86 * Global Type Definitions
88 ***********************************************************************/
90 /* Structure for Reading Layer II Allocation Tables from File */
92 typedef struct
94 unsigned int steps;
95 unsigned int bits;
96 unsigned int group;
97 unsigned int quant;
99 sb_alloc, *alloc_ptr;
101 typedef sb_alloc al_table[SBLIMIT][16];
103 /* Header Information Structure */
105 typedef struct
107 int version;
108 int lay;
109 int error_protection;
110 int dab_extension;
111 int dab_length;
112 int bitrate_index;
113 int sampling_frequency;
114 int padding;
115 int extension;
116 int mode;
117 int mode_ext;
118 int copyright;
119 int original;
120 int emphasis;
122 frame_header;
124 /* Parent Structure Interpreting some Frame Parameters in Header */
126 typedef struct
128 frame_header *header; /* raw header information */
129 int actual_mode; /* when writing IS, may forget if 0 chs */
130 al_table *alloc; /* bit allocation table read in */
131 int tab_num; /* number of table as loaded */
132 int nch; /* num channels: 1 for mono, 2 for stereo */
133 int jsbound; /* first band of joint stereo coding */
134 int sblimit; /* total number of sub bands */
136 frame_info;
138 typedef struct bit_stream_struc
140 FILE *pt; /* pointer to bit stream device */
141 unsigned char *buf; /* bit stream buffer */
142 int buf_size; /* size of buffer (in number of bytes) */
143 long totbit; /* bit counter of bit stream */
144 int buf_byte_idx; /* pointer to top byte in buffer */
145 int buf_bit_idx; /* pointer to top bit of top byte in buffer */
146 int mode; /* bit stream open in read or write mode */
147 int eob; /* end of buffer index */
148 int eobs; /* end of bit stream flag */
149 char format;
151 /* format of file in rd mode (BINARY/ASCII) */
153 Bit_stream_struc;
156 enum byte_order
157 { order_unknown, order_bigEndian, order_littleEndian };
158 extern enum byte_order NativeByteOrder;
160 /* "bit_stream.h" Type Definitions */
165 /***********************************************************************
167 * Global Variable External Declarations
169 ***********************************************************************/
171 extern char *mode_names[4];
172 extern char *version_names[2];
173 extern double s_freq[2][4];
174 extern int bitrate[2][15];
175 extern double multiple[64];
177 int js_bound (int);
178 void hdr_to_frps (frame_info *);
179 int toolame_BitrateIndex (int, int);
180 int toolame_SmpFrqIndex (long, int *);
181 void new_ext (char *filename, char *extname, char *newname);
183 #endif