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

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

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

revision 1.13.2.6, Tue Nov 12 14:46:03 2002 UTC revision 1.20.2.4, Sat Jun 28 15:51:18 2003 UTC
# Line 36  Line 36 
36  #include "../portab.h"  #include "../portab.h"
37  #include "../global.h"  #include "../global.h"
38    
39  // fast ((A)/2)*2  /* fast ((A)/2)*2 */
40  #define EVEN(A)         (((A)<0?(A)+1:(A)) & ~1)  #define EVEN(A)         (((A)<0?(A)+1:(A)) & ~1)
41    
42  #define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) )  #define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) )
43  #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )  #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )
44    
45  static const uint32_t roundtab[16] =  /*****************************************************************************
46                  { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };   * Modified rounding tables -- defined in motion_est.c
47     * Original tables see ISO spec tables 7-6 -> 7-9
48  /*   ****************************************************************************/
  * modified rounding tables  
  * original tables see ISO spec tables 7-6 -> 7-9  
  */  
49    
50    extern const uint32_t roundtab[16];
51  /* K = 4 */  /* K = 4 */
52  static const uint32_t roundtab_76[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 };  extern const uint32_t roundtab_76[16];
53  /* K = 2 */  /* K = 2 */
54  static const uint32_t roundtab_78[8] = { 0, 0, 1, 1, 0, 0, 0, 1  };  extern const uint32_t roundtab_78[8];
55  /* K = 1 */  /* K = 1 */
56  static const uint32_t roundtab_79[4] = { 0, 1, 0, 0 };  extern const uint32_t roundtab_79[4];
   
57    
58  /*  /*
59   * getref: calculate reference image pointer   * getref: calculate reference image pointer
# Line 72  Line 69 
69                  const uint32_t x,                  const uint32_t x,
70                  const uint32_t y,                  const uint32_t y,
71                  const uint32_t block,   /* block dimension, 8 or 16 */                  const uint32_t block,   /* block dimension, 8 or 16 */
   
72                  const int32_t dx,                  const int32_t dx,
73                  const int32_t dy,                  const int32_t dy,
74                  const uint32_t stride)                  const int32_t stride)
75  {  {
   
   
76          switch (((dx & 1) << 1) + (dy & 1)) {   /* ((dx%2)?2:0)+((dy%2)?1:0) */          switch (((dx & 1) << 1) + (dy & 1)) {   /* ((dx%2)?2:0)+((dy%2)?1:0) */
77          case 0:          case 0:
78                  return refn + (int) ((x * block + dx / 2) + (y * block + dy / 2) * stride);                  return refn + (int) ((x * block + dx / 2) + (y * block + dy / 2) * stride);
79          case 1:          case 1:
80                  return refv + (int) ((x * block + dx / 2) + (y * block +                  return refv + (int) ((x * block + dx / 2) + (y * block + (dy - 1) / 2) * stride);
                                                                                           (dy - 1) / 2) * stride);  
81          case 2:          case 2:
82                  return refh + (int) ((x * block + (dx - 1) / 2) + (y * block +                  return refh + (int) ((x * block + (dx - 1) / 2) + (y * block + dy / 2) * stride);
                                                                                                         dy / 2) * stride);  
83          default:          default:
84                  return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block +                  return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block + (dy - 1) / 2) * stride);
                                                                                                          (dy - 1) / 2) * stride);  
85          }          }
   
 }  
   
   
 /* This is somehow a copy of get_ref, but with MV instead of X,Y */  
   
 static __inline const uint8_t *  
 get_ref_mv(const uint8_t * const refn,  
                    const uint8_t * const refh,  
                    const uint8_t * const refv,  
                    const uint8_t * const refhv,  
                    const uint32_t x,  
                    const uint32_t y,  
                    const uint32_t block,        /* block dimension, 8 or 16 */  
   
                    const VECTOR * mv,   /* measured in half-pel! */  
   
                    const uint32_t stride)  
 {  
   
         switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) {  
         case 0:  
                 return refn + (int) ((x * block + (mv->x) / 2) + (y * block +  
                                                                                                    (mv->y) / 2) * stride);  
         case 1:  
                 return refv + (int) ((x * block + (mv->x) / 2) + (y * block +  
                                                                                                    ((mv->y) - 1) / 2) * stride);  
         case 2:  
                 return refh + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block +  
                                                                                                                  (mv->y) / 2) * stride);  
         default:  
                 return refhv + (int) ((x * block + ((mv->x) - 1) / 2) + (y * block +  
                                                                                                                   ((mv->y) -  
                                                                                                                    1) / 2) * stride);  
         }  
   
86  }  }
87    
88  void MotionEstimationBVOP(MBParam * const pParam,  void MotionEstimationBVOP(MBParam * const pParam,
89                                                    FRAMEINFO * const frame,                                                    FRAMEINFO * const frame,
90                                                    // forward (past) reference                                                  /* forward (past) reference */
91                                                    const int32_t time_bp,                                                    const int32_t time_bp,
92                                                    const int32_t time_pp,                                                    const int32_t time_pp,
93                                                    const MACROBLOCK * const f_mbs,                                                    const MACROBLOCK * const f_mbs,
# Line 140  Line 95 
95                                                    const IMAGE * const f_refH,                                                    const IMAGE * const f_refH,
96                                                    const IMAGE * const f_refV,                                                    const IMAGE * const f_refV,
97                                                    const IMAGE * const f_refHV,                                                    const IMAGE * const f_refHV,
98                                                    // backward (future) reference                                                  /* backward (future) reference */
99                                                    const FRAMEINFO * const b_reference,                                                    const FRAMEINFO * const b_reference,
100                                                    const IMAGE * const b_ref,                                                    const IMAGE * const b_ref,
101                                                    const IMAGE * const b_refH,                                                    const IMAGE * const b_refH,
# Line 162  Line 117 
117                                                            const IMAGE * const b_refhv,                                                            const IMAGE * const b_refhv,
118                                                            int16_t * dct_codes);                                                            int16_t * dct_codes);
119    
 void  
 MotionEstimationHinted( MBParam * const pParam,  
                                                 FRAMEINFO * const current,  
                                                 FRAMEINFO * const reference,  
                                                 const IMAGE * const pRefH,  
                                                 const IMAGE * const pRefV,  
                                                 const IMAGE * const pRefHV);  
   
120  int  int
121  MEanalysis(     const IMAGE * const pRef,  MEanalysis(     const IMAGE * const pRef,
122                          FRAMEINFO * const Current,                          const FRAMEINFO * const Current,
123                          MBParam * const pParam,                          const MBParam * const pParam,
124                          int maxIntra,                          const int maxIntra,
125                          int intraCount,                          const int intraCount,
126                          int bCount);                          const int bCount,
127                            const int b_thresh);
 int  
 FindFcode(      const MBParam * const pParam,  
                         const FRAMEINFO * const current);  
   
 /* used internally only */  
   
 static VECTOR  
 GlobalMotionEst(const MACROBLOCK * const pMBs,  
                                 const MBParam * const pParam, const uint32_t iFcode);  
   
128    
129  #endif                                                  /* _MOTION_H_ */  #endif                                                  /* _MOTION_H_ */

Legend:
Removed from v.1.13.2.6  
changed lines
  Added in v.1.20.2.4

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