mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
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
This commit is contained in:
parent
2b895d9349
commit
63cc56045a
17
spudec.c
17
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user