37 |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
38 |
* - 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> |
39 |
* |
* |
40 |
* $Id: xvid.c,v 1.33.2.11 2002-11-07 10:28:15 suxen_drol Exp $ |
* $Id: xvid.c,v 1.33.2.13 2002-11-08 10:10:48 suxen_drol Exp $ |
41 |
* |
* |
42 |
****************************************************************************/ |
****************************************************************************/ |
43 |
|
|
140 |
* |
* |
141 |
****************************************************************************/ |
****************************************************************************/ |
142 |
|
|
143 |
int |
|
144 |
xvid_init(void *handle, |
static |
145 |
int opt, |
int xvid_init_init(XVID_INIT_PARAM * init_param) |
|
void *param1, |
|
|
void *param2) |
|
146 |
{ |
{ |
147 |
int cpu_flags; |
int cpu_flags; |
|
XVID_INIT_PARAM *init_param; |
|
|
|
|
|
init_param = (XVID_INIT_PARAM *) param1; |
|
148 |
|
|
149 |
/* Inform the client the API version */ |
/* Inform the client the API version */ |
150 |
init_param->api_version = API_VERSION; |
init_param->api_version = API_VERSION; |
396 |
/* Colorspace transformation */ |
/* Colorspace transformation */ |
397 |
yv12_to_yv12 = yv12_to_yv12_xmm; |
yv12_to_yv12 = yv12_to_yv12_xmm; |
398 |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
399 |
uyvy_to_yv12 = yuyv_to_yv12_xmm; |
uyvy_to_yv12 = uyvy_to_yv12_xmm; |
400 |
|
|
401 |
/* ME functions */ |
/* ME functions */ |
402 |
sad16 = sad16_xmm; |
sad16 = sad16_xmm; |
482 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
483 |
} |
} |
484 |
|
|
485 |
|
|
486 |
|
|
487 |
|
static int |
488 |
|
xvid_init_convert(XVID_INIT_CONVERTINFO* convert) |
489 |
|
{ |
490 |
|
const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP); |
491 |
|
const int width = convert->width; |
492 |
|
const int height = convert->height; |
493 |
|
const int width2 = convert->width/2; |
494 |
|
const int height2 = convert->height/2; |
495 |
|
IMAGE img; |
496 |
|
|
497 |
|
switch (convert->input.colorspace & ~XVID_CSP_VFLIP) |
498 |
|
{ |
499 |
|
case XVID_CSP_YV12 : |
500 |
|
img.y = convert->input.y; |
501 |
|
img.v = (uint8_t*)convert->input.y + width*height; |
502 |
|
img.u = (uint8_t*)convert->input.y + width*height + width2*height2; |
503 |
|
image_output(&img, width, height, width, |
504 |
|
convert->output.y, convert->output.y_stride, |
505 |
|
convert->output.colorspace, convert->interlacing); |
506 |
|
break; |
507 |
|
|
508 |
|
default : |
509 |
|
return XVID_ERR_FORMAT; |
510 |
|
} |
511 |
|
|
512 |
|
|
513 |
|
emms(); |
514 |
|
return XVID_ERR_OK; |
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
int |
519 |
|
xvid_init(void *handle, |
520 |
|
int opt, |
521 |
|
void *param1, |
522 |
|
void *param2) |
523 |
|
{ |
524 |
|
switch(opt) |
525 |
|
{ |
526 |
|
case XVID_INIT_INIT : |
527 |
|
return xvid_init_init((XVID_INIT_PARAM*)param1); |
528 |
|
|
529 |
|
case XVID_INIT_CONVERT : |
530 |
|
return xvid_init_convert((XVID_INIT_CONVERTINFO*)param1); |
531 |
|
|
532 |
|
default : |
533 |
|
return XVID_ERR_FAIL; |
534 |
|
} |
535 |
|
} |
536 |
|
|
537 |
/***************************************************************************** |
/***************************************************************************** |
538 |
* XviD Native decoder entry point |
* XviD Native decoder entry point |
539 |
* |
* |