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

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
March 1, 2007
+ [GB] Zoom capability and decoder settings dialog in OPJViewer; modified JPWL library .dsp project in order to create a library with embedded JPWL functions
February 28, 2007
+ [Parvatha] Enabled compression of TIF image format to j2k by tifftoimage() and decompression of codestream to TIF image format using imagetotif(). Modifications in image_to_j2k.c, j2k_to_image.c, convert.c, convert.h
* [antonin] fixed a bug in context numerotation that prevented the RESET switch to work correctly : mqc_reset_enc in mqc.c

View File

@ -37,20 +37,20 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "W32Release"
# PROP Intermediate_Dir "W32Release"
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MD /GX /O2 /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /FR /FD /c
# ADD CPP /nologo /G6 /MD /GX /O2 /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /c
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
@ -62,12 +62,12 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "W32Debug"
# PROP Intermediate_Dir "W32Debug"
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /Gm /GX /Zi /Od /I "C:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /FR /FD /GZ /c
# ADD CPP /nologo /MDd /Gm /GX /Zi /Od /I "C:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
@ -76,7 +76,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -158,6 +158,14 @@ SOURCE=.\source\icon5.xpm
# End Source File
# Begin Source File
SOURCE=.\source\OPJChild.ico
# End Source File
# Begin Source File
SOURCE=.\source\OPJChild16.xpm
# End Source File
# Begin Source File
SOURCE=.\source\OPJViewer.ico
# End Source File
# Begin Source File
@ -169,37 +177,5 @@ SOURCE=.\source\OPJViewer.rc
SOURCE=.\source\OPJViewer16.xpm
# End Source File
# End Group
# Begin Group "JPWL"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\jpwl\crc.c
# End Source File
# Begin Source File
SOURCE=..\jpwl\crc.h
# End Source File
# Begin Source File
SOURCE=..\jpwl\jpwl.c
# End Source File
# Begin Source File
SOURCE=..\jpwl\jpwl.h
# End Source File
# Begin Source File
SOURCE=..\jpwl\jpwl_lib.c
# End Source File
# Begin Source File
SOURCE=..\jpwl\rs.c
# End Source File
# Begin Source File
SOURCE=..\jpwl\rs.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -3,7 +3,7 @@
[Setup]
AppName=OPJViewer
AppVerName=OPJViewer 0.1 alpha
AppVerName=OPJViewer 0.2 alpha
AppPublisher=OpenJPEG
AppPublisherURL=http://www.openjpeg.org
AppSupportURL=http://www.openjpeg.org
@ -11,9 +11,17 @@ AppUpdatesURL=http://www.openjpeg.org
DefaultDirName={pf}\OPJViewer
DefaultGroupName=OPJViewer
OutputDir=setup
OutputBaseFilename=OPJViewer01alpha_setup
OutputBaseFilename=OPJViewer02alpha_setup
Compression=lzma
SolidCompression=yes
SolidCompression=true
InfoBeforeFile=source\readmebefore.txt
InfoAfterFile=source\readmeafter.txt
LicenseFile=source\license.txt
VersionInfoVersion=0.2.0.0
VersionInfoCompany=OpenJPEG
VersionInfoDescription=JPEG 2000 viewer
ShowLanguageDialog=yes
SetupIconFile=source\OPJViewer.ico
[Languages]
Name: english; MessagesFile: compiler:Default.isl
@ -22,13 +30,15 @@ Name: english; MessagesFile: compiler:Default.isl
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
[Files]
Source: W32Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion
Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
[Run]
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}

View File

@ -1,8 +1,6 @@
===============================================================================
JPEG2000 Visualization Software
- OPJViewer
JPEG2000 Visualization Software - OPJViewer
Version 0.1 alpha

36
OPJViewer/about/about.htm Normal file
View File

@ -0,0 +1,36 @@
<html>
<body bgcolor="#FFFFFF">
<table cellspacing=7 cellpadding=1 border=0 width="100%">
<tr>
<td rowspan=3 valign=top align=center width=70>
<img src="opj_logo.png"><br><br>
</td>
<td align=center>
<font size=+2 color="#000000"><b>OPJViewer v0.2 alpha</b></font><br>
<font size=+0 color="#000000"><b>A JPEG 2000 image viewer</b></font>
</td>
</tr>
<tr height=3 valign=center>
<td valign=center bgcolor=#cc3300></td>
</tr>
<tr>
<td align=justify>
<center><font size=+0 color="#000000"><a href="http://www.openjpeg.org/">OpenJPEG</a></font></center>
<font size=-1 color="#000000">The OpenJPEG library is an open-source JPEG 2000 codec written in C language.
In addition to the basic codec, various other features are under development,
among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool
useful for the JPIP protocol, JPWL-tools for error-resilience, ...</font>
</td>
</tr>
<tr>
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></td>
</tr>
<tr>
<td colspan=2>
<font size=-2 color="#444">OpenJPEG is &copy; 2002-2007 <a href="http://www.tele.ucl.ac.be/">TELE</a> - <a href="http://www.uclouvain.be/">Université Catholique de Louvain</a></font><br>
<font size=-2 color="#444">OPJViewer is also &copy; 2005-2007 <a href="http://dsplab.diei.unipg.it/">DSPLab</a> - <a href="http://www.unipg.it/">Università degli studi di Perugia</a></font>
</td>
</tr>
</table>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,28 @@
/* XPM */
static char *OPJChild16[] = {
/* columns rows colors chars-per-pixel */
"16 16 6 1",
" c black",
". c #008000",
"X c red",
"o c #800080",
"O c gray100",
"+ c None",
/* pixels */
"++++++++++++++++",
"+OOOOOOOOOOOOOO+",
"+OooooooooooooO+",
"+OooooooooooooO+",
"+OooOOOOOOOOOoO+",
"+OooO.......OoO+",
"+OooO.......OoO+",
"+OooO..OOO..OoO+",
"+OooO..OXO..OoO+",
"+OooO..OOO..OoO+",
"+OooO.......OoO+",
"+OooO.......OoO+",
"+OooOOOOOOOOOoO+",
"+OooooooooooooO+",
"+OOOOOOOOOOOOOO+",
"++++++++++++++++"
};

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,16 @@
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Name: dialogs.h
// Purpose: Common dialogs demo
// Author: Julian Smart
// Modified by: ABX (2004) - adjustementd for conditional building
// Created: 04/01/98
// RCS-ID: $Id: dialogs.h,v 1.50 2006/10/08 14:12:59 VZ Exp $
// Copyright: (c) Julian Smart
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __OPJ_VIEWER_H__
#define __OPJ_VIEWER_H__
@ -76,6 +86,14 @@
#include <wx/cmdline.h>
#include <wx/file.h>
#include "wx/notebook.h"
#include <wx/numdlg.h>
#include "wx/propdlg.h"
#include "wx/spinctrl.h"
#include <wx/dnd.h>
#include "wx/wxhtml.h"
#include "wx/statline.h"
#include "libopenjpeg\openjpeg.h"
@ -83,6 +101,14 @@
#include "imagjp2.h"
#include "imagmj2.h"
#ifdef __WXMSW__
typedef unsigned __int64 int8byte;
#endif // __WXMSW__
#ifdef __WXGTK__
typedef unsigned long long int8byte;
#endif // __WXGTK__
#define USE_GENERIC_TREECTRL 0
#if USE_GENERIC_TREECTRL
@ -94,7 +120,7 @@
#endif
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
#define OPJ_APPLICATION_VERSION wxT("0.1 alpha")
#define OPJ_APPLICATION_VERSION wxT("0.2 alpha")
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")
@ -140,6 +166,13 @@ class OPJViewerApp: public wxApp
// the list of all filenames written in the command line
wxArrayString m_filelist;
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
// private methods and variables
private:
bool m_showImages, m_showButtons;
@ -163,9 +196,11 @@ class OPJCanvas: public wxScrolledWindow
void OnEvent(wxMouseEvent& event);
void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave();}
OPJDecoThread *CreateDecoThread(void);
OPJChildFrame *m_childframe;
wxBitmap m_image;
wxBitmap m_image, m_image100;
wxFileName m_fname;
long m_zooml;
DECLARE_EVENT_TABLE()
};
@ -223,7 +258,7 @@ public:
void OnEndLabelEdit(wxTreeEvent& event);*/
/*void OnDeleteItem(wxTreeEvent& event);*/
/*void OnContextMenu(wxContextMenuEvent& event);*/
/*void OnItemMenu(wxTreeEvent& event);*/
void OnItemMenu(wxTreeEvent& event);
/*void OnGetInfo(wxTreeEvent& event);
void OnSetInfo(wxTreeEvent& event);*/
/*void OnItemExpanded(wxTreeEvent& event);*/
@ -304,10 +339,15 @@ class OPJFrame: public wxMDIParentFrame
void OnAbout(wxCommandEvent& WXUNUSED(event));
void OnFileOpen(wxCommandEvent& WXUNUSED(event));
void OnQuit(wxCommandEvent& WXUNUSED(event));
void OnClose(wxCommandEvent& WXUNUSED(event));
void OnZoom(wxCommandEvent& WXUNUSED(event));
void OnFit(wxCommandEvent& WXUNUSED(event));
void OnToggleWindow(wxCommandEvent& WXUNUSED(event));
void OnSetsDeco(wxCommandEvent& event);
void OnSashDrag(wxSashEvent& event);
void OpenFiles(wxArrayString paths, wxArrayString filenames);
void OnNotebook(wxNotebookEvent& event);
void Rescale(int scale, OPJChildFrame *child);
OPJMarkerTreeHash m_treehash;
OPJChildFrameHash m_childhash;
@ -345,25 +385,29 @@ class OPJChildFrame: public wxMDIChildFrame
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
void OnClose(wxCloseEvent& event);
void OnGotFocus(wxFocusEvent& event);
/*void OnLostFocus(wxFocusEvent& event);*/
void OnLostFocus(wxFocusEvent& event);
OPJFrame *m_frame;
wxFileName m_fname;
int m_winnumber;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#define SASHTEST_QUIT wxID_EXIT
#define SASHTEST_NEW_WINDOW 2
#define SASHTEST_REFRESH 3
#define SASHTEST_CHILD_QUIT 4
#define SASHTEST_ABOUT wxID_ABOUT
#define SASHTEST_TOGGLE_WINDOW 6
// frame and main menu ids
enum {
OPJFRAME_FILEEXIT = wxID_EXIT,
OPJFRAME_HELPABOUT = wxID_ABOUT,
OPJFRAME_FILEOPEN,
OPJFRAME_FILETOGGLE,
OPJFRAME_VIEWZOOM,
OPJFRAME_VIEWFIT,
OPJFRAME_FILECLOSE,
OPJFRAME_SETSDECO,
OPJFRAME_BROWSEWIN = 10000,
OPJFRAME_LOGWIN
};
#define ID_WINDOW_TOP 100
#define ID_WINDOW_LEFT1 101
#define ID_WINDOW_LEFT2 102
#define ID_WINDOW_BOTTOM 103
// menu and control ids
enum
@ -466,4 +510,56 @@ private:
};
// Drag and drop files target
class OPJDnDFile: public wxFileDropTarget
{
public:
OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; }
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
private:
OPJFrame *m_pOwner;
};
// Property sheet dialog
class OPJDecoderDialog: public wxPropertySheetDialog
{
DECLARE_CLASS(OPJDecoderDialog)
public:
OPJDecoderDialog(wxWindow* parent, int dialogType);
~OPJDecoderDialog();
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
wxPanel* CreateMainSettingsPage(wxWindow* parent);
#ifdef USE_JPWL
void OnEnableJPWL(wxCommandEvent& event);
wxPanel* CreateJPWLSettingsPage(wxWindow* parent);
wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl;
wxCheckBox *m_enablejpwlCheck;
#endif // USE_JPWL
protected:
enum {
OPJDECO_REDUCEFACTOR = 100,
OPJDECO_QUALITYLAYERS,
OPJDECO_NUMCOMPS,
OPJDECO_ENABLEJPWL,
OPJDECO_EXPCOMPS,
OPJDECO_MAXTILES
};
wxImageList* m_imageList;
DECLARE_EVENT_TABLE()
};
#endif //__OPJ_VIEWER_H__

View File

@ -1,2 +1,3 @@
OPJChild16 ICON OPJChild.ico
OPJViewer16 ICON OPJViewer.ico
#include "wx/msw/wx.rc"

View File

@ -51,10 +51,6 @@
#include "wx/module.h"
#endif
#include "libopenjpeg/openjpeg.h"
#include "wx/filefn.h"
#include "wx/wfstream.h"
@ -150,12 +146,18 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = J2K_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 = JPWL_EXPECTED_COMPONENTS;
parameters.jpwl_max_tiles = JPWL_MAXIMUM_TILES;
parameters.jpwl_correct = true;
parameters.jpwl_exp_comps = m_expcomps;
parameters.jpwl_max_tiles = m_maxtiles;
parameters.jpwl_correct = m_enablejpwl;
#endif /* USE_JPWL */
/* get a decoder handle */
@ -183,7 +185,7 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opjimage = opj_decode(dinfo, cio);
if (!opjimage) {
wxMutexGuiEnter();
wxLogError("J2K: failed to decode image!");
wxLogError(wxT("J2K: failed to decode image!"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
@ -198,7 +200,7 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
// check image components
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("J2K: weird number of components");
wxLogError(wxT("J2K: weird number of components"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
free(src);

View File

@ -44,9 +44,19 @@
#if wxUSE_LIBOPENJPEG
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#define wxBITMAP_TYPE_J2K 47
#define wxIMAGE_OPTION_REDUCEFACTOR wxString(_T("reducefactor"))
#define wxIMAGE_OPTION_QUALITYLAYERS wxString(_T("qualitylayers"))
#define wxIMAGE_OPTION_MAXCOMPS wxString(_T("maxcomps"))
#ifdef USE_JPWL
#define wxIMAGE_OPTION_ENABLEJPWL wxString(_T("enablejpwl"))
#define wxIMAGE_OPTION_EXPCOMPS wxString(_T("expcomps"))
#define wxIMAGE_OPTION_MAXTILES wxString(_T("maxtiles"))
#endif // USE_JPWL
class WXDLLEXPORT wxJ2KHandler: public wxImageHandler
{
public:
@ -56,8 +66,24 @@ public:
m_extension = wxT("j2k");
m_type = wxBITMAP_TYPE_J2K;
m_mime = wxT("image/j2k");
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
#ifdef USE_JPWL
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
}
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );

View File

@ -149,6 +149,19 @@ bool wxJP2Handler::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);
@ -175,7 +188,7 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opjimage = opj_decode(dinfo, cio);
if (!opjimage) {
wxMutexGuiEnter();
wxLogError("JP2: failed to decode image!");
wxLogError(wxT("JP2: failed to decode image!"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
@ -189,7 +202,7 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
// check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("JP2: weird number of components");
wxLogError(wxT("JP2: weird number of components"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
free(src);

View File

@ -44,6 +44,7 @@
#if wxUSE_LIBOPENJPEG
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#define wxBITMAP_TYPE_JP2 48
@ -56,8 +57,24 @@ public:
m_extension = wxT("jp2");
m_type = wxBITMAP_TYPE_JP2;
m_mime = wxT("image/jp2");
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
#ifdef USE_JPWL
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
}
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );

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);

View File

@ -44,6 +44,7 @@
#if wxUSE_LIBOPENJPEG
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#define wxBITMAP_TYPE_MJ2 49
@ -56,8 +57,24 @@ public:
m_extension = wxT("mj2");
m_type = wxBITMAP_TYPE_MJ2;
m_mime = wxT("image/mj2");
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
#ifdef USE_JPWL
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
}
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );

View File

@ -0,0 +1,13 @@
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
Copyright (c) 2002-2007, Professor Benoit Macq
Copyright (c) 2001-2003, David Janssens
Copyright (c) 2002-2003, Yannick Verschueren
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
Copyright (c) 2005, Herve Drolon, FreeImage Team
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1 @@
Good choice!

View File

@ -0,0 +1,11 @@
What is OpenJPEG ?
==================
The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ...
Who can use the library ?
=========================
Anybody. As the OpenJPEG library is released under the BSD license, anybody can use or modify the library, even for commercial applications. The only restriction is to retain the copyright in the sources or the binaries documentation.
Who is developing the library ?
===============================
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.

View File

@ -196,7 +196,7 @@ void OPJParseThread::ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOff
// marker name
wxTreeItemId subcurrid1 = m_tree->AppendItem(currid,
wxT("*** ") + wxString(marker_descr[m]) + wxT(" ***"),
wxT("*** ") + wxString::Format(wxT("%s"), marker_descr[m]) + wxT(" ***"),
image, imageSel,
new OPJMarkerData(wxT("INFO"))
);

View File

@ -61,8 +61,10 @@ typedef enum {
TKHD_BOX,
MDIA_BOX,
MINF_BOX,
VMHD_BOX,
STBL_BOX,
STSD_BOX,
STSZ_BOX,
MJP2_BOX,
MDAT_BOX,
ANY_BOX,
@ -377,15 +379,15 @@ int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffs
new OPJMarkerData(wxT("INFO"))
);
} else {
unsigned __int64 creation_time, modification_time, duration;
int8byte creation_time, modification_time, duration;
unsigned long int timescale;
fileid->Read(&creation_time, sizeof(unsigned __int64));
fileid->Read(&creation_time, sizeof(int8byte));
creation_time = BYTE_SWAP8(creation_time);
fileid->Read(&modification_time, sizeof(unsigned __int64));
fileid->Read(&modification_time, sizeof(int8byte));
modification_time = BYTE_SWAP8(modification_time);
fileid->Read(&timescale, sizeof(unsigned long int));
timescale = BYTE_SWAP4(timescale);
fileid->Read(&duration, sizeof(unsigned __int64));
fileid->Read(&duration, sizeof(int8byte));
duration = BYTE_SWAP8(duration);
wxTreeItemId currid = m_tree->AppendItem(parentid,
wxString::Format(wxT("Creation time: %u"), creation_time),
@ -454,6 +456,110 @@ int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffs
break;
/* Sample Size box */
case (STSZ_BOX): {
unsigned long int version, sample_size, sample_count, entry_size;
fileid->Read(&version, sizeof(unsigned long int));
version = BYTE_SWAP4(version);
fileid->Read(&sample_size, sizeof(unsigned long int));
sample_size = BYTE_SWAP4(sample_size);
if (sample_size == 0) {
fileid->Read(&sample_count, sizeof(unsigned long int));
sample_count = BYTE_SWAP4(sample_count);
wxTreeItemId currid = m_tree->AppendItem(parentid,
wxString::Format(wxT("Sample count: %d"), sample_count),
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
);
currid = m_tree->AppendItem(parentid,
wxT("Entries size (bytes)"),
m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1,
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
);
wxString text;
for (int s = 0; s < sample_count; s++) {
fileid->Read(&entry_size, sizeof(unsigned long int));
entry_size = BYTE_SWAP4(entry_size);
text << wxString::Format(wxT("%d, "), entry_size);
if (((s % 10) == (ITEM_PER_ROW - 1)) || (s == (sample_count - 1))) {
m_tree->AppendItem(currid,
text,
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
);
text = wxT("");
}
}
}
};
break;
/* Video Media Header box */
case (VMHD_BOX): {
unsigned long int version;
unsigned short int graphicsmode, opcolor[3];
char graphicsdescr[100];
fileid->Read(&version, sizeof(unsigned long int));
version = BYTE_SWAP4(version);
fileid->Read(&graphicsmode, sizeof(unsigned short int));
graphicsmode = BYTE_SWAP2(graphicsmode);
switch (graphicsmode) {
case (0x00):
strcpy(graphicsdescr, "copy");
break;
case (0x24):
strcpy(graphicsdescr, "transparent");
break;
case (0x0100):
strcpy(graphicsdescr, "alpha");
break;
case (0x0101):
strcpy(graphicsdescr, "whitealpha");
break;
case (0x0102):
strcpy(graphicsdescr, "blackalpha");
break;
default:
strcpy(graphicsdescr, "unknown");
break;
};
fileid->Read(opcolor, 3 * sizeof(unsigned short int));
opcolor[0] = BYTE_SWAP2(opcolor[0]);
opcolor[1] = BYTE_SWAP2(opcolor[1]);
opcolor[2] = BYTE_SWAP2(opcolor[2]);
wxTreeItemId currid = m_tree->AppendItem(parentid,
wxString::Format(wxT("Composition mode: %d (%s)"), graphicsmode, graphicsdescr),
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
);
currid = m_tree->AppendItem(parentid,
wxString::Format(wxT("OP color: %d %d %d"), opcolor[0], opcolor[1], opcolor[2]),
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
);
};
break;
/* MJP2 Sample Description box */
case (MJP2_BOX): {
@ -500,8 +606,6 @@ int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffs
default:
break;
};
return (0);
@ -525,8 +629,10 @@ int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffs
#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 STSZ_SIGN "stsz"
#define MJP2_SIGN "mjp2"
#define MDAT_SIGN "mdat"
#define ANY_SIGN ""
@ -658,6 +764,13 @@ struct boxdef j2box[] =
/* req */ {1, 1, 1},
/* ins */ MDIA_BOX},
/* sign */ {VMHD_SIGN,
/* short */ "Video Media Header box",
/* long */ "The video media header contains general presentation information, independent of the coding, for video media",
/* sbox */ 0,
/* req */ {1, 1, 1},
/* ins */ MINF_BOX},
/* sign */ {STBL_SIGN,
/* short */ "Sample Table box",
/* long */ "The sample table contains all the time and data indexing of the media samples in a track",
@ -666,13 +779,20 @@ struct boxdef j2box[] =
/* ins */ MINF_BOX},
/* sign */ {STSD_SIGN,
/* short */ "Sample Description box",
/* short */ "STSD Sample Description box",
/* long */ "The sample description table gives detailed information about the coding type used, and any initialization "
"information needed for that coding",
/* sbox */ 0,
/* req */ {1, 1, 1},
/* ins */ MINF_BOX},
/* sign */ {STSZ_SIGN,
/* short */ "Sample Size box",
/* long */ "This box contains the sample count and a table giving the size of each sample",
/* sbox */ 0,
/* req */ {1, 1, 1},
/* ins */ STBL_BOX},
/* sign */ {MJP2_SIGN,
/* short */ "MJP2 Sample Description box",
/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization "
@ -727,7 +847,7 @@ int OPJParseThread::jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFile
int LBox_read;
char TBox[5] = "\0\0\0\0";
int TBox_read;
__int64 XLBox = 0x0000000000000000;
int8byte XLBox = 0x0000000000000000;
int XLBox_read;
unsigned long int box_length = 0;
int last_box = 0, box_num = 0;