summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-09-28 18:49:38 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-09-28 18:49:38 +0000
commitfe2a390351727cb5ae264588293f8bd7d6d5198e (patch)
tree20c91e59d361585dd0d8d45440a96c807ea7dddb /src/xine-engine
parentf42eccd3e7c5a717f668f0b832ace09f161dbfbc (diff)
downloadxine-lib-fe2a390351727cb5ae264588293f8bd7d6d5198e.tar.gz
xine-lib-fe2a390351727cb5ae264588293f8bd7d6d5198e.tar.bz2
xxmc patch by Thomas Hellstrom (with some changes)
there is still some work to do, please report any breakages. note: new xxmc driver tested with both nvidia and via libraries. CVS patchset: 7007 CVS date: 2004/09/28 18:49:38
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am3
-rw-r--r--src/xine-engine/accel_xvmc.h152
-rw-r--r--src/xine-engine/post.c36
-rw-r--r--src/xine-engine/video_out.c60
-rw-r--r--src/xine-engine/video_out.h61
5 files changed, 198 insertions, 114 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 61f4163c4..696a501b6 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -28,7 +28,8 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
input_rip.c info_helper.c
# FIXME: these are currently unused:
-EXTRA_DIST = lrb.c lrb.h
+EXTRA_DIST = lrb.c lrb.h accel_xvmc.h
+
libxine_la_DEPENDENCIES = @INTLLIBS@ $(XINEUTILS_LIB) $(zlib_dep) \
$(dirent_lib) $(pthread_dep) $(LIBXINEPOSIX)
diff --git a/src/xine-engine/accel_xvmc.h b/src/xine-engine/accel_xvmc.h
new file mode 100644
index 000000000..ea10a40ff
--- /dev/null
+++ b/src/xine-engine/accel_xvmc.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2004 the Unichrome project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: accel_xvmc.h,v 1.1 2004/09/28 18:49:40 miguelfreitas Exp $
+ *
+ *
+ * Common acceleration definitions for XvMC.
+ *
+ *
+ */
+
+#ifndef HAVE_XINE_ACCEL_H
+#define HAVE_XINE_ACCEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+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;
+
+typedef struct xine_vld_frame_s {
+ int version; /* Backward compatibility */
+ int mv_ranges[2][2];
+ int picture_structure;
+ int picture_coding_type;
+ int intra_dc_precision;
+ int mpeg_coding;
+ int progressive_sequence;
+ int scan;
+ int pred_dct_frame;
+ int concealment_motion_vectors;
+ int q_scale_type;
+ int intra_vlc_format;
+ int second_field;
+ int load_intra_quantizer_matrix;
+ int load_non_intra_quantizer_matrix;
+ uint8_t intra_quantizer_matrix[64];
+ uint8_t non_intra_quantizer_matrix[64];
+ vo_frame_t *backward_reference_frame;
+ vo_frame_t *forward_reference_frame;
+} xine_vld_frame_t;
+
+
+typedef struct xine_xvmc_s {
+ xine_macroblocks_t *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]);
+} xine_xvmc_t ;
+
+typedef struct xine_xxmc_s {
+
+ /*
+ * We inherit the xine_xvmc_t properties.
+ */
+
+ xine_xvmc_t xvmc;
+
+ unsigned format;
+ unsigned mpeg;
+ unsigned acceleration;
+ xine_vld_frame_t vld_frame;
+ uint8_t *slice_data;
+ unsigned slice_data_size;
+ unsigned slice_code;
+ int result;
+ int decoded;
+ float sleep;
+ void (*proc_xxmc_frame) (vo_frame_t *vo_img);
+ void (*proc_xxmc_begin) (vo_frame_t *vo_img);
+ void (*proc_xxmc_slice) (vo_frame_t *vo_img);
+ void (*proc_xxmc_flush) (vo_frame_t *vo_img);
+} xine_xxmc_t;
+
+ /*
+ * Register XvMC stream types here.
+ */
+
+#define XINE_XVMC_MPEG_1 0x00000001
+#define XINE_XVMC_MPEG_2 0x00000002
+#define XINE_XVMC_MPEG_4 0x00000004
+
+ /*
+ * Register XvMC acceleration levels here.
+ */
+
+#define XINE_XVMC_ACCEL_MOCOMP 0x00000001
+#define XINE_XVMC_ACCEL_IDCT 0x00000002
+#define XINE_XVMC_ACCEL_VLD 0x00000004
+
+
+/* xvmc acceleration types */
+#define XINE_VO_MOTION_ACCEL 1
+#define XINE_VO_IDCT_ACCEL 2
+#define XINE_VO_SIGNED_INTRA 4
+
+/* 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
+
+/* 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
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c
index 9f49b2115..5f8eca309 100644
--- a/src/xine-engine/post.c
+++ b/src/xine-engine/post.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: post.c,v 1.26 2004/05/29 14:45:25 mroi Exp $
+ * $Id: post.c,v 1.27 2004/09/28 18:49:40 miguelfreitas Exp $
*/
/*
@@ -345,34 +345,6 @@ static void post_frame_dispose(vo_frame_t *vo_img) {
_x_post_dec_usage(port);
}
-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 = _x_post_video_frame_to_port(current_frame);
-
- if (port->frame_lock) pthread_mutex_lock(port->frame_lock);
- _x_post_frame_copy_down(current_frame, current_frame->next);
- current_frame->next->proc_macro_block(x, y, mb_type, motion_type, mv_field_sel,
- dmvector, cbp, dct_type, current_frame->next,
- forward_ref_frame, backward_ref_frame,
- picture_structure, second_field,
- f_mot_pmv, b_mot_pmv);
- _x_post_frame_copy_up(current_frame, current_frame->next);
- if (port->frame_lock) pthread_mutex_unlock(port->frame_lock);
-}
-
vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) {
vo_frame_t *new_frame;
@@ -397,8 +369,6 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *
port->new_frame->proc_frame ? port->new_frame->proc_frame : NULL;
new_frame->proc_slice =
port->new_frame->proc_slice ? port->new_frame->proc_slice : NULL;
- new_frame->proc_macro_block =
- port->new_frame->proc_macro_block ? port->new_frame->proc_macro_block : NULL;
new_frame->field =
port->new_frame->field ? port->new_frame->field : post_frame_field;
new_frame->draw =
@@ -417,8 +387,6 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *
new_frame->proc_frame = post_frame_proc_frame;
if (frame->proc_slice && !new_frame->proc_slice)
new_frame->proc_slice = post_frame_proc_slice;
- if (frame->proc_macro_block && !new_frame->proc_macro_block)
- new_frame->proc_macro_block = post_frame_proc_macro_block;
}
return new_frame;
@@ -450,7 +418,7 @@ void _x_post_frame_copy_down(vo_frame_t *from, vo_frame_t *to) {
to->progressive_frame = from->progressive_frame;
to->picture_coding_type = from->picture_coding_type;
to->drawn = from->drawn;
- to->macroblocks = from->macroblocks;
+ to->accel_data = from->accel_data;
to->stream = from->stream;
if (to->extra_info != from->extra_info)
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index dfc6aa5b7..b482c2784 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out.c,v 1.206 2004/09/22 20:29:17 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.207 2004/09/28 18:49:40 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -335,7 +335,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->crop_right = 0;
img->crop_top = 0;
img->crop_bottom = 0;
- img->macroblocks = NULL;
+
_x_extra_info_reset ( img->extra_info );
/* let driver ensure this image has the right format */
@@ -615,31 +615,36 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
pthread_mutex_unlock (&dupl->mutex);
- switch (img->format) {
- case XINE_IMGFMT_YV12:
- yv12_to_yv12(
- /* Y */
- img->base[0], img->pitches[0],
- dupl->base[0], dupl->pitches[0],
- /* U */
- img->base[1], img->pitches[1],
- dupl->base[1], dupl->pitches[1],
- /* V */
- img->base[2], img->pitches[2],
- dupl->base[2], dupl->pitches[2],
- /* width x height */
- img->width, img->height);
- break;
- case XINE_IMGFMT_YUY2:
- yuy2_to_yuy2(
- /* src */
- img->base[0], img->pitches[0],
- /* dst */
- dupl->base[0], dupl->pitches[0],
- /* width x height */
- img->width, img->height);
- break;
- }
+ if (dupl->proc_duplicate_frame_data) {
+ dupl->proc_duplicate_frame_data(dupl,img);
+ } else {
+
+ switch (img->format) {
+ case XINE_IMGFMT_YV12:
+ yv12_to_yv12(
+ /* Y */
+ img->base[0], img->pitches[0],
+ dupl->base[0], dupl->pitches[0],
+ /* U */
+ img->base[1], img->pitches[1],
+ dupl->base[1], dupl->pitches[1],
+ /* V */
+ img->base[2], img->pitches[2],
+ dupl->base[2], dupl->pitches[2],
+ /* width x height */
+ img->width, img->height);
+ break;
+ case XINE_IMGFMT_YUY2:
+ yuy2_to_yuy2(
+ /* src */
+ img->base[0], img->pitches[0],
+ /* dst */
+ dupl->base[0], dupl->pitches[0],
+ /* width x height */
+ img->width, img->height);
+ break;
+ }
+ }
dupl->bad_frame = 0;
dupl->pts = 0;
@@ -1661,6 +1666,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon
img = driver->alloc_frame (driver) ;
if (!img) break;
+ img->proc_duplicate_frame_data = NULL;
img->id = i;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index c96307471..ba35e2e2a 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out.h,v 1.110 2004/09/26 22:54:52 valtri Exp $
+ * $Id: video_out.h,v 1.111 2004/09/28 18:49:40 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -60,13 +60,6 @@ typedef struct video_driver_class_s video_driver_class_t;
typedef struct vo_overlay_s vo_overlay_t;
typedef struct video_overlay_manager_s video_overlay_manager_t;
-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;
-
-
/* public part, video drivers may add private fields
*
* Remember that adding new functions to this structure requires
@@ -78,6 +71,11 @@ struct vo_frame_s {
* member functions
*/
+ /* Duplicate picture data and acceleration specific data of a frame. */
+ /* if the image format isn't already known by Xine. Currently this is needed */
+ /* For all image formats except XINE_IMGFMT_YV12 and XINE_IMGFMT_YUY2 */
+ void (*proc_duplicate_frame_data) (vo_frame_t *vo_img, vo_frame_t *src);
+
/* tell video driver to copy/convert the whole of this frame, may be NULL */
/* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */
void (*proc_frame) (vo_frame_t *vo_img);
@@ -86,23 +84,6 @@ struct vo_frame_s {
/* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */
void (*proc_slice) (vo_frame_t *vo_img, uint8_t **src);
- /* XvMC routine for rendering macroblocks, may be NULL */
- 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]);
-
/* tell video driver that the decoder starts a new field */
void (*field) (vo_frame_t *vo_img, int which_field);
@@ -161,8 +142,8 @@ struct vo_frame_s {
int flags; /* remember the frame flags */
int proc_called; /* track use of proc_*() methods */
- /* used to carry macroblocks information for XvMC acceleration */
- xine_macroblocks_t *macroblocks;
+ /* Used to carry private data for accelerated plugins.*/
+ void *accel_data;
/* "backward" references to where this frame originates from */
xine_video_port_t *port;
@@ -292,31 +273,7 @@ struct xine_video_port_s {
#define VO_CAP_XVMC_IDCT 0x00000008 /* driver can use XvMC idct acceleration */
#define VO_CAP_UNSCALED_OVERLAY 0x00000010 /* driver can blend overlay at output resolution */
#define VO_CAP_CROP 0x00000020 /* driver can crop */
-
-/* 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
+#define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */
/*