[cvs] / xvidcore / src / motion / estimation.h Repository:
ViewVC logotype

Diff of /xvidcore/src/motion/estimation.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4, Fri Oct 3 14:23:00 2003 UTC revision 1.12, Mon Mar 14 00:47:07 2005 UTC
# Line 30  Line 30 
30    
31  #include "../portab.h"  #include "../portab.h"
32  #include "../global.h"  #include "../global.h"
 #include "../image/reduced.h"  
33    
34  /* hard coded motion search parameters */  /* hard coded motion search parameters */
35    
# Line 38  Line 37 
37  #define MV_MAX_ERROR    (4096 * 256)  #define MV_MAX_ERROR    (4096 * 256)
38    
39  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */
40  #define MV16_INTER_BIAS 512  #define MV16_INTER_BIAS 450
41    
42  /* vector map (vlc delta size) smoother parameters ! float !*/  /* vector map (vlc delta size) smoother parameters ! float !*/
43  #define NEIGH_TEND_16X16                10.5  #define NEIGH_TEND_16X16                0.6
44  #define NEIGH_TEND_8X8                  40.0  #define NEIGH_TEND_8X8                  0.6
45  #define NEIGH_8X8_BIAS                  30  #define NEIGH_8X8_BIAS                  40
46    
47  #define BITS_MULT                               16  #define BITS_MULT                               16
48    
49  #define INITIAL_SKIP_THRESH             10  #define INITIAL_SKIP_THRESH             6
50  #define FINAL_SKIP_THRESH               50  #define FINAL_SKIP_THRESH               50
51  #define MAX_SAD00_FOR_SKIP              20  #define MAX_SAD00_FOR_SKIP              20
52  #define MAX_CHROMA_SAD_FOR_SKIP 22  #define MAX_CHROMA_SAD_FOR_SKIP 22
# Line 60  Line 59 
59  #define CHECK_CANDIDATE(X,Y,D) { \  #define CHECK_CANDIDATE(X,Y,D) { \
60          CheckCandidate((X),(Y), data, (D) ); }          CheckCandidate((X),(Y), data, (D) ); }
61    
 #define RRV_MV_SCALEDOWN(a)     ( (a)>=0 ? (a+1)/2 : (a-1)/2 )  
   
