Parent Directory
|
Revision Log
Revision 1.6 - (view) (download)
1 : | Isibaar | 1.1 | #ifndef _GLOBAL_H_ |
2 : | #define _GLOBAL_H_ | ||
3 : | |||
4 : | h | 1.4 | #include "xvid.h" |
5 : | Isibaar | 1.1 | #include "portab.h" |
6 : | |||
7 : | suxen_drol | 1.5 | /* --- macroblock modes --- */ |
8 : | Isibaar | 1.1 | |
9 : | #define MODE_INTER 0 | ||
10 : | #define MODE_INTER_Q 1 | ||
11 : | #define MODE_INTER4V 2 | ||
12 : | #define MODE_INTRA 3 | ||
13 : | #define MODE_INTRA_Q 4 | ||
14 : | #define MODE_STUFFING 7 | ||
15 : | #define MODE_NOT_CODED 16 | ||
16 : | |||
17 : | suxen_drol | 1.5 | /* --- bframe specific --- */ |
18 : | |||
19 : | #define MODE_DIRECT 0 | ||
20 : | #define MODE_INTERPOLATE 1 | ||
21 : | #define MODE_BACKWARD 2 | ||
22 : | #define MODE_FORWARD 3 | ||
23 : | chenm001 | 1.6 | #define MODE_DIRECT_NONE_MV 4 |
24 : | suxen_drol | 1.5 | |
25 : | |||
26 : | Isibaar | 1.1 | typedef struct |
27 : | { | ||
28 : | h | 1.4 | uint32_t bufa; |
29 : | uint32_t bufb; | ||
30 : | uint32_t buf; | ||
31 : | uint32_t pos; | ||
32 : | uint32_t *tail; | ||
33 : | uint32_t *start; | ||
34 : | uint32_t length; | ||
35 : | } | ||
36 : | Bitstream; | ||
37 : | Isibaar | 1.1 | |
38 : | |||
39 : | #define MBPRED_SIZE 15 | ||
40 : | |||
41 : | |||
42 : | typedef struct | ||
43 : | { | ||
44 : | // decoder/encoder | ||
45 : | VECTOR mvs[4]; | ||
46 : | uint32_t sad8[4]; // SAD values for inter4v-VECTORs | ||
47 : | uint32_t sad16; // SAD value for inter-VECTOR | ||
48 : | |||
49 : | short int pred_values[6][MBPRED_SIZE]; | ||
50 : | int acpred_directions[6]; | ||
51 : | |||
52 : | int mode; | ||
53 : | int quant; // absolute quant | ||
54 : | |||
55 : | h | 1.2 | int field_dct; |
56 : | int field_pred; | ||
57 : | int field_for_top; | ||
58 : | int field_for_bot; | ||
59 : | |||
60 : | Isibaar | 1.1 | // encoder specific |
61 : | |||
62 : | VECTOR pmvs[4]; | ||
63 : | int dquant; | ||
64 : | int cbp; | ||
65 : | |||
66 : | suxen_drol | 1.5 | // bframe stuff |
67 : | |||
68 : | VECTOR b_mvs[4]; | ||
69 : | VECTOR b_pmvs[4]; | ||
70 : | chenm001 | 1.6 | |
71 : | int mb_type; | ||
72 : | int dbquant; | ||
73 : | suxen_drol | 1.5 | |
74 : | Isibaar | 1.1 | } MACROBLOCK; |
75 : | |||
76 : | static __inline int8_t get_dc_scaler(int32_t quant, uint32_t lum) | ||
77 : | { | ||
78 : | int8_t dc_scaler; | ||
79 : | |||
80 : | if(quant > 0 && quant < 5) { | ||
81 : | dc_scaler = 8; | ||
82 : | return dc_scaler; | ||
83 : | } | ||
84 : | |||
85 : | if(quant < 25 && !lum) { | ||
86 : | dc_scaler = (quant + 13) >> 1; | ||
87 : | return dc_scaler; | ||
88 : | } | ||
89 : | |||
90 : | if(quant < 9) { | ||
91 : | dc_scaler = quant << 1; | ||
92 : | return dc_scaler; | ||
93 : | } | ||
94 : | |||
95 : | if(quant < 25) { | ||
96 : | dc_scaler = quant + 8; | ||
97 : | return dc_scaler; | ||
98 : | } | ||
99 : | |||
100 : | if(lum) | ||
101 : | dc_scaler = (quant << 1) - 16; | ||
102 : | else | ||
103 : | dc_scaler = quant - 6; | ||
104 : | |||
105 : | return dc_scaler; | ||
106 : | } | ||
107 : | suxen_drol | 1.5 | |
108 : | |||
109 : | // useful macros | ||
110 : | |||
111 : | #define MIN(X, Y) ((X)<(Y)?(X):(Y)) | ||
112 : | #define MAX(X, Y) ((X)>(Y)?(X):(Y)) | ||
113 : | #define ABS(X) (((X)>0)?(X):-(X)) | ||
114 : | #define SIGN(X) (((X)>0)?1:-1) | ||
115 : | |||
116 : | Isibaar | 1.1 | |
117 : | edgomez | 1.3 | #endif /* _GLOBAL_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |