Possibility to disable parsing in OPJViewer; also, saves common settings to the registry; automatic build numbering

This commit is contained in:
Giuseppe Baruffa 2007-06-16 17:28:47 +00:00
parent 3d626da232
commit 2845d9bf64
12 changed files with 153 additions and 43 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
June 16, 2007
+ [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry
June 15, 2007
* [FOD] Fixed the generation of index files

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# 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 /W3 /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" /D "OPJ_MANYFORMATS" /FR /FD /c
# ADD CPP /nologo /G6 /MD /W3 /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" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
BSC32=bscmake.exe
@ -67,15 +67,15 @@ LINK32=link.exe
# 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 /W3 /Gm /GX /Zi /Od /I "d:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\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
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\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
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x410 /i "d:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
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 /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_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"d:\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

View File

@ -42,3 +42,7 @@ Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon
[Run]
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
[Registry]
Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:

View File

@ -52,8 +52,7 @@ The porting is possible and under way.
3. General information on the viewer
====================================
This viewer is conceived to open and display information and image content of J2K, JP2,
and MJ2 files.
This viewer is conceived to open and display information and image content of J2K, JP2, and MJ2 files.
The viewer application interface is divided into three main panels:
- a browsing pane;
- a viewing pane;

15
OPJViewer/buildupdate.bat Normal file
View File

@ -0,0 +1,15 @@
::== buildupdate.bat
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=2,* delims=^(^) " %%a in ('find /v "" ^< .\source\build.h') do (
rem echo %%a
set /A M = %%a + 1
echo Build !M!
echo wxT^("!M!"^) > buildtemp283746825t347
)
if exist buildtemp283746825t347 move /Y buildtemp283746825t347 .\source\build.h
if exist buildtemp283746825t347 del /F /Q buildtemp283746825t347
::==

View File

@ -207,8 +207,30 @@ bool OPJViewerApp::OnInit(void)
// memory file system
wxFileSystem::AddHandler(new wxMemoryFSHandler);
#ifdef OPJ_INICONFIG
//load decoding engine parameters
OPJconfig = new wxConfig(OPJ_APPLICATION, OPJ_APPLICATION_VENDOR);
OPJconfig->Read(wxT("enabledeco"), &m_enabledeco, (bool) true);
OPJconfig->Read(wxT("enableparse"), &m_enableparse, (bool) true);
OPJconfig->Read(wxT("resizemethod"), &m_resizemethod, (long) 0);
OPJconfig->Read(wxT("reducefactor"), &m_reducefactor, (long) 0);
OPJconfig->Read(wxT("qualitylayers"), &m_qualitylayers, (long) 0);
OPJconfig->Read(wxT("components"), &m_components, (long) 0);
OPJconfig->Read(wxT("framenum"), &m_framenum, (long) 0);
#ifdef USE_JPWL
OPJconfig->Read(wxT("enablejpwl"), &m_enablejpwl, (bool) true);
OPJconfig->Read(wxT("expcomps"), &m_expcomps, (long) JPWL_EXPECTED_COMPONENTS);
OPJconfig->Read(wxT("maxtiles"), &m_maxtiles, (long) JPWL_MAXIMUM_TILES);
#endif // USE_JPWL
OPJconfig->Write(wxT("teststring"), wxT("This is a test value"));
OPJconfig->Write(wxT("testbool"), (bool) true);
OPJconfig->Write(wxT("testlong"), (long) 245);
#else
// set decoding engine parameters
m_enabledeco = true;
m_enableparse = true;
m_resizemethod = 0;
m_reducefactor = 0;
m_qualitylayers = 0;
@ -219,6 +241,7 @@ bool OPJViewerApp::OnInit(void)
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
#endif // OPJ_INICONFIG
// Create the main frame window
OPJFrame *frame = new OPJFrame(NULL, wxID_ANY, OPJ_APPLICATION_TITLEBAR,
@ -250,6 +273,26 @@ bool OPJViewerApp::OnInit(void)
return true;
}
int OPJViewerApp::OnExit()
{
#ifdef OPJ_INICONFIG
OPJconfig->Write(wxT("enabledeco"), m_enabledeco);
OPJconfig->Write(wxT("enableparse"), m_enableparse);
OPJconfig->Write(wxT("resizemethod"), m_resizemethod);
OPJconfig->Write(wxT("reducefactor"), m_reducefactor);
OPJconfig->Write(wxT("qualitylayers"), m_qualitylayers);
OPJconfig->Write(wxT("components"), m_components);
OPJconfig->Write(wxT("framenum"), m_framenum);
#ifdef USE_JPWL
OPJconfig->Write(wxT("enablejpwl"), m_enablejpwl);
OPJconfig->Write(wxT("expcomps"), m_expcomps);
OPJconfig->Write(wxT("maxtiles"), m_maxtiles);
#endif // USE_JPWL
#endif // OPJ_INICONFIG
return 1;
}
void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser)
{
wxString s = wxT("Command line parsed successfully:\nInput files: ");
@ -472,7 +515,8 @@ void OPJFrame::OnSetsDeco(wxCommandEvent& event)
// load settings
wxGetApp().m_enabledeco = dialog.m_enabledecoCheck->GetValue();
wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection();
wxGetApp().m_enableparse = dialog.m_enableparseCheck->GetValue();
wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection() - 1;
wxGetApp().m_reducefactor = dialog.m_reduceCtrl->GetValue();
wxGetApp().m_qualitylayers = dialog.m_layerCtrl->GetValue();
wxGetApp().m_components = dialog.m_numcompsCtrl->GetValue();
@ -548,6 +592,12 @@ void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
{
wxImage new_image = currframe->m_canvas->m_image100.ConvertToImage();
// resizing enabled?
if (wxGetApp().m_resizemethod == -1) {
zooml = 100;
}
if (zooml != 100)
new_image.Rescale((int) ((double) zooml * (double) new_image.GetWidth() / 100.0),
(int) ((double) zooml * (double) new_image.GetHeight() / 100.0),
@ -558,6 +608,7 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
(int)(0.5 + (double) new_image.GetWidth() / 20.0),
(int)(0.5 + (double) new_image.GetHeight() / 20.0)
);
currframe->m_canvas->Refresh();
// update zoom
@ -1125,6 +1176,9 @@ void OPJParseThread::LoadFile(wxFileName fname)
// open the file
wxFile m_file(fname.GetFullPath().c_str(), wxFile::read);
// parsing enabled?
if (wxGetApp().m_enableparse) {
// what is the extension?
if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) {
@ -1140,9 +1194,10 @@ void OPJParseThread::LoadFile(wxFileName fname)
ParseJ2KFile(&m_file, data->m_start, data->m_length, rootid);
m_tree->Expand(rootid);
} else
} else {
// as usual
ParseJP2File(&m_file, 0, m_file.Length(), rootid);
}
} else {
@ -1151,6 +1206,9 @@ void OPJParseThread::LoadFile(wxFileName fname)
}
}
// this is the root node
if (this->m_parentid)
m_tree->SetItemText(rootid, wxT("Codestream"));
@ -2131,8 +2189,14 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent)
0, wxGROW | wxALL, 5);
m_enabledecoCheck->SetValue(wxGetApp().m_enabledeco);
// add parsing enabling check box
subtopSizer->Add(
m_enableparseCheck = new wxCheckBox(panel, OPJDECO_ENABLEPARSE, wxT("Enable parsing"), wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL, 5);
m_enableparseCheck->SetValue(wxGetApp().m_enableparse);
// resize settings, column
wxString choices[] = {wxT("Low quality"), wxT("High quality")};
wxString choices[] = {wxT("Don't resize"), wxT("Low quality"), wxT("High quality")};
m_resizeBox = new wxRadioBox(panel, OPJDECO_RESMETHOD,
wxT("Resize method"),
wxDefaultPosition, wxDefaultSize,
@ -2140,7 +2204,7 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent)
choices,
1,
wxRA_SPECIFY_ROWS);
m_resizeBox->SetSelection(wxGetApp().m_resizemethod);
m_resizeBox->SetSelection(wxGetApp().m_resizemethod + 1);
subtopSizer->Add(m_resizeBox, 0, wxGROW | wxALL, 5);

View File

@ -128,6 +128,7 @@ typedef unsigned long long int8byte;
#define OPJ_APPLICATION_VERSION wxT("0.3 alpha")
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
#ifdef __WXMSW__
#define OPJ_APPLICATION_PLATFORM wxT("Windows")
@ -158,6 +159,7 @@ class OPJViewerApp: public wxApp
// other methods
bool OnInit(void);
int OnExit(void);
void SetShowImages(bool show) { m_showImages = show; }
bool ShowImages() const { return m_showImages; }
void ShowCmdLine(const wxCmdLineParser& parser);
@ -183,13 +185,16 @@ class OPJViewerApp: public wxApp
int m_resizemethod;
// decoding engine parameters
bool m_enabledeco;
bool m_enabledeco, m_enableparse;
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
// application configuration
wxConfig *OPJconfig;
// private methods and variables
private:
bool m_showImages, m_showButtons;
@ -619,7 +624,7 @@ public:
~OPJDecoderDialog();
wxBookCtrlBase* m_settingsNotebook;
wxCheckBox *m_enabledecoCheck;
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
wxRadioBox* m_resizeBox;
@ -644,6 +649,7 @@ protected:
OPJDECO_QUALITYLAYERS,
OPJDECO_NUMCOMPS,
OPJDECO_ENABLEDECO,
OPJDECO_ENABLEPARSE,
OPJDECO_ENABLEJPWL,
OPJDECO_EXPCOMPS,
OPJDECO_MAXTILES,

View File

@ -22,8 +22,10 @@ OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
"<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.</font><br>"
"<font size=-2 color=red>* Build: " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "</font><br>"
)
"<font size=-2 color=red>* Build: ")
#include "build.h"
wxT("</font><br>")
wxT("<font size=-2 color=red>* " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "</font><br>")
#ifdef USE_JPWL
wxT("<font size=-2 color=green>- Compiled with JPWL support</font><br>")
#endif // USE_JPWL

1
OPJViewer/source/build.h Normal file
View File

@ -0,0 +1 @@
wxT("20")

View File

@ -130,10 +130,18 @@ void mj2_info_callback(const char *msg, void *client_data) {
/* From little endian to big endian, 2 and 4 bytes */
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
#ifdef __WXGTK__
#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \
((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \
((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \
((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56)
#else
#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)
#endif
/* From codestream to int values */
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \

View File

@ -303,10 +303,18 @@ struct boxdef j22box[] =
/* From little endian to big endian, 2 and 4 bytes */
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
#define BYTE_SWAP8(X) (((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
#ifdef __WXGTK__
#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \
((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \
((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \
((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56)
#else
#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56))
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)
#endif
/* From codestream to int values */
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \