Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified. Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
This commit is contained in:
parent
29ea3dde47
commit
ac0cc6df62
|
@ -5,6 +5,10 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
February 11, 2000
|
||||||
|
* [GB] Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified
|
||||||
|
! [GB] Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
|
||||||
|
|
||||||
February 5, 2008
|
February 5, 2008
|
||||||
! [Parvatha] In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in
|
! [Parvatha] In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in
|
||||||
tcd_init_encode(). Thanks to Jeremy Furtek and Jérôme Fimes.
|
tcd_init_encode(). Thanks to Jeremy Furtek and Jérôme Fimes.
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
CC = $(shell wx-config-2.8 --cxx)
|
CC = $(shell wx-config-2.8 --cxx)
|
||||||
AR = ar
|
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
|
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS $(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 source/OPJViewer.cpp source/OPJThreads.cpp
|
OPJV_SRCS = source/imagjpeg2000.cpp source/wxj2kparser.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJDialogs.cpp source/OPJThreads.cpp source/OPJAbout.cpp ../codec/index.c
|
||||||
|
|
||||||
MODULES = $(OPJV_SRCS:.cpp=.o)
|
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ lib:
|
||||||
cd ../jpwl; make
|
cd ../jpwl; make
|
||||||
|
|
||||||
opjviewer: $(OPJV_SRCS) lib
|
opjviewer: $(OPJV_SRCS) lib
|
||||||
$(CC) $(CFLAGS) -I .. $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
$(CC) $(CFLAGS) -I .. -I ../codec -I ../libopenjpeg $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=OPJViewer
|
AppName=OPJViewer
|
||||||
AppVerName=OPJViewer 0.3 alpha
|
AppVerName=OPJViewer 0.4 beta
|
||||||
AppPublisher=OpenJPEG
|
AppPublisher=OpenJPEG
|
||||||
AppPublisherURL=http://www.openjpeg.org
|
AppPublisherURL=http://www.openjpeg.org
|
||||||
AppSupportURL=http://www.openjpeg.org
|
AppSupportURL=http://www.openjpeg.org
|
||||||
|
@ -11,13 +11,13 @@ AppUpdatesURL=http://www.openjpeg.org
|
||||||
DefaultDirName={pf}\OPJViewer
|
DefaultDirName={pf}\OPJViewer
|
||||||
DefaultGroupName=OPJViewer
|
DefaultGroupName=OPJViewer
|
||||||
OutputDir=setup
|
OutputDir=setup
|
||||||
OutputBaseFilename=OPJViewer03alpha_setup
|
OutputBaseFilename=OPJViewer04beta_setup
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=true
|
SolidCompression=true
|
||||||
InfoBeforeFile=source\readmebefore.txt
|
InfoBeforeFile=source\readmebefore.txt
|
||||||
InfoAfterFile=source\readmeafter.txt
|
InfoAfterFile=source\readmeafter.txt
|
||||||
LicenseFile=source\license.txt
|
LicenseFile=source\license.txt
|
||||||
VersionInfoVersion=0.3.0.0
|
VersionInfoVersion=0.4.0.0
|
||||||
VersionInfoCompany=OpenJPEG
|
VersionInfoCompany=OpenJPEG
|
||||||
VersionInfoDescription=JPEG 2000 viewer
|
VersionInfoDescription=JPEG 2000 viewer
|
||||||
ShowLanguageDialog=yes
|
ShowLanguageDialog=yes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
===============================================================================
|
===============================================================================
|
||||||
JPEG2000 Visualization Software - OPJViewer
|
JPEG2000 Visualization Software - OPJViewer
|
||||||
|
|
||||||
Version 0.3 alpha
|
Version 0.4 beta
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ f) Build!
|
||||||
g) Run!
|
g) Run!
|
||||||
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
||||||
|
|
||||||
|
2.1.1 Additional libraries
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Since we are also working on the Digital Cinema JPEG 2000, we are integrating the viewer with the MXF library, which is used to prepare the DCPs for digital movies. You can enable its linking in the code by specifying the USE_MXF preprocessor directive but, remember, the integration is at a very early stage.
|
||||||
|
|
||||||
2.2. Compiling the source code in Unix-like systems
|
2.2. Compiling the source code in Unix-like systems
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,6 @@ void *OPJEncoThread::Entry()
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Decoding thread class
|
// Decoding thread class
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||||
: wxThread()
|
: wxThread()
|
||||||
{
|
{
|
||||||
|
@ -141,7 +140,15 @@ OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||||
void OPJDecoThread::WriteText(const wxString& text)
|
void OPJDecoThread::WriteText(const wxString& text)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
// we use a fake event and post it for inter-thread gui communication
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||||
|
event.SetInt(-1);
|
||||||
|
msg << text;
|
||||||
|
event.SetString(msg);
|
||||||
|
wxPostEvent(this->m_canvas->m_childframe->m_frame, event);
|
||||||
|
|
||||||
|
/*
|
||||||
// before doing any GUI calls we must ensure that this thread is the only
|
// before doing any GUI calls we must ensure that this thread is the only
|
||||||
// one doing it!
|
// one doing it!
|
||||||
|
|
||||||
|
@ -155,6 +162,7 @@ void OPJDecoThread::WriteText(const wxString& text)
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJDecoThread::OnExit()
|
void OPJDecoThread::OnExit()
|
||||||
|
@ -180,53 +188,24 @@ void *OPJDecoThread::Entry()
|
||||||
|
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
srand(GetId());
|
//srand(GetId());
|
||||||
//int m_countnum = rand() % 9;
|
//int m_countnum = rand() % 9;
|
||||||
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
||||||
// GetId(), GetPriority(), m_countnum);
|
// GetId(), GetPriority(), m_countnum);
|
||||||
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
|
||||||
|
|
||||||
|
// we have started
|
||||||
|
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||||
WriteText(text);
|
WriteText(text);
|
||||||
|
|
||||||
|
// prepare dummy wximage
|
||||||
wxBitmap bitmap(100, 100);
|
wxBitmap bitmap(100, 100);
|
||||||
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
||||||
image.Destroy();
|
image.Destroy();
|
||||||
|
|
||||||
|
// show image full name
|
||||||
WriteText(m_canvas->m_fname.GetFullPath());
|
WriteText(m_canvas->m_fname.GetFullPath());
|
||||||
|
|
||||||
|
|
||||||
// set handler properties
|
// set handler properties
|
||||||
/* wxJ2KHandler *j2kkkhandler = (wxJ2KHandler *) wxImage::FindHandler( wxBITMAP_TYPE_J2K);
|
|
||||||
j2kkkhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
|
||||||
j2kkkhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
|
||||||
j2kkkhandler->m_components = wxGetApp().m_components;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
j2kkkhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
|
||||||
j2kkkhandler->m_expcomps = wxGetApp().m_expcomps;
|
|
||||||
j2kkkhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
|
||||||
#endif // USE_JPWL*/
|
|
||||||
|
|
||||||
/* wxJP2Handler *jp222handler = (wxJP2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_JP2);
|
|
||||||
jp222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
|
||||||
jp222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
|
||||||
jp222handler->m_components = wxGetApp().m_components;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
jp222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
|
||||||
jp222handler->m_expcomps = wxGetApp().m_expcomps;
|
|
||||||
jp222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
|
||||||
#endif // USE_JPWL*/
|
|
||||||
|
|
||||||
/* wxMJ2Handler *mj222handler = (wxMJ2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_MJ2);
|
|
||||||
mj222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
|
||||||
mj222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
|
||||||
mj222handler->m_components = wxGetApp().m_components;
|
|
||||||
mj222handler->m_framenum = wxGetApp().m_framenum;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
mj222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
|
||||||
mj222handler->m_expcomps = wxGetApp().m_expcomps;
|
|
||||||
mj222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
|
||||||
#endif // USE_JPWL*/
|
|
||||||
|
|
||||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||||
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||||
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||||
|
@ -239,7 +218,7 @@ void *OPJDecoThread::Entry()
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler( wxBITMAP_TYPE_MXF);
|
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(wxBITMAP_TYPE_MXF);
|
||||||
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||||
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||||
mxfffhandler->m_components = wxGetApp().m_components;
|
mxfffhandler->m_components = wxGetApp().m_components;
|
||||||
|
@ -252,11 +231,12 @@ void *OPJDecoThread::Entry()
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
|
|
||||||
|
// if decoding is enabled...
|
||||||
if (wxGetApp().m_enabledeco) {
|
if (wxGetApp().m_enabledeco) {
|
||||||
|
|
||||||
// load the file
|
// load the file
|
||||||
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
||||||
WriteText(wxT("Can't load image"));
|
WriteText(wxT("Can't load image!"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +244,7 @@ void *OPJDecoThread::Entry()
|
||||||
|
|
||||||
// display a warning
|
// display a warning
|
||||||
if (!image.Create(300, 5, false)) {
|
if (!image.Create(300, 5, false)) {
|
||||||
WriteText(wxT("Can't create image"));
|
WriteText(wxT("Can't create image!"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,16 +253,22 @@ void *OPJDecoThread::Entry()
|
||||||
// assign 100% image
|
// assign 100% image
|
||||||
m_canvas->m_image100 = wxBitmap(image);
|
m_canvas->m_image100 = wxBitmap(image);
|
||||||
|
|
||||||
|
// signal the frame to refresh the canvas
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_VIEWFIT);
|
||||||
|
event.SetString(wxT("Fit me"));
|
||||||
|
event.SetInt(m_canvas->m_childframe->m_winnumber);
|
||||||
|
wxPostEvent(m_canvas->m_childframe->m_frame, event);
|
||||||
|
|
||||||
// find a fit-to-width zoom
|
// find a fit-to-width zoom
|
||||||
int zooml, wzooml, hzooml;
|
/*int zooml, wzooml, hzooml;
|
||||||
wxSize clientsize = m_canvas->GetClientSize();
|
wxSize clientsize = m_canvas->GetClientSize();
|
||||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
||||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
||||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||||
|
|
||||||
// fit to width
|
// fit to width
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
//m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
|
||||||
//m_canvas->m_image = m_canvas->m_image100;
|
//m_canvas->m_image = m_canvas->m_image100;
|
||||||
|
@ -311,8 +297,15 @@ OPJParseThread::OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid)
|
||||||
void OPJParseThread::WriteText(const wxString& text)
|
void OPJParseThread::WriteText(const wxString& text)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
// we use a fake event and post it for inter-thread gui communication
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||||
|
event.SetInt(-1);
|
||||||
|
msg << text;
|
||||||
|
event.SetString(msg);
|
||||||
|
wxPostEvent(this->m_tree->m_childframe->m_frame, event);
|
||||||
|
|
||||||
// before doing any GUI calls we must ensure that this thread is the only
|
/* // before doing any GUI calls we must ensure that this thread is the only
|
||||||
// one doing it!
|
// one doing it!
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
|
@ -324,7 +317,7 @@ void OPJParseThread::WriteText(const wxString& text)
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif // __WXGTK
|
#endif // __WXGTK*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJParseThread::OnExit()
|
void OPJParseThread::OnExit()
|
||||||
|
@ -595,7 +588,6 @@ void OPJParseThread::LoadFile(wxFileName fname)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this is the root node
|
// this is the root node
|
||||||
if (this->m_parentid)
|
if (this->m_parentid)
|
||||||
m_tree->SetItemText(rootid, wxT("Codestream"));
|
m_tree->SetItemText(rootid, wxT("Codestream"));
|
||||||
|
|
|
@ -165,10 +165,6 @@ bool OPJViewerApp::OnInit(void)
|
||||||
|
|
||||||
wxCmdLineParser parser(cmdLineDesc, argc, wxArgv);
|
wxCmdLineParser parser(cmdLineDesc, argc, wxArgv);
|
||||||
|
|
||||||
/*parser.AddOption(_T("project_name"), _T(""), _T("full path to project file"),
|
|
||||||
wxCMD_LINE_VAL_STRING,
|
|
||||||
wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR);*/
|
|
||||||
|
|
||||||
switch (parser.Parse()) {
|
switch (parser.Parse()) {
|
||||||
case -1:
|
case -1:
|
||||||
wxLogMessage(wxT("Help was given, terminating."));
|
wxLogMessage(wxT("Help was given, terminating."));
|
||||||
|
@ -190,9 +186,6 @@ bool OPJViewerApp::OnInit(void)
|
||||||
wxImage::AddHandler( new wxJPEGHandler );
|
wxImage::AddHandler( new wxJPEGHandler );
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_LIBOPENJPEG
|
#if wxUSE_LIBOPENJPEG
|
||||||
//wxImage::AddHandler( new wxJ2KHandler );
|
|
||||||
//wxImage::AddHandler( new wxJP2Handler );
|
|
||||||
//wxImage::AddHandler( new wxMJ2Handler );
|
|
||||||
wxImage::AddHandler( new wxJPEG2000Handler );
|
wxImage::AddHandler( new wxJPEG2000Handler );
|
||||||
#endif
|
#endif
|
||||||
#if USE_MXF
|
#if USE_MXF
|
||||||
|
@ -477,9 +470,6 @@ void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser)
|
||||||
// OPJFrame events
|
// OPJFrame events
|
||||||
|
|
||||||
// Event class for sending text messages between worker and GUI threads
|
// Event class for sending text messages between worker and GUI threads
|
||||||
DECLARE_EVENT_TYPE(wxEVT_LOGMSG_EVENT, -1)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_LOGMSG_EVENT)
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
||||||
EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout)
|
EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout)
|
||||||
EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen)
|
EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen)
|
||||||
|
@ -510,7 +500,7 @@ BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
||||||
EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)
|
EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)
|
||||||
EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)
|
EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook)
|
EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook)
|
||||||
EVT_COMMAND(wxID_ANY, wxEVT_LOGMSG_EVENT, OPJFrame::OnLogmsgEvent)
|
EVT_MENU(OPJFRAME_THREADLOGMSG, OPJFrame::OnThreadLogmsg)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// this is the frame constructor
|
// this is the frame constructor
|
||||||
|
@ -928,10 +918,21 @@ void OPJFrame::OnClose(wxCommandEvent& WXUNUSED(event))
|
||||||
currframe->OnClose(e);
|
currframe->OnClose(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
void OPJFrame::OnFit(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
OPJChildFrame *currchild;
|
||||||
|
wxString eventstring = event.GetString();
|
||||||
|
|
||||||
|
//wxLogMessage(wxT("OnFit:%d:%s"), event.GetInt(), eventstring);
|
||||||
|
|
||||||
// current child
|
// current child
|
||||||
OPJChildFrame *currchild = (OPJChildFrame *) GetActiveChild();
|
if (event.GetInt() >= 1) {
|
||||||
|
currchild = m_childhash[event.GetInt()];
|
||||||
|
} else {
|
||||||
|
currchild = (OPJChildFrame *) GetActiveChild();
|
||||||
|
}
|
||||||
|
|
||||||
|
// problems
|
||||||
if (!currchild)
|
if (!currchild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -939,14 +940,14 @@ void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
||||||
OPJCanvas *currcanvas = currchild->m_canvas;
|
OPJCanvas *currcanvas = currchild->m_canvas;
|
||||||
|
|
||||||
// find a fit-to-width zoom
|
// find a fit-to-width zoom
|
||||||
int zooml, wzooml, hzooml;
|
/*int zooml, wzooml, hzooml;
|
||||||
wxSize clientsize = currcanvas->GetClientSize();
|
wxSize clientsize = currcanvas->GetClientSize();
|
||||||
wzooml = (int) ceil(100.0 * (double) (clientsize.GetWidth() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetWidth()));
|
wzooml = (int) ceil(100.0 * (double) (clientsize.GetWidth() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetWidth()));
|
||||||
hzooml = (int) ceil(100.0 * (double) (clientsize.GetHeight() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetHeight()));
|
hzooml = (int) ceil(100.0 * (double) (clientsize.GetHeight() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetHeight()));
|
||||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||||
|
|
||||||
// fit to width
|
// fit to width
|
||||||
Rescale(zooml, currchild);
|
Rescale(-1, currchild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
|
void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@ -976,7 +977,20 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
||||||
|
|
||||||
// resizing enabled?
|
// resizing enabled?
|
||||||
if (wxGetApp().m_resizemethod == -1) {
|
if (wxGetApp().m_resizemethod == -1) {
|
||||||
|
|
||||||
zooml = 100;
|
zooml = 100;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (zooml < 0) {
|
||||||
|
// find a fit-to-width zoom
|
||||||
|
int wzooml, hzooml;
|
||||||
|
//wxSize clientsize = currframe->m_canvas->GetClientSize();
|
||||||
|
wxSize clientsize = currframe->m_frame->GetActiveChild()->GetClientSize();
|
||||||
|
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetWidth()));
|
||||||
|
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetHeight()));
|
||||||
|
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zooml != 100)
|
if (zooml != 100)
|
||||||
|
@ -992,6 +1006,8 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
||||||
|
|
||||||
currframe->m_canvas->Refresh();
|
currframe->m_canvas->Refresh();
|
||||||
|
|
||||||
|
wxLogMessage(wxT("Rescale said %d%%"), zooml);
|
||||||
|
|
||||||
// update zoom
|
// update zoom
|
||||||
currframe->m_canvas->m_zooml = zooml;
|
currframe->m_canvas->m_zooml = zooml;
|
||||||
}
|
}
|
||||||
|
@ -1199,6 +1215,36 @@ void OPJFrame::OnSashDrag(wxSashEvent& event)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPJFrame::OnThreadLogmsg(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
wxLogMessage(wxT("Frame got message from worker thread: %d"), event.GetInt());
|
||||||
|
wxLogMessage(event.GetString());
|
||||||
|
#else
|
||||||
|
int n = event.GetInt();
|
||||||
|
if ( n == -1 )
|
||||||
|
{
|
||||||
|
m_dlgProgress->Destroy();
|
||||||
|
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||||
|
|
||||||
|
// the dialog is aborted because the event came from another thread, so
|
||||||
|
// we may need to wake up the main event loop for the dialog to be
|
||||||
|
// really closed
|
||||||
|
wxWakeUpIdle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_dlgProgress->Update(n) )
|
||||||
|
{
|
||||||
|
wxCriticalSectionLocker lock(m_critsectWork);
|
||||||
|
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// physically save the file
|
// physically save the file
|
||||||
void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames)
|
void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames)
|
||||||
{
|
{
|
||||||
|
@ -1364,6 +1410,7 @@ void OPJFrame::OnMemoryOpen(wxCommandEvent& WXUNUSED(event))
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow)
|
||||||
EVT_MOUSE_EVENTS(OPJCanvas::OnEvent)
|
EVT_MOUSE_EVENTS(OPJCanvas::OnEvent)
|
||||||
|
EVT_MENU(OPJCANVAS_THREADSIGNAL, OPJCanvas::OnThreadSignal)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
|
@ -1469,13 +1516,33 @@ void OPJFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||||
layout.LayoutMDIFrame(this);
|
layout.LayoutMDIFrame(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJFrame::OnLogmsgEvent(wxCommandEvent &event)
|
void OPJCanvas::OnThreadSignal(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
// receive string
|
#if 1
|
||||||
wxString text = event.GetString();
|
wxLogMessage(wxT("Canvas got signal from deco thread: %d"), event.GetInt());
|
||||||
|
wxLogMessage(event.GetString());
|
||||||
|
#else
|
||||||
|
int n = event.GetInt();
|
||||||
|
if ( n == -1 )
|
||||||
|
{
|
||||||
|
m_dlgProgress->Destroy();
|
||||||
|
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||||
|
|
||||||
// show it on the log
|
// the dialog is aborted because the event came from another thread, so
|
||||||
wxLogMessage(text);
|
// we may need to wake up the main event loop for the dialog to be
|
||||||
|
// really closed
|
||||||
|
wxWakeUpIdle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_dlgProgress->Update(n) )
|
||||||
|
{
|
||||||
|
wxCriticalSectionLocker lock(m_critsectWork);
|
||||||
|
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,13 @@ class OPJCanvas: public wxScrolledWindow
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif //__WXGTK__
|
#endif //__WXGTK__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnThreadSignal(wxCommandEvent& event);
|
||||||
|
|
||||||
OPJDecoThread *CreateDecoThread(void);
|
OPJDecoThread *CreateDecoThread(void);
|
||||||
OPJEncoThread *CreateEncoThread(void);
|
OPJEncoThread *CreateEncoThread(void);
|
||||||
|
|
||||||
|
|
||||||
OPJChildFrame *m_childframe;
|
OPJChildFrame *m_childframe;
|
||||||
|
|
||||||
wxBitmap m_image, m_image100;
|
wxBitmap m_image, m_image100;
|
||||||
|
@ -419,7 +424,7 @@ class OPJFrame: public wxMDIParentFrame
|
||||||
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnClose(wxCommandEvent& WXUNUSED(event));
|
void OnClose(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnFit(wxCommandEvent& WXUNUSED(event));
|
void OnFit(wxCommandEvent& event);
|
||||||
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||||
|
@ -443,7 +448,7 @@ class OPJFrame: public wxMDIParentFrame
|
||||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||||
void OnNotebook(wxNotebookEvent& event);
|
void OnNotebook(wxNotebookEvent& event);
|
||||||
void Rescale(int scale, OPJChildFrame *child);
|
void Rescale(int scale, OPJChildFrame *child);
|
||||||
void OnLogmsgEvent(wxCommandEvent &event);
|
void OnThreadLogmsg(wxCommandEvent& event);
|
||||||
|
|
||||||
OPJMarkerTreeHash m_treehash;
|
OPJMarkerTreeHash m_treehash;
|
||||||
OPJChildFrameHash m_childhash;
|
OPJChildFrameHash m_childhash;
|
||||||
|
@ -523,7 +528,10 @@ enum {
|
||||||
|
|
||||||
OPJFRAME_BROWSEWIN = 10000,
|
OPJFRAME_BROWSEWIN = 10000,
|
||||||
OPJFRAME_LOGWIN,
|
OPJFRAME_LOGWIN,
|
||||||
OPJFRAME_TOOLBAR
|
OPJFRAME_TOOLBAR,
|
||||||
|
|
||||||
|
OPJFRAME_THREADLOGMSG,
|
||||||
|
OPJCANVAS_THREADSIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
wxT("468")
|
wxT("491")
|
||||||
|
|
|
@ -128,46 +128,61 @@ jpeg2000familytype(unsigned char *hdr, int hdr_len)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sample error callback expecting a FILE* client object */
|
/* we have to use this to avoid GUI-noGUI threads crashing */
|
||||||
void jpeg2000_error_callback(const char *msg, void *client_data) {
|
void printevent(const char *msg)
|
||||||
int message_len = strlen(msg) - 1;
|
{
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiEnter();
|
wxMutexGuiEnter();
|
||||||
#endif /* __WXGTK__ */
|
#endif /* __WXGTK__ */
|
||||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
wxLogMessage(wxT("%s"), msg);
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif /* __WXGTK__ */
|
#endif /* __WXGTK__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* sample error callback expecting a FILE* client object */
|
||||||
|
void jpeg2000_error_callback(const char *msg, void *client_data) {
|
||||||
|
char mess[MAX_MESSAGE_LEN + 20];
|
||||||
|
int message_len = strlen(msg);
|
||||||
|
|
||||||
|
if (message_len > MAX_MESSAGE_LEN)
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
|
||||||
|
if (msg[message_len - 1] == '\n')
|
||||||
|
message_len--;
|
||||||
|
|
||||||
|
sprintf(mess, "[ERROR] %.*s", message_len, msg);
|
||||||
|
printevent(mess);
|
||||||
|
}
|
||||||
|
|
||||||
/* sample warning callback expecting a FILE* client object */
|
/* sample warning callback expecting a FILE* client object */
|
||||||
void jpeg2000_warning_callback(const char *msg, void *client_data) {
|
void jpeg2000_warning_callback(const char *msg, void *client_data) {
|
||||||
int message_len = strlen(msg) - 1;
|
char mess[MAX_MESSAGE_LEN + 20];
|
||||||
if (msg[message_len] != '\n')
|
int message_len = strlen(msg);
|
||||||
|
|
||||||
|
if (message_len > MAX_MESSAGE_LEN)
|
||||||
message_len = MAX_MESSAGE_LEN;
|
message_len = MAX_MESSAGE_LEN;
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
if (msg[message_len - 1] == '\n')
|
||||||
#endif /* __WXGTK__ */
|
message_len--;
|
||||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
sprintf(mess, "[WARNING] %.*s", message_len, msg);
|
||||||
wxMutexGuiLeave();
|
printevent(mess);
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sample debug callback expecting no client object */
|
/* sample debug callback expecting no client object */
|
||||||
void jpeg2000_info_callback(const char *msg, void *client_data) {
|
void jpeg2000_info_callback(const char *msg, void *client_data) {
|
||||||
int message_len = strlen(msg) - 1;
|
char mess[MAX_MESSAGE_LEN + 20];
|
||||||
if (msg[message_len] != '\n')
|
int message_len = strlen(msg);
|
||||||
|
|
||||||
|
if (message_len > MAX_MESSAGE_LEN)
|
||||||
message_len = MAX_MESSAGE_LEN;
|
message_len = MAX_MESSAGE_LEN;
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
if (msg[message_len - 1] == '\n')
|
||||||
#endif /* __WXGTK__ */
|
message_len--;
|
||||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
sprintf(mess, "[INFO] %.*s", message_len, msg);
|
||||||
wxMutexGuiLeave();
|
printevent(mess);
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* macro functions */
|
/* macro functions */
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
int hprot, pprot, sens, addr, size, range;
|
int hprot, pprot, sens, addr, size, range;
|
||||||
|
|
||||||
/* we need to enable indexing */
|
/* we need to enable indexing */
|
||||||
if (!indexfilename) {
|
if (!indexfilename || !strcmp(indexfilename, "")) {
|
||||||
strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,7 +1122,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
/* search packet error protection method */
|
/* search packet error protection method */
|
||||||
if (*token == 'p') {
|
if (*token == 'p') {
|
||||||
|
|
||||||
static int pack = 0, tile = 0, packspec = 0, lastpackno = 0;
|
static int pack = 0, tile = 0, packspec = 0/*, lastpackno = 0*/;
|
||||||
|
|
||||||
pprot = 1; /* predefined method */
|
pprot = 1; /* predefined method */
|
||||||
|
|
||||||
|
@ -1278,7 +1278,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
/* search addressing size */
|
/* search addressing size */
|
||||||
if (*token == 'a') {
|
if (*token == 'a') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
/*static int tile = 0, tilespec = 0, lasttileno = 0*/;
|
||||||
|
|
||||||
addr = 0; /* predefined: auto */
|
addr = 0; /* predefined: auto */
|
||||||
|
|
||||||
|
@ -1304,7 +1304,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
/* search sensitivity size */
|
/* search sensitivity size */
|
||||||
if (*token == 'z') {
|
if (*token == 'z') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
/*static int tile = 0, tilespec = 0, lasttileno = 0;*/
|
||||||
|
|
||||||
size = 1; /* predefined: 1 byte */
|
size = 1; /* predefined: 1 byte */
|
||||||
|
|
||||||
|
@ -1330,7 +1330,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
/* search range method */
|
/* search range method */
|
||||||
if (*token == 'g') {
|
if (*token == 'g') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
/*static int tile = 0, tilespec = 0, lasttileno = 0;*/
|
||||||
|
|
||||||
range = 0; /* predefined: 0 (packet) */
|
range = 0; /* predefined: 0 (packet) */
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /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 "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
||||||
# ADD RSC /l 0x80c /d "NDEBUG"
|
# ADD RSC /l 0x80c /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
|
@ -41,7 +41,8 @@ RSC=rc.exe
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# 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 /I "../libopenjpeg" /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" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
||||||
# ADD RSC /l 0x80c /d "NDEBUG"
|
# ADD RSC /l 0x80c /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
@ -64,7 +65,8 @@ LIB32=link.exe -lib
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Target_Dir ""
|
# 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 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 /I "../libopenjpeg" /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" /FD /GZ /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x80c /d "_DEBUG"
|
# ADD BASE RSC /l 0x80c /d "_DEBUG"
|
||||||
# ADD RSC /l 0x80c /d "_DEBUG"
|
# ADD RSC /l 0x80c /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
|
@ -19,8 +19,8 @@ INSTALL_INCLUDE = $(PREFIX)/include
|
||||||
# Converts cr/lf to just lf
|
# Converts cr/lf to just lf
|
||||||
DOS2UNIX = dos2unix
|
DOS2UNIX = dos2unix
|
||||||
|
|
||||||
COMPILERFLAGS = -O3 -fPIC
|
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
|
||||||
LIBRARIES = -lstdc++
|
LIBRARIES = -lstdc++
|
||||||
|
|
||||||
MODULES = $(SRCS:.c=.o)
|
MODULES = $(SRCS:.c=.o)
|
||||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE) -DUSE_JPWL
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDE) -DUSE_JPWL
|
||||||
|
@ -60,10 +60,10 @@ $(SHAREDLIB): $(MODULES)
|
||||||
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||||
|
|
||||||
JPWL_j2k_to_image: ../codec/j2k_to_image.c
|
JPWL_j2k_to_image: ../codec/j2k_to_image.c
|
||||||
gcc $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
|
gcc $(CFLAGS) ../codec/compat/getopt.c ../codec/index.c ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
|
||||||
|
|
||||||
JPWL_image_to_j2k: ../codec/image_to_j2k.c
|
JPWL_image_to_j2k: ../codec/image_to_j2k.c
|
||||||
gcc $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
|
gcc $(CFLAGS) ../codec/compat/getopt.c ../codec/index.c ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -ltiff
|
||||||
|
|
||||||
install: OpenJPEG
|
install: OpenJPEG
|
||||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||||
|
|
76
jpwl/jpwl.c
76
jpwl/jpwl.c
|
@ -122,19 +122,19 @@ void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
switch (jwmarker[mm].id) {
|
switch (jwmarker[mm].id) {
|
||||||
|
|
||||||
case J2K_MS_EPB:
|
case J2K_MS_EPB:
|
||||||
free(jwmarker[mm].epbmark);
|
opj_free(jwmarker[mm].m.epbmark);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_EPC:
|
case J2K_MS_EPC:
|
||||||
free(jwmarker[mm].epcmark);
|
opj_free(jwmarker[mm].m.epcmark);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_ESD:
|
case J2K_MS_ESD:
|
||||||
free(jwmarker[mm].esdmark);
|
opj_free(jwmarker[mm].m.esdmark);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_RED:
|
case J2K_MS_RED:
|
||||||
free(jwmarker[mm].redmark);
|
opj_free(jwmarker[mm].m.redmark);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -202,18 +202,18 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
EPC MS for Main Header: if we are here it's required
|
EPC MS for Main Header: if we are here it's required
|
||||||
*/
|
*/
|
||||||
/* create the EPC */
|
/* create the EPC */
|
||||||
if (epc_mark = jpwl_epc_create(
|
if ((epc_mark = jpwl_epc_create(
|
||||||
j2k,
|
j2k,
|
||||||
j2k->cp->esd_on, /* is ESD present? */
|
j2k->cp->esd_on, /* is ESD present? */
|
||||||
j2k->cp->red_on, /* is RED present? */
|
j2k->cp->red_on, /* is RED present? */
|
||||||
j2k->cp->epb_on, /* is EPB present? */
|
j2k->cp->epb_on, /* is EPB present? */
|
||||||
false /* are informative techniques present? */
|
false /* are informative techniques present? */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (epc_mark) {
|
if (epc_mark) {
|
||||||
jwmarker[jwmarker_num].id = J2K_MS_EPC; /* its type */
|
jwmarker[jwmarker_num].id = J2K_MS_EPC; /* its type */
|
||||||
jwmarker[jwmarker_num].epcmark = epc_mark; /* the EPC */
|
jwmarker[jwmarker_num].m.epcmark = epc_mark; /* the EPC */
|
||||||
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
|
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */
|
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.1; /* not so first */
|
||||||
jwmarker[jwmarker_num].len = epc_mark->Lepc; /* its length */
|
jwmarker[jwmarker_num].len = epc_mark->Lepc; /* its length */
|
||||||
|
@ -243,7 +243,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
if (j2k->cp->esd_on && (j2k->cp->sens_MH >= 0)) {
|
if (j2k->cp->esd_on && (j2k->cp->sens_MH >= 0)) {
|
||||||
|
|
||||||
/* Create the ESD */
|
/* Create the ESD */
|
||||||
if (esd_mark = jpwl_esd_create(
|
if ((esd_mark = jpwl_esd_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
-1, /* we are averaging over all components */
|
-1, /* we are averaging over all components */
|
||||||
(unsigned char) j2k->cp->sens_range, /* range method */
|
(unsigned char) j2k->cp->sens_range, /* range method */
|
||||||
|
@ -253,12 +253,12 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
-1, /* this ESD is in main header */
|
-1, /* this ESD is in main header */
|
||||||
0 /*j2k->cstr_info->num*/, /* number of packets in codestream */
|
0 /*j2k->cstr_info->num*/, /* number of packets in codestream */
|
||||||
NULL /*sensval*/ /* pointer to sensitivity data of packets */
|
NULL /*sensval*/ /* pointer to sensitivity data of packets */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
||||||
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
|
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
|
||||||
jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */
|
jwmarker[jwmarker_num].m.esdmark = esd_mark; /* the EPB */
|
||||||
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* we choose to place it after SIZ */
|
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* we choose to place it after SIZ */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
|
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
|
||||||
jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */
|
jwmarker[jwmarker_num].len = esd_mark->Lesd; /* its length */
|
||||||
|
@ -337,7 +337,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
if (j2k->cp->esd_on && (sens >= 0)) {
|
if (j2k->cp->esd_on && (sens >= 0)) {
|
||||||
|
|
||||||
/* Create the ESD */
|
/* Create the ESD */
|
||||||
if (esd_mark = jpwl_esd_create(
|
if ((esd_mark = jpwl_esd_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
-1, /* we are averaging over all components */
|
-1, /* we are averaging over all components */
|
||||||
(unsigned char) j2k->cp->sens_range, /* range method */
|
(unsigned char) j2k->cp->sens_range, /* range method */
|
||||||
|
@ -347,12 +347,12 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
tileno, /* this ESD is in a tile */
|
tileno, /* this ESD is in a tile */
|
||||||
0, /* number of packets in codestream */
|
0, /* number of packets in codestream */
|
||||||
NULL /* pointer to sensitivity data of packets */
|
NULL /* pointer to sensitivity data of packets */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
||||||
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
|
jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */
|
||||||
jwmarker[jwmarker_num].esdmark = esd_mark; /* the EPB */
|
jwmarker[jwmarker_num].m.esdmark = esd_mark; /* the EPB */
|
||||||
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
|
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
|
||||||
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
|
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
|
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos + 0.2; /* not first at all! */
|
||||||
|
@ -416,7 +416,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the EPB */
|
/* Create the EPB */
|
||||||
if (epb_mark = jpwl_epb_create(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
true, /* is it the latest? */
|
true, /* is it the latest? */
|
||||||
true, /* is it packed? not for now */
|
true, /* is it packed? not for now */
|
||||||
|
@ -425,12 +425,12 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
j2k->cp->hprot_MH, /* protection type parameters of data */
|
j2k->cp->hprot_MH, /* protection type parameters of data */
|
||||||
socsiz_len, /* pre-data: only SOC+SIZ */
|
socsiz_len, /* pre-data: only SOC+SIZ */
|
||||||
left_MHmarks_len /* post-data: from SOC to SOT, and all JPWL markers within */
|
left_MHmarks_len /* post-data: from SOC to SOT, and all JPWL markers within */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
||||||
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
|
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
|
||||||
jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */
|
jwmarker[jwmarker_num].m.epbmark = epb_mark; /* the EPB */
|
||||||
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
|
jwmarker[jwmarker_num].pos = soc_pos + socsiz_len; /* after SIZ */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
||||||
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
|
jwmarker[jwmarker_num].len = epb_mark->Lepb; /* its length */
|
||||||
|
@ -474,7 +474,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
|
|
||||||
int sot_len, Psot, Psotp, mm, epb_index = 0, prot_len = 0;
|
int sot_len, Psot, Psotp, mm, epb_index = 0, prot_len = 0;
|
||||||
unsigned long sot_pos, post_sod_pos;
|
unsigned long sot_pos, post_sod_pos;
|
||||||
unsigned long int left_THmarks_len, epbs_len = 0;
|
unsigned long int left_THmarks_len/*, epbs_len = 0*/;
|
||||||
int startpack = 0, stoppack = j2k->cstr_info->packno;
|
int startpack = 0, stoppack = j2k->cstr_info->packno;
|
||||||
int first_tp_pack, last_tp_pack;
|
int first_tp_pack, last_tp_pack;
|
||||||
jpwl_epb_ms_t *tph_epb = NULL;
|
jpwl_epb_ms_t *tph_epb = NULL;
|
||||||
|
@ -514,7 +514,7 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
if (j2k->cp->epb_on && (hprot > 0)) {
|
if (j2k->cp->epb_on && (hprot > 0)) {
|
||||||
|
|
||||||
/* Create the EPB */
|
/* Create the EPB */
|
||||||
if (epb_mark = jpwl_epb_create(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
false, /* is it the latest? in TPH, no for now (if huge data size in TPH, we'd need more) */
|
false, /* is it the latest? in TPH, no for now (if huge data size in TPH, we'd need more) */
|
||||||
true, /* is it packed? yes for now */
|
true, /* is it packed? yes for now */
|
||||||
|
@ -523,12 +523,12 @@ void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
hprot, /* protection type parameters of following data */
|
hprot, /* protection type parameters of following data */
|
||||||
sot_len + 2, /* pre-data length: only SOT */
|
sot_len + 2, /* pre-data length: only SOT */
|
||||||
left_THmarks_len /* post-data length: from SOT end to SOD inclusive */
|
left_THmarks_len /* post-data length: from SOT end to SOD inclusive */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
if (jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
||||||
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
|
jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */
|
||||||
jwmarker[jwmarker_num].epbmark = epb_mark; /* the EPB */
|
jwmarker[jwmarker_num].m.epbmark = epb_mark; /* the EPB */
|
||||||
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
|
/****** jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].start_pos + sot_len + 2; */ /* after SOT */
|
||||||
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
|
jwmarker[jwmarker_num].pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2; /* after SOT */
|
||||||
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
jwmarker[jwmarker_num].dpos = (double) jwmarker[jwmarker_num].pos; /* first first first! */
|
||||||
|
@ -712,7 +712,7 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
int mm;
|
int mm;
|
||||||
unsigned long int old_size = j2k->cstr_info->codestream_size;
|
unsigned long int old_size = j2k->cstr_info->codestream_size;
|
||||||
unsigned long int new_size = old_size;
|
unsigned long int new_size = old_size;
|
||||||
int ciopos = cio_tell(cio), soc_pos = j2k->cstr_info->main_head_start;
|
int /*ciopos = cio_tell(cio),*/ soc_pos = j2k->cstr_info->main_head_start;
|
||||||
unsigned char *jpwl_buf, *orig_buf;
|
unsigned char *jpwl_buf, *orig_buf;
|
||||||
unsigned long int orig_pos;
|
unsigned long int orig_pos;
|
||||||
double epbcoding_time = 0.0, esdcoding_time = 0.0;
|
double epbcoding_time = 0.0, esdcoding_time = 0.0;
|
||||||
|
@ -758,15 +758,15 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
switch (jwmarker[mm].id) {
|
switch (jwmarker[mm].id) {
|
||||||
|
|
||||||
case J2K_MS_EPB:
|
case J2K_MS_EPB:
|
||||||
jpwl_epb_write(j2k, jwmarker[mm].epbmark, jpwl_buf);
|
jpwl_epb_write(j2k, jwmarker[mm].m.epbmark, jpwl_buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_EPC:
|
case J2K_MS_EPC:
|
||||||
jpwl_epc_write(j2k, jwmarker[mm].epcmark, jpwl_buf);
|
jpwl_epc_write(j2k, jwmarker[mm].m.epcmark, jpwl_buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_ESD:
|
case J2K_MS_ESD:
|
||||||
jpwl_esd_write(j2k, jwmarker[mm].esdmark, jpwl_buf);
|
jpwl_esd_write(j2k, jwmarker[mm].m.esdmark, jpwl_buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case J2K_MS_RED:
|
case J2K_MS_RED:
|
||||||
|
@ -812,11 +812,11 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
unsigned short int mycrc = 0x0000;
|
unsigned short int mycrc = 0x0000;
|
||||||
|
|
||||||
/* fix and fill the DL field */
|
/* fix and fill the DL field */
|
||||||
jwmarker[mm].epcmark->DL = new_size;
|
jwmarker[mm].m.epcmark->DL = new_size;
|
||||||
orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].epcmark->DL >> 24);
|
orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 24);
|
||||||
orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].epcmark->DL >> 16);
|
orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 16);
|
||||||
orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].epcmark->DL >> 8);
|
orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 8);
|
||||||
orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].epcmark->DL >> 0);
|
orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 0);
|
||||||
|
|
||||||
/* compute the CRC field (excluding itself) */
|
/* compute the CRC field (excluding itself) */
|
||||||
for (pp = 0; pp < 4; pp++)
|
for (pp = 0; pp < 4; pp++)
|
||||||
|
@ -825,9 +825,9 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]);
|
jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]);
|
||||||
|
|
||||||
/* fix and fill the CRC */
|
/* fix and fill the CRC */
|
||||||
jwmarker[mm].epcmark->Pcrc = mycrc;
|
jwmarker[mm].m.epcmark->Pcrc = mycrc;
|
||||||
orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 8);
|
orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].m.epcmark->Pcrc >> 8);
|
||||||
orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].epcmark->Pcrc >> 0);
|
orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].m.epcmark->Pcrc >> 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -842,7 +842,7 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
/* remember that they are now in a new position (dpos) */
|
/* remember that they are now in a new position (dpos) */
|
||||||
int esd_pos = (int) jwmarker[mm].dpos;
|
int esd_pos = (int) jwmarker[mm].dpos;
|
||||||
|
|
||||||
jpwl_esd_fill(j2k, jwmarker[mm].esdmark, &orig_buf[esd_pos]);
|
jpwl_esd_fill(j2k, jwmarker[mm].m.esdmark, &orig_buf[esd_pos]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,16 +867,16 @@ void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
|
||||||
accum_len = 0;
|
accum_len = 0;
|
||||||
for (nn = mm; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
|
for (nn = mm; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
|
||||||
(jwmarker[nn].pos == jwmarker[mm].pos); nn++)
|
(jwmarker[nn].pos == jwmarker[mm].pos); nn++)
|
||||||
accum_len += jwmarker[nn].epbmark->Lepb + 2;
|
accum_len += jwmarker[nn].m.epbmark->Lepb + 2;
|
||||||
|
|
||||||
/* fill the current (first) EPB with post-data starting from the computed position */
|
/* fill the current (first) EPB with post-data starting from the computed position */
|
||||||
jpwl_epb_fill(j2k, jwmarker[mm].epbmark, &orig_buf[(int) jwmarker[mm].dpos],
|
jpwl_epb_fill(j2k, jwmarker[mm].m.epbmark, &orig_buf[(int) jwmarker[mm].dpos],
|
||||||
&orig_buf[(int) jwmarker[mm].dpos + accum_len]);
|
&orig_buf[(int) jwmarker[mm].dpos + accum_len]);
|
||||||
|
|
||||||
/* fill the remaining EPBs in the header with post-data starting from the last position */
|
/* fill the remaining EPBs in the header with post-data starting from the last position */
|
||||||
for (nn = mm + 1; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
|
for (nn = mm + 1; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) &&
|
||||||
(jwmarker[nn].pos == jwmarker[mm].pos); nn++)
|
(jwmarker[nn].pos == jwmarker[mm].pos); nn++)
|
||||||
jpwl_epb_fill(j2k, jwmarker[nn].epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL);
|
jpwl_epb_fill(j2k, jwmarker[nn].m.epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL);
|
||||||
|
|
||||||
/* skip all the processed EPBs */
|
/* skip all the processed EPBs */
|
||||||
mm = nn - 1;
|
mm = nn - 1;
|
||||||
|
@ -1106,9 +1106,9 @@ void j2k_read_epb(opj_j2k_t *j2k) {
|
||||||
if (((Pepb & 0xF0000000) >> 28) == 0)
|
if (((Pepb & 0xF0000000) >> 28) == 0)
|
||||||
sprintf(str1, "pred"); /* predefined */
|
sprintf(str1, "pred"); /* predefined */
|
||||||
else if (((Pepb & 0xF0000000) >> 28) == 1)
|
else if (((Pepb & 0xF0000000) >> 28) == 1)
|
||||||
sprintf(str1, "crc-%d", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */
|
sprintf(str1, "crc-%lu", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */
|
||||||
else if (((Pepb & 0xF0000000) >> 28) == 2)
|
else if (((Pepb & 0xF0000000) >> 28) == 2)
|
||||||
sprintf(str1, "rs(%d,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */
|
sprintf(str1, "rs(%lu,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */
|
||||||
else if (Pepb == 0xFFFFFFFF)
|
else if (Pepb == 0xFFFFFFFF)
|
||||||
sprintf(str1, "nometh"); /* RS mode */
|
sprintf(str1, "nometh"); /* RS mode */
|
||||||
else
|
else
|
||||||
|
|
|
@ -179,7 +179,7 @@ typedef struct jpwl_marker {
|
||||||
/** marker value (J2K_MS_EPC, etc.) */
|
/** marker value (J2K_MS_EPC, etc.) */
|
||||||
int id;
|
int id;
|
||||||
/** union keeping the pointer to the real marker struct */
|
/** union keeping the pointer to the real marker struct */
|
||||||
union {
|
union jpwl_marks {
|
||||||
/** pointer to EPB marker */
|
/** pointer to EPB marker */
|
||||||
jpwl_epb_ms_t *epbmark;
|
jpwl_epb_ms_t *epbmark;
|
||||||
/** pointer to EPC marker */
|
/** pointer to EPC marker */
|
||||||
|
@ -188,7 +188,7 @@ typedef struct jpwl_marker {
|
||||||
jpwl_esd_ms_t *esdmark;
|
jpwl_esd_ms_t *esdmark;
|
||||||
/** pointer to RED marker */
|
/** pointer to RED marker */
|
||||||
jpwl_red_ms_t *redmark;
|
jpwl_red_ms_t *redmark;
|
||||||
};
|
} m;
|
||||||
/** position where the marker should go, in the pre-JPWL codestream */
|
/** position where the marker should go, in the pre-JPWL codestream */
|
||||||
unsigned long int pos;
|
unsigned long int pos;
|
||||||
/** same as before, only written as a double, so we can sort it better */
|
/** same as before, only written as a double, so we can sort it better */
|
||||||
|
|
|
@ -152,7 +152,7 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
|
||||||
/* length to use */
|
/* length to use */
|
||||||
dL4 = min(max_postlen, post_len);
|
dL4 = min(max_postlen, post_len);
|
||||||
|
|
||||||
if (epb_mark = jpwl_epb_create(
|
if ((epb_mark = jpwl_epb_create(
|
||||||
j2k, /* this encoder handle */
|
j2k, /* this encoder handle */
|
||||||
latest ? (dL4 < max_postlen) : false, /* is it the latest? */
|
latest ? (dL4 < max_postlen) : false, /* is it the latest? */
|
||||||
packed, /* is it packed? */
|
packed, /* is it packed? */
|
||||||
|
@ -161,12 +161,12 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
|
||||||
hprot, /* protection type parameters of following data */
|
hprot, /* protection type parameters of following data */
|
||||||
0, /* pre-data: nothing for now */
|
0, /* pre-data: nothing for now */
|
||||||
dL4 /* post-data: the stub computed previously */
|
dL4 /* post-data: the stub computed previously */
|
||||||
)) {
|
))) {
|
||||||
|
|
||||||
/* Add this marker to the 'insertanda' list */
|
/* Add this marker to the 'insertanda' list */
|
||||||
if (*jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
if (*jwmarker_num < JPWL_MAX_NO_MARKERS) {
|
||||||
jwmarker[*jwmarker_num].id = J2K_MS_EPB; /* its type */
|
jwmarker[*jwmarker_num].id = J2K_MS_EPB; /* its type */
|
||||||
jwmarker[*jwmarker_num].epbmark = epb_mark; /* the EPB */
|
jwmarker[*jwmarker_num].m.epbmark = epb_mark; /* the EPB */
|
||||||
jwmarker[*jwmarker_num].pos = (int) place_pos; /* after SOT */
|
jwmarker[*jwmarker_num].pos = (int) place_pos; /* after SOT */
|
||||||
jwmarker[*jwmarker_num].dpos = place_pos + 0.0000001 * (double)(*idx); /* not very first! */
|
jwmarker[*jwmarker_num].dpos = place_pos + 0.0000001 * (double)(*idx); /* not very first! */
|
||||||
jwmarker[*jwmarker_num].len = epb_mark->Lepb; /* its length */
|
jwmarker[*jwmarker_num].len = epb_mark->Lepb; /* its length */
|
||||||
|
@ -200,10 +200,10 @@ jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int til
|
||||||
unsigned long int pre_len, unsigned long int post_len) {
|
unsigned long int pre_len, unsigned long int post_len) {
|
||||||
|
|
||||||
jpwl_epb_ms_t *epb = NULL;
|
jpwl_epb_ms_t *epb = NULL;
|
||||||
unsigned short int data_len = 0;
|
/*unsigned short int data_len = 0;*/
|
||||||
unsigned short int L2, L3;
|
unsigned short int L2, L3;
|
||||||
unsigned long int L1, L4;
|
unsigned long int L1, L4;
|
||||||
unsigned char *predata_in = NULL;
|
/*unsigned char *predata_in = NULL;*/
|
||||||
|
|
||||||
bool insideMH = (tileno == -1);
|
bool insideMH = (tileno == -1);
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool ep
|
||||||
jpwl_epc_ms_t *epc = NULL;
|
jpwl_epc_ms_t *epc = NULL;
|
||||||
|
|
||||||
/* Alloc space */
|
/* Alloc space */
|
||||||
if (!(epc = (jpwl_epc_ms_t *) malloc((size_t) 1 * sizeof (jpwl_epc_ms_t)))) {
|
if (!(epc = (jpwl_epc_ms_t *) opj_malloc((size_t) 1 * sizeof (jpwl_epc_ms_t)))) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for EPC MS\n");
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for EPC MS\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
@ -596,6 +596,15 @@ bool jpwl_correct(opj_j2k_t *j2k) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disable correction in case of missing or bad head EPB */
|
||||||
|
/* We can't do better! */
|
||||||
|
/* PATCHED: 2008-01-25 */
|
||||||
|
/* MOVED UP: 2008-02-01 */
|
||||||
|
if (!status) {
|
||||||
|
j2k->cp->correct = false;
|
||||||
|
opj_event_msg(j2k->cinfo, EVT_WARNING, "Couldn't find the MH EPB: disabling JPWL\n");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -790,6 +799,8 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
/* automatic setup */
|
/* automatic setup */
|
||||||
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Auto. setup not yet implemented\n");
|
||||||
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -911,9 +922,9 @@ bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_l
|
||||||
if (((Pepb & 0xF0000000) >> 28) == 0)
|
if (((Pepb & 0xF0000000) >> 28) == 0)
|
||||||
sprintf(str1, "pred"); /* predefined */
|
sprintf(str1, "pred"); /* predefined */
|
||||||
else if (((Pepb & 0xF0000000) >> 28) == 1)
|
else if (((Pepb & 0xF0000000) >> 28) == 1)
|
||||||
sprintf(str1, "crc-%d", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */
|
sprintf(str1, "crc-%lu", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */
|
||||||
else if (((Pepb & 0xF0000000) >> 28) == 2)
|
else if (((Pepb & 0xF0000000) >> 28) == 2)
|
||||||
sprintf(str1, "rs(%d,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */
|
sprintf(str1, "rs(%lu,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */
|
||||||
else if (Pepb == 0xFFFFFFFF)
|
else if (Pepb == 0xFFFFFFFF)
|
||||||
sprintf(str1, "nometh"); /* RS mode */
|
sprintf(str1, "nometh"); /* RS mode */
|
||||||
else
|
else
|
||||||
|
@ -1196,7 +1207,7 @@ jpwl_esd_ms_t *jpwl_esd_create(opj_j2k_t *j2k, int comp, unsigned char addrm, un
|
||||||
jpwl_esd_ms_t *esd = NULL;
|
jpwl_esd_ms_t *esd = NULL;
|
||||||
|
|
||||||
/* Alloc space */
|
/* Alloc space */
|
||||||
if (!(esd = (jpwl_esd_ms_t *) malloc((size_t) 1 * sizeof (jpwl_esd_ms_t)))) {
|
if (!(esd = (jpwl_esd_ms_t *) opj_malloc((size_t) 1 * sizeof (jpwl_esd_ms_t)))) {
|
||||||
opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for ESD MS\n");
|
opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for ESD MS\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
@ -1325,8 +1336,8 @@ bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned long int vv;
|
unsigned long int vv;
|
||||||
unsigned long int addr1, addr2;
|
unsigned long int addr1 = 0L, addr2 = 0L;
|
||||||
double dvalue, Omax2, tmp, TSE, MSE, oldMSE, PSNR, oldPSNR;
|
double dvalue = 0.0, Omax2, tmp, TSE = 0.0, MSE, oldMSE = 0.0, PSNR, oldPSNR = 0.0;
|
||||||
unsigned short int pfpvalue;
|
unsigned short int pfpvalue;
|
||||||
unsigned long int addrmask = 0x00000000;
|
unsigned long int addrmask = 0x00000000;
|
||||||
bool doneMH = false, doneTPH = false;
|
bool doneMH = false, doneTPH = false;
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
* each error counting as two erasures.
|
* each error counting as two erasures.
|
||||||
*/
|
*/
|
||||||
#define MM 8 /* RS code over GF(2**MM) - change to suit */
|
#define MM 8 /* RS code over GF(2**MM) - change to suit */
|
||||||
static int KK;
|
//static int KK;
|
||||||
|
int KK;
|
||||||
|
|
||||||
/* Original code */
|
/* Original code */
|
||||||
/*#define KK 239*/ /* KK = number of information symbols */
|
/*#define KK 239*/ /* KK = number of information symbols */
|
||||||
|
|
Loading…
Reference in New Issue