Parent Directory
|
Revision Log
Revision 1.37 - (view) (download)
1 : | edgomez | 1.16 | /***************************************************************************** |
2 : | edgomez | 1.17 | * |
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - Native API implementation - | ||
5 : | * | ||
6 : | suxen_drol | 1.37 | * Copyright(C) 2001-2002 Peter Ross <pross@xvid.org> |
7 : | edgomez | 1.34 | * |
8 : | edgomez | 1.17 | * This program is an implementation of a part of one or more MPEG-4 |
9 : | * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
10 : | * to use this software module in hardware or software products are | ||
11 : | * advised that its use may infringe existing patents or copyrights, and | ||
12 : | * any such use would be at such party's own risk. The original | ||
13 : | * developer of this software module and his/her company, and subsequent | ||
14 : | * editors and their companies, will have no liability for use of this | ||
15 : | * software or modifications or derivatives thereof. | ||
16 : | * | ||
17 : | * This program is free software ; you can redistribute it and/or modify | ||
18 : | * it under the terms of the GNU General Public License as published by | ||
19 : | * the Free Software Foundation ; either version 2 of the License, or | ||
20 : | * (at your option) any later version. | ||
21 : | * | ||
22 : | * This program is distributed in the hope that it will be useful, | ||
23 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
24 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
25 : | * GNU General Public License for more details. | ||
26 : | * | ||
27 : | * You should have received a copy of the GNU General Public License | ||
28 : | * along with this program ; if not, write to the Free Software | ||
29 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
30 : | * | ||
31 : | suxen_drol | 1.37 | * $Id: xvid.c,v 1.36 2002/09/04 22:08:45 edgomez Exp $ |
32 : | edgomez | 1.36 | * |
33 : | edgomez | 1.17 | ****************************************************************************/ |
34 : | chenm001 | 1.29 | |
35 : | Isibaar | 1.1 | #include "xvid.h" |
36 : | #include "decoder.h" | ||
37 : | #include "encoder.h" | ||
38 : | #include "bitstream/cbp.h" | ||
39 : | #include "dct/idct.h" | ||
40 : | #include "dct/fdct.h" | ||
41 : | #include "image/colorspace.h" | ||
42 : | #include "image/interpolate8x8.h" | ||
43 : | #include "utils/mem_transfer.h" | ||
44 : | #include "quant/quant_h263.h" | ||
45 : | #include "quant/quant_mpeg4.h" | ||
46 : | ia64p | 1.30 | #include "motion/motion.h" |
47 : | Isibaar | 1.1 | #include "motion/sad.h" |
48 : | #include "utils/emms.h" | ||
49 : | #include "utils/timer.h" | ||
50 : | Isibaar | 1.9 | #include "bitstream/mbcoding.h" |
51 : | Isibaar | 1.1 | |
52 : | suxen_drol | 1.31 | #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE) |
53 : | |||
54 : | #ifdef WIN32 | ||
55 : | #include <windows.h> | ||
56 : | #else | ||
57 : | #include <signal.h> | ||
58 : | #include <setjmp.h> | ||
59 : | #endif | ||
60 : | |||
61 : | |||
62 : | #ifndef WIN32 | ||
63 : | |||
64 : | static jmp_buf mark; | ||
65 : | |||
66 : | static void | ||
67 : | sigill_handler(int signal) | ||
68 : | { | ||
69 : | longjmp(mark, 1); | ||
70 : | } | ||
71 : | #endif | ||
72 : | |||
73 : | |||
74 : | /* | ||
75 : | edgomez | 1.34 | * Calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled |
76 : | * Return values: | ||
77 : | * -1 : could not determine | ||
78 : | * 0 : SIGILL was *not* signalled | ||
79 : | * 1 : SIGILL was signalled | ||
80 : | */ | ||
81 : | suxen_drol | 1.31 | |
82 : | int | ||
83 : | sigill_check(void (*func)()) | ||
84 : | { | ||
85 : | #ifdef WIN32 | ||
86 : | _try { | ||
87 : | func(); | ||
88 : | } | ||
89 : | _except(EXCEPTION_EXECUTE_HANDLER) { | ||
90 : | |||
91 : | if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) | ||
92 : | return 1; | ||
93 : | } | ||
94 : | return 0; | ||
95 : | #else | ||
96 : | void * old_handler; | ||
97 : | int jmpret; | ||
98 : | |||
99 : | |||
100 : | old_handler = signal(SIGILL, sigill_handler); | ||
101 : | if (old_handler == SIG_ERR) | ||
102 : | { | ||
103 : | return -1; | ||
104 : | } | ||
105 : | |||
106 : | jmpret = setjmp(mark); | ||
107 : | if (jmpret == 0) | ||
108 : | { | ||
109 : | func(); | ||
110 : | } | ||
111 : | |||
112 : | signal(SIGILL, old_handler); | ||
113 : | |||
114 : | return jmpret; | ||
115 : | #endif | ||
116 : | } | ||
117 : | #endif | ||
118 : | |||
119 : | edgomez | 1.16 | /***************************************************************************** |
120 : | * XviD Init Entry point | ||
121 : | * | ||
122 : | * Well this function initialize all internal function pointers according | ||
123 : | * to the CPU features forced by the library client or autodetected (depending | ||
124 : | * on the XVID_CPU_FORCE flag). It also initializes vlc coding tables and all | ||
125 : | * image colorspace transformation tables. | ||
126 : | * | ||
127 : | * Returned value : XVID_ERR_OK | ||
128 : | * + API_VERSION in the input XVID_INIT_PARAM structure | ||
129 : | * + core build " " " " " | ||
130 : | * | ||
131 : | ****************************************************************************/ | ||
132 : | |||
133 : | edgomez | 1.15 | int |
134 : | xvid_init(void *handle, | ||
135 : | int opt, | ||
136 : | void *param1, | ||
137 : | void *param2) | ||
138 : | Isibaar | 1.1 | { |
139 : | int cpu_flags; | ||
140 : | XVID_INIT_PARAM *init_param; | ||
141 : | |||
142 : | init_param = (XVID_INIT_PARAM *) param1; | ||
143 : | |||
144 : | suxen_drol | 1.21 | /* Inform the client the API version */ |
145 : | init_param->api_version = API_VERSION; | ||
146 : | |||
147 : | /* Inform the client the core build - unused because we're still alpha */ | ||
148 : | init_param->core_build = 1000; | ||
149 : | |||
150 : | suxen_drol | 1.31 | /* Do we have to force CPU features ? */ |
151 : | if ((init_param->cpu_flags & XVID_CPU_FORCE)) { | ||
152 : | suxen_drol | 1.21 | |
153 : | Isibaar | 1.1 | cpu_flags = init_param->cpu_flags; |
154 : | suxen_drol | 1.31 | |
155 : | edgomez | 1.16 | } else { |
156 : | Isibaar | 1.1 | |
157 : | chenm001 | 1.29 | cpu_flags = check_cpu_features(); |
158 : | suxen_drol | 1.31 | |
159 : | #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE) | ||
160 : | if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) | ||
161 : | cpu_flags &= ~XVID_CPU_SSE; | ||
162 : | |||
163 : | if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger)) | ||
164 : | cpu_flags &= ~XVID_CPU_SSE2; | ||
165 : | #endif | ||
166 : | } | ||
167 : | |||
168 : | if ((init_param->cpu_flags & XVID_CPU_CHKONLY)) | ||
169 : | { | ||
170 : | Isibaar | 1.1 | init_param->cpu_flags = cpu_flags; |
171 : | suxen_drol | 1.31 | return XVID_ERR_OK; |
172 : | Isibaar | 1.1 | } |
173 : | suxen_drol | 1.31 | |
174 : | init_param->cpu_flags = cpu_flags; | ||
175 : | |||
176 : | Isibaar | 1.1 | |
177 : | edgomez | 1.16 | /* Initialize the function pointers */ |
178 : | Isibaar | 1.1 | idct_int32_init(); |
179 : | Isibaar | 1.9 | init_vlc_tables(); |
180 : | |||
181 : | edgomez | 1.16 | /* Fixed Point Forward/Inverse DCT transformations */ |
182 : | Isibaar | 1.1 | fdct = fdct_int32; |
183 : | idct = idct_int32; | ||
184 : | |||
185 : | edgomez | 1.16 | /* Only needed on PPC Altivec archs */ |
186 : | canard | 1.10 | sadInit = 0; |
187 : | edgomez | 1.15 | |
188 : | edgomez | 1.16 | /* Restore FPU context : emms_c is a nop functions */ |
189 : | Isibaar | 1.1 | emms = emms_c; |
190 : | |||
191 : | edgomez | 1.16 | /* Quantization functions */ |
192 : | quant_intra = quant_intra_c; | ||
193 : | Isibaar | 1.1 | dequant_intra = dequant_intra_c; |
194 : | edgomez | 1.16 | quant_inter = quant_inter_c; |
195 : | Isibaar | 1.1 | dequant_inter = dequant_inter_c; |
196 : | |||
197 : | edgomez | 1.16 | quant4_intra = quant4_intra_c; |
198 : | Isibaar | 1.1 | dequant4_intra = dequant4_intra_c; |
199 : | edgomez | 1.16 | quant4_inter = quant4_inter_c; |
200 : | Isibaar | 1.1 | dequant4_inter = dequant4_inter_c; |
201 : | |||
202 : | edgomez | 1.16 | /* Block transfer related functions */ |
203 : | Isibaar | 1.1 | transfer_8to16copy = transfer_8to16copy_c; |
204 : | transfer_16to8copy = transfer_16to8copy_c; | ||
205 : | edgomez | 1.16 | transfer_8to16sub = transfer_8to16sub_c; |
206 : | suxen_drol | 1.11 | transfer_8to16sub2 = transfer_8to16sub2_c; |
207 : | edgomez | 1.16 | transfer_16to8add = transfer_16to8add_c; |
208 : | transfer8x8_copy = transfer8x8_copy_c; | ||
209 : | Isibaar | 1.1 | |
210 : | edgomez | 1.16 | /* Image interpolation related functions */ |
211 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_c; | ||
212 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_c; | ||
213 : | Isibaar | 1.1 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_c; |
214 : | |||
215 : | edgomez | 1.16 | /* Initialize internal colorspace transformation tables */ |
216 : | Isibaar | 1.1 | colorspace_init(); |
217 : | |||
218 : | edgomez | 1.16 | /* All colorspace transformation functions User Format->YV12 */ |
219 : | Isibaar | 1.1 | rgb555_to_yv12 = rgb555_to_yv12_c; |
220 : | rgb565_to_yv12 = rgb565_to_yv12_c; | ||
221 : | edgomez | 1.16 | rgb24_to_yv12 = rgb24_to_yv12_c; |
222 : | rgb32_to_yv12 = rgb32_to_yv12_c; | ||
223 : | yuv_to_yv12 = yuv_to_yv12_c; | ||
224 : | yuyv_to_yv12 = yuyv_to_yv12_c; | ||
225 : | uyvy_to_yv12 = uyvy_to_yv12_c; | ||
226 : | Isibaar | 1.1 | |
227 : | edgomez | 1.16 | /* All colorspace transformation functions YV12->User format */ |
228 : | Isibaar | 1.1 | yv12_to_rgb555 = yv12_to_rgb555_c; |
229 : | yv12_to_rgb565 = yv12_to_rgb565_c; | ||
230 : | edgomez | 1.16 | yv12_to_rgb24 = yv12_to_rgb24_c; |
231 : | yv12_to_rgb32 = yv12_to_rgb32_c; | ||
232 : | yv12_to_yuv = yv12_to_yuv_c; | ||
233 : | yv12_to_yuyv = yv12_to_yuyv_c; | ||
234 : | yv12_to_uyvy = yv12_to_uyvy_c; | ||
235 : | Isibaar | 1.1 | |
236 : | edgomez | 1.16 | /* Functions used in motion estimation algorithms */ |
237 : | Isibaar | 1.1 | calc_cbp = calc_cbp_c; |
238 : | edgomez | 1.16 | sad16 = sad16_c; |
239 : | suxen_drol | 1.33 | sad8 = sad8_c; |
240 : | edgomez | 1.16 | sad16bi = sad16bi_c; |
241 : | suxen_drol | 1.33 | sad8bi = sad8bi_c; |
242 : | edgomez | 1.16 | dev16 = dev16_c; |
243 : | suxen_drol | 1.33 | |
244 : | ia64p | 1.30 | Halfpel8_Refine = Halfpel8_Refine_c; |
245 : | Isibaar | 1.1 | |
246 : | #ifdef ARCH_X86 | ||
247 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_MMX) > 0) { |
248 : | edgomez | 1.16 | |
249 : | /* Forward and Inverse Discrete Cosine Transformation functions */ | ||
250 : | Isibaar | 1.1 | fdct = fdct_mmx; |
251 : | idct = idct_mmx; | ||
252 : | |||
253 : | edgomez | 1.16 | /* To restore FPU context after mmx use */ |
254 : | Isibaar | 1.1 | emms = emms_mmx; |
255 : | |||
256 : | edgomez | 1.16 | /* Quantization related functions */ |
257 : | quant_intra = quant_intra_mmx; | ||
258 : | Isibaar | 1.1 | dequant_intra = dequant_intra_mmx; |
259 : | edgomez | 1.16 | quant_inter = quant_inter_mmx; |
260 : | Isibaar | 1.1 | dequant_inter = dequant_inter_mmx; |
261 : | |||
262 : | edgomez | 1.16 | quant4_intra = quant4_intra_mmx; |
263 : | Isibaar | 1.1 | dequant4_intra = dequant4_intra_mmx; |
264 : | edgomez | 1.16 | quant4_inter = quant4_inter_mmx; |
265 : | Isibaar | 1.1 | dequant4_inter = dequant4_inter_mmx; |
266 : | |||
267 : | edgomez | 1.16 | /* Block related functions */ |
268 : | Isibaar | 1.1 | transfer_8to16copy = transfer_8to16copy_mmx; |
269 : | transfer_16to8copy = transfer_16to8copy_mmx; | ||
270 : | edgomez | 1.16 | transfer_8to16sub = transfer_8to16sub_mmx; |
271 : | edgomez | 1.22 | transfer_8to16sub2 = transfer_8to16sub2_mmx; |
272 : | edgomez | 1.16 | transfer_16to8add = transfer_16to8add_mmx; |
273 : | transfer8x8_copy = transfer8x8_copy_mmx; | ||
274 : | edgomez | 1.22 | |
275 : | edgomez | 1.16 | |
276 : | /* Image Interpolation related functions */ | ||
277 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_mmx; | ||
278 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; | ||
279 : | Isibaar | 1.1 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_mmx; |
280 : | |||
281 : | edgomez | 1.16 | /* Image RGB->YV12 related functions */ |
282 : | Isibaar | 1.1 | rgb24_to_yv12 = rgb24_to_yv12_mmx; |
283 : | rgb32_to_yv12 = rgb32_to_yv12_mmx; | ||
284 : | edgomez | 1.16 | yuv_to_yv12 = yuv_to_yv12_mmx; |
285 : | yuyv_to_yv12 = yuyv_to_yv12_mmx; | ||
286 : | uyvy_to_yv12 = uyvy_to_yv12_mmx; | ||
287 : | Isibaar | 1.1 | |
288 : | edgomez | 1.16 | /* Image YV12->RGB related functions */ |
289 : | Isibaar | 1.1 | yv12_to_rgb24 = yv12_to_rgb24_mmx; |
290 : | yv12_to_rgb32 = yv12_to_rgb32_mmx; | ||
291 : | edgomez | 1.16 | yv12_to_yuyv = yv12_to_yuyv_mmx; |
292 : | yv12_to_uyvy = yv12_to_uyvy_mmx; | ||
293 : | Isibaar | 1.1 | |
294 : | edgomez | 1.16 | /* Motion estimation related functions */ |
295 : | Isibaar | 1.1 | calc_cbp = calc_cbp_mmx; |
296 : | edgomez | 1.16 | sad16 = sad16_mmx; |
297 : | sad8 = sad8_mmx; | ||
298 : | suxen_drol | 1.33 | sad16bi = sad16bi_mmx; |
299 : | sad8bi = sad8bi_mmx; | ||
300 : | edgomez | 1.16 | dev16 = dev16_mmx; |
301 : | Isibaar | 1.1 | |
302 : | } | ||
303 : | |||
304 : | suxen_drol | 1.33 | /* these 3dnow functions are faster than mmx, but slower than xmm. */ |
305 : | if ((cpu_flags & XVID_CPU_3DNOW) > 0) { | ||
306 : | |||
307 : | /* ME functions */ | ||
308 : | sad16bi = sad16bi_3dn; | ||
309 : | sad8bi = sad8bi_3dn; | ||
310 : | } | ||
311 : | |||
312 : | |||
313 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_MMXEXT) > 0) { |
314 : | edgomez | 1.16 | |
315 : | /* Inverse DCT */ | ||
316 : | Isibaar | 1.1 | idct = idct_xmm; |
317 : | edgomez | 1.16 | |
318 : | /* Interpolation */ | ||
319 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_xmm; | ||
320 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; | ||
321 : | h | 1.3 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
322 : | Isibaar | 1.25 | |
323 : | chenm001 | 1.29 | /* Quantization */ |
324 : | dequant_intra = dequant_intra_xmm; | ||
325 : | dequant_inter = dequant_inter_xmm; | ||
326 : | |||
327 : | edgomez | 1.19 | /* Buffer transfer */ |
328 : | transfer_8to16sub2 = transfer_8to16sub2_xmm; | ||
329 : | edgomez | 1.16 | |
330 : | /* Colorspace transformation */ | ||
331 : | Isibaar | 1.1 | yuv_to_yv12 = yuv_to_yv12_xmm; |
332 : | |||
333 : | edgomez | 1.16 | /* ME functions */ |
334 : | Isibaar | 1.1 | sad16 = sad16_xmm; |
335 : | suxen_drol | 1.33 | sad8 = sad8_xmm; |
336 : | chenm001 | 1.29 | sad16bi = sad16bi_xmm; |
337 : | suxen_drol | 1.33 | sad8bi = sad8bi_xmm; |
338 : | Isibaar | 1.1 | dev16 = dev16_xmm; |
339 : | |||
340 : | } | ||
341 : | |||
342 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_3DNOW) > 0) { |
343 : | edgomez | 1.16 | |
344 : | /* Interpolation */ | ||
345 : | Isibaar | 1.1 | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn; |
346 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dn; | ||
347 : | h | 1.4 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
348 : | Isibaar | 1.1 | } |
349 : | |||
350 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_SSE2) > 0) { |
351 : | Isibaar | 1.14 | #ifdef EXPERIMENTAL_SSE2_CODE |
352 : | edgomez | 1.16 | |
353 : | chenm001 | 1.29 | calc_cbp = calc_cbp_sse2; |
354 : | |||
355 : | edgomez | 1.16 | /* Quantization */ |
356 : | quant_intra = quant_intra_sse2; | ||
357 : | Isibaar | 1.14 | dequant_intra = dequant_intra_sse2; |
358 : | edgomez | 1.16 | quant_inter = quant_inter_sse2; |
359 : | Isibaar | 1.14 | dequant_inter = dequant_inter_sse2; |
360 : | h | 1.13 | |
361 : | edgomez | 1.16 | /* ME */ |
362 : | sad16 = sad16_sse2; | ||
363 : | dev16 = dev16_sse2; | ||
364 : | |||
365 : | /* Forward and Inverse DCT */ | ||
366 : | idct = idct_sse2; | ||
367 : | Isibaar | 1.14 | fdct = fdct_sse2; |
368 : | #endif | ||
369 : | h | 1.12 | } |
370 : | edgomez | 1.16 | |
371 : | Isibaar | 1.1 | #endif |
372 : | Isibaar | 1.18 | |
373 : | #ifdef ARCH_IA64 | ||
374 : | if ((cpu_flags & XVID_CPU_IA64) > 0) { //use assembler routines? | ||
375 : | idct_ia64_init(); | ||
376 : | fdct = fdct_ia64; | ||
377 : | idct = idct_ia64; //not yet working, crashes | ||
378 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64; | ||
379 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64; | ||
380 : | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64; | ||
381 : | sad16 = sad16_ia64; | ||
382 : | sad16bi = sad16bi_ia64; | ||
383 : | sad8 = sad8_ia64; | ||
384 : | dev16 = dev16_ia64; | ||
385 : | ia64p | 1.30 | Halfpel8_Refine = Halfpel8_Refine_ia64; |
386 : | Isibaar | 1.18 | quant_intra = quant_intra_ia64; |
387 : | dequant_intra = dequant_intra_ia64; | ||
388 : | quant_inter = quant_inter_ia64; | ||
389 : | dequant_inter = dequant_inter_ia64; | ||
390 : | transfer_8to16copy = transfer_8to16copy_ia64; | ||
391 : | transfer_16to8copy = transfer_16to8copy_ia64; | ||
392 : | transfer_8to16sub = transfer_8to16sub_ia64; | ||
393 : | transfer_8to16sub2 = transfer_8to16sub2_ia64; | ||
394 : | transfer_16to8add = transfer_16to8add_ia64; | ||
395 : | transfer8x8_copy = transfer8x8_copy_ia64; | ||
396 : | DEBUG("Using IA-64 assembler routines.\n"); | ||
397 : | } | ||
398 : | #endif | ||
399 : | edgomez | 1.16 | |
400 : | canard | 1.5 | #ifdef ARCH_PPC |
401 : | canard | 1.6 | #ifdef ARCH_PPC_ALTIVEC |
402 : | calc_cbp = calc_cbp_altivec; | ||
403 : | canard | 1.7 | fdct = fdct_altivec; |
404 : | idct = idct_altivec; | ||
405 : | canard | 1.10 | sadInit = sadInit_altivec; |
406 : | canard | 1.8 | sad16 = sad16_altivec; |
407 : | sad8 = sad8_altivec; | ||
408 : | dev16 = dev16_altivec; | ||
409 : | canard | 1.6 | #else |
410 : | canard | 1.5 | calc_cbp = calc_cbp_ppc; |
411 : | canard | 1.6 | #endif |
412 : | canard | 1.5 | #endif |
413 : | Isibaar | 1.1 | |
414 : | return XVID_ERR_OK; | ||
415 : | } | ||
416 : | |||
417 : | edgomez | 1.16 | /***************************************************************************** |
418 : | * XviD Native decoder entry point | ||
419 : | * | ||
420 : | * This function is just a wrapper to all the option cases. | ||
421 : | * | ||
422 : | * Returned values : XVID_ERR_FAIL when opt is invalid | ||
423 : | * else returns the wrapped function result | ||
424 : | * | ||
425 : | ****************************************************************************/ | ||
426 : | |||
427 : | edgomez | 1.15 | int |
428 : | xvid_decore(void *handle, | ||
429 : | int opt, | ||
430 : | void *param1, | ||
431 : | void *param2) | ||
432 : | Isibaar | 1.1 | { |
433 : | edgomez | 1.15 | switch (opt) { |
434 : | case XVID_DEC_DECODE: | ||
435 : | return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1); | ||
436 : | |||
437 : | case XVID_DEC_CREATE: | ||
438 : | chenm001 | 1.29 | return decoder_create((XVID_DEC_PARAM *) param1); |
439 : | edgomez | 1.15 | |
440 : | case XVID_DEC_DESTROY: | ||
441 : | return decoder_destroy((DECODER *) handle); | ||
442 : | Isibaar | 1.1 | |
443 : | default: | ||
444 : | edgomez | 1.15 | return XVID_ERR_FAIL; |
445 : | } | ||
446 : | Isibaar | 1.1 | } |
447 : | |||
448 : | edgomez | 1.16 | |
449 : | /***************************************************************************** | ||
450 : | * XviD Native encoder entry point | ||
451 : | * | ||
452 : | * This function is just a wrapper to all the option cases. | ||
453 : | * | ||
454 : | * Returned values : XVID_ERR_FAIL when opt is invalid | ||
455 : | * else returns the wrapped function result | ||
456 : | * | ||
457 : | ****************************************************************************/ | ||
458 : | Isibaar | 1.1 | |
459 : | edgomez | 1.15 | int |
460 : | xvid_encore(void *handle, | ||
461 : | int opt, | ||
462 : | void *param1, | ||
463 : | void *param2) | ||
464 : | Isibaar | 1.1 | { |
465 : | edgomez | 1.15 | switch (opt) { |
466 : | case XVID_ENC_ENCODE: | ||
467 : | return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1, | ||
468 : | (XVID_ENC_STATS *) param2); | ||
469 : | |||
470 : | case XVID_ENC_CREATE: | ||
471 : | return encoder_create((XVID_ENC_PARAM *) param1); | ||
472 : | |||
473 : | case XVID_ENC_DESTROY: | ||
474 : | return encoder_destroy((Encoder *) handle); | ||
475 : | Isibaar | 1.1 | |
476 : | default: | ||
477 : | edgomez | 1.15 | return XVID_ERR_FAIL; |
478 : | } | ||
479 : | Isibaar | 1.1 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |