Improved success for the linux build; OPJViewer shows all the COM contents
This commit is contained in:
parent
9e114bcaa4
commit
123a680669
|
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
|||
! : changed
|
||||
+ : added
|
||||
|
||||
October 23, 2007
|
||||
* [GB] Improved success for the linux build; OPJViewer shows all the COM contents
|
||||
|
||||
October 18, 2007
|
||||
* [FOD] Changed the ROI parameter in the image_to_j2k codec to make it correspond to the documentation (i.e. -ROI c=0,U=25)
|
||||
* [FOD] Patch from Callum Lewick. Memset patch.
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
|
||||
|
||||
# General configuration variables:
|
||||
CC = $(shell wx-config-2.8 --cxx)
|
||||
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
|
||||
|
||||
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||
|
||||
all: opjviewer lib
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
lib:
|
||||
cd ../jpwl; make
|
||||
|
||||
opjviewer: $(OPJV_SRCS) lib
|
||||
$(CC) $(CFLAGS) -I .. $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f OPJViewer *.o *.a
|
||||
cd ../libopenjpeg; rm -f *.o
|
||||
|
||||
|
||||
|
||||
|
||||
#.cpp.o :
|
||||
# $(CXX) -g -c `wx-config-2.8 --cxxflags` -I ../.. -D wxUSE_LIBOPENJPEG -D wxHACK_BOOLEAN -o $@ $<
|
||||
|
||||
#all: $(PROGRAM)
|
||||
|
||||
#$(PROGRAM): $(OBJECTS)
|
||||
# $(CXX) -o $(PROGRAM) $(OBJECTS) -lopenjpeg -L ../.. `wx-config-2.8 --libs`
|
||||
|
||||
#clean:
|
||||
# rm -f *.o $(PROGRAM)
|
||||
# Makefile for OPJViewer
|
||||
|
||||
# General configuration variables:
|
||||
CC = $(shell wx-config-2.8 --cxx)
|
||||
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
|
||||
|
||||
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||
|
||||
all: opjviewer lib
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
lib:
|
||||
cd ../jpwl; make
|
||||
|
||||
opjviewer: $(OPJV_SRCS) lib
|
||||
$(CC) $(CFLAGS) -I .. $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f OPJViewer *.o *.a
|
||||
cd ../libopenjpeg; rm -f *.o
|
||||
|
||||
|
||||
|
||||
|
||||
#.cpp.o :
|
||||
# $(CXX) -g -c `wx-config-2.8 --cxxflags` -I ../.. -D wxUSE_LIBOPENJPEG -D wxHACK_BOOLEAN -o $@ $<
|
||||
|
||||
#all: $(PROGRAM)
|
||||
|
||||
#$(PROGRAM): $(OBJECTS)
|
||||
# $(CXX) -o $(PROGRAM) $(OBJECTS) -lopenjpeg -L ../.. `wx-config-2.8 --libs`
|
||||
|
||||
#clean:
|
||||
# rm -f *.o $(PROGRAM)
|
||||
|
|
|
@ -42,15 +42,15 @@ 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 "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "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 ".." /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 BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
|
||||
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 /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
|
|
|
@ -306,9 +306,9 @@ bool OPJViewerApp::OnInit(void)
|
|||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format("%s with JPWL", opj_version());
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format("%s", opj_version());
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1245,7 +1245,11 @@ void OPJCanvas::OnDraw(wxDC& dc)
|
|||
} else {
|
||||
dc.SetFont(*wxSWISS_FONT);
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
#ifdef __WXGTK__
|
||||
dc.DrawText(_T("Decoding image, please wait... (press \"Zoom to Fit\" to show the image)"), 40, 50);
|
||||
#else
|
||||
dc.DrawText(_T("Decoding image, please wait..."), 40, 50);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1793,14 +1797,13 @@ void OPJMarkerTree::OnItemExpanding(wxTreeEvent& event)
|
|||
|
||||
void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
||||
{
|
||||
#define BUNCH_LINESIZE 16
|
||||
#define BUNCH_NUMLINES 7
|
||||
int bunch_linesize = 16;
|
||||
int bunch_numlines = 7;
|
||||
|
||||
wxTreeItemId item = event.GetItem();
|
||||
OPJMarkerData* data = (OPJMarkerData *) GetItemData(item);
|
||||
wxString text;
|
||||
int l, c, pos = 0, pre_pos;
|
||||
unsigned char buffer[BUNCH_LINESIZE * BUNCH_NUMLINES];
|
||||
|
||||
m_peektextCtrl->Clear();
|
||||
|
||||
|
@ -1815,19 +1818,25 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
|||
fp->Seek(data->m_start, wxFromStart);
|
||||
|
||||
// read a bunch
|
||||
int max_read = wxMin(wxFileOffset(WXSIZEOF(buffer)), data->m_length - data->m_start + 1);
|
||||
int max_read = wxMin(wxFileOffset(bunch_linesize * bunch_numlines), data->m_length - data->m_start + 1);
|
||||
if (data->m_desc == wxT("MARK (65380)")) {
|
||||
/*wxLogMessage(data->m_desc);*/
|
||||
max_read = data->m_length - data->m_start + 1;
|
||||
bunch_numlines = (int) ceil((float) max_read / (float) bunch_linesize);
|
||||
}
|
||||
unsigned char *buffer = new unsigned char[bunch_linesize * bunch_numlines];
|
||||
fp->Read(buffer, max_read);
|
||||
|
||||
// write the file data between start and stop
|
||||
pos = 0;
|
||||
for (l = 0; l < BUNCH_NUMLINES; l++) {
|
||||
for (l = 0; l < bunch_numlines; l++) {
|
||||
|
||||
text << wxString::Format(wxT("%010d:"), data->m_start + pos);
|
||||
|
||||
pre_pos = pos;
|
||||
|
||||
// add hex browsing text
|
||||
for (c = 0; c < BUNCH_LINESIZE; c++) {
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
|
||||
if (!(c % 8))
|
||||
text << wxT(" ");
|
||||
|
@ -1842,7 +1851,7 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
|||
text << wxT(" ");
|
||||
|
||||
// add char browsing text
|
||||
for (c = 0; c < BUNCH_LINESIZE; c++) {
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
|
||||
if (pre_pos < max_read) {
|
||||
if ((buffer[pre_pos] == '\n') ||
|
||||
|
@ -1865,6 +1874,8 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
|||
fp->Close();
|
||||
|
||||
m_peektextCtrl->WriteText(text);
|
||||
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
|
@ -2324,7 +2335,7 @@ void *OPJEncoThread::Entry()
|
|||
j2kkkhandler->m_comment = wxGetApp().m_comment;
|
||||
|
||||
// save the file
|
||||
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), wxBITMAP_TYPE_J2K)) {
|
||||
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), (wxBitmapType) wxBITMAP_TYPE_J2K)) {
|
||||
WriteText(wxT("Can't save image"));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3185,7 +3196,7 @@ wxPanel* OPJEncoderDialog::CreatePart1_1SettingsPage(wxWindow* parent)
|
|||
// add the value control
|
||||
resnumSizer->Add(
|
||||
m_resolutionsCtrl = new wxSpinCtrl(panel, OPJENCO_RESNUMBER,
|
||||
wxString::Format("%d", wxGetApp().m_resolutions),
|
||||
wxString::Format(wxT("%d"), wxGetApp().m_resolutions),
|
||||
wxDefaultPosition, wxSize(80, wxDefaultCoord),
|
||||
wxSP_ARROW_KEYS,
|
||||
0, 256, 6),
|
||||
|
|
|
@ -272,10 +272,10 @@ class OPJMarkerData : public wxTreeItemData
|
|||
const wxChar *GetDesc1() const { return m_desc.c_str(); }
|
||||
const wxChar *GetDesc2() const { return m_filestring.c_str(); }
|
||||
wxFileOffset m_start, m_length;
|
||||
wxString m_desc;
|
||||
|
||||
// private methods and variables
|
||||
private:
|
||||
wxString m_desc;
|
||||
wxString m_filestring;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
|||
"In addition to the basic codec, various other features are under development.</font><br>"
|
||||
"<font size=-2 color=red>* Build: ")
|
||||
#include "build.h"
|
||||
wxT("</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
||||
#ifdef USE_JPWL
|
||||
wxT("<font size=-2 color=green>- Compiled with JPWL support</font><br>")
|
||||
#endif // USE_JPWL
|
||||
|
|
|
@ -1 +1 @@
|
|||
wxT("219")
|
||||
wxT("242")
|
||||
|
|
|
@ -189,7 +189,7 @@ bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
|
|||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode(dinfo, cio, &cstr_info);
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
|
@ -261,15 +261,15 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
parameters.cp_cinema = OFF;
|
||||
|
||||
/* subsampling */
|
||||
if (sscanf(m_subsampling.c_str(), wxT("%d,%d"), &(parameters.subsampling_dx), &(parameters.subsampling_dy)) != 2) {
|
||||
if (sscanf(m_subsampling.ToAscii(), "%d,%d", &(parameters.subsampling_dx), &(parameters.subsampling_dy)) != 2) {
|
||||
wxLogError(wxT("Wrong sub-sampling encoder setting: dx,dy"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* compression rates */
|
||||
if (m_rates != wxT("")) {
|
||||
char *s1 = (char *) m_rates.c_str();
|
||||
wxLogMessage("rates %s", s1);
|
||||
const char *s1 = m_rates.ToAscii();
|
||||
wxLogMessage(wxT("rates %s"), s1);
|
||||
while (sscanf(s1, "%f", &(parameters.tcp_rates[parameters.tcp_numlayers])) == 1) {
|
||||
parameters.tcp_numlayers++;
|
||||
while (*s1 && *s1 != ',') {
|
||||
|
@ -279,14 +279,14 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
break;
|
||||
s1++;
|
||||
}
|
||||
wxLogMessage("%d layers", parameters.tcp_numlayers);
|
||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
||||
parameters.cp_disto_alloc = 1;
|
||||
}
|
||||
|
||||
/* image quality, dB */
|
||||
if (m_rates == wxT("")) {
|
||||
char *s2 = (char *) m_quality.c_str();
|
||||
wxLogMessage("qualities %s", s2);
|
||||
const char *s2 = m_quality.ToAscii();
|
||||
wxLogMessage(wxT("qualities %s"), s2);
|
||||
while (sscanf(s2, "%f", ¶meters.tcp_distoratio[parameters.tcp_numlayers]) == 1) {
|
||||
parameters.tcp_numlayers++;
|
||||
while (*s2 && *s2 != ',') {
|
||||
|
@ -296,21 +296,21 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
break;
|
||||
s2++;
|
||||
}
|
||||
wxLogMessage("%d layers", parameters.tcp_numlayers);
|
||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
||||
parameters.cp_fixed_quality = 1;
|
||||
}
|
||||
|
||||
/* image origin */
|
||||
if (sscanf(m_origin.c_str(), "%d,%d", ¶meters.image_offset_x0, ¶meters.image_offset_y0) != 2) {
|
||||
if (sscanf(m_origin.ToAscii(), "%d,%d", ¶meters.image_offset_x0, ¶meters.image_offset_y0) != 2) {
|
||||
wxLogError(wxT("bad coordinate of the image origin: x0,y0"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Create comment for codestream */
|
||||
if(m_enablecomm) {
|
||||
parameters.cp_comment = (char *) malloc(strlen(m_comment.c_str()) + 1);
|
||||
parameters.cp_comment = (char *) malloc(strlen(m_comment.ToAscii()) + 1);
|
||||
if(parameters.cp_comment) {
|
||||
strcpy(parameters.cp_comment, m_comment.c_str());
|
||||
strcpy(parameters.cp_comment, m_comment.ToAscii());
|
||||
}
|
||||
} else {
|
||||
parameters.cp_comment = NULL;
|
||||
|
@ -318,8 +318,8 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
|
||||
/* indexing file */
|
||||
if (m_enableidx) {
|
||||
strncpy(indexfilename, m_index.c_str(), OPJ_PATH_LEN);
|
||||
wxLogMessage("index file is %s", indexfilename);
|
||||
strncpy(indexfilename, m_index.ToAscii(), OPJ_PATH_LEN);
|
||||
wxLogMessage(wxT("index file is %s"), indexfilename);
|
||||
}
|
||||
|
||||
/* if no rate entered, lossless by default */
|
||||
|
@ -338,9 +338,9 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
/* codeblocks size */
|
||||
if (m_cbsize != wxT("")) {
|
||||
int cblockw_init = 0, cblockh_init = 0;
|
||||
sscanf(m_cbsize.c_str(), "%d,%d", &cblockw_init, &cblockh_init);
|
||||
sscanf(m_cbsize.ToAscii(), "%d,%d", &cblockw_init, &cblockh_init);
|
||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||
wxLogError("!! Size of code_block error !! Restrictions:\n width*height<=4096\n 4<=width,height<= 1024");
|
||||
wxLogError(wxT("!! Size of code_block error !! Restrictions:\n width*height<=4096\n 4<=width,height<= 1024"));
|
||||
return false;
|
||||
}
|
||||
parameters.cblockw_init = cblockw_init;
|
||||
|
@ -364,13 +364,13 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
|
||||
/* tiles */
|
||||
if (m_tsize != wxT("")) {
|
||||
sscanf(m_tsize.c_str(), "%d,%d", ¶meters.cp_tdx, ¶meters.cp_tdy);
|
||||
sscanf(m_tsize.ToAscii(), "%d,%d", ¶meters.cp_tdx, ¶meters.cp_tdy);
|
||||
parameters.tile_size_on = true;
|
||||
}
|
||||
|
||||
/* tile origin */
|
||||
if (sscanf(m_torigin.c_str(), "%d,%d", ¶meters.cp_tx0, ¶meters.cp_ty0) != 2) {
|
||||
wxLogError("tile offset setting error: X0,Y0");
|
||||
if (sscanf(m_torigin.ToAscii(), "%d,%d", ¶meters.cp_tx0, ¶meters.cp_ty0) != 2) {
|
||||
wxLogError(wxT("tile offset setting error: X0,Y0"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbo
|
|||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||
|
||||
/* encode the image */
|
||||
bSuccess = opj_encode(cinfo, cio, oimage, &cstr_info);
|
||||
bSuccess = opj_encode_with_info(cinfo, cio, oimage, &cstr_info);
|
||||
if (!bSuccess) {
|
||||
|
||||
opj_cio_close(cio);
|
||||
|
@ -526,24 +526,25 @@ bool wxJ2KHandler::DoCanRead( wxInputStream& stream )
|
|||
return hdr[0] == 0xFF && hdr[1] == 0x4F;
|
||||
}
|
||||
|
||||
/**
|
||||
Create an index and write it to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
// 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 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||
|
@ -553,54 +554,70 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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; resno >= 0; resno--) {
|
||||
|
||||
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 */
|
||||
(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\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\n",
|
||||
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].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 num_packs start_pos end_tph_pos end_pos\n");
|
||||
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 %11d %9d\n",
|
||||
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\n");
|
||||
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 < cstr_info->numdecompos + 1; resno++) {
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
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;
|
||||
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6d %6d %7d\n",
|
||||
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, 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++;
|
||||
}
|
||||
}
|
||||
|
@ -609,18 +626,23 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
} /* 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\n");
|
||||
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos disto\n");
|
||||
|
||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
||||
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 = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
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;
|
||||
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %7d\n",
|
||||
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, 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++;
|
||||
}
|
||||
}
|
||||
|
@ -629,9 +651,9 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
} /* 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\n");
|
||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos disto\n");
|
||||
|
||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
||||
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;
|
||||
|
@ -639,10 +661,12 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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 - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - 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++) {
|
||||
|
@ -653,8 +677,10 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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;
|
||||
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %7d\n",
|
||||
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, 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++;
|
||||
}
|
||||
}
|
||||
|
@ -672,15 +698,15 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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\n");
|
||||
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 + 1; resno++) {
|
||||
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 - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - 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++) {
|
||||
|
@ -691,8 +717,10 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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;
|
||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d\n",
|
||||
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, 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++;
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +733,7 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
} /* PCRL */
|
||||
else { /* CPRL */
|
||||
|
||||
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos\n");
|
||||
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 */
|
||||
|
@ -714,12 +742,12 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
int x1 = x0 + cstr_info->tile_x;
|
||||
int y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
for (resno = 0; resno < cstr_info->numdecompos + 1; resno++) {
|
||||
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 - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos - 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++) {
|
||||
|
@ -730,8 +758,10 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
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;
|
||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d\n",
|
||||
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, 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++;
|
||||
}
|
||||
}
|
||||
|
@ -744,6 +774,13 @@ bool wxJ2KHandler::write_index_file(opj_codestream_info_t *cstr_info, char *inde
|
|||
} /* 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);
|
||||
|
|
|
@ -108,9 +108,9 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format("%s with JPWL", opj_version());
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format("%s", opj_version());
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
|
|||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode(dinfo, cio, &cstr_info);
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
|
|
|
@ -700,7 +700,7 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
|
|||
cio = opj_cio_open((opj_common_ptr)dinfo, src, my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode(dinfo, cio, &cstr_info);
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
wxMutexGuiEnter();
|
||||
wxLogError(wxT("MJ2: failed to decode image!"));
|
||||
|
|
|
@ -255,7 +255,8 @@ void OPJParseThread::ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOff
|
|||
wxString::FromAscii(marker_name[m]) +
|
||||
wxString::Format(wxT(" (0x%04X)"), marker_val[m]),
|
||||
image, imageSel,
|
||||
new OPJMarkerData(wxT("MARK"), m_tree->m_fname.GetFullPath(), offset, offset + currlen + 1)
|
||||
new OPJMarkerData(wxT("MARK") + wxString::Format(wxT(" (%d)"), marker_val[m]),
|
||||
m_tree->m_fname.GetFullPath(), offset, offset + currlen + 1)
|
||||
);
|
||||
|
||||
// append some info
|
||||
|
|
125
jpwl/Makefile
125
jpwl/Makefile
|
@ -1,33 +1,92 @@
|
|||
# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
|
||||
|
||||
# General configuration variables:
|
||||
CC = gcc
|
||||
AR = ar
|
||||
|
||||
CFLAGS = -O3 -DUSE_JPWL # -g -p -pg -DUSE_JPWL
|
||||
|
||||
OPJ_SRCS = ../libopenjpeg/bio.c ../libopenjpeg/cio.c ../libopenjpeg/dwt.c ../libopenjpeg/event.c ../libopenjpeg/image.c ../libopenjpeg/j2k.c ../libopenjpeg/j2k_lib.c ../libopenjpeg/jp2.c ../libopenjpeg/jpt.c ../libopenjpeg/mct.c ../libopenjpeg/mqc.c ../libopenjpeg/openjpeg.c ../libopenjpeg/pi.c ../libopenjpeg/raw.c ../libopenjpeg/t1.c ../libopenjpeg/t2.c ../libopenjpeg/tcd.c ../libopenjpeg/tgt.c
|
||||
JPWL_SRCS = crc.c jpwl.c jpwl_lib.c rs.c
|
||||
|
||||
TARGET = openjpeg_JPWL
|
||||
STATICLIB = lib$(TARGET).a
|
||||
|
||||
MODULES = $(OPJ_SRCS:.c=.o) $(JPWL_SRCS:.c=.o)
|
||||
|
||||
all: JPWL_image_to_j2k JPWL_j2k_to_image
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(STATICLIB): $(MODULES)
|
||||
$(AR) r $@ $(MODULES)
|
||||
|
||||
JPWL_j2k_to_image: ../codec/j2k_to_image.c $(STATICLIB)
|
||||
gcc $(CFLAGS) ../codec/convert.c ../codec/j2k_to_image.c -o JPWL_j2k_to_image -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -lstdc++
|
||||
|
||||
JPWL_image_to_j2k: ../codec/image_to_j2k.c $(STATICLIB)
|
||||
gcc $(CFLAGS) ../codec/convert.c ../codec/image_to_j2k.c -o JPWL_image_to_j2k -I ../libopenjpeg/ -L . -lopenjpeg_JPWL -lm -lstdc++
|
||||
|
||||
clean:
|
||||
rm -f JPWL_j2k_to_image JPWL_image_to_j2k *.o *.a
|
||||
cd ../libopenjpeg; rm -f *.o
|
||||
# Linux makefile for OpenJPEG + JPWL
|
||||
|
||||
VER_MAJOR = 2
|
||||
VER_MINOR = 1.2.0
|
||||
|
||||
JPWL_SRCS = ./crc.c ./jpwl.c ./jpwl_lib.c ./rs.c
|
||||
SRCS = ../libopenjpeg/bio.c ../libopenjpeg/cio.c ../libopenjpeg/dwt.c ../libopenjpeg/event.c ../libopenjpeg/image.c ../libopenjpeg/j2k.c ../libopenjpeg/j2k_lib.c ../libopenjpeg/jp2.c ../libopenjpeg/jpt.c ../libopenjpeg/mct.c ../libopenjpeg/mqc.c ../libopenjpeg/openjpeg.c ../libopenjpeg/pi.c ../libopenjpeg/raw.c ../libopenjpeg/t1.c ../libopenjpeg/t2.c ../libopenjpeg/tcd.c ../libopenjpeg/tgt.c $(JPWL_SRCS)
|
||||
INCLS = ../libopenjpeg/bio.h ../libopenjpeg/cio.h ../libopenjpeg/dwt.h ../libopenjpeg/event.h ../libopenjpeg/fix.h ../libopenjpeg/image.h ../libopenjpeg/int.h ../libopenjpeg/j2k.h ../libopenjpeg/j2k_lib.h ../libopenjpeg/jp2.h ../libopenjpeg/jpt.h ../libopenjpeg/mct.h ../libopenjpeg/mqc.h ../libopenjpeg/openjpeg.h ../libopenjpeg/pi.h ../libopenjpeg/raw.h ../libopenjpeg/t1.h ../libopenjpeg/t2.h ../libopenjpeg/tcd.h ../libopenjpeg/tgt.h ../libopenjpeg/opj_malloc.h ../libopenjpeg/opj_includes.h
|
||||
INCLUDE = -Ilibopenjpeg_JPWL
|
||||
|
||||
# General configuration variables:
|
||||
CC = gcc
|
||||
AR = ar
|
||||
|
||||
PREFIX = /usr
|
||||
INSTALL_LIBDIR = $(PREFIX)/lib
|
||||
INSTALL_INCLUDE = $(PREFIX)/include
|
||||
|
||||
# Converts cr/lf to just lf
|
||||
DOS2UNIX = dos2unix
|
||||
|
||||
COMPILERFLAGS = -O3 -fPIC
|
||||
LIBRARIES = -lstdc++
|
||||
|
||||
MODULES = $(SRCS:.c=.o)
|
||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE) -DUSE_JPWL
|
||||
|
||||
TARGET = openjpeg_JPWL
|
||||
STATICLIB = lib$(TARGET).a
|
||||
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
|
||||
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
|
||||
|
||||
|
||||
|
||||
default: all
|
||||
|
||||
all: OpenJPEG_JPWL JPWL_image_to_j2k JPWL_j2k_to_image
|
||||
|
||||
dist: OpenJPEG_JPWL
|
||||
install -d dist
|
||||
install -m 644 $(STATICLIB) dist
|
||||
install -m 755 $(SHAREDLIB) dist
|
||||
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
||||
install libopenjpeg/openjpeg.h dist
|
||||
|
||||
dos2unix:
|
||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||
|
||||
OpenJPEG_JPWL: $(STATICLIB) $(SHAREDLIB)
|
||||
|
||||
JPWL_codec: JPWL_j2k_to_image JPWL_image_to_j2k $(STATICLIB)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(STATICLIB): $(MODULES)
|
||||
$(AR) r $@ $(MODULES)
|
||||
|
||||
$(SHAREDLIB): $(MODULES)
|
||||
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
install: OpenJPEG
|
||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
||||
install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
||||
install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
-ldconfig
|
||||
|
||||
cleanlib:
|
||||
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
||||
|
||||
cleancodec:
|
||||
rm -f JPWL_j2k_to_image JPWL_image_to_j2k JPWL_j2k_to_image.o JPWL_image_to_j2k.o
|
||||
|
||||
clean: cleanlib cleancodec
|
||||
|
||||
osx:
|
||||
make -f Makefile.osx
|
||||
|
||||
osxinstall:
|
||||
make -f Makefile.osx install
|
||||
|
||||
osxclean:
|
||||
make -f Makefile.osx clean
|
||||
|
|
Loading…
Reference in New Issue