Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files.

This commit is contained in:
Giuseppe Baruffa 2007-11-29 14:38:26 +00:00
parent 9e5d165e79
commit e06bcd027f
21 changed files with 2282 additions and 1711 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
November 29, 2007
! [GB] Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files.
November 14, 2007
+ [FOD] Created the file index.c in the codec directory. This file handles the creation of index files,
at encoding and decoding.

View File

@ -6,7 +6,7 @@ AR = ar
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
OPJV_SRCS = source/imagj2k.cpp source/imagmj2.cpp source/wxj2kparser.cpp source/imagjp2.cpp source/OPJViewer.cpp source/wxjp2parser.cpp
OPJV_SRCS = source/imagj2k.cpp source/imagmj2.cpp source/wxj2kparser.cpp source/imagjp2.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJViewer.cpp source/OPJThreads.cpp
MODULES = $(OPJV_SRCS:.cpp=.o)

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 "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 "USE_JPSEC" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c
# 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 ".." /I "../libopenjpeg" /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 "USE_JPSEC" /D "USE_MXF" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
BSC32=bscmake.exe
@ -72,15 +72,15 @@ PostBuild_Cmds=buildupdate.bat
# 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 "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
# 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 "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
# 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
@ -111,10 +111,26 @@ SOURCE=.\source\imagmj2.cpp
# End Source File
# Begin Source File
SOURCE=.\source\imagmxf.cpp
# End Source File
# Begin Source File
SOURCE=..\codec\index.c
# End Source File
# Begin Source File
SOURCE=.\source\OPJAbout.cpp
# End Source File
# Begin Source File
SOURCE=.\source\OPJDialogs.cpp
# End Source File
# Begin Source File
SOURCE=.\source\OPJThreads.cpp
# End Source File
# Begin Source File
SOURCE=.\source\OPJViewer.cpp
# End Source File
# Begin Source File
@ -160,6 +176,14 @@ SOURCE=.\source\imagmj2.h
# End Source File
# Begin Source File
SOURCE=.\source\imagmxf.h
# End Source File
# Begin Source File
SOURCE=..\codec\index.h
# End Source File
# Begin Source File
SOURCE=.\source\OPJViewer.h
# End Source File
# End Group

View File

@ -32,8 +32,8 @@
IMPLEMENT_CLASS(OPJDecoderDialog, wxPropertySheetDialog)
BEGIN_EVENT_TABLE(OPJDecoderDialog, wxPropertySheetDialog)
#ifdef USE_JPWL
EVT_CHECKBOX(OPJDECO_ENABLEDECO, OPJDecoderDialog::OnEnableDeco)
#ifdef USE_JPWL
EVT_CHECKBOX(OPJDECO_ENABLEJPWL, OPJDecoderDialog::OnEnableJPWL)
#endif // USE_JPWL
END_EVENT_TABLE()
@ -400,21 +400,6 @@ void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event)
#endif // USE_JPWL
bool OPJDnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
{
/*size_t nFiles = filenames.GetCount();
wxString str;
str.Printf( _T("%d files dropped\n"), (int)nFiles);
for ( size_t n = 0; n < nFiles; n++ ) {
str << filenames[n] << wxT("\n");
}
wxLogMessage(str);*/
m_pOwner->OpenFiles(filenames, filenames);
return true;
}
@ -425,12 +410,16 @@ bool OPJDnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
IMPLEMENT_CLASS(OPJEncoderDialog, wxPropertySheetDialog)
BEGIN_EVENT_TABLE(OPJEncoderDialog, wxPropertySheetDialog)
#ifdef USE_JPWL
EVT_CHECKBOX(OPJENCO_ENABLEJPWL, OPJEncoderDialog::OnEnableJPWL)
EVT_CHECKBOX(OPJENCO_ENABLECOMM, OPJEncoderDialog::OnEnableComm)
EVT_CHECKBOX(OPJENCO_ENABLEINDEX, OPJEncoderDialog::OnEnableIdx)
EVT_CHECKBOX(OPJENCO_ENABLEPOC, OPJEncoderDialog::OnEnablePoc)
EVT_RADIOBUTTON(OPJENCO_RATERADIO, OPJEncoderDialog::OnRadioQualityRate)
EVT_RADIOBUTTON(OPJENCO_QUALITYRADIO, OPJEncoderDialog::OnRadioQualityRate)
#ifdef USE_JPWL
EVT_CHECKBOX(OPJENCO_ENABLEJPWL, OPJEncoderDialog::OnEnableJPWL)
EVT_CHOICE(OPJENCO_HPROT, OPJEncoderDialog::OnHprotSelect)
EVT_CHOICE(OPJENCO_PPROT, OPJEncoderDialog::OnPprotSelect)
EVT_CHOICE(OPJENCO_SENSI, OPJEncoderDialog::OnSensiSelect)
#endif // USE_JPWL
END_EVENT_TABLE()
@ -454,12 +443,12 @@ OPJEncoderDialog::OPJEncoderDialog(wxWindow* win, int dialogType)
wxPanel* jpwlSettings = CreatePart11SettingsPage(m_settingsNotebook);
#endif // USE_JPWL
m_settingsNotebook->AddPage(jpeg2000_1Settings, wxT("JPEG 2000 - 1"), false);
m_settingsNotebook->AddPage(jpeg2000_2Settings, wxT("JPEG 2000 - 2"), false);
m_settingsNotebook->AddPage(mainSettings, wxT("General"), false);
#ifdef USE_JPWL
m_settingsNotebook->AddPage(jpwlSettings, wxT("JPWL"), false);
#endif // USE_JPWL
m_settingsNotebook->AddPage(jpeg2000_1Settings, wxT("JPEG 2000 - 1"), false);
m_settingsNotebook->AddPage(jpeg2000_2Settings, wxT("JPEG 2000 - 2"), false);
m_settingsNotebook->AddPage(mainSettings, wxT("General"), false);
LayoutDialog();
}
@ -491,12 +480,218 @@ wxPanel* OPJEncoderDialog::CreateMainSettingsPage(wxWindow* parent)
wxPanel* OPJEncoderDialog::CreatePart11SettingsPage(wxWindow* parent)
{
wxPanel* panel = new wxPanel(parent, wxID_ANY);
int specno;
// top sizer
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
// add JPWL enabling check box
topSizer->Add(
m_enablejpwlCheck = new wxCheckBox(panel, OPJENCO_ENABLEJPWL, wxT("Enable JPWL"),
wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL | wxALIGN_CENTER, 5);
m_enablejpwlCheck->SetValue(wxGetApp().m_enablejpwle);
// sub top sizer
wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL);
wxFlexGridSizer *subtopSizer = new wxFlexGridSizer(2, 3, 3);
// header settings, column
wxStaticBox* headerBox = new wxStaticBox(panel, wxID_ANY, wxT("Header protection"));
wxBoxSizer* headerSizer = new wxStaticBoxSizer(headerBox, wxVERTICAL);
// info sizer, row
wxBoxSizer* info1Sizer = new wxBoxSizer(wxHORIZONTAL);
// add some text
info1Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Type")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
// add some horizontal space
info1Sizer->Add(3, 3, 1, wxALL, 0);
// add some text
info1Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Tile part")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
headerSizer->Add(info1Sizer, 0, wxGROW | wxALL, 0);
// specify specs
wxString hprotvalues[] = {wxT("None"), wxT("Pred."), wxT("CRC16"), wxT("CRC32"),
wxT("RS37"), wxT("RS38"), wxT("RS40"), wxT("RS43"), wxT("RS45"), wxT("RS48"),
wxT("RS51"), wxT("RS53"), wxT("RS56"), wxT("RS64"), wxT("RS75"), wxT("RS80"),
wxT("RS85"), wxT("RS96"), wxT("RS112"), wxT("RS128")};
for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) {
// tile+hprot sizer, row
wxBoxSizer* tilehprotSizer = new wxBoxSizer(wxHORIZONTAL);
// add the value selection
tilehprotSizer->Add(
m_hprotChoice[specno] = new wxChoice(panel, OPJENCO_HPROT,
wxDefaultPosition, wxSize(60, wxDefaultCoord),
WXSIZEOF(hprotvalues), hprotvalues),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
m_hprotChoice[specno]->SetSelection(wxGetApp().m_hprotsel[specno]);
// add some horizontal space
tilehprotSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
tilehprotSizer->Add(
m_htileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_HTILE,
wxString::Format(wxT("%d"), wxGetApp().m_htileval[specno]),
wxDefaultPosition, wxSize(45, wxDefaultCoord),
wxSP_ARROW_KEYS,
0, JPWL_MAXIMUM_TILES - 1, 0),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
headerSizer->Add(tilehprotSizer, 0, wxGROW | wxALL, 0);
}
wxCommandEvent event1;
OnHprotSelect(event1);
subtopSizer->Add(headerSizer, 0, wxGROW | wxALL, 3);
// packet settings, column
wxStaticBox* packetBox = new wxStaticBox(panel, wxID_ANY, wxT("Packet protection"));
wxBoxSizer* packetSizer = new wxStaticBoxSizer(packetBox, wxVERTICAL);
// info sizer, row
wxBoxSizer* info2Sizer = new wxBoxSizer(wxHORIZONTAL);
// add some text
info2Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Type")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
// add some horizontal space
info2Sizer->Add(3, 3, 1, wxALL, 0);
// add some text
info2Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Tile part")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
// add some horizontal space
info2Sizer->Add(3, 3, 1, wxALL, 0);
// add some text
info2Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Packet")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
packetSizer->Add(info2Sizer, 0, wxGROW | wxALL, 0);
// specify specs
wxString pprotvalues[] = {wxT("None"), wxT("Pred."), wxT("CRC16"), wxT("CRC32"),
wxT("RS37"), wxT("RS38"), wxT("RS40"), wxT("RS43"), wxT("RS45"), wxT("RS48"),
wxT("RS51"), wxT("RS53"), wxT("RS56"), wxT("RS64"), wxT("RS75"), wxT("RS80"),
wxT("RS85"), wxT("RS96"), wxT("RS112"), wxT("RS128")};
for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) {
// tile+pprot sizer, row
wxBoxSizer* tilepprotSizer = new wxBoxSizer(wxHORIZONTAL);
// add the value selection
tilepprotSizer->Add(
m_pprotChoice[specno] = new wxChoice(panel, OPJENCO_PPROT,
wxDefaultPosition, wxSize(60, wxDefaultCoord),
WXSIZEOF(pprotvalues), pprotvalues),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
m_pprotChoice[specno]->SetSelection(wxGetApp().m_pprotsel[specno]);
// add some horizontal space
tilepprotSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
tilepprotSizer->Add(
m_ptileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_PTILE,
wxString::Format(wxT("%d"), wxGetApp().m_ptileval[specno]),
wxDefaultPosition, wxSize(45, wxDefaultCoord),
wxSP_ARROW_KEYS,
0, JPWL_MAXIMUM_TILES - 1, 0),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
// add some horizontal space
tilepprotSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
tilepprotSizer->Add(
m_ppackCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_PPACK,
wxString::Format(wxT("%d"), wxGetApp().m_ppackval[specno]),
wxDefaultPosition, wxSize(50, wxDefaultCoord),
wxSP_ARROW_KEYS,
0, 2047, 0),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
packetSizer->Add(tilepprotSizer, 0, wxGROW | wxALL, 0);
}
wxCommandEvent event2;
OnPprotSelect(event2);
subtopSizer->Add(packetSizer, 0, wxGROW | wxALL, 3);
// sensitivity settings, column
wxStaticBox* sensiBox = new wxStaticBox(panel, wxID_ANY, wxT("Sensitivity"));
wxBoxSizer* sensiSizer = new wxStaticBoxSizer(sensiBox, wxVERTICAL);
// info sizer, row
wxBoxSizer* info3Sizer = new wxBoxSizer(wxHORIZONTAL);
// add some text
info3Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Type")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
// add some horizontal space
info3Sizer->Add(3, 3, 1, wxALL, 0);
// add some text
info3Sizer->Add(new wxStaticText(panel, wxID_ANY,
wxT("Tile part")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
sensiSizer->Add(info3Sizer, 0, wxGROW | wxALL, 0);
// specify specs
wxString sensivalues[] = {wxT("None"), wxT("RELATIVE ERROR"), wxT("MSE"),
wxT("MSE REDUCTION"), wxT("PSNR INCREMENT"), wxT("MAXERR"), wxT("TSE")};
for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) {
// tile+sensi sizer, row
wxBoxSizer* tilesensiSizer = new wxBoxSizer(wxHORIZONTAL);
// add the value selection
tilesensiSizer->Add(
m_sensiChoice[specno] = new wxChoice(panel, OPJENCO_SENSI,
wxDefaultPosition, wxSize(110, wxDefaultCoord),
WXSIZEOF(sensivalues), sensivalues),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
m_sensiChoice[specno]->SetSelection(wxGetApp().m_sensisel[specno]);
// add some horizontal space
tilesensiSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
tilesensiSizer->Add(
m_stileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_STILE,
wxString::Format(wxT("%d"), wxGetApp().m_stileval[specno]),
wxDefaultPosition, wxSize(45, wxDefaultCoord),
wxSP_ARROW_KEYS,
0, JPWL_MAXIMUM_TILES - 1, 0),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1);
sensiSizer->Add(tilesensiSizer, 0, wxGROW | wxALL, 0);
}
wxCommandEvent event3;
OnSensiSelect(event3);
subtopSizer->Add(sensiSizer, 0, wxGROW | wxALL, 3);
topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5);
@ -668,7 +863,7 @@ wxPanel* OPJEncoderDialog::CreatePart1_1SettingsPage(wxWindow* parent)
wxString::Format(wxT("%d"), wxGetApp().m_resolutions),
wxDefaultPosition, wxSize(80, wxDefaultCoord),
wxSP_ARROW_KEYS,
0, 256, 6),
1, 256, 6),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3);
transformSizer->Add(resnumSizer, 0, wxGROW | wxALL, 3);
@ -926,6 +1121,65 @@ wxPanel* OPJEncoderDialog::CreatePart1_2SettingsPage(wxWindow* parent)
subtopSizer->Add(roiSizer, 0, wxGROW | wxALL, 3);
// POC settings, column
wxStaticBox* pocBox = new wxStaticBox(panel, wxID_ANY, wxT("POC"));
wxBoxSizer* pocSizer = new wxStaticBoxSizer(pocBox, wxVERTICAL);
// POC check box
pocSizer->Add(
m_enablepocCheck = new wxCheckBox(panel, OPJENCO_ENABLEPOC, wxT("Enabled (tn=rs,cs,le,re,ce,pr)"),
wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL, 3);
m_enablepocCheck->SetValue(wxGetApp().m_enablepoc);
// POC sizer, row
wxBoxSizer* pocspecSizer = new wxBoxSizer(wxHORIZONTAL);
// add some text
pocspecSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Changes:")),
0, wxALL | wxALIGN_TOP, 3);
// add some horizontal space
pocspecSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
pocspecSizer->Add(
m_pocCtrl = new wxTextCtrl(panel, OPJENCO_POCSPEC,
wxGetApp().m_poc,
wxDefaultPosition, wxSize(140, 60),
wxTE_LEFT | wxTE_MULTILINE),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3);
m_pocCtrl->Enable(wxGetApp().m_enablepoc);
pocSizer->Add(pocspecSizer, 0, wxGROW | wxALL, 3);
subtopSizer->Add(pocSizer, 0, wxGROW | wxALL, 3);
// Comment settings, column
wxStaticBox* commentBox = new wxStaticBox(panel, wxID_ANY, wxT("Comment"));
wxBoxSizer* commentSizer = new wxStaticBoxSizer(commentBox, wxVERTICAL);
// commenting check box
commentSizer->Add(
m_enablecommCheck = new wxCheckBox(panel, OPJENCO_ENABLECOMM, wxT("Enabled (empty to reset)"),
wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL, 3);
m_enablecommCheck->SetValue(wxGetApp().m_enablecomm);
// add some horizontal space
commentSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
commentSizer->Add(
m_commentCtrl = new wxTextCtrl(panel, OPJENCO_COMMENTTEXT,
wxGetApp().m_comment,
wxDefaultPosition, wxSize(wxDefaultCoord, 60),
wxTE_LEFT | wxTE_MULTILINE),
0, wxGROW | wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3);
m_commentCtrl->Enable(wxGetApp().m_enablecomm);
subtopSizer->Add(commentSizer, 0, wxGROW | wxALL, 3);
// Index file settings, column
wxStaticBox* indexBox = new wxStaticBox(panel, wxID_ANY, wxT("Indexing"));
wxBoxSizer* indexSizer = new wxStaticBoxSizer(indexBox, wxVERTICAL);
@ -960,65 +1214,6 @@ wxPanel* OPJEncoderDialog::CreatePart1_2SettingsPage(wxWindow* parent)
subtopSizer->Add(indexSizer, 0, wxGROW | wxALL, 3);
// Comment settings, column
wxStaticBox* commentBox = new wxStaticBox(panel, wxID_ANY, wxT("Comment"));
wxBoxSizer* commentSizer = new wxStaticBoxSizer(commentBox, wxVERTICAL);
// commenting check box
commentSizer->Add(
m_enablecommCheck = new wxCheckBox(panel, OPJENCO_ENABLECOMM, wxT("Enabled (empty to reset)"),
wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL, 3);
m_enablecommCheck->SetValue(wxGetApp().m_enablecomm);
// add some horizontal space
commentSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
commentSizer->Add(
m_commentCtrl = new wxTextCtrl(panel, OPJENCO_COMMENTTEXT,
wxGetApp().m_comment,
wxDefaultPosition, wxSize(wxDefaultCoord, 60),
wxTE_LEFT | wxTE_MULTILINE),
0, wxGROW | wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3);
m_commentCtrl->Enable(wxGetApp().m_enablecomm);
subtopSizer->Add(commentSizer, 0, wxGROW | wxALL, 3);
// POC settings, column
wxStaticBox* pocBox = new wxStaticBox(panel, wxID_ANY, wxT("POC"));
wxBoxSizer* pocSizer = new wxStaticBoxSizer(pocBox, wxVERTICAL);
// POC check box
pocSizer->Add(
m_enablepocCheck = new wxCheckBox(panel, OPJENCO_ENABLEPOC, wxT("Enabled"),
wxDefaultPosition, wxDefaultSize),
0, wxGROW | wxALL, 3);
m_enablepocCheck->SetValue(/*wxGetApp().m_enableidx*/true);
// POC sizer, row
wxBoxSizer* pocspecSizer = new wxBoxSizer(wxHORIZONTAL);
// add some text
pocspecSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Changes:")),
0, wxALL | wxALIGN_CENTER_VERTICAL, 3);
// add some horizontal space
pocspecSizer->Add(3, 3, 1, wxALL, 0);
// add the value control
pocspecSizer->Add(
m_pocCtrl = new wxTextCtrl(panel, OPJENCO_POCSPEC,
/*wxGetApp().m_index*/wxT("RRRR"),
wxDefaultPosition, wxSize(120, wxDefaultCoord),
wxTE_LEFT),
0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3);
m_pocCtrl->Enable(/*wxGetApp().m_enableidx*/true);
pocSizer->Add(pocspecSizer, 0, wxGROW | wxALL, 3);
subtopSizer->Add(pocSizer, 0, wxGROW | wxALL, 3);
topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5);
// assign top and fit it
@ -1052,6 +1247,18 @@ void OPJEncoderDialog::OnEnableIdx(wxCommandEvent& event)
}
void OPJEncoderDialog::OnEnablePoc(wxCommandEvent& event)
{
if (event.IsChecked()) {
wxLogMessage(wxT("POC enabled"));
m_pocCtrl->Enable(true);
} else {
wxLogMessage(wxT("POC disabled"));
m_pocCtrl->Enable(false);
}
}
void OPJEncoderDialog::OnRadioQualityRate(wxCommandEvent& event)
{
if (event.GetId() == OPJENCO_QUALITYRADIO) {
@ -1068,15 +1275,99 @@ void OPJEncoderDialog::OnRadioQualityRate(wxCommandEvent& event)
#ifdef USE_JPWL
void OPJEncoderDialog::OnEnableJPWL(wxCommandEvent& event)
{
/*if (event.IsChecked()) {
int specno;
if (event.IsChecked()) {
wxLogMessage(wxT("JPWL enabled"));
m_expcompsCtrl->Enable(true);
m_maxtilesCtrl->Enable(true);
for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) {
m_hprotChoice[specno]->Enable(true);
m_htileCtrl[specno]->Enable(true);
m_pprotChoice[specno]->Enable(true);
m_ptileCtrl[specno]->Enable(true);
m_ppackCtrl[specno]->Enable(true);
m_sensiChoice[specno]->Enable(true);
m_stileCtrl[specno]->Enable(true);
}
OnHprotSelect(event);
OnPprotSelect(event);
OnSensiSelect(event);
} else {
wxLogMessage(wxT("JPWL disabled"));
m_expcompsCtrl->Enable(false);
m_maxtilesCtrl->Enable(false);
}*/
for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) {
m_hprotChoice[specno]->Enable(false);
m_htileCtrl[specno]->Enable(false);
m_pprotChoice[specno]->Enable(false);
m_ptileCtrl[specno]->Enable(false);
m_ppackCtrl[specno]->Enable(false);
m_sensiChoice[specno]->Enable(false);
m_stileCtrl[specno]->Enable(false);
}
}
}
void OPJEncoderDialog::OnHprotSelect(wxCommandEvent& event)
{
int specno;
// deactivate properly
for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) {
if (!m_hprotChoice[specno]->GetSelection()) {
m_hprotChoice[specno]->Enable(false);
m_htileCtrl[specno]->Enable(false);
} else
break;
}
if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) {
m_hprotChoice[specno + 1]->Enable(true);
m_htileCtrl[specno + 1]->Enable(true);
}
//wxLogMessage(wxT("hprot changed: %d"), specno);
}
void OPJEncoderDialog::OnPprotSelect(wxCommandEvent& event)
{
int specno;
// deactivate properly
for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) {
if (!m_pprotChoice[specno]->GetSelection()) {
m_pprotChoice[specno]->Enable(false);
m_ptileCtrl[specno]->Enable(false);
m_ppackCtrl[specno]->Enable(false);
} else
break;
}
if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) {
m_pprotChoice[specno + 1]->Enable(true);
m_ptileCtrl[specno + 1]->Enable(true);
m_ppackCtrl[specno + 1]->Enable(true);
}
//wxLogMessage(wxT("pprot changed: %d"), specno);
}
void OPJEncoderDialog::OnSensiSelect(wxCommandEvent& event)
{
int specno;
// deactivate properly
for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) {
if (!m_sensiChoice[specno]->GetSelection()) {
m_sensiChoice[specno]->Enable(false);
m_stileCtrl[specno]->Enable(false);
} else
break;
}
if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) {
m_sensiChoice[specno + 1]->Enable(true);
m_stileCtrl[specno + 1]->Enable(true);
}
//wxLogMessage(wxT("sprot changed: %d"), specno);
}
#endif // USE_JPWL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -106,6 +106,9 @@
#include "imagj2k.h"
#include "imagjp2.h"
#include "imagmj2.h"
#ifdef USE_MXF
#include "imagmxf.h"
#endif // USE_MXF
#ifdef __WXMSW__
typedef unsigned __int64 int8byte;
@ -150,6 +153,16 @@ typedef unsigned long long int8byte;
#define OPJ_CANVAS_BORDER 10
#define OPJ_CANVAS_COLOUR *wxWHITE
#ifdef USE_JPWL
//#define MYJPWL_MAX_NO_TILESPECS JPWL_MAX_NO_TILESPECS
#define MYJPWL_MAX_NO_TILESPECS 4
#endif // USE_JPWL
class OPJDecoThread;
class OPJEncoThread;
class OPJParseThread;
@ -198,19 +211,25 @@ class OPJViewerApp: public wxApp
bool m_enabledeco, m_enableparse;
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
#ifdef USE_JPWL
bool m_enablejpwl;
bool m_enablejpwl, m_enablejpwle;
int m_expcomps, m_maxtiles;
int m_framewidth, m_frameheight;
#endif // USE_JPWL
// encoding engine parameters
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
wxString m_cbsize, m_prsize, m_tsize, m_torigin;
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph;
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm;
bool m_enablesegmark;
bool m_enablesegmark, m_enablepoc;
bool m_enablequality;
int m_resolutions, m_progression;
#ifdef USE_JPWL
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
#endif // USE_JPWL
// some layout settings
bool m_showtoolbar, m_showbrowser, m_showpeeker;
@ -655,13 +674,24 @@ public:
wxPanel* CreatePart1_1SettingsPage(wxWindow* parent);
wxPanel* CreatePart1_2SettingsPage(wxWindow* parent);
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
#ifdef USE_JPWL
void OnEnableJPWL(wxCommandEvent& event);
void OnEnableComm(wxCommandEvent& event);
void OnEnableIdx(wxCommandEvent& event);
void OnEnablePoc(wxCommandEvent& event);
void OnRadioQualityRate(wxCommandEvent& event);
#ifdef USE_JPWL
void OnEnableJPWL(wxCommandEvent& event);
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
/*wxCheckBox *m_enablejpwlCheck;*/
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
void OnHprotSelect(wxCommandEvent& event);
void OnPprotSelect(wxCommandEvent& event);
void OnSensiSelect(wxCommandEvent& event);
#endif // USE_JPWL
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
@ -672,7 +702,7 @@ public:
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck;
wxCheckBox *m_enablepocCheck;
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
wxSpinCtrl *m_resolutionsCtrl;
protected:
@ -708,7 +738,14 @@ protected:
OPJENCO_INDEXNAME,
OPJENCO_POCSPEC,
OPJENCO_ENABLECOMM,
OPJENCO_COMMENTTEXT
OPJENCO_COMMENTTEXT,
OPJENCO_HPROT,
OPJENCO_HTILE,
OPJENCO_PPROT,
OPJENCO_PTILE,
OPJENCO_PPACK,
OPJENCO_SENSI,
OPJENCO_STILE
};
DECLARE_EVENT_TABLE()

