[svn] / branches / dev-api-3 / xvidcore / src / motion / motion_est.h Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/motion/motion_est.h

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

revision 579, Sat Oct 5 21:37:44 2002 UTC revision 768, Thu Jan 9 11:36:33 2003 UTC
# Line 26  Line 26 
26   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
27   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28   *   *
29   *  $Id: motion_est.h,v 1.1.2.4 2002-10-05 21:37:44 Isibaar Exp $   *  $Id: motion_est.h,v 1.1.2.12 2003-01-09 11:36:33 syskin Exp $
30   *   *
31   ***************************************************************************/   ***************************************************************************/
32    
# Line 35  Line 35 
35    
36  #include "../portab.h"  #include "../portab.h"
37  #include "../global.h"  #include "../global.h"
38    #include "../image/reduced.h"
39    
40  /* hard coded motion search parameters for motion_est and smp_motion_est */  /* hard coded motion search parameters for motion_est and smp_motion_est */
41    
# Line 44  Line 45 
45  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */
46  #define MV16_INTER_BIAS 512  #define MV16_INTER_BIAS 512
47    
48    /* vector map (vlc delta size) smoother parameters ! float !*/
49    #define NEIGH_TEND_16X16        10.5
50    #define NEIGH_TEND_8X8          40.0
51    #define NEIGH_8X8_BIAS          30
52    
53  /* Parameters which control inter/inter4v decision */  /* Parameters which control inter/inter4v decision */
54  #define IMV16X16                        2  #define IMV16X16                        2
55    
 /* vector map (vlc delta size) smoother parameters ! float !*/  
 #define NEIGH_TEND_16X16        4.0  
 #define NEIGH_TEND_8X8          7.0  
   
56  static const int lambda_vec16[32] =  static const int lambda_vec16[32] =
57          {     0    ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5),          {     0    ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5),
58          (int)(1.15582*NEIGH_TEND_16X16 + 0.5), (int)(1.31976*NEIGH_TEND_16X16 + 0.5),          (int)(1.15582*NEIGH_TEND_16X16 + 0.5), (int)(1.31976*NEIGH_TEND_16X16 + 0.5),
# Line 99  Line 101 
101          -1, -2, 1, 2          -1, -2, 1, 2
102  };  };
103    
104    #define RRV_MV_SCALEDOWN(a)     ( (a)>=0 ? (a+1)/2 : (a-1)/2 )
105    
106    static const VECTOR zeroMV = {0,0};
107    
108  typedef struct  typedef struct
109          {          {
# Line 106  Line 111 
111                  int max_dx, min_dx, max_dy, min_dy;                  int max_dx, min_dx, max_dy, min_dy;
112                  uint32_t rounding;                  uint32_t rounding;
113                  VECTOR predMV;                  VECTOR predMV;
                 VECTOR predQMV;  
114                  VECTOR *currentMV;                  VECTOR *currentMV;
115                  VECTOR *currentQMV;                  VECTOR *currentQMV;
116                  int32_t *iMinSAD;                  int32_t *iMinSAD;
# Line 114  Line 118 
118                  const uint8_t * RefH;                  const uint8_t * RefH;
119                  const uint8_t * RefV;                  const uint8_t * RefV;
120                  const uint8_t * RefHV;                  const uint8_t * RefHV;
121                  const uint8_t * RefQ;          const uint8_t * RefCU;
122            const uint8_t * RefCV;
123            const uint8_t * CurU;
124            const uint8_t * CurV;
125            uint8_t * RefQ;
126                  const uint8_t * Cur;                  const uint8_t * Cur;
127                  uint32_t iQuant;          uint32_t lambda16;
128            uint32_t lambda8;
129                  uint32_t iEdgedWidth;                  uint32_t iEdgedWidth;
130                  uint32_t iFcode;                  uint32_t iFcode;
131                  int * temp;                  int * temp;
132  //fields for interpolate and direct mode          int qpel, qpel_precision;
133            int chroma;
134            int rrv;
135    //fields for interpolate and direct modes
136                  const uint8_t *bRef;                  const uint8_t *bRef;
137                  const uint8_t *bRefH;                  const uint8_t *bRefH;
138                  const uint8_t *bRefV;                  const uint8_t *bRefV;
# Line 131  Line 143 
143                  VECTOR directmvF[4];                  VECTOR directmvF[4];
144                  VECTOR directmvB[4];                  VECTOR directmvB[4];
145                  const VECTOR * referencemv;                  const VECTOR * referencemv;
146          }  
147          SearchData;  } SearchData;
148    
149    
150  typedef void(CheckFunc)(const int x, const int y,  typedef void(CheckFunc)(const int x, const int y,
151                                                  const int Direction, int * const dir,                                                  const int Direction, int * const dir,
152                                                  const SearchData * const Data);                                                  const SearchData * const Data);
   
 static CheckFunc CheckCandidate16, CheckCandidate16no4v, CheckCandidateInt,  
                         CheckCandidateDirect, CheckCandidateDirectno4v,  
                         CheckCandidate8;  
153  CheckFunc *CheckCandidate;  CheckFunc *CheckCandidate;
154    
155  /*  /*
156   * Calculate the min/max range (in halfpixels)   * Calculate the min/max range
157   * relative to the _MACROBLOCK_ position   * relative to the _MACROBLOCK_ position
158   */   */
159  static void __inline  static void __inline
# Line 155  Line 163 
163                    int32_t * const max_dy,                    int32_t * const max_dy,
164                    const uint32_t x,                    const uint32_t x,
165                    const uint32_t y,                    const uint32_t y,
166                    const uint32_t block_sz,      /* block dimension, 8 or 16 */                    uint32_t block_sz, /* block dimension, 8 or 16 */
167                    const uint32_t width,                    const uint32_t width,
168                    const uint32_t height,                    const uint32_t height,
169                    const uint32_t fcode,                    const uint32_t fcode,
170                    const uint32_t quarterpel)                    const int qpel, /* 1 if the resulting range should be in qpel precision; otherwise 0 */
171                      const int rrv)
172  {  {
173            int k, m = qpel ? 4 : 2;
174            const int search_range = 32 << (fcode - 1);
175            int high = search_range - 1;
176            int low = -search_range;
177    
178            if (rrv) {
179                    high = RRV_MV_SCALEUP(high);
180                    low = RRV_MV_SCALEUP(low);
181                    block_sz *= 2;
182            }
183    
184          int k;          k = m * (int)(width - x * block_sz);
         const int search_range = 32 << (fcode - 1 - quarterpel);  
         const int high = search_range - 1;  
         const int low = -search_range;  
   
         k = 2 * (int)(width - x*block_sz);  
185          *max_dx = MIN(high, k);          *max_dx = MIN(high, k);
186          k = 2 * (int)(height -  y*block_sz);          k = m * (int)(height -  y * block_sz);
187          *max_dy = MIN(high, k);          *max_dy = MIN(high, k);
188    
189          k = -2 * (int)((x+1) * block_sz);          k = -m * (int)((x+1) * block_sz);
190          *min_dx = MAX(low, k);          *min_dx = MAX(low, k);
191          k = -2 * (int)((y+1) * block_sz);          k = -m * (int)((y+1) * block_sz);
192          *min_dy = MAX(low, k);          *min_dy = MAX(low, k);
   
193  }  }
194    
   
195  typedef void MainSearchFunc(int x, int y, const SearchData * const Data, int bDirection);  typedef void MainSearchFunc(int x, int y, const SearchData * const Data, int bDirection);
196    
197  static MainSearchFunc DiamondSearch, AdvDiamondSearch, SquareSearch;  static MainSearchFunc DiamondSearch, AdvDiamondSearch, SquareSearch;
# Line 203  Line 215 
215                                   const uint32_t iLimit);                                   const uint32_t iLimit);
216    
217  static void  static void
218  SearchP(const uint8_t * const pRef,  SearchP(const IMAGE * const pRef,
219                  const uint8_t * const pRefH,                  const uint8_t * const pRefH,
220                  const uint8_t * const pRefV,                  const uint8_t * const pRefV,
221                  const uint8_t * const pRefHV,                  const uint8_t * const pRefHV,
                 const uint8_t * const pRefQ,  
222                  const IMAGE * const pCur,                  const IMAGE * const pCur,
223                  const int x,                  const int x,
224                  const int y,                  const int y,
# Line 220  Line 231 
231                  int inter4v,                  int inter4v,
232                  MACROBLOCK * const pMB);                  MACROBLOCK * const pMB);
233    
234    static VECTOR
235    GlobalMotionEst(const MACROBLOCK * const pMBs,
236                                    const MBParam * const pParam, const uint32_t iFcode);
237    
238  #ifdef _SMP  #define iDiamondSize 2
 bool  
 SMP_MotionEstimation(MBParam * const pParam,  
                                  FRAMEINFO * const current,  
                                  FRAMEINFO * const reference,  
                                  const IMAGE * const pRefH,  
                                  const IMAGE * const pRefV,  
                                  const IMAGE * const pRefHV,  
                                  const uint32_t iLimit);  
 #endif  
239    
240  #endif                                                  /* _MOTION_EST_H_ */  #endif                                                  /* _MOTION_EST_H_ */

Legend:
Removed from v.579  
changed lines
  Added in v.768

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