Web lists-archives.com

[MPlayer-dev-eng] [PATCH] vf_expand: fix clearing of horizontal padding.

The current code clears full_w-w on the right of the input image,
relying on the area overflowing to the left.
Therefore, it does not clear properly the left of the first row,
and probably the immediate left if the stride is larger than the
full width.

More importantly, the clear overflows from each plane on what
whould be the left of the line after the last. It is visible with
a command line like that:

./mplayer -vf-add expand=850:480 640x480.h264

A green line appears on the left of the first chroma lines.

Instead, clear the left and right rectangles separately.
 libmpcodecs/vf_expand.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

A similar problem exists with the top/bottom clear just below, it can be
observed with subtitles not disappearing on the padding. Unfortunately, for
some reason, while full_w is really the full width, full_h seems not to be
the full height. I am not familiar enough with the mp_image_t structure to
understand what is going on.

diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 85fae06..f747374 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -416,8 +416,10 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
 	if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
 	// padding for use by decoder needs to be cleared
-	if (mpi->w < full_w)
-	    vf_mpi_clear(mpi, mpi->w, 0, full_w - mpi->w, full_h);
+	if (mpi->w < full_w) {
+	    vf_mpi_clear(mpi, -vf->priv->exp_x, 0, vf->priv->exp_x, full_h);
+	    vf_mpi_clear(mpi, mpi->w, 0, full_w - mpi->w - vf->priv->exp_x, full_h);
+	}
 	if (mpi->h < full_h)
 	    vf_mpi_clear(mpi, 0, mpi->h, full_w, full_h - mpi->h);
 	// we've used DR, so we're ready...

MPlayer-dev-eng mailing list