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