📄 common.h
字号:
typedef sb_alloc al_table[SBLIMIT][16];
/* Header Information Structure */
typedef struct {
int version;
int lay;
int error_protection;
int bitrate_index;
int bitrate_index1;
int bitrate_index2;
int sampling_frequency;
int padding;
int extension;
int mode;
int mode_ext;
int copyright;
int original;
int emphasis;
int center; /* center present */
int surround; /* surrounds present*/
int dematrix_procedure; /* type of dematricing */
int lfe; /* low freequency effect channel*/
int audio_mix; /* large or small room */
int no_of_multi_lingual_ch;/* number of multilingual channels */
int multi_lingual_fs; /* fs of main channels and ML-fs are the same*/
int multi_lingual_layer; /* Layer IIML or Layer II ML is used*/
int mc_prediction[8]; /* prediction bit *//* 28.9. R.S. changed name and length like DIS*/
int mc_pred_coeff[8][4][3];/* bits for prediction coefficient */
int tc_alloc[12]; /* transmission channel allocation in each sbgroup*/
int mc_predsi[8][4]; /* predictor select information*/
int mc_delay_comp[8][4]; /* 3 bit for delay compensations factor */
int ext_bit_stream_present;
int copyright_ident_bit; /* additional copyright bits */
int copyright_ident_start; /* */
int n_ad_bytes;
int ad_bytes_crc_info; /* for MC-CRC -check 7.12.94 R.S */
int mc_prediction_on;
int tc_sbgr_select;
int dyn_cross_on;
int dyn_cross_LR;
int dyn_cross_mode[12];
int dyn_second_stereo;
int tc_allocation;
int ext_syncword; /* 12 bits */
int ext_crc_check; /* 16 bits */
int ext_length; /* 11 bits *//* Important!! in bits per frame */
int reserved_bit;
unsigned int ext_crc_bits[15];
} layer, *the_layer;
/* Parent Structure Interpreting some Frame Parameters in Header */
typedef struct {
layer *header; /* raw header information */
int actual_mode; /* when writing IS, may forget if 0 chs */
al_table *alloc; /* bit allocation table read in */
int tab_num; /* number of table as loaded */
int stereo; /* 1 for mono, 2 for stereo */
int mc_channel;
int jsbound; /* first band of joint stereo coding */
double mnr_min; /* mnr for dynamic bitallocation */
int sblimit; /* total number of sub bands */
} frame_params;
/* Double and SANE Floating Point Type Definitions */
typedef struct IEEE_DBL_struct {
unsigned long hi;
unsigned long lo;
} IEEE_DBL;
typedef struct SANE_EXT_struct {
unsigned long l1;
unsigned long l2;
unsigned short s1;
} SANE_EXT;
/* AIFF Type Definitions */
typedef char ID[4];
typedef struct identifier_struct{
ID name;
long ck_length;
}identifier;
typedef struct ChunkHeader_struct {
ID ckID;
long ckSize;
} ChunkHeader;
typedef struct Chunk_struct {
ID ckID;
long ckSize;
ID formType;
} Chunk;
typedef struct CommonChunk_struct {
ID ckID;
long ckSize;
short numChannels;
unsigned long numSampleFrames;
short sampleSize;
char sampleRate[10];
} CommonChunk;
typedef struct SoundDataChunk_struct {
ID ckID;
long ckSize;
unsigned long offset;
unsigned long blockSize;
} SoundDataChunk;
typedef struct blockAlign_struct {
unsigned long offset;
unsigned long blockSize;
} blockAlign;
typedef struct IFF_AIFF_struct {
short numChannels;
unsigned long numSampleFrames;
short sampleSize;
double sampleRate;
ID/*char**/ sampleType;/*must be allocated 21.6.93 SR*/
blockAlign blkAlgn;
} IFF_AIFF;
/* "bit_stream.h" Type Definitions */
typedef struct bit_stream_struc {
FILE *pt; /* pointer to bit stream device */
unsigned char *buf; /* bit stream buffer */
int buf_size; /* size of buffer (in number of bytes) */
long totbit; /* bit counter of bit stream */
int buf_byte_idx; /* pointer to top byte in buffer */
int buf_bit_idx; /* pointer to top bit of top byte in buffer */
int mode; /* bit stream open in read or write mode */
int eob; /* end of buffer index */
int eobs; /* end of bit stream flag */
char format;
/* format of file in rd mode (BINARY/ASCII) */
} Bit_stream_struc;
/***********************************************************************
*
* Global Variable External Declarations
*
***********************************************************************/
extern Bit_stream_struc bs_ext;
extern layer info;
extern int read_from_ext;
extern char *mode_names[4];
extern char *layer_names[3];
extern double s_freq[4];
extern int bitrate[3][15];
extern double multiple[64];
extern int sb_groups[12];
extern unsigned char bs_tmp_buf[50];
/***********************************************************************
*
* Global Function Prototype Declarations
*
***********************************************************************/
/* The following functions are in the file "common.c" */
#ifdef PROTO_ARGS
extern FILE *OpenTableFile(char*);
extern int read_bit_alloc(int, al_table*);
extern int pick_table(frame_params*);
extern int js_bound(int, int);
extern void hdr_to_frps(frame_params*);
extern void WriteHdr(frame_params*, FILE*);
extern void WriteBitAlloc(unsigned int[2][SBLIMIT], frame_params*,
FILE*);
extern void WriteScale(unsigned int[2][SBLIMIT],
unsigned int[2][SBLIMIT], unsigned int[2][3][SBLIMIT],
frame_params*, FILE*);
extern void WriteSamples(int, unsigned int/*far*/[SBLIMIT],
unsigned int[SBLIMIT], frame_params*, FILE*);
extern int NumericQ(char*);
extern int BitrateIndex(int, int);
extern int SmpFrqIndex(long);
extern int memcheck(char*, int, int);
extern void *mem_alloc(unsigned long, char*);
extern void mem_free(void**);
extern void double_to_extended(double*, char[10]);
extern void extended_to_double(char[10], double*);
extern int aiff_read_headers(FILE*, IFF_AIFF*, int*);
extern int aiff_seek_to_sound_data(FILE*);
extern int aiff_write_headers(FILE*, IFF_AIFF*);
extern void refill_buffer(Bit_stream_struc*);
extern void empty_buffer(Bit_stream_struc*, int);
extern void open_bit_stream_w(Bit_stream_struc*, char*, int);
extern int open_bit_stream_r(Bit_stream_struc*, char*, int);
extern void close_bit_stream_r(Bit_stream_struc*);
extern void close_bit_stream_w(Bit_stream_struc*);
extern void alloc_buffer(Bit_stream_struc*, int);
extern void desalloc_buffer(Bit_stream_struc*);
extern void back_track_buffer(Bit_stream_struc*, int);
extern void skipbits(Bit_stream_struc *, unsigned int);
extern void skip_ext_bits(Bit_stream_struc *, unsigned int);
extern unsigned int get1bit(Bit_stream_struc*);
extern unsigned int local_get1bit(Bit_stream_struc*);
extern void put1bit(Bit_stream_struc*, int);
extern unsigned long look_ahead(Bit_stream_struc*, int);
extern unsigned long getbits(Bit_stream_struc*, int);
extern unsigned int local_getbits(Bit_stream_struc*, int);
extern void putbits(Bit_stream_struc*, unsigned int, int);
extern void byte_ali_putbits(Bit_stream_struc*, unsigned int, int);
extern unsigned long byte_ali_getbits(Bit_stream_struc*, int);
extern unsigned long sstell(Bit_stream_struc*);
extern int end_bs(Bit_stream_struc*);
extern int seek_sync(Bit_stream_struc*, long, int);
extern void I_CRC_calc(frame_params*, unsigned int[2][SBLIMIT],
unsigned int*);
extern void II_CRC_calc(frame_params*, unsigned int[5][SBLIMIT],
unsigned int[5][SBLIMIT], unsigned int*);
extern void mc_error_check(frame_params*, unsigned int[7][SBLIMIT],
unsigned int[7][SBLIMIT], unsigned int*);
extern int mc_ext_error_check(void);
extern void update_CRC(unsigned int, unsigned int, unsigned int*);
extern void read_absthr(FLOAT*, long);
extern void program_information(void);
extern int js_bound1(int, int); /* other bounderies for multichannel*/
#ifdef MACINTOSH
extern void set_mac_file_attr(char[MAX_NAME_SIZE], short, OsType,
OsType);
#endif
#ifdef MS_DOS
extern char *new_ext(char *filename, char *extname); /* 92-08-19 shn */
#endif
#else
extern FILE *OpenTableFile();
extern int read_bit_alloc();
extern int pick_table();
extern int js_bound();
extern void hdr_to_frps();
extern void WriteHdr();
extern void WriteBitAlloc();
extern void WriteScale();
extern void WriteSamples();
extern int NumericQ();
extern int BitrateIndex();
extern int SmpFrqIndex();
extern int memcheck();
extern void *mem_alloc();
extern void mem_free();
extern void double_to_extended();
extern void extended_to_double();
extern int aiff_read_headers();
extern int aiff_seek_to_sound_data();
extern int aiff_write_headers();
extern void refill_buffer();
extern void empty_buffer();
extern void open_bit_stream_w();
extern int open_bit_stream_r();
extern void close_bit_stream_r();
extern void close_bit_stream_w();
extern void alloc_buffer();
extern void desalloc_buffer();
extern void back_track_buffer();
extern int mc_ext_header();
extern int mc_ext_error_check();
extern unsigned int get1bit();
extern void put1bit();
extern unsigned long look_ahead();
extern unsigned long getbits();
extern void putbits();
extern void byte_ali_putbits();
extern unsigned long byte_ali_getbits();
extern unsigned long sstell();
extern int end_bs();
extern int seek_sync();
extern void I_CRC_calc();
extern void II_CRC_calc();
extern void update_CRC();
extern void read_absthr();
extern void program_information();
#ifdef MSDOS
extern char *new_ext(); /* 92-08-19 shn */
#endif
#endif
#ifdef CONCAT
Bit_stream_struc bs_concat; /*23/03/1995 JMZ Concat */
#endif CONCAT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -