22 #define NULL_CHAR '\0'
24 #define MAX_U_32_NUM 0xFFFFFFFF
26 #define PI 3.14159265358979
31 #define LN_TO_LOG10 0.2302585093
34 #define MPEG_AUDIO_ID 1
35 #define MPEG_PHASE2_LSF 0 /* 1995-07-11 SHN */
36 #define MAC_WINDOW_SIZE 24
40 #define BITS_IN_A_BYTE 8
42 #define MAX_NAME_SIZE 255
47 #define SCALE_BLOCK 12
48 #define SCALE_RANGE 64
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
62 #define MPG_MD_LR_LR 0
64 #define MPG_MD_MS_LR 2
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 */
79 #define BUFFER_SIZE 4096
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 */
101 typedef sb_alloc al_table
[SBLIMIT
][16];
103 /* Header Information Structure */
109 int error_protection
;
113 int sampling_frequency
;
124 /* Parent Structure Interpreting some Frame Parameters in Header */
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 */
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 */
151 /* format of file in rd mode (BINARY/ASCII) */
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];
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
);