[svn] / trunk / xvidcore / src / xvid.h Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/xvid.h

Parent Directory Parent Directory | Revision Log Revision Log


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

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