Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c. As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib

This commit is contained in:
Giuseppe Baruffa 2007-02-23 01:23:05 +00:00
parent e841b13166
commit 8a75823eea
7 changed files with 28 additions and 18 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
February 23, 2007
* [GB] Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c. As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib
February 22, 2007 February 22, 2007
+ [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia + [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia

View File

@ -124,7 +124,6 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_dparameters_t parameters; /* decompression parameters */ opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */ opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL; opj_image_t *opjimage = NULL;
FILE *fsrc = NULL;
unsigned char *src = NULL; unsigned char *src = NULL;
unsigned char *ptr; unsigned char *ptr;
int file_length; int file_length;
@ -147,13 +146,15 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_set_default_decoder_parameters(&parameters); opj_set_default_decoder_parameters(&parameters);
/* prepare parameters */ /* prepare parameters */
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = J2K_CFMT; parameters.decod_format = J2K_CFMT;
parameters.cod_format = BMP_DFMT; parameters.cod_format = BMP_DFMT;
/* JPWL only */ /* JPWL only */
#ifdef USE_JPWL #ifdef USE_JPWL
parameters.jpwl_exp_comps = 3; parameters.jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
parameters.jpwl_max_tiles = 100; parameters.jpwl_max_tiles = JPWL_MAXIMUM_TILES;
parameters.jpwl_correct = true; parameters.jpwl_correct = true;
#endif /* USE_JPWL */ #endif /* USE_JPWL */
@ -191,13 +192,15 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
return false; return false;
} }
/* close the byte stream */
opj_cio_close(cio);
// check image components // check image components
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) { if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter(); wxMutexGuiEnter();
wxLogError("J2K: weird number of components"); wxLogError("J2K: weird number of components");
wxMutexGuiLeave(); wxMutexGuiLeave();
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
free(src); free(src);
return false; return false;
} }
@ -274,7 +277,6 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
/* close openjpeg structs */ /* close openjpeg structs */
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
opj_image_destroy(opjimage); opj_image_destroy(opjimage);
free(src); free(src);

View File

@ -124,7 +124,6 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_dparameters_t parameters; /* decompression parameters */ opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */ opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL; opj_image_t *opjimage = NULL;
FILE *fsrc = NULL;
unsigned char *src = NULL; unsigned char *src = NULL;
unsigned char *ptr; unsigned char *ptr;
int file_length; int file_length;
@ -146,6 +145,8 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_set_default_decoder_parameters(&parameters); opj_set_default_decoder_parameters(&parameters);
/* prepare parameters */ /* prepare parameters */
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT; parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT; parameters.cod_format = BMP_DFMT;
@ -182,17 +183,20 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
return false; return false;
} }
/* close the byte stream */
opj_cio_close(cio);
// check image size // check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) { if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter(); wxMutexGuiEnter();
wxLogError("JP2: weird number of components"); wxLogError("JP2: weird number of components");
wxMutexGuiLeave(); wxMutexGuiLeave();
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
free(src); free(src);
return false; return false;
} }
// prepare image size // prepare image size
image->Create(opjimage->comps[0].w, opjimage->comps[0].h, true ); image->Create(opjimage->comps[0].w, opjimage->comps[0].h, true );
@ -238,7 +242,6 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
/* close openjpeg structs */ /* close openjpeg structs */
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
opj_image_destroy(opjimage); opj_image_destroy(opjimage);
free(src); free(src);

View File

@ -589,7 +589,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_dparameters_t parameters; /* decompression parameters */ opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */ opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL; opj_image_t *opjimage = NULL;
FILE *fsrc = NULL;
unsigned char *src = NULL; unsigned char *src = NULL;
unsigned char *ptr; unsigned char *ptr;
int file_length, jp2c_point, jp2h_point; int file_length, jp2c_point, jp2h_point;
@ -612,6 +611,8 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_set_default_decoder_parameters(&parameters); opj_set_default_decoder_parameters(&parameters);
/* prepare parameters */ /* prepare parameters */
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT; parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT; parameters.cod_format = BMP_DFMT;
@ -671,13 +672,15 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
return false; return false;
} }
/* close the byte stream */
opj_cio_close(cio);
// check image size // check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) { if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter(); wxMutexGuiEnter();
wxLogError("MJ2: weird number of components"); wxLogError("MJ2: weird number of components");
wxMutexGuiLeave(); wxMutexGuiLeave();
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
free(src); free(src);
return false; return false;
} }
@ -736,7 +739,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
/* close openjpeg structs */ /* close openjpeg structs */
opj_destroy_decompress(dinfo); opj_destroy_decompress(dinfo);
opj_cio_close(cio);
opj_image_destroy(opjimage); opj_image_destroy(opjimage);
free(src); free(src);

View File

@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "LibOpenJPEG_JPWL___Win32_Release" # PROP Output_Dir "Release"
# PROP Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /YX /FD /c
@ -60,8 +60,8 @@ LIB32=link.exe -lib
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "LibOpenJPEG_JPWL___Win32_Debug" # PROP Output_Dir "Debug"
# PROP Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /YX /FD /GZ /c

View File

@ -1483,7 +1483,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
else else
/* packet: first is most important, and then in decreasing order /* packet: first is most important, and then in decreasing order
down to the last, which counts for 1 */ down to the last, which counts for 1 */
dvalue = jpwl_pfp_to_double(j2k->image_info->num - thispacket, esd->se_size); dvalue = jpwl_pfp_to_double((unsigned short) (j2k->image_info->num - thispacket), esd->se_size);
break; break;
/* MSE */ /* MSE */

View File

@ -366,9 +366,9 @@ typedef struct opj_dparameters {
/** activates the JPWL correction capabilities */ /** activates the JPWL correction capabilities */
bool jpwl_correct; bool jpwl_correct;
/** expected number of components */ /** expected number of components */
bool jpwl_exp_comps; int jpwl_exp_comps;
/** maximum number of tiles */ /** maximum number of tiles */
bool jpwl_max_tiles; int jpwl_max_tiles;
/*@}*/ /*@}*/
#endif /* USE_JPWL */ #endif /* USE_JPWL */
/* <<UniPG */ /* <<UniPG */