changeset 35387:8c7b99d25d9a

Expand: when using DR clear the part of the image that is padding for the decoder and thus will contain nonsense after decoding.
author reimar
date Sun, 25 Nov 2012 19:37:21 +0000
parents ef2d3b306d6e
children 6c9c58ad43a3
files libmpcodecs/vf_expand.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_expand.c	Sun Nov 25 15:51:38 2012 +0000
+++ b/libmpcodecs/vf_expand.c	Sun Nov 25 19:37:21 2012 +0000
@@ -407,12 +407,19 @@
     }
 
     if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
+	int full_w = FFMIN(mpi->width,  vf->priv->exp_w);
+	int full_h = FFMIN(mpi->height, vf->priv->exp_h);
 	vf->dmpi=mpi->priv;
 	if(!vf->dmpi) { mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
 	mpi->priv=NULL;
 #ifdef OSD_SUPPORT
 	if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
 #endif
+	// 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->h < full_h)
+	    vf_mpi_clear(mpi, 0, mpi->h, full_w, full_h - mpi->h);
 	// we've used DR, so we're ready...
 	if(!(mpi->flags&MP_IMGFLAG_PLANAR))
 	    vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette