parent
f6843d5511
commit
b190a91ab5
|
@ -536,9 +536,11 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||||
{
|
{
|
||||||
png_set_packing(png);
|
png_set_packing(png);
|
||||||
}
|
}
|
||||||
// printf("%s:%d:sgnd(%d,%d,%d) w(%d) h(%d) alpha(%d)\n",__FILE__,__LINE__,
|
/*
|
||||||
//image->comps[0].sgnd,
|
printf("%s:%d:sgnd(%d,%d,%d) w(%d) h(%d) alpha(%d)\n",__FILE__,__LINE__,
|
||||||
//image->comps[1].sgnd,image->comps[2].sgnd,width,height,has_alpha);
|
image->comps[0].sgnd,
|
||||||
|
image->comps[1].sgnd,image->comps[2].sgnd,width,height,has_alpha);
|
||||||
|
*/
|
||||||
|
|
||||||
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||||
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||||
|
|
|
@ -1871,9 +1871,9 @@ int main(int argc, char **argv) {
|
||||||
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
||||||
|
|
||||||
t = opj_clock() - t;
|
t = opj_clock() - t;
|
||||||
if (num_compressed_files)
|
if (num_compressed_files) {
|
||||||
fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files));
|
fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000.0)/(OPJ_FLOAT64)num_compressed_files));
|
||||||
//getch());
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,12 +175,12 @@ static void decode_help_display(void) {
|
||||||
" Image file Directory path \n"
|
" Image file Directory path \n"
|
||||||
" -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|RAW|RAWL|TGA>\n"
|
" -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|RAW|RAWL|TGA>\n"
|
||||||
" REQUIRED only if -ImgDir is used\n"
|
" REQUIRED only if -ImgDir is used\n"
|
||||||
" Output format for decompressed images.\n"
|
" Output format for decompressed images.\n");
|
||||||
" -i <compressed file>\n"
|
fprintf(stdout," -i <compressed file>\n"
|
||||||
" REQUIRED only if an Input image directory is not specified\n"
|
" REQUIRED only if an Input image directory is not specified\n"
|
||||||
" Currently accepts J2K-files, JP2-files and JPT-files. The file type\n"
|
" Currently accepts J2K-files, JP2-files and JPT-files. The file type\n"
|
||||||
" is identified based on its suffix.\n"
|
" is identified based on its suffix.\n");
|
||||||
" -o <decompressed file>\n"
|
fprintf(stdout," -o <decompressed file>\n"
|
||||||
" REQUIRED\n"
|
" REQUIRED\n"
|
||||||
" Currently accepts formats specified above (see OutFor option)\n"
|
" Currently accepts formats specified above (see OutFor option)\n"
|
||||||
" Binary data is written to the file (not ascii). If a PGX\n"
|
" Binary data is written to the file (not ascii). If a PGX\n"
|
||||||
|
@ -188,8 +188,8 @@ static void decode_help_display(void) {
|
||||||
" components: an indice starting from 0 will then be appended to the\n"
|
" components: an indice starting from 0 will then be appended to the\n"
|
||||||
" output filename, just before the \"pgx\" extension. If a PGM filename\n"
|
" output filename, just before the \"pgx\" extension. If a PGM filename\n"
|
||||||
" is given and there are more than one component, only the first component\n"
|
" is given and there are more than one component, only the first component\n"
|
||||||
" will be written to the file.\n"
|
" will be written to the file.\n");
|
||||||
" -r <reduce factor>\n"
|
fprintf(stdout," -r <reduce factor>\n"
|
||||||
" Set the number of highest resolution levels to be discarded. The\n"
|
" Set the number of highest resolution levels to be discarded. The\n"
|
||||||
" image resolution is effectively divided by 2 to the power of the\n"
|
" image resolution is effectively divided by 2 to the power of the\n"
|
||||||
" number of discarded levels. The reduce factor is limited by the\n"
|
" number of discarded levels. The reduce factor is limited by the\n"
|
||||||
|
@ -197,8 +197,8 @@ static void decode_help_display(void) {
|
||||||
" -l <number of quality layers to decode>\n"
|
" -l <number of quality layers to decode>\n"
|
||||||
" Set the maximum number of quality layers to decode. If there are\n"
|
" Set the maximum number of quality layers to decode. If there are\n"
|
||||||
" less quality layers than the specified number, all the quality layers\n"
|
" less quality layers than the specified number, all the quality layers\n"
|
||||||
" are decoded.\n"
|
" are decoded.\n");
|
||||||
" -x \n"
|
fprintf(stdout," -x \n"
|
||||||
" Create an index file *.Idx (-x index_name.Idx) \n"
|
" Create an index file *.Idx (-x index_name.Idx) \n"
|
||||||
" -d <x0,y0,x1,y1>\n"
|
" -d <x0,y0,x1,y1>\n"
|
||||||
" OPTIONAL\n"
|
" OPTIONAL\n"
|
||||||
|
@ -207,8 +207,8 @@ static void decode_help_display(void) {
|
||||||
" -t <tile_number>\n"
|
" -t <tile_number>\n"
|
||||||
" OPTIONAL\n"
|
" OPTIONAL\n"
|
||||||
" Set the tile number of the decoded tile. Follow the JPEG2000 convention from left-up to bottom-up\n"
|
" Set the tile number of the decoded tile. Follow the JPEG2000 convention from left-up to bottom-up\n"
|
||||||
" By default all tiles are decoded.\n"
|
" By default all tiles are decoded.\n");
|
||||||
" -p <comp 0 precision>[C|S][,<comp 1 precision>[C|S][,...]]\n"
|
fprintf(stdout," -p <comp 0 precision>[C|S][,<comp 1 precision>[C|S][,...]]\n"
|
||||||
" OPTIONAL\n"
|
" OPTIONAL\n"
|
||||||
" Force the precision (bit depth) of components.\n"
|
" Force the precision (bit depth) of components.\n"
|
||||||
" There shall be at least 1 value. Theres no limit on the number of values (comma separated, last values ignored if too much values).\n"
|
" There shall be at least 1 value. Theres no limit on the number of values (comma separated, last values ignored if too much values).\n"
|
||||||
|
@ -252,7 +252,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
OPJ_UINT32 prec;
|
int prec;
|
||||||
char mode;
|
char mode;
|
||||||
char comma;
|
char comma;
|
||||||
int count;
|
int count;
|
||||||
|
@ -270,7 +270,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p
|
||||||
count = 3;
|
count = 3;
|
||||||
}
|
}
|
||||||
if (count == 3) {
|
if (count == 3) {
|
||||||
if (prec > 32U) {
|
if ((prec < 1) || (prec > 32)) {
|
||||||
fprintf(stderr,"Invalid precision %d in precision option %s\n", prec, option);
|
fprintf(stderr,"Invalid precision %d in precision option %s\n", prec, option);
|
||||||
l_result = OPJ_FALSE;
|
l_result = OPJ_FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -313,7 +313,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p
|
||||||
parameters->precision = l_new;
|
parameters->precision = l_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters->precision[parameters->nb_precision].prec = prec;
|
parameters->precision[parameters->nb_precision].prec = (OPJ_UINT32)prec;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'C':
|
case 'C':
|
||||||
parameters->precision[parameters->nb_precision].mode = OPJ_PREC_MODE_CLIP;
|
parameters->precision[parameters->nb_precision].mode = OPJ_PREC_MODE_CLIP;
|
||||||
|
@ -1540,9 +1540,9 @@ int main(int argc, char **argv)
|
||||||
if(failed) remove(parameters.outfile);
|
if(failed) remove(parameters.outfile);
|
||||||
}
|
}
|
||||||
destroy_parameters(¶meters);
|
destroy_parameters(¶meters);
|
||||||
if (numDecompressedImages)
|
if (numDecompressedImages) {
|
||||||
fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages));
|
fprintf(stdout, "decode time: %d ms\n", (int)( (tCumulative * 1000.0) / (OPJ_FLOAT64)numDecompressedImages));
|
||||||
//getch();
|
}
|
||||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
/*end main*/
|
/*end main*/
|
||||||
|
|
|
@ -127,8 +127,8 @@ static INLINE long lrintf(float f){
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
return _mm_cvt_ss2si(_mm_load_ss(&f));
|
return _mm_cvt_ss2si(_mm_load_ss(&f));
|
||||||
|
|
||||||
// commented out line breaks many tests
|
/* commented out line breaks many tests */
|
||||||
///return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
/* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
_asm{
|
_asm{
|
||||||
|
|
Loading…
Reference in New Issue