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

📄 encoder.h

📁 MPEG 2的音频编码软件。喜欢多媒体的开发人员可以看看。
💻 H
📖 第 1 页 / 共 2 页
字号:
/**********************************************************************
 * ISO MPEG Audio Subgroup Software Simulation Group (1996)
 * ISO 13818-3 MPEG-2 Audio Multichannel Encoder
 *
 * $Id: encoder.h 1.9 1996/02/12 07:13:35 rowlands Exp $
 *
 * $Log: encoder.h $
 * Revision 1.9  1996/02/12 07:13:35  rowlands
 * Release following Munich meeting
 *
 * Revision 1.8  1996/02/12 05:51:17  rowlands
 * Added verbosity switch to control text output.
 * Removed reference to unused file "fp100".
 *
 * Revision 1.6.2.1  1995/11/06  04:19:12  rowlands
 * Received from Uwe Felderhoff (IRT)
 *
 * Revision 1.7  1995/08/14  08:02:08  tenkate
 * ML-LSF added Warner ten Kate 7/8/95 (Philips)
 *
 * Revision 1.4.3.1  1995/06/16  08:25:11  rowlands
 * Input from Sang Wook Kim (Samsung AIT)
 *
 * Revision 1.4.2.1  1995/06/16  03:46:42  rowlands
 * Input from Susanne Ritscher (IRT)
 *
 * Revision 1.4.1.2  1995/06/16  02:50:56  rowlands
 * Added dematrix procedure 2 procedure prototypes
 *
 **********************************************************************/

/**********************************************************************
 *   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 function prototypes for more    *
 *                              rigorous type checking.               *
 * 27jun91  dpwe (Aware)        moved "alloc_*" types, pros to common *
 *                              Use ifdef PROTO_ARGS for prototypes   *
 *                              prototypes reflect frame_params struct*
 * 7/10/91  Earle Jennings      Conversion of all floats to FLOAT     *
 * 10/3/91  Don H. Lee          implemented CRC-16 error protection   *
 *                              Additions and revisions are marked    *
 *                              with "dhl" for clarity                *
 * 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.    *
 * 13jul92  Susanne Ritscher    MS-DOS, MSC 6.0 port fix.             *
 * 92-11-06 Soren H. Nielsen	  Changed POWERNORM to 96 dB in order *
 * 			        to get FFT levels conforming to ISO.  *
 *  dec 92 Susanne Ritscher     Changed to multi channel with several *
 * 				options                               *
 **********************************************************************
 *                                                                    *
 *                                                                    *
 *  MPEG/audio Phase 2 coding/decoding multichannel                   *
 *                                                                    *
 *  7/27/93        Susanne Ritscher,  IRT Munich                      *
 *  8/27/93        Susanne Ritscher, IRT Munich                       *
 *                 Channel-Switching is working                       *
 *  9/1/93         Susanne Ritscher,  IRT Munich                      *
 *                 all channels normalized                            *
 *                                                                    *
 *  9/20/93        channel-switching is only performed at a           *
 *                 certain limit of TC_ALLOC dB, which is included    *
 *                 in encoder.h                                       *
 *                                                                    *
 *  Version 1.0                                                       *
 *                                                                    *
 *  07/12/94       Susanne Ritscher,  IRT Munich                      *
 *                 Tel: +49 89 32399 458                              *
 *                 Fax: +49 89 32399 415                              *
 *                                                                    *
 *  Version 1.1                                                       *
 *                                                                    *
 *  02/23/95	   Susanne Ritscher,  IRT Munich                      *
 *                 corrected some bugs                                *
 *                 extension bitstream is working                     *
 *                                                                    *
 *  Version 2.0                                                       *
 *                                                                    *
 *  01/28/97       Frans de Bont, Philips Sound & Vision, Eindhoven   *
 *		    - dynamic crosstalk working for all configurations*
 *		    - prediction working for all configurations	      *
 *		    - extension bitstream fixed			      *
 *		    - fully compliant to DIS 13818-3.2                *
 *                                                                    *				      *		    
 **********************************************************************/
/**********************************************************************
 *                                                                    *
 *  06/06/95       Yeon Bae Thomas Kim, Samsung AIT                   *
 *                 ancillary data is working                          *
 *                                                                    *
 *  06/06/95       Sang Wook Kim, Samsung AIT                         *
 *                 corrected some bugs                                *
 *                                                                    *
 **********************************************************************/
/***********************************************************************
*
*  Encoder Include Files
*
***********************************************************************/

/***********************************************************************
*
*  Encoder Definitions
*
***********************************************************************/

/* General Definitions */

/* Default Input Arguments (for command line control) */

#define DFLT_LAY	2	/* default encoding layer is II */
#define DFLT_MOD	'r'	/* default mode is stereo front channels */
#define DFLT_PSY	1	/* default psych model is 1 */
#define DFLT_SFQ        48     	/* default input sampling rate is 44.1 kHz, now 48kHz 28.6.93 SR */
#define DFLT_BRT        384    	/* default total output bitrate is 384 kbps */
#define DFLT_EMP        'n'    	/* default de-emphasis is none */
#define DFLT_EXT        ".mpg" 	/* default output file extension */
#define DFLT_EXT_EXT    ".ext" 	/* default output file extension of extension bit stream*/
#define DFLT_ML_EXT     ".ml"  	/* default extension for MultiLingual file */
#define	DFLT_VERB	1	/* default level of verbosity */
#define DFLT_NADB	2	/* default number of ancillary data bytes (for DVD !!!) */

#define FILETYPE_ENCODE 'TEXT'
#define CREATOR_ENCODE  'MpgD'

#define TC_ALLOC        0.0

/* This is the smallest MNR a subband can have before it is counted
   as 'noisy' by the logic which chooses the number of JS subbands */
/* Now optionally in fr_ps */

/*#define NOISY_MIN_MNR   0.0*/

/* Psychacoustic Model 1 Definitions */

#define CB_FRACTION     0.33
#define MAX_SNR         1000
#define NOISE           10
#define TONE            20
#define DBMIN           -200.0
#define LAST            -1
#define STOP            -100
#define POWERNORM       90.3090
			/*96.0*/
			/* Full amplitude, 32767, should correspond to
			   96 dB, 1992-11-06 Soren H. Nielsen */
		/* 90.3090  = 20 * log10(32768) to normalize */
                                /* max output power to 96 dB per spec */

/* Psychoacoustic Model 2 Definitions */

#define LOGBLKSIZE      10
#define BLKSIZE         1024
#define HBLKSIZE        513
#define CBANDS          63
#define LXMIN           32.0

/***********************************************************************
*
*  Encoder Type Definitions
*
***********************************************************************/

/* Psychoacoustic Model 1 Type Definitions */

typedef int        IFFT2[FFT_SIZE/2];
typedef int        IFFT[FFT_SIZE];
typedef double     D9[9];
typedef double     D10[10];
typedef double     D640[640];
typedef double     D1408[1408];
typedef double     DFFT2[FFT_SIZE/2];
typedef double     DFFT[FFT_SIZE];
typedef double     DSBL[SBLIMIT];
typedef double     D2SBL[2][SBLIMIT];
typedef double     D5SBL[5][SBLIMIT];
typedef double     D7SBL[7][SBLIMIT];  /*added because of 7 channels, 8/10/93, SR*/
typedef double     D12SBL[12][SBLIMIT];  /*added because of 12 channels, 8/10/93, SR*/

typedef struct {
        int        line;
        double     bark, hear, x;
} g_thres, *g_ptr;

typedef struct {
        double     x;
        int        type, next, map;
} mask, *mask_ptr;

/* Psychoacoustic Model 2 Type Definitions */

typedef int        ICB[CBANDS];
typedef int        IHBLK[HBLKSIZE];
typedef FLOAT      F32[32];
typedef FLOAT      F2_32[2][32];
typedef FLOAT      FCB[CBANDS];
typedef FLOAT      FCBCB[CBANDS][CBANDS];
typedef FLOAT      FBLK[BLKSIZE];
typedef FLOAT      FHBLK[HBLKSIZE];
typedef FLOAT      F2HBLK[2][HBLKSIZE];
typedef FLOAT      F22HBLK[2][2][HBLKSIZE];
typedef double     DCB[CBANDS];

/***********************************************************************
*
*  Encoder Variable External Declarations
*
***********************************************************************/

#ifdef MS_DOS
/* extern unsigned _stklen = 16384; */ /* removed, 92-07-13 sr */
#endif

/***********************************************************************
*
*  Encoder Function Prototype Declarations
*
***********************************************************************/

/* The following functions are in the file "musicin.c" */

