--- estimation.h 2004/04/22 13:39:33 1.4 +++ estimation.h 2005/03/14 00:47:07 1.12 @@ -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.4 2004/04/22 13:39:33 syskin Exp $ + * $Id: estimation.h,v 1.12 2005/03/14 00:47:07 Isibaar Exp $ * ****************************************************************************/ @@ -30,7 +30,6 @@ #include "../portab.h" #include "../global.h" -#include "../image/reduced.h" /* hard coded motion search parameters */ @@ -41,8 +40,8 @@ #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 0.6 #define NEIGH_8X8_BIAS 40 #define BITS_MULT 16 @@ -60,8 +59,6 @@ #define CHECK_CANDIDATE(X,Y,D) { \ CheckCandidate((X),(Y), data, (D) ); } -#define RRV_MV_SCALEDOWN(a) ( (a)>=0 ? (a+1)/2 : (a-1)/2 ) - /* fast ((A)/2)*2 */ #define EVEN(A) (((A)<0?(A)+1:(A)) & ~1) @@ -71,6 +68,8 @@ typedef struct { + int max_dx, min_dx, max_dy, min_dy; /* maximum search range */ + /* data modified by CheckCandidates */ int32_t iMinSAD[5]; /* smallest SADs found so far */ VECTOR currentMV[5]; /* best vectors found so far */ @@ -80,7 +79,6 @@ int chromaX, chromaY, chromaSAD; /* info to make ChromaSAD faster */ /* general fields */ - int max_dx, min_dx, max_dy, min_dy; /* maximum range */ uint32_t rounding; /* rounding type in use */ VECTOR predMV; /* vector which predicts current vector */ const uint8_t * RefP[6]; /* reference pictures - N, V, H, HV, cU, cV */ @@ -96,26 +94,27 @@ int qpel; /* if we're coding in qpel mode */ int qpel_precision; /* if X and Y are in qpel precision (refinement probably) */ int chroma; /* should we include chroma SAD? */ - int rrv; /* are we using reduced resolution? */ /* fields for interpolate and direct modes */ const uint8_t * b_RefP[6]; /* backward reference pictures - N, V, H, HV, cU, cV */ - VECTOR bpredMV; /* backward prediction - used interpolate mode only */ - uint32_t bFcode; /* backward fcode - used as above */ + VECTOR bpredMV; /* backward prediction - used in Interpolate-mode search only */ + uint32_t bFcode; /* backward fcode - used in Interpolate-mode search only */ int b_chromaX, b_chromaY; /* fields for direct mode */ VECTOR directmvF[4]; /* scaled reference vectors */ - VECTOR directmvB[4]; /* as above */ + VECTOR directmvB[4]; const VECTOR * referencemv; /* pointer to not-scaled reference vectors */ /* BITS/R-D stuff */ int16_t * dctSpace; /* temporary space for dct */ uint32_t iQuant; /* current quant */ uint32_t quant_type; /* current quant type */ - unsigned int cbp[2]; /* CBP of the best vector found so far + cbp for inter4v search */ + unsigned int cbp[2]; /* CBP of the best vector found so far + cbp for inter4v search */ const uint16_t * scan_table; /* current scan table */ 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 */ } SearchData; @@ -139,7 +138,7 @@ int xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference, const int x, const int y, - const uint32_t stride, const uint32_t iQuant, int rrv); + const uint32_t stride, const uint32_t iQuant); #define iDiamondSize 2 typedef void @@ -149,7 +148,7 @@ MainSearchFunc xvid_me_DiamondSearch, xvid_me_AdvDiamondSearch, xvid_me_SquareSearch; void -xvid_me_SubpelRefine(SearchData * const data, CheckFunc * const CheckCandidate, int dir); +xvid_me_SubpelRefine(VECTOR centerMV, SearchData * const data, CheckFunc * const CheckCandidate, int dir); void FullRefine_Fast(SearchData * data, CheckFunc * CheckCandidate, int direction); @@ -182,5 +181,21 @@ const IMAGE * const vGMC, const int coding_type); +void +ModeDecision_BVOP_RD(SearchData * const Data_d, + SearchData * const Data_b, + SearchData * const Data_f, + SearchData * const Data_i, + MACROBLOCK * const pMB, + const MACROBLOCK * const b_mb, + VECTOR * f_predMV, + VECTOR * b_predMV, + const uint32_t MotionFlags, + const MBParam * const pParam, + int x, int y, + int best_sad); + +unsigned int +getMinFcode(const int MVmax); #endif /* _ESTIMATION_H_ */