Parent Directory | Revision Log
Revision 1.13 - (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 : | edgomez | 1.10 | } |
36 : | h | 1.4 | 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 : | |||
47 : | chl | 1.9 | short int pred_values[6][MBPRED_SIZE]; |
48 : | int acpred_directions[6]; | ||
49 : | edgomez | 1.10 | |
50 : | Isibaar | 1.1 | int mode; |
51 : | edgomez | 1.10 | int quant; // absolute quant |
52 : | Isibaar | 1.1 | |
53 : | h | 1.2 | int field_dct; |
54 : | int field_pred; | ||
55 : | int field_for_top; | ||
56 : | int field_for_bot; | ||
57 : | |||
58 : | Isibaar | 1.1 | // encoder specific |
59 : | |||
60 : | chl | 1.9 | VECTOR mv16; |
61 : | Isibaar | 1.1 | VECTOR pmvs[4]; |
62 : | chl | 1.9 | |
63 : | edgomez | 1.10 | int32_t sad8[4]; // SAD values for inter4v-VECTORs |
64 : | int32_t sad16; // SAD value for inter-VECTOR | ||
65 : | chl | 1.9 | |
66 : | Isibaar | 1.1 | int dquant; |
67 : | int cbp; | ||
68 : | |||
69 : | suxen_drol | 1.5 | // bframe stuff |
70 : | |||
71 : | VECTOR b_mvs[4]; | ||
72 : | VECTOR b_pmvs[4]; | ||
73 : | chenm001 | 1.6 | |
74 : | chl | 1.13 | // bframe direct mode |
75 : | |||
76 : | VECTOR directmv[4]; | ||
77 : | VECTOR deltamv; | ||
78 : | |||
79 : | chenm001 | 1.6 | int mb_type; |
80 : | int dbquant; | ||
81 : | suxen_drol | 1.5 | |
82 : | chl | 1.11 | // stuff for block based ME (needed for Qpel ME) |
83 : | // backup of last integer ME vectors/sad | ||
84 : | |||
85 : | VECTOR i_mv16; | ||
86 : | chl | 1.12 | VECTOR i_mvs[4]; |
87 : | chl | 1.11 | |
88 : | chl | 1.12 | int32_t i_sad8[4]; // SAD values for inter4v-VECTORs |
89 : | int32_t i_sad16; // SAD value for inter-VECTOR | ||
90 : | chl | 1.11 | |
91 : | edgomez | 1.10 | } |
92 : | MACROBLOCK; | ||
93 : | Isibaar | 1.1 | |
94 : | edgomez | 1.10 | static __inline int8_t |
95 : | get_dc_scaler(uint32_t quant, | ||
96 : | uint32_t lum) | ||
97 : | Isibaar | 1.1 | { |
98 : | edgomez | 1.10 | if (quant < 5) |
99 : | return 8; | ||
100 : | Isibaar | 1.1 | |
101 : | edgomez | 1.10 | if (quant < 25 && !lum) |
102 : | return (quant + 13) / 2; | ||
103 : | Isibaar | 1.1 | |
104 : | edgomez | 1.10 | if (quant < 9) |
105 : | return 2 * quant; | ||
106 : | Isibaar | 1.1 | |
107 : | edgomez | 1.10 | if (quant < 25) |
108 : | return quant + 8; | ||
109 : | Isibaar | 1.1 | |
110 : | edgomez | 1.10 | if (lum) |
111 : | Isibaar | 1.7 | return 2 * quant - 16; |
112 : | Isibaar | 1.1 | else |
113 : | edgomez | 1.10 | return quant - 6; |
114 : | Isibaar | 1.1 | } |
115 : | suxen_drol | 1.5 | |
116 : | // useful macros | ||
117 : | |||
118 : | #define MIN(X, Y) ((X)<(Y)?(X):(Y)) | ||
119 : | #define MAX(X, Y) ((X)>(Y)?(X):(Y)) | ||
120 : | #define ABS(X) (((X)>0)?(X):-(X)) | ||
121 : | #define SIGN(X) (((X)>0)?1:-1) | ||
122 : | |||
123 : | Isibaar | 1.1 | |
124 : | edgomez | 1.10 | #endif /* _GLOBAL_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |