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

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13.2.5

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