49 |
#include "dct/fdct.h" |
#include "dct/fdct.h" |
50 |
#include "image/colorspace.h" |
#include "image/colorspace.h" |
51 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
52 |
|
#include "image/reduced.h" |
53 |
#include "utils/mem_transfer.h" |
#include "utils/mem_transfer.h" |
54 |
#include "utils/mbfunctions.h" |
#include "utils/mbfunctions.h" |
55 |
#include "quant/quant_h263.h" |
#include "quant/quant_h263.h" |
141 |
* |
* |
142 |
****************************************************************************/ |
****************************************************************************/ |
143 |
|
|
144 |
int |
|
145 |
xvid_init(void *handle, |
static |
146 |
int opt, |
int xvid_init_init(XVID_INIT_PARAM * init_param) |
|
void *param1, |
|
|
void *param2) |
|
147 |
{ |
{ |
148 |
int cpu_flags; |
int cpu_flags; |
|
XVID_INIT_PARAM *init_param; |
|
|
|
|
|
init_param = (XVID_INIT_PARAM *) param1; |
|
149 |
|
|
150 |
/* Inform the client the API version */ |
/* Inform the client the API version */ |
151 |
init_param->api_version = API_VERSION; |
init_param->api_version = API_VERSION; |
235 |
interpolate8x8_avg2 = interpolate8x8_avg2_c; |
interpolate8x8_avg2 = interpolate8x8_avg2_c; |
236 |
interpolate8x8_avg4 = interpolate8x8_avg4_c; |
interpolate8x8_avg4 = interpolate8x8_avg4_c; |
237 |
|
|
238 |
|
/* reduced resoltuion */ |
239 |
|
|
240 |
|
#ifdef ARCH_X86 |
241 |
|
vfilter_31 = xvid_VFilter_31_x86; |
242 |
|
hfilter_31 = xvid_HFilter_31_x86; |
243 |
|
#else |
244 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_C; |
245 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_C; |
246 |
|
vfilter_31 = xvid_VFilter_31_C; |
247 |
|
hfilter_31 = xvid_HFilter_31_C; |
248 |
|
#endif |
249 |
|
|
250 |
/* Initialize internal colorspace transformation tables */ |
/* Initialize internal colorspace transformation tables */ |
251 |
colorspace_init(); |
colorspace_init(); |
252 |
|
|
347 |
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_mmx; |
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_mmx; |
348 |
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_mmx; |
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_mmx; |
349 |
|
|
350 |
// interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
351 |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
352 |
|
|
353 |
|
/* reduced resolution */ |
354 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_mmx; |
355 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_mmx; |
356 |
|
hfilter_31 = xvid_HFilter_31_mmx; |
357 |
|
|
358 |
/* image input xxx_to_yv12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
359 |
yv12_to_yv12 = yv12_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
360 |
bgr_to_yv12 = bgr_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
404 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
405 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
406 |
|
|
407 |
|
/* reduced resolution */ |
408 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_xmm; |
409 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_xmm; |
410 |
|
|
411 |
/* Quantization */ |
/* Quantization */ |
412 |
dequant_intra = dequant_intra_xmm; |
dequant_intra = dequant_intra_xmm; |
413 |
dequant_inter = dequant_inter_xmm; |
dequant_inter = dequant_inter_xmm; |
504 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
505 |
} |
} |
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
static int |
510 |
|
xvid_init_convert(XVID_INIT_CONVERTINFO* convert) |
511 |
|
{ |
512 |
|
const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP); |
513 |
|
const int width = convert->width; |
514 |
|
const int height = convert->height; |
515 |
|
const int width2 = convert->width/2; |
516 |
|
const int height2 = convert->height/2; |
517 |
|
IMAGE img; |
518 |
|
|
519 |
|
switch (convert->input.colorspace & ~XVID_CSP_VFLIP) |
520 |
|
{ |
521 |
|
case XVID_CSP_YV12 : |
522 |
|
img.y = convert->input.y; |
523 |
|
img.v = (uint8_t*)convert->input.y + width*height; |
524 |
|
img.u = (uint8_t*)convert->input.y + width*height + width2*height2; |
525 |
|
image_output(&img, width, height, width, |
526 |
|
convert->output.y, convert->output.y_stride, |
527 |
|
convert->output.colorspace, convert->interlacing); |
528 |
|
break; |
529 |
|
|
530 |
|
default : |
531 |
|
return XVID_ERR_FORMAT; |
532 |
|
} |
533 |
|
|
534 |
|
|
535 |
|
emms(); |
536 |
|
return XVID_ERR_OK; |
537 |
|
} |
538 |
|
|
539 |
|
|
540 |
|
int |
541 |
|
xvid_init(void *handle, |
542 |
|
int opt, |
543 |
|
void *param1, |
544 |
|
void *param2) |
545 |
|
{ |
546 |
|
switch(opt) |
547 |
|
{ |
548 |
|
case XVID_INIT_INIT : |
549 |
|
return xvid_init_init((XVID_INIT_PARAM*)param1); |
550 |
|
|
551 |
|
case XVID_INIT_CONVERT : |
552 |
|
return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1); |
553 |
|
|
554 |
|
default : |
555 |
|
return XVID_ERR_FAIL; |
556 |
|
} |
557 |
|
} |
558 |
|
|
559 |
/***************************************************************************** |
/***************************************************************************** |
560 |
* XviD Native decoder entry point |
* XviD Native decoder entry point |
561 |
* |
* |