Zoom capability and decoder settings dialog in OPJViewer

This commit is contained in:
Giuseppe Baruffa
2007-03-01 00:01:37 +00:00
parent e2a54d9ac6
commit ba423fe3d0
22 changed files with 1261 additions and 425 deletions

View File

@@ -199,6 +199,7 @@ typedef enum {
#define TKHD_SIGN "tkhd"
#define MDIA_SIGN "mdia"
#define MINF_SIGN "minf"
#define VMHD_SIGN "vmhd"
#define STBL_SIGN "stbl"
#define STSD_SIGN "stsd"
#define MJP2_SIGN "mjp2"
@@ -503,14 +504,14 @@ searchfirstjp2c(wxInputStream& stream, unsigned long int fsize)
char scansign[] = "jp2c";
unsigned long int scanpoint = 0L;
wxLogMessage("MJ2: searching jp2c box... ");
wxLogMessage(wxT("MJ2: searching jp2c box... "));
/* do the parsing */
if (my_jpeg2000parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0)
wxLogMessage("MJ2: Unrecoverable error during file parsing: stopping");
wxLogMessage(wxT("MJ2: Unrecoverable error during file parsing: stopping"));
if (strcmp(scansign, " "))
wxLogMessage("MJ2: not found");
wxLogMessage(wxT("MJ2: not found"));
else {
wxLogMessage(wxString::Format("MJ2: found at byte %d", scanpoint));
@@ -528,16 +529,16 @@ searchjpegheaderbox(wxInputStream& stream, unsigned long int fsize)
char scansign[] = "jp2h";
unsigned long int scanpoint = 0L;
wxLogMessage("MJ2: searching jp2h box... ");
wxLogMessage(wxT("MJ2: searching jp2h box... "));
/* do the parsing */
if (my_jpeg2000parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0)
wxLogMessage("Unrecoverable error during file parsing: stopping");
wxLogMessage(wxT("Unrecoverable error during file parsing: stopping"));
if (strcmp(scansign, " "))
wxLogMessage("MJ2: not found");
wxLogMessage(wxT("MJ2: not found"));
else
wxLogMessage(wxString::Format("MJ2: found at byte %d", scanpoint));
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
return (scanpoint);
}
@@ -615,6 +616,19 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT;
if (m_reducefactor)
parameters.cp_reduce = m_reducefactor;
if (m_qualitylayers)
parameters.cp_layer = m_qualitylayers;
/*if (n_components)
parameters. = n_components;*/
/* JPWL only */
#ifdef USE_JPWL
parameters.jpwl_exp_comps = m_expcomps;
parameters.jpwl_max_tiles = m_maxtiles;
parameters.jpwl_correct = m_enablejpwl;
#endif /* USE_JPWL */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JP2);
@@ -664,7 +678,7 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opjimage = opj_decode(dinfo, cio);
if (!opjimage) {
wxMutexGuiEnter();
wxLogError("MJ2: failed to decode image!");
wxLogError(wxT("MJ2: failed to decode image!"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
@@ -678,7 +692,7 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
// check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("MJ2: weird number of components");
wxLogError(wxT("MJ2: weird number of components"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
free(src);