OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C)2009-2011 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 |
11 * and/or other materials provided with the distribution. | 11 * and/or other materials provided with the distribution. |
12 * - Neither the name of the libjpeg-turbo Project nor the names of its | 12 * - Neither the name of the libjpeg-turbo Project nor the names of its |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 if(jpegqual>0) | 104 if(jpegqual>0) |
105 { | 105 { |
106 snprintf(qualstr, 6, "_Q%d", jpegqual); | 106 snprintf(qualstr, 6, "_Q%d", jpegqual); |
107 qualstr[5]=0; | 107 qualstr[5]=0; |
108 } | 108 } |
109 | 109 |
110 if((handle=tjInitDecompress())==NULL) | 110 if((handle=tjInitDecompress())==NULL) |
111 _throwtj("executing tjInitDecompress()"); | 111 _throwtj("executing tjInitDecompress()"); |
112 | 112 |
113 » bufsize=(yuv==YUVDECODE? yuvsize:pitch*h); | 113 » bufsize=(yuv==YUVDECODE? yuvsize:pitch*scaledh); |
114 if(dstbuf==NULL) | 114 if(dstbuf==NULL) |
115 { | 115 { |
116 if((dstbuf=(unsigned char *)malloc(bufsize)) == NULL) | 116 if((dstbuf=(unsigned char *)malloc(bufsize)) == NULL) |
117 _throwunix("allocating image buffer"); | 117 _throwunix("allocating image buffer"); |
118 dstbufalloc=1; | 118 dstbufalloc=1; |
119 } | 119 } |
120 /* Set the destination buffer to gray so we know whether the decompresso
r | 120 /* Set the destination buffer to gray so we know whether the decompresso
r |
121 attempted to write to it */ | 121 attempted to write to it */ |
122 memset(dstbuf, 127, bufsize); | 122 memset(dstbuf, 127, bufsize); |
123 | 123 |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 fast, inaccurate upsampling code to perform
4:2:2 and 4:2:0\n"); |
684 » printf(" YUV decoding in libjpeg decompressor\n"); | 684 » printf(" YUV decoding\n"); |
685 printf("-quiet = Output results in tabular rather than verbose format\n"
); | 685 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"); | 686 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")
; | 687 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"); | 688 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 = "); | 689 printf(" factor of M/N (M/N = "); |
690 for(i=0; i<nsf; i++) | 690 for(i=0; i<nsf; i++) |
691 { | 691 { |
692 printf("%d/%d", scalingfactors[i].num, scalingfactors[i].denom); | 692 printf("%d/%d", scalingfactors[i].num, scalingfactors[i].denom); |
693 if(nsf==2 && i!=nsf-1) printf(" or "); | 693 if(nsf==2 && i!=nsf-1) printf(" or "); |
694 else if(nsf>2) | 694 else if(nsf>2) |
695 { | 695 { |
696 if(i!=nsf-1) printf(", "); | 696 if(i!=nsf-1) printf(", "); |
697 if(i==nsf-2) printf("or "); | 697 if(i==nsf-2) printf("or "); |
698 } | 698 } |
| 699 if(i%8==0 && i!=0) printf("\n "); |
699 } | 700 } |
700 printf(")\n"); | 701 printf(")\n"); |
701 printf("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot27
0 =\n"); | 702 printf("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot27
0 =\n"); |
702 printf(" Perform the corresponding lossless transform prior to\n"); | 703 printf(" Perform the corresponding lossless transform prior to\n"); |
703 printf(" decompression (these options are mutually exclusive)\n"); | 704 printf(" decompression (these options are mutually exclusive)\n"); |
704 printf("-grayscale = Perform lossless grayscale conversion prior to deco
mpression\n"); | 705 printf("-grayscale = Perform lossless grayscale conversion prior to deco
mpression\n"); |
705 printf(" test (can be combined with the other transforms above)\n"); | 706 printf(" test (can be combined with the other transforms above)\n"); |
706 printf("-benchtime <t> = Run each benchmark for at least <t> seconds (de
fault = 5.0)\n\n"); | 707 printf("-benchtime <t> = Run each benchmark for at least <t> seconds (de
fault = 5.0)\n\n"); |
707 printf("NOTE: If the quality is specified as a range (e.g. 90-100), a s
eparate\n"); | 708 printf("NOTE: If the quality is specified as a range (e.g. 90-100), a s
eparate\n"); |
708 printf("test will be performed for all quality values in the range.\n\n"
); | 709 printf("test will be performed for all quality values in the range.\n\n"
); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTT
OMUP; | 805 if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTT
OMUP; |
805 if(!strcasecmp(argv[i], "-quiet")) quiet=1; | 806 if(!strcasecmp(argv[i], "-quiet")) quiet=1; |
806 if(!strcasecmp(argv[i], "-qq")) quiet=2; | 807 if(!strcasecmp(argv[i], "-qq")) quiet=2; |
807 if(!strcasecmp(argv[i], "-scale") && i<argc-1) | 808 if(!strcasecmp(argv[i], "-scale") && i<argc-1) |
808 { | 809 { |
809 int temp1=0, temp2=0, match=0; | 810 int temp1=0, temp2=0, match=0; |
810 if(sscanf(argv[++i], "%d/%d", &temp1, &temp2)==2
) | 811 if(sscanf(argv[++i], "%d/%d", &temp1, &temp2)==2
) |
811 { | 812 { |
812 for(j=0; j<nsf; j++) | 813 for(j=0; j<nsf; j++) |
813 { | 814 { |
814 » » » » » » if(temp1==scalingfactors[j].num
&& temp2==scalingfactors[j].denom) | 815 » » » » » » if((double)temp1/(double)temp2 |
| 816 » » » » » » » == (double)scalingfactor
s[j].num/(double)scalingfactors[j].denom) |
815 { | 817 { |
816 sf=scalingfactors[j]; | 818 sf=scalingfactors[j]; |
817 match=1; break; | 819 match=1; break; |
818 } | 820 } |
819 } | 821 } |
820 if(!match) usage(argv[0]); | 822 if(!match) usage(argv[0]); |
821 } | 823 } |
822 else usage(argv[0]); | 824 else usage(argv[0]); |
823 } | 825 } |
824 if(!strcasecmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP; | 826 if(!strcasecmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 dotest(srcbuf, w, h, TJ_422, i, argv[1]); | 891 dotest(srcbuf, w, h, TJ_422, i, argv[1]); |
890 printf("\n"); | 892 printf("\n"); |
891 for(i=maxqual; i>=minqual; i--) | 893 for(i=maxqual; i>=minqual; i--) |
892 dotest(srcbuf, w, h, TJ_444, i, argv[1]); | 894 dotest(srcbuf, w, h, TJ_444, i, argv[1]); |
893 printf("\n"); | 895 printf("\n"); |
894 | 896 |
895 bailout: | 897 bailout: |
896 if(srcbuf) free(srcbuf); | 898 if(srcbuf) free(srcbuf); |
897 return retval; | 899 return retval; |
898 } | 900 } |
OLD | NEW |