From: Miguel F. <mig...@us...> - 2003-09-26 21:57:09
|
Update of /cvsroot/xine/xine-lib/src/xine-engine In directory sc8-pr-cvs1:/tmp/cvs-serv17487/src/xine-engine Modified Files: Tag: xvmc post.c video_out.c video_out.h Log Message: add xvmc patch by Jack Steven Kelliher (with a lot of changes) note: xvmc branch Index: post.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/post.c,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -r1.14 -r1.14.2.1 --- post.c 15 Aug 2003 14:38:04 -0000 1.14 +++ post.c 26 Sep 2003 21:56:54 -0000 1.14.2.1 @@ -91,7 +91,6 @@ return port->original_port->set_property(port->original_port, property, value); } - post_video_port_t *post_intercept_video_port(post_plugin_t *post, xine_video_port_t *original) { post_video_port_t *post_port = (post_video_port_t *)malloc(sizeof(post_video_port_t)); @@ -158,6 +157,33 @@ vo_img->dispose(vo_img); } +static void post_frame_proc_macro_block(int x, + int y, + int mb_type, + int motion_type, + int (*mv_field_sel)[2], + int *dmvector, + int cbp, + int dct_type, + vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, + int picture_structure, + int second_field, + int (*f_mot_pmv)[2], + int (*b_mot_pmv)[2]) { + post_video_port_t *port = (post_video_port_t *)current_frame->port; + post_restore_video_frame(current_frame, port); + post_restore_video_frame(forward_ref_frame, port); + post_restore_video_frame(backward_ref_frame, port); + current_frame->proc_macro_block(x, y, mb_type, motion_type, mv_field_sel, + dmvector, cbp, dct_type, current_frame, + forward_ref_frame, backward_ref_frame, + picture_structure, second_field, + f_mot_pmv, b_mot_pmv); +} + + void post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) { port->original_frame.port = frame->port; @@ -167,6 +193,7 @@ port->original_frame.draw = frame->draw; port->original_frame.lock = frame->lock; port->original_frame.dispose = frame->dispose; + port->original_frame.proc_macro_block = frame->proc_macro_block; frame->port = &port->port; frame->free = post_frame_free; @@ -175,6 +202,7 @@ frame->draw = post_frame_draw; frame->lock = post_frame_lock; frame->dispose = post_frame_dispose; + frame->proc_macro_block = post_frame_proc_macro_block; } void post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) { @@ -185,6 +213,7 @@ frame->draw = port->original_frame.draw; frame->lock = port->original_frame.lock; frame->dispose = port->original_frame.dispose; + frame->proc_macro_block = port->original_frame.proc_macro_block; } Index: video_out.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/video_out.c,v retrieving revision 1.171 retrieving revision 1.171.2.1 diff -u -r1.171 -r1.171.2.1 --- video_out.c 13 Sep 2003 16:15:38 -0000 1.171 +++ video_out.c 26 Sep 2003 21:56:54 -0000 1.171.2.1 @@ -47,7 +47,11 @@ #define LOG */ +#ifdef HAVE_XVMC +#define NUM_FRAME_BUFFERS (MAX_NUM_FRAME_BUFS) +#else #define NUM_FRAME_BUFFERS 15 +#endif typedef struct { @@ -298,6 +302,7 @@ img->progressive_frame = 0; img->repeat_first_field = 0; img->top_field_first = 1; + img->macroblocks = NULL; extra_info_reset ( img->extra_info ); /* let driver ensure this image has the right format */ Index: video_out.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/video_out.h,v retrieving revision 1.96 retrieving revision 1.96.2.1 diff -u -r1.96 -r1.96.2.1 --- video_out.h 15 Aug 2003 14:35:09 -0000 1.96 +++ video_out.h 26 Sep 2003 21:56:54 -0000 1.96.2.1 @@ -52,6 +52,12 @@ #include <inttypes.h> #include <pthread.h> +#ifdef HAVE_XVMC +#define MAX_NUM_FRAME_BUFS 15 +#else +#define MAX_NUM_FRAME_BUFS 5000 +#endif + typedef struct vo_frame_s vo_frame_t; typedef struct img_buf_fifo_s img_buf_fifo_t; typedef struct vo_overlay_s vo_overlay_t; @@ -70,6 +76,13 @@ * adaption of the post plugin decoration layer. Be sure to look into * src/xine-engine/post.[ch]. */ + +typedef struct xine_macroblock_s { + short *blockptr; // pointer to current dct block + short *blockbaseptr; // pointer to base of dct block array in blocks + short xvmc_accel; // type of acceleration supported +} xine_macroblocks_t; + struct vo_frame_s { /* * member functions @@ -97,6 +110,23 @@ /* free memory/resources for this frame */ void (*dispose) (vo_frame_t *vo_img); + + /* XvMC routine for rendering macroblocks */ + void (*proc_macro_block)(int x, + int y, + int mb_type, + int motion_type, + int (*mv_field_sel)[2], + int *dmvector, + int cbp, + int dct_type, + vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, + int picture_structure, + int second_field, + int (*f_mot_pmv)[2], + int (*b_mot_pmv)[2]); /* * public variables to decoders and vo drivers @@ -119,6 +149,7 @@ * that reason, this flag should be interpreted as a "hint". */ int progressive_frame; + int picture_coding_type; /* pan/scan offset */ int pan_scan_x; @@ -136,6 +167,9 @@ int flags; /* remember the frame flags */ int copy_called; /* track use of copy() method */ + /* used to carry macroblocks information for XvMC acceleration */ + xine_macroblocks_t *macroblocks; + /* "backward" references to where this frame originates from */ xine_video_port_t *port; vo_driver_t *driver; @@ -151,7 +185,6 @@ int id; /* debugging - track this frame */ int is_first; - }; /* @@ -248,11 +281,12 @@ /* get_frame flags */ -#define VO_TOP_FIELD 1 -#define VO_BOTTOM_FIELD 2 -#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD) -#define VO_PAN_SCAN_FLAG 4 -#define VO_INTERLACED_FLAG 8 +#define VO_TOP_FIELD 1 +#define VO_BOTTOM_FIELD 2 +#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD) +#define VO_PAN_SCAN_FLAG 4 +#define VO_INTERLACED_FLAG 8 +#define VO_NEW_SEQUENCE_FLAG 16 /* set after MPEG2 Sequence Header Code (used by XvMC) */ /* video driver capabilities */ @@ -269,6 +303,34 @@ #define VO_CAP_CONTRAST 0x00000080 /* driver can set CONTRAST value */ #define VO_CAP_COLORKEY 0x00000100 /* driver can set COLORKEY value */ #define VO_CAP_AUTOPAINT_COLORKEY 0x00000200 /* driver can set AUTOPAINT_COLORKEY value */ +#define VO_CAP_XVMC_MOCOMP 0x00000400 /* driver can set XvMC motion compensation */ +#define VO_CAP_XVMC_IDCT 0x00000800 /* driver can use XvMC idct acceleration */ + +/* macroblock modes */ +#define XINE_MACROBLOCK_INTRA 1 +#define XINE_MACROBLOCK_PATTERN 2 +#define XINE_MACROBLOCK_MOTION_BACKWARD 4 +#define XINE_MACROBLOCK_MOTION_FORWARD 8 +#define XINE_MACROBLOCK_QUANT 16 +#define XINE_MACROBLOCK_DCT_TYPE_INTERLACED 32 + +/* motion types */ +#define XINE_MC_FIELD 1 +#define XINE_MC_FRAME 2 +#define XINE_MC_16X8 2 +#define XINE_MC_DMV 3 + +/* picture coding type */ +#define XINE_PICT_I_TYPE 1 +#define XINE_PICT_P_TYPE 2 +#define XINE_PICT_B_TYPE 3 +#define XINE_PICT_D_TYPE 4 + +/* xvmc acceleration types */ +#define XINE_VO_MOTION_ACCEL 1 +#define XINE_VO_IDCT_ACCEL 2 +#define XINE_VO_SIGNED_INTRA 4 + /* * vo_driver_s contains the functions every display driver |