diff --git a/ChangeLog b/ChangeLog index ed4ec633..cfc8f683 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : added +June 16, 2007 ++ [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry + June 15, 2007 * [FOD] Fixed the generation of index files diff --git a/OPJViewer/OPJViewer.dsp b/OPJViewer/OPJViewer.dsp index c882690d..31f4c1eb 100644 --- a/OPJViewer/OPJViewer.dsp +++ b/OPJViewer/OPJViewer.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "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 "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /FR /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 "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" BSC32=bscmake.exe @@ -67,15 +67,15 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "d:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c # ADD BASE RSC /l 0x410 /d "_DEBUG" -# ADD RSC /l 0x410 /i "d:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG" +# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug" # SUBTRACT LINK32 /pdb:none !ENDIF diff --git a/OPJViewer/OPJViewer.iss b/OPJViewer/OPJViewer.iss index 1467e288..a45bde6f 100644 --- a/OPJViewer/OPJViewer.iss +++ b/OPJViewer/OPJViewer.iss @@ -42,3 +42,7 @@ Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon [Run] Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app} + +[Registry] +Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages: +Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages: diff --git a/OPJViewer/Readme.txt b/OPJViewer/Readme.txt index bc29075e..469ee15b 100644 --- a/OPJViewer/Readme.txt +++ b/OPJViewer/Readme.txt @@ -52,8 +52,7 @@ The porting is possible and under way. 3. General information on the viewer ==================================== -This viewer is conceived to open and display information and image content of J2K, JP2, -and MJ2 files. +This viewer is conceived to open and display information and image content of J2K, JP2, and MJ2 files. The viewer application interface is divided into three main panels: - a browsing pane; - a viewing pane; diff --git a/OPJViewer/buildupdate.bat b/OPJViewer/buildupdate.bat new file mode 100644 index 00000000..6ff0d42a --- /dev/null +++ b/OPJViewer/buildupdate.bat @@ -0,0 +1,15 @@ +::== buildupdate.bat +@echo off +setLocal EnableDelayedExpansion + +for /f "tokens=2,* delims=^(^) " %%a in ('find /v "" ^< .\source\build.h') do ( +rem echo %%a +set /A M = %%a + 1 +echo Build !M! +echo wxT^("!M!"^) > buildtemp283746825t347 +) + +if exist buildtemp283746825t347 move /Y buildtemp283746825t347 .\source\build.h +if exist buildtemp283746825t347 del /F /Q buildtemp283746825t347 + +::== \ No newline at end of file diff --git a/OPJViewer/source/OPJViewer.cpp b/OPJViewer/source/OPJViewer.cpp index 356c28e8..2d1e3ac6 100644 --- a/OPJViewer/source/OPJViewer.cpp +++ b/OPJViewer/source/OPJViewer.cpp @@ -207,8 +207,30 @@ bool OPJViewerApp::OnInit(void) // memory file system wxFileSystem::AddHandler(new wxMemoryFSHandler); +#ifdef OPJ_INICONFIG + //load decoding engine parameters + OPJconfig = new wxConfig(OPJ_APPLICATION, OPJ_APPLICATION_VENDOR); + + OPJconfig->Read(wxT("enabledeco"), &m_enabledeco, (bool) true); + OPJconfig->Read(wxT("enableparse"), &m_enableparse, (bool) true); + OPJconfig->Read(wxT("resizemethod"), &m_resizemethod, (long) 0); + OPJconfig->Read(wxT("reducefactor"), &m_reducefactor, (long) 0); + OPJconfig->Read(wxT("qualitylayers"), &m_qualitylayers, (long) 0); + OPJconfig->Read(wxT("components"), &m_components, (long) 0); + OPJconfig->Read(wxT("framenum"), &m_framenum, (long) 0); +#ifdef USE_JPWL + OPJconfig->Read(wxT("enablejpwl"), &m_enablejpwl, (bool) true); + OPJconfig->Read(wxT("expcomps"), &m_expcomps, (long) JPWL_EXPECTED_COMPONENTS); + OPJconfig->Read(wxT("maxtiles"), &m_maxtiles, (long) JPWL_MAXIMUM_TILES); +#endif // USE_JPWL + + OPJconfig->Write(wxT("teststring"), wxT("This is a test value")); + OPJconfig->Write(wxT("testbool"), (bool) true); + OPJconfig->Write(wxT("testlong"), (long) 245); +#else // set decoding engine parameters m_enabledeco = true; + m_enableparse = true; m_resizemethod = 0; m_reducefactor = 0; m_qualitylayers = 0; @@ -219,6 +241,7 @@ bool OPJViewerApp::OnInit(void) m_expcomps = JPWL_EXPECTED_COMPONENTS; m_maxtiles = JPWL_MAXIMUM_TILES; #endif // USE_JPWL +#endif // OPJ_INICONFIG // Create the main frame window OPJFrame *frame = new OPJFrame(NULL, wxID_ANY, OPJ_APPLICATION_TITLEBAR, @@ -250,6 +273,26 @@ bool OPJViewerApp::OnInit(void) return true; } +int OPJViewerApp::OnExit() +{ +#ifdef OPJ_INICONFIG + OPJconfig->Write(wxT("enabledeco"), m_enabledeco); + OPJconfig->Write(wxT("enableparse"), m_enableparse); + OPJconfig->Write(wxT("resizemethod"), m_resizemethod); + OPJconfig->Write(wxT("reducefactor"), m_reducefactor); + OPJconfig->Write(wxT("qualitylayers"), m_qualitylayers); + OPJconfig->Write(wxT("components"), m_components); + OPJconfig->Write(wxT("framenum"), m_framenum); +#ifdef USE_JPWL + OPJconfig->Write(wxT("enablejpwl"), m_enablejpwl); + OPJconfig->Write(wxT("expcomps"), m_expcomps); + OPJconfig->Write(wxT("maxtiles"), m_maxtiles); +#endif // USE_JPWL +#endif // OPJ_INICONFIG + + return 1; +} + void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser) { wxString s = wxT("Command line parsed successfully:\nInput files: "); @@ -472,7 +515,8 @@ void OPJFrame::OnSetsDeco(wxCommandEvent& event) // load settings wxGetApp().m_enabledeco = dialog.m_enabledecoCheck->GetValue(); - wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection(); + wxGetApp().m_enableparse = dialog.m_enableparseCheck->GetValue(); + wxGetApp().m_resizemethod = dialog.m_resizeBox->GetSelection() - 1; wxGetApp().m_reducefactor = dialog.m_reduceCtrl->GetValue(); wxGetApp().m_qualitylayers = dialog.m_layerCtrl->GetValue(); wxGetApp().m_components = dialog.m_numcompsCtrl->GetValue(); @@ -548,16 +592,23 @@ void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event)) void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe) { wxImage new_image = currframe->m_canvas->m_image100.ConvertToImage(); + + // resizing enabled? + if (wxGetApp().m_resizemethod == -1) { + zooml = 100; + } + if (zooml != 100) new_image.Rescale((int) ((double) zooml * (double) new_image.GetWidth() / 100.0), (int) ((double) zooml * (double) new_image.GetHeight() / 100.0), wxGetApp().m_resizemethod ? wxIMAGE_QUALITY_HIGH : wxIMAGE_QUALITY_NORMAL); - currframe->m_canvas->m_image = wxBitmap(new_image); + currframe->m_canvas->m_image = wxBitmap(new_image); currframe->m_canvas->SetScrollbars(20, 20, (int)(0.5 + (double) new_image.GetWidth() / 20.0), (int)(0.5 + (double) new_image.GetHeight() / 20.0) ); + currframe->m_canvas->Refresh(); // update zoom @@ -1125,32 +1176,39 @@ void OPJParseThread::LoadFile(wxFileName fname) // open the file wxFile m_file(fname.GetFullPath().c_str(), wxFile::read); - // what is the extension? - if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) { + // parsing enabled? + if (wxGetApp().m_enableparse) { - // parse the file - ParseJ2KFile(&m_file, 0, m_file.Length(), rootid); + // what is the extension? + if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) { - } else if ((fname.GetExt() == wxT("jp2")) || (fname.GetExt() == wxT("mj2"))) { + // parse the file + ParseJ2KFile(&m_file, 0, m_file.Length(), rootid); - // parse the file - if (this->m_parentid) { - //WriteText(wxT("Only a subsection of jp2")); - OPJMarkerData *data = (OPJMarkerData *) m_tree->GetItemData(rootid); - ParseJ2KFile(&m_file, data->m_start, data->m_length, rootid); - m_tree->Expand(rootid); + } else if ((fname.GetExt() == wxT("jp2")) || (fname.GetExt() == wxT("mj2"))) { - } else - // as usual - ParseJP2File(&m_file, 0, m_file.Length(), rootid); + // parse the file + if (this->m_parentid) { + //WriteText(wxT("Only a subsection of jp2")); + OPJMarkerData *data = (OPJMarkerData *) m_tree->GetItemData(rootid); + ParseJ2KFile(&m_file, data->m_start, data->m_length, rootid); + m_tree->Expand(rootid); - } else { + } else { + // as usual + ParseJP2File(&m_file, 0, m_file.Length(), rootid); + } - // unknown extension - WriteText(wxT("Unknown file format!")); + } else { + + // unknown extension + WriteText(wxT("Unknown file format!")); + + } } + // this is the root node if (this->m_parentid) m_tree->SetItemText(rootid, wxT("Codestream")); @@ -2131,8 +2189,14 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent) 0, wxGROW | wxALL, 5); m_enabledecoCheck->SetValue(wxGetApp().m_enabledeco); + // add parsing enabling check box + subtopSizer->Add( + m_enableparseCheck = new wxCheckBox(panel, OPJDECO_ENABLEPARSE, wxT("Enable parsing"), wxDefaultPosition, wxDefaultSize), + 0, wxGROW | wxALL, 5); + m_enableparseCheck->SetValue(wxGetApp().m_enableparse); + // resize settings, column - wxString choices[] = {wxT("Low quality"), wxT("High quality")}; + wxString choices[] = {wxT("Don't resize"), wxT("Low quality"), wxT("High quality")}; m_resizeBox = new wxRadioBox(panel, OPJDECO_RESMETHOD, wxT("Resize method"), wxDefaultPosition, wxDefaultSize, @@ -2140,7 +2204,7 @@ wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent) choices, 1, wxRA_SPECIFY_ROWS); - m_resizeBox->SetSelection(wxGetApp().m_resizemethod); + m_resizeBox->SetSelection(wxGetApp().m_resizemethod + 1); subtopSizer->Add(m_resizeBox, 0, wxGROW | wxALL, 5); diff --git a/OPJViewer/source/OPJViewer.h b/OPJViewer/source/OPJViewer.h index 7757ec73..c69c55db 100644 --- a/OPJViewer/source/OPJViewer.h +++ b/OPJViewer/source/OPJViewer.h @@ -128,6 +128,7 @@ typedef unsigned long long int8byte; #define OPJ_APPLICATION_VERSION wxT("0.3 alpha") #define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION #define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa") +#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG") #ifdef __WXMSW__ #define OPJ_APPLICATION_PLATFORM wxT("Windows") @@ -158,6 +159,7 @@ class OPJViewerApp: public wxApp // other methods bool OnInit(void); + int OnExit(void); void SetShowImages(bool show) { m_showImages = show; } bool ShowImages() const { return m_showImages; } void ShowCmdLine(const wxCmdLineParser& parser); @@ -183,13 +185,16 @@ class OPJViewerApp: public wxApp int m_resizemethod; // decoding engine parameters - bool m_enabledeco; + bool m_enabledeco, m_enableparse; int m_reducefactor, m_qualitylayers, m_components, m_framenum; #ifdef USE_JPWL bool m_enablejpwl; int m_expcomps, m_maxtiles; #endif // USE_JPWL + // application configuration + wxConfig *OPJconfig; + // private methods and variables private: bool m_showImages, m_showButtons; @@ -619,7 +624,7 @@ public: ~OPJDecoderDialog(); wxBookCtrlBase* m_settingsNotebook; - wxCheckBox *m_enabledecoCheck; + wxCheckBox *m_enabledecoCheck, *m_enableparseCheck; wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl; wxRadioBox* m_resizeBox; @@ -644,6 +649,7 @@ protected: OPJDECO_QUALITYLAYERS, OPJDECO_NUMCOMPS, OPJDECO_ENABLEDECO, + OPJDECO_ENABLEPARSE, OPJDECO_ENABLEJPWL, OPJDECO_EXPCOMPS, OPJDECO_MAXTILES, diff --git a/OPJViewer/source/about_htm.h b/OPJViewer/source/about_htm.h index c0c0c280..d37db13f 100644 --- a/OPJViewer/source/about_htm.h +++ b/OPJViewer/source/about_htm.h @@ -1,29 +1,31 @@ wxString htmlaboutpage = wxT( "" "" -"" +"
" "" "" "" "" -"" -"" +"" +"" "" "" "" "" "" -"" +"" "" "" "
" -"

" +"

" "
" -"" -OPJ_APPLICATION " " OPJ_APPLICATION_VERSION +"" +OPJ_APPLICATION " " OPJ_APPLICATION_VERSION "
" -"A JPEG 2000 image viewer
" -"" OPJ_APPLICATION_PLATFORM " version" +"A JPEG 2000 image viewer
" +"" OPJ_APPLICATION_PLATFORM " version" "
" "
OpenJPEG
" "The OpenJPEG library is an open-source JPEG 2000 codec written in C language. " "In addition to the basic codec, various other features are under development.
" -"* Build: " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "
" -) +"* Build: ") +#include "build.h" +wxT("
") +wxT("* " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "
") #ifdef USE_JPWL wxT("- Compiled with JPWL support
") #endif // USE_JPWL @@ -33,7 +35,7 @@ wxT("- Compiled with JPSEC support") wxT("
" diff --git a/OPJViewer/source/build.h b/OPJViewer/source/build.h new file mode 100644 index 00000000..d944e636 --- /dev/null +++ b/OPJViewer/source/build.h @@ -0,0 +1 @@ +wxT("20") diff --git a/OPJViewer/source/imagjpeg2000.cpp b/OPJViewer/source/imagjpeg2000.cpp index 967bbad3..78734b17 100644 --- a/OPJViewer/source/imagjpeg2000.cpp +++ b/OPJViewer/source/imagjpeg2000.cpp @@ -183,4 +183,4 @@ } -} \ No newline at end of file +} diff --git a/OPJViewer/source/imagmj2.cpp b/OPJViewer/source/imagmj2.cpp index e0fa2d4e..1cd7244f 100644 --- a/OPJViewer/source/imagmj2.cpp +++ b/OPJViewer/source/imagmj2.cpp @@ -130,10 +130,18 @@ void mj2_info_callback(const char *msg, void *client_data) { /* From little endian to big endian, 2 and 4 bytes */ #define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8) #define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24) + +#ifdef __WXGTK__ +#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \ + ((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \ + ((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \ + ((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56) +#else #define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \ ((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \ ((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \ ((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56) +#endif /* From codestream to int values */ #define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \ diff --git a/OPJViewer/source/wxjp2parser.cpp b/OPJViewer/source/wxjp2parser.cpp index 4832870f..afacd394 100644 --- a/OPJViewer/source/wxjp2parser.cpp +++ b/OPJViewer/source/wxjp2parser.cpp @@ -303,10 +303,18 @@ struct boxdef j22box[] = /* From little endian to big endian, 2 and 4 bytes */ #define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8) #define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24) -#define BYTE_SWAP8(X) (((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \ + +#ifdef __WXGTK__ +#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \ + ((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \ + ((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \ + ((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56) +#else +#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \ ((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \ ((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \ - ((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)) + ((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56) +#endif /* From codestream to int values */ #define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \