--- estimation.h 2005/03/14 00:47:07 1.12 +++ estimation.h 2010/12/24 13:21:35 1.16 @@ -4,7 +4,7 @@ * - Motion Estimation related header - * * Copyright(C) 2002 Christoph Lampert - * 2002 Michael Militzer + * 2002-2010 Michael Militzer * 2002-2003 Radoslaw Czyz * * This program is free software ; you can redistribute it and/or modify @@ -21,7 +21,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: estimation.h,v 1.12 2005/03/14 00:47:07 Isibaar Exp $ + * $Id: estimation.h,v 1.16 2010/12/24 13:21:35 Isibaar Exp $ * ****************************************************************************/ @@ -30,6 +30,7 @@ #include "../portab.h" #include "../global.h" +#include "sad.h" /* hard coded motion search parameters */ @@ -41,7 +42,8 @@ /* vector map (vlc delta size) smoother parameters ! float !*/ #define NEIGH_TEND_16X16 0.6 -#define NEIGH_TEND_8X8 0.6 +#define NEIGH_TEND_8X8 1.5 + #define NEIGH_8X8_BIAS 40 #define BITS_MULT 16 @@ -115,9 +117,19 @@ const uint16_t * mpeg_quant_matrices; /* current MPEG quantization matrices */ int lambda[6]; /* R-D lambdas for all 6 blocks */ unsigned int quant_sq; /* quant squared - saves many multiplications in VHQ */ - + uint32_t rel_var8[6]; /* relative variances for all 6 sub-blocks */ + int metric; /* distortion metric for R-D optimizations, currently: PSNR=0, PSNRHVSM=1 */ } SearchData; +static __inline uint32_t +masked_sseh8_16bit(int16_t * const orig, + int16_t * const rec, + const uint32_t rel_var8) +{ + uint16_t mask = ((isqrt(2*coeff8_energy(orig)*rel_var8) + 48) >> 6); + return (5*sseh8_16bit(orig, rec, (uint16_t) mask)) >> 7; +} + typedef void(CheckFunc)(const int x, const int y, SearchData * const Data, const unsigned int Direction); @@ -165,7 +177,8 @@ const IMAGE * const pCurrent, const IMAGE * const pRef, const IMAGE * const vGMC, - const int coding_type); + const int coding_type, + const int bound); void xvid_me_ModeDecision_Fast(SearchData * const Data, @@ -179,7 +192,8 @@ const IMAGE * const pCurrent, const IMAGE * const pRef, const IMAGE * const vGMC, - const int coding_type); + const int coding_type, + const int bound); void ModeDecision_BVOP_RD(SearchData * const Data_d, @@ -191,9 +205,11 @@ VECTOR * f_predMV, VECTOR * b_predMV, const uint32_t MotionFlags, + const uint32_t VopFlags, const MBParam * const pParam, int x, int y, - int best_sad); + int best_sad, + int force_direct); unsigned int getMinFcode(const int MVmax);