[svn] / branches / dev-api-3 / xvidcore / src / xvid.h Repository:
ViewVC logotype

Annotation of /branches/dev-api-3/xvidcore/src/xvid.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 582 - (view) (download)

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 582 * $Id: xvid.h,v 1.17.2.2 2002-10-06 07:05:50 suxen_drol Exp $
32 : edgomez 199 *
33 :     *****************************************************************************/
34 :    
35 :    
36 :     #ifndef _XVID_H_
37 :     #define _XVID_H_
38 :    
39 :     #ifdef __cplusplus
40 : chl 352 extern "C" {
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 : suxen_drol 582 #define XVID_CSP_RGB24 0 /* [b|g|r] */
60 : edgomez 199 #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 : suxen_drol 582 #define XVID_CSP_RGB32 1000 /* [b|g|r|a] */
70 :     #define XVID_CSP_ABGR 1006 /* [a|b|g|r] */
71 :     #define XVID_CSP_RGBA 1005 /* [r|g|b|a] */
72 :    
73 :    
74 :    
75 : edgomez 199 #define XVID_CSP_NULL 9999
76 :    
77 :     #define XVID_CSP_VFLIP 0x80000000 // flip mask
78 :    
79 :    
80 :     /*****************************************************************************
81 : albeu 315 * Initialization constants
82 : edgomez 199 ****************************************************************************/
83 :    
84 :     /* CPU flags for XVID_INIT_PARAM.cpu_flags */
85 :    
86 :     #define XVID_CPU_MMX 0x00000001
87 :     #define XVID_CPU_MMXEXT 0x00000002
88 :     #define XVID_CPU_SSE 0x00000004
89 :     #define XVID_CPU_SSE2 0x00000008
90 :     #define XVID_CPU_3DNOW 0x00000010
91 :     #define XVID_CPU_3DNOWEXT 0x00000020
92 :    
93 :     #define XVID_CPU_TSC 0x00000040
94 : Isibaar 209
95 : edgomez 199 #define XVID_CPU_IA64 0x00000080
96 :    
97 :     #define XVID_CPU_CHKONLY 0x40000000 /* check cpu only; dont init globals */
98 :     #define XVID_CPU_FORCE 0x80000000
99 :    
100 :    
101 : Isibaar 209 /*****************************************************************************
102 : edgomez 199 * Initialization structures
103 : Isibaar 209 ****************************************************************************/
104 :    
105 :     typedef struct
106 : suxen_drol 234 {
107 : edgomez 199 int cpu_flags;
108 :     int api_version;
109 :     int core_build;
110 :     }
111 :     XVID_INIT_PARAM;
112 :    
113 :     /*****************************************************************************
114 :     * Initialization entry point
115 :     ****************************************************************************/
116 :    
117 :     int xvid_init(void *handle,
118 :     int opt,
119 :     void *param1,
120 :     void *param2);
121 :    
122 :    
123 :     /*****************************************************************************
124 :     * Decoder constants
125 :     ****************************************************************************/
126 :    
127 :     /* Flags for XVID_DEC_FRAME.general */
128 :     #define XVID_QUICK_DECODE 0x00000010
129 :    
130 :     /*****************************************************************************
131 :     * Decoder structures
132 :     ****************************************************************************/
133 :    
134 :     typedef struct
135 :     {
136 :     int width;
137 :     int height;
138 :     void *handle;
139 :     }
140 :     XVID_DEC_PARAM;
141 :    
142 :    
143 :     typedef struct
144 :     {
145 :     int general;
146 :     void *bitstream;
147 :     int length;
148 :    
149 :     void *image;
150 :     int stride;
151 :     int colorspace;
152 :     }
153 :     XVID_DEC_FRAME;
154 :    
155 :    
156 :     // This struct is used for per slice rendering
157 :     typedef struct
158 :     {
159 :     void *y,*u,*v;
160 :     int stride_y, stride_u,stride_v;
161 :     } XVID_DEC_PICTURE;
162 :    
163 : albeu 315
164 :     /*****************************************************************************
165 :     * Decoder entry point
166 :     ****************************************************************************/
167 :    
168 :     /* decoder options */
169 :     #define XVID_DEC_DECODE 0
170 :     #define XVID_DEC_CREATE 1
171 : edgomez 199 #define XVID_DEC_DESTROY 2
172 :    
173 :     int xvid_decore(void *handle,
174 :     int opt,
175 :     void *param1,
176 :     void *param2);
177 :    
178 :    
179 :     /*****************************************************************************
180 :     * Encoder constants
181 :     ****************************************************************************/
182 :    
183 :     /* Flags for XVID_ENC_PARAM.global */
184 :     #define XVID_GLOBAL_PACKED 0x00000001 /* packed bitstream */
185 :     #define XVID_GLOBAL_DX50BVOP 0x00000002 /* dx50 bvop compatibility */
186 :     #define XVID_GLOBAL_DEBUG 0x00000004 /* print debug info on each frame */
187 :    
188 :     /* Flags for XVID_ENC_FRAME.general */
189 :     #define XVID_VALID_FLAGS 0x80000000
190 :    
191 :     #define XVID_CUSTOM_QMATRIX 0x00000004 /* use custom quant matrix */
192 : suxen_drol 234 #define XVID_H263QUANT 0x00000010
193 :     #define XVID_MPEGQUANT 0x00000020
194 :     #define XVID_HALFPEL 0x00000040 /* use halfpel interpolation */
195 : Isibaar 579 #define XVID_QUARTERPEL 0x02000000
196 : suxen_drol 234 #define XVID_ADAPTIVEQUANT 0x00000080
197 :     #define XVID_LUMIMASKING 0x00000100
198 : edgomez 199 #define XVID_LATEINTRA 0x00000200
199 :    
200 :     #define XVID_INTERLACING 0x00000400 /* enable interlaced encoding */
201 :     #define XVID_TOPFIELDFIRST 0x00000800 /* set top-field-first flag */
202 :     #define XVID_ALTERNATESCAN 0x00001000 /* set alternate vertical scan flag */
203 :    
204 :     #define XVID_HINTEDME_GET 0x00002000 /* receive mv hint data from core (1st pass) */
205 :     #define XVID_HINTEDME_SET 0x00004000 /* send mv hint data to core (2nd pass) */
206 :    
207 :     #define XVID_INTER4V 0x00008000
208 :    
209 :     #define XVID_ME_ZERO 0x00010000
210 :     #define XVID_ME_LOGARITHMIC 0x00020000
211 :     #define XVID_ME_FULLSEARCH 0x00040000
212 :     #define XVID_ME_PMVFAST 0x00080000
213 :     #define XVID_ME_EPZS 0x00100000
214 :    
215 :    
216 :     #define XVID_GREYSCALE 0x01000000 /* enable greyscale only mode (even for */
217 : Isibaar 579 #define XVID_GRAYSCALE 0x01000000 /* color input material chroma is ignored) */
218 : edgomez 199
219 :    
220 :     /* Flags for XVID_ENC_FRAME.motion */
221 :     #define PMV_ADVANCEDDIAMOND8 0x00004000
222 :     #define PMV_ADVANCEDDIAMOND16 0x00008000
223 : chl 352
224 :     #define PMV_HALFPELDIAMOND16 0x00010000
225 :     #define PMV_HALFPELREFINE16 0x00020000
226 : Isibaar 579 #define PMV_QUARTERPELREFINE16 0x00040000
227 :     #define PMV_EXTSEARCH16 0x00080000 /* extend PMV by more searches */
228 : edgomez 199 #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */
229 :     #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */
230 :     #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */
231 :     #define PMV_USESQUARES16 0x00800000
232 :    
233 :     #define PMV_HALFPELDIAMOND8 0x01000000
234 :     #define PMV_HALFPELREFINE8 0x02000000
235 : Isibaar 579 #define PMV_QUARTERPELREFINE8 0x04000000
236 :     #define PMV_EXTSEARCH8 0x08000000 /* extend PMV by more searches */
237 : edgomez 199 #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */
238 :     #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */
239 :     #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */
240 :     #define PMV_USESQUARES8 0x80000000
241 :    
242 :    
243 :     /*****************************************************************************
244 :     * Encoder structures
245 :     ****************************************************************************/
246 :    
247 :     typedef struct
248 :     {
249 :     int width, height;
250 :     int fincr, fbase; /* frame increment, fbase. each frame = "fincr/fbase" seconds */
251 :     int rc_bitrate; /* the bitrate of the target encoded stream, in bits/second */
252 :     int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */
253 :     int rc_averaging_period; /* as above */
254 :     int rc_buffer; /* as above */
255 :     int max_quantizer; /* the upper limit of the quantizer */
256 :     int min_quantizer; /* the lower limit of the quantizer */
257 :     int max_key_interval; /* the maximum interval between key frames */
258 :     #ifdef _SMP
259 :     int num_threads; /* number of threads */
260 :     #endif
261 :     #ifdef BFRAMES
262 :     int global; /* global/debug options */
263 :     int max_bframes; /* max sequential bframes (0=disable bframes) */
264 :     int bquant_ratio; /* bframe quantizer multipier (percentage).
265 :     * used only when bquant < 1
266 :     * eg. 200 = x2 multiplier
267 : suxen_drol 295 * quant = ((past_quant + future_quant) * bquant_ratio)/200
268 :     */
269 :     int frame_drop_ratio; /* frame dropping: 0=drop none... 100=drop all */
270 : edgomez 199 #endif
271 : suxen_drol 234 void *handle; /* [out] encoder instance handle */
272 : edgomez 199 }
273 :     XVID_ENC_PARAM;
274 :    
275 :     typedef struct
276 :     {
277 :     int x;
278 : suxen_drol 324 int y;
279 : edgomez 199 }
280 :     VECTOR;
281 :    
282 :     typedef struct
283 :     {
284 :     int mode; /* macroblock mode */
285 :     VECTOR mvs[4];
286 :     }
287 :     MVBLOCKHINT;
288 :    
289 :     typedef struct
290 :     {
291 :     int intra; /* frame intra choice */
292 :     int fcode; /* frame fcode */
293 :     MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */
294 :     }
295 :     MVFRAMEHINT;
296 :    
297 :     typedef struct
298 :     {
299 :     int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */
300 :    
301 :     MVFRAMEHINT mvhint;
302 :     void *hintstream; /* compressed hint buffer */
303 :     int hintlength; /* length of buffer (bytes) */
304 :     }
305 :     HINTINFO;
306 :    
307 :     typedef struct
308 :     {
309 :     int general; /* [in] general options */
310 :     int motion; /* [in] ME options */
311 :     void *bitstream; /* [in] bitstream ptr */
312 :     int length; /* [out] bitstream length (bytes) */
313 :    
314 :     void *image; /* [in] image ptr */
315 :     int colorspace; /* [in] source colorspace */
316 :    
317 :     unsigned char *quant_intra_matrix; // [in] custom intra qmatrix */
318 :     unsigned char *quant_inter_matrix; // [in] custom inter qmatrix */
319 :     int quant; /* [in] frame quantizer (vbr) */
320 :     int intra; /* [in] force intra frame (vbr only)
321 :     * [out] intra state
322 :     */
323 :     HINTINFO hint; /* [in/out] mv hint information */
324 :    
325 :     #ifdef BFRAMES
326 :     int bquant; /* [in] bframe quantizer */
327 :     #endif
328 :    
329 :     }
330 :     XVID_ENC_FRAME;
331 :    
332 :    
333 :     typedef struct
334 :     {
335 :     int quant; /* [out] frame quantizer */
336 :     int hlength; /* [out] header length (bytes) */
337 :     int kblks, mblks, ublks; /* [out] */
338 :    
339 :     }
340 :     XVID_ENC_STATS;
341 :    
342 :    
343 :     /*****************************************************************************
344 :     * Encoder entry point
345 :     ****************************************************************************/
346 :    
347 :     /* Encoder options */
348 :     #define XVID_ENC_ENCODE 0
349 :     #define XVID_ENC_CREATE 1
350 :     #define XVID_ENC_DESTROY 2
351 :    
352 :     int xvid_encore(void *handle,
353 :     int opt,
354 :     void *param1,
355 :     void *param2);
356 :    
357 :    
358 :     #ifdef __cplusplus
359 :     }
360 :     #endif
361 :    
362 :     #endif

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4