extern
void
obtain_parameters(
	frame_params		*fr_ps,
	int			*psy,
	long unsigned int	*num_samples,
	long unsigned int	*num_samples_ml,
	char			*original_file_name,
	char			*encoded_file_name,
	IFF_AIFF		*pcm_aiff_data,
	IFF_AIFF		*pcm_aiff_data_ml,
	int			*aiff,
	int			*byte_per_sample,
	int 			*mat_mode,
	int 			*aug_mat_mode,
	int			*cha_sw,
	int			*aug_cha_sw,
	char			*encoded_file_name_ext,
	int			*bit_rate,
	char			*encoded_file_name_mpg,
	int			*dyn_cross,
	int			*dyn_cross_LR,
	int			*aug_dyn_cross,
	int                     *ancillaryUse,
	int			*verbosity
);

extern
void
parse_args(
	int			argc,
	char			**argv,
	frame_params		*fr_ps,
	int			*psy,
	long unsigned int	*num_samples,
	long unsigned int	*num_samples_ml,
	char			*original_file_name,
	char			*encoded_file_name,
	IFF_AIFF		*pcm_aiff_data,
	IFF_AIFF		*pcm_aiff_data_ml,
	int			*aiff,
	int			*byte_per_sample,
	int 			*mat_mode,
	int 			*aug_mat_mode,
	int			*cha_sw,
	int			*aug_cha_sw,
	char			*encoded_file_name_ext,
	int			*bit_rate,
	char			*encoded_file_name_mpg,
	int			*dyn_cross,
	int			*dyn_cross_LR,
	int			*aug_dyn_cross,
	int                     *ancillaryUse,
	int			*verbosity
);

extern void   print_config(frame_params *fr_ps, int *psy, long unsigned int *num_samples, char *inPath, char *outPath, int *aiff);


static void   usage();
extern void   aiff_check(char *file_name, IFF_AIFF *pcm_aiff_data);


/* The following functions are in the file "encode.c" */

extern unsigned long  read_samples (FILE *musicin,
				    long int *sample_buffer,
				    long unsigned int num_samples,
				    long unsigned int frame_size,
				    int *byte_per_sample,
				    int *aiff);

extern
unsigned long
get_audio (
	FILE		*musicin,
	double		(*buffer)[1152],
	long unsigned int num_samples,
	int		stereo,
	IFF_AIFF	*aiff_ptr,
	int		stereomc,
	int		stereoaug,
	frame_params	*fr_ps,
	int		*aiff,
	int		*byte_per_sample,
	double		(*buffer_matr)[1152]
);

extern void 	   normalizing (double (*sb_sample)[3][12][SBLIMIT], frame_params *fr_ps);
#ifdef Augmentation_7ch
extern void 	   normalizing_aug (double (*sb_sample)[3][12][SBLIMIT], frame_params *fr_ps);
#endif
extern void 	   matricing (double (*sb_sample)[3][12][SBLIMIT], frame_params *fr_ps);
#ifdef Augmentation_7ch
extern void 	   matricing_aug (double (*sb_sample)[3][12][SBLIMIT], frame_params *fr_ps);
#endif
extern void        read_ana_window (double *ana_win);
extern void        window_subband (double **buffer, double *z, int k);
extern void        create_ana_filter (double (*filter)[64]);
extern void        filter_subband (double *z, double *s);
extern void        encode_info (frame_params *fr_ps, Bit_stream_struc *bs);
extern void        encode_info_mc1 (frame_params *fr_ps, Bit_stream_struc *bs);
extern void        encode_info_mc2 (frame_params *fr_ps, Bit_stream_struc *bs);
#ifdef Augmentation_7ch
extern void        encode_info_aug (frame_params *fr_ps, Bit_stream_struc *bs);
#endif
extern void        encode_info_ext1 (frame_params *fr_ps, Bit_stream_struc *bs_ext);
extern void        encode_info_ext2 (frame_params *fr_ps, Bit_stream_struc *bs_ext, unsigned int crc);
extern double      mod (double a);
extern void        I_combine_LR (double (*sb_sample)[3][12][SBLIMIT], double (*joint_sample)[3][12][SBLIMIT]);
extern void 	   II_combine_LR (double (*sb_sample)[3][12][SBLIMIT], double (*joint_sample)[3][12][SBLIMIT],
					    int sblimit);
extern void        I_scale_factor_calc (double (*sb_sample)[3][12][SBLIMIT], unsigned int (*scalar)[3][SBLIMIT],
					    int stereo);
extern void 	   II_scale_factor_calc (frame_params *fr_ps, double (*sb_sample)[3][12][SBLIMIT],
					unsigned int (*scalar)[3][SBLIMIT], int sblimit, int l, int m);

⌨️ 快捷键说明

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