--- libmpcodecs/vf_bmovl.c.orig	2010-02-21 10:48:03.000000000 -0500
+++ libmpcodecs/vf_bmovl.c	2016-08-31 16:57:37.853988181 -0400
@@ -328,8 +328,8 @@ put_image(struct vf_instance *vf, mp_ima
 					memset( vf->priv->bitmap.a  + (ypos*vf->priv->w) + imgx, 0, imgw );
 					memset( vf->priv->bitmap.oa + (ypos*vf->priv->w) + imgx, 0, imgw );
 					if(ypos%2) {
-						memset( vf->priv->bitmap.u + ((ypos/2)*dmpi->stride[1]) + (imgx/2), 128, imgw/2 );
-						memset( vf->priv->bitmap.v + ((ypos/2)*dmpi->stride[2]) + (imgx/2), 128, imgw/2 );
+						memset( vf->priv->bitmap.u + ((ypos/2)*vf->priv->w) + (imgx/2), 128, imgw/2 );
+						memset( vf->priv->bitmap.v + ((ypos/2)*vf->priv->w) + (imgx/2), 128, imgw/2 );
 					}
 				}	// Recalculate area that contains graphics
 				if( (imgx <= vf->priv->x1) && ( (imgw+imgx) >= vf->priv->x2) ) {
@@ -389,7 +389,7 @@ put_image(struct vf_instance *vf, mp_ima
 						vf->priv->bitmap.oa[pos] = alpha;
 						vf->priv->bitmap.a[pos]  = INRANGE((alpha+imgalpha),0,255);
 						if((buf_y%2) && ((buf_x/pxsz)%2)) {
-							pos = ( ((buf_y+imgy)/2) * dmpi->stride[1] ) + (((buf_x/pxsz)+imgx)/2);
+							pos = ( ((buf_y+imgy)/2) * vf->priv->w ) + (((buf_x/pxsz)+imgx)/2);
 							vf->priv->bitmap.u[pos] = rgb2u(red,green,blue);
 							vf->priv->bitmap.v[pos] = rgb2v(red,green,blue);
 						}
@@ -421,34 +421,35 @@ put_image(struct vf_instance *vf, mp_ima
 	} else { // Blit the bitmap to the videoscreen, pixel for pixel
 	    for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) {
 	        for ( xpos=vf->priv->x1 ; xpos < vf->priv->x2 ; xpos++ ) {
-				pos = (ypos * dmpi->stride[0]) + xpos;
+				int s = ypos * vf->priv->w + xpos;
+				int d = ypos * dmpi->stride[0] + xpos;
 
-				alpha = vf->priv->bitmap.a[pos];
+				alpha = vf->priv->bitmap.a[s];
 
 				if (alpha == 0) continue; // Completly transparent pixel
 
 				if (alpha == 255) {	// Opaque pixel
-					dmpi->planes[0][pos] = vf->priv->bitmap.y[pos];
+					dmpi->planes[0][d] = vf->priv->bitmap.y[s];
 					if ((ypos%2) && (xpos%2)) {
-						pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
-						dmpi->planes[1][pos] = vf->priv->bitmap.u[pos];
-						dmpi->planes[2][pos] = vf->priv->bitmap.v[pos];
+						s = (ypos/2) * vf->priv->w + xpos/2;
+						d = (ypos/2) * dmpi->stride[1] + xpos/2;
+						dmpi->planes[1][d] = vf->priv->bitmap.u[s];
+						dmpi->planes[2][d] = vf->priv->bitmap.v[s];
 					}
 				} else { // Alphablended pixel
-					dmpi->planes[0][pos] =
-						((255 - alpha) * (int)dmpi->planes[0][pos] +
-						alpha * (int)vf->priv->bitmap.y[pos]) >> 8;
+					dmpi->planes[0][d] =
+						((255 - alpha) * (int)dmpi->planes[0][d] +
+						alpha * (int)vf->priv->bitmap.y[s]) >> 8;
 
 					if ((ypos%2) && (xpos%2)) {
-						pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
-
-						dmpi->planes[1][pos] =
-							((255 - alpha) * (int)dmpi->planes[1][pos] +
-							alpha * (int)vf->priv->bitmap.u[pos]) >> 8;
-
-						dmpi->planes[2][pos] =
-							((255 - alpha) * (int)dmpi->planes[2][pos] +
-							alpha * (int)vf->priv->bitmap.v[pos]) >> 8;
+						s = (ypos/2) * vf->priv->w + xpos/2;
+						d = (ypos/2) * dmpi->stride[1] + xpos/2;
+						dmpi->planes[1][d] =
+							((255 - alpha) * (int)dmpi->planes[1][d] +
+							alpha * (int)vf->priv->bitmap.u[s]) >> 8;
+						dmpi->planes[2][d] =
+							((255 - alpha) * (int)dmpi->planes[2][d] +
+							alpha * (int)vf->priv->bitmap.v[s]) >> 8;
 					}
 			    }
 			} // for xpos
