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

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