| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C)2009-2012 D. R. Commander. All Rights Reserved. | 2 * Copyright (C)2009-2012 D. R. Commander. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * - Redistributions of source code must retain the above copyright notice, | 7 * - Redistributions of source code must retain the above copyright notice, |
| 8 * this list of conditions and the following disclaimer. | 8 * this list of conditions and the following disclaimer. |
| 9 * - Redistributions in binary form must reproduce the above copyright notice, | 9 * - Redistributions in binary form must reproduce the above copyright notice, |
| 10 * this list of conditions and the following disclaimer in the documentation | 10 * this list of conditions and the following disclaimer in the documentation |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 if(t) {free(t); t=NULL;} | 660 if(t) {free(t); t=NULL;} |
| 661 if(handle) {tjDestroy(handle); handle=NULL;} | 661 if(handle) {tjDestroy(handle); handle=NULL;} |
| 662 return; | 662 return; |
| 663 } | 663 } |
| 664 | 664 |
| 665 | 665 |
| 666 void usage(char *progname) | 666 void usage(char *progname) |
| 667 { | 667 { |
| 668 int i; | 668 int i; |
| 669 printf("USAGE: %s\n", progname); | 669 printf("USAGE: %s\n", progname); |
| 670 » printf(" <Inputfile (BMP|PPM)> <%% Quality> [options]\n\n"); | 670 » printf(" <Inputfile (BMP|PPM)> <Quality> [options]\n\n"); |
| 671 printf(" %s\n", progname); | 671 printf(" %s\n", progname); |
| 672 printf(" <Inputfile (JPG)> [options]\n\n"); | 672 printf(" <Inputfile (JPG)> [options]\n\n"); |
| 673 printf("Options:\n\n"); | 673 printf("Options:\n\n"); |
| 674 printf("-alloc = Dynamically allocate JPEG image buffers\n"); | 674 printf("-alloc = Dynamically allocate JPEG image buffers\n"); |
| 675 printf("-bmp = Generate output images in Windows Bitmap format (default=
PPM)\n"); | 675 printf("-bmp = Generate output images in Windows Bitmap format (default=
PPM)\n"); |
| 676 printf("-bottomup = Test bottom-up compression/decompression\n"); | 676 printf("-bottomup = Test bottom-up compression/decompression\n"); |
| 677 printf("-tile = Test performance of the codec when the image is encoded
as separate\n"); | 677 printf("-tile = Test performance of the codec when the image is encoded
as separate\n"); |
| 678 printf(" tiles of varying sizes.\n"); | 678 printf(" tiles of varying sizes.\n"); |
| 679 printf("-forcemmx, -forcesse, -forcesse2, -forcesse3 =\n"); | 679 printf("-forcemmx, -forcesse, -forcesse2, -forcesse3 =\n"); |
| 680 printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying
codec\n"); | 680 printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying
codec\n"); |
| 681 printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n"); | 681 printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n"); |
| 682 printf(" Test the specified color conversion path in the codec (defa
ult: BGR)\n"); | 682 printf(" Test the specified color conversion path in the codec (defa
ult: BGR)\n"); |
| 683 » printf("-fastupsample = Use fast, inaccurate upsampling code to perform
4:2:2 and 4:2:0\n"); | 683 » printf("-fastupsample = Use the fastest chrominance upsampling algorithm
available in\n"); |
| 684 » printf(" YUV decoding\n"); | 684 » printf(" the underlying codec\n"); |
| 685 » printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the
underlying\n"); |
| 686 » printf(" codec\n"); |
| 687 » printf("-accuratedct = Use the most accurate DCT/IDCT algorithms availab
le in the\n"); |
| 688 » printf(" underlying codec\n"); |
| 685 printf("-quiet = Output results in tabular rather than verbose format\n"
); | 689 printf("-quiet = Output results in tabular rather than verbose format\n"
); |
| 686 printf("-yuvencode = Encode RGB input as planar YUV rather than compress
ing as JPEG\n"); | 690 printf("-yuvencode = Encode RGB input as planar YUV rather than compress
ing as JPEG\n"); |
| 687 printf("-yuvdecode = Decode JPEG image to planar YUV rather than RGB\n")
; | 691 printf("-yuvdecode = Decode JPEG image to planar YUV rather than RGB\n")
; |
| 688 printf("-scale M/N = scale down the width/height of the decompressed JPE
G image by a\n"); | 692 printf("-scale M/N = scale down the width/height of the decompressed JPE
G image by a\n"); |
| 689 printf(" factor of M/N (M/N = "); | 693 printf(" factor of M/N (M/N = "); |
| 690 for(i=0; i<nsf; i++) | 694 for(i=0; i<nsf; i++) |
| 691 { | 695 { |
| 692 printf("%d/%d", scalingfactors[i].num, scalingfactors[i].denom); | 696 printf("%d/%d", scalingfactors[i].num, scalingfactors[i].denom); |
| 693 if(nsf==2 && i!=nsf-1) printf(" or "); | 697 if(nsf==2 && i!=nsf-1) printf(" or "); |
| 694 else if(nsf>2) | 698 else if(nsf>2) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 if(!strcasecmp(argv[i], "-forcemmx")) | 793 if(!strcasecmp(argv[i], "-forcemmx")) |
| 790 { | 794 { |
| 791 printf("Forcing MMX code\n\n"); | 795 printf("Forcing MMX code\n\n"); |
| 792 flags|=TJFLAG_FORCEMMX; | 796 flags|=TJFLAG_FORCEMMX; |
| 793 } | 797 } |
| 794 if(!strcasecmp(argv[i], "-fastupsample")) | 798 if(!strcasecmp(argv[i], "-fastupsample")) |
| 795 { | 799 { |
| 796 printf("Using fast upsampling code\n\n"); | 800 printf("Using fast upsampling code\n\n"); |
| 797 flags|=TJFLAG_FASTUPSAMPLE; | 801 flags|=TJFLAG_FASTUPSAMPLE; |
| 798 } | 802 } |
| 803 if(!strcasecmp(argv[i], "-fastdct")) |
| 804 { |
| 805 printf("Using fastest DCT/IDCT algorithm\n\n"); |
| 806 flags|=TJFLAG_FASTDCT; |
| 807 } |
| 808 if(!strcasecmp(argv[i], "-accuratedct")) |
| 809 { |
| 810 printf("Using most accurate DCT/IDCT algorithm\n
\n"); |
| 811 flags|=TJFLAG_ACCURATEDCT; |
| 812 } |
| 799 if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB; | 813 if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB; |
| 800 if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX; | 814 if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX; |
| 801 if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR; | 815 if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR; |
| 802 if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX; | 816 if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX; |
| 803 if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR; | 817 if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR; |
| 804 if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB; | 818 if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB; |
| 805 if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTT
OMUP; | 819 if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTT
OMUP; |
| 806 if(!strcasecmp(argv[i], "-quiet")) quiet=1; | 820 if(!strcasecmp(argv[i], "-quiet")) quiet=1; |
| 807 if(!strcasecmp(argv[i], "-qq")) quiet=2; | 821 if(!strcasecmp(argv[i], "-qq")) quiet=2; |
| 808 if(!strcasecmp(argv[i], "-scale") && i<argc-1) | 822 if(!strcasecmp(argv[i], "-scale") && i<argc-1) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 dotest(srcbuf, w, h, TJ_422, i, argv[1]); | 905 dotest(srcbuf, w, h, TJ_422, i, argv[1]); |
| 892 printf("\n"); | 906 printf("\n"); |
| 893 for(i=maxqual; i>=minqual; i--) | 907 for(i=maxqual; i>=minqual; i--) |
| 894 dotest(srcbuf, w, h, TJ_444, i, argv[1]); | 908 dotest(srcbuf, w, h, TJ_444, i, argv[1]); |
| 895 printf("\n"); | 909 printf("\n"); |
| 896 | 910 |
| 897 bailout: | 911 bailout: |
| 898 if(srcbuf) free(srcbuf); | 912 if(srcbuf) free(srcbuf); |
| 899 return retval; | 913 return retval; |
| 900 } | 914 } |
| OLD | NEW |