diff options
| author | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-02-23 01:23:05 +0000 |
|---|---|---|
| committer | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-02-23 01:23:05 +0000 |
| commit | 8a75823eeaa6f36c428a848d757e7d94ce4386f1 (patch) | |
| tree | 35cbd0c3181e404833790c0c1e04c0879d868bad | |
| parent | e841b13166218ba152595a7c0adf5b70c4e5558d (diff) | |
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
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | OPJViewer/source/imagj2k.cpp | 12 | ||||
| -rw-r--r-- | OPJViewer/source/imagjp2.cpp | 9 | ||||
| -rw-r--r-- | OPJViewer/source/imagmj2.cpp | 8 | ||||
| -rw-r--r-- | jpwl/LibOpenJPEG_JPWL.dsp | 8 | ||||
| -rw-r--r-- | jpwl/jpwl_lib.c | 2 | ||||
| -rw-r--r-- | libopenjpeg/openjpeg.h | 4 |
7 files changed, 28 insertions, 18 deletions
@@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : 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 + [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia diff --git a/OPJViewer/source/imagj2k.cpp b/OPJViewer/source/imagj2k.cpp index b58c7a51..16bcdd16 100644 --- a/OPJViewer/source/imagj2k.cpp +++ b/OPJViewer/source/imagj2k.cpp @@ -124,7 +124,6 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL;
- FILE *fsrc = NULL;
unsigned char *src = NULL;
unsigned char *ptr;
int file_length;
@@ -147,13 +146,15 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_set_default_decoder_parameters(¶meters);
/* prepare parameters */
+ strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
+ strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = J2K_CFMT;
parameters.cod_format = BMP_DFMT;
/* JPWL only */
#ifdef USE_JPWL
- parameters.jpwl_exp_comps = 3;
- parameters.jpwl_max_tiles = 100;
+ parameters.jpwl_exp_comps = JPWL_EXPECTED_COMPONENTS;
+ parameters.jpwl_max_tiles = JPWL_MAXIMUM_TILES;
parameters.jpwl_correct = true;
#endif /* USE_JPWL */
@@ -191,13 +192,15 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, return false;
}
+ /* close the byte stream */
+ opj_cio_close(cio);
+
// check image components
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("J2K: weird number of components");
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
free(src);
return false;
}
@@ -274,7 +277,6 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, /* close openjpeg structs */
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
opj_image_destroy(opjimage);
free(src);
diff --git a/OPJViewer/source/imagjp2.cpp b/OPJViewer/source/imagjp2.cpp index 4b7437f8..99ef23c9 100644 --- a/OPJViewer/source/imagjp2.cpp +++ b/OPJViewer/source/imagjp2.cpp @@ -124,7 +124,6 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL;
- FILE *fsrc = NULL;
unsigned char *src = NULL;
unsigned char *ptr;
int file_length;
@@ -146,6 +145,8 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_set_default_decoder_parameters(¶meters);
/* prepare parameters */
+ strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
+ strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT;
@@ -182,17 +183,20 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, return false;
}
+ /* close the byte stream */
+ opj_cio_close(cio);
+
// check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("JP2: weird number of components");
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
free(src);
return false;
}
+
// prepare image size
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 */
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
opj_image_destroy(opjimage);
free(src);
diff --git a/OPJViewer/source/imagmj2.cpp b/OPJViewer/source/imagmj2.cpp index 351621ea..65c9ca73 100644 --- a/OPJViewer/source/imagmj2.cpp +++ b/OPJViewer/source/imagmj2.cpp @@ -589,7 +589,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL;
- FILE *fsrc = NULL;
unsigned char *src = NULL;
unsigned char *ptr;
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(¶meters);
/* prepare parameters */
+ strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
+ strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT;
@@ -671,13 +672,15 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, return false;
}
+ /* close the byte stream */
+ opj_cio_close(cio);
+
// check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("MJ2: weird number of components");
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
free(src);
return false;
}
@@ -736,7 +739,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, /* close openjpeg structs */
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
opj_image_destroy(opjimage);
free(src);
diff --git a/jpwl/LibOpenJPEG_JPWL.dsp b/jpwl/LibOpenJPEG_JPWL.dsp index 58b92973..68ee908c 100644 --- a/jpwl/LibOpenJPEG_JPWL.dsp +++ b/jpwl/LibOpenJPEG_JPWL.dsp @@ -37,8 +37,8 @@ RSC=rc.exe # PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "LibOpenJPEG_JPWL___Win32_Release"
-# PROP Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Release"
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# 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
@@ -60,8 +60,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "LibOpenJPEG_JPWL___Win32_Debug"
-# PROP Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Debug"
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
# 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 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
diff --git a/jpwl/jpwl_lib.c b/jpwl/jpwl_lib.c index 656ca7e5..96e6f69d 100644 --- a/jpwl/jpwl_lib.c +++ b/jpwl/jpwl_lib.c @@ -1483,7 +1483,7 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) { else /* packet: first is most important, and then in decreasing order 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; /* MSE */ diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h index 8e9da446..71baf02f 100644 --- a/libopenjpeg/openjpeg.h +++ b/libopenjpeg/openjpeg.h @@ -366,9 +366,9 @@ typedef struct opj_dparameters { /** activates the JPWL correction capabilities */ bool jpwl_correct; /** expected number of components */ - bool jpwl_exp_comps; + int jpwl_exp_comps; /** maximum number of tiles */ - bool jpwl_max_tiles; + int jpwl_max_tiles; /*@}*/ #endif /* USE_JPWL */ /* <<UniPG */ |
