[MPlayer-dev-eng] [PATCH] bugfix for black bar besides gaussed vobsubs

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jan 8 21:49:44 CET 2005


Hi,
On Sat, Jan 08, 2005 at 06:26:27AM +0100, Csillag Kristof wrote:
> When playing a movie with a vobsub subtitle, using the swscaler gaussian
> blur for nice antialiasing, sometimes we can see a black bar on the
> right of the subtitle box. I uploaded a screenshot here:
> http://rht.bme.hu/~lunkwill/computer/mplayer/black-column.png (60 KB)
> 
> (Look closely at the hand.)
> 
> If you want to try it:
> 
> 1. wget http://rht.bme.hu/~lunkwill/computer/mplayer/sample.mkv (3 MB)
> 2. mplayer -vo x11 -nofs -zoom -spuaa 4 -slang hun sample.mkv 
> 
> ..and watch the left hand of Bruce Willis, at the right side of the
> subtitles.
> 
>   * * *
> 
> This is an error in spudec.c; there is some 8-padding for alpha_draw in
> the spu images, but only the real image gets scaled up, so the padding's
> alpha map has to be zeroed out. (It should be zero on the first place,
> but there is some compication with interpreting 0 as 1, and 255 as 0,
> because 0 has a special meaning (full transparency.)
> 
> This two-line patch fixes the mess, and removes the black bar.

I think the attached patch makes much more sense - it shifts setting the
border alpha values of the scaled image to after scaling (instead of
before)...

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: spudec.c
===================================================================
RCS file: /cvsroot/mplayer/main/spudec.c,v
retrieving revision 1.44
diff -u -r1.44 spudec.c
--- spudec.c	18 Sep 2004 00:08:16 -0000	1.44
+++ spudec.c	8 Jan 2005 20:48:14 -0000
@@ -808,15 +808,6 @@
 	}
 	if (spu->scaled_image) {
 	  unsigned int x, y;
-	  /* Kludge: draw_alpha needs width multiple of 8. */
-	  if (spu->scaled_width < spu->scaled_stride)
-	    for (y = 0; y < spu->scaled_height; ++y) {
-	      memset(spu->scaled_aimage + y * spu->scaled_stride + spu->scaled_width, 0,
-		     spu->scaled_stride - spu->scaled_width);
-	      /* FIXME: Why is this one needed? */
-	      memset(spu->scaled_image + y * spu->scaled_stride + spu->scaled_width, 0,
-		     spu->scaled_stride - spu->scaled_width);
-	    }
 	  if (spu->scaled_width <= 1 || spu->scaled_height <= 1) {
 	    goto nothing_to_do;
 	  }
@@ -1061,6 +1052,12 @@
 	  }
 	  }
 nothing_to_do:
+	  /* Kludge: draw_alpha needs width multiple of 8. */
+	  if (spu->scaled_width < spu->scaled_stride)
+	    for (y = 0; y < spu->scaled_height; ++y) {
+	      memset(spu->scaled_aimage + y * spu->scaled_stride + spu->scaled_width, 0,
+		     spu->scaled_stride - spu->scaled_width);
+	    }
 	  spu->scaled_frame_width = dxs;
 	  spu->scaled_frame_height = dys;
 	}


More information about the MPlayer-dev-eng mailing list