enable/disable decoding in OPJViewer
This commit is contained in:
@@ -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()) {
|
||||
|
@@ -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,
|
||||
|
@@ -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<69> 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:
|
||||
|
@@ -1 +1,34 @@
|
||||
Good choice!
|
||||
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.
|
||||
|
||||
|
Reference in New Issue
Block a user