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

📄 global.h

📁 mpeg2编码解码源程序代码
💻 H
📖 第 1 页 / 共 2 页
字号:

/* global.h, global variables                                               *//* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. *//* * Disclaimer of Warranty * * These software programs are available to the user without any license fee or * royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims * any and all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose.  In no event shall the copyright-holder be liable for any * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and user's * customers, employees, agents, transferees, successors, and assigns. * * The MPEG Software Simulation Group does not represent or warrant that the * programs furnished hereunder are free of infringement of any third-party * patents. * * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware, * are subject to royalty fees to patent holders.  Many of these patents are * general enough such that they are unavoidable regardless of implementation * design. * */#include "..\\mpeg2dec.h"
#include <vfw.h>/* choose between declaration (GLOBAL undefined) * and definition (GLOBAL defined) * GLOBAL is defined in exactly one file mpeg2dec.c) */#ifndef GLOBAL#define EXTERN extern#else#define EXTERN#endif
#define WIDTHBYTES(i)           ((unsigned)((i+31)&(~31))/8) 
#define BUFFER_SIZE				2048
#define PICTURE_START_CODE			0x100
#define SLICE_START_CODE_MIN		0x101
#define SLICE_START_CODE_MAX		0x1AF
#define USER_DATA_START_CODE		0x1B2
#define SEQUENCE_HEADER_CODE		0x1B3
#define EXTENSION_START_CODE		0x1B5
#define SEQUENCE_END_CODE			0x1B7
#define GROUP_START_CODE			0x1B8

#define SYSTEM_END_CODE				0x1B9
#define PACK_START_CODE				0x1BA
#define SYSTEM_START_CODE			0x1BB

#define VIDEO_ELEMENTARY_STREAM		0x1E0

#define PRIVATE_STREAM_1			0x1BD
#define PRIVATE_STREAM_2			0x1BF
#define AUDIO_ELEMENTARY_STREAM_0	0x1C0
#define AUDIO_ELEMENTARY_STREAM_1	0x1C1
#define AUDIO_ELEMENTARY_STREAM_2	0x1C2
#define AUDIO_ELEMENTARY_STREAM_3	0x1C3
#define AUDIO_ELEMENTARY_STREAM_4	0x1C4
#define AUDIO_ELEMENTARY_STREAM_5	0x1C5
#define AUDIO_ELEMENTARY_STREAM_6	0x1C6
#define AUDIO_ELEMENTARY_STREAM_7	0x1C7

#define SUB_SUB						0x20
#define SUB_AC3						0x80
#define SUB_PCM						0xA0


#define SEQUENCE_EXTENSION_ID					1
#define SEQUENCE_DISPLAY_EXTENSION_ID			2
#define QUANT_MATRIX_EXTENSION_ID				3
#define COPYRIGHT_EXTENSION_ID					4
#define PICTURE_DISPLAY_EXTENSION_ID			7
#define PICTURE_CODING_EXTENSION_ID				8

#define ZIG_ZAG									0
#define MB_WEIGHT								32
#define MB_CLASS4								64

#define I_TYPE			1
#define P_TYPE			2
#define B_TYPE			3

#define MACROBLOCK_INTRA				1
#define MACROBLOCK_PATTERN				2
#define MACROBLOCK_MOTION_BACKWARD		4
#define MACROBLOCK_MOTION_FORWARD		8
#define MACROBLOCK_QUANT				16

#define TOP_FIELD		1
#define BOTTOM_FIELD	2
#define FRAME_PICTURE	3

#define MC_FIELD		1
#define MC_FRAME		2
#define MC_16X8			2
#define MC_DMV			3

#define MV_FIELD		0
#define MV_FRAME		1

#define CHROMA420		1
#define CHROMA422		2
#define CHROMA444		3

#define BUFFER_SIZE				2048
#define MAX_FILE_NUMBER			256

#define STORE_RGB24		1
#define STORE_YUY2		2

#define IDCT_MMX		1
#define	IDCT_FPU		2
#define IDCT_REF		3

#define LOCATE_INIT			0
#define LOCATE_FORWARD		1
#define LOCATE_BACKWARD		-1
#define LOCATE_SCROLL		2
#define LOCATE_RIP			3

#define CHANNEL				8

#define TRACK_NONE		15	// DANGEROUS!
#define TRACK_1			0
#define TRACK_2			1
#define TRACK_3			2
#define TRACK_4			3
#define TRACK_5			4
#define TRACK_6			5
#define TRACK_7			6
#define TRACK_8			7

#define FORMAT_AUTO			0
#define FORMAT_AC3			1
#define FORMAT_MPA			2
#define FORMAT_LPCM			3

#define AUDIO_DEMUXALL		0
#define AUDIO_DEMUXONE		1
#define AUDIO_DECODE		2

#define FO_NONE			0
#define FO_FILM			1
#define FO_SWAP			2

#define SRC_NONE		0
#define SRC_LOW			1
#define SRC_MID			2
#define SRC_HIGH		3
#define SRC_UHIGH		4

#define NORM_NONE		0
#define NORM_DYNAMIC	1
#define NORM_MAXIMUM	2

#define TRACK_PITCH		500

#define CRITICAL_ERROR_LEVEL	50



EXTERN int CH[CHANNEL];
EXTERN short Sound_Max;

EXTERN struct AC3Stream{
	FILE					*file;
	char					filename[_MAX_PATH];
	int						rip;
	int						size;
	int						delay;
	unsigned int			mode;
	unsigned int			rate;
}	 ac3[CHANNEL];

