00001 00002 /*! 00003 ************************************************************************************* 00004 * 00005 * \file me_umhexsmp.h 00006 * 00007 * \brief 00008 * Fast integer pixel and sub pixel motion estimation 00009 * Improved and simplified from the original UMHexagonS algorithms 00010 * See JVT-P021 for details 00011 * 00012 * \author 00013 * Main contributors: (see contributors.h for copyright, address and affiliation details) 00014 * - Zhibo Chen <chenzhibo@tsinghua.org.cn> 00015 * - JianFeng Xu <fenax@video.mdc.tsinghua.edu.cn> 00016 * - Wenfang Fu <fwf@video.mdc.tsinghua.edu.cn> 00017 * 00018 * - Xiaoquan Yi <xyi@engr.scu.edu> 00019 * - Jun Zhang <jzhang2@engr.scu.edu> 00020 * 00021 * \date 00022 * 6. Nov. 2006 00023 ************************************************************************************* 00024 */ 00025 00026 #ifndef _ME_UMHEXSMP_H_ 00027 #define _ME_UMHEXSMP_H_ 00028 00029 #include "mbuffer.h" 00030 00031 unsigned short SymmetricalCrossSearchThreshold1; 00032 unsigned short SymmetricalCrossSearchThreshold2; 00033 unsigned short ConvergeThreshold; 00034 unsigned short SubPelThreshold1; 00035 unsigned short SubPelThreshold3; 00036 00037 byte **smpUMHEX_SearchState; //state for fractional pel search 00038 int ***smpUMHEX_l0_cost; //store SAD information needed for forward median and uplayer prediction 00039 int ***smpUMHEX_l1_cost; //store SAD information needed for backward median and uplayer prediction 00040 byte *smpUMHEX_flag_intra; 00041 int smpUMHEX_flag_intra_SAD; 00042 00043 int smpUMHEX_pred_SAD_uplayer; // Up layer SAD prediction 00044 short smpUMHEX_pred_MV_uplayer_X; // Up layer MV predictor X-component 00045 short smpUMHEX_pred_MV_uplayer_Y; // Up layer MV predictor Y-component 00046 00047 void smpUMHEX_init(void); 00048 int smpUMHEX_get_mem(void); 00049 void smpUMHEX_free_mem(void); 00050 void smpUMHEX_decide_intrabk_SAD(void); 00051 void smpUMHEX_skip_intrabk_SAD(int, int); 00052 void smpUMHEX_setup(short, int, int, int, int, short ******); 00053 00054 int // ==> minimum motion cost after search 00055 smpUMHEXIntegerPelBlockMotionSearch (Macroblock *currMB, // <-- current Macroblock 00056 imgpel *orig_pic, // <-- not used 00057 short ref, // <-- reference frame (0... or -1 (backward)) 00058 int list, // <-- reference picture list 00059 char ***refPic, // <-- reference array 00060 short ****tmp_mv, // <-- mv array 00061 int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block 00062 int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block 00063 int blocktype, // <-- block type (1-16x16 ... 7-4x4) 00064 MotionVector *pred_mv, // <-- motion vector predictor (x|y) in sub-pel units 00065 MotionVector *mv, // --> motion vector (x|y) - in pel units 00066 int search_range, // <-- 1-d search range in pel units 00067 int min_mcost, // <-- minimum motion cost (cost for center or huge value) 00068 int lambda_factor, // <-- lagrangian parameter for determining motion cost 00069 int apply_weights 00070 ); 00071 00072 int // ==> minimum motion cost after search 00073 smpUMHEXSubPelBlockMotionSearch ( 00074 imgpel* orig_pic, // <-- original pixel values for the AxB block 00075 short ref, // <-- reference frame (0... or -1 (backward)) 00076 int list, // <-- reference picture list 00077 int list_offset, // <-- MBAFF list offset 00078 int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block 00079 int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block 00080 int blocktype, // <-- block type (1-16x16 ... 7-4x4) 00081 MotionVector *pred, // <-- motion vector predictor (x|y) in sub-pel units 00082 MotionVector *mv, // <--> in: search center (x|y) / out: motion vector (x|y) - in pel units 00083 int search_pos2, // <-- search positions for half-pel search (default: 9) 00084 int search_pos4, // <-- search positions for quarter-pel search (default: 9) 00085 int min_mcost, // <-- minimum motion cost (cost for center or huge value) 00086 int lambda_factor, // <-- lagrangian parameter for determining motion cost 00087 int apply_weights 00088 ); 00089 00090 int // ==> minimum motion cost after search 00091 smpUMHEXFullSubPelBlockMotionSearch (imgpel* orig_pic, // <-- original pixel values for the AxB block 00092 short ref, // <-- reference frame (0... or -1 (backward)) 00093 int list, // <-- reference picture list 00094 int list_offset, // <-- MBAFF list offset 00095 int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block 00096 int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block 00097 int blocktype, // <-- block type (1-16x16 ... 7-4x4) 00098 MotionVector *pred_mv, // <-- motion vector predictor (x|y) in sub-pel units 00099 MotionVector *mv, // <--> in: search center (x|y) / out: motion vector (x|y) - in pel units 00100 int search_pos2, // <-- search positions for half-pel search (default: 9) 00101 int search_pos4, // <-- search positions for quarter-pel search (default: 9) 00102 int min_mcost, // <-- minimum motion cost (cost for center or huge value) 00103 int lambda_factor, // <-- lagrangian parameter for determining motion cost 00104 int apply_weights 00105 ); 00106 int // ==> minimum motion cost after search 00107 smpUMHEXBipredIntegerPelBlockMotionSearch (Macroblock *currMB, // <-- current Macroblock 00108 imgpel* cur_pic, // <-- original pixel values for the AxB block 00109 short ref, // <-- reference frame (0... or -1 (backward)) 00110 int list, // <-- Current reference list 00111 char ***refPic, // <-- reference array 00112 short ****tmp_mv, // <-- mv array 00113 int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block 00114 int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block 00115 int blocktype, // <-- block type (1-16x16 ... 7-4x4) 00116 MotionVector *pred_mv1, // <-- motion vector predictor (x|y) in sub-pel units 00117 MotionVector *pred_mv2, // <-- motion vector predictor (x|y) in sub-pel units 00118 MotionVector *mv1, // <--> in: search center (x|y) / out: motion vector (x|y) - in pel units 00119 MotionVector *mv2, // <--> in: search center (x|y) / out: motion vector (x|y) - in pel units 00120 int search_range, // <-- 1-d search range in pel units 00121 int min_mcost, // <-- minimum motion cost (cost for center or huge value) 00122 int iteration_no, // <-- bi pred iteration number 00123 int lambda_factor, // <-- lagrangian parameter for determining motion cost 00124 int apply_weights 00125 ); 00126 00127 00128 int // ==> minimum motion cost after search 00129 smpUMHEXSubPelBlockME (imgpel* orig_pic, // <-- original pixel values for the AxB block 00130 short ref, // <-- reference frame (0... or -1 (backward)) 00131 int list, 00132 int list_offset, // <-- MBAFF list offset 00133 int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block 00134 int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block 00135 int blocktype, // <-- block type (1-16x16 ... 7-4x4) 00136 MotionVector *pred_mv, // <-- motion vector predictor (x|y) in sub-pel units 00137 MotionVector *mv, // <--> in: search center (x|y) / out: motion vector (x|y) - in sub-pel units 00138 int search_pos2, // <-- search positions for half-pel search (default: 9) 00139 int search_pos4, // <-- search positions for quarter-pel search (default: 9) 00140 int min_mcost, // <-- minimum motion cost (cost for center or huge value) 00141 int* lambda, 00142 int apply_weights 00143 ); 00144 00145 #endif