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

Diff of /trunk/xvidcore/src/global.h

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

revision 3, Fri Mar 8 02:46:11 2002 UTC revision 195, Wed Jun 12 20:38:41 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
# Line 13  Line 14 
14  #define MODE_STUFFING   7  #define MODE_STUFFING   7
15  #define MODE_NOT_CODED  16  #define MODE_NOT_CODED  16
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    
25    
26  typedef struct  typedef struct
27  {  {
28          int x;          uint32_t bufa;
29          int y;          uint32_t bufb;
30  } VECTOR;          uint32_t buf;
31            uint32_t pos;
32            uint32_t *tail;
33            uint32_t *start;
34            uint32_t length;
35    }
36    Bitstream;
37    
38    
39  #define MBPRED_SIZE  15  #define MBPRED_SIZE  15
# Line 27  Line 43 
43  {  {
44          // decoder/encoder          // decoder/encoder
45          VECTOR mvs[4];          VECTOR mvs[4];
         uint32_t sad8[4];               // SAD values for inter4v-VECTORs  
         uint32_t sad16;                 // SAD value for inter-VECTOR  
46    
47      short int pred_values[6][MBPRED_SIZE];      short int pred_values[6][MBPRED_SIZE];
48      int acpred_directions[6];      int acpred_directions[6];
# Line 36  Line 50 
50          int mode;          int mode;
51          int quant;              // absolute quant          int quant;              // absolute quant
52    
53            int field_dct;
54            int field_pred;
55            int field_for_top;
56            int field_for_bot;
57    
58          // encoder specific          // encoder specific
59    
60            VECTOR mv16;
61          VECTOR pmvs[4];          VECTOR pmvs[4];
62    
63            int32_t sad8[4];                        // SAD values for inter4v-VECTORs
64            int32_t sad16;                          // SAD value for inter-VECTOR
65    
66          int dquant;          int dquant;
67          int cbp;          int cbp;
68    
69  } MACROBLOCK;          // bframe stuff
70    
71  static __inline int8_t get_dc_scaler(int32_t quant, uint32_t lum)          VECTOR b_mvs[4];
72  {          VECTOR b_pmvs[4];
     int8_t dc_scaler;  
73    
74          if(quant > 0 && quant < 5) {          int mb_type;
75          dc_scaler = 8;          int dbquant;
                 return dc_scaler;  
         }  
76    
         if(quant < 25 && !lum) {  
         dc_scaler = (quant + 13) >> 1;  
                 return dc_scaler;  
77          }          }
78    MACROBLOCK;
79    
80          if(quant < 9) {  static __inline int8_t
81          dc_scaler = quant << 1;  get_dc_scaler(uint32_t quant,
82                  return dc_scaler;                            uint32_t lum)
83          }  {
84            if (quant < 5)
85                    return 8;
86    
87      if(quant < 25) {          if (quant < 25 && !lum)
88          dc_scaler = quant + 8;                  return (quant + 13) / 2;
89                  return dc_scaler;  
90          }          if (quant < 9)
91                    return 2 * quant;
92    
93            if (quant < 25)
94                    return quant + 8;
95    
96          if(lum)          if(lum)
97                  dc_scaler = (quant << 1) - 16;                  return 2 * quant - 16;
98          else          else
99          dc_scaler = quant - 6;                  return quant - 6;
   
     return dc_scaler;  
100  }  }
101    
102    // useful macros
103    
104    #define MIN(X, Y) ((X)<(Y)?(X):(Y))
105    #define MAX(X, Y) ((X)>(Y)?(X):(Y))
106    #define ABS(X)    (((X)>0)?(X):-(X))
107    #define SIGN(X)   (((X)>0)?1:-1)
108    
109    
110  #endif /* _GLOBAL_H_ */  #endif /* _GLOBAL_H_ */

Legend:
Removed from v.3  
changed lines
  Added in v.195

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