[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.2.1, Thu Mar 27 17:09:59 2003 UTC revision 1.24.2.1, Mon May 25 09:03:47 2009 UTC
# Line 1  Line 1 
1  /**************************************************************************  /*****************************************************************************
2   *   *
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  -  Motion sad header  -   *  - Motion module header -
5     *
6     *  Copyright(C) 2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net>
7     *               2002 Michael Militzer <michael@xvid.org>
8   *   *
  *  This program is an implementation of a part of one or more MPEG-4  
  *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  
  *  to use this software module in hardware or software products are  
  *  advised that its use may infringe existing patents or copyrights, and  
  *  any such use would be at such party's own risk.  The original  
  *  developer of this software module and his/her company, and subsequent  
  *  editors and their companies, will have no liability for use of this  
  *  software or modifications or derivatives thereof.  
9   *   *
10   *  This program is free software; you can redistribute it and/or modify   *  This program is free software; you can redistribute it and/or modify
11   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 36  Line 31 
31  #include "../portab.h"  #include "../portab.h"
32  #include "../global.h"  #include "../global.h"
33    
 // fast ((A)/2)*2  
 #define EVEN(A)         (((A)<0?(A)+1:(A)) & ~1)  
   
 #define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) )  
 #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )  
   
34  /*****************************************************************************  /*****************************************************************************
35   * Modified rounding tables -- defined in motion_est.c   * Modified rounding tables -- defined in estimation_common.c
36   * Original tables see ISO spec tables 7-6 -> 7-9   * Original tables see ISO spec tables 7-6 -> 7-9
37   ****************************************************************************/   ****************************************************************************/
38    
# Line 55  Line 44 
44  /* K = 1 */  /* K = 1 */
45  extern const uint32_t roundtab_79[4];  extern const uint32_t roundtab_79[4];
46    
 /*  
  * getref: calculate reference image pointer  
  * the decision to use interpolation h/v/hv or the normal image is  
  * based on dx & dy.  
  */  
   
 static __inline const uint8_t *  
 get_ref(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 int32_t dx,  
                 const int32_t dy,  
                 const int32_t stride)  
 {  
         switch (((dx & 1) << 1) + (dy & 1)) {   /* ((dx%2)?2:0)+((dy%2)?1:0) */  
         case 0:  
                 return refn + (int) ((x * block + dx / 2) + (y * block + dy / 2) * stride);  
         case 1:  
                 return refv + (int) ((x * block + dx / 2) + (y * block + (dy - 1) / 2) * stride);  
         case 2:  
                 return refh + (int) ((x * block + (dx - 1) / 2) + (y * block + dy / 2) * stride);  
         default:  
                 return refhv + (int) ((x * block + (dx - 1) / 2) + (y * block + (dy - 1) / 2) * stride);  
         }  
 }  
47    
48  void MotionEstimationBVOP(MBParam * const pParam,  /** MotionEstimation **/
49    
50    void MotionEstimation(MBParam * const pParam,
51                                            FRAMEINFO * const current,
52                                            FRAMEINFO * const reference,
53                                            const IMAGE * const pRefH,
54                                            const IMAGE * const pRefV,
55                                            const IMAGE * const pRefHV,
56                                            const IMAGE * const pGMC,
57                                            const uint32_t iLimit);
58    
59    void
60    MotionEstimationBVOP(MBParam * const pParam,
61                                                  FRAMEINFO * const frame,                                                  FRAMEINFO * const frame,
                                                 // forward (past) reference  
62                                                  const int32_t time_bp,                                                  const int32_t time_bp,
63                                                  const int32_t time_pp,                                                  const int32_t time_pp,
64                                                  const MACROBLOCK * const f_mbs,                                                  const MACROBLOCK * const f_mbs,
# Line 95  Line 66 
66                                                  const IMAGE * const f_refH,                                                  const IMAGE * const f_refH,
67                                                  const IMAGE * const f_refV,                                                  const IMAGE * const f_refV,
68                                                  const IMAGE * const f_refHV,                                                  const IMAGE * const f_refHV,
                                                 // backward (future) reference  
69                                                  const FRAMEINFO * const b_reference,                                                  const FRAMEINFO * const b_reference,
70                                                  const IMAGE * const b_ref,                                                  const IMAGE * const b_ref,
71                                                  const IMAGE * const b_refH,                                                  const IMAGE * const b_refH,
72                                                  const IMAGE * const b_refV,                                                  const IMAGE * const b_refV,
73                                                  const IMAGE * const b_refHV);                                                  const IMAGE * const b_refHV);
74    
75  void MBMotionCompensationBVOP(MBParam * pParam,  void
76    GMEanalysis(const MBParam * const pParam,
77                            const FRAMEINFO * const current,
78                            const FRAMEINFO * const reference,
79                            const IMAGE * const pRefH,
80                            const IMAGE * const pRefV,
81                            const IMAGE * const pRefHV);
82    
83    WARPPOINTS
84    GlobalMotionEst(MACROBLOCK * const pMBs,
85                                    const MBParam * const pParam,
86                                    const FRAMEINFO * const current,
87                                    const FRAMEINFO * const reference,
88                                    const IMAGE * const pRefH,
89                                    const IMAGE * const pRefV,
90                                    const IMAGE * const pRefHV);
91    
92    int
93    GlobalMotionEstRefine(
94                                    WARPPOINTS *const startwp,
95                                    MACROBLOCK * const pMBs,
96                                    const MBParam * const pParam,
97                                    const FRAMEINFO * const current,
98                                    const FRAMEINFO * const reference,
99                                    const IMAGE * const pCurr,
100                                    const IMAGE * const pRef,
101                                    const IMAGE * const pRefH,
102                                    const IMAGE * const pRefV,
103                                    const IMAGE * const pRefHV);
104    
105    int
106    globalSAD(const WARPPOINTS *const wp,
107                      const MBParam * const pParam,
108                      const MACROBLOCK * const pMBs,
109                      const FRAMEINFO * const current,
110                      const IMAGE * const pRef,
111                      const IMAGE * const pCurr,
112                      uint8_t *const GMCblock);
113    
114    
115    int
116    MEanalysis(     const IMAGE * const pRef,
117                            const FRAMEINFO * const Current,
118                            const MBParam * const pParam,
119                            const int maxIntra,
120                            const int intraCount,
121                            const int bCount,
122                            const int b_thresh,
123                            const MACROBLOCK * const prev_mbs);
124    
125    /** MotionCompensation **/
126    
127    void
128    MBMotionCompensation(MACROBLOCK * const mb,
129                                            const uint32_t i,
130                                            const uint32_t j,
131                                            const IMAGE * const ref,
132                                            const IMAGE * const refh,
133                                            const IMAGE * const refv,
134                                            const IMAGE * const refhv,
135                                            const IMAGE * const refGMC,
136                                            IMAGE * const cur,
137                                            int16_t * dct_codes,
138                                            const uint32_t width,
139                                            const uint32_t height,
140                                            const uint32_t edged_width,
141                                            const int32_t quarterpel,
142                                            const int32_t rounding);
143    
144    void
145    MBMotionCompensationBVOP(MBParam * pParam,
146                                                          MACROBLOCK * const mb,                                                          MACROBLOCK * const mb,
147                                                          const uint32_t i,                                                          const uint32_t i,
148                                                          const uint32_t j,                                                          const uint32_t j,
# Line 117  Line 157 
157                                                          const IMAGE * const b_refhv,                                                          const IMAGE * const b_refhv,
158                                                          int16_t * dct_codes);                                                          int16_t * dct_codes);
159    
   
 /* GMC stuff. Maybe better put it into a separate file */  
   
 void  
 generate_GMCparameters( const int num_wp,                               // [input]: number of warppoints  
                                                 const int res,                                  // [input]: resolution  
                                                 const WARPPOINTS *const warp,   // [input]: warp points  
                                                 const int width, const int height,      // [input]: without edges!  
                                                 GMC_DATA *const gmc);           // [output] precalculated parameters  
   
 void  
 generate_GMCimage(      const GMC_DATA *const gmc_data,         // [input] precalculated data  
                                         const IMAGE *const pRef,                        // [input]  
                                         const int mb_width,  
                                         const int mb_height,  
                                         const int stride,  
                                         const int stride2,  
                                         const int fcode,                                        // [input] some parameters...  
                                         const int32_t quarterpel,                       // [input] for rounding avgMV  
                                         const int reduced_resolution,           // [input] ignored  
                                         const int32_t rounding,                 // [input] for rounding image data  
                                         MACROBLOCK *const pMBs,         // [output] average motion vectors  
                                         IMAGE *const pGMC);                     // [output] full warped image  
   
 VECTOR generate_GMCimageMB(     const GMC_DATA *const gmc_data,         /* [input] all precalc data */  
                                                         const IMAGE *const pRef,                        // [input]  
                                                         const int mi, const int mj,             /* [input] MB position */  
                                                         const int stride,                                       /* [input] Lumi stride */  
                                                         const int stride2,                                      /* [input] chroma stride */  
                                                         const int quarterpel,                           /* [input] for rounding of AvgMV */  
                                                         const int rounding,  
                                                         IMAGE *const pGMC);                                     /* [outut] generate image */  
   
 int  
 MEanalysis(     const IMAGE * const pRef,  
                         const FRAMEINFO * const Current,  
                         const MBParam * const pParam,  
                         const int maxIntra,  
                         const int intraCount,  
                         const int bCount,  
                         const int b_thresh);  
   
160  #endif                                                  /* _MOTION_H_ */  #endif                                                  /* _MOTION_H_ */

Legend:
Removed from v.1.20.2.1  
changed lines
  Added in v.1.24.2.1

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