?? sim.h
字號:
#define ACK 5 /* ACK signals need returning */#define NACK 6 /* NACK signals need returning */#define ACK_NACK 7 /* ACK and NACK */#define MODE_INTER 0#define MODE_INTER_Q 1#define MODE_INTER4V 2#define MODE_INTRA 3#define MODE_INTRA_Q 4#define MODE_INTER4V_Q 5#define PBMODE_NORMAL 0#define PBMODE_MVDB 1#define PBMODE_CBPB_MVDB 2#define PBMODE_BIDIR_PRED 0#define PBMODE_CBPB_BIDIR_PRED 2#define PBMODE_FRW_PRED 6#define PBMODE_CBPB_FRW_PRED 14#define PBMODE_BCKW_PRED 30#define PBMODE_CBPB_BCKW_PRED 31#define SNR_SCALABILITY 1#define SPATIAL_SCALABILITY_H 3#define SPATIAL_SCALABILITY_V 5#define SPATIAL_SCALABILITY_HV 7/* Intra Mode for Advanced Intra Coding mode */#define INTRA_MODE_DC 0#define INTRA_MODE_VERT_AC 2#define INTRA_MODE_HORI_AC 3/* Scalability default layer number. */#define BASE_LAYER_NUM 1#define ENHANCEMENT_LAYER_NUM 2#define MAX_LAYERS 2/* Rate control methods */#define OFFLINE_RC 1#define TMN5_RC 2#define TMN8_RC 3 #define NO_VEC 999/* Motionvector structure */typedef struct motionvector { int x; /* Horizontal comp. of mv */ int y; /* Vertical comp. of mv */ int x_half; /* Horizontal half-pel acc. */ int y_half; /* Vertical half-pel acc. */ int min_error; /* Min error for this vector */ int Mode; /* Necessary for adv. pred. mode */} MotionVector;/* Stores I->P or P->P MVs for use with direct mode prediction in true B frames. * Can be used with 1 or 4 MVs (annex F and J). */ MotionVector *True_B_Direct_Mode_MV[5][MBR][MBC];/* Rounding table */static int roundtab[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2};/* Point structure */typedef struct point { int x; int y;} Point;/* Structure with image data */typedef struct pict_image { unsigned char *lum; /* Luminance plane */ unsigned char *Cr; /* Cr plane */ unsigned char *Cb; /* Cb plane */} PictImage;typedef struct diff_image { int *lum; int *Cr; int *Cb;} DiffImage;/* Back Channel Message Structure *//* used with Annex N with Videomux channel */typedef struct bcm { int present; /* set to 1 if bcm is present */ int BT; /* Back-channel message type (2 bits) */ int URF; /* Unreliable flag (1 bit) */ int TR; /* Temporal reference (10 bits) */ int ELNUMI; /* Enhancement layer number indication (1 bit) */ int ELNUM; /* Enhancement layer number (4 bits) */ int BCPM; /* Indicates that BSBI is present (1 bit) */ int BSPI; /* Back-channel sub bitstream indicator (2 bits) */ int BEPB1; /* Back-channel emulation prevention bit 1 (1 bit set to 1 */ int GN_MBA; /* GOB number / Macroblock address (variable length) */ int BEPB2; /* Back-channel emulation prevention bit 2 (1 bit set to 1 */ int RTR; /* Requested temporal reference (10 bits) */ int BSTUF; /* stuffing (variable length) */} BCM;/* Thread information when using VRC */typedef struct thread{ int TR; /* Time Reference */ int TRP; /* Time reference for prediction */ int sync_frame; /* This frame is a sync frame */} Thread;/* Group of pictures structure. *//* Picture structure */typedef struct pict { int prev; int curr; int TRI; /* Time reference indication - used by Annex N */ int TR; /* Time reference */ int bit_rate; int src_frame_rate; float target_frame_rate; int source_format; int picture_coding_type; int GFID; int spare; int unrestricted_mv_mode; int PB; int QUANT; int DQUANT; int dquant_size; /* dquant bit number when using modified quantization*/ int MB; int seek_dist; /* Motion vector search window */ int use_gobsync; /* flag for gob_sync */ int MODB; /* B-frame mode */ int BQUANT; /* which quantizer to use for B-MBs in PB-frame */ int TRB; /* Time reference for B-picture */ float QP_mean; /* mean quantizer */ int EPTYPE; /* use extended P-Type */ int UFEP; /* Update Full Extended PTYPE */ int PCF; /* Custom picture clock frequency */ int PAR; /* Pixel aspect ratio for custom format */ int PWI; /* Picture width indication for custom format */ int PHI; /* Picture height indication for custom format */ int PAR_width; /* Extended PAR width for custom format */ int PAR_height; /* Extended PAR height for custom format */ int CCC; /* Clock conversion code for custom picture clock*/ int CD; /* Clock divisor for custom picture clock */ int rectangular_slice; /* Slice structure submode */ int arbitrary_slice_ordering; int ELNUM; /* Enhancement layer number */ int RLNUM; /* Reference layer number */ int RPSMF; /* Mode flags of reference picture selection */ int reference_picture_selection; int sync; /* Synchronization frame for VRC */ int TRPI; /* Temporal reference for prediction indication */ int TRP; /* Temporal reference for prediction */ int BCI; /* Back channel message indication */ BCM *BCM; /* Back channel message */ int BCM_LENGTH; /* Back channel message lenght */ int RPRP; /* Reference picture resampling parameters */ int RPRP_LENGTH; /* Reference picture resampling parameters lenght */ int PEI; /* Extra insertion information, signals PSUPP */ int PSUPP; /* Supplemental Information (Annex L) */ int Intra_Mode; /* Intra Mode for advanced Intra Coding */ int RTYPE; /* Rounding type for P-pictures */ int UUI; /* Unlimited unrestricted motion vector indicator */} Pict;/* Slice structure */typedef struct slice { unsigned int vert_pos; /* Vertical position of slice */ unsigned int quant_scale; /* Quantization scale */} Slice;/* Macroblock structure */typedef struct macroblock { int mb_address; /* Macroblock address */ int macroblock_type; /* Macroblock type */ int skipped; /* 1 if skipped */ MotionVector motion; /* Motion Vector */} Macroblock;/* Structure for macroblock data */typedef struct mb_structure { int lum[16][16]; int Cr[8][8]; int Cb[8][8];} MB_Structure;/* Structure for counted bits */typedef struct bits_counted { int Y; int C; int vec; int CBPY; int CBPCM; int INTRA_MODE; /* used in advanced intra coding mode */ int MODB; int CBPB; int COD; int header; int DQUANT; int total; int no_inter; int no_inter4v; int no_intra;/* NB: Remember to change AddBits(), ZeroBits() and AddBitsPicture() when entries are added here */} Bits;/* Structure for data for data from previous macroblock *//* Structure for average results and virtal buffer data */typedef struct results { float SNR_l; /* SNR for luminance */ float SNR_Cr; /* SNR for chrominance */ float SNR_Cb; float QP_mean; /* Mean quantizer */} Results;void Help();void AdvancedHelp();void DeterminePictureType(int *frame_no, Pict *pic, int P_skip, int B_skip, int i);void CalculateStatistics(PictImage *curr_image, PictImage *curr_recon, PictImage *pb_b_image, PictImage *pb_b_recon, Bits *bits, int QP, Pict *pic);void StoreDirectModeVectors(MotionVector *ppMV[7][MBR+1][MBC+2], MotionVector *directMV[5][MBR][MBC]);void InitializeMV(MotionVector *MV[7][MBR+1][MBC+2]);void CodingLossImage(DiffImage *diff_image, PictImage *curr_image, PictImage *curr_reference_recon);PictImage *AddEnhancementAndReferenceLayers(DiffImage *enhancement, PictImage *reference);int NextTwoPB(PictImage *p2, PictImage *bim, PictImage *p1, int bskip, int pskip, int seek_dist);void PrintSNR(Results *res, int num);void PrintResult(Bits *bits, int num_units, int num);unsigned char *ReadImage(char *filename, int frame_no, int headerlength);PictImage *FillImage(unsigned char *in);void WriteImage(PictImage *image, char *filename);PictImage *InitImage(int size);DiffImage *InitDiffImage (int size);void FreeImage(PictImage *image);void FreeDiffImage (DiffImage * image);char *StripName(char *s);int *MB_Encode(MB_Structure *mb_orig);int MB_Decode(int *qcoeff, MB_Structure *mb_recon);int Dct( int *block, int *coeff);void Scan(int *qcoeff, int Intra_Mode);void DeScan(int *qcoeff, int Intra_Mode);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -