]> granicus.if.org Git - libjpeg-turbo/commitdiff
Implement "ultra quiet mode" for generating output that is easy to copy/paste into...
authorDRC <dcommander@users.sourceforge.net>
Sat, 19 Feb 2011 18:06:09 +0000 (18:06 +0000)
committerDRC <dcommander@users.sourceforge.net>
Sat, 19 Feb 2011 18:06:09 +0000 (18:06 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@417 632fc199-4ca6-4c93-a231-07263d6284db

1  2 
jpgtest.c

diff --cc jpgtest.c
index a07a99939c8adb6e841e20a7e0fe2da6e063dcce,3ca6a20d0e92e6d49de2f1bbc680d67ede547040..318f9bf5b3f9fa91635143826208cdc44e99830d
+++ b/jpgtest.c
@@@ -391,18 -342,27 +394,18 @@@ void dodecomptest(char *filename
        if((hnd=tjInitDecompress())==NULL) _throwtj("executing tjInitDecompress()");
        if(tjDecompressHeader2(hnd, jpegbuf, jpgbufsize, &w, &h, &jpegsub)==-1)
                _throwtj("executing tjDecompressHeader2()");
 -
 -      hsf=_hsf[jpegsub], vsf=_vsf[jpegsub];
 -      pw=PAD(w, hsf), ph=PAD(h, vsf);
 -      cw=pw/hsf, ch=ph/vsf;
 -      ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
 -      yuvsize=ypitch*ph + (jpegsub==TJ_GRAYSCALE? 0:uvpitch*ch*2);
 -
 -      pitch=w*ps;
 +      if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
 +      hnd=NULL;
  
-       if(quiet)
+       if(quiet==1)
        {
-               printf("All performance values in Mpixels/sec\n\n");
+               printf("\nAll performance values in Mpixels/sec\n\n");
 -              printf("Bitmap\tBitmap\tImage Size\tDecomp\n"),
 -              printf("Format\tOrder\t X    Y  \tPerf\n\n");
 -              printf("%s\t%s\t%-4d %-4d\t", _pfname[pf], bu?"BU":"TD", w, h);
 +              printf("Bitmap\tBitmap\tJPEG\tImage Size\tDecomp\n"),
 +              printf("Format\tOrder\tFormat\t  X    Y  \tPerf\n\n");
 +              printf("%s\t%s\t%s\t%-4d  %-4d\t", _pfname[pf], bu?"BU":"TD",
 +                      _subnamel[jpegsub], w, h);
        }
 -
 -      if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h)))==NULL)
 -              _throwunix("allocating image buffer");
 -
 -      if(!quiet)
 +      else
        {
                if(yuv==YUVDECODE)
                        printf("\n>>>>>  JPEG --> YUV %s  <<<<<\n", _subnamel[jpegsub]);
@@@ -454,12 -450,11 +457,10 @@@ void usage(char *progname
  
  int main(int argc, char *argv[])
  {
 -      unsigned char *bmpbuf=NULL;  int w, h, i, useppm=0;
 -      int qual, dotile=0, quiet=0, hiqual=-1;  char *temp;
 -      int pf=BMP_BGR;
 -      int bu=0, minarg=2;
 +      unsigned char *bmpbuf=NULL;  int w, h, i;
 +      int qual, hiqual=-1;  char *temp;
 +      int minarg=2;
  
-       printf("\n");
        if(argc<minarg) usage(argv[0]);
  
        temp=strrchr(argv[1], '.');
                        if(!stricmp(argv[i], "-argb")) pf=BMP_ARGB;
                        if(!stricmp(argv[i], "-bottomup")) bu=1;
                        if(!stricmp(argv[i], "-quiet")) quiet=1;
+                       if(!stricmp(argv[i], "-qq")) quiet=2;
 +                      if(!stricmp(argv[i], "-scale") && i<argc-1)
 +                      {
 +                              int temp1=0, temp2=0;
 +                              if(sscanf(argv[++i], "%d/%d", &temp1, &temp2)!=2
 +                                      || temp1!=1 || temp2<1 || temp2>8 || (temp2&(temp2-1))!=0)
 +                                      usage(argv[0]);
 +                              scalefactor=temp2;
 +                      }
                }
        }