Main Page   Class Overview   Pixels   Images   Geometry   Quick Index  

global.h

00001 #ifndef GLOBAL_H
00002 #define GLOBAL_H
00003 
00004 /* global.h, global variables                                               */
00005 
00006 #include "mpeg2dec.h"
00007 #include "mpegfile.h"
00008 
00009 
00010 /* choose between declaration (GLOBAL undefined)
00011  * and definition (GLOBAL defined)
00012  * GLOBAL is defined in exactly one file dec.c)
00013  */
00014 
00015 #ifndef GLOBAL
00016 #define EXTERN extern
00017 #else
00018 #define EXTERN
00019 #endif
00020 
00021 
00022 /* prototypes of global functions */
00023 /* readpic.c */
00024 void Substitute_Frame_Buffer(MpegFile *myvf, int bitstream_framenum, 
00025   int sequence_framenum);
00026 
00027 /* Get_Bits.c */
00028 void Initialize_Buffer(MpegFile *myvf);
00029 void Fill_Buffer(MpegFile *myvf);
00030 unsigned int Show_Bits(MpegFile *myvf,int n);
00031 unsigned int Get_Bits1(MpegFile *myvf);
00032 void Flush_Buffer(MpegFile *myvf,int n);
00033 unsigned int Get_Bits(MpegFile *myvf,int n);
00034 int Get_Byte(MpegFile *myvf);
00035 int Get_Word(MpegFile *myvf);
00036 
00037 /* systems.c */
00038 void Next_Packet(MpegFile *myvf);
00039 int Get_Long(MpegFile *myvf);
00040 void Flush_Buffer32(MpegFile *myvf);
00041 unsigned int Get_Bits32(MpegFile *myvf);
00042 
00043 
00044 /* getblk.c */
00045 void Decode_MPEG1_Intra_Block(MpegFile *myvf,
00046     int comp, int dc_dct_pred[]);
00047 void Decode_MPEG1_Non_Intra_Block(MpegFile *myvf, int comp);
00048 void Decode_MPEG2_Intra_Block(MpegFile *myvf,
00049         int comp, int dc_dct_pred[]);
00050 void Decode_MPEG2_Non_Intra_Block(MpegFile *myvf, int comp);
00051 
00052 /* gethdr.c */
00053 int Get_Hdr(MpegFile *myvf);
00054 void next_start_code(MpegFile *myvf);
00055 int slice_header(MpegFile *myvf);
00056 void marker_bit(MpegFile *myvf,char *text);
00057 
00058 /* getpic.c */
00059 void Decode_Picture(MpegFile *myvf,int bitstream_framenum, 
00060   int sequence_framenum);
00061 void Output_Last_Frame_of_Sequence(MpegFile *myvf, int framenum);
00062 
00063 /* getvlc.c */
00064 int Get_macroblock_type(MpegFile *myvf);
00065 int Get_motion_code(MpegFile *myvf);
00066 int Get_dmvector(MpegFile *myvf);
00067 int Get_coded_block_pattern(MpegFile *myvf);
00068 int Get_macroblock_address_increment(MpegFile *myvf);
00069 int Get_Luma_DC_dct_diff(MpegFile *myvf);
00070 int Get_Chroma_DC_dct_diff(MpegFile *myvf);
00071 
00072 /* idct.c */
00073 void Fast_IDCT(MpegFile *myvf, short *block);
00074 void Initialize_Fast_IDCT(MpegFile *myvf);
00075 
00076 /* Reference_IDCT.c */
00077 void Initialize_Reference_IDCT(MpegFile *myvf);
00078 void Reference_IDCT(MpegFile *myvf, short *block);
00079 
00080 /* motion.c */
00081 void motion_vectors(MpegFile *myvf, int PMV[2][2][2], int dmvector[2],
00082   int motion_vertical_field_select[2][2], int s, int motion_vector_count, 
00083   int mv_format, int h_r_size, int v_r_size, int dmv, int mvscale);
00084 void motion_vector(MpegFile *myvf, int *PMV, int *dmvector,
00085   int h_r_size, int v_r_size, int dmv, int mvscale, int full_pel_vector);
00086 void Dual_Prime_Arithmetic(MpegFile *myvf, int DMV[][2], int *dmvector, int mvx, int mvy);
00087 
00088 /* mpeg2dec.c */
00089 void Error(char *text);
00090 void Warning(char *text);
00091 void Print_Bits(int code, int bits, int len);
00092 
00093 
00094 /* recon.c */
00095 void form_predictions(MpegFile *myvf, int bx, int by, int macroblock_type, 
00096   int motion_type, int PMV[2][2][2], int motion_vertical_field_select[2][2], 
00097   int dmvector[2], int stwtype);
00098 
00099 /* spatscal.c */
00100 void Spatial_Prediction(MpegFile *myvf);
00101 
00102 /* store.c */
00103 void Write_Frame(MpegFile *myvf, unsigned char *src[], int frame);
00104 
00105 
00106 /* global variables */
00107 
00108 EXTERN char Version[]
00109 #ifdef GLOBAL
00110   ="mpeg2decode V1.2a, 96/07/19"
00111 #endif
00112 ;
00113 
00114 EXTERN char Author[]
00115 #ifdef GLOBAL
00116   ="(C) 1996, MPEG Software Simulation Group"
00117 #endif
00118 ;
00119 
00120 
00121 /* zig-zag and alternate scan patterns */
00122 EXTERN unsigned char scan[2][64]
00123 #ifdef GLOBAL
00124 =
00125 {
00126   { /* Zig-Zag scan pattern  */
00127     0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,
00128     12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,
00129     35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,
00130     58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63
00131   },
00132   { /* Alternate scan pattern */
00133     0,8,16,24,1,9,2,10,17,25,32,40,48,56,57,49,
00134     41,33,26,18,3,11,4,12,19,27,34,42,50,58,35,43,
00135     51,59,20,28,5,13,6,14,21,29,36,44,52,60,37,45,
00136     53,61,22,30,7,15,23,31,38,46,54,62,39,47,55,63
00137   }
00138 }
00139 #endif
00140 ;
00141 
00142 /* default intra quantization matrix */
00143 EXTERN unsigned char default_intra_quantizer_matrix[64]
00144 #ifdef GLOBAL
00145 =
00146 {
00147   8, 16, 19, 22, 26, 27, 29, 34,
00148   16, 16, 22, 24, 27, 29, 34, 37,
00149   19, 22, 26, 27, 29, 34, 34, 38,
00150   22, 22, 26, 27, 29, 34, 37, 40,
00151   22, 26, 27, 29, 32, 35, 40, 48,
00152   26, 27, 29, 32, 35, 40, 48, 58,
00153   26, 27, 29, 34, 38, 46, 56, 69,
00154   27, 29, 35, 38, 46, 56, 69, 83
00155 }
00156 #endif
00157 ;
00158 
00159 /* non-linear quantization coefficient table */
00160 EXTERN unsigned char Non_Linear_quantizer_scale[32]
00161 #ifdef GLOBAL
00162 =
00163 {
00164    0, 1, 2, 3, 4, 5, 6, 7,
00165    8,10,12,14,16,18,20,22,
00166   24,28,32,36,40,44,48,52,
00167   56,64,72,80,88,96,104,112
00168 }
00169 #endif
00170 ;
00171 
00172 /* color space conversion coefficients
00173  * for YCbCr -> RGB mapping
00174  *
00175  * entries are {crv,cbu,cgu,cgv}
00176  *
00177  * crv=(255/224)*65536*(1-cr)/0.5
00178  * cbu=(255/224)*65536*(1-cb)/0.5
00179  * cgu=(255/224)*65536*(cb/cg)*(1-cb)/0.5
00180  * cgv=(255/224)*65536*(cr/cg)*(1-cr)/0.5
00181  *
00182  * where Y=cr*R+cg*G+cb*B (cr+cg+cb=1)
00183  */
00184 
00185 /* ISO/IEC 13818-2 section 6.3.6 sequence_display_extension() */
00186 
00187 EXTERN int Inverse_Table_6_9[8][4]
00188 #ifdef GLOBAL
00189 =
00190 {
00191   {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
00192   {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
00193   {104597, 132201, 25675, 53279}, /* unspecified */
00194   {104597, 132201, 25675, 53279}, /* reserved */
00195   {104448, 132798, 24759, 53109}, /* FCC */
00196   {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
00197   {104597, 132201, 25675, 53279}, /* SMPTE 170M */
00198   {117579, 136230, 16907, 35559}  /* SMPTE 240M (1987) */
00199 }
00200 #endif
00201 ;
00202 
00203 
00204 
00205 
00206 
00207 /* output types (Output_Type) */
00208 #define T_YUV   0
00209 #define T_SIF   1
00210 #define T_TGA   2
00211 #define T_PPM   3
00212 #define T_X11   4
00213 #define T_X11HIQ 5
00214 
00215 #endif
00216 

Generated on Tue Jan 8 13:59:10 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001