--- trunk/xvidcore/src/motion/estimation.h 2004/12/17 15:42:35 1577 +++ trunk/xvidcore/src/motion/estimation.h 2010/11/28 15:19:07 1909 @@ -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.11 2004-12-17 15:42:35 syskin Exp $ + * $Id: estimation.h,v 1.14 2010-11-28 15:18:21 Isibaar Exp $ * ****************************************************************************/ @@ -30,6 +30,7 @@ #include "../portab.h" #include "../global.h" +#include "sad.h" /* hard coded motion search parameters */ @@ -40,8 +41,9 @@ #define MV16_INTER_BIAS 450 /* vector map (vlc delta size) smoother parameters ! float !*/ -#define NEIGH_TEND_16X16 10.5 -#define NEIGH_TEND_8X8 40.0 +#define NEIGH_TEND_16X16 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); @@ -191,6 +203,7 @@ 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);