summaryrefslogtreecommitdiff
path: root/src/video_out
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-07-08 18:15:54 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-07-08 18:15:54 +0000
commitc980a592bd835f2c0826e4f0638cef3fabd70ee7 (patch)
treeecf5e9adcd28cabe0d59e0842780a1dbb3cc0633 /src/video_out
parentfbf6214d84dbed2b9e22da164748eca8c762cb82 (diff)
downloadxine-lib-c980a592bd835f2c0826e4f0638cef3fabd70ee7.tar.gz
xine-lib-c980a592bd835f2c0826e4f0638cef3fabd70ee7.tar.bz2
subtitle patches from james
CVS patchset: 259 CVS date: 2001/07/08 18:15:54
Diffstat (limited to 'src/video_out')
-rw-r--r--src/video_out/alphablend.c40
-rw-r--r--src/video_out/video_out_xv.c17
2 files changed, 36 insertions, 21 deletions
diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c
index 134c8aac3..65f96e5c0 100644
--- a/src/video_out/alphablend.c
+++ b/src/video_out/alphablend.c
@@ -1,7 +1,7 @@
//TOAST_SPU will define ALL spu entries - no matter the tranparency
//#define TOAST_SPU
/* #define PRIV_CLUT */
-
+/* Currently only blend_yuv(..) works */
/*
*
* Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001
@@ -34,6 +34,18 @@
#include "video_out.h"
+/* FIXME: CLUT_T should go elsewhere. */
+#ifndef CLUT_T
+#define CLUT_T
+typedef struct { // CLUT == Color LookUp Table
+ uint8_t:8;
+ uint8_t y:8;
+ uint8_t cr:8;
+ uint8_t cb:8;
+} __attribute__ ((packed)) clut_t;
+#endif
+
+
#define BLEND_COLOR(dst, src, mask, o) ((((src&mask)*o + ((dst&mask)*(0x0f-o)))/0xf) & mask)
static inline uint16_t blendpixel_rgb16 (uint16_t dst, uint16_t src,
@@ -227,7 +239,8 @@ void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, int dst_width,
void blend_yuv (uint8_t * dst_img, vo_overlay_t * img_overl,
int dst_width, int dst_height)
{
-#ifdef PRIV_CLUT
+/* FIXME: my_clut should disappear once I find out how to get the clut from the MPEG2 stream. */
+/* This happens to work with "The Matrix" using 0(black), 8(white) and 9(edges) */
clut_t my_clut[] = {
{y: 0x51, cr: 0xef, cb:0x5a},
{y: 0xbf, cr: 0x80, cb:0x80},
@@ -237,8 +250,8 @@ void blend_yuv (uint8_t * dst_img, vo_overlay_t * img_overl,
{y: 0xbf, cr: 0x80, cb:0x80},
{y: 0x36, cr: 0x80, cb:0x80},
{y: 0x28, cr: 0x6d, cb:0xef},
- {y: 0x5c, cr: 0x80, cb:0x80},
{y: 0xbf, cr: 0x80, cb:0x80},
+ {y: 0x5c, cr: 0x80, cb:0x80},
{y: 0x10, cr: 0x80, cb:0x80},
{y: 0x28, cr: 0x6d, cb:0xef},
{y: 0x5c, cr: 0x80, cb:0x80},
@@ -246,7 +259,6 @@ void blend_yuv (uint8_t * dst_img, vo_overlay_t * img_overl,
{y: 0x1c, cr: 0x80, cb:0x80},
{y: 0x28, cr: 0x6d, cb:0xef}
};
-#endif
int src_width = img_overl->width;
int src_height = img_overl->height;
@@ -269,30 +281,18 @@ void blend_yuv (uint8_t * dst_img, vo_overlay_t * img_overl,
uint8_t clr;
uint8_t o;
- clr = img_overl->clut[*src_data & 0x0f];
- o = img_overl->trans[*src_data & 0x0f];
+ clr = img_overl->clut[*src_data & 0x03];
+ o = img_overl->trans[*src_data & 0x03];
- if (clr)
-// *INDENT-OFF*
-#ifdef PRIV_CLUT
+ if (clr) {
*dst_y = BLEND_YUV (*dst_y, my_clut[clr].y, o);
-#else
- *dst_y = BLEND_YUV (*dst_y, img_overl->clut[clr]/*.y*/, o);
-#endif
-// *INDENT-ON*
+ }
dst_y++;
if (y & x & 1) {
if (clr) {
-// *INDENT-OFF*
-#ifdef PRIV_CLUT
*dst_cr = BLEND_YUV (*dst_cr, my_clut[clr].cr, o);
*dst_cb = BLEND_YUV (*dst_cb, my_clut[clr].cb, o);
-#else
- *dst_cr = BLEND_YUV (*dst_cr, img_overl->clut [clr]/*.cr*/, o);
- *dst_cb = BLEND_YUV (*dst_cb, img_overl->clut [clr]/*.cb*/, o);
-#endif
-// *INDENT-ON*
}
dst_cr++;
dst_cb++;
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 38bdca7e3..ce0b74e4c 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.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_xv.c,v 1.49 2001/07/04 20:32:29 uid32519 Exp $
+ * $Id: video_out_xv.c,v 1.50 2001/07/08 18:15:54 guenter Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -539,6 +539,20 @@ static void xv_calc_format (xv_driver_t *this,
/*
*
*/
+static void xv_overlay_blend (vo_frame_t *frame_gen, vo_overlay_t *overlay) {
+
+ xv_frame_t *frame = (xv_frame_t *) frame_gen;
+
+// Alpha Blend here
+// As XV drivers improve to support Hardware overlay, we will change this function.
+ if (overlay->data) {
+ blend_yuv( frame->image->data, overlay, frame->width, frame->height);
+ }
+}
+
+/*
+ *
+ */
static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
xv_driver_t *this = (xv_driver_t *) this_gen;
@@ -880,6 +894,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
this->vo_driver.get_capabilities = xv_get_capabilities;
this->vo_driver.alloc_frame = xv_alloc_frame;
this->vo_driver.update_frame_format = xv_update_frame_format;
+ this->vo_driver.overlay_blend = xv_overlay_blend;
this->vo_driver.display_frame = xv_display_frame;
this->vo_driver.set_overlay = xv_set_overlay;
this->vo_driver.get_property = xv_get_property;