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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 324 - (view) (download)

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

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