26 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
*****************************************************************************/ |
****************************************************************************/ |
30 |
/***************************************************************************** |
/***************************************************************************** |
31 |
* |
* |
32 |
* History |
* History |
33 |
* |
* |
34 |
|
* - 23.06.2002 added XVID_CPU_CHKONLY |
35 |
* - 17.03.2002 Added interpolate8x8_halfpel_hv_xmm |
* - 17.03.2002 Added interpolate8x8_halfpel_hv_xmm |
36 |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
37 |
* - 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
* - 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
38 |
* |
* |
39 |
* $Id: xvid.c,v 1.16 2002-06-13 13:18:57 edgomez Exp $ |
* $Id: xvid.c,v 1.28 2002-07-09 01:44:44 chenm001 Exp $ |
40 |
* |
* |
41 |
*****************************************************************************/ |
****************************************************************************/ |
42 |
|
|
43 |
#include "xvid.h" |
#include "xvid.h" |
44 |
#include "decoder.h" |
#include "decoder.h" |
81 |
|
|
82 |
init_param = (XVID_INIT_PARAM *) param1; |
init_param = (XVID_INIT_PARAM *) param1; |
83 |
|
|
84 |
|
/* Inform the client the API version */ |
85 |
|
init_param->api_version = API_VERSION; |
86 |
|
|
87 |
|
/* Inform the client the core build - unused because we're still alpha */ |
88 |
|
init_param->core_build = 1000; |
89 |
|
|
90 |
|
printf("init_param->cpu_flags %x\n",init_param->cpu_flags);//NIC |
91 |
|
|
92 |
|
if ((init_param->cpu_flags & XVID_CPU_CHKONLY)) |
93 |
|
{ |
94 |
|
//init_param->cpu_flags = check_cpu_features();//nic |
95 |
|
return XVID_ERR_OK; |
96 |
|
} |
97 |
|
|
98 |
/* Do we have to force CPU features ? */ |
/* Do we have to force CPU features ? */ |
99 |
if ((init_param->cpu_flags & XVID_CPU_FORCE) > 0) { |
if ((init_param->cpu_flags & XVID_CPU_FORCE) > 0) { |
100 |
cpu_flags = init_param->cpu_flags; |
cpu_flags = init_param->cpu_flags; |
101 |
} else { |
} else { |
102 |
|
|
103 |
#ifdef ARCH_X86 |
//cpu_flags = check_cpu_features();//nic |
|
cpu_flags = check_cpu_features(); |
|
|
#else |
|
|
cpu_flags = 0; |
|
|
#endif |
|
104 |
init_param->cpu_flags = cpu_flags; |
init_param->cpu_flags = cpu_flags; |
105 |
} |
} |
106 |
|
|
195 |
transfer_8to16copy = transfer_8to16copy_mmx; |
transfer_8to16copy = transfer_8to16copy_mmx; |
196 |
transfer_16to8copy = transfer_16to8copy_mmx; |
transfer_16to8copy = transfer_16to8copy_mmx; |
197 |
transfer_8to16sub = transfer_8to16sub_mmx; |
transfer_8to16sub = transfer_8to16sub_mmx; |
198 |
|
transfer_8to16sub2 = transfer_8to16sub2_mmx; |
199 |
transfer_16to8add = transfer_16to8add_mmx; |
transfer_16to8add = transfer_16to8add_mmx; |
200 |
transfer8x8_copy = transfer8x8_copy_mmx; |
transfer8x8_copy = transfer8x8_copy_mmx; |
201 |
|
|
202 |
|
|
203 |
/* Image Interpolation related functions */ |
/* Image Interpolation related functions */ |
204 |
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_mmx; |
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_mmx; |
205 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; |
236 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
237 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
238 |
|
|
239 |
|
/* Buffer transfer */ |
240 |
|
transfer_8to16sub2 = transfer_8to16sub2_xmm; |
241 |
|
|
242 |
/* Colorspace transformation */ |
/* Colorspace transformation */ |
243 |
yuv_to_yv12 = yuv_to_yv12_xmm; |
yuv_to_yv12 = yuv_to_yv12_xmm; |
244 |
|
|
279 |
|
|
280 |
#endif |
#endif |
281 |
|
|
282 |
|
#ifdef ARCH_IA64 |
283 |
|
if ((cpu_flags & XVID_CPU_IA64) > 0) { //use assembler routines? |
284 |
|
idct_ia64_init(); |
285 |
|
fdct = fdct_ia64; |
286 |
|
idct = idct_ia64; //not yet working, crashes |
287 |
|
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64; |
288 |
|
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64; |
289 |
|
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64; |
290 |
|
sad16 = sad16_ia64; |
291 |
|
sad16bi = sad16bi_ia64; |
292 |
|
sad8 = sad8_ia64; |
293 |
|
dev16 = dev16_ia64; |
294 |
|
quant_intra = quant_intra_ia64; |
295 |
|
dequant_intra = dequant_intra_ia64; |
296 |
|
quant_inter = quant_inter_ia64; |
297 |
|
dequant_inter = dequant_inter_ia64; |
298 |
|
transfer_8to16copy = transfer_8to16copy_ia64; |
299 |
|
transfer_16to8copy = transfer_16to8copy_ia64; |
300 |
|
transfer_8to16sub = transfer_8to16sub_ia64; |
301 |
|
transfer_8to16sub2 = transfer_8to16sub2_ia64; |
302 |
|
transfer_16to8add = transfer_16to8add_ia64; |
303 |
|
transfer8x8_copy = transfer8x8_copy_ia64; |
304 |
|
DEBUG("Using IA-64 assembler routines.\n"); |
305 |
|
} |
306 |
|
#endif |
307 |
|
|
308 |
#ifdef ARCH_PPC |
#ifdef ARCH_PPC |
309 |
#ifdef ARCH_PPC_ALTIVEC |
#ifdef ARCH_PPC_ALTIVEC |
310 |
calc_cbp = calc_cbp_altivec; |
calc_cbp = calc_cbp_altivec; |
319 |
#endif |
#endif |
320 |
#endif |
#endif |
321 |
|
|
|
/* Inform the client the API version */ |
|
|
init_param->api_version = API_VERSION; |
|
|
|
|
|
/* Inform the client the core build - unused because we're still alpha */ |
|
|
init_param->core_build = 1000; |
|
|
|
|
322 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
323 |
} |
} |
324 |
|
|
343 |
return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1); |
return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1); |
344 |
|
|
345 |
case XVID_DEC_CREATE: |
case XVID_DEC_CREATE: |
346 |
return decoder_create((XVID_DEC_PARAM *) param1); |
/* *************************************************************************** |
347 |
|
NIC uso il secondo parametro 'param2' ma in realta` non so bene per cosa e` |
348 |
|
stato pensato ..... e quindi in futuro potrebbe essere un problema |
349 |
|
*************************************************************************** */ |
350 |
|
if(param2!=NULL) |
351 |
|
return IM1_decoder_create((XVID_DEC_PARAM *) param1,(XVID_DEC_FRAME *) param2); |
352 |
|
else |
353 |
|
return decoder_create((XVID_DEC_PARAM *) param1); //NIC commentata |
354 |
|
|
355 |
case XVID_DEC_DESTROY: |
case XVID_DEC_DESTROY: |
356 |
return decoder_destroy((DECODER *) handle); |
return decoder_destroy((DECODER *) handle); |
379 |
{ |
{ |
380 |
switch (opt) { |
switch (opt) { |
381 |
case XVID_ENC_ENCODE: |
case XVID_ENC_ENCODE: |
382 |
|
#ifdef BFRAMES |
383 |
|
if (((Encoder *) handle)->mbParam.max_bframes >= 0) |
384 |
|
return encoder_encode_bframes((Encoder *) handle, (XVID_ENC_FRAME *) param1, |
385 |
|
(XVID_ENC_STATS *) param2); |
386 |
|
else |
387 |
|
#endif |
388 |
return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1, |
return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1, |
389 |
(XVID_ENC_STATS *) param2); |
(XVID_ENC_STATS *) param2); |
390 |
|
|