Parent Directory
|
Revision Log
Revision 324 -
(view)
(download)
Original Path: trunk/xvidcore/src/xvid.h
1 : | edgomez | 199 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - XviD Main header file - | ||
5 : | * | ||
6 : | * This program is free software ; you can redistribute it and/or modify | ||
7 : | * it under the terms of the GNU General Public License as published by | ||
8 : | * the Free Software Foundation ; either version 2 of the License, or | ||
9 : | * (at your option) any later version. | ||
10 : | * | ||
11 : | * This program is distributed in the hope that it will be useful, | ||
12 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
13 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 : | * GNU General Public License for more details. | ||
15 : | * | ||
16 : | * You should have received a copy of the GNU General Public License | ||
17 : | * along with this program ; if not, write to the Free Software | ||
18 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 : | * | ||
20 : | *****************************************************************************/ | ||
21 : | /***************************************************************************** | ||
22 : | * | ||
23 : | * History | ||
24 : | * | ||
25 : | * - 2002/06/13 Added legal header, ANSI C comment style (only for this header | ||
26 : | * as it can be included in a ANSI C project). | ||
27 : | * | ||
28 : | * ToDo ? : when BFRAMES is defined, the API_VERSION should not | ||
29 : | * be the same (3.0 ?) | ||
30 : | * | ||
31 : | suxen_drol | 324 | * $Id: xvid.h,v 1.16 2002-07-21 03:41:44 suxen_drol Exp $ |
32 : | edgomez | 199 | * |
33 : | *****************************************************************************/ | ||
34 : | |||
35 : | |||
36 : | #ifndef _XVID_H_ | ||
37 : | #define _XVID_H_ | ||
38 : | |||
39 : | #ifdef __cplusplus | ||
40 : | suxen_drol | 324 | * $Id: xvid.h,v 1.16 2002-07-21 03:41:44 suxen_drol Exp $ |
41 : | edgomez | 199 | #endif |
42 : | |||
43 : | /***************************************************************************** | ||
44 : | * Global constants | ||
45 : | ****************************************************************************/ | ||
46 : | |||
47 : | /* API Version : 2.1 */ | ||
48 : | #define API_VERSION ((2 << 16) | (1)) | ||
49 : | |||
50 : | |||
51 : | /* Error codes */ | ||
52 : | #define XVID_ERR_FAIL -1 | ||
53 : | #define XVID_ERR_OK 0 | ||
54 : | #define XVID_ERR_MEMORY 1 | ||
55 : | #define XVID_ERR_FORMAT 2 | ||
56 : | |||
57 : | |||
58 : | /* Colorspaces */ | ||
59 : | #define XVID_CSP_RGB24 0 | ||
60 : | #define XVID_CSP_YV12 1 | ||
61 : | #define XVID_CSP_YUY2 2 | ||
62 : | #define XVID_CSP_UYVY 3 | ||
63 : | #define XVID_CSP_I420 4 | ||
64 : | #define XVID_CSP_RGB555 10 | ||
65 : | #define XVID_CSP_RGB565 11 | ||
66 : | #define XVID_CSP_USER 12 | ||
67 : | #define XVID_CSP_EXTERN 1004 // per slice rendering | ||
68 : | #define XVID_CSP_YVYU 1002 | ||
69 : | #define XVID_CSP_RGB32 1000 | ||
70 : | #define XVID_CSP_NULL 9999 | ||
71 : | |||
72 : | #define XVID_CSP_VFLIP 0x80000000 // flip mask | ||
73 : | |||
74 : | |||
75 : | /***************************************************************************** | ||
76 : | albeu | 315 | * Initialization constants |
77 : | edgomez | 199 | ****************************************************************************/ |
78 : | |||
79 : | /* CPU flags for XVID_INIT_PARAM.cpu_flags */ | ||
80 : | |||
81 : | #define XVID_CPU_MMX 0x00000001 | ||
82 : | #define XVID_CPU_MMXEXT 0x00000002 | ||
83 : | #define XVID_CPU_SSE 0x00000004 | ||
84 : | #define XVID_CPU_SSE2 0x00000008 | ||
85 : | #define XVID_CPU_3DNOW 0x00000010 | ||
86 : | #define XVID_CPU_3DNOWEXT 0x00000020 | ||
87 : | |||
88 : | #define XVID_CPU_TSC 0x00000040 | ||
89 : | Isibaar | 209 | |
90 : | edgomez | 199 | #define XVID_CPU_IA64 0x00000080 |
91 : | |||
92 : | #define XVID_CPU_CHKONLY 0x40000000 /* check cpu only; dont init globals */ | ||
93 : | #define XVID_CPU_FORCE 0x80000000 | ||
94 : | |||
95 : | |||
96 : | Isibaar | 209 | /***************************************************************************** |
97 : | edgomez | 199 | * Initialization structures |
98 : | Isibaar | 209 | ****************************************************************************/ |
99 : | |||
100 : | typedef struct | ||
101 : | suxen_drol | 234 | { |
102 : | edgomez | 199 | int cpu_flags; |
103 : | int api_version; | ||
104 : | int core_build; | ||
105 : | } | ||
106 : | XVID_INIT_PARAM; | ||
107 : | |||
108 : | /***************************************************************************** | ||
109 : | * Initialization entry point | ||
110 : | ****************************************************************************/ | ||
111 : | |||
112 : | int xvid_init(void *handle, | ||
113 : | int opt, | ||
114 : | void *param1, | ||
115 : | void *param2); | ||
116 : | |||
117 : | |||
118 : | /***************************************************************************** | ||
119 : | * Decoder constants | ||
120 : | ****************************************************************************/ | ||
121 : | |||
122 : | /* Flags for XVID_DEC_FRAME.general */ | ||
123 : | #define XVID_QUICK_DECODE 0x00000010 | ||
124 : | |||
125 : | /***************************************************************************** | ||
126 : | * Decoder structures | ||
127 : | ****************************************************************************/ | ||
128 : | |||
129 : | typedef struct | ||
130 : | { | ||
131 : | int width; | ||
132 : | int height; | ||
133 : | void *handle; | ||
134 : | } | ||
135 : | XVID_DEC_PARAM; | ||
136 : | |||
137 : | |||
138 : | typedef struct | ||
139 : | { | ||
140 : | int general; | ||
141 : | void *bitstream; | ||
142 : | int length; | ||
143 : | |||
144 : | void *image; | ||
145 : | int stride; | ||
146 : | int colorspace; | ||
147 : | } | ||
148 : | XVID_DEC_FRAME; | ||
149 : | |||
150 : | |||
151 : | // This struct is used for per slice rendering | ||
152 : | typedef struct | ||
153 : | { | ||
154 : | void *y,*u,*v; | ||
155 : | int stride_y, stride_u,stride_v; | ||
156 : | } XVID_DEC_PICTURE; | ||
157 : | |||
158 : | albeu | 315 | |
159 : | /***************************************************************************** | ||
160 : | * Decoder entry point | ||
161 : | ****************************************************************************/ | ||
162 : | |||
163 : | /* decoder options */ | ||
164 : | #define XVID_DEC_DECODE 0 | ||
165 : | #define XVID_DEC_CREATE 1 | ||
166 : | edgomez | 199 | #define XVID_DEC_DESTROY 2 |
167 : | |||
168 : | int xvid_decore(void *handle, | ||
169 : | int opt, | ||
170 : | void *param1, | ||
171 : | void *param2); | ||
172 : | |||
173 : | |||
174 : | /***************************************************************************** | ||
175 : | * Encoder constants | ||
176 : | ****************************************************************************/ | ||
177 : | |||
178 : | /* Flags for XVID_ENC_PARAM.global */ | ||
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 : | |||
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 : | #define XVID_GREYSCALE 0x01000000 /* enable greyscale only mode (even for */ | ||
211 : | #define XVID_GRAYSCALE 0x01000000 /* color input material chroma is ignored) */ | ||
212 : | |||
213 : | |||
214 : | /* Flags for XVID_ENC_FRAME.motion */ | ||
215 : | #define PMV_ADVANCEDDIAMOND8 0x00004000 | ||
216 : | #define PMV_ADVANCEDDIAMOND16 0x00008000 | ||
217 : | #define PMV_EARLYSTOP16 0x00080000 | ||
218 : | #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */ | ||
219 : | #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */ | ||
220 : | #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */ | ||
221 : | #define PMV_USESQUARES16 0x00800000 | ||
222 : | |||
223 : | #define PMV_HALFPELDIAMOND8 0x01000000 | ||
224 : | #define PMV_HALFPELREFINE8 0x02000000 | ||
225 : | #define PMV_EXTSEARCH8 0x04000000 /* extend PMV by more searches */ | ||
226 : | #define PMV_EARLYSTOP8 0x08000000 | ||
227 : | #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */ | ||
228 : | #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */ | ||
229 : | #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */ | ||
230 : | #define PMV_USESQUARES8 0x80000000 | ||
231 : | |||
232 : | |||
233 : | /***************************************************************************** | ||
234 : | * Encoder structures | ||
235 : | ****************************************************************************/ | ||
236 : | |||
237 : | typedef struct | ||
238 : | { | ||
239 : | int width, height; | ||
240 : | int fincr, fbase; /* frame increment, fbase. each frame = "fincr/fbase" seconds */ | ||
241 : | int rc_bitrate; /* the bitrate of the target encoded stream, in bits/second */ | ||
242 : | int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */ | ||
243 : | int rc_averaging_period; /* as above */ | ||
244 : | int rc_buffer; /* as above */ | ||
245 : | int max_quantizer; /* the upper limit of the quantizer */ | ||
246 : | int min_quantizer; /* the lower limit of the quantizer */ | ||
247 : | int max_key_interval; /* the maximum interval between key frames */ | ||
248 : | #ifdef _SMP | ||
249 : | int num_threads; /* number of threads */ | ||
250 : | #endif | ||
251 : | #ifdef BFRAMES | ||
252 : | int global; /* global/debug options */ | ||
253 : | int max_bframes; /* max sequential bframes (0=disable bframes) */ | ||
254 : | int bquant_ratio; /* bframe quantizer multipier (percentage). | ||
255 : | * used only when bquant < 1 | ||
256 : | * eg. 200 = x2 multiplier | ||
257 : | suxen_drol | 295 | * quant = ((past_quant + future_quant) * bquant_ratio)/200 |
258 : | */ | ||
259 : | int frame_drop_ratio; /* frame dropping: 0=drop none... 100=drop all */ | ||
260 : | edgomez | 199 | #endif |
261 : | suxen_drol | 234 | void *handle; /* [out] encoder instance handle */ |
262 : | edgomez | 199 | } |
263 : | XVID_ENC_PARAM; | ||
264 : | |||
265 : | typedef struct | ||
266 : | { | ||
267 : | int x; | ||
268 : | suxen_drol | 324 | int y; |
269 : | edgomez | 199 | } |
270 : | VECTOR; | ||
271 : | |||
272 : | typedef struct | ||
273 : | { | ||
274 : | int mode; /* macroblock mode */ | ||
275 : | VECTOR mvs[4]; | ||
276 : | } | ||
277 : | MVBLOCKHINT; | ||
278 : | |||
279 : | typedef struct | ||
280 : | { | ||
281 : | int intra; /* frame intra choice */ | ||
282 : | int fcode; /* frame fcode */ | ||
283 : | MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */ | ||
284 : | } | ||
285 : | MVFRAMEHINT; | ||
286 : | |||
287 : | typedef struct | ||
288 : | { | ||
289 : | int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */ | ||
290 : | |||
291 : | MVFRAMEHINT mvhint; | ||
292 : | void *hintstream; /* compressed hint buffer */ | ||
293 : | int hintlength; /* length of buffer (bytes) */ | ||
294 : | } | ||
295 : | HINTINFO; | ||
296 : | |||
297 : | typedef struct | ||
298 : | { | ||
299 : | int general; /* [in] general options */ | ||
300 : | int motion; /* [in] ME options */ | ||
301 : | void *bitstream; /* [in] bitstream ptr */ | ||
302 : | int length; /* [out] bitstream length (bytes) */ | ||
303 : | |||
304 : | void *image; /* [in] image ptr */ | ||
305 : | int colorspace; /* [in] source colorspace */ | ||
306 : | |||
307 : | unsigned char *quant_intra_matrix; // [in] custom intra qmatrix */ | ||
308 : | unsigned char *quant_inter_matrix; // [in] custom inter qmatrix */ | ||
309 : | int quant; /* [in] frame quantizer (vbr) */ | ||
310 : | int intra; /* [in] force intra frame (vbr only) | ||
311 : | * [out] intra state | ||
312 : | */ | ||
313 : | HINTINFO hint; /* [in/out] mv hint information */ | ||
314 : | |||
315 : | #ifdef BFRAMES | ||
316 : | int bquant; /* [in] bframe quantizer */ | ||
317 : | #endif | ||
318 : | |||
319 : | } | ||
320 : | XVID_ENC_FRAME; | ||
321 : | |||
322 : | |||
323 : | typedef struct | ||
324 : | { | ||
325 : | int quant; /* [out] frame quantizer */ | ||
326 : | int hlength; /* [out] header length (bytes) */ | ||
327 : | int kblks, mblks, ublks; /* [out] */ | ||
328 : | |||
329 : | } | ||
330 : | XVID_ENC_STATS; | ||
331 : | |||
332 : | |||
333 : | /***************************************************************************** | ||
334 : | * Encoder entry point | ||
335 : | ****************************************************************************/ | ||
336 : | |||
337 : | /* Encoder options */ | ||
338 : | #define XVID_ENC_ENCODE 0 | ||
339 : | #define XVID_ENC_CREATE 1 | ||
340 : | #define XVID_ENC_DESTROY 2 | ||
341 : | |||
342 : | int xvid_encore(void *handle, | ||
343 : | int opt, | ||
344 : | void *param1, | ||
345 : | void *param2); | ||
346 : | |||
347 : | |||
348 : | #ifdef __cplusplus | ||
349 : | } | ||
350 : | #endif | ||
351 : | |||
352 : | #endif |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |