[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 411 - (view) (download)

1 : edgomez 199 /*****************************************************************************
2 : edgomez 411 *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - XviD Main header file -
5 :     *
6 :     * This program is an implementation of a part of one or more MPEG-4
7 :     * Video tools as specified in ISO/IEC 14496-2 standard. Those intending
8 :     * to use this software module in hardware or software products are
9 :     * advised that its use may infringe existing patents or copyrights, and
10 :     * any such use would be at such party's own risk. The original
11 :     * developer of this software module and his/her company, and subsequent
12 :     * editors and their companies, will have no liability for use of this
13 :     * software or modifications or derivatives thereof.
14 :     *
15 :     * This program is free software ; you can redistribute it and/or modify
16 :     * it under the terms of the GNU General Public License as published by
17 :     * the Free Software Foundation ; either version 2 of the License, or
18 :     * (at your option) any later version.
19 :     *
20 :     * This program is distributed in the hope that it will be useful,
21 :     * but WITHOUT ANY WARRANTY ; without even the implied warranty of
22 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 :     * GNU General Public License for more details.
24 :     *
25 :     * You should have received a copy of the GNU General Public License
26 :     * along with this program ; if not, write to the Free Software
27 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 :     *
29 :     * $Id: xvid.h,v 1.18 2002-09-04 22:12:21 edgomez Exp $
30 :     *
31 :     *****************************************************************************/
32 : edgomez 199
33 :     #ifndef _XVID_H_
34 :     #define _XVID_H_
35 :    
36 :     #ifdef __cplusplus
37 : chl 352 extern "C" {
38 : edgomez 199 #endif
39 :    
40 :     /*****************************************************************************
41 :     * Global constants
42 :     ****************************************************************************/
43 :    
44 :     /* API Version : 2.1 */
45 :     #define API_VERSION ((2 << 16) | (1))
46 :    
47 :    
48 :     /* Error codes */
49 :     #define XVID_ERR_FAIL -1
50 :     #define XVID_ERR_OK 0
51 :     #define XVID_ERR_MEMORY 1
52 :     #define XVID_ERR_FORMAT 2
53 :    
54 :    
55 :     /* Colorspaces */
56 :     #define XVID_CSP_RGB24 0
57 :     #define XVID_CSP_YV12 1
58 :     #define XVID_CSP_YUY2 2
59 :     #define XVID_CSP_UYVY 3
60 :     #define XVID_CSP_I420 4
61 :     #define XVID_CSP_RGB555 10
62 :     #define XVID_CSP_RGB565 11
63 :     #define XVID_CSP_USER 12
64 :     #define XVID_CSP_EXTERN 1004 // per slice rendering
65 :     #define XVID_CSP_YVYU 1002
66 :     #define XVID_CSP_RGB32 1000
67 :     #define XVID_CSP_NULL 9999
68 :    
69 :     #define XVID_CSP_VFLIP 0x80000000 // flip mask
70 :    
71 :    
72 :     /*****************************************************************************
73 : albeu 315 * Initialization constants
74 : edgomez 199 ****************************************************************************/
75 :    
76 :     /* CPU flags for XVID_INIT_PARAM.cpu_flags */
77 :    
78 :     #define XVID_CPU_MMX 0x00000001
79 :     #define XVID_CPU_MMXEXT 0x00000002
80 :     #define XVID_CPU_SSE 0x00000004
81 :     #define XVID_CPU_SSE2 0x00000008
82 :     #define XVID_CPU_3DNOW 0x00000010
83 :     #define XVID_CPU_3DNOWEXT 0x00000020
84 :    
85 :     #define XVID_CPU_TSC 0x00000040
86 : Isibaar 209
87 : edgomez 199 #define XVID_CPU_IA64 0x00000080
88 :    
89 :     #define XVID_CPU_CHKONLY 0x40000000 /* check cpu only; dont init globals */
90 :     #define XVID_CPU_FORCE 0x80000000
91 :    
92 :    
93 : Isibaar 209 /*****************************************************************************
94 : edgomez 199 * Initialization structures
95 : Isibaar 209 ****************************************************************************/
96 :    
97 :     typedef struct
98 : suxen_drol 234 {
99 : edgomez 199 int cpu_flags;
100 :     int api_version;
101 :     int core_build;
102 :     }
103 :     XVID_INIT_PARAM;
104 :    
105 :     /*****************************************************************************
106 :     * Initialization entry point
107 :     ****************************************************************************/
108 :    
109 :     int xvid_init(void *handle,
110 :     int opt,
111 :     void *param1,
112 :     void *param2);
113 :    
114 :    
115 :     /*****************************************************************************
116 :     * Decoder constants
117 :     ****************************************************************************/
118 :    
119 :     /* Flags for XVID_DEC_FRAME.general */
120 :     #define XVID_QUICK_DECODE 0x00000010
121 :    
122 :     /*****************************************************************************
123 :     * Decoder structures
124 :     ****************************************************************************/
125 :    
126 :     typedef struct
127 :     {
128 :     int width;
129 :     int height;
130 :     void *handle;
131 :     }
132 :     XVID_DEC_PARAM;
133 :    
134 :    
135 :     typedef struct
136 :     {
137 :     int general;
138 :     void *bitstream;
139 :     int length;
140 :    
141 :     void *image;
142 :     int stride;
143 :     int colorspace;
144 :     }
145 :     XVID_DEC_FRAME;
146 :    
147 :    
148 :     // This struct is used for per slice rendering
149 :     typedef struct
150 :     {
151 :     void *y,*u,*v;
152 :     int stride_y, stride_u,stride_v;
153 :     } XVID_DEC_PICTURE;
154 :    
155 : albeu 315
156 :     /*****************************************************************************
157 :     * Decoder entry point
158 :     ****************************************************************************/
159 :    
160 :     /* decoder options */
161 :     #define XVID_DEC_DECODE 0
162 :     #define XVID_DEC_CREATE 1
163 : edgomez 199 #define XVID_DEC_DESTROY 2
164 :    
165 :     int xvid_decore(void *handle,
166 :     int opt,
167 :     void *param1,
168 :     void *param2);
169 :    
170 :    
171 :     /*****************************************************************************
172 :     * Encoder constants
173 :     ****************************************************************************/
174 :    
175 :     /* Flags for XVID_ENC_PARAM.global */
176 :     #define XVID_GLOBAL_PACKED 0x00000001 /* packed bitstream */
177 :     #define XVID_GLOBAL_DX50BVOP 0x00000002 /* dx50 bvop compatibility */
178 :     #define XVID_GLOBAL_DEBUG 0x00000004 /* print debug info on each frame */
179 :    
180 :     /* Flags for XVID_ENC_FRAME.general */
181 :     #define XVID_VALID_FLAGS 0x80000000
182 :    
183 :     #define XVID_CUSTOM_QMATRIX 0x00000004 /* use custom quant matrix */
184 : suxen_drol 234 #define XVID_H263QUANT 0x00000010
185 :     #define XVID_MPEGQUANT 0x00000020
186 :     #define XVID_HALFPEL 0x00000040 /* use halfpel interpolation */
187 :     #define XVID_ADAPTIVEQUANT 0x00000080
188 :     #define XVID_LUMIMASKING 0x00000100
189 : edgomez 199 #define XVID_LATEINTRA 0x00000200
190 :    
191 :     #define XVID_INTERLACING 0x00000400 /* enable interlaced encoding */
192 :     #define XVID_TOPFIELDFIRST 0x00000800 /* set top-field-first flag */
193 :     #define XVID_ALTERNATESCAN 0x00001000 /* set alternate vertical scan flag */
194 :    
195 :     #define XVID_HINTEDME_GET 0x00002000 /* receive mv hint data from core (1st pass) */
196 :     #define XVID_HINTEDME_SET 0x00004000 /* send mv hint data to core (2nd pass) */
197 :    
198 :     #define XVID_INTER4V 0x00008000
199 :    
200 :     #define XVID_ME_ZERO 0x00010000
201 :     #define XVID_ME_LOGARITHMIC 0x00020000
202 :     #define XVID_ME_FULLSEARCH 0x00040000
203 :     #define XVID_ME_PMVFAST 0x00080000
204 :     #define XVID_ME_EPZS 0x00100000
205 :    
206 :    
207 :     #define XVID_GREYSCALE 0x01000000 /* enable greyscale only mode (even for */
208 :     #define XVID_GRAYSCALE 0x01000000 /* color input material chroma is ignored) */
209 :    
210 :    
211 :     /* Flags for XVID_ENC_FRAME.motion */
212 :     #define PMV_ADVANCEDDIAMOND8 0x00004000
213 :     #define PMV_ADVANCEDDIAMOND16 0x00008000
214 : chl 352
215 :     #define PMV_HALFPELDIAMOND16 0x00010000
216 :     #define PMV_HALFPELREFINE16 0x00020000
217 :     #define PMV_EXTSEARCH16 0x00040000 /* extend PMV by more searches */
218 : edgomez 199 #define PMV_EARLYSTOP16 0x00080000
219 :     #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */
220 :     #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */
221 :     #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */
222 :     #define PMV_USESQUARES16 0x00800000
223 :    
224 :     #define PMV_HALFPELDIAMOND8 0x01000000
225 :     #define PMV_HALFPELREFINE8 0x02000000
226 :     #define PMV_EXTSEARCH8 0x04000000 /* extend PMV by more searches */
227 :     #define PMV_EARLYSTOP8 0x08000000
228 :     #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */
229 :     #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */
230 :     #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */
231 :     #define PMV_USESQUARES8 0x80000000
232 :    
233 :    
234 :     /*****************************************************************************
235 :     * Encoder structures
236 :     ****************************************************************************/
237 :    
238 :     typedef struct
239 :     {
240 :     int width, height;
241 :     int fincr, fbase; /* frame increment, fbase. each frame = "fincr/fbase" seconds */
242 :     int rc_bitrate; /* the bitrate of the target encoded stream, in bits/second */
243 :     int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */
244 :     int rc_averaging_period; /* as above */
245 :     int rc_buffer; /* as above */
246 :     int max_quantizer; /* the upper limit of the quantizer */
247 :     int min_quantizer; /* the lower limit of the quantizer */
248 :     int max_key_interval; /* the maximum interval between key frames */
249 :     #ifdef _SMP
250 :     int num_threads; /* number of threads */
251 :     #endif
252 :     #ifdef BFRAMES
253 :     int global; /* global/debug options */
254 :     int max_bframes; /* max sequential bframes (0=disable bframes) */
255 :     int bquant_ratio; /* bframe quantizer multipier (percentage).
256 :     * used only when bquant < 1
257 :     * eg. 200 = x2 multiplier
258 : suxen_drol 295 * quant = ((past_quant + future_quant) * bquant_ratio)/200
259 :     */
260 :     int frame_drop_ratio; /* frame dropping: 0=drop none... 100=drop all */
261 : edgomez 199 #endif
262 : suxen_drol 234 void *handle; /* [out] encoder instance handle */
263 : edgomez 199 }
264 :     XVID_ENC_PARAM;
265 :    
266 :     typedef struct
267 :     {
268 :     int x;
269 : suxen_drol 324 int y;
270 : edgomez 199 }
271 :     VECTOR;
272 :    
273 :     typedef struct
274 :     {
275 :     int mode; /* macroblock mode */
276 :     VECTOR mvs[4];
277 :     }
278 :     MVBLOCKHINT;
279 :    
280 :     typedef struct
281 :     {
282 :     int intra; /* frame intra choice */
283 :     int fcode; /* frame fcode */
284 :     MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */
285 :     }
286 :     MVFRAMEHINT;
287 :    
288 :     typedef struct
289 :     {
290 :     int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */
291 :    
292 :     MVFRAMEHINT mvhint;
293 :     void *hintstream; /* compressed hint buffer */
294 :     int hintlength; /* length of buffer (bytes) */
295 :     }
296 :     HINTINFO;
297 :    
298 :     typedef struct
299 :     {
300 :     int general; /* [in] general options */
301 :     int motion; /* [in] ME options */
302 :     void *bitstream; /* [in] bitstream ptr */
303 :     int length; /* [out] bitstream length (bytes) */
304 :    
305 :     void *image; /* [in] image ptr */
306 :     int colorspace; /* [in] source colorspace */
307 :    
308 :     unsigned char *quant_intra_matrix; // [in] custom intra qmatrix */
309 :     unsigned char *quant_inter_matrix; // [in] custom inter qmatrix */
310 :     int quant; /* [in] frame quantizer (vbr) */
311 :     int intra; /* [in] force intra frame (vbr only)
312 :     * [out] intra state
313 :     */
314 :     HINTINFO hint; /* [in/out] mv hint information */
315 :    
316 :     #ifdef BFRAMES
317 :     int bquant; /* [in] bframe quantizer */
318 :     #endif
319 :    
320 :     }
321 :     XVID_ENC_FRAME;
322 :    
323 :    
324 :     typedef struct
325 :     {
326 :     int quant; /* [out] frame quantizer */
327 :     int hlength; /* [out] header length (bytes) */
328 :     int kblks, mblks, ublks; /* [out] */
329 :    
330 :     }
331 :     XVID_ENC_STATS;
332 :    
333 :    
334 :     /*****************************************************************************
335 :     * Encoder entry point
336 :     ****************************************************************************/
337 :    
338 :     /* Encoder options */
339 :     #define XVID_ENC_ENCODE 0
340 :     #define XVID_ENC_CREATE 1
341 :     #define XVID_ENC_DESTROY 2
342 :    
343 :     int xvid_encore(void *handle,
344 :     int opt,
345 :     void *param1,
346 :     void *param2);
347 :    
348 :    
349 :     #ifdef __cplusplus
350 :     }
351 :     #endif
352 :    
353 :     #endif

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