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