[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 601, Thu Oct 17 13:50:23 2002 UTC revision 704, Wed Dec 11 10:32:29 2002 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.6 2002-10-17 13:50:23 syskin Exp $   *  $Id: motion_est.h,v 1.1.2.10 2002-12-11 10:32:29 syskin Exp $
30   *   *
31   ***************************************************************************/   ***************************************************************************/
32    
# Line 44  Line 44 
44  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */  /* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */
45  #define MV16_INTER_BIAS 512  #define MV16_INTER_BIAS 512
46    
47    /* vector map (vlc delta size) smoother parameters ! float !*/
48    #define NEIGH_TEND_16X16        10.5
49    #define NEIGH_TEND_8X8          4.0
50    #define NEIGH_8X8_BIAS          30
51    
52  /* Parameters which control inter/inter4v decision */  /* Parameters which control inter/inter4v decision */
53  #define IMV16X16                        2  #define IMV16X16                        2
54    
 /* vector map (vlc delta size) smoother parameters ! float !*/  
 #define NEIGH_TEND_16X16        4.0  
 #define NEIGH_TEND_8X8          6.0  
   
55  static const int lambda_vec16[32] =  static const int lambda_vec16[32] =
56          {     0    ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5),          {     0    ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5),
57          (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 100 
100          -1, -2, 1, 2          -1, -2, 1, 2
101  };  };
102    
103    #define RRV_MV_SCALEDOWN(a)     ( (a)>=0 ? (a+1)/2 : (a-1)/2 )
104    #define RRV_MV_SCALEUP(a)       ( (a)>0 ? 2*(a)-1 : (a)<0 ? 2*(a)+1 : (a) )
105    
106  typedef struct  typedef struct
107          {          {
# Line 106  Line 109 
109                  int max_dx, min_dx, max_dy, min_dy;                  int max_dx, min_dx, max_dy, min_dy;
110                  uint32_t rounding;                  uint32_t rounding;
111                  VECTOR predMV;                  VECTOR predMV;
                 VECTOR predQMV;  
112                  VECTOR *currentMV;                  VECTOR *currentMV;
113                  VECTOR *currentQMV;                  VECTOR *currentQMV;
114                  int32_t *iMinSAD;                  int32_t *iMinSAD;
# Line 114  Line 116 
116                  const uint8_t * RefH;                  const uint8_t * RefH;
117                  const uint8_t * RefV;                  const uint8_t * RefV;
118                  const uint8_t * RefHV;                  const uint8_t * RefHV;
119                  const uint8_t * RefQ;                  const uint8_t * RefCU;
120                    const uint8_t * RefCV;
121                    const uint8_t * CurU;
122                    const uint8_t * CurV;
123                    uint8_t * RefQ;
124                  const uint8_t * Cur;                  const uint8_t * Cur;
125                  uint32_t lambda16; //weights of motion vectors                  uint32_t lambda16;
126                  uint32_t lambda8;                  uint32_t lambda8;
127                  uint32_t iEdgedWidth;                  uint32_t iEdgedWidth;
128                  uint32_t iFcode;                  uint32_t iFcode;
129                  int * temp;                  int * temp;
130                    int qpel, qpel_precision;
131                    int chroma;
132                    int rrv;
133  //fields for interpolate and direct mode  //fields for interpolate and direct mode
134                  const uint8_t *bRef;                  const uint8_t *bRef;
135                  const uint8_t *bRefH;                  const uint8_t *bRefH;
# Line 159  Line 168 
168                    const uint32_t block_sz,      /* block dimension, 8 or 16 */                    const uint32_t block_sz,      /* block dimension, 8 or 16 */
169                    const uint32_t width,                    const uint32_t width,
170                    const uint32_t height,                    const uint32_t height,
171                    const uint32_t fcode,                    const uint32_t fcode)
                   const uint32_t quarterpel)  
172  {  {
   
173          int k;          int k;
174          const int search_range = 32 << (fcode - 1 - quarterpel);          const int search_range = 32 << (fcode - 1);
175          const int high = search_range - 1;          const int high = search_range - 1;
176          const int low = -search_range;          const int low = -search_range;
177    
# Line 177  Line 184 
184          *min_dx = MAX(low, k);          *min_dx = MAX(low, k);
185          k = -2 * (int)((y+1) * block_sz);          k = -2 * (int)((y+1) * block_sz);
186          *min_dy = MAX(low, k);          *min_dy = MAX(low, k);
187    }
188    
189    static void __inline
190    get_range_rrv(int32_t * const min_dx,
191                      int32_t * const max_dx,
192                      int32_t * const min_dy,
193                      int32_t * const max_dy,
194                      const uint32_t x,
195                      const uint32_t y,
196                      const uint32_t block_sz,      /* block dimension, 8 or 16 */
197                      const uint32_t width,
198                      const uint32_t height,
199                      const uint32_t fcode)
200    {
201            int k;
202            const int search_range = 32 << (fcode - 1);
203            const int high = RRV_MV_SCALEUP(search_range - 1); //halfzero -> halfpel, because we do our search in halfpel
204            const int low = RRV_MV_SCALEUP(-search_range);
205    
206            k = 2 * (int)(width - x*block_sz);
207            *max_dx = MIN(high, k);
208            k = 2 * (int)(height -  y*block_sz);
209            *max_dy = MIN(high, k);
210    
211            k = -2 * (int)((x+1) * block_sz);
212            *min_dx = MAX(low, k);
213            k = -2 * (int)((y+1) * block_sz);
214            *min_dy = MAX(low, k);
215    }
216    
217    static void __inline
218    get_range_qpel(int32_t * const min_dx,
219                      int32_t * const max_dx,
220                      int32_t * const min_dy,
221                      int32_t * const max_dy,
222                      const uint32_t x,
223                      const uint32_t y,
224                      const uint32_t block_sz,      /* block dimension, 8 or 16 */
225                      const uint32_t width,
226                      const uint32_t height,
227                      const uint32_t fcode)
228    {
229            int k;
230            const int search_range = 32 << (fcode - 1);
231            const int high = search_range - 1;
232            const int low = -search_range;
233    
234            k = 4 * (int)(width - x*block_sz);
235            *max_dx = MIN(high, k);
236            k = 4 * (int)(height -  y*block_sz);
237            *max_dy = MIN(high, k);
238    
239            k = -4 * (int)((x+1) * block_sz);
240            *min_dx = MAX(low, k);
241            k = -4 * (int)((y+1) * block_sz);
242            *min_dy = MAX(low, k);
243  }  }
244    
245    
# Line 204  Line 266 
266                                   const uint32_t iLimit);                                   const uint32_t iLimit);
267    
268  static void  static void
269  SearchP(const uint8_t * const pRef,  SearchP(const IMAGE * const pRef,
270                  const uint8_t * const pRefH,                  const uint8_t * const pRefH,
271                  const uint8_t * const pRefV,                  const uint8_t * const pRefV,
272                  const uint8_t * const pRefHV,                  const uint8_t * const pRefHV,
                 const uint8_t * const pRefQ,  
273                  const IMAGE * const pCur,                  const IMAGE * const pCur,
274                  const int x,                  const int x,
275                  const int y,                  const int y,
# Line 221  Line 282 
282                  int inter4v,                  int inter4v,
283                  MACROBLOCK * const pMB);                  MACROBLOCK * const pMB);
284    
   
 #ifdef _SMP  
 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  
   
285  #endif                                                  /* _MOTION_EST_H_ */  #endif                                                  /* _MOTION_EST_H_ */

Legend:
Removed from v.601  
changed lines
  Added in v.704

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