DECODER.H
上传用户:njqiyou
上传日期:2007-01-08
资源大小:574k
文件大小:12k
源码类别:

mpeg/mp3

开发平台:

C/C++

  1. /**********************************************************************
  2.  * Copyright (c) 1995 MPEG/audio software simulation group
  3.  * All Rights Reserved
  4.  * $Id: decoder.h,v 1.1 1996/04/18 03:39:59 rowlands Exp $
  5.  *
  6.  * MPEG/audio coding/decoding software, work in progress
  7.  *   NOT for public distribution until verified and approved by the
  8.  *   MPEG/audio committee.
  9.  *
  10.  * $Log: decoder.h,v $
  11.  * Revision 1.1  1996/04/18 03:39:59  rowlands
  12.  * Initial revision
  13.  *
  14.  * Revision 1.3  1995/04/06  05:01:42  rowlands
  15.  * Ran decoder through protoize to convert to ANSI C.
  16.  *
  17.  * Revision 1.2  1995/04/06  04:56:00  rowlands
  18.  * Added header, RCS info and cleaned up prototypes in initial revision.
  19.  *
  20.  **********************************************************************/
  21. /**********************************************************************
  22.  * VERSION 2.5                                                        *
  23.  *   changes made since last update:                                  *
  24.  *   date   programmers                comment                        *
  25.  * 2/25/91  Douglas Wong        start of version 1.0 records          *
  26.  * 3/06/91  Douglas Wong        rename setup.h to dedef.h             *
  27.  *                              removed extraneous variables          *
  28.  *                              removed window_samples (now part of   *
  29.  *                              filter_samples)                       *
  30.  * 3/07/91  Davis Pan           changed output file to "codmusic"     *
  31.  * 5/10/91  Vish (PRISM)        Ported to Macintosh and Unix.         *
  32.  *                              Incorporated new "out_fifo()" which   *
  33.  *                              writes out last incomplete buffer.    *
  34.  *                              Incorporated all AIFF routines which  *
  35.  *                              are also compatible with SUN.         *
  36.  *                              Incorporated user interface for       *
  37.  *                              specifying sound file names.          *
  38.  *                              Also incorporated user interface for  *
  39.  *                              writing AIFF compatible sound files.  *
  40.  * 27jun91  dpwe (Aware)        Added musicout and &sample_frames as  *
  41.  *                              args to out_fifo (were glob refs).    *
  42.  *                              Used new 'frame_params' struct.       *
  43.  *                              Clean,simplify, track clipped output  *
  44.  *                              and total bits/frame received.        *
  45.  * 7/10/91  Earle Jennings      changed to floats to FLOAT            *
  46.  *10/ 1/91  S.I. Sudharsanan,   Ported to IBM AIX platform.           *
  47.  *          Don H. Lee,                                               *
  48.  *          Peter W. Farrett                                          *
  49.  *10/ 3/91  Don H. Lee          implemented CRC-16 error protection   *
  50.  *                              newly introduced functions are        *
  51.  *                              buffer_CRC and recover_CRC_error      *
  52.  *                              Additions and revisions are marked    *
  53.  *                              with "dhl" for clarity                *
  54.  * 2/11/92  W. Joseph Carter    Ported new code to Macintosh.  Most   *
  55.  *                              important fixes involved changing     *
  56.  *                              16-bit ints to long or unsigned in    *
  57.  *                              bit alloc routines for quant of 65535 *
  58.  *                              and passing proper function args.     *
  59.  *                              Removed "Other Joint Stereo" option   *
  60.  *                              and made bitrate be total channel     *
  61.  *                              bitrate, irrespective of the mode.    *
  62.  *                              Fixed many small bugs & reorganized.  *
  63.  **********************************************************************
  64.  *                                                                    *
  65.  *                                                                    *
  66.  *  MPEG/audio Phase 2 coding/decoding multichannel                   *
  67.  *                                                                    *
  68.  *  Version 1.0                                                       *
  69.  *                                                                    *
  70.  *  7/27/93        Susanne Ritscher,  IRT Munich                      *
  71.  *                                                                    *
  72.  *                  thanks to                                         *
  73.  *                  Ralf Schwalbe,    Telekom FTZ Berlin              *
  74.  *                  Heiko Purnhagen,  Uni Hannover                    *
  75.  *                                                                    *
  76.  *  Version 2.0                                                       *
  77.  *                                                                    *
  78.  *  8/27/93        Susanne Ritscher, IRT Munich                       *
  79.  *                 Channel-Switching is working                       *
  80.  *                                                                    *
  81.  *  Version 2.1                                                       *
  82.  *                                                                    *
  83.  *  9/1/93         Susanne Ritscher,  IRT Munich                      *
  84.  *                 all channels normalized                            *
  85.  *                                                                    *
  86.  *  Version 3.0                                                       *
  87.  *                                                                    *
  88.  *  06/16/94       Ralf Schwalbe, Telekom FTZ Berlin                  *
  89.  *                 all sources and variables adapted due to MPEG-2 -  *
  90.  *                 DIS from March 1994                                *
  91.  *                  - dematrix and denormalize procedure              *
  92.  *                  - new tc - allocation (0-7)                       *
  93.  *                  - some new structures and variables as a basis    *
  94.  *                    for further decoding modes                      *
  95.  **********************************************************************
  96.  *       *
  97.  *  Version 1.0 Shareware                                             *
  98.  *                                                                    *
  99.  *  07/12/94       Ralf Schwalbe,  Telekom FTZ Berlin                 *
  100.  *                 Tel: +49 30 6708 2406                              *
  101.  *                 Fax: +49 30 6774 539                               *
  102.  *       *
  103.  *  04/11/94    Ralf Schwalbe. Telekom FTZ Berlin                  *
  104.  *                  - decoding extension bitstream                    *
  105.  *                  - some new subroutines, globale variables and     *
  106.  *                    structures (important to handle the ext. bitst.)*
  107.  *                  - changed all functions to ANSI-C funktion header *
  108.  *     - corrected some bugs to decode bitstreams > 512kB*
  109.  *       *
  110.  *  Version 1.1 Shareware                                             *
  111.  *                                                                    *
  112.  *  07/12/94       Ralf Schwalbe,  Telekom FTZ Berlin                 *
  113.  *                 Tel: +49 30 6708 2406                              *
  114.  *                 Fax: +49 30 6774 539                               *
  115.  *       *
  116.  **********************************************************************/
  117. /***********************************************************************
  118. *
  119. *  Decoder Include Files
  120. *
  121. ***********************************************************************/
  122. /***********************************************************************
  123. *
  124. *  Decoder Definitions
  125. *
  126. ***********************************************************************/
  127. #define  DFLT_OPEXT        ".dec"   /* default output file name extension */
  128. #define  DFLT_OPEXT_EXT    ".ext"  /* default input for extension file */
  129. #define  FILTYP_DEC_AIFF   "AIFF" /* '-> " . 7/13/92. sr */
  130. #define  FILTYP_DEC_BNRY   "TEXT" /* '-> " . 7/13/92. sr */
  131. #define  CREATR_DEC_AIFF   "Sd2a" /* '-> " . 7/13/92. sr */
  132. #define  CREATR_DEC_BNRY   "????" /* '-> " . 7/13/92. sr */
  133. #define   SYNC_WORD         (long) 0xfff
  134. #define   SYNC_WORD_LNGTH   12
  135. #define   MUTE              0
  136. #define   STEP     0.03125  /* 13.10.93 R.S. step for prediction */
  137. #define   PREDDEL           (2+7)        /* max. delay in prediction, HP 08-nov-94 */
  138. /***********************************************************************
  139. *
  140. *  Decoder Type Definitions
  141. *
  142. ***********************************************************************/
  143. /***********************************************************************
  144. *
  145. *  Decoder Variable External Declarations
  146. *
  147. ***********************************************************************/
  148. extern int bits_in_frame;
  149. extern unsigned long frameNum;
  150. extern unsigned int ext_length;
  151.  
  152. /***********************************************************************
  153. *
  154. *  Decoder Function Prototype Declarations
  155. *
  156. ***********************************************************************/
  157. /* The following functions are in the file "musicout.c" */
  158. #ifdef   PROTO_ARGS
  159. extern void   usage(void);
  160. #else
  161. extern void   usage();
  162. #endif
  163. /* The following functions are in the file "decode.c" */
  164. #ifdef   PROTO_ARGS
  165. extern void   decode_info(Bit_stream_struc*, frame_params*);
  166. extern void   II_decode_bitalloc(Bit_stream_struc*, unsigned int[5][SBLIMIT],
  167.    frame_params*, int*, int*);
  168. extern void   II_decode_scale(Bit_stream_struc*, unsigned int[5][SBLIMIT],
  169.    unsigned int[5][SBLIMIT], unsigned int[5][3][SBLIMIT],
  170.    frame_params*, int*, int*);
  171. extern void   II_buffer_sample(Bit_stream_struc*, unsigned int[5][3][SBLIMIT],
  172.    unsigned int[5][SBLIMIT], frame_params*);
  173. extern void   II_buffer_samplemc(Bit_stream_struc*, unsigned int[5][3][SBLIMIT],
  174.    unsigned int[5][SBLIMIT], frame_params*, int*);
  175. extern void   read_quantizer_table(double[17], double[17]);
  176. extern void   II_dequantize_sample(unsigned int[5][3][SBLIMIT],
  177.    unsigned int[5][SBLIMIT], double[5][SBLIMIT][3][12],
  178.    frame_params*, int*);
  179. extern void   II_dequantize_samplemc(unsigned int[5][3][SBLIMIT],
  180.    unsigned int[5][SBLIMIT], double[5][SBLIMIT][3][12],
  181.    frame_params*, int*, int*);
  182. extern void   read_scale_factor(double[SCALE_RANGE]);
  183. extern void   II_denormalize_sample(double[5][SBLIMIT][3][12],
  184.    unsigned int[5][3][SBLIMIT], frame_params*, int, int*);
  185. extern void   II_denormalize_samplemc(double[5][SBLIMIT][3][12],
  186.    unsigned int[5][3][SBLIMIT], frame_params*, int, int*,
  187.    int*);
  188. extern void   create_syn_filter(double[64][SBLIMIT]);
  189. extern int    SubBandSynthesis (double*, int, long*);
  190. extern void   read_syn_window(double[HAN_SIZE]);
  191. extern void   window_sample(double*, double*);
  192. extern void   out_fifo(long[5][3][SBLIMIT], int, frame_params*, int, FILE*,
  193.    unsigned long*);
  194. extern void   buffer_CRC(Bit_stream_struc*, unsigned int*);
  195. extern void   recover_CRC_error(long[5][3][SBLIMIT], int, frame_params*,
  196.    FILE*, unsigned long*);
  197. extern void   mc_header(Bit_stream_struc*, frame_params*);
  198. extern int    mc_ext_header(void);
  199. extern int    mc_ext_error_check(void);
  200. extern void   mc_composite_status_info(Bit_stream_struc*, frame_params*);
  201. extern
  202. void
  203. dematricing(
  204. double (*pcm_sample)[SBLIMIT][3][12],
  205. frame_params *fr_ps,
  206. double (*pred_buf)[8][36+PREDDEL]
  207. );
  208. #else
  209. extern void   decode_info();
  210. extern void   II_decode_bitalloc();
  211. extern void   II_decode_scale();
  212. extern void   II_buffer_sample();
  213. extern void   read_quantizer_table();
  214. extern void   II_dequantize_sample();
  215. extern void   read_scale_factor();
  216. extern void   II_denormalize_sample();
  217. extern void   create_syn_filter();
  218. extern int    SubBandSynthesis ();
  219. extern void   read_syn_window();
  220. extern void   window_sample();
  221. extern void   out_fifo();
  222. extern int    mc_ext_header();
  223. extern int    mc_ext_error_check();
  224. extern void   buffer_CRC();
  225. extern void   recover_CRC_error();
  226. #endif