[MPlayer-cvslog] r31797 - trunk/spudec.c

reimar subversion at mplayerhq.hu
Sun Jul 25 11:31:01 CEST 2010


Author: reimar
Date: Sun Jul 25 11:31:00 2010
New Revision: 31797

Log:
Avoid useless malloc/frees

Modified:
   trunk/spudec.c

Modified: trunk/spudec.c
==============================================================================
--- trunk/spudec.c	Sun Jul 25 11:22:37 2010	(r31796)
+++ trunk/spudec.c	Sun Jul 25 11:31:00 2010	(r31797)
@@ -198,23 +198,14 @@ static inline void spudec_cut_image(spud
 	  this->height = last_y - first_y +1;
   } else {
 	  this->height = 0;
-	  this->image_size = 0;
 	  return;
   }
 
 //  printf("new h %d new start %d (sz %d st %d)---\n\n", this->height, this->start_row, this->image_size, this->stride);
 
-  image = malloc(2 * this->stride * this->height);
-  if(image){
-    this->image_size = this->stride * this->height;
-    aimage = image + this->image_size;
-    memcpy(image, this->image + this->stride * first_y, this->image_size);
-    memcpy(aimage, this->aimage + this->stride * first_y, this->image_size);
-    free(this->image);
-    this->image = image;
-    this->aimage = aimage;
-  } else {
-    mp_msg(MSGT_SPUDEC, MSGL_FATAL, "Fatal: update_spu: malloc requested %d bytes\n", 2 * this->stride * this->height);
+  if (first_y > 0) {
+    memmove(this->image,  this->image  + this->stride * first_y, this->stride * this->height);
+    memmove(this->aimage, this->aimage + this->stride * first_y, this->stride * this->height);
   }
 }
 


More information about the MPlayer-cvslog mailing list