📄 common.h
字号:
/**********************************************************************
* ISO MPEG Audio Subgroup Software Simulation Group (1996)
* ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
*
* $Header: /MP3Stego Decoder/common.h 5 15/08/98 10:40 Fapp2 $
*
* $Id: common.h,v 1.3 1996/03/28 03:13:37 rowlands Exp $
*
* $Log: /MP3Stego Decoder/common.h $
*
* 5 15/08/98 10:40 Fapp2
* Started revision control on this file.
* Revision 1.3 1996/03/28 03:13:37 rowlands
* Merged layers 1-2 and layer 3 revisions
*
* Revision 1.2 1996/02/14 05:18:36 rowlands
* Cleanups.
*
* Revision 1.1 1996/02/14 03:45:52 rowlands
* Initial revision
*
* Received from FhG
**********************************************************************/
/**********************************************************************
* date programmers comment *
* 2/25/91 Doulas Wong, start of version 1.0 records *
* Davis Pan *
* 5/10/91 W. Joseph Carter Reorganized & renamed all ".h" files *
* into "common.h" and "encoder.h". *
* Ported to Macintosh and Unix. *
* Added additional type definitions for *
* AIFF, double/SANE and "bitstream.c". *
* Added function prototypes for more *
* rigorous type checking. *
* 27jun91 dpwe (Aware) Added "alloc_*" defs & prototypes *
* Defined new struct 'frame_params'. *
* Changed info.stereo to info.mode_ext *
* #define constants for mode types *
* Prototype arguments if PROTO_ARGS *
* 5/28/91 Earle Jennings added MS_DOS definition *
* MsDos function prototype declarations *
* 7/10/91 Earle Jennings added FLOAT definition as double *
*10/ 3/91 Don H. Lee implemented CRC-16 error protection *
* 2/11/92 W. Joseph Carter Ported new code to Macintosh. Most *
* important fixes involved changing *
* 16-bit ints to long or unsigned in *
* bit alloc routines for quant of 65535 *
* and passing proper function args. *
* Removed "Other Joint Stereo" option *
* and made bitrate be total channel *
* bitrate, irrespective of the mode. *
* Fixed many small bugs & reorganized. *
* Modified some function prototypes. *
* Changed BUFFER_SIZE back to 4096. *
* 8/10/92 Amit Gulati Ported to the AIX Platform (RS6000) *
* AIFF string constants redefined *
* 8/27/93 Seymour Shlien, Fixes in Unix and MSDOS ports, *
* Daniel Lauzon, and *
* Bill Truerniet *
*--------------------------------------------------------------------*
* 4/23/92 J. Pineda Added code for Layer III. *
* 11/9/92 Amit Gulati Added defines for layerIII stereo *
* modes. *
* 8/24/93 Masahiro Iwadare Included IS modification in Layer III.*
* Changed for 1 pass decoding. *
* 9/07/93 Toshiyuki Ishino Integrated Layer III with Ver 3.9. *
*--------------------------------------------------------------------*
* 11/20/93 Masahiro Iwadare Integrated Layer III with Ver 4.0. *
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* 6/12/95 Soeren H. Nielsen Bug fix in new_ext(). *
* 7/11/95 Soeren H. Nielsen Added defs. for MPEG-2 LSF *
*--------------------------------------------------------------------*
* Roland Bitto Adapted to MPEG2 low sampling rate *
**********************************************************************/
#ifndef COMMON_H
#define COMMON_H
#define TABLES_PATH "tables/"
/***********************************************************************
*
* Global Include Files
*
***********************************************************************/
//#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
/***********************************************************************
*
* Global Definitions
*
***********************************************************************/
/* General Definitions */
#ifdef MS_DOS
#define FLOAT double
#else
#define FLOAT float
#endif
#define FALSE 0
#define TRUE 1
#define BOOL int
#define NULL_CHAR '\0'
#ifndef PI
#define PI 3.14159265358979
#endif
#define PI4 PI/4
#define PI64 PI/64
#define MONO 1
#define STEREO 2
#define MAX_NAME_SIZE 81
#define SBLIMIT 32
#define SSLIMIT 18
#define FFT_SIZE 1024
#define HAN_SIZE 512
#define SCALE_BLOCK 12
#define SCALE_RANGE 64
#define SCALE 32768
#define CRC16_POLYNOMIAL 0x8005
/* MPEG Header Definitions - ID Bit Values */
#define MPEG_AUDIO_ID 1
#define MPEG_PHASE2_LSF 0 /* 1995-07-11 SHN */
/* MPEG Header Definitions - Mode Values */
#define MPG_MD_STEREO 0 //蛮羘笵.
#define MPG_MD_JOINT_STEREO 1
#define MPG_MD_DUAL_CHANNEL 2
#define MPG_MD_MONO 3 //虫羘笵.
/* Mode Extention */
#define MPG_MD_LR_LR 0
#define MPG_MD_LR_I 1
#define MPG_MD_MS_LR 2
#define MPG_MD_MS_I 3
enum byte_order { order_unknown, order_bigEndian, order_littleEndian };
extern enum byte_order NativeByteOrder;
/* "bit_stream.h" Definitions */
#define MINIMUM 4 /* Minimum size of the buffer in bytes */
#define MAX_LENGTH 32 /* Maximum length of word written or
read from bit stream */
#define READ_MODE 0
#define WRITE_MODE 1
#define ALIGNING 8
#define BINARY 0
#define ASCII 1
#ifndef BS_FORMAT
#define BS_FORMAT ASCII /* BINARY or ASCII = 2x bytes */
#endif
#define BUFFER_SIZE 4096
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))
/***********************************************************************
*
* Global Type Definitions
*
***********************************************************************/
typedef struct {
char encoded_file_name[MAX_NAME_SIZE];
char decoded_file_name[MAX_NAME_SIZE];
int topSb;
/* STEGO */
int extract_hidden;
char hidden_file_name[MAX_NAME_SIZE];
/* STEGO */
}Arguments_t;
/* Structure for Reading Layer II Allocation Tables from File */
typedef struct {
unsigned int steps;
unsigned int bits;
unsigned int group;
unsigned int quant;
} sb_alloc, *alloc_ptr;
typedef sb_alloc al_table[SBLIMIT][16];
/* Header Information Structure */
//================================================================
//IDex:
// One bit to indicate the extended ID of the algorithm.
// It equals '1' for MPEG1 as well as for MPEG2 and '0'
// for MPEG2.5.
//version:
// One bit to indicate the ID of the algorithm. It equals
// '1' for MPEG1 and '0' for MPEG2 as well as for MPEG2.5
// (i. e. for extension to lower sampling frequencies).
//layer:
// Two bits to indicate which layer is used. For Layer3
// the bitstring is '01'.
//protection_bit:
// One bit to indicate whether redundancy has been added
// in the audio bitstream to facilitate error detection and
// concealment. It equals '1' if no redundancy has been
// added and '0' if redundancy has been added.
//bitrate_index:
// Indicates the bitrate. The all zero value indicates the
// 'free format' condition, in which a fixed bitrate which
// does not need to be in the list can be used. Fixed means
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -