| Index: tjbench.c
|
| ===================================================================
|
| --- tjbench.c (revision 106486)
|
| +++ tjbench.c (working copy)
|
| @@ -59,6 +59,7 @@
|
| const char *subName[NUMSUBOPT]={"444", "422", "420", "GRAY", "440"};
|
| tjscalingfactor *scalingfactors=NULL, sf={1, 1}; int nsf=0;
|
| int xformop=TJXOP_NONE, xformopt=0;
|
| +int (*customFilter)(short *, tjregion, tjregion, int, int, tjtransform *);
|
| double benchtime=5.0;
|
|
|
|
|
| @@ -73,6 +74,16 @@
|
| }
|
|
|
|
|
| +/* Custom DCT filter which produces a negative of the image */
|
| +int dummyDCTFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
|
| + int componentIndex, int transformIndex, tjtransform *transform)
|
| +{
|
| + int i;
|
| + for(i=0; i<arrayRegion.w*arrayRegion.h; i++) coeffs[i]=-coeffs[i];
|
| + return 0;
|
| +}
|
| +
|
| +
|
| /* Decompression test */
|
| int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf,
|
| unsigned long *jpegsize, unsigned char *dstbuf, int w, int h,
|
| @@ -458,7 +469,7 @@
|
| int w=0, h=0, subsamp=-1, _w, _h, _tilew, _tileh,
|
| _ntilesw, _ntilesh, _subsamp;
|
| char *temp=NULL, tempstr[80], tempstr2[80];
|
| - int row, col, i, tilew, tileh, ntilesw, ntilesh, retval=0;
|
| + int row, col, i, tilew, tileh, ntilesw=1, ntilesh=1, retval=0;
|
| double start, elapsed;
|
| int ps=tjPixelSize[pf], tile;
|
|
|
| @@ -534,7 +545,7 @@
|
| }
|
|
|
| _subsamp=subsamp;
|
| - if(dotile || xformop!=TJXOP_NONE || xformopt!=0)
|
| + if(dotile || xformop!=TJXOP_NONE || xformopt!=0 || customFilter)
|
| {
|
| if((t=(tjtransform *)malloc(sizeof(tjtransform)*ntilesw*ntilesh))
|
| ==NULL)
|
| @@ -568,6 +579,11 @@
|
| t[tile].r.y=row*_tileh;
|
| t[tile].op=xformop;
|
| t[tile].options=xformopt|TJXOPT_TRIM;
|
| + t[tile].customFilter=customFilter;
|
| + if(t[tile].options&TJXOPT_NOOUTPUT && jpegbuf[tile])
|
| + {
|
| + free(jpegbuf[tile]); jpegbuf[tile]=NULL;
|
| + }
|
| }
|
| }
|
|
|
| @@ -611,9 +627,13 @@
|
|
|
| if(w==tilew) _tilew=_w;
|
| if(h==tileh) _tileh=_h;
|
| - if(decomptest(NULL, jpegbuf, jpegsize, NULL, _w, _h, _subsamp, 0,
|
| - filename, _tilew, _tileh)==-1)
|
| - goto bailout;
|
| + if(!(xformopt&TJXOPT_NOOUTPUT))
|
| + {
|
| + if(decomptest(NULL, jpegbuf, jpegsize, NULL, _w, _h, _subsamp, 0,
|
| + filename, _tilew, _tileh)==-1)
|
| + goto bailout;
|
| + }
|
| + else if(quiet==1) printf("N/A\n");
|
|
|
| for(i=0; i<ntilesw*ntilesh; i++)
|
| {
|
| @@ -809,6 +829,8 @@
|
| if(!strcasecmp(argv[i], "-rot180")) xformop=TJXOP_ROT180;
|
| if(!strcasecmp(argv[i], "-rot270")) xformop=TJXOP_ROT270;
|
| if(!strcasecmp(argv[i], "-grayscale")) xformopt|=TJXOPT_GRAY;
|
| + if(!strcasecmp(argv[i], "-custom")) customFilter=dummyDCTFilter;
|
| + if(!strcasecmp(argv[i], "-nooutput")) xformopt|=TJXOPT_NOOUTPUT;
|
| if(!strcasecmp(argv[i], "-benchtime") && i<argc-1)
|
| {
|
| double temp=atof(argv[++i]);
|
|
|