[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.4, Fri Apr 5 14:40:36 2002 UTC revision 1.13.2.7, Sat Jan 4 06:14:32 2003 UTC
# Line 4  Line 4 
4  #include "xvid.h"  #include "xvid.h"
5  #include "portab.h"  #include "portab.h"
6    
7  /* --- macroblock stuff --- */  /* --- macroblock modes --- */
8    
9  #define MODE_INTER              0  #define MODE_INTER              0
10  #define MODE_INTER_Q    1  #define MODE_INTER_Q    1
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 --- */
18    
19    #define MODE_DIRECT                     0
20    #define MODE_INTERPOLATE        1
21    #define MODE_BACKWARD           2
22    #define MODE_FORWARD            3
23    #define MODE_DIRECT_NONE_MV     4
24    #define MODE_DIRECT_NO4V        5
25    
26    typedef struct
27    {
28            uint8_t *y;
29            uint8_t *u;
30            uint8_t *v;
31    }
32    IMAGE;
33    
34    
35  typedef struct  typedef struct
36  {  {
# Line 34  Line 52 
52  {  {
53          // decoder/encoder          // decoder/encoder
54          VECTOR mvs[4];          VECTOR mvs[4];
         uint32_t sad8[4];               // SAD values for inter4v-VECTORs  
         uint32_t sad16;                 // SAD value for inter-VECTOR  
55    
56      short int pred_values[6][MBPRED_SIZE];      short int pred_values[6][MBPRED_SIZE];
57      int acpred_directions[6];      int acpred_directions[6];
# Line 50  Line 66 
66    
67          // encoder specific          // encoder specific
68    
69            VECTOR mv16;
70          VECTOR pmvs[4];          VECTOR pmvs[4];
71            VECTOR qmvs[4];                         // mvs in quarter pixel resolution
72    
73            int32_t sad8[4];                        // SAD values for inter4v-VECTORs
74            int32_t sad16;                          // SAD value for inter-VECTOR
75    
76          int dquant;          int dquant;
77          int cbp;          int cbp;
78    
79  } MACROBLOCK;          // bframe stuff
80    
81  static __inline int8_t get_dc_scaler(int32_t quant, uint32_t lum)          VECTOR b_mvs[4];
82  {          VECTOR b_qmvs[4];
83      int8_t dc_scaler;  //      VECTOR b_pmvs[1];
84    
85          if(quant > 0 && quant < 5) {          // bframe direct mode
         dc_scaler = 8;  
                 return dc_scaler;  
         }  
86    
87          if(quant < 25 && !lum) {  //      VECTOR directmv[4];
88          dc_scaler = (quant + 13) >> 1;  //      VECTOR deltamv;
89                  return dc_scaler;  
90          }          int mb_type;
91            int dbquant;
92    
93            // stuff for block based ME (needed for Qpel ME)
94            // backup of last integer ME vectors/sad
95    
96    //      VECTOR i_mv16;
97            VECTOR i_mvs[4];
98    
99            int32_t i_sad8[4];      // SAD values for inter4v-VECTORs
100    //      int32_t i_sad16;        // SAD value for inter-VECTOR
101    
         if(quant < 9) {  
         dc_scaler = quant << 1;  
                 return dc_scaler;  
         }  
102    
     if(quant < 25) {  
         dc_scaler = quant + 8;  
                 return dc_scaler;  
103          }          }
104    MACROBLOCK;
105    
106    static __inline int8_t
107    get_dc_scaler(uint32_t quant,
108                              uint32_t lum)
109    {
110            if (quant < 5)
111                    return 8;
112    
113            if (quant < 25 && !lum)
114                    return (quant + 13) / 2;
115    
116            if (quant < 9)
117                    return 2 * quant;
118    
119            if (quant < 25)
120                    return quant + 8;
121    
122          if(lum)          if(lum)
123                  dc_scaler = (quant << 1) - 16;                  return 2 * quant - 16;
124          else          else
125          dc_scaler = quant - 6;                  return quant - 6;
   
     return dc_scaler;  
126  }  }
127    
128    // useful macros
129    
130    #define MIN(X, Y) ((X)<(Y)?(X):(Y))
131    #define MAX(X, Y) ((X)>(Y)?(X):(Y))
132    #define ABS(X)    (((X)>0)?(X):-(X))
133    #define SIGN(X)   (((X)>0)?1:-1)
134    #define CLIP(X,AMIN,AMAX)   (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X))
135    #define DIV_DIV(a,b)    (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b))
136    
137    
138  #endif /* _GLOBAL_H_ */  #endif /* _GLOBAL_H_ */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.13.2.7

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