[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.20, Wed Feb 19 20:12:43 2003 UTC revision 1.20.2.3, Mon Jun 9 13:54:25 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) )
# Line 48  Line 48 
48   ****************************************************************************/   ****************************************************************************/
49    
50  extern const uint32_t roundtab[16];  extern const uint32_t roundtab[16];
   
51  /* K = 4 */  /* K = 4 */
52  extern const uint32_t roundtab_76[16];  extern const uint32_t roundtab_76[16];
53  /* K = 2 */  /* K = 2 */
# Line 56  Line 55 
55  /* K = 1 */  /* K = 1 */
56  extern const uint32_t roundtab_79[4];  extern const uint32_t roundtab_79[4];
57    
   
58  /*  /*
59   * getref: calculate reference image pointer   * getref: calculate reference image pointer
60   * the decision to use interpolation h/v/hv or the normal image is   * the decision to use interpolation h/v/hv or the normal image is
# Line 71  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 int32_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 int32_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 139  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 165  Line 121 
121  /* GMC stuff. Maybe better put it into a separate file */  /* GMC stuff. Maybe better put it into a separate file */
122    
123  void  void
124  generate_GMCparameters( const int num_wp,                               // [input]: number of warppoints  generate_GMCparameters( const int num_wp,                               /* [input]: number of warppoints */
125                                                  const int res,                                  // [input]: resolution                                                  const int res,                                  /* [input]: resolution */
126                                                  const WARPPOINTS *const warp,   // [input]: warp points                                                  const WARPPOINTS *const warp,   /* [input]: warp points */
127                                                  const int width, const int height,      // [input]: without edges!                                                  const int width, const int height,      /* [input]: without edges! */
128                                                  GMC_DATA *const gmc);           // [output] precalculated parameters                                                  GMC_DATA *const gmc);           /* [output] precalculated parameters */
129    
130  void  void
131  generate_GMCimage(      const GMC_DATA *const gmc_data,         // [input] precalculated data  generate_GMCimage(      const GMC_DATA *const gmc_data,         /* [input] precalculated data */
132                                          const IMAGE *const pRef,                        // [input]                                          const IMAGE *const pRef,                        /* [input] */
133                                          const int mb_width,                                          const int mb_width,
134                                          const int mb_height,                                          const int mb_height,
135                                          const int stride,                                          const int stride,
136                                          const int stride2,                                          const int stride2,
137                                          const int fcode,                                        // [input] some parameters...                                          const int fcode,                                        /* [input] some parameters... */
138                                          const int32_t quarterpel,                       // [input] for rounding avgMV                                          const int32_t quarterpel,                       /* [input] for rounding avgMV */
139                                          const int reduced_resolution,           // [input] ignored                                          const int reduced_resolution,           /* [input] ignored */
140                                          const int32_t rounding,                 // [input] for rounding image data                                          const int32_t rounding,                 /* [input] for rounding image data */
141                                          MACROBLOCK *const pMBs,         // [output] average motion vectors                                          MACROBLOCK *const pMBs,         /* [output] average motion vectors */
142                                          IMAGE *const pGMC);                     // [output] full warped image                                          IMAGE *const pGMC);                     /* [output] full warped image */
   
143    
144  VECTOR generate_GMCimageMB(     const GMC_DATA *const gmc_data,         /* [input] all precalc data */  VECTOR generate_GMCimageMB(     const GMC_DATA *const gmc_data,         /* [input] all precalc data */
145                                                          const IMAGE *const pRef,                        // [input]                                                          const IMAGE *const pRef,                        /* [input] */
146                                                          const int mi, const int mj,             /* [input] MB position  */                                                          const int mi, const int mj,             /* [input] MB position  */
147                                                          const int stride,                                       /* [input] Lumi stride */                                                          const int stride,                                       /* [input] Lumi stride */
148                                                          const int stride2,                                      /* [input] chroma stride */                                                          const int stride2,                                      /* [input] chroma stride */
# Line 195  Line 150 
150                                                          const int rounding,                                                          const int rounding,
151                                                          IMAGE *const pGMC);                                     /* [outut] generate image */                                                          IMAGE *const pGMC);                                     /* [outut] generate image */
152    
   
   
 /* Hinted ME */  
   
 void  
 MotionEstimationHinted( MBParam * const pParam,  
                                                 FRAMEINFO * const current,  
                                                 FRAMEINFO * const reference,  
                                                 const IMAGE * const pRefH,  
                                                 const IMAGE * const pRefV,  
                                                 const IMAGE * const pRefHV);  
   
153  int  int
154  MEanalysis(     const IMAGE * const pRef,  MEanalysis(     const IMAGE * const pRef,
155                          FRAMEINFO * const Current,                          const FRAMEINFO * const Current,
156                          MBParam * const pParam,                          const MBParam * const pParam,
157                          int maxIntra,                          const int maxIntra,
158                          int intraCount,                          const int intraCount,
159                          int bCount);                          const int bCount,
160                            const int b_thresh);
 int  
 FindFcode(      const MBParam * const pParam,  
                         const FRAMEINFO * const current);  
   
   
 int d_amv_penalty(int x, int y, const VECTOR pred, const uint32_t iFcode, const int quant);  
   
161    
162  #endif                                                  /* _MOTION_H_ */  #endif                                                  /* _MOTION_H_ */

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.20.2.3

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