Parent Directory | Revision Log
Revision 209 -
(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 : | Isibaar | 209 | * $Id: xvid.h,v 1.11 2002-06-14 13:27:47 Isibaar Exp $ |
32 : | edgomez | 199 | * |
33 : | *****************************************************************************/ | ||
34 : | |||
35 : | |||
36 : | #ifndef _XVID_H_ | ||
37 : | #define _XVID_H_ | ||
38 : | |||
39 : | #ifdef __cplusplus | ||
40 : | Isibaar | 209 | * $Id: xvid.h,v 1.11 2002-06-14 13:27:47 Isibaar 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 : | ****************************************************************************/ | ||
77 : | |||
78 : | /* CPU flags for XVID_INIT_PARAM.cpu_flags */ | ||
79 : | |||
80 : | #define XVID_CPU_MMX 0x00000001 | ||
81 : | #define XVID_CPU_MMXEXT 0x00000002 | ||
82 : | #define XVID_CPU_SSE 0x00000004 | ||
83 : | #define XVID_CPU_SSE2 0x00000008 | ||
84 : | #define XVID_CPU_3DNOW 0x00000010 | ||
85 : | #define XVID_CPU_3DNOWEXT 0x00000020 | ||
86 : | |||
87 : | #define XVID_CPU_TSC 0x00000040 | ||
88 : | Isibaar | 209 | |
89 : | edgomez | 199 | #define XVID_CPU_IA64 0x00000080 |
90 : | |||
91 : | #define XVID_CPU_CHKONLY 0x40000000 /* check cpu only; dont init globals */ | ||
92 : | #define XVID_CPU_FORCE 0x80000000 | ||
93 : | |||
94 : | |||
95 : | Isibaar | 209 | /***************************************************************************** |
96 : | edgomez | 199 | * Initialization structures |
97 : | Isibaar | 209 | ****************************************************************************/ |
98 : | |||
99 : | typedef struct | ||
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 : | #define XVID_DEC_DESTROY 2 | ||
157 : | |||
158 : | int xvid_decore(void *handle, | ||
159 : | int opt, | ||
160 : | void *param1, | ||
161 : | void *param2); | ||
162 : | |||
163 : | |||
164 : | /***************************************************************************** | ||
165 : | * Encoder constants | ||
166 : | ****************************************************************************/ | ||
167 : | |||
168 : | /* Flags for XVID_ENC_PARAM.global */ | ||
169 : | #define XVID_GLOBAL_PACKED 0x00000001 /* packed bitstream */ | ||
170 : | #define XVID_GLOBAL_DX50BVOP 0x00000002 /* dx50 bvop compatibility */ | ||
171 : | #define XVID_GLOBAL_DEBUG 0x00000004 /* print debug info on each frame */ | ||
172 : | |||
173 : | /* Flags for XVID_ENC_FRAME.general */ | ||
174 : | #define XVID_VALID_FLAGS 0x80000000 | ||
175 : | |||
176 : | #define XVID_CUSTOM_QMATRIX 0x00000004 /* use custom quant matrix */ | ||
177 : | #define XVID_LATEINTRA 0x00000200 | ||
178 : | |||
179 : | #define XVID_INTERLACING 0x00000400 /* enable interlaced encoding */ | ||
180 : | #define XVID_TOPFIELDFIRST 0x00000800 /* set top-field-first flag */ | ||
181 : | #define XVID_ALTERNATESCAN 0x00001000 /* set alternate vertical scan flag */ | ||
182 : | |||
183 : | #define XVID_HINTEDME_GET 0x00002000 /* receive mv hint data from core (1st pass) */ | ||
184 : | #define XVID_HINTEDME_SET 0x00004000 /* send mv hint data to core (2nd pass) */ | ||
185 : | |||
186 : | #define XVID_INTER4V 0x00008000 | ||
187 : | |||
188 : | #define XVID_ME_ZERO 0x00010000 | ||
189 : | #define XVID_ME_LOGARITHMIC 0x00020000 | ||
190 : | #define XVID_ME_FULLSEARCH 0x00040000 | ||
191 : | #define XVID_ME_PMVFAST 0x00080000 | ||
192 : | #define XVID_ME_EPZS 0x00100000 | ||
193 : | |||
194 : | |||
195 : | #define XVID_GREYSCALE 0x01000000 /* enable greyscale only mode (even for */ | ||
196 : | #define XVID_GRAYSCALE 0x01000000 /* color input material chroma is ignored) */ | ||
197 : | |||
198 : | |||
199 : | /* Flags for XVID_ENC_FRAME.motion */ | ||
200 : | #define PMV_ADVANCEDDIAMOND8 0x00004000 | ||
201 : | #define PMV_ADVANCEDDIAMOND16 0x00008000 | ||
202 : | #define PMV_EARLYSTOP16 0x00080000 | ||
203 : | #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */ | ||
204 : | #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */ | ||
205 : | #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */ | ||
206 : | #define PMV_USESQUARES16 0x00800000 | ||
207 : | |||
208 : | #define PMV_HALFPELDIAMOND8 0x01000000 | ||
209 : | #define PMV_HALFPELREFINE8 0x02000000 | ||
210 : | #define PMV_EXTSEARCH8 0x04000000 /* extend PMV by more searches */ | ||
211 : | #define PMV_EARLYSTOP8 0x08000000 | ||
212 : | #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */ | ||
213 : | #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */ | ||
214 : | #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */ | ||
215 : | #define PMV_USESQUARES8 0x80000000 | ||
216 : | |||
217 : | |||
218 : | /***************************************************************************** | ||
219 : | * Encoder structures | ||
220 : | ****************************************************************************/ | ||
221 : | |||
222 : | typedef struct | ||
223 : | { | ||
224 : | int width, height; | ||
225 : | int fincr, fbase; /* frame increment, fbase. each frame = "fincr/fbase" seconds */ | ||
226 : | int rc_bitrate; /* the bitrate of the target encoded stream, in bits/second */ | ||
227 : | int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */ | ||
228 : | int rc_averaging_period; /* as above */ | ||
229 : | int rc_buffer; /* as above */ | ||
230 : | int max_quantizer; /* the upper limit of the quantizer */ | ||
231 : | int min_quantizer; /* the lower limit of the quantizer */ | ||
232 : | int max_key_interval; /* the maximum interval between key frames */ | ||
233 : | #ifdef _SMP | ||
234 : | int num_threads; /* number of threads */ | ||
235 : | #endif | ||
236 : | #ifdef BFRAMES | ||
237 : | int global; /* global/debug options */ | ||
238 : | int max_bframes; /* max sequential bframes (0=disable bframes) */ | ||
239 : | int bquant_ratio; /* bframe quantizer multipier (percentage). | ||
240 : | * used only when bquant < 1 | ||
241 : | * eg. 200 = x2 multiplier | ||
242 : | #endif | ||
243 : | } | ||
244 : | XVID_ENC_PARAM; | ||
245 : | |||
246 : | typedef struct | ||
247 : | { | ||
248 : | int x; | ||
249 : | } | ||
250 : | VECTOR; | ||
251 : | |||
252 : | typedef struct | ||
253 : | { | ||
254 : | int mode; /* macroblock mode */ | ||
255 : | VECTOR mvs[4]; | ||
256 : | } | ||
257 : | MVBLOCKHINT; | ||
258 : | |||
259 : | typedef struct | ||
260 : | { | ||
261 : | int intra; /* frame intra choice */ | ||
262 : | int fcode; /* frame fcode */ | ||
263 : | MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */ | ||
264 : | } | ||
265 : | MVFRAMEHINT; | ||
266 : | |||
267 : | typedef struct | ||
268 : | { | ||
269 : | int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */ | ||
270 : | |||
271 : | MVFRAMEHINT mvhint; | ||
272 : | void *hintstream; /* compressed hint buffer */ | ||
273 : | int hintlength; /* length of buffer (bytes) */ | ||
274 : | } | ||
275 : | HINTINFO; | ||
276 : | |||
277 : | typedef struct | ||
278 : | { | ||
279 : | int general; /* [in] general options */ | ||
280 : | int motion; /* [in] ME options */ | ||
281 : | void *bitstream; /* [in] bitstream ptr */ | ||
282 : | int length; /* [out] bitstream length (bytes) */ | ||
283 : | |||
284 : | void *image; /* [in] image ptr */ | ||
285 : | int colorspace; /* [in] source colorspace */ | ||
286 : | |||
287 : | unsigned char *quant_intra_matrix; // [in] custom intra qmatrix */ | ||
288 : | unsigned char *quant_inter_matrix; // [in] custom inter qmatrix */ | ||
289 : | int quant; /* [in] frame quantizer (vbr) */ | ||
290 : | int intra; /* [in] force intra frame (vbr only) | ||
291 : | * [out] intra state | ||
292 : | */ | ||
293 : | HINTINFO hint; /* [in/out] mv hint information */ | ||
294 : | |||
295 : | #ifdef BFRAMES | ||
296 : | int bquant; /* [in] bframe quantizer */ | ||
297 : | #endif | ||
298 : | |||
299 : | } | ||
300 : | XVID_ENC_FRAME; | ||
301 : | |||
302 : | |||
303 : | typedef struct | ||
304 : | { | ||
305 : | int quant; /* [out] frame quantizer */ | ||
306 : | int input_consumed; /* [out] */ | ||
307 : | int hlength; /* [out] header length (bytes) */ | ||
308 : | int kblks, mblks, ublks; /* [out] */ | ||
309 : | |||
310 : | } | ||
311 : | XVID_ENC_STATS; | ||
312 : | |||
313 : | |||
314 : | /***************************************************************************** | ||
315 : | * Encoder entry point | ||
316 : | ****************************************************************************/ | ||
317 : | |||
318 : | /* Encoder options */ | ||
319 : | #define XVID_ENC_ENCODE 0 | ||
320 : | #define XVID_ENC_CREATE 1 | ||
321 : | #define XVID_ENC_DESTROY 2 | ||
322 : | |||
323 : | int xvid_encore(void *handle, | ||
324 : | int opt, | ||
325 : | void *param1, | ||
326 : | void *param2); | ||
327 : | |||
328 : | |||
329 : | #ifdef __cplusplus | ||
330 : | } | ||
331 : | #endif | ||
332 : | |||
333 : | #endif |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |