Parent Directory | Revision Log
Revision 1.15 - (view) (download)
1 : | edgomez | 1.14 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - Global structures, constants - | ||
5 : | * | ||
6 : | edgomez | 1.15 | * Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
7 : | edgomez | 1.14 | * |
8 : | * This program is an implementation of a part of one or more MPEG-4 | ||
9 : | * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
10 : | * to use this software module in hardware or software products are | ||
11 : | * advised that its use may infringe existing patents or copyrights, and | ||
12 : | * any such use would be at such party's own risk. The original | ||
13 : | * developer of this software module and his/her company, and subsequent | ||
14 : | * editors and their companies, will have no liability for use of this | ||
15 : | * software or modifications or derivatives thereof. | ||
16 : | * | ||
17 : | * This program is free software ; you can redistribute it and/or modify | ||
18 : | * it under the terms of the GNU General Public License as published by | ||
19 : | * the Free Software Foundation ; either version 2 of the License, or | ||
20 : | * (at your option) any later version. | ||
21 : | * | ||
22 : | * This program is distributed in the hope that it will be useful, | ||
23 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
24 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
25 : | * GNU General Public License for more details. | ||
26 : | * | ||
27 : | * You should have received a copy of the GNU General Public License | ||
28 : | * along with this program ; if not, write to the Free Software | ||
29 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
30 : | * | ||
31 : | edgomez | 1.15 | * $Id: global.h,v 1.14 2002/09/04 21:59:27 edgomez Exp $ |
32 : | edgomez | 1.14 | * |
33 : | ****************************************************************************/ | ||
34 : | |||
35 : | Isibaar | 1.1 | #ifndef _GLOBAL_H_ |
36 : | #define _GLOBAL_H_ | ||
37 : | |||
38 : | h | 1.4 | #include "xvid.h" |
39 : | Isibaar | 1.1 | #include "portab.h" |
40 : | |||
41 : | suxen_drol | 1.5 | /* --- macroblock modes --- */ |
42 : | Isibaar | 1.1 | |
43 : | #define MODE_INTER 0 | ||
44 : | #define MODE_INTER_Q 1 | ||
45 : | #define MODE_INTER4V 2 | ||
46 : | #define MODE_INTRA 3 | ||
47 : | #define MODE_INTRA_Q 4 | ||
48 : | #define MODE_STUFFING 7 | ||
49 : | #define MODE_NOT_CODED 16 | ||
50 : | |||
51 : | suxen_drol | 1.5 | /* --- bframe specific --- */ |
52 : | |||
53 : | #define MODE_DIRECT 0 | ||
54 : | #define MODE_INTERPOLATE 1 | ||
55 : | #define MODE_BACKWARD 2 | ||
56 : | #define MODE_FORWARD 3 | ||
57 : | chenm001 | 1.6 | #define MODE_DIRECT_NONE_MV 4 |
58 : | suxen_drol | 1.5 | |
59 : | |||
60 : | Isibaar | 1.1 | typedef struct |
61 : | { | ||
62 : | h | 1.4 | uint32_t bufa; |
63 : | uint32_t bufb; | ||
64 : | uint32_t buf; | ||
65 : | uint32_t pos; | ||
66 : | uint32_t *tail; | ||
67 : | uint32_t *start; | ||
68 : | uint32_t length; | ||
69 : | edgomez | 1.10 | } |
70 : | h | 1.4 | Bitstream; |
71 : | Isibaar | 1.1 | |
72 : | |||
73 : | #define MBPRED_SIZE 15 | ||
74 : | |||
75 : | |||
76 : | typedef struct | ||
77 : | { | ||
78 : | // decoder/encoder | ||
79 : | VECTOR mvs[4]; | ||
80 : | |||
81 : | chl | 1.9 | short int pred_values[6][MBPRED_SIZE]; |
82 : | int acpred_directions[6]; | ||
83 : | edgomez | 1.10 | |
84 : | Isibaar | 1.1 | int mode; |
85 : | edgomez | 1.10 | int quant; // absolute quant |
86 : | Isibaar | 1.1 | |
87 : | h | 1.2 | int field_dct; |
88 : | int field_pred; | ||
89 : | int field_for_top; | ||
90 : | int field_for_bot; | ||
91 : | |||
92 : | Isibaar | 1.1 | // encoder specific |
93 : | |||
94 : | chl | 1.9 | VECTOR mv16; |
95 : | Isibaar | 1.1 | VECTOR pmvs[4]; |
96 : | chl | 1.9 | |
97 : | edgomez | 1.10 | int32_t sad8[4]; // SAD values for inter4v-VECTORs |
98 : | int32_t sad16; // SAD value for inter-VECTOR | ||
99 : | chl | 1.9 | |
100 : | Isibaar | 1.1 | int dquant; |
101 : | int cbp; | ||
102 : | |||
103 : | suxen_drol | 1.5 | // bframe stuff |
104 : | |||
105 : | VECTOR b_mvs[4]; | ||
106 : | VECTOR b_pmvs[4]; | ||
107 : | chenm001 | 1.6 | |
108 : | chl | 1.13 | // bframe direct mode |
109 : | |||
110 : | VECTOR directmv[4]; | ||
111 : | VECTOR deltamv; | ||
112 : | |||
113 : | chenm001 | 1.6 | int mb_type; |
114 : | int dbquant; | ||
115 : | suxen_drol | 1.5 | |
116 : | chl | 1.11 | // stuff for block based ME (needed for Qpel ME) |
117 : | // backup of last integer ME vectors/sad | ||
118 : | |||
119 : | VECTOR i_mv16; | ||
120 : | chl | 1.12 | VECTOR i_mvs[4]; |
121 : | chl | 1.11 | |
122 : | chl | 1.12 | int32_t i_sad8[4]; // SAD values for inter4v-VECTORs |
123 : | int32_t i_sad16; // SAD value for inter-VECTOR | ||
124 : | chl | 1.11 | |
125 : | edgomez | 1.10 | } |
126 : | MACROBLOCK; | ||
127 : | Isibaar | 1.1 | |
128 : | edgomez | 1.10 | static __inline int8_t |
129 : | get_dc_scaler(uint32_t quant, | ||
130 : | uint32_t lum) | ||
131 : | Isibaar | 1.1 | { |
132 : | edgomez | 1.10 | if (quant < 5) |
133 : | return 8; | ||
134 : | Isibaar | 1.1 | |
135 : | edgomez | 1.10 | if (quant < 25 && !lum) |
136 : | return (quant + 13) / 2; | ||
137 : | Isibaar | 1.1 | |
138 : | edgomez | 1.10 | if (quant < 9) |
139 : | return 2 * quant; | ||
140 : | Isibaar | 1.1 | |
141 : | edgomez | 1.10 | if (quant < 25) |
142 : | return quant + 8; | ||
143 : | Isibaar | 1.1 | |
144 : | edgomez | 1.10 | if (lum) |
145 : | Isibaar | 1.7 | return 2 * quant - 16; |
146 : | Isibaar | 1.1 | else |
147 : | edgomez | 1.10 | return quant - 6; |
148 : | Isibaar | 1.1 | } |
149 : | suxen_drol | 1.5 | |
150 : | // useful macros | ||
151 : | |||
152 : | #define MIN(X, Y) ((X)<(Y)?(X):(Y)) | ||
153 : | #define MAX(X, Y) ((X)>(Y)?(X):(Y)) | ||
154 : | #define ABS(X) (((X)>0)?(X):-(X)) | ||
155 : | #define SIGN(X) (((X)>0)?1:-1) | ||
156 : | |||
157 : | Isibaar | 1.1 | |
158 : | edgomez | 1.14 | #endif /* _GLOBAL_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |