| 1 |
#include <stdio.h> |
| 2 |
#include <string.h> |
| 3 |
#include <signal.h> |
| 4 |
|
| 5 |
#ifndef WIN32 |
| 6 |
#include <sys/signal.h> |
| 7 |
#include <unistd.h> |
| 8 |
#endif |
| 9 |
|
| 10 |
#include <math.h> |
| 11 |
|
| 12 |
#ifdef _WIN32 |
| 13 |
# undef WIN32 |
| 14 |
# define WIN32 |
| 15 |
|
| 16 |
# define M_PI 3.14159265358979323846 |
| 17 |
# define M_SQRT2 1.41421356237309504880 |
| 18 |
# define REAL_IS_FLOAT |
| 19 |
# define NEW_DCT9 |
| 20 |
|
| 21 |
# define random rand |
| 22 |
# define srandom srand |
| 23 |
|
| 24 |
#endif |
| 25 |
|
| 26 |
#ifdef REAL_IS_FLOAT |
| 27 |
# define real float |
| 28 |
#elif defined(REAL_IS_LONG_DOUBLE) |
| 29 |
# define real long double |
| 30 |
#else |
| 31 |
# define real double |
| 32 |
#endif |
| 33 |
|
| 34 |
#ifdef __GNUC__ |
| 35 |
#define INLINE inline |
| 36 |
#else |
| 37 |
#define INLINE |
| 38 |
#endif |
| 39 |
|
| 40 |
|
| 41 |
#define AUDIOBUFSIZE 16384 |
| 42 |
|
| 43 |
#define FALSE 0 |
| 44 |
#define TRUE 1 |
| 45 |
|
| 46 |
#define SBLIMIT 32 |
| 47 |
#define SSLIMIT 18 |
| 48 |
|
| 49 |
#define MPG_MD_STEREO 0 |
| 50 |
#define MPG_MD_JOINT_STEREO 1 |
| 51 |
#define MPG_MD_DUAL_CHANNEL 2 |
| 52 |
#define MPG_MD_MONO 3 |
| 53 |
|
| 54 |
#define MAXFRAMESIZE 1792 |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
#define AUSHIFT (3) |
| 59 |
|
| 60 |
struct frame { |
| 61 |
int stereo; |
| 62 |
int jsbound; |
| 63 |
int single; |
| 64 |
int lsf; |
| 65 |
int mpeg25; |
| 66 |
int header_change; |
| 67 |
int lay; |
| 68 |
int error_protection; |
| 69 |
int bitrate_index; |
| 70 |
int sampling_frequency; |
| 71 |
int padding; |
| 72 |
int extension; |
| 73 |
int mode; |
| 74 |
int mode_ext; |
| 75 |
int copyright; |
| 76 |
int original; |
| 77 |
int emphasis; |
| 78 |
int framesize; |
| 79 |
}; |
| 80 |
|
| 81 |
struct parameter { |
| 82 |
int quiet; |
| 83 |
int tryresync; |
| 84 |
int verbose; |
| 85 |
int checkrange; |
| 86 |
}; |
| 87 |
|
| 88 |
extern int decode_header(struct frame *fr,unsigned long newhead); |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
struct gr_info_s { |
| 93 |
int scfsi; |
| 94 |
unsigned part2_3_length; |
| 95 |
unsigned big_values; |
| 96 |
unsigned scalefac_compress; |
| 97 |
unsigned block_type; |
| 98 |
unsigned mixed_block_flag; |
| 99 |
unsigned table_select[3]; |
| 100 |
unsigned subblock_gain[3]; |
| 101 |
unsigned maxband[3]; |
| 102 |
unsigned maxbandl; |
| 103 |
unsigned maxb; |
| 104 |
unsigned region1start; |
| 105 |
unsigned region2start; |
| 106 |
unsigned preflag; |
| 107 |
unsigned scalefac_scale; |
| 108 |
unsigned count1table_select; |
| 109 |
real *full_gain[3]; |
| 110 |
real *pow2gain; |
| 111 |
}; |
| 112 |
|
| 113 |
struct III_sideinfo |
| 114 |
{ |
| 115 |
unsigned main_data_begin; |
| 116 |
unsigned private_bits; |
| 117 |
struct { |
| 118 |
struct gr_info_s gr[2]; |
| 119 |
} ch[2]; |
| 120 |
}; |
| 121 |
|
| 122 |
struct pcm_workingsample |
| 123 |
{ |
| 124 |
int bitindex; |
| 125 |
unsigned char *wordpointer; |
| 126 |
}; |
| 127 |
|
| 128 |
|
| 129 |
extern long freqs[9]; |
| 130 |
extern struct parameter param; |
| 131 |
extern real *pnts[5]; |
| 132 |
|