Parent Directory | Revision Log
Revision 160 - (view) (download)
1 : | Isibaar | 6 | #ifndef _XVID_H_ |
2 : | #define _XVID_H_ | ||
3 : | |||
4 : | #ifdef __cplusplus | ||
5 : | extern "C" { | ||
6 : | #endif | ||
7 : | |||
8 : | // ========================================== | ||
9 : | // global | ||
10 : | // ========================================== | ||
11 : | |||
12 : | uManiac | 160 | // API Version: 2.1 |
13 : | #define API_VERSION ((2 << 16) | (1)) | ||
14 : | Isibaar | 6 | |
15 : | // cpu features | ||
16 : | #define XVID_CPU_MMX 0x00000001 | ||
17 : | #define XVID_CPU_MMXEXT 0x00000002 | ||
18 : | #define XVID_CPU_SSE 0x00000004 | ||
19 : | #define XVID_CPU_SSE2 0x00000008 | ||
20 : | #define XVID_CPU_3DNOW 0x00000010 | ||
21 : | #define XVID_CPU_3DNOWEXT 0x00000020 | ||
22 : | #define XVID_CPU_TSC 0x00000040 | ||
23 : | #define XVID_CPU_FORCE 0x80000000 | ||
24 : | |||
25 : | // colorspaces | ||
26 : | #define XVID_CSP_RGB24 0 | ||
27 : | #define XVID_CSP_YV12 1 | ||
28 : | #define XVID_CSP_YUY2 2 | ||
29 : | #define XVID_CSP_UYVY 3 | ||
30 : | #define XVID_CSP_I420 4 | ||
31 : | #define XVID_CSP_RGB555 10 | ||
32 : | #define XVID_CSP_RGB565 11 | ||
33 : | #define XVID_CSP_USER 12 | ||
34 : | #define XVID_CSP_YVYU 1002 | ||
35 : | #define XVID_CSP_RGB32 1000 | ||
36 : | #define XVID_CSP_NULL 9999 | ||
37 : | |||
38 : | #define XVID_CSP_VFLIP 0x80000000 // flip mask | ||
39 : | |||
40 : | // error | ||
41 : | #define XVID_ERR_FAIL -1 | ||
42 : | #define XVID_ERR_OK 0 | ||
43 : | #define XVID_ERR_MEMORY 1 | ||
44 : | #define XVID_ERR_FORMAT 2 | ||
45 : | |||
46 : | typedef struct | ||
47 : | { | ||
48 : | int cpu_flags; | ||
49 : | int api_version; | ||
50 : | int core_build; | ||
51 : | } XVID_INIT_PARAM; | ||
52 : | |||
53 : | int xvid_init(void *handle, int opt, | ||
54 : | void *param1, void *param2); | ||
55 : | |||
56 : | |||
57 : | // ========================================== | ||
58 : | // decoder | ||
59 : | // ========================================== | ||
60 : | |||
61 : | #define XVID_QUICK_DECODE 0x00000010 /* increases decoding speed but reduces quality */ | ||
62 : | |||
63 : | typedef struct | ||
64 : | { | ||
65 : | int width; | ||
66 : | int height; | ||
67 : | void *handle; | ||
68 : | } XVID_DEC_PARAM; | ||
69 : | |||
70 : | |||
71 : | typedef struct | ||
72 : | { | ||
73 : | int general; | ||
74 : | void * bitstream; | ||
75 : | int length; | ||
76 : | |||
77 : | void * image; | ||
78 : | int stride; | ||
79 : | int colorspace; | ||
80 : | } XVID_DEC_FRAME; | ||
81 : | |||
82 : | |||
83 : | // decoder options | ||
84 : | #define XVID_DEC_DECODE 0 | ||
85 : | #define XVID_DEC_CREATE 1 | ||
86 : | #define XVID_DEC_DESTROY 2 | ||
87 : | |||
88 : | int xvid_decore(void * handle, | ||
89 : | int opt, | ||
90 : | void * param1, | ||
91 : | void * param2); | ||
92 : | |||
93 : | |||
94 : | // ========================================== | ||
95 : | // encoder | ||
96 : | // ========================================== | ||
97 : | |||
98 : | /* Do not rely on the VALUES of these constants, they may be changed at any time */ | ||
99 : | #define XVID_VALID_FLAGS 0x80000000 | ||
100 : | |||
101 : | #define XVID_CUSTOM_QMATRIX 0x00000004 /* use custom quant matrix */ | ||
102 : | #define XVID_H263QUANT 0x00000010 | ||
103 : | #define XVID_MPEGQUANT 0x00000020 | ||
104 : | #define XVID_HALFPEL 0x00000040 /* use halfpel interpolation */ | ||
105 : | #define XVID_ADAPTIVEQUANT 0x00000080 | ||
106 : | #define XVID_LUMIMASKING 0x00000100 | ||
107 : | uManiac | 160 | #define XVID_LATEINTRA 0x00000200 |
108 : | Isibaar | 6 | |
109 : | uManiac | 160 | #define XVID_INTERLACING 0x00000400 /* enable interlaced encoding */ |
110 : | #define XVID_TOPFIELDFIRST 0x00000800 /* set top-field-first flag (cosmetic only) */ | ||
111 : | #define XVID_ALTERNATESCAN 0x00001000 /* ?? sets alternate vertical scan flag */ | ||
112 : | Isibaar | 6 | |
113 : | uManiac | 160 | #define XVID_HINTEDME_GET 0x00002000 /* receive mv hint data from core (1st pass) */ |
114 : | #define XVID_HINTEDME_SET 0x00004000 /* send mv hint data to core (2nd pass) */ | ||
115 : | Isibaar | 6 | |
116 : | uManiac | 160 | #define XVID_INTER4V 0x00008000 |
117 : | |||
118 : | #define XVID_ME_ZERO 0x00010000 | ||
119 : | #define XVID_ME_LOGARITHMIC 0x00020000 | ||
120 : | #define XVID_ME_FULLSEARCH 0x00040000 | ||
121 : | #define XVID_ME_PMVFAST 0x00080000 | ||
122 : | #define XVID_ME_EPZS 0x00100000 | ||
123 : | |||
124 : | Isibaar | 6 | #define PMV_HALFPELDIAMOND16 0x00010000 |
125 : | #define PMV_HALFPELREFINE16 0x00020000 | ||
126 : | #define PMV_EXTSEARCH16 0x00040000 /* extend PMV by more searches */ | ||
127 : | #define PMV_EARLYSTOP16 0x00080000 | ||
128 : | #define PMV_QUICKSTOP16 0x00100000 /* like early, but without any more refinement */ | ||
129 : | #define PMV_UNRESTRICTED16 0x00200000 /* unrestricted ME, not implemented */ | ||
130 : | #define PMV_OVERLAPPING16 0x00400000 /* overlapping ME, not implemented */ | ||
131 : | uManiac | 160 | #define PMV_USESQUARES16 0x00800000 |
132 : | Isibaar | 6 | |
133 : | #define PMV_HALFPELDIAMOND8 0x01000000 | ||
134 : | #define PMV_HALFPELREFINE8 0x02000000 | ||
135 : | #define PMV_EXTSEARCH8 0x04000000 /* extend PMV by more searches */ | ||
136 : | #define PMV_EARLYSTOP8 0x08000000 | ||
137 : | #define PMV_QUICKSTOP8 0x10000000 /* like early, but without any more refinement */ | ||
138 : | #define PMV_UNRESTRICTED8 0x20000000 /* unrestricted ME, not implemented */ | ||
139 : | #define PMV_OVERLAPPING8 0x40000000 /* overlapping ME, not implemented */ | ||
140 : | uManiac | 160 | #define PMV_USESQUARES8 0x80000000 |
141 : | Isibaar | 6 | |
142 : | uManiac | 160 | |
143 : | Isibaar | 6 | typedef struct |
144 : | { | ||
145 : | int width, height; | ||
146 : | int fincr, fbase; // frame increment, fbase. each frame = "fincr/fbase" seconds | ||
147 : | uManiac | 160 | int rc_bitrate; // the bitrate of the target encoded stream, in bits/second |
148 : | int rc_reaction_delay_factor; // how fast the rate control reacts - lower values are faster | ||
149 : | int rc_averaging_period; // as above | ||
150 : | int rc_buffer; // as above | ||
151 : | Isibaar | 6 | int max_quantizer; // the upper limit of the quantizer |
152 : | int min_quantizer; // the lower limit of the quantizer | ||
153 : | int max_key_interval; // the maximum interval between key frames | ||
154 : | uManiac | 160 | #ifdef BFRAMES |
155 : | int max_bframes; // max sequential bframes (0=disable bframes) | ||
156 : | int bquant_ratio; // bframe quantizer multipier (percentage). | ||
157 : | // used only when bquant < 1 | ||
158 : | // eg. 200 = x2 multiplier | ||
159 : | // quant = ((past_quant + future_quant) * bquant_ratio)/200 | ||
160 : | #endif | ||
161 : | Isibaar | 6 | void * handle; // [out] encoder instance handle |
162 : | |||
163 : | } XVID_ENC_PARAM; | ||
164 : | |||
165 : | |||
166 : | typedef struct | ||
167 : | { | ||
168 : | uManiac | 160 | int x; |
169 : | int y; | ||
170 : | } VECTOR; | ||
171 : | |||
172 : | typedef struct | ||
173 : | { | ||
174 : | int mode; // macroblock mode | ||
175 : | VECTOR mvs[4]; | ||
176 : | } MVBLOCKHINT; | ||
177 : | |||
178 : | typedef struct | ||
179 : | { | ||
180 : | int intra; // frame intra choice | ||
181 : | int fcode; // frame fcode | ||
182 : | MVBLOCKHINT * block; // caller-allocated array of block hints (mb_width * mb_height) | ||
183 : | } MVFRAMEHINT; | ||
184 : | |||
185 : | typedef struct | ||
186 : | { | ||
187 : | int rawhints; // if set, use MVFRAMEHINT, else use compressed buffer | ||
188 : | |||
189 : | MVFRAMEHINT mvhint; | ||
190 : | void * hintstream; // compressed hint buffer | ||
191 : | int hintlength; // length of buffer (bytes) | ||
192 : | } HINTINFO; | ||
193 : | |||
194 : | typedef struct | ||
195 : | { | ||
196 : | Isibaar | 6 | int general; // [in] general options |
197 : | int motion; // [in] ME options | ||
198 : | void * bitstream; // [in] bitstream ptr | ||
199 : | int length; // [out] bitstream length (bytes) | ||
200 : | |||
201 : | void * image; // [in] image ptr | ||
202 : | int colorspace; // [in] source colorspace | ||
203 : | |||
204 : | unsigned char *quant_intra_matrix; // [in] custom intra qmatrix | ||
205 : | unsigned char *quant_inter_matrix; // [in] custom inter qmatrix | ||
206 : | int quant; // [in] frame quantizer (vbr) | ||
207 : | int intra; // [in] force intra frame (vbr only) | ||
208 : | // [out] intra state | ||
209 : | uManiac | 160 | HINTINFO hint; // [in/out] mv hint information |
210 : | |||
211 : | #ifdef BFRAMES | ||
212 : | int bquant; // [in] bframe quantizer | ||
213 : | int input_consumed; // [out] | ||
214 : | #endif | ||
215 : | |||
216 : | Isibaar | 6 | } XVID_ENC_FRAME; |
217 : | |||
218 : | |||
219 : | typedef struct | ||
220 : | { | ||
221 : | int quant; // [out] frame quantizer | ||
222 : | int hlength; // [out] header length (bytes) | ||
223 : | int kblks, mblks, ublks; // [out] | ||
224 : | |||
225 : | } XVID_ENC_STATS; | ||
226 : | |||
227 : | |||
228 : | #define XVID_ENC_ENCODE 0 | ||
229 : | #define XVID_ENC_CREATE 1 | ||
230 : | #define XVID_ENC_DESTROY 2 | ||
231 : | |||
232 : | int xvid_encore(void * handle, | ||
233 : | int opt, | ||
234 : | void * param1, | ||
235 : | void * param2); | ||
236 : | |||
237 : | |||
238 : | #ifdef __cplusplus | ||
239 : | } | ||
240 : | #endif | ||
241 : | |||
242 : | #endif /* _XVID_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |