Main Page | File List

GLOBAL.H

00001 /************************************************************************
00002  *
00003  *  global.h, global variables for tmndecode (H.263 decoder)
00004  *  Copyright (C) 1995, 1996  Telenor R&D, Norway
00005  *
00006  *  Contacts:
00007  *  Robert Danielsen                  <Robert.Danielsen@nta.no>
00008  *
00009  *  Telenor Research and Development  http://www.nta.no/brukere/DVC/
00010  *  P.O.Box 83                        tel.:   +47 63 84 84 00
00011  *  N-2007 Kjeller, Norway            fax.:   +47 63 81 00 76
00012  *
00013  *  Copyright (C) 1997  University of BC, Canada
00014  *  Modified by: Michael Gallant <mikeg@ee.ubc.ca>
00015  *               Guy Cote <guyc@ee.ubc.ca>
00016  *               Berna Erol <bernae@ee.ubc.ca>
00017  *
00018  *  Contacts:
00019  *  Michael Gallant                   <mikeg@ee.ubc.ca>
00020  *
00021  *  UBC Image Processing Laboratory   http://www.ee.ubc.ca/image
00022  *  2356 Main Mall                    tel.: +1 604 822 4051
00023  *  Vancouver BC Canada V6T1Z4        fax.: +1 604 822 5949
00024  *
00025  ************************************************************************/
00026 
00027 /* Disclaimer of Warranty
00028  * 
00029  * These software programs are available to the user without any license fee
00030  * or royalty on an "as is" basis. The University of British Columbia
00031  * disclaims any and all warranties, whether express, implied, or
00032  * statuary, including any implied warranties or merchantability or of
00033  * fitness for a particular purpose.  In no event shall the
00034  * copyright-holder be liable for any incidental, punitive, or
00035  * consequential damages of any kind whatsoever arising from the use of
00036  * these programs.
00037  * 
00038  * This disclaimer of warranty extends to the user of these programs and
00039  * user's customers, employees, agents, transferees, successors, and
00040  * assigns.
00041  * 
00042  * The University of British Columbia does not represent or warrant that the
00043  * programs furnished hereunder are free of infringement of any
00044  * third-party patents.
00045  * 
00046  * Commercial implementations of H.263, including shareware, are subject to
00047  * royalty fees to patent holders.  Many of these patents are general
00048  * enough such that they are unavoidable regardless of implementation
00049  * design.
00050  * 
00051  */
00052 
00053 
00054 
00055 /* based on mpeg2decode, (C) 1994, MPEG Software Simulation Group and
00056  * mpeg2play, (C) 1994 Stefan Eckart <stefan@lis.e-technik.tu-muenchen.de>
00057  * 
00058  */
00059 
00060 
00061 /* choose between declaration (GLOBAL undefined) and definition (GLOBAL
00062  * defined) GLOBAL is defined in exactly one file (tmndec.c) */
00063 
00064 #include <stdio.h>
00065 #include <winsock.h>
00066 #include "config.h"
00067 
00068 #ifndef GLOBAL
00069 #define EXTERN extern
00070 #else
00071 #define EXTERN
00072 #endif
00073 
00074 
00075 /* this is necessary for the max resolution 16CIF */
00076 #define MAX_MBC    88
00077 #define MAX_MBR    72
00078 
00079 /* scalability layers */
00080 #define MAX_LAYERS    2
00081 
00082 /* From sim.h */
00083 #define PSC        1
00084 #define PSC_LENGTH        17
00085 #define SE_CODE           31
00086 
00087 #define MODE_INTER                      0
00088 #define MODE_INTER_Q                    1
00089 #define MODE_INTER4V                    2
00090 #define MODE_INTRA                      3
00091 #define MODE_INTRA_Q                    4
00092 #define MODE_INTER4V_Q                  5
00093 
00094 /* source formats */
00095 #define SF_SQCIF                        1 /* 001 */
00096 #define SF_QCIF                         2 /* 010 */
00097 #define SF_CIF                          3 /* 011 */
00098 #define SF_4CIF                         4 /* 100 */
00099 #define SF_16CIF                        5 /* 101 */
00100 #define SF_CUSTOM                       6 /* 110 */
00101 #define EXTENDED_PTYPE                  7 /* 111 */
00102 
00103 #define EXTENDED_PAR                    15  /* 1111 */
00104 
00105 /* Pixel aspect ration for custom source format */
00106 #define PAR_0                           0  /* 0000 */
00107 #define PAR_SQUARE                      1  /* 0001 */
00108 #define PAR_CIF                         2  /* 0010 */
00109 #define PAR_525                         3  /* 0011 */
00110 #define PAR_CIF_STRETCHED               4  /* 0100 */
00111 #define PAR_525_STRETCHED               5  /* 0101 */
00112 #define PAR_EXTENDED                    15 /* 1111 */
00113 
00114 /* Scalability modes */
00115 #define SNR_SCALABILITY                             1
00116 #define SPATIAL_SCALABILITY_H                   3
00117 #define SPATIAL_SCALABILITY_V           5
00118 #define SPATIAL_SCALABILITY_HV          7
00119 
00120 /* MODB options in normal PB frames mode */
00121 #define PBMODE_NORMAL                   0
00122 #define PBMODE_MVDB                     1
00123 #define PBMODE_CBPB_MVDB                2
00124 
00125 /* MODB options in improved PB frames mode */
00126 #define PBMODE_BIDIR_PRED                           0
00127 #define PBMODE_CBPB_BIDIR_PRED                  2
00128 #define PBMODE_FRW_PRED                         6
00129 #define PBMODE_CBPB_FRW_PRED                    14
00130 #define PBMODE_BCKW_PRED                            30
00131 #define PBMODE_CBPB_BCKW_PRED                   31
00132 
00133 #define B_DIRECT_PREDICTION               0
00134 #define B_FORWARD_PREDICTION              1
00135 #define B_BACKWARD_PREDICTION             2
00136 #define B_BIDIRECTIONAL_PREDICTION        3
00137 #define B_INTRA_PREDICTION                4
00138 
00139 #define EP_FORWARD_PREDICTION             0
00140 #define EI_EP_UPWARD_PREDICTION           1
00141 #define EP_BIDIRECTIONAL_PREDICTION       2
00142 #define EI_EP_INTRA_PREDICTION            3
00143 
00144 #define B_EI_EP_STUFFING                  5
00145 #define INVALID_MBTYPE                    255
00146 
00147 #define FORWARD_PREDICTION                0
00148 #define BIDIRECTIONAL_PREDICTION          1
00149 
00150 #define ESCAPE                          7167
00151 #define ESCAPE_INDEX                    102
00152 
00153 
00154 /* Intra Mode for Advanced Intra Coding mode */
00155 #define INTRA_MODE_DC                   0
00156 #define INTRA_MODE_VERT_AC              2
00157 #define INTRA_MODE_HORI_AC              3
00158 
00159 /* picture types */
00160 #define PCT_INTRA                       0
00161 #define PCT_INTER                       1
00162 #define PCT_IPB                         2
00163 #define PCT_B                           3
00164 #define PCT_EI                          4
00165 #define PCT_EP                          5
00166 #define PCT_PB                          6
00167 
00168 /* pb frame type */
00169 #define PB_FRAMES                       1
00170 #define IM_PB_FRAMES                    2
00171 
00172 #define ON                              1
00173 #define OFF                             0
00174 
00175 #define YES                             1
00176 #define NO                              0
00177 
00178 /* Some macros */
00179 #define mmax(a, b)        ((a) > (b) ? (a) : (b))
00180 #define mmin(a, b)        ((a) < (b) ? (a) : (b))
00181 #define mnint(a)        ((a) < 0 ? (int)(a - 0.5) : (int)(a + 0.5))
00182 #define sign(a)         ((a) < 0 ? -1 : 1)
00183 
00184 /* prototypes of global functions */
00185 
00186 /* getbits.c */
00187 void initbits _ANSI_ARGS_ ((void));
00188 void fillbfr _ANSI_ARGS_ ((void));
00189 unsigned int showbits _ANSI_ARGS_ ((int n));
00190 unsigned int getbits1 _ANSI_ARGS_ ((void));
00191 void flushbits _ANSI_ARGS_ ((int n));
00192 unsigned int getbits _ANSI_ARGS_ ((int n));
00193 
00194 /* getblk.c */
00195 void getblock _ANSI_ARGS_ ((int comp, int mode, int INTRA_AC_DC, int Mode));
00196 void get_sac_block _ANSI_ARGS_ ((int comp, int mode, int INTRA_AC_DC, int Mode));
00197 
00198 /* gethdr.c */
00199 int getheader _ANSI_ARGS_ ((void));
00200 void startcode _ANSI_ARGS_ ((void));
00201 void initoptions _ANSI_ARGS_ ((void));
00202 void getgobheader _ANSI_ARGS_ ((void));
00203 /* getpic.c */
00204 void getpicture _ANSI_ARGS_ ((int *framenum, int gob));
00205 void putlast _ANSI_ARGS_ ((int framenum));
00206 
00207 /* scalability funcitons */
00208 void UpsampleReferenceLayerPicture _ANSI_ARGS_((void));
00209 void UpsampleComponent _ANSI_ARGS_((unsigned char *enhanced, unsigned char *base,
00210                         int horiz, int vert));
00211 /* advanced intra coding functions */
00212 void Intra_AC_DC_Decode _ANSI_ARGS_ ((short *store_qcoeff, int INTRA_AC_DC, int MBA, int xpos, int ypos, int comp, int newgob));
00213 void fill_null _ANSI_ARGS_ ((int pred[]));
00214 void fill_A _ANSI_ARGS_ ((int pred[], short *store_qcoeff, int xpos, int ypos, int block));
00215 void fill_B _ANSI_ARGS_ ((int pred[], short *store_qcoeff, int xpos, int ypos, int block));
00216 int oddifyclipDC _ANSI_ARGS_ ((int x));
00217 int clipAC _ANSI_ARGS_ ((int x));
00218 int clipDC _ANSI_ARGS_ ((int x));
00219 void interpolate_image _ANSI_ARGS_ ((unsigned char *in, unsigned char
00220                                      *out, int width, int height));
00221 
00222 /* getvlc.c */
00223 int getTMNMV _ANSI_ARGS_ ((void));
00224 int getRVLC  _ANSI_ARGS_ ((void));
00225 int getMCBPC _ANSI_ARGS_ ((void));
00226 int getMODB _ANSI_ARGS_ ((void));
00227 int getMCBPCintra _ANSI_ARGS_ ((void));
00228 int getCBPY _ANSI_ARGS_ ((void));
00229 int getMBTYPE _ANSI_ARGS_ ((int *true_B_cbp, int *true_B_quant));
00230 int getscalabilityCBPC ();
00231 
00232 /* idct.c */
00233 void idct _ANSI_ARGS_ ((short *block));
00234 void init_idct _ANSI_ARGS_ ((void));
00235 
00236 /* idctref.c */
00237 void init_idctref _ANSI_ARGS_ ((void));
00238 void idctref _ANSI_ARGS_ ((short *block));
00239 
00240 /* tmndec.c */
00241 #ifdef USE_TIME
00242 void doframerate (int pb);
00243 #endif
00244 
00245 /* recon.c */
00246 void reconstruct _ANSI_ARGS_ ((int bx, int by, int P, int bdx, int bdy, int MODB, int newgob));
00247 void reconstruct_true_B _ANSI_ARGS_ ((int bx, int by, int true_B_prediction_type));
00248 void reconstruct_ei_ep _ANSI_ARGS_ ((int bx, int by, int ei_ep_prediction_type));
00249 
00250 /* store.c */
00251 void storeframe _ANSI_ARGS_ ((unsigned char *src[], int frame));
00252 void store_enhancement_frame _ANSI_ARGS_ ((unsigned char *src[], int frame));
00253 void save_frame _ANSI_ARGS_ ((unsigned char *src[], int framenum, FILE * file));
00254 void store_one _ANSI_ARGS_ ((char *outname, unsigned char *src[], int offset, int incr, 
00255                              int height));
00256 
00257 /* sac.c */
00258 int decode_a_symbol _ANSI_ARGS_ ((int cumul_freq[]));
00259 void decoder_reset ();
00260 
00261 /* ring_buf.c */
00262 int  get_reference_picture _ANSI_ARGS_ ((void));
00263 void store_picture _ANSI_ARGS_ ((int quality));
00264 
00265 #ifdef DISPLAY
00266 
00267 /* dither.c */
00268 void ord4x4_dither_init _ANSI_ARGS_ ((void));
00269 void ord4x4_dither_frame _ANSI_ARGS_ ((unsigned char *[], unsigned char *));
00270 
00271 /* yuv2rgb.c */
00272 void Color16DitherImage _ANSI_ARGS_ ((unsigned char *[], unsigned char *));
00273 void Color32DitherImage _ANSI_ARGS_ ((unsigned char *[], unsigned char *));
00274 void InitColorDither _ANSI_ARGS_ ((int));
00275 //void init_dither_tab _ANSI_ARGS_ ((void));
00276 
00277 #endif
00278 
00279 /* global variables */
00280 
00281 EXTERN char version[]
00282 #ifdef GLOBAL
00283 = "tmndecode v3.0\n(C) 1997, University of British Columbia, Canada\n(C) 1995, 1996 Telenor R&D, Norway\n"
00284 #endif
00285 ;
00286 
00287 /* zig-zag scan */
00288 EXTERN unsigned char zig_zag_scan[64]
00289 #ifdef GLOBAL
00290 =
00291 {
00292   0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
00293   12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
00294   35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
00295   58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
00296 }
00297 #endif
00298 ;
00299 
00300 EXTERN int lines[]
00301 #ifdef GLOBAL
00302 = {-1,128,176,352,704,1408,-1}
00303 #endif
00304 ;
00305 
00306 EXTERN int pels[7]
00307 #ifdef GLOBAL
00308 = {-1,96,144,288,576,1152,-1}
00309 #endif
00310 ;
00311 
00312 /* other scan orders needed in advanced intra coding mode */
00313 EXTERN unsigned char alternate_horizontal_scan[64]
00314 #ifdef GLOBAL
00315 =
00316 {
00317   0, 1, 2, 3, 8, 9, 16, 17, 10, 11, 4, 5, 6, 7, 15, 14,
00318   13, 12, 19, 18, 24, 25, 32, 33, 26, 27, 20, 21, 22, 23, 28, 29,
00319   30, 31, 34, 35, 40, 41, 48, 49, 42, 43, 36, 37, 38, 39, 44, 45,
00320   46, 47, 50, 51, 56, 57, 58, 59, 52, 53, 54, 55, 60, 61, 62, 63
00321 }
00322 #endif
00323 ;
00324 EXTERN unsigned char alternate_vertical_scan[64]
00325 #ifdef GLOBAL
00326 =
00327 {
00328   0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
00329   41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
00330   51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
00331   53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
00332 }
00333 #endif
00334 ;
00335 
00336 /* color space conversion coefficients
00337  * 
00338  * entries are {crv,cbu,cgu,cgv}
00339  * 
00340  * crv=(255/224)*65536*(1-cr)/0.5 cbu=(255/224)*65536*(1-cb)/0.5
00341  * cgu=(255/224)*65536*(cb/cg)*(1-cb)/0.5
00342  * cgv=(255/224)*65536*(cr/cg)*(1-cr)/0.5
00343  * 
00344  * where Y=cr*R+cg*G+cb*B (cr+cg+cb=1) */
00345 
00346 EXTERN int convmat[8][4]
00347 #ifdef GLOBAL
00348 =
00349 {
00350   {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
00351   {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
00352   {104597, 132201, 25675, 53279}, /* unspecified */
00353   {104597, 132201, 25675, 53279}, /* reserved */
00354   {104448, 132798, 24759, 53109}, /* FCC */
00355   {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
00356   {104597, 132201, 25675, 53279}, /* SMPTE 170M */
00357   {117579, 136230, 16907, 35559}/* SMPTE 240M (1987) */
00358 }
00359 #endif
00360 ;
00361 
00362 EXTERN int quiet;
00363 EXTERN int save_frames;
00364 EXTERN char errortext[256];
00365 EXTERN unsigned char *prev_frame[3], *current_frame[3], *bframe[3];
00366 EXTERN unsigned char *tmp_f[3], *tmp_b[3];
00367 EXTERN unsigned char *edgeframe[3], *edgeframeorig[3], *exnewframe[3];
00368 EXTERN unsigned char *nextedgeframe[3], *nextedgeframeorig[3];
00369 EXTERN unsigned char *enhancementedgeframe[3], *enhacnementedgeframeorig[3];
00370 EXTERN unsigned char *next_I_P_frame[3], *prev_I_P_frame[3], *buffered_frame[3];
00371 EXTERN int MV[2][6][MAX_MBR + 1][MAX_MBC + 2];
00372 EXTERN int true_B_direct_mode_MV[2][5][MAX_MBR + 1][MAX_MBC + 2];
00373 EXTERN int modemap[MAX_MBR + 1][MAX_MBC + 2];
00374 EXTERN int anchorframemodemap[MAX_MBR + 1][MAX_MBC + 2];
00375 EXTERN int predictionmap[MAX_MBR + 1][MAX_MBC + 2];
00376 EXTERN unsigned char *clp;
00377 EXTERN int horizontal_size, vertical_size, mb_width, mb_height;
00378 EXTERN int coded_picture_width, coded_picture_height;
00379 EXTERN int ref_coded_picture_width, ref_coded_picture_height;
00380 EXTERN int chrom_width, chrom_height, blk_cnt;
00381 EXTERN int ref_chrom_width, ref_chrom_height;
00382 EXTERN int pict_type, newgob, gfid, pgfid;
00383 EXTERN int mv_outside_frame;
00384 EXTERN int syntax_arith_coding;
00385 EXTERN int adv_pred_mode;
00386 EXTERN int overlapping_MC;
00387 EXTERN int use_4mv;
00388 EXTERN int pb_frame;
00389 EXTERN int true_B_frame;
00390 EXTERN int scalability_mode;
00391 EXTERN int buffered_framenum;
00392 EXTERN int long_vectors;
00393 EXTERN int fault, expand;
00394 EXTERN int verbose;
00395 EXTERN int refidct;
00396 EXTERN int matrix_coefficients;
00397 EXTERN int temp_ref, prev_non_disposable_temp_ref, next_non_disposable_temp_ref;
00398 EXTERN int pic_quant, quant, source_format, base_source_format;
00399 EXTERN int UFEP;
00400 EXTERN int prev_mv_outside_frame, prev_sac, prev_adv_pred, prev_aic, prev_df;
00401 EXTERN int prev_slice_struct, prev_rps, prev_isd, prev_aivlc, prev_mq;
00402 EXTERN int prev_4mv, prev_long_vectors, prev_obmc;
00403 
00404 /* Following variables are used in H.263+ bitstream decoding */
00405 EXTERN int plus_type;           /* indicates if extended PTYPE exists or
00406                                  * not. */
00407 EXTERN int optional_custom_PCF;
00408 EXTERN int advanced_intra_coding;
00409 EXTERN int deblocking_filter_mode;
00410 EXTERN int slice_structured_mode;
00411 EXTERN int reference_picture_selection_mode;
00412 EXTERN int independently_segmented_decoding_mode;
00413 EXTERN int alternative_inter_VLC_mode;
00414 EXTERN int modified_quantization_mode;
00415 EXTERN int reduced_resolution_update_mode;
00416 EXTERN int reference_picture_resampling_mode;
00417 EXTERN int rtype;
00418 EXTERN int post_filter;
00419 EXTERN int unlimited_unrestricted_motion_vectors;
00420 EXTERN int concealment;
00421 
00422 /* Scalability globals */
00423 EXTERN unsigned char *prev_enhancement_frame[MAX_LAYERS][3], *current_enhancement_frame[MAX_LAYERS][3];
00424 EXTERN unsigned char *curr_reference_frame[3], *upsampled_reference_frame[3];
00425 EXTERN unsigned char *enhance_edgeframeorig[MAX_LAYERS][3], *enhance_edgeframe[MAX_LAYERS][3];
00426 EXTERN unsigned char *tmp_enhance_fwd[MAX_LAYERS][3], *tmp_enhance_up[MAX_LAYERS][3];
00427 EXTERN int enhancement_layer_init[MAX_LAYERS];
00428 EXTERN int enhance_pict;
00429  
00430 /* custom format variables */
00431 EXTERN int CP_PAR_code;
00432 EXTERN int CP_picture_width_indication;
00433 EXTERN int CP_picture_width;
00434 EXTERN int CP_picture_height_indication;
00435 EXTERN int CP_picture_height;
00436 EXTERN int PAR_width;
00437 EXTERN int PAR_height;
00438 
00439 EXTERN int CP_clock_frequency;
00440 EXTERN int SSS_rectangular_slices;
00441 EXTERN int SSS_arbitary_slice_ordering;
00442 EXTERN int enhancement_layer_num;
00443 EXTERN int reference_layer_number;
00444 EXTERN int MF_of_reference_picture_selection;
00445 EXTERN int TRI, TRPI;
00446 EXTERN int temporal_reference_for_prediction;
00447 
00448 #ifdef USE_TIME
00449 EXTERN int framerate;
00450 #ifndef WIN32
00451 EXTERN struct timeval tftarget;
00452 #else
00453 EXTERN unsigned int targetTime;
00454 #endif
00455 #endif
00456 
00457 
00458 EXTERN int trd, trb, bscan, bquant, true_b_trb;
00459 EXTERN int bscan_tab[]
00460 #ifdef GLOBAL
00461 = {2, 4, 6, 8}
00462 #endif
00463 ;
00464 EXTERN int bquant_tab[]
00465 #ifdef GLOBAL
00466 = {5, 6, 7, 8}
00467 #endif
00468 ;
00469 
00470 EXTERN int OM[5][8][8]
00471 #ifdef GLOBAL
00472 = {
00473   {
00474     {4, 5, 5, 5, 5, 5, 5, 4},
00475     {5, 5, 5, 5, 5, 5, 5, 5},
00476     {5, 5, 6, 6, 6, 6, 5, 5},
00477     {5, 5, 6, 6, 6, 6, 5, 5},
00478     {5, 5, 6, 6, 6, 6, 5, 5},
00479     {5, 5, 6, 6, 6, 6, 5, 5},
00480     {5, 5, 5, 5, 5, 5, 5, 5},
00481     {4, 5, 5, 5, 5, 5, 5, 4},
00482   }, {
00483     {2, 2, 2, 2, 2, 2, 2, 2},
00484     {1, 1, 2, 2, 2, 2, 1, 1},
00485     {1, 1, 1, 1, 1, 1, 1, 1},
00486     {1, 1, 1, 1, 1, 1, 1, 1},
00487     {0, 0, 0, 0, 0, 0, 0, 0},
00488     {0, 0, 0, 0, 0, 0, 0, 0},
00489     {0, 0, 0, 0, 0, 0, 0, 0},
00490     {0, 0, 0, 0, 0, 0, 0, 0},
00491   }, {
00492     {0, 0, 0, 0, 0, 0, 0, 0},
00493     {0, 0, 0, 0, 0, 0, 0, 0},
00494     {0, 0, 0, 0, 0, 0, 0, 0},
00495     {0, 0, 0, 0, 0, 0, 0, 0},
00496     {1, 1, 1, 1, 1, 1, 1, 1},
00497     {1, 1, 1, 1, 1, 1, 1, 1},
00498     {1, 1, 2, 2, 2, 2, 1, 1},
00499     {2, 2, 2, 2, 2, 2, 2, 2},
00500   }, {
00501     {0, 0, 0, 0, 1, 1, 1, 2},
00502     {0, 0, 0, 0, 1, 1, 2, 2},
00503     {0, 0, 0, 0, 1, 1, 2, 2},
00504     {0, 0, 0, 0, 1, 1, 2, 2},
00505     {0, 0, 0, 0, 1, 1, 2, 2},
00506     {0, 0, 0, 0, 1, 1, 2, 2},
00507     {0, 0, 0, 0, 1, 1, 2, 2},
00508     {0, 0, 0, 0, 1, 1, 1, 2},
00509   }, {
00510     {2, 1, 1, 1, 0, 0, 0, 0},
00511     {2, 2, 1, 1, 0, 0, 0, 0},
00512     {2, 2, 1, 1, 0, 0, 0, 0},
00513     {2, 2, 1, 1, 0, 0, 0, 0},
00514     {2, 2, 1, 1, 0, 0, 0, 0},
00515     {2, 2, 1, 1, 0, 0, 0, 0},
00516     {2, 2, 1, 1, 0, 0, 0, 0},
00517     {2, 1, 1, 1, 0, 0, 0, 0},
00518 }}
00519 #endif
00520 ;
00521 
00522 EXTERN int roundtab[16]
00523 #ifdef GLOBAL
00524 = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2}
00525 #endif
00526 ;
00527 
00528 EXTERN int MQ_chroma_QP_table[32]
00529 #ifdef GLOBAL
00530  = {0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 
00531 14, 14, 14, 14, 14, 15, 15, 15, 15, 15}
00532 #endif
00533 ;
00534 
00535 /* output */
00536 EXTERN char *outputname;
00537 EXTERN char recon_file_name[100];
00538 EXTERN FILE *recon_file_ptr;
00539 EXTERN char enhance_recon_file_name[MAX_LAYERS][100];
00540 EXTERN FILE *enhance_recon_file_ptr[MAX_LAYERS];
00541 
00542 EXTERN int outtype;
00543 #define T_YUV      0
00544 #define T_SIF      1
00545 #define T_TGA      2
00546 #define T_PPM      3
00547 #define T_X11      4
00548 #define T_YUV_CONC 5
00549 #define T_WIN      6
00550 
00551 
00552 /* For reference picture selection Mode  (Annex N) */
00553 
00554 #define RING_SIZE 8
00555 
00556 EXTERN int   ring_pointer;               /* pointer - to last picture */
00557 EXTERN void *ring_lum[RING_SIZE];    /* luminance */
00558 EXTERN void *ring_Cr[RING_SIZE];     /* chominance */
00559 EXTERN void *ring_Cb[RING_SIZE];
00560 EXTERN int   ring_temporal_reference[RING_SIZE];     /* TR values for the pictures */
00561 EXTERN int   ring_quality[RING_SIZE];     /* picture quality */
00562 EXTERN int   stop_decoder;           /* flag if we completely out of sync */
00563 
00564 /* Back Channel Message Structure */
00565 /* used with Annex N with Videomux channel */
00566 EXTERN struct bcm 
00567 {
00568   int present;           /* set to 1 if bcm is present */
00569   int BT;                /* Back-channel message type (2 bits) */
00570   int URF;               /* Unreliable flag (1 bit) */
00571   int TR;                /* Temporal reference (10 bits) */
00572   int ELNUMI;            /* Enhancement layer number indication (1 bit) */
00573   int ELNUM;             /* Enhancement layer number (4 bits) */
00574   int BCPM;              /* Indicates that BSBI is present (1 bit) */
00575   int BSPI;              /* Back-channel sub bitstream indicator (2 bits) */
00576   int BEPB1;             /* Back-channel emulation prevention bit 1 (1 bit set to 1 */
00577   int GN_MBA;            /* GOB number / Macroblock address (variable length) */
00578   int BEPB2;             /* Back-channel emulation prevention bit 2 (1 bit set to 1 */
00579   int RTR;               /* Requested temporal reference (10 bits) */
00580   int BSTUF;             /* stuffing (variable length) */
00581 } BCM;
00582 
00583 EXTERN struct ld {
00584   /* bit input */
00585   SOCKET pDataSock;
00586   unsigned char rdbfr[2051];
00587   unsigned char *rdptr;
00588   unsigned char inbfr[16];
00589   int incnt;
00590   int bitcnt;
00591   /* block data */
00592   short block[12][64];
00593 } base, *ld;
00594 
00595 EXTERN int MBC, MBR;
00596 
00597 EXTERN unsigned char* dithered_image;
00598 
00599 EXTERN int loopflag;
00600 
00601 EXTERN int FrameRate;
00602 
00603 EXTERN FILE *video;
00604 
00605 
00606 EXTERN unsigned char* recv_buf;
00607 EXTERN int recv_buf_size;
00608 EXTERN int bits_recv_buf;

Generated on Mon May 8 22:27:08 2006 by  doxygen 1.3.9.1