--- motion.h 2003/02/19 20:12:43 1.20 +++ motion.h 2003/03/04 11:00:53 1.21 @@ -26,7 +26,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * \$Id: motion.h,v 1.20 2003/02/19 20:12:43 edgomez Exp \$ + * \$Id: motion.h,v 1.21 2003/03/04 11:00:53 syskin Exp \$ * ***************************************************************************/ @@ -48,7 +48,6 @@ ****************************************************************************/ extern const uint32_t roundtab[16]; - /* K = 4 */ extern const uint32_t roundtab_76[16]; /* K = 2 */ @@ -56,7 +55,6 @@ /* K = 1 */ extern const uint32_t roundtab_79[4]; - /* * getref: calculate reference image pointer * the decision to use interpolation h/v/hv or the normal image is @@ -71,156 +69,94 @@ const uint32_t x, const uint32_t y, const uint32_t block, /* block dimension, 8 or 16 */ - const int32_t dx, const int32_t dy, const int32_t stride) { - - switch (((dx & 1) << 1) + (dy & 1)) { /* ((dx%2)?2:0)+((dy%2)?1:0) */ case 0: return refn + (int) ((x * block + dx / 2) + (y * block + dy / 2) * stride); case 1: - return refv + (int) ((x * block + dx / 2) + (y * block + - (dy - 1) / 2) * stride); + return refv + (int) ((x * block + dx / 2) + (y * block + (dy - 1) / 2) * stride); case 2: - return refh + (int) ((x * block + (dx - 1) / 2) + (y * block + - dy / 2) * stride); + return refh + (int) ((x * block + (dx - 1) / 2) + (y * block + dy / 2) * stride); default: - return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block + - (dy - 1) / 2) * stride); + return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block + (dy - 1) / 2) * stride); } - -} - - -/* This is somehow a copy of get_ref, but with MV instead of X,Y */ - -static __inline const uint8_t * -get_ref_mv(const uint8_t * const refn, - const uint8_t * const refh, - const uint8_t * const refv, - const uint8_t * const refhv, - const uint32_t x, - const uint32_t y, - const uint32_t block, /* block dimension, 8 or 16 */ - - const VECTOR * mv, /* measured in half-pel! */ - - const int32_t stride) -{ - - switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) { - case 0: - return refn + (int) ((x * block + (mv->x) / 2) + (y * block + - (mv->y) / 2) * stride); - case 1: - return refv + (int) ((x * block + (mv->x) / 2) + (y * block + - ((mv->y) - 1) / 2) * stride); - case 2: - return refh + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block + - (mv->y) / 2) * stride); - default: - return refhv + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block + - ((mv->y) - - 1) / 2) * stride); - } - } void MotionEstimationBVOP(MBParam * const pParam, - FRAMEINFO * const frame, - // forward (past) reference - const int32_t time_bp, - const int32_t time_pp, - const MACROBLOCK * const f_mbs, - const IMAGE * const f_ref, - const IMAGE * const f_refH, - const IMAGE * const f_refV, - const IMAGE * const f_refHV, - // backward (future) reference - const FRAMEINFO * const b_reference, - const IMAGE * const b_ref, - const IMAGE * const b_refH, - const IMAGE * const b_refV, - const IMAGE * const b_refHV); + FRAMEINFO * const frame, + // forward (past) reference + const int32_t time_bp, + const int32_t time_pp, + const MACROBLOCK * const f_mbs, + const IMAGE * const f_ref, + const IMAGE * const f_refH, + const IMAGE * const f_refV, + const IMAGE * const f_refHV, + // backward (future) reference + const FRAMEINFO * const b_reference, + const IMAGE * const b_ref, + const IMAGE * const b_refH, + const IMAGE * const b_refV, + const IMAGE * const b_refHV); void MBMotionCompensationBVOP(MBParam * pParam, - MACROBLOCK * const mb, - const uint32_t i, - const uint32_t j, - IMAGE * const cur, - const IMAGE * const f_ref, - const IMAGE * const f_refh, - const IMAGE * const f_refv, - const IMAGE * const f_refhv, - const IMAGE * const b_ref, - const IMAGE * const b_refh, - const IMAGE * const b_refv, - const IMAGE * const b_refhv, - int16_t * dct_codes); - - + MACROBLOCK * const mb, + const uint32_t i, + const uint32_t j, + IMAGE * const cur, + const IMAGE * const f_ref, + const IMAGE * const f_refh, + const IMAGE * const f_refv, + const IMAGE * const f_refhv, + const IMAGE * const b_ref, + const IMAGE * const b_refh, + const IMAGE * const b_refv, + const IMAGE * const b_refhv, + int16_t * dct_codes); + + /* GMC stuff. Maybe better put it into a separate file */ - -void + +void generate_GMCparameters( const int num_wp, // [input]: number of warppoints - const int res, // [input]: resolution - const WARPPOINTS *const warp, // [input]: warp points + const int res, // [input]: resolution + const WARPPOINTS *const warp, // [input]: warp points const int width, const int height, // [input]: without edges! - GMC_DATA *const gmc); // [output] precalculated parameters + GMC_DATA *const gmc); // [output] precalculated parameters -void +void generate_GMCimage( const GMC_DATA *const gmc_data, // [input] precalculated data - const IMAGE *const pRef, // [input] - const int mb_width, + const IMAGE *const pRef, // [input] + const int mb_width, const int mb_height, const int stride, - const int stride2, + const int stride2, const int fcode, // [input] some parameters... - const int32_t quarterpel, // [input] for rounding avgMV + const int32_t quarterpel, // [input] for rounding avgMV const int reduced_resolution, // [input] ignored const int32_t rounding, // [input] for rounding image data MACROBLOCK *const pMBs, // [output] average motion vectors IMAGE *const pGMC); // [output] full warped image - VECTOR generate_GMCimageMB( const GMC_DATA *const gmc_data, /* [input] all precalc data */ - const IMAGE *const pRef, // [input] - const int mi, const int mj, /* [input] MB position */ + const IMAGE *const pRef, // [input] + const int mi, const int mj, /* [input] MB position */ const int stride, /* [input] Lumi stride */ const int stride2, /* [input] chroma stride */ const int quarterpel, /* [input] for rounding of AvgMV */ - const int rounding, + const int rounding, IMAGE *const pGMC); /* [outut] generate image */ - - -/* Hinted ME */ - -void -MotionEstimationHinted( MBParam * const pParam, - FRAMEINFO * const current, - FRAMEINFO * const reference, - const IMAGE * const pRefH, - const IMAGE * const pRefV, - const IMAGE * const pRefHV); - int -MEanalysis( const IMAGE * const pRef, - FRAMEINFO * const Current, - MBParam * const pParam, - int maxIntra, - int intraCount, - int bCount); - -int -FindFcode( const MBParam * const pParam, - const FRAMEINFO * const current); - - -int d_amv_penalty(int x, int y, const VECTOR pred, const uint32_t iFcode, const int quant); - +MEanalysis( const IMAGE * const pRef, + const FRAMEINFO * const Current, + const MBParam * const pParam, + const int maxIntra, + const int intraCount, + const int bCount, + const int b_thresh); #endif /* _MOTION_H_ */