View File

@ -1 +1 @@
wxT("292")
wxT("404")

View File

@ -670,8 +670,7 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
/* Write the index to disk */
if (*indexfilename) {
bSuccess = write_index_file(&cstr_info, indexfilename);
if (!bSuccess) {
if (write_index_file(&cstr_info, indexfilename)) {
wxLogError(wxT("Failed to output index file"));
}
}
@ -717,268 +716,6 @@ bool wxJ2KHandler::DoCanRead( wxInputStream& stream )
return hdr[0] == 0xFF && hdr[1] == 0x4F;
}
// write the index file
bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *index) {
int tileno, compno, layno, resno, precno, pack_nb, x, y;
FILE *stream = NULL;
double total_disto = 0;
int tilepartno;
#ifdef USE_JPWL
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
return true;
#endif // USE_JPWL
if (!cstr_info)
return 1;
stream = fopen(index, "w");
if (!stream) {
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
return false;
}
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
fprintf(stream, "%d\n", cstr_info->prog);
fprintf(stream, "%d %d\n", cstr_info->tile_x, cstr_info->tile_y);
fprintf(stream, "%d %d\n", cstr_info->tw, cstr_info->th);
fprintf(stream, "%d\n", cstr_info->numcomps);
fprintf(stream, "%d\n", cstr_info->numlayers);
fprintf(stream, "%d\n", cstr_info->numdecompos);
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
fprintf(stream, "[%d,%d] ",
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
}
fprintf(stream, "\n");
fprintf(stream, "%d\n", cstr_info->main_head_start);
fprintf(stream, "%d\n", cstr_info->main_head_end);
fprintf(stream, "%d\n", cstr_info->codestream_size);
fprintf(stream, "\nINFO ON TILES\n");
fprintf(stream, "tileno start_pos end_hd end_tile nbparts disto nbpix disto/nbpix\n");
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
fprintf(stream, "%4d %9d %9d %9d %9d %9e %9d %9e\n",
cstr_info->tile[tileno].tileno,
cstr_info->tile[tileno].start_pos,
cstr_info->tile[tileno].end_header,
cstr_info->tile[tileno].end_pos,
cstr_info->tile[tileno].num_tps,
cstr_info->tile[tileno].distotile, cstr_info->tile[tileno].numpix,
cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
}
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
int start_pos, end_ph_pos, end_pos;
double disto = 0;
int max_numdecompos = 0;
pack_nb = 0;
for (compno = 0; compno < cstr_info->numcomps; compno++) {
if (max_numdecompos < cstr_info->numdecompos[compno])
max_numdecompos = cstr_info->numdecompos[compno];
}
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
fprintf(stream, "part_nb tileno start_pack num_packs start_pos end_tph_pos end_pos\n");
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
tilepartno, tileno,
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
cstr_info->tile[tileno].tp[tilepartno].tp_start_pos,
cstr_info->tile[tileno].tp[tilepartno].tp_end_header,
cstr_info->tile[tileno].tp[tilepartno].tp_end_pos
);
if (cstr_info->prog == LRCP) { /* LRCP */
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos disto\n");
for (layno = 0; layno < cstr_info->numlayers; layno++) {
for (resno = 0; resno < max_numdecompos + 1; resno++) {
for (compno = 0; compno < cstr_info->numcomps; compno++) {
int prec_max;
if (resno > cstr_info->numdecompos[compno])
break;
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
for (precno = 0; precno < prec_max; precno++) {
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6d %6d %7d %8e\n",
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, end_pos, disto);
total_disto += disto;
pack_nb++;
}
}
}
}
} /* LRCP */
else if (cstr_info->prog == RLCP) { /* RLCP */
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos disto\n");
for (resno = 0; resno < max_numdecompos + 1; resno++) {
for (layno = 0; layno < cstr_info->numlayers; layno++) {
for (compno = 0; compno < cstr_info->numcomps; compno++) {
int prec_max;
if (resno > cstr_info->numdecompos[compno])
break;
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
for (precno = 0; precno < prec_max; precno++) {
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %7d %8e\n",
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, end_pos, disto);
total_disto += disto;
pack_nb++;
}
}
}
}
} /* RLCP */
else if (cstr_info->prog == RPCL) { /* RPCL */
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos disto\n");
for (resno = 0; resno < max_numdecompos + 1; resno++) {
/* I suppose components have same XRsiz, YRsiz */
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
int x1 = x0 + cstr_info->tile_x;
int y1 = y0 + cstr_info->tile_y;
for (compno = 0; compno < cstr_info->numcomps; compno++) {
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
if (resno > cstr_info->numdecompos[compno])
break;
for (precno = 0; precno < prec_max; precno++) {
int pcnx = cstr_info->tile[tileno].pw[resno];
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
int precno_y = (int) floor( (float)precno/(float)pcnx );
for(y = y0; y < y1; y++) {
if (precno_y*pcy == y ) {
for (x = x0; x < x1; x++) {
if (precno_x*pcx == x ) {
for (layno = 0; layno < cstr_info->numlayers; layno++) {
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %7d %8e\n",
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, end_pos, disto);
total_disto += disto;
pack_nb++;
}
}
}/* x = x0..x1 */
}
} /* y = y0..y1 */
} /* precno */
} /* compno */
} /* resno */
} /* RPCL */
else if (cstr_info->prog == PCRL) { /* PCRL */
/* I suppose components have same XRsiz, YRsiz */
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
int x1 = x0 + cstr_info->tile_x;
int y1 = y0 + cstr_info->tile_y;
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos disto\n");
for (compno = 0; compno < cstr_info->numcomps; compno++) {
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
for (precno = 0; precno < prec_max; precno++) {
int pcnx = cstr_info->tile[tileno].pw[resno];
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
int precno_y = (int) floor( (float)precno/(float)pcnx );
for(y = y0; y < y1; y++) {
if (precno_y*pcy == y ) {
for (x = x0; x < x1; x++) {
if (precno_x*pcx == x ) {
for (layno = 0; layno < cstr_info->numlayers; layno++) {
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d %8e\n",
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, end_pos, disto);
total_disto += disto;
pack_nb++;
}
}
}/* x = x0..x1 */
}
} /* y = y0..y1 */
} /* precno */
} /* resno */
} /* compno */
} /* PCRL */
else { /* CPRL */
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos disto\n");
for (compno = 0; compno < cstr_info->numcomps; compno++) {
/* I suppose components have same XRsiz, YRsiz */
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
int x1 = x0 + cstr_info->tile_x;
int y1 = y0 + cstr_info->tile_y;
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
for (precno = 0; precno < prec_max; precno++) {
int pcnx = cstr_info->tile[tileno].pw[resno];
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
int precno_y = (int) floor( (float)precno/(float)pcnx );
for(y = y0; y < y1; y++) {
if (precno_y*pcy == y ) {
for (x = x0; x < x1; x++) {
if (precno_x*pcx == x ) {
for (layno = 0; layno < cstr_info->numlayers; layno++) {
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d %8e\n",
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, end_pos, disto);
total_disto += disto;
pack_nb++;
}
}
}/* x = x0..x1 */
}
} /* y = y0..y1 */
} /* precno */
} /* resno */
} /* compno */
} /* CPRL */
} /* tileno */
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
fprintf(stream, "\nMARKER LIST\n");
fprintf(stream, "%d\n", cstr_info->marknum);
fprintf(stream, "type\tstart_pos length\n");
for (x = 0; x < cstr_info->marknum; x++)
fprintf(stream, "%X\t%9d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);
fclose(stream);
fprintf(stderr,"Generated index file %s\n", index);
return true;
}
#endif // wxUSE_STREAMS
#endif // wxUSE_LIBOPENJPEG

View File

@ -45,6 +45,7 @@
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#include "codec/index.h"
#define wxBITMAP_TYPE_J2K 47
@ -106,6 +107,8 @@ public:
m_indexfname*/
m_enableidx = false;
m_index = wxT("index.txt");
m_enablepoc = false;
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
m_enablecomm = true;
#if defined __WXMSW__
@ -162,8 +165,8 @@ public:
wxString m_index;
bool m_enablecomm;
wxString m_comment;
bool write_index_file(opj_codestream_info_t *cstr_info, char *index);
bool m_enablepoc;
wxString m_poc;
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
@ -173,6 +176,7 @@ protected:
#endif
private:
OPJ_PROG_ORDER give_progression(char progression[4]);
DECLARE_DYNAMIC_CLASS(wxJ2KHandler)
};

View File

@ -0,0 +1,274 @@
/*
* 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 conditions
* are 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.
*/
/////////////////////////////////////////////////////////////////////////////
// Name: imagmxf.cpp
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
// RCS-ID: $Id: imagmxf.cpp,v 0.00 2007/11/19 17:00:00 MW Exp $
// Copyright: (c) Giuseppe Baruffa
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef USE_MXF
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
#include "imagmxf.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/app.h"
#include "wx/intl.h"
#include "wx/bitmap.h"
#include "wx/module.h"
#endif
#include "libopenjpeg/openjpeg.h"
#include "wx/filefn.h"
#include "wx/wfstream.h"
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxMXFHandler
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMXFHandler,wxImageHandler)
#if wxUSE_STREAMS
//------------- JPEG 2000 Data Source Manager
#define J2K_CFMT 0
#define JP2_CFMT 1
#define JPT_CFMT 2
#define MJ2_CFMT 3
#define PXM_DFMT 0
#define PGX_DFMT 1
#define BMP_DFMT 2
#define YUV_DFMT 3
#define MAX_MESSAGE_LEN 200
/* sample error callback expecting a FILE* client object */
void mxf_error_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
#ifndef __WXGTK__
wxMutexGuiEnter();
#endif /* __WXGTK__ */
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
#ifndef __WXGTK__
wxMutexGuiLeave();
#endif /* __WXGTK__ */
}
/* sample warning callback expecting a FILE* client object */
void mxf_warning_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
#ifndef __WXGTK__
wxMutexGuiEnter();
#endif /* __WXGTK__ */
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
#ifndef __WXGTK__
wxMutexGuiLeave();
#endif /* __WXGTK__ */
}
/* sample debug callback expecting no client object */
void mxf_info_callback(const char *msg, void *client_data) {
int message_len = strlen(msg) - 1;
if (msg[message_len] != '\n')
message_len = MAX_MESSAGE_LEN;
#ifndef __WXGTK__
wxMutexGuiEnter();
#endif /* __WXGTK__ */
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
#ifndef __WXGTK__
wxMutexGuiLeave();
#endif /* __WXGTK__ */
}
/////////////////////////////////////////////////
/////////////////////////////////////////////////
// load the mxf file format
bool wxMXFHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
{
opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL;
unsigned char *src = NULL;
unsigned char *ptr;
int file_length, j2k_point, j2k_len;
opj_codestream_info_t cstr_info; /* Codestream information structure */
// destroy the image
image->Destroy();
/* handle to a decompressor */
opj_dinfo_t* dinfo = NULL;
opj_cio_t *cio = NULL;
/* configure the event callbacks (not required) */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = mxf_error_callback;
event_mgr.warning_handler = mxf_warning_callback;
event_mgr.info_handler = mxf_info_callback;
/* set decoding parameters to default values */
opj_set_default_decoder_parameters(&parameters);
/* prepare parameters */
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
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 = 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_J2K);
/* find length of the stream */
stream.SeekI(0, wxFromEnd);
file_length = (int) stream.TellI();
/* search for the m_framenum codestream position and length */
//jp2c_point = searchjp2c(stream, file_length, m_framenum);
//jp2c_len = searchjp2c(stream, file_length, m_framenum);
j2k_point = 0;
j2k_len = 10;
// malloc memory source
src = (unsigned char *) malloc(j2k_len);
// copy the jp2c
stream.SeekI(j2k_point, wxFromStart);
stream.Read(src, j2k_len);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, &parameters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, j2k_len);
/* decode the stream and fill the image structure */
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
if (!opjimage) {
wxMutexGuiEnter();
wxLogError(wxT("MXF: failed to decode image!"));
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
free(src);
return false;
}
/* close the byte stream */
opj_cio_close(cio);
/* common rendering method */
#include "imagjpeg2000.cpp"
wxMutexGuiEnter();
wxLogMessage(wxT("MXF: image loaded."));
wxMutexGuiLeave();
/* close openjpeg structs */
opj_destroy_decompress(dinfo);
opj_image_destroy(opjimage);
free(src);
if (!image->Ok())
return false;
else
return true;
}
// save the mxf file format
bool wxMXFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
{
wxLogError(wxT("MXF: Couldn't save movie -> not implemented."));
return false;
}
#ifdef __VISUALC__
#pragma warning(default:4611)
#endif /* VC++ */
// recognize the MXF JPEG 2000 starting box
bool wxMXFHandler::DoCanRead( wxInputStream& stream )
{
unsigned char hdr[4];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return false;
return (hdr[0] == 0x06 &&
hdr[1] == 0x0E &&
hdr[2] == 0x2B &&
hdr[3] == 0x34);
}
#endif // wxUSE_STREAMS
#endif // wxUSE_LIBOPENJPEG
#endif // USE_MXF

