]> granicus.if.org Git - openjpeg/commitdiff
enable/disable decoding in OPJViewer
authorGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Sun, 22 Apr 2007 22:41:01 +0000 (22:41 +0000)
committerGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Sun, 22 Apr 2007 22:41:01 +0000 (22:41 +0000)
ChangeLog
OPJViewer/OPJViewer.dsp
OPJViewer/Readme.txt
OPJViewer/source/OPJViewer.cpp
OPJViewer/source/OPJViewer.h
OPJViewer/source/license.txt
OPJViewer/source/readmeafter.txt

index 1dbbbfa2ba8d585c3da1b5bfbb2b512c7efaf314..1d7430342eda8560e4de467614a25078ce1bbe9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@ What's New for OpenJPEG
 ! : changed
 + : added
 
+April 23, 2007
++ [GB] Enable/disable image decoding in OPJViewer
+
 April 12,2007
 * [Parvatha] Fixed Error in tiftoimage(). Modification in convert.c.
 
index b1aaad9a044993e2b4b049cac8fd914fb44c1ef3..22a21e47d40bde75d28e79dc7dd5ec5116f8c830 100644 (file)
@@ -42,15 +42,15 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /G6 /MD /W3 /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" /D "OPJ_HTMLABOUT" /FR /FD /c\r
+# 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" /FR /FD /c\r
 # ADD BASE RSC /l 0x410 /d "NDEBUG"\r
-# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"\r
+# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"\r
 BSC32=bscmake.exe\r
 # ADD BASE BSC32 /nologo\r
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # 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\r
-# 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\r
+# 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\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ELSEIF  "$(CFG)" == "OPJViewer - Win32 Debug"\r
index 957113492873272d740ceac4fe8b35918db06f54..bc29075e0bc03977023cc1f96df264fe9ea5b774 100644 (file)
@@ -17,26 +17,31 @@ This document describes the installation and use of the OPJViewer in the framewo
 \r
 This implementation has been developed using the OpenJPEG library as decoding engine and wxWidgets 2.8.0 as GUI engine.\r
 \r
-If you find some bugs or if you have problems using the encoder/decoder, please send an e-mail to jpwl@diei.unipg.it\r
+If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it\r
 \r
 2. Installing the viewer\r
 ==========================\r
 \r
-There are two available options, at the moment: a) compile from source code, and b) download a precompiled binary. In order to perform option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8.0 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).\r
+There are two options available, at the moment:\r
+\r
+a) compile from source code\r
+b) download a precompiled binary.\r
+\r
+In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8.0 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).\r
 \r
 2.1. Compiling the source code in Windows\r
 -------------------------------------------\r
 \r
-These are the steps required to compile the viewer under windows.\r
+The steps required to compile the viewer under windows are:\r
 \r
-a) Download at least the libonjpeg, jpwl, and opjviewer folders from the SVN trunk.\r
+a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk.\r
 b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration.\r
 c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them.\r
 d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path.\r
 e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path.\r
 f) Build!\r
 g) Run!\r
-h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download it from http://www.jrsoftware.org/isinfo.php).\r
+h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).\r
 \r
 2.2. Compiling the source code in Unix-like systems\r
 -----------------------------------------------------\r
@@ -47,8 +52,9 @@ The porting is possible and under way.
 3. General information on the viewer\r
 ====================================\r
 \r
-This viewer is conceived to open and display information and image of J2K, JP2, and MJ2 files.\r
-The viewer application graphical interface is divided into three main panels:\r
+This viewer is conceived to open and display information and image content of J2K, JP2,\r
+and MJ2 files.\r
+The viewer application interface is divided into three main panels:\r
 - a browsing pane;\r
 - a viewing pane;\r
 - a log/peek pane.\r
@@ -92,4 +98,4 @@ The log/peek pane is shared among two different subpanels:
 4.2. Limitations\r
 ------------------\r
 \r
-* For mj2 files, only the first frame is displayed, and only in B/W\r
+* For mj2 files, rendering is only in B/W\r
index 1dcd026eed6e178e459426677693c946cec8c982..bf7a2077bb5eadc4cf4555d0150f0a061fcaa6d6 100644 (file)
@@ -201,6 +201,7 @@ bool OPJViewerApp::OnInit(void)
     wxFileSystem::AddHandler(new wxMemoryFSHandler);\r
 \r
        // set decoding engine parameters\r
+       m_enabledeco = true;\r
        m_resizemethod = 0;\r
        m_reducefactor = 0;\r
        m_qualitylayers = 0;\r
@@ -450,6 +451,7 @@ void OPJFrame::OnSetsDeco(wxCommandEvent& event)
     if (dialog.ShowModal() == wxID_OK) {\r
 \r
                // load settings\r
+               wxGetApp().m_enabledeco = dialog.m_enabledecoCheck->GetValue();\r
                wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection();\r
                wxGetApp().m_reducefactor = dialog.m_reduceCtrl->GetValue();\r
                wxGetApp().m_qualitylayers = dialog.m_layerCtrl->GetValue();\r
@@ -748,6 +750,7 @@ OPJCanvas::OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, con
        // 100% zoom\r
        m_zooml = 100;\r
 \r
+\r
     OPJDecoThread *dthread = CreateDecoThread();\r
 \r
     if (dthread->Run() != wxTHREAD_NO_ERROR)\r
@@ -1840,9 +1843,6 @@ void *OPJDecoThread::Entry()
     //            GetId(), GetPriority(), m_countnum);\r
     text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);\r
 \r
-\r
-\r
-\r
     WriteText(text);\r
 \r
     wxBitmap bitmap(100, 100);\r
@@ -1884,10 +1884,22 @@ void *OPJDecoThread::Entry()
        mj222handler->m_maxtiles = wxGetApp().m_maxtiles;\r
 #endif // USE_JPWL\r
 \r
-       // load the file\r
-    if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY), 0) {\r
-        WriteText(wxT("Can't load image"));\r
-               return NULL;\r
+       if (wxGetApp().m_enabledeco) {\r
+\r
+               // load the file\r
+               if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {\r
+                       WriteText(wxT("Can't load image"));\r
+                       return NULL;\r
+               }\r
+\r
+       } else {\r
+\r
+               // display a macaron\r
+               if (!image.Create(300, 5, false)) {\r
+                       WriteText(wxT("Can't create image"));\r
+                       return NULL;\r
+               }\r
+\r
        }\r
 \r
        // assign 100% image\r
@@ -2021,6 +2033,7 @@ IMPLEMENT_CLASS(OPJDecoderDialog, wxPropertySheetDialog)
 \r
 BEGIN_EVENT_TABLE(OPJDecoderDialog, wxPropertySheetDialog)\r
 #ifdef USE_JPWL\r
+       EVT_CHECKBOX(OPJDECO_ENABLEDECO, OPJDecoderDialog::OnEnableDeco)\r
        EVT_CHECKBOX(OPJDECO_ENABLEJPWL, OPJDecoderDialog::OnEnableJPWL)\r
 #endif // USE_JPWL\r
 END_EVENT_TABLE()\r
@@ -2036,20 +2049,26 @@ OPJDecoderDialog::OPJDecoderDialog(wxWindow* win, int dialogType)
 \r
        CreateButtons(wxOK | wxCANCEL | (int)wxPlatform::IfNot(wxOS_WINDOWS_CE, wxHELP));\r
 \r
-       wxBookCtrlBase* notebook = GetBookCtrl();\r
+       m_settingsNotebook = GetBookCtrl();\r
 \r
-       wxPanel* mainSettings = CreateMainSettingsPage(notebook);\r
-       wxPanel* jpeg2000Settings = CreatePart1SettingsPage(notebook);\r
-       wxPanel* mjpeg2000Settings = CreatePart3SettingsPage(notebook);\r
+       wxPanel* mainSettings = CreateMainSettingsPage(m_settingsNotebook);\r
+       wxPanel* jpeg2000Settings = CreatePart1SettingsPage(m_settingsNotebook);\r
+       if (!wxGetApp().m_enabledeco)\r
+               jpeg2000Settings->Enable(false);\r
+       wxPanel* mjpeg2000Settings = CreatePart3SettingsPage(m_settingsNotebook);\r
+       if (!wxGetApp().m_enabledeco)\r
+               mjpeg2000Settings->Enable(false);\r
 #ifdef USE_JPWL\r
-       wxPanel* jpwlSettings = CreatePart11SettingsPage(notebook);\r
+       wxPanel* jpwlSettings = CreatePart11SettingsPage(m_settingsNotebook);\r
+       if (!wxGetApp().m_enabledeco)\r
+               jpwlSettings->Enable(false);\r
 #endif // USE_JPWL\r
 \r
-       notebook->AddPage(mainSettings, wxT("Display"), false);\r
-       notebook->AddPage(jpeg2000Settings, wxT("JPEG 2000"), false);\r
-       notebook->AddPage(mjpeg2000Settings, wxT("MJPEG 2000"), false);\r
+       m_settingsNotebook->AddPage(mainSettings, wxT("Display"), false);\r
+       m_settingsNotebook->AddPage(jpeg2000Settings, wxT("JPEG 2000"), false);\r
+       m_settingsNotebook->AddPage(mjpeg2000Settings, wxT("MJPEG 2000"), false);\r
 #ifdef USE_JPWL\r
-       notebook->AddPage(jpwlSettings, wxT("JPWL"), false);\r
+       m_settingsNotebook->AddPage(jpwlSettings, wxT("JPWL"), false);\r
 #endif // USE_JPWL\r
 \r
        LayoutDialog();\r
@@ -2173,6 +2192,12 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent)
                // sub top sizer\r
                wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL);\r
 \r
+               // add decoding enabling check box\r
+               subtopSizer->Add(\r
+                       m_enabledecoCheck = new wxCheckBox(panel, OPJDECO_ENABLEDECO, wxT("Enable decoding"), wxDefaultPosition, wxDefaultSize),\r
+                       0, wxGROW | wxALL, 5);\r
+               m_enabledecoCheck->SetValue(wxGetApp().m_enabledeco);\r
+\r
                        // resize settings, column\r
                        wxString choices[] = {wxT("Low quality"), wxT("High quality")};\r
                        m_resizeBox = new wxRadioBox(panel, OPJDECO_RESMETHOD,\r
@@ -2433,6 +2458,30 @@ wxPanel* OPJDecoderDialog::CreatePart11SettingsPage(wxWindow* parent)
     return panel;\r
 }\r
 \r
+void OPJDecoderDialog::OnEnableDeco(wxCommandEvent& event)\r
+{\r
+       size_t pp;\r
+\r
+       if (event.IsChecked()) {\r
+               wxLogMessage(wxT("Decoding enabled"));\r
+               m_resizeBox->Enable(true);\r
+               // enable all tabs except ourselves\r
+               for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) {\r
+                       if (m_settingsNotebook->GetPageText(pp) != wxT("Display"))\r
+                               m_settingsNotebook->GetPage(pp)->Enable(true);\r
+               }\r
+       } else {\r
+               wxLogMessage(wxT("Decoding disabled"));\r
+               m_resizeBox->Enable(false);\r
+               // disable all tabs except ourselves\r
+               for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) {\r
+                       if (m_settingsNotebook->GetPageText(pp) != wxT("Display"))\r
+                               m_settingsNotebook->GetPage(pp)->Enable(false);\r
+               }\r
+       }\r
+\r
+}\r
+\r
 void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event)\r
 {\r
        if (event.IsChecked()) {\r
index deb3e8f08c2bb462af337d02d0f6c0cbf3e52fe4..c1413b749846dc3000d57f6c7914a9a86f507ece 100644 (file)
@@ -182,6 +182,7 @@ class OPJViewerApp: public wxApp
                int m_resizemethod;\r
 \r
                // decoding engine parameters\r
+               bool m_enabledeco;\r
                int m_reducefactor, m_qualitylayers, m_components, m_framenum;\r
 #ifdef USE_JPWL\r
                bool m_enablejpwl;\r
@@ -562,9 +563,13 @@ public:
     OPJDecoderDialog(wxWindow* parent, int dialogType);\r
     ~OPJDecoderDialog();\r
 \r
+       wxBookCtrlBase* m_settingsNotebook;\r
+       wxCheckBox *m_enabledecoCheck;\r
        wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;\r
        wxRadioBox* m_resizeBox;\r
 \r
+       void OnEnableDeco(wxCommandEvent& event);\r
+\r
     wxPanel* CreateMainSettingsPage(wxWindow* parent);\r
     wxPanel* CreatePart1SettingsPage(wxWindow* parent);\r
     wxPanel* CreatePart3SettingsPage(wxWindow* parent);\r
@@ -583,6 +588,7 @@ protected:
                OPJDECO_REDUCEFACTOR,\r
                OPJDECO_QUALITYLAYERS,\r
                OPJDECO_NUMCOMPS,\r
+               OPJDECO_ENABLEDECO,\r
                OPJDECO_ENABLEJPWL,\r
                OPJDECO_EXPCOMPS,\r
                OPJDECO_MAXTILES,\r
index 2d0f584a50d1157101ee9f16d73a116785d771cc..81d6b3493a6b98ad66a660763b4e4dc7a94a6ebe 100644 (file)
@@ -4,6 +4,7 @@ Copyright (c) 2001-2003, David Janssens
 Copyright (c) 2002-2003, Yannick Verschueren\r
 Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe\r
 Copyright (c) 2005, Herve Drolon, FreeImage Team\r
+Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy\r
 All rights reserved.\r
 \r
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:\r
index deffff3fd88f4963e234ff95772b7ba5ef0fc8a3..d5e8fb9aa7354bd5a80619d01a23938b4151f650 100644 (file)
@@ -1 +1,34 @@
-Good choice!
\ No newline at end of file
+This viewer is conceived to open and display information and image content of J2K, JP2,\r
+and MJ2 files.\r
+The viewer application interface is divided into three main panels:\r
+- a browsing pane;\r
+- a viewing pane;\r
+- a log/peek pane.\r
+\r
+The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:\r
+\r
+filename\r
+|\r
+|_ #000: Marker/Box short name (Hex code)\r
+|  |\r
+|  |_ *** Marker/Box long name ***\r
+|  |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)\r
+|  |_ Additional info, depending on the marker/box type\r
+|  |_ ...\r
+|\r
+|_ #001: Marker/Box short name (Hex code)\r
+|  |\r
+|  |_ ...\r
+|\r
+...\r
+\r
+\r
+The viewing pane will display the decoded image contained in the JPEG 2000 file.\r
+It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.\r
+\r
+\r
+The log/peek pane is shared among two different subpanels:\r
+\r
+- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library\r
+- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section. \r
+\r