summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-25 09:31:00 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:45 +0200
commit63cc56045ad1d3051ea9ae408c044fa28afa35d1 (patch)
tree7f8b40e4ca9585953da92d2c22399660e3c1830a /spudec.c
parent2b895d9349d4779fbe5111391d30b32e2a1a3f34 (diff)
downloadmpv-63cc56045ad1d3051ea9ae408c044fa28afa35d1.tar.bz2
mpv-63cc56045ad1d3051ea9ae408c044fa28afa35d1.tar.xz
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
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c17
1 files 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);
}
}