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

Diff of /xvidcore/src/global.h

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

revision 1.14, Wed Sep 4 21:59:27 2002 UTC revision 1.21.2.4, Thu Apr 10 13:05:54 2003 UTC
# Line 1  Line 1 
 /*****************************************************************************  
  *  
  *  XVID MPEG-4 VIDEO CODEC  
  *  - Global structures, constants -  
  *  
  *  Copyright(C) 2002 Michael Militzer  
  *  
  *  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.  
  *  
  *  This program is free software ; you can redistribute it and/or modify  
  *  it under the terms of the GNU General Public License as published by  
  *  the Free Software Foundation ; either version 2 of the License, or  
  *  (at your option) any later version.  
  *  
  *  This program is distributed in the hope that it will be useful,  
  *  but WITHOUT ANY WARRANTY ; without even the implied warranty of  
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  *  GNU General Public License for more details.  
  *  
  *  You should have received a copy of the GNU General Public License  
  *  along with this program ; if not, write to the Free Software  
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  
  *  
  * $Id$  
  *  
  ****************************************************************************/  
   
1  #ifndef _GLOBAL_H_  #ifndef _GLOBAL_H_
2  #define _GLOBAL_H_  #define _GLOBAL_H_
3    
# Line 45  Line 11 
11  #define MODE_INTER4V    2  #define MODE_INTER4V    2
12  #define MODE_INTRA              3  #define MODE_INTRA              3
13  #define MODE_INTRA_Q    4  #define MODE_INTRA_Q    4
 #define MODE_STUFFING   7  
14  #define MODE_NOT_CODED  16  #define MODE_NOT_CODED  16
15    #define MODE_NOT_CODED_GMC      17
16    
17  /* --- bframe specific --- */  /* --- bframe specific --- */
18    
# Line 55  Line 21 
21  #define MODE_BACKWARD           2  #define MODE_BACKWARD           2
22  #define MODE_FORWARD            3  #define MODE_FORWARD            3
23  #define MODE_DIRECT_NONE_MV     4  #define MODE_DIRECT_NONE_MV     4
24    #define MODE_DIRECT_NO4V        5
25    
26    
27    // vop coding types
28    // intra, prediction, backward, sprite, not_coded
29    #define I_VOP   0
30    #define P_VOP   1
31    #define B_VOP   2
32    #define S_VOP   3
33    #define N_VOP   4
34    
35    /* convert mpeg-4 coding type i/p/b/s_VOP to XVID_TYPE_xxx */
36    static __inline int
37    coding2type(int coding_type)
38    {
39            return coding_type + 1;
40    }
41    
42    /* convert XVID_TYPE_xxx to bitstream coding type i/p/b/s_VOP */
43    static __inline int
44    type2coding(int xvid_type)
45    {
46            return xvid_type - 1;
47    }
48    
49    
50    typedef struct
51    {
52            int x;
53            int y;
54    }
55    VECTOR;
56    
57    
58    
59    typedef struct
60    {
61            VECTOR duv[3];
62    }
63    WARPPOINTS;
64    
65    /* save all warping parameters for GMC once and for all, instead of
66       recalculating for every block. This is needed for encoding&decoding
67       When switching to incremental calculations, this will get much shorter
68    */
69    
70    /*      we don't include WARPPOINTS wp  here, but in FRAMEINFO itself */
71    
72    typedef struct
73    {
74            int num_wp;             //      [input]: 0=none, 1=translation, 2,3 = warping
75                                                            //  a value of -1 means: "structure not initialized!"
76            int s;                                  //  [input]: calc is done with 1/s pel resolution
77    
78            int W;
79            int H;
80    
81            int ss;
82            int smask;
83            int sigma;
84    
85            int r;
86            int rho;
87    
88            int i0s;
89            int j0s;
90            int i1s;
91            int j1s;
92            int i2s;
93            int j2s;
94    
95            int i1ss;
96            int j1ss;
97            int i2ss;
98            int j2ss;
99    
100            int alpha;
101            int beta;
102            int Ws;
103            int Hs;
104    
105            int dxF, dyF, dxG, dyG;
106            int Fo, Go;
107            int cFo, cGo;
108    }
109    GMC_DATA;
110    
111    
112    typedef struct
113    {
114            uint8_t *y;
115            uint8_t *u;
116            uint8_t *v;
117    }
118    IMAGE;
119    
120    
121  typedef struct  typedef struct
# Line 66  Line 127 
127          uint32_t *tail;          uint32_t *tail;
128          uint32_t *start;          uint32_t *start;
129          uint32_t length;          uint32_t length;
130            uint32_t initpos;
131  }  }
132  Bitstream;  Bitstream;
133    
# Line 93  Line 155 
155    
156          VECTOR mv16;          VECTOR mv16;
157          VECTOR pmvs[4];          VECTOR pmvs[4];
158            VECTOR qmvs[4];                         // mvs in quarter pixel resolution
159    
160          int32_t sad8[4];                        // SAD values for inter4v-VECTORs          int32_t sad8[4];                        // SAD values for inter4v-VECTORs
161          int32_t sad16;                          // SAD value for inter-VECTOR          int32_t sad16;                          // SAD value for inter-VECTOR
# Line 103  Line 166 
166          // bframe stuff          // bframe stuff
167    
168          VECTOR b_mvs[4];          VECTOR b_mvs[4];
169          VECTOR b_pmvs[4];          VECTOR b_qmvs[4];
   
         // bframe direct mode  
   
         VECTOR directmv[4];  
         VECTOR deltamv;  
170    
171          int mb_type;          int mb_type;
         int dbquant;  
172    
173          // stuff for block based ME (needed for Qpel ME)          // stuff for block based ME (needed for Qpel ME)
174          // backup of last integer ME vectors/sad          // backup of last integer ME vectors/sad
175    
176          VECTOR i_mv16;          VECTOR amv; // average motion vectors from GMC
177          VECTOR i_mvs[4];          int32_t mcsel;
178    
179          int32_t i_sad8[4];      // SAD values for inter4v-VECTORs  /* This structure has become way to big! What to do? Split it up?   */
         int32_t i_sad16;        // SAD value for inter-VECTOR  
180    
181  }  }
182  MACROBLOCK;  MACROBLOCK;
183    
184  static __inline int8_t  static __inline uint32_t
185  get_dc_scaler(uint32_t quant,  get_dc_scaler(uint32_t quant,
186                            uint32_t lum)                            uint32_t lum)
187  {  {
# Line 151  Line 207 
207    
208  #define MIN(X, Y) ((X)<(Y)?(X):(Y))  #define MIN(X, Y) ((X)<(Y)?(X):(Y))
209  #define MAX(X, Y) ((X)>(Y)?(X):(Y))  #define MAX(X, Y) ((X)>(Y)?(X):(Y))
210  #define ABS(X)    (((X)>0)?(X):-(X))  /* #define ABS(X)    (((X)>0)?(X):-(X)) */
211  #define SIGN(X)   (((X)>0)?1:-1)  #define SIGN(X)   (((X)>0)?1:-1)
212    #define CLIP(X,AMIN,AMAX)   (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X))
213    #define DIV_DIV(a,b)    (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b))
214    #define SWAP(_T_,A,B)    { _T_ tmp = A; A = B; B = tmp; }
215    
216    
217  #endif /* _GLOBAL_H_ */  #endif /* _GLOBAL_H_ */

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.21.2.4

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