The following message is a courtesy copy of an article
that has been posted to gmane.comp.video.xine.devel as well.

# HG changeset patch
# User Durand Burke
# Date 1205528235 -3600
# Node ID ab7dd74755c712af15e5876399e77f40fea6392b
# Parent  df257a6e4008dfdee1cfc9a90e1aebd267f1fedb
Patch found on https://bugs.launchpad.net/bugs/129114

Xine renders DVB subtitles incorrectly when using xshm output. The
subtitles seem to be XOR'd over the video (correct colouring is evident
on a black background, garbled otherwise) instead of painted over. With
xvideo output, the subtitles are properly displayed. (Just the annoyance
that xvideo output doesn't work realiably on the Feisty r300 driver, but
that's another bug.)

I looked into it a bit and found that the subtitles are not actually
being XORed; I think what's happening is that when the subtitles are
alpha blended into the image, an 8-bit alpha channel is being passed to
a blending function designed for 4-bit alpha channels, causing the pixel
values to overflow and wrap around.

The attached patch fixes the DVB subtitles for me, but it is not the
correct fix because it has the side effect of making DVD (as opposed to
DVB) subtitles very faint (perhaps they actually use the 4-bit alpha the
original code expects?). I'm including it anyway just in case it
provides some clues that might help someone who understands the code to
come up with a real fix.

diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c
--- a/src/xine-engine/alphablend.c
+++ b/src/xine-engine/alphablend.c
@@ -40,7 +40,7 @@
 
 #define BLEND_COLOR(dst, src, mask, o) 
((((((src&mask)-(dst&mask))*(o*0x111+1))>>12)+(dst&mask))&mask)
 
-#define BLEND_BYTE(dst, src, o) (((((src)-(dst))*(o*0x1111+1))>>16)+(dst))
+#define BLEND_BYTE(dst, src, o) (((((src)-(dst))*(o*0x101))>>16)+(dst))
 
 static void mem_blend16(uint16_t *mem, uint16_t clr, uint8_t o, int len) {
   uint16_t *limit = mem + len;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

-- 
DVB subtitle rendering faulty with xshm
https://bugs.launchpad.net/bugs/129114
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to