From 63cc56045ad1d3051ea9ae408c044fa28afa35d1 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Jul 2010 09:31:00 +0000 Subject: spudec.c: Avoid useless malloc/frees git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31797 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove unused variables. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31800 b3059339-0415-0410-9bf9-f77b7e298cf2 --- spudec.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/spudec.c b/spudec.c index 500a133e4a..8a85e6c81b 100644 --- a/spudec.c +++ b/spudec.c @@ -179,8 +179,6 @@ static inline void spudec_cut_image(spudec_handle_t *this) { unsigned int fy, ly; unsigned int first_y, last_y; - unsigned char *image; - unsigned char *aimage; if (this->stride == 0 || this->height == 0) { return; @@ -198,23 +196,14 @@ static inline void spudec_cut_image(spudec_handle_t *this) 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); } } -- cgit v1.2.3