View File

@ -0,0 +1,96 @@
/*
* 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 conditions
* are 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.
*/
/////////////////////////////////////////////////////////////////////////////
// Name: imagmxf.h
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/11/19 17:00:00 VZ Exp $
// Copyright: (c) Giuseppe Baruffa
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGMXF_H_
#define _WX_IMAGMXF_H_
#ifdef USE_MXF
#include "wx/defs.h"
//-----------------------------------------------------------------------------
// wxMXFHandler
//-----------------------------------------------------------------------------
#if wxUSE_LIBOPENJPEG
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#define wxBITMAP_TYPE_MXF 50
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
{
public:
inline wxMXFHandler()
{
m_name = wxT("MXF JPEG 2000 file format");
m_extension = wxT("mxf");
m_type = wxBITMAP_TYPE_MXF;
m_mime = wxT("image/mxf");
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, m_framenum;
#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 );
protected:
virtual bool DoCanRead( wxInputStream& stream );
#endif
private:
DECLARE_DYNAMIC_CLASS(wxMXFHandler)
};
#endif // wxUSE_LIBOPENJPEG
#endif // USE_MXF
#endif // _WX_IMAGMXF_H_

View File

@ -106,5 +106,13 @@ SOURCE=.\compat\getopt.h
SOURCE=.\image_to_j2k.c
# End Source File
# Begin Source File
SOURCE=.\index.c
# End Source File
# Begin Source File
SOURCE=.\index.h
# End Source File
# End Target
# End Project

View File

@ -28,6 +28,7 @@
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "openjpeg.h"
#include "index.h"

View File

@ -29,6 +29,10 @@
#ifndef __J2K_INDEX_H
#define __J2K_INDEX_H
#ifdef __cplusplus
extern "C" {
#endif
/**
Write a structured index to a file
@param cstr_info Codestream information
@ -37,5 +41,9 @@ Write a structured index to a file
*/
int write_index_file(opj_codestream_info_t *cstr_info, char *index);
#ifdef __cplusplus
}
#endif
#endif /* __J2K_INDEX_H */

View File

@ -103,6 +103,14 @@ SOURCE=.\compat\getopt.h
# End Source File
# Begin Source File
SOURCE=.\index.c
# End Source File
# Begin Source File
SOURCE=.\index.h
# End Source File
# Begin Source File
SOURCE=.\j2k_to_image.c
# End Source File
# End Target

View File

@ -98,6 +98,10 @@ SOURCE=..\codec\compat\getopt.c
SOURCE=..\codec\image_to_j2k.c
# End Source File
# Begin Source File
SOURCE=..\codec\index.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -112,6 +116,10 @@ SOURCE=..\codec\compat\getopt.h
# End Source File
# Begin Source File
SOURCE=..\codec\index.h
# End Source File
# Begin Source File
SOURCE=..\libopenjpeg\openjpeg.h
# End Source File
# End Group

View File

@ -95,6 +95,10 @@ SOURCE=..\codec\compat\getopt.c
# End Source File
# Begin Source File
SOURCE=..\codec\index.c
# End Source File
# Begin Source File
SOURCE=..\codec\j2k_to_image.c
# End Source File
# End Group
@ -115,6 +119,10 @@ SOURCE=..\codec\compat\getopt.h
# End Source File
# Begin Source File
SOURCE=..\codec\index.h
# End Source File
# Begin Source File
SOURCE=.\jpwl.h
# End Source File
# Begin Source File

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /YX /FD /c
# ADD BASE RSC /l 0x80c /d "NDEBUG"
# ADD RSC /l 0x80c /d "NDEBUG"
BSC32=bscmake.exe
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /YX /FD /GZ /c
# ADD BASE RSC /l 0x80c /d "_DEBUG"
# ADD RSC /l 0x80c /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -1219,6 +1219,7 @@ void j2k_read_red(opj_j2k_t *j2k) {
bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
#ifdef oerhgierhgvhreit4u
/*
we navigate through the tile and find possible invalid parameters:
this saves a lot of crashes!!!!!
@ -1280,6 +1281,8 @@ bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) {
}
}
#endif
return true;
}

View File

@ -661,7 +661,7 @@ bool jpwl_correct(opj_j2k_t *j2k) {
j2k->state = J2K_STATE_MHSOC;
/* cycle all over the markers */
while ((unsigned int) cio_tell(cio) < cio->length) {
while (cio_tell(cio) < cio->length) {
/* read the marker */
mark_pos = cio_tell(cio);