⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.h

📁 mepg 1 layer3软解码源代码,实现了对MP3文件的软件解码
💻 H
📖 第 1 页 / 共 2 页
字号:
/**********************************************************************Copyright (c) 1991 MPEG/audio software simulation group, All Rights Reservedcommon.h**********************************************************************//********************************************************************** * MPEG/audio coding/decoding software, work in progress              * *   NOT for public distribution until verified and approved by the   * *   MPEG/audio committee.  For further information, please contact   * *   Chad Fogg email: <cfogg@xenon.com>                               * *                                                                    * * VERSION 4.1                                                        * *   changes made since last update:                                  * *   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.     * * 7/27/92  Michael Li          (re-)Ported to MS-DOS                 * * 7/27/92  Masahiro Iwadare    Ported to Convex                      * * 8/07/92  mc@tv.tek.com                                             * * 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.    * *--------------------------------------------------------------------* *  7/14/94 Juergen Koller      Fix for HPUX an IRIX in AIFF-Strings  * **********************************************************************//*************************************************************************  Global Conditional Compile Switches************************************************************************//* #define      UNIX            /* Unix conditional compile switch *//* #define      MACINTOSH       /* Macintosh conditional compile switch *//* #define      MS_DOS          /* IBM PC conditional compile switch *//* #define      MSC60           /* Compiled for MS_DOS with MSC v6.0 *//* #define      AIX             /* AIX conditional compile switch    *//* #define      CONVEX          /* CONVEX conditional compile switch */#if defined(MSC60) #ifndef MS_DOS#define MS_DOS#endif#ifndef PROTO_ARGS#define PROTO_ARGS#endif#endif#ifdef  UNIX#define         TABLES_PATH     "tables"  /* to find data files *//* name of environment variable holding path of table files */#define         MPEGTABENV      "MPEGTABLES"#define         PATH_SEPARATOR  "/"        /* how to build paths */#endif  /* UNIX */#ifdef  MACINTOSH/* #define      TABLES_PATH ":tables:"  /* where to find data files */#endif  /* MACINTOSH *//*  * Don't define FAR to far unless you're willing to clean up the  * prototypes */#define FAR /*far*/#ifdef __STDC__#ifndef PROTO_ARGS#define PROTO_ARGS#endif#endif#ifdef CONVEX#define SEEK_SET        0#define SEEK_CUR        1#define SEEK_END        2#endif/* MS_DOS and VMS do not define TABLES_PATH, so OpenTableFile will default   to finding the data files in the default directory *//*************************************************************************  Global Include Files************************************************************************/#include        <stdio.h>#include        <string.h>#include        <math.h>#ifdef  UNIX#include        <unistd.h>#endif  /* UNIX */#ifdef  MACINTOSH#include        <stdlib.h>#include        <console.h>#endif  /* MACINTOSH */#ifdef  MS_DOS#include        <stdlib.h>#ifdef MSC60#include        <memory.h>#else#include        <alloc.h>#include        <mem.h>#endif  /* MSC60 */#endif  /* MS_DOS *//*************************************************************************  Global Definitions************************************************************************//* General Definitions */#ifdef  MS_DOS#define         FLOAT                   double#else#define         FLOAT                   float#endif#define         FALSE                   0#define         TRUE                    1#define         NULL_CHAR               '\0'#define         MAX_U_32_NUM            0xFFFFFFFF#define         PI                      3.14159265358979#define         PI4                     PI/4#define         PI64                    PI/64#define         LN_TO_LOG10             0.2302585093#define         VOL_REF_NUM             0#define         MPEG_AUDIO_ID           1#define         MAC_WINDOW_SIZE         24#define         MONO                    1#define         STEREO                  2#define         BITS_IN_A_BYTE          8#define         WORD                    16#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 - 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/* AIFF Definitions *//*  * Note:  The value of a multi-character constant *        is implementation-defined. */#if !defined(MS_DOS) && !defined(AIX) && !defined(__hpux) && !defined(sgi) && !defined(linux)#define         IFF_LONG#define         IFF_ID_FORM             'FORM'#define         IFF_ID_AIFF             'AIFF'#define         IFF_ID_COMM             'COMM'#define         IFF_ID_SSND             'SSND'#define         IFF_ID_MPEG             'MPEG'#else#define         IFF_ID_FORM             "FORM"#define         IFF_ID_AIFF             "AIFF"#define         IFF_ID_COMM             "COMM"#define         IFF_ID_SSND             "SSND"#define         IFF_ID_MPEG             "MPEG"#endif/* "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#define         BS_FORMAT       ASCII /* BINARY or ASCII = 2x bytes */#define         BUFFER_SIZE     4096#define         MIN(A, B)       ((A) < (B) ? (A) : (B))#define         MAX(A, B)       ((A) > (B) ? (A) : (B))/*************************************************************************  Global Type Definitions************************************************************************//* 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 */typedef struct {    int version;    int lay;    int error_protection;    int bitrate_index;    int sampling_frequency;    int padding;    int extension;    int mode;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -