Parent Directory | Revision Log
Revision 412 - (view) (download)
1 : | edgomez | 199 | /***************************************************************************** |
2 : | edgomez | 411 | * |
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - XviD Main header file - | ||
5 : | * | ||
6 : | * This program is an implementation of a part of one or more MPEG-4 | ||
7 : | * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
8 : | * to use this software module in hardware or software products are | ||
9 : | * advised that its use may infringe existing patents or copyrights, and | ||
10 : | * any such use would be at such party's own risk. The original | ||
11 : | * developer of this software module and his/her company, and subsequent | ||
12 : | * editors and their companies, will have no liability for use of this | ||
13 : | * software or modifications or derivatives thereof. | ||
14 : | * | ||
15 : | * This program is free software ; you can redistribute it and/or modify | ||
16 : | * it under the terms of the GNU General Public License as published by | ||
17 : | * the Free Software Foundation ; either version 2 of the License, or | ||
18 : | * (at your option) any later version. | ||
19 : | * | ||
20 : | * This program is distributed in the hope that it will be useful, | ||
21 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
22 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 : | * GNU General Public License for more details. | ||
24 : | * | ||
25 : | * You should have received a copy of the GNU General Public License | ||
26 : | * along with this program ; if not, write to the Free Software | ||
27 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
28 : | * | ||
29 : | edgomez | 412 | * $Id: xvid.h,v 1.19 2002-09-04 22:26:04 edgomez Exp $ |
30 : | edgomez | 411 | * |
31 : | *****************************************************************************/ | ||
32 : | edgomez | 199 | |
33 : | #ifndef _XVID_H_ | ||
34 : | #define _XVID_H_ | ||
35 : | |||
36 : | #ifdef __cplusplus | ||
37 : | chl | 352 | extern "C" { |
38 : | edgomez | 199 | #endif |
39 : | |||
40 : | /***************************************************************************** | ||
41 : | * Global constants | ||
42 : | ****************************************************************************/ | ||
43 : | |||
44 : | /* API Version : 2.1 */ | ||
45 : | #define API_VERSION ((2 << 16) | (1)) | ||
46 : | |||
47 : | |||
48 : | /* Error codes */ | ||
49 : | edgomez | 412 | #define XVID_ERR_FAIL -1 |
50 : | #define XVID_ERR_OK 0 | ||
51 : | #define XVID_ERR_MEMORY 1 | ||
52 : | #define XVID_ERR_FORMAT 2 | ||
53 : | edgomez | 199 | |
54 : | |||
55 : | /* Colorspaces */ | ||
56 : | edgomez | 412 | #define XVID_CSP_RGB24 0 |
57 : | #define XVID_CSP_YV12 1 | ||
58 : | #define XVID_CSP_YUY2 2 | ||
59 : | #define XVID_CSP_UYVY 3 | ||
60 : | #define XVID_CSP_I420 4 | ||
61 : | #define XVID_CSP_RGB555 10 | ||
62 : | #define XVID_CSP_RGB565 11 | ||
63 : | #define XVID_CSP_USER 12 | ||
64 : | #define XVID_CSP_EXTERN 1004 // per slice rendering | ||
65 : | #define XVID_CSP_YVYU 1002 | ||
66 : | #define XVID_CSP_RGB32 1000 | ||
67 : | #define XVID_CSP_NULL 9999 | ||
68 : | edgomez | 199 | |
69 : | edgomez | 412 | #define XVID_CSP_VFLIP 0x80000000 // flip mask |
70 : | edgomez | 199 | |
71 : | |||
72 : | /***************************************************************************** | ||
73 : | albeu | 315 | * Initialization constants |
74 : | edgomez | 199 | ****************************************************************************/ |
75 : | |||
76 : | /* CPU flags for XVID_INIT_PARAM.cpu_flags */ | ||
77 : | |||
78 : | edgomez | 412 | /* x86 cpu flags */ |
79 : | #define XVID_CPU_MMX 0x00000001 | ||
80 : | #define XVID_CPU_MMXEXT 0x00000002 | ||
81 : | #define XVID_CPU_SSE 0x00000004 | ||
82 : | #define XVID_CPU_SSE2 0x00000008 | ||
83 : | #define XVID_CPU_3DNOW 0x00000010 | ||
84 : | #define XVID_CPU_3DNOWEXT 0x00000020 | ||
85 : | #define XVID_CPU_TSC 0x00000040 | ||
86 : | edgomez | 199 | |
87 : | edgomez | 412 | /* ia64 cpu flags */ |
88 : | #define XVID_CPU_IA64 0x00000080 | ||
89 : | Isibaar | 209 | |
90 : | edgomez | 412 | #define XVID_CPU_CHKONLY 0x40000000 /* check cpu only; dont init globals */ |
91 : | #define XVID_CPU_FORCE 0x80000000 | ||
92 : | edgomez | 199 | |
93 : | |||
94 : | Isibaar | 209 | /***************************************************************************** |
95 : | edgomez | 199 | * Initialization structures |
96 : | Isibaar | 209 | ****************************************************************************/ |
97 : | |||
98 : | typedef struct | ||
99 : | suxen_drol | 234 | { |
100 : | edgomez | 199 | int cpu_flags; |
101 : | int api_version; | ||
102 : | int core_build; | ||
103 : | } | ||
104 : | XVID_INIT_PARAM; | ||
105 : | |||
106 : | /***************************************************************************** | ||
107 : | * Initialization entry point | ||
108 : | ****************************************************************************/ | ||
109 : | |||
110 : | int xvid_init(void *handle, | ||
111 : | int opt, | ||
112 : | void *param1, | ||
113 : | void *param2); | ||
114 : | |||
115 : | |||
116 : | /***************************************************************************** | ||
117 : | * Decoder constants | ||
118 : | ****************************************************************************/ | ||
119 : | |||
120 : | /* Flags for XVID_DEC_FRAME.general */ | ||
121 : | #define XVID_QUICK_DECODE 0x00000010 | ||
122 : | |||
123 : | /***************************************************************************** | ||
124 : | * Decoder structures | ||
125 : | ****************************************************************************/ | ||
126 : | |||
127 : | typedef struct | ||
128 : | { | ||
129 : | int width; | ||
130 : | int height; | ||
131 : | void *handle; | ||
132 : | } | ||
133 : | XVID_DEC_PARAM; | ||
134 : | |||
135 : | |||
136 : | typedef struct | ||
137 : | { | ||
138 : | int general; | ||
139 : | void *bitstream; | ||
140 : | int length; | ||
141 : | |||
142 : | void *image; | ||
143 : | int stride; | ||
144 : | int colorspace; | ||
145 : | } | ||
146 : | XVID_DEC_FRAME; | ||
147 : | |||
148 : | |||
149 : | // This struct is used for per slice rendering | ||
150 : | typedef struct | ||
151 : | { | ||
152 : | void *y,*u,*v; | ||
153 : | int stride_y, stride_u,stride_v; | ||
154 : | } XVID_DEC_PICTURE; | ||
155 : | |||
156 : | albeu | 315 | |
157 : | /***************************************************************************** | ||
158 : | * Decoder entry point | ||
159 : | ****************************************************************************/ | ||
160 : | |||
161 : | /* decoder options */ | ||
162 : | #define XVID_DEC_DECODE 0 | ||
163 : | #define XVID_DEC_CREATE 1 | ||
164 : | edgomez | 199 | #define XVID_DEC_DESTROY 2 |
165 : | |||
166 : | int xvid_decore(void *handle, | ||
167 : | int opt, | ||
168 : | void *param1, | ||
169 : | void *param2); | ||
170 : | |||
171 : | |||
172 : | /***************************************************************************** | ||
173 : | * Encoder constants | ||
174 : | ****************************************************************************/ | ||
175 : | |||
176 : | edgomez | 412 | /* Flags for XVID_ENC_PARAM.global |
177 : | * ToDo : Remove this part when BFRAMES stuff will be out of XviD stable tree | ||
178 : | */ | ||
179 : | #define XVID_GLOBAL_PACKED 0x00000001 /* packed bitstream */ | ||
180 : | #define XVID_GLOBAL_DX50BVOP 0x00000002 /* dx50 bvop compatibility */ | ||
181 : | #define XVID_GLOBAL_DEBUG 0x00000004 /* print debug info on each frame */ | ||
182 : | edgomez | 199 | |
183 : | /* Flags for XVID_ENC_FRAME.general */ | ||
184 : | #define XVID_VALID_FLAGS 0x80000000 | ||
185 : | |||
186 : | #define XVID_CUSTOM_QMATRIX 0x00000004 /* use custom quant matrix */ | ||
187 : | suxen_drol | 234 | #define XVID_H263QUANT 0x00000010 |
188 : | #define XVID_MPEGQUANT 0x00000020 | ||
189 : | #define XVID_HALFPEL 0x00000040 /* use halfpel interpolation */ | ||
190 : | #define XVID_ADAPTIVEQUANT 0x00000080 | ||
191 : | #define XVID_LUMIMASKING 0x00000100 | ||
192 : | edgomez | 199 | #define XVID_LATEINTRA 0x00000200 |
193 : | |||
194 : | #define XVID_INTERLACING 0x00000400 /* enable interlaced encoding */ | ||
195 : | #define XVID_TOPFIELDFIRST 0x00000800 /* set top-field-first flag */ | ||
196 : | #define XVID_ALTERNATESCAN 0x00001000 /* set alternate vertical scan flag */ | ||
197 : | |||
198 : | #define XVID_HINTEDME_GET 0x00002000 /* receive mv hint data from core (1st pass) */ | ||
199 : | #define XVID_HINTEDME_SET 0x00004000 /* send mv hint data to core (2nd pass) */ | ||
200 : | |||
201 : | #define XVID_INTER4V 0x00008000 | ||
202 : | |||
203 : | #define XVID_ME_ZERO 0x00010000 | ||
204 : | #define XVID_ME_LOGARITHMIC 0x00020000 | ||
205 : | #define XVID_ME_FULLSEARCH 0x00040000 | ||
206 : | #define XVID_ME_PMVFAST 0x00080000 | ||
207 : | #define XVID_ME_EPZS 0x00100000 | ||
208 : | |||
209 : | |||
210 : | edgomez | 412 | #define XVID_GREYSCALE 0x01000000 /* enable greyscale only mode (even for */ |
211 : | #define XVID_GRAYSCALE XVID_GREYSCALE /* color input material chroma is ignored) */ | ||
212 : | edgomez | 199 | |
213 : | |||
214 : | /* Flags for XVID_ENC_FRAME.motion */ | ||
215 : | #define PMV_ADVANCEDDIAMOND8 0x00004000 | ||
216 : | #define PMV_ADVANCEDDIAMOND16 0x00008000 | ||
217 : | chl | 352 | |
218 : | #define PMV_HALFPELDIAMOND16 0x00010000 | ||
219 : | #define PMV_HALFPELREFINE16 0x00020000 | ||
220 : | #define PMV_EXTSEARCH16 0x00040000 /* extend PMV by more searches */ | ||
221 : | edgomez | 199 | #define PMV_EARLYSTOP16 0x00080000 |
222 : | #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */ | ||
223 : | #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */ | ||
224 : | #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */ | ||
225 : | #define PMV_USESQUARES16 0x00800000 | ||
226 : | |||
227 : | #define PMV_HALFPELDIAMOND8 0x01000000 | ||
228 : | #define PMV_HALFPELREFINE8 0x02000000 | ||
229 : | #define PMV_EXTSEARCH8 0x04000000 /* extend PMV by more searches */ | ||
230 : | #define PMV_EARLYSTOP8 0x08000000 | ||
231 : | #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */ | ||
232 : | #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */ | ||
233 : | #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */ | ||
234 : | #define PMV_USESQUARES8 0x80000000 | ||
235 : | |||
236 : | |||
237 : | /***************************************************************************** | ||
238 : | * Encoder structures | ||
239 : | ****************************************************************************/ | ||
240 : | |||
241 : | typedef struct | ||
242 : | { | ||
243 : | edgomez | 412 | int width; |
244 : | int height; | ||
245 : | int fincr; | ||
246 : | int fbase; /* frame increment, fbase. each frame = "fincr/fbase" seconds */ | ||
247 : | int rc_bitrate; /* the bitrate of the target encoded stream, in bits/second */ | ||
248 : | int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */ | ||
249 : | int rc_averaging_period; /* as above */ | ||
250 : | int rc_buffer; /* as above */ | ||
251 : | int max_quantizer; /* the upper limit of the quantizer */ | ||
252 : | int min_quantizer; /* the lower limit of the quantizer */ | ||
253 : | int max_key_interval; /* the maximum interval between key frames */ | ||
254 : | edgomez | 199 | #ifdef _SMP |
255 : | edgomez | 412 | int num_threads; /* number of threads */ |
256 : | edgomez | 199 | #endif |
257 : | edgomez | 412 | void *handle; /* [out] encoder instance handle */ |
258 : | edgomez | 199 | } |
259 : | XVID_ENC_PARAM; | ||
260 : | |||
261 : | typedef struct | ||
262 : | { | ||
263 : | int x; | ||
264 : | suxen_drol | 324 | int y; |
265 : | edgomez | 199 | } |
266 : | VECTOR; | ||
267 : | |||
268 : | typedef struct | ||
269 : | { | ||
270 : | int mode; /* macroblock mode */ | ||
271 : | VECTOR mvs[4]; | ||
272 : | } | ||
273 : | MVBLOCKHINT; | ||
274 : | |||
275 : | typedef struct | ||
276 : | { | ||
277 : | int intra; /* frame intra choice */ | ||
278 : | int fcode; /* frame fcode */ | ||
279 : | MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */ | ||
280 : | } | ||
281 : | MVFRAMEHINT; | ||
282 : | |||
283 : | typedef struct | ||
284 : | { | ||
285 : | int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */ | ||
286 : | |||
287 : | MVFRAMEHINT mvhint; | ||
288 : | void *hintstream; /* compressed hint buffer */ | ||
289 : | int hintlength; /* length of buffer (bytes) */ | ||
290 : | } | ||
291 : | HINTINFO; | ||
292 : | |||
293 : | typedef struct | ||
294 : | { | ||
295 : | int general; /* [in] general options */ | ||
296 : | int motion; /* [in] ME options */ | ||
297 : | void *bitstream; /* [in] bitstream ptr */ | ||
298 : | int length; /* [out] bitstream length (bytes) */ | ||
299 : | |||
300 : | void *image; /* [in] image ptr */ | ||
301 : | int colorspace; /* [in] source colorspace */ | ||
302 : | |||
303 : | unsigned char *quant_intra_matrix; // [in] custom intra qmatrix */ | ||
304 : | unsigned char *quant_inter_matrix; // [in] custom inter qmatrix */ | ||
305 : | int quant; /* [in] frame quantizer (vbr) */ | ||
306 : | int intra; /* [in] force intra frame (vbr only) | ||
307 : | * [out] intra state | ||
308 : | */ | ||
309 : | HINTINFO hint; /* [in/out] mv hint information */ | ||
310 : | |||
311 : | } | ||
312 : | XVID_ENC_FRAME; | ||
313 : | |||
314 : | |||
315 : | typedef struct | ||
316 : | { | ||
317 : | int quant; /* [out] frame quantizer */ | ||
318 : | int hlength; /* [out] header length (bytes) */ | ||
319 : | int kblks, mblks, ublks; /* [out] */ | ||
320 : | |||
321 : | } | ||
322 : | XVID_ENC_STATS; | ||
323 : | |||
324 : | |||
325 : | /***************************************************************************** | ||
326 : | * Encoder entry point | ||
327 : | ****************************************************************************/ | ||
328 : | |||
329 : | /* Encoder options */ | ||
330 : | #define XVID_ENC_ENCODE 0 | ||
331 : | #define XVID_ENC_CREATE 1 | ||
332 : | #define XVID_ENC_DESTROY 2 | ||
333 : | |||
334 : | int xvid_encore(void *handle, | ||
335 : | int opt, | ||
336 : | void *param1, | ||
337 : | void *param2); | ||
338 : | |||
339 : | |||
340 : | #ifdef __cplusplus | ||
341 : | } | ||
342 : | #endif | ||
343 : | |||
344 : | #endif |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |