[MPlayer-dev-eng] [PATCH] Remove trailing black boxes when scaling subtitles.

Glen Nakamura glen at imodulo.com
Fri Jun 20 19:03:01 CEST 2003


sometimes when using options such as:
-spuaa 4 -spugauss 0.5 -vop scale=640:272

there would be an extra black box at the right of the subtitles.
this is especially noticeable when the subtitle images are cropped instead
of being fullscreen.

the following patch works around the problem by clearing the extra padding
(scaled_stride - scaled_width) after scaling the image instead of before.

- glen

diff -Nru3p MPlayer-0.90.orig/spudec.c MPlayer-0.90/spudec.c
--- MPlayer-0.90.orig/spudec.c	2003-01-24 10:24:07.000000000 +0000
+++ MPlayer-0.90/spudec.c	2003-01-24 10:24:07.000000000 +0000
@@ -759,15 +759,6 @@ void spudec_draw_scaled(void *me, unsign
 	}
 	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;
 	  }
@@ -1012,6 +1003,15 @@ void spudec_draw_scaled(void *me, unsign
 	  }
 	  }
 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);
+	      /* FIXME: Why is this one needed? */
+	      memset(spu->scaled_image + 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