[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.3, Thu Oct 3 08:26:19 2002 UTC revision 1.21, Tue Mar 4 11:00:53 2003 UTC
# Line 42  Line 42 
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    /*****************************************************************************
46     * Modified rounding tables -- defined in motion_est.c
47     * Original tables see ISO spec tables 7-6 -> 7-9
48     ****************************************************************************/
49    
50    extern const uint32_t roundtab[16];
51    /* K = 4 */
52    extern const uint32_t roundtab_76[16];
53    /* K = 2 */
54    extern const uint32_t roundtab_78[8];
55    /* K = 1 */
56    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
61   * based on dx & dy.   * based on dx & dy.
62   */   */
63    
 static const uint32_t roundtab[16] =  
                 { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };  
   
   
64  static __inline const uint8_t *  static __inline const uint8_t *
65  get_ref(const uint8_t * const refn,  get_ref(const uint8_t * const refn,
66                  const uint8_t * const refh,                  const uint8_t * const refh,
# Line 60  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,
# Line 129  Line 96 
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 MACROBLOCK * const b_mbs,                                                  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,
102                                                    const IMAGE * const b_refV,                                                    const IMAGE * const b_refV,
# Line 150  Line 117 
117                                                            const IMAGE * const b_refhv,                                                            const IMAGE * const b_refhv,
118                                                            int16_t * dct_codes);                                                            int16_t * dct_codes);
119    
120    
121    /* GMC stuff. Maybe better put it into a separate file */
122    
123  void  void
124  MotionEstimationHinted( MBParam * const pParam,  generate_GMCparameters( const int num_wp,                               // [input]: number of warppoints
125                                                  FRAMEINFO * const current,                                                  const int res,                                  // [input]: resolution
126                                                  FRAMEINFO * const reference,                                                  const WARPPOINTS *const warp,   // [input]: warp points
127                                                  const IMAGE * const pRefH,                                                  const int width, const int height,      // [input]: without edges!
128                                                  const IMAGE * const pRefV,                                                  GMC_DATA *const gmc);           // [output] precalculated parameters
                                                 const IMAGE * const pRefHV);  
129    
130  int  void
131  MEanalysis(     const IMAGE * const pRef,  generate_GMCimage(      const GMC_DATA *const gmc_data,         // [input] precalculated data
132                          const IMAGE * const pCurrent,                                          const IMAGE *const pRef,                        // [input]
133                          MBParam * const pParam,                                          const int mb_width,
134                          MACROBLOCK * const pMBs,                                          const int mb_height,
135                          const uint32_t iFcode);                                          const int stride,
136                                            const int stride2,
137                                            const int fcode,                                        // [input] some parameters...
138                                            const int32_t quarterpel,                       // [input] for rounding avgMV
139                                            const int reduced_resolution,           // [input] ignored
140                                            const int32_t rounding,                 // [input] for rounding image data
141                                            MACROBLOCK *const pMBs,         // [output] average motion vectors
142                                            IMAGE *const pGMC);                     // [output] full warped image
143    
144    VECTOR generate_GMCimageMB(     const GMC_DATA *const gmc_data,         /* [input] all precalc data */
145                                                            const IMAGE *const pRef,                        // [input]
146                                                            const int mi, const int mj,             /* [input] MB position */
147                                                            const int stride,                                       /* [input] Lumi stride */
148                                                            const int stride2,                                      /* [input] chroma stride */
149                                                            const int quarterpel,                           /* [input] for rounding of AvgMV */
150                                                            const int rounding,
151                                                            IMAGE *const pGMC);                                     /* [outut] generate image */
152    
153  int  int
154  FindFcode(      const MBParam * const pParam,  MEanalysis(     const IMAGE * const pRef,
155                          const FRAMEINFO * const current);                          const FRAMEINFO * const Current,
156                            const MBParam * const pParam,
157                            const int maxIntra,
158                            const int intraCount,
159                            const int bCount,
160                            const int b_thresh);
161    
162  #endif                                                  /* _MOTION_H_ */  #endif                                                  /* _MOTION_H_ */

Legend:
Removed from v.1.13.2.3  
changed lines
  Added in v.1.21

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