[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mjpeg.c,1.110,1.111

Michael Niedermayer CVS michael
Sun Jul 17 14:56:58 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv16122

Modified Files:
	mjpeg.c 
Log Message:
dont pre allocate uselessly large buffer and dont ignore FF_INPUT_BUFFER_PADDING_SIZE


Index: mjpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mjpeg.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- mjpeg.c	17 Jul 2005 11:27:00 -0000	1.110
+++ mjpeg.c	17 Jul 2005 12:56:56 -0000	1.111
@@ -896,11 +896,8 @@
     s->idct_put= s2.dsp.idct_put;
 
     s->mpeg_enc_ctx_allocated = 0;
-    s->buffer_size = 102400; /* smaller buffer should be enough,
-				but photojpg files could ahive bigger sizes */
-    s->buffer = av_malloc(s->buffer_size);
-    if (!s->buffer)
-	return -1;
+    s->buffer_size = 0;
+    s->buffer = NULL;
     s->start_code = -1;
     s->first_picture = 1;
     s->org_height = avctx->coded_height;
@@ -1841,7 +1838,7 @@
 		{
 		    av_free(s->buffer);
 		    s->buffer_size = buf_end-buf_ptr;
-		    s->buffer = av_malloc(s->buffer_size);
+                    s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
 		    dprintf("buffer too small, expanding to %d bytes\n",
 			s->buffer_size);
 		}





More information about the ffmpeg-cvslog mailing list