62  /* fast ((A)/2)*2 */  /* fast ((A)/2)*2 */
63  #define EVEN(A)         (((A)<0?(A)+1:(A)) & ~1)  #define EVEN(A)         (((A)<0?(A)+1:(A)) & ~1)
64    
# Line 71  Line 68 
68    
69  typedef struct  typedef struct
70  {  {
71            int max_dx, min_dx, max_dy, min_dy; /* maximum search range */
72    
73            /* data modified by CheckCandidates */
74            int32_t iMinSAD[5];                     /* smallest SADs found so far */
75            VECTOR currentMV[5];            /* best vectors found so far */
76            VECTOR currentQMV[5];           /* as above, but used during qpel search */
77            int temp[4];                            /* temporary space */
78            unsigned int dir;                       /* 'direction', set when better vector is found */
79            int chromaX, chromaY, chromaSAD; /* info to make ChromaSAD faster */
80    
81          /* general fields */          /* general fields */
82          int max_dx, min_dx, max_dy, min_dy;          uint32_t rounding;                      /* rounding type in use */
83          uint32_t rounding;          VECTOR predMV;                          /* vector which predicts current vector */
84          VECTOR predMV;          const uint8_t * RefP[6];        /* reference pictures - N, V, H, HV, cU, cV */
85          VECTOR * currentMV;          const uint8_t * Cur;            /* current picture */
86          VECTOR * currentQMV;          const uint8_t *CurU, *CurV;     /* current picture - chroma planes */
87          VECTOR * currentQMV2;  
88          int32_t * iMinSAD;          uint8_t * RefQ;                         /* temporary space for interpolations */
89          int32_t * iMinSAD2;          uint32_t lambda16;                      /* how much vector bits weight */
90          const uint8_t * RefP[6]; /* N, V, H, HV, cU, cV */          uint32_t lambda8;                       /* as above - for inter4v mode */
91          const uint8_t * CurU;          uint32_t iEdgedWidth;           /* picture's stride */
92          const uint8_t * CurV;          uint32_t iFcode;                        /* current fcode */
93          uint8_t * RefQ;  
94          const uint8_t * Cur;          int qpel;                                       /* if we're coding in qpel mode */
95          uint32_t lambda16;          int qpel_precision;                     /* if X and Y are in qpel precision (refinement probably) */
96          uint32_t lambda8;          int chroma;                                     /* should we include chroma SAD? */
         uint32_t iEdgedWidth;  
         uint32_t iFcode;  
         int * temp;  
         unsigned int * dir;  
         int qpel, qpel_precision;  
         int chroma;  
         int rrv;  
97    
98          /* fields for interpolate and direct modes */          /* fields for interpolate and direct modes */
99          const uint8_t * b_RefP[6]; /* N, V, H, HV, cU, cV */          const uint8_t * b_RefP[6];      /* backward reference pictures - N, V, H, HV, cU, cV */
100          VECTOR bpredMV;          VECTOR bpredMV;                         /* backward prediction - used in Interpolate-mode search only */
101          uint32_t bFcode;          uint32_t bFcode;                        /* backward fcode - used in Interpolate-mode search only */
102            int b_chromaX, b_chromaY;
103    
104          /* fields for direct mode */          /* fields for direct mode */
105          VECTOR directmvF[4];          VECTOR directmvF[4];            /* scaled reference vectors */
106          VECTOR directmvB[4];          VECTOR directmvB[4];
107          const VECTOR * referencemv;          const VECTOR * referencemv; /* pointer to not-scaled reference vectors */
108    
109          /* BITS/R-D stuff */          /* BITS/R-D stuff */
110          int16_t * dctSpace;          int16_t * dctSpace;                     /* temporary space for dct */
111          uint32_t iQuant;          uint32_t iQuant;                        /* current quant */
112          uint32_t quant_type;          uint32_t quant_type;            /* current quant type */
113          int * cbp;          unsigned int cbp[2];            /* CBP of the best vector found so far + cbp for inter4v search */
114          const uint16_t * scan_table;          const uint16_t * scan_table; /* current scan table */
115            const uint16_t * mpeg_quant_matrices;                   /* current MPEG quantization matrices */
116            int lambda[6];                          /* R-D lambdas for all 6 blocks */
117            unsigned int quant_sq;          /* quant squared - saves many multiplications in VHQ */
118    
119  } SearchData;  } SearchData;
120    
121  typedef void(CheckFunc)(const int x, const int y,  typedef void(CheckFunc)(const int x, const int y,
122                                                  const SearchData * const Data,                                                  SearchData * const Data,
123                                                  const unsigned int Direction);                                                  const unsigned int Direction);
124    
125  CheckFunc CheckCandidate16no4v; /* shared between p-vop and b-vop search */  CheckFunc CheckCandidate16no4v; /* shared between p-vop and b-vop search */
# Line 129  Line 133 
133                                                          const SearchData * const data);                                                          const SearchData * const data);
134    
135  int32_t  int32_t
136  xvid_me_ChromaSAD(const int dx, const int dy, const SearchData * const data);  xvid_me_ChromaSAD(const int dx, const int dy, SearchData * const data);
137    
138  int  int
139  xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference,  xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference,
140                                          const int x, const int y,                                          const int x, const int y,
141                                          const uint32_t stride, const uint32_t iQuant, int rrv);                                          const uint32_t stride, const uint32_t iQuant);
142    
143  #define iDiamondSize 2  #define iDiamondSize 2
144  typedef void  typedef void
145  MainSearchFunc(int x, int y, const SearchData * const Data,  MainSearchFunc(int x, int y, SearchData * const Data,
146                             int bDirection, CheckFunc * const CheckCandidate);                             int bDirection, CheckFunc * const CheckCandidate);
147    
148  MainSearchFunc xvid_me_DiamondSearch, xvid_me_AdvDiamondSearch, xvid_me_SquareSearch;  MainSearchFunc xvid_me_DiamondSearch, xvid_me_AdvDiamondSearch, xvid_me_SquareSearch;
149    
150  void  void
151  xvid_me_SubpelRefine(const SearchData * const data, CheckFunc * const CheckCandidate);  xvid_me_SubpelRefine(VECTOR centerMV, SearchData * const data, CheckFunc * const CheckCandidate, int dir);
152    
153    void
154    FullRefine_Fast(SearchData * data, CheckFunc * CheckCandidate, int direction);
155    
156  void  void
157  xvid_me_ModeDecision_RD(SearchData * const Data,  xvid_me_ModeDecision_RD(SearchData * const Data,
# Line 174  Line 181 
181                  const IMAGE * const vGMC,                  const IMAGE * const vGMC,
182                  const int coding_type);                  const int coding_type);
183    
184    void
185    ModeDecision_BVOP_RD(SearchData * const Data_d,
186                                             SearchData * const Data_b,
187                                             SearchData * const Data_f,
188                                             SearchData * const Data_i,
189                                             MACROBLOCK * const pMB,
190                                             const MACROBLOCK * const b_mb,
191                                             VECTOR * f_predMV,
192                                             VECTOR * b_predMV,
193                                             const uint32_t MotionFlags,
194                                             const MBParam * const pParam,
195                                             int x, int y,
196                                             int best_sad);
197    
198    unsigned int
199    getMinFcode(const int MVmax);
200    
201  #endif                                                  /* _ESTIMATION_H_ */  #endif                                                  /* _ESTIMATION_H_ */

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.12

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4