EXTERN  struct MPAStream{
	FILE					*file;
	int						rip;
	int						delay;
}	 mpa[CHANNEL];

EXTERN struct PCMStream {
	FILE					*file;
	char					filename[_MAX_PATH];
	int						rip;
	int						size;
	int						delay;
}	pcm;

EXTERN struct PROCESS {
	__int64					length[MAX_FILE_NUMBER];
	__int64					total;
	__int64					run;
	__int64					start;
	__int64					end;
	int						trackleft;
	int						trackright;
	int						locate;
	int						startfile;
	__int64					startloc;
	int						endfile;
	__int64					endloc;
	int						file;
	__int64					lba;
	int						leftfile;
	__int64					leftlba;
	int						rightfile;
	__int64					rightlba;
	unsigned int			op;
	unsigned int			ed;
	unsigned int			elapsed;
	unsigned int			remain;
	float					percent;
}	process;

EXTERN struct CPU {
	BOOL					mmx;
	BOOL					amd;
	BOOL					sse;
}	cpu;


EXTERN int AVI_Flag;
EXTERN int Check_Flag;
EXTERN int D2V_Flag;
EXTERN int DDOverlay_Flag;
EXTERN int Display_Flag;

EXTERN int File_Flag;
EXTERN int File_Limit;
EXTERN int FO_Flag;
EXTERN int iDCT_Flag;
EXTERN int Luminance_Flag;
EXTERN int Pause_Flag;
EXTERN int Rip_Flag;
EXTERN int Scale_Flag;
EXTERN int Statistics_Flag;
EXTERN int Stop_Flag;
EXTERN int Store_Flag;
EXTERN int SystemStream_Flag;

EXTERN unsigned int Track_Flag;
EXTERN int Format_Flag;
EXTERN int AC3_Flag;
EXTERN int MPA_Flag;
EXTERN int Surround_Flag;
EXTERN int Norm_Flag;
EXTERN int SRC_Flag;
EXTERN BOOL AUDIO;
EXTERN unsigned char* audiodst;







EXTERN int VideoPTS, AudioPTS;

EXTERN unsigned short VOB_ID, CELL_ID;
EXTERN char szInput[_MAX_PATH], szOutput[_MAX_PATH], szBuffer[_MAX_PATH], szBlank[1];



/* norm.c */
void Normalize(FILE *WaveIn, int WaveInPos, char *filename, FILE *WaveOut, int WaveOutPos, int size);
/* wavefs44.c */
void InitialSRC(void);
void Wavefs44(FILE *file, int size, unsigned char *buffer);
void EndSRC(FILE *file);
void Wavefs44File(int delay, int now, int total);
void EndWAV(FILE *file, int size);
void DownWAV(FILE *file);
BOOL CheckWAV(void);
EXTERN unsigned char WAVHeader[44]
#ifdef GLOBAL
=
{
	0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00,
	0x57, 0x41, 0x56, 0x45, 0x66, 0x6d, 0x74, 0x20,
	0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
	0x80, 0xbb, 0x00, 0x00, 0x00, 0xee, 0x02, 0x00,
	0x04, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61,
	0x00, 0x00, 0x00, 0x00
}
#endif
;

EXTERN char *NormType[3]
#ifdef GLOBAL
=
{
	"", " drc", " max"
}
#endif
;

EXTERN char *AC3Mode[8]
#ifdef GLOBAL
=
{
	"1+1", "1/0", "2/0", "3/0", "2/1", "3/1", "2/2", "3/2"
}
#endif
;

EXTERN int AC3Rate[32]
#ifdef GLOBAL
=
{
	32, 40, 48, 56, 64, 80, 96, 112, 128, 160,
	192, 224, 256, 320, 384, 448, 512, 576, 640,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
#endif
;

EXTERN unsigned char AC3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 0x94, 0xf5, 0xef, 0x8e, 0xb5, 
	0x76, 0x72, 0x93, 0x46, 0x9b, 0x5f, 0x95, 0x79, 
	0x55, 0x64, 0x04, 0x7d, 0x95, 0x32, 0x4f, 0x81, 
	0x49, 0x79, 0xe8, 0xb7, 0x63, 0xe9, 0x3e, 0x4e, 
	0xd1, 0x33, 0xc1, 0x76, 0x85, 0x05, 0xe1, 0x5e, 
	0x6d, 0x10, 0x0e, 0x38, 0x7a, 0x04, 0xb8, 0x33, 
	0x9d, 0x91, 0x4f, 0x7e, 0xc4, 0x68, 0x43, 0x4b, 
	0xe1, 0x37, 0x04, 0xc9, 0xe2, 0xaf, 0x02, 0x27, 
	0xb9, 0x80, 0xad, 0x78, 0xd6, 0x80, 0xea, 0x1e
}
#endif
;

////////////////////////

#ifdef DISPLAY/* display.c */void Initialize_Display_Process (char *name);void Terminate_Display_Process (void);void Display_Second_Field (void);void dither (unsigned char *src[]);void Initialize_Dither_Matrix (void);#endif/* global variables */EXTERN char Version[]#ifdef GLOBAL  ="mpeg2decode V1.2a, 96/07/19"#endif;EXTERN char Author[]#ifdef GLOBAL  ="(C) 1996, MPEG Software Simulation Group"

⌨️ 快捷键说明

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