[Mplayer-cvslog] CVS: main/libmpcodecs vf.c,1.63,1.64

Arpi of Ize arpi at mplayerhq.hu
Sun Dec 29 03:58:05 CET 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv11550

Modified Files:
	vf.c 
Log Message:
(temporary?) fix for redundant buffer re-allocation


Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- vf.c	5 Dec 2002 00:22:37 -0000	1.63
+++ vf.c	29 Dec 2002 02:57:49 -0000	1.64
@@ -184,13 +184,18 @@
     // accept restrictions & draw_slice flags only:
     mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK);
     if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
-    if((mpi->width!=w2 || mpi->height!=h) && !(mpi->flags&MP_IMGFLAG_DIRECT)){
-	mpi->width=w2; mpi->chroma_width=w2>>mpi->chroma_x_shift;
-	mpi->height=h; mpi->chroma_height=h>>mpi->chroma_y_shift;
+    if(mpi->width!=w2 || mpi->height!=h){
+//	printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
 	if(mpi->flags&MP_IMGFLAG_ALLOCATED){
-	    // need to re-allocate buffer memory:
-	    free(mpi->planes[0]);
-	    mpi->flags&=~MP_IMGFLAG_ALLOCATED;
+	    if(mpi->width<w2 || mpi->height<h){
+		// need to re-allocate buffer memory:
+		free(mpi->planes[0]);
+		mpi->flags&=~MP_IMGFLAG_ALLOCATED;
+		printf("vf.c: have to REALLOCATE buffer memory :(\n");
+	    }
+	} else {
+	    mpi->width=w2; mpi->chroma_width=w2>>mpi->chroma_x_shift;
+	    mpi->height=h; mpi->chroma_height=h>>mpi->chroma_y_shift;
 	}
     }
     if(!mpi->bpp) mp_image_setfmt(mpi,outfmt);
@@ -246,6 +251,7 @@
 	  } else {
 	      if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8;
 	  }
+//	  printf("clearing img!\n");
 	  vf_mpi_clear(mpi,0,0,mpi->width,mpi->height);
 	  mpi->flags|=MP_IMGFLAG_ALLOCATED;
         }
@@ -267,6 +273,9 @@
     }
 
   }
+//    printf("\rVF_MPI: %p %p %p %d %d %d    \n",
+//	mpi->planes[0],mpi->planes[1],mpi->planes[2],
+//	mpi->stride[0],mpi->stride[1],mpi->stride[2]);
   return mpi;
 }
 




More information about the MPlayer-cvslog mailing list