diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-12-08 10:24:02 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-12-08 10:24:02 +0000 |
commit | e74929e8bb19eb19e8a4b7d1d2ea0d589b39f254 (patch) | |
tree | 5ee6c2759f2672c4cdf34b0f2eaa2516f6bde013 /libavcodec/imgconvert.c | |
parent | 614e139a11198eb692ec68f30820adf3ec0f629d (diff) | |
download | ffmpeg-e74929e8bb19eb19e8a4b7d1d2ea0d589b39f254.tar.gz |
Use av_image_alloc() in avpicture_alloc(), simplify.
Originally committed as revision 25920 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 790ce80ac0..e40de6ebec 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -813,23 +813,12 @@ void ff_shrink88(uint8_t *dst, int dst_wrap, int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height) { - int size; - void *ptr; - - size = avpicture_fill(picture, NULL, pix_fmt, width, height); - if(size<0) - goto fail; - ptr = av_malloc(size); - if (!ptr) - goto fail; - avpicture_fill(picture, ptr, pix_fmt, width, height); - if(picture->data[1] && !picture->data[2]) - ff_set_systematic_pal2((uint32_t*)picture->data[1], pix_fmt); - - return 0; - fail: + if (av_image_alloc(picture->data, picture->linesize, width, height, pix_fmt, 0) < 0) { memset(picture, 0, sizeof(AVPicture)); return -1; + } + + return 0; } void avpicture_free(AVPicture *picture) |