Remove unused code in TJBench

The merge from libjpeg-turbo 1.4 somehow failed here, and this function from
1.3 was left hanging.
This commit is contained in:
DRC
2014-11-06 01:30:06 -06:00
parent ebc7c3a760
commit 63eb69de62

View File

@@ -273,82 +273,6 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf,
}
int dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
char *filename)
{
char tempstr[1024], tempstr2[80];
FILE *file=NULL; tjhandle handle=NULL;
unsigned char *dstbuf=NULL;
double start, elapsed;
int i, retval=0, ps=tjPixelSize[pf];
int yuvsize=0;
yuvsize=tjBufSizeYUV(w, h, subsamp);
if((dstbuf=(unsigned char *)malloc(yuvsize)) == NULL)
_throwunix("allocating image buffer");
if(!quiet)
printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", pixFormatStr[pf],
(flags&TJFLAG_BOTTOMUP)? "Bottom-up":"Top-down", subNameLong[subsamp]);
if(quiet==1)
printf("%s\t%s\t%s\tN/A\t", pixFormatStr[pf],
(flags&TJFLAG_BOTTOMUP)? "BU":"TD", subNameLong[subsamp]);
if((handle=tjInitCompress())==NULL)
_throwtj("executing tjInitCompress()");
/* Execute once to preload cache */
if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
_throwtj("executing tjEncodeYUV2()");
/* Benchmark */
for(i=0, start=gettime(); (elapsed=gettime()-start)<benchtime; i++)
{
if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
_throwtj("executing tjEncodeYUV2()");
}
if(tjDestroy(handle)==-1) _throwtj("executing tjDestroy()");
handle=NULL;
if(quiet==1) printf("%-4d %-4d\t", w, h);
if(quiet)
{
printf("%s%c%s%c",
sigfig((double)(w*h)/1000000.*(double)i/elapsed, 4, tempstr, 1024),
quiet==2? '\n':'\t',
sigfig((double)(w*h*ps)/(double)yuvsize, 4, tempstr2, 80),
quiet==2? '\n':'\t');
}
else
{
printf("\n%s size: %d x %d\n", "Image", w, h);
printf("C--> Frame rate: %f fps\n", (double)i/elapsed);
printf(" Output image size: %d bytes\n", yuvsize);
printf(" Compression ratio: %f:1\n",
(double)(w*h*ps)/(double)yuvsize);
printf(" Source throughput: %f Megapixels/sec\n",
(double)(w*h)/1000000.*(double)i/elapsed);
printf(" Output bit stream: %f Megabits/sec\n",
(double)yuvsize*8./1000000.*(double)i/elapsed);
}
snprintf(tempstr, 1024, "%s_%s.yuv", filename, subName[subsamp]);
if((file=fopen(tempstr, "wb"))==NULL)
_throwunix("opening reference image");
if(fwrite(dstbuf, yuvsize, 1, file)!=1)
_throwunix("writing reference image");
fclose(file); file=NULL;
if(!quiet) printf("Reference image written to %s\n", tempstr);
bailout:
if(file) {fclose(file); file=NULL;}
if(dstbuf) {free(dstbuf); dstbuf=NULL;}
if(handle) {tjDestroy(handle); handle=NULL;}
return retval;
}
int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
char *filename)
{