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

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