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