From 94476c648beca6d50393ad1750c7f1a007afd0c0 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 25 Feb 2011 01:14:46 +0000 Subject: [PATCH] Only access TJBUFSIZEYUV symbol if YUV encoding is enabled, and add 1 to the buffer size; This allows jpgtest to be used to benchmark the old TurboJPEG/IPP libraries. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@446 632fc199-4ca6-4c93-a231-07263d6284db --- jpgtest.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jpgtest.c b/jpgtest.c index e5147333..80ac42e4 100644 --- a/jpgtest.c +++ b/jpgtest.c @@ -79,10 +79,9 @@ void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu, flags |= _flags[pf]; if(bu) flags |= TJ_BOTTOMUP; - if(yuv==YUVENCODE) flags |= TJ_YUV; - yuvsize=TJBUFSIZEYUV(w, h, jpegsub); - if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h))) == NULL) + if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub); + if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL) _throwunix("allocating image buffer"); if(!quiet)