[FFmpeg-cvslog] r25920 - trunk/libavcodec/imgconvert.c

stefano subversion
Wed Dec 8 11:24:02 CET 2010


Author: stefano
Date: Wed Dec  8 11:24:02 2010
New Revision: 25920

Log:
Use av_image_alloc() in avpicture_alloc(), simplify.

Modified:
   trunk/libavcodec/imgconvert.c

Modified: trunk/libavcodec/imgconvert.c
==============================================================================
--- trunk/libavcodec/imgconvert.c	Tue Dec  7 19:15:06 2010	(r25919)
+++ trunk/libavcodec/imgconvert.c	Wed Dec  8 11:24:02 2010	(r25920)
@@ -813,23 +813,12 @@ void ff_shrink88(uint8_t *dst, int dst_w
 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)



More information about the ffmpeg-cvslog mailing list