00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MODE_DECISION_H_
00019 #define _MODE_DECISION_H_
00020
00021 extern CSptr cs_mb, cs_b8, cs_cm, cs_ib8, cs_ib4;
00022 extern RD_8x8DATA tr4x4, tr8x8;
00023
00024
00025 extern double mb16x16_cost;
00026 extern double lambda_mf_factor;
00027
00028 extern int *****coefAC8x8;
00029 extern int *****cofAC8x8ts;
00030 extern int ****cofAC;
00031 extern int QP2QUANT[40];
00032 extern int cbp_blk8x8;
00033 extern int cbp, cbp8x8, cnt_nonz_8x8;
00034 extern int64 cbp_blk8_8x8ts;
00035 extern int cbp8_8x8ts;
00036 extern int cnt_nonz8_8x8ts;
00037
00038
00039 extern char b4_ipredmode[16], b4_intra_pred_modes[16];
00040
00041 extern short best_mode;
00042 extern imgpel **pred;
00043
00044 extern imgpel ***rec4x4;
00045 extern imgpel ***rec4x4CbCr;
00046
00047 extern void set_stored_macroblock_parameters (Macroblock *currMB);
00048 extern void StoreMV8x8(int);
00049 extern void store_macroblock_parameters (Macroblock *currMB, int);
00050 extern void SetModesAndRefframeForBlocks (Macroblock *currMB, int);
00051 extern void SetRefAndMotionVectors (PicMotionParams *motion, Macroblock *currMB, int, int, int, int, int, short);
00052 extern void StoreNewMotionVectorsBlock8x8(int, int, int, int, int, int, int, int);
00053 extern void assign_enc_picture_params(int, char, int, int, int, int, int, short);
00054 extern void set_subblock8x8_info(Block8x8Info*, int, int, RD_8x8DATA*);
00055 extern void set_block8x8_info(Block8x8Info*, int, int, char[2], char, short);
00056 extern void update_refresh_map(int intra, int intra1, Macroblock *currMB);
00057 extern void SetCoeffAndReconstruction8x8 (Macroblock*);
00058
00059 extern int GetBestTransformP8x8(void);
00060 extern int I16Offset (int, int);
00061 extern int CheckReliabilityOfRef (int, int, int, int);
00062 extern int Mode_Decision_for_Intra4x4Macroblock (Slice *currSlice, Macroblock *currMB, double, double*, int is_cavlc);
00063 extern int RDCost_for_macroblocks (Slice *currSlice, Macroblock *currMB, double, int, double*, double*, double*, int, int);
00064 extern double RDCost_for_8x8blocks (Slice *currSlice, Macroblock *currMB, int*, int64*, double, int, int, short, short, short, short, int);
00065 extern double *mb16x16_cost_frame;
00066
00067 extern const int b8_mode_table[6];
00068 extern const int mb_mode_table[9];
00069
00070 void rc_store_diff(int cpix_x, int cpix_y, imgpel **prediction);
00071 void submacroblock_mode_decision (Slice *currSlice, RD_PARAMS *, RD_8x8DATA *, Macroblock *,int ****, int *, short, int, int *, int *, int *, int, int);
00072 void submacroblock_mode_decision_low(Slice *currSlice, RD_PARAMS *, RD_8x8DATA *, Macroblock *,int ****, int *, short, int, int *, int *, int *, int, int);
00073 void init_enc_mb_params(Macroblock* currMB, RD_PARAMS *enc_mb, int intra, int bslice);
00074 void list_prediction_cost(Macroblock *currMB, int list, int block, int mode, RD_PARAMS *enc_mb, int bmcost[5], char best_ref[2]);
00075 void determine_prediction_list(int, int [5], char [2], char *, int *, short *);
00076 void compute_mode_RD_cost (Slice *currSlice, Macroblock *currMB, RD_PARAMS *enc_mb, int mode,
00077 double *min_rdcost, double *min_dcost, double *min_rate,
00078 int i16mode, short bslice, short *inter_skip, int is_cavlc);
00079
00080 int transform_termination_control(Macroblock* currMB, int mode, int bslice);
00081 int bslice_16x16_termination_control(Block8x8Info *b8x8info, int *ctr16x16, int mode, int bslice);
00082
00083 int iminarray ( int arr[], int size, int *minind );
00084
00085 extern void update_lambda_costs(RD_PARAMS *enc_mb, int lambda_mf[3]);
00086
00087
00088 void get_initial_mb16x16_cost(Macroblock* currMB);
00089 void adjust_mb16x16_cost(int);
00090
00091 void reset_adaptive_rounding();
00092
00093 int64 (*getDistortion)( Macroblock *currMB );
00094 int64 distortionSSE ( Macroblock *currMB );
00095 #endif
00096