diff options
| author | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-04-22 22:41:01 +0000 |
|---|---|---|
| committer | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-04-22 22:41:01 +0000 |
| commit | fbc9a5edcb84f97b48692b4f1871ac34a04b9320 (patch) | |
| tree | 8ccbb5deab3734b843be6e4e4ffa6a29d8bf9854 /OPJViewer/source | |
| parent | 110b54c7c6f1ceea769264e78424883ff4a4701d (diff) | |
enable/disable decoding in OPJViewer
Diffstat (limited to 'OPJViewer/source')
| -rw-r--r-- | OPJViewer/source/OPJViewer.cpp | 81 | ||||
| -rw-r--r-- | OPJViewer/source/OPJViewer.h | 6 | ||||
| -rw-r--r-- | OPJViewer/source/license.txt | 1 | ||||
| -rw-r--r-- | OPJViewer/source/readmeafter.txt | 35 |
4 files changed, 106 insertions, 17 deletions
diff --git a/OPJViewer/source/OPJViewer.cpp b/OPJViewer/source/OPJViewer.cpp index 1dcd026e..bf7a2077 100644 --- a/OPJViewer/source/OPJViewer.cpp +++ b/OPJViewer/source/OPJViewer.cpp @@ -201,6 +201,7 @@ bool OPJViewerApp::OnInit(void) wxFileSystem::AddHandler(new wxMemoryFSHandler);
// set decoding engine parameters
+ m_enabledeco = true;
m_resizemethod = 0;
m_reducefactor = 0;
m_qualitylayers = 0;
@@ -450,6 +451,7 @@ void OPJFrame::OnSetsDeco(wxCommandEvent& event) if (dialog.ShowModal() == wxID_OK) {
// load settings
+ wxGetApp().m_enabledeco = dialog.m_enabledecoCheck->GetValue();
wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection();
wxGetApp().m_reducefactor = dialog.m_reduceCtrl->GetValue();
wxGetApp().m_qualitylayers = dialog.m_layerCtrl->GetValue();
@@ -748,6 +750,7 @@ OPJCanvas::OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, con // 100% zoom
m_zooml = 100;
+
OPJDecoThread *dthread = CreateDecoThread();
if (dthread->Run() != wxTHREAD_NO_ERROR)
@@ -1840,9 +1843,6 @@ void *OPJDecoThread::Entry() // GetId(), GetPriority(), m_countnum);
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
-
-
-
WriteText(text);
wxBitmap bitmap(100, 100);
@@ -1884,10 +1884,22 @@ void *OPJDecoThread::Entry() mj222handler->m_maxtiles = wxGetApp().m_maxtiles;
#endif // USE_JPWL
- // load the file
- if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY), 0) {
- WriteText(wxT("Can't load image"));
- return NULL;
+ if (wxGetApp().m_enabledeco) {
+
+ // load the file
+ if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
+ WriteText(wxT("Can't load image"));
+ return NULL;
+ }
+
+ } else {
+
+ // display a macaron
+ if (!image.Create(300, 5, false)) {
+ WriteText(wxT("Can't create image"));
+ return NULL;
+ }
+
}
// assign 100% image
@@ -2021,6 +2033,7 @@ IMPLEMENT_CLASS(OPJDecoderDialog, wxPropertySheetDialog) BEGIN_EVENT_TABLE(OPJDecoderDialog, wxPropertySheetDialog)
#ifdef USE_JPWL
+ EVT_CHECKBOX(OPJDECO_ENABLEDECO, OPJDecoderDialog::OnEnableDeco)
EVT_CHECKBOX(OPJDECO_ENABLEJPWL, OPJDecoderDialog::OnEnableJPWL)
#endif // USE_JPWL
END_EVENT_TABLE()
@@ -2036,20 +2049,26 @@ OPJDecoderDialog::OPJDecoderDialog(wxWindow* win, int dialogType) CreateButtons(wxOK | wxCANCEL | (int)wxPlatform::IfNot(wxOS_WINDOWS_CE, wxHELP));
- wxBookCtrlBase* notebook = GetBookCtrl();
+ m_settingsNotebook = GetBookCtrl();
- wxPanel* mainSettings = CreateMainSettingsPage(notebook);
- wxPanel* jpeg2000Settings = CreatePart1SettingsPage(notebook);
- wxPanel* mjpeg2000Settings = CreatePart3SettingsPage(notebook);
+ wxPanel* mainSettings = CreateMainSettingsPage(m_settingsNotebook);
+ wxPanel* jpeg2000Settings = CreatePart1SettingsPage(m_settingsNotebook);
+ if (!wxGetApp().m_enabledeco)
+ jpeg2000Settings->Enable(false);
+ wxPanel* mjpeg2000Settings = CreatePart3SettingsPage(m_settingsNotebook);
+ if (!wxGetApp().m_enabledeco)
+ mjpeg2000Settings->Enable(false);
#ifdef USE_JPWL
- wxPanel* jpwlSettings = CreatePart11SettingsPage(notebook);
+ wxPanel* jpwlSettings = CreatePart11SettingsPage(m_settingsNotebook);
+ if (!wxGetApp().m_enabledeco)
+ jpwlSettings->Enable(false);
#endif // USE_JPWL
- notebook->AddPage(mainSettings, wxT("Display"), false);
- notebook->AddPage(jpeg2000Settings, wxT("JPEG 2000"), false);
- notebook->AddPage(mjpeg2000Settings, wxT("MJPEG 2000"), false);
+ m_settingsNotebook->AddPage(mainSettings, wxT("Display"), false);
+ m_settingsNotebook->AddPage(jpeg2000Settings, wxT("JPEG 2000"), false);
+ m_settingsNotebook->AddPage(mjpeg2000Settings, wxT("MJPEG 2000"), false);
#ifdef USE_JPWL
- notebook->AddPage(jpwlSettings, wxT("JPWL"), false);
+ m_settingsNotebook->AddPage(jpwlSettings, wxT("JPWL"), false);
#endif // USE_JPWL
LayoutDialog();
@@ -2173,6 +2192,12 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent) // sub top sizer
wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL);
+ // add decoding enabling check box
+ subtopSizer->Add(
+ m_enabledecoCheck = new wxCheckBox(panel, OPJDECO_ENABLEDECO, wxT("Enable decoding"), wxDefaultPosition, wxDefaultSize),
+ 0, wxGROW | wxALL, 5);
+ m_enabledecoCheck->SetValue(wxGetApp().m_enabledeco);
+
// resize settings, column
wxString choices[] = {wxT("Low quality"), wxT("High quality")};
m_resizeBox = new wxRadioBox(panel, OPJDECO_RESMETHOD,
@@ -2433,6 +2458,30 @@ wxPanel* OPJDecoderDialog::CreatePart11SettingsPage(wxWindow* parent) return panel;
}
+void OPJDecoderDialog::OnEnableDeco(wxCommandEvent& event)
+{
+ size_t pp;
+
+ if (event.IsChecked()) {
+ wxLogMessage(wxT("Decoding enabled"));
+ m_resizeBox->Enable(true);
+ // enable all tabs except ourselves
+ for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) {
+ if (m_settingsNotebook->GetPageText(pp) != wxT("Display"))
+ m_settingsNotebook->GetPage(pp)->Enable(true);
+ }
+ } else {
+ wxLogMessage(wxT("Decoding disabled"));
+ m_resizeBox->Enable(false);
+ // disable all tabs except ourselves
+ for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) {
+ if (m_settingsNotebook->GetPageText(pp) != wxT("Display"))
+ m_settingsNotebook->GetPage(pp)->Enable(false);
+ }
+ }
+
+}
+
void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event)
{
if (event.IsChecked()) {
diff --git a/OPJViewer/source/OPJViewer.h b/OPJViewer/source/OPJViewer.h index deb3e8f0..c1413b74 100644 --- a/OPJViewer/source/OPJViewer.h +++ b/OPJViewer/source/OPJViewer.h @@ -182,6 +182,7 @@ class OPJViewerApp: public wxApp int m_resizemethod;
// decoding engine parameters
+ bool m_enabledeco;
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
#ifdef USE_JPWL
bool m_enablejpwl;
@@ -562,9 +563,13 @@ public: OPJDecoderDialog(wxWindow* parent, int dialogType);
~OPJDecoderDialog();
+ wxBookCtrlBase* m_settingsNotebook;
+ wxCheckBox *m_enabledecoCheck;
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
wxRadioBox* m_resizeBox;
+ void OnEnableDeco(wxCommandEvent& event);
+
wxPanel* CreateMainSettingsPage(wxWindow* parent);
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
wxPanel* CreatePart3SettingsPage(wxWindow* parent);
@@ -583,6 +588,7 @@ protected: OPJDECO_REDUCEFACTOR,
OPJDECO_QUALITYLAYERS,
OPJDECO_NUMCOMPS,
+ OPJDECO_ENABLEDECO,
OPJDECO_ENABLEJPWL,
OPJDECO_EXPCOMPS,
OPJDECO_MAXTILES,
diff --git a/OPJViewer/source/license.txt b/OPJViewer/source/license.txt index 2d0f584a..81d6b349 100644 --- a/OPJViewer/source/license.txt +++ b/OPJViewer/source/license.txt @@ -4,6 +4,7 @@ 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
+Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:
diff --git a/OPJViewer/source/readmeafter.txt b/OPJViewer/source/readmeafter.txt index deffff3f..d5e8fb9a 100644 --- a/OPJViewer/source/readmeafter.txt +++ b/OPJViewer/source/readmeafter.txt @@ -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,
+and MJ2 files.
+The viewer application interface is divided into three main panels:
+- a browsing pane;
+- a viewing pane;
+- a log/peek pane.
+
+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:
+
+filename
+|
+|_ #000: Marker/Box short name (Hex code)
+| |
+| |_ *** Marker/Box long name ***
+| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
+| |_ Additional info, depending on the marker/box type
+| |_ ...
+|
+|_ #001: Marker/Box short name (Hex code)
+| |
+| |_ ...
+|
+...
+
+
+The viewing pane will display the decoded image contained in the JPEG 2000 file.
+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.
+
+
+The log/peek pane is shared among two different subpanels:
+
+- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
+- 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.
+
|
