From 9fba123a7ac6183fb4d4f6b9ba36189d99f67942 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Tue, 12 Apr 2011 23:36:01 +0000 Subject: [PATCH] Removed folders mj2, JavaOpenJpeg, jpwl, OPJViewer (not compliant with v2). Removed obsolete windows project files. Removed obsolete Makefiles (only build method currently supported with v2 branch: cmake). Renamed ChangeLog to CHANGES. Renamed License.txt to LICENSE. Removed obsolete README files. --- ChangeLog => CHANGES | 1 + DllOpenJPEG.dsp | 273 -- DllOpenJPEG.sln | 20 - DllOpenJPEG.vcproj | 694 ---- JavaOpenJPEG/CMakeLists.txt | 53 - JavaOpenJPEG/JavaOpenJPEG.c | 1989 ----------- JavaOpenJPEG/JavaOpenJPEG.dsp | 110 - JavaOpenJPEG/JavaOpenJPEG.dsw | 44 - JavaOpenJPEG/JavaOpenJPEG.vcproj | 276 -- JavaOpenJPEG/JavaOpenJPEGDecoder.c | 897 ----- JavaOpenJPEG/Makefile | 14 - .../org/openJpeg/OpenJPEGJavaDecoder.java | 250 -- .../org/openJpeg/OpenJPEGJavaEncoder.java | 338 -- JavaOpenJPEG/java-jni/include/jawt.h | 278 -- JavaOpenJPEG/java-jni/include/jdwpTransport.h | 237 -- JavaOpenJPEG/java-jni/include/jni.h | 1951 ----------- JavaOpenJPEG/java-jni/include/jvmdi.h | 1012 ------ JavaOpenJPEG/java-jni/include/jvmpi.h | 642 ---- JavaOpenJPEG/java-jni/include/jvmti.h | 2181 ------------- JavaOpenJPEG/java-jni/include/win32/jawt_md.h | 41 - JavaOpenJPEG/java-jni/include/win32/jni_md.h | 19 - JavaOpenJPEG/java-jni/lib/jvm.lib | Bin 273276 -> 0 bytes .../org_openJpeg_OpenJPEGJavaDecoder.h | 21 - .../org_openJpeg_OpenJPEGJavaEncoder.h | 21 - license.txt => LICENSE | 0 LibOpenJPEG.dsp | 262 -- LibOpenJPEG.dsw | 41 - LibOpenJPEG.sln | 20 - LibOpenJPEG.vcproj | 642 ---- Makefile | 78 - Makefile.osx | 66 - OPJViewer/Makefile | 41 - OPJViewer/OPJViewer.dsp | 290 -- OPJViewer/OPJViewer.dsw | 56 - OPJViewer/OPJViewer.iss | 48 - OPJViewer/Readme.txt | 100 - OPJViewer/about/about.htm | 36 - OPJViewer/about/opj_logo.png | Bin 6500 -> 0 bytes OPJViewer/buildupdate.bat | 15 - OPJViewer/source/OPJAbout.cpp | 87 - OPJViewer/source/OPJChild.ico | Bin 1078 -> 0 bytes OPJViewer/source/OPJChild16.xpm | 28 - OPJViewer/source/OPJDialogs.cpp | 1373 -------- OPJViewer/source/OPJThreads.cpp | 1268 ------- OPJViewer/source/OPJViewer.cpp | 1664 ---------- OPJViewer/source/OPJViewer.h | 811 ----- OPJViewer/source/OPJViewer.ico | Bin 1078 -> 0 bytes OPJViewer/source/OPJViewer.rc | 3 - OPJViewer/source/OPJViewer16.xpm | 26 - OPJViewer/source/about_htm.h | 54 - OPJViewer/source/build.h | 1 - OPJViewer/source/icon1.xpm | 79 - OPJViewer/source/icon2.xpm | 53 - OPJViewer/source/icon3.xpm | 79 - OPJViewer/source/icon4.xpm | 43 - OPJViewer/source/icon5.xpm | 79 - OPJViewer/source/imagjpeg2000.cpp | 1464 --------- OPJViewer/source/imagjpeg2000.h | 177 - OPJViewer/source/imagmxf.cpp | 502 --- OPJViewer/source/imagmxf.h | 99 - OPJViewer/source/license.txt | 14 - OPJViewer/source/opj_logo.xpm | 285 -- OPJViewer/source/readmeafter.txt | 34 - OPJViewer/source/readmebefore.txt | 11 - OPJViewer/source/wxj2kparser.cpp | 1465 --------- OPJViewer/source/wxjp2parser.cpp | 1116 ------- README.linux | 33 - README.msvc | 40 - README.osx | 26 - clean.bat | 25 - codec/Makefile | 14 - codec/image_to_j2k.dsp | 118 - codec/image_to_j2k.dsw | 44 - codec/image_to_j2k.sln | Bin 1506 -> 0 bytes codec/image_to_j2k.vcproj | 292 -- codec/j2k_to_image.dsp | 117 - codec/j2k_to_image.dsw | 44 - codec/j2k_to_image.sln | Bin 1506 -> 0 bytes codec/j2k_to_image.vcproj | 291 -- jpwl/CMakeLists.txt | 55 - jpwl/JPWL_image_to_j2k.dsp | 127 - jpwl/JPWL_image_to_j2k.dsw | 44 - jpwl/JPWL_j2k_to_image.dsp | 135 - jpwl/JPWL_j2k_to_image.dsw | 44 - jpwl/LibOpenJPEG_JPWL.dsp | 282 -- jpwl/Makefile | 83 - jpwl/README.txt | 136 - jpwl/crc.c | 160 - jpwl/crc.h | 84 - jpwl/jpwl.c | 1357 -------- jpwl/jpwl.h | 425 --- jpwl/jpwl_lib.c | 1796 ---------- jpwl/rs.c | 594 ---- jpwl/rs.h | 111 - mj2/CMakeLists.txt | 42 - mj2/MJ2_Extractor.dsp | 196 -- mj2/MJ2_Extractor.dsw | 44 - mj2/MJ2_Extractor.sln | 29 - mj2/MJ2_Extractor.vcproj | 354 -- mj2/MJ2_Wrapper.dsp | 195 -- mj2/MJ2_Wrapper.dsw | 44 - mj2/MJ2_Wrapper.sln | 29 - mj2/MJ2_Wrapper.vcproj | 353 -- mj2/Makefile | 20 - mj2/compat/getopt.c | 116 - mj2/compat/getopt.h | 14 - mj2/extract_j2k_from_mj2.c | 148 - mj2/frames_to_mj2.c | 806 ----- mj2/frames_to_mj2.dsp | 212 -- mj2/frames_to_mj2.dsw | 44 - mj2/frames_to_mj2.sln | Bin 1508 -> 0 bytes mj2/frames_to_mj2.vcproj | 406 --- mj2/meta_out.c | 2181 ------------- mj2/meta_out.h | 13 - mj2/mj2.c | 2906 ----------------- mj2/mj2.h | 391 --- mj2/mj2_convert.c | 329 -- mj2/mj2_convert.h | 45 - mj2/mj2_to_frames.c | 225 -- mj2/mj2_to_frames.dsp | 159 - mj2/mj2_to_frames.dsw | 44 - mj2/mj2_to_frames.sln | 29 - mj2/mj2_to_frames.vcproj | 324 -- mj2/mj2_to_metadata.c | 312 -- mj2/mj2_to_metadata.dsp | 140 - mj2/mj2_to_metadata.dsw | 44 - mj2/mj2_to_metadata.dtd | 425 --- mj2/mj2_to_metadata.h | 9 - mj2/mj2_to_metadata.sln | 29 - mj2/mj2_to_metadata.vcproj | 349 -- mj2/mj2_to_metadata_Notes.doc | Bin 35328 -> 0 bytes mj2/readme.txt | 3 - mj2/wrap_j2k_in_mj2.c | 368 --- 133 files changed, 1 insertion(+), 41725 deletions(-) rename ChangeLog => CHANGES (99%) delete mode 100644 DllOpenJPEG.dsp delete mode 100644 DllOpenJPEG.sln delete mode 100644 DllOpenJPEG.vcproj delete mode 100644 JavaOpenJPEG/CMakeLists.txt delete mode 100644 JavaOpenJPEG/JavaOpenJPEG.c delete mode 100644 JavaOpenJPEG/JavaOpenJPEG.dsp delete mode 100644 JavaOpenJPEG/JavaOpenJPEG.dsw delete mode 100644 JavaOpenJPEG/JavaOpenJPEG.vcproj delete mode 100644 JavaOpenJPEG/JavaOpenJPEGDecoder.c delete mode 100644 JavaOpenJPEG/Makefile delete mode 100644 JavaOpenJPEG/java sources/org/openJpeg/OpenJPEGJavaDecoder.java delete mode 100644 JavaOpenJPEG/java sources/org/openJpeg/OpenJPEGJavaEncoder.java delete mode 100644 JavaOpenJPEG/java-jni/include/jawt.h delete mode 100644 JavaOpenJPEG/java-jni/include/jdwpTransport.h delete mode 100644 JavaOpenJPEG/java-jni/include/jni.h delete mode 100644 JavaOpenJPEG/java-jni/include/jvmdi.h delete mode 100644 JavaOpenJPEG/java-jni/include/jvmpi.h delete mode 100644 JavaOpenJPEG/java-jni/include/jvmti.h delete mode 100644 JavaOpenJPEG/java-jni/include/win32/jawt_md.h delete mode 100644 JavaOpenJPEG/java-jni/include/win32/jni_md.h delete mode 100644 JavaOpenJPEG/java-jni/lib/jvm.lib delete mode 100644 JavaOpenJPEG/org_openJpeg_OpenJPEGJavaDecoder.h delete mode 100644 JavaOpenJPEG/org_openJpeg_OpenJPEGJavaEncoder.h rename license.txt => LICENSE (100%) delete mode 100644 LibOpenJPEG.dsp delete mode 100644 LibOpenJPEG.dsw delete mode 100644 LibOpenJPEG.sln delete mode 100644 LibOpenJPEG.vcproj delete mode 100644 Makefile delete mode 100644 Makefile.osx delete mode 100644 OPJViewer/Makefile delete mode 100644 OPJViewer/OPJViewer.dsp delete mode 100644 OPJViewer/OPJViewer.dsw delete mode 100644 OPJViewer/OPJViewer.iss delete mode 100644 OPJViewer/Readme.txt delete mode 100644 OPJViewer/about/about.htm delete mode 100644 OPJViewer/about/opj_logo.png delete mode 100644 OPJViewer/buildupdate.bat delete mode 100644 OPJViewer/source/OPJAbout.cpp delete mode 100644 OPJViewer/source/OPJChild.ico delete mode 100644 OPJViewer/source/OPJChild16.xpm delete mode 100644 OPJViewer/source/OPJDialogs.cpp delete mode 100644 OPJViewer/source/OPJThreads.cpp delete mode 100644 OPJViewer/source/OPJViewer.cpp delete mode 100644 OPJViewer/source/OPJViewer.h delete mode 100644 OPJViewer/source/OPJViewer.ico delete mode 100644 OPJViewer/source/OPJViewer.rc delete mode 100644 OPJViewer/source/OPJViewer16.xpm delete mode 100644 OPJViewer/source/about_htm.h delete mode 100644 OPJViewer/source/build.h delete mode 100644 OPJViewer/source/icon1.xpm delete mode 100644 OPJViewer/source/icon2.xpm delete mode 100644 OPJViewer/source/icon3.xpm delete mode 100644 OPJViewer/source/icon4.xpm delete mode 100644 OPJViewer/source/icon5.xpm delete mode 100644 OPJViewer/source/imagjpeg2000.cpp delete mode 100644 OPJViewer/source/imagjpeg2000.h delete mode 100644 OPJViewer/source/imagmxf.cpp delete mode 100644 OPJViewer/source/imagmxf.h delete mode 100644 OPJViewer/source/license.txt delete mode 100644 OPJViewer/source/opj_logo.xpm delete mode 100644 OPJViewer/source/readmeafter.txt delete mode 100644 OPJViewer/source/readmebefore.txt delete mode 100644 OPJViewer/source/wxj2kparser.cpp delete mode 100644 OPJViewer/source/wxjp2parser.cpp delete mode 100644 README.linux delete mode 100644 README.msvc delete mode 100644 README.osx delete mode 100644 clean.bat delete mode 100644 codec/Makefile delete mode 100644 codec/image_to_j2k.dsp delete mode 100644 codec/image_to_j2k.dsw delete mode 100644 codec/image_to_j2k.sln delete mode 100644 codec/image_to_j2k.vcproj delete mode 100644 codec/j2k_to_image.dsp delete mode 100644 codec/j2k_to_image.dsw delete mode 100644 codec/j2k_to_image.sln delete mode 100644 codec/j2k_to_image.vcproj delete mode 100755 jpwl/CMakeLists.txt delete mode 100644 jpwl/JPWL_image_to_j2k.dsp delete mode 100644 jpwl/JPWL_image_to_j2k.dsw delete mode 100644 jpwl/JPWL_j2k_to_image.dsp delete mode 100644 jpwl/JPWL_j2k_to_image.dsw delete mode 100644 jpwl/LibOpenJPEG_JPWL.dsp delete mode 100755 jpwl/Makefile delete mode 100644 jpwl/README.txt delete mode 100644 jpwl/crc.c delete mode 100644 jpwl/crc.h delete mode 100644 jpwl/jpwl.c delete mode 100644 jpwl/jpwl.h delete mode 100644 jpwl/jpwl_lib.c delete mode 100644 jpwl/rs.c delete mode 100644 jpwl/rs.h delete mode 100644 mj2/CMakeLists.txt delete mode 100644 mj2/MJ2_Extractor.dsp delete mode 100644 mj2/MJ2_Extractor.dsw delete mode 100644 mj2/MJ2_Extractor.sln delete mode 100644 mj2/MJ2_Extractor.vcproj delete mode 100644 mj2/MJ2_Wrapper.dsp delete mode 100644 mj2/MJ2_Wrapper.dsw delete mode 100644 mj2/MJ2_Wrapper.sln delete mode 100644 mj2/MJ2_Wrapper.vcproj delete mode 100644 mj2/Makefile delete mode 100644 mj2/compat/getopt.c delete mode 100644 mj2/compat/getopt.h delete mode 100644 mj2/extract_j2k_from_mj2.c delete mode 100644 mj2/frames_to_mj2.c delete mode 100644 mj2/frames_to_mj2.dsp delete mode 100644 mj2/frames_to_mj2.dsw delete mode 100644 mj2/frames_to_mj2.sln delete mode 100644 mj2/frames_to_mj2.vcproj delete mode 100644 mj2/meta_out.c delete mode 100644 mj2/meta_out.h delete mode 100644 mj2/mj2.c delete mode 100644 mj2/mj2.h delete mode 100644 mj2/mj2_convert.c delete mode 100644 mj2/mj2_convert.h delete mode 100644 mj2/mj2_to_frames.c delete mode 100644 mj2/mj2_to_frames.dsp delete mode 100644 mj2/mj2_to_frames.dsw delete mode 100644 mj2/mj2_to_frames.sln delete mode 100644 mj2/mj2_to_frames.vcproj delete mode 100644 mj2/mj2_to_metadata.c delete mode 100644 mj2/mj2_to_metadata.dsp delete mode 100644 mj2/mj2_to_metadata.dsw delete mode 100644 mj2/mj2_to_metadata.dtd delete mode 100644 mj2/mj2_to_metadata.h delete mode 100644 mj2/mj2_to_metadata.sln delete mode 100644 mj2/mj2_to_metadata.vcproj delete mode 100644 mj2/mj2_to_metadata_Notes.doc delete mode 100644 mj2/readme.txt delete mode 100644 mj2/wrap_j2k_in_mj2.c diff --git a/ChangeLog b/CHANGES similarity index 99% rename from ChangeLog rename to CHANGES index 3c8fec28..3d4e6e80 100644 --- a/ChangeLog +++ b/CHANGES @@ -6,6 +6,7 @@ What's New for OpenJPEG + : added April 12, 2011 +- [antonin] Removed folders mj2, JavaOpenJpeg, jpwl, OPJViewer (not compliant with v2). Removed obsolete windows project files. Removed obsolete Makefiles (only build method currently supported with v2 branch: cmake). Renamed ChangeLog to CHANGES. Renamed License.txt to LICENSE. Removed obsolete README files. * [antonin] Fixed internal function names conflict with Jasper (http://code.google.com/p/openjpeg/issues/detail?id=30) November 25, 2010 diff --git a/DllOpenJPEG.dsp b/DllOpenJPEG.dsp deleted file mode 100644 index 6408c639..00000000 --- a/DllOpenJPEG.dsp +++ /dev/null @@ -1,273 +0,0 @@ -# Microsoft Developer Studio Project File - Name="DllOpenJPEG" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=DllOpenJPEG - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "DllOpenJPEG.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "DllOpenJPEG.mak" CFG="DllOpenJPEG - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "DllOpenJPEG - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "DllOpenJPEG - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "DllOpenJPEG - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLLOPENJPEG_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /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 /dll /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 /nologo /dll /machine:I386 /out:"Release/OpenJPEG.dll" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Release\OpenJPEG.dll dist copy Release\OpenJPEG.lib dist -# End Special Build Tool - -!ELSEIF "$(CFG)" == "DllOpenJPEG - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLLOPENJPEG_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /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 /dll /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 /nologo /dll /debug /machine:I386 /out:"Debug/OpenJPEGd.dll" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Debug\OpenJPEGd.dll dist copy Debug\OpenJPEGd.lib dist -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "DllOpenJPEG - Win32 Release" -# Name "DllOpenJPEG - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\libopenjpeg\bio.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\cio.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\dwt.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\event.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\image.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\j2k.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\j2k_lib.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\jp2.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\jpt.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\mct.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\mqc.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\openjpeg.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\pi.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\raw.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\t1.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\t2.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\tcd.c -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\tgt.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\tgt.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\OpenJPEG.rc -# End Source File -# End Group -# End Target -# End Project diff --git a/DllOpenJPEG.sln b/DllOpenJPEG.sln deleted file mode 100644 index 5125e739..00000000 --- a/DllOpenJPEG.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllOpenJPEG", "DllOpenJPEG.vcproj", "{89AC992C-5E2C-4E6B-A453-61C1DF446216}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {89AC992C-5E2C-4E6B-A453-61C1DF446216}.Debug|Win32.ActiveCfg = Debug|Win32 - {89AC992C-5E2C-4E6B-A453-61C1DF446216}.Debug|Win32.Build.0 = Debug|Win32 - {89AC992C-5E2C-4E6B-A453-61C1DF446216}.Release|Win32.ActiveCfg = Release|Win32 - {89AC992C-5E2C-4E6B-A453-61C1DF446216}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DllOpenJPEG.vcproj b/DllOpenJPEG.vcproj deleted file mode 100644 index f7aad9ea..00000000 --- a/DllOpenJPEG.vcproj +++ /dev/null @@ -1,694 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JavaOpenJPEG/CMakeLists.txt b/JavaOpenJPEG/CMakeLists.txt deleted file mode 100644 index 24058463..00000000 --- a/JavaOpenJPEG/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# Build the demo app, small examples - -# First thing define the common source: -SET(common_SRCS - convert.c - ) -# Then check if getopt is present: -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -SET(DONT_HAVE_GETOPT 1) -IF(UNIX) #I am pretty sure only *nix sys have this anyway - CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H) - # Seems like we need the contrary: - IF(CMAKE_HAVE_GETOPT_H) - SET(DONT_HAVE_GETOPT 0) - ENDIF(CMAKE_HAVE_GETOPT_H) -ENDIF(UNIX) - -# If not getopt was found then add it to the lib: -IF(DONT_HAVE_GETOPT) - ADD_DEFINITIONS(-DDONT_HAVE_GETOPT) - SET(common_SRCS - ${common_SRCS} - compat/getopt.c - ) -ENDIF(DONT_HAVE_GETOPT) - - -# Headers file are located here: -INCLUDE_DIRECTORIES( - ${OPENJPEG_SOURCE_DIR}/libopenjpeg - ) - -# Do the proper thing when building static...if only there was configured -# headers or def files instead -IF(NOT BUILD_SHARED_LIBS) - ADD_DEFINITIONS(-DOPJ_STATIC) -ENDIF(NOT BUILD_SHARED_LIBS) - -FIND_PACKAGE(TIFF REQUIRED) - -# Loop over all executables: -FOREACH(exe j2k_to_image image_to_j2k) - ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS}) - TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES}) - # On unix you need to link to the math library: - IF(UNIX) - TARGET_LINK_LIBRARIES(${exe} -lm) - ENDIF(UNIX) - # Install exe - INSTALL_TARGETS(/bin/ ${exe}) -ENDFOREACH(exe) - - diff --git a/JavaOpenJPEG/JavaOpenJPEG.c b/JavaOpenJPEG/JavaOpenJPEG.c deleted file mode 100644 index 6af3a44a..00000000 --- a/JavaOpenJPEG/JavaOpenJPEG.c +++ /dev/null @@ -1,1989 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe - * Copyright (c) 2005, Herve Drolon, FreeImage Team - * Copyright (c) 2006-2007, Parvatha Elangovan - * Copyright (c) 2007, Patrick Piscaglia (Telemis) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include -#include -#include -#include -#include - -#include "openjpeg.h" -#include "compat/getopt.h" -#include "convert.h" -#include "index.h" -#include "dirent.h" -#include "org_openJpeg_OpenJPEGJavaEncoder.h" - -#ifndef WIN32 -#define stricmp strcasecmp -#define strnicmp strncasecmp -#endif - -/* ----------------------------------------------------------------------- */ - -#define J2K_CFMT 0 -#define JP2_CFMT 1 -#define JPT_CFMT 2 - -#define PXM_DFMT 10 -#define PGX_DFMT 11 -#define BMP_DFMT 12 -#define YUV_DFMT 13 -#define TIF_DFMT 14 -#define RAW_DFMT 15 -#define TGA_DFMT 16 - -/* ----------------------------------------------------------------------- */ -#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/ -#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/ -#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/ -#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/ - -extern int get_file_format(char *filename); -extern void error_callback(const char *msg, void *client_data); -extern warning_callback(const char *msg, void *client_data); -extern void info_callback(const char *msg, void *client_data); - -typedef struct callback_variables { - JNIEnv *env; - /** 'jclass' object used to call a Java method from the C */ - jobject *jobj; - /** 'jclass' object used to call a Java method from the C */ - jmethodID message_mid; - jmethodID error_mid; -} callback_variables_t; - -typedef struct dircnt{ - /** Buffer for holding images read from Directory*/ - char *filename_buf; - /** Pointer to the buffer*/ - char **filename; -}dircnt_t; - -typedef struct img_folder{ - /** The directory path of the folder containing input images*/ - char *imgdirpath; - /** Output format*/ - char *out_format; - /** Enable option*/ - char set_imgdir; - /** Enable Cod Format for output*/ - char set_out_format; - /** User specified rate stored in case of cinema option*/ - float *rates; -}img_fol_t; - -void encode_help_display() { - fprintf(stdout,"HELP\n----\n\n"); - fprintf(stdout,"- the -h option displays this help information on screen\n\n"); - -/* UniPG>> */ - fprintf(stdout,"List of parameters for the JPEG 2000 " -#ifdef USE_JPWL - "+ JPWL " -#endif /* USE_JPWL */ - "encoder:\n"); -/* <> */ -#ifdef USE_JPWL - fprintf(stdout," * No JPWL protection\n"); -#endif /* USE_JPWL */ -/* < \n"); - fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA formats\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-i : source file (-i source.pnm also *.pgm, *.ppm, *.bmp, *.tif, *.raw, *.tga) \n"); - fprintf(stdout," When using this option -o must be used\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-o : destination file (-o dest.j2k or .jp2) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Optional Parameters:\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-h : display the help information \n "); - fprintf(stdout,"\n"); - fprintf(stdout,"-cinema2K : Digital Cinema 2K profile compliant codestream for 2K resolution.(-cinema2k 24 or 48) \n"); - fprintf(stdout," Need to specify the frames per second for a 2K resolution. Only 24 or 48 fps is allowed\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-cinema4K : Digital Cinema 4K profile compliant codestream for 4K resolution \n"); - fprintf(stdout," Frames per second not required. Default value is 24fps\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-r : different compression ratios for successive layers (-r 20,10,5)\n "); - fprintf(stdout," - The rate specified for each quality level is the desired \n"); - fprintf(stdout," compression factor.\n"); - fprintf(stdout," Example: -r 20,10,1 means quality 1: compress 20x, \n"); - fprintf(stdout," quality 2: compress 10x and quality 3: compress lossless\n"); - fprintf(stdout,"\n"); - fprintf(stdout," (options -r and -q cannot be used together)\n "); - fprintf(stdout,"\n"); - - fprintf(stdout,"-q : different psnr for successive layers (-q 30,40,50) \n "); - - fprintf(stdout," (options -r and -q cannot be used together)\n "); - - fprintf(stdout,"\n"); - fprintf(stdout,"-n : number of resolutions (-n 3) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-b : size of code block (-b 32,32) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-c : size of precinct (-c 128,128) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-t : size of tile (-t 512,512) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-p : progression order (-p LRCP) [LRCP, RLCP, RPCL, PCRL, CPRL] \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-s : subsampling factor (-s 2,2) [-s X,Y] \n"); - fprintf(stdout," Remark: subsampling bigger than 2 can produce error\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-POC : Progression order change (-POC T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL) \n"); - fprintf(stdout," Example: T1=0,0,1,5,3,CPRL \n"); - fprintf(stdout," : Ttilenumber=Resolution num start,Component num start,Layer num end,Resolution num end,Component num end,Progression order\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-SOP : write SOP marker before each packet \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-EPH : write EPH marker after each header packet \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-M : mode switch (-M 3) [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL)\n"); - fprintf(stdout," 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)] \n"); - fprintf(stdout," Indicate multiple modes by adding their values. \n"); - fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n"); - fprintf(stdout," for component c=%%d [%%d = 0,1,2]\n"); - fprintf(stdout," with a value of U=%%d [0 <= %%d <= 37] (i.e. -ROI c=0,U=25) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-d : offset of the origin of the image (-d 150,300) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-T : offset of the origin of the tiles (-T 100,75) \n"); - fprintf(stdout,"\n"); - fprintf(stdout,"-I : use the irreversible DWT 9-7 (-I) \n"); - fprintf(stdout,"\n"); -/* UniPG>> */ -#ifdef USE_JPWL - fprintf(stdout,"-W : adoption of JPWL (Part 11) capabilities (-W params)\n"); - fprintf(stdout," The parameters can be written and repeated in any order:\n"); - fprintf(stdout," [h<=type>,s<=method>,a=,...\n"); - fprintf(stdout," ...,z=,g=,p<=type>]\n"); - fprintf(stdout,"\n"); - fprintf(stdout," h selects the header error protection (EPB): 'type' can be\n"); - fprintf(stdout," [0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]\n"); - fprintf(stdout," if 'tilepart' is absent, it is for main and tile headers\n"); - fprintf(stdout," if 'tilepart' is present, it applies from that tile\n"); - fprintf(stdout," onwards, up to the next h<> spec, or to the last tilepart\n"); - fprintf(stdout," in the codestream (max. %d specs)\n", JPWL_MAX_NO_TILESPECS); - fprintf(stdout,"\n"); - fprintf(stdout," p selects the packet error protection (EEP/UEP with EPBs)\n"); - fprintf(stdout," to be applied to raw data: 'type' can be\n"); - fprintf(stdout," [0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]\n"); - fprintf(stdout," if 'tilepart:pack' is absent, it is from tile 0, packet 0\n"); - fprintf(stdout," if 'tilepart:pack' is present, it applies from that tile\n"); - fprintf(stdout," and that packet onwards, up to the next packet spec\n"); - fprintf(stdout," or to the last packet in the last tilepart in the stream\n"); - fprintf(stdout," (max. %d specs)\n", JPWL_MAX_NO_PACKSPECS); - fprintf(stdout,"\n"); - fprintf(stdout," s enables sensitivity data insertion (ESD): 'method' can be\n"); - fprintf(stdout," [-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR\n"); - fprintf(stdout," 4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED]\n"); - fprintf(stdout," if 'tilepart' is absent, it is for main header only\n"); - fprintf(stdout," if 'tilepart' is present, it applies from that tile\n"); - fprintf(stdout," onwards, up to the next s<> spec, or to the last tilepart\n"); - fprintf(stdout," in the codestream (max. %d specs)\n", JPWL_MAX_NO_TILESPECS); - fprintf(stdout,"\n"); - fprintf(stdout," g determines the addressing mode: can be\n"); - fprintf(stdout," [0=PACKET 1=BYTE RANGE 2=PACKET RANGE]\n"); - fprintf(stdout,"\n"); - fprintf(stdout," a determines the size of data addressing: can be\n"); - fprintf(stdout," 2/4 bytes (small/large codestreams). If not set, auto-mode\n"); - fprintf(stdout,"\n"); - fprintf(stdout," z determines the size of sensitivity values: can be\n"); - fprintf(stdout," 1/2 bytes, for the transformed pseudo-floating point value\n"); - fprintf(stdout,"\n"); - fprintf(stdout," ex.:\n"); - fprintf(stdout," h,h0=64,h3=16,h5=32,p0=78,p0:24=56,p1,p3:0=0,p3:20=32,s=0,\n"); - fprintf(stdout," s0=6,s3=-1,a=0,g=1,z=1\n"); - fprintf(stdout," means\n"); - fprintf(stdout," predefined EPB in MH, rs(64,32) from TPH 0 to TPH 2,\n"); - fprintf(stdout," CRC-16 in TPH 3 and TPH 4, CRC-32 in remaining TPHs,\n"); - fprintf(stdout," UEP rs(78,32) for packets 0 to 23 of tile 0,\n"); - fprintf(stdout," UEP rs(56,32) for packs. 24 to the last of tilepart 0,\n"); - fprintf(stdout," UEP rs default for packets of tilepart 1,\n"); - fprintf(stdout," no UEP for packets 0 to 19 of tilepart 3,\n"); - fprintf(stdout," UEP CRC-32 for packs. 20 of tilepart 3 to last tilepart,\n"); - fprintf(stdout," relative sensitivity ESD for MH,\n"); - fprintf(stdout," TSE ESD from TPH 0 to TPH 2, byte range with automatic\n"); - fprintf(stdout," size of addresses and 1 byte for each sensitivity value\n"); - fprintf(stdout,"\n"); - fprintf(stdout," ex.:\n"); - fprintf(stdout," h,s,p\n"); - fprintf(stdout," means\n"); - fprintf(stdout," default protection to headers (MH and TPHs) as well as\n"); - fprintf(stdout," data packets, one ESD in MH\n"); - fprintf(stdout,"\n"); - fprintf(stdout," N.B.: use the following recommendations when specifying\n"); - fprintf(stdout," the JPWL parameters list\n"); - fprintf(stdout," - when you use UEP, always pair the 'p' option with 'h'\n"); - fprintf(stdout," \n"); -#endif /* USE_JPWL */ -/* < -/// Get logarithm of an integer and round downwards. -/// -int int_floorlog2(int a) { - int l; - for (l=0; a>1; l++) { - a>>=1; - } - return l; -} - -static int initialise_4K_poc(opj_poc_t *POC, int numres){ - POC[0].tile = 1; - POC[0].resno0 = 0; - POC[0].compno0 = 0; - POC[0].layno1 = 1; - POC[0].resno1 = numres-1; - POC[0].compno1 = 3; - POC[0].prg1 = CPRL; - POC[1].tile = 1; - POC[1].resno0 = numres-1; - POC[1].compno0 = 0; - POC[1].layno1 = 1; - POC[1].resno1 = numres; - POC[1].compno1 = 3; - POC[1].prg1 = CPRL; - return 2; -} - -void cinema_parameters(opj_cparameters_t *parameters){ - parameters->tile_size_on = false; - parameters->cp_tdx=1; - parameters->cp_tdy=1; - - /*Tile part*/ - parameters->tp_flag = 'C'; - parameters->tp_on = 1; - - /*Tile and Image shall be at (0,0)*/ - parameters->cp_tx0 = 0; - parameters->cp_ty0 = 0; - parameters->image_offset_x0 = 0; - parameters->image_offset_y0 = 0; - - /*Codeblock size= 32*32*/ - parameters->cblockw_init = 32; - parameters->cblockh_init = 32; - parameters->csty |= 0x01; - - /*The progression order shall be CPRL*/ - parameters->prog_order = CPRL; - - /* No ROI */ - parameters->roi_compno = -1; - - parameters->subsampling_dx = 1; parameters->subsampling_dy = 1; - - /* 9-7 transform */ - parameters->irreversible = 1; - -} - -void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){ - int i; - float temp_rate; - opj_poc_t *POC = NULL; - - switch (parameters->cp_cinema){ - case CINEMA2K_24: - case CINEMA2K_48: - if(parameters->numresolution > 6){ - parameters->numresolution = 6; - } - if (!((image->comps[0].w == 2048) | (image->comps[0].h == 1080))){ - fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3" - "(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n", - image->comps[0].w,image->comps[0].h); - parameters->cp_rsiz = STD_RSIZ; - } - break; - - case CINEMA4K_24: - if(parameters->numresolution < 1){ - parameters->numresolution = 1; - }else if(parameters->numresolution > 7){ - parameters->numresolution = 7; - } - if (!((image->comps[0].w == 4096) | (image->comps[0].h == 2160))){ - fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4" - "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n", - image->comps[0].w,image->comps[0].h); - parameters->cp_rsiz = STD_RSIZ; - } - parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution); - break; - } - - switch (parameters->cp_cinema){ - case CINEMA2K_24: - case CINEMA4K_24: - for(i=0 ; itcp_numlayers ; i++){ - temp_rate = 0 ; - if (img_fol->rates[i]== 0){ - parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy); - }else{ - temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy); - if (temp_rate > CINEMA_24_CS ){ - parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy); - }else{ - parameters->tcp_rates[i]= img_fol->rates[i]; - } - } - } - parameters->max_comp_size = COMP_24_CS; - break; - - case CINEMA2K_48: - for(i=0 ; itcp_numlayers ; i++){ - temp_rate = 0 ; - if (img_fol->rates[i]== 0){ - parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy); - }else{ - temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy); - if (temp_rate > CINEMA_48_CS ){ - parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ - (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy); - }else{ - parameters->tcp_rates[i]= img_fol->rates[i]; - } - } - } - parameters->max_comp_size = COMP_48_CS; - break; - } - parameters->cp_disto_alloc = 1; -} - - -/* ------------------------------------------------------------------------------------ */ -int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters, - img_fol_t *img_fol, char *indexfilename) { - int i, j,totlen; - option_t long_option[]={ - {"cinema2K",REQ_ARG, NULL ,'w'}, - {"cinema4K",NO_ARG, NULL ,'y'}, - {"ImgDir",REQ_ARG, NULL ,'z'}, - {"TP",REQ_ARG, NULL ,'v'}, - {"SOP",NO_ARG, NULL ,'S'}, - {"EPH",NO_ARG, NULL ,'E'}, - {"OutFor",REQ_ARG, NULL ,'O'}, - {"POC",REQ_ARG, NULL ,'P'}, - {"ROI",REQ_ARG, NULL ,'R'}, - }; - - /* parse the command line */ -/* UniPG>> */ - const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:" -#ifdef USE_JPWL - "W:" -#endif /* USE_JPWL */ - ; - - /*printf("C: parse_cmdline_encoder:"); - for (i=0; iset_out_format=0; - reset_options_reading(); - - while (1) { - int c = getopt_long(argc, argv, optlist,long_option,totlen); - if (c == -1) - break; - switch (c) { - - /* ----------------------------------------------------- */ - - case 'o': /* output file */ - { - char *outfile = optarg; - parameters->cod_format = get_file_format(outfile); - switch(parameters->cod_format) { - case J2K_CFMT: - case JP2_CFMT: - break; - default: - fprintf(stderr, "Unknown output format image %s [only *.j2k, *.j2c or *.jp2]!! \n", outfile); - return 1; - } - strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1); - } - break; - - /* ----------------------------------------------------- */ - case 'O': /* output format */ - { - char outformat[50]; - char *of = optarg; - sprintf(outformat,".%s",of); - img_fol->set_out_format = 1; - parameters->cod_format = get_file_format(outformat); - switch(parameters->cod_format) { - case J2K_CFMT: - case JP2_CFMT: - img_fol->out_format = optarg; - break; - default: - fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n"); - return 1; - } - } - break; - - - /* ----------------------------------------------------- */ - - - case 'r': /* rates rates/distorsion */ - { - char *s = optarg; - while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) { - parameters->tcp_numlayers++; - while (*s && *s != ',') { - s++; - } - if (!*s) - break; - s++; - } - parameters->cp_disto_alloc = 1; - } - break; - - /* ----------------------------------------------------- */ - - case 'q': /* add fixed_quality */ - { - char *s = optarg; - while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) { - parameters->tcp_numlayers++; - while (*s && *s != ',') { - s++; - } - if (!*s) - break; - s++; - } - parameters->cp_fixed_quality = 1; - } - break; - - /* dda */ - /* ----------------------------------------------------- */ - - case 'f': /* mod fixed_quality (before : -q) */ - { - int *row = NULL, *col = NULL; - int numlayers = 0, numresolution = 0, matrix_width = 0; - - char *s = optarg; - sscanf(s, "%d", &numlayers); - s++; - if (numlayers > 9) - s++; - - parameters->tcp_numlayers = numlayers; - numresolution = parameters->numresolution; - matrix_width = numresolution * 3; - parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int)); - s = s + 2; - - for (i = 0; i < numlayers; i++) { - row = ¶meters->cp_matrice[i * matrix_width]; - col = row; - parameters->tcp_rates[i] = 1; - sscanf(s, "%d,", &col[0]); - s += 2; - if (col[0] > 9) - s++; - col[1] = 0; - col[2] = 0; - for (j = 1; j < numresolution; j++) { - col += 3; - sscanf(s, "%d,%d,%d", &col[0], &col[1], &col[2]); - s += 6; - if (col[0] > 9) - s++; - if (col[1] > 9) - s++; - if (col[2] > 9) - s++; - } - if (i < numlayers - 1) - s++; - } - parameters->cp_fixed_alloc = 1; - } - break; - - /* ----------------------------------------------------- */ - - case 't': /* tiles */ - { - sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy); - parameters->tile_size_on = true; - } - break; - - /* ----------------------------------------------------- */ - - case 'n': /* resolution */ - { - sscanf(optarg, "%d", ¶meters->numresolution); - } - break; - - /* ----------------------------------------------------- */ - case 'c': /* precinct dimension */ - { - char sep; - int res_spec = 0; - - char *s = optarg; - do { - sep = 0; - sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec], - ¶meters->prch_init[res_spec], &sep); - parameters->csty |= 0x01; - res_spec++; - s = strpbrk(s, "]") + 2; - } - while (sep == ','); - parameters->res_spec = res_spec; - } - break; - - /* ----------------------------------------------------- */ - - case 'b': /* code-block dimension */ - { - int cblockw_init = 0, cblockh_init = 0; - sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init); - if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 - || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) { - fprintf(stderr, - "!! Size of code_block error (option -b) !!\n\nRestriction :\n" - " * width*height<=4096\n * 4<=width,height<= 1024\n\n"); - return 1; - } - parameters->cblockw_init = cblockw_init; - parameters->cblockh_init = cblockh_init; - } - break; - - /* ----------------------------------------------------- */ - - case 'x': /* creation of index file */ - { - char *index = optarg; - strncpy(indexfilename, index, OPJ_PATH_LEN); - } - break; - - /* ----------------------------------------------------- */ - - case 'p': /* progression order */ - { - char progression[4]; - - strncpy(progression, optarg, 4); - parameters->prog_order = give_progression(progression); - if (parameters->prog_order == -1) { - fprintf(stderr, "Unrecognized progression order " - "[LRCP, RLCP, RPCL, PCRL, CPRL] !!\n"); - return 1; - } - } - break; - - /* ----------------------------------------------------- */ - - case 's': /* subsampling factor */ - { - if (sscanf(optarg, "%d,%d", ¶meters->subsampling_dx, - ¶meters->subsampling_dy) != 2) { - fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n"); - return 1; - } - } - break; - - /* ----------------------------------------------------- */ - - case 'd': /* coordonnate of the reference grid */ - { - if (sscanf(optarg, "%d,%d", ¶meters->image_offset_x0, - ¶meters->image_offset_y0) != 2) { - fprintf(stderr, "-d 'coordonnate of the reference grid' argument " - "error !! [-d x0,y0]\n"); - return 1; - } - } - break; - - /* ----------------------------------------------------- */ - - case 'h': /* display an help description */ - encode_help_display(); - return 1; - - /* ----------------------------------------------------- */ - - case 'P': /* POC */ - { - int numpocs = 0; /* number of progression order change (POC) default 0 */ - opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */ - - char *s = optarg; - POC = parameters->POC; - - while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile, - &POC[numpocs].resno0, &POC[numpocs].compno0, - &POC[numpocs].layno1, &POC[numpocs].resno1, - &POC[numpocs].compno1, &POC[numpocs].progorder) == 7) { - POC[numpocs].prg1 = give_progression(POC[numpocs].progorder); - numpocs++; - while (*s && *s != '/') { - s++; - } - if (!*s) { - break; - } - s++; - } - parameters->numpocs = numpocs; - } - break; - - /* ------------------------------------------------------ */ - - case 'S': /* SOP marker */ - { - parameters->csty |= 0x02; - } - break; - - /* ------------------------------------------------------ */ - - case 'E': /* EPH marker */ - { - parameters->csty |= 0x04; - } - break; - - /* ------------------------------------------------------ */ - - case 'M': /* Mode switch pas tous au point !! */ - { - int value = 0; - if (sscanf(optarg, "%d", &value) == 1) { - for (i = 0; i <= 5; i++) { - int cache = value & (1 << i); - if (cache) - parameters->mode |= (1 << i); - } - } - } - break; - - /* ------------------------------------------------------ */ - - case 'R': /* ROI */ - { - if (sscanf(optarg, "c=%d,U=%d", ¶meters->roi_compno, - ¶meters->roi_shift) != 2) { - fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n"); - return 1; - } - } - break; - - /* ------------------------------------------------------ */ - - case 'T': /* Tile offset */ - { - if (sscanf(optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) { - fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]"); - return 1; - } - } - break; - - /* ------------------------------------------------------ */ - - case 'C': /* add a comment */ - { - parameters->cp_comment = (char*)malloc(strlen(optarg) + 1); - if(parameters->cp_comment) { - strcpy(parameters->cp_comment, optarg); - } - } - break; - - - /* ------------------------------------------------------ */ - - case 'I': /* reversible or not */ - { - parameters->irreversible = 1; - } - break; - - /* ------------------------------------------------------ */ - - case 'v': /* Tile part generation*/ - { - parameters->tp_flag = optarg[0]; - parameters->tp_on = 1; - } - break; - - /* ------------------------------------------------------ */ - - case 'z': /* Image Directory path */ - { - img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1); - strcpy(img_fol->imgdirpath,optarg); - img_fol->set_imgdir=1; - } - break; - - /* ------------------------------------------------------ */ - - case 'w': /* Digital Cinema 2K profile compliance*/ - { - int fps=0; - sscanf(optarg,"%d",&fps); - if(fps == 24){ - parameters->cp_cinema = CINEMA2K_24; - }else if(fps == 48 ){ - parameters->cp_cinema = CINEMA2K_48; - }else { - fprintf(stderr,"Incorrect value!! must be 24 or 48\n"); - return 1; - } - fprintf(stdout,"CINEMA 2K compliant codestream\n"); - parameters->cp_rsiz = CINEMA2K; - - } - break; - - /* ------------------------------------------------------ */ - - case 'y': /* Digital Cinema 4K profile compliance*/ - { - parameters->cp_cinema = CINEMA4K_24; - fprintf(stdout,"CINEMA 4K compliant codestream\n"); - parameters->cp_rsiz = CINEMA4K; - } - break; - - /* ------------------------------------------------------ */ - -/* UniPG>> */ -#ifdef USE_JPWL - /* ------------------------------------------------------ */ - - case 'W': /* JPWL capabilities switched on */ - { - char *token = NULL; - int hprot, pprot, sens, addr, size, range; - - /* we need to enable indexing */ - if (!indexfilename) { - strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN); - } - - /* search for different protection methods */ - - /* break the option in comma points and parse the result */ - token = strtok(optarg, ","); - while(token != NULL) { - - /* search header error protection method */ - if (*token == 'h') { - - static int tile = 0, tilespec = 0, lasttileno = 0; - - hprot = 1; /* predefined method */ - - if(sscanf(token, "h=%d", &hprot) == 1) { - /* Main header, specified */ - if (!((hprot == 0) || (hprot == 1) || (hprot == 16) || (hprot == 32) || - ((hprot >= 37) && (hprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid main header protection method h = %d\n", hprot); - return 1; - } - parameters->jpwl_hprot_MH = hprot; - - } else if(sscanf(token, "h%d=%d", &tile, &hprot) == 2) { - /* Tile part header, specified */ - if (!((hprot == 0) || (hprot == 1) || (hprot == 16) || (hprot == 32) || - ((hprot >= 37) && (hprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid tile part header protection method h = %d\n", hprot); - return 1; - } - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method t = %d\n", tile); - return 1; - } - if (tilespec < JPWL_MAX_NO_TILESPECS) { - parameters->jpwl_hprot_TPH_tileno[tilespec] = lasttileno = tile; - parameters->jpwl_hprot_TPH[tilespec++] = hprot; - } - - } else if(sscanf(token, "h%d", &tile) == 1) { - /* Tile part header, unspecified */ - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method t = %d\n", tile); - return 1; - } - if (tilespec < JPWL_MAX_NO_TILESPECS) { - parameters->jpwl_hprot_TPH_tileno[tilespec] = lasttileno = tile; - parameters->jpwl_hprot_TPH[tilespec++] = hprot; - } - - - } else if (!strcmp(token, "h")) { - /* Main header, unspecified */ - parameters->jpwl_hprot_MH = hprot; - - } else { - fprintf(stderr, "ERROR -> invalid protection method selection = %s\n", token); - return 1; - }; - - } - - /* search packet error protection method */ - if (*token == 'p') { - - static int pack = 0, tile = 0, packspec = 0, lastpackno = 0; - - pprot = 1; /* predefined method */ - - if (sscanf(token, "p=%d", &pprot) == 1) { - /* Method for all tiles and all packets */ - if (!((pprot == 0) || (pprot == 1) || (pprot == 16) || (pprot == 32) || - ((pprot >= 37) && (pprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid default packet protection method p = %d\n", pprot); - return 1; - } - parameters->jpwl_pprot_tileno[0] = 0; - parameters->jpwl_pprot_packno[0] = 0; - parameters->jpwl_pprot[0] = pprot; - - } else if (sscanf(token, "p%d=%d", &tile, &pprot) == 2) { - /* method specified from that tile on */ - if (!((pprot == 0) || (pprot == 1) || (pprot == 16) || (pprot == 32) || - ((pprot >= 37) && (pprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid packet protection method p = %d\n", pprot); - return 1; - } - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method p = %d\n", tile); - return 1; - } - if (packspec < JPWL_MAX_NO_PACKSPECS) { - parameters->jpwl_pprot_tileno[packspec] = tile; - parameters->jpwl_pprot_packno[packspec] = 0; - parameters->jpwl_pprot[packspec++] = pprot; - } - - } else if (sscanf(token, "p%d:%d=%d", &tile, &pack, &pprot) == 3) { - /* method fully specified from that tile and that packet on */ - if (!((pprot == 0) || (pprot == 1) || (pprot == 16) || (pprot == 32) || - ((pprot >= 37) && (pprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid packet protection method p = %d\n", pprot); - return 1; - } - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method p = %d\n", tile); - return 1; - } - if (pack < 0) { - fprintf(stderr, "ERROR -> invalid packet number on protection method p = %d\n", pack); - return 1; - } - if (packspec < JPWL_MAX_NO_PACKSPECS) { - parameters->jpwl_pprot_tileno[packspec] = tile; - parameters->jpwl_pprot_packno[packspec] = pack; - parameters->jpwl_pprot[packspec++] = pprot; - } - - } else if (sscanf(token, "p%d:%d", &tile, &pack) == 2) { - /* default method from that tile and that packet on */ - if (!((pprot == 0) || (pprot == 1) || (pprot == 16) || (pprot == 32) || - ((pprot >= 37) && (pprot <= 128)))) { - fprintf(stderr, "ERROR -> invalid packet protection method p = %d\n", pprot); - return 1; - } - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method p = %d\n", tile); - return 1; - } - if (pack < 0) { - fprintf(stderr, "ERROR -> invalid packet number on protection method p = %d\n", pack); - return 1; - } - if (packspec < JPWL_MAX_NO_PACKSPECS) { - parameters->jpwl_pprot_tileno[packspec] = tile; - parameters->jpwl_pprot_packno[packspec] = pack; - parameters->jpwl_pprot[packspec++] = pprot; - } - - } else if (sscanf(token, "p%d", &tile) == 1) { - /* default from a tile on */ - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on protection method p = %d\n", tile); - return 1; - } - if (packspec < JPWL_MAX_NO_PACKSPECS) { - parameters->jpwl_pprot_tileno[packspec] = tile; - parameters->jpwl_pprot_packno[packspec] = 0; - parameters->jpwl_pprot[packspec++] = pprot; - } - - - } else if (!strcmp(token, "p")) { - /* all default */ - parameters->jpwl_pprot_tileno[0] = 0; - parameters->jpwl_pprot_packno[0] = 0; - parameters->jpwl_pprot[0] = pprot; - - } else { - fprintf(stderr, "ERROR -> invalid protection method selection = %s\n", token); - return 1; - }; - - } - - /* search sensitivity method */ - if (*token == 's') { - - static int tile = 0, tilespec = 0, lasttileno = 0; - - sens = 0; /* predefined: relative error */ - - if(sscanf(token, "s=%d", &sens) == 1) { - /* Main header, specified */ - if ((sens < -1) || (sens > 7)) { - fprintf(stderr, "ERROR -> invalid main header sensitivity method s = %d\n", sens); - return 1; - } - parameters->jpwl_sens_MH = sens; - - } else if(sscanf(token, "s%d=%d", &tile, &sens) == 2) { - /* Tile part header, specified */ - if ((sens < -1) || (sens > 7)) { - fprintf(stderr, "ERROR -> invalid tile part header sensitivity method s = %d\n", sens); - return 1; - } - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on sensitivity method t = %d\n", tile); - return 1; - } - if (tilespec < JPWL_MAX_NO_TILESPECS) { - parameters->jpwl_sens_TPH_tileno[tilespec] = lasttileno = tile; - parameters->jpwl_sens_TPH[tilespec++] = sens; - } - - } else if(sscanf(token, "s%d", &tile) == 1) { - /* Tile part header, unspecified */ - if (tile < 0) { - fprintf(stderr, "ERROR -> invalid tile part number on sensitivity method t = %d\n", tile); - return 1; - } - if (tilespec < JPWL_MAX_NO_TILESPECS) { - parameters->jpwl_sens_TPH_tileno[tilespec] = lasttileno = tile; - parameters->jpwl_sens_TPH[tilespec++] = hprot; - } - - } else if (!strcmp(token, "s")) { - /* Main header, unspecified */ - parameters->jpwl_sens_MH = sens; - - } else { - fprintf(stderr, "ERROR -> invalid sensitivity method selection = %s\n", token); - return 1; - }; - - parameters->jpwl_sens_size = 2; /* 2 bytes for default size */ - } - - /* search addressing size */ - if (*token == 'a') { - - static int tile = 0, tilespec = 0, lasttileno = 0; - - addr = 0; /* predefined: auto */ - - if(sscanf(token, "a=%d", &addr) == 1) { - /* Specified */ - if ((addr != 0) && (addr != 2) && (addr != 4)) { - fprintf(stderr, "ERROR -> invalid addressing size a = %d\n", addr); - return 1; - } - parameters->jpwl_sens_addr = addr; - - } else if (!strcmp(token, "a")) { - /* default */ - parameters->jpwl_sens_addr = addr; /* auto for default size */ - - } else { - fprintf(stderr, "ERROR -> invalid addressing selection = %s\n", token); - return 1; - }; - - } - - /* search sensitivity size */ - if (*token == 'z') { - - static int tile = 0, tilespec = 0, lasttileno = 0; - - size = 1; /* predefined: 1 byte */ - - if(sscanf(token, "z=%d", &size) == 1) { - /* Specified */ - if ((size != 0) && (size != 1) && (size != 2)) { - fprintf(stderr, "ERROR -> invalid sensitivity size z = %d\n", size); - return 1; - } - parameters->jpwl_sens_size = size; - - } else if (!strcmp(token, "a")) { - /* default */ - parameters->jpwl_sens_size = size; /* 1 for default size */ - - } else { - fprintf(stderr, "ERROR -> invalid size selection = %s\n", token); - return 1; - }; - - } - - /* search range method */ - if (*token == 'g') { - - static int tile = 0, tilespec = 0, lasttileno = 0; - - range = 0; /* predefined: 0 (packet) */ - - if(sscanf(token, "g=%d", &range) == 1) { - /* Specified */ - if ((range < 0) || (range > 3)) { - fprintf(stderr, "ERROR -> invalid sensitivity range method g = %d\n", range); - return 1; - } - parameters->jpwl_sens_range = range; - - } else if (!strcmp(token, "g")) { - /* default */ - parameters->jpwl_sens_range = range; - - } else { - fprintf(stderr, "ERROR -> invalid range selection = %s\n", token); - return 1; - }; - - } - - /* next token or bust */ - token = strtok(NULL, ","); - }; - - - /* some info */ - fprintf(stdout, "Info: JPWL capabilities enabled\n"); - parameters->jpwl_epc_on = true; - - } - break; -#endif /* USE_JPWL */ -/* < Command line not valid\n"); - return 1; - } - } - - /* check for possible errors */ - if (parameters->cp_cinema){ - if(parameters->tcp_numlayers > 1){ - parameters->cp_rsiz = STD_RSIZ; - fprintf(stdout,"Warning: DC profiles do not allow more than one quality layer. The codestream created will not be compliant with the DC profile\n"); - } - } - - if ((parameters->cp_disto_alloc || parameters->cp_fixed_alloc || parameters->cp_fixed_quality) - && (!(parameters->cp_disto_alloc ^ parameters->cp_fixed_alloc ^ parameters->cp_fixed_quality))) { - fprintf(stderr, "Error: options -r -q and -f cannot be used together !!\n"); - return 1; - } /* mod fixed_quality */ - - /* if no rate entered, lossless by default */ - if (parameters->tcp_numlayers == 0) { - parameters->tcp_rates[0] = 0; /* MOD antonin : losslessbug */ - parameters->tcp_numlayers++; - parameters->cp_disto_alloc = 1; - } - - if((parameters->cp_tx0 > parameters->image_offset_x0) || (parameters->cp_ty0 > parameters->image_offset_y0)) { - fprintf(stderr, - "Error: Tile offset dimension is unnappropriate --> TX0(%d)<=IMG_X0(%d) TYO(%d)<=IMG_Y0(%d) \n", - parameters->cp_tx0, parameters->image_offset_x0, parameters->cp_ty0, parameters->image_offset_y0); - return 1; - } - - for (i = 0; i < parameters->numpocs; i++) { - if (parameters->POC[i].prg == -1) { - fprintf(stderr, - "Unrecognized progression order in option -P (POC n %d) [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n", - i + 1); - } - } - - return 0; -} - - -/** Create the same index as j2k_create_index does, but in an int[] instead of in a file ==> easy to pass it back to Java, to transfer it etc. - @param buffer_size, increased by the length of the compressed index, in number of bytes - @return a pointer to a char[] - Syntax of the index: - one char for the version number (1): one byte because no problem with little endian, big endian etc. - one int for each of the following informations: - Image Width - Image Height - progression order - Tile width - Tile height - Nb tiles in X - Nb tiles in Y - Nb of components - Nb of layers - Nb of resolutions - - for each resolution: - Precinct width - Precinct height - - End main header position - codestream size - - For each tile: - tile number - tile start pos in codestream - tile header end position - tile end position in codestream - - For each LRCP, RLCP etc.: - packet number - tile number - layer number - resolution number - component number - precinct number - start position in the codestream - end position of this packet - */ -char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer_size) { - int tileno, compno, layno, resno, precno, pack_nb, x, y; - char* buffer = NULL; - int buffer_pos = 0; - int prec_max = 0; - - prec_max = 0; - for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) { - for (resno = 0; resno < cstr_info->numdecompos[0] + 1; resno++) { - prec_max = max(prec_max,cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]); - } - } - - // Compute the size of the index buffer, in number of bytes*/ - *buffer_size = - 1 /* version */ - + (10 /* image_w until decomposition */ - + (cstr_info->numdecompos[0]+1) * 2 /* pdx size for each tile */ - + 2 /* main_head_end + codestream_size */ - + cstr_info->tw * cstr_info->th * 4 /* tile info, without distorsion info */ - + cstr_info->tw*cstr_info->th * cstr_info->numlayers * (cstr_info->numdecompos[0] + 1) * cstr_info->numcomps * prec_max *8 - ) * sizeof(int); - //printf("C: index buffer size = %d bytes\n", *buffer_size); - buffer = (char*) malloc(*buffer_size); - - if (!buffer) { - //opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size); - fprintf(stderr, "failed to allocate index buffer for writing %d int\n", *buffer_size); - return 0; - } - - buffer[0] = 1; // Version stored on a byte - buffer++; - // Remaining informations are stored on a int. - ((int*)buffer)[buffer_pos++] = cstr_info->image_w; - ((int*)buffer)[buffer_pos++] = cstr_info->image_h; - ((int*)buffer)[buffer_pos++] = cstr_info->prog; - ((int*)buffer)[buffer_pos++] = cstr_info->tile_x; - ((int*)buffer)[buffer_pos++] = cstr_info->tile_y; - ((int*)buffer)[buffer_pos++] = cstr_info->tw; - ((int*)buffer)[buffer_pos++] = cstr_info->th; - ((int*)buffer)[buffer_pos++] = cstr_info->numcomps; - ((int*)buffer)[buffer_pos++] = cstr_info->numlayers; - ((int*)buffer)[buffer_pos++] = cstr_info->numdecompos[0]; - - for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) { - /* based on tile 0 */ - ((int*)buffer)[buffer_pos++] = (1 << cstr_info->tile[0].pdx[resno]); - ((int*)buffer)[buffer_pos++] = (1 << cstr_info->tile[0].pdx[resno]); - } - ((int*)buffer)[buffer_pos++] = cstr_info->main_head_end; - ((int*)buffer)[buffer_pos++] = cstr_info->codestream_size; - - for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) { - ((int*)buffer)[buffer_pos++] = cstr_info->tile[tileno].tileno; - ((int*)buffer)[buffer_pos++] = cstr_info->tile[tileno].start_pos; - ((int*)buffer)[buffer_pos++] = cstr_info->tile[tileno].end_header; - ((int*)buffer)[buffer_pos++] = cstr_info->tile[tileno].end_pos; - } - - for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) { - int start_pos, end_pos; - 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]; - } - - if (cstr_info->prog == LRCP) { /* LRCP */ - - for (layno = 0; layno < cstr_info->numlayers; layno++) { - for (resno = 0; resno < max_numdecompos + 1; resno++) { - for (compno = 0; compno < cstr_info->numcomps; compno++) { - int prec_max; - if (resno > cstr_info->numdecompos[compno]) - break; - prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]; - for (precno = 0; precno < prec_max; precno++) { - start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos; - end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos; - ((int*)buffer)[buffer_pos++] = pack_nb; - ((int*)buffer)[buffer_pos++] = tileno; - ((int*)buffer)[buffer_pos++] = layno; - ((int*)buffer)[buffer_pos++] = resno; - ((int*)buffer)[buffer_pos++] = compno; - ((int*)buffer)[buffer_pos++] = precno; - ((int*)buffer)[buffer_pos++] = start_pos; - ((int*)buffer)[buffer_pos++] = end_pos; - pack_nb++; - } - } - } - } - } /* LRCP */ - else if (cstr_info->prog == RLCP) { /* RLCP */ - - for (resno = 0; resno < max_numdecompos + 1; resno++) { - for (layno = 0; layno < cstr_info->numlayers; layno++) { - for (compno = 0; compno < cstr_info->numcomps; compno++) { - int prec_max; - if (resno > cstr_info->numdecompos[compno]) - break; - prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]; - for (precno = 0; precno < prec_max; precno++) { - start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos; - end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos; - ((int*)buffer)[buffer_pos++] = pack_nb; - ((int*)buffer)[buffer_pos++] = tileno; - ((int*)buffer)[buffer_pos++] = resno; - ((int*)buffer)[buffer_pos++] = layno; - ((int*)buffer)[buffer_pos++] = compno; - ((int*)buffer)[buffer_pos++] = precno; - ((int*)buffer)[buffer_pos++] = start_pos; - ((int*)buffer)[buffer_pos++] = end_pos; - pack_nb++; - } - } - } - } - } /* RLCP */ - else if (cstr_info->prog == RPCL) { /* RPCL */ - - for (resno = 0; resno < max_numdecompos + 1; resno++) { - /* I suppose components have same XRsiz, YRsiz */ - int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x; - int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y; - int x1 = x0 + cstr_info->tile_x; - int y1 = y0 + cstr_info->tile_y; - for (compno = 0; compno < cstr_info->numcomps; compno++) { - int prec_max; - 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++) { - int pcnx = cstr_info->tile[tileno].pw[resno]; - int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno ); - int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno ); - int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx; - int precno_y = (int) floor( (float)precno/(float)pcnx ); - for(y = y0; y < y1; y++) { - if (precno_y*pcy == y ) { - for (x = x0; x < x1; x++) { - if (precno_x*pcx == x ) { - for (layno = 0; layno < cstr_info->numlayers; layno++) { - start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos; - end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos; - ((int*)buffer)[buffer_pos++] = pack_nb; - ((int*)buffer)[buffer_pos++] = tileno; - ((int*)buffer)[buffer_pos++] = resno; - ((int*)buffer)[buffer_pos++] = precno; - ((int*)buffer)[buffer_pos++] = compno; - ((int*)buffer)[buffer_pos++] = layno; - ((int*)buffer)[buffer_pos++] = start_pos; - ((int*)buffer)[buffer_pos++] = end_pos; - pack_nb++; - } - } - }/* x = x0..x1 */ - } - } /* y = y0..y1 */ - } /* precno */ - } /* compno */ - } /* resno */ - } /* RPCL */ - else if (cstr_info->prog == PCRL) { /* PCRL */ - /* I suppose components have same XRsiz, YRsiz */ - int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x; - int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y; - int x1 = x0 + cstr_info->tile_x; - int y1 = y0 + cstr_info->tile_y; - - for (compno = 0; compno < cstr_info->numcomps; compno++) { - for (resno = 0; resno < max_numdecompos + 1; 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++) { - int pcnx = cstr_info->tile[tileno].pw[resno]; - int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno ); - int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno ); - int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx; - int precno_y = (int) floor( (float)precno/(float)pcnx ); - for(y = y0; y < y1; y++) { - if (precno_y*pcy == y ) { - for (x = x0; x < x1; x++) { - if (precno_x*pcx == x ) { - for (layno = 0; layno < cstr_info->numlayers; layno++) { - start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos; - end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos; - ((int*)buffer)[buffer_pos++] = pack_nb; - ((int*)buffer)[buffer_pos++] = tileno; - ((int*)buffer)[buffer_pos++] = precno; - ((int*)buffer)[buffer_pos++] = compno; - ((int*)buffer)[buffer_pos++] = resno; - ((int*)buffer)[buffer_pos++] = layno; - ((int*)buffer)[buffer_pos++] = start_pos; - ((int*)buffer)[buffer_pos++] = end_pos; - pack_nb++; - } - } - }/* x = x0..x1 */ - } - } /* y = y0..y1 */ - } /* precno */ - } /* resno */ - } /* compno */ - } /* PCRL */ - else { /* CPRL */ - - for (compno = 0; compno < cstr_info->numcomps; compno++) { - /* I suppose components have same XRsiz, YRsiz */ - int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x; - int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y; - int x1 = x0 + cstr_info->tile_x; - int y1 = y0 + cstr_info->tile_y; - - for (resno = 0; resno < max_numdecompos + 1; 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++) { - int pcnx = cstr_info->tile[tileno].pw[resno]; - int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno ); - int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno ); - int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx; - int precno_y = (int) floor( (float)precno/(float)pcnx ); - for(y = y0; y < y1; y++) { - if (precno_y*pcy == y ) { - for (x = x0; x < x1; x++) { - if (precno_x*pcx == x ) { - for (layno = 0; layno < cstr_info->numlayers; layno++) { - start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos; - end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos; - ((int*)buffer)[buffer_pos++] = pack_nb; - ((int*)buffer)[buffer_pos++] = tileno; - ((int*)buffer)[buffer_pos++] = compno; - ((int*)buffer)[buffer_pos++] = precno; - ((int*)buffer)[buffer_pos++] = resno; - ((int*)buffer)[buffer_pos++] = layno; - ((int*)buffer)[buffer_pos++] = start_pos; - ((int*)buffer)[buffer_pos++] = end_pos; - pack_nb++; - } - } - }/* x = x0..x1 */ - } - } /* y = y0..y1 */ - } /* precno */ - } /* resno */ - } /* compno */ - } /* CPRL */ - } /* tileno */ - - if (buffer_pos > *buffer_size) { - //opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size); - fprintf(stderr, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size); - return 0; - } - - return --buffer; -} - - - - -/* -------------------------------------------------------------------------- - ------------ Get the image byte[] from the Java object -------------------*/ - -opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj, jclass cls) { - int i,max,shift,w,h,depth; - opj_image_t * img = NULL; - int compno, numcomps; - opj_image_t * image = NULL; - opj_image_comp_t *comp; - opj_image_cmptparm_t cmptparm[3]; /* maximum of 3 components */ - OPJ_COLOR_SPACE color_space; - jfieldID fid; - jint ji; - jbyteArray jba; - jshortArray jsa; - jintArray jia; - int len; - jbyte *jbBody; - jshort *jsBody; - jint *jiBody; - boolean isCopy; - - // Image width, height and depth - fid = (*env)->GetFieldID(env, cls,"width", "I"); - ji = (*env)->GetIntField(env, obj, fid); - w = ji; - - fid = (*env)->GetFieldID(env, cls,"height", "I"); - ji = (*env)->GetIntField(env, obj, fid); - h = ji; - - fid = (*env)->GetFieldID(env, cls,"depth", "I"); - ji = (*env)->GetIntField(env, obj, fid); - depth = ji; - - // Read the image - if (depth <=16) { - numcomps = 1; - color_space = CLRSPC_GRAY; - } else { - numcomps = 3; - color_space = CLRSPC_SRGB; - } - memset(&cmptparm[0], 0, numcomps * sizeof(opj_image_cmptparm_t)); - - if (numcomps == 1) { - cmptparm[0].x0 = parameters->image_offset_x0; - cmptparm[0].y0 = parameters->image_offset_y0; - cmptparm[0].w = !cmptparm[0].x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm[0].x0 + (w - 1) * parameters->subsampling_dx + 1; - cmptparm[0].h = !cmptparm[0].y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm[0].y0 + (h - 1) * parameters->subsampling_dy + 1; - // Java types are always signed but we use them as unsigned types (shift of the negative part of - // the pixels of the images in Telemis before entering the encoder). - cmptparm[0].sgnd = 0; - if (depth<=16) - cmptparm[0].prec=depth; - else - cmptparm[0].prec = 8; - cmptparm[0].bpp = cmptparm[0].prec; - cmptparm[0].dx = parameters->subsampling_dx; - cmptparm[0].dy = parameters->subsampling_dy; - /*printf("C: component 0 initialised: x0=%d, y0=%d, w=%d, h=%d, sgnd=%d, bpp=%d, dx=%d, dy=%d, color_space=%d\n", cmptparm[0].x0, cmptparm[0].y0, cmptparm[0].w, - cmptparm[0].h, cmptparm[0].sgnd, cmptparm[0].bpp, cmptparm[0].dx, cmptparm[0].dy, color_space);*/ - } else { - for(i = 0; i < numcomps; i++) { - cmptparm[i].prec = 8; - cmptparm[i].bpp = 8; - cmptparm[i].sgnd = 0; - cmptparm[i].dx = parameters->subsampling_dx; - cmptparm[i].dy = parameters->subsampling_dy; - cmptparm[i].w = w; - cmptparm[i].h = h; - } - } - - /* create the image */ - image = opj_image_create(numcomps, &cmptparm[0], color_space); - - if (!image) - return NULL; - - if (depth <=16) { - image->numcomps=1; - } else { - image->numcomps = 3; - } - - /* set image offset and reference grid */ - image->x0 = cmptparm[0].x0; - image->y0 = cmptparm[0].x0; - image->x1 = cmptparm[0].w; - image->y1 = cmptparm[0].h; - - /* set image data */ - for (compno=0; compnocomps[compno]; - max = -100000; - if (depth == 8) { - fid = (*env)->GetFieldID(env, cls,"image8", "[B"); // byteArray [] - jba = (*env)->GetObjectField(env, obj, fid); - len = (*env)->GetArrayLength(env, jba); - - jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, &isCopy); - //printf("C: before transfering 8 bpp image\n"); - if (comp->sgnd) { - for(i=0; i< len;i++) { - comp->data[i] = (char) jbBody[i]; - if (comp->data[i] > max) max = comp->data[i]; - } - } else { - for(i=0; i< len;i++) { - comp->data[i] = (unsigned char) jbBody[i]; - if (comp->data[i] > max) max = comp->data[i]; - } - } - (*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0); - } else if(depth == 16) { - fid = (*env)->GetFieldID(env, cls,"image16", "[S"); // shortArray [] - jsa = (*env)->GetObjectField(env, obj, fid); - len = (*env)->GetArrayLength(env, jsa); - - jsBody = (*env)->GetPrimitiveArrayCritical(env, jsa, &isCopy); - //printf("C: before transfering 16 bpp image\n"); - if (comp->sgnd) { // Special behaviour to deal with signed elements ?? - comp->data[i] = (short) jsBody[i]; - for(i=0; i< len;i++) { - if (comp->data[i] > max) max = comp->data[i]; - } - } else { - for(i=0; i< len;i++) { - comp->data[i] = (unsigned short) jsBody[i]; - if (comp->data[i] > max) max = comp->data[i]; - } - } - (*env)->ReleasePrimitiveArrayCritical(env, jsa, jsBody, 0); - } else if (depth == 24) { - fid = (*env)->GetFieldID(env, cls,"image24", "[I"); // intArray [] - jia = (*env)->GetObjectField(env, obj, fid); - len = (*env)->GetArrayLength(env, jia); - shift = compno*8; - - jiBody = (*env)->GetPrimitiveArrayCritical(env, jia, &isCopy); - //printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd); - if (comp->sgnd) { // Special behaviour to deal with signed elements ?? XXXXX - for(i=0; i< len;i++) { - comp->data[i] = ( ((int) jiBody[i]) & (0xFF << shift) ) >> shift; - if (comp->data[i] > max) max = comp->data[i]; - } - } else { - for(i=0; i< len;i++) { - comp->data[i] = ( ((unsigned int) jiBody[i]) & (0xFF << shift) ) >> shift; - if (comp->data[i] > max) max = comp->data[i]; - } - } - (*env)->ReleasePrimitiveArrayCritical(env, jia, jiBody, 0); - } - comp->bpp = int_floorlog2(max)+1; - comp->prec = comp->bpp; - //printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp); - } - return image; -} - - -/* -------------------------------------------------------------------------- - -------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/ -JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K(JNIEnv *env, jobject obj, jobjectArray javaParameters) { - int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */ - char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */ - bool bSuccess; - opj_cparameters_t parameters; /* compression parameters */ - img_fol_t img_fol; - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *image = NULL; - int i,j,num_images; - int imageno; - opj_codestream_info_t cstr_info; /* Codestream information structure */ - char indexfilename[OPJ_PATH_LEN]; /* index file name */ - - int* compressed_index = NULL; - int compressed_index_size=-1; - // ==> Access variables to the Java member variables - jsize arraySize; - jclass cls; - jobject object; - jboolean isCopy; - jfieldID fid; - jbyteArray jba; - jbyte *jbBody; - callback_variables_t msgErrorCallback_vars; - // <== access variable to the Java member variables. - - // For the encoding and storage into the file - opj_cinfo_t* cinfo; - int codestream_length; - opj_cio_t *cio = NULL; - FILE *f = NULL; - - // JNI reference to the calling class - cls = (*env)->GetObjectClass(env, obj); - - // Pointers to be able to call a Java method for all the info and error messages - msgErrorCallback_vars.env = env; - msgErrorCallback_vars.jobj = &obj; - msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V"); - msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V"); - - arraySize = (*env)->GetArrayLength(env, javaParameters); - argc = (int) arraySize +1; - argv = malloc(argc*sizeof(char*)); - argv[0] = "ProgramName.exe"; // The program name: useless - j=0; - for (i=1; iGetObjectArrayElement(env, javaParameters, i-1); - argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy); - } - - /*printf("C: "); - for (i=0; iReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]); - return -1; - } - - // Release the Java arguments array - for (i=1; iReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]); - - if (parameters.cp_cinema){ - cinema_parameters(¶meters); - } - - - /* Create comment for codestream */ - if(parameters.cp_comment == NULL) { - const char comment[] = "Created by JavaOpenJPEG version "; - const size_t clen = strlen(comment); - const char *version = opj_version(); -/* UniPG>> */ -#ifdef USE_JPWL - parameters.cp_comment = (char*)malloc(clen+strlen(version)+11); - sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version); -#else - parameters.cp_comment = (char*)malloc(clen+strlen(version)+1); - sprintf(parameters.cp_comment,"%s%s", comment, version); -#endif -/* <numcomps == 3 ? 1 : 0; - - if(parameters.cp_cinema){ - cinema_setup_encoder(¶meters,image,&img_fol); - } - - /* encode the destination image */ - /* ---------------------------- */ - /* get a J2K compressor handle */ - if (parameters.cod_format == J2K_CFMT) { /* J2K format output */ - cinfo = opj_create_compress(CODEC_J2K); - } else { /* JP2 format output */ - cinfo = opj_create_compress(CODEC_JP2); - } - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, &msgErrorCallback_vars); - - /* setup the encoder parameters using the current image and user parameters */ - opj_setup_encoder(cinfo, ¶meters, image); - - /* open a byte stream for writing */ - /* allocate memory for all tiles */ - cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0); - - /* encode the image */ - bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info); - printf("C: after opj_encode_with_info\n"); - if (!bSuccess) { - opj_cio_close(cio); - fprintf(stderr, "failed to encode image\n"); - return -1; - } - codestream_length = cio_tell(cio); - - /* write the index on disk, if needed (-x 'filename') */ - if (*indexfilename) { - bSuccess = write_index_file(&cstr_info, indexfilename); - if (bSuccess) { - fprintf(stderr, "Failed to output index file into [%s]\n", indexfilename); - } - } - - compressed_index = create_index_into_byte_array(&cstr_info, &compressed_index_size); - /* Allocates the Java compressedIndex byte[] and sends this index into the Java object */ - fid = (*env)->GetFieldID(env, cls,"compressedIndex", "[B"); - jba = (*env)->NewByteArray(env, compressed_index_size+1); - jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, 0); - memcpy(jbBody, compressed_index, compressed_index_size); - (*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0); - (*env)->SetObjectField(env, obj, fid, jba); - free(compressed_index); - - /* write the generated codestream to disk ? */ - if (parameters.outfile[0]!='\0') { - f = fopen(parameters.outfile, "wb"); - if (!f) { - fprintf(stderr, "failed to open [%s] for writing\n", parameters.outfile); - return -1; - } - fwrite(cio->buffer, 1, codestream_length, f); - fclose(f); - fprintf(stdout,"Generated outfile [%s]\n",parameters.outfile); - } - - /* Write the generated codestream to the Java pre-allocated compressedStream byte[] */ - fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B"); - jba = (*env)->GetObjectField(env, obj, fid); - jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, 0); - memcpy(jbBody, cio->buffer, codestream_length); - (*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0); - - /* close and free the byte stream */ - opj_cio_close(cio); - - /* free remaining compression structures */ - opj_destroy_compress(cinfo); - opj_destroy_cstr_info(&cstr_info); - - /* free image data */ - opj_image_destroy(image); - } - - /* free user parameters structure */ - if(parameters.cp_comment) free(parameters.cp_comment); - if(parameters.cp_matrice) free(parameters.cp_matrice); - - return codestream_length; -} diff --git a/JavaOpenJPEG/JavaOpenJPEG.dsp b/JavaOpenJPEG/JavaOpenJPEG.dsp deleted file mode 100644 index 389ef7a2..00000000 --- a/JavaOpenJPEG/JavaOpenJPEG.dsp +++ /dev/null @@ -1,110 +0,0 @@ -# Microsoft Developer Studio Project File - Name="image_to_j2k" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=image_to_j2k - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "image_to_j2k.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "image_to_j2k.mak" CFG="image_to_j2k - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "image_to_j2k - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "image_to_j2k - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "image_to_j2k - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "image_to_j2k - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "image_to_j2k - Win32 Release" -# Name "image_to_j2k - Win32 Debug" -# Begin Source File - -SOURCE=.\convert.c -# End Source File -# Begin Source File - -SOURCE=.\convert.h -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=.\image_to_j2k.c -# End Source File -# End Target -# End Project diff --git a/JavaOpenJPEG/JavaOpenJPEG.dsw b/JavaOpenJPEG/JavaOpenJPEG.dsw deleted file mode 100644 index fd19c260..00000000 --- a/JavaOpenJPEG/JavaOpenJPEG.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "image_to_j2k"=.\image_to_j2k.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/JavaOpenJPEG/JavaOpenJPEG.vcproj b/JavaOpenJPEG/JavaOpenJPEG.vcproj deleted file mode 100644 index 06b507de..00000000 --- a/JavaOpenJPEG/JavaOpenJPEG.vcproj +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JavaOpenJPEG/JavaOpenJPEGDecoder.c b/JavaOpenJPEG/JavaOpenJPEGDecoder.c deleted file mode 100644 index a33fe9db..00000000 --- a/JavaOpenJPEG/JavaOpenJPEGDecoder.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe - * Copyright (c) 2005, Herve Drolon, FreeImage Team - * Copyright (c) 2006-2007, Parvatha Elangovan - * Copyright (c) 2007, Patrick Piscaglia (Telemis) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include -#include -#include -#include -#include - -#include "openjpeg.h" -#include "compat/getopt.h" -#include "convert.h" -#include "dirent.h" -#include "org_openJpeg_OpenJPEGJavaDecoder.h" - -#ifndef WIN32 -#define stricmp strcasecmp -#define strnicmp strncasecmp -#endif - -/* ----------------------------------------------------------------------- */ - -#define J2K_CFMT 0 -#define JP2_CFMT 1 -#define JPT_CFMT 2 - -#define PXM_DFMT 10 -#define PGX_DFMT 11 -#define BMP_DFMT 12 -#define YUV_DFMT 13 -#define TIF_DFMT 14 -#define RAW_DFMT 15 -#define TGA_DFMT 16 - -/* ----------------------------------------------------------------------- */ - -typedef struct callback_variables { - JNIEnv *env; - /** 'jclass' object used to call a Java method from the C */ - jobject *jobj; - /** 'jclass' object used to call a Java method from the C */ - jmethodID message_mid; - jmethodID error_mid; -} callback_variables_t; - -typedef struct dircnt{ - /** Buffer for holding images read from Directory*/ - char *filename_buf; - /** Pointer to the buffer*/ - char **filename; -}dircnt_t; - - -typedef struct img_folder{ - /** The directory path of the folder containing input images*/ - char *imgdirpath; - /** Output format*/ - char *out_format; - /** Enable option*/ - char set_imgdir; - /** Enable Cod Format for output*/ - char set_out_format; - -}img_fol_t; - - -void decode_help_display() { - fprintf(stdout,"HELP\n----\n\n"); - fprintf(stdout,"- the -h option displays this help information on screen\n\n"); - -/* UniPG>> */ - fprintf(stdout,"List of parameters for the JPEG 2000 " -#ifdef USE_JPWL - "+ JPWL " -#endif /* USE_JPWL */ - "decoder:\n"); -/* < \n"); - fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP format\n"); - fprintf(stdout," -i \n"); - fprintf(stdout," REQUIRED only if an Input image directory not specified\n"); - fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n"); - fprintf(stdout," is identified based on its suffix.\n"); - fprintf(stdout," -o \n"); - fprintf(stdout," REQUIRED\n"); - fprintf(stdout," Currently accepts PGM-files, PPM-files, PNM-files, PGX-files and\n"); - fprintf(stdout," BMP-files. Binary data is written to the file (not ascii). If a PGX\n"); - fprintf(stdout," filename is given, there will be as many output files as there are\n"); - fprintf(stdout," components: an indice starting from 0 will then be appended to the\n"); - fprintf(stdout," output filename, just before the \"pgx\" extension. If a PGM filename\n"); - fprintf(stdout," is given and there are more than one component, only the first component\n"); - fprintf(stdout," will be written to the file.\n"); - fprintf(stdout," -r \n"); - fprintf(stdout," Set the number of highest resolution levels to be discarded. The\n"); - fprintf(stdout," image resolution is effectively divided by 2 to the power of the\n"); - fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n"); - fprintf(stdout," smallest total number of decomposition levels among tiles.\n"); - fprintf(stdout," -l \n"); - fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n"); - fprintf(stdout," less quality layers than the specified number, all the quality layers\n"); - fprintf(stdout," are decoded.\n"); -/* UniPG>> */ -#ifdef USE_JPWL - fprintf(stdout," -W \n"); - fprintf(stdout," Activates the JPWL correction capability, if the codestream complies.\n"); - fprintf(stdout," Options can be a comma separated list of tokens:\n"); - fprintf(stdout," c, c=numcomps\n"); - fprintf(stdout," numcomps is the number of expected components in the codestream\n"); - fprintf(stdout," (search of first EPB rely upon this, default is %d)\n", JPWL_EXPECTED_COMPONENTS); -#endif /* USE_JPWL */ -/* <d_name)==0 || strcmp("..",content->d_name)==0 ) - continue; - num_images++; - } - return num_images; -} - -int load_images(dircnt_t *dirptr, char *imgdirpath){ - DIR *dir; - struct dirent* content; - int i = 0; - - /*Reading the input images from given input directory*/ - - dir= opendir(imgdirpath); - if(!dir){ - fprintf(stderr,"Could not open Folder %s\n",imgdirpath); - return 1; - }else { - fprintf(stderr,"Folder opened successfully\n"); - } - - while((content=readdir(dir))!=NULL){ - if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 ) - continue; - - strcpy(dirptr->filename[i],content->d_name); - i++; - } - return 0; -} - -int get_file_format(char *filename) { - unsigned int i; - static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "j2k", "jp2", "jpt", "j2c" }; - static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT }; - char * ext = strrchr(filename, '.'); - if (ext == NULL) - return -1; - ext++; - if(ext) { - for(i = 0; i < sizeof(format)/sizeof(*format); i++) { - if(strnicmp(ext, extension[i], 3) == 0) { - return format[i]; - } - } - } - - return -1; -} - - -/* -------------------------------------------------------------------------- */ - -int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) { - /* parse the command line */ - int totlen; - option_t long_option[]={ - {"ImgDir",REQ_ARG, NULL ,'y'}, - {"OutFor",REQ_ARG, NULL ,'O'}, - }; - -/* UniPG>> */ - const char optlist[] = "i:o:r:l:hx:" - -#ifdef USE_JPWL - "W:" -#endif /* USE_JPWL */ - ; - /*for (i=0; iset_out_format = 0; - reset_options_reading(); - - while (1) { - int c = getopt_long(argc, argv,optlist,long_option,totlen); - if (c == -1) - break; - switch (c) { - case 'i': /* input file */ - { - char *infile = optarg; - parameters->decod_format = get_file_format(infile); - switch(parameters->decod_format) { - case J2K_CFMT: - case JP2_CFMT: - case JPT_CFMT: - break; - default: - fprintf(stderr, - "!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n", - infile); - return 1; - } - strncpy(parameters->infile, infile, sizeof(parameters->infile)-1); - } - break; - - /* ----------------------------------------------------- */ - - case 'o': /* output file */ - { - char *outfile = optarg; - parameters->cod_format = get_file_format(outfile); - switch(parameters->cod_format) { - case PGX_DFMT: - case PXM_DFMT: - case BMP_DFMT: - case TIF_DFMT: - case RAW_DFMT: - case TGA_DFMT: - break; - default: - fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outfile); - return 1; - } - strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1); - } - break; - - /* ----------------------------------------------------- */ - - case 'O': /* output format */ - { - char outformat[50]; - char *of = optarg; - sprintf(outformat,".%s",of); - img_fol->set_out_format = 1; - parameters->cod_format = get_file_format(outformat); - switch(parameters->cod_format) { - case PGX_DFMT: - img_fol->out_format = "pgx"; - break; - case PXM_DFMT: - img_fol->out_format = "ppm"; - break; - case BMP_DFMT: - img_fol->out_format = "bmp"; - break; - case TIF_DFMT: - img_fol->out_format = "tif"; - break; - case RAW_DFMT: - img_fol->out_format = "raw"; - break; - case TGA_DFMT: - img_fol->out_format = "raw"; - break; - default: - fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat); - return 1; - break; - } - } - break; - - /* ----------------------------------------------------- */ - - - case 'r': /* reduce option */ - { - sscanf(optarg, "%d", ¶meters->cp_reduce); - } - break; - - /* ----------------------------------------------------- */ - - - case 'l': /* layering option */ - { - sscanf(optarg, "%d", ¶meters->cp_layer); - } - break; - - /* ----------------------------------------------------- */ - - case 'h': /* display an help description */ - decode_help_display(); - return 1; - - /* ------------------------------------------------------ */ - - case 'y': /* Image Directory path */ - { - img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1); - strcpy(img_fol->imgdirpath,optarg); - img_fol->set_imgdir=1; - } - break; - /* ----------------------------------------------------- */ -/* UniPG>> */ -#ifdef USE_JPWL - - case 'W': /* activate JPWL correction */ - { - char *token = NULL; - - token = strtok(optarg, ","); - while(token != NULL) { - - /* search expected number of components */ - if (*token == 'c') { - - static int compno; - - compno = JPWL_EXPECTED_COMPONENTS; /* predefined no. of components */ - - if(sscanf(token, "c=%d", &compno) == 1) { - /* Specified */ - if ((compno < 1) || (compno > 256)) { - fprintf(stderr, "ERROR -> invalid number of components c = %d\n", compno); - return 1; - } - parameters->jpwl_exp_comps = compno; - - } else if (!strcmp(token, "c")) { - /* default */ - parameters->jpwl_exp_comps = compno; /* auto for default size */ - - } else { - fprintf(stderr, "ERROR -> invalid components specified = %s\n", token); - return 1; - }; - } - - /* search maximum number of tiles */ - if (*token == 't') { - - static int tileno; - - tileno = JPWL_MAXIMUM_TILES; /* maximum no. of tiles */ - - if(sscanf(token, "t=%d", &tileno) == 1) { - /* Specified */ - if ((tileno < 1) || (tileno > JPWL_MAXIMUM_TILES)) { - fprintf(stderr, "ERROR -> invalid number of tiles t = %d\n", tileno); - return 1; - } - parameters->jpwl_max_tiles = tileno; - - } else if (!strcmp(token, "t")) { - /* default */ - parameters->jpwl_max_tiles = tileno; /* auto for default size */ - - } else { - fprintf(stderr, "ERROR -> invalid tiles specified = %s\n", token); - return 1; - }; - } - - /* next token or bust */ - token = strtok(NULL, ","); - }; - parameters->jpwl_correct = true; - fprintf(stdout, "JPWL correction capability activated\n"); - fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps); - } - break; -#endif /* USE_JPWL */ -/* < this option is not valid \"-%c %s\"\n",c, optarg); - break; - } - } - - /* No check for possible errors before the -i and -o options are of course not mandatory*/ - - return 0; -} - -/* -------------------------------------------------------------------------- */ - -/** -error callback returning the message to Java andexpecting a callback_variables_t client object -*/ -void error_callback(const char *msg, void *client_data) { - callback_variables_t* vars = (callback_variables_t*) client_data; - JNIEnv *env = vars->env; - jstring jbuffer; - - jbuffer = (*env)->NewStringUTF(env, msg); - (*env)->ExceptionClear(env); - (*env)->CallVoidMethod(env, *(vars->jobj), vars->error_mid, jbuffer); - - if ((*env)->ExceptionOccurred(env)) { - fprintf(stderr,"C: Exception during call back method\n"); - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - (*env)->DeleteLocalRef(env, jbuffer); -} -/** -warning callback returning the message to Java andexpecting a callback_variables_t client object -*/ -void warning_callback(const char *msg, void *client_data) { - callback_variables_t* vars = (callback_variables_t*) client_data; - JNIEnv *env = vars->env; - jstring jbuffer; - - jbuffer = (*env)->NewStringUTF(env, msg); - (*env)->ExceptionClear(env); - (*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer); - - if ((*env)->ExceptionOccurred(env)) { - fprintf(stderr,"C: Exception during call back method\n"); - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - (*env)->DeleteLocalRef(env, jbuffer); -} -/** -information callback returning the message to Java andexpecting a callback_variables_t client object -*/ -void info_callback(const char *msg, void *client_data) { - callback_variables_t* vars = (callback_variables_t*) client_data; - JNIEnv *env = vars->env; - jstring jbuffer; - - jbuffer = (*env)->NewStringUTF(env, msg); - (*env)->ExceptionClear(env); - (*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer); - - if ((*env)->ExceptionOccurred(env)) { - fprintf(stderr,"C: Exception during call back method\n"); - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - (*env)->DeleteLocalRef(env, jbuffer); -} - - -/* -------------------------------------------------------------------------- - -------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/ -JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) { - int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */ - char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */ - opj_dparameters_t parameters; /* decompression parameters */ - img_fol_t img_fol; - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *image = NULL; - FILE *fsrc = NULL; - unsigned char *src = NULL; - int file_length; - int num_images; - int i,j,imageno; - opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ - opj_cio_t *cio = NULL; - int w,h; - long min_value, max_value; - short tempS; unsigned char tempUC, tempUC1, tempUC2; - // ==> Access variables to the Java member variables - jsize arraySize; - jclass cls; - jobject object; - jboolean isCopy; - jfieldID fid; - jbyteArray jba; - jshortArray jsa; - jintArray jia; - jbyte *jbBody, *ptrBBody; - jshort *jsBody, *ptrSBody; - jint *jiBody, *ptrIBody; - callback_variables_t msgErrorCallback_vars; - // <=== access variable to Java member variables */ - int *ptr, *ptr1, *ptr2; // <== To transfer the decoded image to Java - - /* configure the event callbacks */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - // JNI reference to the calling class - cls = (*env)->GetObjectClass(env, obj); - - // Pointers to be able to call a Java method for all the info and error messages - msgErrorCallback_vars.env = env; - msgErrorCallback_vars.jobj = &obj; - msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V"); - msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V"); - - // Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments. - arraySize = (*env)->GetArrayLength(env, javaParameters); - argc = (int) arraySize +1; - argv = malloc(argc*sizeof(char*)); - argv[0] = "ProgramName.exe"; // The program name: useless - j=0; - for (i=1; iGetObjectArrayElement(env, javaParameters, i-1); - argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy); - } - - /*printf("C: decoder params = "); - for (i=0; iReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]); - return -1; - } - // Release the Java arguments array - for (i=1; iReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]); - - num_images=1; - - // Get additional information from the Java object variables - fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I"); - parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid); - - /*Decoding image one by one*/ - for(imageno = 0; imageno < num_images ; imageno++) - { - image = NULL; - fprintf(stderr,"\n"); - - /* read the input file and put it in memory into the 'src' object, if the -i option is given in JavaParameters. - Implemented for debug purpose. */ - /* -------------------------------------------------------------- */ - if (parameters.infile && parameters.infile[0]!='\0') { - //printf("C: opening [%s]\n", parameters.infile); - fsrc = fopen(parameters.infile, "rb"); - if (!fsrc) { - fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile); - return 1; - } - fseek(fsrc, 0, SEEK_END); - file_length = ftell(fsrc); - fseek(fsrc, 0, SEEK_SET); - src = (unsigned char *) malloc(file_length); - fread(src, 1, file_length, fsrc); - fclose(fsrc); - //printf("C: %d bytes read from file\n",file_length); - } else { - // Preparing the transfer of the codestream from Java to C - //printf("C: before transfering codestream\n"); - fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B"); - jba = (*env)->GetObjectField(env, obj, fid); - file_length = (*env)->GetArrayLength(env, jba); - jbBody = (*env)->GetByteArrayElements(env, jba, &isCopy); - src = (unsigned char*)jbBody; - } - - /* decode the code-stream */ - /* ---------------------- */ - - switch(parameters.decod_format) { - case J2K_CFMT: - { - /* JPEG-2000 codestream */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_J2K); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); - - /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio); - if(!image) { - fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - return 1; - } - - /* close the byte stream */ - opj_cio_close(cio); - } - break; - - case JP2_CFMT: - { - /* JPEG 2000 compressed image data */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_JP2); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars); - - /* setup the decoder decoding parameters using the current image and user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); - - /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio); - if(!image) { - fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - return 1; - } - - /* close the byte stream */ - opj_cio_close(cio); - - } - break; - - case JPT_CFMT: - { - /* JPEG 2000, JPIP */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_JPT); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); - - /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio); - if(!image) { - fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - return 1; - } - - /* close the byte stream */ - opj_cio_close(cio); - } - break; - - default: - fprintf(stderr, "skipping file..\n"); - continue; - } - - /* free the memory containing the code-stream */ - if (parameters.infile && parameters.infile[0]!='\0') { - free(src); - } else { - (*env)->ReleaseByteArrayElements(env, jba, jbBody, 0); - } - src = NULL; - - /* create output image. - If the -o parameter is given in the JavaParameters, write the decoded version into a file. - Implemented for debug purpose. */ - /* ---------------------------------- */ - switch (parameters.cod_format) { - case PXM_DFMT: /* PNM PGM PPM */ - if (imagetopnm(image, parameters.outfile)) { - fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); - } - else { - fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); - } - break; - - case PGX_DFMT: /* PGX */ - if(imagetopgx(image, parameters.outfile)){ - fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); - } - else { - fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); - } - break; - - case BMP_DFMT: /* BMP */ - if(imagetobmp(image, parameters.outfile)){ - fprintf(stdout,"Outfile %s not generated\n",parameters.outfile); - } - else { - fprintf(stdout,"Generated Outfile %s\n",parameters.outfile); - } - break; - - } - - // ========= Return the image to the Java structure =============== -#ifdef CHECK_THRESHOLDS - printf("C: checking thresholds\n"); -#endif - // First compute the real with and height, in function of the resolutions decoded. - //wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor; - //hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor; - w = image->comps[0].w; - h = image->comps[0].h; - - if (image->numcomps==3) { // 3 components color image - ptr = image->comps[0].data; - ptr1 = image->comps[1].data; - ptr2 = image->comps[2].data; -#ifdef CHECK_THRESHOLDS - if (image->comps[0].sgnd) { - min_value = 0; - max_value = 255; - } else { - min_value = -128; - max_value = 127; - } -#endif - // Get the pointer to the Java structure where the data must be copied - fid = (*env)->GetFieldID(env, cls,"image24", "[I"); - jia = (*env)->GetObjectField(env, obj, fid); - jiBody = (*env)->GetIntArrayElements(env, jia, 0); - ptrIBody = jiBody; - printf("C: transfering image24: %d int to Java pointer=%d\n",image->numcomps*w*h, ptrIBody); - - for (i=0; i max_value) - tempUC=max_value; - if (tempUC1 < min_value) - tempUC1=min_value; - else if (tempUC1 > max_value) - tempUC1=max_value; - if (tempUC2 < min_value) - tempUC2=min_value; - else if (tempUC2 > max_value) - tempUC2=max_value; -#endif - *(ptrIBody++) = (int) ( (tempUC2<<16) + (tempUC1<<8) + tempUC ); - } - (*env)->ReleaseIntArrayElements(env, jia, jiBody, 0); - - } else { // 1 component 8 or 16 bpp image - ptr = image->comps[0].data; - printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h); - if (image->comps[0].prec<=8) { - fid = (*env)->GetFieldID(env, cls,"image8", "[B"); - jba = (*env)->GetObjectField(env, obj, fid); - jbBody = (*env)->GetByteArrayElements(env, jba, 0); - ptrBBody = jbBody; -#ifdef CHECK_THRESHOLDS - if (image->comps[0].sgnd) { - min_value = 0; - max_value = 255; - } else { - min_value = -128; - max_value = 127; - } -#endif - //printf("C: transfering %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody); - for (i=0; i max_value) - tempUC = max_value; -#endif - *(ptrBBody++) = tempUC; - } - (*env)->ReleaseByteArrayElements(env, jba, jbBody, 0); - printf("C: image8 transfered to Java\n"); - } else { - fid = (*env)->GetFieldID(env, cls,"image16", "[S"); - jsa = (*env)->GetObjectField(env, obj, fid); - jsBody = (*env)->GetShortArrayElements(env, jsa, 0); - ptrSBody = jsBody; -#ifdef CHECK_THRESHOLDS - if (image->comps[0].sgnd) { - min_value = 0; - max_value = 65535; - } else { - min_value = -32768; - max_value = 32767; - } - printf("C: minValue = %d, maxValue = %d\n", min_value, max_value); -#endif - printf("C: transfering %d shorts to Java image16 pointer = %d\n", w*h,ptrSBody); - for (i=0; i max_value) { - printf("C: value %d truncated to %d\n", tempS, max_value); - tempS = max_value; - } -#endif - *(ptrSBody++) = tempS; - } - (*env)->ReleaseShortArrayElements(env, jsa, jsBody, 0); - printf("C: image16 completely filled\n"); - } - } - - - /* free remaining structures */ - if(dinfo) { - opj_destroy_decompress(dinfo); - } - /* free image data structure */ - opj_image_destroy(image); - - } - return 1; /* OK */ -} -//end main - diff --git a/JavaOpenJPEG/Makefile b/JavaOpenJPEG/Makefile deleted file mode 100644 index f38ff762..00000000 --- a/JavaOpenJPEG/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k - -CFLAGS = -O3 -lstdc++ # -g -p -pg - -all: j2k_to_image image_to_j2k - -j2k_to_image: j2k_to_image.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -image_to_j2k: image_to_j2k.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -clean: - rm -f j2k_to_image image_to_j2k diff --git a/JavaOpenJPEG/java sources/org/openJpeg/OpenJPEGJavaDecoder.java b/JavaOpenJPEG/java sources/org/openJpeg/OpenJPEGJavaDecoder.java deleted file mode 100644 index 0bacc84f..00000000 --- a/JavaOpenJPEG/java sources/org/openJpeg/OpenJPEGJavaDecoder.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -package org.openJpeg; - -import java.util.Vector; - -/** This class decodes one J2K codestream into an image (width + height + depth + pixels[], - * using the OpenJPEG.org library. - * To be able to log messages, the called must register a IJavaJ2KDecoderLogger object. - */ -public class OpenJPEGJavaDecoder { - - public interface IJavaJ2KDecoderLogger { - public void logDecoderMessage(String message); - public void logDecoderError(String message); - } - - private static boolean isInitialized = false; - - // ===== decompression parameters =============> - // These value may be changed for each image - private String[] decoder_arguments = null; - /** number of resolutions decompositions */ - private int nbResolutions = -1; - /** the quality layers */ - private int[] layers = null; - - /** Contains the 8 bpp version of the image. May NOT be filled together with image16 or image24.

- * We store in Java the 8 or 16 bpp version of the image while the decoder uses a 32 bpp version, because

    - *
  • the storage capacity required is smaller - *
  • the transfer Java <-- C will be faster - *
  • the conversion byte/short ==> int will be done faster by the C - *
*/ - private byte[] image8 = null; - /** Contains the 16 bpp version of the image. May NOT be filled together with image8 or image24*/ - private short[] image16 = null; - /** Contains the 24 bpp version of the image. May NOT be filled together with image8 or image16 */ - private int[] image24 = null; - /** Holds the J2K compressed bytecode to decode */ - private byte compressedStream[] = null; - /** Holds the compressed version of the index file, to be used by the decoder */ - private byte compressedIndex[] = null; - /** Width and Height of the image */ - private int width = -1; - private int height = -1; - private int depth = -1; - /** This parameter is never used in Java but is read by the C library to know the number of resolutions to skip when decoding, - * i.e. if there are 5 resolutions and skipped=1 ==> decode until resolution 4. */ - private int skippedResolutions = 0; - - private Vector loggers = new Vector(); - - - public OpenJPEGJavaDecoder(String openJPEGlibraryFullPathAndName, IJavaJ2KDecoderLogger messagesAndErrorsLogger) throws ExceptionInInitializerError - { - this(openJPEGlibraryFullPathAndName); - loggers.addElement(messagesAndErrorsLogger); - } - - public OpenJPEGJavaDecoder(String openJPEGlibraryFullPathAndName) throws ExceptionInInitializerError - { - if (!isInitialized) { - try { - System.load(openJPEGlibraryFullPathAndName); - isInitialized = true; - } catch (Throwable t) { - throw new ExceptionInInitializerError("OpenJPEG Java Decoder: probably impossible to find the C library"); - } - } - } - - public void addLogger(IJavaJ2KDecoderLogger messagesAndErrorsLogger) { - loggers.addElement(messagesAndErrorsLogger); - } - - public void removeLogger(IJavaJ2KDecoderLogger messagesAndErrorsLogger) { - loggers.removeElement(messagesAndErrorsLogger); - } - - public int decodeJ2KtoImage() { - if ((image16 == null || (image16 != null && image16.length != width*height)) && (depth==-1 || depth==16)) { - image16 = new short[width*height]; - logMessage("OpenJPEGJavaDecoder.decompressImage: image16 length = " + image16.length + " (" + width + " x " + height + ") "); - } - if ((image8 == null || (image8 != null && image8.length != width*height)) && (depth==-1 || depth==8)) { - image8 = new byte[width*height]; - logMessage("OpenJPEGJavaDecoder.decompressImage: image8 length = " + image8.length + " (" + width + " x " + height + ") "); - } - if ((image24 == null || (image24 != null && image24.length != width*height)) && (depth==-1 || depth==24)) { - image24 = new int[width*height]; - logMessage("OpenJPEGJavaDecoder.decompressImage: image24 length = " + image24.length + " (" + width + " x " + height + ") "); - } - - String[] arguments = new String[0 + (decoder_arguments != null ? decoder_arguments.length : 0)]; - int offset = 0; - if (decoder_arguments != null) { - for (int i=0; i - // These value may be changed for each image - private String[] encoder_arguments = null; - /** number of resolutions decompositions */ - private int nbResolutions = -1; - /** the quality layers, expressed as compression rate */ - private float[] ratioLayers = null; - /** the quality layers, expressed as PSNR values. This variable, if defined, has priority over the ratioLayers variable */ - private float[] psnrLayers = null; - - /** Contains the 8 bpp version of the image. May NOT be filled together with image16 or image24.

- * We store the 8 or 16 bpp version of the original image while the encoder uses a 32 bpp version, because

    - *
  • the storage capacity required is smaller - *
  • the transfer Java --> C will be faster - *
  • the conversion byte/short ==> int will be done faster by the C - *
*/ - private byte[] image8 = null; - /** Contains the 16 bpp version of the image. May NOT be filled together with image8 or image24*/ - private short[] image16 = null; - /** Contains the 24 bpp version of the image. May NOT be filled together with image8 or image16 */ - private int[] image24 = null; - /** Holds the result of the compression, i.e. the J2K compressed bytecode */ - private byte compressedStream[] = null; - /** Holds the compressed stream length, which may be smaller than compressedStream.length if this byte[] is pre-allocated */ - private long compressedStreamLength = -1; - /** Holds the compressed version of the index file, returned by the encoder */ - private byte compressedIndex[] = null; - /** Width and Height of the image */ - private int width = -1; - private int height = -1; - private int depth = -1; - /** Tile size. We suppose the same size for the horizontal and vertical tiles. - * If size == -1 ==> no tiling */ - private int tileSize = -1; - // <===== Compression parameters ============= - - private Vector loggers = new Vector(); - - public OpenJPEGJavaEncoder(String openJPEGlibraryFullPathAndName, IJavaJ2KEncoderLogger messagesAndErrorsLogger) throws ExceptionInInitializerError - { - this(openJPEGlibraryFullPathAndName); - loggers.addElement(messagesAndErrorsLogger); - } - - public OpenJPEGJavaEncoder(String openJPEGlibraryFullPathAndName) throws ExceptionInInitializerError - { - if (!isInitialized) { - try { - String absolutePath = (new File(openJPEGlibraryFullPathAndName)).getCanonicalPath(); - System.load(absolutePath); - isInitialized = true; - } catch (Throwable t) { - t.printStackTrace(); - throw new ExceptionInInitializerError("OpenJPEG Java Encoder: probably impossible to find the C library"); - } - } - } - - public void addLogger(IJavaJ2KEncoderLogger messagesAndErrorsLogger) { - loggers.addElement(messagesAndErrorsLogger); - } - - public void removeLogger(IJavaJ2KEncoderLogger messagesAndErrorsLogger) { - loggers.removeElement(messagesAndErrorsLogger); - } - - /** This method compresses the given image.

- * It returns the compressed J2K codestream into the compressedStream byte[].

- * It also returns the compression index as a compressed form, into the compressedIndex byte[].

- * One of the image8, image16 or image24 arrays must be correctly initialized and filled.

- * The width, height and depth variables must be correctly filled.

- * The nbResolutions, nbLayers and if needed the float[] psnrLayers or ratioLayers must also be filled before calling this method. - */ - public void encodeImageToJ2K() { - // Need to allocate / reallocate the compressed stream buffer ? (size = max possible size = original image size) - if (compressedStream== null || (compressedStream.length != width*height*depth/8)) { - logMessage("OpenJPEGJavaEncoder.encodeImageToJ2K: (re-)allocating " + (width*height*depth/8) + " bytes for the compressedStream"); - compressedStream = new byte[width*height*depth/8]; - } - // Arguments = - // - number of resolutions "-n 5" : 2 - // - size of tile "-t 512,512" : 2 - // - // Image width, height, depth and pixels are directly fetched by C from the Java class - int nbArgs = 2 + (tileSize == -1 ? 0 : 2) + (encoder_arguments != null ? encoder_arguments.length : 0); - if (psnrLayers != null && psnrLayers.length>0 && psnrLayers[0] != 0) - // If psnrLayers is defined and doesn't just express "lossless" - nbArgs += 2; - else if (ratioLayers != null && ratioLayers.length>0 && ratioLayers[0]!=0.0) - nbArgs += 2; - String[] arguments = new String[nbArgs]; - int offset = 0; - arguments[offset] = "-n"; arguments[offset+1] = "" + nbResolutions; offset += 2; - if (tileSize!= -1) { - arguments[offset++] = "-t"; - arguments[offset++] = "" + tileSize + "," + tileSize; - } - // If PSNR layers are defined, use them to encode the images - if (psnrLayers != null && psnrLayers.length>0 && psnrLayers[0]!=-1) { - arguments[offset++] = "-q"; - String s = ""; - for (int i=0; i0 && ratioLayers[0]!=0.0) { - // Specify quality ratioLayers, as compression ratios - arguments[offset++] = "-r"; - String s = ""; - for (int i=0; i - * - * JNIEXPORT void JNICALL - * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics) - * { - * JAWT awt; - * JAWT_DrawingSurface* ds; - * JAWT_DrawingSurfaceInfo* dsi; - * JAWT_Win32DrawingSurfaceInfo* dsi_win; - * jboolean result; - * jint lock; - * - * // Get the AWT - * awt.version = JAWT_VERSION_1_3; - * result = JAWT_GetAWT(env, &awt); - * assert(result != JNI_FALSE); - * - * // Get the drawing surface - * ds = awt.GetDrawingSurface(env, canvas); - * assert(ds != NULL); - * - * // Lock the drawing surface - * lock = ds->Lock(ds); - * assert((lock & JAWT_LOCK_ERROR) == 0); - * - * // Get the drawing surface info - * dsi = ds->GetDrawingSurfaceInfo(ds); - * - * // Get the platform-specific drawing info - * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; - * - * ////////////////////////////// - * // !!! DO PAINTING HERE !!! // - * ////////////////////////////// - * - * // Free the drawing surface info - * ds->FreeDrawingSurfaceInfo(dsi); - * - * // Unlock the drawing surface - * ds->Unlock(ds); - * - * // Free the drawing surface - * awt.FreeDrawingSurface(ds); - * } - * - */ - -/* - * JAWT_Rectangle - * Structure for a native rectangle. - */ -typedef struct jawt_Rectangle { - jint x; - jint y; - jint width; - jint height; -} JAWT_Rectangle; - -struct jawt_DrawingSurface; - -/* - * JAWT_DrawingSurfaceInfo - * Structure for containing the underlying drawing information of a component. - */ -typedef struct jawt_DrawingSurfaceInfo { - /* - * Pointer to the platform-specific information. This can be safely - * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a - * JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details. - */ - void* platformInfo; - /* Cached pointer to the underlying drawing surface */ - struct jawt_DrawingSurface* ds; - /* Bounding rectangle of the drawing surface */ - JAWT_Rectangle bounds; - /* Number of rectangles in the clip */ - jint clipSize; - /* Clip rectangle array */ - JAWT_Rectangle* clip; -} JAWT_DrawingSurfaceInfo; - -#define JAWT_LOCK_ERROR 0x00000001 -#define JAWT_LOCK_CLIP_CHANGED 0x00000002 -#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004 -#define JAWT_LOCK_SURFACE_CHANGED 0x00000008 - -/* - * JAWT_DrawingSurface - * Structure for containing the underlying drawing information of a component. - * All operations on a JAWT_DrawingSurface MUST be performed from the same - * thread as the call to GetDrawingSurface. - */ -typedef struct jawt_DrawingSurface { - /* - * Cached reference to the Java environment of the calling thread. - * If Lock(), Unlock(), GetDrawingSurfaceInfo() or - * FreeDrawingSurfaceInfo() are called from a different thread, - * this data member should be set before calling those functions. - */ - JNIEnv* env; - /* Cached reference to the target object */ - jobject target; - /* - * Lock the surface of the target component for native rendering. - * When finished drawing, the surface must be unlocked with - * Unlock(). This function returns a bitmask with one or more of the - * following values: - * - * JAWT_LOCK_ERROR - When an error has occurred and the surface could not - * be locked. - * - * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed. - * - * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed. - * - * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed - */ - jint (JNICALL *Lock) - (struct jawt_DrawingSurface* ds); - /* - * Get the drawing surface info. - * The value returned may be cached, but the values may change if - * additional calls to Lock() or Unlock() are made. - * Lock() must be called before this can return a valid value. - * Returns NULL if an error has occurred. - * When finished with the returned value, FreeDrawingSurfaceInfo must be - * called. - */ - JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo) - (struct jawt_DrawingSurface* ds); - /* - * Free the drawing surface info. - */ - void (JNICALL *FreeDrawingSurfaceInfo) - (JAWT_DrawingSurfaceInfo* dsi); - /* - * Unlock the drawing surface of the target component for native rendering. - */ - void (JNICALL *Unlock) - (struct jawt_DrawingSurface* ds); -} JAWT_DrawingSurface; - -/* - * JAWT - * Structure for containing native AWT functions. - */ -typedef struct jawt { - /* - * Version of this structure. This must always be set before - * calling JAWT_GetAWT() - */ - jint version; - /* - * Return a drawing surface from a target jobject. This value - * may be cached. - * Returns NULL if an error has occurred. - * Target must be a java.awt.Component (should be a Canvas - * or Window for native rendering). - * FreeDrawingSurface() must be called when finished with the - * returned JAWT_DrawingSurface. - */ - JAWT_DrawingSurface* (JNICALL *GetDrawingSurface) - (JNIEnv* env, jobject target); - /* - * Free the drawing surface allocated in GetDrawingSurface. - */ - void (JNICALL *FreeDrawingSurface) - (JAWT_DrawingSurface* ds); - /* - * Since 1.4 - * Locks the entire AWT for synchronization purposes - */ - void (JNICALL *Lock)(JNIEnv* env); - /* - * Since 1.4 - * Unlocks the entire AWT for synchronization purposes - */ - void (JNICALL *Unlock)(JNIEnv* env); - /* - * Since 1.4 - * Returns a reference to a java.awt.Component from a native - * platform handle. On Windows, this corresponds to an HWND; - * on Solaris and Linux, this is a Drawable. For other platforms, - * see the appropriate machine-dependent header file for a description. - * The reference returned by this function is a local - * reference that is only valid in this environment. - * This function returns a NULL reference if no component could be - * found with matching platform information. - */ - jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); - -} JAWT; - -/* - * Get the AWT native structure. This function returns JNI_FALSE if - * an error occurs. - */ -_JNI_IMPORT_OR_EXPORT_ -jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); - -#define JAWT_VERSION_1_3 0x00010003 -#define JAWT_VERSION_1_4 0x00010004 - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* !_JAVASOFT_JAWT_H_ */ diff --git a/JavaOpenJPEG/java-jni/include/jdwpTransport.h b/JavaOpenJPEG/java-jni/include/jdwpTransport.h deleted file mode 100644 index 1d780092..00000000 --- a/JavaOpenJPEG/java-jni/include/jdwpTransport.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * @(#)jdwpTransport.h 1.7 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * Java Debug Wire Protocol Transport Service Provider Interface. - */ - -#ifndef JDWPTRANSPORT_H -#define JDWPTRANSPORT_H - -#include "jni.h" - -enum { - JDWPTRANSPORT_VERSION_1_0 = 0x00010000 -}; - -#ifdef __cplusplus -extern "C" { -#endif - -struct jdwpTransportNativeInterface_; - -struct _jdwpTransportEnv; - -#ifdef __cplusplus -typedef _jdwpTransportEnv jdwpTransportEnv; -#else -typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv; -#endif /* __cplusplus */ - -/* - * Errors. Universal errors with JVMTI/JVMDI equivalents keep the - * values the same. - */ -typedef enum { - JDWPTRANSPORT_ERROR_NONE = 0, - JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103, - JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110, - JDWPTRANSPORT_ERROR_INTERNAL = 113, - JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201, - JDWPTRANSPORT_ERROR_IO_ERROR = 202, - JDWPTRANSPORT_ERROR_TIMEOUT = 203, - JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204 -} jdwpTransportError; - - -/* - * Structure to define capabilities - */ -typedef struct { - unsigned int can_timeout_attach :1; - unsigned int can_timeout_accept :1; - unsigned int can_timeout_handshake :1; - unsigned int reserved3 :1; - unsigned int reserved4 :1; - unsigned int reserved5 :1; - unsigned int reserved6 :1; - unsigned int reserved7 :1; - unsigned int reserved8 :1; - unsigned int reserved9 :1; - unsigned int reserved10 :1; - unsigned int reserved11 :1; - unsigned int reserved12 :1; - unsigned int reserved13 :1; - unsigned int reserved14 :1; - unsigned int reserved15 :1; -} JDWPTransportCapabilities; - - -/* - * Structures to define packet layout. - * - * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html - */ - -enum { - JDWPTRANSPORT_FLAGS_NONE = 0x0, - JDWPTRANSPORT_FLAGS_REPLY = 0x80 -}; - -typedef struct { - jint len; - jint id; - jbyte flags; - jbyte cmdSet; - jbyte cmd; - jbyte *data; -} jdwpCmdPacket; - -typedef struct { - jint len; - jint id; - jbyte flags; - jshort errorCode; - jbyte *data; -} jdwpReplyPacket; - -typedef struct { - union { - jdwpCmdPacket cmd; - jdwpReplyPacket reply; - } type; -} jdwpPacket; - -/* - * JDWP functions called by the transport. - */ -typedef struct jdwpTransportCallback { - void *(*alloc)(jint numBytes); /* Call this for all allocations */ - void (*free)(void *buffer); /* Call this for all deallocations */ -} jdwpTransportCallback; - -typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm, - jdwpTransportCallback *callback, - jint version, - jdwpTransportEnv** env); - - - -/* Function Interface */ - -struct jdwpTransportNativeInterface_ { - /* 1 : RESERVED */ - void *reserved1; - - /* 2 : Get Capabilities */ - jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env, - JDWPTransportCapabilities *capabilities_ptr); - - /* 3 : Attach */ - jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env, - const char* address, - jlong attach_timeout, - jlong handshake_timeout); - - /* 4: StartListening */ - jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env, - const char* address, - char** actual_address); - - /* 5: StopListening */ - jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env); - - /* 6: Accept */ - jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env, - jlong accept_timeout, - jlong handshake_timeout); - - /* 7: IsOpen */ - jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env); - - /* 8: Close */ - jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env); - - /* 9: ReadPacket */ - jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env, - jdwpPacket *pkt); - - /* 10: Write Packet */ - jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env, - const jdwpPacket* pkt); - - /* 11: GetLastError */ - jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env, - char** error); - -}; - - -/* - * Use inlined functions so that C++ code can use syntax such as - * env->Attach("mymachine:5000", 10*1000, 0); - * - * rather than using C's :- - * - * (*env)->Attach(env, "mymachine:5000", 10*1000, 0); - */ -struct _jdwpTransportEnv { - const struct jdwpTransportNativeInterface_ *functions; -#ifdef __cplusplus - - jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) { - return functions->GetCapabilities(this, capabilities_ptr); - } - - jdwpTransportError Attach(const char* address, jlong attach_timeout, - jlong handshake_timeout) { - return functions->Attach(this, address, attach_timeout, handshake_timeout); - } - - jdwpTransportError StartListening(const char* address, - char** actual_address) { - return functions->StartListening(this, address, actual_address); - } - - jdwpTransportError StopListening(void) { - return functions->StopListening(this); - } - - jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) { - return functions->Accept(this, accept_timeout, handshake_timeout); - } - - jboolean IsOpen(void) { - return functions->IsOpen(this); - } - - jdwpTransportError Close(void) { - return functions->Close(this); - } - - jdwpTransportError ReadPacket(jdwpPacket *pkt) { - return functions->ReadPacket(this, pkt); - } - - jdwpTransportError WritePacket(const jdwpPacket* pkt) { - return functions->WritePacket(this, pkt); - } - - jdwpTransportError GetLastError(char** error) { - return functions->GetLastError(this, error); - } - - -#endif /* __cplusplus */ -}; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* JDWPTRANSPORT_H */ - diff --git a/JavaOpenJPEG/java-jni/include/jni.h b/JavaOpenJPEG/java-jni/include/jni.h deleted file mode 100644 index cb3baef5..00000000 --- a/JavaOpenJPEG/java-jni/include/jni.h +++ /dev/null @@ -1,1951 +0,0 @@ -/* - * @(#)jni.h 1.56 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * We used part of Netscape's Java Runtime Interface (JRI) as the starting - * point of our design and implementation. - */ - -/****************************************************************************** - * Java Runtime Interface - * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved. - *****************************************************************************/ - -#ifndef _JAVASOFT_JNI_H_ -#define _JAVASOFT_JNI_H_ - -#include -#include - -/* jni_md.h contains the machine-dependent typedefs for jbyte, jint - and jlong */ - -#include "jni_md.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * JNI Types - */ - -#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H - -typedef unsigned char jboolean; -typedef unsigned short jchar; -typedef short jshort; -typedef float jfloat; -typedef double jdouble; - -typedef jint jsize; - -#ifdef __cplusplus - -class _jobject {}; -class _jclass : public _jobject {}; -class _jthrowable : public _jobject {}; -class _jstring : public _jobject {}; -class _jarray : public _jobject {}; -class _jbooleanArray : public _jarray {}; -class _jbyteArray : public _jarray {}; -class _jcharArray : public _jarray {}; -class _jshortArray : public _jarray {}; -class _jintArray : public _jarray {}; -class _jlongArray : public _jarray {}; -class _jfloatArray : public _jarray {}; -class _jdoubleArray : public _jarray {}; -class _jobjectArray : public _jarray {}; - -typedef _jobject *jobject; -typedef _jclass *jclass; -typedef _jthrowable *jthrowable; -typedef _jstring *jstring; -typedef _jarray *jarray; -typedef _jbooleanArray *jbooleanArray; -typedef _jbyteArray *jbyteArray; -typedef _jcharArray *jcharArray; -typedef _jshortArray *jshortArray; -typedef _jintArray *jintArray; -typedef _jlongArray *jlongArray; -typedef _jfloatArray *jfloatArray; -typedef _jdoubleArray *jdoubleArray; -typedef _jobjectArray *jobjectArray; - -#else - -struct _jobject; - -typedef struct _jobject *jobject; -typedef jobject jclass; -typedef jobject jthrowable; -typedef jobject jstring; -typedef jobject jarray; -typedef jarray jbooleanArray; -typedef jarray jbyteArray; -typedef jarray jcharArray; -typedef jarray jshortArray; -typedef jarray jintArray; -typedef jarray jlongArray; -typedef jarray jfloatArray; -typedef jarray jdoubleArray; -typedef jarray jobjectArray; - -#endif - -typedef jobject jweak; - -typedef union jvalue { - jboolean z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong j; - jfloat f; - jdouble d; - jobject l; -} jvalue; - -struct _jfieldID; -typedef struct _jfieldID *jfieldID; - -struct _jmethodID; -typedef struct _jmethodID *jmethodID; - -#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */ - -/* - * jboolean constants - */ - -#define JNI_FALSE 0 -#define JNI_TRUE 1 - -/* - * possible return values for JNI functions. - */ - -#define JNI_OK 0 /* success */ -#define JNI_ERR (-1) /* unknown error */ -#define JNI_EDETACHED (-2) /* thread detached from the VM */ -#define JNI_EVERSION (-3) /* JNI version error */ -#define JNI_ENOMEM (-4) /* not enough memory */ -#define JNI_EEXIST (-5) /* VM already created */ -#define JNI_EINVAL (-6) /* invalid arguments */ - -/* - * used in ReleaseScalarArrayElements - */ - -#define JNI_COMMIT 1 -#define JNI_ABORT 2 - -/* - * used in RegisterNatives to describe native method name, signature, - * and function pointer. - */ - -typedef struct { - char *name; - char *signature; - void *fnPtr; -} JNINativeMethod; - -/* - * JNI Native Method Interface. - */ - -struct JNINativeInterface_; - -struct JNIEnv_; - -#ifdef __cplusplus -typedef JNIEnv_ JNIEnv; -#else -typedef const struct JNINativeInterface_ *JNIEnv; -#endif - -/* - * JNI Invocation Interface. - */ - -struct JNIInvokeInterface_; - -struct JavaVM_; - -#ifdef __cplusplus -typedef JavaVM_ JavaVM; -#else -typedef const struct JNIInvokeInterface_ *JavaVM; -#endif - -struct JNINativeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - void *reserved3; - jint (JNICALL *GetVersion)(JNIEnv *env); - - jclass (JNICALL *DefineClass) - (JNIEnv *env, const char *name, jobject loader, const jbyte *buf, - jsize len); - jclass (JNICALL *FindClass) - (JNIEnv *env, const char *name); - - jmethodID (JNICALL *FromReflectedMethod) - (JNIEnv *env, jobject method); - jfieldID (JNICALL *FromReflectedField) - (JNIEnv *env, jobject field); - - jobject (JNICALL *ToReflectedMethod) - (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic); - - jclass (JNICALL *GetSuperclass) - (JNIEnv *env, jclass sub); - jboolean (JNICALL *IsAssignableFrom) - (JNIEnv *env, jclass sub, jclass sup); - - jobject (JNICALL *ToReflectedField) - (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic); - - jint (JNICALL *Throw) - (JNIEnv *env, jthrowable obj); - jint (JNICALL *ThrowNew) - (JNIEnv *env, jclass clazz, const char *msg); - jthrowable (JNICALL *ExceptionOccurred) - (JNIEnv *env); - void (JNICALL *ExceptionDescribe) - (JNIEnv *env); - void (JNICALL *ExceptionClear) - (JNIEnv *env); - void (JNICALL *FatalError) - (JNIEnv *env, const char *msg); - - jint (JNICALL *PushLocalFrame) - (JNIEnv *env, jint capacity); - jobject (JNICALL *PopLocalFrame) - (JNIEnv *env, jobject result); - - jobject (JNICALL *NewGlobalRef) - (JNIEnv *env, jobject lobj); - void (JNICALL *DeleteGlobalRef) - (JNIEnv *env, jobject gref); - void (JNICALL *DeleteLocalRef) - (JNIEnv *env, jobject obj); - jboolean (JNICALL *IsSameObject) - (JNIEnv *env, jobject obj1, jobject obj2); - jobject (JNICALL *NewLocalRef) - (JNIEnv *env, jobject ref); - jint (JNICALL *EnsureLocalCapacity) - (JNIEnv *env, jint capacity); - - jobject (JNICALL *AllocObject) - (JNIEnv *env, jclass clazz); - jobject (JNICALL *NewObject) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *NewObjectV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (JNICALL *NewObjectA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jclass (JNICALL *GetObjectClass) - (JNIEnv *env, jobject obj); - jboolean (JNICALL *IsInstanceOf) - (JNIEnv *env, jobject obj, jclass clazz); - - jmethodID (JNICALL *GetMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *CallObjectMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jobject (JNICALL *CallObjectMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jobject (JNICALL *CallObjectMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jboolean (JNICALL *CallBooleanMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jboolean (JNICALL *CallBooleanMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jboolean (JNICALL *CallBooleanMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jbyte (JNICALL *CallByteMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jbyte (JNICALL *CallByteMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jbyte (JNICALL *CallByteMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jchar (JNICALL *CallCharMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jchar (JNICALL *CallCharMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jchar (JNICALL *CallCharMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jshort (JNICALL *CallShortMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jshort (JNICALL *CallShortMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jshort (JNICALL *CallShortMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jint (JNICALL *CallIntMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jint (JNICALL *CallIntMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jint (JNICALL *CallIntMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jlong (JNICALL *CallLongMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jlong (JNICALL *CallLongMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jlong (JNICALL *CallLongMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jfloat (JNICALL *CallFloatMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jfloat (JNICALL *CallFloatMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jfloat (JNICALL *CallFloatMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jdouble (JNICALL *CallDoubleMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jdouble (JNICALL *CallDoubleMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jdouble (JNICALL *CallDoubleMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - void (JNICALL *CallVoidMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - void (JNICALL *CallVoidMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - void (JNICALL *CallVoidMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jobject (JNICALL *CallNonvirtualObjectMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *CallNonvirtualObjectMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jobject (JNICALL *CallNonvirtualObjectMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jboolean (JNICALL *CallNonvirtualBooleanMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jboolean (JNICALL *CallNonvirtualBooleanMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jboolean (JNICALL *CallNonvirtualBooleanMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jbyte (JNICALL *CallNonvirtualByteMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jbyte (JNICALL *CallNonvirtualByteMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jbyte (JNICALL *CallNonvirtualByteMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jchar (JNICALL *CallNonvirtualCharMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jchar (JNICALL *CallNonvirtualCharMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jchar (JNICALL *CallNonvirtualCharMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jshort (JNICALL *CallNonvirtualShortMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jshort (JNICALL *CallNonvirtualShortMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jshort (JNICALL *CallNonvirtualShortMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jint (JNICALL *CallNonvirtualIntMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jint (JNICALL *CallNonvirtualIntMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jint (JNICALL *CallNonvirtualIntMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jlong (JNICALL *CallNonvirtualLongMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jlong (JNICALL *CallNonvirtualLongMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jlong (JNICALL *CallNonvirtualLongMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jfloat (JNICALL *CallNonvirtualFloatMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jfloat (JNICALL *CallNonvirtualFloatMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jfloat (JNICALL *CallNonvirtualFloatMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jdouble (JNICALL *CallNonvirtualDoubleMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jdouble (JNICALL *CallNonvirtualDoubleMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jdouble (JNICALL *CallNonvirtualDoubleMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - void (JNICALL *CallNonvirtualVoidMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - void (JNICALL *CallNonvirtualVoidMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - void (JNICALL *CallNonvirtualVoidMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jfieldID (JNICALL *GetFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *GetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jboolean (JNICALL *GetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jbyte (JNICALL *GetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jchar (JNICALL *GetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jshort (JNICALL *GetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jint (JNICALL *GetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jlong (JNICALL *GetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jfloat (JNICALL *GetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jdouble (JNICALL *GetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - - void (JNICALL *SetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val); - void (JNICALL *SetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val); - void (JNICALL *SetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val); - void (JNICALL *SetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val); - void (JNICALL *SetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val); - void (JNICALL *SetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jint val); - void (JNICALL *SetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val); - void (JNICALL *SetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val); - void (JNICALL *SetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val); - - jmethodID (JNICALL *GetStaticMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *CallStaticObjectMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *CallStaticObjectMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (JNICALL *CallStaticObjectMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jboolean (JNICALL *CallStaticBooleanMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jboolean (JNICALL *CallStaticBooleanMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jboolean (JNICALL *CallStaticBooleanMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jbyte (JNICALL *CallStaticByteMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jbyte (JNICALL *CallStaticByteMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jbyte (JNICALL *CallStaticByteMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jchar (JNICALL *CallStaticCharMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jchar (JNICALL *CallStaticCharMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jchar (JNICALL *CallStaticCharMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jshort (JNICALL *CallStaticShortMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jshort (JNICALL *CallStaticShortMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jshort (JNICALL *CallStaticShortMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jint (JNICALL *CallStaticIntMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jint (JNICALL *CallStaticIntMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jint (JNICALL *CallStaticIntMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jlong (JNICALL *CallStaticLongMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jlong (JNICALL *CallStaticLongMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jlong (JNICALL *CallStaticLongMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jfloat (JNICALL *CallStaticFloatMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jfloat (JNICALL *CallStaticFloatMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jfloat (JNICALL *CallStaticFloatMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jdouble (JNICALL *CallStaticDoubleMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jdouble (JNICALL *CallStaticDoubleMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jdouble (JNICALL *CallStaticDoubleMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - void (JNICALL *CallStaticVoidMethod) - (JNIEnv *env, jclass cls, jmethodID methodID, ...); - void (JNICALL *CallStaticVoidMethodV) - (JNIEnv *env, jclass cls, jmethodID methodID, va_list args); - void (JNICALL *CallStaticVoidMethodA) - (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args); - - jfieldID (JNICALL *GetStaticFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - jobject (JNICALL *GetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jboolean (JNICALL *GetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jbyte (JNICALL *GetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jchar (JNICALL *GetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jshort (JNICALL *GetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jint (JNICALL *GetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jlong (JNICALL *GetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jfloat (JNICALL *GetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jdouble (JNICALL *GetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - - void (JNICALL *SetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value); - void (JNICALL *SetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value); - void (JNICALL *SetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value); - void (JNICALL *SetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value); - void (JNICALL *SetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value); - void (JNICALL *SetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value); - void (JNICALL *SetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value); - void (JNICALL *SetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value); - void (JNICALL *SetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value); - - jstring (JNICALL *NewString) - (JNIEnv *env, const jchar *unicode, jsize len); - jsize (JNICALL *GetStringLength) - (JNIEnv *env, jstring str); - const jchar *(JNICALL *GetStringChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (JNICALL *ReleaseStringChars) - (JNIEnv *env, jstring str, const jchar *chars); - - jstring (JNICALL *NewStringUTF) - (JNIEnv *env, const char *utf); - jsize (JNICALL *GetStringUTFLength) - (JNIEnv *env, jstring str); - const char* (JNICALL *GetStringUTFChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (JNICALL *ReleaseStringUTFChars) - (JNIEnv *env, jstring str, const char* chars); - - - jsize (JNICALL *GetArrayLength) - (JNIEnv *env, jarray array); - - jobjectArray (JNICALL *NewObjectArray) - (JNIEnv *env, jsize len, jclass clazz, jobject init); - jobject (JNICALL *GetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index); - void (JNICALL *SetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index, jobject val); - - jbooleanArray (JNICALL *NewBooleanArray) - (JNIEnv *env, jsize len); - jbyteArray (JNICALL *NewByteArray) - (JNIEnv *env, jsize len); - jcharArray (JNICALL *NewCharArray) - (JNIEnv *env, jsize len); - jshortArray (JNICALL *NewShortArray) - (JNIEnv *env, jsize len); - jintArray (JNICALL *NewIntArray) - (JNIEnv *env, jsize len); - jlongArray (JNICALL *NewLongArray) - (JNIEnv *env, jsize len); - jfloatArray (JNICALL *NewFloatArray) - (JNIEnv *env, jsize len); - jdoubleArray (JNICALL *NewDoubleArray) - (JNIEnv *env, jsize len); - - jboolean * (JNICALL *GetBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *isCopy); - jbyte * (JNICALL *GetByteArrayElements) - (JNIEnv *env, jbyteArray array, jboolean *isCopy); - jchar * (JNICALL *GetCharArrayElements) - (JNIEnv *env, jcharArray array, jboolean *isCopy); - jshort * (JNICALL *GetShortArrayElements) - (JNIEnv *env, jshortArray array, jboolean *isCopy); - jint * (JNICALL *GetIntArrayElements) - (JNIEnv *env, jintArray array, jboolean *isCopy); - jlong * (JNICALL *GetLongArrayElements) - (JNIEnv *env, jlongArray array, jboolean *isCopy); - jfloat * (JNICALL *GetFloatArrayElements) - (JNIEnv *env, jfloatArray array, jboolean *isCopy); - jdouble * (JNICALL *GetDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jboolean *isCopy); - - void (JNICALL *ReleaseBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode); - void (JNICALL *ReleaseByteArrayElements) - (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode); - void (JNICALL *ReleaseCharArrayElements) - (JNIEnv *env, jcharArray array, jchar *elems, jint mode); - void (JNICALL *ReleaseShortArrayElements) - (JNIEnv *env, jshortArray array, jshort *elems, jint mode); - void (JNICALL *ReleaseIntArrayElements) - (JNIEnv *env, jintArray array, jint *elems, jint mode); - void (JNICALL *ReleaseLongArrayElements) - (JNIEnv *env, jlongArray array, jlong *elems, jint mode); - void (JNICALL *ReleaseFloatArrayElements) - (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode); - void (JNICALL *ReleaseDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode); - - void (JNICALL *GetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf); - void (JNICALL *GetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf); - void (JNICALL *GetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf); - void (JNICALL *GetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf); - void (JNICALL *GetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf); - void (JNICALL *GetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf); - void (JNICALL *GetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf); - void (JNICALL *GetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf); - - void (JNICALL *SetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf); - void (JNICALL *SetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf); - void (JNICALL *SetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf); - void (JNICALL *SetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf); - void (JNICALL *SetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf); - void (JNICALL *SetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf); - void (JNICALL *SetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf); - void (JNICALL *SetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf); - - jint (JNICALL *RegisterNatives) - (JNIEnv *env, jclass clazz, const JNINativeMethod *methods, - jint nMethods); - jint (JNICALL *UnregisterNatives) - (JNIEnv *env, jclass clazz); - - jint (JNICALL *MonitorEnter) - (JNIEnv *env, jobject obj); - jint (JNICALL *MonitorExit) - (JNIEnv *env, jobject obj); - - jint (JNICALL *GetJavaVM) - (JNIEnv *env, JavaVM **vm); - - void (JNICALL *GetStringRegion) - (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf); - void (JNICALL *GetStringUTFRegion) - (JNIEnv *env, jstring str, jsize start, jsize len, char *buf); - - void * (JNICALL *GetPrimitiveArrayCritical) - (JNIEnv *env, jarray array, jboolean *isCopy); - void (JNICALL *ReleasePrimitiveArrayCritical) - (JNIEnv *env, jarray array, void *carray, jint mode); - - const jchar * (JNICALL *GetStringCritical) - (JNIEnv *env, jstring string, jboolean *isCopy); - void (JNICALL *ReleaseStringCritical) - (JNIEnv *env, jstring string, const jchar *cstring); - - jweak (JNICALL *NewWeakGlobalRef) - (JNIEnv *env, jobject obj); - void (JNICALL *DeleteWeakGlobalRef) - (JNIEnv *env, jweak ref); - - jboolean (JNICALL *ExceptionCheck) - (JNIEnv *env); - - jobject (JNICALL *NewDirectByteBuffer) - (JNIEnv* env, void* address, jlong capacity); - void* (JNICALL *GetDirectBufferAddress) - (JNIEnv* env, jobject buf); - jlong (JNICALL *GetDirectBufferCapacity) - (JNIEnv* env, jobject buf); -}; - -/* - * We use inlined functions for C++ so that programmers can write: - * - * env->FindClass("java/lang/String") - * - * in C++ rather than: - * - * (*env)->FindClass(env, "java/lang/String") - * - * in C. - */ - -struct JNIEnv_ { - const struct JNINativeInterface_ *functions; -#ifdef __cplusplus - - jint GetVersion() { - return functions->GetVersion(this); - } - jclass DefineClass(const char *name, jobject loader, const jbyte *buf, - jsize len) { - return functions->DefineClass(this, name, loader, buf, len); - } - jclass FindClass(const char *name) { - return functions->FindClass(this, name); - } - jmethodID FromReflectedMethod(jobject method) { - return functions->FromReflectedMethod(this,method); - } - jfieldID FromReflectedField(jobject field) { - return functions->FromReflectedField(this,field); - } - - jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) { - return functions->ToReflectedMethod(this, cls, methodID, isStatic); - } - - jclass GetSuperclass(jclass sub) { - return functions->GetSuperclass(this, sub); - } - jboolean IsAssignableFrom(jclass sub, jclass sup) { - return functions->IsAssignableFrom(this, sub, sup); - } - - jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) { - return functions->ToReflectedField(this,cls,fieldID,isStatic); - } - - jint Throw(jthrowable obj) { - return functions->Throw(this, obj); - } - jint ThrowNew(jclass clazz, const char *msg) { - return functions->ThrowNew(this, clazz, msg); - } - jthrowable ExceptionOccurred() { - return functions->ExceptionOccurred(this); - } - void ExceptionDescribe() { - functions->ExceptionDescribe(this); - } - void ExceptionClear() { - functions->ExceptionClear(this); - } - void FatalError(const char *msg) { - functions->FatalError(this, msg); - } - - jint PushLocalFrame(jint capacity) { - return functions->PushLocalFrame(this,capacity); - } - jobject PopLocalFrame(jobject result) { - return functions->PopLocalFrame(this,result); - } - - jobject NewGlobalRef(jobject lobj) { - return functions->NewGlobalRef(this,lobj); - } - void DeleteGlobalRef(jobject gref) { - functions->DeleteGlobalRef(this,gref); - } - void DeleteLocalRef(jobject obj) { - functions->DeleteLocalRef(this, obj); - } - - jboolean IsSameObject(jobject obj1, jobject obj2) { - return functions->IsSameObject(this,obj1,obj2); - } - - jobject NewLocalRef(jobject ref) { - return functions->NewLocalRef(this,ref); - } - jint EnsureLocalCapacity(jint capacity) { - return functions->EnsureLocalCapacity(this,capacity); - } - - jobject AllocObject(jclass clazz) { - return functions->AllocObject(this,clazz); - } - jobject NewObject(jclass clazz, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args, methodID); - result = functions->NewObjectV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject NewObjectV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->NewObjectV(this,clazz,methodID,args); - } - jobject NewObjectA(jclass clazz, jmethodID methodID, - const jvalue *args) { - return functions->NewObjectA(this,clazz,methodID,args); - } - - jclass GetObjectClass(jobject obj) { - return functions->GetObjectClass(this,obj); - } - jboolean IsInstanceOf(jobject obj, jclass clazz) { - return functions->IsInstanceOf(this,obj,clazz); - } - - jmethodID GetMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetMethodID(this,clazz,name,sig); - } - - jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallObjectMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jobject CallObjectMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallObjectMethodV(this,obj,methodID,args); - } - jobject CallObjectMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallObjectMethodA(this,obj,methodID,args); - } - - jboolean CallBooleanMethod(jobject obj, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallBooleanMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jboolean CallBooleanMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallBooleanMethodV(this,obj,methodID,args); - } - jboolean CallBooleanMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallBooleanMethodA(this,obj,methodID, args); - } - - jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallByteMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jbyte CallByteMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallByteMethodV(this,obj,methodID,args); - } - jbyte CallByteMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallByteMethodA(this,obj,methodID,args); - } - - jchar CallCharMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallCharMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jchar CallCharMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallCharMethodV(this,obj,methodID,args); - } - jchar CallCharMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallCharMethodA(this,obj,methodID,args); - } - - jshort CallShortMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallShortMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jshort CallShortMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallShortMethodV(this,obj,methodID,args); - } - jshort CallShortMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallShortMethodA(this,obj,methodID,args); - } - - jint CallIntMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallIntMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jint CallIntMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallIntMethodV(this,obj,methodID,args); - } - jint CallIntMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallIntMethodA(this,obj,methodID,args); - } - - jlong CallLongMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallLongMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jlong CallLongMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallLongMethodV(this,obj,methodID,args); - } - jlong CallLongMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallLongMethodA(this,obj,methodID,args); - } - - jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallFloatMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jfloat CallFloatMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallFloatMethodV(this,obj,methodID,args); - } - jfloat CallFloatMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallFloatMethodA(this,obj,methodID,args); - } - - jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallDoubleMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jdouble CallDoubleMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallDoubleMethodV(this,obj,methodID,args); - } - jdouble CallDoubleMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallDoubleMethodA(this,obj,methodID,args); - } - - void CallVoidMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallVoidMethodV(this,obj,methodID,args); - va_end(args); - } - void CallVoidMethodV(jobject obj, jmethodID methodID, - va_list args) { - functions->CallVoidMethodV(this,obj,methodID,args); - } - void CallVoidMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - functions->CallVoidMethodA(this,obj,methodID,args); - } - - jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - } - jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualObjectMethodA(this,obj,clazz, - methodID,args); - } - - jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - } - jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualBooleanMethodA(this,obj,clazz, - methodID, args); - } - - jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - } - jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualByteMethodA(this,obj,clazz, - methodID,args); - } - - jchar CallNonvirtualCharMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - } - jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualCharMethodA(this,obj,clazz, - methodID,args); - } - - jshort CallNonvirtualShortMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - } - jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualShortMethodA(this,obj,clazz, - methodID,args); - } - - jint CallNonvirtualIntMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jint CallNonvirtualIntMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - } - jint CallNonvirtualIntMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualIntMethodA(this,obj,clazz, - methodID,args); - } - - jlong CallNonvirtualLongMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - } - jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualLongMethodA(this,obj,clazz, - methodID,args); - } - - jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - } - jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - return functions->CallNonvirtualFloatMethodA(this,obj,clazz, - methodID,args); - } - - jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - } - jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - return functions->CallNonvirtualDoubleMethodA(this,obj,clazz, - methodID,args); - } - - void CallNonvirtualVoidMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - va_end(args); - } - void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - } - void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args); - } - - jfieldID GetFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetFieldID(this,clazz,name,sig); - } - - jobject GetObjectField(jobject obj, jfieldID fieldID) { - return functions->GetObjectField(this,obj,fieldID); - } - jboolean GetBooleanField(jobject obj, jfieldID fieldID) { - return functions->GetBooleanField(this,obj,fieldID); - } - jbyte GetByteField(jobject obj, jfieldID fieldID) { - return functions->GetByteField(this,obj,fieldID); - } - jchar GetCharField(jobject obj, jfieldID fieldID) { - return functions->GetCharField(this,obj,fieldID); - } - jshort GetShortField(jobject obj, jfieldID fieldID) { - return functions->GetShortField(this,obj,fieldID); - } - jint GetIntField(jobject obj, jfieldID fieldID) { - return functions->GetIntField(this,obj,fieldID); - } - jlong GetLongField(jobject obj, jfieldID fieldID) { - return functions->GetLongField(this,obj,fieldID); - } - jfloat GetFloatField(jobject obj, jfieldID fieldID) { - return functions->GetFloatField(this,obj,fieldID); - } - jdouble GetDoubleField(jobject obj, jfieldID fieldID) { - return functions->GetDoubleField(this,obj,fieldID); - } - - void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { - functions->SetObjectField(this,obj,fieldID,val); - } - void SetBooleanField(jobject obj, jfieldID fieldID, - jboolean val) { - functions->SetBooleanField(this,obj,fieldID,val); - } - void SetByteField(jobject obj, jfieldID fieldID, - jbyte val) { - functions->SetByteField(this,obj,fieldID,val); - } - void SetCharField(jobject obj, jfieldID fieldID, - jchar val) { - functions->SetCharField(this,obj,fieldID,val); - } - void SetShortField(jobject obj, jfieldID fieldID, - jshort val) { - functions->SetShortField(this,obj,fieldID,val); - } - void SetIntField(jobject obj, jfieldID fieldID, - jint val) { - functions->SetIntField(this,obj,fieldID,val); - } - void SetLongField(jobject obj, jfieldID fieldID, - jlong val) { - functions->SetLongField(this,obj,fieldID,val); - } - void SetFloatField(jobject obj, jfieldID fieldID, - jfloat val) { - functions->SetFloatField(this,obj,fieldID,val); - } - void SetDoubleField(jobject obj, jfieldID fieldID, - jdouble val) { - functions->SetDoubleField(this,obj,fieldID,val); - } - - jmethodID GetStaticMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticMethodID(this,clazz,name,sig); - } - - jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID, - ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallStaticObjectMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->CallStaticObjectMethodV(this,clazz,methodID,args); - } - jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID, - const jvalue *args) { - return functions->CallStaticObjectMethodA(this,clazz,methodID,args); - } - - jboolean CallStaticBooleanMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jboolean CallStaticBooleanMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - } - jboolean CallStaticBooleanMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticBooleanMethodA(this,clazz,methodID,args); - } - - jbyte CallStaticByteMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallStaticByteMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jbyte CallStaticByteMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticByteMethodV(this,clazz,methodID,args); - } - jbyte CallStaticByteMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticByteMethodA(this,clazz,methodID,args); - } - - jchar CallStaticCharMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallStaticCharMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jchar CallStaticCharMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticCharMethodV(this,clazz,methodID,args); - } - jchar CallStaticCharMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticCharMethodA(this,clazz,methodID,args); - } - - jshort CallStaticShortMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallStaticShortMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jshort CallStaticShortMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticShortMethodV(this,clazz,methodID,args); - } - jshort CallStaticShortMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticShortMethodA(this,clazz,methodID,args); - } - - jint CallStaticIntMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallStaticIntMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jint CallStaticIntMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticIntMethodV(this,clazz,methodID,args); - } - jint CallStaticIntMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticIntMethodA(this,clazz,methodID,args); - } - - jlong CallStaticLongMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallStaticLongMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jlong CallStaticLongMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticLongMethodV(this,clazz,methodID,args); - } - jlong CallStaticLongMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticLongMethodA(this,clazz,methodID,args); - } - - jfloat CallStaticFloatMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallStaticFloatMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jfloat CallStaticFloatMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticFloatMethodV(this,clazz,methodID,args); - } - jfloat CallStaticFloatMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticFloatMethodA(this,clazz,methodID,args); - } - - jdouble CallStaticDoubleMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jdouble CallStaticDoubleMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - } - jdouble CallStaticDoubleMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticDoubleMethodA(this,clazz,methodID,args); - } - - void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallStaticVoidMethodV(this,cls,methodID,args); - va_end(args); - } - void CallStaticVoidMethodV(jclass cls, jmethodID methodID, - va_list args) { - functions->CallStaticVoidMethodV(this,cls,methodID,args); - } - void CallStaticVoidMethodA(jclass cls, jmethodID methodID, - const jvalue * args) { - functions->CallStaticVoidMethodA(this,cls,methodID,args); - } - - jfieldID GetStaticFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticFieldID(this,clazz,name,sig); - } - jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticObjectField(this,clazz,fieldID); - } - jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticBooleanField(this,clazz,fieldID); - } - jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticByteField(this,clazz,fieldID); - } - jchar GetStaticCharField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticCharField(this,clazz,fieldID); - } - jshort GetStaticShortField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticShortField(this,clazz,fieldID); - } - jint GetStaticIntField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticIntField(this,clazz,fieldID); - } - jlong GetStaticLongField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticLongField(this,clazz,fieldID); - } - jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticFloatField(this,clazz,fieldID); - } - jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticDoubleField(this,clazz,fieldID); - } - - void SetStaticObjectField(jclass clazz, jfieldID fieldID, - jobject value) { - functions->SetStaticObjectField(this,clazz,fieldID,value); - } - void SetStaticBooleanField(jclass clazz, jfieldID fieldID, - jboolean value) { - functions->SetStaticBooleanField(this,clazz,fieldID,value); - } - void SetStaticByteField(jclass clazz, jfieldID fieldID, - jbyte value) { - functions->SetStaticByteField(this,clazz,fieldID,value); - } - void SetStaticCharField(jclass clazz, jfieldID fieldID, - jchar value) { - functions->SetStaticCharField(this,clazz,fieldID,value); - } - void SetStaticShortField(jclass clazz, jfieldID fieldID, - jshort value) { - functions->SetStaticShortField(this,clazz,fieldID,value); - } - void SetStaticIntField(jclass clazz, jfieldID fieldID, - jint value) { - functions->SetStaticIntField(this,clazz,fieldID,value); - } - void SetStaticLongField(jclass clazz, jfieldID fieldID, - jlong value) { - functions->SetStaticLongField(this,clazz,fieldID,value); - } - void SetStaticFloatField(jclass clazz, jfieldID fieldID, - jfloat value) { - functions->SetStaticFloatField(this,clazz,fieldID,value); - } - void SetStaticDoubleField(jclass clazz, jfieldID fieldID, - jdouble value) { - functions->SetStaticDoubleField(this,clazz,fieldID,value); - } - - jstring NewString(const jchar *unicode, jsize len) { - return functions->NewString(this,unicode,len); - } - jsize GetStringLength(jstring str) { - return functions->GetStringLength(this,str); - } - const jchar *GetStringChars(jstring str, jboolean *isCopy) { - return functions->GetStringChars(this,str,isCopy); - } - void ReleaseStringChars(jstring str, const jchar *chars) { - functions->ReleaseStringChars(this,str,chars); - } - - jstring NewStringUTF(const char *utf) { - return functions->NewStringUTF(this,utf); - } - jsize GetStringUTFLength(jstring str) { - return functions->GetStringUTFLength(this,str); - } - const char* GetStringUTFChars(jstring str, jboolean *isCopy) { - return functions->GetStringUTFChars(this,str,isCopy); - } - void ReleaseStringUTFChars(jstring str, const char* chars) { - functions->ReleaseStringUTFChars(this,str,chars); - } - - jsize GetArrayLength(jarray array) { - return functions->GetArrayLength(this,array); - } - - jobjectArray NewObjectArray(jsize len, jclass clazz, - jobject init) { - return functions->NewObjectArray(this,len,clazz,init); - } - jobject GetObjectArrayElement(jobjectArray array, jsize index) { - return functions->GetObjectArrayElement(this,array,index); - } - void SetObjectArrayElement(jobjectArray array, jsize index, - jobject val) { - functions->SetObjectArrayElement(this,array,index,val); - } - - jbooleanArray NewBooleanArray(jsize len) { - return functions->NewBooleanArray(this,len); - } - jbyteArray NewByteArray(jsize len) { - return functions->NewByteArray(this,len); - } - jcharArray NewCharArray(jsize len) { - return functions->NewCharArray(this,len); - } - jshortArray NewShortArray(jsize len) { - return functions->NewShortArray(this,len); - } - jintArray NewIntArray(jsize len) { - return functions->NewIntArray(this,len); - } - jlongArray NewLongArray(jsize len) { - return functions->NewLongArray(this,len); - } - jfloatArray NewFloatArray(jsize len) { - return functions->NewFloatArray(this,len); - } - jdoubleArray NewDoubleArray(jsize len) { - return functions->NewDoubleArray(this,len); - } - - jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) { - return functions->GetBooleanArrayElements(this,array,isCopy); - } - jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) { - return functions->GetByteArrayElements(this,array,isCopy); - } - jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) { - return functions->GetCharArrayElements(this,array,isCopy); - } - jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) { - return functions->GetShortArrayElements(this,array,isCopy); - } - jint * GetIntArrayElements(jintArray array, jboolean *isCopy) { - return functions->GetIntArrayElements(this,array,isCopy); - } - jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) { - return functions->GetLongArrayElements(this,array,isCopy); - } - jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) { - return functions->GetFloatArrayElements(this,array,isCopy); - } - jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) { - return functions->GetDoubleArrayElements(this,array,isCopy); - } - - void ReleaseBooleanArrayElements(jbooleanArray array, - jboolean *elems, - jint mode) { - functions->ReleaseBooleanArrayElements(this,array,elems,mode); - } - void ReleaseByteArrayElements(jbyteArray array, - jbyte *elems, - jint mode) { - functions->ReleaseByteArrayElements(this,array,elems,mode); - } - void ReleaseCharArrayElements(jcharArray array, - jchar *elems, - jint mode) { - functions->ReleaseCharArrayElements(this,array,elems,mode); - } - void ReleaseShortArrayElements(jshortArray array, - jshort *elems, - jint mode) { - functions->ReleaseShortArrayElements(this,array,elems,mode); - } - void ReleaseIntArrayElements(jintArray array, - jint *elems, - jint mode) { - functions->ReleaseIntArrayElements(this,array,elems,mode); - } - void ReleaseLongArrayElements(jlongArray array, - jlong *elems, - jint mode) { - functions->ReleaseLongArrayElements(this,array,elems,mode); - } - void ReleaseFloatArrayElements(jfloatArray array, - jfloat *elems, - jint mode) { - functions->ReleaseFloatArrayElements(this,array,elems,mode); - } - void ReleaseDoubleArrayElements(jdoubleArray array, - jdouble *elems, - jint mode) { - functions->ReleaseDoubleArrayElements(this,array,elems,mode); - } - - void GetBooleanArrayRegion(jbooleanArray array, - jsize start, jsize len, jboolean *buf) { - functions->GetBooleanArrayRegion(this,array,start,len,buf); - } - void GetByteArrayRegion(jbyteArray array, - jsize start, jsize len, jbyte *buf) { - functions->GetByteArrayRegion(this,array,start,len,buf); - } - void GetCharArrayRegion(jcharArray array, - jsize start, jsize len, jchar *buf) { - functions->GetCharArrayRegion(this,array,start,len,buf); - } - void GetShortArrayRegion(jshortArray array, - jsize start, jsize len, jshort *buf) { - functions->GetShortArrayRegion(this,array,start,len,buf); - } - void GetIntArrayRegion(jintArray array, - jsize start, jsize len, jint *buf) { - functions->GetIntArrayRegion(this,array,start,len,buf); - } - void GetLongArrayRegion(jlongArray array, - jsize start, jsize len, jlong *buf) { - functions->GetLongArrayRegion(this,array,start,len,buf); - } - void GetFloatArrayRegion(jfloatArray array, - jsize start, jsize len, jfloat *buf) { - functions->GetFloatArrayRegion(this,array,start,len,buf); - } - void GetDoubleArrayRegion(jdoubleArray array, - jsize start, jsize len, jdouble *buf) { - functions->GetDoubleArrayRegion(this,array,start,len,buf); - } - - void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, - const jboolean *buf) { - functions->SetBooleanArrayRegion(this,array,start,len,buf); - } - void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, - const jbyte *buf) { - functions->SetByteArrayRegion(this,array,start,len,buf); - } - void SetCharArrayRegion(jcharArray array, jsize start, jsize len, - const jchar *buf) { - functions->SetCharArrayRegion(this,array,start,len,buf); - } - void SetShortArrayRegion(jshortArray array, jsize start, jsize len, - const jshort *buf) { - functions->SetShortArrayRegion(this,array,start,len,buf); - } - void SetIntArrayRegion(jintArray array, jsize start, jsize len, - const jint *buf) { - functions->SetIntArrayRegion(this,array,start,len,buf); - } - void SetLongArrayRegion(jlongArray array, jsize start, jsize len, - const jlong *buf) { - functions->SetLongArrayRegion(this,array,start,len,buf); - } - void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, - const jfloat *buf) { - functions->SetFloatArrayRegion(this,array,start,len,buf); - } - void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, - const jdouble *buf) { - functions->SetDoubleArrayRegion(this,array,start,len,buf); - } - - jint RegisterNatives(jclass clazz, const JNINativeMethod *methods, - jint nMethods) { - return functions->RegisterNatives(this,clazz,methods,nMethods); - } - jint UnregisterNatives(jclass clazz) { - return functions->UnregisterNatives(this,clazz); - } - - jint MonitorEnter(jobject obj) { - return functions->MonitorEnter(this,obj); - } - jint MonitorExit(jobject obj) { - return functions->MonitorExit(this,obj); - } - - jint GetJavaVM(JavaVM **vm) { - return functions->GetJavaVM(this,vm); - } - - void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) { - functions->GetStringRegion(this,str,start,len,buf); - } - void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) { - functions->GetStringUTFRegion(this,str,start,len,buf); - } - - void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) { - return functions->GetPrimitiveArrayCritical(this,array,isCopy); - } - void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) { - functions->ReleasePrimitiveArrayCritical(this,array,carray,mode); - } - - const jchar * GetStringCritical(jstring string, jboolean *isCopy) { - return functions->GetStringCritical(this,string,isCopy); - } - void ReleaseStringCritical(jstring string, const jchar *cstring) { - functions->ReleaseStringCritical(this,string,cstring); - } - - jweak NewWeakGlobalRef(jobject obj) { - return functions->NewWeakGlobalRef(this,obj); - } - void DeleteWeakGlobalRef(jweak ref) { - functions->DeleteWeakGlobalRef(this,ref); - } - - jboolean ExceptionCheck() { - return functions->ExceptionCheck(this); - } - - jobject NewDirectByteBuffer(void* address, jlong capacity) { - return functions->NewDirectByteBuffer(this, address, capacity); - } - void* GetDirectBufferAddress(jobject buf) { - return functions->GetDirectBufferAddress(this, buf); - } - jlong GetDirectBufferCapacity(jobject buf) { - return functions->GetDirectBufferCapacity(this, buf); - } - -#endif /* __cplusplus */ -}; - -typedef struct JavaVMOption { - char *optionString; - void *extraInfo; -} JavaVMOption; - -typedef struct JavaVMInitArgs { - jint version; - - jint nOptions; - JavaVMOption *options; - jboolean ignoreUnrecognized; -} JavaVMInitArgs; - -typedef struct JavaVMAttachArgs { - jint version; - - char *name; - jobject group; -} JavaVMAttachArgs; - -/* These structures will be VM-specific. */ - -typedef struct JDK1_1InitArgs { - jint version; - - char **properties; - jint checkSource; - jint nativeStackSize; - jint javaStackSize; - jint minHeapSize; - jint maxHeapSize; - jint verifyMode; - char *classpath; - - jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); - void (JNICALL *exit)(jint code); - void (JNICALL *abort)(void); - - jint enableClassGC; - jint enableVerboseGC; - jint disableAsyncGC; - jint verbose; - jboolean debugging; - jint debugPort; -} JDK1_1InitArgs; - -typedef struct JDK1_1AttachArgs { - void * __padding; /* C compilers don't allow empty structures. */ -} JDK1_1AttachArgs; - -#define JDK1_2 -#define JDK1_4 - -/* End VM-specific. */ - -struct JNIInvokeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - jint (JNICALL *DestroyJavaVM)(JavaVM *vm); - - jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args); - - jint (JNICALL *DetachCurrentThread)(JavaVM *vm); - - jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version); - - jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args); -}; - -struct JavaVM_ { - const struct JNIInvokeInterface_ *functions; -#ifdef __cplusplus - - jint DestroyJavaVM() { - return functions->DestroyJavaVM(this); - } - jint AttachCurrentThread(void **penv, void *args) { - return functions->AttachCurrentThread(this, penv, args); - } - jint DetachCurrentThread() { - return functions->DetachCurrentThread(this); - } - - jint GetEnv(void **penv, jint version) { - return functions->GetEnv(this, penv, version); - } - jint AttachCurrentThreadAsDaemon(void **penv, void *args) { - return functions->AttachCurrentThreadAsDaemon(this, penv, args); - } -#endif -}; - -#ifdef _JNI_IMPLEMENTATION_ -#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT -#else -#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT -#endif -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_GetDefaultJavaVMInitArgs(void *args); - -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args); - -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); - -/* Defined by native libraries. */ -JNIEXPORT jint JNICALL -JNI_OnLoad(JavaVM *vm, void *reserved); - -JNIEXPORT void JNICALL -JNI_OnUnload(JavaVM *vm, void *reserved); - -#define JNI_VERSION_1_1 0x00010001 -#define JNI_VERSION_1_2 0x00010002 -#define JNI_VERSION_1_4 0x00010004 - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVASOFT_JNI_H_ */ diff --git a/JavaOpenJPEG/java-jni/include/jvmdi.h b/JavaOpenJPEG/java-jni/include/jvmdi.h deleted file mode 100644 index d39c4a95..00000000 --- a/JavaOpenJPEG/java-jni/include/jvmdi.h +++ /dev/null @@ -1,1012 +0,0 @@ -/* - * @(#)jvmdi.h 1.48 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * Java Virtual Machine Debug Interface - * - * Defines debugging functionality that a VM should provide. - * - * Should not overlap functionality in jni.h - */ - -#ifndef _JAVASOFT_JVMDI_H_ -#define _JAVASOFT_JVMDI_H_ - -#include "jni.h" - -#define JVMDI_VERSION_1 0x20010000 -#define JVMDI_VERSION_1_1 0x20010001 -#define JVMDI_VERSION_1_2 0x20010002 -#define JVMDI_VERSION_1_3 0x20010003 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef jobject jthread; - -typedef jobject jthreadGroup; - -struct _jframeID; -typedef struct _jframeID *jframeID; - - /* specifies program location "pc" - often byte code index */ -typedef jlong jlocation; - - /* The jmethodID for methods that have been replaced */ - /* via RedefineClasses - used when the implementation */ - /* does not wish to retain replaced jmethodIDs */ -#define OBSOLETE_METHOD_ID ((jmethodID)(NULL)) - - /* - * Errors - */ - -typedef jint jvmdiError; - - /* no error */ -#define JVMDI_ERROR_NONE ((jvmdiError)0) - - /* - * Errors on thread operations - */ - - /* invalid thread */ -#define JVMDI_ERROR_INVALID_THREAD ((jvmdiError)10) - /* invalid thread group */ -#define JVMDI_ERROR_INVALID_THREAD_GROUP ((jvmdiError)11) - /* invalid thread priority */ -#define JVMDI_ERROR_INVALID_PRIORITY ((jvmdiError)12) - /* thread not suspended */ -#define JVMDI_ERROR_THREAD_NOT_SUSPENDED ((jvmdiError)13) - /* thread already suspended */ -#define JVMDI_ERROR_THREAD_SUSPENDED ((jvmdiError)14) - - /* - * Errors on object and class operations - */ - - /* invalid object (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_INVALID_OBJECT ((jvmdiError)20) - /* invalid class (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_INVALID_CLASS ((jvmdiError)21) - /* class not prepared */ -#define JVMDI_ERROR_CLASS_NOT_PREPARED ((jvmdiError)22) - /* invalid methodID (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_INVALID_METHODID ((jvmdiError)23) - /* invalid location */ -#define JVMDI_ERROR_INVALID_LOCATION ((jvmdiError)24) - /* invalid fieldID (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_INVALID_FIELDID ((jvmdiError)25) - - /* - * Errors on frame operations - */ - - /* invalid frameID (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_INVALID_FRAMEID ((jvmdiError)30) - /* there are no more frames on the stack */ -#define JVMDI_ERROR_NO_MORE_FRAMES ((jvmdiError)31) - /* operation cannot be performed on this frame */ -#define JVMDI_ERROR_OPAQUE_FRAME ((jvmdiError)32) - /* operation can only be performed on current frame */ -#define JVMDI_ERROR_NOT_CURRENT_FRAME ((jvmdiError)33) - /* type mismatch (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_TYPE_MISMATCH ((jvmdiError)34) - /* invalid slot */ -#define JVMDI_ERROR_INVALID_SLOT ((jvmdiError)35) - - /* - * Errors on set/clear/find operations - */ - - /* item already present */ -#define JVMDI_ERROR_DUPLICATE ((jvmdiError)40) - /* item not found */ -#define JVMDI_ERROR_NOT_FOUND ((jvmdiError)41) - - /* - * Errors on monitor operations - */ - - /* invalid monitor */ -#define JVMDI_ERROR_INVALID_MONITOR ((jvmdiError)50) - /* wait, notify, notify all tried without entering monitor */ -#define JVMDI_ERROR_NOT_MONITOR_OWNER ((jvmdiError)51) - /* waiting thread interrupted */ -#define JVMDI_ERROR_INTERRUPT ((jvmdiError)52) - - /* - * Class redefinition / operand stack errors - */ - - /* The equivalent of ClassFormatError */ -#define JVMDI_ERROR_INVALID_CLASS_FORMAT ((jvmdiError)60) - /* The equivalent of ClassCircularityError */ -#define JVMDI_ERROR_CIRCULAR_CLASS_DEFINITION ((jvmdiError)61) - /* The class bytes fail verification */ -#define JVMDI_ERROR_FAILS_VERIFICATION ((jvmdiError)62) - /* The new class version adds new methods */ - /* and can_add_method is false */ -#define JVMDI_ERROR_ADD_METHOD_NOT_IMPLEMENTED ((jvmdiError)63) - /* The new class version changes fields */ - /* and can_unrestrictedly_redefine_classes is false */ -#define JVMDI_ERROR_SCHEMA_CHANGE_NOT_IMPLEMENTED ((jvmdiError)64) - /* bci/operand stack/local var combination is not verifiably */ - /* type safe */ -#define JVMDI_ERROR_INVALID_TYPESTATE ((jvmdiError)65) - /* A direct superclass is different for the new class */ - /* version, or the set of directly implemented */ - /* interfaces is different */ - /* and can_unrestrictedly_redefine_classes is false */ -#define JVMDI_ERROR_HIERARCHY_CHANGE_NOT_IMPLEMENTED ((jvmdiError)66) - /* The new class version does not declare a method */ - /* declared in the old class version */ - /* and can_unrestrictedly_redefine_classes is false */ -#define JVMDI_ERROR_DELETE_METHOD_NOT_IMPLEMENTED ((jvmdiError)67) - /* A class file has a version number not supported */ - /* by this VM. */ -#define JVMDI_ERROR_UNSUPPORTED_VERSION ((jvmdiError)68) - /* The class name defined in the new class file is */ - /* different from the name in the old class object */ -#define JVMDI_ERROR_NAMES_DONT_MATCH ((jvmdiError)69) - /* The new class version has different modifiers and */ - /* can_unrestrictedly_redefine_classes is false */ -#define JVMDI_ERROR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED ((jvmdiError)70) - /* A method in the new class version has different modifiers */ - /* than its counterpart in the old class version */ - /* and can_unrestrictedly_redefine_classes is false */ -#define JVMDI_ERROR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED ((jvmdiError)71) - - /* - * Miscellaneous errors - */ - - /* Not yet implemented */ -#define JVMDI_ERROR_NOT_IMPLEMENTED ((jvmdiError)99) - /* null pointer */ -#define JVMDI_ERROR_NULL_POINTER ((jvmdiError)100) - /* information is absent */ -#define JVMDI_ERROR_ABSENT_INFORMATION ((jvmdiError)101) - /* invalid event type */ -#define JVMDI_ERROR_INVALID_EVENT_TYPE ((jvmdiError)102) - /* invalid argument */ -#define JVMDI_ERROR_ILLEGAL_ARGUMENT ((jvmdiError)103) - - /* - * Universal errors. These errors may be returned by - * any JVMDI function, not just the ones for which they are listed - * below. - */ - - /* no more memory available for allocation */ -#define JVMDI_ERROR_OUT_OF_MEMORY ((jvmdiError)110) - /* debugging has not been enabled in this VM */ -#define JVMDI_ERROR_ACCESS_DENIED ((jvmdiError)111) - /* VM is dead (implementation not required to gracefully catch) */ -#define JVMDI_ERROR_VM_DEAD ((jvmdiError)112) - /* internal error */ -#define JVMDI_ERROR_INTERNAL ((jvmdiError)113) - /* Thread calling JVMDI function not attached to VM */ -#define JVMDI_ERROR_UNATTACHED_THREAD ((jvmdiError)115) - - - /* - * Threads - */ - - /* Thread status is unknown */ -#define JVMDI_THREAD_STATUS_UNKNOWN ((jint)-1) - /* Thread is waiting to die */ -#define JVMDI_THREAD_STATUS_ZOMBIE ((jint)0) - /* Thread is runnable */ -#define JVMDI_THREAD_STATUS_RUNNING ((jint)1) - /* Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */ -#define JVMDI_THREAD_STATUS_SLEEPING ((jint)2) - /* Thread is waiting on a java monitor */ -#define JVMDI_THREAD_STATUS_MONITOR ((jint)3) - /* Thread is waiting - Thread.wait() or JVM_MonitorWait() was called */ -#define JVMDI_THREAD_STATUS_WAIT ((jint)4) - - /* Thread is suspended - Thread.suspend(), JVM_Suspend() or - * JVMDI_Suspend was called */ -#define JVMDI_SUSPEND_STATUS_SUSPENDED ((jint)0x1) - /* Thread is at a breakpoint */ -#define JVMDI_SUSPEND_STATUS_BREAK ((jint)0x2) - - - /* Thread priority constants */ -#define JVMDI_THREAD_MIN_PRIORITY ((jint)1) -#define JVMDI_THREAD_NORM_PRIORITY ((jint)5) -#define JVMDI_THREAD_MAX_PRIORITY ((jint)10) - -typedef struct { - char *name; - jint priority; - jboolean is_daemon; - jthreadGroup thread_group; - jobject context_class_loader; -} JVMDI_thread_info; - -typedef struct { - jthreadGroup parent; - char *name; - jint max_priority; - jboolean is_daemon; -} JVMDI_thread_group_info; - -#define JVMDI_DISABLE ((jint) 0) -#define JVMDI_ENABLE ((jint) 1) - -/* - * Initial function for debug threads created through JVMDI - */ -typedef void (*JVMDI_StartFunction)(void *); - -/* - * Type for debug monitors created through JVMDI - */ -typedef void *JVMDI_RawMonitor; - -#define JVMDI_MONITOR_WAIT_FOREVER ((jlong)(-1)) - -/* - * Monitor information - */ -typedef struct { - jthread owner; - jint entry_count; - jint waiter_count; - jthread *waiters; -} JVMDI_monitor_info; - -typedef struct { - jint owned_monitor_count; - jobject *owned_monitors; -} JVMDI_owned_monitor_info; - - /* - * Events - */ - - /* kind = JVMDI_EVENT_SINGLE_STEP */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - } JVMDI_single_step_event_data; - - /* kind = JVMDI_EVENT_BREAKPOINT */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - } JVMDI_breakpoint_event_data; - - /* kind = JVMDI_EVENT_FIELD_ACCESS */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - jclass field_clazz; - jobject object; - jfieldID field; - } JVMDI_field_access_event_data; - - /* kind = JVMDI_EVENT_FIELD_MODIFICATION */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - jclass field_clazz; - jobject object; - jfieldID field; - char signature_type; - jvalue new_value; - } JVMDI_field_modification_event_data; - - /* kind = JVMDI_EVENT_FRAME_POP */ - /* kind = JVMDI_EVENT_METHOD_ENTRY */ - /* kind = JVMDI_EVENT_METHOD_EXIT */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jframeID frame; - } JVMDI_frame_event_data; - - /* kind = JVMDI_EVENT_EXCEPTION */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - jobject exception; - jclass catch_clazz; - jmethodID catch_method; - jlocation catch_location; - } JVMDI_exception_event_data; - - /* kind = JVMDI_EVENT_EXCEPTION_CATCH */ - typedef struct { - jthread thread; - jclass clazz; - jmethodID method; - jlocation location; - jobject exception; - } JVMDI_exception_catch_event_data; - - /* kind = JVMDI_EVENT_USER_DEFINED */ - typedef struct { - jobject object; - jint key; - } JVMDI_user_event_data; - - /* kind = JVMDI_EVENT_THREAD_END or */ - /* JVMDI_EVENT_THREAD_START */ - typedef struct { - jthread thread; - } JVMDI_thread_change_event_data; - - /* kind = JVMDI_EVENT_CLASS_LOAD, */ - /* JVMDI_EVENT_CLASS_UNLOAD, or */ - /* JVMDI_EVENT_CLASS_PREPARE */ - typedef struct { - jthread thread; - jclass clazz; - } JVMDI_class_event_data; - -/* This stucture passes information about the event. - * location is the index of the last instruction executed. - */ -typedef struct { - jint kind; /* the discriminant */ - - union { - /* kind = JVMDI_EVENT_SINGLE_STEP */ - JVMDI_single_step_event_data single_step; - - /* kind = JVMDI_EVENT_BREAKPOINT */ - JVMDI_breakpoint_event_data breakpoint; - - /* kind = JVMDI_EVENT_FRAME_POP */ - /* kind = JVMDI_EVENT_METHOD_ENTRY */ - /* kind = JVMDI_EVENT_METHOD_EXIT */ - JVMDI_frame_event_data frame; - - /* kind = JVMDI_EVENT_FIELD_ACCESS */ - JVMDI_field_access_event_data field_access; - - /* kind = JVMDI_EVENT_FIELD_MODIFICATION */ - JVMDI_field_modification_event_data field_modification; - - /* kind = JVMDI_EVENT_EXCEPTION */ - JVMDI_exception_event_data exception; - - /* kind = JVMDI_EVENT_EXCEPTION_CATCH */ - JVMDI_exception_catch_event_data exception_catch; - - /* kind = JVMDI_EVENT_USER_DEFINED */ - JVMDI_user_event_data user; - - /* kind = JVMDI_EVENT_THREAD_END or */ - /* JVMDI_EVENT_THREAD_START */ - JVMDI_thread_change_event_data thread_change; - - /* kind = JVMDI_EVENT_CLASS_LOAD, */ - /* JVMDI_EVENT_CLASS_UNLOAD, or */ - /* JVMDI_EVENT_CLASS_PREPARE */ - JVMDI_class_event_data class_event; - - /* kind = JVMDI_EVENT_VM_DEATH, JVMDI_EVENT_VM_INIT */ - /* no additional fields */ - } u; -} JVMDI_Event; - - /*** event kinds ***/ -#define JVMDI_EVENT_SINGLE_STEP ((jint)1) -#define JVMDI_EVENT_BREAKPOINT ((jint)2) -#define JVMDI_EVENT_FRAME_POP ((jint)3) -#define JVMDI_EVENT_EXCEPTION ((jint)4) -#define JVMDI_EVENT_USER_DEFINED ((jint)5) -#define JVMDI_EVENT_THREAD_START ((jint)6) -#define JVMDI_EVENT_THREAD_END ((jint)7) -#define JVMDI_EVENT_CLASS_PREPARE ((jint)8) -#define JVMDI_EVENT_CLASS_UNLOAD ((jint)9) -#define JVMDI_EVENT_CLASS_LOAD ((jint)10) -#define JVMDI_EVENT_FIELD_ACCESS ((jint)20) -#define JVMDI_EVENT_FIELD_MODIFICATION ((jint)21) -#define JVMDI_EVENT_EXCEPTION_CATCH ((jint)30) -#define JVMDI_EVENT_METHOD_ENTRY ((jint)40) -#define JVMDI_EVENT_METHOD_EXIT ((jint)41) -#define JVMDI_EVENT_VM_INIT ((jint)90) -#define JVMDI_EVENT_VM_DEATH ((jint)99) - -#define JVMDI_MAX_EVENT_TYPE_VAL ((jint)99) - - - -/* event handler hook */ -typedef void (*JVMDI_EventHook)(JNIEnv *env, JVMDI_Event *event); - -typedef jvmdiError (*JVMDI_AllocHook) (jlong size, jbyte** memPtr); -typedef jvmdiError (*JVMDI_DeallocHook) (jbyte* buffer); - -/* - * Class states used in JVMDI_GetClassStatus - */ -#define JVMDI_CLASS_STATUS_VERIFIED ((jint)0x01) -#define JVMDI_CLASS_STATUS_PREPARED ((jint)0x02) -#define JVMDI_CLASS_STATUS_INITIALIZED ((jint)0x04) - /* Error prevents initialization */ -#define JVMDI_CLASS_STATUS_ERROR ((jint)0x08) - -/* structure for returning line number information - */ -typedef struct { - jlocation start_location; - jint line_number; -} JVMDI_line_number_entry; - - -/* structure for returning local variable information - */ -typedef struct { - jlocation start_location; /* variable valid start_location */ - jint length; /* upto start_location+length */ - char *name; /* name in UTF8 */ - char *signature; /* type signature in UTF8 */ - jint slot; /* variable slot, see JVMDI_GetLocal*() */ -} JVMDI_local_variable_entry; - -/* structure for returning exception handler information - */ -typedef struct { - jlocation start_location; - jlocation end_location; - jlocation handler_location; - jclass exception; /* if null, all exceptions */ -} JVMDI_exception_handler_entry; - -#define JVMDI_OPERAND_TYPE_REFERENCE ((jint)1) -#define JVMDI_OPERAND_TYPE_INT ((jint)2) -#define JVMDI_OPERAND_TYPE_FLOAT ((jint)3) -#define JVMDI_OPERAND_TYPE_LONG0 ((jint)4) /* least sig. 32 bits */ -#define JVMDI_OPERAND_TYPE_LONG1 ((jint)5) /* most sig. 32 bits */ -#define JVMDI_OPERAND_TYPE_DOUBLE0 ((jint)6) /* least sig. 32 bits */ -#define JVMDI_OPERAND_TYPE_DOUBLE1 ((jint)7) /* most sig. 32 bits */ -#define JVMDI_OPERAND_TYPE_RETURN_ADDRESS ((jint)8) - -typedef struct { - jint word; /* 32 bit operand stack quantities */ - jint type; /* type encoding of the operand word */ - /* one of JVMDI_OPERAND_TYPE_* */ -} JVMDI_operand_stack_element; - -typedef struct { - jint instance_field_count; /* number of instance fields referencing obj */ - struct JVMDI_instance_field { - jobject instance; /* instance referencing obj */ - jfieldID field; /* field holding reference */ - } *instance_fields; /* instanceField_count of them */ - - jint static_field_count; /* number of static fields referencing obj */ - struct JVMDI_static_field { - jclass clazz; /* class referencing obj */ - jfieldID static_field; /* field holding reference */ - } *static_fields; /* static_field_count of them */ - - jint array_element_count; /* number of array elements referencing obj */ - struct JVMDI_array_element { - jobjectArray array; /* array referencing obj */ - jint index; /* index holding reference */ - } *array_elements; /* array_element_count of them */ - - jint frame_slot_count; /* number of frame slots referencing obj */ - struct JVMDI_frame_slot { - jthread thread; /* thread of the frame */ - jframeID frame; /* frame referencing obj */ - jint slot; /* slot holding reference */ - } *frame_slots; /* frame_slot_count of them */ -} JVMDI_object_reference_info; - -/* structure for defining a class -*/ -typedef struct { - jclass clazz; /* Class object for this class */ - jint class_byte_count; /* number of bytes defining class (below) */ - jbyte *class_bytes; /* bytes defining class (in JVM spec */ - /* Class File Format) */ -} JVMDI_class_definition; - - /* For backwards compatibility */ -#define can_change_schema can_unrestrictedly_redefine_classes - -typedef struct { - unsigned int can_watch_field_modification : 1; - unsigned int can_watch_field_access : 1; - unsigned int can_get_bytecodes : 1; - unsigned int can_get_synthetic_attribute : 1; - unsigned int can_get_owned_monitor_info : 1; - unsigned int can_get_current_contended_monitor : 1; - unsigned int can_get_monitor_info : 1; - unsigned int can_get_heap_info : 1; - unsigned int can_get_operand_stack : 1; - unsigned int can_set_operand_stack : 1; - unsigned int can_pop_frame : 1; - unsigned int can_get_class_definition : 1; - unsigned int can_redefine_classes : 1; - unsigned int can_add_method : 1; - unsigned int can_unrestrictedly_redefine_classes : 1; - unsigned int can_suspend_resume_thread_lists : 1; -} JVMDI_capabilities; - -typedef struct JVMDI_Interface_1_ { - jvmdiError (JNICALL *SetEventHook) - (JVMDI_EventHook hook); - jvmdiError (JNICALL *SetEventNotificationMode) - (jint mode, jint eventType, jthread thread, ...); - - jvmdiError (JNICALL *GetThreadStatus) - (jthread thread, - jint *threadStatusPtr, jint *suspendStatusPtr); - jvmdiError (JNICALL *GetAllThreads) - (jint *threadsCountPtr, jthread **threadsPtr); - jvmdiError (JNICALL *SuspendThread) - (jthread thread); - jvmdiError (JNICALL *ResumeThread) - (jthread thread); - jvmdiError (JNICALL *StopThread) - (jthread thread, jobject exception); - jvmdiError (JNICALL *InterruptThread) - (jthread thread); - jvmdiError (JNICALL *GetThreadInfo) - (jthread thread, JVMDI_thread_info *infoPtr); - jvmdiError (JNICALL *GetOwnedMonitorInfo) - (jthread thread, JVMDI_owned_monitor_info *infoPtr); - jvmdiError (JNICALL *GetCurrentContendedMonitor) - (jthread thread, jobject *monitor); - jvmdiError (JNICALL *RunDebugThread) - (jthread thread, JVMDI_StartFunction proc, void *arg, - int priority); - - jvmdiError (JNICALL *GetTopThreadGroups) - (jint *groupCountPtr, jthreadGroup **groupsPtr); - jvmdiError (JNICALL *GetThreadGroupInfo) - (jthreadGroup group, JVMDI_thread_group_info *infoPtr); - jvmdiError (JNICALL *GetThreadGroupChildren) - (jthreadGroup group, - jint *threadCountPtr, jthread **threadsPtr, - jint *groupCountPtr, jthreadGroup **groupsPtr); - - jvmdiError (JNICALL *GetFrameCount) - (jthread thread, jint *countPtr); - jvmdiError (JNICALL *GetCurrentFrame) - (jthread thread, jframeID *framePtr); - jvmdiError (JNICALL *GetCallerFrame) - (jframeID called, jframeID *framePtr); - jvmdiError (JNICALL *GetFrameLocation) - (jframeID frame, jclass *classPtr, jmethodID *methodPtr, - jlocation *locationPtr); - jvmdiError (JNICALL *NotifyFramePop) - (jframeID frame); - jvmdiError (JNICALL *GetLocalObject) - (jframeID frame, jint slot, jobject *valuePtr); - jvmdiError (JNICALL *GetLocalInt) - (jframeID frame, jint slot, jint *valuePtr); - jvmdiError (JNICALL *GetLocalLong) - (jframeID frame, jint slot, jlong *valuePtr); - jvmdiError (JNICALL *GetLocalFloat) - (jframeID frame, jint slot, jfloat *valuePtr); - jvmdiError (JNICALL *GetLocalDouble) - (jframeID frame, jint slot, jdouble *valuePtr); - jvmdiError (JNICALL *SetLocalObject) - (jframeID frame, jint slot, jobject value); - jvmdiError (JNICALL *SetLocalInt) - (jframeID frame, jint slot, jint value); - jvmdiError (JNICALL *SetLocalLong) - (jframeID frame, jint slot, jlong value); - jvmdiError (JNICALL *SetLocalFloat) - (jframeID frame, jint slot, jfloat value); - jvmdiError (JNICALL *SetLocalDouble) - (jframeID frame, jint slot, jdouble value); - - jvmdiError (JNICALL *CreateRawMonitor) - (char *name, JVMDI_RawMonitor *monitorPtr); - jvmdiError (JNICALL *DestroyRawMonitor) - (JVMDI_RawMonitor monitor); - jvmdiError (JNICALL *RawMonitorEnter) - (JVMDI_RawMonitor monitor); - jvmdiError (JNICALL *RawMonitorExit) - (JVMDI_RawMonitor monitor); - jvmdiError (JNICALL *RawMonitorWait) - (JVMDI_RawMonitor monitor, jlong millis); - jvmdiError (JNICALL *RawMonitorNotify) - (JVMDI_RawMonitor monitor); - jvmdiError (JNICALL *RawMonitorNotifyAll) - (JVMDI_RawMonitor monitor); - - jvmdiError (JNICALL *SetBreakpoint) - (jclass clazz, jmethodID method, jlocation location); - jvmdiError (JNICALL *ClearBreakpoint) - (jclass clazz, jmethodID method, jlocation location); - jvmdiError (JNICALL *ClearAllBreakpoints) - (); - - jvmdiError (JNICALL *SetFieldAccessWatch) - (jclass clazz, jfieldID field); - jvmdiError (JNICALL *ClearFieldAccessWatch) - (jclass clazz, jfieldID field); - jvmdiError (JNICALL *SetFieldModificationWatch) - (jclass clazz, jfieldID field); - jvmdiError (JNICALL *ClearFieldModificationWatch) - (jclass clazz, jfieldID field); - - jvmdiError (JNICALL *SetAllocationHooks) - (JVMDI_AllocHook ahook, JVMDI_DeallocHook dhook); - jvmdiError (JNICALL *Allocate) - (jlong size, jbyte** memPtr); - jvmdiError (JNICALL *Deallocate) - (jbyte* mem); - - jvmdiError (JNICALL *GetClassSignature) - (jclass clazz, char **sigPtr); - jvmdiError (JNICALL *GetClassStatus) - (jclass clazz, jint *statusPtr); - jvmdiError (JNICALL *GetSourceFileName) - (jclass clazz, char **sourceNamePtr); - jvmdiError (JNICALL *GetClassModifiers) - (jclass clazz, jint *modifiersPtr); - jvmdiError (JNICALL *GetClassMethods) - (jclass clazz, jint *methodCountPtr, jmethodID **methodsPtr); - jvmdiError (JNICALL *GetClassFields) - (jclass clazz, jint *fieldCountPtr, jfieldID **fieldsPtr); - jvmdiError (JNICALL *GetImplementedInterfaces) - (jclass clazz, jint *interfaceCountPtr, jclass **interfacesPtr); - jvmdiError (JNICALL *IsInterface) - (jclass clazz, jboolean *isInterfacePtr); - jvmdiError (JNICALL *IsArrayClass) - (jclass clazz, jboolean *isArrayClassPtr); - jvmdiError (JNICALL *GetClassLoader) - (jclass clazz, jobject *classloaderPtr); - - jvmdiError (JNICALL *GetObjectHashCode) - (jobject object, jint *hashCodePtr); - jvmdiError (JNICALL *GetMonitorInfo) - (jobject object, JVMDI_monitor_info *infoPtr); - - jvmdiError (JNICALL *GetFieldName) - (jclass clazz, jfieldID field, char **namePtr, char **signaturePtr); - jvmdiError (JNICALL *GetFieldDeclaringClass) - (jclass clazz, jfieldID field, jclass *declaringClassPtr); - jvmdiError (JNICALL *GetFieldModifiers) - (jclass clazz, jfieldID field, jint *modifiersPtr); - jvmdiError (JNICALL *IsFieldSynthetic) - (jclass clazz, jfieldID field, jboolean *isSyntheticPtr); - - jvmdiError (JNICALL *GetMethodName) - (jclass clazz, jmethodID method, - char **namePtr, char **signaturePtr); - jvmdiError (JNICALL *GetMethodDeclaringClass) - (jclass clazz, jmethodID method, jclass *declaringClassPtr); - jvmdiError (JNICALL *GetMethodModifiers) - (jclass clazz, jmethodID method, jint *modifiersPtr); - jvmdiError (JNICALL *GetMaxStack) - (jclass clazz, jmethodID method, jint *maxPtr); - jvmdiError (JNICALL *GetMaxLocals) - (jclass clazz, jmethodID method, jint *maxPtr); - jvmdiError (JNICALL *GetArgumentsSize) - (jclass clazz, jmethodID method, jint *sizePtr); - jvmdiError (JNICALL *GetLineNumberTable) - (jclass clazz, jmethodID method, - jint *entryCountPtr, JVMDI_line_number_entry **tablePtr); - jvmdiError (JNICALL *GetMethodLocation) - (jclass clazz, jmethodID method, - jlocation *startLocationPtr, jlocation *endLocationPtr); - jvmdiError (JNICALL *GetLocalVariableTable) - (jclass clazz, jmethodID method, - jint *entryCountPtr, JVMDI_local_variable_entry **tablePtr); - jvmdiError (JNICALL *GetExceptionHandlerTable) - (jclass clazz, jmethodID method, - jint *entryCountPtr, JVMDI_exception_handler_entry **tablePtr); - jvmdiError (JNICALL *GetThrownExceptions) - (jclass clazz, jmethodID method, - jint *exceptionCountPtr, jclass **exceptionsPtr); - jvmdiError (JNICALL *GetBytecodes) - (jclass clazz, jmethodID method, - jint *bytecodeCountPtr, jbyte **bytecodesPtr); - jvmdiError (JNICALL *IsMethodNative) - (jclass clazz, jmethodID method, jboolean *isNativePtr); - jvmdiError (JNICALL *IsMethodSynthetic) - (jclass clazz, jmethodID method, jboolean *isSyntheticPtr); - - jvmdiError (JNICALL *GetLoadedClasses) - (jint *classCountPtr, jclass **classesPtr); - jvmdiError (JNICALL *GetClassLoaderClasses) - (jobject initiatingLoader, jint *classesCountPtr, - jclass **classesPtr); - - jvmdiError (JNICALL *PopFrame) - (jthread thread); - jvmdiError (JNICALL *SetFrameLocation) - (jframeID frame, jlocation location); - jvmdiError (JNICALL *GetOperandStack) - (jframeID frame, jint *operandStackSizePtr, - JVMDI_operand_stack_element **operandStackPtr); - jvmdiError (JNICALL *SetOperandStack) - (jframeID frame, jint operandStackSize, - JVMDI_operand_stack_element *operandStack); - jvmdiError (JNICALL *AllInstances) - (jclass clazz, jint *instanceCountPtr, jobject **instancesPtr); - jvmdiError (JNICALL *References) - (jobject obj, JVMDI_object_reference_info *refs); - jvmdiError (JNICALL *GetClassDefinition) - (jclass clazz, JVMDI_class_definition *classDefPtr); - jvmdiError (JNICALL *RedefineClasses) - (jint classCount, JVMDI_class_definition *classDefs); - - jvmdiError (JNICALL *GetVersionNumber) - (jint *versionPtr); - jvmdiError (JNICALL *GetCapabilities) - (JVMDI_capabilities *capabilitiesPtr); - - jvmdiError (JNICALL *GetSourceDebugExtension) - (jclass clazz, char **sourceDebugExtension); - jvmdiError (JNICALL *IsMethodObsolete) - (jclass clazz, jmethodID method, jboolean *isObsoletePtr); - - jvmdiError (JNICALL *SuspendThreadList) - (jint reqCount, jthread *reqList, jvmdiError *results); - jvmdiError (JNICALL *ResumeThreadList) - (jint reqCount, jthread *reqList, jvmdiError *results); -} JVMDI_Interface_1; - -#ifndef NO_JVMDI_MACROS - -#define JVMDI_ERROR_DUPLICATE_BREAKPOINT JVMDI_ERROR_DUPLICATE -#define JVMDI_ERROR_NO_SUCH_BREAKPOINT JVMDI_ERROR_NOT_FOUND -#define JVMDI_ERROR_DUPLICATE_FRAME_POP JVMDI_ERROR_DUPLICATE - - -static JVMDI_Interface_1 *jvmdi_interface = NULL; -static JavaVM *j_vm; - -#ifdef __cplusplus -#define SetJVMDIfromJNIEnv(a_env) ( (jvmdi_interface == NULL)? \ - ((a_env)->GetJavaVM(&j_vm), \ - (j_vm)->GetEnv((void **)&jvmdi_interface, \ - JVMDI_VERSION_1)):0) -#else -#define SetJVMDIfromJNIEnv(a_env) ( (jvmdi_interface == NULL)? \ - ((*a_env)->GetJavaVM(a_env, &j_vm), \ - (*j_vm)->GetEnv(j_vm, (void **)&jvmdi_interface, \ - JVMDI_VERSION_1)):0) -#endif - -#define JVMDI_SetEventHook(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetEventHook(a1) ) -#define JVMDI_GetThreadStatus(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetThreadStatus(a1, a2, a3) ) -#define JVMDI_GetAllThreads(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetAllThreads(a1, a2) ) -#define JVMDI_SuspendThread(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SuspendThread(a1) ) -#define JVMDI_ResumeThread(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->ResumeThread(a1) ) -#define JVMDI_StopThread(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->StopThread(a1, a2) ) -#define JVMDI_InterruptThread(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->InterruptThread(a1) ) -#define JVMDI_SetSingleStep(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetEventNotificationMode( \ - (a2) ? JVMDI_ENABLE : JVMDI_DISABLE, \ - JVMDI_EVENT_SINGLE_STEP, a1) ) -#define JVMDI_GetThreadInfo(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetThreadInfo(a1, a2) ) -#define JVMDI_RunDebugThread(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RunDebugThread(a1, a2, a3, a4) ) -#define JVMDI_GetTopThreadGroups(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetTopThreadGroups(a1, a2) ) -#define JVMDI_GetThreadGroupInfo(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetThreadGroupInfo(a1, a2) ) -#define JVMDI_GetThreadGroupChildren(a_env, a1, a2, a3, a4, a5) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetThreadGroupChildren(a1, a2, a3, a4, a5) ) -#define JVMDI_GetCurrentFrame(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetCurrentFrame(a1, a2) ) -#define JVMDI_GetCallerFrame(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetCallerFrame(a1, a2) ) -#define JVMDI_GetFrameLocation(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetFrameLocation(a1, a2, a3, a4) ) -#define JVMDI_NotifyFramePop(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->NotifyFramePop(a1) ) -#define JVMDI_GetLocalObject(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalObject(a1, a2, a3) ) -#define JVMDI_GetLocalInt(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalInt(a1, a2, a3) ) -#define JVMDI_GetLocalLong(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalLong(a1, a2, a3) ) -#define JVMDI_GetLocalFloat(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalFloat(a1, a2, a3) ) -#define JVMDI_GetLocalDouble(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalDouble(a1, a2, a3) ) -#define JVMDI_SetLocalObject(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetLocalObject(a1, a2, a3) ) -#define JVMDI_SetLocalInt(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetLocalInt(a1, a2, a3) ) -#define JVMDI_SetLocalLong(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetLocalLong(a1, a2, a3) ) -#define JVMDI_SetLocalFloat(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetLocalFloat(a1, a2, a3) ) -#define JVMDI_SetLocalDouble(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetLocalDouble(a1, a2, a3) ) -#define JVMDI_CreateRawMonitor(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->CreateRawMonitor(a1, a2) ) -#define JVMDI_DestroyRawMonitor(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->DestroyRawMonitor(a1) ) -#define JVMDI_RawMonitorEnter(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RawMonitorEnter(a1) ) -#define JVMDI_RawMonitorExit(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RawMonitorExit(a1) ) -#define JVMDI_RawMonitorWait(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RawMonitorWait(a1, a2) ) -#define JVMDI_RawMonitorNotify(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RawMonitorNotify(a1) ) -#define JVMDI_RawMonitorNotifyAll(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->RawMonitorNotifyAll(a1) ) -#define JVMDI_SetBreakpoint(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetBreakpoint(a1, a2, a3) ) -#define JVMDI_ClearBreakpoint(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->ClearBreakpoint(a1, a2, a3) ) -#define JVMDI_ClearAllBreakpoints(a_env) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->ClearAllBreakpoints() ) -#define JVMDI_SetAllocationHooks(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->SetAllocationHooks(a1, a2) ) -#define JVMDI_Allocate(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->Allocate(a1, a2) ) -#define JVMDI_Deallocate(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->Deallocate(a1) ) -#define JVMDI_GetClassSignature(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassSignature(a1, a2) ) -#define JVMDI_GetClassStatus(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassStatus(a1, a2) ) -#define JVMDI_GetSourceFileName(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetSourceFileName(a1, a2) ) -#define JVMDI_GetClassModifiers(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassModifiers(a1, a2) ) -#define JVMDI_GetClassMethods(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassMethods(a1, a2, a3) ) -#define JVMDI_GetClassFields(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassFields(a1, a2, a3) ) -#define JVMDI_GetImplementedInterfaces(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetImplementedInterfaces(a1, a2, a3) ) -#define JVMDI_IsInterface(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->IsInterface(a1, a2) ) -#define JVMDI_IsArrayClass(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->IsArrayClass(a1, a2) ) -#define JVMDI_ClassLoader(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassLoader(a1, a2) ) -#define JVMDI_GetFieldName(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetFieldName(a1, a2, a3, a4) ) -#define JVMDI_GetFieldDeclaringClass(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetFieldDeclaringClass(a1, a2, a3) ) -#define JVMDI_GetFieldModifiers(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetFieldModifiers(a1, a2, a3) ) -#define JVMDI_GetMethodName(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMethodName(a1, a2, a3, a4) ) -#define JVMDI_GetMethodDeclaringClass(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMethodDeclaringClass(a1, a2, a3) ) -#define JVMDI_GetMethodModifiers(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMethodModifiers(a1, a2, a3) ) -#define JVMDI_GetMaxStack(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMaxStack(a1, a2, a3) ) -#define JVMDI_GetMaxLocals(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMaxLocals(a1, a2, a3) ) -#define JVMDI_GetArgumentsSize(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetArgumentsSize(a1, a2, a3) ) -#define JVMDI_GetLineNumberTable(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLineNumberTable(a1, a2, a3, a4) ) -#define JVMDI_GetMethodLocation(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetMethodLocation(a1, a2, a3, a4) ) -#define JVMDI_GetLocalVariableTable(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLocalVariableTable(a1, a2, a3, a4) ) -#define JVMDI_GetExceptionHandlerTable(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetExceptionHandlerTable(a1, a2, a3, a4) ) -#define JVMDI_GetThrownExceptions(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetThrownExceptions(a1, a2, a3, a4) ) -#define JVMDI_GetBytecodes(a_env, a1, a2, a3, a4) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetBytecodes(a1, a2, a3, a4) ) -#define JVMDI_IsMethodNative(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->IsMethodNative(a1, a2, a3) ) -#define JVMDI_GetLoadedClasses(a_env, a1, a2) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetLoadedClasses(a1, a2) ) -#define JVMDI_GetClassLoaderClasses(a_env, a1, a2, a3) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetClassLoaderClasses(a1, a2, a3) ) -#define JVMDI_GetVersionNumber(a_env, a1) ( \ - SetJVMDIfromJNIEnv(a_env), \ - jvmdi_interface->GetVersionNumber(a1) ) - -#endif /* !NO_JVMDI_MACROS */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVASOFT_JVMDI_H_ */ - - diff --git a/JavaOpenJPEG/java-jni/include/jvmpi.h b/JavaOpenJPEG/java-jni/include/jvmpi.h deleted file mode 100644 index 557b231b..00000000 --- a/JavaOpenJPEG/java-jni/include/jvmpi.h +++ /dev/null @@ -1,642 +0,0 @@ -/* - * @(#)jvmpi.h 1.28 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JVMPI_H_ -#define _JAVASOFT_JVMPI_H_ - -#include "jni.h" - -#define JVMPI_VERSION_1 ((jint)0x10000001) /* implied 0 for minor version */ -#define JVMPI_VERSION_1_1 ((jint)0x10000002) -#define JVMPI_VERSION_1_2 ((jint)0x10000003) - -#ifdef __cplusplus -extern "C" { -#endif - typedef void (*jvmpi_void_function_of_void)(void *); -#ifdef __cplusplus -} -#endif - -/**************************************************************** - * Profiler interface data structures. - ****************************************************************/ -/* identifier types. */ -struct _jobjectID; -typedef struct _jobjectID * jobjectID; /* type of object ids */ - -/* raw monitors */ -struct _JVMPI_RawMonitor; -typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor; - -/* call frame */ -typedef struct { - jint lineno; /* line number in the source file */ - jmethodID method_id; /* method executed in this frame */ -} JVMPI_CallFrame; - -/* call trace */ -typedef struct { - JNIEnv *env_id; /* Env where trace was recorded */ - jint num_frames; /* number of frames in this trace */ - JVMPI_CallFrame *frames; /* frames */ -} JVMPI_CallTrace; - -/* method */ -typedef struct { - char *method_name; /* name of method */ - char *method_signature; /* signature of method */ - jint start_lineno; /* -1 if native, abstract .. */ - jint end_lineno; /* -1 if native, abstract .. */ - jmethodID method_id; /* id assigned to this method */ -} JVMPI_Method; - -/* Field */ -typedef struct { - char *field_name; /* name of field */ - char *field_signature; /* signature of field */ -} JVMPI_Field; - -/* line number info for a compiled method */ -typedef struct { - jint offset; /* offset from beginning of method */ - jint lineno; /* lineno from beginning of src file */ -} JVMPI_Lineno; - -/* event */ -typedef struct { - jint event_type; /* event_type */ - JNIEnv *env_id; /* env where this event occured */ - - union { - struct { - const char *class_name; /* class name */ - char *source_name; /* name of source file */ - jint num_interfaces; /* number of interfaces implemented */ - jint num_methods; /* number of methods in the class */ - JVMPI_Method *methods; /* methods */ - jint num_static_fields; /* number of static fields */ - JVMPI_Field *statics; /* static fields */ - jint num_instance_fields; /* number of instance fields */ - JVMPI_Field *instances; /* instance fields */ - jobjectID class_id; /* id of the class object */ - } class_load; - - struct { - jobjectID class_id; /* id of the class object */ - } class_unload; - - struct { - unsigned char *class_data; /* content of class file */ - jint class_data_len; /* class file length */ - unsigned char *new_class_data; /* instrumented class file */ - jint new_class_data_len; /* new class file length */ - void * (*malloc_f)(unsigned int); /* memory allocation function */ - } class_load_hook; - - struct { - jint arena_id; - jobjectID class_id; /* id of object class */ - jint is_array; /* JVMPI_NORMAL_OBJECT, ... */ - jint size; /* size in number of bytes */ - jobjectID obj_id; /* id assigned to this object */ - } obj_alloc; - - struct { - jobjectID obj_id; /* id of the object */ - } obj_free; - - struct { - jint arena_id; /* cur arena id */ - jobjectID obj_id; /* cur object id */ - jint new_arena_id; /* new arena id */ - jobjectID new_obj_id; /* new object id */ - } obj_move; - - struct { - jint arena_id; /* id of arena */ - const char *arena_name; /* name of arena */ - } new_arena; - - struct { - jint arena_id; /* id of arena */ - } delete_arena; - - struct { - char *thread_name; /* name of thread */ - char *group_name; /* name of group */ - char *parent_name; /* name of parent */ - jobjectID thread_id; /* id of the thread object */ - JNIEnv *thread_env_id; - } thread_start; - - struct { - int dump_level; /* level of the heap dump info */ - char *begin; /* where all the root records begin, - please see the heap dump buffer - format described below */ - char *end; /* where the object records end. */ - jint num_traces; /* number of thread traces, - 0 if dump level = JVMPI_DUMP_LEVEL_0 */ - JVMPI_CallTrace *traces; /* thread traces collected during - heap dump */ - } heap_dump; - - struct { - jobjectID obj_id; /* object id */ - jobject ref_id; /* id assigned to the globalref */ - } jni_globalref_alloc; - - struct { - jobject ref_id; /* id of the global ref */ - } jni_globalref_free; - - struct { - jmethodID method_id; /* method */ - } method; - - struct { - jmethodID method_id; /* id of method */ - jobjectID obj_id; /* id of target object */ - } method_entry2; - - struct { - jmethodID method_id; /* id of compiled method */ - void *code_addr; /* code start addr. in memory */ - jint code_size; /* code size */ - jint lineno_table_size; /* size of lineno table */ - JVMPI_Lineno *lineno_table; /* lineno info */ - } compiled_method_load; - - struct { - jmethodID method_id; /* id of unloaded compiled method */ - } compiled_method_unload; - - struct { - jmethodID method_id; /* id of the method the instruction belongs to */ - jint offset; /* instruction offset in the method's bytecode */ - union { - struct { - jboolean is_true; /* whether true or false branch is taken */ - } if_info; - struct { - jint key; /* top stack value used as an index */ - jint low; /* min value of the index */ - jint hi; /* max value of the index */ - } tableswitch_info; - struct { - jint chosen_pair_index; /* actually chosen pair index (0-based) - * if chosen_pair_index == pairs_total then - * the 'default' branch is taken - */ - jint pairs_total; /* total number of lookupswitch pairs */ - } lookupswitch_info; - } u; - } instruction; - - struct { - char *begin; /* beginning of dump buffer, - see below for format */ - char *end; /* end of dump buffer */ - jint num_traces; /* number of traces */ - JVMPI_CallTrace *traces; /* traces of all threads */ - jint *threads_status; /* status of all threads */ - } monitor_dump; - - struct { - const char *name; /* name of raw monitor */ - JVMPI_RawMonitor id; /* id */ - } raw_monitor; - - struct { - jobjectID object; /* Java object */ - } monitor; - - struct { - jobjectID object; /* Java object */ - jlong timeout; /* timeout period */ - } monitor_wait; - - struct { - jlong used_objects; - jlong used_object_space; - jlong total_object_space; - } gc_info; - - struct { - jint data_len; - char *data; - } object_dump; - } u; -} JVMPI_Event; - -/* interface functions */ -typedef struct { - jint version; /* JVMPI version */ - - /* ------interface implemented by the profiler------ */ - - /** - * Function called by the JVM to notify an event. - */ - void (*NotifyEvent)(JVMPI_Event *event); - - /* ------interface implemented by the JVM------ */ - - /** - * Function called by the profiler to enable/disable/send notification - * for a particular event type. - * - * event_type - event_type - * arg - event specific arg - * - * return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL - */ - jint (*EnableEvent)(jint event_type, void *arg); - jint (*DisableEvent)(jint event_type, void *arg); - jint (*RequestEvent)(jint event_type, void *arg); - - /** - * Function called by the profiler to get a stack - * trace from the JVM. - * - * trace - trace data structure to be filled - * depth - maximum depth of the trace. - */ - void (*GetCallTrace)(JVMPI_CallTrace *trace, jint depth); - - /** - * Function called by profiler when it wants to exit/stop. - */ - void (*ProfilerExit)(jint); - - /** - * Utility functions provided by the JVM. - */ - JVMPI_RawMonitor (*RawMonitorCreate)(char *lock_name); - void (*RawMonitorEnter)(JVMPI_RawMonitor lock_id); - void (*RawMonitorExit)(JVMPI_RawMonitor lock_id); - void (*RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms); - void (*RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id); - void (*RawMonitorDestroy)(JVMPI_RawMonitor lock_id); - - /** - * Function called by the profiler to get the current thread's CPU time. - * - * return time in nanoseconds; - */ - jlong (*GetCurrentThreadCpuTime)(void); - - void (*SuspendThread)(JNIEnv *env); - void (*ResumeThread)(JNIEnv *env); - jint (*GetThreadStatus)(JNIEnv *env); - jboolean (*ThreadHasRun)(JNIEnv *env); - - /* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE - notification by the JVM. */ - jint (*CreateSystemThread)(char *name, jint priority, void (*f)(void *)); - - /* thread local storage access functions to avoid locking in time - critical functions */ - void (*SetThreadLocalStorage)(JNIEnv *env_id, void *ptr); - void * (*GetThreadLocalStorage)(JNIEnv *env_id); - - /* control GC */ - void (*DisableGC)(void); - void (*EnableGC)(void); - void (*RunGC)(void); - - jobjectID (*GetThreadObject)(JNIEnv *env); - jobjectID (*GetMethodClass)(jmethodID mid); - - /* JNI <-> jobject conversions */ - jobject (*jobjectID2jobject)(jobjectID jid); - jobjectID (*jobject2jobjectID)(jobject jobj); - - void (*SuspendThreadList) - (jint reqCount, JNIEnv **reqList, jint *results); - void (*ResumeThreadList) - (jint reqCount, JNIEnv **reqList, jint *results); -} JVMPI_Interface; - -/* type of argument passed to RequestEvent for heap dumps */ -typedef struct { - jint heap_dump_level; -} JVMPI_HeapDumpArg; - -/********************************************************************** - * Constants and formats used in JVM Profiler Interface. - **********************************************************************/ -/* - * Event type constants. - */ -#define JVMPI_EVENT_METHOD_ENTRY ((jint)1) -#define JVMPI_EVENT_METHOD_ENTRY2 ((jint)2) -#define JVMPI_EVENT_METHOD_EXIT ((jint)3) - -#define JVMPI_EVENT_OBJECT_ALLOC ((jint)4) -#define JVMPI_EVENT_OBJECT_FREE ((jint)5) -#define JVMPI_EVENT_OBJECT_MOVE ((jint)6) - -#define JVMPI_EVENT_COMPILED_METHOD_LOAD ((jint)7) -#define JVMPI_EVENT_COMPILED_METHOD_UNLOAD ((jint)8) - -#define JVMPI_EVENT_INSTRUCTION_START ((jint)9) - -#define JVMPI_EVENT_THREAD_START ((jint)33) -#define JVMPI_EVENT_THREAD_END ((jint)34) - -#define JVMPI_EVENT_CLASS_LOAD_HOOK ((jint)35) - -#define JVMPI_EVENT_HEAP_DUMP ((jint)37) -#define JVMPI_EVENT_JNI_GLOBALREF_ALLOC ((jint)38) -#define JVMPI_EVENT_JNI_GLOBALREF_FREE ((jint)39) -#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC ((jint)40) -#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE ((jint)41) -#define JVMPI_EVENT_CLASS_LOAD ((jint)42) -#define JVMPI_EVENT_CLASS_UNLOAD ((jint)43) -#define JVMPI_EVENT_DATA_DUMP_REQUEST ((jint)44) -#define JVMPI_EVENT_DATA_RESET_REQUEST ((jint)45) - -#define JVMPI_EVENT_JVM_INIT_DONE ((jint)46) -#define JVMPI_EVENT_JVM_SHUT_DOWN ((jint)47) - -#define JVMPI_EVENT_ARENA_NEW ((jint)48) -#define JVMPI_EVENT_ARENA_DELETE ((jint)49) - -#define JVMPI_EVENT_OBJECT_DUMP ((jint)50) - -#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER ((jint)51) -#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52) -#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT ((jint)53) -#define JVMPI_EVENT_MONITOR_CONTENDED_ENTER ((jint)54) -#define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED ((jint)55) -#define JVMPI_EVENT_MONITOR_CONTENDED_EXIT ((jint)56) -#define JVMPI_EVENT_MONITOR_WAIT ((jint)57) -#define JVMPI_EVENT_MONITOR_WAITED ((jint)58) -#define JVMPI_EVENT_MONITOR_DUMP ((jint)59) - -#define JVMPI_EVENT_GC_START ((jint)60) -#define JVMPI_EVENT_GC_FINISH ((jint)61) - -#define JVMPI_MAX_EVENT_TYPE_VAL ((jint)61) - -/* old definitions, to be removed */ -#define JVMPI_EVENT_LOAD_COMPILED_METHOD ((jint)7) -#define JVMPI_EVENT_UNLOAD_COMPILED_METHOD ((jint)8) -#define JVMPI_EVENT_NEW_ARENA ((jint)48) -#define JVMPI_EVENT_DELETE_ARENA ((jint)49) -#define JVMPI_EVENT_DUMP_DATA_REQUEST ((jint)44) -#define JVMPI_EVENT_RESET_DATA_REQUEST ((jint)45) -#define JVMPI_EVENT_OBJ_ALLOC ((jint)4) -#define JVMPI_EVENT_OBJ_FREE ((jint)5) -#define JVMPI_EVENT_OBJ_MOVE ((jint)6) - -#define JVMPI_REQUESTED_EVENT ((jint)0x10000000) - - - -/* - * enabling/disabling event notification. - */ -/* results */ -#define JVMPI_SUCCESS ((jint)0) -#define JVMPI_NOT_AVAILABLE ((jint)1) -#define JVMPI_FAIL ((jint)-1) - -/* - * Thread status - */ -enum { - JVMPI_THREAD_RUNNABLE = 1, - JVMPI_THREAD_MONITOR_WAIT, - JVMPI_THREAD_CONDVAR_WAIT -}; - -#define JVMPI_THREAD_SUSPENDED 0x8000 -#define JVMPI_THREAD_INTERRUPTED 0x4000 - -/* - * Thread priority - */ -#define JVMPI_MINIMUM_PRIORITY 1 -#define JVMPI_MAXIMUM_PRIORITY 10 -#define JVMPI_NORMAL_PRIORITY 5 - -/* - * Object type constants. - */ -#define JVMPI_NORMAL_OBJECT ((jint)0) -#define JVMPI_CLASS ((jint)2) -#define JVMPI_BOOLEAN ((jint)4) -#define JVMPI_CHAR ((jint)5) -#define JVMPI_FLOAT ((jint)6) -#define JVMPI_DOUBLE ((jint)7) -#define JVMPI_BYTE ((jint)8) -#define JVMPI_SHORT ((jint)9) -#define JVMPI_INT ((jint)10) -#define JVMPI_LONG ((jint)11) - -/* - * Monitor dump constants. - */ - -#define JVMPI_MONITOR_JAVA 0x01 -#define JVMPI_MONITOR_RAW 0x02 - -/* - * Heap dump constants. - */ -#define JVMPI_GC_ROOT_UNKNOWN 0xff -#define JVMPI_GC_ROOT_JNI_GLOBAL 0x01 -#define JVMPI_GC_ROOT_JNI_LOCAL 0x02 -#define JVMPI_GC_ROOT_JAVA_FRAME 0x03 -#define JVMPI_GC_ROOT_NATIVE_STACK 0x04 -#define JVMPI_GC_ROOT_STICKY_CLASS 0x05 -#define JVMPI_GC_ROOT_THREAD_BLOCK 0x06 -#define JVMPI_GC_ROOT_MONITOR_USED 0x07 -#define JVMPI_GC_ROOT_THREAD_OBJ 0x08 - -#define JVMPI_GC_CLASS_DUMP 0x20 -#define JVMPI_GC_INSTANCE_DUMP 0x21 -#define JVMPI_GC_OBJ_ARRAY_DUMP 0x22 -#define JVMPI_GC_PRIM_ARRAY_DUMP 0x23 - -/* - * Dump levels - */ -#define JVMPI_DUMP_LEVEL_0 ((jint)0) -#define JVMPI_DUMP_LEVEL_1 ((jint)1) -#define JVMPI_DUMP_LEVEL_2 ((jint)2) - -/* Types used in dumps - - * - * u1: 1 byte - * u2: 2 bytes - * u4: 4 bytes - * u8: 8 bytes - * - * ty: u1 where: - * JVMPI_CLASS: object - * JVMPI_BOOLEAN: boolean - * JVMPI_CHAR: char - * JVMPI_FLOAT: float - * JVMPI_DOUBLE: double - * JVMPI_BYTE: byte - * JVMPI_SHORT: short - * JVMPI_INT: int - * JVMPI_LONG: long - * - * vl: values, exact type depends on the type of the value: - * JVMPI_BOOLEAN & JVMPI_BYTE: u1 - * JVMPI_SHORT & JVMPI_CHAR: u2 - * JVMPI_INT & JVMPI_FLOAT: u4 - * JVMPI_LONG & JVMPI_DOUBLE: u8 - * JVMPI_CLASS: jobjectID - */ - -/* Format of the monitor dump buffer: - * - * u1 monitor type - * - * JVMPI_MONITOR_JAVA Java monitor - * - * jobjectID object - * JNIEnv * owner thread - * u4 entry count - * u4 # of threads waiting to enter - * [JNIEnv *]* threads waiting to enter - * u4 # of threads waiting to be notified - * [JNIEnv *]* threads waiting to be notified - * - * JVMPI_MONITOR_RAW raw monitor - * - * char * name - * JVMPI_RawMonitor raw monitor - * JNIEnv * owner thread - * u4 entry count - * u4 # of threads waiting to enter - * [JNIEnv *]* threads waiting to enter - * u4 # of threads waiting to be notified - * [JNIEnv *]* threads waiting to be notified - */ - -/* Format of the heap dump buffer depends on the dump level - * specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg. - * The default is JVMPI_DUMP_LEVEL_2. - * - * JVMPI_DUMP_LEVEL_0: - * - * u1 object type (JVMPI_CLASS ...) - * jobjectID object - * - * JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format: - * In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object - * instance dumps , the values of primitive statics in class dumps and the - * values of primitive arrays are excluded. JVMPI_DUMP_LEVEL_2 includes the - * primitive values. - * - * u1 record type - * - * JVMPI_GC_ROOT_UNKNOWN unknown root - * - * jobjectID object - * - * JVMPI_GC_ROOT_JNI_GLOBAL JNI global ref root - * - * jobjectID object - * jobject JNI global reference - * - * JVMPI_GC_ROOT_JNI_LOCAL JNI local ref - * - * jobjectID object - * JNIEnv * thread - * u4 frame # in stack trace (-1 for empty) - * - * JVMPI_GC_ROOT_JAVA_FRAME Java stack frame - * - * jobjectID object - * JNIEnv * thread - * u4 frame # in stack trace (-1 for empty) - * - * JVMPI_GC_ROOT_NATIVE_STACK Native stack - * - * jobjectID object - * JNIEnv * thread - * - * JVMPI_GC_ROOT_STICKY_CLASS System class - * - * jobjectID class object - * - * JVMPI_GC_ROOT_THREAD_BLOCK Reference from thread block - * - * jobjectID thread object - * JNIEnv * thread - * - * JVMPI_GC_ROOT_MONITOR_USED Busy monitor - * - * jobjectID object - * - * JVMPI_GC_CLASS_DUMP dump of a class object - * - * jobjectID class - * jobjectID super - * jobjectID class loader - * jobjectID signers - * jobjectID protection domain - * jobjectID class name - * void * reserved - * - * u4 instance size (in bytes) - * - * [jobjectID]* interfaces - * - * u2 size of constant pool - * [u2, constant pool index, - * ty, type, - * vl]* value - * - * [vl]* static field values - * - * JVMPI_GC_INSTANCE_DUMP dump of a normal object - * - * jobjectID object - * jobjectID class - * u4 number of bytes that follow - * [vl]* instance field values (class, followed - * by super, super's super ...) - * - * JVMPI_GC_OBJ_ARRAY_DUMP dump of an object array - * - * jobjectID array object - * u4 number of elements - * jobjectID element class - * [jobjectID]* elements - * - * JVMPI_GC_PRIM_ARRAY_DUMP dump of a primitive array - * - * jobjectID array object - * u4 number of elements - * ty element type - * [vl]* elements - * - */ - -/* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP: - * All the records have JVMPI_DUMP_LEVEL_2 information. - * - * u1 record type - * - * followed by a: - * - * JVMPI_GC_CLASS_DUMP, - * JVMPI_GC_INSTANCE_DUMP, - * JVMPI_GC_OBJ_ARRAY_DUMP, or - * JVMPI_GC_PRIM_ARRAY_DUMP record. - */ - -#endif /* !_JAVASOFT_JVMPI_H_ */ diff --git a/JavaOpenJPEG/java-jni/include/jvmti.h b/JavaOpenJPEG/java-jni/include/jvmti.h deleted file mode 100644 index de24e3e9..00000000 --- a/JavaOpenJPEG/java-jni/include/jvmti.h +++ /dev/null @@ -1,2181 +0,0 @@ -#ifdef USE_PRAGMA_IDENT_HDR -#pragma ident "@(#)jvmtiLib.xsl 1.32 04/06/01 20:19:53 JVM" -#endif -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - - /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ - - - /* Include file for the Java(tm) Virtual Machine Tool Interface */ - -#ifndef _JAVA_JVMTI_H_ -#define _JAVA_JVMTI_H_ - -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - JVMTI_VERSION_1 = 0x30010000, - JVMTI_VERSION_1_0 = 0x30010000, - - JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (0 * 0x100) + 33 /* version: 1.0.33 */ -}; - -JNIEXPORT jint JNICALL -Agent_OnLoad(JavaVM *vm, char *options, void *reserved); - -JNIEXPORT void JNICALL -Agent_OnUnload(JavaVM *vm); - - /* Forward declaration of the environment */ - -struct _jvmtiEnv; - -struct jvmtiInterface_1_; - -#ifdef __cplusplus -typedef _jvmtiEnv jvmtiEnv; -#else -typedef const struct jvmtiInterface_1_ *jvmtiEnv; -#endif /* __cplusplus */ - -/* Derived Base Types */ - -typedef jobject jthread; -typedef jobject jthreadGroup; -typedef jlong jlocation; -struct _jrawMonitorID; -typedef struct _jrawMonitorID *jrawMonitorID; -typedef struct JNINativeInterface_ jniNativeInterface; - - /* Constants */ - - - /* Thread State Flags */ - -enum { - JVMTI_THREAD_STATE_ALIVE = 0x0001, - JVMTI_THREAD_STATE_TERMINATED = 0x0002, - JVMTI_THREAD_STATE_RUNNABLE = 0x0004, - JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400, - JVMTI_THREAD_STATE_WAITING = 0x0080, - JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010, - JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020, - JVMTI_THREAD_STATE_SLEEPING = 0x0040, - JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100, - JVMTI_THREAD_STATE_PARKED = 0x0200, - JVMTI_THREAD_STATE_SUSPENDED = 0x100000, - JVMTI_THREAD_STATE_INTERRUPTED = 0x200000, - JVMTI_THREAD_STATE_IN_NATIVE = 0x400000, - JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000, - JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000, - JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000 -}; - - /* java.lang.Thread.State Conversion Masks */ - -enum { - JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, - JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0, - JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED, - JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE, - JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, - JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY, - JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT -}; - - /* Thread Priority Constants */ - -enum { - JVMTI_THREAD_MIN_PRIORITY = 1, - JVMTI_THREAD_NORM_PRIORITY = 5, - JVMTI_THREAD_MAX_PRIORITY = 10 -}; - - /* Heap Object Filter Enumeration */ - -typedef enum { - JVMTI_HEAP_OBJECT_TAGGED = 1, - JVMTI_HEAP_OBJECT_UNTAGGED = 2, - JVMTI_HEAP_OBJECT_EITHER = 3 -} jvmtiHeapObjectFilter; - - /* Heap Root Kind Enumeration */ - -typedef enum { - JVMTI_HEAP_ROOT_JNI_GLOBAL = 1, - JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2, - JVMTI_HEAP_ROOT_MONITOR = 3, - JVMTI_HEAP_ROOT_STACK_LOCAL = 4, - JVMTI_HEAP_ROOT_JNI_LOCAL = 5, - JVMTI_HEAP_ROOT_THREAD = 6, - JVMTI_HEAP_ROOT_OTHER = 7 -} jvmtiHeapRootKind; - - /* Object Reference Enumeration */ - -typedef enum { - JVMTI_REFERENCE_CLASS = 1, - JVMTI_REFERENCE_FIELD = 2, - JVMTI_REFERENCE_ARRAY_ELEMENT = 3, - JVMTI_REFERENCE_CLASS_LOADER = 4, - JVMTI_REFERENCE_SIGNERS = 5, - JVMTI_REFERENCE_PROTECTION_DOMAIN = 6, - JVMTI_REFERENCE_INTERFACE = 7, - JVMTI_REFERENCE_STATIC_FIELD = 8, - JVMTI_REFERENCE_CONSTANT_POOL = 9 -} jvmtiObjectReferenceKind; - - /* Iteration Control Enumeration */ - -typedef enum { - JVMTI_ITERATION_CONTINUE = 1, - JVMTI_ITERATION_IGNORE = 2, - JVMTI_ITERATION_ABORT = 0 -} jvmtiIterationControl; - - /* Class Status Flags */ - -enum { - JVMTI_CLASS_STATUS_VERIFIED = 1, - JVMTI_CLASS_STATUS_PREPARED = 2, - JVMTI_CLASS_STATUS_INITIALIZED = 4, - JVMTI_CLASS_STATUS_ERROR = 8, - JVMTI_CLASS_STATUS_ARRAY = 16, - JVMTI_CLASS_STATUS_PRIMITIVE = 32 -}; - - /* Event Enable/Disable */ - -typedef enum { - JVMTI_ENABLE = 1, - JVMTI_DISABLE = 0 -} jvmtiEventMode; - - /* Extension Function/Event Parameter Types */ - -typedef enum { - JVMTI_TYPE_JBYTE = 101, - JVMTI_TYPE_JCHAR = 102, - JVMTI_TYPE_JSHORT = 103, - JVMTI_TYPE_JINT = 104, - JVMTI_TYPE_JLONG = 105, - JVMTI_TYPE_JFLOAT = 106, - JVMTI_TYPE_JDOUBLE = 107, - JVMTI_TYPE_JBOOLEAN = 108, - JVMTI_TYPE_JOBJECT = 109, - JVMTI_TYPE_JTHREAD = 110, - JVMTI_TYPE_JCLASS = 111, - JVMTI_TYPE_JVALUE = 112, - JVMTI_TYPE_JFIELDID = 113, - JVMTI_TYPE_JMETHODID = 114, - JVMTI_TYPE_CCHAR = 115, - JVMTI_TYPE_CVOID = 116, - JVMTI_TYPE_JNIENV = 117 -} jvmtiParamTypes; - - /* Extension Function/Event Parameter Kinds */ - -typedef enum { - JVMTI_KIND_IN = 91, - JVMTI_KIND_IN_PTR = 92, - JVMTI_KIND_IN_BUF = 93, - JVMTI_KIND_ALLOC_BUF = 94, - JVMTI_KIND_ALLOC_ALLOC_BUF = 95, - JVMTI_KIND_OUT = 96, - JVMTI_KIND_OUT_BUF = 97 -} jvmtiParamKind; - - /* Timer Kinds */ - -typedef enum { - JVMTI_TIMER_USER_CPU = 30, - JVMTI_TIMER_TOTAL_CPU = 31, - JVMTI_TIMER_ELAPSED = 32 -} jvmtiTimerKind; - - /* Phases of execution */ - -typedef enum { - JVMTI_PHASE_ONLOAD = 1, - JVMTI_PHASE_PRIMORDIAL = 2, - JVMTI_PHASE_START = 6, - JVMTI_PHASE_LIVE = 4, - JVMTI_PHASE_DEAD = 8 -} jvmtiPhase; - - /* Version Interface Types */ - -enum { - JVMTI_VERSION_INTERFACE_JNI = 0x00000000, - JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000 -}; - - /* Version Masks */ - -enum { - JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000, - JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000, - JVMTI_VERSION_MASK_MINOR = 0x0000FF00, - JVMTI_VERSION_MASK_MICRO = 0x000000FF -}; - - /* Version Shifts */ - -enum { - JVMTI_VERSION_SHIFT_MAJOR = 16, - JVMTI_VERSION_SHIFT_MINOR = 8, - JVMTI_VERSION_SHIFT_MICRO = 0 -}; - - /* Verbose Flag Enumeration */ - -typedef enum { - JVMTI_VERBOSE_OTHER = 0, - JVMTI_VERBOSE_GC = 1, - JVMTI_VERBOSE_CLASS = 2, - JVMTI_VERBOSE_JNI = 4 -} jvmtiVerboseFlag; - - /* JLocation Format Enumeration */ - -typedef enum { - JVMTI_JLOCATION_JVMBCI = 1, - JVMTI_JLOCATION_MACHINEPC = 2, - JVMTI_JLOCATION_OTHER = 0 -} jvmtiJlocationFormat; - - /* Errors */ - -typedef enum { - JVMTI_ERROR_NONE = 0, - JVMTI_ERROR_INVALID_THREAD = 10, - JVMTI_ERROR_INVALID_THREAD_GROUP = 11, - JVMTI_ERROR_INVALID_PRIORITY = 12, - JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13, - JVMTI_ERROR_THREAD_SUSPENDED = 14, - JVMTI_ERROR_THREAD_NOT_ALIVE = 15, - JVMTI_ERROR_INVALID_OBJECT = 20, - JVMTI_ERROR_INVALID_CLASS = 21, - JVMTI_ERROR_CLASS_NOT_PREPARED = 22, - JVMTI_ERROR_INVALID_METHODID = 23, - JVMTI_ERROR_INVALID_LOCATION = 24, - JVMTI_ERROR_INVALID_FIELDID = 25, - JVMTI_ERROR_NO_MORE_FRAMES = 31, - JVMTI_ERROR_OPAQUE_FRAME = 32, - JVMTI_ERROR_TYPE_MISMATCH = 34, - JVMTI_ERROR_INVALID_SLOT = 35, - JVMTI_ERROR_DUPLICATE = 40, - JVMTI_ERROR_NOT_FOUND = 41, - JVMTI_ERROR_INVALID_MONITOR = 50, - JVMTI_ERROR_NOT_MONITOR_OWNER = 51, - JVMTI_ERROR_INTERRUPT = 52, - JVMTI_ERROR_INVALID_CLASS_FORMAT = 60, - JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61, - JVMTI_ERROR_FAILS_VERIFICATION = 62, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64, - JVMTI_ERROR_INVALID_TYPESTATE = 65, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67, - JVMTI_ERROR_UNSUPPORTED_VERSION = 68, - JVMTI_ERROR_NAMES_DONT_MATCH = 69, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71, - JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, - JVMTI_ERROR_NOT_AVAILABLE = 98, - JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, - JVMTI_ERROR_NULL_POINTER = 100, - JVMTI_ERROR_ABSENT_INFORMATION = 101, - JVMTI_ERROR_INVALID_EVENT_TYPE = 102, - JVMTI_ERROR_ILLEGAL_ARGUMENT = 103, - JVMTI_ERROR_NATIVE_METHOD = 104, - JVMTI_ERROR_OUT_OF_MEMORY = 110, - JVMTI_ERROR_ACCESS_DENIED = 111, - JVMTI_ERROR_WRONG_PHASE = 112, - JVMTI_ERROR_INTERNAL = 113, - JVMTI_ERROR_UNATTACHED_THREAD = 115, - JVMTI_ERROR_INVALID_ENVIRONMENT = 116, - JVMTI_ERROR_MAX = 116 -} jvmtiError; - - /* Event IDs */ - -typedef enum { - JVMTI_MIN_EVENT_TYPE_VAL = 50, - JVMTI_EVENT_VM_INIT = 50, - JVMTI_EVENT_VM_DEATH = 51, - JVMTI_EVENT_THREAD_START = 52, - JVMTI_EVENT_THREAD_END = 53, - JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54, - JVMTI_EVENT_CLASS_LOAD = 55, - JVMTI_EVENT_CLASS_PREPARE = 56, - JVMTI_EVENT_VM_START = 57, - JVMTI_EVENT_EXCEPTION = 58, - JVMTI_EVENT_EXCEPTION_CATCH = 59, - JVMTI_EVENT_SINGLE_STEP = 60, - JVMTI_EVENT_FRAME_POP = 61, - JVMTI_EVENT_BREAKPOINT = 62, - JVMTI_EVENT_FIELD_ACCESS = 63, - JVMTI_EVENT_FIELD_MODIFICATION = 64, - JVMTI_EVENT_METHOD_ENTRY = 65, - JVMTI_EVENT_METHOD_EXIT = 66, - JVMTI_EVENT_NATIVE_METHOD_BIND = 67, - JVMTI_EVENT_COMPILED_METHOD_LOAD = 68, - JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69, - JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70, - JVMTI_EVENT_DATA_DUMP_REQUEST = 71, - JVMTI_EVENT_MONITOR_WAIT = 73, - JVMTI_EVENT_MONITOR_WAITED = 74, - JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75, - JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76, - JVMTI_EVENT_GARBAGE_COLLECTION_START = 81, - JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82, - JVMTI_EVENT_OBJECT_FREE = 83, - JVMTI_EVENT_VM_OBJECT_ALLOC = 84, - JVMTI_MAX_EVENT_TYPE_VAL = 84 -} jvmtiEvent; - - - /* Function Types */ - -typedef void (JNICALL *jvmtiStartFunction) - (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg); - -typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback) - (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback) - (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback) - (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback) - (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data); - -typedef jvmtiError (JNICALL *jvmtiExtensionFunction) - (jvmtiEnv* jvmti_env, ...); - -typedef void (JNICALL *jvmtiExtensionEvent) - (jvmtiEnv* jvmti_env, ...); - - - /* Structure Types */ - -typedef struct { - char* name; - jint priority; - jboolean is_daemon; - jthreadGroup thread_group; - jobject context_class_loader; -} jvmtiThreadInfo; - -typedef struct { - jthreadGroup parent; - char* name; - jint max_priority; - jboolean is_daemon; -} jvmtiThreadGroupInfo; - -typedef struct { - jmethodID method; - jlocation location; -} jvmtiFrameInfo; - -typedef struct { - jthread thread; - jint state; - jvmtiFrameInfo* frame_buffer; - jint frame_count; -} jvmtiStackInfo; - -typedef struct { - jclass klass; - jint class_byte_count; - const unsigned char* class_bytes; -} jvmtiClassDefinition; - -typedef struct { - jthread owner; - jint entry_count; - jint waiter_count; - jthread* waiters; - jint notify_waiter_count; - jthread* notify_waiters; -} jvmtiMonitorUsage; - -typedef struct { - jlocation start_location; - jint line_number; -} jvmtiLineNumberEntry; - -typedef struct { - jlocation start_location; - jint length; - char* name; - char* signature; - char* generic_signature; - jint slot; -} jvmtiLocalVariableEntry; - -typedef struct { - char* name; - jvmtiParamKind kind; - jvmtiParamTypes base_type; - jboolean null_ok; -} jvmtiParamInfo; - -typedef struct { - jvmtiExtensionFunction func; - char* id; - char* short_description; - jint param_count; - jvmtiParamInfo* params; - jint error_count; - jvmtiError* errors; -} jvmtiExtensionFunctionInfo; - -typedef struct { - jint extension_event_index; - char* id; - char* short_description; - jint param_count; - jvmtiParamInfo* params; -} jvmtiExtensionEventInfo; - -typedef struct { - jlong max_value; - jboolean may_skip_forward; - jboolean may_skip_backward; - jvmtiTimerKind kind; - jlong reserved1; - jlong reserved2; -} jvmtiTimerInfo; - -typedef struct { - const void* start_address; - jlocation location; -} jvmtiAddrLocationMap; - -typedef struct { - unsigned int can_tag_objects : 1; - unsigned int can_generate_field_modification_events : 1; - unsigned int can_generate_field_access_events : 1; - unsigned int can_get_bytecodes : 1; - unsigned int can_get_synthetic_attribute : 1; - unsigned int can_get_owned_monitor_info : 1; - unsigned int can_get_current_contended_monitor : 1; - unsigned int can_get_monitor_info : 1; - unsigned int can_pop_frame : 1; - unsigned int can_redefine_classes : 1; - unsigned int can_signal_thread : 1; - unsigned int can_get_source_file_name : 1; - unsigned int can_get_line_numbers : 1; - unsigned int can_get_source_debug_extension : 1; - unsigned int can_access_local_variables : 1; - unsigned int can_maintain_original_method_order : 1; - unsigned int can_generate_single_step_events : 1; - unsigned int can_generate_exception_events : 1; - unsigned int can_generate_frame_pop_events : 1; - unsigned int can_generate_breakpoint_events : 1; - unsigned int can_suspend : 1; - unsigned int can_redefine_any_class : 1; - unsigned int can_get_current_thread_cpu_time : 1; - unsigned int can_get_thread_cpu_time : 1; - unsigned int can_generate_method_entry_events : 1; - unsigned int can_generate_method_exit_events : 1; - unsigned int can_generate_all_class_hook_events : 1; - unsigned int can_generate_compiled_method_load_events : 1; - unsigned int can_generate_monitor_events : 1; - unsigned int can_generate_vm_object_alloc_events : 1; - unsigned int can_generate_native_method_bind_events : 1; - unsigned int can_generate_garbage_collection_events : 1; - unsigned int can_generate_object_free_events : 1; - unsigned int : 15; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; -} jvmtiCapabilities; - - - /* Event Definitions */ - -typedef void (JNICALL *jvmtiEventReserved)(void); - - -typedef void (JNICALL *jvmtiEventBreakpoint) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location); - -typedef void (JNICALL *jvmtiEventClassFileLoadHook) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jclass class_being_redefined, - jobject loader, - const char* name, - jobject protection_domain, - jint class_data_len, - const unsigned char* class_data, - jint* new_class_data_len, - unsigned char** new_class_data); - -typedef void (JNICALL *jvmtiEventClassLoad) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jclass klass); - -typedef void (JNICALL *jvmtiEventClassPrepare) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jclass klass); - -typedef void (JNICALL *jvmtiEventCompiledMethodLoad) - (jvmtiEnv *jvmti_env, - jmethodID method, - jint code_size, - const void* code_addr, - jint map_length, - const jvmtiAddrLocationMap* map, - const void* compile_info); - -typedef void (JNICALL *jvmtiEventCompiledMethodUnload) - (jvmtiEnv *jvmti_env, - jmethodID method, - const void* code_addr); - -typedef void (JNICALL *jvmtiEventDataDumpRequest) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventDynamicCodeGenerated) - (jvmtiEnv *jvmti_env, - const char* name, - const void* address, - jint length); - -typedef void (JNICALL *jvmtiEventException) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jobject exception, - jmethodID catch_method, - jlocation catch_location); - -typedef void (JNICALL *jvmtiEventExceptionCatch) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jobject exception); - -typedef void (JNICALL *jvmtiEventFieldAccess) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jclass field_klass, - jobject object, - jfieldID field); - -typedef void (JNICALL *jvmtiEventFieldModification) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jclass field_klass, - jobject object, - jfieldID field, - char signature_type, - jvalue new_value); - -typedef void (JNICALL *jvmtiEventFramePop) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jboolean was_popped_by_exception); - -typedef void (JNICALL *jvmtiEventGarbageCollectionFinish) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventGarbageCollectionStart) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventMethodEntry) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method); - -typedef void (JNICALL *jvmtiEventMethodExit) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jboolean was_popped_by_exception, - jvalue return_value); - -typedef void (JNICALL *jvmtiEventMonitorContendedEnter) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object); - -typedef void (JNICALL *jvmtiEventMonitorContendedEntered) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object); - -typedef void (JNICALL *jvmtiEventMonitorWait) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jlong timeout); - -typedef void (JNICALL *jvmtiEventMonitorWaited) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jboolean timed_out); - -typedef void (JNICALL *jvmtiEventNativeMethodBind) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - void* address, - void** new_address_ptr); - -typedef void (JNICALL *jvmtiEventObjectFree) - (jvmtiEnv *jvmti_env, - jlong tag); - -typedef void (JNICALL *jvmtiEventSingleStep) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location); - -typedef void (JNICALL *jvmtiEventThreadEnd) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventThreadStart) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventVMDeath) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env); - -typedef void (JNICALL *jvmtiEventVMInit) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventVMObjectAlloc) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jclass object_klass, - jlong size); - -typedef void (JNICALL *jvmtiEventVMStart) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env); - - /* Event Callback Structure */ - -typedef struct { - /* 50 : VM Initialization Event */ - jvmtiEventVMInit VMInit; - /* 51 : VM Death Event */ - jvmtiEventVMDeath VMDeath; - /* 52 : Thread Start */ - jvmtiEventThreadStart ThreadStart; - /* 53 : Thread End */ - jvmtiEventThreadEnd ThreadEnd; - /* 54 : Class File Load Hook */ - jvmtiEventClassFileLoadHook ClassFileLoadHook; - /* 55 : Class Load */ - jvmtiEventClassLoad ClassLoad; - /* 56 : Class Prepare */ - jvmtiEventClassPrepare ClassPrepare; - /* 57 : VM Start Event */ - jvmtiEventVMStart VMStart; - /* 58 : Exception */ - jvmtiEventException Exception; - /* 59 : Exception Catch */ - jvmtiEventExceptionCatch ExceptionCatch; - /* 60 : Single Step */ - jvmtiEventSingleStep SingleStep; - /* 61 : Frame Pop */ - jvmtiEventFramePop FramePop; - /* 62 : Breakpoint */ - jvmtiEventBreakpoint Breakpoint; - /* 63 : Field Access */ - jvmtiEventFieldAccess FieldAccess; - /* 64 : Field Modification */ - jvmtiEventFieldModification FieldModification; - /* 65 : Method Entry */ - jvmtiEventMethodEntry MethodEntry; - /* 66 : Method Exit */ - jvmtiEventMethodExit MethodExit; - /* 67 : Native Method Bind */ - jvmtiEventNativeMethodBind NativeMethodBind; - /* 68 : Compiled Method Load */ - jvmtiEventCompiledMethodLoad CompiledMethodLoad; - /* 69 : Compiled Method Unload */ - jvmtiEventCompiledMethodUnload CompiledMethodUnload; - /* 70 : Dynamic Code Generated */ - jvmtiEventDynamicCodeGenerated DynamicCodeGenerated; - /* 71 : Data Dump Request */ - jvmtiEventDataDumpRequest DataDumpRequest; - /* 72 */ - jvmtiEventReserved reserved72; - /* 73 : Monitor Wait */ - jvmtiEventMonitorWait MonitorWait; - /* 74 : Monitor Waited */ - jvmtiEventMonitorWaited MonitorWaited; - /* 75 : Monitor Contended Enter */ - jvmtiEventMonitorContendedEnter MonitorContendedEnter; - /* 76 : Monitor Contended Entered */ - jvmtiEventMonitorContendedEntered MonitorContendedEntered; - /* 77 */ - jvmtiEventReserved reserved77; - /* 78 */ - jvmtiEventReserved reserved78; - /* 79 */ - jvmtiEventReserved reserved79; - /* 80 */ - jvmtiEventReserved reserved80; - /* 81 : Garbage Collection Start */ - jvmtiEventGarbageCollectionStart GarbageCollectionStart; - /* 82 : Garbage Collection Finish */ - jvmtiEventGarbageCollectionFinish GarbageCollectionFinish; - /* 83 : Object Free */ - jvmtiEventObjectFree ObjectFree; - /* 84 : VM Object Allocation */ - jvmtiEventVMObjectAlloc VMObjectAlloc; -} jvmtiEventCallbacks; - - - /* Function Interface */ - -typedef struct jvmtiInterface_1_ { - - /* 1 : RESERVED */ - void *reserved1; - - /* 2 : Set Event Notification Mode */ - jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env, - jvmtiEventMode mode, - jvmtiEvent event_type, - jthread event_thread, - ...); - - /* 3 : RESERVED */ - void *reserved3; - - /* 4 : Get All Threads */ - jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env, - jint* threads_count_ptr, - jthread** threads_ptr); - - /* 5 : Suspend Thread */ - jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env, - jthread thread); - - /* 6 : Resume Thread */ - jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env, - jthread thread); - - /* 7 : Stop Thread */ - jvmtiError (JNICALL *StopThread) (jvmtiEnv* env, - jthread thread, - jobject exception); - - /* 8 : Interrupt Thread */ - jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env, - jthread thread); - - /* 9 : Get Thread Info */ - jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env, - jthread thread, - jvmtiThreadInfo* info_ptr); - - /* 10 : Get Owned Monitor Info */ - jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env, - jthread thread, - jint* owned_monitor_count_ptr, - jobject** owned_monitors_ptr); - - /* 11 : Get Current Contended Monitor */ - jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env, - jthread thread, - jobject* monitor_ptr); - - /* 12 : Run Agent Thread */ - jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env, - jthread thread, - jvmtiStartFunction proc, - const void* arg, - jint priority); - - /* 13 : Get Top Thread Groups */ - jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env, - jint* group_count_ptr, - jthreadGroup** groups_ptr); - - /* 14 : Get Thread Group Info */ - jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env, - jthreadGroup group, - jvmtiThreadGroupInfo* info_ptr); - - /* 15 : Get Thread Group Children */ - jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env, - jthreadGroup group, - jint* thread_count_ptr, - jthread** threads_ptr, - jint* group_count_ptr, - jthreadGroup** groups_ptr); - - /* 16 : Get Frame Count */ - jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env, - jthread thread, - jint* count_ptr); - - /* 17 : Get Thread State */ - jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env, - jthread thread, - jint* thread_state_ptr); - - /* 18 : RESERVED */ - void *reserved18; - - /* 19 : Get Frame Location */ - jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env, - jthread thread, - jint depth, - jmethodID* method_ptr, - jlocation* location_ptr); - - /* 20 : Notify Frame Pop */ - jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env, - jthread thread, - jint depth); - - /* 21 : Get Local Variable - Object */ - jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jobject* value_ptr); - - /* 22 : Get Local Variable - Int */ - jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jint* value_ptr); - - /* 23 : Get Local Variable - Long */ - jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jlong* value_ptr); - - /* 24 : Get Local Variable - Float */ - jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jfloat* value_ptr); - - /* 25 : Get Local Variable - Double */ - jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jdouble* value_ptr); - - /* 26 : Set Local Variable - Object */ - jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jobject value); - - /* 27 : Set Local Variable - Int */ - jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jint value); - - /* 28 : Set Local Variable - Long */ - jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jlong value); - - /* 29 : Set Local Variable - Float */ - jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jfloat value); - - /* 30 : Set Local Variable - Double */ - jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jdouble value); - - /* 31 : Create Raw Monitor */ - jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env, - const char* name, - jrawMonitorID* monitor_ptr); - - /* 32 : Destroy Raw Monitor */ - jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 33 : Raw Monitor Enter */ - jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 34 : Raw Monitor Exit */ - jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 35 : Raw Monitor Wait */ - jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env, - jrawMonitorID monitor, - jlong millis); - - /* 36 : Raw Monitor Notify */ - jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 37 : Raw Monitor Notify All */ - jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 38 : Set Breakpoint */ - jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env, - jmethodID method, - jlocation location); - - /* 39 : Clear Breakpoint */ - jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env, - jmethodID method, - jlocation location); - - /* 40 : RESERVED */ - void *reserved40; - - /* 41 : Set Field Access Watch */ - jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 42 : Clear Field Access Watch */ - jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 43 : Set Field Modification Watch */ - jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 44 : Clear Field Modification Watch */ - jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 45 : RESERVED */ - void *reserved45; - - /* 46 : Allocate */ - jvmtiError (JNICALL *Allocate) (jvmtiEnv* env, - jlong size, - unsigned char** mem_ptr); - - /* 47 : Deallocate */ - jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env, - unsigned char* mem); - - /* 48 : Get Class Signature */ - jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env, - jclass klass, - char** signature_ptr, - char** generic_ptr); - - /* 49 : Get Class Status */ - jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env, - jclass klass, - jint* status_ptr); - - /* 50 : Get Source File Name */ - jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env, - jclass klass, - char** source_name_ptr); - - /* 51 : Get Class Modifiers */ - jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env, - jclass klass, - jint* modifiers_ptr); - - /* 52 : Get Class Methods */ - jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env, - jclass klass, - jint* method_count_ptr, - jmethodID** methods_ptr); - - /* 53 : Get Class Fields */ - jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env, - jclass klass, - jint* field_count_ptr, - jfieldID** fields_ptr); - - /* 54 : Get Implemented Interfaces */ - jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env, - jclass klass, - jint* interface_count_ptr, - jclass** interfaces_ptr); - - /* 55 : Is Interface */ - jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env, - jclass klass, - jboolean* is_interface_ptr); - - /* 56 : Is Array Class */ - jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env, - jclass klass, - jboolean* is_array_class_ptr); - - /* 57 : Get Class Loader */ - jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env, - jclass klass, - jobject* classloader_ptr); - - /* 58 : Get Object Hash Code */ - jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env, - jobject object, - jint* hash_code_ptr); - - /* 59 : Get Object Monitor Usage */ - jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env, - jobject object, - jvmtiMonitorUsage* info_ptr); - - /* 60 : Get Field Name (and Signature) */ - jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env, - jclass klass, - jfieldID field, - char** name_ptr, - char** signature_ptr, - char** generic_ptr); - - /* 61 : Get Field Declaring Class */ - jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jclass* declaring_class_ptr); - - /* 62 : Get Field Modifiers */ - jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jint* modifiers_ptr); - - /* 63 : Is Field Synthetic */ - jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jboolean* is_synthetic_ptr); - - /* 64 : Get Method Name (and Signature) */ - jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env, - jmethodID method, - char** name_ptr, - char** signature_ptr, - char** generic_ptr); - - /* 65 : Get Method Declaring Class */ - jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env, - jmethodID method, - jclass* declaring_class_ptr); - - /* 66 : Get Method Modifiers */ - jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env, - jmethodID method, - jint* modifiers_ptr); - - /* 67 : RESERVED */ - void *reserved67; - - /* 68 : Get Max Locals */ - jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env, - jmethodID method, - jint* max_ptr); - - /* 69 : Get Arguments Size */ - jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env, - jmethodID method, - jint* size_ptr); - - /* 70 : Get Line Number Table */ - jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env, - jmethodID method, - jint* entry_count_ptr, - jvmtiLineNumberEntry** table_ptr); - - /* 71 : Get Method Location */ - jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env, - jmethodID method, - jlocation* start_location_ptr, - jlocation* end_location_ptr); - - /* 72 : Get Local Variable Table */ - jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env, - jmethodID method, - jint* entry_count_ptr, - jvmtiLocalVariableEntry** table_ptr); - - /* 73 : RESERVED */ - void *reserved73; - - /* 74 : RESERVED */ - void *reserved74; - - /* 75 : Get Bytecodes */ - jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env, - jmethodID method, - jint* bytecode_count_ptr, - unsigned char** bytecodes_ptr); - - /* 76 : Is Method Native */ - jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env, - jmethodID method, - jboolean* is_native_ptr); - - /* 77 : Is Method Synthetic */ - jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env, - jmethodID method, - jboolean* is_synthetic_ptr); - - /* 78 : Get Loaded Classes */ - jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env, - jint* class_count_ptr, - jclass** classes_ptr); - - /* 79 : Get Classloader Classes */ - jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env, - jobject initiating_loader, - jint* class_count_ptr, - jclass** classes_ptr); - - /* 80 : Pop Frame */ - jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env, - jthread thread); - - /* 81 : RESERVED */ - void *reserved81; - - /* 82 : RESERVED */ - void *reserved82; - - /* 83 : RESERVED */ - void *reserved83; - - /* 84 : RESERVED */ - void *reserved84; - - /* 85 : RESERVED */ - void *reserved85; - - /* 86 : RESERVED */ - void *reserved86; - - /* 87 : Redefine Classes */ - jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env, - jint class_count, - const jvmtiClassDefinition* class_definitions); - - /* 88 : Get Version Number */ - jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env, - jint* version_ptr); - - /* 89 : Get Capabilities */ - jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env, - jvmtiCapabilities* capabilities_ptr); - - /* 90 : Get Source Debug Extension */ - jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env, - jclass klass, - char** source_debug_extension_ptr); - - /* 91 : Is Method Obsolete */ - jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env, - jmethodID method, - jboolean* is_obsolete_ptr); - - /* 92 : Suspend Thread List */ - jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env, - jint request_count, - const jthread* request_list, - jvmtiError* results); - - /* 93 : Resume Thread List */ - jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env, - jint request_count, - const jthread* request_list, - jvmtiError* results); - - /* 94 : RESERVED */ - void *reserved94; - - /* 95 : RESERVED */ - void *reserved95; - - /* 96 : RESERVED */ - void *reserved96; - - /* 97 : RESERVED */ - void *reserved97; - - /* 98 : RESERVED */ - void *reserved98; - - /* 99 : RESERVED */ - void *reserved99; - - /* 100 : Get All Stack Traces */ - jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr, - jint* thread_count_ptr); - - /* 101 : Get Thread List Stack Traces */ - jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env, - jint thread_count, - const jthread* thread_list, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr); - - /* 102 : Get Thread Local Storage */ - jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env, - jthread thread, - void** data_ptr); - - /* 103 : Set Thread Local Storage */ - jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env, - jthread thread, - const void* data); - - /* 104 : Get Stack Trace */ - jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env, - jthread thread, - jint start_depth, - jint max_frame_count, - jvmtiFrameInfo* frame_buffer, - jint* count_ptr); - - /* 105 : RESERVED */ - void *reserved105; - - /* 106 : Get Tag */ - jvmtiError (JNICALL *GetTag) (jvmtiEnv* env, - jobject object, - jlong* tag_ptr); - - /* 107 : Set Tag */ - jvmtiError (JNICALL *SetTag) (jvmtiEnv* env, - jobject object, - jlong tag); - - /* 108 : Force Garbage Collection */ - jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env); - - /* 109 : Iterate Over Objects Reachable From Object */ - jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env, - jobject object, - jvmtiObjectReferenceCallback object_reference_callback, - void* user_data); - - /* 110 : Iterate Over Reachable Objects */ - jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env, - jvmtiHeapRootCallback heap_root_callback, - jvmtiStackReferenceCallback stack_ref_callback, - jvmtiObjectReferenceCallback object_ref_callback, - void* user_data); - - /* 111 : Iterate Over Heap */ - jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - void* user_data); - - /* 112 : Iterate Over Instances Of Class */ - jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env, - jclass klass, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - void* user_data); - - /* 113 : RESERVED */ - void *reserved113; - - /* 114 : Get Objects With Tags */ - jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env, - jint tag_count, - const jlong* tags, - jint* count_ptr, - jobject** object_result_ptr, - jlong** tag_result_ptr); - - /* 115 : RESERVED */ - void *reserved115; - - /* 116 : RESERVED */ - void *reserved116; - - /* 117 : RESERVED */ - void *reserved117; - - /* 118 : RESERVED */ - void *reserved118; - - /* 119 : RESERVED */ - void *reserved119; - - /* 120 : Set JNI Function Table */ - jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env, - const jniNativeInterface* function_table); - - /* 121 : Get JNI Function Table */ - jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env, - jniNativeInterface** function_table); - - /* 122 : Set Event Callbacks */ - jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env, - const jvmtiEventCallbacks* callbacks, - jint size_of_callbacks); - - /* 123 : Generate Events */ - jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env, - jvmtiEvent event_type); - - /* 124 : Get Extension Functions */ - jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env, - jint* extension_count_ptr, - jvmtiExtensionFunctionInfo** extensions); - - /* 125 : Get Extension Events */ - jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env, - jint* extension_count_ptr, - jvmtiExtensionEventInfo** extensions); - - /* 126 : Set Extension Event Callback */ - jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env, - jint extension_event_index, - jvmtiExtensionEvent callback); - - /* 127 : Dispose Environment */ - jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env); - - /* 128 : Get Error Name */ - jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env, - jvmtiError error, - char** name_ptr); - - /* 129 : Get JLocation Format */ - jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env, - jvmtiJlocationFormat* format_ptr); - - /* 130 : Get System Properties */ - jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env, - jint* count_ptr, - char*** property_ptr); - - /* 131 : Get System Property */ - jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env, - const char* property, - char** value_ptr); - - /* 132 : Set System Property */ - jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env, - const char* property, - const char* value); - - /* 133 : Get Phase */ - jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env, - jvmtiPhase* phase_ptr); - - /* 134 : Get Current Thread CPU Timer Information */ - jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 135 : Get Current Thread CPU Time */ - jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env, - jlong* nanos_ptr); - - /* 136 : Get Thread CPU Timer Information */ - jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 137 : Get Thread CPU Time */ - jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env, - jthread thread, - jlong* nanos_ptr); - - /* 138 : Get Timer Information */ - jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 139 : Get Time */ - jvmtiError (JNICALL *GetTime) (jvmtiEnv* env, - jlong* nanos_ptr); - - /* 140 : Get Potential Capabilities */ - jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env, - jvmtiCapabilities* capabilities_ptr); - - /* 141 : RESERVED */ - void *reserved141; - - /* 142 : Add Capabilities */ - jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env, - const jvmtiCapabilities* capabilities_ptr); - - /* 143 : Relinquish Capabilities */ - jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env, - const jvmtiCapabilities* capabilities_ptr); - - /* 144 : Get Available Processors */ - jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env, - jint* processor_count_ptr); - - /* 145 : RESERVED */ - void *reserved145; - - /* 146 : RESERVED */ - void *reserved146; - - /* 147 : Get Environment Local Storage */ - jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env, - void** data_ptr); - - /* 148 : Set Environment Local Storage */ - jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env, - const void* data); - - /* 149 : Add To Bootstrap Class Loader Search */ - jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env, - const char* segment); - - /* 150 : Set Verbose Flag */ - jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env, - jvmtiVerboseFlag flag, - jboolean value); - - /* 151 : RESERVED */ - void *reserved151; - - /* 152 : RESERVED */ - void *reserved152; - - /* 153 : RESERVED */ - void *reserved153; - - /* 154 : Get Object Size */ - jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env, - jobject object, - jlong* size_ptr); - -} jvmtiInterface_1; - -struct _jvmtiEnv { - const struct jvmtiInterface_1_ *functions; -#ifdef __cplusplus - - - jvmtiError Allocate(jlong size, - unsigned char** mem_ptr) { - return functions->Allocate(this, size, mem_ptr); - } - - jvmtiError Deallocate(unsigned char* mem) { - return functions->Deallocate(this, mem); - } - - jvmtiError GetThreadState(jthread thread, - jint* thread_state_ptr) { - return functions->GetThreadState(this, thread, thread_state_ptr); - } - - jvmtiError GetAllThreads(jint* threads_count_ptr, - jthread** threads_ptr) { - return functions->GetAllThreads(this, threads_count_ptr, threads_ptr); - } - - jvmtiError SuspendThread(jthread thread) { - return functions->SuspendThread(this, thread); - } - - jvmtiError SuspendThreadList(jint request_count, - const jthread* request_list, - jvmtiError* results) { - return functions->SuspendThreadList(this, request_count, request_list, results); - } - - jvmtiError ResumeThread(jthread thread) { - return functions->ResumeThread(this, thread); - } - - jvmtiError ResumeThreadList(jint request_count, - const jthread* request_list, - jvmtiError* results) { - return functions->ResumeThreadList(this, request_count, request_list, results); - } - - jvmtiError StopThread(jthread thread, - jobject exception) { - return functions->StopThread(this, thread, exception); - } - - jvmtiError InterruptThread(jthread thread) { - return functions->InterruptThread(this, thread); - } - - jvmtiError GetThreadInfo(jthread thread, - jvmtiThreadInfo* info_ptr) { - return functions->GetThreadInfo(this, thread, info_ptr); - } - - jvmtiError GetOwnedMonitorInfo(jthread thread, - jint* owned_monitor_count_ptr, - jobject** owned_monitors_ptr) { - return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr); - } - - jvmtiError GetCurrentContendedMonitor(jthread thread, - jobject* monitor_ptr) { - return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr); - } - - jvmtiError RunAgentThread(jthread thread, - jvmtiStartFunction proc, - const void* arg, - jint priority) { - return functions->RunAgentThread(this, thread, proc, arg, priority); - } - - jvmtiError SetThreadLocalStorage(jthread thread, - const void* data) { - return functions->SetThreadLocalStorage(this, thread, data); - } - - jvmtiError GetThreadLocalStorage(jthread thread, - void** data_ptr) { - return functions->GetThreadLocalStorage(this, thread, data_ptr); - } - - jvmtiError GetTopThreadGroups(jint* group_count_ptr, - jthreadGroup** groups_ptr) { - return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr); - } - - jvmtiError GetThreadGroupInfo(jthreadGroup group, - jvmtiThreadGroupInfo* info_ptr) { - return functions->GetThreadGroupInfo(this, group, info_ptr); - } - - jvmtiError GetThreadGroupChildren(jthreadGroup group, - jint* thread_count_ptr, - jthread** threads_ptr, - jint* group_count_ptr, - jthreadGroup** groups_ptr) { - return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr); - } - - jvmtiError GetStackTrace(jthread thread, - jint start_depth, - jint max_frame_count, - jvmtiFrameInfo* frame_buffer, - jint* count_ptr) { - return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr); - } - - jvmtiError GetAllStackTraces(jint max_frame_count, - jvmtiStackInfo** stack_info_ptr, - jint* thread_count_ptr) { - return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr); - } - - jvmtiError GetThreadListStackTraces(jint thread_count, - const jthread* thread_list, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr) { - return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr); - } - - jvmtiError GetFrameCount(jthread thread, - jint* count_ptr) { - return functions->GetFrameCount(this, thread, count_ptr); - } - - jvmtiError PopFrame(jthread thread) { - return functions->PopFrame(this, thread); - } - - jvmtiError GetFrameLocation(jthread thread, - jint depth, - jmethodID* method_ptr, - jlocation* location_ptr) { - return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr); - } - - jvmtiError NotifyFramePop(jthread thread, - jint depth) { - return functions->NotifyFramePop(this, thread, depth); - } - - jvmtiError GetTag(jobject object, - jlong* tag_ptr) { - return functions->GetTag(this, object, tag_ptr); - } - - jvmtiError SetTag(jobject object, - jlong tag) { - return functions->SetTag(this, object, tag); - } - - jvmtiError ForceGarbageCollection() { - return functions->ForceGarbageCollection(this); - } - - jvmtiError IterateOverObjectsReachableFromObject(jobject object, - jvmtiObjectReferenceCallback object_reference_callback, - void* user_data) { - return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data); - } - - jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, - jvmtiStackReferenceCallback stack_ref_callback, - jvmtiObjectReferenceCallback object_ref_callback, - void* user_data) { - return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data); - } - - jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - void* user_data) { - return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data); - } - - jvmtiError IterateOverInstancesOfClass(jclass klass, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - void* user_data) { - return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data); - } - - jvmtiError GetObjectsWithTags(jint tag_count, - const jlong* tags, - jint* count_ptr, - jobject** object_result_ptr, - jlong** tag_result_ptr) { - return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr); - } - - jvmtiError GetLocalObject(jthread thread, - jint depth, - jint slot, - jobject* value_ptr) { - return functions->GetLocalObject(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalInt(jthread thread, - jint depth, - jint slot, - jint* value_ptr) { - return functions->GetLocalInt(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalLong(jthread thread, - jint depth, - jint slot, - jlong* value_ptr) { - return functions->GetLocalLong(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalFloat(jthread thread, - jint depth, - jint slot, - jfloat* value_ptr) { - return functions->GetLocalFloat(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalDouble(jthread thread, - jint depth, - jint slot, - jdouble* value_ptr) { - return functions->GetLocalDouble(this, thread, depth, slot, value_ptr); - } - - jvmtiError SetLocalObject(jthread thread, - jint depth, - jint slot, - jobject value) { - return functions->SetLocalObject(this, thread, depth, slot, value); - } - - jvmtiError SetLocalInt(jthread thread, - jint depth, - jint slot, - jint value) { - return functions->SetLocalInt(this, thread, depth, slot, value); - } - - jvmtiError SetLocalLong(jthread thread, - jint depth, - jint slot, - jlong value) { - return functions->SetLocalLong(this, thread, depth, slot, value); - } - - jvmtiError SetLocalFloat(jthread thread, - jint depth, - jint slot, - jfloat value) { - return functions->SetLocalFloat(this, thread, depth, slot, value); - } - - jvmtiError SetLocalDouble(jthread thread, - jint depth, - jint slot, - jdouble value) { - return functions->SetLocalDouble(this, thread, depth, slot, value); - } - - jvmtiError SetBreakpoint(jmethodID method, - jlocation location) { - return functions->SetBreakpoint(this, method, location); - } - - jvmtiError ClearBreakpoint(jmethodID method, - jlocation location) { - return functions->ClearBreakpoint(this, method, location); - } - - jvmtiError SetFieldAccessWatch(jclass klass, - jfieldID field) { - return functions->SetFieldAccessWatch(this, klass, field); - } - - jvmtiError ClearFieldAccessWatch(jclass klass, - jfieldID field) { - return functions->ClearFieldAccessWatch(this, klass, field); - } - - jvmtiError SetFieldModificationWatch(jclass klass, - jfieldID field) { - return functions->SetFieldModificationWatch(this, klass, field); - } - - jvmtiError ClearFieldModificationWatch(jclass klass, - jfieldID field) { - return functions->ClearFieldModificationWatch(this, klass, field); - } - - jvmtiError GetLoadedClasses(jint* class_count_ptr, - jclass** classes_ptr) { - return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr); - } - - jvmtiError GetClassLoaderClasses(jobject initiating_loader, - jint* class_count_ptr, - jclass** classes_ptr) { - return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr); - } - - jvmtiError GetClassSignature(jclass klass, - char** signature_ptr, - char** generic_ptr) { - return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr); - } - - jvmtiError GetClassStatus(jclass klass, - jint* status_ptr) { - return functions->GetClassStatus(this, klass, status_ptr); - } - - jvmtiError GetSourceFileName(jclass klass, - char** source_name_ptr) { - return functions->GetSourceFileName(this, klass, source_name_ptr); - } - - jvmtiError GetClassModifiers(jclass klass, - jint* modifiers_ptr) { - return functions->GetClassModifiers(this, klass, modifiers_ptr); - } - - jvmtiError GetClassMethods(jclass klass, - jint* method_count_ptr, - jmethodID** methods_ptr) { - return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr); - } - - jvmtiError GetClassFields(jclass klass, - jint* field_count_ptr, - jfieldID** fields_ptr) { - return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr); - } - - jvmtiError GetImplementedInterfaces(jclass klass, - jint* interface_count_ptr, - jclass** interfaces_ptr) { - return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr); - } - - jvmtiError IsInterface(jclass klass, - jboolean* is_interface_ptr) { - return functions->IsInterface(this, klass, is_interface_ptr); - } - - jvmtiError IsArrayClass(jclass klass, - jboolean* is_array_class_ptr) { - return functions->IsArrayClass(this, klass, is_array_class_ptr); - } - - jvmtiError GetClassLoader(jclass klass, - jobject* classloader_ptr) { - return functions->GetClassLoader(this, klass, classloader_ptr); - } - - jvmtiError GetSourceDebugExtension(jclass klass, - char** source_debug_extension_ptr) { - return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr); - } - - jvmtiError RedefineClasses(jint class_count, - const jvmtiClassDefinition* class_definitions) { - return functions->RedefineClasses(this, class_count, class_definitions); - } - - jvmtiError GetObjectSize(jobject object, - jlong* size_ptr) { - return functions->GetObjectSize(this, object, size_ptr); - } - - jvmtiError GetObjectHashCode(jobject object, - jint* hash_code_ptr) { - return functions->GetObjectHashCode(this, object, hash_code_ptr); - } - - jvmtiError GetObjectMonitorUsage(jobject object, - jvmtiMonitorUsage* info_ptr) { - return functions->GetObjectMonitorUsage(this, object, info_ptr); - } - - jvmtiError GetFieldName(jclass klass, - jfieldID field, - char** name_ptr, - char** signature_ptr, - char** generic_ptr) { - return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr); - } - - jvmtiError GetFieldDeclaringClass(jclass klass, - jfieldID field, - jclass* declaring_class_ptr) { - return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr); - } - - jvmtiError GetFieldModifiers(jclass klass, - jfieldID field, - jint* modifiers_ptr) { - return functions->GetFieldModifiers(this, klass, field, modifiers_ptr); - } - - jvmtiError IsFieldSynthetic(jclass klass, - jfieldID field, - jboolean* is_synthetic_ptr) { - return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr); - } - - jvmtiError GetMethodName(jmethodID method, - char** name_ptr, - char** signature_ptr, - char** generic_ptr) { - return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr); - } - - jvmtiError GetMethodDeclaringClass(jmethodID method, - jclass* declaring_class_ptr) { - return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr); - } - - jvmtiError GetMethodModifiers(jmethodID method, - jint* modifiers_ptr) { - return functions->GetMethodModifiers(this, method, modifiers_ptr); - } - - jvmtiError GetMaxLocals(jmethodID method, - jint* max_ptr) { - return functions->GetMaxLocals(this, method, max_ptr); - } - - jvmtiError GetArgumentsSize(jmethodID method, - jint* size_ptr) { - return functions->GetArgumentsSize(this, method, size_ptr); - } - - jvmtiError GetLineNumberTable(jmethodID method, - jint* entry_count_ptr, - jvmtiLineNumberEntry** table_ptr) { - return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr); - } - - jvmtiError GetMethodLocation(jmethodID method, - jlocation* start_location_ptr, - jlocation* end_location_ptr) { - return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr); - } - - jvmtiError GetLocalVariableTable(jmethodID method, - jint* entry_count_ptr, - jvmtiLocalVariableEntry** table_ptr) { - return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr); - } - - jvmtiError GetBytecodes(jmethodID method, - jint* bytecode_count_ptr, - unsigned char** bytecodes_ptr) { - return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr); - } - - jvmtiError IsMethodNative(jmethodID method, - jboolean* is_native_ptr) { - return functions->IsMethodNative(this, method, is_native_ptr); - } - - jvmtiError IsMethodSynthetic(jmethodID method, - jboolean* is_synthetic_ptr) { - return functions->IsMethodSynthetic(this, method, is_synthetic_ptr); - } - - jvmtiError IsMethodObsolete(jmethodID method, - jboolean* is_obsolete_ptr) { - return functions->IsMethodObsolete(this, method, is_obsolete_ptr); - } - - jvmtiError CreateRawMonitor(const char* name, - jrawMonitorID* monitor_ptr) { - return functions->CreateRawMonitor(this, name, monitor_ptr); - } - - jvmtiError DestroyRawMonitor(jrawMonitorID monitor) { - return functions->DestroyRawMonitor(this, monitor); - } - - jvmtiError RawMonitorEnter(jrawMonitorID monitor) { - return functions->RawMonitorEnter(this, monitor); - } - - jvmtiError RawMonitorExit(jrawMonitorID monitor) { - return functions->RawMonitorExit(this, monitor); - } - - jvmtiError RawMonitorWait(jrawMonitorID monitor, - jlong millis) { - return functions->RawMonitorWait(this, monitor, millis); - } - - jvmtiError RawMonitorNotify(jrawMonitorID monitor) { - return functions->RawMonitorNotify(this, monitor); - } - - jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) { - return functions->RawMonitorNotifyAll(this, monitor); - } - - jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) { - return functions->SetJNIFunctionTable(this, function_table); - } - - jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) { - return functions->GetJNIFunctionTable(this, function_table); - } - - jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks, - jint size_of_callbacks) { - return functions->SetEventCallbacks(this, callbacks, size_of_callbacks); - } - - jvmtiError SetEventNotificationMode(jvmtiEventMode mode, - jvmtiEvent event_type, - jthread event_thread, - ...) { - return functions->SetEventNotificationMode(this, mode, event_type, event_thread); - } - - jvmtiError GenerateEvents(jvmtiEvent event_type) { - return functions->GenerateEvents(this, event_type); - } - - jvmtiError GetExtensionFunctions(jint* extension_count_ptr, - jvmtiExtensionFunctionInfo** extensions) { - return functions->GetExtensionFunctions(this, extension_count_ptr, extensions); - } - - jvmtiError GetExtensionEvents(jint* extension_count_ptr, - jvmtiExtensionEventInfo** extensions) { - return functions->GetExtensionEvents(this, extension_count_ptr, extensions); - } - - jvmtiError SetExtensionEventCallback(jint extension_event_index, - jvmtiExtensionEvent callback) { - return functions->SetExtensionEventCallback(this, extension_event_index, callback); - } - - jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) { - return functions->GetPotentialCapabilities(this, capabilities_ptr); - } - - jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) { - return functions->AddCapabilities(this, capabilities_ptr); - } - - jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) { - return functions->RelinquishCapabilities(this, capabilities_ptr); - } - - jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) { - return functions->GetCapabilities(this, capabilities_ptr); - } - - jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr); - } - - jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) { - return functions->GetCurrentThreadCpuTime(this, nanos_ptr); - } - - jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetThreadCpuTimerInfo(this, info_ptr); - } - - jvmtiError GetThreadCpuTime(jthread thread, - jlong* nanos_ptr) { - return functions->GetThreadCpuTime(this, thread, nanos_ptr); - } - - jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetTimerInfo(this, info_ptr); - } - - jvmtiError GetTime(jlong* nanos_ptr) { - return functions->GetTime(this, nanos_ptr); - } - - jvmtiError GetAvailableProcessors(jint* processor_count_ptr) { - return functions->GetAvailableProcessors(this, processor_count_ptr); - } - - jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) { - return functions->AddToBootstrapClassLoaderSearch(this, segment); - } - - jvmtiError GetSystemProperties(jint* count_ptr, - char*** property_ptr) { - return functions->GetSystemProperties(this, count_ptr, property_ptr); - } - - jvmtiError GetSystemProperty(const char* property, - char** value_ptr) { - return functions->GetSystemProperty(this, property, value_ptr); - } - - jvmtiError SetSystemProperty(const char* property, - const char* value) { - return functions->SetSystemProperty(this, property, value); - } - - jvmtiError GetPhase(jvmtiPhase* phase_ptr) { - return functions->GetPhase(this, phase_ptr); - } - - jvmtiError DisposeEnvironment() { - return functions->DisposeEnvironment(this); - } - - jvmtiError SetEnvironmentLocalStorage(const void* data) { - return functions->SetEnvironmentLocalStorage(this, data); - } - - jvmtiError GetEnvironmentLocalStorage(void** data_ptr) { - return functions->GetEnvironmentLocalStorage(this, data_ptr); - } - - jvmtiError GetVersionNumber(jint* version_ptr) { - return functions->GetVersionNumber(this, version_ptr); - } - - jvmtiError GetErrorName(jvmtiError error, - char** name_ptr) { - return functions->GetErrorName(this, error, name_ptr); - } - - jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag, - jboolean value) { - return functions->SetVerboseFlag(this, flag, value); - } - - jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) { - return functions->GetJLocationFormat(this, format_ptr); - } - -#endif /* __cplusplus */ -}; - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVA_JVMTI_H_ */ - diff --git a/JavaOpenJPEG/java-jni/include/win32/jawt_md.h b/JavaOpenJPEG/java-jni/include/win32/jawt_md.h deleted file mode 100644 index 5df3e469..00000000 --- a/JavaOpenJPEG/java-jni/include/win32/jawt_md.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @(#)jawt_md.h 1.7 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JAWT_MD_H_ -#define _JAVASOFT_JAWT_MD_H_ - -#include -#include "jawt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Win32-specific declarations for AWT native interface. - * See notes in jawt.h for an example of use. - */ -typedef struct jawt_Win32DrawingSurfaceInfo { - /* Native window, DDB, or DIB handle */ - union { - HWND hwnd; - HBITMAP hbitmap; - void* pbits; - }; - /* - * This HDC should always be used instead of the HDC returned from - * BeginPaint() or any calls to GetDC(). - */ - HDC hdc; - HPALETTE hpalette; -} JAWT_Win32DrawingSurfaceInfo; - -#ifdef __cplusplus -} -#endif - -#endif /* !_JAVASOFT_JAWT_MD_H_ */ diff --git a/JavaOpenJPEG/java-jni/include/win32/jni_md.h b/JavaOpenJPEG/java-jni/include/win32/jni_md.h deleted file mode 100644 index fdc79a07..00000000 --- a/JavaOpenJPEG/java-jni/include/win32/jni_md.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * @(#)jni_md.h 1.14 03/12/19 - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JNI_MD_H_ -#define _JAVASOFT_JNI_MD_H_ - -#define JNIEXPORT __declspec(dllexport) -#define JNIIMPORT __declspec(dllimport) -#define JNICALL __stdcall - -typedef long jint; -typedef __int64 jlong; -typedef signed char jbyte; - -#endif /* !_JAVASOFT_JNI_MD_H_ */ diff --git a/JavaOpenJPEG/java-jni/lib/jvm.lib b/JavaOpenJPEG/java-jni/lib/jvm.lib deleted file mode 100644 index 672855a0f0f4d9f1d4a5f37637b5c160290e1a5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 273276 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 a6% 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 LWKe?6JmUWYI;fM( diff --git a/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaDecoder.h b/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaDecoder.h deleted file mode 100644 index 0e8de2e7..00000000 --- a/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaDecoder.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_openJpeg_OpenJPEGJavaDecoder */ - -#ifndef _Included_org_openJpeg_OpenJPEGJavaDecoder -#define _Included_org_openJpeg_OpenJPEGJavaDecoder -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_openJpeg_OpenJPEGJavaDecoder - * Method: internalDecodeJ2KtoImage - * Signature: ([Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage - (JNIEnv *, jobject, jobjectArray); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaEncoder.h b/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaEncoder.h deleted file mode 100644 index 22b3d958..00000000 --- a/JavaOpenJPEG/org_openJpeg_OpenJPEGJavaEncoder.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_openJpeg_OpenJPEGJavaEncoder */ - -#ifndef _Included_org_openJpeg_OpenJPEGJavaEncoder -#define _Included_org_openJpeg_OpenJPEGJavaEncoder -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_openJpeg_OpenJPEGJavaEncoder - * Method: internalEncodeImageToJ2K - * Signature: ([Ljava/lang/String;)J - */ -JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K - (JNIEnv *, jobject, jobjectArray); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/license.txt b/LICENSE similarity index 100% rename from license.txt rename to LICENSE diff --git a/LibOpenJPEG.dsp b/LibOpenJPEG.dsp deleted file mode 100644 index 3f1766ed..00000000 --- a/LibOpenJPEG.dsp +++ /dev/null @@ -1,262 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LibOpenJPEG" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=LibOpenJPEG - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LibOpenJPEG.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LibOpenJPEG.mak" CFG="LibOpenJPEG - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LibOpenJPEG - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "LibOpenJPEG - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "LibOpenJPEG - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist dist mkdir dist copy Release\LibOpenJPEG.lib dist copy libopenjpeg\openjpeg.h dist -# End Special Build Tool - -!ELSEIF "$(CFG)" == "LibOpenJPEG - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Debug\LibOpenJPEGd.lib" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist dist mkdir dist copy Debug\LibOpenJPEGd.lib dist copy libopenjpeg\openjpeg.h dist -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "LibOpenJPEG - Win32 Release" -# Name "LibOpenJPEG - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=libopenjpeg\bio.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\cio.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\dwt.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\event.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\image.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\j2k.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\j2k_lib.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\jp2.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\jpt.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\mct.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\mqc.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\openjpeg.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\pi.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\raw.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\t1.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\t2.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\tcd.c -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\tgt.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=.\libopenjpeg\t1_luts.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=libopenjpeg\tgt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/LibOpenJPEG.dsw b/LibOpenJPEG.dsw deleted file mode 100644 index fdff9aee..00000000 --- a/LibOpenJPEG.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "DllOpenJPEG"=.\DllOpenJPEG.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "LibOpenJPEG"=.\LibOpenJPEG.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/LibOpenJPEG.sln b/LibOpenJPEG.sln deleted file mode 100644 index f088d7a9..00000000 --- a/LibOpenJPEG.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "LibOpenJPEG.vcproj", "{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Debug|Win32.ActiveCfg = Debug|Win32 - {6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Debug|Win32.Build.0 = Debug|Win32 - {6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Release|Win32.ActiveCfg = Release|Win32 - {6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/LibOpenJPEG.vcproj b/LibOpenJPEG.vcproj deleted file mode 100644 index 8d217d12..00000000 --- a/LibOpenJPEG.vcproj +++ /dev/null @@ -1,642 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Makefile b/Makefile deleted file mode 100644 index 92c781b4..00000000 --- a/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# Linux makefile for OpenJPEG - -VER_MAJOR = 2 -VER_MINOR = 2.0.0 - -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 ./libopenjpeg/function_list.c ./libopenjpeg/invert.c ./libopenjpeg/profile.c -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/function_list.h ./libopenjpeg/invert.h ./libopenjpeg/profile.h ./libopenjpeg/opj_malloc.h ./libopenjpeg/opj_includes.h -INCLUDE = -Ilibopenjpeg - -# 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 = -Wall -O3 -ffast-math -std=c99 -fPIC -LIBRARIES = -lstdc++ - -MODULES = $(SRCS:.c=.o) -CFLAGS = $(COMPILERFLAGS) $(INCLUDE) - -TARGET = openjpeg -STATICLIB = lib$(TARGET).a -SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so -LIBNAME = lib$(TARGET).so.$(VER_MAJOR) - - - -default: all - -all: OpenJPEG - -dist: OpenJPEG - 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: $(STATICLIB) $(SHAREDLIB) - -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ - -$(STATICLIB): $(MODULES) - $(AR) r $@ $(MODULES) - -$(SHAREDLIB): $(MODULES) - $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES) - -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 - -clean: - rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME) - -osx: - make -f Makefile.osx - -osxinstall: - make -f Makefile.osx install - -osxclean: - make -f Makefile.osx clean diff --git a/Makefile.osx b/Makefile.osx deleted file mode 100644 index 658b3d38..00000000 --- a/Makefile.osx +++ /dev/null @@ -1,66 +0,0 @@ -# MacOSX makefile for OpenJPEG - -VER_MAJOR = 2 -VER_MINOR = 2.0.0 - -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 -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_includes.h -INCLUDE = -Ilibopenjpeg - -# General configuration variables: -CC = gcc -LIBTOOLSTAT = libtool -LIBTOOLDYN = gcc - -PREFIX = /usr -INSTALL_LIBDIR = $(PREFIX)/lib -INSTALL_INCLUDE = $(PREFIX)/include - -COMPILERFLAGS = -O3 -fPIC - -MODULES = $(SRCS:.c=.o) -CFLAGS = $(COMPILERFLAGS) $(INCLUDE) - -TARGET = openjpeg -STATICLIB = lib$(TARGET).a -SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib -LIBNAME = lib$(TARGET).dylib - - - -default: all - -all: OpenJPEG - -dos2unix: - @$(DOS2UNIX) $(SRCS) $(INCLS) - -dist: OpenJPEG - install -d dist - install -m 644 $(STATICLIB) dist - install -m 755 $(SHAREDLIB) dist - ln -sf $(SHAREDLIB) dist/$(LIBNAME) - install libopenjpeg/openjpeg.h dist - -OpenJPEG: $(STATICLIB) $(SHAREDLIB) - -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ - -$(STATICLIB): $(MODULES) - $(LIBTOOLSTAT) -o $@ $(MODULES) - -$(SHAREDLIB): $(MODULES) - $(LIBTOOLDYN) -dynamiclib -o $@ $(MODULES) - -install: - install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)' - install -m 644 -o root -g wheel $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' - ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)' - install -m 755 -o root -g wheel $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' - ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)' - install -m 644 -o root -g wheel ./libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)' - -clean: - rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME) - diff --git a/OPJViewer/Makefile b/OPJViewer/Makefile deleted file mode 100644 index b691dc7b..00000000 --- a/OPJViewer/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# 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 -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL - -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) - -all: opjviewer lib - -.cpp.o: - $(CC) $(CFLAGS) -c $< -o $@ - -lib: - cd ../jpwl; make - -opjviewer: $(OPJV_SRCS) lib - $(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: - 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) diff --git a/OPJViewer/OPJViewer.dsp b/OPJViewer/OPJViewer.dsp deleted file mode 100644 index 4939f646..00000000 --- a/OPJViewer/OPJViewer.dsp +++ /dev/null @@ -1,290 +0,0 @@ -# Microsoft Developer Studio Project File - Name="OPJViewer" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=OPJVIEWER - WIN32 RELEASE -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "OPJViewer.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "OPJViewer.mak" CFG="OPJVIEWER - WIN32 RELEASE" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "OPJViewer - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "OPJViewer - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "OPJViewer - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /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 /Zm200 /c -# ADD BASE RSC /l 0x410 /d "NDEBUG" -# ADD RSC /l 0x409 /i "$(WXWIN28)\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 mxflib.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Release" /libpath:"$(MXFLIB)\build\msvc\Release" /IGNORE:4089 -# SUBTRACT LINK32 /pdb:none /nodefaultlib -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Update build number -PostBuild_Cmds=buildupdate.bat -# End Special Build Tool - -!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "OPJViewer___Win32_Debug" -# PROP BASE Intermediate_Dir "OPJViewer___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 "$(WXWIN28)\INCLUDE" /I "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /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" /D "OPJ_INICONFIG" /D "OPJ_MANYFORMATS" /D "USE_JPSEC" /FR /FD /GZ /Zm200 /c -# ADD BASE RSC /l 0x410 /d "_DEBUG" -# ADD RSC /l 0x410 /i "$(WXWIN28)\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 mxflib.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Debug" /libpath:"$(MXFLIB)\build\msvc\Debug" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "OPJViewer - Win32 Release" -# Name "OPJViewer - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\source\imagjpeg2000.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\imagmxf.cpp -# End Source File -# Begin Source File - -SOURCE=..\codec\index.c -# End Source File -# Begin Source File - -SOURCE=.\source\OPJAbout.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\OPJDialogs.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\OPJThreads.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\OPJViewer.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\wxj2kparser.cpp -# End Source File -# Begin Source File - -SOURCE=.\source\wxjp2parser.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\source\about_htm.h -# End Source File -# Begin Source File - -SOURCE=.\source\build.h -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\source\imagjpeg2000.h -# End Source File -# Begin Source File - -SOURCE=.\source\imagmxf.h -# End Source File -# Begin Source File - -SOURCE=..\codec\index.h -# End Source File -# Begin Source File - -SOURCE=.\source\OPJViewer.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\source\wx\msw\blank.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\bullseye.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\cdrom.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\computer.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\cross.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\drive.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\file1.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\floppy.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\folder1.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\folder2.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\hand.cur -# End Source File -# Begin Source File - -SOURCE=.\source\icon1.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\icon2.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\icon3.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\icon4.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\icon5.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\magnif1.cur -# End Source File -# Begin Source File - -SOURCE=.\source\opj_logo.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\OPJChild.ico -# End Source File -# Begin Source File - -SOURCE=.\source\OPJChild16.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\OPJViewer.ico -# End Source File -# Begin Source File - -SOURCE=.\source\OPJViewer.rc -# End Source File -# Begin Source File - -SOURCE=.\source\OPJViewer16.xpm -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\pbrush.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\pencil.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\pntleft.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\pntright.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\removble.ico -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\rightarr.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\roller.cur -# End Source File -# Begin Source File - -SOURCE=.\source\wx\msw\std.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/OPJViewer/OPJViewer.dsw b/OPJViewer/OPJViewer.dsw deleted file mode 100644 index 772043d5..00000000 --- a/OPJViewer/OPJViewer.dsw +++ /dev/null @@ -1,56 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG_JPWL"=..\jpwl\LibOpenJPEG_JPWL.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "OPJViewer"=.\OPJViewer.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG_JPWL - End Project Dependency -}}} - -############################################################################### - -Project: "mxflib"="..\..\..\..\mxflib-1.0.0\build\msvc\mxflib.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/OPJViewer/OPJViewer.iss b/OPJViewer/OPJViewer.iss deleted file mode 100644 index d4cfadbb..00000000 --- a/OPJViewer/OPJViewer.iss +++ /dev/null @@ -1,48 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! - -[Setup] -AppName=OPJViewer -AppVerName=OPJViewer 0.4 beta -AppPublisher=OpenJPEG -AppPublisherURL=http://www.openjpeg.org -AppSupportURL=http://www.openjpeg.org -AppUpdatesURL=http://www.openjpeg.org -DefaultDirName={pf}\OPJViewer -DefaultGroupName=OPJViewer -OutputDir=setup -OutputBaseFilename=OPJViewer04beta_setup -Compression=lzma -SolidCompression=true -InfoBeforeFile=source\readmebefore.txt -InfoAfterFile=source\readmeafter.txt -LicenseFile=source\license.txt -VersionInfoVersion=0.4.0.0 -VersionInfoCompany=OpenJPEG -VersionInfoDescription=JPEG 2000 viewer -ShowLanguageDialog=yes -SetupIconFile=source\OPJViewer.ico - -[Languages] -Name: english; MessagesFile: compiler:Default.isl - -[Tasks] -Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked - -[Files] -Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion -;Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion -;Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0 -Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe} -Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0 - -[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 deleted file mode 100644 index 7eb3e467..00000000 --- a/OPJViewer/Readme.txt +++ /dev/null @@ -1,100 +0,0 @@ -=============================================================================== - JPEG2000 Visualization Software - OPJViewer - - Version 0.4 beta -=============================================================================== - - -1. Scope -============= - -This document describes the installation and use of the OPJViewer in the framework of OpenJPEG library. - -This implementation has been developed using the OpenJPEG library as decoding engine and wxWidgets 2.8 as GUI engine. - -If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it - -2. Installing the viewer -========================== - -There are two options available, at the moment: - -a) compile from source code -b) download a precompiled binary. - -In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries). - -2.1. Compiling the source code in Windows -------------------------------------------- - -The steps required to compile the viewer under windows are: - -a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk. -b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration. -c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them. -d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path. -e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path. -f) Build! -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). - -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 ------------------------------------------------------ - -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. -The viewer application interface is divided into three main panels: -- a browsing pane; -- a viewing pane; -- a log/peek pane. - -The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form: - -filename -| -|_ #000: Marker/Box short name (Hex code) -| | -| |_ *** Marker/Box long name *** -| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length) -| |_ Additional info, depending on the marker/box type -| |_ ... -| -|_ #001: Marker/Box short name (Hex code) -| | -| |_ ... -| -... - - -The viewing pane will display the decoded image contained in the JPEG 2000 file. -It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working. - - -The log/peek pane is shared among two different subpanels: - -- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library -- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section. - - -4. Known bugs and limitations -=============================== - -4.1. Bugs ------------ - -* - -4.2. Limitations ------------------- - -* For mj2 files, rendering is only in B/W diff --git a/OPJViewer/about/about.htm b/OPJViewer/about/about.htm deleted file mode 100644 index fec6028f..00000000 --- a/OPJViewer/about/about.htm +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
-

-
-OPJViewer v0.2 alpha
-A JPEG 2000 image viewer -
-
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, -among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool -useful for the JPIP protocol, JPWL-tools for error-resilience, ... -
-OpenJPEG is © 2002-2007 TELE - Université Catholique de Louvain
-OPJViewer is also © 2005-2007 DSPLab - Università degli studi di Perugia -
- - diff --git a/OPJViewer/about/opj_logo.png b/OPJViewer/about/opj_logo.png deleted file mode 100644 index 0f43840a0184278d122f52bbbc11a943b888eec4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6500 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 KMNUMnLSTZ7N^0N$ diff --git a/OPJViewer/buildupdate.bat b/OPJViewer/buildupdate.bat deleted file mode 100644 index 0aae1c1c..00000000 --- a/OPJViewer/buildupdate.bat +++ /dev/null @@ -1,15 +0,0 @@ -::== 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 %%a done^! -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/OPJAbout.cpp b/OPJViewer/source/OPJAbout.cpp deleted file mode 100644 index ecc5f45d..00000000 --- a/OPJViewer/source/OPJAbout.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'  degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifdef USE_MXF -#include "mxflib/mxflib.h" -#endif // USE_MXF - -#include "OPJViewer.h" - -// about window for the frame -void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) -{ -#ifdef OPJ_HTMLABOUT -#include "about_htm.h" -#include "opj_logo.xpm" - - wxBoxSizer *topsizer; - wxHtmlWindow *html; - wxDialog dlg(this, wxID_ANY, wxString(_("About"))); - - wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM); - - topsizer = new wxBoxSizer(wxVERTICAL); - - html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER); - html->SetBorders(0); - //html->LoadPage(wxT("about/about.htm")); - //html->SetPage("Hello, world!"); - html->SetPage(htmlaboutpage); - html->SetSize(html->GetInternalRepresentation()->GetWidth(), - html->GetInternalRepresentation()->GetHeight()); - - topsizer->Add(html, 1, wxALL, 10); - - topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10); - - wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK")); - bu1->SetDefault(); - - topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15); - - dlg.SetSizer(topsizer); - topsizer->Fit(&dlg); - - dlg.ShowModal(); - -#else - - wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR - wxT("\n\n") - wxT("Built with %s and OpenJPEG ") - wxT(OPENJPEG_VERSION) - wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__) - wxT("\nRunning under %s\n\n") - OPJ_APPLICATION_COPYRIGHT, - wxVERSION_STRING, - wxGetOsDescription().c_str()), - wxT("About ") OPJ_APPLICATION_NAME, - wxOK | wxICON_INFORMATION, - this - ); - -#endif - -} diff --git a/OPJViewer/source/OPJChild.ico b/OPJViewer/source/OPJChild.ico deleted file mode 100644 index 7a127189d5bd3506e6c763205e60631369603798..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmd5*OAf*y5PfZ3TaG|nnC`fOmvG&ya1B?z3deD2OuEK5d_pBnOw|})JD?#x6Q#k98nB$Z4$B}T)<#237tT3a3Hb2Bd+{iIWJuIj zaM1$5d|qG_K9+dohYa%_ZbAVjP5I1)nEr@Y`^%r7_gkG$eSV+ul3cu(x4WF~fbLh4 z>q?(X=W9ytb4Pz2mOai0dpa0ux|{mEkA-i2JY`xLm}&34rYCEBEnable(false); - wxPanel* mjpeg2000Settings = CreatePart3SettingsPage(m_settingsNotebook); - if (!wxGetApp().m_enabledeco) - mjpeg2000Settings->Enable(false); -#ifdef USE_JPWL - wxPanel* jpwlSettings = CreatePart11SettingsPage(m_settingsNotebook); - if (!wxGetApp().m_enabledeco) - jpwlSettings->Enable(false); -#endif // USE_JPWL - - m_settingsNotebook->AddPage(mainSettings, wxT("Display"), false); - m_settingsNotebook->AddPage(jpeg2000Settings, wxT("JPEG 2000"), false); - m_settingsNotebook->AddPage(mjpeg2000Settings, wxT("MJPEG 2000"), false); -#ifdef USE_JPWL - m_settingsNotebook->AddPage(jpwlSettings, wxT("JPWL"), false); -#endif // USE_JPWL - - LayoutDialog(); -} - -OPJDecoderDialog::~OPJDecoderDialog() -{ -} - -wxPanel* OPJDecoderDialog::CreateMainSettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // sub top sizer - wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL); - - // add decoding enabling check box - subtopSizer->Add( - m_enabledecoCheck = new wxCheckBox(panel, OPJDECO_ENABLEDECO, wxT("Enable decoding"), wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 5); - m_enabledecoCheck->SetValue(wxGetApp().m_enabledeco); - - // 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("Don't resize"), wxT("Low quality"), wxT("High quality")}; - m_resizeBox = new wxRadioBox(panel, OPJDECO_RESMETHOD, - wxT("Resize method"), - wxDefaultPosition, wxDefaultSize, - WXSIZEOF(choices), - choices, - 1, - wxRA_SPECIFY_ROWS); - m_resizeBox->SetSelection(wxGetApp().m_resizemethod + 1); - - subtopSizer->Add(m_resizeBox, 0, wxGROW | wxALL, 5); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -wxPanel* OPJDecoderDialog::CreatePart3SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add some space - //topSizer->AddSpacer(5); - - // sub top sizer - wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL); - - // frame settings, column - wxStaticBox* frameBox = new wxStaticBox(panel, wxID_ANY, wxT("Frame")); - wxBoxSizer* frameSizer = new wxStaticBoxSizer(frameBox, wxVERTICAL); - - // selected frame number, row - wxBoxSizer* framenumSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - framenumSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Displayed frame:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - framenumSizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - framenumSizer->Add( - m_framenumCtrl = new wxSpinCtrl(panel, OPJDECO_FRAMENUM, - wxString::Format(wxT("%d"), wxGetApp().m_framenum), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 1, 100000, wxGetApp().m_framenum), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - - frameSizer->Add(framenumSizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(frameSizer, 0, wxGROW | wxALL, 5); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -wxPanel* OPJDecoderDialog::CreatePart1SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add some space - //topSizer->AddSpacer(5); - - // sub top sizer - wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL); - - // resolutions settings, column - wxStaticBox* resolutionBox = new wxStaticBox(panel, wxID_ANY, wxT("Resolutions")); - wxBoxSizer* resolutionSizer = new wxStaticBoxSizer(resolutionBox, wxVERTICAL); - - // reduce factor sizer, row - wxBoxSizer* reduceSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - reduceSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Reduce factor:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - reduceSizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - reduceSizer->Add( - m_reduceCtrl = new wxSpinCtrl(panel, OPJDECO_REDUCEFACTOR, - wxString::Format(wxT("%d"), wxGetApp().m_reducefactor), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 10000, wxGetApp().m_reducefactor), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - - resolutionSizer->Add(reduceSizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(resolutionSizer, 0, wxGROW | wxALL, 5); - - // quality layer settings, column - wxStaticBox* layerBox = new wxStaticBox(panel, wxID_ANY, wxT("Layers")); - wxBoxSizer* layerSizer = new wxStaticBoxSizer(layerBox, wxVERTICAL); - - // quality layers sizer, row - wxBoxSizer* qualitySizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - qualitySizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Quality layers:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - qualitySizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - qualitySizer->Add( - m_layerCtrl = new wxSpinCtrl(panel, OPJDECO_QUALITYLAYERS, - wxString::Format(wxT("%d"), wxGetApp().m_qualitylayers), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 100000, wxGetApp().m_qualitylayers), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - - layerSizer->Add(qualitySizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(layerSizer, 0, wxGROW | wxALL, 5); - - // component settings, column - wxStaticBox* compoBox = new wxStaticBox(panel, wxID_ANY, wxT("Components")); - wxBoxSizer* compoSizer = new wxStaticBoxSizer(compoBox, wxVERTICAL); - - // quality layers sizer, row - wxBoxSizer* numcompsSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - numcompsSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Component displayed:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - numcompsSizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - numcompsSizer->Add( - m_numcompsCtrl = new wxSpinCtrl(panel, OPJDECO_NUMCOMPS, - wxString::Format(wxT("%d"), wxGetApp().m_components), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 100000, wxGetApp().m_components), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - m_numcompsCtrl->Enable(true); - - compoSizer->Add(numcompsSizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(compoSizer, 0, wxGROW | wxALL, 5); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -#ifdef USE_JPWL -wxPanel* OPJDecoderDialog::CreatePart11SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add some space - //topSizer->AddSpacer(5); - - // sub top sizer - wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL); - - // add JPWL enabling check box - subtopSizer->Add( - m_enablejpwlCheck = new wxCheckBox(panel, OPJDECO_ENABLEJPWL, wxT("Enable JPWL"), wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 5); - m_enablejpwlCheck->SetValue(wxGetApp().m_enablejpwl); - - // component settings, column - wxStaticBox* compoBox = new wxStaticBox(panel, wxID_ANY, wxT("Components")); - wxBoxSizer* compoSizer = new wxStaticBoxSizer(compoBox, wxVERTICAL); - - // expected components sizer, row - wxBoxSizer* expcompsSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - expcompsSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Expected comps.:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - expcompsSizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - expcompsSizer->Add( - m_expcompsCtrl = new wxSpinCtrl(panel, OPJDECO_EXPCOMPS, - wxString::Format(wxT("%d"), wxGetApp().m_expcomps), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 1, 100000, wxGetApp().m_expcomps), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - m_expcompsCtrl->Enable(wxGetApp().m_enablejpwl); - - compoSizer->Add(expcompsSizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(compoSizer, 0, wxGROW | wxALL, 5); - - // tiles settings, column - wxStaticBox* tileBox = new wxStaticBox(panel, wxID_ANY, wxT("Tiles")); - wxBoxSizer* tileSizer = new wxStaticBoxSizer(tileBox, wxVERTICAL); - - // maximum tiles sizer, row - wxBoxSizer* maxtileSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - maxtileSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Max. no. of tiles:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); - - // add some horizontal space - maxtileSizer->Add(5, 5, 1, wxALL, 0); - - // add the value control - maxtileSizer->Add( - m_maxtilesCtrl = new wxSpinCtrl(panel, OPJDECO_MAXTILES, - wxString::Format(wxT("%d"), wxGetApp().m_maxtiles), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 1, 100000, wxGetApp().m_maxtiles), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - m_maxtilesCtrl->Enable(wxGetApp().m_enablejpwl); - - tileSizer->Add(maxtileSizer, 0, wxGROW | wxALL, 5); - - subtopSizer->Add(tileSizer, 0, wxGROW | wxALL, 5); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -void OPJDecoderDialog::OnEnableDeco(wxCommandEvent& event) -{ - size_t pp; - - if (event.IsChecked()) { - wxLogMessage(wxT("Decoding enabled")); - m_resizeBox->Enable(true); - // enable all tabs except ourselves - for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) { - if (m_settingsNotebook->GetPageText(pp) != wxT("Display")) - m_settingsNotebook->GetPage(pp)->Enable(true); - } - } else { - wxLogMessage(wxT("Decoding disabled")); - m_resizeBox->Enable(false); - // disable all tabs except ourselves - for (pp = 0; pp < m_settingsNotebook->GetPageCount(); pp++) { - if (m_settingsNotebook->GetPageText(pp) != wxT("Display")) - m_settingsNotebook->GetPage(pp)->Enable(false); - } - } - -} - -void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event) -{ - if (event.IsChecked()) { - wxLogMessage(wxT("JPWL enabled")); - m_expcompsCtrl->Enable(true); - m_maxtilesCtrl->Enable(true); - } else { - wxLogMessage(wxT("JPWL disabled")); - m_expcompsCtrl->Enable(false); - m_maxtilesCtrl->Enable(false); - } - -} - -#endif // USE_JPWL - - - - -// ---------------------------------------------------------------------------- -// OPJEncoderDialog -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(OPJEncoderDialog, wxPropertySheetDialog) - -BEGIN_EVENT_TABLE(OPJEncoderDialog, wxPropertySheetDialog) - EVT_CHECKBOX(OPJENCO_ENABLECOMM, OPJEncoderDialog::OnEnableComm) - EVT_CHECKBOX(OPJENCO_ENABLEINDEX, OPJEncoderDialog::OnEnableIdx) - EVT_CHECKBOX(OPJENCO_ENABLEPOC, OPJEncoderDialog::OnEnablePoc) - EVT_RADIOBUTTON(OPJENCO_RATERADIO, OPJEncoderDialog::OnRadioQualityRate) - EVT_RADIOBUTTON(OPJENCO_QUALITYRADIO, OPJEncoderDialog::OnRadioQualityRate) -#ifdef USE_JPWL - EVT_CHECKBOX(OPJENCO_ENABLEJPWL, OPJEncoderDialog::OnEnableJPWL) - EVT_CHOICE(OPJENCO_HPROT, OPJEncoderDialog::OnHprotSelect) - EVT_CHOICE(OPJENCO_PPROT, OPJEncoderDialog::OnPprotSelect) - EVT_CHOICE(OPJENCO_SENSI, OPJEncoderDialog::OnSensiSelect) -#endif // USE_JPWL -END_EVENT_TABLE() - -OPJEncoderDialog::OPJEncoderDialog(wxWindow* win, int dialogType) -{ - SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY); - - Create(win, wxID_ANY, wxT("Encoder settings"), - wxDefaultPosition, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE| (int) wxPlatform::IfNot(wxOS_WINDOWS_CE, wxRESIZE_BORDER) - ); - - CreateButtons(wxOK | wxCANCEL | (int)wxPlatform::IfNot(wxOS_WINDOWS_CE, wxHELP)); - - m_settingsNotebook = GetBookCtrl(); - - wxPanel* jpeg2000_1Settings = CreatePart1_1SettingsPage(m_settingsNotebook); - wxPanel* jpeg2000_2Settings = CreatePart1_2SettingsPage(m_settingsNotebook); - wxPanel* mainSettings = CreateMainSettingsPage(m_settingsNotebook); -#ifdef USE_JPWL - wxPanel* jpwlSettings = CreatePart11SettingsPage(m_settingsNotebook); -#endif // USE_JPWL - -#ifdef USE_JPWL - m_settingsNotebook->AddPage(jpwlSettings, wxT("JPWL"), false); -#endif // USE_JPWL - m_settingsNotebook->AddPage(jpeg2000_1Settings, wxT("JPEG 2000 - 1"), false); - m_settingsNotebook->AddPage(jpeg2000_2Settings, wxT("JPEG 2000 - 2"), false); - m_settingsNotebook->AddPage(mainSettings, wxT("General"), false); - - LayoutDialog(); -} - -OPJEncoderDialog::~OPJEncoderDialog() -{ -} - -wxPanel* OPJEncoderDialog::CreateMainSettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // sub top sizer - wxBoxSizer *subtopSizer = new wxBoxSizer(wxVERTICAL); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -#ifdef USE_JPWL -wxPanel* OPJEncoderDialog::CreatePart11SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - int specno; - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add JPWL enabling check box - topSizer->Add( - m_enablejpwlCheck = new wxCheckBox(panel, OPJENCO_ENABLEJPWL, wxT("Enable JPWL"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL | wxALIGN_CENTER, 5); - m_enablejpwlCheck->SetValue(wxGetApp().m_enablejpwle); - - // sub top sizer - wxFlexGridSizer *subtopSizer = new wxFlexGridSizer(2, 3, 3); - - // header settings, column - wxStaticBox* headerBox = new wxStaticBox(panel, wxID_ANY, wxT("Header protection")); - wxBoxSizer* headerSizer = new wxStaticBoxSizer(headerBox, wxVERTICAL); - - // info sizer, row - wxBoxSizer* info1Sizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - info1Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Type")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - // add some horizontal space - info1Sizer->Add(3, 3, 1, wxALL, 0); - - // add some text - info1Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Tile part")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - headerSizer->Add(info1Sizer, 0, wxGROW | wxALL, 0); - - // specify specs - wxString hprotvalues[] = {wxT("None"), wxT("Pred."), wxT("CRC16"), wxT("CRC32"), - wxT("RS37"), wxT("RS38"), wxT("RS40"), wxT("RS43"), wxT("RS45"), wxT("RS48"), - wxT("RS51"), wxT("RS53"), wxT("RS56"), wxT("RS64"), wxT("RS75"), wxT("RS80"), - wxT("RS85"), wxT("RS96"), wxT("RS112"), wxT("RS128")}; - for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) { - - // tile+hprot sizer, row - wxBoxSizer* tilehprotSizer = new wxBoxSizer(wxHORIZONTAL); - - // add the value selection - tilehprotSizer->Add( - m_hprotChoice[specno] = new wxChoice(panel, OPJENCO_HPROT, - wxDefaultPosition, wxSize(60, wxDefaultCoord), - WXSIZEOF(hprotvalues), hprotvalues), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - m_hprotChoice[specno]->SetSelection(wxGetApp().m_hprotsel[specno]); - - // add some horizontal space - tilehprotSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilehprotSizer->Add( - m_htileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_HTILE, - wxString::Format(wxT("%d"), wxGetApp().m_htileval[specno]), - wxDefaultPosition, wxSize(45, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, JPWL_MAXIMUM_TILES - 1, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - - headerSizer->Add(tilehprotSizer, 0, wxGROW | wxALL, 0); - } - - wxCommandEvent event1; - OnHprotSelect(event1); - - subtopSizer->Add(headerSizer, 0, wxGROW | wxALL, 3); - - // packet settings, column - wxStaticBox* packetBox = new wxStaticBox(panel, wxID_ANY, wxT("Packet protection")); - wxBoxSizer* packetSizer = new wxStaticBoxSizer(packetBox, wxVERTICAL); - - // info sizer, row - wxBoxSizer* info2Sizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - info2Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Type")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - // add some horizontal space - info2Sizer->Add(3, 3, 1, wxALL, 0); - - // add some text - info2Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Tile part")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - // add some horizontal space - info2Sizer->Add(3, 3, 1, wxALL, 0); - - // add some text - info2Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Packet")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - packetSizer->Add(info2Sizer, 0, wxGROW | wxALL, 0); - - // specify specs - wxString pprotvalues[] = {wxT("None"), wxT("Pred."), wxT("CRC16"), wxT("CRC32"), - wxT("RS37"), wxT("RS38"), wxT("RS40"), wxT("RS43"), wxT("RS45"), wxT("RS48"), - wxT("RS51"), wxT("RS53"), wxT("RS56"), wxT("RS64"), wxT("RS75"), wxT("RS80"), - wxT("RS85"), wxT("RS96"), wxT("RS112"), wxT("RS128")}; - for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) { - - // tile+pprot sizer, row - wxBoxSizer* tilepprotSizer = new wxBoxSizer(wxHORIZONTAL); - - // add the value selection - tilepprotSizer->Add( - m_pprotChoice[specno] = new wxChoice(panel, OPJENCO_PPROT, - wxDefaultPosition, wxSize(60, wxDefaultCoord), - WXSIZEOF(pprotvalues), pprotvalues), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - m_pprotChoice[specno]->SetSelection(wxGetApp().m_pprotsel[specno]); - - // add some horizontal space - tilepprotSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilepprotSizer->Add( - m_ptileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_PTILE, - wxString::Format(wxT("%d"), wxGetApp().m_ptileval[specno]), - wxDefaultPosition, wxSize(45, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, JPWL_MAXIMUM_TILES - 1, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - - // add some horizontal space - tilepprotSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilepprotSizer->Add( - m_ppackCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_PPACK, - wxString::Format(wxT("%d"), wxGetApp().m_ppackval[specno]), - wxDefaultPosition, wxSize(50, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 2047, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - - packetSizer->Add(tilepprotSizer, 0, wxGROW | wxALL, 0); - } - - wxCommandEvent event2; - OnPprotSelect(event2); - - subtopSizer->Add(packetSizer, 0, wxGROW | wxALL, 3); - - // sensitivity settings, column - wxStaticBox* sensiBox = new wxStaticBox(panel, wxID_ANY, wxT("Sensitivity")); - wxBoxSizer* sensiSizer = new wxStaticBoxSizer(sensiBox, wxVERTICAL); - - // info sizer, row - wxBoxSizer* info3Sizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - info3Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Type")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - // add some horizontal space - info3Sizer->Add(3, 3, 1, wxALL, 0); - - // add some text - info3Sizer->Add(new wxStaticText(panel, wxID_ANY, - wxT("Tile part")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); - - sensiSizer->Add(info3Sizer, 0, wxGROW | wxALL, 0); - - // specify specs - wxString sensivalues[] = {wxT("None"), wxT("RELATIVE ERROR"), wxT("MSE"), - wxT("MSE REDUCTION"), wxT("PSNR INCREMENT"), wxT("MAXERR"), wxT("TSE")}; - for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) { - - // tile+sensi sizer, row - wxBoxSizer* tilesensiSizer = new wxBoxSizer(wxHORIZONTAL); - - // add the value selection - tilesensiSizer->Add( - m_sensiChoice[specno] = new wxChoice(panel, OPJENCO_SENSI, - wxDefaultPosition, wxSize(110, wxDefaultCoord), - WXSIZEOF(sensivalues), sensivalues), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - m_sensiChoice[specno]->SetSelection(wxGetApp().m_sensisel[specno]); - - // add some horizontal space - tilesensiSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilesensiSizer->Add( - m_stileCtrl[specno] = new wxSpinCtrl(panel, OPJENCO_STILE, - wxString::Format(wxT("%d"), wxGetApp().m_stileval[specno]), - wxDefaultPosition, wxSize(45, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, JPWL_MAXIMUM_TILES - 1, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 1); - - sensiSizer->Add(tilesensiSizer, 0, wxGROW | wxALL, 0); - } - - wxCommandEvent event3; - OnSensiSelect(event3); - - subtopSizer->Add(sensiSizer, 0, wxGROW | wxALL, 3); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} -#endif // USE_JPWL - -wxPanel* OPJEncoderDialog::CreatePart1_1SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add some space - //topSizer->AddSpacer(5); - - // sub top sizer - wxFlexGridSizer *subtopSizer = new wxFlexGridSizer(2, 3, 3); - - // image settings, column - wxStaticBox* imageBox = new wxStaticBox(panel, wxID_ANY, wxT("Image")); - wxBoxSizer* imageSizer = new wxStaticBoxSizer(imageBox, wxVERTICAL); - - // subsampling factor sizer, row - wxBoxSizer* subsSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - subsSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Subsampling:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - subsSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - subsSizer->Add( - m_subsamplingCtrl = new wxTextCtrl(panel, OPJENCO_SUBSAMPLING, - wxGetApp().m_subsampling, - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - imageSizer->Add(subsSizer, 0, wxGROW | wxALL, 3); - - // origin sizer, row - wxBoxSizer* imorigSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - imorigSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Origin:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - imorigSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - imorigSizer->Add( - m_originCtrl = new wxTextCtrl(panel, OPJENCO_IMORIG, - wxGetApp().m_origin, - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - imageSizer->Add(imorigSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(imageSizer, 0, wxGROW | wxALL, 3); - - // layer settings, column - wxStaticBox* layerBox = new wxStaticBox(panel, wxID_ANY, wxT("Layers/compression")); - wxBoxSizer* layerSizer = new wxStaticBoxSizer(layerBox, wxVERTICAL); - - // rate factor sizer, row - wxBoxSizer* rateSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - /*rateSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Rate values:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3);*/ - - // add the radio button - rateSizer->Add( - m_rateRadio = new wxRadioButton(panel, OPJENCO_RATERADIO, wxT("&Rate values"), - wxDefaultPosition, wxDefaultSize, - wxRB_GROUP), - 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL - ); - m_rateRadio->SetValue(!(wxGetApp().m_enablequality)); - - // add some horizontal space - rateSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - rateSizer->Add( - m_rateCtrl = new wxTextCtrl(panel, OPJENCO_RATEFACTOR, - wxGetApp().m_rates, - wxDefaultPosition, wxSize(100, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - if (wxGetApp().m_enablequality == true) - m_rateCtrl->Enable(false); - - layerSizer->Add(rateSizer, 0, wxGROW | wxALL, 3); - - // quality factor sizer, row - wxBoxSizer* qualitySizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - /*qualitySizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Quality values:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3);*/ - - // add the radio button - qualitySizer->Add( - m_qualityRadio = new wxRadioButton(panel, OPJENCO_QUALITYRADIO, wxT("&Quality values"), - wxDefaultPosition, wxDefaultSize), - 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL - ); - m_qualityRadio->SetValue(wxGetApp().m_enablequality); - - // add some horizontal space - qualitySizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - qualitySizer->Add( - m_qualityCtrl = new wxTextCtrl(panel, OPJENCO_QUALITYFACTOR, - wxGetApp().m_quality, - wxDefaultPosition, wxSize(100, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - if (wxGetApp().m_enablequality == false) - m_qualityCtrl->Enable(false); - - layerSizer->Add(qualitySizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(layerSizer, 0, wxGROW | wxALL, 3); - - // wavelet settings, column - wxStaticBox* transformBox = new wxStaticBox(panel, wxID_ANY, wxT("Transforms")); - wxBoxSizer* transformSizer = new wxStaticBoxSizer(transformBox, wxVERTICAL); - - // multiple component check box - transformSizer->Add( - m_mctCheck = new wxCheckBox(panel, OPJENCO_ENABLEMCT, wxT("Multiple component"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_mctCheck->SetValue(wxGetApp().m_multicomp); - - // irreversible wavelet check box - transformSizer->Add( - m_irrevCheck = new wxCheckBox(panel, OPJENCO_ENABLEIRREV, wxT("Irreversible wavelet"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_irrevCheck->SetValue(wxGetApp().m_irreversible); - - // resolution number sizer, row - wxBoxSizer* resnumSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - resnumSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Resolutions:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - resnumSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - resnumSizer->Add( - m_resolutionsCtrl = new wxSpinCtrl(panel, OPJENCO_RESNUMBER, - wxString::Format(wxT("%d"), wxGetApp().m_resolutions), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 1, 256, 6), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - transformSizer->Add(resnumSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(transformSizer, 0, wxGROW | wxALL, 3); - - // codestream settings, column - wxStaticBox* codestreamBox = new wxStaticBox(panel, wxID_ANY, wxT("Codestream")); - wxBoxSizer* codestreamSizer = new wxStaticBoxSizer(codestreamBox, wxVERTICAL); - - // codeblock sizer, row - wxBoxSizer* codeblockSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - codeblockSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Codeblocks size:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - codeblockSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - codeblockSizer->Add( - m_cbsizeCtrl = new wxTextCtrl(panel, OPJENCO_CODEBLOCKSIZE, - wxGetApp().m_cbsize, - wxDefaultPosition, wxSize(100, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - codestreamSizer->Add(codeblockSizer, 0, wxGROW | wxALL, 3); - - // precinct sizer, row - wxBoxSizer* precinctSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - precinctSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Precincts size:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - precinctSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - precinctSizer->Add( - m_prsizeCtrl = new wxTextCtrl(panel, OPJENCO_PRECINCTSIZE, - wxGetApp().m_prsize, - wxDefaultPosition, wxSize(100, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - codestreamSizer->Add(precinctSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(codestreamSizer, 0, wxGROW | wxALL, 3); - - // tile settings, column - wxStaticBox* tileBox = new wxStaticBox(panel, wxID_ANY, wxT("Tiles")); - wxBoxSizer* tileSizer = new wxStaticBoxSizer(tileBox, wxVERTICAL); - - // tile size sizer, row - wxBoxSizer* tilesizeSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - tilesizeSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Size:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - tilesizeSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilesizeSizer->Add( - m_tsizeCtrl = new wxTextCtrl(panel, OPJENCO_TILESIZE, - wxGetApp().m_tsize, - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - tileSizer->Add(tilesizeSizer, 0, wxGROW | wxALL, 3); - - // tile origin sizer, row - wxBoxSizer* tilorigSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - tilorigSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Origin:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - tilorigSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - tilorigSizer->Add( - m_toriginCtrl = new wxTextCtrl(panel, OPJENCO_TILORIG, - wxGetApp().m_torigin, - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - tileSizer->Add(tilorigSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(tileSizer, 0, wxGROW | wxALL, 3); - - // progression and profile settings, column - wxString choices[] = {wxT("LRCP"), wxT("RLCP"), wxT("RPCL"), wxT("PCRL"), wxT("CPRL"), - wxT("DCI2K24"), wxT("DCI2K48"), wxT("DCI4K")}; - progressionBox = new wxRadioBox(panel, OPJENCO_PROGRESSION, - wxT("Progression order/profile"), - wxDefaultPosition, wxDefaultSize, - WXSIZEOF(choices), - choices, - 3, - wxRA_SPECIFY_COLS); - progressionBox->SetSelection(wxGetApp().m_progression); - - subtopSizer->Add(progressionBox, 0, wxGROW | wxALL, 3); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -wxPanel* OPJEncoderDialog::CreatePart1_2SettingsPage(wxWindow* parent) -{ - wxPanel* panel = new wxPanel(parent, wxID_ANY); - - // top sizer - wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); - - // add some space - //topSizer->AddSpacer(5); - - // sub top sizer - wxFlexGridSizer *subtopSizer = new wxFlexGridSizer(2, 3, 3); - - // resilience settings, column - wxStaticBox* resilBox = new wxStaticBox(panel, wxID_ANY, wxT("Error resilience")); - wxBoxSizer* resilSizer = new wxStaticBoxSizer(resilBox, wxVERTICAL); - - // resil2 sizer, row - wxBoxSizer* resil2Sizer = new wxBoxSizer(wxHORIZONTAL); - - // SOP check box - resil2Sizer->Add( - m_sopCheck = new wxCheckBox(panel, OPJENCO_ENABLESOP, wxT("SOP"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_sopCheck->SetValue(wxGetApp().m_enablesop); - - // EPH check box - resil2Sizer->Add( - m_ephCheck = new wxCheckBox(panel, OPJENCO_ENABLEEPH, wxT("EPH"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_ephCheck->SetValue(wxGetApp().m_enableeph); - - resilSizer->Add(resil2Sizer, 0, wxGROW | wxALL, 3); - - // separation - resilSizer->Add(new wxStaticLine(panel, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 3); - - // resil3 sizer, row - wxFlexGridSizer* resil3Sizer = new wxFlexGridSizer(3, 3, 3); - - // BYPASS check box - resil3Sizer->Add( - m_enablebypassCheck = new wxCheckBox(panel, OPJENCO_ENABLEBYPASS, wxT("BYPASS"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablebypassCheck->SetValue(wxGetApp().m_enablebypass); - - // RESET check box - resil3Sizer->Add( - m_enableresetCheck = new wxCheckBox(panel, OPJENCO_ENABLERESET, wxT("RESET"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enableresetCheck->SetValue(wxGetApp().m_enablereset); - - // RESTART check box - resil3Sizer->Add( - m_enablerestartCheck = new wxCheckBox(panel, OPJENCO_ENABLERESTART, wxT("RESTART"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablerestartCheck->SetValue(wxGetApp().m_enablerestart); - - // VSC check box - resil3Sizer->Add( - m_enablevscCheck = new wxCheckBox(panel, OPJENCO_ENABLEVSC, wxT("VSC"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablevscCheck->SetValue(wxGetApp().m_enablevsc); - - // ERTERM check box - resil3Sizer->Add( - m_enableertermCheck = new wxCheckBox(panel, OPJENCO_ENABLEERTERM, wxT("ERTERM"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enableertermCheck->SetValue(wxGetApp().m_enableerterm); - - // SEGMARK check box - resil3Sizer->Add( - m_enablesegmarkCheck = new wxCheckBox(panel, OPJENCO_ENABLESEGMARK, wxT("SEGMARK"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablesegmarkCheck->SetValue(wxGetApp().m_enablesegmark); - - resilSizer->Add(resil3Sizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(resilSizer, 0, wxGROW | wxALL, 3); - - // ROI settings, column - wxStaticBox* roiBox = new wxStaticBox(panel, wxID_ANY, wxT("Region Of Interest")); - wxBoxSizer* roiSizer = new wxStaticBoxSizer(roiBox, wxVERTICAL); - - // component number sizer, row - wxBoxSizer* roicompSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - roicompSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Component:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - roicompSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - roicompSizer->Add( - /*m_layerCtrl =*/ new wxSpinCtrl(panel, OPJENCO_ROICOMP, - wxT("0"), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 256, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - roiSizer->Add(roicompSizer, 0, wxGROW | wxALL, 3); - - // upshift sizer, row - wxBoxSizer* roishiftSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - roishiftSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Upshift:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - roishiftSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - roishiftSizer->Add( - /*m_layerCtrl =*/ new wxSpinCtrl(panel, OPJENCO_ROISHIFT, - wxT("0"), - wxDefaultPosition, wxSize(80, wxDefaultCoord), - wxSP_ARROW_KEYS, - 0, 37, 0), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - - roiSizer->Add(roishiftSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(roiSizer, 0, wxGROW | wxALL, 3); - - // POC settings, column - wxStaticBox* pocBox = new wxStaticBox(panel, wxID_ANY, wxT("POC")); - wxBoxSizer* pocSizer = new wxStaticBoxSizer(pocBox, wxVERTICAL); - - // POC check box - pocSizer->Add( - m_enablepocCheck = new wxCheckBox(panel, OPJENCO_ENABLEPOC, wxT("Enabled (tn=rs,cs,le,re,ce,pr)"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablepocCheck->SetValue(wxGetApp().m_enablepoc); - - // POC sizer, row - wxBoxSizer* pocspecSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - pocspecSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&Changes:")), - 0, wxALL | wxALIGN_TOP, 3); - - // add some horizontal space - pocspecSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - pocspecSizer->Add( - m_pocCtrl = new wxTextCtrl(panel, OPJENCO_POCSPEC, - wxGetApp().m_poc, - wxDefaultPosition, wxSize(140, 60), - wxTE_LEFT | wxTE_MULTILINE), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - m_pocCtrl->Enable(wxGetApp().m_enablepoc); - - pocSizer->Add(pocspecSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(pocSizer, 0, wxGROW | wxALL, 3); - - // Comment settings, column - wxStaticBox* commentBox = new wxStaticBox(panel, wxID_ANY, wxT("Comment")); - wxBoxSizer* commentSizer = new wxStaticBoxSizer(commentBox, wxVERTICAL); - - // commenting check box - commentSizer->Add( - m_enablecommCheck = new wxCheckBox(panel, OPJENCO_ENABLECOMM, wxT("Enabled (empty to reset)"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enablecommCheck->SetValue(wxGetApp().m_enablecomm); - - // add some horizontal space - commentSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - commentSizer->Add( - m_commentCtrl = new wxTextCtrl(panel, OPJENCO_COMMENTTEXT, - wxGetApp().m_comment, - wxDefaultPosition, wxSize(wxDefaultCoord, 60), - wxTE_LEFT | wxTE_MULTILINE), - 0, wxGROW | wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - m_commentCtrl->Enable(wxGetApp().m_enablecomm); - - subtopSizer->Add(commentSizer, 0, wxGROW | wxALL, 3); - - // Index file settings, column - wxStaticBox* indexBox = new wxStaticBox(panel, wxID_ANY, wxT("Indexing")); - wxBoxSizer* indexSizer = new wxStaticBoxSizer(indexBox, wxVERTICAL); - - // indexing check box - indexSizer->Add( - m_enableidxCheck = new wxCheckBox(panel, OPJENCO_ENABLEINDEX, wxT("Enabled"), - wxDefaultPosition, wxDefaultSize), - 0, wxGROW | wxALL, 3); - m_enableidxCheck->SetValue(wxGetApp().m_enableidx); - - // index file sizer, row - wxBoxSizer* indexnameSizer = new wxBoxSizer(wxHORIZONTAL); - - // add some text - indexnameSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("&File name:")), - 0, wxALL | wxALIGN_CENTER_VERTICAL, 3); - - // add some horizontal space - indexnameSizer->Add(3, 3, 1, wxALL, 0); - - // add the value control - indexnameSizer->Add( - m_indexCtrl = new wxTextCtrl(panel, OPJENCO_INDEXNAME, - wxGetApp().m_index, - wxDefaultPosition, wxSize(120, wxDefaultCoord), - wxTE_LEFT), - 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 3); - m_indexCtrl->Enable(wxGetApp().m_enableidx); - - indexSizer->Add(indexnameSizer, 0, wxGROW | wxALL, 3); - - subtopSizer->Add(indexSizer, 0, wxGROW | wxALL, 3); - - topSizer->Add(subtopSizer, 1, wxGROW | wxALIGN_CENTRE | wxALL, 5); - - // assign top and fit it - panel->SetSizer(topSizer); - topSizer->Fit(panel); - - return panel; -} - -void OPJEncoderDialog::OnEnableComm(wxCommandEvent& event) -{ - if (event.IsChecked()) { - wxLogMessage(wxT("Comment enabled")); - m_commentCtrl->Enable(true); - } else { - wxLogMessage(wxT("Comment disabled")); - m_commentCtrl->Enable(false); - } - -} - -void OPJEncoderDialog::OnEnableIdx(wxCommandEvent& event) -{ - if (event.IsChecked()) { - wxLogMessage(wxT("Index enabled")); - m_indexCtrl->Enable(true); - } else { - wxLogMessage(wxT("Index disabled")); - m_indexCtrl->Enable(false); - } - -} - -void OPJEncoderDialog::OnEnablePoc(wxCommandEvent& event) -{ - if (event.IsChecked()) { - wxLogMessage(wxT("POC enabled")); - m_pocCtrl->Enable(true); - } else { - wxLogMessage(wxT("POC disabled")); - m_pocCtrl->Enable(false); - } - -} - -void OPJEncoderDialog::OnRadioQualityRate(wxCommandEvent& event) -{ - if (event.GetId() == OPJENCO_QUALITYRADIO) { - wxLogMessage(wxT("Quality selected")); - m_rateCtrl->Enable(false); - m_qualityCtrl->Enable(true); - } else { - wxLogMessage(wxT("Rate selected")); - m_rateCtrl->Enable(true); - m_qualityCtrl->Enable(false); - } -} - -#ifdef USE_JPWL -void OPJEncoderDialog::OnEnableJPWL(wxCommandEvent& event) -{ - int specno; - - if (event.IsChecked()) { - wxLogMessage(wxT("JPWL enabled")); - for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) { - m_hprotChoice[specno]->Enable(true); - m_htileCtrl[specno]->Enable(true); - m_pprotChoice[specno]->Enable(true); - m_ptileCtrl[specno]->Enable(true); - m_ppackCtrl[specno]->Enable(true); - m_sensiChoice[specno]->Enable(true); - m_stileCtrl[specno]->Enable(true); - } - OnHprotSelect(event); - OnPprotSelect(event); - OnSensiSelect(event); - } else { - wxLogMessage(wxT("JPWL disabled")); - for (specno = 0; specno < MYJPWL_MAX_NO_TILESPECS; specno++) { - m_hprotChoice[specno]->Enable(false); - m_htileCtrl[specno]->Enable(false); - m_pprotChoice[specno]->Enable(false); - m_ptileCtrl[specno]->Enable(false); - m_ppackCtrl[specno]->Enable(false); - m_sensiChoice[specno]->Enable(false); - m_stileCtrl[specno]->Enable(false); - } - } - -} - -void OPJEncoderDialog::OnHprotSelect(wxCommandEvent& event) -{ - int specno; - - // deactivate properly - for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) { - if (!m_hprotChoice[specno]->GetSelection()) { - m_hprotChoice[specno]->Enable(false); - m_htileCtrl[specno]->Enable(false); - } else - break; - } - if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) { - m_hprotChoice[specno + 1]->Enable(true); - m_htileCtrl[specno + 1]->Enable(true); - } - - //wxLogMessage(wxT("hprot changed: %d"), specno); -} - -void OPJEncoderDialog::OnPprotSelect(wxCommandEvent& event) -{ - int specno; - - // deactivate properly - for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) { - if (!m_pprotChoice[specno]->GetSelection()) { - m_pprotChoice[specno]->Enable(false); - m_ptileCtrl[specno]->Enable(false); - m_ppackCtrl[specno]->Enable(false); - } else - break; - } - if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) { - m_pprotChoice[specno + 1]->Enable(true); - m_ptileCtrl[specno + 1]->Enable(true); - m_ppackCtrl[specno + 1]->Enable(true); - } - - //wxLogMessage(wxT("pprot changed: %d"), specno); -} - -void OPJEncoderDialog::OnSensiSelect(wxCommandEvent& event) -{ - int specno; - - // deactivate properly - for (specno = MYJPWL_MAX_NO_TILESPECS - 1; specno >= 0; specno--) { - if (!m_sensiChoice[specno]->GetSelection()) { - m_sensiChoice[specno]->Enable(false); - m_stileCtrl[specno]->Enable(false); - } else - break; - } - if (specno < (MYJPWL_MAX_NO_TILESPECS - 1)) { - m_sensiChoice[specno + 1]->Enable(true); - m_stileCtrl[specno + 1]->Enable(true); - } - - //wxLogMessage(wxT("sprot changed: %d"), specno); -} - - -#endif // USE_JPWL - diff --git a/OPJViewer/source/OPJThreads.cpp b/OPJViewer/source/OPJThreads.cpp deleted file mode 100644 index 3c93ee23..00000000 --- a/OPJViewer/source/OPJThreads.cpp +++ /dev/null @@ -1,1268 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'  degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "OPJViewer.h" - - -///////////////////////////////////////////////////////////////////// -// Encoding thread class -///////////////////////////////////////////////////////////////////// - -OPJEncoThread::OPJEncoThread(OPJCanvas *canvas) - : wxThread() -{ - m_count = 0; - m_canvas = canvas; -} - -void OPJEncoThread::WriteText(const wxString& text) -{ - wxString msg; - - // before doing any GUI calls we must ensure that this thread is the only - // one doing it! - -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif // __WXGTK__ - - msg << text; - m_canvas->WriteText(msg); - -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif // __WXGTK__ -} - -void OPJEncoThread::OnExit() -{ - wxCriticalSectionLocker locker(wxGetApp().m_enco_critsect); - - wxArrayThread& ethreads = wxGetApp().m_enco_threads; - ethreads.Remove(this); - - if (ethreads.IsEmpty() ) - { - // signal the main thread that there are no more threads left if it is - // waiting for us - if (wxGetApp().m_enco_waitingUntilAllDone) { - wxGetApp().m_enco_waitingUntilAllDone = false; - wxGetApp().m_enco_semAllDone.Post(); - } - } -} - -void *OPJEncoThread::Entry() -{ - wxString text; - - srand(GetId()); - //int m_countnum = rand() % 9; - //text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."), - // GetId(), GetPriority(), m_countnum); - text.Printf(wxT("Enco thread %d started"), m_canvas->m_childframe->m_winnumber); - WriteText(text); - - // set handler properties - wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000); - jpeg2000handler->m_subsampling = wxGetApp().m_subsampling; - jpeg2000handler->m_origin = wxGetApp().m_origin; - jpeg2000handler->m_rates = wxGetApp().m_rates; - jpeg2000handler->m_quality = wxGetApp().m_quality; - jpeg2000handler->m_enablequality = wxGetApp().m_enablequality; - jpeg2000handler->m_multicomp = wxGetApp().m_multicomp; - jpeg2000handler->m_irreversible = wxGetApp().m_irreversible; - jpeg2000handler->m_resolutions = wxGetApp().m_resolutions; - jpeg2000handler->m_progression = wxGetApp().m_progression; - jpeg2000handler->m_cbsize = wxGetApp().m_cbsize; - jpeg2000handler->m_prsize = wxGetApp().m_prsize; - jpeg2000handler->m_tsize = wxGetApp().m_tsize; - jpeg2000handler->m_torigin = wxGetApp().m_torigin; - jpeg2000handler->m_enablesop = wxGetApp().m_enablesop; - jpeg2000handler->m_enableeph = wxGetApp().m_enableeph; - jpeg2000handler->m_enablebypass = wxGetApp().m_enablebypass; - jpeg2000handler->m_enablerestart = wxGetApp().m_enablerestart; - jpeg2000handler->m_enablereset = wxGetApp().m_enablereset; - jpeg2000handler->m_enablesegmark = wxGetApp().m_enablesegmark; - jpeg2000handler->m_enableerterm = wxGetApp().m_enableerterm; - jpeg2000handler->m_enablevsc = wxGetApp().m_enablevsc; - jpeg2000handler->m_enableidx = wxGetApp().m_enableidx; - jpeg2000handler->m_index = m_canvas->m_savename.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxGetApp().m_index; - jpeg2000handler->m_enablecomm = wxGetApp().m_enablecomm; - jpeg2000handler->m_comment = wxGetApp().m_comment; - jpeg2000handler->m_enablepoc = wxGetApp().m_enablepoc; - jpeg2000handler->m_poc = wxGetApp().m_poc; - - // save the file - if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), (wxBitmapType) wxBITMAP_TYPE_JPEG2000)) { - WriteText(wxT("Can't save image")); - return NULL; - } - - text.Printf(wxT("Enco thread %d finished"), m_canvas->m_childframe->m_winnumber); - WriteText(text); - return NULL; -} - - -///////////////////////////////////////////////////////////////////// -// Decoding thread class -///////////////////////////////////////////////////////////////////// -OPJDecoThread::OPJDecoThread(OPJCanvas *canvas) - : wxThread() -{ - m_count = 0; - m_canvas = canvas; -} - -void OPJDecoThread::WriteText(const wxString& text) -{ - 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 - // one doing it! - -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif // __WXGTK__ - - msg << text; - m_canvas->WriteText(msg); - -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif // __WXGTK__ -*/ -} - -void OPJDecoThread::OnExit() -{ - wxCriticalSectionLocker locker(wxGetApp().m_deco_critsect); - - wxArrayThread& dthreads = wxGetApp().m_deco_threads; - dthreads.Remove(this); - - if (dthreads.IsEmpty() ) - { - // signal the main thread that there are no more threads left if it is - // waiting for us - if (wxGetApp().m_deco_waitingUntilAllDone) { - wxGetApp().m_deco_waitingUntilAllDone = false; - wxGetApp().m_deco_semAllDone.Post(); - } - } -} - -void *OPJDecoThread::Entry() -{ - - wxString text; - - //srand(GetId()); - //int m_countnum = rand() % 9; - //text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."), - // GetId(), GetPriority(), m_countnum); - - // we have started - text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber); - WriteText(text); - - // prepare dummy wximage - wxBitmap bitmap(100, 100); - wxImage image(100, 100, true); //= bitmap.ConvertToImage(); - image.Destroy(); - - // show image full name - WriteText(m_canvas->m_fname.GetFullPath()); - - // set handler properties - wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000); - jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor; - jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers; - jpeg2000handler->m_components = wxGetApp().m_components; - jpeg2000handler->m_framenum = wxGetApp().m_framenum; -#ifdef USE_JPWL - jpeg2000handler->m_enablejpwl = wxGetApp().m_enablejpwl; - jpeg2000handler->m_expcomps = wxGetApp().m_expcomps; - jpeg2000handler->m_maxtiles = wxGetApp().m_maxtiles; -#endif // USE_JPWL - -#ifdef USE_MXF - wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(wxBITMAP_TYPE_MXF); - mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor; - mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers; - mxfffhandler->m_components = wxGetApp().m_components; - mxfffhandler->m_framenum = wxGetApp().m_framenum; - mxfffhandler->m_filename = m_canvas->m_fname; -#ifdef USE_JPWL - mxfffhandler->m_enablejpwl = wxGetApp().m_enablejpwl; - mxfffhandler->m_expcomps = wxGetApp().m_expcomps; - mxfffhandler->m_maxtiles = wxGetApp().m_maxtiles; -#endif // USE_JPWL -#endif // USE_MXF - - // if decoding is enabled... - if (wxGetApp().m_enabledeco) { - - // load the file - if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) { - WriteText(wxT("Can't load image!")); - return NULL; - } - - } else { - - // display a warning - if (!image.Create(300, 5, false)) { - WriteText(wxT("Can't create image!")); - return NULL; - } - - } - - // assign 100% 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 - /*int zooml, wzooml, hzooml; - wxSize clientsize = m_canvas->GetClientSize(); - 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())); - zooml = wxMin(100, wxMin(wzooml, hzooml));*/ - - // fit to width -#ifndef __WXGTK__ - //m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe); -#endif // __WXGTK__ - - //m_canvas->m_image = m_canvas->m_image100; - //m_canvas->Refresh(); - //m_canvas->SetScrollbars(20, 20, (int)(0.5 + (double) image.GetWidth() / 20.0), (int)(0.5 + (double) image.GetHeight() / 20.0)); - - //text.Printf(wxT("Deco thread 0x%lx finished."), GetId()); - text.Printf(wxT("Deco thread %d finished"), m_canvas->m_childframe->m_winnumber); - WriteText(text); - return NULL; - -} - -///////////////////////////////////////////////////////////////////// -// Parsing thread class -///////////////////////////////////////////////////////////////////// - -OPJParseThread::OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid) - : wxThread() -{ - m_count = 0; - m_tree = tree; - m_parentid = parentid; -} - -void OPJParseThread::WriteText(const wxString& text) -{ - 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 - // one doing it! - -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif // __WXGTK - - msg << text; - m_tree->WriteText(msg); - -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif // __WXGTK*/ -} - -void OPJParseThread::OnExit() -{ - wxCriticalSectionLocker locker(wxGetApp().m_parse_critsect); - - wxArrayThread& threads = wxGetApp().m_parse_threads; - threads.Remove(this); - - if (threads.IsEmpty()) { - // signal the main thread that there are no more threads left if it is - // waiting for us - if (wxGetApp().m_parse_waitingUntilAllDone) { - wxGetApp().m_parse_waitingUntilAllDone = false; - wxGetApp().m_parse_semAllDone.Post(); - } - } -} - -void *OPJParseThread::Entry() -{ - - printf("Entering\n\n"); - - wxString text; - - srand(GetId()); - int m_countnum = rand() % 9; - text.Printf(wxT("Parse thread 0x%lx started (priority = %u, time = %d)."), - GetId(), GetPriority(), m_countnum); - WriteText(text); - LoadFile(m_tree->m_fname); - text.Printf(wxT("Parse thread 0x%lx finished."), GetId()); - WriteText(text); - - - //wxLogMessage(wxT("Entering\n")); //test wxLog thread safeness - - //wxBusyCursor wait; - //wxBusyInfo wait(wxT("Decoding image ...")); - - - /*for ( m_count = 0; m_count < m_countnum; m_count++ ) - { - // check if we were asked to exit - if ( TestDestroy() ) - break; - - text.Printf(wxT("[%u] Parse thread 0x%lx here."), m_count, GetId()); - WriteText(text); - - // wxSleep() can't be called from non-GUI thread! - wxThread::Sleep(10); - }*/ - - // wxLogMessage(text); -- test wxLog thread safeness - - printf("Exiting\n\n"); - - return NULL; -} - - -/////////////////////////////////////////// -// Parsing hread and related -/////////////////////////////////////////// - -#if USE_GENERIC_TREECTRL -BEGIN_EVENT_TABLE(OPJMarkerTree, wxGenericTreeCtrl) -#else -BEGIN_EVENT_TABLE(OPJMarkerTree, wxTreeCtrl) -#endif - /*EVT_TREE_BEGIN_DRAG(TreeTest_Ctrl, OPJMarkerTree::OnBeginDrag) - EVT_TREE_BEGIN_RDRAG(TreeTest_Ctrl, OPJMarkerTree::OnBeginRDrag) - EVT_TREE_END_DRAG(TreeTest_Ctrl, OPJMarkerTree::OnEndDrag)*/ - /*EVT_TREE_BEGIN_LABEL_EDIT(TreeTest_Ctrl, OPJMarkerTree::OnBeginLabelEdit) - EVT_TREE_END_LABEL_EDIT(TreeTest_Ctrl, OPJMarkerTree::OnEndLabelEdit)*/ - /*EVT_TREE_DELETE_ITEM(TreeTest_Ctrl, OPJMarkerTree::OnDeleteItem)*/ -#if 0 // there are so many of those that logging them causes flicker - /*EVT_TREE_GET_INFO(TreeTest_Ctrl, OPJMarkerTree::OnGetInfo)*/ -#endif - /*EVT_TREE_SET_INFO(TreeTest_Ctrl, OPJMarkerTree::OnSetInfo) - EVT_TREE_ITEM_EXPANDED(TreeTest_Ctrl, OPJMarkerTree::OnItemExpanded)*/ - EVT_TREE_ITEM_EXPANDING(TreeTest_Ctrl, OPJMarkerTree::OnItemExpanding) - /*EVT_TREE_ITEM_COLLAPSED(TreeTest_Ctrl, OPJMarkerTree::OnItemCollapsed) - EVT_TREE_ITEM_COLLAPSING(TreeTest_Ctrl, OPJMarkerTree::OnItemCollapsing)*/ - - EVT_TREE_SEL_CHANGED(TreeTest_Ctrl, OPJMarkerTree::OnSelChanged) - /*EVT_TREE_SEL_CHANGING(TreeTest_Ctrl, OPJMarkerTree::OnSelChanging)*/ - /*EVT_TREE_KEY_DOWN(TreeTest_Ctrl, OPJMarkerTree::OnTreeKeyDown)*/ - /*EVT_TREE_ITEM_ACTIVATED(TreeTest_Ctrl, OPJMarkerTree::OnItemActivated)*/ - - // so many differents ways to handle right mouse button clicks... - /*EVT_CONTEXT_MENU(OPJMarkerTree::OnContextMenu)*/ - // EVT_TREE_ITEM_MENU is the preferred event for creating context menus - // on a tree control, because it includes the point of the click or item, - // meaning that no additional placement calculations are required. - EVT_TREE_ITEM_MENU(TreeTest_Ctrl, OPJMarkerTree::OnItemMenu) - /*EVT_TREE_ITEM_RIGHT_CLICK(TreeTest_Ctrl, OPJMarkerTree::OnItemRClick)*/ - - /*EVT_RIGHT_DOWN(OPJMarkerTree::OnRMouseDown) - EVT_RIGHT_UP(OPJMarkerTree::OnRMouseUp) - EVT_RIGHT_DCLICK(OPJMarkerTree::OnRMouseDClick)*/ -END_EVENT_TABLE() - -// OPJMarkerTree implementation -#if USE_GENERIC_TREECTRL -IMPLEMENT_DYNAMIC_CLASS(OPJMarkerTree, wxGenericTreeCtrl) -#else -IMPLEMENT_DYNAMIC_CLASS(OPJMarkerTree, wxTreeCtrl) -#endif - -OPJMarkerTree::OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id, - const wxPoint& pos, const wxSize& size, long style) - : wxTreeCtrl(parent, id, pos, size, style) -{ - m_reverseSort = false; - m_fname = fname; - - m_peektextCtrl = ((OPJFrame *) (parent->GetParent()->GetParent()))->m_textCtrlbrowse; - CreateImageList(); - - // Add some items to the tree - //AddTestItemsToTree(5, 5); - int image = wxGetApp().ShowImages() ? OPJMarkerTree::TreeCtrlIcon_Folder : -1; - wxTreeItemId rootId = AddRoot(name, - image, image, - new OPJMarkerData(name)); - - OPJParseThread *pthread = CreateParseThread(0x00, subframe); - if (pthread->Run() != wxTHREAD_NO_ERROR) - wxLogMessage(wxT("Can't start parse thread!")); - else - wxLogMessage(wxT("New parse thread started.")); - - m_childframe = subframe; -} - -void OPJMarkerTree::CreateImageList(int size) -{ - if (size == -1) { - SetImageList(NULL); - return; - } - if (size == 0) - size = m_imageSize; - else - m_imageSize = size; - - // Make an image list containing small icons - wxImageList *images = new wxImageList(size, size, true); - - // should correspond to TreeCtrlIcon_xxx enum - wxBusyCursor wait; - wxIcon icons[5]; - icons[0] = wxIcon(icon1_xpm); - icons[1] = wxIcon(icon2_xpm); - icons[2] = wxIcon(icon3_xpm); - icons[3] = wxIcon(icon4_xpm); - icons[4] = wxIcon(icon5_xpm); - - int sizeOrig = icons[0].GetWidth(); - for (size_t i = 0; i < WXSIZEOF(icons); i++) { - if (size == sizeOrig) { - images->Add(icons[i]); - } else { - images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); - } - } - - AssignImageList(images); -} - -#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) -void OPJMarkerTree::CreateButtonsImageList(int size) -{ - if ( size == -1 ) { - SetButtonsImageList(NULL); - return; - } - - // Make an image list containing small icons - wxImageList *images = new wxImageList(size, size, true); - - // should correspond to TreeCtrlIcon_xxx enum - wxBusyCursor wait; - wxIcon icons[4]; - icons[0] = wxIcon(icon3_xpm); // closed - icons[1] = wxIcon(icon3_xpm); // closed, selected - icons[2] = wxIcon(icon5_xpm); // open - icons[3] = wxIcon(icon5_xpm); // open, selected - - for ( size_t i = 0; i < WXSIZEOF(icons); i++ ) { - int sizeOrig = icons[i].GetWidth(); - if ( size == sizeOrig ) { - images->Add(icons[i]); - } else { - images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); - } - } - - AssignButtonsImageList(images); -#else -void OPJMarkerTree::CreateButtonsImageList(int WXUNUSED(size)) -{ -#endif -} - -void OPJParseThread::LoadFile(wxFileName fname) -{ - wxTreeItemId rootid; - - // this is the root node - int image = wxGetApp().ShowImages() ? m_tree->TreeCtrlIcon_Folder : -1; - - if (this->m_parentid) { - // leaf of a tree - rootid = m_parentid; - m_tree->SetItemText(rootid, wxT("Parsing...")); - - } else { - - // delete the existing tree hierarchy - m_tree->DeleteAllItems(); - - // new tree - rootid = m_tree->AddRoot(wxT("Parsing..."), - image, - image, - new OPJMarkerData(fname.GetFullPath()) - ); - //m_tree->SetItemFont(rootid, *wxITALIC_FONT); - m_tree->SetItemBold(rootid); - } - - // open the file - wxFile m_file(fname.GetFullPath().c_str(), wxFile::read); - - // parsing enabled? - if (wxGetApp().m_enableparse) { - - // what is the extension? - if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) { - - // parse the file - ParseJ2KFile(&m_file, 0, m_file.Length(), rootid); - - } else if ((fname.GetExt() == wxT("jp2")) || (fname.GetExt() == wxT("mj2"))) { - - // 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 { - // as usual - ParseJP2File(&m_file, 0, m_file.Length(), rootid); - } - - } else { - - // unknown extension - WriteText(wxT("Unknown file format!")); - - } - - } - - // this is the root node - if (this->m_parentid) - m_tree->SetItemText(rootid, wxT("Codestream")); - else - //m_tree->SetItemText(rootid, wxString::Format(wxT("%s (%d B)"), fname.GetFullName(), m_file.Length())); - m_tree->SetItemText(rootid, fname.GetFullName()); - - // close the file - m_file.Close(); - - WriteText(wxT("Parsing finished!")); -} - -/*int OPJMarkerTree::OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2) -{ - if ( m_reverseSort ) - { - // just exchange 1st and 2nd items - return wxTreeCtrl::OnCompareItems(item2, item1); - } - else - { - return wxTreeCtrl::OnCompareItems(item1, item2); - } -}*/ - -/*void OPJMarkerTree::AddItemsRecursively(const wxTreeItemId& idParent, - size_t numChildren, - size_t depth, - size_t folder) -{ - if ( depth > 0 ) - { - bool hasChildren = depth > 1; - - wxString str; - for ( size_t n = 0; n < numChildren; n++ ) - { - // at depth 1 elements won't have any more children - if ( hasChildren ) - str.Printf(wxT("%s child %u"), wxT("Folder"), unsigned(n + 1)); - else - str.Printf(wxT("%s child %u.%u"), wxT("File"), unsigned(folder), unsigned(n + 1)); - - // here we pass to AppendItem() normal and selected item images (we - // suppose that selected image follows the normal one in the enum) - int image, imageSel; - if ( wxGetApp().ShowImages() ) - { - image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder; - imageSel = image + 1; - } - else - { - image = imageSel = -1; - } - wxTreeItemId id = AppendItem(idParent, str, image, imageSel, - new OPJMarkerData(str)); - - // and now we also set the expanded one (only for the folders) - if ( hasChildren && wxGetApp().ShowImages() ) - { - SetItemImage(id, TreeCtrlIcon_FolderOpened, - wxTreeItemIcon_Expanded); - } - - // remember the last child for OnEnsureVisible() - if ( !hasChildren && n == numChildren - 1 ) - { - m_lastItem = id; - } - - AddItemsRecursively(id, numChildren, depth - 1, n + 1); - } - } - //else: done! -}*/ - -/*void OPJMarkerTree::AddTestItemsToTree(size_t numChildren, - size_t depth) -{ - int image = wxGetApp().ShowImages() ? OPJMarkerTree::TreeCtrlIcon_Folder : -1; - wxTreeItemId rootId = AddRoot(wxT("Root"), - image, image, - new OPJMarkerData(wxT("Root item"))); - if ( image != -1 ) - { - SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded); - } - - AddItemsRecursively(rootId, numChildren, depth, 0); - - // set some colours/fonts for testing - SetItemFont(rootId, *wxITALIC_FONT); - - wxTreeItemIdValue cookie; - wxTreeItemId id = GetFirstChild(rootId, cookie); - SetItemTextColour(id, *wxBLUE); - - id = GetNextChild(rootId, cookie); - id = GetNextChild(rootId, cookie); - SetItemTextColour(id, *wxRED); - SetItemBackgroundColour(id, *wxLIGHT_GREY); -}*/ - -/*void OPJMarkerTree::GetItemsRecursively(const wxTreeItemId& idParent, - wxTreeItemIdValue cookie) -{ - wxTreeItemId id; - - if ( !cookie ) - id = GetFirstChild(idParent, cookie); - else - id = GetNextChild(idParent, cookie); - - if ( !id.IsOk() ) - return; - - wxString text = GetItemText(id); - wxLogMessage(text); - - if (ItemHasChildren(id)) - GetItemsRecursively(id); - - GetItemsRecursively(idParent, cookie); -}*/ - -/*void OPJMarkerTree::DoToggleIcon(const wxTreeItemId& item) -{ - int image = (GetItemImage(item) == TreeCtrlIcon_Folder) - ? TreeCtrlIcon_File - : TreeCtrlIcon_Folder; - SetItemImage(item, image, wxTreeItemIcon_Normal); - - image = (GetItemImage(item) == TreeCtrlIcon_FolderSelected) - ? TreeCtrlIcon_FileSelected - : TreeCtrlIcon_FolderSelected; - SetItemImage(item, image, wxTreeItemIcon_Selected); -}*/ - -void OPJMarkerTree::LogEvent(const wxChar *name, const wxTreeEvent& event) -{ - wxTreeItemId item = event.GetItem(); - wxString text; - if ( item.IsOk() ) - text << wxT('"') << GetItemText(item).c_str() << wxT('"'); - else - text = wxT("invalid item"); - wxLogMessage(wxT("%s(%s)"), name, text.c_str()); -} - -OPJParseThread *OPJMarkerTree::CreateParseThread(wxTreeItemId parentid, OPJChildFrame *subframe) -{ - OPJParseThread *pthread = new OPJParseThread(this, parentid); - - if (pthread->Create() != wxTHREAD_NO_ERROR) - wxLogError(wxT("Can't create parse thread!")); - - wxCriticalSectionLocker enter(wxGetApp().m_parse_critsect); - wxGetApp().m_parse_threads.Add(pthread); - - return pthread; -} - - -/*// avoid repetition -#define TREE_EVENT_HANDLER(name) \ -void OPJMarkerTree::name(wxTreeEvent& event) \ -{ \ - LogEvent(_T(#name), event); \ - SetLastItem(wxTreeItemId()); \ - event.Skip(); \ -}*/ - -/*TREE_EVENT_HANDLER(OnBeginRDrag)*/ -/*TREE_EVENT_HANDLER(OnDeleteItem)*/ -/*TREE_EVENT_HANDLER(OnGetInfo) -TREE_EVENT_HANDLER(OnSetInfo)*/ -/*TREE_EVENT_HANDLER(OnItemExpanded) -TREE_EVENT_HANDLER(OnItemExpanding)*/ -/*TREE_EVENT_HANDLER(OnItemCollapsed)*/ -/*TREE_EVENT_HANDLER(OnSelChanged) -TREE_EVENT_HANDLER(OnSelChanging)*/ - -/*#undef TREE_EVENT_HANDLER*/ - -void OPJMarkerTree::OnItemExpanding(wxTreeEvent& event) -{ - wxTreeItemId item = event.GetItem(); - OPJMarkerData* data = (OPJMarkerData *) GetItemData(item); - wxString text; - - if (item.IsOk()) - text << wxT('"') << GetItemText(item).c_str() << wxT('"'); - else - text = wxT("invalid item"); - - if (wxStrcmp(data->GetDesc1(), wxT("INFO-CSTREAM"))) - return; - - wxLogMessage(wxT("Expanding... (%s -> %s, %s, %d, %d)"), - text.c_str(), data->GetDesc1(), data->GetDesc2(), - data->m_start, data->m_length); - - // the codestream box is being asked for expansion - wxTreeItemIdValue cookie; - if (!GetFirstChild(item, cookie).IsOk()) { - OPJParseThread *pthread = CreateParseThread(item); - if (pthread->Run() != wxTHREAD_NO_ERROR) - wxLogMessage(wxT("Can't start parse thread!")); - else - wxLogMessage(wxT("New parse thread started.")); - } -} - -void OPJMarkerTree::OnSelChanged(wxTreeEvent& event) -{ - 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; - - m_peektextCtrl->Clear(); - - /*text << wxString::Format(wxT("Selected... (%s -> %s, %s, %d, %d)"), - text.c_str(), data->GetDesc1(), data->GetDesc2(), - data->m_start, data->m_length) << wxT("\n");*/ - - // open the file and browse a little - wxFile *fp = new wxFile(m_fname.GetFullPath().c_str(), wxFile::read); - - // go to position claimed - fp->Seek(data->m_start, wxFromStart); - - // read a bunch - 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++) { - - text << wxString::Format(wxT("%010d:"), data->m_start + pos); - - pre_pos = pos; - - // add hex browsing text - for (c = 0; c < bunch_linesize; c++) { - - if (!(c % 8)) - text << wxT(" "); - - if (pos < max_read) { - text << wxString::Format(wxT("%02X "), buffer[pos]); - } else - text << wxT(" "); - pos++; - } - - text << wxT(" "); - - // add char browsing text - for (c = 0; c < bunch_linesize; c++) { - - if (pre_pos < max_read) { - if ((buffer[pre_pos] == '\n') || - (buffer[pre_pos] == '\t') || - (buffer[pre_pos] == '\0') || - (buffer[pre_pos] == 0x0D) || - (buffer[pre_pos] == 0x0B)) - buffer[pre_pos] = ' '; - text << wxString::FromAscii((char) buffer[pre_pos]) << wxT("."); - } else - text << wxT(" "); - pre_pos++; - } - - text << wxT("\n"); - - } - - // close the file - fp->Close(); - - m_peektextCtrl->WriteText(text); - - delete buffer; -} - -/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event) -{ - wxString key; - long keycode = event.GetKeyCode(); - { - switch ( keycode ) - { - case WXK_BACK: key = wxT("BACK"); break; - case WXK_TAB: key = wxT("TAB"); break; - case WXK_RETURN: key = wxT("RETURN"); break; - case WXK_ESCAPE: key = wxT("ESCAPE"); break; - case WXK_SPACE: key = wxT("SPACE"); break; - case WXK_DELETE: key = wxT("DELETE"); break; - case WXK_START: key = wxT("START"); break; - case WXK_LBUTTON: key = wxT("LBUTTON"); break; - case WXK_RBUTTON: key = wxT("RBUTTON"); break; - case WXK_CANCEL: key = wxT("CANCEL"); break; - case WXK_MBUTTON: key = wxT("MBUTTON"); break; - case WXK_CLEAR: key = wxT("CLEAR"); break; - case WXK_SHIFT: key = wxT("SHIFT"); break; - case WXK_ALT: key = wxT("ALT"); break; - case WXK_CONTROL: key = wxT("CONTROL"); break; - case WXK_MENU: key = wxT("MENU"); break; - case WXK_PAUSE: key = wxT("PAUSE"); break; - case WXK_CAPITAL: key = wxT("CAPITAL"); break; - case WXK_END: key = wxT("END"); break; - case WXK_HOME: key = wxT("HOME"); break; - case WXK_LEFT: key = wxT("LEFT"); break; - case WXK_UP: key = wxT("UP"); break; - case WXK_RIGHT: key = wxT("RIGHT"); break; - case WXK_DOWN: key = wxT("DOWN"); break; - case WXK_SELECT: key = wxT("SELECT"); break; - case WXK_PRINT: key = wxT("PRINT"); break; - case WXK_EXECUTE: key = wxT("EXECUTE"); break; - case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break; - case WXK_INSERT: key = wxT("INSERT"); break; - case WXK_HELP: key = wxT("HELP"); break; - case WXK_NUMPAD0: key = wxT("NUMPAD0"); break; - case WXK_NUMPAD1: key = wxT("NUMPAD1"); break; - case WXK_NUMPAD2: key = wxT("NUMPAD2"); break; - case WXK_NUMPAD3: key = wxT("NUMPAD3"); break; - case WXK_NUMPAD4: key = wxT("NUMPAD4"); break; - case WXK_NUMPAD5: key = wxT("NUMPAD5"); break; - case WXK_NUMPAD6: key = wxT("NUMPAD6"); break; - case WXK_NUMPAD7: key = wxT("NUMPAD7"); break; - case WXK_NUMPAD8: key = wxT("NUMPAD8"); break; - case WXK_NUMPAD9: key = wxT("NUMPAD9"); break; - case WXK_MULTIPLY: key = wxT("MULTIPLY"); break; - case WXK_ADD: key = wxT("ADD"); break; - case WXK_SEPARATOR: key = wxT("SEPARATOR"); break; - case WXK_SUBTRACT: key = wxT("SUBTRACT"); break; - case WXK_DECIMAL: key = wxT("DECIMAL"); break; - case WXK_DIVIDE: key = wxT("DIVIDE"); break; - case WXK_F1: key = wxT("F1"); break; - case WXK_F2: key = wxT("F2"); break; - case WXK_F3: key = wxT("F3"); break; - case WXK_F4: key = wxT("F4"); break; - case WXK_F5: key = wxT("F5"); break; - case WXK_F6: key = wxT("F6"); break; - case WXK_F7: key = wxT("F7"); break; - case WXK_F8: key = wxT("F8"); break; - case WXK_F9: key = wxT("F9"); break; - case WXK_F10: key = wxT("F10"); break; - case WXK_F11: key = wxT("F11"); break; - case WXK_F12: key = wxT("F12"); break; - case WXK_F13: key = wxT("F13"); break; - case WXK_F14: key = wxT("F14"); break; - case WXK_F15: key = wxT("F15"); break; - case WXK_F16: key = wxT("F16"); break; - case WXK_F17: key = wxT("F17"); break; - case WXK_F18: key = wxT("F18"); break; - case WXK_F19: key = wxT("F19"); break; - case WXK_F20: key = wxT("F20"); break; - case WXK_F21: key = wxT("F21"); break; - case WXK_F22: key = wxT("F22"); break; - case WXK_F23: key = wxT("F23"); break; - case WXK_F24: key = wxT("F24"); break; - case WXK_NUMLOCK: key = wxT("NUMLOCK"); break; - case WXK_SCROLL: key = wxT("SCROLL"); break; - case WXK_PAGEUP: key = wxT("PAGEUP"); break; - case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break; - case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break; - case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break; - case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break; - case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break; - case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break; - case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break; - case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break; - case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break; - case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break; - case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break; - case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break; - case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break; - case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break; - case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break; - case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break; - case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break; - case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break; - case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break; - case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break; - case WXK_NUMPAD_MULTIPLY: key = wxT("NUMPAD_MULTIPLY"); break; - case WXK_NUMPAD_ADD: key = wxT("NUMPAD_ADD"); break; - case WXK_NUMPAD_SEPARATOR: key = wxT("NUMPAD_SEPARATOR"); break; - case WXK_NUMPAD_SUBTRACT: key = wxT("NUMPAD_SUBTRACT"); break; - case WXK_NUMPAD_DECIMAL: key = wxT("NUMPAD_DECIMAL"); break; - - default: - { - if ( keycode < 128 && wxIsprint((int)keycode) ) - key.Printf(wxT("'%c'"), (char)keycode); - else if ( keycode > 0 && keycode < 27 ) - key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1); - else - key.Printf(wxT("unknown (%ld)"), keycode); - } - } - } - - wxLogMessage(wxT("%s event: %s (flags = %c%c%c%c)"), - name, - key.c_str(), - event.ControlDown() ? wxT('C') : wxT('-'), - event.AltDown() ? wxT('A') : wxT('-'), - event.ShiftDown() ? wxT('S') : wxT('-'), - event.MetaDown() ? wxT('M') : wxT('-')); -} - -void OPJMarkerTree::OnTreeKeyDown(wxTreeEvent& event) -{ - LogKeyEvent(wxT("Tree key down "), event.GetKeyEvent()); - - event.Skip(); -}*/ - -/*void OPJMarkerTree::OnBeginDrag(wxTreeEvent& event) -{ - // need to explicitly allow drag - if ( event.GetItem() != GetRootItem() ) - { - m_draggedItem = event.GetItem(); - - wxLogMessage(wxT("OnBeginDrag: started dragging %s"), - GetItemText(m_draggedItem).c_str()); - - event.Allow(); - } - else - { - wxLogMessage(wxT("OnBeginDrag: this item can't be dragged.")); - } -} - -void OPJMarkerTree::OnEndDrag(wxTreeEvent& event) -{ - wxTreeItemId itemSrc = m_draggedItem, - itemDst = event.GetItem(); - m_draggedItem = (wxTreeItemId)0l; - - // where to copy the item? - if ( itemDst.IsOk() && !ItemHasChildren(itemDst) ) - { - // copy to the parent then - itemDst = GetItemParent(itemDst); - } - - if ( !itemDst.IsOk() ) - { - wxLogMessage(wxT("OnEndDrag: can't drop here.")); - - return; - } - - wxString text = GetItemText(itemSrc); - wxLogMessage(wxT("OnEndDrag: '%s' copied to '%s'."), - text.c_str(), GetItemText(itemDst).c_str()); - - // just do append here - we could also insert it just before/after the item - // on which it was dropped, but this requires slightly more work... we also - // completely ignore the client data and icon of the old item but could - // copy them as well. - // - // Finally, we only copy one item here but we might copy the entire tree if - // we were dragging a folder. - int image = wxGetApp().ShowImages() ? TreeCtrlIcon_File : -1; - AppendItem(itemDst, text, image); -}*/ - -/*void OPJMarkerTree::OnBeginLabelEdit(wxTreeEvent& event) -{ - wxLogMessage(wxT("OnBeginLabelEdit")); - - // for testing, prevent this item's label editing - wxTreeItemId itemId = event.GetItem(); - if ( IsTestItem(itemId) ) - { - wxMessageBox(wxT("You can't edit this item.")); - - event.Veto(); - } - else if ( itemId == GetRootItem() ) - { - // test that it is possible to change the text of the item being edited - SetItemText(itemId, _T("Editing root item")); - } -} - -void OPJMarkerTree::OnEndLabelEdit(wxTreeEvent& event) -{ - wxLogMessage(wxT("OnEndLabelEdit")); - - // don't allow anything except letters in the labels - if ( !event.GetLabel().IsWord() ) - { - wxMessageBox(wxT("The new label should be a single word.")); - - event.Veto(); - } -}*/ - -/*void OPJMarkerTree::OnItemCollapsing(wxTreeEvent& event) -{ - wxLogMessage(wxT("OnItemCollapsing")); - - // for testing, prevent the user from collapsing the first child folder - wxTreeItemId itemId = event.GetItem(); - if ( IsTestItem(itemId) ) - { - wxMessageBox(wxT("You can't collapse this item.")); - - event.Veto(); - } -}*/ - -/*void OPJMarkerTree::OnItemActivated(wxTreeEvent& event) -{ - // show some info about this item - wxTreeItemId itemId = event.GetItem(); - OPJMarkerData *item = (OPJMarkerData *)GetItemData(itemId); - - if ( item != NULL ) - { - item->ShowInfo(this); - } - - wxLogMessage(wxT("OnItemActivated")); -}*/ - -void OPJMarkerTree::OnItemMenu(wxTreeEvent& event) -{ - /*wxTreeItemId itemId = event.GetItem(); - OPJMarkerData *item = itemId.IsOk() ? (OPJMarkerData *)GetItemData(itemId) - : NULL; - - wxLogMessage(wxT("OnItemMenu for item \"%s\""), item ? item->GetDesc() - : _T(""));*/ - - //wxLogMessage(wxT("EEEEEEEEEE")); - - //event.Skip(); -} - -/*void OPJMarkerTree::OnContextMenu(wxContextMenuEvent& event) -{ - wxPoint pt = event.GetPosition(); - wxTreeItemId item; - wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y); - - // check if event was generated by keyboard (MSW-specific?) - if ( pt.x == -1 && pt.y == -1 ) //(this is how MSW indicates it) - { - if ( !HasFlag(wxTR_MULTIPLE) ) - item = GetSelection(); - - // attempt to guess where to show the menu - if ( item.IsOk() ) - { - // if an item was clicked, show menu to the right of it - wxRect rect; - GetBoundingRect(item, rect, true );// only the label - pt = wxPoint(rect.GetRight(), rect.GetTop()); - } - else - { - pt = wxPoint(0, 0); - } - } - else // event was generated by mouse, use supplied coords - { - pt = ScreenToClient(pt); - item = HitTest(pt); - } - - ShowMenu(item, pt); -}*/ - -/*void OPJMarkerTree::ShowMenu(wxTreeItemId id, const wxPoint& pt) -{ - wxString title; - if ( id.IsOk() ) - { - title << wxT("Menu for ") << GetItemText(id); - } - else - { - title = wxT("Menu for no particular item"); - } - -#if wxUSE_MENUS - wxMenu menu(title); - menu.Append(TreeTest_About, wxT("&About...")); - menu.AppendSeparator(); - menu.Append(TreeTest_Highlight, wxT("&Highlight item")); - menu.Append(TreeTest_Dump, wxT("&Dump")); - - PopupMenu(&menu, pt); -#endif // wxUSE_MENUS -}*/ - -/*void OPJMarkerTree::OnItemRClick(wxTreeEvent& event) -{ - wxTreeItemId itemId = event.GetItem(); - OPJMarkerData *item = itemId.IsOk() ? (OPJMarkerData *)GetItemData(itemId) - : NULL; - - wxLogMessage(wxT("Item \"%s\" right clicked"), item ? item->GetDesc() - : _T("")); - - event.Skip(); -}*/ - -/* -void OPJMarkerTree::OnRMouseDown(wxMouseEvent& event) -{ - wxLogMessage(wxT("Right mouse button down")); - - event.Skip(); -} - -void OPJMarkerTree::OnRMouseUp(wxMouseEvent& event) -{ - wxLogMessage(wxT("Right mouse button up")); - - event.Skip(); -} - -void OPJMarkerTree::OnRMouseDClick(wxMouseEvent& event) -{ - wxTreeItemId id = HitTest(event.GetPosition()); - if ( !id ) - wxLogMessage(wxT("No item under mouse")); - else - { - OPJMarkerData *item = (OPJMarkerData *)GetItemData(id); - if ( item ) - wxLogMessage(wxT("Item '%s' under mouse"), item->GetDesc()); - } - - event.Skip(); -} -*/ - -static inline const wxChar *Bool2String(bool b) -{ - return b ? wxT("") : wxT("not "); -} - -void OPJMarkerData::ShowInfo(wxTreeCtrl *tree) -{ - wxLogMessage(wxT("Item '%s': %sselected, %sexpanded, %sbold,\n") - wxT("%u children (%u immediately under this item)."), - m_desc.c_str(), - Bool2String(tree->IsSelected(GetId())), - Bool2String(tree->IsExpanded(GetId())), - Bool2String(tree->IsBold(GetId())), - unsigned(tree->GetChildrenCount(GetId())), - unsigned(tree->GetChildrenCount(GetId(), false))); -} - - diff --git a/OPJViewer/source/OPJViewer.cpp b/OPJViewer/source/OPJViewer.cpp deleted file mode 100644 index 8f2c86e8..00000000 --- a/OPJViewer/source/OPJViewer.cpp +++ /dev/null @@ -1,1664 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: sashtest.cpp -// Purpose: Layout/sash sample -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: sashtest.cpp,v 1.18 2005/08/23 15:54:35 ABX Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: treetest.cpp -// Purpose: wxTreeCtrl sample -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: treetest.cpp,v 1.110 2006/11/04 11:26:51 VZ Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: dialogs.cpp -// Purpose: Common dialogs demo -// Author: Julian Smart -// Modified by: ABX (2004) - adjustements for conditional building + new menu -// Created: 04/01/98 -// RCS-ID: $Id: dialogs.cpp,v 1.163 2006/11/04 10:57:24 VZ Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: thread.cpp -// Purpose: wxWidgets thread sample -// Author: Guilhem Lavaux, Vadim Zeitlin -// Modified by: -// Created: 06/16/98 -// RCS-ID: $Id: thread.cpp,v 1.26 2006/10/02 05:36:28 PC Exp $ -// Copyright: (c) 1998-2002 wxWidgets team -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Name: samples/image/image.cpp -// Purpose: sample showing operations with wxImage -// Author: Robert Roebling -// Modified by: -// Created: 1998 -// RCS-ID: $Id: image.cpp,v 1.120 2006/12/06 17:13:11 VZ Exp $ -// Copyright: (c) 1998-2005 Robert Roebling -// License: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: samples/console/console.cpp -// Purpose: A sample console (as opposed to GUI) program using wxWidgets -// Author: Vadim Zeitlin -// Modified by: -// Created: 04.10.99 -// RCS-ID: $Id: console.cpp,v 1.206 2006/11/12 19:55:19 VZ Exp $ -// Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: samples/notebook/notebook.cpp -// Purpose: a sample demonstrating notebook usage -// Author: Julian Smart -// Modified by: Dimitri Schoolwerth -// Created: 26/10/98 -// RCS-ID: $Id: notebook.cpp,v 1.49 2006/11/04 18:24:07 RR Exp $ -// Copyright: (c) 1998-2002 wxWidgets team -// License: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: dialogs.cpp -// Purpose: Common dialogs demo -// Author: Julian Smart -// Modified by: ABX (2004) - adjustements for conditional building + new menu -// Created: 04/01/98 -// RCS-ID: $Id: dialogs.cpp,v 1.163 2006/11/04 10:57:24 VZ Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: dnd.cpp -// Purpose: Drag and drop sample -// Author: Vadim Zeitlin -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: dnd.cpp,v 1.107 2006/10/30 20:23:41 VZ Exp $ -// Copyright: -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: test.cpp -// Purpose: wxHtml testing example -///////////////////////////////////////////////////////////////////////////// - - -#include "OPJViewer.h" - -IMPLEMENT_APP(OPJViewerApp) - -// For drawing lines in a canvas -long xpos = -1; -long ypos = -1; - -int winNumber = 1; - -// Initialise this in OnInit, not statically -bool OPJViewerApp::OnInit(void) -{ - int n; -#if wxUSE_UNICODE - - wxChar **wxArgv = new wxChar *[argc + 1]; - - for (n = 0; n < argc; n++ ) { - wxMB2WXbuf warg = wxConvertMB2WX((char *) argv[n]); - wxArgv[n] = wxStrdup(warg); - } - - wxArgv[n] = NULL; - -#else // !wxUSE_UNICODE - - #define wxArgv argv - -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - -#if wxUSE_CMDLINE_PARSER - - static const wxCmdLineEntryDesc cmdLineDesc[] = - { - { wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("show this help message"), - wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, - - { wxCMD_LINE_PARAM, NULL, NULL, _T("input file"), - wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE }, - - { wxCMD_LINE_NONE } - }; - - wxCmdLineParser parser(cmdLineDesc, argc, wxArgv); - - switch (parser.Parse()) { - case -1: - wxLogMessage(wxT("Help was given, terminating.")); - break; - - case 0: - ShowCmdLine(parser); - break; - - default: - wxLogMessage(wxT("Syntax error detected.")); - break; - } - -#endif // wxUSE_CMDLINE_PARSER - - //wxInitAllImageHandlers(); -#if wxUSE_LIBJPEG - wxImage::AddHandler( new wxJPEGHandler ); -#endif -#if wxUSE_LIBOPENJPEG - wxImage::AddHandler( new wxJPEG2000Handler ); -#endif -#if USE_MXF - wxImage::AddHandler( new wxMXFHandler ); -#endif // USE_MXF -#if OPJ_MANYFORMATS - wxImage::AddHandler( new wxBMPHandler ); - wxImage::AddHandler( new wxPNGHandler ); - wxImage::AddHandler( new wxGIFHandler ); - wxImage::AddHandler( new wxPNMHandler ); - wxImage::AddHandler( new wxTIFFHandler ); -#endif - // we use a XPM image in our HTML page - wxImage::AddHandler(new wxXPMHandler); - - // 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("decode/enabledeco"), &m_enabledeco, (bool) true); - OPJconfig->Read(wxT("decode/enableparse"), &m_enableparse, (bool) true); - OPJconfig->Read(wxT("decode/resizemethod"), &m_resizemethod, (long) 0); - OPJconfig->Read(wxT("decode/xxxreducefactor"), &m_reducefactor, (long) 0); - OPJconfig->Read(wxT("decode/xxxqualitylayers"), &m_qualitylayers, (long) 0); - OPJconfig->Read(wxT("decode/xxxcomponents"), &m_components, (long) 0); - OPJconfig->Read(wxT("decode/xxxframenum"), &m_framenum, (long) 0); -#ifdef USE_JPWL - OPJconfig->Read(wxT("decode/enablejpwl"), &m_enablejpwl, (bool) true); - OPJconfig->Read(wxT("decode/expcomps"), &m_expcomps, (long) JPWL_EXPECTED_COMPONENTS); - OPJconfig->Read(wxT("decode/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); - - OPJconfig->Read(wxT("showtoolbar"), &m_showtoolbar, (bool) true); - OPJconfig->Read(wxT("showbrowser"), &m_showbrowser, (bool) true); - OPJconfig->Read(wxT("showpeeker"), &m_showpeeker, (bool) true); - OPJconfig->Read(wxT("browserwidth"), &m_browserwidth, (long) OPJ_BROWSER_WIDTH); - OPJconfig->Read(wxT("peekerheight"), &m_peekerheight, (long) OPJ_PEEKER_HEIGHT); - OPJconfig->Read(wxT("framewidth"), &m_framewidth, (long) OPJ_FRAME_WIDTH); - OPJconfig->Read(wxT("frameheight"), &m_frameheight, (long) OPJ_FRAME_HEIGHT); - - // load encoding engine parameters - OPJconfig->Read(wxT("encode/subsampling"), &m_subsampling, (wxString) wxT("1,1")); - OPJconfig->Read(wxT("encode/origin"), &m_origin, (wxString) wxT("0,0")); - OPJconfig->Read(wxT("encode/rates"), &m_rates, (wxString) wxT("20,10,5")); - OPJconfig->Read(wxT("encode/quality"), &m_quality, (wxString) wxT("30,35,40")); - OPJconfig->Read(wxT("encode/enablequality"), &m_enablequality, (bool) false); - OPJconfig->Read(wxT("encode/multicomp"), &m_multicomp, (bool) false); - OPJconfig->Read(wxT("encode/irreversible"), &m_irreversible, (bool) false); - OPJconfig->Read(wxT("encode/resolutions"), &m_resolutions, (int) 6); - OPJconfig->Read(wxT("encode/progression"), &m_progression, (int) 0); - OPJconfig->Read(wxT("encode/cbsize"), &m_cbsize, (wxString) wxT("32,32")); - OPJconfig->Read(wxT("encode/prsize"), &m_prsize, (wxString) wxT("[128,128],[128,128]")); - OPJconfig->Read(wxT("encode/tsize"), &m_tsize, (wxString) wxT("")); - OPJconfig->Read(wxT("encode/torigin"), &m_torigin, (wxString) wxT("0,0")); - OPJconfig->Read(wxT("encode/enablesop"), &m_enablesop, (bool) false); - OPJconfig->Read(wxT("encode/enableeph"), &m_enableeph, (bool) false); - OPJconfig->Read(wxT("encode/enablebypass"), &m_enablebypass, (bool) false); - OPJconfig->Read(wxT("encode/enablereset"), &m_enablereset, (bool) false); - OPJconfig->Read(wxT("encode/enablerestart"), &m_enablerestart, (bool) false); - OPJconfig->Read(wxT("encode/enablevsc"), &m_enablevsc, (bool) false); - OPJconfig->Read(wxT("encode/enableerterm"), &m_enableerterm, (bool) false); - OPJconfig->Read(wxT("encode/enablesegmark"), &m_enablesegmark, (bool) false); - OPJconfig->Read(wxT("encode/enablecomm"), &m_enablecomm, (bool) true); - OPJconfig->Read(wxT("encode/enablepoc"), &m_enablepoc, (bool) false); - OPJconfig->Read(wxT("encode/comment"), &m_comment, (wxString) wxT("")); - OPJconfig->Read(wxT("encode/poc"), &m_poc, (wxString) wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL")); - OPJconfig->Read(wxT("encode/enableidx"), &m_enableidx, (bool) false); - OPJconfig->Read(wxT("encode/index"), &m_index, (wxString) wxT("index.txt")); -#ifdef USE_JPWL - OPJconfig->Read(wxT("encode/enablejpwl"), &m_enablejpwle, (bool) true); - for (n = 0; n < MYJPWL_MAX_NO_TILESPECS; n++) { - OPJconfig->Read(wxT("encode/jpwl/hprotsel") + wxString::Format(wxT("%02d"), n), &m_hprotsel[n], 0); - OPJconfig->Read(wxT("encode/jpwl/htileval") + wxString::Format(wxT("%02d"), n), &m_htileval[n], 0); - OPJconfig->Read(wxT("encode/jpwl/pprotsel") + wxString::Format(wxT("%02d"), n), &m_pprotsel[n], 0); - OPJconfig->Read(wxT("encode/jpwl/ptileval") + wxString::Format(wxT("%02d"), n), &m_ptileval[n], 0); - OPJconfig->Read(wxT("encode/jpwl/ppackval") + wxString::Format(wxT("%02d"), n), &m_ppackval[n], 0); - OPJconfig->Read(wxT("encode/jpwl/sensisel") + wxString::Format(wxT("%02d"), n), &m_sensisel[n], 0); - OPJconfig->Read(wxT("encode/jpwl/stileval") + wxString::Format(wxT("%02d"), n), &m_stileval[n], 0); - } -#endif // USE_JPWL - -#else - // set decoding engine parameters - m_enabledeco = true; - m_enableparse = true; - m_resizemethod = 0; - m_reducefactor = 0; - m_qualitylayers = 0; - m_components = 0; - m_framenum = 0; -#ifdef USE_JPWL - m_enablejpwl = true; - m_expcomps = JPWL_EXPECTED_COMPONENTS; - m_maxtiles = JPWL_MAXIMUM_TILES; -#endif // USE_JPWL - m_showtoolbar = true; - m_showbrowser = true; - m_showpeeker = true; - m_browserwidth = OPJ_BROWSER_WIDTH; - m_peekerheight = OPJ_PEEKER_HEIGHT; - m_framewidth = OPJ_FRAME_WIDTH; - m_frameheight = OPJ_FRAME_HEIGHT; - - // set encoding engine parameters - m_subsampling = wxT("1,1"); - m_origin = wxT("0,0"); - m_rates = wxT("20,10,5"); - m_quality = wxT("30,35,40"); - m_enablequality = false; - m_multicomp = false; - m_irreversible = false; - m_resolutions = 6; - m_progression = 0; - m_cbsize= wxT("32,32"); - m_prsize= wxT("[128,128],[128,128]"); - m_tsize = wxT(""); - m_torigin = wxT("0,0"); - m_enablesop = false; - m_enableeph = false; - m_enablebypass = false; - m_enablereset = false; - m_enablerestart = false; - m_enablevsc = false; - m_enableerterm = false; - m_enablesegmark = false; - m_enableidx = false; - m_index = wxT("index.txt"); - m_enablecomm = true; - m_comment = wxT(""); - m_enablepoc = false; - m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL"); -#ifdef USE_JPWL - m_enablejpwle = true; - for (n = 0; n < MYJPWL_MAX_NO_TILESPECS; n++) { - m_hprotsel[n] = 0; - m_htileval[n] = 0; - m_pprotsel[n] = 0; - m_ptileval[n] = 0; - m_sensisel[n] = 0; - m_stileval[n] = 0; - } -#endif // USE_JPWL - -#endif // OPJ_INICONFIG - - if (m_comment == wxT("")) { -#if defined __WXMSW__ - m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version "); -#elif defined __WXGTK__ - m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version "); -#else - m_comment = wxT("Created by OPJViewer - OpenJPEG version "); -#endif - -#ifdef USE_JPWL - m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version()); -#else - m_comment += wxString::Format(wxT("%s"), (char *) opj_version()); -#endif - } - - // Create the main frame window - OPJFrame *frame = new OPJFrame(NULL, wxID_ANY, OPJ_APPLICATION_TITLEBAR, - wxDefaultPosition, wxSize(wxGetApp().m_framewidth, wxGetApp().m_frameheight), - wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE | - wxHSCROLL | wxVSCROLL); - - // Give it an icon (this is ignored in MDI mode: uses resources) -#ifdef __WXMSW__ - frame->SetIcon(wxIcon(wxT("OPJViewer16"))); -#endif - - frame->Show(true); - - SetTopWindow(frame); - - // if there are files on the command line, open them - if (!(m_filelist.IsEmpty())) { - //wxLogMessage(wxT("Habemus files!!!")); - wxArrayString paths, filenames; - for (unsigned int f = 0; f < wxGetApp().m_filelist.GetCount(); f++) { - paths.Add(wxFileName(wxGetApp().m_filelist[f]).GetFullPath()); - filenames.Add(wxFileName(wxGetApp().m_filelist[f]).GetFullName()); - } - //wxLogMessage(paths[0]); - frame->OpenFiles(paths, filenames); - } - - return true; -} - -int OPJViewerApp::OnExit() -{ - int n; - -#ifdef OPJ_INICONFIG - OPJconfig->Write(wxT("decode/enabledeco"), m_enabledeco); - OPJconfig->Write(wxT("decode/enableparse"), m_enableparse); - OPJconfig->Write(wxT("decode/resizemethod"), m_resizemethod); - OPJconfig->Write(wxT("decode/reducefactor"), m_reducefactor); - OPJconfig->Write(wxT("decode/qualitylayers"), m_qualitylayers); - OPJconfig->Write(wxT("decode/components"), m_components); - OPJconfig->Write(wxT("decode/framenum"), m_framenum); -#ifdef USE_JPWL - OPJconfig->Write(wxT("decode/enablejpwl"), m_enablejpwl); - OPJconfig->Write(wxT("decode/expcomps"), m_expcomps); - OPJconfig->Write(wxT("decode/maxtiles"), m_maxtiles); -#endif // USE_JPWL - OPJconfig->Write(wxT("showtoolbar"), m_showtoolbar); - OPJconfig->Write(wxT("showbrowser"), m_showbrowser); - OPJconfig->Write(wxT("showpeeker"), m_showpeeker); - OPJconfig->Write(wxT("browserwidth"), m_browserwidth); - OPJconfig->Write(wxT("peekerheight"), m_peekerheight); - OPJconfig->Write(wxT("framewidth"), m_framewidth); - OPJconfig->Write(wxT("frameheight"), m_frameheight); - - OPJconfig->Write(wxT("encode/subsampling"), m_subsampling); - OPJconfig->Write(wxT("encode/origin"), m_origin); - OPJconfig->Write(wxT("encode/rates"), m_rates); - OPJconfig->Write(wxT("encode/quality"), m_quality); - OPJconfig->Write(wxT("encode/enablequality"), m_enablequality); - OPJconfig->Write(wxT("encode/multicomp"), m_multicomp); - OPJconfig->Write(wxT("encode/irreversible"), m_irreversible); - OPJconfig->Write(wxT("encode/resolutions"), m_resolutions); - OPJconfig->Write(wxT("encode/progression"), m_progression); - OPJconfig->Write(wxT("encode/cbsize"), m_cbsize); - OPJconfig->Write(wxT("encode/prsize"), m_prsize); - OPJconfig->Write(wxT("encode/tiles"), m_tsize); - OPJconfig->Write(wxT("encode/torigin"), m_torigin); - OPJconfig->Write(wxT("encode/enablesop"), m_enablesop); - OPJconfig->Write(wxT("encode/enableeph"), m_enableeph); - OPJconfig->Write(wxT("encode/enablebypass"), m_enablebypass); - OPJconfig->Write(wxT("encode/enablereset"), m_enablereset); - OPJconfig->Write(wxT("encode/enablerestart"), m_enablerestart); - OPJconfig->Write(wxT("encode/enablevsc"), m_enablevsc); - OPJconfig->Write(wxT("encode/enableerterm"), m_enableerterm); - OPJconfig->Write(wxT("encode/enablesegmark"), m_enablesegmark); - OPJconfig->Write(wxT("encode/enableidx"), m_enableidx); - OPJconfig->Write(wxT("encode/index"), m_index); - OPJconfig->Write(wxT("encode/enablecomm"), m_enablecomm); - OPJconfig->Write(wxT("encode/comment"), m_comment); - OPJconfig->Write(wxT("encode/enablepoc"), m_enablepoc); - OPJconfig->Write(wxT("encode/poc"), m_poc); -#ifdef USE_JPWL - OPJconfig->Write(wxT("encode/enablejpwl"), m_enablejpwle); - for (n = 0; n < MYJPWL_MAX_NO_TILESPECS; n++) { - OPJconfig->Write(wxT("encode/jpwl/hprotsel") + wxString::Format(wxT("%02d"), n), m_hprotsel[n]); - OPJconfig->Write(wxT("encode/jpwl/htileval") + wxString::Format(wxT("%02d"), n), m_htileval[n]); - OPJconfig->Write(wxT("encode/jpwl/pprotsel") + wxString::Format(wxT("%02d"), n), m_pprotsel[n]); - OPJconfig->Write(wxT("encode/jpwl/ptileval") + wxString::Format(wxT("%02d"), n), m_ptileval[n]); - OPJconfig->Write(wxT("encode/jpwl/ppackval") + wxString::Format(wxT("%02d"), n), m_ppackval[n]); - OPJconfig->Write(wxT("encode/jpwl/sensisel") + wxString::Format(wxT("%02d"), n), m_sensisel[n]); - OPJconfig->Write(wxT("encode/jpwl/stileval") + wxString::Format(wxT("%02d"), n), m_stileval[n]); - } -#endif // USE_JPWL - -#endif // OPJ_INICONFIG - - return 1; -} - -void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser) -{ - wxString s = wxT("Command line parsed successfully:\nInput files: "); - - size_t count = parser.GetParamCount(); - for (size_t param = 0; param < count; param++) { - s << parser.GetParam(param) << ';'; - m_filelist.Add(parser.GetParam(param)); - } - - //wxLogMessage(s); -} - -// OPJFrame events - -// Event class for sending text messages between worker and GUI threads -BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame) - EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout) - EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen) - EVT_MENU(OPJFRAME_FILESAVEAS, OPJFrame::OnFileSaveAs) - EVT_MENU(OPJFRAME_MEMORYOPEN, OPJFrame::OnMemoryOpen) - EVT_SIZE(OPJFrame::OnSize) - EVT_MENU(OPJFRAME_FILEEXIT, OPJFrame::OnQuit) - EVT_MENU(OPJFRAME_FILECLOSE, OPJFrame::OnClose) - EVT_MENU(OPJFRAME_VIEWZOOM, OPJFrame::OnZoom) - EVT_MENU(OPJFRAME_VIEWFIT, OPJFrame::OnFit) - EVT_MENU(OPJFRAME_VIEWRELOAD, OPJFrame::OnReload) - EVT_MENU(OPJFRAME_VIEWPREVFRAME, OPJFrame::OnPrevFrame) - EVT_MENU(OPJFRAME_VIEWHOMEFRAME, OPJFrame::OnHomeFrame) - EVT_MENU(OPJFRAME_VIEWNEXTFRAME, OPJFrame::OnNextFrame) - EVT_MENU(OPJFRAME_VIEWLESSLAYERS, OPJFrame::OnLessLayers) - EVT_MENU(OPJFRAME_VIEWALLLAYERS, OPJFrame::OnAllLayers) - EVT_MENU(OPJFRAME_VIEWMORELAYERS, OPJFrame::OnMoreLayers) - EVT_MENU(OPJFRAME_VIEWLESSRES, OPJFrame::OnLessRes) - EVT_MENU(OPJFRAME_VIEWFULLRES, OPJFrame::OnFullRes) - EVT_MENU(OPJFRAME_VIEWMORERES, OPJFrame::OnMoreRes) - EVT_MENU(OPJFRAME_VIEWPREVCOMP, OPJFrame::OnPrevComp) - EVT_MENU(OPJFRAME_VIEWALLCOMPS, OPJFrame::OnAllComps) - EVT_MENU(OPJFRAME_VIEWNEXTCOMP, OPJFrame::OnNextComp) - EVT_MENU(OPJFRAME_FILETOGGLEB, OPJFrame::OnToggleBrowser) - EVT_MENU(OPJFRAME_FILETOGGLEP, OPJFrame::OnTogglePeeker) - EVT_MENU(OPJFRAME_FILETOGGLET, OPJFrame::OnToggleToolbar) - EVT_MENU(OPJFRAME_SETSENCO, OPJFrame::OnSetsEnco) - EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco) - EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag) - EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook) - EVT_MENU(OPJFRAME_THREADLOGMSG, OPJFrame::OnThreadLogmsg) -END_EVENT_TABLE() - -// this is the frame constructor -OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, const long style) - : wxMDIParentFrame(parent, id, title, pos, size, style) -{ - // file menu and its items - wxMenu *file_menu = new wxMenu; - - file_menu->Append(OPJFRAME_FILEOPEN, wxT("&Open\tCtrl+O")); - file_menu->SetHelpString(OPJFRAME_FILEOPEN, wxT("Open one or more files")); - - file_menu->Append(OPJFRAME_MEMORYOPEN, wxT("&Memory\tCtrl+M")); - file_menu->SetHelpString(OPJFRAME_MEMORYOPEN, wxT("Open a memory buffer")); - - file_menu->Append(OPJFRAME_FILECLOSE, wxT("&Close\tCtrl+C")); - file_menu->SetHelpString(OPJFRAME_FILECLOSE, wxT("Close current image")); - - file_menu->AppendSeparator(); - - file_menu->Append(OPJFRAME_FILESAVEAS, wxT("&Save as\tCtrl+S")); - file_menu->SetHelpString(OPJFRAME_FILESAVEAS, wxT("Save the current image")); - //file_menu->Enable(OPJFRAME_FILESAVEAS, false); - - file_menu->AppendSeparator(); - - file_menu->Append(OPJFRAME_FILETOGGLEB, wxT("Toggle &browser\tCtrl+B")); - file_menu->SetHelpString(OPJFRAME_FILETOGGLEB, wxT("Toggle the left browsing pane")); - - file_menu->Append(OPJFRAME_FILETOGGLEP, wxT("Toggle &peeker\tCtrl+P")); - file_menu->SetHelpString(OPJFRAME_FILETOGGLEP, wxT("Toggle the bottom peeking pane")); - - file_menu->Append(OPJFRAME_FILETOGGLET, wxT("Toggle &toolbar\tCtrl+T")); - file_menu->SetHelpString(OPJFRAME_FILETOGGLET, wxT("Toggle the toolbar")); - - file_menu->AppendSeparator(); - - file_menu->Append(OPJFRAME_FILEEXIT, wxT("&Exit\tCtrl+Q")); - file_menu->SetHelpString(OPJFRAME_FILEEXIT, wxT("Quit this program")); - - // view menu and its items - wxMenu *view_menu = new wxMenu; - - view_menu->Append(OPJFRAME_VIEWZOOM, wxT("&Zoom\tCtrl+Z")); - view_menu->SetHelpString(OPJFRAME_VIEWZOOM, wxT("Rescale the image")); - - view_menu->Append(OPJFRAME_VIEWFIT, wxT("Zoom to &fit\tCtrl+F")); - view_menu->SetHelpString(OPJFRAME_VIEWFIT, wxT("Fit the image in canvas")); - - view_menu->Append(OPJFRAME_VIEWRELOAD, wxT("&Reload image\tCtrl+R")); - view_menu->SetHelpString(OPJFRAME_VIEWRELOAD, wxT("Reload the current image")); - - view_menu->AppendSeparator(); - - view_menu->Append(OPJFRAME_VIEWPREVFRAME, wxT("&Prev frame\tLeft")); - view_menu->SetHelpString(OPJFRAME_VIEWPREVFRAME, wxT("View previous frame")); - - view_menu->Append(OPJFRAME_VIEWHOMEFRAME, wxT("&Start frame\tHome")); - view_menu->SetHelpString(OPJFRAME_VIEWHOMEFRAME, wxT("View starting frame")); - - view_menu->Append(OPJFRAME_VIEWNEXTFRAME, wxT("&Next frame\tRight")); - view_menu->SetHelpString(OPJFRAME_VIEWNEXTFRAME, wxT("View next frame")); - - view_menu->AppendSeparator(); - - view_menu->Append(OPJFRAME_VIEWLESSLAYERS, wxT("&Less layers\t-")); - view_menu->SetHelpString(OPJFRAME_VIEWLESSLAYERS, wxT("Remove a layer")); - - view_menu->Append(OPJFRAME_VIEWALLLAYERS, wxT("&All layers\t0")); - view_menu->SetHelpString(OPJFRAME_VIEWALLLAYERS, wxT("Show all layers")); - - view_menu->Append(OPJFRAME_VIEWMORELAYERS, wxT("&More layers\t+")); - view_menu->SetHelpString(OPJFRAME_VIEWMORELAYERS, wxT("Add a layer")); - - view_menu->AppendSeparator(); - - view_menu->Append(OPJFRAME_VIEWLESSRES, wxT("&Less resolution\t<")); - view_menu->SetHelpString(OPJFRAME_VIEWLESSRES, wxT("Reduce the resolution")); - - view_menu->Append(OPJFRAME_VIEWFULLRES, wxT("&Full resolution\tf")); - view_menu->SetHelpString(OPJFRAME_VIEWFULLRES, wxT("Full resolution")); - - view_menu->Append(OPJFRAME_VIEWMORERES, wxT("&More resolution\t>")); - view_menu->SetHelpString(OPJFRAME_VIEWMORERES, wxT("Increase the resolution")); - - view_menu->AppendSeparator(); - - view_menu->Append(OPJFRAME_VIEWPREVCOMP, wxT("&Prev component\tDown")); - view_menu->SetHelpString(OPJFRAME_VIEWPREVCOMP, wxT("View previous component")); - - view_menu->Append(OPJFRAME_VIEWALLCOMPS, wxT("&All components\ta")); - view_menu->SetHelpString(OPJFRAME_VIEWALLCOMPS, wxT("View all components")); - - view_menu->Append(OPJFRAME_VIEWNEXTCOMP, wxT("&Next component\tUp")); - view_menu->SetHelpString(OPJFRAME_VIEWNEXTCOMP, wxT("View next component")); - - - // settings menu and its items - wxMenu *sets_menu = new wxMenu; - - sets_menu->Append(OPJFRAME_SETSENCO, wxT("&Encoder\tCtrl+E")); - sets_menu->SetHelpString(OPJFRAME_SETSENCO, wxT("Encoder settings")); - - sets_menu->Append(OPJFRAME_SETSDECO, wxT("&Decoder\tCtrl+D")); - sets_menu->SetHelpString(OPJFRAME_SETSDECO, wxT("Decoder settings")); - - // help menu and its items - wxMenu *help_menu = new wxMenu; - - help_menu->Append(OPJFRAME_HELPABOUT, wxT("&About\tF1")); - help_menu->SetHelpString(OPJFRAME_HELPABOUT, wxT("Basic info on the program")); - - // the whole menubar - wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(file_menu, wxT("&File")); - menu_bar->Append(view_menu, wxT("&View")); - menu_bar->Append(sets_menu, wxT("&Settings")); - menu_bar->Append(help_menu, wxT("&Help")); - - // Associate the menu bar with the frame - SetMenuBar(menu_bar); - - // the status bar - CreateStatusBar(); - - // the toolbar - tool_bar = new wxToolBar(this, OPJFRAME_TOOLBAR, - wxDefaultPosition, wxDefaultSize, - wxTB_HORIZONTAL | wxNO_BORDER); - wxBitmap bmpOpen = wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpSaveAs = wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpZoom = wxArtProvider::GetBitmap(wxART_FIND, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpFit = wxArtProvider::GetBitmap(wxART_FIND_AND_REPLACE, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpReload = wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpDecosettings = wxArtProvider::GetBitmap(wxART_REPORT_VIEW, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpEncosettings = wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpPrevframe = wxArtProvider::GetBitmap(wxART_GO_BACK, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpHomeframe = wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpNextframe = wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpLesslayers = bmpPrevframe; - wxBitmap bmpAlllayers = wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpMorelayers = bmpNextframe; - wxBitmap bmpLessres = bmpPrevframe; - wxBitmap bmpFullres = wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpMoreres = bmpNextframe; - wxBitmap bmpPrevcomp = bmpPrevframe; - wxBitmap bmpAllcomps = wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_TOOLBAR, - wxDefaultSize); - wxBitmap bmpNextcomp = bmpNextframe; - - tool_bar->AddTool(OPJFRAME_FILEOPEN, bmpOpen, wxT("Open")); - tool_bar->AddTool(OPJFRAME_FILESAVEAS, bmpSaveAs, wxT("Save as ")); - //tool_bar->EnableTool(OPJFRAME_FILESAVEAS, false); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_VIEWZOOM, bmpZoom, wxT("Zoom")); - tool_bar->AddTool(OPJFRAME_VIEWFIT, bmpFit, wxT("Zoom to fit")); - tool_bar->AddTool(OPJFRAME_VIEWRELOAD, bmpReload, wxT("Reload")); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_SETSDECO, bmpDecosettings, wxT("Decoder settings")); - tool_bar->AddTool(OPJFRAME_SETSENCO, bmpEncosettings, wxT("Encoder settings")); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_VIEWPREVFRAME, bmpPrevframe, wxT("Previous frame")); - tool_bar->AddTool(OPJFRAME_VIEWHOMEFRAME, bmpHomeframe, wxT("Starting frame")); - tool_bar->AddTool(OPJFRAME_VIEWNEXTFRAME, bmpNextframe, wxT("Next frame")); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_VIEWLESSLAYERS, bmpLesslayers, wxT("Remove a layer")); - tool_bar->AddTool(OPJFRAME_VIEWALLLAYERS, bmpAlllayers, wxT("Show all layers")); - tool_bar->AddTool(OPJFRAME_VIEWMORELAYERS, bmpMorelayers, wxT("Add a layer")); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_VIEWLESSRES, bmpLessres, wxT("Reduce the resolution")); - tool_bar->AddTool(OPJFRAME_VIEWFULLRES, bmpFullres, wxT("Full resolution")); - tool_bar->AddTool(OPJFRAME_VIEWMORERES, bmpMoreres, wxT("Increase the resolution")); - tool_bar->AddSeparator(); - tool_bar->AddTool(OPJFRAME_VIEWPREVCOMP, bmpPrevcomp, wxT("Previous component")); - tool_bar->AddTool(OPJFRAME_VIEWALLCOMPS, bmpAllcomps, wxT("All components")); - tool_bar->AddTool(OPJFRAME_VIEWNEXTCOMP, bmpNextcomp, wxT("Next component")); - tool_bar->Realize(); - - // associate the toolbar with the frame - SetToolBar(tool_bar); - - // show the toolbar? - if (!wxGetApp().m_showtoolbar) - tool_bar->Show(false); - else - tool_bar->Show(true); - - // the logging window - loggingWindow = new wxSashLayoutWindow(this, OPJFRAME_LOGWIN, - wxDefaultPosition, wxSize(400, wxGetApp().m_peekerheight), - wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN - ); - loggingWindow->SetDefaultSize(wxSize(1000, wxGetApp().m_peekerheight)); - loggingWindow->SetOrientation(wxLAYOUT_HORIZONTAL); - loggingWindow->SetAlignment(wxLAYOUT_BOTTOM); - //loggingWindow->SetBackgroundColour(wxColour(0, 0, 255)); - loggingWindow->SetSashVisible(wxSASH_TOP, true); - - // show the logging? - if (!wxGetApp().m_showpeeker) - loggingWindow->Show(false); - else - loggingWindow->Show(true); - - // create the bottom notebook - m_bookCtrlbottom = new wxNotebook(loggingWindow, BOTTOM_NOTEBOOK_ID, - wxDefaultPosition, wxDefaultSize, - wxBK_LEFT); - - // create the text control of the logger - m_textCtrl = new wxTextCtrl(m_bookCtrlbottom, wxID_ANY, wxT(""), - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY - ); - m_textCtrl->SetValue(_T("Logging window\n")); - - // add it to the notebook - m_bookCtrlbottom->AddPage(m_textCtrl, wxT("Log")); - - // create the text control of the browser - m_textCtrlbrowse = new wxTextCtrl(m_bookCtrlbottom, wxID_ANY, wxT(""), - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY | wxTE_RICH - ); - wxFont *browsefont = new wxFont(wxNORMAL_FONT->GetPointSize(), - wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); - m_textCtrlbrowse->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, *browsefont)); - m_textCtrlbrowse->AppendText(wxT("Browsing window\n")); - - // add it the notebook - m_bookCtrlbottom->AddPage(m_textCtrlbrowse, wxT("Peek"), false); - - // the browser window - markerTreeWindow = new wxSashLayoutWindow(this, OPJFRAME_BROWSEWIN, - wxDefaultPosition, wxSize(wxGetApp().m_browserwidth, 30), - wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN - ); - markerTreeWindow->SetDefaultSize(wxSize(wxGetApp().m_browserwidth, 1000)); - markerTreeWindow->SetOrientation(wxLAYOUT_VERTICAL); - markerTreeWindow->SetAlignment(wxLAYOUT_LEFT); - //markerTreeWindow->SetBackgroundColour(wxColour(0, 255, 0)); - markerTreeWindow->SetSashVisible(wxSASH_RIGHT, true); - markerTreeWindow->SetExtraBorderSize(0); - - // create the browser notebook - m_bookCtrl = new wxNotebook(markerTreeWindow, LEFT_NOTEBOOK_ID, - wxDefaultPosition, wxDefaultSize, - wxBK_TOP); - - // show the browser? - if (!wxGetApp().m_showbrowser) - markerTreeWindow->Show(false); - else - markerTreeWindow->Show(true); - -#ifdef __WXMOTIF__ - // For some reason, we get a memcpy crash in wxLogStream::DoLogStream - // on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc? - delete wxLog::SetActiveTarget(new wxLogStderr); -#else - // set our text control as the log target - wxLogTextCtrl *logWindow = new wxLogTextCtrl(m_textCtrl); - delete wxLog::SetActiveTarget(logWindow); -#endif - - // associate drop targets with the controls - SetDropTarget(new OPJDnDFile(this)); - -} - -// this is the frame destructor -OPJFrame::~OPJFrame(void) -{ - // save size settings - GetSize(&(wxGetApp().m_framewidth), &(wxGetApp().m_frameheight)); - - // delete all possible things - delete m_bookCtrl; - m_bookCtrl = NULL; - - delete markerTreeWindow; - markerTreeWindow = NULL; - - delete m_textCtrl; - m_textCtrl = NULL; - - delete m_bookCtrlbottom; - m_bookCtrlbottom = NULL; - - delete loggingWindow; - loggingWindow = NULL; -} - -void OPJFrame::OnNotebook(wxNotebookEvent& event) -{ - int sel = event.GetSelection(); - long childnum; - - m_bookCtrl->GetPageText(sel).ToLong(&childnum); - - if (m_childhash[childnum]) - m_childhash[childnum]->Activate(); - - //wxLogMessage(wxT("Selection changed (now %d --> %d)"), childnum, m_childhash[childnum]->m_winnumber); - -} - - -void OPJFrame::Resize(int number) -{ - wxSize size = GetClientSize(); -} - -void OPJFrame::OnSetsEnco(wxCommandEvent& event) -{ - int n; - - OPJEncoderDialog dialog(this, event.GetId()); - - if (dialog.ShowModal() == wxID_OK) { - - // load settings - wxGetApp().m_subsampling = dialog.m_subsamplingCtrl->GetValue(); - wxGetApp().m_origin = dialog.m_originCtrl->GetValue(); - wxGetApp().m_rates = dialog.m_rateCtrl->GetValue(); - wxGetApp().m_quality = dialog.m_qualityCtrl->GetValue(); - wxGetApp().m_enablequality = dialog.m_qualityRadio->GetValue(); - wxGetApp().m_multicomp = dialog.m_mctCheck->GetValue(); - wxGetApp().m_irreversible = dialog.m_irrevCheck->GetValue(); - wxGetApp().m_resolutions = dialog.m_resolutionsCtrl->GetValue(); - wxGetApp().m_cbsize = dialog.m_cbsizeCtrl->GetValue(); - wxGetApp().m_prsize = dialog.m_prsizeCtrl->GetValue(); - wxGetApp().m_tsize = dialog.m_tsizeCtrl->GetValue(); - wxGetApp().m_torigin = dialog.m_toriginCtrl->GetValue(); - wxGetApp().m_progression = dialog.progressionBox->GetSelection(); - wxGetApp().m_enablesop = dialog.m_sopCheck->GetValue(); - wxGetApp().m_enableeph = dialog.m_ephCheck->GetValue(); - wxGetApp().m_enablebypass = dialog.m_enablebypassCheck->GetValue(); - wxGetApp().m_enablereset = dialog.m_enableresetCheck->GetValue(); - wxGetApp().m_enablerestart = dialog.m_enablerestartCheck->GetValue(); - wxGetApp().m_enablevsc = dialog.m_enablevscCheck->GetValue(); - wxGetApp().m_enableerterm = dialog.m_enableertermCheck->GetValue(); - wxGetApp().m_enablesegmark = dialog.m_enablesegmarkCheck->GetValue(); - wxGetApp().m_enableidx = dialog.m_enableidxCheck->GetValue(); - wxGetApp().m_index = dialog.m_indexCtrl->GetValue(); - wxGetApp().m_enablecomm = dialog.m_enablecommCheck->GetValue(); - wxGetApp().m_comment = dialog.m_commentCtrl->GetValue(); - wxGetApp().m_enablepoc = dialog.m_enablepocCheck->GetValue(); - wxGetApp().m_poc = dialog.m_pocCtrl->GetValue(); -#ifdef USE_JPWL - wxGetApp().m_enablejpwle = dialog.m_enablejpwlCheck->GetValue(); - for (n = 0; n < MYJPWL_MAX_NO_TILESPECS; n++) { - wxGetApp().m_hprotsel[n] = dialog.m_hprotChoice[n]->GetSelection(); - wxGetApp().m_htileval[n] = dialog.m_htileCtrl[n]->GetValue(); - wxGetApp().m_pprotsel[n] = dialog.m_pprotChoice[n]->GetSelection(); - wxGetApp().m_ptileval[n] = dialog.m_ptileCtrl[n]->GetValue(); - wxGetApp().m_ppackval[n] = dialog.m_ppackCtrl[n]->GetValue(); - wxGetApp().m_sensisel[n] = dialog.m_sensiChoice[n]->GetSelection(); - wxGetApp().m_stileval[n] = dialog.m_stileCtrl[n]->GetValue(); - } -#endif // USE_JPWL - }; -} - -void OPJFrame::OnSetsDeco(wxCommandEvent& event) -{ - OPJDecoderDialog dialog(this, event.GetId()); - - if (dialog.ShowModal() == wxID_OK) { - - // load settings - wxGetApp().m_enabledeco = dialog.m_enabledecoCheck->GetValue(); - 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(); - wxGetApp().m_framenum = dialog.m_framenumCtrl->GetValue(); -#ifdef USE_JPWL - wxGetApp().m_enablejpwl = dialog.m_enablejpwlCheck->GetValue(); - wxGetApp().m_expcomps = dialog.m_expcompsCtrl->GetValue(); - wxGetApp().m_maxtiles = dialog.m_maxtilesCtrl->GetValue(); -#endif // USE_JPWL - - }; -} - -void OPJFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) -{ - Close(true); -} - -void OPJFrame::OnClose(wxCommandEvent& WXUNUSED(event)) -{ - // current frame - OPJChildFrame *currframe = (OPJChildFrame *) GetActiveChild(); - - if (!currframe) - return; - - wxCloseEvent e; - currframe->OnClose(e); -} - -void OPJFrame::OnFit(wxCommandEvent& event) -{ - OPJChildFrame *currchild; - wxString eventstring = event.GetString(); - - //wxLogMessage(wxT("OnFit:%d:%s"), event.GetInt(), eventstring); - - // current child - if (event.GetInt() >= 1) { - currchild = m_childhash[event.GetInt()]; - } else { - currchild = (OPJChildFrame *) GetActiveChild(); - } - - // problems - if (!currchild) - return; - - // current canvas - OPJCanvas *currcanvas = currchild->m_canvas; - - // find a fit-to-width zoom - /*int zooml, wzooml, hzooml; - wxSize clientsize = currcanvas->GetClientSize(); - 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())); - zooml = wxMin(100, wxMin(wzooml, hzooml));*/ - - // fit to width - Rescale(-1, currchild); -} - -void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event)) -{ - // current frame - OPJChildFrame *currframe = (OPJChildFrame *) GetActiveChild(); - - if (!currframe) - return; - - // get the preferred zoom - long zooml = wxGetNumberFromUser(wxT("Choose a scale between 5% and 300%"), - wxT("Zoom (%)"), - wxT("Image scale"), - currframe->m_canvas->m_zooml, 5, 300, NULL, wxDefaultPosition); - - // rescale current frame image if necessary - if (zooml >= 5) { - Rescale(zooml, currframe); - wxLogMessage(wxT("zoom to %d%%"), zooml); - } -} - -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; - - } 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) - 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->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(); - - wxLogMessage(wxT("Rescale said %d%%"), zooml); - - // update zoom - currframe->m_canvas->m_zooml = zooml; -} - - -void OPJFrame::OnReload(wxCommandEvent& event) -{ - OPJChildFrame *currframe = (OPJChildFrame *) GetActiveChild(); - - if (currframe) { - OPJDecoThread *dthread = currframe->m_canvas->CreateDecoThread(); - - if (dthread->Run() != wxTHREAD_NO_ERROR) - wxLogMessage(wxT("Can't start deco thread!")); - else - wxLogMessage(wxT("New deco thread started.")); - - currframe->m_canvas->Refresh(); - - // update zoom - //currframe->m_canvas->m_zooml = zooml; - } -} - -void OPJFrame::OnPrevFrame(wxCommandEvent& event) -{ - if (--wxGetApp().m_framenum < 0) - wxGetApp().m_framenum = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnHomeFrame(wxCommandEvent& event) -{ - wxGetApp().m_framenum = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnNextFrame(wxCommandEvent& event) -{ - ++wxGetApp().m_framenum; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnLessLayers(wxCommandEvent& event) -{ - if (--wxGetApp().m_qualitylayers < 1) - wxGetApp().m_qualitylayers = 1; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnAllLayers(wxCommandEvent& event) -{ - wxGetApp().m_qualitylayers = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnMoreLayers(wxCommandEvent& event) -{ - ++wxGetApp().m_qualitylayers; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnLessRes(wxCommandEvent& event) -{ - ++wxGetApp().m_reducefactor; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnFullRes(wxCommandEvent& event) -{ - wxGetApp().m_reducefactor = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnMoreRes(wxCommandEvent& event) -{ - if (--wxGetApp().m_reducefactor < 0) - wxGetApp().m_reducefactor = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnPrevComp(wxCommandEvent& event) -{ - if (--wxGetApp().m_components < 1) - wxGetApp().m_components = 1; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnAllComps(wxCommandEvent& event) -{ - wxGetApp().m_components = 0; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnNextComp(wxCommandEvent& event) -{ - ++wxGetApp().m_components; - - wxCommandEvent e; - OnReload(e); -} - -void OPJFrame::OnToggleBrowser(wxCommandEvent& WXUNUSED(event)) -{ - if (markerTreeWindow->IsShown()) - markerTreeWindow->Show(false); - else - markerTreeWindow->Show(true); - - wxLayoutAlgorithm layout; - layout.LayoutMDIFrame(this); - - wxGetApp().m_showbrowser = markerTreeWindow->IsShown(); - - // Leaves bits of itself behind sometimes - GetClientWindow()->Refresh(); -} - -void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event)) -{ - if (loggingWindow->IsShown()) - loggingWindow->Show(false); - else - loggingWindow->Show(true); - - wxLayoutAlgorithm layout; - layout.LayoutMDIFrame(this); - - wxGetApp().m_showpeeker = loggingWindow->IsShown(); - - // Leaves bits of itself behind sometimes - GetClientWindow()->Refresh(); -} - -void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event)) -{ - if (tool_bar->IsShown()) - tool_bar->Show(false); - else - tool_bar->Show(true); - - wxLayoutAlgorithm layout; - layout.LayoutMDIFrame(this); - - wxGetApp().m_showtoolbar = tool_bar->IsShown(); - - // Leaves bits of itself behind sometimes - GetClientWindow()->Refresh(); -} - -void OPJFrame::OnSashDrag(wxSashEvent& event) -{ - int wid, hei; - - if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE) - return; - - switch (event.GetId()) { - case OPJFRAME_BROWSEWIN: - { - markerTreeWindow->SetDefaultSize(wxSize(event.GetDragRect().width, 1000)); - break; - } - case OPJFRAME_LOGWIN: - { - loggingWindow->SetDefaultSize(wxSize(1000, event.GetDragRect().height)); - break; - } - } - - wxLayoutAlgorithm layout; - layout.LayoutMDIFrame(this); - - // Leaves bits of itself behind sometimes - GetClientWindow()->Refresh(); - - // update dimensions - markerTreeWindow->GetSize(&wid, &hei); - wxGetApp().m_browserwidth = wid; - - loggingWindow->GetSize(&wid, &hei); - wxGetApp().m_peekerheight = hei; - -} - -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 -void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames) -{ - size_t count = paths.GetCount(); - wxString msg, s; - - if (wxFile::Exists(paths[0].c_str())) { - - s.Printf(wxT("File %s already exists. Do you want to overwrite it?\n"), filenames[0].c_str()); - wxMessageDialog dialog3(this, s, _T("File exists"), wxYES_NO); - if (dialog3.ShowModal() == wxID_NO) - return; - } - - /*s.Printf(_T("File %d: %s (%s)\n"), (int)0, paths[0].c_str(), filenames[0].c_str()); - msg += s; - - wxMessageDialog dialog2(this, msg, _T("Selected files")); - dialog2.ShowModal();*/ - - if (!GetActiveChild()) - return; - - ((OPJChildFrame *) GetActiveChild())->m_canvas->m_savename = paths[0]; - - OPJEncoThread *ethread = ((OPJChildFrame *) GetActiveChild())->m_canvas->CreateEncoThread(); - - if (ethread->Run() != wxTHREAD_NO_ERROR) - wxLogMessage(wxT("Can't start enco thread!")); - else - wxLogMessage(wxT("New enco thread started.")); - - -} - -// physically open the files -void OPJFrame::OpenFiles(wxArrayString paths, wxArrayString filenames) -{ - - size_t count = paths.GetCount(); - for (size_t n = 0; n < count; n++) { - - wxString msg, s; - s.Printf(_T("File %d: %s (%s)\n"), (int)n, paths[n].c_str(), filenames[n].c_str()); - - msg += s; - - /*wxMessageDialog dialog2(this, msg, _T("Selected files")); - dialog2.ShowModal();*/ - - // Make another frame, containing a canvas - OPJChildFrame *subframe = new OPJChildFrame(this, - paths[n], - winNumber, - wxT("Canvas Frame"), - wxDefaultPosition, wxSize(300, 300), - wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE - ); - m_childhash[winNumber] = subframe; - - // create own marker tree - m_treehash[winNumber] = new OPJMarkerTree(m_bookCtrl, subframe, paths[n], wxT("Parsing..."), TreeTest_Ctrl, - wxDefaultPosition, wxDefaultSize, - wxTR_DEFAULT_STYLE | wxSUNKEN_BORDER - ); - - m_bookCtrl->AddPage(m_treehash[winNumber], wxString::Format(wxT("%u"), winNumber), false); - - for (unsigned int p = 0; p < m_bookCtrl->GetPageCount(); p++) { - if (m_bookCtrl->GetPageText(p) == wxString::Format(wxT("%u"), winNumber)) { - m_bookCtrl->ChangeSelection(p); - break; - } - } - - winNumber++; - } -} - -void OPJFrame::OnFileOpen(wxCommandEvent& WXUNUSED(event)) -{ - wxString wildcards = -#ifdef __WXMOTIF__ - wxT("JPEG 2000 files (*.jp2,*.j2k,*.j2c,*.mj2)|*.*j*2*"); -#else -#if wxUSE_LIBOPENJPEG - wxT("JPEG 2000 files (*.jp2,*.j2k,*.j2c,*.mj2)|*.jp2;*.j2k;*.j2c;*.mj2") -#endif -#if USE_MXF - wxT("|MXF JPEG 2000 video (*.mxf)|*.mxf") -#endif // USE_MXF -#if wxUSE_LIBJPEG - wxT("|JPEG files (*.jpg)|*.jpg") -#endif -#if OPJ_MANYFORMATS - wxT("|BMP files (*.bmp)|*.bmp") - wxT("|PNG files (*.png)|*.png") - wxT("|GIF files (*.gif)|*.gif") - wxT("|PNM files (*.pnm)|*.pnm") - wxT("|TIFF files (*.tif,*.tiff)|*.tif*") -#endif - wxT("|All files|*"); -#endif - wxFileDialog dialog(this, _T("Open image file(s)"), - wxEmptyString, wxEmptyString, wildcards, - wxFD_OPEN|wxFD_MULTIPLE); - - if (dialog.ShowModal() == wxID_OK) { - wxArrayString paths, filenames; - - dialog.GetPaths(paths); - dialog.GetFilenames(filenames); - - OpenFiles(paths, filenames); - } - -} - -void OPJFrame::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) -{ - wxString wildcards = -#ifdef wxUSE_LIBOPENJPEG -#ifdef __WXMOTIF__ - wxT("JPEG 2000 codestream (*.j2k)|*.*j*2*"); -#else - wxT("JPEG 2000 codestream (*.j2k)|*.j2k") - wxT("|JPEG 2000 file format (*.jp2)|*.jp2"); -#endif -#endif - - wxFileDialog dialog(this, _T("Save image file"), - wxEmptyString, wxEmptyString, wildcards, - wxFD_SAVE); - - if (dialog.ShowModal() == wxID_OK) { - wxArrayString paths, filenames; - - dialog.GetPaths(paths); - dialog.GetFilenames(filenames); - - SaveFile(paths, filenames); - } - - -} - -void OPJFrame::OnMemoryOpen(wxCommandEvent& WXUNUSED(event)) -{ - // do nothing - return; - - wxTextEntryDialog dialog(this, wxT("Memory HEX address range: start_address-stop_address"), - wxT("Decode a memory buffer"), - wxT("0x-0x"), - wxOK | wxCANCEL | wxCENTRE, - wxDefaultPosition); - - if (dialog.ShowModal() == wxID_OK) { - - } - -} - -BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow) - EVT_MOUSE_EVENTS(OPJCanvas::OnEvent) - EVT_MENU(OPJCANVAS_THREADSIGNAL, OPJCanvas::OnThreadSignal) -END_EVENT_TABLE() - -// Define a constructor for my canvas -OPJCanvas::OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size) - : wxScrolledWindow(parent, wxID_ANY, pos, size, - wxSUNKEN_BORDER | wxNO_FULL_REPAINT_ON_RESIZE) -{ - SetBackgroundColour(OPJ_CANVAS_COLOUR); - - m_fname = fname; - m_childframe = (OPJChildFrame *) parent; - // 100% zoom - m_zooml = 100; - - - OPJDecoThread *dthread = CreateDecoThread(); - - if (dthread->Run() != wxTHREAD_NO_ERROR) - wxLogMessage(wxT("Can't start deco thread!")); - else - wxLogMessage(wxT("New deco thread started.")); - - // 100% zoom - //m_zooml = 100; - -} - -OPJDecoThread *OPJCanvas::CreateDecoThread(void) -{ - OPJDecoThread *dthread = new OPJDecoThread(this); - - if (dthread->Create() != wxTHREAD_NO_ERROR) - wxLogError(wxT("Can't create deco thread!")); - - wxCriticalSectionLocker enter(wxGetApp().m_deco_critsect); - wxGetApp().m_deco_threads.Add(dthread); - - return dthread; -} - -OPJEncoThread *OPJCanvas::CreateEncoThread(void) -{ - OPJEncoThread *ethread = new OPJEncoThread(this); - - if (ethread->Create() != wxTHREAD_NO_ERROR) - wxLogError(wxT("Can't create enco thread!")); - - wxCriticalSectionLocker enter(wxGetApp().m_enco_critsect); - wxGetApp().m_enco_threads.Add(ethread); - - return ethread; -} - -#define activeoverlay 0 -// Define the repainting behaviour -void OPJCanvas::OnDraw(wxDC& dc) -{ - if (m_image.Ok()) { - dc.DrawBitmap(m_image, OPJ_CANVAS_BORDER, OPJ_CANVAS_BORDER); - - if (activeoverlay) { - dc.SetPen(*wxRED_PEN); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - //int tw, th; - dc.DrawRectangle(OPJ_CANVAS_BORDER, OPJ_CANVAS_BORDER, - (unsigned long int) (0.5 + (double) m_zooml * (double) m_childframe->m_twidth / 100.0), - (unsigned long int) (0.5 + (double) m_zooml * (double) m_childframe->m_theight / 100.0)); - } - - } 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 - } -} - -// This implements a tiny doodling program! Drag the mouse using -// the left button. -void OPJCanvas::OnEvent(wxMouseEvent& event) -{ -#if USE_PENCIL_ON_CANVAS - wxClientDC dc(this); - PrepareDC(dc); - - wxPoint pt(event.GetLogicalPosition(dc)); - - if ((xpos > -1) && (ypos > -1) && event.Dragging()) { - dc.SetPen(*wxRED_PEN); - dc.DrawLine(xpos, ypos, pt.x, pt.y); - } - xpos = pt.x; - ypos = pt.y; -#endif -} - -void OPJFrame::OnSize(wxSizeEvent& WXUNUSED(event)) -{ - wxLayoutAlgorithm layout; - layout.LayoutMDIFrame(this); -} - -void OPJCanvas::OnThreadSignal(wxCommandEvent& event) -{ -#if 1 - 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; - - // 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 -} - - -// Note that OPJFRAME_FILEOPEN and OPJFRAME_HELPABOUT commands get passed -// to the parent window for processing, so no need to -// duplicate event handlers here. - -BEGIN_EVENT_TABLE(OPJChildFrame, wxMDIChildFrame) - /*EVT_MENU(SASHTEST_CHILD_QUIT, OPJChildFrame::OnQuit)*/ - EVT_CLOSE(OPJChildFrame::OnClose) - EVT_SET_FOCUS(OPJChildFrame::OnGotFocus) - EVT_KILL_FOCUS(OPJChildFrame::OnLostFocus) -END_EVENT_TABLE() - -OPJChildFrame::OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, -const long style): - wxMDIChildFrame(parent, wxID_ANY, title, pos, size, style) -{ - m_frame = (OPJFrame *) parent; - m_canvas = NULL; - //my_children.Append(this); - m_fname = fname; - m_winnumber = winnumber; - SetTitle(wxString::Format(_T("%d: "), m_winnumber) + m_fname.GetFullName()); - - // Give it an icon (this is ignored in MDI mode: uses resources) -#ifdef __WXMSW__ - SetIcon(wxIcon(wxT("OPJChild16"))); -#endif - - // Give it a status line - /*CreateStatusBar();*/ - - int width, height; - GetClientSize(&width, &height); - - OPJCanvas *canvas = new OPJCanvas(fname, this, wxPoint(0, 0), wxSize(width, height)); -#if USE_PENCIL_ON_CANVAS - canvas->SetCursor(wxCursor(wxCURSOR_PENCIL)); -#endif - m_canvas = canvas; - - // Give it scrollbars - canvas->SetScrollbars(20, 20, 5, 5); - - Show(true); - Maximize(true); - - /*wxLogError(wxString::Format(wxT("Created tree %d (0x%x)"), m_winnumber, m_frame->m_treehash[m_winnumber]));*/ - -} - -OPJChildFrame::~OPJChildFrame(void) -{ - //my_children.DeleteObject(this); -} - - -void OPJChildFrame::OnClose(wxCloseEvent& event) -{ - for (unsigned int p = 0; p < m_frame->m_bookCtrl->GetPageCount(); p++) { - if (m_frame->m_bookCtrl->GetPageText(p) == wxString::Format(wxT("%u"), m_winnumber)) { - m_frame->m_bookCtrl->DeletePage(p); - break; - } - } - Destroy(); - - wxLogMessage(wxT("Closed: %d"), m_winnumber); -} - -void OPJChildFrame::OnActivate(wxActivateEvent& event) -{ - /*if (event.GetActive() && m_canvas) - m_canvas->SetFocus();*/ -} - -void OPJChildFrame::OnGotFocus(wxFocusEvent& event) -{ - // we need to check if the notebook is being destroyed or not - if (!m_frame->m_bookCtrl) - return; - - for (unsigned int p = 0; p < m_frame->m_bookCtrl->GetPageCount(); p++) { - - if (m_frame->m_bookCtrl->GetPageText(p) == wxString::Format(wxT("%u"), m_winnumber)) { - m_frame->m_bookCtrl->ChangeSelection(p); - break; - } - - } - - //wxLogMessage(wxT("Got focus: %d (%x)"), m_winnumber, event.GetWindow()); -} - -void OPJChildFrame::OnLostFocus(wxFocusEvent& event) -{ - //wxLogMessage(wxT("Lost focus: %d (%x)"), m_winnumber, event.GetWindow()); -} - - -//////////////////////////////// -// drag and drop -//////////////////////////////// - -bool OPJDnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) -{ - /*size_t nFiles = filenames.GetCount(); - wxString str; - str.Printf( _T("%d files dropped\n"), (int)nFiles); - for ( size_t n = 0; n < nFiles; n++ ) { - str << filenames[n] << wxT("\n"); - } - wxLogMessage(str);*/ - m_pOwner->OpenFiles(filenames, filenames); - - return true; -} - diff --git a/OPJViewer/source/OPJViewer.h b/OPJViewer/source/OPJViewer.h deleted file mode 100644 index 3574dac1..00000000 --- a/OPJViewer/source/OPJViewer.h +++ /dev/null @@ -1,811 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: sashtest.h -// Purpose: Layout window/sash sample -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: sashtest.h,v 1.5 2005/06/02 12:04:24 JS Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.h -// Purpose: wxTreeCtrl sample -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id: treetest.h,v 1.50 2006/11/04 11:26:51 VZ Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Name: dialogs.h -// Purpose: Common dialogs demo -// Author: Julian Smart -// Modified by: ABX (2004) - adjustementd for conditional building -// Created: 04/01/98 -// RCS-ID: $Id: dialogs.h,v 1.50 2006/10/08 14:12:59 VZ Exp $ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifndef __OPJ_VIEWER_H__ -#define __OPJ_VIEWER_H__ - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#include "wx/mdi.h" -#endif - -#include "wx/toolbar.h" -#include "wx/laywin.h" -#include "wx/treectrl.h" - -#include "icon1.xpm" -#include "icon2.xpm" -#include "icon3.xpm" -#include "icon4.xpm" -#include "icon5.xpm" - -#include "wx/filedlg.h" -#include "wx/toolbar.h" -#include -#include -#include -#include -#include "wx/notebook.h" -#include - -#include "wx/propdlg.h" -#include "wx/spinctrl.h" - -#include -#include "wx/wxhtml.h" -#include "wx/statline.h" -#include - -#include - -#include "wx/toolbar.h" -#include "wx/artprov.h" - -#include "libopenjpeg/openjpeg.h" - -//#include "imagj2k.h" -//#include "imagjp2.h" -//#include "imagmj2.h" -#include "imagjpeg2000.h" -#ifdef USE_MXF -#include "imagmxf.h" -#endif // USE_MXF - -#ifdef __WXMSW__ -typedef unsigned __int64 int8byte; -#endif // __WXMSW__ - -#ifdef __WXGTK__ -typedef unsigned long long int8byte; -#endif // __WXGTK__ - -#define USE_GENERIC_TREECTRL 0 -#define USE_PENCIL_ON_CANVAS 0 - -#if USE_GENERIC_TREECTRL -#include "wx/generic/treectlg.h" -#ifndef wxTreeCtrl -#define wxTreeCtrl wxGenericTreeCtrl -#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl -#endif -#endif - -#define OPJ_APPLICATION wxT("OPJViewer") -#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer") -#define OPJ_APPLICATION_VERSION wxT("0.4 beta") -#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION -#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa") -#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG") - -#ifdef __WXMSW__ -#define OPJ_APPLICATION_PLATFORM wxT("Windows") -#endif - -#ifdef __WXGTK__ -#define OPJ_APPLICATION_PLATFORM wxT("Linux") -#endif - -#define OPJ_FRAME_WIDTH 800 -#define OPJ_FRAME_HEIGHT 600 - -#define OPJ_BROWSER_WIDTH 300 -#define OPJ_PEEKER_HEIGHT 130 - -#define OPJ_CANVAS_BORDER 10 -#define OPJ_CANVAS_COLOUR *wxWHITE - - - -#ifdef USE_JPWL - -//#define MYJPWL_MAX_NO_TILESPECS JPWL_MAX_NO_TILESPECS -#define MYJPWL_MAX_NO_TILESPECS 4 - -#endif // USE_JPWL - - -class OPJDecoThread; -class OPJEncoThread; -class OPJParseThread; -WX_DEFINE_ARRAY_PTR(wxThread *, wxArrayThread); -class OPJChildFrame; - -////////////////////////////////// -// this is our main application // -////////////////////////////////// -class OPJViewerApp: public wxApp -{ - // public methods and variables - public: - - // class constructor - OPJViewerApp() { m_showImages = true; m_showButtons = false; } - - // 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); - - // all the threads currently alive - as soon as the thread terminates, it's - // removed from the array - wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads; - - // crit section protects access to all of the arrays below - wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect; - - // semaphore used to wait for the threads to exit, see OPJFrame::OnQuit() - wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone; - - // the last exiting thread should post to m_semAllDone if this is true - // (protected by the same m_critsect) - bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone, m_enco_waitingUntilAllDone; - - // the list of all filenames written in the command line - wxArrayString m_filelist; - - // displaying engine parameters - int m_resizemethod; - - // decoding engine parameters - bool m_enabledeco, m_enableparse; - int m_reducefactor, m_qualitylayers, m_components, m_framenum; -#ifdef USE_JPWL - bool m_enablejpwl, m_enablejpwle; - int m_expcomps, m_maxtiles; - int m_framewidth, m_frameheight; -#endif // USE_JPWL - - // encoding engine parameters - wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality; - wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc; - bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph; - bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm; - bool m_enablesegmark, m_enablepoc; - bool m_enablequality; - int m_resolutions, m_progression; -#ifdef USE_JPWL - int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS]; - int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS], - m_ppackval[MYJPWL_MAX_NO_TILESPECS]; - int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS]; -#endif // USE_JPWL - - // some layout settings - bool m_showtoolbar, m_showbrowser, m_showpeeker; - int m_browserwidth, m_peekerheight; - - // application configuration - wxConfig *OPJconfig; - - // private methods and variables - private: - bool m_showImages, m_showButtons; - -}; - -DECLARE_APP(OPJViewerApp) - -/////////////////////////////////////////// -// this canvas is used to draw the image // -/////////////////////////////////////////// -class OPJCanvas: public wxScrolledWindow -{ - // public methods and variables - public: - - // class constructor - OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size); - - virtual void OnDraw(wxDC& dc); - void OnEvent(wxMouseEvent& event); - void WriteText(const wxString& text) { -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif //__WXGTK__ - wxLogMessage(text); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif //__WXGTK__ - } - - void OnThreadSignal(wxCommandEvent& event); - - OPJDecoThread *CreateDecoThread(void); - OPJEncoThread *CreateEncoThread(void); - - - OPJChildFrame *m_childframe; - - wxBitmap m_image, m_image100; - wxFileName m_fname, m_savename; - long m_zooml; - - DECLARE_EVENT_TABLE() -}; - -/////////////////////////////////////////////////// -// the data associated to each tree leaf or node // -/////////////////////////////////////////////////// -class OPJMarkerData : public wxTreeItemData -{ - // public methods and variables - public: - - // class constructor - OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; } - - void ShowInfo(wxTreeCtrl *tree); - 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_filestring; -}; - - -class OPJMarkerTree : public wxTreeCtrl -{ -public: - enum - { - TreeCtrlIcon_File, - TreeCtrlIcon_FileSelected, - TreeCtrlIcon_Folder, - TreeCtrlIcon_FolderSelected, - TreeCtrlIcon_FolderOpened - }; - - OPJMarkerTree() { }; - OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style); - virtual ~OPJMarkerTree(){}; - OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL); - void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); } - - wxFileName m_fname; - wxTextCtrl *m_peektextCtrl; - OPJChildFrame *m_childframe; - - /*void OnBeginDrag(wxTreeEvent& event); - void OnBeginRDrag(wxTreeEvent& event); - void OnEndDrag(wxTreeEvent& event);*/ - /*void OnBeginLabelEdit(wxTreeEvent& event); - void OnEndLabelEdit(wxTreeEvent& event);*/ - /*void OnDeleteItem(wxTreeEvent& event);*/ - /*void OnContextMenu(wxContextMenuEvent& event);*/ - void OnItemMenu(wxTreeEvent& event); - /*void OnGetInfo(wxTreeEvent& event); - void OnSetInfo(wxTreeEvent& event);*/ - /*void OnItemExpanded(wxTreeEvent& event);*/ - void OnItemExpanding(wxTreeEvent& event); - /*void OnItemCollapsed(wxTreeEvent& event); - void OnItemCollapsing(wxTreeEvent& event);*/ - void OnSelChanged(wxTreeEvent& event); - /*void OnSelChanging(wxTreeEvent& event);*/ - /*void OnTreeKeyDown(wxTreeEvent& event);*/ - /*void OnItemActivated(wxTreeEvent& event);*/ - /*void OnItemRClick(wxTreeEvent& event);*/ - /*void OnRMouseDown(wxMouseEvent& event); - void OnRMouseUp(wxMouseEvent& event); - void OnRMouseDClick(wxMouseEvent& event);*/ - /*void GetItemsRecursively(const wxTreeItemId& idParent, - wxTreeItemIdValue cookie = 0);*/ - - void CreateImageList(int size = 16); - void CreateButtonsImageList(int size = 11); - - /*void AddTestItemsToTree(size_t numChildren, size_t depth);*/ - /*void DoSortChildren(const wxTreeItemId& item, bool reverse = false) - { m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }*/ - /*void DoEnsureVisible() { if (m_lastItem.IsOk()) EnsureVisible(m_lastItem); }*/ - /*void DoToggleIcon(const wxTreeItemId& item);*/ - /*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/ - - int ImageSize(void) const { return m_imageSize; } - - void SetLastItem(wxTreeItemId id) { m_lastItem = id; } - -protected: - /*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/ - - // is this the test item which we use in several event handlers? - /*bool IsTestItem(const wxTreeItemId& item) - { - // the test item is the first child folder - return GetItemParent(item) == GetRootItem() && !GetPrevSibling(item); - }*/ - -private: - /*void AddItemsRecursively(const wxTreeItemId& idParent, - size_t nChildren, - size_t depth, - size_t folder);*/ - - void LogEvent(const wxChar *name, const wxTreeEvent& event); - - int m_imageSize; // current size of images - bool m_reverseSort; // flag for OnCompareItems - wxTreeItemId m_lastItem, // for OnEnsureVisible() - m_draggedItem; // item being dragged right now - - // NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS() - // if you want your overloaded OnCompareItems() to be called. - // OTOH, if you don't want it you may omit the next line - this will - // make default (alphabetical) sorting much faster under wxMSW. - DECLARE_DYNAMIC_CLASS(OPJMarkerTree) - DECLARE_EVENT_TABLE() -}; - -// this hash map stores all the trees of currently opened images, with an integer key -WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash); - -// this hash map stores all the children of currently opened images, with an integer key -WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash); - -// Define a new frame -class OPJFrame: public wxMDIParentFrame -{ - public: - - OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); - - ~OPJFrame(void); - void OnSize(wxSizeEvent& WXUNUSED(event)); - void OnAbout(wxCommandEvent& WXUNUSED(event)); - void OnFileOpen(wxCommandEvent& WXUNUSED(event)); - void OnFileSaveAs(wxCommandEvent& WXUNUSED(event)); - void OnMemoryOpen(wxCommandEvent& WXUNUSED(event)); - void OnQuit(wxCommandEvent& WXUNUSED(event)); - void OnClose(wxCommandEvent& WXUNUSED(event)); - void OnZoom(wxCommandEvent& WXUNUSED(event)); - void OnFit(wxCommandEvent& event); - void OnToggleBrowser(wxCommandEvent& WXUNUSED(event)); - void OnTogglePeeker(wxCommandEvent& WXUNUSED(event)); - void OnToggleToolbar(wxCommandEvent& WXUNUSED(event)); - void OnReload(wxCommandEvent& event); - void OnPrevFrame(wxCommandEvent& event); - void OnHomeFrame(wxCommandEvent& event); - void OnNextFrame(wxCommandEvent& event); - void OnLessLayers(wxCommandEvent& event); - void OnAllLayers(wxCommandEvent& event); - void OnMoreLayers(wxCommandEvent& event); - void OnLessRes(wxCommandEvent& event); - void OnFullRes(wxCommandEvent& event); - void OnMoreRes(wxCommandEvent& event); - void OnPrevComp(wxCommandEvent& event); - void OnAllComps(wxCommandEvent& event); - void OnNextComp(wxCommandEvent& event); - void OnSetsEnco(wxCommandEvent& event); - void OnSetsDeco(wxCommandEvent& event); - void OnSashDrag(wxSashEvent& event); - void OpenFiles(wxArrayString paths, wxArrayString filenames); - void SaveFile(wxArrayString paths, wxArrayString filenames); - void OnNotebook(wxNotebookEvent& event); - void Rescale(int scale, OPJChildFrame *child); - void OnThreadLogmsg(wxCommandEvent& event); - - OPJMarkerTreeHash m_treehash; - OPJChildFrameHash m_childhash; - wxSashLayoutWindow* markerTreeWindow; - wxSashLayoutWindow* loggingWindow; - wxToolBar* tool_bar; - void Resize(int number); - wxNotebook *m_bookCtrl; - wxNotebook *m_bookCtrlbottom; - wxTextCtrl *m_textCtrlbrowse; - - private: - void TogStyle(int id, long flag); - - void DoSort(bool reverse = false); - - wxPanel *m_panel; - wxTextCtrl *m_textCtrl; - - void DoSetBold(bool bold = true); - -protected: - wxSashLayoutWindow* m_topWindow; - wxSashLayoutWindow* m_leftWindow2; - -DECLARE_EVENT_TABLE() -}; - -class OPJChildFrame: public wxMDIChildFrame -{ - public: - OPJCanvas *m_canvas; - OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); - ~OPJChildFrame(void); - void OnActivate(wxActivateEvent& event); - /*void OnQuit(wxCommandEvent& WXUNUSED(event));*/ - void OnClose(wxCloseEvent& event); - void OnGotFocus(wxFocusEvent& event); - void OnLostFocus(wxFocusEvent& event); - OPJFrame *m_frame; - wxFileName m_fname; - int m_winnumber; - - unsigned long m_twidth, m_theight, m_tx, m_ty; - - DECLARE_EVENT_TABLE() -}; - -// frame and main menu ids -enum { - OPJFRAME_FILEEXIT = wxID_EXIT, - OPJFRAME_HELPABOUT = wxID_ABOUT, - OPJFRAME_FILEOPEN, - OPJFRAME_MEMORYOPEN, - OPJFRAME_FILESAVEAS, - OPJFRAME_FILETOGGLEB, - OPJFRAME_FILETOGGLEP, - OPJFRAME_FILETOGGLET, - OPJFRAME_VIEWZOOM, - OPJFRAME_VIEWFIT, - OPJFRAME_VIEWRELOAD, - OPJFRAME_VIEWPREVFRAME, - OPJFRAME_VIEWHOMEFRAME, - OPJFRAME_VIEWNEXTFRAME, - OPJFRAME_VIEWLESSLAYERS, - OPJFRAME_VIEWALLLAYERS, - OPJFRAME_VIEWMORELAYERS, - OPJFRAME_VIEWLESSRES, - OPJFRAME_VIEWFULLRES, - OPJFRAME_VIEWMORERES, - OPJFRAME_VIEWPREVCOMP, - OPJFRAME_VIEWALLCOMPS, - OPJFRAME_VIEWNEXTCOMP, - OPJFRAME_FILECLOSE, - OPJFRAME_SETSENCO, - OPJFRAME_SETSDECO, - - OPJFRAME_BROWSEWIN = 10000, - OPJFRAME_LOGWIN, - OPJFRAME_TOOLBAR, - - OPJFRAME_THREADLOGMSG, - OPJCANVAS_THREADSIGNAL -}; - - -// menu and control ids -enum -{ - TreeTest_Quit = wxID_EXIT, - TreeTest_About = wxID_ABOUT, - TreeTest_TogButtons = wxID_HIGHEST, - TreeTest_TogTwist, - TreeTest_TogLines, - TreeTest_TogEdit, - TreeTest_TogHideRoot, - TreeTest_TogRootLines, - TreeTest_TogBorder, - TreeTest_TogFullHighlight, - TreeTest_SetFgColour, - TreeTest_SetBgColour, - TreeTest_ResetStyle, - TreeTest_Highlight, - TreeTest_Dump, - TreeTest_DumpSelected, - TreeTest_Count, - TreeTest_CountRec, - TreeTest_Sort, - TreeTest_SortRev, - TreeTest_SetBold, - TreeTest_ClearBold, - TreeTest_Rename, - TreeTest_Delete, - TreeTest_DeleteChildren, - TreeTest_DeleteAll, - TreeTest_Recreate, - TreeTest_ToggleImages, - TreeTest_ToggleButtons, - TreeTest_SetImageSize, - TreeTest_ToggleSel, - TreeTest_CollapseAndReset, - TreeTest_EnsureVisible, - TreeTest_AddItem, - TreeTest_InsertItem, - TreeTest_IncIndent, - TreeTest_DecIndent, - TreeTest_IncSpacing, - TreeTest_DecSpacing, - TreeTest_ToggleIcon, - TreeTest_Select, - TreeTest_Unselect, - TreeTest_SelectRoot, - TreeTest_Ctrl = 1000, - BOTTOM_NOTEBOOK_ID, - LEFT_NOTEBOOK_ID -}; - -class OPJEncoThread : public wxThread -{ -public: - OPJEncoThread(OPJCanvas *canvas); - - // thread execution starts here - virtual void *Entry(); - - // called when the thread exits - whether it terminates normally or is - // stopped with Delete() (but not when it is Kill()ed!) - virtual void OnExit(); - - // write something to the text control - void WriteText(const wxString& text); - -public: - unsigned m_count; - OPJCanvas *m_canvas; -}; - -class OPJDecoThread : public wxThread -{ -public: - OPJDecoThread(OPJCanvas *canvas); - - // thread execution starts here - virtual void *Entry(); - - // called when the thread exits - whether it terminates normally or is - // stopped with Delete() (but not when it is Kill()ed!) - virtual void OnExit(); - - // write something to the text control - void WriteText(const wxString& text); - -public: - unsigned m_count; - OPJCanvas *m_canvas; -}; - -class OPJParseThread : public wxThread -{ -public: - OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid = 0x00); - - // thread execution starts here - virtual void *Entry(); - - // called when the thread exits - whether it terminates normally or is - // stopped with Delete() (but not when it is Kill()ed!) - virtual void OnExit(); - - // write something to the text control - void WriteText(const wxString& text); - void LoadFile(wxFileName fname); - void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid); - void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid); - - unsigned m_count; - OPJMarkerTree *m_tree; - wxTreeItemId m_parentid; - -private: - int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); - int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint); - -}; - - -// Drag and drop files target -class OPJDnDFile: public wxFileDropTarget -{ -public: - OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; } - virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); - -private: - OPJFrame *m_pOwner; -}; - - - -// Property sheet dialog: encoder -class OPJEncoderDialog: public wxPropertySheetDialog -{ -DECLARE_CLASS(OPJEncoderDialog) -public: - OPJEncoderDialog(wxWindow* parent, int dialogType); - ~OPJEncoderDialog(); - - wxBookCtrlBase* m_settingsNotebook; - - wxPanel* CreateMainSettingsPage(wxWindow* parent); - wxPanel* CreatePart1_1SettingsPage(wxWindow* parent); - wxPanel* CreatePart1_2SettingsPage(wxWindow* parent); -/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/ - void OnEnableComm(wxCommandEvent& event); - void OnEnableIdx(wxCommandEvent& event); - void OnEnablePoc(wxCommandEvent& event); - void OnRadioQualityRate(wxCommandEvent& event); -#ifdef USE_JPWL - void OnEnableJPWL(wxCommandEvent& event); - wxPanel* CreatePart11SettingsPage(wxWindow* parent); - /*wxCheckBox *m_enablejpwlCheck;*/ - wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS]; - wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS]; - wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS]; - void OnHprotSelect(wxCommandEvent& event); - void OnPprotSelect(wxCommandEvent& event); - void OnSensiSelect(wxCommandEvent& event); -#endif // USE_JPWL - - wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl; - wxRadioButton *m_rateRadio, *m_qualityRadio; - wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, *m_pocCtrl; - wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl; - wxRadioBox *progressionBox; - wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck; - wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck, - *m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck; - wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck; - wxSpinCtrl *m_resolutionsCtrl; - -protected: - - enum { - OPJENCO_ENABLEJPWL = 100, - OPJENCO_RATEFACTOR, - OPJENCO_RATERADIO, - OPJENCO_QUALITYFACTOR, - OPJENCO_QUALITYRADIO, - OPJENCO_RESNUMBER, - OPJENCO_CODEBLOCKSIZE, - OPJENCO_PRECINCTSIZE, - OPJENCO_TILESIZE, - OPJENCO_PROGRESSION, - OPJENCO_SUBSAMPLING, - OPJENCO_ENABLESOP, - OPJENCO_ENABLEEPH, - OPJENCO_ENABLEBYPASS, - OPJENCO_ENABLERESET, - OPJENCO_ENABLERESTART, - OPJENCO_ENABLEVSC, - OPJENCO_ENABLEERTERM, - OPJENCO_ENABLESEGMARK, - OPJENCO_ENABLEPOC, - OPJENCO_ROICOMP, - OPJENCO_ROISHIFT, - OPJENCO_IMORIG, - OPJENCO_TILORIG, - OPJENCO_ENABLEMCT, - OPJENCO_ENABLEIRREV, - OPJENCO_ENABLEINDEX, - OPJENCO_INDEXNAME, - OPJENCO_POCSPEC, - OPJENCO_ENABLECOMM, - OPJENCO_COMMENTTEXT, - OPJENCO_HPROT, - OPJENCO_HTILE, - OPJENCO_PPROT, - OPJENCO_PTILE, - OPJENCO_PPACK, - OPJENCO_SENSI, - OPJENCO_STILE - }; - -DECLARE_EVENT_TABLE() -}; - -// Property sheet dialog: decoder -class OPJDecoderDialog: public wxPropertySheetDialog -{ -DECLARE_CLASS(OPJDecoderDialog) -public: - OPJDecoderDialog(wxWindow* parent, int dialogType); - ~OPJDecoderDialog(); - - wxBookCtrlBase* m_settingsNotebook; - wxCheckBox *m_enabledecoCheck, *m_enableparseCheck; - wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl; - wxRadioBox* m_resizeBox; - - void OnEnableDeco(wxCommandEvent& event); - - wxPanel* CreateMainSettingsPage(wxWindow* parent); - wxPanel* CreatePart1SettingsPage(wxWindow* parent); - wxPanel* CreatePart3SettingsPage(wxWindow* parent); -#ifdef USE_JPWL - void OnEnableJPWL(wxCommandEvent& event); - wxPanel* CreatePart11SettingsPage(wxWindow* parent); - wxSpinCtrl *m_expcompsCtrl, *m_framenumCtrl, *m_maxtilesCtrl; - wxCheckBox *m_enablejpwlCheck; -#endif // USE_JPWL - - -protected: - - enum { - OPJDECO_RESMETHOD = 100, - OPJDECO_REDUCEFACTOR, - OPJDECO_QUALITYLAYERS, - OPJDECO_NUMCOMPS, - OPJDECO_ENABLEDECO, - OPJDECO_ENABLEPARSE, - OPJDECO_ENABLEJPWL, - OPJDECO_EXPCOMPS, - OPJDECO_MAXTILES, - OPJDECO_FRAMENUM - }; - -DECLARE_EVENT_TABLE() -}; - -#endif //__OPJ_VIEWER_H__ - - - diff --git a/OPJViewer/source/OPJViewer.ico b/OPJViewer/source/OPJViewer.ico deleted file mode 100644 index 931d5e021191a3fd17610e14bec8405796abfb57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmcIjy-ou$40Z|<%7QLq7U)F#6orkAmtg1vbVa(`x*)iSDNFk*hlJE3Rn03@q5~t{ zm?+=pP^p#5KqY+V*p5FtKXycnw4~iGg!JALxqvK+Yw>5)hmb8YYy*vK(PkqX%T zRKW>PRb_z@sx(alNyl1$S+A*q@o|d7zmu=U*EU8M#q*5LLB>K%_1=8kaY-~##k#u4j_eDE{ZNy=jKO#9-!Bqkov9D}%;ll|%u$NXd zn^x1+aQXT%Tu!C)GHW{Xn^s@JX*=YrT-=qHlU_M~9F^nos7&MeIrtjfPia0#>0yxG z&Ti9Z?_?*ES=i?|vG)3=&zoP5Q=!M02=(wj=Y5m(ULmysA%o?XP!0gRR+4pB yH0$f&BZBQpNj8{d>4fFdV66}}rTpIT<|bP_g#IM*jAwWc9+kU1gT25!W4{3rvE}0c diff --git a/OPJViewer/source/OPJViewer.rc b/OPJViewer/source/OPJViewer.rc deleted file mode 100644 index fb5a5def..00000000 --- a/OPJViewer/source/OPJViewer.rc +++ /dev/null @@ -1,3 +0,0 @@ -OPJChild16 ICON OPJChild.ico -OPJViewer16 ICON OPJViewer.ico -#include "wx/msw/wx.rc" \ No newline at end of file diff --git a/OPJViewer/source/OPJViewer16.xpm b/OPJViewer/source/OPJViewer16.xpm deleted file mode 100644 index 27e522b1..00000000 --- a/OPJViewer/source/OPJViewer16.xpm +++ /dev/null @@ -1,26 +0,0 @@ -/* XPM */ -static char *OPJViewer16[] = { -/* columns rows colors chars-per-pixel */ -"16 16 4 1", -" c black", -". c #800000", -"X c red", -"o c None", -/* pixels */ -"oooooooooooooooo", -"ooo.XXXXoooooooo", -"ooXXoo .Xooooooo", -"o..oooo .ooooooo", -"oX.oooo ooooooo", -"oX.oooo .ooooooo", -"oXXoooo .ooooooo", -"o.XXoo .oooooooo", -"oo.XXXXooooooooo", -"ooooooooo.Xo .oo", -"ooooooooo X. ooo", -"oooooooooo...ooo", -"oooooooooo XXooo", -"oooooooooo .Xooo", -"oooooooooooooooo", -"oooooooooooooooo" -}; diff --git a/OPJViewer/source/about_htm.h b/OPJViewer/source/about_htm.h deleted file mode 100644 index c39fdc59..00000000 --- a/OPJViewer/source/about_htm.h +++ /dev/null @@ -1,54 +0,0 @@ -wxString htmlaboutpage = wxT( -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"
" -"

" -"
" -"" -OPJ_APPLICATION " " OPJ_APPLICATION_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: ") -#include "build.h" -wxT(", " __DATE__ ", " __TIME__ "
") -wxT("* " wxVERSION_STRING "
") -wxT("* OpenJPEG " OPENJPEG_VERSION " (") -#ifdef USE_JPWL -wxT("JPWL ") -#endif // USE_JPWL -#ifdef USE_JPSEC -wxT("JPSEC ") -#endif // USE_JPSEC -wxT(")
") -#ifdef USE_MXF -wxT("* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")
") -#endif // USE_MXF -wxT("
" -"OpenJPEG is © 2002-2008 TELE - Universite' Catholique de Louvain
" -"OPJViewer is © 2007-2008 DSPLab - Universita' degli studi di Perugia" -"
" -"" -"" -); diff --git a/OPJViewer/source/build.h b/OPJViewer/source/build.h deleted file mode 100644 index 9858dffe..00000000 --- a/OPJViewer/source/build.h +++ /dev/null @@ -1 +0,0 @@ -wxT("491") diff --git a/OPJViewer/source/icon1.xpm b/OPJViewer/source/icon1.xpm deleted file mode 100644 index fbc605b5..00000000 --- a/OPJViewer/source/icon1.xpm +++ /dev/null @@ -1,79 +0,0 @@ -/* XPM */ -static char *icon1_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 41 1", -"> c #97C4E7", -"# c #4381AA", -"d c #FFFFFF", -"< c #71B2DE", -"+ c #538BB1", -"& c #D1E5F5", -"q c #63B3DE", -"6 c #F1F4F7", -"* c #CAE1F3", -"y c #7AC4E5", -"= c #C3DDF1", -"X c #74A1BD", -"- c #BCD9EF", -"5 c #619BC4", -"3 c #E6EAF1", -"2 c #4B8EBF", -"o c #6B97B6", -". c #4B82A8", -" c None", -"w c #54A6D8", -"1 c #71A8D1", -", c #85BBE2", -"t c #EFF6FC", -"7 c #DEEDF8", -"@ c #4388B4", -"a c #F7FBFD", -"$ c #D7E0E9", -"r c #FAFCFE", -"4 c #DAEAF7", -"e c #E9F3FA", -"0 c #76BAE2", -"% c #7FA6C0", -"s c #FDFDFE", -"O c #5896BE", -"p c #B6D5EE", -"8 c #87ABC3", -": c #A5CCEA", -"9 c #E5F0F9", -"; c #AFD1EC", -"i c #F4F9FD", -"u c #8FB0C3", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" .XXXooOO++@#$ ", -" %&*=-;:>>,<123 ", -" %4&*=-;:>>,1>56 ", -" %74&*=-;:>>1*>56 ", -" 89700qqqqwq1e*>X ", -" 8e974&*=-;:1re*>8 ", -" 8te974&*=-;11111# ", -" 8tty000qqqqqww>,+ ", -" uitte974&*=-p:>>+ ", -" uaitte974&*=-p:>O ", -" uaayyyy000qqqqp:O ", -" uraaitte974&*=-po ", -" urraaitte974&*=-o ", -" usryyyyyyy000q*=X ", -" ussrraaitte974&*X ", -" udssrraaitte974&X ", -" uddyyyyyyyyyy074% ", -" udddssrraaitte97% ", -" uddddssrraaitte9% ", -" udddddssrraaitte8 ", -" uddddddssrraaitt8 ", -" uuuuuuuuuuuuuu88u ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/OPJViewer/source/icon2.xpm b/OPJViewer/source/icon2.xpm deleted file mode 100644 index 7ae8c92c..00000000 --- a/OPJViewer/source/icon2.xpm +++ /dev/null @@ -1,53 +0,0 @@ -/* XPM */ -static char *icon2_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 15 1", -". c Black", -"O c #97C4E7", -"$ c #63B3DE", -"@ c #CAE1F3", -"; c #7AC4E5", -"* c #74A1BD", -"+ c #619BC4", -"o c #4B8EBF", -" c None", -"% c #54A6D8", -"= c #FAFCFE", -"& c #E9F3FA", -"# c #76BAE2", -"X c #C00000", -"- c #87ABC3", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ............. ", -" .XXXXXXXXXX.o. ", -" .XXXXXXXXXX.O+. ", -" .XXXXXXXXXX.@O+. ", -" .XX##$$$$%$.&@O* ", -" .XXXXXXXXXX.=&@O- ", -" .XXXXXXXXXX...... ", -" .XX;###$$$$$%%XX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" .XX;;;;###$$$$XX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" .XX;;;;;;;###$XX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" .XX;;;;;;;;;;#XX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" .XXXXXXXXXXXXXXX. ", -" ................. ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/OPJViewer/source/icon3.xpm b/OPJViewer/source/icon3.xpm deleted file mode 100644 index 722de6b1..00000000 --- a/OPJViewer/source/icon3.xpm +++ /dev/null @@ -1,79 +0,0 @@ -/* XPM */ -static char *icon3_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 41 1", -"6 c #EDF2FB", -"- c #AAC1E8", -": c #B9CDED", -"X c #295193", -", c #C6D6F0", -"a c #4A7CCE", -"u c #779DDB", -"y c #7FA2DD", -"$ c #3263B4", -"5 c #EAF0FA", -". c #2D59A3", -"o c #6E96D8", -"* c #356AC1", -"r c #F7F9FD", -"> c #BED0EE", -"3 c #E1E9F7", -"7 c #F0F5FC", -"< c #CBD9F1", -"2 c #DAE5F6", -"# c #3161B1", -" c None", -"0 c #FDFEFF", -"= c #9FB9E5", -"e c #AEC5EA", -"t c #89A9DF", -"q c #98B5E4", -"p c #5584D1", -"d c #3A70CA", -"@ c #305FAC", -"i c #5D89D3", -"1 c #D2DFF4", -"% c #3366B9", -"9 c #FAFCFE", -"8 c #F5F8FD", -"s c #4075CC", -"O c #638ED5", -"w c #90AFE2", -"& c #3467BC", -"+ c #2F5DA9", -"; c #B3C8EB", -"4 c #E5EDF9", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ......X ", -" .oooooO+ ", -" .ooooooo. ", -" .+@@@##$%%&&&&&****. ", -" .=-;:>,<12345678900. ", -" .q=-;:>,<1234567890. ", -" .wq=-e:>,<12345678r. ", -" .twq=-e:>,<12345678. ", -" .ytwq=-e:>,<1234567. ", -" .uytwq=-e:>,<123456. ", -" .ouytwq=-e:>,<12345. ", -" .Oouytwq=-e;>,<1234. ", -" .iOouytwq=-e;>,<123. ", -" .piOouytwq=-e;>,<12. ", -" .apiOouytwq=-e;>,<1. ", -" .sapiOouytwq=-e;>,<. ", -" .dsapiOouytwq=-e;>,. ", -" ...................# ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/OPJViewer/source/icon4.xpm b/OPJViewer/source/icon4.xpm deleted file mode 100644 index a18e1a70..00000000 --- a/OPJViewer/source/icon4.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static char *icon4_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 5 1", -". c Black", -"o c #8399B4", -"X c #8DA0B9", -" c None", -"O c #800000", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .XXXXXo. ", -" .XXXXXXX. ", -" .................... ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .OOOOOOOOOOOOOOOOOO. ", -" .................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/OPJViewer/source/icon5.xpm b/OPJViewer/source/icon5.xpm deleted file mode 100644 index 9f63c310..00000000 --- a/OPJViewer/source/icon5.xpm +++ /dev/null @@ -1,79 +0,0 @@ -/* XPM */ -static char *icon5_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 41 1", -"0 c #AAC1E8", -"q c #B9CDED", -"X c #295193", -"e c #C6D6F0", -"a c #4A7CCE", -"& c #779DDB", -"* c #7FA2DD", -"2 c #EAF0FA", -"@ c #2D59A3", -"o c #6E96D8", -"y c #356AC1", -"d c #214279", -"w c #BED0EE", -"= c #85A7DF", -"< c #E1E9F7", -"3 c #F0F5FC", -"s c #CBD9F1", -", c #DAE5F6", -"7 c #3161B1", -" c None", -". c #274D8B", -"6 c #FDFEFF", -"i c #E7EEF9", -"9 c #9FB9E5", -"- c #89A9DF", -"8 c #98B5E4", -"$ c #5584D1", -"+ c #3569BF", -"% c #305FAC", -"O c #5D89D3", -"> c #D2DFF4", -"p c #3366B9", -"5 c #FAFCFE", -"4 c #F5F8FD", -"t c #4075CC", -"u c #638ED5", -"r c #CEDCF2", -"; c #90AFE2", -"# c #2F5DA9", -": c #B3C8EB", -"1 c #E5EDF9", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ......X ", -" XoooooO. ", -" Xoooooo+. ", -" Xooooooo@XXXXXXXXXX# ", -" Xoooooooooooooooooo# ", -" Xoooooooooooooooooo# ", -" Xoo$################### ", -" Xoo%O&*=-;:>,<123445667 ", -" XooX890:qwer>,<123445q# ", -" Xoty;890:qwer>,<12344# ", -" Xo%u-;890:qwer>,,,,<# ", -" XX$Ouo&*-;890:qwer>s# ", -" d%a$Ouo&*-;890:qwer# ", -" d+ta$Ouo&*-;890:qwe# ", -" d..................# ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/OPJViewer/source/imagjpeg2000.cpp b/OPJViewer/source/imagjpeg2000.cpp deleted file mode 100644 index 66e1146b..00000000 --- a/OPJViewer/source/imagjpeg2000.cpp +++ /dev/null @@ -1,1464 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: imagjpeg2000.cpp -// Purpose: wxImage JPEG 2000 family file format handler -// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik -// RCS-ID: $Id: imagjpeg2000.cpp,v 0.00 2008/01/31 10:58:00 MW Exp $ -// Copyright: (c) Giuseppe Baruffa -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG - -#include "imagjpeg2000.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/bitmap.h" - #include "wx/module.h" -#endif - -#include "libopenjpeg/openjpeg.h" - -#include "wx/filefn.h" -#include "wx/wfstream.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- -// wxJPEG2000Handler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxJPEG2000Handler,wxImageHandler) - -#if wxUSE_STREAMS - -//------------- JPEG 2000 Data Source Manager - -#define J2K_CFMT 0 -#define JP2_CFMT 1 -#define JPT_CFMT 2 -#define MJ2_CFMT 3 -#define PXM_DFMT 0 -#define PGX_DFMT 1 -#define BMP_DFMT 2 -#define YUV_DFMT 3 - -#define MAX_MESSAGE_LEN 200 - -/* check file type */ -int -jpeg2000familytype(unsigned char *hdr, int hdr_len) -{ - // check length - if (hdr_len < 24) - return -1; - - // check format - if (hdr[0] == 0x00 && - hdr[1] == 0x00 && - hdr[2] == 0x00 && - hdr[3] == 0x0C && - hdr[4] == 0x6A && - hdr[5] == 0x50 && - hdr[6] == 0x20 && - hdr[7] == 0x20 && - hdr[20] == 0x6A && - hdr[21] == 0x70 && - hdr[22] == 0x32) - // JP2 file format - return JP2_CFMT; - else if (hdr[0] == 0x00 && - hdr[1] == 0x00 && - hdr[2] == 0x00 && - hdr[3] == 0x0C && - hdr[4] == 0x6A && - hdr[5] == 0x50 && - hdr[6] == 0x20 && - hdr[7] == 0x20 && - hdr[20] == 0x6D && - hdr[21] == 0x6A && - hdr[22] == 0x70 && - hdr[23] == 0x32) - // MJ2 file format - return MJ2_CFMT; - else if (hdr[0] == 0xFF && - hdr[1] == 0x4F) - // J2K file format - return J2K_CFMT; - else - // unknown format - return -1; - -} - -/* we have to use this to avoid GUI-noGUI threads crashing */ -void printevent(const char *msg) -{ -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("%s"), msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#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 */ -void jpeg2000_warning_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, "[WARNING] %.*s", message_len, msg); - printevent(mess); -} - -/* sample debug callback expecting no client object */ -void jpeg2000_info_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, "[INFO] %.*s", message_len, msg); - printevent(mess); -} - -/* macro functions */ -/* 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) + \ - ((unsigned long int) (C)[(P) + 1] << 16) + \ - ((unsigned long int) (C)[(P) + 2] << 8) + \ - ((unsigned long int) (C)[(P) + 3] << 0)) - -#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \ - ((unsigned long int) (C)[(P) + 1] << 0)) - -/* defines */ -#define SHORT_DESCR_LEN 32 -#define LONG_DESCR_LEN 256 - -/* enumeration for file formats */ -#define JPEG2000FILENUM 4 -typedef enum { - - JP2_FILE, - J2K_FILE, - MJ2_FILE, - UNK_FILE - -} jpeg2000filetype; - -/* enumeration for the box types */ -#define JPEG2000BOXNUM 23 -typedef enum { - - FILE_BOX, - JP_BOX, - FTYP_BOX, - JP2H_BOX, - IHDR_BOX, - COLR_BOX, - JP2C_BOX, - JP2I_BOX, - XML_BOX, - UUID_BOX, - UINF_BOX, - MOOV_BOX, - MVHD_BOX, - TRAK_BOX, - TKHD_BOX, - MDIA_BOX, - MINF_BOX, - STBL_BOX, - STSD_BOX, - MJP2_BOX, - MDAT_BOX, - ANY_BOX, - UNK_BOX - -} jpeg2000boxtype; - -/* jpeg2000 family box signatures */ -#define FILE_SIGN "" -#define JP_SIGN "jP\040\040" -#define FTYP_SIGN "ftyp" -#define JP2H_SIGN "jp2h" -#define IHDR_SIGN "ihdr" -#define COLR_SIGN "colr" -#define JP2C_SIGN "jp2c" -#define JP2I_SIGN "jp2i" -#define XML_SIGN "xml\040" -#define UUID_SIGN "uuid" -#define UINF_SIGN "uinf" -#define MOOV_SIGN "moov" -#define MVHD_SIGN "mvhd" -#define TRAK_SIGN "trak" -#define TKHD_SIGN "tkhd" -#define MDIA_SIGN "mdia" -#define MINF_SIGN "minf" -#define VMHD_SIGN "vmhd" -#define STBL_SIGN "stbl" -#define STSD_SIGN "stsd" -#define MJP2_SIGN "mjp2" -#define MDAT_SIGN "mdat" -#define ANY_SIGN "" -#define UNK_SIGN "" - -/* the box structure itself */ -struct jpeg2000boxdef { - - char value[5]; /* hexadecimal value/string*/ - char name[SHORT_DESCR_LEN]; /* short description */ - char descr[LONG_DESCR_LEN]; /* long description */ - int sbox; /* is it a superbox? */ - int req[JPEG2000FILENUM]; /* mandatory box */ - jpeg2000boxtype ins; /* contained in box... */ - -}; - -/* the possible boxes */ -struct jpeg2000boxdef jpeg2000box[] = -{ -/* sign */ {FILE_SIGN, -/* short */ "placeholder for nothing", -/* long */ "Nothing to say", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP_SIGN, -/* short */ "JPEG 2000 Signature box", -/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {FTYP_SIGN, -/* short */ "File Type box", -/* long */ "This box specifies file type, version and compatibility information, including specifying if this file " - "is a conforming JP2 file or if it can be read by a conforming JP2 reader", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP2H_SIGN, -/* short */ "JP2 Header box", -/* long */ "This box contains a series of boxes that contain header-type information about the file", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {IHDR_SIGN, -/* short */ "Image Header box", -/* long */ "This box specifies the size of the image and other related fields", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ JP2H_BOX}, - -/* sign */ {COLR_SIGN, -/* short */ "Colour Specification box", -/* long */ "This box specifies the colourspace of the image", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ JP2H_BOX}, - -/* sign */ {JP2C_SIGN, -/* short */ "Contiguous Codestream box", -/* long */ "This box contains the codestream as defined by Annex A", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP2I_SIGN, -/* short */ "Intellectual Property box", -/* long */ "This box contains intellectual property information about the image", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {XML_SIGN, -/* short */ "XML box", -/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UUID_SIGN, -/* short */ "UUID box", -/* long */ "This box provides a tool by which vendors can add additional information to a file " - "without risking conflict with other vendors", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UINF_SIGN, -/* short */ "UUID Info box", -/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {MOOV_SIGN, -/* short */ "Movie box", -/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {MVHD_SIGN, -/* short */ "Movie Header box", -/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation " - "considered as a whole", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MOOV_BOX}, - -/* sign */ {TRAK_SIGN, -/* short */ "Track box", -/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MOOV_BOX}, - -/* sign */ {TKHD_SIGN, -/* short */ "Track Header box", -/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ TRAK_BOX}, - -/* sign */ {MDIA_SIGN, -/* short */ "Media box", -/* long */ "The media declaration container contains all the objects which declare information about the media data " - "within a track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ TRAK_BOX}, - -/* sign */ {MINF_SIGN, -/* short */ "Media Information box", -/* long */ "This box contains all the objects which declare characteristic information of the media in the track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MDIA_BOX}, - -/* sign */ {STBL_SIGN, -/* short */ "Sample Table box", -/* long */ "The sample table contains all the time and data indexing of the media samples in a track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {STSD_SIGN, -/* short */ "Sample Description box", -/* long */ "The sample description table gives detailed information about the coding type used, and any initialization " - "information needed for that coding", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {MJP2_SIGN, -/* short */ "MJP2 Sample Description box", -/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization " - "information needed for that coding", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {MDAT_SIGN, -/* short */ "Media Data box", -/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {ANY_SIGN, -/* short */ "Any box", -/* long */ "All the existing boxes", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UNK_SIGN, -/* short */ "Unknown Type box", -/* long */ "The signature is not recognised to be that of an existing box", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ ANY_BOX} - -}; - -/* declaration */ -int -jpeg2000_box_handler_function(jpeg2000boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, - unsigned long int filelimit, int level, char *scansign, - unsigned long int *scanpoint); - -#ifdef __WXMSW__ -typedef unsigned __int64 int8byte; -#endif // __WXMSW__ - -#ifdef __WXGTK__ -typedef unsigned long long int8byte; -#endif // __WXGTK__ - -/* internal mini-search for a box signature */ -int -jpeg2000_file_parse(wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level, - char *scansign, unsigned long int *scanpoint) -{ - unsigned long int LBox = 0x00000000; - char TBox[5] = "\0\0\0\0"; - int8byte XLBox = 0x0000000000000000; - unsigned long int box_length = 0; - int last_box = 0, box_num = 0; - int box_type = ANY_BOX; - unsigned char fourbytes[4]; - int box_number = 0; - - /* cycle all over the file */ - box_num = 0; - last_box = 0; - while (!last_box) { - - /* do not exceed file limit */ - if (filepoint >= filelimit) - return (0); - - /* seek on file */ - if (stream.SeekI(filepoint, wxFromStart) == wxInvalidOffset) - return (-1); - - /* read the mandatory LBox, 4 bytes */ - if (!stream.Read(fourbytes, 4)) { - wxLogError(wxT("Problem reading LBox from the file (file ended?)")); - return -1; - }; - LBox = STREAM_TO_UINT32(fourbytes, 0); - - /* read the mandatory TBox, 4 bytes */ - if (!stream.Read(TBox, 4)) { - wxLogError(wxT("Problem reading TBox from the file (file ended?)")); - return -1; - }; - - /* look if scansign is got */ - if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) { - /* hack/exploit */ - // stop as soon as you find the level-th codebox - if (box_number == level) { - memcpy(scansign, " ", 4); - *scanpoint = filepoint; - return (0); - } else - box_number++; - - }; - - /* determine the box type */ - for (box_type = JP_BOX; box_type < UNK_BOX; box_type++) - if (memcmp(TBox, jpeg2000box[box_type].value, 4) == 0) - break; - - /* read the optional XLBox, 8 bytes */ - if (LBox == 1) { - - if (!stream.Read(&XLBox, 8)) { - wxLogError(wxT("Problem reading XLBox from the file (file ended?)")); - return -1; - }; - box_length = (unsigned long int) BYTE_SWAP8(XLBox); - - } else if (LBox == 0x00000000) { - - /* last box in file */ - last_box = 1; - box_length = filelimit - filepoint; - - } else - - box_length = LBox; - - - /* go deep in the box */ - jpeg2000_box_handler_function((jpeg2000boxtype) box_type, - stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), - filepoint + box_length, level, scansign, scanpoint); - - /* if it's a superbox go inside it */ - if (jpeg2000box[box_type].sbox) - jpeg2000_file_parse(stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, - level, scansign, scanpoint); - - /* increment box number and filepoint*/ - box_num++; - filepoint += box_length; - - }; - - /* all good */ - return (0); -} - -// search first contiguos codestream box in an mj2 file -unsigned long int -searchjpeg2000c(wxInputStream& stream, unsigned long int fsize, int number) -{ - char scansign[] = "jp2c"; - unsigned long int scanpoint = 0L; - - wxLogMessage(wxT("Searching jp2c box... ")); - - /* do the parsing */ - if (jpeg2000_file_parse(stream, 0, fsize, number, scansign, &scanpoint) < 0) - wxLogMessage(wxT("Unrecoverable error during JPEG 2000 box parsing: stopping")); - - if (strcmp(scansign, " ")) - wxLogMessage(wxT("Box not found")); - else { - - wxLogMessage(wxString::Format(wxT("Box found at byte %d"), scanpoint)); - - }; - - return (scanpoint); -} - -// search the jp2h box in the file -unsigned long int -searchjpeg2000headerbox(wxInputStream& stream, unsigned long int fsize) -{ - char scansign[] = "jp2h"; - unsigned long int scanpoint = 0L; - - wxLogMessage(wxT("Searching jp2h box... ")); - - /* do the parsing */ - if (jpeg2000_file_parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0) - wxLogMessage(wxT("Unrecoverable error during JPEG 2000 box parsing: stopping")); - - if (strcmp(scansign, " ")) - wxLogMessage(wxT("Box not found")); - else - wxLogMessage(wxString::Format(wxT("Box found at byte %d"), scanpoint)); - - return (scanpoint); -} - -/* handling functions */ -#define ITEM_PER_ROW 10 - -/* Box handler function */ -int -jpeg2000_box_handler_function(jpeg2000boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, - unsigned long int filelimit, int level, - char *scansign, unsigned long int *scanpoint) -{ - switch (boxtype) { - - /* Sample Description box */ - case (STSD_BOX): - jpeg2000_file_parse(stream, filepoint + 8, filelimit, level, scansign, scanpoint); - break; - - /* MJP2 Sample Description box */ - case (MJP2_BOX): - jpeg2000_file_parse(stream, filepoint + 78, filelimit, level, scansign, scanpoint); - break; - - /* not yet implemented */ - default: - break; - - }; - - return (0); -} - -// the jP and ftyp parts of the header -#define jpeg2000headSIZE 32 -unsigned char jpeg2000head[jpeg2000headSIZE] = { - 0x00, 0x00, 0x00, 0x0C, 'j', 'P', ' ', ' ', - 0x0D, 0x0A, 0x87, 0x0A, 0x00, 0x00, 0x00, 0x14, - 'f', 't', 'y', 'p', 'j', 'p', '2', ' ', - 0x00, 0x00, 0x00, 0x00, 'j', 'p', '2', ' ' -}; - -///////////////////////////////////////////////// -///////////////////////////////////////////////// - -// load the jpeg2000 file format -bool wxJPEG2000Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index) -{ - opj_dparameters_t parameters; /* decompression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *opjimage = NULL; - unsigned char *src = NULL; - unsigned char *ptr; - int file_length, jp2c_point, jp2h_point; - unsigned long int jp2hboxlen, jp2cboxlen; - opj_codestream_info_t cstr_info; /* Codestream information structure */ - unsigned char hdr[24]; - int jpfamform; - - // destroy the image - image->Destroy(); - - /* read the beginning of the file to check the type */ - if (!stream.Read(hdr, WXSIZEOF(hdr))) - return false; - if ((jpfamform = jpeg2000familytype(hdr, WXSIZEOF(hdr))) < 0) - return false; - stream.SeekI(0, wxFromStart); - - /* handle to a decompressor */ - opj_dinfo_t* dinfo = NULL; - opj_cio_t *cio = NULL; - - /* configure the event callbacks */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = jpeg2000_error_callback; - event_mgr.warning_handler = jpeg2000_warning_callback; - event_mgr.info_handler = jpeg2000_info_callback; - - /* set decoding parameters to default values */ - opj_set_default_decoder_parameters(¶meters); - - /* prepare parameters */ - strncpy(parameters.infile, "", sizeof(parameters.infile) - 1); - strncpy(parameters.outfile, "", sizeof(parameters.outfile) - 1); - parameters.decod_format = jpfamform; - parameters.cod_format = BMP_DFMT; - if (m_reducefactor) - parameters.cp_reduce = m_reducefactor; - if (m_qualitylayers) - parameters.cp_layer = m_qualitylayers; - /*if (n_components) - parameters. = n_components;*/ - - /* JPWL only */ -#ifdef USE_JPWL - parameters.jpwl_exp_comps = m_expcomps; - parameters.jpwl_max_tiles = m_maxtiles; - parameters.jpwl_correct = m_enablejpwl; -#endif /* USE_JPWL */ - - /* get a decoder handle */ - if (jpfamform == JP2_CFMT || jpfamform == MJ2_CFMT) - dinfo = opj_create_decompress(CODEC_JP2); - else if (jpfamform == J2K_CFMT) - dinfo = opj_create_decompress(CODEC_J2K); - else - return false; - - /* find length of the stream */ - stream.SeekI(0, wxFromEnd); - file_length = (int) stream.TellI(); - - /* it's a movie */ - if (jpfamform == MJ2_CFMT) { - /* search for the first codestream box and the movie header box */ - jp2c_point = searchjpeg2000c(stream, file_length, m_framenum); - jp2h_point = searchjpeg2000headerbox(stream, file_length); - - // read the jp2h box and store it - stream.SeekI(jp2h_point, wxFromStart); - stream.Read(&jp2hboxlen, sizeof(unsigned long int)); - jp2hboxlen = BYTE_SWAP4(jp2hboxlen); - - // read the jp2c box and store it - stream.SeekI(jp2c_point, wxFromStart); - stream.Read(&jp2cboxlen, sizeof(unsigned long int)); - jp2cboxlen = BYTE_SWAP4(jp2cboxlen); - - // malloc memory source - src = (unsigned char *) malloc(jpeg2000headSIZE + jp2hboxlen + jp2cboxlen); - - // copy the jP and ftyp - memcpy(src, jpeg2000head, jpeg2000headSIZE); - - // copy the jp2h - stream.SeekI(jp2h_point, wxFromStart); - stream.Read(&src[jpeg2000headSIZE], jp2hboxlen); - - // copy the jp2c - stream.SeekI(jp2c_point, wxFromStart); - stream.Read(&src[jpeg2000headSIZE + jp2hboxlen], jp2cboxlen); - } else if (jpfamform == JP2_CFMT || jpfamform == J2K_CFMT) { - /* It's a plain image */ - /* get data */ - stream.SeekI(0, wxFromStart); - src = (unsigned char *) malloc(file_length); - stream.Read(src, file_length); - } else - return false; - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - if (jpfamform == MJ2_CFMT) - cio = opj_cio_open((opj_common_ptr)dinfo, src, jpeg2000headSIZE + jp2hboxlen + jp2cboxlen); - else if (jpfamform == JP2_CFMT || jpfamform == J2K_CFMT) - cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); - else { - free(src); - return false; - } - - /* decode the stream and fill the image structure */ - opjimage = opj_decode_with_info(dinfo, cio, &cstr_info); - if (!opjimage) { - wxMutexGuiEnter(); - wxLogError(wxT("JPEG 2000 failed to decode image!")); - wxMutexGuiLeave(); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - free(src); - return false; - } - - /* close the byte stream */ - opj_cio_close(cio); - - /* - - - At this point, we have the structure "opjimage" that is filled with decompressed - data, as processed by the OpenJPEG decompression engine - - - We need to fill the class "image" with the proper pixel sample values - - */ - { - int shiftbpp; - int c, tempcomps; - - // check components number - if (m_components > opjimage->numcomps) - m_components = opjimage->numcomps; - - // check image depth (only on the first one, for now) - if (m_components) - shiftbpp = opjimage->comps[m_components - 1].prec - 8; - else - shiftbpp = opjimage->comps[0].prec - 8; - - // prepare image size - if (m_components) - image->Create(opjimage->comps[m_components - 1].w, opjimage->comps[m_components - 1].h, true); - else - image->Create(opjimage->comps[0].w, opjimage->comps[0].h, true); - - // access image raw data - image->SetMask(false); - ptr = image->GetData(); - - // workaround for components different from 1 or 3 - if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) { -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("JPEG2000: weird number of components")); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ - tempcomps = 1; - } else - tempcomps = opjimage->numcomps; - - // workaround for subsampled components - for (c = 1; c < tempcomps; c++) { - if ((opjimage->comps[c].w != opjimage->comps[c - 1].w) || (opjimage->comps[c].h != opjimage->comps[c - 1].h)) { - tempcomps = 1; - break; - } - } - - // workaround for different precision components - for (c = 1; c < tempcomps; c++) { - if (opjimage->comps[c].bpp != opjimage->comps[c - 1].bpp) { - tempcomps = 1; - break; - } - } - - // only one component selected - if (m_components) - tempcomps = 1; - - // RGB color picture - if (tempcomps == 3) { - int row, col; - int *r = opjimage->comps[0].data; - int *g = opjimage->comps[1].data; - int *b = opjimage->comps[2].data; - if (shiftbpp > 0) { - for (row = 0; row < opjimage->comps[0].h; row++) { - for (col = 0; col < opjimage->comps[0].w; col++) { - - *(ptr++) = (*(r++)) >> shiftbpp; - *(ptr++) = (*(g++)) >> shiftbpp; - *(ptr++) = (*(b++)) >> shiftbpp; - - } - } - - } else if (shiftbpp < 0) { - for (row = 0; row < opjimage->comps[0].h; row++) { - for (col = 0; col < opjimage->comps[0].w; col++) { - - *(ptr++) = (*(r++)) << -shiftbpp; - *(ptr++) = (*(g++)) << -shiftbpp; - *(ptr++) = (*(b++)) << -shiftbpp; - - } - } - - } else { - for (row = 0; row < opjimage->comps[0].h; row++) { - for (col = 0; col < opjimage->comps[0].w; col++) { - - *(ptr++) = *(r++); - *(ptr++) = *(g++); - *(ptr++) = *(b++); - - } - } - } - } - - // B/W picture - if (tempcomps == 1) { - int row, col; - int selcomp; - - if (m_components) - selcomp = m_components - 1; - else - selcomp = 0; - - int *y = opjimage->comps[selcomp].data; - if (shiftbpp > 0) { - for (row = 0; row < opjimage->comps[selcomp].h; row++) { - for (col = 0; col < opjimage->comps[selcomp].w; col++) { - - *(ptr++) = (*(y)) >> shiftbpp; - *(ptr++) = (*(y)) >> shiftbpp; - *(ptr++) = (*(y++)) >> shiftbpp; - - } - } - } else if (shiftbpp < 0) { - for (row = 0; row < opjimage->comps[selcomp].h; row++) { - for (col = 0; col < opjimage->comps[selcomp].w; col++) { - - *(ptr++) = (*(y)) << -shiftbpp; - *(ptr++) = (*(y)) << -shiftbpp; - *(ptr++) = (*(y++)) << -shiftbpp; - - } - } - } else { - for (row = 0; row < opjimage->comps[selcomp].h; row++) { - for (col = 0; col < opjimage->comps[selcomp].w; col++) { - - *(ptr++) = *(y); - *(ptr++) = *(y); - *(ptr++) = *(y++); - - } - } - } - } - - - } - - wxMutexGuiEnter(); - wxLogMessage(wxT("JPEG 2000 image loaded.")); - wxMutexGuiLeave(); - - /* close openjpeg structs */ - opj_destroy_decompress(dinfo); - opj_image_destroy(opjimage); - free(src); - - if (!image->Ok()) - return false; - else - return true; - -} - -#define CINEMA_24_CS 1302083 /* Codestream length for 24fps */ -#define CINEMA_48_CS 651041 /* Codestream length for 48fps */ -#define COMP_24_CS 1041666 /* Maximum size per color component for 2K & 4K @ 24fps */ -#define COMP_48_CS 520833 /* Maximum size per color component for 2K @ 48fps */ - -// save the j2k codestream -bool wxJPEG2000Handler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbose ) -{ - opj_cparameters_t parameters; /* compression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *oimage = NULL; - opj_image_cmptparm_t *cmptparm; - opj_cio_t *cio = NULL; - opj_codestream_info_t cstr_info; - int codestream_length; - bool bSuccess; - int i; - char indexfilename[OPJ_PATH_LEN] = ""; /* index file name */ - - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = jpeg2000_error_callback; - event_mgr.warning_handler = jpeg2000_warning_callback; - event_mgr.info_handler = jpeg2000_info_callback; - - /* set encoding parameters to default values */ - opj_set_default_encoder_parameters(¶meters); - - /* load parameters */ - parameters.cp_cinema = OFF; - - /* subsampling */ - 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("")) && (!m_enablequality)) { - 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 != ',') { - s1++; - } - if (!*s1) - break; - s1++; - } - wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers); - parameters.cp_disto_alloc = 1; - } - - /* image quality, dB */ - if ((m_quality != wxT("")) && (m_enablequality)) { - 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 != ',') { - s2++; - } - if (!*s2) - break; - s2++; - } - wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers); - parameters.cp_fixed_quality = 1; - } - - /* image origin */ - 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.ToAscii()) + 1); - if(parameters.cp_comment) { - strcpy(parameters.cp_comment, m_comment.ToAscii()); - } - } else { - parameters.cp_comment = NULL; - } - - /* indexing file */ - if (m_enableidx) { - strncpy(indexfilename, m_index.ToAscii(), OPJ_PATH_LEN); - wxLogMessage(wxT("index file is %s"), indexfilename); - } - - /* if no rate entered, lossless by default */ - if (parameters.tcp_numlayers == 0) { - parameters.tcp_rates[0] = 0; /* MOD antonin : losslessbug */ - parameters.tcp_numlayers++; - parameters.cp_disto_alloc = 1; - } - - /* irreversible transform */ - parameters.irreversible = (m_irreversible == true) ? 1 : 0; - - /* resolutions */ - parameters.numresolution = m_resolutions; - - /* codeblocks size */ - if (m_cbsize != wxT("")) { - int cblockw_init = 0, cblockh_init = 0; - 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(wxT("!! Size of code_block error !! Restrictions:\n width*height<=4096\n 4<=width,height<= 1024")); - return false; - } - parameters.cblockw_init = cblockw_init; - parameters.cblockh_init = cblockh_init; - } - - /* precincts size */ - if (m_prsize != wxT("")) { - char sep; - int res_spec = 0; - char *s = (char *) m_prsize.c_str(); - do { - sep = 0; - sscanf(s, "[%d,%d]%c", ¶meters.prcw_init[res_spec], ¶meters.prch_init[res_spec], &sep); - parameters.csty |= 0x01; - res_spec++; - s = strpbrk(s, "]") + 2; - } while (sep == ','); - parameters.res_spec = res_spec; - } - - /* tiles */ - if (m_tsize != wxT("")) { - sscanf(m_tsize.ToAscii(), "%d,%d", ¶meters.cp_tdx, ¶meters.cp_tdy); - parameters.tile_size_on = true; - } - - /* tile origin */ - if (sscanf(m_torigin.ToAscii(), "%d,%d", ¶meters.cp_tx0, ¶meters.cp_ty0) != 2) { - wxLogError(wxT("tile offset setting error: X0,Y0")); - return false; - } - - /* use SOP */ - if (m_enablesop) - parameters.csty |= 0x02; - - /* use EPH */ - if (m_enableeph) - parameters.csty |= 0x04; - - /* multiple component transform */ - if (m_multicomp) - parameters.tcp_mct = 1; - else - parameters.tcp_mct = 0; - - /* mode switch */ - parameters.mode = (m_enablebypass ? 1 : 0) + (m_enablereset ? 2 : 0) - + (m_enablerestart ? 4 : 0) + (m_enablevsc ? 8 : 0) - + (m_enableerterm ? 16 : 0) + (m_enablesegmark ? 32 : 0); - - /* progression order */ - switch (m_progression) { - - /* LRCP */ - case 0: - parameters.prog_order = LRCP; - break; - - /* RLCP */ - case 1: - parameters.prog_order = RLCP; - break; - - /* RPCL */ - case 2: - parameters.prog_order = RPCL; - break; - - /* PCRL */ - case 3: - parameters.prog_order = PCRL; - break; - - /* CPRL */ - case 4: - parameters.prog_order = CPRL; - break; - - /* DCI2K24 */ - case 5: - parameters.cp_cinema = CINEMA2K_24; - parameters.cp_rsiz = CINEMA2K; - break; - - /* DCI2K48 */ - case 6: - parameters.cp_cinema = CINEMA2K_48; - parameters.cp_rsiz = CINEMA2K; - break; - - /* DCI4K */ - case 7: - parameters.cp_cinema = CINEMA4K_24; - parameters.cp_rsiz = CINEMA4K; - break; - - default: - break; - } - - /* check cinema */ - if (parameters.cp_cinema) { - - /* set up */ - parameters.tile_size_on = false; - parameters.cp_tdx=1; - parameters.cp_tdy=1; - - /*Tile part*/ - parameters.tp_flag = 'C'; - parameters.tp_on = 1; - - /*Tile and Image shall be at (0,0)*/ - parameters.cp_tx0 = 0; - parameters.cp_ty0 = 0; - parameters.image_offset_x0 = 0; - parameters.image_offset_y0 = 0; - - /*Codeblock size= 32*32*/ - parameters.cblockw_init = 32; - parameters.cblockh_init = 32; - parameters.csty |= 0x01; - - /*The progression order shall be CPRL*/ - parameters.prog_order = CPRL; - - /* No ROI */ - parameters.roi_compno = -1; - - parameters.subsampling_dx = 1; - parameters.subsampling_dy = 1; - - /* 9-7 transform */ - parameters.irreversible = 1; - - } - - /* convert wx image into opj image */ - cmptparm = (opj_image_cmptparm_t*) malloc(3 * sizeof(opj_image_cmptparm_t)); - - /* initialize opj image components */ - memset(&cmptparm[0], 0, 3 * sizeof(opj_image_cmptparm_t)); - for(i = 0; i < 3; i++) { - cmptparm[i].prec = 8; - cmptparm[i].bpp = 8; - cmptparm[i].sgnd = false; - cmptparm[i].dx = parameters.subsampling_dx; - cmptparm[i].dy = parameters.subsampling_dy; - cmptparm[i].w = wimage->GetWidth(); - cmptparm[i].h = wimage->GetHeight(); - } - - /* create the image */ - oimage = opj_image_create(3, &cmptparm[0], CLRSPC_SRGB); - if(!oimage) { - if (cmptparm) - free(cmptparm); - return false; - } - - /* set image offset and reference grid */ - oimage->x0 = parameters.image_offset_x0; - oimage->y0 = parameters.image_offset_y0; - oimage->x1 = parameters.image_offset_x0 + (wimage->GetWidth() - 1) * 1 + 1; - oimage->y1 = parameters.image_offset_y0 + (wimage->GetHeight() - 1) * 1 + 1; - - /* load image data */ - unsigned char *value = wimage->GetData(); - int area = wimage->GetWidth() * wimage->GetHeight(); - for (i = 0; i < area; i++) { - oimage->comps[0].data[i] = *(value++); - oimage->comps[1].data[i] = *(value++); - oimage->comps[2].data[i] = *(value++); - } - - /* check cinema again */ - if (parameters.cp_cinema) { - int i; - float temp_rate; - opj_poc_t *POC = NULL; - - switch (parameters.cp_cinema) { - - case CINEMA2K_24: - case CINEMA2K_48: - if (parameters.numresolution > 6) { - parameters.numresolution = 6; - } - if (!((oimage->comps[0].w == 2048) | (oimage->comps[0].h == 1080))) { - wxLogWarning(wxT("Image coordinates %d x %d is not 2K compliant. JPEG Digital Cinema Profile-3 " - "(2K profile) compliance requires that at least one of coordinates match 2048 x 1080"), - oimage->comps[0].w, oimage->comps[0].h); - parameters.cp_rsiz = STD_RSIZ; - } - break; - - case CINEMA4K_24: - if (parameters.numresolution < 1) { - parameters.numresolution = 1; - } else if (parameters.numresolution > 7) { - parameters.numresolution = 7; - } - if (!((oimage->comps[0].w == 4096) | (oimage->comps[0].h == 2160))) { - wxLogWarning(wxT("Image coordinates %d x %d is not 4K compliant. JPEG Digital Cinema Profile-4" - "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160"), - oimage->comps[0].w, oimage->comps[0].h); - parameters.cp_rsiz = STD_RSIZ; - } - parameters.POC[0].tile = 1; - parameters.POC[0].resno0 = 0; - parameters.POC[0].compno0 = 0; - parameters.POC[0].layno1 = 1; - parameters.POC[0].resno1 = parameters.numresolution - 1; - parameters.POC[0].compno1 = 3; - parameters.POC[0].prg1 = CPRL; - parameters.POC[1].tile = 1; - parameters.POC[1].resno0 = parameters.numresolution - 1; - parameters.POC[1].compno0 = 0; - parameters.POC[1].layno1 = 1; - parameters.POC[1].resno1 = parameters.numresolution; - parameters.POC[1].compno1 = 3; - parameters.POC[1].prg1 = CPRL; - parameters.numpocs = 2; - break; - } - - switch (parameters.cp_cinema) { - case CINEMA2K_24: - case CINEMA4K_24: - for (i = 0 ; i < parameters.tcp_numlayers; i++) { - temp_rate = 0; - if (parameters.tcp_rates[i] == 0) { - parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - }else{ - temp_rate = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - if (temp_rate > CINEMA_24_CS ) { - parameters.tcp_rates[i]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - } else { - /* do nothing */ - } - } - } - parameters.max_comp_size = COMP_24_CS; - break; - - case CINEMA2K_48: - for (i = 0; i < parameters.tcp_numlayers; i++) { - temp_rate = 0 ; - if (parameters.tcp_rates[i] == 0) { - parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - }else{ - temp_rate =((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - if (temp_rate > CINEMA_48_CS ){ - parameters.tcp_rates[0]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) / - (CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy); - }else{ - /* do nothing */ - } - } - } - parameters.max_comp_size = COMP_48_CS; - break; - } - - parameters.cp_disto_alloc = 1; - } - - /* get a J2K compressor handle */ - opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); - - /* setup the encoder parameters using the current image and user parameters */ - opj_setup_encoder(cinfo, ¶meters, oimage); - - /* open a byte stream for writing */ - /* allocate memory for all tiles */ - cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0); - - /* encode the image */ - bSuccess = opj_encode_with_info(cinfo, cio, oimage, &cstr_info); - if (!bSuccess) { - - opj_cio_close(cio); - opj_destroy_compress(cinfo); - opj_image_destroy(oimage); - if (cmptparm) - free(cmptparm); - if(parameters.cp_comment) - free(parameters.cp_comment); - if(parameters.cp_matrice) - free(parameters.cp_matrice); - -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - - wxLogError(wxT("failed to encode image")); - -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ - - return false; - } - codestream_length = cio_tell(cio); - wxLogMessage(wxT("Codestream: %d bytes"), codestream_length); - - /* write the buffer to stream */ - stream.Write(cio->buffer, codestream_length); - - /* close and free the byte stream */ - opj_cio_close(cio); - - /* Write the index to disk */ - if (*indexfilename) { - if (write_index_file(&cstr_info, indexfilename)) { - wxLogError(wxT("Failed to output index file")); - } - } - - /* free remaining compression structures */ - opj_destroy_compress(cinfo); - - /* free image data */ - opj_image_destroy(oimage); - - if (cmptparm) - free(cmptparm); - if(parameters.cp_comment) - free(parameters.cp_comment); - if(parameters.cp_matrice) - free(parameters.cp_matrice); - -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - - wxLogMessage(wxT("J2K: Image encoded!")); - -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ - - return true; -} - -#ifdef __VISUALC__ - #pragma warning(default:4611) -#endif /* VC++ */ - -// recognize the JPEG 2000 family starting box or the 0xFF4F JPEG 2000 SOC marker -bool wxJPEG2000Handler::DoCanRead(wxInputStream& stream) -{ - unsigned char hdr[24]; - int jpfamform; - - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - jpfamform = jpeg2000familytype(hdr, WXSIZEOF(hdr)); - - return ((jpfamform == JP2_CFMT) || (jpfamform == MJ2_CFMT) || (jpfamform == J2K_CFMT)); -} - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LIBOPENJPEG diff --git a/OPJViewer/source/imagjpeg2000.h b/OPJViewer/source/imagjpeg2000.h deleted file mode 100644 index 2fea20a8..00000000 --- a/OPJViewer/source/imagjpeg2000.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: imagalljpeg2000.h -// Purpose: wxImage JPEG 2000 family file format handler -// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik -// RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $ -// Copyright: (c) Giuseppe Baruffa -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGJPEG2000_H_ -#define _WX_IMAGJPEG2000_H_ - -#include "wx/defs.h" - -//----------------------------------------------------------------------------- -// wxJPEG2000Handler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBOPENJPEG - -#include "wx/image.h" -#include "libopenjpeg/openjpeg.h" -#include "codec/index.h" - -#define wxBITMAP_TYPE_JPEG2000 50 - -class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler -{ -public: - inline wxJPEG2000Handler() - { - m_name = wxT("JPEG 2000 family file format"); - m_extension = wxT("mj2"); - m_type = wxBITMAP_TYPE_JPEG2000; - m_mime = wxT("image/mj2"); - - /* decoding */ - m_reducefactor = 0; - m_qualitylayers = 0; - m_components = 0; -#ifdef USE_JPWL - m_enablejpwl = true; - m_expcomps = JPWL_EXPECTED_COMPONENTS; - m_maxtiles = JPWL_MAXIMUM_TILES; -#endif // USE_JPWL - - /* encoding */ - m_subsampling = wxT("1,1"); - m_origin = wxT("0,0"); - m_rates = wxT("20,10,5"); - m_quality = wxT("30,35,40"); - m_enablequality = false; - m_multicomp = false; - m_irreversible = false; - m_resolutions = 6; - m_progression = 0; - m_cbsize = wxT("32,32"); - m_prsize = wxT("[128,128],[128,128]"); - m_tsize = wxT(""); - m_torigin = wxT("0,0"); - /*m_progression - m_resilience*/ - m_enablesop = false; - m_enableeph = false; - m_enablereset = false; - m_enablesegmark = false; - m_enablevsc = false; - m_enablerestart = false; - m_enableerterm = false; - m_enablebypass = false; - /*m_roicompo - m_roiup - m_indexfname*/ - m_enableidx = false; - m_index = wxT("index.txt"); - m_enablepoc = false; - m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL"); - m_enablecomm = true; - -#if defined __WXMSW__ - m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version "); -#elif defined __WXGTK__ - m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version "); -#else - m_comment = wxT("Created by OPJViewer - OpenJPEG version "); -#endif - -#ifdef USE_JPWL - m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version()); -#else - m_comment += wxString::Format(wxT("%s"), (char *) opj_version()); -#endif - - } - - // decoding engine parameters - int m_reducefactor, m_qualitylayers, m_components, m_framenum; -#ifdef USE_JPWL - bool m_enablejpwl; - int m_expcomps, m_maxtiles; -#endif // USE_JPWL - - // encoding engine parameters - wxString m_subsampling; - wxString m_origin; - wxString m_rates; - wxString m_quality; - bool m_enablequality; - bool m_multicomp; - bool m_irreversible; - int m_resolutions; - int m_progression; - wxString m_cbsize; - wxString m_prsize; - wxString m_tsize; - wxString m_torigin; - /*m_progression - m_resilience*/ - bool m_enablesop; - bool m_enableeph; - bool m_enablebypass; - bool m_enableerterm; - bool m_enablerestart; - bool m_enablereset; - bool m_enablesegmark; - bool m_enablevsc; - /*m_roicompo - m_roiup - m_indexfname*/ - bool m_enableidx; - wxString m_index; - bool m_enablecomm; - wxString m_comment; - bool m_enablepoc; - wxString m_poc; - -#if wxUSE_STREAMS - virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); - virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); -protected: - virtual bool DoCanRead(wxInputStream& stream); -#endif - -private: - OPJ_PROG_ORDER give_progression(char progression[4]); - DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler) -}; - -#endif // wxUSE_LIBOPENJPEG - -#endif // _WX_IMAGJPEG2000_H_ - diff --git a/OPJViewer/source/imagmxf.cpp b/OPJViewer/source/imagmxf.cpp deleted file mode 100644 index 99d0b939..00000000 --- a/OPJViewer/source/imagmxf.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: imagmxf.cpp -// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler -// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik -// RCS-ID: $Id: imagmxf.cpp,v 0.00 2007/11/19 17:00:00 MW Exp $ -// Copyright: (c) Giuseppe Baruffa -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef USE_MXF - -#include "mxflib/mxflib.h" -using namespace mxflib; - -namespace -{ - //! Structure holding information about the essence in each body stream - struct EssenceInfo - { - UMIDPtr PackageID; - PackagePtr Package; - MDObjectPtr Descriptor; - }; - //! Map of EssenceInfo structures indexed by BodySID - typedef std::map EssenceInfoMap; - - //! The map of essence info for this file - EssenceInfoMap EssenceLookup; -}; - -//! Build an EssenceInfoMap for the essence in a given file -/*! \return True if al OK, else false - */ -bool BuildEssenceInfo(MXFFilePtr &File, EssenceInfoMap &EssenceLookup); - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG - -#include "imagmxf.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/intl.h" - #include "wx/bitmap.h" - #include "wx/module.h" -#endif - - -#include "libopenjpeg/openjpeg.h" - - -#include "wx/filefn.h" -#include "wx/wfstream.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- -// wxMXFHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxMXFHandler,wxImageHandler) - -#if wxUSE_STREAMS - -#include -#define MAX_MESSAGE_LEN 200 - -//------------- MXF Manager - -// Debug and error messages - -//! Display a warning message -void mxflib::warning(const char *Fmt, ...) -{ - char msg[MAX_MESSAGE_LEN]; - va_list args; - - va_start(args, Fmt); - _vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args); - va_end(args); - - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[WARNING_MXF] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - -//! Display an error message -void mxflib::error(const char *Fmt, ...) -{ - char msg[MAX_MESSAGE_LEN]; - va_list args; - - va_start(args, Fmt); - _vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args); - va_end(args); - - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[ERROR_MXF] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - -//! Display an error message -void mxflib::debug(const char *Fmt, ...) -{ - char msg[MAX_MESSAGE_LEN]; - va_list args; - - va_start(args, Fmt); - _vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args); - va_end(args); - - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[DEBUG_MXF] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - - - -//------------- JPEG 2000 Data Source Manager - -#define J2K_CFMT 0 -#define JP2_CFMT 1 -#define JPT_CFMT 2 -#define MJ2_CFMT 3 -#define PXM_DFMT 0 -#define PGX_DFMT 1 -#define BMP_DFMT 2 -#define YUV_DFMT 3 - -/* sample error callback expecting a FILE* client object */ -void mxf_error_callback(const char *msg, void *client_data) { - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - -/* sample warning callback expecting a FILE* client object */ -void mxf_warning_callback(const char *msg, void *client_data) { - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - -/* sample debug callback expecting no client object */ -void mxf_info_callback(const char *msg, void *client_data) { - int message_len = strlen(msg) - 1; - if (msg[message_len] != '\n') - message_len = MAX_MESSAGE_LEN; -#ifndef __WXGTK__ - wxMutexGuiEnter(); -#endif /* __WXGTK__ */ - wxLogMessage(wxT("[INFO] %.*s"), message_len, msg); -#ifndef __WXGTK__ - wxMutexGuiLeave(); -#endif /* __WXGTK__ */ -} - - -///////////////////////////////////////////////// -///////////////////////////////////////////////// - -// load the mxf file format -bool wxMXFHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index) -{ - opj_dparameters_t parameters; /* decompression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_image_t *opjimage = NULL; - unsigned char *src = NULL; - unsigned char *ptr; - int file_length, j2k_point, j2k_len; - opj_codestream_info_t cstr_info; /* Codestream information structure */ - - // simply display the version of the library - wxLogMessage(wxT("Version of MXF: %s "), wxString::FromAscii(LibraryVersion().c_str())); - //wxLogMessage(wxT("MXF file name: %s"), m_filename.GetFullPath()); - - // open MXF file - MXFFilePtr TestFile = new MXFFile; - if (! TestFile->Open(m_filename.GetFullPath().c_str(), true)) - { - wxLogError(wxT("Could not find %s"), m_filename.GetFullPath().c_str()); - return false; - } else - wxLogMessage(wxT("Found %s"), m_filename.GetFullPath().c_str()); - - // Get the size - TestFile->SeekEnd(); - wxLogMessage(wxT("Size is %d bytes"), TestFile->Tell()); - TestFile->Seek(0); - - // essence information - //BuildEssenceInfo(TestFile, EssenceLookup); - - // close MXF file - TestFile->Close(); - - return false; - - // destroy the image - image->Destroy(); - - /* handle to a decompressor */ - opj_dinfo_t* dinfo = NULL; - opj_cio_t *cio = NULL; - - /* configure the event callbacks (not required) */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = mxf_error_callback; - event_mgr.warning_handler = mxf_warning_callback; - event_mgr.info_handler = mxf_info_callback; - - /* set decoding parameters to default values */ - opj_set_default_decoder_parameters(¶meters); - - /* prepare parameters */ - strncpy(parameters.infile, "", sizeof(parameters.infile)-1); - strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1); - parameters.decod_format = J2K_CFMT; - parameters.cod_format = BMP_DFMT; - if (m_reducefactor) - parameters.cp_reduce = m_reducefactor; - if (m_qualitylayers) - parameters.cp_layer = m_qualitylayers; - /*if (n_components) - parameters. = n_components;*/ - - /* JPWL only */ -#ifdef USE_JPWL - parameters.jpwl_exp_comps = m_expcomps; - parameters.jpwl_max_tiles = m_maxtiles; - parameters.jpwl_correct = m_enablejpwl; -#endif /* USE_JPWL */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_J2K); - - /* find length of the stream */ - stream.SeekI(0, wxFromEnd); - file_length = (int) stream.TellI(); - - /* search for the m_framenum codestream position and length */ - //jp2c_point = searchjp2c(stream, file_length, m_framenum); - //jp2c_len = searchjp2c(stream, file_length, m_framenum); - j2k_point = 0; - j2k_len = 10; - - // malloc memory source - src = (unsigned char *) malloc(j2k_len); - - // copy the jp2c - stream.SeekI(j2k_point, wxFromStart); - stream.Read(src, j2k_len); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, src, j2k_len); - - /* decode the stream and fill the image structure */ - opjimage = opj_decode_with_info(dinfo, cio, &cstr_info); - if (!opjimage) { - wxMutexGuiEnter(); - wxLogError(wxT("MXF: failed to decode image!")); - wxMutexGuiLeave(); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - free(src); - return false; - } - - /* close the byte stream */ - opj_cio_close(cio); - - /* common rendering method */ -#include "imagjpeg2000.cpp" - - wxMutexGuiEnter(); - wxLogMessage(wxT("MXF: image loaded.")); - wxMutexGuiLeave(); - - /* close openjpeg structs */ - opj_destroy_decompress(dinfo); - opj_image_destroy(opjimage); - free(src); - - if (!image->Ok()) - return false; - else - return true; - -} - -// save the mxf file format -bool wxMXFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) -{ - wxLogError(wxT("MXF: Couldn't save movie -> not implemented.")); - return false; -} - -#ifdef __VISUALC__ - #pragma warning(default:4611) -#endif /* VC++ */ - -// recognize the MXF JPEG 2000 starting box -bool wxMXFHandler::DoCanRead( wxInputStream& stream ) -{ - unsigned char hdr[4]; - - if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) - return false; - - return (hdr[0] == 0x06 && - hdr[1] == 0x0E && - hdr[2] == 0x2B && - hdr[3] == 0x34); -} - -//! Build an EssenceInfoMap for the essence in a given file -/*! \return True if al OK, else false - */ -bool BuildEssenceInfo(MXFFilePtr &File, EssenceInfoMap &EssenceLookup) -{ - // Empty any old data - EssenceLookup.clear(); - - // Get the master metadata set (or the header if we must) - PartitionPtr MasterPartition = File->ReadMasterPartition(); - if(!MasterPartition) - { - File->Seek(0); - MasterPartition = File->ReadPartition(); - warning("File %s does not contain a cloased copy of header metadata - using the open copy in the file header\n", File->Name.c_str()); - } - - if(!MasterPartition) - { - error("Could not read header metadata from file %s\n", File->Name.c_str()); - return false; - } - - // Read and parse the metadata - MasterPartition->ReadMetadata(); - MetadataPtr HMeta = MasterPartition->ParseMetadata(); - - if(!HMeta) - { - error("Could not read header metadata from file %s\n", File->Name.c_str()); - return false; - } - - /* Scan the Essence container data sets to get PackageID to BodySID mapping */ - MDObjectPtr ECDSet = HMeta[ContentStorage_UL]; - if(ECDSet) ECDSet = ECDSet->GetLink(); - if(ECDSet) ECDSet = ECDSet[EssenceContainerDataBatch_UL]; - if(!ECDSet) - { - error("Header metadata in file %s does not contain an EssenceContainerData set\n", File->Name.c_str()); - return false; - } - - MDObject::iterator it = ECDSet->begin(); - while(it != ECDSet->end()) - { - MDObjectPtr ThisECDSet = (*it).second->GetLink(); - MDObjectPtr PackageID; - if(ThisECDSet) PackageID = ThisECDSet->Child(LinkedPackageUID_UL); - if(PackageID) - { - EssenceInfo NewEI; - NewEI.PackageID = new UMID(PackageID->PutData()->Data); - - // Inset the basic essence info - but not if this is external essence (BodySID == 0) - UInt32 BodySID = ThisECDSet->GetUInt(BodySID_UL); - if(BodySID) EssenceLookup[BodySID] = NewEI; - } - it++; - } - - /* Now find the other items for the essence lookup map */ - if(EssenceLookup.size()) - { - PackageList::iterator it = HMeta->Packages.begin(); - while(it != HMeta->Packages.end()) - { - // Only Source Packages are of interest - if((*it)->IsA(SourcePackage_UL)) - { - MDObjectPtr Descriptor = (*it)->Child(Descriptor_UL); - if(Descriptor) Descriptor = Descriptor->GetLink(); - - if(Descriptor) - { - MDObjectPtr PackageID = (*it)->Child(PackageUID_UL); - if(PackageID) - { - UMIDPtr TheID = new UMID(PackageID->PutData()->Data); - - /* Now do a lookup in the essence lookup map (it will need to be done the long way here */ - EssenceInfoMap::iterator EL_it = EssenceLookup.begin(); - while(EL_it != EssenceLookup.end()) - { - if((*((*EL_it).second.PackageID)) == (*TheID)) - { - // If found, set the missing items and stop searching - (*EL_it).second.Package = (*it); - (*EL_it).second.Descriptor = Descriptor; - break; - } - EL_it++; - } - } - } - } - - it++; - } - } - - return true; -} - - -#endif // wxUSE_STREAMS - -#endif // wxUSE_LIBOPENJPEG - -#endif // USE_MXF - diff --git a/OPJViewer/source/imagmxf.h b/OPJViewer/source/imagmxf.h deleted file mode 100644 index c87a4cb4..00000000 --- a/OPJViewer/source/imagmxf.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -///////////////////////////////////////////////////////////////////////////// -// Name: imagmxf.h -// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler -// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik -// RCS-ID: $Id: imagmj2.h,v 0.0 2007/11/19 17:00:00 VZ Exp $ -// Copyright: (c) Giuseppe Baruffa -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGMXF_H_ -#define _WX_IMAGMXF_H_ - -#ifdef USE_MXF - -#include "wx/defs.h" -#include "wx/filename.h" - -//----------------------------------------------------------------------------- -// wxMXFHandler -//----------------------------------------------------------------------------- - -#if wxUSE_LIBOPENJPEG - -#include "wx/image.h" -#include "libopenjpeg/openjpeg.h" - -#define wxBITMAP_TYPE_MXF 51 - -class WXDLLEXPORT wxMXFHandler: public wxImageHandler -{ -public: - inline wxMXFHandler() - { - m_name = wxT("MXF JPEG 2000 file format"); - m_extension = wxT("mxf"); - m_type = wxBITMAP_TYPE_MXF; - m_mime = wxT("image/mxf"); - - m_reducefactor = 0; - m_qualitylayers = 0; - m_components = 0; - m_filename = wxT(""); -#ifdef USE_JPWL - m_enablejpwl = true; - m_expcomps = JPWL_EXPECTED_COMPONENTS; - m_maxtiles = JPWL_MAXIMUM_TILES; -#endif // USE_JPWL - } - - // decoding engine parameters - int m_reducefactor, m_qualitylayers, m_components, m_framenum; - wxFileName m_filename; -#ifdef USE_JPWL - bool m_enablejpwl; - int m_expcomps, m_maxtiles; -#endif // USE_JPWL - -#if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); -protected: - virtual bool DoCanRead( wxInputStream& stream ); -#endif - -private: - DECLARE_DYNAMIC_CLASS(wxMXFHandler) -}; - -#endif // wxUSE_LIBOPENJPEG - -#endif // USE_MXF - -#endif // _WX_IMAGMXF_H_ - diff --git a/OPJViewer/source/license.txt b/OPJViewer/source/license.txt deleted file mode 100644 index 81d6b349..00000000 --- a/OPJViewer/source/license.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium -Copyright (c) 2002-2007, Professor Benoit Macq -Copyright (c) 2001-2003, David Janssens -Copyright (c) 2002-2003, Yannick Verschueren -Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe -Copyright (c) 2005, Herve Drolon, FreeImage Team -Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met: -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/OPJViewer/source/opj_logo.xpm b/OPJViewer/source/opj_logo.xpm deleted file mode 100644 index c64d0a7b..00000000 --- a/OPJViewer/source/opj_logo.xpm +++ /dev/null @@ -1,285 +0,0 @@ -/* XPM */ -static char *opj_logo[] = { -/* columns rows colors chars-per-pixel */ -"90 61 218 2", -" c #BE3D12", -". c #BF461D", -"X c #AD5435", -"o c #B64925", -"O c #B54E2B", -"+ c #BC4620", -"@ c #BB4B25", -"# c #BC4E29", -"$ c #B5502F", -"% c #BD512C", -"& c #B45334", -"* c #B35638", -"= c #B45B3D", -"- c #BB5533", -"; c #BE5937", -": c #BC5C3D", -"> c #9C766A", -", c #AD5D42", -"< c #B55F41", -"1 c #BA5E40", -"2 c #A7634D", -"3 c #A76C57", -"4 c #AA6750", -"5 c #AC6B56", -"6 c #AA6E5A", -"7 c #A4705E", -"8 c #B46045", -"9 c #B1644B", -"0 c #BD6244", -"q c #B96448", -"w c #BC694D", -"e c #B36B53", -"r c #B26E58", -"t c #BB6C52", -"y c #B2725D", -"u c #BD7056", -"i c #BB745C", -"p c #A67566", -"a c #A57B6D", -"s c #AE7562", -"d c #AB7867", -"f c #AA7C6C", -"g c #A07E73", -"h c #AA7F71", -"j c #B37661", -"k c #B47863", -"l c #B27D6B", -"z c #BB7863", -"x c #BA7E69", -"c c #C73605", -"v c #C63A0B", -"b c #CB3300", -"n c #CA3807", -"m c #C93A0A", -"M c #C43E11", -"N c #C93E10", -"B c #C44115", -"V c #C3441A", -"C c #C4481E", -"Z c #CA4113", -"A c #C94519", -"S c #CB481C", -"D c #C24A23", -"F c #C24F28", -"G c #CD4D23", -"H c #C4522D", -"J c #CB532B", -"K c #C25632", -"L c #C35936", -"P c #C25C3B", -"I c #C85630", -"U c #CB5933", -"Y c #CB5E3A", -"T c #D05026", -"R c #CC613D", -"E c #C26343", -"W c #C46748", -"Q c #C1694C", -"! c #CD6744", -"~ c #CA6C4D", -"^ c #C37155", -"/ c #C4755B", -"( c #CB7356", -") c #C8765B", -"_ c #D06D4C", -"` c #D07253", -"' c #D47B5E", -"] c #C37B63", -"[ c #C27E68", -"{ c #C97F68", -"} c #A68175", -"| c #A48479", -" . c #AD8172", -".. c #AD8578", -"X. c #AB897D", -"o. c #B1806F", -"O. c #BA816F", -"+. c #B38373", -"@. c #B58778", -"#. c #B3897B", -"$. c #BA8472", -"%. c #BB8C7C", -"&. c #C2816B", -"*. c #CD846C", -"=. c #C38470", -"-. c #C38976", -";. c #C38D7B", -":. c #CC8973", -">. c #CF8F7A", -",. c #CB907D", -"<. c #D1937F", -"1. c #948E8C", -"2. c #9D8C86", -"3. c #9D8F89", -"4. c #96908E", -"5. c #9C918D", -"6. c #949392", -"7. c #9B9492", -"8. c #9D9997", -"9. c #9D9C9C", -"0. c #A38B83", -"q. c #AA8D83", -"w. c #A4918B", -"e. c #AC9087", -"r. c #AB938C", -"t. c #A49590", -"y. c #A29996", -"u. c #A19D9C", -"i. c #AA9790", -"p. c #AC9994", -"a. c #AC9E99", -"s. c #B18D81", -"d. c #B59084", -"f. c #B49389", -"g. c #BA9184", -"h. c #B89589", -"j. c #BA988D", -"k. c #B29B93", -"l. c #BC9C92", -"z. c #ACA19D", -"x. c #B1A19D", -"c. c #BCA39B", -"v. c #A3A3A3", -"b. c #ABA5A3", -"n. c #AEA9A7", -"m. c #ABABAA", -"M. c #B3A5A1", -"N. c #B3A9A6", -"B. c #B3ADAA", -"V. c #B9A6A0", -"C. c #B9AAA5", -"Z. c #BAADA9", -"A. c #B4B0AF", -"S. c #BAB0AD", -"D. c #B4B3B3", -"F. c #BAB5B3", -"G. c #BDB8B6", -"H. c #BBBBBB", -"J. c #C39384", -"K. c #C0978A", -"L. c #C2998B", -"P. c #CA9483", -"I. c #CD9A8A", -"U. c #C19D92", -"Y. c #D69B89", -"T. c #DB9680", -"R. c #C2A095", -"E. c #C4A69C", -"W. c #CCA193", -"Q. c #C8A599", -"!. c #CBA99D", -"~. c #C6AEA6", -"^. c #CCACA2", -"/. c #CBB2AB", -"(. c #C3B8B5", -"). c #C2BDBC", -"_. c #C9B9B3", -"`. c #D3ADA0", -"'. c #D3B4A9", -"]. c #DCB2A4", -"[. c #DEB6A8", -"{. c #D1BFB9", -"}. c #D9BEB5", -"|. c #C5C0BE", -" X c #CDC0BC", -".X c #D2C1BB", -"XX c #DDC3BB", -"oX c #E0C5BC", -"OX c #E0C8BF", -"+X c #C2C2C2", -"@X c #CBC4C2", -"#X c #CDC8C6", -"$X c #CCCBCB", -"%X c #D2C6C2", -"&X c #D1CECD", -"*X c #DDC8C1", -"=X c #DECFCA", -"-X c #D9D1CE", -";X c #D3D3D3", -":X c #D9D5D4", -">X c #DED9D7", -",X c #DBDBDB", -".;X0XwXwXwXwXrXwXwXrXrXrXrXtXrXtXrXrXrXwXrXrXrXrXrXrXrXrXrXrXrXwXrXrXwXrXrXrXtXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXrXrXrX0X,X'.S b b P l.z.M.k.w n b b g.;X,X,X,X0X0X0X0X0XwXwXwXwXwXwXwXwXwX0X0X0XwX0X0XwXwXwXwX0X0X0X0X0X0XwXwXwXwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXrXrXrXwX0X:XT.m b A ] G.D.D.m.$.m b b $.$X&X.X}.XX>XOX}.oXXX c b @ 9.v.9.u., b b - 3.& b b 7 1.1.4.4.4.6.7.9.w.m b + t.v.m.p.D b b K.;X,X0XwXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXwX0X,X$X-.b b b i D.H.G.H.J.N b b = 9.9.5 c b B 7.9.v.y.b b m f 4.O b b 3 6.6.6.g 9 4 h u.h b b - b.m.m.s.b b N ~.;X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXwX0X,X;XE.G b b I z ] ] ] W n b H l 9.8.9 b b m e 6 r e b b # 0.y.< b b O 6 p 6 < # ; q.v.t b b 0 n.A.A.+.b b H _.;X,XwXwXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXwXwX,X;X#Xf.b b b b b b b b b - a.v.v.w.@ b b v b b b b b @ b.m.v.w.M b b b b b b v ..m.n.A b n g.H.H.H.4 b b [ &X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXwXwX0X:X$XZ.Q H v n b m B H E x n.m.m.q.B b v < . v N + E z m.m.m.b.e - M m v M - t k.D.m.; # - V.H.+XH.s # # K.:X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXrXwXwX,X,X$X+XG.Z.Z.B.C.S.F.H.H.H.D.D.j b b q v.b.a.n.B.H.H.+X+X+XH.H.D.Z.C.Z.Z.F.H.H.+X+XH.).H.$X&X&X;X$X#X#X:X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXrXrXwX0X,X;X#X+X+X+XH.H.+X+X+XH.H.H.D.e b n i n.m.D.H.H.+X#X$X$X+X+X+X+XH.H.H.H.+X+X+X$X&X&X&X$X;X;X;X:X;X:X,X,X0XwXwXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXrXrXwXwX,X,X;X;X$X$X$X;X;X&X;X$X#X+XF b v s.H.H.+X$X&X;X;X,X,X,X;X:X;X;X;X;X;X;X:X,X,X,X0X,X0X,X0X0X0X0X0X0X0XwXwXrXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXrXtXrXwXwX0X,X:X;X;X;X;X;X:X;X;X;X$X+XC b B k.+X+X$X$X;X,X,X0X0X0X0X0X;X,X,X,X,X,X,X,X,X0X0X0X0X0X0XwX0X0X0XwXwXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXtXrXrXrXrXwXwXwX0X0X0X0X0X0X0X,X,X:X^.^.!.$X$X;X,X,X0XwXwXwXwXwXwXwXwX0X0X0X0XwXwXwXwXwXwXrXrXwXrXrXrXrXrXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXtXtXrXrXrXrXwXwXwXwX0XwXwXwX0X0X,X:X;X$X&X&X;X,X,X0XwXwXwXrXrXrXrXrXwXwXwXwXwXwXwXrXrXrXwXrXrXrXrXrXrXrXrXrXrXtXrXtXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXrXrXrXrXrXrXrXrXrXwXwXwXwX0X,X0X0X0XwXwXrXrXrXrXrXrXrXrXrXrXrXrXrXrXwXrXrXrXrXrXtXrXrXrXtXrXrXrXrXrXrXrXrXrXtXtXtXrXrXtXtXtXtXrXrXtXrXrXtXrXtXrXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXrXtXtXrXtXrXrXrXrXrXrXwXwXwX0XwX0XwXwXwXrXrXrXtXtXrXrXrXrXrXrXrXrXwXrXwXrXwXwXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXtXrXrXtXtXrXrXrXrXrXrXrXrXrXrXtXtXtXtXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXwXrXrXrXrXrXrXtXrXtXrXrXrXrXrXwXwXwXwXwX0X0XwX0XwXwXwXwXwXwXwXrXwXwXwX0X0X0X0XwX0XwXwXrXrXrXwXrXwXwXwX0XwX0XwXwXwXrXrXrXrXtXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXrXrXrXrXtXtXrXrXtXrXrXeX7X7X9XwXwXwX5X3X3X3X2X2X2X5X0XwXwXwXwXwX8X3X3X2X2X2X2X2X3X6X6X7XwXwXwXwXwXwX7X1XXXOXOX1X8XwXwXrXrXrXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXtXtXrXrXrXwXT.T T :.,X,X-X` G G G G G G U _ J.-X,X,X,X[ G G G G G G G G G G _ >XwX0X,X&XI.R N b b b m ! `.5XwXrXrXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXtXtXrXtXrXrXrXwX0X' b b ] >X,X%XJ b b b b b b b b Q {.:X;X:Xq b b b b b b b b b b Y >X0X,X-X'.^ n b b b b b m *.1XwXwXrXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrX0X0X%XL b b L.@X+X-.b b M L L L D b b b M V.+X(.N b b D H H H H H U U W.;X&X^.H b b n W -.-.W n b b J &XwXrXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX0X XF b b U.+X+X[ b b D z z j P v b b N U.H.S.m b m E Q t ^ ) / ) ) /.$X$X;.m b n A %.H.H.J.N b b N .XwXwXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX,X:X!.m b L N.D.m.* b b y v.v.v.v.p.n b M f.m.w b b D u.v.m.m.D.G.H.H.+X).g.b b B j.F.D.D.D.D.l.; F I /.0XwXrXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwX,X:XU.n b E B.A.n.$ b b s v.9.v.v.r.n n M r.b.1 b b D u.v.m.m.D.D.H.H.).H.k b b # M.G.D.D.D.D.Z.t w u _.0XwXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwXwX,X;X$XJ b m h b.v.i.m b M a 5.5.2.p M b c < 8.2.+ b b M o o o o # % j G.H.g.m b A M.D.D.D.B.M.M.M.M.Z.(.:X0XwXrXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXrXwX,X,X&X(.n b M 0.v.v.s b b b b b n b b c b M u.v.g M b b b b b b b b b i G.D.0 b b 8 D.D.H.G.P n b b n b U :X,XwXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXwX0X,X;X$XV.n b M w.v.9.< b b b b b b b b c H r 9.v.a n b * < < w w Q Q g.D.B.: b b r D.D.D.m.C b b b b b ) ;X0XwXrXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrX6XP.=.K.;X#X+Xx n b D v.u.7.. b b M D . D & 2 q.b.b.v.v.< b b X 6.9.9.b.m.D.D.D.D.n.# b b f D.D.D.b.= 1 * N b n !.;X,XwXtXtXtXtXtX", -"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXrXwX stopbyte, inner_length + marker/box sign length (total length) -| |_ Additional info, depending on the marker/box type -| |_ ... -| -|_ #001: Marker/Box short name (Hex code) -| | -| |_ ... -| -... - - -The viewing pane will display the decoded image contained in the JPEG 2000 file. -It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working. - - -The log/peek pane is shared among two different subpanels: - -- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library -- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section. - diff --git a/OPJViewer/source/readmebefore.txt b/OPJViewer/source/readmebefore.txt deleted file mode 100644 index c5e1ed87..00000000 --- a/OPJViewer/source/readmebefore.txt +++ /dev/null @@ -1,11 +0,0 @@ -What is OpenJPEG ? -================== -The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ... - -Who can use the library ? -========================= -Anybody. As the OpenJPEG library is released under the BSD license, anybody can use or modify the library, even for commercial applications. The only restriction is to retain the copyright in the sources or the binaries documentation. - -Who is developing the library ? -=============================== -The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly. \ No newline at end of file diff --git a/OPJViewer/source/wxj2kparser.cpp b/OPJViewer/source/wxj2kparser.cpp deleted file mode 100644 index 600fd65e..00000000 --- a/OPJViewer/source/wxj2kparser.cpp +++ /dev/null @@ -1,1465 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "OPJViewer.h" - -/* From little endian to big endian, 2 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) - -/* From codestream to int values */ -#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \ - ((unsigned long int) (C)[(P) + 1] << 16) + \ - ((unsigned long int) (C)[(P) + 2] << 8) + \ - ((unsigned long int) (C)[(P) + 3] << 0)) - -#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \ - ((unsigned long int) (C)[(P) + 1] << 0)) - - -/* Markers values */ -#define J2KMARK_NUM 24 -enum { - SOC_VAL = 0xFF4F, - SOT_VAL = 0xFF90, - SOD_VAL = 0xFF93, - EOC_VAL = 0xFFD9, - SIZ_VAL = 0xFF51, - COD_VAL = 0xFF52, - COC_VAL = 0xFF53, - RGN_VAL = 0xFF5E, - QCD_VAL = 0xFF5C, - QCC_VAL = 0xFF5D, - POD_VAL = 0xFF5F, - TLM_VAL = 0xFF55, - PLM_VAL = 0xFF57, - PLT_VAL = 0xFF58, - PPM_VAL = 0xFF60, - PPT_VAL = 0xFF61, - SOP_VAL = 0xFF91, - EPH_VAL = 0xFF92, - COM_VAL = 0xFF64 -#ifdef USE_JPWL - , EPB_VAL = 0xFF66, - ESD_VAL = 0xFF67, - EPC_VAL = 0xFF68, - RED_VAL = 0xFF69 - /*, EPB_VAL = 0xFF96, - ESD_VAL = 0xFF98, - EPC_VAL = 0xFF97, - RED_VAL = 0xFF99*/ -#endif // USE_JPWL -#ifdef USE_JPSEC - , SEC_VAL = 0xFF65 -#endif // USE_JPSEC -}; - -// All the markers in one vector -unsigned short int marker_val[] = { - SOC_VAL, SOT_VAL, SOD_VAL, EOC_VAL, - SIZ_VAL, - COD_VAL, COC_VAL, RGN_VAL, QCD_VAL, QCC_VAL, POD_VAL, - TLM_VAL, PLM_VAL, PLT_VAL, PPM_VAL, PPT_VAL, - SOP_VAL, EPH_VAL, - COM_VAL -#ifdef USE_JPWL - , EPB_VAL, ESD_VAL, EPC_VAL, RED_VAL -#endif // USE_JPWL -#ifdef USE_JPSEC - , SEC_VAL -#endif // USE_JPSEC -}; - -// Marker names -char *marker_name[] = { - "SOC", "SOT", "SOD", "EOC", - "SIZ", - "COD", "COC", "RGN", "QCD", "QCC", "POD", - "TLM", "PLM", "PLT", "PPM", "PPT", - "SOP", "EPH", - "COM" -#ifdef USE_JPWL - , "EPB", "ESD", "EPC", "RED" -#endif // USE_JPWL -#ifdef USE_JPSEC - , "SEC" -#endif // USE_JPSEC -}; - -// Marker descriptions -char *marker_descr[] = { - "Start of codestream", "Start of tile-part", "Start of data", "End of codestream", - "Image and tile size", - "Coding style default", "Coding style component", "Region-of-interest", "Quantization default", - "Quantization component", "Progression order change, default", - "Tile-part lengths, main header", "Packet length, main header", "Packets length, tile-part header", - "Packed packet headers, main header", "Packed packet headers, tile-part header", - "Start of packet", "End of packet header", - "Comment and extension" -#ifdef USE_JPWL - , "Error Protection Block", "Error Sensitivity Descriptor", "Error Protection Capability", - "Residual Errors Descriptor" -#endif // USE_JPWL -#ifdef USE_JPSEC - , "Main security marker" -#endif // USE_JPSEC -}; - -void OPJParseThread::ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid) -{ - unsigned short int csiz = 0; - - // check if the file is opened - if (m_file->IsOpened()) - WriteText(wxT("File OK")); - else - return; - - // position at the beginning - m_file->Seek(offset, wxFromStart); - - // navigate the file - int m, inside_sod = 0, inside_sop = 0; - int nmarks = 0, maxmarks = 10000; - unsigned char onebyte[1]; - unsigned char twobytes[2], firstbyte, secondbyte; - unsigned char fourbytes[4]; - unsigned short int currmark; - unsigned short int currlen; - int lastPsot = 0, lastsotpos = 0; - - WriteText(wxT("Start search...")); - -// advancing macro -#define OPJ_ADVANCE(A) {offset += A; if (offset < length) m_file->Seek(offset, wxFromStart); else return;} - - // begin search - while ((offset < length) && (!m_file->Eof())) { - - // read one byte - if (m_file->Read(&firstbyte, 1) != 1) - break; - - // look for 0xFF - if (firstbyte == 0xFF) { - - // it is a possible marker - if (m_file->Read(&secondbyte, 1) != 1) - break; - else - currmark = (((unsigned short int) firstbyte) << 8) + (unsigned short int) secondbyte; - - } else { - - // nope, advance by one and search again - OPJ_ADVANCE(1); - continue; - } - - // search the marker - for (m = 0; m < J2KMARK_NUM; m++) { - if (currmark == marker_val[m]) - break; - } - - // marker not found - if (m == J2KMARK_NUM) { - // nope, advance by one and search again - OPJ_ADVANCE(1); - continue; - } - - // if we are inside SOD, only some markers are allowed - if (inside_sod) { - - // we are inside SOP - if (inside_sop) { - - } - - // randomly marker coincident data - if ((currmark != SOT_VAL) && - (currmark != EOC_VAL) && - (currmark != SOP_VAL) && - (currmark != EPH_VAL)) { - OPJ_ADVANCE(1); - continue; - } - - // possible SOT? - if ((currmark == SOT_VAL)) { - // too early SOT - if (offset < (lastsotpos + lastPsot)) { - OPJ_ADVANCE(1); - continue; - } - // we were not in the last tile - /*if (lastPsot != 0) { - OPJ_ADVANCE(1); - break; - }*/ - } - } - - // beyond this point, the marker MUST BE real - - // length of current marker segment - if ((currmark == SOD_VAL) || - (currmark == SOC_VAL) || - (currmark == EOC_VAL) || - (currmark == EPH_VAL)) - - // zero length markers - currlen = 0; - - else { - - // read length field - if (m_file->Read(twobytes, 2) != 2) - break; - - currlen = (((unsigned short int) twobytes[0]) << 8) + (unsigned short int) twobytes[1]; - } - - // here we pass to AppendItem() normal and selected item images (we - // suppose that selected image follows the normal one in the enum) - int image, imageSel; - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - // append the marker - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("%03d: "), nmarks) + - wxString::FromAscii(marker_name[m]) + - wxString::Format(wxT(" (0x%04X)"), marker_val[m]), - image, imageSel, - new OPJMarkerData(wxT("MARK") + wxString::Format(wxT(" (%d)"), marker_val[m]), - m_tree->m_fname.GetFullPath(), offset, offset + currlen + 1) - ); - - // append some info - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - // marker name - wxTreeItemId subcurrid1 = m_tree->AppendItem(currid, - wxT("*** ") + wxString::FromAscii(marker_descr[m]) + wxT(" ***"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - m_tree->SetItemFont(subcurrid1, *wxITALIC_FONT); - - // position and length - wxTreeItemId subcurrid2 = m_tree->AppendItem(currid, - wxLongLong(offset).ToString() + wxT(" > ") + wxLongLong(offset + currlen + 1).ToString() + - wxT(", ") + wxString::Format(wxT("%d + 2 (%d)"), currlen, currlen + 2), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - // give additional info on markers - switch (currmark) { - - ///////// - // SOP // - ///////// - case SOP_VAL: - { - // read packet number - if (m_file->Read(twobytes, 2) != 2) - break; - int packnum = STREAM_TO_UINT16(twobytes, 0); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("Pack. no. %d"), packnum), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - inside_sop = 1; - }; - break; - -#ifdef USE_JPWL - ///////// - // RED // - ///////// - case RED_VAL: - { - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char pred = onebyte[0]; - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxString address[] = { - wxT("Packet addressing"), - wxT("Byte-range addressing"), - wxT("Packet-range addressing"), - wxT("Reserved") - }; - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - address[(pred & 0xC0) >> 6], - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("%d bytes range"), (((pred & 0x02) >> 1) + 1) * 2), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - pred & 0x01 ? wxT("Errors/erasures in codestream") : wxT("Error free codestream"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("Residual corruption level: %d"), (pred & 0x38) >> 3), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - ///////// - // ESD // - ///////// - case ESD_VAL: - { - unsigned short int cesd; - if (csiz < 257) { - if (m_file->Read(onebyte, 1) != 1) - break; - cesd = onebyte[0]; - } else { - if (m_file->Read(twobytes, 2) != 2) - break; - cesd = STREAM_TO_UINT16(twobytes, 0); - } - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char pesd = onebyte[0]; - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - pesd & 0x01 ? wxT("Comp. average") : wxString::Format(wxT("Comp. no. %d"), cesd), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - wxString meth[] = { - wxT("Relative error sensitivity"), - wxT("MSE"), - wxT("MSE reduction"), - wxT("PSNR"), - wxT("PSNR increase"), - wxT("MAXERR (absolute peak error)"), - wxT("TSE (total squared error)"), - wxT("Reserved") - }; - - subcurrid = m_tree->AppendItem(currid, - meth[(pesd & 0x38) >> 3], - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - wxString address[] = { - wxT("Packet addressing"), - wxT("Byte-range addressing"), - wxT("Packet-range addressing"), - wxT("Reserved") - }; - - subcurrid = m_tree->AppendItem(currid, - address[(pesd & 0xC0) >> 6], - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("%d bytes/value, %d bytes range"), ((pesd & 0x04) >> 2) + 1, (((pesd & 0x02) >> 1) + 1) * 2), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - ///////// - // EPC // - ///////// - case EPC_VAL: - { - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int pcrc = STREAM_TO_UINT16(twobytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int dl = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char pepc = onebyte[0]; - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("CRC-16 = 0x%x"), pcrc), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("Tot. length = %d"), dl), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("%s%s%s%s"), - pepc & 0x10 ? wxT("ESD, ") : wxT(""), - pepc & 0x20 ? wxT("RED, ") : wxT(""), - pepc & 0x40 ? wxT("EPB, ") : wxT(""), - pepc & 0x80 ? wxT("Info") : wxT("") - ), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - ///////// - // EPB // - ///////// - case EPB_VAL: - { - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char depb = onebyte[0]; - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int ldpepb = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int pepb = STREAM_TO_UINT32(fourbytes, 0); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("No. %d, %slatest, %spacked"), - depb & 0x3F, - depb & 0x40 ? wxT("") : wxT("not "), - depb & 0x80 ? wxT("") : wxT("un")), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("%d bytes protected"), ldpepb), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (pepb == 0x00000000) - - subcurrid = m_tree->AppendItem(currid, - wxT("Predefined codes"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - else if ((pepb >= 0x10000000) && (pepb <= 0x1FFFFFFF)) { - - wxString text = wxT("CRC code"); - if (pepb == 0x10000000) - text << wxT(", CCITT (X25) 16 bits"); - else if (pepb == 0x10000001) - text << wxT(", Ethernet 32 bits"); - else - text << wxT(", JPWL RA"); - subcurrid = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } else if ((pepb >= 0x20000000) && (pepb <= 0x2FFFFFFF)) { - - wxString text; - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("RS code, RS(%d, %d)"), - (pepb & 0x0000FF00) >> 8, - (pepb & 0x000000FF)), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } else if ((pepb >= 0x30000000) && (pepb <= 0x3FFFFFFE)) - - subcurrid = m_tree->AppendItem(currid, - wxT("JPWL RA"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - else if (pepb == 0xFFFFFFFF) - - subcurrid = m_tree->AppendItem(currid, - wxT("No method"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; -#endif // USE_JPWL - -#ifdef USE_JPSEC - case SEC_VAL: - { - - } - break; -#endif // USE_JPSEC - - ///////// - // SIZ // - ///////// - case SIZ_VAL: - { - int c; - - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int rsiz = STREAM_TO_UINT16(twobytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int xsiz = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int ysiz = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int xosiz = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int yosiz = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int xtsiz = STREAM_TO_UINT32(fourbytes, 0); - this->m_tree->m_childframe->m_twidth = xtsiz; - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int ytsiz = STREAM_TO_UINT32(fourbytes, 0); - this->m_tree->m_childframe->m_theight = ytsiz; - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int xtosiz = STREAM_TO_UINT32(fourbytes, 0); - this->m_tree->m_childframe->m_tx = xtosiz; - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int ytosiz = STREAM_TO_UINT32(fourbytes, 0); - this->m_tree->m_childframe->m_ty = ytosiz; - - if (m_file->Read(twobytes, 2) != 2) - break; - csiz = STREAM_TO_UINT16(twobytes, 0); - - bool equaldepth = true, equalsize = true; - unsigned char *ssiz = new unsigned char(csiz); - unsigned char *xrsiz = new unsigned char(csiz); - unsigned char *yrsiz = new unsigned char(csiz); - - for (c = 0; c < csiz; c++) { - - if (m_file->Read(&ssiz[c], 1) != 1) - break; - - if (c > 0) - equaldepth = equaldepth && (ssiz[c] == ssiz[c - 1]); - - if (m_file->Read(&xrsiz[c], 1) != 1) - break; - - if (m_file->Read(&yrsiz[c], 1) != 1) - break; - - if (c > 0) - equalsize = equalsize && (xrsiz[c] == xrsiz[c - 1]) && (yrsiz[c] == yrsiz[c - 1]) ; - - } - - if (equaldepth && equalsize) - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("I: %dx%d (%d, %d), %d c., %d%s bpp"), - xsiz, ysiz, - xosiz, yosiz, - csiz, ((ssiz[0] & 0x7F) + 1), - (ssiz[0] & 0x80) ? wxT("s") : wxT("u")), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - else - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("I: %dx%d (%d, %d), %d c."), - xsiz, ysiz, - xosiz, yosiz, - csiz), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("T: %dx%d (%d, %d)"), - xtsiz, ytsiz, - xtosiz, ytosiz), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - wxTreeItemId subcurrid4 = m_tree->AppendItem(currid, - wxT("Components"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - for (c = 0; c < csiz; c++) { - - wxTreeItemId subcurrid5 = m_tree->AppendItem(subcurrid4, - wxString::Format(wxT("#%d: %dx%d, %d%s bpp"), - c, - xsiz/xrsiz[c], ysiz/yrsiz[c], - ((ssiz[c] & 0x7F) + 1), - (ssiz[c] & 0x80) ? wxT("s") : wxT("u")), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - - }; - break; - - ///////// - // SOT // - ///////// - case SOT_VAL: - { - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int isot = STREAM_TO_UINT16(twobytes, 0); - - if (m_file->Read(fourbytes, 4) != 4) - break; - unsigned long int psot = STREAM_TO_UINT32(fourbytes, 0); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char tpsot = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char tnsot = onebyte[0]; - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("tile %d, psot = %d, part %d of %d"), isot, psot, tpsot, tnsot), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - lastPsot = psot; - lastsotpos = offset; - inside_sod = 0; - }; - break; - - ///////// - // COC // - ///////// - case COC_VAL: - { - unsigned short int ccoc; - if (csiz < 257) { - if (m_file->Read(onebyte, 1) != 1) - break; - ccoc = onebyte[0]; - } else { - if (m_file->Read(twobytes, 2) != 2) - break; - ccoc = STREAM_TO_UINT16(twobytes, 0); - } - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char scoc = onebyte[0]; - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("Comp. no. %d"), ccoc), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - wxString text; - if (scoc & 0x01) - text << wxT("Partitioned entropy coder"); - else - text << wxT("Unpartitioned entropy coder"); - - subcurrid = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char decomplevs = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbswidth = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbsheight = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbstyle = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char transform = onebyte[0]; - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("%d levels (%d resolutions)"), decomplevs, decomplevs + 1), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (transform & 0x01) - text = wxT("5-3 reversible wavelet"); - else - text = wxT("9-7 irreversible wavelet"); - subcurrid = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("Code-blocks: %dx%d"), 1 << ((cbswidth & 0x0F) + 2), 1 << ((cbsheight & 0x0F) + 2)), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxT("Coding styles"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - if (cbstyle & 0x01) - text = wxT("Selective arithmetic coding bypass"); - else - text = wxT("No selective arithmetic coding bypass"); - wxTreeItemId subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x02) - text = wxT("Reset context probabilities on coding pass boundaries"); - else - text = wxT("No reset of context probabilities on coding pass boundaries"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x04) - text = wxT("Termination on each coding passs"); - else - text = wxT("No termination on each coding pass"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x08) - text = wxT("Vertically stripe causal context"); - else - text = wxT("No vertically stripe causal context"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x10) - text = wxT("Predictable termination"); - else - text = wxT("No predictable termination"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x20) - text = wxT("Segmentation symbols are used"); - else - text = wxT("No segmentation symbols are used"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - ///////// - // COD // - ///////// - case COD_VAL: - { - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char scod = onebyte[0]; - - wxString text; - - if (scod & 0x01) - text << wxT("Partitioned entropy coder"); - else - text << wxT("Unpartitioned entropy coder"); - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - text = wxT(""); - if (scod & 0x02) - text << wxT("Possible SOPs"); - else - text << wxT("No SOPs"); - - if (scod & 0x04) - text << wxT(", possible EPHs"); - else - text << wxT(", no EPHs"); - - subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char progord = onebyte[0]; - - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int numlayers = STREAM_TO_UINT16(twobytes, 0); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char mctransform = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char decomplevs = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbswidth = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbsheight = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char cbstyle = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char transform = onebyte[0]; - - subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("%d levels (%d resolutions)"), decomplevs, decomplevs + 1), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - text = wxT(""); - switch (progord) { - case (0): - text << wxT("LRCP"); - break; - case (1): - text << wxT("RLCP"); - break; - case (2): - text << wxT("LRCP"); - break; - case (3): - text << wxT("RPCL"); - break; - case (4): - text << wxT("CPRL"); - break; - default: - text << wxT("unknown progression"); - break; - } - text << wxString::Format(wxT(", %d layers"), numlayers); - if (transform & 0x01) - text << wxT(", 5-3 rev."); - else - text << wxT(", 9-7 irr."); - subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("Code-blocks: %dx%d"), 1 << ((cbswidth & 0x0F) + 2), 1 << ((cbsheight & 0x0F) + 2)), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - switch (mctransform) { - case (0): - { - text = wxT("No MCT"); - } - break; - case (1): - { - text = wxT("Reversible MCT on 0, 1, 2"); - } - break; - case (2): - { - text = wxT("Irreversible MCT on 0, 1, 2"); - } - break; - default: - { - text = wxT("Unknown"); - } - break; - }; - subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - subcurrid3 = m_tree->AppendItem(currid, - wxT("Coding styles"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - if (cbstyle & 0x01) - text = wxT("Selective arithmetic coding bypass"); - else - text = wxT("No selective arithmetic coding bypass"); - wxTreeItemId subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x02) - text = wxT("Reset context probabilities on coding pass boundaries"); - else - text = wxT("No reset of context probabilities on coding pass boundaries"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x04) - text = wxT("Termination on each coding passs"); - else - text = wxT("No termination on each coding pass"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x08) - text = wxT("Vertically stripe causal context"); - else - text = wxT("No vertically stripe causal context"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x10) - text = wxT("Predictable termination"); - else - text = wxT("No predictable termination"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (cbstyle & 0x20) - text = wxT("Segmentation symbols are used"); - else - text = wxT("No segmentation symbols are used"); - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - }; - break; - - ///////// - // QCC // - ///////// - case QCC_VAL: - { - unsigned short int cqcc; - if (csiz < 257) { - if (m_file->Read(onebyte, 1) != 1) - break; - cqcc = onebyte[0]; - } else { - if (m_file->Read(twobytes, 2) != 2) - break; - cqcc = STREAM_TO_UINT16(twobytes, 0); - } - - wxTreeItemId subcurrid = m_tree->AppendItem(currid, - wxString::Format(wxT("Comp. no. %d"), cqcc), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char sqcc = onebyte[0]; - - wxString text; - switch (sqcc & 0x1F) { - case (0): - text = wxT("No quantization"); - break; - case (1): - text = wxT("Scalar implicit"); - break; - case (2): - text = wxT("Scalar explicit"); - break; - default: - text = wxT("Unknown"); - break; - } - text << wxString::Format(wxT(", %d guard bits"), (sqcc & 0xE0) >> 5); - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - ///////// - // QCD // - ///////// - case QCD_VAL: - { - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char sqcd = onebyte[0]; - - wxString text; - switch (sqcd & 0x1F) { - case (0): - text = wxT("No quantization"); - break; - case (1): - text = wxT("Scalar implicit"); - break; - case (2): - text = wxT("Scalar explicit"); - break; - default: - text = wxT("Unknown"); - break; - } - text << wxString::Format(wxT(", %d guard bits"), (sqcd & 0xE0) >> 5); - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - }; - break; - - ///////// - // COM // - ///////// - case COM_VAL: - { - #define showlen 25 - char comment[showlen]; - wxString comments; - - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int rcom = STREAM_TO_UINT16(twobytes, 0); - - wxString text; - if (rcom == 0) - text = wxT("Binary values"); - else if (rcom == 1) - text = wxT("ISO 8859-1 (latin-1) values"); - else if (rcom < 65535) - text = wxT("Reserved for registration"); - else - text = wxT("Reserved for extension"); - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (m_file->Read(comment, showlen) != showlen) - break; - comments = wxString::FromAscii(comment).Truncate(wxMin(showlen, currlen - 4)); - if ((currlen - 4) > showlen) - comments << wxT("..."); - subcurrid3 = m_tree->AppendItem(currid, - comments, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - }; - break; - - ///////// - // TLM // - ///////// - case TLM_VAL: - { - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char ztlm = onebyte[0]; - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char stlm = onebyte[0]; - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("TLM #%d"), ztlm), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("%d bits/index, %d bits/length"), - 8 * ((stlm & 0x30) >> 4), 16 + 16 * ((stlm & 0x40) >> 6)), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - int n, numparts; - - numparts = (currlen - 2) / ( ((stlm & 0x30) >> 4) + 2 + 2 * ((stlm & 0x40) >> 6)); - - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - subcurrid3 = m_tree->AppendItem(currid, - wxT("Tile parts"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - for (n = 0; n < numparts; n++) { - - unsigned short int ttlm; - unsigned long int ptlm; - - switch (((stlm & 0x30) >> 4)) { - - case 0: - ttlm = 0; - break; - - case 1: - if (m_file->Read(onebyte, 1) != 1) - break; - ttlm = onebyte[0]; - break; - - case 2: - if (m_file->Read(twobytes, 2) != 2) - break; - ttlm = STREAM_TO_UINT16(twobytes, 0); - break; - - } - - switch (((stlm & 0x40) >> 6)) { - - case 0: - if (m_file->Read(twobytes, 2) != 2) - break; - ptlm = STREAM_TO_UINT16(twobytes, 0); - break; - - case 1: - if (m_file->Read(fourbytes, 4) != 4) - break; - ptlm = STREAM_TO_UINT32(fourbytes, 0); - break; - - } - - wxTreeItemId subcurrid4 = m_tree->AppendItem(subcurrid3, - wxString::Format(wxT("Tile %d: %d bytes"), ttlm, ptlm), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - } - - } - break; - - ///////// - // POD // - ///////// - case POD_VAL: - { - int n, numchanges; - - if (csiz < 257) - numchanges = (currlen - 2) / 7; - else - numchanges = (currlen - 2) / 9; - - for (n = 0; n < numchanges; n++) { - - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - - wxTreeItemId subcurrid3 = m_tree->AppendItem(currid, - wxString::Format(wxT("Change #%d"), n), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char rspod = onebyte[0]; - - unsigned short int cspod; - if (csiz < 257) { - if (m_file->Read(onebyte, 1) != 1) - break; - cspod = onebyte[0]; - } else { - if (m_file->Read(twobytes, 2) != 2) - break; - cspod = STREAM_TO_UINT16(twobytes, 0); - } - - if (m_file->Read(twobytes, 2) != 2) - break; - unsigned short int lyepod = STREAM_TO_UINT16(twobytes, 0); - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char repod = onebyte[0]; - - unsigned short int cepod; - if (csiz < 257) { - if (m_file->Read(onebyte, 1) != 1) - break; - cepod = onebyte[0]; - } else { - if (m_file->Read(twobytes, 2) != 2) - break; - cepod = STREAM_TO_UINT16(twobytes, 0); - } - - if (m_file->Read(onebyte, 1) != 1) - break; - unsigned char ppod = onebyte[0]; - - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - wxTreeItemId subcurrid4 = m_tree->AppendItem(subcurrid3, - wxString::Format(wxT("%d <= Resolution < %d"), rspod, repod), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid4 = m_tree->AppendItem(subcurrid3, - wxString::Format(wxT("%d <= Component < %d"), cspod, cepod), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - subcurrid4 = m_tree->AppendItem(subcurrid3, - wxString::Format(wxT("0 <= Layer < %d"), lyepod), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - wxString text = wxT(""); - switch (ppod) { - case (0): - text << wxT("LRCP"); - break; - case (1): - text << wxT("RLCP"); - break; - case (2): - text << wxT("LRCP"); - break; - case (3): - text << wxT("RPCL"); - break; - case (4): - text << wxT("CPRL"); - break; - default: - text << wxT("unknown progression"); - break; - } - subcurrid4 = m_tree->AppendItem(subcurrid3, - text, - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - } - - } - break; - - ///////// - // SOD // - ///////// - case SOD_VAL: - { - inside_sod = 1; - }; - break; - - default: - break; - - } - - // increment number of markers - if (nmarks++ >= maxmarks) { - WriteText(wxT("Maximum amount of markers exceeded")); - break; - } - - // advance position - OPJ_ADVANCE(currlen + 2); - } - - WriteText(wxT("Search finished")); -} diff --git a/OPJViewer/source/wxjp2parser.cpp b/OPJViewer/source/wxjp2parser.cpp deleted file mode 100644 index 6e89390a..00000000 --- a/OPJViewer/source/wxjp2parser.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/* - * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "OPJViewer.h" - -/* defines */ -#define SHORT_DESCR_LEN 32 -#define LONG_DESCR_LEN 256 - -/* enumeration for file formats */ -#define J2FILENUM 4 -typedef enum { - - JP2_FILE, - J2K_FILE, - MJ2_FILE, - UNK_FILE - -} j2filetype; - -/* enumeration for the box types */ -#define j22boxNUM 23 -typedef enum { - - FILE_BOX, - JP_BOX, - FTYP_BOX, - JP2H_BOX, - IHDR_BOX, - COLR_BOX, - JP2C_BOX, - JP2I_BOX, - XML_BOX, - UUID_BOX, - UINF_BOX, - MOOV_BOX, - MVHD_BOX, - TRAK_BOX, - TKHD_BOX, - MDIA_BOX, - MDHD_BOX, - HDLR_BOX, - MINF_BOX, - VMHD_BOX, - STBL_BOX, - STSD_BOX, - STSZ_BOX, - MJP2_BOX, - MDAT_BOX, - ANY_BOX, - UNK_BOX - -} j22boxtype; - -/* the box structure itself */ -struct boxdef { - - char value[5]; /* hexadecimal value/string*/ - char name[SHORT_DESCR_LEN]; /* short description */ - char descr[LONG_DESCR_LEN]; /* long description */ - int sbox; /* is it a superbox? */ - int req[J2FILENUM]; /* mandatory box */ - j22boxtype ins; /* contained in box... */ - -}; - - -/* jp2 family box signatures */ -#define FILE_SIGN "" -#define JP_SIGN "jP\040\040" -#define FTYP_SIGN "ftyp" -#define JP2H_SIGN "jp2h" -#define IHDR_SIGN "ihdr" -#define COLR_SIGN "colr" -#define JP2C_SIGN "jp2c" -#define JP2I_SIGN "jp2i" -#define XML_SIGN "xml\040" -#define UUID_SIGN "uuid" -#define UINF_SIGN "uinf" -#define MOOV_SIGN "moov" -#define MVHD_SIGN "mvhd" -#define TRAK_SIGN "trak" -#define TKHD_SIGN "tkhd" -#define MDIA_SIGN "mdia" -#define MDHD_SIGN "mdhd" -#define HDLR_SIGN "hdlr" -#define MINF_SIGN "minf" -#define VMHD_SIGN "vmhd" -#define STBL_SIGN "stbl" -#define STSD_SIGN "stsd" -#define STSZ_SIGN "stsz" -#define MJP2_SIGN "mjp2" -#define MDAT_SIGN "mdat" -#define ANY_SIGN "" -#define UNK_SIGN "" - -/* the possible boxes */ -struct boxdef j22box[] = -{ -/* sign */ {FILE_SIGN, -/* short */ "placeholder for nothing", -/* long */ "Nothing to say", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP_SIGN, -/* short */ "JPEG 2000 Signature box", -/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {FTYP_SIGN, -/* short */ "File Type box", -/* long */ "This box specifies file type, version and compatibility information, including specifying if this file " - "is a conforming JP2 file or if it can be read by a conforming JP2 reader", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP2H_SIGN, -/* short */ "JP2 Header box", -/* long */ "This box contains a series of boxes that contain header-type information about the file", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {IHDR_SIGN, -/* short */ "Image Header box", -/* long */ "This box specifies the size of the image and other related fields", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ JP2H_BOX}, - -/* sign */ {COLR_SIGN, -/* short */ "Colour Specification box", -/* long */ "This box specifies the colourspace of the image", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ JP2H_BOX}, - -/* sign */ {JP2C_SIGN, -/* short */ "Contiguous Codestream box", -/* long */ "This box contains the codestream as defined by Annex A", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {JP2I_SIGN, -/* short */ "Intellectual Property box", -/* long */ "This box contains intellectual property information about the image", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {XML_SIGN, -/* short */ "XML box", -/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UUID_SIGN, -/* short */ "UUID box", -/* long */ "This box provides a tool by which vendors can add additional information to a file " - "without risking conflict with other vendors", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UINF_SIGN, -/* short */ "UUID Info box", -/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {MOOV_SIGN, -/* short */ "Movie box", -/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {MVHD_SIGN, -/* short */ "Movie Header box", -/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation " - "considered as a whole", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MOOV_BOX}, - -/* sign */ {TRAK_SIGN, -/* short */ "Track box", -/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MOOV_BOX}, - -/* sign */ {TKHD_SIGN, -/* short */ "Track Header box", -/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ TRAK_BOX}, - -/* sign */ {MDIA_SIGN, -/* short */ "Media box", -/* long */ "The media declaration container contains all the objects which declare information about the media data " - "within a track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ TRAK_BOX}, - -/* sign */ {MDHD_SIGN, -/* short */ "Media Header box", -/* long */ "The media header declares overall information which is media-independent, and relevant to characteristics " - "of the media in a track", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MDIA_BOX}, - -/* sign */ {HDLR_SIGN, -/* short */ "Handler Reference box", -/* long */ "This box within a Media Box declares the process by which the media-data in the track may be presented, " - "and thus, the nature of the media in a track", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MDIA_BOX}, - -/* sign */ {MINF_SIGN, -/* short */ "Media Information box", -/* long */ "This box contains all the objects which declare characteristic information of the media in the track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MDIA_BOX}, - -/* sign */ {VMHD_SIGN, -/* short */ "Video Media Header box", -/* long */ "The video media header contains general presentation information, independent of the coding, for video media", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {STBL_SIGN, -/* short */ "Sample Table box", -/* long */ "The sample table contains all the time and data indexing of the media samples in a track", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {STSD_SIGN, -/* short */ "STSD Sample Description box", -/* long */ "The sample description table gives detailed information about the coding type used, and any initialization " - "information needed for that coding", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {STSZ_SIGN, -/* short */ "Sample Size box", -/* long */ "This box contains the sample count and a table giving the size of each sample", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ STBL_BOX}, - -/* sign */ {MJP2_SIGN, -/* short */ "MJP2 Sample Description box", -/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization " - "information needed for that coding", -/* sbox */ 0, -/* req */ {1, 1, 1}, -/* ins */ MINF_BOX}, - -/* sign */ {MDAT_SIGN, -/* short */ "Media Data box", -/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file", -/* sbox */ 1, -/* req */ {1, 1, 1}, -/* ins */ FILE_BOX}, - -/* sign */ {ANY_SIGN, -/* short */ "Any box", -/* long */ "All the existing boxes", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ FILE_BOX}, - -/* sign */ {UNK_SIGN, -/* short */ "Unknown Type box", -/* long */ "The signature is not recognised to be that of an existing box", -/* sbox */ 0, -/* req */ {0, 0, 0}, -/* ins */ ANY_BOX} - -}; - - -/* macro functions */ -/* 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) + \ - ((unsigned long int) (C)[(P) + 1] << 16) + \ - ((unsigned long int) (C)[(P) + 2] << 8) + \ - ((unsigned long int) (C)[(P) + 3] << 0)) - -#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \ - ((unsigned long int) (C)[(P) + 1] << 0)) - -#define OPJREAD_LONG(F,L,N) { \ - if (F->Read(fourbytes, 4) < 4) { \ - wxLogMessage(wxT("Problem reading " N " from the file (file ended?)")); \ - return -1; \ - }; \ - L = STREAM_TO_UINT32(fourbytes, 0); \ - } - -/* handling functions */ -#define ITEM_PER_ROW 10 - -//#define indprint if (0) printf("%.*s", 2 * level + 9, indent), printf -char indent[] = " " - " " - " " - " "; - -void indprint(wxString printout, int level) -{ - wxLogMessage(/*wxString::Format(wxT("%.*s"), 2 * level + 9, indent) + */printout); -} - -/* Box handler function */ -int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint) -{ - switch ((j22boxtype) boxtype) { - - - /* JPEG 2000 Signature box */ - case (JP_BOX): { - - unsigned long int checkdata = 0; - fileid->Read(&checkdata, sizeof(unsigned long int)); - checkdata = BYTE_SWAP4(checkdata); - - // add info - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Check data: %X -> %s"), checkdata, (checkdata == 0x0D0A870A) ? wxT("OK") : wxT("KO")), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - }; - break; - - - /* JPEG 2000 codestream box */ - case (JP2C_BOX): { - - // add info - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString(wxT("Codestream")), - m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1, - new OPJMarkerData(wxT("INFO-CSTREAM"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - - m_tree->SetItemHasChildren(currid); - - // parse the file - //ParseJ2KFile(fileid, filepoint, filelimit, currid); - - }; - break; - - - - - - /* File Type box */ - case (FTYP_BOX): { - - char BR[4], CL[4]; - unsigned long int MinV, numCL, i; - fileid->Read(BR, sizeof(char) * 4); - fileid->Read(&MinV, sizeof(unsigned long int)); - MinV = BYTE_SWAP4(MinV); - numCL = (filelimit - fileid->Tell()) / 4; - - // add info - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxT("Brand/Minor version: ") + - wxString::FromAscii(BR).Truncate(4) + - wxString::Format(wxT("/%d"), MinV), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Compatibility list")), - m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1, - new OPJMarkerData(wxT("INFO")) - ); - - for (i = 0; i < numCL; i++) { - fileid->Read(CL, sizeof(char) * 4); - m_tree->AppendItem(currid, - wxString::FromAscii(CL).Truncate(4), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - }; - - }; - break; - - - - /* JP2 Header box */ - case (IHDR_BOX): { - - unsigned long int height, width; - unsigned short int nc; - unsigned char bpc, C, UnkC, IPR; - fileid->Read(&height, sizeof(unsigned long int)); - height = BYTE_SWAP4(height); - fileid->Read(&width, sizeof(unsigned long int)); - width = BYTE_SWAP4(width); - fileid->Read(&nc, sizeof(unsigned short int)); - nc = BYTE_SWAP2(nc); - fileid->Read(&bpc, sizeof(unsigned char)); - fileid->Read(&C, sizeof(unsigned char)); - fileid->Read(&UnkC, sizeof(unsigned char)); - fileid->Read(&IPR, sizeof(unsigned char)); - - // add info - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Dimensions: %d x %d x %d @ %d bpc"), width, height, nc, bpc + 1), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Compression type: %d"), C), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Colourspace unknown: %d"), UnkC), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Intellectual Property Rights: %d"), IPR), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - }; - break; - - - - /* Colour Specification box */ - case (COLR_BOX): { - - unsigned char METH, PREC, APPROX; - char methdescr[80], enumcsdescr[80]; - unsigned long int EnumCS; - fileid->Read(&METH, sizeof(unsigned char)); - switch (METH) { - case 1: - strcpy(methdescr, "Enumerated Colourspace"); - break; - case 2: - strcpy(methdescr, "Restricted ICC profile"); - break; - default: - strcpy(methdescr, "Unknown"); - break; - }; - fileid->Read(&PREC, sizeof(unsigned char)); - fileid->Read(&APPROX, sizeof(unsigned char)); - if (METH != 2) { - fileid->Read(&EnumCS, sizeof(unsigned long int)); - EnumCS = BYTE_SWAP4(EnumCS); - switch (EnumCS) { - case 16: - strcpy(enumcsdescr, "sRGB"); - break; - case 17: - strcpy(enumcsdescr, "greyscale"); - break; - case 18: - strcpy(enumcsdescr, "sYCC"); - break; - default: - strcpy(enumcsdescr, "Unknown"); - break; - }; - }; - - // add info - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Specification method: %d ("), METH) + - wxString::FromAscii(methdescr) + - wxT(")"), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Precedence: %d"), PREC), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Colourspace approximation: %d"), APPROX), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - if (METH != 2) - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Enumerated colourspace: %d ("), EnumCS) + - wxString::FromAscii(enumcsdescr) + - wxT(")"), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - if (METH != 1) - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("ICC profile: there is one")), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - - }; - break; - - - - - - - /* Movie Header Box */ - case (MVHD_BOX): { - - unsigned long int version, rate, matrix[9], next_track_ID; - unsigned short int volume; - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - if (version == 0) { - unsigned long int creation_time, modification_time, timescale, duration; - fileid->Read(&creation_time, sizeof(unsigned long int)); - creation_time = BYTE_SWAP4(creation_time); - fileid->Read(&modification_time, sizeof(unsigned long int)); - modification_time = BYTE_SWAP4(modification_time); - fileid->Read(×cale, sizeof(unsigned long int)); - timescale = BYTE_SWAP4(timescale); - fileid->Read(&duration, sizeof(unsigned long int)); - duration = BYTE_SWAP4(duration); - const long unix_time = creation_time - 2082844800L; - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Creation time: %u (%.24s)"), creation_time, ctime(&unix_time)), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - const long unix_time1 = modification_time - 2082844800L; - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Modification time: %u (%.24s)"), modification_time, ctime(&unix_time1)), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Timescale: %u (%.6fs)"), timescale, 1.0 / (float) timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Duration: %u (%.3fs)"), duration, (float) duration / (float) timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - } else { - int8byte creation_time, modification_time, duration; - unsigned long int timescale; - fileid->Read(&creation_time, sizeof(int8byte)); - creation_time = BYTE_SWAP8(creation_time); - fileid->Read(&modification_time, sizeof(int8byte)); - modification_time = BYTE_SWAP8(modification_time); - fileid->Read(×cale, sizeof(unsigned long int)); - timescale = BYTE_SWAP4(timescale); - fileid->Read(&duration, sizeof(int8byte)); - duration = BYTE_SWAP8(duration); - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Creation time: %u"), creation_time), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Modification time: %u"), modification_time), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Timescale: %u"), timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Duration: %u"), duration), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - }; - fileid->Read(&rate, sizeof(unsigned long int)); - rate = BYTE_SWAP4(rate); - fileid->Read(&volume, sizeof(unsigned short int)); - volume = BYTE_SWAP2(volume); - fileid->Seek(6, wxFromCurrent); - fileid->Read(&matrix, sizeof(unsigned char) * 9); - fileid->Seek(4, wxFromCurrent); - fileid->Read(&next_track_ID, sizeof(unsigned long int)); - next_track_ID = BYTE_SWAP4(next_track_ID); - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Rate: %d (%d.%d)"), rate, rate >> 16, rate & 0x0000FFFF), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Volume: %d (%d.%d)"), volume, volume >> 8, volume & 0x00FF), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Next track ID: %d"), next_track_ID), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - }; - break; - - - /* Sample Description box */ - case (STSD_BOX): { - - unsigned long int version, entry_count; - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - fileid->Read(&entry_count, sizeof(unsigned long int)); - entry_count = BYTE_SWAP4(entry_count); - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Entry count: %d"), entry_count), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - jpeg2000parse(fileid, filepoint + 8, filelimit, parentid, level + 1, scansign, scanpoint); - }; - break; - - - /* Sample Size box */ - case (STSZ_BOX): { - - unsigned long int version, sample_size, sample_count, entry_size; - - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - - fileid->Read(&sample_size, sizeof(unsigned long int)); - sample_size = BYTE_SWAP4(sample_size); - - if (sample_size == 0) { - fileid->Read(&sample_count, sizeof(unsigned long int)); - sample_count = BYTE_SWAP4(sample_count); - - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Sample count: %d"), sample_count), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - - currid = m_tree->AppendItem(parentid, - wxT("Entries size (bytes)"), - m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - - wxString text; - for (unsigned int s = 0; s < sample_count; s++) { - fileid->Read(&entry_size, sizeof(unsigned long int)); - entry_size = BYTE_SWAP4(entry_size); - - text << wxString::Format(wxT("%d, "), entry_size); - - if (((s % 10) == (ITEM_PER_ROW - 1)) || (s == (sample_count - 1))) { - m_tree->AppendItem(currid, - text, - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - text = wxT(""); - } - - } - - } - - }; - break; - - - /* Video Media Header box */ - case (VMHD_BOX): { - - unsigned long int version; - unsigned short int graphicsmode, opcolor[3]; - char graphicsdescr[100]; - - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - - fileid->Read(&graphicsmode, sizeof(unsigned short int)); - graphicsmode = BYTE_SWAP2(graphicsmode); - switch (graphicsmode) { - case (0x00): - strcpy(graphicsdescr, "copy"); - break; - case (0x24): - strcpy(graphicsdescr, "transparent"); - break; - case (0x0100): - strcpy(graphicsdescr, "alpha"); - break; - case (0x0101): - strcpy(graphicsdescr, "whitealpha"); - break; - case (0x0102): - strcpy(graphicsdescr, "blackalpha"); - break; - default: - strcpy(graphicsdescr, "unknown"); - break; - }; - - fileid->Read(opcolor, 3 * sizeof(unsigned short int)); - opcolor[0] = BYTE_SWAP2(opcolor[0]); - opcolor[1] = BYTE_SWAP2(opcolor[1]); - opcolor[2] = BYTE_SWAP2(opcolor[2]); - - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Composition mode: %d (")) + - wxString::FromAscii(graphicsdescr) + - wxT(")"), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("OP color: %d %d %d"), opcolor[0], opcolor[1], opcolor[2]), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - }; - break; - - - - /* MJP2 Sample Description box */ - case (MJP2_BOX): { - - unsigned short int height, width, depth; - unsigned long int horizresolution, vertresolution; - char compressor_name[32]; - fileid->Seek(24, wxFromCurrent); - fileid->Read(&width, sizeof(unsigned short int)); - width = BYTE_SWAP2(width); - fileid->Read(&height, sizeof(unsigned short int)); - height = BYTE_SWAP2(height); - fileid->Read(&horizresolution, sizeof(unsigned long int)); - horizresolution = BYTE_SWAP4(horizresolution); - fileid->Read(&vertresolution, sizeof(unsigned long int)); - vertresolution = BYTE_SWAP4(vertresolution); - fileid->Seek(6, wxFromCurrent); - fileid->Read(compressor_name, sizeof(char) * 32); - fileid->Read(&depth, sizeof(unsigned short int)); - depth = BYTE_SWAP2(depth); - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Dimensions: %d x %d @ %d bpp"), width, height, depth), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Resolution: %d.%d x %d.%d"), horizresolution >> 16, horizresolution & 0x0000FFFF, - vertresolution >> 16, vertresolution & 0x0000FFFF), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Compressor: %.32s"), compressor_name), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - jpeg2000parse(fileid, filepoint + 78, filelimit, parentid, level + 1, scansign, scanpoint); - - }; - break; - - /* Media Header box */ - case (MDHD_BOX): { - unsigned long int version; - unsigned short int language; - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - if (version == 0) { - unsigned long int creation_time, modification_time, timescale, duration; - fileid->Read(&creation_time, sizeof(unsigned long int)); - creation_time = BYTE_SWAP4(creation_time); - fileid->Read(&modification_time, sizeof(unsigned long int)); - modification_time = BYTE_SWAP4(modification_time); - fileid->Read(×cale, sizeof(unsigned long int)); - timescale = BYTE_SWAP4(timescale); - fileid->Read(&duration, sizeof(unsigned long int)); - duration = BYTE_SWAP4(duration); - const long unix_time = creation_time - 2082844800L; - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Creation time: %u (%.24s)"), creation_time, ctime(&unix_time)), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - const long unix_time1 = modification_time - 2082844800L; - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Modification time: %u (%.24s)"), modification_time, ctime(&unix_time1)), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Timescale: %u (%.6fs)"), timescale, 1.0 / (float) timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Duration: %u (%.3fs)"), duration, (float) duration / (float) timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - } else { - int8byte creation_time, modification_time, duration; - unsigned long int timescale; - fileid->Read(&creation_time, sizeof(int8byte)); - creation_time = BYTE_SWAP8(creation_time); - fileid->Read(&modification_time, sizeof(int8byte)); - modification_time = BYTE_SWAP8(modification_time); - fileid->Read(×cale, sizeof(unsigned long int)); - timescale = BYTE_SWAP4(timescale); - fileid->Read(&duration, sizeof(int8byte)); - duration = BYTE_SWAP8(duration); - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Creation time: %u"), creation_time), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Modification time: %u"), modification_time), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Timescale: %u"), timescale), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Duration: %u"), duration), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - } - fileid->Read(&language, sizeof(unsigned short int)); - - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Language: %d (%c%c%c)"), language & 0xEFFF, - 0x60 + (char) ((language >> 10) & 0x001F), 0x60 + (char) ((language >> 5) & 0x001F), 0x60 + (char) ((language >> 0) & 0x001F)), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - }; - break; - - /* Media Handler box */ - case (HDLR_BOX): { - unsigned long int version, predefined, temp[3]; - char handler[4], name[256]; - int namelen = wxMin(256, (filelimit - filepoint - 24)); - fileid->Read(&version, sizeof(unsigned long int)); - version = BYTE_SWAP4(version); - fileid->Read(&predefined, sizeof(unsigned long int)); - fileid->Read(handler, 4 * sizeof(char)); - fileid->Read(&temp, 3 * sizeof(unsigned long int)); - fileid->Read(name, namelen * sizeof(char)); - - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Handler: %.4s"), handler), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("Name: %.255s"), name), - m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1, - new OPJMarkerData(wxT("INFO")) - ); - - } - break; - - /* not yet implemented */ - default: - break; - - }; - - return (0); -} - - -void OPJParseThread::ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid) -{ - unsigned long int scanpoint; - - jpeg2000parse(fileid, filepoint, filelimit, parentid, 0, NULL, &scanpoint); -} - -/* the parsing function itself */ -/* - fileid = fid of the file to scan (you should open it by yourself) - filepoint = first byte where to start to scan from (usually 0) - filelimit = first byte where to stop to scan from (usually the file size) - level = set this to 0 - scansign = signature to scan for (NULL avoids search, returns " " if successful) - scanpoint = point where the scan signature lies -*/ -int OPJParseThread::jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, - wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint) -{ - unsigned long int LBox = 0x00000000; - //int LBox_read; - char TBox[5] = "\0\0\0\0"; - //int TBox_read; - int8byte XLBox = 0x0000000000000000; - //int XLBox_read; - unsigned long int box_length = 0; - int last_box = 0, box_num = 0; - int box_type = ANY_BOX; - unsigned char /*onebyte[1], twobytes[2],*/ fourbytes[4]; - - /* cycle all over the file */ - box_num = 0; - last_box = 0; - while (!last_box) { - - /* do not exceed file limit */ - if (filepoint >= filelimit) - return (0); - - /* seek on file */ - if (fileid->Seek(filepoint, wxFromStart) == wxInvalidOffset) - return (-1); - - /* read the mandatory LBox, 4 bytes */ - if (fileid->Read(fourbytes, 4) < 4) { - WriteText(wxT("Problem reading LBox from the file (file ended?)")); - return -1; - }; - LBox = STREAM_TO_UINT32(fourbytes, 0); - - /* read the mandatory TBox, 4 bytes */ - if (fileid->Read(TBox, 4) < 4) { - WriteText(wxT("Problem reading TBox from the file (file ended?)")); - return -1; - }; - - /* look if scansign is got */ - if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) { - memcpy(scansign, " ", 4); - *scanpoint = filepoint; - - /* hack/exploit */ - // stop as soon as you find the codebox - return (0); - - }; - - /* determine the box type */ - for (box_type = JP_BOX; box_type < UNK_BOX; box_type++) - if (memcmp(TBox, j22box[box_type].value, 4) == 0) - break; - - /* read the optional XLBox, 8 bytes */ - if (LBox == 1) { - - if (fileid->Read(&XLBox, 8) < 8) { - WriteText(wxT("Problem reading XLBox from the file (file ended?)")); - return -1; - }; - box_length = (unsigned long int) BYTE_SWAP8(XLBox); - - } else if (LBox == 0x00000000) { - - /* last box in file */ - last_box = 1; - box_length = filelimit - filepoint; - - } else - - box_length = LBox; - - /* show box info */ - - // append the marker - int image, imageSel; - image = m_tree->TreeCtrlIcon_Folder; - imageSel = image + 1; - wxTreeItemId currid = m_tree->AppendItem(parentid, - wxString::Format(wxT("%03d: "), box_num) + - wxString::FromAscii(TBox) + - wxString::Format(wxT(" (0x%04X)"), - ((unsigned long int) TBox[3]) + ((unsigned long int) TBox[2] << 8) + - ((unsigned long int) TBox[1] << 16) + ((unsigned long int) TBox[0] << 24) - ), - image, imageSel, - new OPJMarkerData(wxT("BOX"), m_tree->m_fname.GetFullPath(), filepoint, filepoint + box_length) - ); - - // append some info - image = m_tree->TreeCtrlIcon_File; - imageSel = image + 1; - - // box name - wxTreeItemId subcurrid1 = m_tree->AppendItem(currid, - wxT("*** ") + wxString::FromAscii(j22box[box_type].name) + wxT(" ***"), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - m_tree->SetItemFont(subcurrid1, *wxITALIC_FONT); - - // position and length - wxTreeItemId subcurrid2 = m_tree->AppendItem(currid, - wxLongLong(filepoint).ToString() + wxT(" > ") + wxLongLong(filepoint + box_length - 1).ToString() + - wxT(", ") + wxString::Format(wxT("%d + 8 (%d)"), box_length, box_length + 8), - image, imageSel, - new OPJMarkerData(wxT("INFO")) - ); - - /* go deep in the box */ - box_handler_function((int) box_type, fileid, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, - currid, level, scansign, scanpoint); - - /* if it's a superbox go inside it */ - if (j22box[box_type].sbox) - jpeg2000parse(fileid, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, - currid, level + 1, scansign, scanpoint); - - /* increment box number and filepoint*/ - box_num++; - filepoint += box_length; - - }; - - /* all good */ - return (0); -} - diff --git a/README.linux b/README.linux deleted file mode 100644 index 677e2d8d..00000000 --- a/README.linux +++ /dev/null @@ -1,33 +0,0 @@ -Release Notes --------------- -This version of the library has been tested under the following OS: -- RedHat Linux 9.0 - -You should be able to link progams with the -lopenjpeg option after the library is compiled and installed. -You can also statically link with libopenjpeg.a. -If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix' -to run all of the files through dos2unix which converts CRLF to LF. This no longer appears to be required -for RedHat 7.3 or 9. - -Please let us know how this works for you under other Linux distributions or any other *nix. - -Installation ------------- -Note: You will need to have root privileges in order to install the library in -/usr/include and /usr/lib directories. -The installation process is as simple as this : -1) Enter the OpenJPEG directory -2) Build the distribution : -make -make install -3) Clean all files produced during the build process -make clean - -Simple codec compilation ------------------------- -Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively: - -gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff -gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -You should add '-L..' to those lines if you did not use the 'install' target (and the 'clean' target neither...). diff --git a/README.msvc b/README.msvc deleted file mode 100644 index fc9ea894..00000000 --- a/README.msvc +++ /dev/null @@ -1,40 +0,0 @@ -How to compile the library under MS VC++ 6.0 --------------------------------------------- - -The library comes in two versions : -- a static library that can be linked against any C/C++ program -- a Dynamic Link Library (Windows DLL) that can be used in any C/C++ program and in most interpreted languages (e.g. VB, C#, ...). - -In order to compile the library version *or* the DLL version, you will have to : - -1) Open the MSVC workspace named LibOpenJPEG.dsw -2) Set the choosen target as the active project, that means : - a) Go to the Menu 'Build -> Set Active Configuration' - b) Choose one of the following configuration : - - DllOpenJPEG - Win32 Release => creates a DLL in release mode named OpenJPEG.dll - - DllOpenJPEG - Win32 Debug => creates a DLL in debug mode named OpenJPEGd.dll - - LibOpenJPEG - Win32 Release => creates a static library in release mode named LibOpenJPEG.lib - - LibOpenJPEG - Win32 Debug => creates a static library in debug mode named LibOpenJPEGd.lib -3) Build the project : Menu -> Build -> Rebuild All - -The build process will create a directory named 'dist' that will contain all you need in order to use the library. - -Simple codec compilation ------------------------- - -Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following projects to build an encoder and decoder respectively: -- image_to_j2k.dsw -- j2k_to_image.dsw - -IMPORTANT NOTE : ----------------- - -The encoder and decoder samples are configured to use the static version of the library. A link to the LibOpenJPEG static project is included in these projects so that you can build both a codec and the library in a single pass. - -However, you MUST NOTE that in order to use LibOpenJPEG as a static library in your program, you NEED to add the following compiler directive to your project : OPJ_STATIC -Look at the menu 'Project -> Settings -> C/C++ tab -> preprocessor definition' to see how this is configured. -When using OpenJPEG as a DLL, this compiler directive MUST NOT be used. - - - - diff --git a/README.osx b/README.osx deleted file mode 100644 index e99eccbc..00000000 --- a/README.osx +++ /dev/null @@ -1,26 +0,0 @@ -Release Notes --------------- -This version of the library has been tested under OSX 10.3 using gcc 3.3. - -While the makefiles will make a .dylib and a .a, it is recommended to simply staticly link with the .a file. - -Installation ------------- -Note: You will need to have root privileges in order to install the library in -/usr/include and /usr/lib directories. -The installation process is as simple as this : -1) Enter the OpenJPEG directory -2) Build the distribution : -make osx -make osxinstall -3) Clean all files produced during the build process -make osxclean - -Simple codec compilation ------------------------- -Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and either use the provided Makefile or use one of the following commands to build an encoder and decoder respectively: - -gcc index.c convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff -gcc index.c convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -You should add '-L..' to those lines if you did not use the 'install' target (and the 'clean' target neither...). diff --git a/clean.bat b/clean.bat deleted file mode 100644 index 2ce15cbe..00000000 --- a/clean.bat +++ /dev/null @@ -1,25 +0,0 @@ -rd Release /s /q -rd Debug /s /q -rd codec\Debug /s /q -rd codec\Release /s /q -rd dist /s /q -del *.pch /s /q -del *.ncb /s /q -del *.opt /s /q -del *.plg /s /q -del *.obj /s /q -del *.dll /s /q -del *.exe /s /q -del *.bsc /s /q -del *.bak /s /q -del *.pdb /s /q -del *.sql /s /q -del *.mdb /s /q -del *.lib /s /q -del *.exp /s /q -del *.ilk /s /q -del *.idb /s /q -del *.aps /s /q -del *.suo /s /q /a:h -del *.o /s /q - diff --git a/codec/Makefile b/codec/Makefile deleted file mode 100644 index 14487a5f..00000000 --- a/codec/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k - -CFLAGS = -O3 -lstdc++ # -g -p -pg - -all: j2k_to_image image_to_j2k - -j2k_to_image: j2k_to_image.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c index.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -image_to_j2k: image_to_j2k.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c index.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff - -clean: - rm -f j2k_to_image image_to_j2k diff --git a/codec/image_to_j2k.dsp b/codec/image_to_j2k.dsp deleted file mode 100644 index 3e1b0f66..00000000 --- a/codec/image_to_j2k.dsp +++ /dev/null @@ -1,118 +0,0 @@ -# Microsoft Developer Studio Project File - Name="image_to_j2k" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=image_to_j2k - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "image_to_j2k.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "image_to_j2k.mak" CFG="image_to_j2k - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "image_to_j2k - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "image_to_j2k - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "image_to_j2k - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "image_to_j2k - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBC" /nodefaultlib:"LIBCMT" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "image_to_j2k - Win32 Release" -# Name "image_to_j2k - Win32 Debug" -# Begin Source File - -SOURCE=.\convert.c -# End Source File -# Begin Source File - -SOURCE=.\convert.h -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=.\image_to_j2k.c -# End Source File -# Begin Source File - -SOURCE=.\index.c -# End Source File -# Begin Source File - -SOURCE=.\index.h -# End Source File -# End Target -# End Project diff --git a/codec/image_to_j2k.dsw b/codec/image_to_j2k.dsw deleted file mode 100644 index fd19c260..00000000 --- a/codec/image_to_j2k.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "image_to_j2k"=.\image_to_j2k.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/codec/image_to_j2k.sln b/codec/image_to_j2k.sln deleted file mode 100644 index de773c8d50dde46e6a463af8a5d1d4928eae6336..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1506 zcmbW1$!^;)5QcNL0KJ2tTv8wuNG&aW=z&_8qDUGe2AWHOK(=UusUjL$a!K-JJ@k?K z3K`XsEjB@__@?1(-~1fv&#&L6aUqwbs?@5szRRjfb8B8VnN-$XDWajz5Fs%}G$sUL%y2X%;Pu@n z`-An_vd`t>awCebv*gS^wQR@vF*tGVmm4VBIv#xPeqt=}kWVNJhX>El<+Y57;!{m9s-re0f+<$(|~ZAxUn0+ zkft%|aOR*5NO;njv4F8NQ7omXS|v8Bs(0X%$+&qTZ(JZ??1kw_bgj;EwMcV_+kW)4 z{W?UdSjlx$rtJ)~Jgrx-7+dgC^g)n4iN&H>KVHkibAfJPwazP%i?k9uw`Ok{we~M? zI)&b#0U3ul1B3L|OMg0sSp~k=gETeN&l$ RCF1OSp1j&%*U~hOo&g;;wgmtH diff --git a/codec/image_to_j2k.vcproj b/codec/image_to_j2k.vcproj deleted file mode 100644 index 8968eb4b..00000000 --- a/codec/image_to_j2k.vcproj +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/codec/j2k_to_image.dsp b/codec/j2k_to_image.dsp deleted file mode 100644 index 927f1a59..00000000 --- a/codec/j2k_to_image.dsp +++ /dev/null @@ -1,117 +0,0 @@ -# Microsoft Developer Studio Project File - Name="j2k_to_image" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=j2k_to_image - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "j2k_to_image.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "j2k_to_image.mak" CFG="j2k_to_image - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "j2k_to_image - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "j2k_to_image - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "j2k_to_image - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "j2k_to_image - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /YX /FD /GZ /c -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /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 ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmt" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "j2k_to_image - Win32 Release" -# Name "j2k_to_image - Win32 Debug" -# Begin Source File - -SOURCE=.\convert.c -# End Source File -# Begin Source File - -SOURCE=.\convert.h -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=.\index.c -# End Source File -# Begin Source File - -SOURCE=.\index.h -# End Source File -# Begin Source File - -SOURCE=.\j2k_to_image.c -# End Source File -# End Target -# End Project diff --git a/codec/j2k_to_image.dsw b/codec/j2k_to_image.dsw deleted file mode 100644 index 5a01ee0a..00000000 --- a/codec/j2k_to_image.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "j2k_to_image"=.\j2k_to_image.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/codec/j2k_to_image.sln b/codec/j2k_to_image.sln deleted file mode 100644 index 22103f55caa4e479ba87b749e95a7ac11e4f12a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1506 zcmbW1OK#gR5Qek00Np`QHYpGaq{P_Nq6_Nb6h)dEHPCJf1hPdNOcl}4BO50t>mom=E%IZq0+?vWvoLf^> z+$9hrin2NM9gI!m^sgKj;|tT673x+jt22Acg3u4+fFTx8jtGe`Vi6$-V~#_gfS0TaY7(ZrxuumAa94$yzj>`*t75Wzcy%_7Nl8MKthXNFUI`Xo4ppjVI%H z+yISQoH=L%5}vhYBw*}R - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpwl/CMakeLists.txt b/jpwl/CMakeLists.txt deleted file mode 100755 index 591c95f5..00000000 --- a/jpwl/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k - -ADD_DEFINITIONS(-DUSE_JPWL) - -SET(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 -) -SET(JPWL_SRCS crc.c jpwl.c jpwl_lib.c rs.c) - -ADD_LIBRARY(openjpeg_JPWL ${JPWL_SRCS} ${OPJ_SRCS}) - -# Do the proper thing when building static...if only there was configured -# headers or def files instead -#IF(NOT BUILD_SHARED_LIBS) -# ADD_DEFINITIONS(-DOPJ_STATIC) -#ENDIF(NOT BUILD_SHARED_LIBS) - -INCLUDE_DIRECTORIES( - ${OPENJPEG_SOURCE_DIR}/libopenjpeg - ) - -FIND_PACKAGE(TIFF REQUIRED) - -ADD_EXECUTABLE(JPWL_j2k_to_image -../codec/convert.c ../codec/j2k_to_image.c -) -TARGET_LINK_LIBRARIES(JPWL_j2k_to_image openjpeg_JPWL ${TIFF_LIBRARIES}) -IF(UNIX) - TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m) -ENDIF(UNIX) - -ADD_EXECUTABLE(JPWL_image_to_j2k -../codec/convert.c ../codec/image_to_j2k.c) -TARGET_LINK_LIBRARIES(JPWL_image_to_j2k openjpeg_JPWL ${TIFF_LIBRARIES}) -IF(UNIX) - TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m) -ENDIF(UNIX) - diff --git a/jpwl/JPWL_image_to_j2k.dsp b/jpwl/JPWL_image_to_j2k.dsp deleted file mode 100644 index dfc30d30..00000000 --- a/jpwl/JPWL_image_to_j2k.dsp +++ /dev/null @@ -1,127 +0,0 @@ -# Microsoft Developer Studio Project File - Name="JPWL_image_to_j2k" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=JPWL_image_to_j2k - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "JPWL_image_to_j2k.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "JPWL_image_to_j2k.mak" CFG="JPWL_image_to_j2k - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "JPWL_image_to_j2k - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "JPWL_image_to_j2k - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "JPWL_image_to_j2k - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x80c /d "NDEBUG" -# ADD RSC /l 0x80c /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 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LibOpenJPEG_JPWL.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /libpath:"Release" - -!ELSEIF "$(CFG)" == "JPWL_image_to_j2k - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /FR /FD /GZ /c -# ADD BASE RSC /l 0x80c /d "_DEBUG" -# ADD RSC /l 0x80c /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 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LibOpenJPEG_JPWLd.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"Debug" - -!ENDIF - -# Begin Target - -# Name "JPWL_image_to_j2k - Win32 Release" -# Name "JPWL_image_to_j2k - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\codec\convert.c -# End Source File -# Begin Source File - -SOURCE=..\codec\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=..\codec\image_to_j2k.c -# End Source File -# Begin Source File - -SOURCE=..\codec\index.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\codec\convert.h -# End Source File -# Begin Source File - -SOURCE=..\codec\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=..\codec\index.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.h -# End Source File -# End Group -# End Target -# End Project diff --git a/jpwl/JPWL_image_to_j2k.dsw b/jpwl/JPWL_image_to_j2k.dsw deleted file mode 100644 index 8487d5cb..00000000 --- a/jpwl/JPWL_image_to_j2k.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "JPWL_image_to_j2k"=".\JPWL_image_to_j2k.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG_JPWL - End Project Dependency -}}} - -############################################################################### - -Project: "LibOpenJPEG_JPWL"=".\LibOpenJPEG_JPWL.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/jpwl/JPWL_j2k_to_image.dsp b/jpwl/JPWL_j2k_to_image.dsp deleted file mode 100644 index a64d80c8..00000000 --- a/jpwl/JPWL_j2k_to_image.dsp +++ /dev/null @@ -1,135 +0,0 @@ -# Microsoft Developer Studio Project File - Name="JPWL_j2k_to_image" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=JPWL_j2k_to_image - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "JPWL_j2k_to_image.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "JPWL_j2k_to_image.mak" CFG="JPWL_j2k_to_image - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "JPWL_j2k_to_image - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "JPWL_j2k_to_image - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "JPWL_j2k_to_image - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /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 RSC /l 0x80c /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 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "JPWL_j2k_to_image - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "JPWL_j2k_to_image___Win32_Debug" -# PROP BASE Intermediate_Dir "JPWL_j2k_to_image___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# 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 /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /YX /FD /GZ /c -# ADD BASE RSC /l 0x80c /d "_DEBUG" -# ADD RSC /l 0x80c /d "_DEBUG" -BSC32=bscmake.exe -# 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 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "JPWL_j2k_to_image - Win32 Release" -# Name "JPWL_j2k_to_image - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\codec\convert.c -# End Source File -# Begin Source File - -SOURCE=..\codec\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=..\codec\index.c -# End Source File -# Begin Source File - -SOURCE=..\codec\j2k_to_image.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\codec\convert.h -# End Source File -# Begin Source File - -SOURCE=.\crc.h -# End Source File -# Begin Source File - -SOURCE=..\codec\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=..\codec\index.h -# End Source File -# Begin Source File - -SOURCE=.\jpwl.h -# End Source File -# Begin Source File - -SOURCE=.\rs.h -# End Source File -# End Group -# End Target -# End Project diff --git a/jpwl/JPWL_j2k_to_image.dsw b/jpwl/JPWL_j2k_to_image.dsw deleted file mode 100644 index b964a6da..00000000 --- a/jpwl/JPWL_j2k_to_image.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "JPWL_j2k_to_image"=".\JPWL_j2k_to_image.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG_JPWL - End Project Dependency -}}} - -############################################################################### - -Project: "LibOpenJPEG_JPWL"=".\LibOpenJPEG_JPWL.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/jpwl/LibOpenJPEG_JPWL.dsp b/jpwl/LibOpenJPEG_JPWL.dsp deleted file mode 100644 index d7bf7937..00000000 --- a/jpwl/LibOpenJPEG_JPWL.dsp +++ /dev/null @@ -1,282 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LibOpenJPEG_JPWL" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=LibOpenJPEG_JPWL - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LibOpenJPEG_JPWL.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LibOpenJPEG_JPWL.mak" CFG="LibOpenJPEG_JPWL - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LibOpenJPEG_JPWL - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "LibOpenJPEG_JPWL - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "LibOpenJPEG_JPWL - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "LibOpenJPEG_JPWL___Win32_Release" -# PROP BASE Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /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 RSC /l 0x80c /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "LibOpenJPEG_JPWL - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "LibOpenJPEG_JPWL___Win32_Debug" -# PROP BASE Intermediate_Dir "LibOpenJPEG_JPWL___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /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 RSC /l 0x80c /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Debug\LibOpenJPEG_JPWLd.lib" - -!ENDIF - -# Begin Target - -# Name "LibOpenJPEG_JPWL - Win32 Release" -# Name "LibOpenJPEG_JPWL - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\libopenjpeg\bio.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\cio.c -# End Source File -# Begin Source File - -SOURCE=.\crc.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\dwt.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\event.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\image.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k_lib.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jp2.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jpt.c -# End Source File -# Begin Source File - -SOURCE=.\jpwl.c -# End Source File -# Begin Source File - -SOURCE=.\jpwl_lib.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mct.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mqc.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\pi.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\raw.c -# End Source File -# Begin Source File - -SOURCE=.\rs.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t1.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t2.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tcd.c -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tgt.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=.\crc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=.\jpwl.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\opj_malloc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=.\rs.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tgt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/jpwl/Makefile b/jpwl/Makefile deleted file mode 100755 index 9dce884a..00000000 --- a/jpwl/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# 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 = -Wall -O3 -ffast-math -std=c99 -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/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 - 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 -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 \ No newline at end of file diff --git a/jpwl/README.txt b/jpwl/README.txt deleted file mode 100644 index 66e9d5b1..00000000 --- a/jpwl/README.txt +++ /dev/null @@ -1,136 +0,0 @@ -=============================================================================== - JPEG2000 Part 11 (ISO/IEC 15444-11 JPWL) Software - - - - Version 20061213 -=============================================================================== - - - - - -1. Scope -============= - -This document describes the installation and use of the JPWL module in the framework of OpenJPEG library. - -This implementation has been developed from OpenJPEG implementation of JPEG2000 standard, and for this reason it is written in C language. - -If you find some bugs or if you have problems using the encoder/decoder, please send an e-mail to jpwl@diei.unipg.it - - -2. Installing the code -========================== - -The JPWL code is integrated with the standard OpenJPEG library and codecs: it is activated by setting the macro USE_JPWL to defined in the preprocessor configuration options of your preferred C compiler. - -2.1. Compiling the source code in Windows -------------------------------------------- - -The "jpwl" directory is already populated with a couple of Visual C++ 6.0 workspaces - - * JPWL_image_to_j2k.dsw - Creates the encoder with JPWL functionalities - * JPWL_j2k_to_image.dsw - Creates the decoder with JPWL functionalities - -2.2. Compiling the source code in Unix-like systems ------------------------------------------------------ - -Under linux, enter the jpwl directory and type "make clean" and "make". - - -3. Running the JPWL software -========================= - -The options available at the command line are exactly the same of the base OpenJPEG codecs. In addition, there is a "-W" switch that activates JPWL functionalities. - -3.1. JPWL Encoder -------------------- - --W : adoption of JPWL (Part 11) capabilities (-W params) - The parameters can be written and repeated in any order: - [h<=type>,s<=method>,a=,z=,g=,... - ...,p<=type>] - - h selects the header error protection (EPB): 'type' can be - [0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS] - if 'tile' is absent, it applies to main and tile headers - if 'tile' is present, it applies from that tile - onwards, up to the next h spec, or to the last tile - in the codestream (max. 16 specs) - - p selects the packet error protection (EEP/UEP with EPBs) - to be applied to raw data: 'type' can be - [0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS] - if 'tile:pack' is absent, it starts from tile 0, packet 0 - if 'tile:pack' is present, it applies from that tile - and that packet onwards, up to the next packet spec - or to the last packet in the last tile in the codestream - (max. 16 specs) - - s enables sensitivity data insertion (ESD): 'method' can be - [-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR - 4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED] - if 'tile' is absent, it applies to main header only - if 'tile' is present, it applies from that tile - onwards, up to the next s spec, or to the last tile - in the codestream (max. 16 specs) - - g determines the addressing mode: can be - [0=PACKET 1=BYTE RANGE 2=PACKET RANGE] - - a determines the size of data addressing: can be - 2/4 bytes (small/large codestreams). If not set, auto-mode - - z determines the size of sensitivity values: can be - 1/2 bytes, for the transformed pseudo-floating point value - - ex.: - h,h0=64,h3=16,h5=32,p0=78,p0:24=56,p1,p3:0=0,p3:20=32,s=0,s0=6,s3=-1,a=0,g=1,z=1 - means - predefined EPB in MH, rs(64,32) from TPH 0 to TPH 2, - CRC-16 in TPH 3 and TPH 4, CRC-32 in remaining TPHs, - UEP rs(78,32) for packets 0 to 23 of tile 0, - UEP rs(56,32) for packets 24 to the last of tile 0, - UEP rs default for packets of tile 1, - no UEP for packets 0 to 19 of tile 3, - UEP CRC-32 for packets 20 of tile 3 to last tile, - relative sensitivity ESD for MH, - TSE ESD from TPH 0 to TPH 2, byte range with automatic - size of addresses and 1 byte for each sensitivity value - - ex.: - h,s,p - means - default protection to headers (MH and TPHs) as well as - data packets, one ESD in MH - - N.B.: use the following recommendations when specifying - the JPWL parameters list - - when you use UEP, always pair the 'p' option with 'h' - -3.2. JPWL Decoder -------------------- - - -W - Activates the JPWL correction capability, if the codestream complies. - Options can be a comma separated list of tokens: - c, c=numcomps - numcomps is the number of expected components in the codestream - (search of first EPB rely upon this, default is 3) - - -4. Known bugs and limitations -=============================== - -4.1. Bugs ------------ - -* It is not possible to save a JPWL encoded codestream using the wrapped file format (i.e. JP2): only raw file format (i.e. J2K) is working - -4.2. Limitations ------------------- - -* When specifying an UEP protection, you need to activate even TPH protection for those tiles where there is a protection of the packets -* RED insertion is not currently implemented at the decoder -* JPWL at entropy coding level is not implemented diff --git a/jpwl/crc.c b/jpwl/crc.c deleted file mode 100644 index a54b6575..00000000 --- a/jpwl/crc.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef USE_JPWL - -#include "crc.h" - -/** -@file crc.c -@brief Functions used to compute the 16- and 32-bit CRC of byte arrays - -*/ - -/** file: CRC16.CPP - * - * CRC - Cyclic Redundancy Check (16-bit) - * - * A CRC-checksum is used to be sure, the data hasn't changed or is false. - * To create a CRC-checksum, initialise a check-variable (unsigned short), - * and set this to zero. Than call for every byte in the file (e.g.) the - * procedure updateCRC16 with this check-variable as the first parameter, - * and the byte as the second. At the end, the check-variable contains the - * CRC-checksum. - * - * implemented by Michael Neumann, 14.06.1998 - * - */ -const unsigned short CRC16_table[256] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 -}; - -void updateCRC16(unsigned short *crc, unsigned char data) { - *crc = CRC16_table[(*crc >> 8) & 0xFF] ^ (*crc << 8) ^ data; -}; - - -/** file: CRC32.CPP - * - * CRC - Cyclic Redundancy Check (32-bit) - * - * A CRC-checksum is used to be sure, the data hasn't changed or is false. - * To create a CRC-checksum, initialise a check-variable (unsigned long), - * and set this to zero. Than call for every byte in the file (e.g.) the - * procedure updateCRC32 with this check-variable as the first parameter, - * and the byte as the second. At the end, the check-variable contains the - * CRC-checksum. - * - * implemented by Michael Neumann, 14.06.1998 - * - */ -const unsigned long CRC32_table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -void updateCRC32(unsigned long *crc, unsigned char data) { - *crc = CRC32_table[(unsigned char) *crc ^ data] ^ ((*crc >> 8) & 0x00FFFFFF); -}; - -#endif /* USE_JPWL */ diff --git a/jpwl/crc.h b/jpwl/crc.h deleted file mode 100644 index 2d871687..00000000 --- a/jpwl/crc.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef USE_JPWL - -/** -@file crc.h -@brief Functions used to compute the 16- and 32-bit CRC of byte arrays - -*/ - -#ifndef __CRC16_HEADER__ -#define __CRC16_HEADER__ - -/** file: CRC16.HPP - * - * CRC - Cyclic Redundancy Check (16-bit) - * - * A CRC-checksum is used to be sure, the data hasn't changed or is false. - * To create a CRC-checksum, initialise a check-variable (unsigned short), - * and set this to zero. Than call for every byte in the file (e.g.) the - * procedure updateCRC16 with this check-variable as the first parameter, - * and the byte as the second. At the end, the check-variable contains the - * CRC-checksum. - * - * implemented by Michael Neumann, 14.06.1998 - * - */ -void updateCRC16(unsigned short *, unsigned char); - -#endif /* __CRC16_HEADER__ */ - - -#ifndef __CRC32_HEADER__ -#define __CRC32_HEADER__ - -/** file: CRC32.HPP - * - * CRC - Cyclic Redundancy Check (32-bit) - * - * A CRC-checksum is used to be sure, the data hasn't changed or is false. - * To create a CRC-checksum, initialise a check-variable (unsigned short), - * and set this to zero. Than call for every byte in the file (e.g.) the - * procedure updateCRC32 with this check-variable as the first parameter, - * and the byte as the second. At the end, the check-variable contains the - * CRC-checksum. - * - * implemented by Michael Neumann, 14.06.1998 - * - */ -void updateCRC32(unsigned long *, unsigned char); - -#endif /* __CRC32_HEADER__ */ - - -#endif /* USE_JPWL */ diff --git a/jpwl/jpwl.c b/jpwl/jpwl.c deleted file mode 100644 index 07ca796a..00000000 --- a/jpwl/jpwl.c +++ /dev/null @@ -1,1357 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../libopenjpeg/opj_includes.h" - -#ifdef USE_JPWL - -/** @defgroup JPWL JPWL - JPEG-2000 Part11 (JPWL) codestream manager */ -/*@{*/ - -/** @name Local static variables */ -/*@{*/ - -/** number of JPWL prepared markers */ -static int jwmarker_num; -/** properties of JPWL markers to insert */ -static jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS]; - -/*@}*/ - -/*@}*/ - -/** @name Local static functions */ -/*@{*/ - -/** create an EPC marker segment -@param j2k J2K compressor handle -@param esd_on true if ESD is activated -@param red_on true if RED is activated -@param epb_on true if EPB is activated -@param info_on true if informative techniques are activated -@return returns the freshly created EPC -*/ -jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool epb_on, bool info_on); - -/*@}*/ - -/** create an EPC marker segment -@param j2k J2K compressor handle -@param comps considered component (-1=average, 0/1/2/...=component no.) -@param addrm addressing mode (0=packet, 1=byte range, 2=packet range, 3=reserved) -@param ad_size size of addresses (2/4 bytes) -@param senst sensitivity type -@param se_size sensitivity values size (1/2 bytes) -@param tileno tile where this ESD lies (-1 means MH) -@param svalnum number of sensitivity values (if 0, they will be automatically filled) -@param sensval pointer to an array of sensitivity values (if NULL, they will be automatically filled) -@return returns the freshly created ESD -*/ -jpwl_esd_ms_t *jpwl_esd_create(opj_j2k_t *j2k, int comps, unsigned char addrm, unsigned char ad_size, - unsigned char senst, int se_size, int tileno, - unsigned long int svalnum, void *sensval); - -/** this function is used to compare two JPWL markers based on -their relevant wishlist position -@param arg1 pointer to first marker -@param arg2 pointer to second marker -@return 1 if arg1>arg2, 0 if arg1=arg2, -1 if arg1pos_correction = 0; - -} - -void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) { - - if (!cstr_info) - return; - - /* expand the list? */ - if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) { - cstr_info->maxmarknum = 100 + (int) ((float) cstr_info->maxmarknum * 1.0F); - cstr_info->marker = opj_realloc(cstr_info->marker, cstr_info->maxmarknum); - } - - /* add the marker */ - cstr_info->marker[cstr_info->marknum].type = type; - cstr_info->marker[cstr_info->marknum].pos = pos; - cstr_info->marker[cstr_info->marknum].len = len; - cstr_info->marknum++; - -} - -void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) { - - unsigned short int socsiz_len = 0; - int ciopos = cio_tell(cio), soc_pos = j2k->cstr_info->main_head_start; - unsigned char *socp = NULL; - - int tileno, acc_tpno, tpno, tilespec, hprot, sens, pprot, packspec, lastileno, packno; - - jpwl_epb_ms_t *epb_mark; - jpwl_epc_ms_t *epc_mark; - jpwl_esd_ms_t *esd_mark; - - /* find (SOC + SIZ) length */ - /* I assume SIZ is always the first marker after SOC */ - cio_seek(cio, soc_pos + 4); - socsiz_len = (unsigned short int) cio_read(cio, 2) + 4; /* add the 2 marks length itself */ - cio_seek(cio, soc_pos + 0); - socp = cio_getbp(cio); /* pointer to SOC */ - - /* - EPC MS for Main Header: if we are here it's required - */ - /* create the EPC */ - if ((epc_mark = jpwl_epc_create( - j2k, - j2k->cp->esd_on, /* is ESD present? */ - j2k->cp->red_on, /* is RED present? */ - j2k->cp->epb_on, /* is EPB present? */ - false /* are informative techniques present? */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (epc_mark) { - jwmarker[jwmarker_num].id = J2K_MS_EPC; /* its type */ - jwmarker[jwmarker_num].m.epcmark = epc_mark; /* the EPC */ - 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].len = epc_mark->Lepc; /* its length */ - jwmarker[jwmarker_num].len_ready = true; /* ready */ - jwmarker[jwmarker_num].pos_ready = true; /* ready */ - jwmarker[jwmarker_num].parms_ready = false; /* not ready */ - jwmarker[jwmarker_num].data_ready = true; /* ready */ - jwmarker_num++; - }; - - opj_event_msg(j2k->cinfo, EVT_INFO, - "MH EPC : setting %s%s%s\n", - j2k->cp->esd_on ? "ESD, " : "", - j2k->cp->red_on ? "RED, " : "", - j2k->cp->epb_on ? "EPB, " : "" - ); - - } else { - /* ooops, problems */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create MH EPC\n"); - }; - - /* - ESD MS for Main Header - */ - /* first of all, must MH have an ESD MS? */ - if (j2k->cp->esd_on && (j2k->cp->sens_MH >= 0)) { - - /* Create the ESD */ - if ((esd_mark = jpwl_esd_create( - j2k, /* this encoder handle */ - -1, /* we are averaging over all components */ - (unsigned char) j2k->cp->sens_range, /* range method */ - (unsigned char) j2k->cp->sens_addr, /* sensitivity addressing */ - (unsigned char) j2k->cp->sens_MH, /* sensitivity method */ - j2k->cp->sens_size, /* sensitivity size */ - -1, /* this ESD is in main header */ - 0 /*j2k->cstr_info->num*/, /* number of packets in codestream */ - NULL /*sensval*/ /* pointer to sensitivity data of packets */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (jwmarker_num < JPWL_MAX_NO_MARKERS) { - jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */ - 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].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_ready = true; /* not ready, yet */ - jwmarker[jwmarker_num].pos_ready = true; /* ready */ - jwmarker[jwmarker_num].parms_ready = true; /* not ready */ - jwmarker[jwmarker_num].data_ready = false; /* not ready */ - jwmarker_num++; - } - - opj_event_msg(j2k->cinfo, EVT_INFO, - "MH ESDs: method %d\n", - j2k->cp->sens_MH - ); - - } else { - /* ooops, problems */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create MH ESD\n"); - }; - - } - - /* - ESD MSs for Tile Part Headers - */ - /* cycle through tiles */ - sens = -1; /* default spec: no ESD */ - tilespec = 0; /* first tile spec */ - acc_tpno = 0; - for (tileno = 0; tileno < j2k->cstr_info->tw * j2k->cstr_info->th; tileno++) { - - opj_event_msg(j2k->cinfo, EVT_INFO, - "Tile %d has %d tile part(s)\n", - tileno, j2k->cstr_info->tile[tileno].num_tps - ); - - /* for every tile part in the tile */ - for (tpno = 0; tpno < j2k->cstr_info->tile[tileno].num_tps; tpno++, acc_tpno++) { - - int sot_len, Psot, Psotp, mm; - unsigned long sot_pos, post_sod_pos; - - unsigned long int left_THmarks_len; - - /******* sot_pos = j2k->cstr_info->tile[tileno].start_pos; */ - sot_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos; - cio_seek(cio, sot_pos + 2); - sot_len = cio_read(cio, 2); /* SOT Len */ - cio_skip(cio, 2); - Psotp = cio_tell(cio); - Psot = cio_read(cio, 4); /* tile length */ - - /******* post_sod_pos = j2k->cstr_info->tile[tileno].end_header + 1; */ - post_sod_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_end_header + 1; - left_THmarks_len = post_sod_pos - sot_pos; - - /* add all the lengths of the markers which are len-ready and stay within SOT and SOD */ - for (mm = 0; mm < jwmarker_num; mm++) { - if ((jwmarker[mm].pos >= sot_pos) && (jwmarker[mm].pos < post_sod_pos)) { - if (jwmarker[mm].len_ready) - left_THmarks_len += jwmarker[mm].len + 2; - else { - opj_event_msg(j2k->cinfo, EVT_ERROR, "MS %x in %f is not len-ready: could not set up TH EPB\n", - jwmarker[mm].id, jwmarker[mm].dpos); - exit(1); - } - } - } - - /******* if ((tilespec < JPWL_MAX_NO_TILESPECS) && (j2k->cp->sens_TPH_tileno[tilespec] == tileno)) */ - if ((tilespec < JPWL_MAX_NO_TILESPECS) && (j2k->cp->sens_TPH_tileno[tilespec] == acc_tpno)) - /* we got a specification from this tile onwards */ - sens = j2k->cp->sens_TPH[tilespec++]; - - /* must this TPH have an ESD MS? */ - if (j2k->cp->esd_on && (sens >= 0)) { - - /* Create the ESD */ - if ((esd_mark = jpwl_esd_create( - j2k, /* this encoder handle */ - -1, /* we are averaging over all components */ - (unsigned char) j2k->cp->sens_range, /* range method */ - (unsigned char) j2k->cp->sens_addr, /* sensitivity addressing size */ - (unsigned char) sens, /* sensitivity method */ - j2k->cp->sens_size, /* sensitivity value size */ - tileno, /* this ESD is in a tile */ - 0, /* number of packets in codestream */ - NULL /* pointer to sensitivity data of packets */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (jwmarker_num < JPWL_MAX_NO_MARKERS) { - jwmarker[jwmarker_num].id = J2K_MS_ESD; /* its type */ - 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].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].len = esd_mark->Lesd; /* its length */ - jwmarker[jwmarker_num].len_ready = true; /* ready, yet */ - jwmarker[jwmarker_num].pos_ready = true; /* ready */ - jwmarker[jwmarker_num].parms_ready = true; /* not ready */ - jwmarker[jwmarker_num].data_ready = false; /* ready */ - jwmarker_num++; - } - - /* update Psot of the tile */ - cio_seek(cio, Psotp); - cio_write(cio, Psot + esd_mark->Lesd + 2, 4); - - opj_event_msg(j2k->cinfo, EVT_INFO, - /******* "TPH ESDs: tile %02d, method %d\n", */ - "TPH ESDs: tile %02d, part %02d, method %d\n", - /******* tileno, */ - tileno, tpno, - sens - ); - - } else { - /* ooops, problems */ - /***** opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create TPH ESD #%d\n", tileno); */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create TPH ESD #%d,%d\n", tileno, tpno); - }; - - } - - } - - }; - - /* - EPB MS for Main Header - */ - /* first of all, must MH have an EPB MS? */ - if (j2k->cp->epb_on && (j2k->cp->hprot_MH > 0)) { - - int mm; - - /* position of SOT */ - unsigned int sot_pos = j2k->cstr_info->main_head_end + 1; - - /* how much space is there between end of SIZ and beginning of SOT? */ - int left_MHmarks_len = sot_pos - socsiz_len; - - /* add all the lengths of the markers which are len-ready and stay within SOC and SOT */ - for (mm = 0; mm < jwmarker_num; mm++) { - if ((jwmarker[mm].pos >=0) && (jwmarker[mm].pos < sot_pos)) { - if (jwmarker[mm].len_ready) - left_MHmarks_len += jwmarker[mm].len + 2; - else { - opj_event_msg(j2k->cinfo, EVT_ERROR, "MS %x in %f is not len-ready: could not set up MH EPB\n", - jwmarker[mm].id, jwmarker[mm].dpos); - exit(1); - } - } - } - - /* Create the EPB */ - if ((epb_mark = jpwl_epb_create( - j2k, /* this encoder handle */ - true, /* is it the latest? */ - true, /* is it packed? not for now */ - -1, /* we are in main header */ - 0, /* its index is 0 (first) */ - j2k->cp->hprot_MH, /* protection type parameters of data */ - socsiz_len, /* pre-data: only SOC+SIZ */ - left_MHmarks_len /* post-data: from SOC to SOT, and all JPWL markers within */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (jwmarker_num < JPWL_MAX_NO_MARKERS) { - jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */ - jwmarker[jwmarker_num].m.epbmark = epb_mark; /* the EPB */ - 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].len = epb_mark->Lepb; /* its length */ - jwmarker[jwmarker_num].len_ready = true; /* ready */ - jwmarker[jwmarker_num].pos_ready = true; /* ready */ - jwmarker[jwmarker_num].parms_ready = true; /* ready */ - jwmarker[jwmarker_num].data_ready = false; /* not ready */ - jwmarker_num++; - } - - opj_event_msg(j2k->cinfo, EVT_INFO, - "MH EPB : prot. %d\n", - j2k->cp->hprot_MH - ); - - } else { - /* ooops, problems */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create MH EPB\n"); - }; - } - - /* - EPB MSs for Tile Parts - */ - /* cycle through TPHs */ - hprot = j2k->cp->hprot_MH; /* default spec */ - tilespec = 0; /* first tile spec */ - lastileno = 0; - packspec = 0; - pprot = -1; - acc_tpno = 0; - for (tileno = 0; tileno < j2k->cstr_info->tw * j2k->cstr_info->th; tileno++) { - - opj_event_msg(j2k->cinfo, EVT_INFO, - "Tile %d has %d tile part(s)\n", - tileno, j2k->cstr_info->tile[tileno].num_tps - ); - - /* for every tile part in the tile */ - for (tpno = 0; tpno < j2k->cstr_info->tile[tileno].num_tps; tpno++, acc_tpno++) { - - int sot_len, Psot, Psotp, mm, epb_index = 0, prot_len = 0; - unsigned long sot_pos, post_sod_pos; - unsigned long int left_THmarks_len/*, epbs_len = 0*/; - int startpack = 0, stoppack = j2k->cstr_info->packno; - int first_tp_pack, last_tp_pack; - jpwl_epb_ms_t *tph_epb = NULL; - - /****** sot_pos = j2k->cstr_info->tile[tileno].start_pos; */ - sot_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos; - cio_seek(cio, sot_pos + 2); - sot_len = cio_read(cio, 2); /* SOT Len */ - cio_skip(cio, 2); - Psotp = cio_tell(cio); - Psot = cio_read(cio, 4); /* tile length */ - - /* a-priori length of the data dwelling between SOT and SOD */ - /****** post_sod_pos = j2k->cstr_info->tile[tileno].end_header + 1; */ - post_sod_pos = j2k->cstr_info->tile[tileno].tp[tpno].tp_end_header + 1; - left_THmarks_len = post_sod_pos - (sot_pos + sot_len + 2); - - /* add all the lengths of the JPWL markers which are len-ready and stay within SOT and SOD */ - for (mm = 0; mm < jwmarker_num; mm++) { - if ((jwmarker[mm].pos >= sot_pos) && (jwmarker[mm].pos < post_sod_pos)) { - if (jwmarker[mm].len_ready) - left_THmarks_len += jwmarker[mm].len + 2; - else { - opj_event_msg(j2k->cinfo, EVT_ERROR, "MS %x in %f is not len-ready: could not set up TH EPB\n", - jwmarker[mm].id, jwmarker[mm].dpos); - exit(1); - } - } - } - - /****** if ((tilespec < JPWL_MAX_NO_TILESPECS) && (j2k->cp->hprot_TPH_tileno[tilespec] == tileno)) */ - if ((tilespec < JPWL_MAX_NO_TILESPECS) && (j2k->cp->hprot_TPH_tileno[tilespec] == acc_tpno)) - /* we got a specification from this tile part onwards */ - hprot = j2k->cp->hprot_TPH[tilespec++]; - - /* must this TPH have an EPB MS? */ - if (j2k->cp->epb_on && (hprot > 0)) { - - /* Create the EPB */ - if ((epb_mark = jpwl_epb_create( - j2k, /* this encoder handle */ - 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 */ - tileno, /* we are in TPH */ - epb_index++, /* its index is 0 (first) */ - hprot, /* protection type parameters of following data */ - sot_len + 2, /* pre-data length: only SOT */ - left_THmarks_len /* post-data length: from SOT end to SOD inclusive */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (jwmarker_num < JPWL_MAX_NO_MARKERS) { - jwmarker[jwmarker_num].id = J2K_MS_EPB; /* its type */ - 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].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].len = epb_mark->Lepb; /* its length */ - jwmarker[jwmarker_num].len_ready = true; /* ready */ - jwmarker[jwmarker_num].pos_ready = true; /* ready */ - jwmarker[jwmarker_num].parms_ready = true; /* ready */ - jwmarker[jwmarker_num].data_ready = false; /* not ready */ - jwmarker_num++; - } - - /* update Psot of the tile */ - Psot += epb_mark->Lepb + 2; - - opj_event_msg(j2k->cinfo, EVT_INFO, - /***** "TPH EPB : tile %02d, prot. %d\n", */ - "TPH EPB : tile %02d, part %02d, prot. %d\n", - /***** tileno, */ - tileno, tpno, - hprot - ); - - /* save this TPH EPB address */ - tph_epb = epb_mark; - - } else { - /* ooops, problems */ - /****** opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create TPH EPB #%d\n", tileno); */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create TPH EPB in #%d,d\n", tileno, tpno); - }; - - } - - startpack = 0; - /* EPB MSs for UEP packet data protection in Tile Parts */ - /****** for (packno = 0; packno < j2k->cstr_info->num; packno++) { */ - /*first_tp_pack = (tpno > 0) ? (first_tp_pack + j2k->cstr_info->tile[tileno].tp[tpno - 1].tp_numpacks) : 0;*/ - first_tp_pack = j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pack; - last_tp_pack = first_tp_pack + j2k->cstr_info->tile[tileno].tp[tpno].tp_numpacks - 1; - for (packno = 0; packno < j2k->cstr_info->tile[tileno].tp[tpno].tp_numpacks; packno++) { - - /******** if ((packspec < JPWL_MAX_NO_PACKSPECS) && - (j2k->cp->pprot_tileno[packspec] == tileno) && (j2k->cp->pprot_packno[packspec] == packno)) { */ - if ((packspec < JPWL_MAX_NO_PACKSPECS) && - (j2k->cp->pprot_tileno[packspec] == acc_tpno) && (j2k->cp->pprot_packno[packspec] == packno)) { - - /* we got a specification from this tile and packet onwards */ - /* print the previous spec */ - if (packno > 0) { - stoppack = packno - 1; - opj_event_msg(j2k->cinfo, EVT_INFO, - /***** "UEP EPBs: tile %02d, packs. %02d-%02d (B %d-%d), prot. %d\n", */ - "UEP EPBs: tile %02d, part %02d, packs. %02d-%02d (B %d-%d), prot. %d\n", - /***** tileno, */ - tileno, tpno, - startpack, - stoppack, - /***** j2k->cstr_info->tile[tileno].packet[startpack].start_pos, */ - j2k->cstr_info->tile[tileno].packet[first_tp_pack + startpack].start_pos, - /***** j2k->cstr_info->tile[tileno].packet[stoppack].end_pos, */ - j2k->cstr_info->tile[tileno].packet[first_tp_pack + stoppack].end_pos, - pprot); - - /***** prot_len = j2k->cstr_info->tile[tileno].packet[stoppack].end_pos + 1 - - j2k->cstr_info->tile[tileno].packet[startpack].start_pos; */ - prot_len = j2k->cstr_info->tile[tileno].packet[first_tp_pack + stoppack].end_pos + 1 - - j2k->cstr_info->tile[tileno].packet[first_tp_pack + startpack].start_pos; - - /* - particular case: if this is the last header and the last packet, - then it is better to protect even the EOC marker - */ - /****** if ((tileno == ((j2k->cstr_info->tw * j2k->cstr_info->th) - 1)) && - (stoppack == (j2k->cstr_info->num - 1))) */ - if ((tileno == ((j2k->cstr_info->tw * j2k->cstr_info->th) - 1)) && - (tpno == (j2k->cstr_info->tile[tileno].num_tps - 1)) && - (stoppack == last_tp_pack)) - /* add the EOC len */ - prot_len += 2; - - /* let's add the EPBs */ - Psot += jpwl_epbs_add( - j2k, /* J2K handle */ - jwmarker, /* pointer to JPWL markers list */ - &jwmarker_num, /* pointer to the number of current markers */ - false, /* latest */ - true, /* packed */ - false, /* inside MH */ - &epb_index, /* pointer to EPB index */ - pprot, /* protection type */ - /****** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001, */ /* position */ - (double) (j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2) + 0.0001, /* position */ - tileno, /* number of tile */ - 0, /* length of pre-data */ - prot_len /*4000*/ /* length of post-data */ - ); - } - - startpack = packno; - pprot = j2k->cp->pprot[packspec++]; - } - - //printf("Tile %02d, pack %02d ==> %d\n", tileno, packno, pprot); - - } - - /* we are at the end: print the remaining spec */ - stoppack = packno - 1; - if (pprot >= 0) { - - opj_event_msg(j2k->cinfo, EVT_INFO, - /**** "UEP EPBs: tile %02d, packs. %02d-%02d (B %d-%d), prot. %d\n", */ - "UEP EPBs: tile %02d, part %02d, packs. %02d-%02d (B %d-%d), prot. %d\n", - /**** tileno, */ - tileno, tpno, - startpack, - stoppack, - /***** j2k->image_info->tile[tileno].packet[startpack].start_pos, - j2k->image_info->tile[tileno].packet[stoppack].end_pos, */ - j2k->cstr_info->tile[tileno].packet[first_tp_pack + startpack].start_pos, - j2k->cstr_info->tile[tileno].packet[first_tp_pack + stoppack].end_pos, - pprot); - - /***** prot_len = j2k->cstr_info->tile[tileno].packet[stoppack].end_pos + 1 - - j2k->cstr_info->tile[tileno].packet[startpack].start_pos; */ - prot_len = j2k->cstr_info->tile[tileno].packet[first_tp_pack + stoppack].end_pos + 1 - - j2k->cstr_info->tile[tileno].packet[first_tp_pack + startpack].start_pos; - - /* - particular case: if this is the last header and the last packet, - then it is better to protect even the EOC marker - */ - /***** if ((tileno == ((j2k->cstr_info->tw * j2k->cstr_info->th) - 1)) && - (stoppack == (j2k->cstr_info->num - 1))) */ - if ((tileno == ((j2k->cstr_info->tw * j2k->cstr_info->th) - 1)) && - (tpno == (j2k->cstr_info->tile[tileno].num_tps - 1)) && - (stoppack == last_tp_pack)) - /* add the EOC len */ - prot_len += 2; - - /* let's add the EPBs */ - Psot += jpwl_epbs_add( - j2k, /* J2K handle */ - jwmarker, /* pointer to JPWL markers list */ - &jwmarker_num, /* pointer to the number of current markers */ - true, /* latest */ - true, /* packed */ - false, /* inside MH */ - &epb_index, /* pointer to EPB index */ - pprot, /* protection type */ - /***** (double) (j2k->cstr_info->tile[tileno].start_pos + sot_len + 2) + 0.0001,*/ /* position */ - (double) (j2k->cstr_info->tile[tileno].tp[tpno].tp_start_pos + sot_len + 2) + 0.0001, /* position */ - tileno, /* number of tile */ - 0, /* length of pre-data */ - prot_len /*4000*/ /* length of post-data */ - ); - } - - /* we can now check if the TPH EPB was really the last one */ - if (tph_epb && (epb_index == 1)) { - /* set the TPH EPB to be the last one in current header */ - tph_epb->Depb |= (unsigned char) ((true & 0x0001) << 6); - tph_epb = NULL; - } - - /* write back Psot */ - cio_seek(cio, Psotp); - cio_write(cio, Psot, 4); - - } - - }; - - /* reset the position */ - cio_seek(cio, ciopos); - -} - -void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) { - - int mm; - unsigned long int old_size = j2k->cstr_info->codestream_size; - unsigned long int new_size = old_size; - int /*ciopos = cio_tell(cio),*/ soc_pos = j2k->cstr_info->main_head_start; - unsigned char *jpwl_buf, *orig_buf; - unsigned long int orig_pos; - double epbcoding_time = 0.0, esdcoding_time = 0.0; - - /* Order JPWL markers according to their wishlist position */ - qsort((void *) jwmarker, (size_t) jwmarker_num, sizeof (jpwl_marker_t), jpwl_markcomp); - - /* compute markers total size */ - for (mm = 0; mm < jwmarker_num; mm++) { - /*printf("%x, %d, %.10f, %d long\n", jwmarker[mm].id, jwmarker[mm].pos, - jwmarker[mm].dpos, jwmarker[mm].len);*/ - new_size += jwmarker[mm].len + 2; - } - - /* allocate a new buffer of proper size */ - if (!(jpwl_buf = (unsigned char *) opj_malloc((size_t) (new_size + soc_pos) * sizeof(unsigned char)))) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for JPWL codestream buffer\n"); - exit(1); - }; - - /* copy the jp2 part, if any */ - orig_buf = jpwl_buf; - memcpy(jpwl_buf, cio->buffer, soc_pos); - jpwl_buf += soc_pos; - - /* cycle through markers */ - orig_pos = soc_pos + 0; /* start from the beginning */ - cio_seek(cio, soc_pos + 0); /* rewind the original */ - for (mm = 0; mm < jwmarker_num; mm++) { - - /* - need to copy a piece of the original codestream - if there is such - */ - memcpy(jpwl_buf, cio_getbp(cio), jwmarker[mm].pos - orig_pos); - jpwl_buf += jwmarker[mm].pos - orig_pos; - orig_pos = jwmarker[mm].pos; - cio_seek(cio, orig_pos); - - /* - then write down the marker - */ - switch (jwmarker[mm].id) { - - case J2K_MS_EPB: - jpwl_epb_write(j2k, jwmarker[mm].m.epbmark, jpwl_buf); - break; - - case J2K_MS_EPC: - jpwl_epc_write(j2k, jwmarker[mm].m.epcmark, jpwl_buf); - break; - - case J2K_MS_ESD: - jpwl_esd_write(j2k, jwmarker[mm].m.esdmark, jpwl_buf); - break; - - case J2K_MS_RED: - memset(jpwl_buf, 0, jwmarker[mm].len + 2); /* placeholder */ - break; - - default: - break; - }; - - /* we update the markers struct */ - if (j2k->cstr_info) - j2k->cstr_info->marker[j2k->cstr_info->marknum - 1].pos = (jpwl_buf - orig_buf); - - /* we set the marker dpos to the new position in the JPWL codestream */ - jwmarker[mm].dpos = (double) (jpwl_buf - orig_buf); - - /* advance JPWL buffer position */ - jpwl_buf += jwmarker[mm].len + 2; - - } - - /* finish remaining original codestream */ - memcpy(jpwl_buf, cio_getbp(cio), old_size - (orig_pos - soc_pos)); - jpwl_buf += old_size - (orig_pos - soc_pos); - cio_seek(cio, soc_pos + old_size); - - /* - update info file based on added markers - */ - if (!jpwl_update_info(j2k, jwmarker, jwmarker_num)) - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not update OPJ cstr_info structure\n"); - - /* now we need to repass some markers and fill their data fields */ - - /* first of all, DL and Pcrc in EPCs */ - for (mm = 0; mm < jwmarker_num; mm++) { - - /* find the EPCs */ - if (jwmarker[mm].id == J2K_MS_EPC) { - - int epc_pos = (int) jwmarker[mm].dpos, pp; - unsigned short int mycrc = 0x0000; - - /* fix and fill the DL field */ - jwmarker[mm].m.epcmark->DL = new_size; - orig_buf[epc_pos + 6] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 24); - orig_buf[epc_pos + 7] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 16); - orig_buf[epc_pos + 8] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 8); - orig_buf[epc_pos + 9] = (unsigned char) (jwmarker[mm].m.epcmark->DL >> 0); - - /* compute the CRC field (excluding itself) */ - for (pp = 0; pp < 4; pp++) - jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]); - for (pp = 6; pp < (jwmarker[mm].len + 2); pp++) - jpwl_updateCRC16(&mycrc, orig_buf[epc_pos + pp]); - - /* fix and fill the CRC */ - jwmarker[mm].m.epcmark->Pcrc = mycrc; - orig_buf[epc_pos + 4] = (unsigned char) (jwmarker[mm].m.epcmark->Pcrc >> 8); - orig_buf[epc_pos + 5] = (unsigned char) (jwmarker[mm].m.epcmark->Pcrc >> 0); - - } - } - - /* then, sensitivity data in ESDs */ - esdcoding_time = opj_clock(); - for (mm = 0; mm < jwmarker_num; mm++) { - - /* find the ESDs */ - if (jwmarker[mm].id == J2K_MS_ESD) { - - /* remember that they are now in a new position (dpos) */ - int esd_pos = (int) jwmarker[mm].dpos; - - jpwl_esd_fill(j2k, jwmarker[mm].m.esdmark, &orig_buf[esd_pos]); - - } - - } - esdcoding_time = opj_clock() - esdcoding_time; - if (j2k->cp->esd_on) - opj_event_msg(j2k->cinfo, EVT_INFO, "ESDs sensitivities computed in %f s\n", esdcoding_time); - - /* finally, RS or CRC parity in EPBs */ - epbcoding_time = opj_clock(); - for (mm = 0; mm < jwmarker_num; mm++) { - - /* find the EPBs */ - if (jwmarker[mm].id == J2K_MS_EPB) { - - /* remember that they are now in a new position (dpos) */ - int nn, accum_len; - - /* let's see how many EPBs are following this one, included itself */ - /* for this to work, we suppose that the markers are correctly ordered */ - /* and, overall, that they are in packed mode inside headers */ - accum_len = 0; - for (nn = mm; (nn < jwmarker_num) && (jwmarker[nn].id == J2K_MS_EPB) && - (jwmarker[nn].pos == jwmarker[mm].pos); nn++) - accum_len += jwmarker[nn].m.epbmark->Lepb + 2; - - /* fill the current (first) EPB with post-data starting from the computed position */ - jpwl_epb_fill(j2k, jwmarker[mm].m.epbmark, &orig_buf[(int) jwmarker[mm].dpos], - &orig_buf[(int) jwmarker[mm].dpos + accum_len]); - - /* 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) && - (jwmarker[nn].pos == jwmarker[mm].pos); nn++) - jpwl_epb_fill(j2k, jwmarker[nn].m.epbmark, &orig_buf[(int) jwmarker[nn].dpos], NULL); - - /* skip all the processed EPBs */ - mm = nn - 1; - } - - } - epbcoding_time = opj_clock() - epbcoding_time; - if (j2k->cp->epb_on) - opj_event_msg(j2k->cinfo, EVT_INFO, "EPBs redundancy computed in %f s\n", epbcoding_time); - - /* free original cio buffer and set it to the JPWL one */ - opj_free(cio->buffer); - cio->cinfo = cio->cinfo; /* no change */ - cio->openmode = cio->openmode; /* no change */ - cio->buffer = orig_buf; - cio->length = new_size + soc_pos; - cio->start = cio->buffer; - cio->end = cio->buffer + cio->length; - cio->bp = cio->buffer; - cio_seek(cio, soc_pos + new_size); - -} - - -void j2k_read_epc(opj_j2k_t *j2k) { - unsigned long int DL, Lepcp, Pcrcp, l; - unsigned short int Lepc, Pcrc = 0x0000; - unsigned char Pepc; - opj_cio_t *cio = j2k->cio; - char *ans1; - - /* Simply read the EPC parameters */ - Lepcp = cio_tell(cio); - Lepc = cio_read(cio, 2); - Pcrcp = cio_tell(cio); - cio_skip(cio, 2); /* Pcrc */ - DL = cio_read(cio, 4); - Pepc = cio_read(cio, 1); - - /* compute Pcrc */ - cio_seek(cio, Lepcp - 2); - - /* Marker */ - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* Length */ - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* skip Pcrc */ - cio_skip(cio, 2); - - /* read all remaining */ - for (l = 4; l < Lepc; l++) - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* check Pcrc with the result */ - cio_seek(cio, Pcrcp); - ans1 = (Pcrc == (unsigned short int) cio_read(cio, 2)) ? "crc-ok" : "crc-ko"; - - /* now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "EPC(%u,%d): %s, DL=%d%s %s %s\n", - Lepcp - 2, - Lepc, - ans1, - DL, /* data length this EPC is referring to */ - (Pepc & 0x10) ? ", esd" : "", /* ESD is present */ - (Pepc & 0x20) ? ", red" : "", /* RED is present */ - (Pepc & 0x40) ? ", epb" : ""); /* EPB is present */ - - cio_seek(cio, Lepcp + Lepc); -} - -void j2k_write_epc(opj_j2k_t *j2k) { - - unsigned long int DL, Lepcp, Pcrcp, l; - unsigned short int Lepc, Pcrc; - unsigned char Pepc; - - opj_cio_t *cio = j2k->cio; - - cio_write(cio, J2K_MS_EPC, 2); /* EPC */ - Lepcp = cio_tell(cio); - cio_skip(cio, 2); - - /* CRC-16 word of the EPC */ - Pcrc = 0x0000; /* initialize */ - Pcrcp = cio_tell(cio); - cio_write(cio, Pcrc, 2); /* Pcrc placeholder*/ - - /* data length of the EPC protection domain */ - DL = 0x00000000; /* we leave this set to 0, as if the information is not available */ - cio_write(cio, DL, 4); /* DL */ - - /* jpwl capabilities */ - Pepc = 0x00; - cio_write(cio, Pepc, 1); /* Pepc */ - - /* ID section */ - /* no ID's, as of now */ - - Lepc = (unsigned short) (cio_tell(cio) - Lepcp); - cio_seek(cio, Lepcp); - cio_write(cio, Lepc, 2); /* Lepc */ - - /* compute Pcrc */ - cio_seek(cio, Lepcp - 2); - - /* Marker */ - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* Length */ - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* skip Pcrc */ - cio_skip(cio, 2); - - /* read all remaining */ - for (l = 4; l < Lepc; l++) - jpwl_updateCRC16(&Pcrc, (unsigned char) cio_read(cio, 1)); - - /* fill Pcrc with the result */ - cio_seek(cio, Pcrcp); - cio_write(cio, Pcrc, 2); - - cio_seek(cio, Lepcp + Lepc); - - /* marker struct update */ - j2k_add_marker(j2k->cstr_info, J2K_MS_EPC, Lepcp - 2, Lepc + 2); - -} - -void j2k_read_epb(opj_j2k_t *j2k) { - unsigned long int LDPepb, Pepb; - unsigned short int Lepb; - unsigned char Depb; - char str1[25] = ""; - bool status; - static bool first_in_tph = true; - int type, pre_len, post_len; - static unsigned char *redund = NULL; - - opj_cio_t *cio = j2k->cio; - - /* B/W = 45, RGB = 51 */ - /* SIZ SIZ_FIELDS SIZ_COMPS FOLLOWING_MARKER */ - int skipnum = 2 + 38 + 3 * j2k->cp->exp_comps + 2; - - if (j2k->cp->correct) { - - /* go back to EPB marker value */ - cio_seek(cio, cio_tell(cio) - 2); - - /* we need to understand where we are */ - if (j2k->state == J2K_STATE_MH) { - /* we are in MH */ - type = 0; /* MH */ - pre_len = skipnum; /* SOC+SIZ */ - post_len = -1; /* auto */ - - } else if ((j2k->state == J2K_STATE_TPH) && first_in_tph) { - /* we are in TPH */ - type = 1; /* TPH */ - pre_len = 12; /* SOC+SIZ */ - first_in_tph = false; - post_len = -1; /* auto */ - - } else { - /* we are elsewhere */ - type = 2; /* other */ - pre_len = 0; /* nada */ - post_len = -1; /* auto */ - - } - - /* call EPB corrector */ - /*printf("before %x, ", redund);*/ - status = jpwl_epb_correct(j2k, /* J2K decompressor handle */ - cio->bp, /* pointer to EPB in codestream buffer */ - type, /* EPB type: MH */ - pre_len, /* length of pre-data */ - post_len, /* length of post-data: -1 means auto */ - NULL, /* do everything auto */ - &redund - ); - /*printf("after %x\n", redund);*/ - - /* Read the (possibly corrected) EPB parameters */ - cio_skip(cio, 2); - Lepb = cio_read(cio, 2); - Depb = cio_read(cio, 1); - LDPepb = cio_read(cio, 4); - Pepb = cio_read(cio, 4); - - if (!status) { - - opj_event_msg(j2k->cinfo, EVT_ERROR, "JPWL correction could not be performed\n"); - - /* advance to EPB endpoint */ - cio_skip(cio, Lepb + 2); - - return; - } - - /* last in current header? */ - if (Depb & 0x40) { - redund = NULL; /* reset the pointer to L4 buffer */ - first_in_tph = true; - } - - /* advance to EPB endpoint */ - cio_skip(cio, Lepb - 11); - - } else { - - /* Simply read the EPB parameters */ - Lepb = cio_read(cio, 2); - Depb = cio_read(cio, 1); - LDPepb = cio_read(cio, 4); - Pepb = cio_read(cio, 4); - - /* What does Pepb tells us about the protection method? */ - if (((Pepb & 0xF0000000) >> 28) == 0) - sprintf(str1, "pred"); /* predefined */ - else if (((Pepb & 0xF0000000) >> 28) == 1) - sprintf(str1, "crc-%lu", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */ - else if (((Pepb & 0xF0000000) >> 28) == 2) - sprintf(str1, "rs(%lu,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */ - else if (Pepb == 0xFFFFFFFF) - sprintf(str1, "nometh"); /* RS mode */ - else - sprintf(str1, "unknown"); /* unknown */ - - /* Now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "EPB(%d): (%sl, %sp, %u), %lu, %s\n", - cio_tell(cio) - 13, - (Depb & 0x40) ? "" : "n", /* latest EPB or not? */ - (Depb & 0x80) ? "" : "n", /* packed or unpacked EPB? */ - (Depb & 0x3F), /* EPB index value */ - LDPepb, /*length of the data protected by the EPB */ - str1); /* protection method */ - - cio_skip(cio, Lepb - 11); - } -} - -void j2k_write_epb(opj_j2k_t *j2k) { - unsigned long int LDPepb, Pepb, Lepbp; - unsigned short int Lepb; - unsigned char Depb; - - opj_cio_t *cio = j2k->cio; - - cio_write(cio, J2K_MS_EPB, 2); /* EPB */ - Lepbp = cio_tell(cio); - cio_skip(cio, 2); - - /* EPB style */ - Depb = 0x00; /* test */ - cio_write(cio, Depb, 1); /* Depb */ - - /* length of the data to be protected by this EPB */ - LDPepb = 0x00000000; /* test */ - cio_write(cio, LDPepb, 4); /* LDPepb */ - - /* next error correction tool */ - Pepb = 0x00000000; /* test */ - cio_write(cio, Pepb, 4); /* Pepb */ - - /* EPB data */ - /* no data, as of now */ - - Lepb = (unsigned short) (cio_tell(cio) - Lepbp); - cio_seek(cio, Lepbp); - cio_write(cio, Lepb, 2); /* Lepb */ - - cio_seek(cio, Lepbp + Lepb); - - /* marker struct update */ - j2k_add_marker(j2k->cstr_info, J2K_MS_EPB, Lepbp - 2, Lepb + 2); -} - -void j2k_read_esd(opj_j2k_t *j2k) { - unsigned short int Lesd, Cesd; - unsigned char Pesd; - - int cesdsize = (j2k->image->numcomps >= 257) ? 2 : 1; - - char str1[4][4] = {"p", "br", "pr", "res"}; - char str2[8][8] = {"res", "mse", "mse-r", "psnr", "psnr-i", "maxerr", "tse", "res"}; - - opj_cio_t *cio = j2k->cio; - - /* Simply read the ESD parameters */ - Lesd = cio_read(cio, 2); - Cesd = cio_read(cio, cesdsize); - Pesd = cio_read(cio, 1); - - /* Now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "ESD(%d): c%d, %s, %s, %s, %s, %s\n", - cio_tell(cio) - (5 + cesdsize), - Cesd, /* component number for this ESD */ - str1[(Pesd & (unsigned char) 0xC0) >> 6], /* addressing mode */ - str2[(Pesd & (unsigned char) 0x38) >> 3], /* sensitivity type */ - ((Pesd & (unsigned char) 0x04) >> 2) ? "2Bs" : "1Bs", - ((Pesd & (unsigned char) 0x02) >> 1) ? "4Ba" : "2Ba", - (Pesd & (unsigned char) 0x01) ? "avgc" : ""); - - cio_skip(cio, Lesd - (3 + cesdsize)); -} - -void j2k_read_red(opj_j2k_t *j2k) { - unsigned short int Lred; - unsigned char Pred; - char str1[4][4] = {"p", "br", "pr", "res"}; - - opj_cio_t *cio = j2k->cio; - - /* Simply read the RED parameters */ - Lred = cio_read(cio, 2); - Pred = cio_read(cio, 1); - - /* Now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "RED(%d): %s, %dc, %s, %s\n", - cio_tell(cio) - 5, - str1[(Pred & (unsigned char) 0xC0) >> 6], /* addressing mode */ - (Pred & (unsigned char) 0x38) >> 3, /* corruption level */ - ((Pred & (unsigned char) 0x02) >> 1) ? "4Ba" : "2Ba", /* address range */ - (Pred & (unsigned char) 0x01) ? "errs" : "free"); /* error free? */ - - cio_skip(cio, Lred - 3); -} - -bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) { - -#ifdef oerhgierhgvhreit4u - /* - we navigate through the tile and find possible invalid parameters: - this saves a lot of crashes!!!!! - */ - int compno, resno, precno, /*layno,*/ bandno, blockno; - int numprecincts, numblocks; - - /* this is the selected tile */ - opj_tcd_tile_t *tile = &(tcd->tcd_image->tiles[tileno]); - - /* will keep the component */ - opj_tcd_tilecomp_t *comp = NULL; - - /* will keep the resolution */ - opj_tcd_resolution_t *res; - - /* will keep the subband */ - opj_tcd_band_t *band; - - /* will keep the precinct */ - opj_tcd_precinct_t *prec; - - /* will keep the codeblock */ - opj_tcd_cblk_t *block; - - /* check all tile components */ - for (compno = 0; compno < tile->numcomps; compno++) { - comp = &(tile->comps[compno]); - - /* check all component resolutions */ - for (resno = 0; resno < comp->numresolutions; resno++) { - res = &(comp->resolutions[resno]); - numprecincts = res->pw * res->ph; - - /* check all the subbands */ - for (bandno = 0; bandno < res->numbands; bandno++) { - band = &(res->bands[bandno]); - - /* check all the precincts */ - for (precno = 0; precno < numprecincts; precno++) { - prec = &(band->precincts[precno]); - numblocks = prec->ch * prec->cw; - - /* check all the codeblocks */ - for (blockno = 0; blockno < numblocks; blockno++) { - block = &(prec->cblks[blockno]); - - /* x-origin is invalid */ - if ((block->x0 < prec->x0) || (block->x0 > prec->x1)) { - opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR, - "JPWL: wrong x-cord of block origin %d => x-prec is (%d, %d)\n", - block->x0, prec->x0, prec->x1); - if (!JPWL_ASSUME || JPWL_ASSUME) - return false; - }; - } - } - } - } - } - -#endif - - return true; -} - -/*@}*/ - -#endif /* USE_JPWL */ - - -#ifdef USE_JPSEC - -/** @defgroup JPSEC JPSEC - JPEG-2000 Part 8 (JPSEC) codestream manager */ -/*@{*/ - - -/** @name Local static functions */ -/*@{*/ - -void j2k_read_sec(opj_j2k_t *j2k) { - unsigned short int Lsec; - - opj_cio_t *cio = j2k->cio; - - /* Simply read the SEC length */ - Lsec = cio_read(cio, 2); - - /* Now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "SEC(%d)\n", - cio_tell(cio) - 2 - ); - - cio_skip(cio, Lsec - 2); -} - -void j2k_write_sec(opj_j2k_t *j2k) { - unsigned short int Lsec = 24; - int i; - - opj_cio_t *cio = j2k->cio; - - cio_write(cio, J2K_MS_SEC, 2); /* SEC */ - cio_write(cio, Lsec, 2); - - /* write dummy data */ - for (i = 0; i < Lsec - 2; i++) - cio_write(cio, 0, 1); -} - -void j2k_read_insec(opj_j2k_t *j2k) { - unsigned short int Linsec; - - opj_cio_t *cio = j2k->cio; - - /* Simply read the INSEC length */ - Linsec = cio_read(cio, 2); - - /* Now we write them to screen */ - opj_event_msg(j2k->cinfo, EVT_INFO, - "INSEC(%d)\n", - cio_tell(cio) - 2 - ); - - cio_skip(cio, Linsec - 2); -} - - -/*@}*/ - -/*@}*/ - -#endif /* USE_JPSEC */ - diff --git a/jpwl/jpwl.h b/jpwl/jpwl.h deleted file mode 100644 index a96840cc..00000000 --- a/jpwl/jpwl.h +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __JPWL_H -#define __JPWL_H - -#ifdef USE_JPWL - -#include "crc.h" -#include "rs.h" - -/** -@file jpwl.h -@brief The JPEG-2000 Part11 (JPWL) marker segments manager - -The functions in JPWL.C have for goal to read/write the markers added by JPWL. -*/ - -/** @defgroup JPWL JPWL - JPEG-2000 Part11 (JPWL) codestream manager */ -/*@{*/ - -/** -Assume a basic codestream structure, so you can resort better from uncorrected errors -*/ -#define JPWL_ASSUME true - -/** -EPB (Error Protection Block) Marker segment -*/ -typedef struct jpwl_epb_ms { - /**@name Private fields set by epb_create */ - /*@{*/ - /** is the latest in header? */ - bool latest; - /** is it in packed mode? */ - bool packed; - /** TH where this marker has been placed (-1 means MH) */ - int tileno; - /** index in current header (0-63) */ - unsigned char index; - /** error protection method [-1=absent 0=none 1=predefined 16=CRC-16 32=CRC-32 37-128=RS] */ - int hprot; - /** message word length of pre-data */ - int k_pre; - /** code word length of pre-data */ - int n_pre; - /** length of pre-data */ - int pre_len; - /** message word length of post-data */ - int k_post; - /** code word length of post-data */ - int n_post; - /** length of post-data */ - int post_len; - /*@}*/ - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of EPB MS, exluding the marker itself (11 to 65535 bytes) */ - unsigned short int Lepb; - /** single byte for the style */ - unsigned char Depb; - /** four bytes, from 0 to 2^31-1 */ - unsigned long int LDPepb; - /** four bytes, next error management method */ - unsigned long int Pepb; - /** EPB data, variable size */ - unsigned char *data; - /*@}*/ -} jpwl_epb_ms_t; - -/** -EPC (Error Protection Capability) Marker segment -*/ -typedef struct jpwl_epc_ms { - /** is ESD active? */ - bool esd_on; - /** is RED active? */ - bool red_on; - /** is EPB active? */ - bool epb_on; - /** are informative techniques active? */ - bool info_on; - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes) */ - unsigned short int Lepc; - /** two bytes, CRC for the EPC, excluding Pcrc itself */ - unsigned short int Pcrc; - /** four bytes, the codestream length from SOC to EOC */ - unsigned long int DL; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pepc; - /** EPC data, variable length */ - unsigned char *data; - /*@}*/ -} jpwl_epc_ms_t; - -/** -ESD (Error Sensitivity Descriptor) Marker segment -*/ -typedef struct jpwl_esd_ms { - /** codestream addressing mode [0=packet, 1=byte range, 2=packet range, 3=reserved] */ - unsigned char addrm; - /** size of codestream addresses [2/4 bytes] */ - unsigned char ad_size; - /** type of sensitivity - [0=relative error, 1=MSE, 2=MSE reduction, 3=PSNR, 4=PSNR increment, - 5=MAXERR (absolute peak error), 6=TSE (total squared error), 7=reserved */ - unsigned char senst; - /** size of sensitivity data (1/2 bytes) */ - unsigned char se_size; - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of ESD MS, exluding the marker itself (4 to 65535 bytes) */ - unsigned short int Lesd; - /** two bytes, component of error sensitivity */ - unsigned short int Cesd; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pesd; - /** ESD data, variable length */ - unsigned char *data; - /*@}*/ - /**@name Fields set by esd_create (only internal use) */ - /*@{*/ - /** number of components in the image */ - int numcomps; - /** tile where this marker has been placed (-1 means MH) */ - int tileno; - /** number of sensitivity values */ - unsigned long int svalnum; - /** size of a single sensitivity pair (address+value) */ - size_t sensval_size; - /*@}*/ -} jpwl_esd_ms_t; - -/** -RED (Residual Error Descriptor) Marker segment -*/ -typedef struct jpwl_red_ms { - /** two bytes for the length of RED MS, exluding the marker itself (3 to 65535 bytes) */ - unsigned short int Lred; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pred; - /** RED data, variable length */ - unsigned char *data; -} jpwl_red_ms_t; - -/** -Structure used to store JPWL markers temporary position and readyness -*/ -typedef struct jpwl_marker { - /** marker value (J2K_MS_EPC, etc.) */ - int id; - /** union keeping the pointer to the real marker struct */ - union jpwl_marks { - /** pointer to EPB marker */ - jpwl_epb_ms_t *epbmark; - /** pointer to EPC marker */ - jpwl_epc_ms_t *epcmark; - /** pointer to ESD marker */ - jpwl_esd_ms_t *esdmark; - /** pointer to RED marker */ - jpwl_red_ms_t *redmark; - } m; - /** position where the marker should go, in the pre-JPWL codestream */ - unsigned long int pos; - /** same as before, only written as a double, so we can sort it better */ - double dpos; - /** length of the marker segment (marker excluded) */ - unsigned short int len; - /** the marker length is ready or not? */ - bool len_ready; - /** the marker position is ready or not? */ - bool pos_ready; - /** the marker parameters are ready or not? */ - bool parms_ready; - /** are the written data ready or not */ - bool data_ready; -} jpwl_marker_t; - -/** -Encode according to JPWL specs -@param j2k J2K handle -@param cio codestream handle -@param image image handle -*/ -void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); - -/** -Prepare the list of JPWL markers, after the Part 1 codestream -has been finalized (index struct is full) -@param j2k J2K handle -@param cio codestream handle -@param image image handle -*/ -void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); - -/** -Dump the list of JPWL markers, after it has been prepared -@param j2k J2K handle -@param cio codestream handle -@param image image handle -*/ -void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); - -/** -Read the EPC marker (Error Protection Capability) -@param j2k J2K handle -*/ -void j2k_read_epc(opj_j2k_t *j2k); - -/** -Write the EPC marker (Error Protection Capability), BUT the DL field is always set to 0 -(this simplifies the management of EPBs and it is openly stated in the standard -as a possible value, mening that the information is not available) and the informative techniques -are not yet implemented -@param j2k J2K handle -*/ -void j2k_write_epc(opj_j2k_t *j2k); - -/** -Read the EPB marker (Error Protection Block) -@param j2k J2K handle -*/ -void j2k_read_epb(opj_j2k_t *j2k); - -/** -Write the EPB marker (Error Protection Block) -@param j2k J2K handle -*/ -void j2k_write_epb(opj_j2k_t *j2k); - -/** -Read the ESD marker (Error Sensitivity Descriptor) -@param j2k J2K handle -*/ -void j2k_read_esd(opj_j2k_t *j2k); - -/** -Read the RED marker (Residual Error Descriptor) -@param j2k J2K handle -*/ -void j2k_read_red(opj_j2k_t *j2k); - -/** create an EPB marker segment -@param j2k J2K compressor handle -@param latest it is the latest EPB in the header -@param packed EPB is in packed style -@param tileno tile number where the marker has been placed (-1 means MH) -@param idx current EPB running index -@param hprot applied protection type (-1/0,1,16,32,37-128) -@param pre_len length of pre-protected data -@param post_len length of post-protected data -@return returns the freshly created EPB -*/ -jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int tileno, int idx, int hprot, - unsigned long int pre_len, unsigned long int post_len); - -/** add a number of EPB marker segments -@param j2k J2K compressor handle -@param jwmarker pointer to the JPWL markers list -@param jwmarker_num pointer to the number of JPWL markers (gets updated) -@param latest it is the latest group of EPBs in the header -@param packed EPBs are in packed style -@param insideMH it is in the MH -@param idx pointer to the starting EPB running index (gets updated) -@param hprot applied protection type (-1/0,1,16,32,37-128) -@param place_pos place in original codestream where EPBs should go -@param tileno tile number of these EPBs -@param pre_len length of pre-protected data -@param post_len length of post-protected data -@return returns the length of all added markers -*/ -int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - bool latest, bool packed, bool insideMH, int *idx, int hprot, - double place_pos, int tileno, - unsigned long int pre_len, unsigned long int post_len); - -/** add a number of ESD marker segments -@param j2k J2K compressor handle -@param jwmarker pointer to the JPWL markers list -@param jwmarker_num pointer to the number of JPWL markers (gets updated) -@param comps considered component (-1=average, 0/1/2/...=component no.) -@param addrm addressing mode (0=packet, 1=byte range, 2=packet range, 3=reserved) -@param ad_size size of addresses (2/4 bytes) -@param senst sensitivity type -@param se_size sensitivity values size (1/2 bytes) -@param place_pos place in original codestream where EPBs should go -@param tileno tile number of these EPBs -@return returns the length of all added markers -*/ -int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - int comps, unsigned char addrm, unsigned char ad_size, - unsigned char senst, unsigned char se_size, - double place_pos, int tileno); - -/** updates the information structure by modifying the positions and lengths -@param j2k J2K compressor handle -@param jwmarker pointer to JPWL markers list -@param jwmarker_num number of JPWL markers -@return returns true in case of success -*/ -bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num); - - -bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf); - -bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf); - -void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len); - -/** corrects the data in the JPWL codestream -@param j2k J2K compressor handle -@return true if correction is performed correctly -*/ -bool jpwl_correct(opj_j2k_t *j2k); - -/** corrects the data protected by an EPB -@param j2k J2K compressor handle -@param buffer pointer to the EPB position -@param type type of EPB: 0=MH, 1=TPH, 2=other, 3=auto -@param pre_len length of pre-data -@param post_len length of post_data -@param conn is a pointer to the length of all connected (packed) EPBs -@param L4_bufp is a pointer to the buffer pointer of redundancy data -@return returns true if correction could be succesfully performed -*/ -bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn, - unsigned char **L4_bufp); - -/** check that a tile and its children have valid data -@param j2k J2K decompressor handle -@param tcd Tile decompressor handle -@param tileno number of the tile to check -*/ -bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno); - -/** Macro functions for CRC computation */ - -/** -Computes the CRC-16, as stated in JPWL specs -@param CRC two bytes containing the CRC value (must be initialized with 0x0000) -@param DATA byte for which the CRC is computed; call this on every byte of the sequence -and get the CRC at the end -*/ -#define jpwl_updateCRC16(CRC, DATA) updateCRC16(CRC, DATA) - -/** -Computes the CRC-32, as stated in JPWL specs -@param CRC four bytes containing the CRC value (must be initialized with 0x00000000) -@param DATA byte for which the CRC is computed; call this on every byte of the sequence -and get the CRC at the end -*/ -#define jpwl_updateCRC32(CRC, DATA) updateCRC32(CRC, DATA) - -/** -Computes the minimum between two integers -@param a first integer to compare -@param b second integer to compare -@return returns the minimum integer between a and b -*/ -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif /* min */ - -/*@}*/ - -#endif /* USE_JPWL */ - -#ifdef USE_JPSEC - -/** @defgroup JPSEC JPSEC - JPEG-2000 Part 8 (JPSEC) codestream manager */ -/*@{*/ - -/** -Read the SEC marker (SEcured Codestream) -@param j2k J2K handle -*/ -void j2k_read_sec(opj_j2k_t *j2k); - -/** -Write the SEC marker (SEcured Codestream) -@param j2k J2K handle -*/ -void j2k_write_sec(opj_j2k_t *j2k); - -/** -Read the INSEC marker (SEcured Codestream) -@param j2k J2K handle -*/ -void j2k_read_insec(opj_j2k_t *j2k); - -/*@}*/ - -#endif /* USE_JPSEC */ - -#endif /* __JPWL_H */ - diff --git a/jpwl/jpwl_lib.c b/jpwl/jpwl_lib.c deleted file mode 100644 index 90391b01..00000000 --- a/jpwl/jpwl_lib.c +++ /dev/null @@ -1,1796 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef USE_JPWL - -#include "../libopenjpeg/opj_includes.h" -#include - -/** Minimum and maximum values for the double->pfp conversion */ -#define MIN_V1 0.0 -#define MAX_V1 17293822569102704640.0 -#define MIN_V2 0.000030517578125 -#define MAX_V2 131040.0 - -/** conversion between a double precision floating point -number and the corresponding pseudo-floating point used -to represent sensitivity values -@param V the double precision value -@param bytes the number of bytes of the representation -@return the pseudo-floating point value (cast accordingly) -*/ -unsigned short int jpwl_double_to_pfp(double V, int bytes); - -/** conversion between a pseudo-floating point used -to represent sensitivity values and the corresponding -double precision floating point number -@param em the pseudo-floating point value (cast accordingly) -@param bytes the number of bytes of the representation -@return the double precision value -*/ -double jpwl_pfp_to_double(unsigned short int em, int bytes); - - /*-------------------------------------------------------------*/ - -int jpwl_markcomp(const void *arg1, const void *arg2) -{ - /* Compare the two markers' positions */ - double diff = (((jpwl_marker_t *) arg1)->dpos - ((jpwl_marker_t *) arg2)->dpos); - - if (diff == 0.0) - return (0); - else if (diff < 0) - return (-1); - else - return (+1); -} - -int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - bool latest, bool packed, bool insideMH, int *idx, int hprot, - double place_pos, int tileno, - unsigned long int pre_len, unsigned long int post_len) { - - jpwl_epb_ms_t *epb_mark = NULL; - - int k_pre, k_post, n_pre, n_post; - - unsigned long int L1, L2, dL4, max_postlen, epbs_len = 0; - - /* We find RS(n,k) for EPB parms and pre-data, if any */ - if (insideMH && (*idx == 0)) { - /* First EPB in MH */ - k_pre = 64; - n_pre = 160; - } else if (!insideMH && (*idx == 0)) { - /* First EPB in TH */ - k_pre = 25; - n_pre = 80; - } else { - /* Following EPBs in MH or TH */ - k_pre = 13; - n_pre = 40; - }; - - /* Find lengths, Figs. B3 and B4 */ - /* size of pre data: pre_buf(pre_len) + EPB(2) + Lepb(2) + Depb(1) + LDPepb(4) + Pepb(4) */ - L1 = pre_len + 13; - - /* size of pre-data redundancy */ - /* (redundancy per codeword) * (number of codewords, rounded up) */ - L2 = (n_pre - k_pre) * (unsigned long int) ceil((double) L1 / (double) k_pre); - - /* Find protection type for post data and its associated redundancy field length*/ - if ((hprot == 16) || (hprot == 32)) { - /* there is a CRC for post-data */ - k_post = post_len; - n_post = post_len + (hprot >> 3); - /*L3 = hprot >> 3;*/ /* 2 (CRC-16) or 4 (CRC-32) bytes */ - - } else if ((hprot >= 37) && (hprot <= 128)) { - /* there is a RS for post-data */ - k_post = 32; - n_post = hprot; - - } else { - /* Use predefined codes */ - n_post = n_pre; - k_post = k_pre; - }; - - /* Create the EPB(s) */ - while (post_len > 0) { - - /* maximum postlen in order to respect EPB size - (we use JPWL_MAXIMUM_EPB_ROOM instead of 65535 for keeping room for EPB parms)*/ - /* (message word size) * (number of containable parity words) */ - max_postlen = k_post * (unsigned long int) floor((double) JPWL_MAXIMUM_EPB_ROOM / (double) (n_post - k_post)); - - /* maximum postlen in order to respect EPB size */ - if (*idx == 0) - /* (we use (JPWL_MAXIMUM_EPB_ROOM - L2) instead of 65535 for keeping room for EPB parms + pre-data) */ - /* (message word size) * (number of containable parity words) */ - max_postlen = k_post * (unsigned long int) floor((double) (JPWL_MAXIMUM_EPB_ROOM - L2) / (double) (n_post - k_post)); - - else - /* (we use JPWL_MAXIMUM_EPB_ROOM instead of 65535 for keeping room for EPB parms) */ - /* (message word size) * (number of containable parity words) */ - max_postlen = k_post * (unsigned long int) floor((double) JPWL_MAXIMUM_EPB_ROOM / (double) (n_post - k_post)); - - /* null protection case */ - /* the max post length can be as large as the LDPepb field can host */ - if (hprot == 0) - max_postlen = INT_MAX; - - /* length to use */ - dL4 = min(max_postlen, post_len); - - if ((epb_mark = jpwl_epb_create( - j2k, /* this encoder handle */ - latest ? (dL4 < max_postlen) : false, /* is it the latest? */ - packed, /* is it packed? */ - tileno, /* we are in TPH */ - *idx, /* its index */ - hprot, /* protection type parameters of following data */ - 0, /* pre-data: nothing for now */ - dL4 /* post-data: the stub computed previously */ - ))) { - - /* Add this marker to the 'insertanda' list */ - if (*jwmarker_num < JPWL_MAX_NO_MARKERS) { - jwmarker[*jwmarker_num].id = J2K_MS_EPB; /* its type */ - jwmarker[*jwmarker_num].m.epbmark = epb_mark; /* the EPB */ - 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].len = epb_mark->Lepb; /* its length */ - jwmarker[*jwmarker_num].len_ready = true; /* ready */ - jwmarker[*jwmarker_num].pos_ready = true; /* ready */ - jwmarker[*jwmarker_num].parms_ready = true; /* ready */ - jwmarker[*jwmarker_num].data_ready = false; /* not ready */ - (*jwmarker_num)++; - } - - /* increment epb index */ - (*idx)++; - - /* decrease postlen */ - post_len -= dL4; - - /* increase the total length of EPBs */ - epbs_len += epb_mark->Lepb + 2; - - } else { - /* ooops, problems */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not create TPH EPB for UEP in tile %d\n", tileno); - }; - } - - return epbs_len; -} - - -jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, bool latest, bool packed, int tileno, int idx, int hprot, - unsigned long int pre_len, unsigned long int post_len) { - - jpwl_epb_ms_t *epb = NULL; - /*unsigned short int data_len = 0;*/ - unsigned short int L2, L3; - unsigned long int L1, L4; - /*unsigned char *predata_in = NULL;*/ - - bool insideMH = (tileno == -1); - - /* Alloc space */ - if (!(epb = (jpwl_epb_ms_t *) opj_malloc((size_t) 1 * sizeof (jpwl_epb_ms_t)))) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "Could not allocate room for one EPB MS\n"); - return NULL; - }; - - /* We set RS(n,k) for EPB parms and pre-data, if any */ - if (insideMH && (idx == 0)) { - /* First EPB in MH */ - epb->k_pre = 64; - epb->n_pre = 160; - } else if (!insideMH && (idx == 0)) { - /* First EPB in TH */ - epb->k_pre = 25; - epb->n_pre = 80; - } else { - /* Following EPBs in MH or TH */ - epb->k_pre = 13; - epb->n_pre = 40; - }; - - /* Find lengths, Figs. B3 and B4 */ - /* size of pre data: pre_buf(pre_len) + EPB(2) + Lepb(2) + Depb(1) + LDPepb(4) + Pepb(4) */ - L1 = pre_len + 13; - epb->pre_len = pre_len; - - /* size of pre-data redundancy */ - /* (redundancy per codeword) * (number of codewords, rounded up) */ - L2 = (epb->n_pre - epb->k_pre) * (unsigned short int) ceil((double) L1 / (double) epb->k_pre); - - /* length of post-data */ - L4 = post_len; - epb->post_len = post_len; - - /* Find protection type for post data and its associated redundancy field length*/ - if ((hprot == 16) || (hprot == 32)) { - /* there is a CRC for post-data */ - epb->Pepb = 0x10000000 | ((unsigned long int) hprot >> 5); /* 0=CRC-16, 1=CRC-32 */ - epb->k_post = post_len; - epb->n_post = post_len + (hprot >> 3); - /*L3 = hprot >> 3;*/ /* 2 (CRC-16) or 4 (CRC-32) bytes */ - - } else if ((hprot >= 37) && (hprot <= 128)) { - /* there is a RS for post-data */ - epb->Pepb = 0x20000020 | (((unsigned long int) hprot & 0x000000FF) << 8); - epb->k_post = 32; - epb->n_post = hprot; - - } else if (hprot == 1) { - /* Use predefined codes */ - epb->Pepb = (unsigned long int) 0x00000000; - epb->n_post = epb->n_pre; - epb->k_post = epb->k_pre; - - } else if (hprot == 0) { - /* Placeholder EPB: only protects its parameters, no protection method */ - epb->Pepb = (unsigned long int) 0xFFFFFFFF; - epb->n_post = 1; - epb->k_post = 1; - - } else { - opj_event_msg(j2k->cinfo, EVT_ERROR, "Invalid protection value for EPB h = %d\n", hprot); - return NULL; - } - - epb->hprot = hprot; - - /* (redundancy per codeword) * (number of codewords, rounded up) */ - L3 = (epb->n_post - epb->k_post) * (unsigned short int) ceil((double) L4 / (double) epb->k_post); - - /* private fields */ - epb->tileno = tileno; - - /* Fill some fields of the EPB */ - - /* total length of the EPB MS (less the EPB marker itself): */ - /* Lepb(2) + Depb(1) + LDPepb(4) + Pepb(4) + pre_redundancy + post-redundancy */ - epb->Lepb = 11 + L2 + L3; - - /* EPB style */ - epb->Depb = ((packed & 0x0001) << 7) | ((latest & 0x0001) << 6) | (idx & 0x003F); - - /* length of data protected by EPB: */ - epb->LDPepb = L1 + L4; - - return epb; -} - -void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf) { - - /* Marker */ - *(buf++) = (unsigned char) (J2K_MS_EPB >> 8); - *(buf++) = (unsigned char) (J2K_MS_EPB >> 0); - - /* Lepb */ - *(buf++) = (unsigned char) (epb->Lepb >> 8); - *(buf++) = (unsigned char) (epb->Lepb >> 0); - - /* Depb */ - *(buf++) = (unsigned char) (epb->Depb >> 0); - - /* LDPepb */ - *(buf++) = (unsigned char) (epb->LDPepb >> 24); - *(buf++) = (unsigned char) (epb->LDPepb >> 16); - *(buf++) = (unsigned char) (epb->LDPepb >> 8); - *(buf++) = (unsigned char) (epb->LDPepb >> 0); - - /* Pepb */ - *(buf++) = (unsigned char) (epb->Pepb >> 24); - *(buf++) = (unsigned char) (epb->Pepb >> 16); - *(buf++) = (unsigned char) (epb->Pepb >> 8); - *(buf++) = (unsigned char) (epb->Pepb >> 0); - - /* Data */ - /*memcpy(buf, epb->data, (size_t) epb->Lepb - 11);*/ - memset(buf, 0, (size_t) epb->Lepb - 11); - - /* update markers struct */ - j2k_add_marker(j2k->cstr_info, J2K_MS_EPB, -1, epb->Lepb + 2); - -}; - - -jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, bool esd_on, bool red_on, bool epb_on, bool info_on) { - - jpwl_epc_ms_t *epc = NULL; - - /* Alloc space */ - 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"); - return NULL; - }; - - /* Set the EPC parameters */ - epc->esd_on = esd_on; - epc->epb_on = epb_on; - epc->red_on = red_on; - epc->info_on = info_on; - - /* Fill the EPC fields with default values */ - epc->Lepc = 9; - epc->Pcrc = 0x0000; - epc->DL = 0x00000000; - epc->Pepc = ((j2k->cp->esd_on & 0x0001) << 4) | ((j2k->cp->red_on & 0x0001) << 5) | - ((j2k->cp->epb_on & 0x0001) << 6) | ((j2k->cp->info_on & 0x0001) << 7); - - return (epc); -} - -bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsigned char *post_buf) { - - unsigned long int L1, L2, L3, L4; - int remaining; - unsigned long int P, NN_P; - - /* Operating buffer */ - static unsigned char codeword[NN], *parityword; - - unsigned char *L1_buf, *L2_buf; - /* these ones are static, since we need to keep memory of - the exact place from one call to the other */ - static unsigned char *L3_buf, *L4_buf; - - /* some consistency check */ - if (!buf) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs\n"); - return false; - } - - if (!post_buf && !L4_buf) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no operating buffer for EPBs data\n"); - return false; - } - - /* - * Compute parity bytes on pre-data, ALWAYS present (at least only for EPB parms) - */ - - /* Initialize RS structures */ - P = epb->n_pre - epb->k_pre; - NN_P = NN - P; - memset(codeword, 0, NN); - parityword = codeword + NN_P; - init_rs(NN_P); - - /* pre-data begins pre_len bytes before of EPB buf */ - L1_buf = buf - epb->pre_len; - L1 = epb->pre_len + 13; - - /* redundancy for pre-data begins immediately after EPB parms */ - L2_buf = buf + 13; - L2 = (epb->n_pre - epb->k_pre) * (unsigned short int) ceil((double) L1 / (double) epb->k_pre); - - /* post-data - the position of L4 buffer can be: - 1) passed as a parameter: in that case use it - 2) null: in that case use the previous (static) one - */ - if (post_buf) - L4_buf = post_buf; - L4 = epb->post_len; - - /* post-data redundancy begins immediately after pre-data redundancy */ - L3_buf = L2_buf + L2; - L3 = (epb->n_post - epb->k_post) * (unsigned short int) ceil((double) L4 / (double) epb->k_post); - - /* let's check whether EPB length is sufficient to contain all these data */ - if (epb->Lepb < (11 + L2 + L3)) - opj_event_msg(j2k->cinfo, EVT_ERROR, "There is no room in EPB data field for writing redundancy data\n"); - /*printf("Env. %d, nec. %d (%d + %d)\n", epb->Lepb - 11, L2 + L3, L2, L3);*/ - - /* Compute redundancy of pre-data message words */ - remaining = L1; - while (remaining) { - - /* copy message data into codeword buffer */ - if (remaining < epb->k_pre) { - /* the last message word is zero-padded */ - memset(codeword, 0, NN); - memcpy(codeword, L1_buf, remaining); - L1_buf += remaining; - remaining = 0; - - } else { - memcpy(codeword, L1_buf, epb->k_pre); - L1_buf += epb->k_pre; - remaining -= epb->k_pre; - - } - - /* Encode the buffer and obtain parity bytes */ - if (encode_rs(codeword, parityword)) - opj_event_msg(j2k->cinfo, EVT_WARNING, - "Possible encoding error in codeword @ position #%d\n", (L1_buf - buf) / epb->k_pre); - - /* copy parity bytes only in redundancy buffer */ - memcpy(L2_buf, parityword, P); - - /* advance parity buffer */ - L2_buf += P; - } - - /* - * Compute parity bytes on post-data, may be absent if there are no data - */ - /*printf("Hprot is %d (tileno=%d, k_pre=%d, n_pre=%d, k_post=%d, n_post=%d, pre_len=%d, post_len=%d)\n", - epb->hprot, epb->tileno, epb->k_pre, epb->n_pre, epb->k_post, epb->n_post, epb->pre_len, - epb->post_len);*/ - if (epb->hprot < 0) { - - /* there should be no EPB */ - - } else if (epb->hprot == 0) { - - /* no protection for the data */ - /* advance anyway */ - L4_buf += epb->post_len; - - } else if (epb->hprot == 16) { - - /* CRC-16 */ - unsigned short int mycrc = 0x0000; - - /* compute the CRC field (excluding itself) */ - remaining = L4; - while (remaining--) - jpwl_updateCRC16(&mycrc, *(L4_buf++)); - - /* write the CRC field */ - *(L3_buf++) = (unsigned char) (mycrc >> 8); - *(L3_buf++) = (unsigned char) (mycrc >> 0); - - } else if (epb->hprot == 32) { - - /* CRC-32 */ - unsigned long int mycrc = 0x00000000; - - /* compute the CRC field (excluding itself) */ - remaining = L4; - while (remaining--) - jpwl_updateCRC32(&mycrc, *(L4_buf++)); - - /* write the CRC field */ - *(L3_buf++) = (unsigned char) (mycrc >> 24); - *(L3_buf++) = (unsigned char) (mycrc >> 16); - *(L3_buf++) = (unsigned char) (mycrc >> 8); - *(L3_buf++) = (unsigned char) (mycrc >> 0); - - } else { - - /* RS */ - - /* Initialize RS structures */ - P = epb->n_post - epb->k_post; - NN_P = NN - P; - memset(codeword, 0, NN); - parityword = codeword + NN_P; - init_rs(NN_P); - - /* Compute redundancy of post-data message words */ - remaining = L4; - while (remaining) { - - /* copy message data into codeword buffer */ - if (remaining < epb->k_post) { - /* the last message word is zero-padded */ - memset(codeword, 0, NN); - memcpy(codeword, L4_buf, remaining); - L4_buf += remaining; - remaining = 0; - - } else { - memcpy(codeword, L4_buf, epb->k_post); - L4_buf += epb->k_post; - remaining -= epb->k_post; - - } - - /* Encode the buffer and obtain parity bytes */ - if (encode_rs(codeword, parityword)) - opj_event_msg(j2k->cinfo, EVT_WARNING, - "Possible encoding error in codeword @ position #%d\n", (L4_buf - buf) / epb->k_post); - - /* copy parity bytes only in redundancy buffer */ - memcpy(L3_buf, parityword, P); - - /* advance parity buffer */ - L3_buf += P; - } - - } - - return true; -} - - -bool jpwl_correct(opj_j2k_t *j2k) { - - opj_cio_t *cio = j2k->cio; - bool status; - static bool mh_done = false; - int mark_pos, id, len, skips, sot_pos; - unsigned long int Psot = 0; - - /* go back to marker position */ - mark_pos = cio_tell(cio) - 2; - cio_seek(cio, mark_pos); - - if ((j2k->state == J2K_STATE_MHSOC) && !mh_done) { - - int mark_val = 0, skipnum = 0; - - /* - COLOR IMAGE - first thing to do, if we are here, is to look whether - 51 (skipnum) positions ahead there is an EPB, in case of MH - */ - /* - B/W IMAGE - first thing to do, if we are here, is to look whether - 45 (skipnum) positions ahead there is an EPB, in case of MH - */ - /* SIZ SIZ_FIELDS SIZ_COMPS FOLLOWING_MARKER */ - skipnum = 2 + 38 + 3 * j2k->cp->exp_comps + 2; - if ((cio->bp + skipnum) < cio->end) { - - cio_skip(cio, skipnum); - - /* check that you are not going beyond the end of codestream */ - - /* call EPB corrector */ - status = jpwl_epb_correct(j2k, /* J2K decompressor handle */ - cio->bp, /* pointer to EPB in codestream buffer */ - 0, /* EPB type: MH */ - skipnum, /* length of pre-data */ - -1, /* length of post-data: -1 means auto */ - NULL, - NULL - ); - - /* read the marker value */ - mark_val = (*(cio->bp) << 8) | *(cio->bp + 1); - - if (status && (mark_val == J2K_MS_EPB)) { - /* we found it! */ - mh_done = 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"); - } - - } - - } - - if (true /*(j2k->state == J2K_STATE_TPHSOT) || (j2k->state == J2K_STATE_TPH)*/) { - /* else, look if 12 positions ahead there is an EPB, in case of TPH */ - cio_seek(cio, mark_pos); - if ((cio->bp + 12) < cio->end) { - - cio_skip(cio, 12); - - /* call EPB corrector */ - status = jpwl_epb_correct(j2k, /* J2K decompressor handle */ - cio->bp, /* pointer to EPB in codestream buffer */ - 1, /* EPB type: TPH */ - 12, /* length of pre-data */ - -1, /* length of post-data: -1 means auto */ - NULL, - NULL - ); - if (status) - /* we found it! */ - return true; - } - } - - return false; - - /* for now, don't use this code */ - - /* else, look if here is an EPB, in case of other */ - if (mark_pos > 64) { - /* it cannot stay before the first MH EPB */ - cio_seek(cio, mark_pos); - cio_skip(cio, 0); - - /* call EPB corrector */ - status = jpwl_epb_correct(j2k, /* J2K decompressor handle */ - cio->bp, /* pointer to EPB in codestream buffer */ - 2, /* EPB type: TPH */ - 0, /* length of pre-data */ - -1, /* length of post-data: -1 means auto */ - NULL, - NULL - ); - if (status) - /* we found it! */ - return true; - } - - /* nope, no EPBs probably, or they are so damaged that we can give up */ - return false; - - return true; - - /* AN ATTEMPT OF PARSER */ - /* NOT USED ACTUALLY */ - - /* go to the beginning of the file */ - cio_seek(cio, 0); - - /* let's begin */ - j2k->state = J2K_STATE_MHSOC; - - /* cycle all over the markers */ - while (cio_tell(cio) < cio->length) { - - /* read the marker */ - mark_pos = cio_tell(cio); - id = cio_read(cio, 2); - - /* details */ - printf("Marker@%d: %X\n", cio_tell(cio) - 2, id); - - /* do an action in response to the read marker */ - switch (id) { - - /* short markers */ - - /* SOC */ - case J2K_MS_SOC: - j2k->state = J2K_STATE_MHSIZ; - len = 0; - skips = 0; - break; - - /* EOC */ - case J2K_MS_EOC: - j2k->state = J2K_STATE_MT; - len = 0; - skips = 0; - break; - - /* particular case of SOD */ - case J2K_MS_SOD: - len = Psot - (mark_pos - sot_pos) - 2; - skips = len; - break; - - /* long markers */ - - /* SOT */ - case J2K_MS_SOT: - j2k->state = J2K_STATE_TPH; - sot_pos = mark_pos; /* position of SOT */ - len = cio_read(cio, 2); /* read the length field */ - cio_skip(cio, 2); /* this field is unnecessary */ - Psot = cio_read(cio, 4); /* tile length */ - skips = len - 8; - break; - - /* remaining */ - case J2K_MS_SIZ: - j2k->state = J2K_STATE_MH; - /* read the length field */ - len = cio_read(cio, 2); - skips = len - 2; - break; - - /* remaining */ - default: - /* read the length field */ - len = cio_read(cio, 2); - skips = len - 2; - break; - - } - - /* skip to marker's end */ - cio_skip(cio, skips); - - } - - -} - -bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn, - unsigned char **L4_bufp) { - - /* Operating buffer */ - unsigned char codeword[NN], *parityword; - - unsigned long int P, NN_P; - unsigned long int L1, L4; - int remaining, n_pre, k_pre, n_post, k_post; - - int status, tt; - - int orig_pos = cio_tell(j2k->cio); - - unsigned char *L1_buf, *L2_buf; - unsigned char *L3_buf, *L4_buf; - - unsigned long int LDPepb, Pepb; - unsigned short int Lepb; - unsigned char Depb; - char str1[25] = ""; - int myconn, errnum = 0; - bool errflag = false; - - opj_cio_t *cio = j2k->cio; - - /* check for common errors */ - if (!buffer) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "The EPB pointer is a NULL buffer\n"); - return false; - } - - /* set bignesses */ - L1 = pre_len + 13; - - /* pre-data correction */ - switch (type) { - - case 0: - /* MH EPB */ - k_pre = 64; - n_pre = 160; - break; - - case 1: - /* TPH EPB */ - k_pre = 25; - n_pre = 80; - break; - - case 2: - /* other EPBs */ - k_pre = 13; - n_pre = 40; - break; - - case 3: - /* automatic setup */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Auto. setup not yet implemented\n"); - return false; - break; - - default: - /* unknown type */ - opj_event_msg(j2k->cinfo, EVT_ERROR, "Unknown expected EPB type\n"); - return false; - break; - - } - - /* Initialize RS structures */ - P = n_pre - k_pre; - NN_P = NN - P; - tt = (int) floor((float) P / 2.0F); /* correction capability of the code */ - memset(codeword, 0, NN); - parityword = codeword + NN_P; - init_rs(NN_P); - - /* Correct pre-data message words */ - L1_buf = buffer - pre_len; - L2_buf = buffer + 13; - remaining = L1; - while (remaining) { - - /* always zero-pad codewords */ - /* (this is required, since after decoding the zeros in the long codeword - could change, and keep unchanged in subsequent calls) */ - memset(codeword, 0, NN); - - /* copy codeword buffer into message bytes */ - if (remaining < k_pre) - memcpy(codeword, L1_buf, remaining); - else - memcpy(codeword, L1_buf, k_pre); - - /* copy redundancy buffer in parity bytes */ - memcpy(parityword, L2_buf, P); - - /* Decode the buffer and possibly obtain corrected bytes */ - status = eras_dec_rs(codeword, NULL, 0); - if (status == -1) { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, - "Possible decoding error in codeword @ position #%d\n", (L1_buf - buffer) / k_pre);*/ - errflag = true; - /* we can try to safely get out from the function: - if we are here, either this is not an EPB or the first codeword - is too damaged to be helpful */ - /*return false;*/ - - } else if (status == 0) { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_INFO, "codeword is correctly decoded\n");*/ - - } else if (status <= tt) { - /* it has corrected 0 <= errs <= tt */ - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "%d errors corrected in codeword\n", status);*/ - errnum += status; - - } else { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n"); - return false;*/ - errflag = true; - } - - - /* advance parity buffer */ - if ((status >= 0) && (status <= tt)) - /* copy back corrected parity only if all is OK */ - memcpy(L2_buf, parityword, P); - L2_buf += P; - - /* advance message buffer */ - if (remaining < k_pre) { - if ((status >= 0) && (status <= tt)) - /* copy back corrected data only if all is OK */ - memcpy(L1_buf, codeword, remaining); - L1_buf += remaining; - remaining = 0; - - } else { - if ((status >= 0) && (status <= tt)) - /* copy back corrected data only if all is OK */ - memcpy(L1_buf, codeword, k_pre); - L1_buf += k_pre; - remaining -= k_pre; - - } - } - - /* print summary */ - if (!conn) { - - /*if (errnum) - opj_event_msg(j2k->cinfo, EVT_INFO, "+ %d symbol errors corrected (Ps=%.1e)\n", errnum, - (float) errnum / ((float) n_pre * (float) L1 / (float) k_pre));*/ - if (errflag) { - /*opj_event_msg(j2k->cinfo, EVT_INFO, "+ there were unrecoverable errors\n");*/ - return false; - } - - } - - /* presumably, now, EPB parameters are correct */ - /* let's get them */ - - /* Simply read the EPB parameters */ - if (conn) - cio->bp = buffer; - cio_skip(cio, 2); /* the marker */ - Lepb = cio_read(cio, 2); - Depb = cio_read(cio, 1); - LDPepb = cio_read(cio, 4); - Pepb = cio_read(cio, 4); - - /* What does Pepb tells us about the protection method? */ - if (((Pepb & 0xF0000000) >> 28) == 0) - sprintf(str1, "pred"); /* predefined */ - else if (((Pepb & 0xF0000000) >> 28) == 1) - sprintf(str1, "crc-%lu", 16 * ((Pepb & 0x00000001) + 1)); /* CRC mode */ - else if (((Pepb & 0xF0000000) >> 28) == 2) - sprintf(str1, "rs(%lu,32)", (Pepb & 0x0000FF00) >> 8); /* RS mode */ - else if (Pepb == 0xFFFFFFFF) - sprintf(str1, "nometh"); /* RS mode */ - else - sprintf(str1, "unknown"); /* unknown */ - - /* Now we write them to screen */ - if (!conn && post_len) - opj_event_msg(j2k->cinfo, EVT_INFO, - "EPB(%d): (%sl, %sp, %u), %lu, %s\n", - cio_tell(cio) - 13, - (Depb & 0x40) ? "" : "n", /* latest EPB or not? */ - (Depb & 0x80) ? "" : "n", /* packed or unpacked EPB? */ - (Depb & 0x3F), /* EPB index value */ - LDPepb, /*length of the data protected by the EPB */ - str1); /* protection method */ - - - /* well, we need to investigate how long is the connected length of packed EPBs */ - myconn = Lepb + 2; - if ((Depb & 0x40) == 0) /* not latest in header */ - jpwl_epb_correct(j2k, /* J2K decompressor handle */ - buffer + Lepb + 2, /* pointer to next EPB in codestream buffer */ - 2, /* EPB type: should be of other type */ - 0, /* only EPB fields */ - 0, /* do not look after */ - &myconn, - NULL - ); - if (conn) - *conn += myconn; - - /*if (!conn) - printf("connected = %d\n", myconn);*/ - - /*cio_seek(j2k->cio, orig_pos); - return true;*/ - - /* post-data - the position of L4 buffer is at the end of currently connected EPBs - */ - if (!(L4_bufp)) - L4_buf = buffer + myconn; - else if (!(*L4_bufp)) - L4_buf = buffer + myconn; - else - L4_buf = *L4_bufp; - if (post_len == -1) - L4 = LDPepb - pre_len - 13; - else if (post_len == 0) - L4 = 0; - else - L4 = post_len; - - L3_buf = L2_buf; - - /* Do a further check here on the read parameters */ - if (L4 > (unsigned long) cio_numbytesleft(j2k->cio)) - /* overflow */ - return false; - - /* we are ready for decoding the remaining data */ - if (((Pepb & 0xF0000000) >> 28) == 1) { - /* CRC here */ - if ((16 * ((Pepb & 0x00000001) + 1)) == 16) { - - /* CRC-16 */ - unsigned short int mycrc = 0x0000, filecrc = 0x0000; - - /* compute the CRC field */ - remaining = L4; - while (remaining--) - jpwl_updateCRC16(&mycrc, *(L4_buf++)); - - /* read the CRC field */ - filecrc = *(L3_buf++) << 8; - filecrc |= *(L3_buf++); - - /* check the CRC field */ - if (mycrc == filecrc) { - if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_INFO, "- CRC is OK\n"); - } else { - if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc); - errflag = true; - } - } - - if ((16 * ((Pepb & 0x00000001) + 1)) == 32) { - - /* CRC-32 */ - unsigned long int mycrc = 0x00000000, filecrc = 0x00000000; - - /* compute the CRC field */ - remaining = L4; - while (remaining--) - jpwl_updateCRC32(&mycrc, *(L4_buf++)); - - /* read the CRC field */ - filecrc = *(L3_buf++) << 24; - filecrc |= *(L3_buf++) << 16; - filecrc |= *(L3_buf++) << 8; - filecrc |= *(L3_buf++); - - /* check the CRC field */ - if (mycrc == filecrc) { - if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_INFO, "- CRC is OK\n"); - } else { - if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "- CRC is KO (r=%d, c=%d)\n", filecrc, mycrc); - errflag = true; - } - } - - } else if (Pepb == 0xFFFFFFFF) { - /* no method */ - - /* advance without doing anything */ - remaining = L4; - while (remaining--) - L4_buf++; - - } else if ((((Pepb & 0xF0000000) >> 28) == 2) || (((Pepb & 0xF0000000) >> 28) == 0)) { - /* RS coding here */ - - if (((Pepb & 0xF0000000) >> 28) == 0) { - - k_post = k_pre; - n_post = n_pre; - - } else { - - k_post = 32; - n_post = (Pepb & 0x0000FF00) >> 8; - } - - /* Initialize RS structures */ - P = n_post - k_post; - NN_P = NN - P; - tt = (int) floor((float) P / 2.0F); /* again, correction capability */ - memset(codeword, 0, NN); - parityword = codeword + NN_P; - init_rs(NN_P); - - /* Correct post-data message words */ - /*L4_buf = buffer + Lepb + 2;*/ - L3_buf = L2_buf; - remaining = L4; - while (remaining) { - - /* always zero-pad codewords */ - /* (this is required, since after decoding the zeros in the long codeword - could change, and keep unchanged in subsequent calls) */ - memset(codeword, 0, NN); - - /* copy codeword buffer into message bytes */ - if (remaining < k_post) - memcpy(codeword, L4_buf, remaining); - else - memcpy(codeword, L4_buf, k_post); - - /* copy redundancy buffer in parity bytes */ - memcpy(parityword, L3_buf, P); - - /* Decode the buffer and possibly obtain corrected bytes */ - status = eras_dec_rs(codeword, NULL, 0); - if (status == -1) { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, - "Possible decoding error in codeword @ position #%d\n", (L4_buf - (buffer + Lepb + 2)) / k_post);*/ - errflag = true; - - } else if (status == 0) { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_INFO, "codeword is correctly decoded\n");*/ - - } else if (status <= tt) { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "%d errors corrected in codeword\n", status);*/ - errnum += status; - - } else { - /*if (conn == NULL) - opj_event_msg(j2k->cinfo, EVT_WARNING, "EPB correction capability exceeded\n"); - return false;*/ - errflag = true; - } - - - /* advance parity buffer */ - if ((status >= 0) && (status <= tt)) - /* copy back corrected data only if all is OK */ - memcpy(L3_buf, parityword, P); - L3_buf += P; - - /* advance message buffer */ - if (remaining < k_post) { - if ((status >= 0) && (status <= tt)) - /* copy back corrected data only if all is OK */ - memcpy(L4_buf, codeword, remaining); - L4_buf += remaining; - remaining = 0; - - } else { - if ((status >= 0) && (status <= tt)) - /* copy back corrected data only if all is OK */ - memcpy(L4_buf, codeword, k_post); - L4_buf += k_post; - remaining -= k_post; - - } - } - } - - /* give back the L4_buf address */ - if (L4_bufp) - *L4_bufp = L4_buf; - - /* print summary */ - if (!conn) { - - if (errnum) - opj_event_msg(j2k->cinfo, EVT_INFO, "- %d symbol errors corrected (Ps=%.1e)\n", errnum, - (float) errnum / (float) LDPepb); - if (errflag) - opj_event_msg(j2k->cinfo, EVT_INFO, "- there were unrecoverable errors\n"); - - } - - cio_seek(j2k->cio, orig_pos); - - return true; -} - -void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epc, unsigned char *buf) { - - /* Marker */ - *(buf++) = (unsigned char) (J2K_MS_EPC >> 8); - *(buf++) = (unsigned char) (J2K_MS_EPC >> 0); - - /* Lepc */ - *(buf++) = (unsigned char) (epc->Lepc >> 8); - *(buf++) = (unsigned char) (epc->Lepc >> 0); - - /* Pcrc */ - *(buf++) = (unsigned char) (epc->Pcrc >> 8); - *(buf++) = (unsigned char) (epc->Pcrc >> 0); - - /* DL */ - *(buf++) = (unsigned char) (epc->DL >> 24); - *(buf++) = (unsigned char) (epc->DL >> 16); - *(buf++) = (unsigned char) (epc->DL >> 8); - *(buf++) = (unsigned char) (epc->DL >> 0); - - /* Pepc */ - *(buf++) = (unsigned char) (epc->Pepc >> 0); - - /* Data */ - /*memcpy(buf, epc->data, (size_t) epc->Lepc - 9);*/ - memset(buf, 0, (size_t) epc->Lepc - 9); - - /* update markers struct */ - j2k_add_marker(j2k->cstr_info, J2K_MS_EPC, -1, epc->Lepc + 2); - -}; - -int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - int comps, unsigned char addrm, unsigned char ad_size, - unsigned char senst, unsigned char se_size, - double place_pos, int tileno) { - - return 0; -} - -jpwl_esd_ms_t *jpwl_esd_create(opj_j2k_t *j2k, int comp, unsigned char addrm, unsigned char ad_size, - unsigned char senst, unsigned char se_size, int tileno, - unsigned long int svalnum, void *sensval) { - - jpwl_esd_ms_t *esd = NULL; - - /* Alloc space */ - 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"); - return NULL; - }; - - /* if relative sensitivity, activate byte range mode */ - if (senst == 0) - addrm = 1; - - /* size of sensval's ... */ - if ((ad_size != 0) && (ad_size != 2) && (ad_size != 4)) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "Address size %d for ESD MS is forbidden\n", ad_size); - return NULL; - } - if ((se_size != 1) && (se_size != 2)) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "Sensitivity size %d for ESD MS is forbidden\n", se_size); - return NULL; - } - - /* ... depends on the addressing mode */ - switch (addrm) { - - /* packet mode */ - case (0): - ad_size = 0; /* as per the standard */ - esd->sensval_size = se_size; - break; - - /* byte range */ - case (1): - /* auto sense address size */ - if (ad_size == 0) - /* if there are more than 66% of (2^16 - 1) bytes, switch to 4 bytes - (we keep space for possible EPBs being inserted) */ - ad_size = (j2k->cstr_info->codestream_size > (1 * 65535 / 3)) ? 4 : 2; - esd->sensval_size = ad_size + ad_size + se_size; - break; - - /* packet range */ - case (2): - /* auto sense address size */ - if (ad_size == 0) - /* if there are more than 2^16 - 1 packets, switch to 4 bytes */ - ad_size = (j2k->cstr_info->packno > 65535) ? 4 : 2; - esd->sensval_size = ad_size + ad_size + se_size; - break; - - case (3): - opj_event_msg(j2k->cinfo, EVT_ERROR, "Address mode %d for ESD MS is unimplemented\n", addrm); - return NULL; - - default: - opj_event_msg(j2k->cinfo, EVT_ERROR, "Address mode %d for ESD MS is forbidden\n", addrm); - return NULL; - } - - /* set or unset sensitivity values */ - if (svalnum <= 0) { - - switch (senst) { - - /* just based on the portions of a codestream */ - case (0): - /* MH + no. of THs + no. of packets */ - svalnum = 1 + (j2k->cstr_info->tw * j2k->cstr_info->th) * (1 + j2k->cstr_info->packno); - break; - - /* all the ones that are based on the packets */ - default: - if (tileno < 0) - /* MH: all the packets and all the tiles info is written */ - svalnum = j2k->cstr_info->tw * j2k->cstr_info->th * j2k->cstr_info->packno; - else - /* TPH: only that tile info is written */ - svalnum = j2k->cstr_info->packno; - break; - - } - } - - /* fill private fields */ - esd->senst = senst; - esd->ad_size = ad_size; - esd->se_size = se_size; - esd->addrm = addrm; - esd->svalnum = svalnum; - esd->numcomps = j2k->image->numcomps; - esd->tileno = tileno; - - /* Set the ESD parameters */ - /* length, excluding data field */ - if (esd->numcomps < 257) - esd->Lesd = 4 + (unsigned short int) (esd->svalnum * esd->sensval_size); - else - esd->Lesd = 5 + (unsigned short int) (esd->svalnum * esd->sensval_size); - - /* component data field */ - if (comp >= 0) - esd->Cesd = comp; - else - /* we are averaging */ - esd->Cesd = 0; - - /* Pesd field */ - esd->Pesd = 0x00; - esd->Pesd |= (esd->addrm & 0x03) << 6; /* addressing mode */ - esd->Pesd |= (esd->senst & 0x07) << 3; /* sensitivity type */ - esd->Pesd |= ((esd->se_size >> 1) & 0x01) << 2; /* sensitivity size */ - esd->Pesd |= ((esd->ad_size >> 2) & 0x01) << 1; /* addressing size */ - esd->Pesd |= (comp < 0) ? 0x01 : 0x00; /* averaging components */ - - /* if pointer to sensval is NULL, we can fill data field by ourselves */ - if (!sensval) { - - /* old code moved to jpwl_esd_fill() */ - esd->data = NULL; - - } else { - /* we set the data field as the sensitivity values poinnter passed to the function */ - esd->data = (unsigned char *) sensval; - } - - return (esd); -} - -bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) { - - int i; - unsigned long int vv; - unsigned long int addr1 = 0L, addr2 = 0L; - double dvalue = 0.0, Omax2, tmp, TSE = 0.0, MSE, oldMSE = 0.0, PSNR, oldPSNR = 0.0; - unsigned short int pfpvalue; - unsigned long int addrmask = 0x00000000; - bool doneMH = false, doneTPH = false; - - /* sensitivity values in image info are as follows: - - for each tile, distotile is the starting distortion for that tile, sum of all components - - for each packet in a tile, disto is the distortion reduction caused by that packet to that tile - - the TSE for a single tile should be given by distotile - sum(disto) , for all components - - the MSE for a single tile is given by TSE / nbpix , for all components - - the PSNR for a single tile is given by 10*log10( Omax^2 / MSE) , for all components - (Omax is given by 2^bpp - 1 for unsigned images and by 2^(bpp - 1) - 1 for signed images - */ - - /* browse all components and find Omax */ - Omax2 = 0.0; - for (i = 0; i < j2k->image->numcomps; i++) { - tmp = pow(2.0, (double) (j2k->image->comps[i].sgnd ? - (j2k->image->comps[i].bpp - 1) : (j2k->image->comps[i].bpp))) - 1; - if (tmp > Omax2) - Omax2 = tmp; - } - Omax2 = Omax2 * Omax2; - - /* if pointer of esd->data is not null, simply write down all the values byte by byte */ - if (esd->data) { - for (i = 0; i < (int) esd->svalnum; i++) - *(buf++) = esd->data[i]; - return true; - } - - /* addressing mask */ - if (esd->ad_size == 2) - addrmask = 0x0000FFFF; /* two bytes */ - else - addrmask = 0xFFFFFFFF; /* four bytes */ - - /* set on precise point where sensitivity starts */ - if (esd->numcomps < 257) - buf += 6; - else - buf += 7; - - /* let's fill the data fields */ - for (vv = (esd->tileno < 0) ? 0 : (j2k->cstr_info->packno * esd->tileno); vv < esd->svalnum; vv++) { - - int thistile = vv / j2k->cstr_info->packno, thispacket = vv % j2k->cstr_info->packno; - - /* skip for the hack some lines below */ - if (thistile == j2k->cstr_info->tw * j2k->cstr_info->th) - break; - - /* starting tile distortion */ - if (thispacket == 0) { - TSE = j2k->cstr_info->tile[thistile].distotile; - oldMSE = TSE / j2k->cstr_info->tile[thistile].numpix; - oldPSNR = 10.0 * log10(Omax2 / oldMSE); - } - - /* TSE */ - TSE -= j2k->cstr_info->tile[thistile].packet[thispacket].disto; - - /* MSE */ - MSE = TSE / j2k->cstr_info->tile[thistile].numpix; - - /* PSNR */ - PSNR = 10.0 * log10(Omax2 / MSE); - - /* fill the address range */ - switch (esd->addrm) { - - /* packet mode */ - case (0): - /* nothing, there is none */ - break; - - /* byte range */ - case (1): - /* start address of packet */ - addr1 = (j2k->cstr_info->tile[thistile].packet[thispacket].start_pos) & addrmask; - /* end address of packet */ - addr2 = (j2k->cstr_info->tile[thistile].packet[thispacket].end_pos) & addrmask; - break; - - /* packet range */ - case (2): - /* not implemented here */ - opj_event_msg(j2k->cinfo, EVT_WARNING, "Addressing mode packet_range is not implemented\n"); - break; - - /* unknown addressing method */ - default: - /* not implemented here */ - opj_event_msg(j2k->cinfo, EVT_WARNING, "Unknown addressing mode\n"); - break; - - } - - /* hack for writing relative sensitivity of MH and TPHs */ - if ((esd->senst == 0) && (thispacket == 0)) { - - /* possible MH */ - if ((thistile == 0) && !doneMH) { - /* we have to manage MH addresses */ - addr1 = 0; /* start of MH */ - addr2 = j2k->cstr_info->main_head_end; /* end of MH */ - /* set special dvalue for this MH */ - dvalue = -10.0; - doneMH = true; /* don't come here anymore */ - vv--; /* wrap back loop counter */ - - } else if (!doneTPH) { - /* we have to manage TPH addresses */ - addr1 = j2k->cstr_info->tile[thistile].start_pos; - addr2 = j2k->cstr_info->tile[thistile].end_header; - /* set special dvalue for this TPH */ - dvalue = -1.0; - doneTPH = true; /* don't come here till the next tile */ - vv--; /* wrap back loop counter */ - } - - } else - doneTPH = false; /* reset TPH counter */ - - /* write the addresses to the buffer */ - switch (esd->ad_size) { - - case (0): - /* do nothing */ - break; - - case (2): - /* two bytes */ - *(buf++) = (unsigned char) (addr1 >> 8); - *(buf++) = (unsigned char) (addr1 >> 0); - *(buf++) = (unsigned char) (addr2 >> 8); - *(buf++) = (unsigned char) (addr2 >> 0); - break; - - case (4): - /* four bytes */ - *(buf++) = (unsigned char) (addr1 >> 24); - *(buf++) = (unsigned char) (addr1 >> 16); - *(buf++) = (unsigned char) (addr1 >> 8); - *(buf++) = (unsigned char) (addr1 >> 0); - *(buf++) = (unsigned char) (addr2 >> 24); - *(buf++) = (unsigned char) (addr2 >> 16); - *(buf++) = (unsigned char) (addr2 >> 8); - *(buf++) = (unsigned char) (addr2 >> 0); - break; - - default: - /* do nothing */ - break; - } - - - /* let's fill the value field */ - switch (esd->senst) { - - /* relative sensitivity */ - case (0): - /* we just write down the packet ordering */ - if (dvalue == -10) - /* MH */ - dvalue = MAX_V1 + 1000.0; /* this will cause pfpvalue set to 0xFFFF */ - else if (dvalue == -1) - /* TPH */ - dvalue = MAX_V1 + 1000.0; /* this will cause pfpvalue set to 0xFFFF */ - else - /* packet: first is most important, and then in decreasing order - down to the last, which counts for 1 */ - dvalue = jpwl_pfp_to_double((unsigned short) (j2k->cstr_info->packno - thispacket), esd->se_size); - break; - - /* MSE */ - case (1): - /* !!! WRONG: let's put here disto field of packets !!! */ - dvalue = MSE; - break; - - /* MSE reduction */ - case (2): - dvalue = oldMSE - MSE; - oldMSE = MSE; - break; - - /* PSNR */ - case (3): - dvalue = PSNR; - break; - - /* PSNR increase */ - case (4): - dvalue = PSNR - oldPSNR; - oldPSNR = PSNR; - break; - - /* MAXERR */ - case (5): - dvalue = 0.0; - opj_event_msg(j2k->cinfo, EVT_WARNING, "MAXERR sensitivity mode is not implemented\n"); - break; - - /* TSE */ - case (6): - dvalue = TSE; - break; - - /* reserved */ - case (7): - dvalue = 0.0; - opj_event_msg(j2k->cinfo, EVT_WARNING, "Reserved sensitivity mode is not implemented\n"); - break; - - default: - dvalue = 0.0; - break; - } - - /* compute the pseudo-floating point value */ - pfpvalue = jpwl_double_to_pfp(dvalue, esd->se_size); - - /* write the pfp value to the buffer */ - switch (esd->se_size) { - - case (1): - /* one byte */ - *(buf++) = (unsigned char) (pfpvalue >> 0); - break; - - case (2): - /* two bytes */ - *(buf++) = (unsigned char) (pfpvalue >> 8); - *(buf++) = (unsigned char) (pfpvalue >> 0); - break; - } - - } - - return true; -} - -void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) { - - /* Marker */ - *(buf++) = (unsigned char) (J2K_MS_ESD >> 8); - *(buf++) = (unsigned char) (J2K_MS_ESD >> 0); - - /* Lesd */ - *(buf++) = (unsigned char) (esd->Lesd >> 8); - *(buf++) = (unsigned char) (esd->Lesd >> 0); - - /* Cesd */ - if (esd->numcomps >= 257) - *(buf++) = (unsigned char) (esd->Cesd >> 8); - *(buf++) = (unsigned char) (esd->Cesd >> 0); - - /* Pesd */ - *(buf++) = (unsigned char) (esd->Pesd >> 0); - - /* Data */ - if (esd->numcomps < 257) - memset(buf, 0xAA, (size_t) esd->Lesd - 4); - /*memcpy(buf, esd->data, (size_t) esd->Lesd - 4);*/ - else - memset(buf, 0xAA, (size_t) esd->Lesd - 5); - /*memcpy(buf, esd->data, (size_t) esd->Lesd - 5);*/ - - /* update markers struct */ - j2k_add_marker(j2k->cstr_info, J2K_MS_ESD, -1, esd->Lesd + 2); - -} - -unsigned short int jpwl_double_to_pfp(double V, int bytes) { - - unsigned short int em, e, m; - - switch (bytes) { - - case (1): - - if (V < MIN_V1) { - e = 0x0000; - m = 0x0000; - } else if (V > MAX_V1) { - e = 0x000F; - m = 0x000F; - } else { - e = (unsigned short int) (floor(log(V) * 1.44269504088896) / 4.0); - m = (unsigned short int) (0.5 + (V / (pow(2.0, (double) (4 * e))))); - } - em = ((e & 0x000F) << 4) + (m & 0x000F); - break; - - case (2): - - if (V < MIN_V2) { - e = 0x0000; - m = 0x0000; - } else if (V > MAX_V2) { - e = 0x001F; - m = 0x07FF; - } else { - e = (unsigned short int) floor(log(V) * 1.44269504088896) + 15; - m = (unsigned short int) (0.5 + 2048.0 * ((V / (pow(2.0, (double) e - 15.0))) - 1.0)); - } - em = ((e & 0x001F) << 11) + (m & 0x07FF); - break; - - default: - - em = 0x0000; - break; - }; - - return em; -} - -double jpwl_pfp_to_double(unsigned short int em, int bytes) { - - double V; - - switch (bytes) { - - case 1: - V = (double) (em & 0x0F) * pow(2.0, (double) (em & 0xF0)); - break; - - case 2: - - V = pow(2.0, (double) ((em & 0xF800) >> 11) - 15.0) * (1.0 + (double) (em & 0x07FF) / 2048.0); - break; - - default: - V = 0.0; - break; - - } - - return V; - -} - -bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num) { - - int mm; - unsigned long int addlen; - - opj_codestream_info_t *info = j2k->cstr_info; - int tileno, tpno, packno, numtiles = info->th * info->tw, numpacks = info->packno; - - if (!j2k || !jwmarker ) { - opj_event_msg(j2k->cinfo, EVT_ERROR, "J2K handle or JPWL markers list badly allocated\n"); - return false; - } - - /* main_head_end: how many markers are there before? */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->main_head_end) - addlen += jwmarker[mm].len + 2; - info->main_head_end += addlen; - - /* codestream_size: always increment with all markers */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - addlen += jwmarker[mm].len + 2; - info->codestream_size += addlen; - - /* navigate through all the tiles */ - for (tileno = 0; tileno < numtiles; tileno++) { - - /* start_pos: increment with markers before SOT */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].start_pos) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].start_pos += addlen; - - /* end_header: increment with markers before of it */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].end_header) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].end_header += addlen; - - /* end_pos: increment with markers before the end of this tile */ - /* code is disabled, since according to JPWL no markers can be beyond TPH */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].end_pos) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].end_pos += addlen; - - /* navigate through all the tile parts */ - for (tpno = 0; tpno < info->tile[tileno].num_tps; tpno++) { - - /* start_pos: increment with markers before SOT */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].tp[tpno].tp_start_pos) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].tp[tpno].tp_start_pos += addlen; - - /* end_header: increment with markers before of it */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].tp[tpno].tp_end_header) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].tp[tpno].tp_end_header += addlen; - - /* end_pos: increment with markers before the end of this tile part */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].tp[tpno].tp_end_pos) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].tp[tpno].tp_end_pos += addlen; - - } - - /* navigate through all the packets in this tile */ - for (packno = 0; packno < numpacks; packno++) { - - /* start_pos: increment with markers before the packet */ - /* disabled for the same reason as before */ - addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos <= (unsigned long int) info->tile[tileno].packet[packno].start_pos) - addlen += jwmarker[mm].len + 2; - info->tile[tileno].packet[packno].start_pos += addlen; - - /* end_ph_pos: increment with markers before the packet */ - /* disabled for the same reason as before */ - /*addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].packet[packno].end_ph_pos) - addlen += jwmarker[mm].len + 2;*/ - info->tile[tileno].packet[packno].end_ph_pos += addlen; - - /* end_pos: increment if marker is before the end of packet */ - /* disabled for the same reason as before */ - /*addlen = 0; - for (mm = 0; mm < jwmarker_num; mm++) - if (jwmarker[mm].pos < (unsigned long int) info->tile[tileno].packet[packno].end_pos) - addlen += jwmarker[mm].len + 2;*/ - info->tile[tileno].packet[packno].end_pos += addlen; - - } - } - - /* reorder the markers list */ - - return true; -} - -#endif /* USE_JPWL */ diff --git a/jpwl/rs.c b/jpwl/rs.c deleted file mode 100644 index 419f0836..00000000 --- a/jpwl/rs.c +++ /dev/null @@ -1,594 +0,0 @@ - /* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef USE_JPWL - -/** -@file rs.c -@brief Functions used to compute the Reed-Solomon parity and check of byte arrays - -*/ - -/** - * Reed-Solomon coding and decoding - * Phil Karn (karn@ka9q.ampr.org) September 1996 - * - * This file is derived from the program "new_rs_erasures.c" by Robert - * Morelos-Zaragoza (robert@spectra.eng.hawaii.edu) and Hari Thirumoorthy - * (harit@spectra.eng.hawaii.edu), Aug 1995 - * - * I've made changes to improve performance, clean up the code and make it - * easier to follow. Data is now passed to the encoding and decoding functions - * through arguments rather than in global arrays. The decode function returns - * the number of corrected symbols, or -1 if the word is uncorrectable. - * - * This code supports a symbol size from 2 bits up to 16 bits, - * implying a block size of 3 2-bit symbols (6 bits) up to 65535 - * 16-bit symbols (1,048,560 bits). The code parameters are set in rs.h. - * - * Note that if symbols larger than 8 bits are used, the type of each - * data array element switches from unsigned char to unsigned int. The - * caller must ensure that elements larger than the symbol range are - * not passed to the encoder or decoder. - * - */ -#include -#include -#include "rs.h" - -/* This defines the type used to store an element of the Galois Field - * used by the code. Make sure this is something larger than a char if - * if anything larger than GF(256) is used. - * - * Note: unsigned char will work up to GF(256) but int seems to run - * faster on the Pentium. - */ -typedef int gf; - -/* Primitive polynomials - see Lin & Costello, Appendix A, - * and Lee & Messerschmitt, p. 453. - */ -#if(MM == 2)/* Admittedly silly */ -int Pp[MM+1] = { 1, 1, 1 }; - -#elif(MM == 3) -/* 1 + x + x^3 */ -int Pp[MM+1] = { 1, 1, 0, 1 }; - -#elif(MM == 4) -/* 1 + x + x^4 */ -int Pp[MM+1] = { 1, 1, 0, 0, 1 }; - -#elif(MM == 5) -/* 1 + x^2 + x^5 */ -int Pp[MM+1] = { 1, 0, 1, 0, 0, 1 }; - -#elif(MM == 6) -/* 1 + x + x^6 */ -int Pp[MM+1] = { 1, 1, 0, 0, 0, 0, 1 }; - -#elif(MM == 7) -/* 1 + x^3 + x^7 */ -int Pp[MM+1] = { 1, 0, 0, 1, 0, 0, 0, 1 }; - -#elif(MM == 8) -/* 1+x^2+x^3+x^4+x^8 */ -int Pp[MM+1] = { 1, 0, 1, 1, 1, 0, 0, 0, 1 }; - -#elif(MM == 9) -/* 1+x^4+x^9 */ -int Pp[MM+1] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; - -#elif(MM == 10) -/* 1+x^3+x^10 */ -int Pp[MM+1] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; - -#elif(MM == 11) -/* 1+x^2+x^11 */ -int Pp[MM+1] = { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - -#elif(MM == 12) -/* 1+x+x^4+x^6+x^12 */ -int Pp[MM+1] = { 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 }; - -#elif(MM == 13) -/* 1+x+x^3+x^4+x^13 */ -int Pp[MM+1] = { 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - -#elif(MM == 14) -/* 1+x+x^6+x^10+x^14 */ -int Pp[MM+1] = { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 }; - -#elif(MM == 15) -/* 1+x+x^15 */ -int Pp[MM+1] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - -#elif(MM == 16) -/* 1+x+x^3+x^12+x^16 */ -int Pp[MM+1] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; - -#else -#error "MM must be in range 2-16" -#endif - -/* Alpha exponent for the first root of the generator polynomial */ -#define B0 0 /* Different from the default 1 */ - -/* index->polynomial form conversion table */ -gf Alpha_to[NN + 1]; - -/* Polynomial->index form conversion table */ -gf Index_of[NN + 1]; - -/* No legal value in index form represents zero, so - * we need a special value for this purpose - */ -#define A0 (NN) - -/* Generator polynomial g(x) - * Degree of g(x) = 2*TT - * has roots @**B0, @**(B0+1), ... ,@^(B0+2*TT-1) - */ -/*gf Gg[NN - KK + 1];*/ -gf Gg[NN - 1]; - -/* Compute x % NN, where NN is 2**MM - 1, - * without a slow divide - */ -static /*inline*/ gf -modnn(int x) -{ - while (x >= NN) { - x -= NN; - x = (x >> MM) + (x & NN); - } - return x; -} - -/*#define min(a,b) ((a) < (b) ? (a) : (b))*/ - -#define CLEAR(a,n) {\ - int ci;\ - for(ci=(n)-1;ci >=0;ci--)\ - (a)[ci] = 0;\ - } - -#define COPY(a,b,n) {\ - int ci;\ - for(ci=(n)-1;ci >=0;ci--)\ - (a)[ci] = (b)[ci];\ - } -#define COPYDOWN(a,b,n) {\ - int ci;\ - for(ci=(n)-1;ci >=0;ci--)\ - (a)[ci] = (b)[ci];\ - } - -void init_rs(int k) -{ - KK = k; - if (KK >= NN) { - printf("KK must be less than 2**MM - 1\n"); - exit(1); - } - - generate_gf(); - gen_poly(); -} - -/* generate GF(2**m) from the irreducible polynomial p(X) in p[0]..p[m] - lookup tables: index->polynomial form alpha_to[] contains j=alpha**i; - polynomial form -> index form index_of[j=alpha**i] = i - alpha=2 is the primitive element of GF(2**m) - HARI's COMMENT: (4/13/94) alpha_to[] can be used as follows: - Let @ represent the primitive element commonly called "alpha" that - is the root of the primitive polynomial p(x). Then in GF(2^m), for any - 0 <= i <= 2^m-2, - @^i = a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1) - where the binary vector (a(0),a(1),a(2),...,a(m-1)) is the representation - of the integer "alpha_to[i]" with a(0) being the LSB and a(m-1) the MSB. Thus for - example the polynomial representation of @^5 would be given by the binary - representation of the integer "alpha_to[5]". - Similarily, index_of[] can be used as follows: - As above, let @ represent the primitive element of GF(2^m) that is - the root of the primitive polynomial p(x). In order to find the power - of @ (alpha) that has the polynomial representation - a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1) - we consider the integer "i" whose binary representation with a(0) being LSB - and a(m-1) MSB is (a(0),a(1),...,a(m-1)) and locate the entry - "index_of[i]". Now, @^index_of[i] is that element whose polynomial - representation is (a(0),a(1),a(2),...,a(m-1)). - NOTE: - The element alpha_to[2^m-1] = 0 always signifying that the - representation of "@^infinity" = 0 is (0,0,0,...,0). - Similarily, the element index_of[0] = A0 always signifying - that the power of alpha which has the polynomial representation - (0,0,...,0) is "infinity". - -*/ - -void -generate_gf(void) -{ - register int i, mask; - - mask = 1; - Alpha_to[MM] = 0; - for (i = 0; i < MM; i++) { - Alpha_to[i] = mask; - Index_of[Alpha_to[i]] = i; - /* If Pp[i] == 1 then, term @^i occurs in poly-repr of @^MM */ - if (Pp[i] != 0) - Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ - mask <<= 1; /* single left-shift */ - } - Index_of[Alpha_to[MM]] = MM; - /* - * Have obtained poly-repr of @^MM. Poly-repr of @^(i+1) is given by - * poly-repr of @^i shifted left one-bit and accounting for any @^MM - * term that may occur when poly-repr of @^i is shifted. - */ - mask >>= 1; - for (i = MM + 1; i < NN; i++) { - if (Alpha_to[i - 1] >= mask) - Alpha_to[i] = Alpha_to[MM] ^ ((Alpha_to[i - 1] ^ mask) << 1); - else - Alpha_to[i] = Alpha_to[i - 1] << 1; - Index_of[Alpha_to[i]] = i; - } - Index_of[0] = A0; - Alpha_to[NN] = 0; -} - - -/* - * Obtain the generator polynomial of the TT-error correcting, length - * NN=(2**MM -1) Reed Solomon code from the product of (X+@**(B0+i)), i = 0, - * ... ,(2*TT-1) - * - * Examples: - * - * If B0 = 1, TT = 1. deg(g(x)) = 2*TT = 2. - * g(x) = (x+@) (x+@**2) - * - * If B0 = 0, TT = 2. deg(g(x)) = 2*TT = 4. - * g(x) = (x+1) (x+@) (x+@**2) (x+@**3) - */ -void -gen_poly(void) -{ - register int i, j; - - Gg[0] = Alpha_to[B0]; - Gg[1] = 1; /* g(x) = (X+@**B0) initially */ - for (i = 2; i <= NN - KK; i++) { - Gg[i] = 1; - /* - * Below multiply (Gg[0]+Gg[1]*x + ... +Gg[i]x^i) by - * (@**(B0+i-1) + x) - */ - for (j = i - 1; j > 0; j--) - if (Gg[j] != 0) - Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + B0 + i - 1)]; - else - Gg[j] = Gg[j - 1]; - /* Gg[0] can never be zero */ - Gg[0] = Alpha_to[modnn((Index_of[Gg[0]]) + B0 + i - 1)]; - } - /* convert Gg[] to index form for quicker encoding */ - for (i = 0; i <= NN - KK; i++) - Gg[i] = Index_of[Gg[i]]; -} - - -/* - * take the string of symbols in data[i], i=0..(k-1) and encode - * systematically to produce NN-KK parity symbols in bb[0]..bb[NN-KK-1] data[] - * is input and bb[] is output in polynomial form. Encoding is done by using - * a feedback shift register with appropriate connections specified by the - * elements of Gg[], which was generated above. Codeword is c(X) = - * data(X)*X**(NN-KK)+ b(X) - */ -int -encode_rs(dtype *data, dtype *bb) -{ - register int i, j; - gf feedback; - - CLEAR(bb,NN-KK); - for (i = KK - 1; i >= 0; i--) { -#if (MM != 8) - if(data[i] > NN) - return -1; /* Illegal symbol */ -#endif - feedback = Index_of[data[i] ^ bb[NN - KK - 1]]; - if (feedback != A0) { /* feedback term is non-zero */ - for (j = NN - KK - 1; j > 0; j--) - if (Gg[j] != A0) - bb[j] = bb[j - 1] ^ Alpha_to[modnn(Gg[j] + feedback)]; - else - bb[j] = bb[j - 1]; - bb[0] = Alpha_to[modnn(Gg[0] + feedback)]; - } else { /* feedback term is zero. encoder becomes a - * single-byte shifter */ - for (j = NN - KK - 1; j > 0; j--) - bb[j] = bb[j - 1]; - bb[0] = 0; - } - } - return 0; -} - -/* - * Performs ERRORS+ERASURES decoding of RS codes. If decoding is successful, - * writes the codeword into data[] itself. Otherwise data[] is unaltered. - * - * Return number of symbols corrected, or -1 if codeword is illegal - * or uncorrectable. - * - * First "no_eras" erasures are declared by the calling program. Then, the - * maximum # of errors correctable is t_after_eras = floor((NN-KK-no_eras)/2). - * If the number of channel errors is not greater than "t_after_eras" the - * transmitted codeword will be recovered. Details of algorithm can be found - * in R. Blahut's "Theory ... of Error-Correcting Codes". - */ -int -eras_dec_rs(dtype *data, int *eras_pos, int no_eras) -{ - int deg_lambda, el, deg_omega; - int i, j, r; - gf u,q,tmp,num1,num2,den,discr_r; - gf recd[NN]; - /* Err+Eras Locator poly and syndrome poly */ - /*gf lambda[NN-KK + 1], s[NN-KK + 1]; - gf b[NN-KK + 1], t[NN-KK + 1], omega[NN-KK + 1]; - gf root[NN-KK], reg[NN-KK + 1], loc[NN-KK];*/ - gf lambda[NN + 1], s[NN + 1]; - gf b[NN + 1], t[NN + 1], omega[NN + 1]; - gf root[NN], reg[NN + 1], loc[NN]; - int syn_error, count; - - /* data[] is in polynomial form, copy and convert to index form */ - for (i = NN-1; i >= 0; i--){ -#if (MM != 8) - if(data[i] > NN) - return -1; /* Illegal symbol */ -#endif - recd[i] = Index_of[data[i]]; - } - /* first form the syndromes; i.e., evaluate recd(x) at roots of g(x) - * namely @**(B0+i), i = 0, ... ,(NN-KK-1) - */ - syn_error = 0; - for (i = 1; i <= NN-KK; i++) { - tmp = 0; - for (j = 0; j < NN; j++) - if (recd[j] != A0) /* recd[j] in index form */ - tmp ^= Alpha_to[modnn(recd[j] + (B0+i-1)*j)]; - syn_error |= tmp; /* set flag if non-zero syndrome => - * error */ - /* store syndrome in index form */ - s[i] = Index_of[tmp]; - } - if (!syn_error) { - /* - * if syndrome is zero, data[] is a codeword and there are no - * errors to correct. So return data[] unmodified - */ - return 0; - } - CLEAR(&lambda[1],NN-KK); - lambda[0] = 1; - if (no_eras > 0) { - /* Init lambda to be the erasure locator polynomial */ - lambda[1] = Alpha_to[eras_pos[0]]; - for (i = 1; i < no_eras; i++) { - u = eras_pos[i]; - for (j = i+1; j > 0; j--) { - tmp = Index_of[lambda[j - 1]]; - if(tmp != A0) - lambda[j] ^= Alpha_to[modnn(u + tmp)]; - } - } -#ifdef ERASURE_DEBUG - /* find roots of the erasure location polynomial */ - for(i=1;i<=no_eras;i++) - reg[i] = Index_of[lambda[i]]; - count = 0; - for (i = 1; i <= NN; i++) { - q = 1; - for (j = 1; j <= no_eras; j++) - if (reg[j] != A0) { - reg[j] = modnn(reg[j] + j); - q ^= Alpha_to[reg[j]]; - } - if (!q) { - /* store root and error location - * number indices - */ - root[count] = i; - loc[count] = NN - i; - count++; - } - } - if (count != no_eras) { - printf("\n lambda(x) is WRONG\n"); - return -1; - } -#ifndef NO_PRINT - printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n"); - for (i = 0; i < count; i++) - printf("%d ", loc[i]); - printf("\n"); -#endif -#endif - } - for(i=0;i 0; j--) - if (reg[j] != A0) { - reg[j] = modnn(reg[j] + j); - q ^= Alpha_to[reg[j]]; - } - if (!q) { - /* store root (index-form) and error location number */ - root[count] = i; - loc[count] = NN - i; - count++; - } - } - -#ifdef DEBUG - printf("\n Final error positions:\t"); - for (i = 0; i < count; i++) - printf("%d ", loc[i]); - printf("\n"); -#endif - if (deg_lambda != count) { - /* - * deg(lambda) unequal to number of roots => uncorrectable - * error detected - */ - return -1; - } - /* - * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo - * x**(NN-KK)). in index form. Also find deg(omega). - */ - deg_omega = 0; - for (i = 0; i < NN-KK;i++){ - tmp = 0; - j = (deg_lambda < i) ? deg_lambda : i; - for(;j >= 0; j--){ - if ((s[i + 1 - j] != A0) && (lambda[j] != A0)) - tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; - } - if(tmp != 0) - deg_omega = i; - omega[i] = Index_of[tmp]; - } - omega[NN-KK] = A0; - - /* - * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = - * inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form - */ - for (j = count-1; j >=0; j--) { - num1 = 0; - for (i = deg_omega; i >= 0; i--) { - if (omega[i] != A0) - num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; - } - num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)]; - den = 0; - - /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ - for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) { - if(lambda[i+1] != A0) - den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])]; - } - if (den == 0) { -#ifdef DEBUG - printf("\n ERROR: denominator = 0\n"); -#endif - return -1; - } - /* Apply error to data */ - if (num1 != 0) { - data[loc[j]] ^= Alpha_to[modnn(Index_of[num1] + Index_of[num2] + NN - Index_of[den])]; - } - } - return count; -} - - -#endif /* USE_JPWL */ diff --git a/jpwl/rs.h b/jpwl/rs.h deleted file mode 100644 index 6d2ed59b..00000000 --- a/jpwl/rs.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe - * Copyright (c) 2005, Hervé Drolon, FreeImage Team - * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium - * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef USE_JPWL - -/** -@file rs.h -@brief Functions used to compute Reed-Solomon parity and check of byte arrays - -*/ - -#ifndef __RS_HEADER__ -#define __RS_HEADER__ - -/** Global definitions for Reed-Solomon encoder/decoder - * Phil Karn KA9Q, September 1996 - * - * The parameters MM and KK specify the Reed-Solomon code parameters. - * - * Set MM to be the size of each code symbol in bits. The Reed-Solomon - * block size will then be NN = 2**M - 1 symbols. Supported values are - * defined in rs.c. - * - * Set KK to be the number of data symbols in each block, which must be - * less than the block size. The code will then be able to correct up - * to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with - * each error counting as two erasures. - */ -#define MM 8 /* RS code over GF(2**MM) - change to suit */ -//static int KK; -int KK; - -/* Original code */ -/*#define KK 239*/ /* KK = number of information symbols */ - -#define NN ((1 << MM) - 1) - -#if (MM <= 8) -typedef unsigned char dtype; -#else -typedef unsigned int dtype; -#endif - -/** Initialization function */ -void init_rs(int); - -/** These two functions *must* be called in this order (e.g., - * by init_rs()) before any encoding/decoding - */ -void generate_gf(void); /* Generate Galois Field */ -void gen_poly(void); /* Generate generator polynomial */ - -/** Reed-Solomon encoding - * data[] is the input block, parity symbols are placed in bb[] - * bb[] may lie past the end of the data, e.g., for (255,223): - * encode_rs(&data[0],&data[223]); - */ -int encode_rs(dtype data[], dtype bb[]); - -/** Reed-Solomon erasures-and-errors decoding - * The received block goes into data[], and a list of zero-origin - * erasure positions, if any, goes in eras_pos[] with a count in no_eras. - * - * The decoder corrects the symbols in place, if possible and returns - * the number of corrected symbols. If the codeword is illegal or - * uncorrectible, the data array is unchanged and -1 is returned - */ -int eras_dec_rs(dtype data[], int eras_pos[], int no_eras); - -/** -Computes the minimum between two integers -@param a first integer to compare -@param b second integer to compare -@return returns the minimum integer between a and b -*/ -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif /* min */ - -#endif /* __RS_HEADER__ */ - - -#endif /* USE_JPWL */ diff --git a/mj2/CMakeLists.txt b/mj2/CMakeLists.txt deleted file mode 100644 index 1e884b82..00000000 --- a/mj2/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Makefile for the MJ2 codecs of the OpenJPEG library: frames_to_mj2, mj2_to_frames, extract_j2k_from_mj2 and wrap_j2k_in_mj2 - -# Headers file are located here: -INCLUDE_DIRECTORIES( - ${OPENJPEG_SOURCE_DIR}/libopenjpeg - ) - -ADD_EXECUTABLE(frames_to_mj2 - frames_to_mj2.c - compat/getopt.c - mj2_convert.c mj2.c ) -TARGET_LINK_LIBRARIES(frames_to_mj2 ${OPJ_PREFIX}openjpeg) -IF(UNIX) - TARGET_LINK_LIBRARIES(frames_to_mj2 m) -ENDIF(UNIX) - -ADD_EXECUTABLE(mj2_to_frames - mj2_to_frames.c - compat/getopt.c mj2_convert.c mj2.c ) -TARGET_LINK_LIBRARIES(mj2_to_frames ${OPJ_PREFIX}openjpeg) -IF(UNIX) - TARGET_LINK_LIBRARIES(mj2_to_frames m) -ENDIF(UNIX) - -ADD_EXECUTABLE(extract_j2k_from_mj2 - extract_j2k_from_mj2.c - mj2.c ) -TARGET_LINK_LIBRARIES(extract_j2k_from_mj2 ${OPJ_PREFIX}openjpeg) -IF(UNIX) - TARGET_LINK_LIBRARIES(extract_j2k_from_mj2 m) -ENDIF(UNIX) - -ADD_EXECUTABLE(wrap_j2k_in_mj2 - wrap_j2k_in_mj2.c - mj2.c ) -TARGET_LINK_LIBRARIES(wrap_j2k_in_mj2 ${OPJ_PREFIX}openjpeg) -IF(UNIX) - TARGET_LINK_LIBRARIES(wrap_j2k_in_mj2 m) -ENDIF(UNIX) - -INSTALL(TARGETS frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2 - DESTINATION bin) diff --git a/mj2/MJ2_Extractor.dsp b/mj2/MJ2_Extractor.dsp deleted file mode 100644 index b4870fde..00000000 --- a/mj2/MJ2_Extractor.dsp +++ /dev/null @@ -1,196 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MJ2_Extractor" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=MJ2_Extractor - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "MJ2_Extractor.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "MJ2_Extractor.mak" CFG="MJ2_Extractor - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "MJ2_Extractor - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "MJ2_Extractor - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MJ2_Extractor - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmt" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "MJ2_Extractor - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "MJ2_Extractor___Win32_Debug" -# PROP BASE Intermediate_Dir "MJ2_Extractor___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "MJ2_Extractor___Win32_Debug" -# PROP Intermediate_Dir "MJ2_Extractor___Win32_Debug" -# 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 /MT /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmt" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "MJ2_Extractor - Win32 Release" -# Name "MJ2_Extractor - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\extract_j2k_from_mj2.c -# End Source File -# Begin Source File - -SOURCE=.\mj2.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mj2.h -# End Source File -# End Group -# Begin Group "OpenJPEG Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tgt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/mj2/MJ2_Extractor.dsw b/mj2/MJ2_Extractor.dsw deleted file mode 100644 index 1ee72c6c..00000000 --- a/mj2/MJ2_Extractor.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"="..\LibOpenJPEG.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "MJ2_Extractor"=".\MJ2_Extractor.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/mj2/MJ2_Extractor.sln b/mj2/MJ2_Extractor.sln deleted file mode 100644 index 63a3b721..00000000 --- a/mj2/MJ2_Extractor.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MJ2_Extractor", "MJ2_Extractor.vcproj", "{BCBEB12A-B691-4B14-9DC5-193BCD01183D}" - ProjectSection(ProjectDependencies) = postProject - {4F27AA53-4181-4A1A-8238-3931B0A41048} = {4F27AA53-4181-4A1A-8238-3931B0A41048} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "..\LibOpenJPEG.vcproj", "{4F27AA53-4181-4A1A-8238-3931B0A41048}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BCBEB12A-B691-4B14-9DC5-193BCD01183D}.Debug|Win32.ActiveCfg = Debug|Win32 - {BCBEB12A-B691-4B14-9DC5-193BCD01183D}.Debug|Win32.Build.0 = Debug|Win32 - {BCBEB12A-B691-4B14-9DC5-193BCD01183D}.Release|Win32.ActiveCfg = Release|Win32 - {BCBEB12A-B691-4B14-9DC5-193BCD01183D}.Release|Win32.Build.0 = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.ActiveCfg = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.Build.0 = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.ActiveCfg = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/mj2/MJ2_Extractor.vcproj b/mj2/MJ2_Extractor.vcproj deleted file mode 100644 index 3c6e9a68..00000000 --- a/mj2/MJ2_Extractor.vcproj +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mj2/MJ2_Wrapper.dsp b/mj2/MJ2_Wrapper.dsp deleted file mode 100644 index 724f6088..00000000 --- a/mj2/MJ2_Wrapper.dsp +++ /dev/null @@ -1,195 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MJ2_Wrapper" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=MJ2_Wrapper - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "MJ2_Wrapper.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "MJ2_Wrapper.mak" CFG="MJ2_Wrapper - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "MJ2_Wrapper - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "MJ2_Wrapper - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MJ2_Wrapper - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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 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 - -!ELSEIF "$(CFG)" == "MJ2_Wrapper - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "MJ2_Wrapper___Win32_Debug" -# PROP BASE Intermediate_Dir "MJ2_Wrapper___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "MJ2_Wrapper___Win32_Debug" -# PROP Intermediate_Dir "MJ2_Wrapper___Win32_Debug" -# 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 /MT /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmt" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "MJ2_Wrapper - Win32 Release" -# Name "MJ2_Wrapper - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mj2.c -# End Source File -# Begin Source File - -SOURCE=.\wrap_j2k_in_mj2.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mj2.h -# End Source File -# End Group -# Begin Group "OpenJPEG Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tgt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/mj2/MJ2_Wrapper.dsw b/mj2/MJ2_Wrapper.dsw deleted file mode 100644 index ae5a7011..00000000 --- a/mj2/MJ2_Wrapper.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"="..\LibOpenJPEG.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "MJ2_Wrapper"=".\MJ2_Wrapper.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/mj2/MJ2_Wrapper.sln b/mj2/MJ2_Wrapper.sln deleted file mode 100644 index 850c3056..00000000 --- a/mj2/MJ2_Wrapper.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MJ2_Wrapper", "MJ2_Wrapper.vcproj", "{87C98B26-E658-4992-8810-201C3CE67011}" - ProjectSection(ProjectDependencies) = postProject - {4F27AA53-4181-4A1A-8238-3931B0A41048} = {4F27AA53-4181-4A1A-8238-3931B0A41048} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "..\LibOpenJPEG.vcproj", "{4F27AA53-4181-4A1A-8238-3931B0A41048}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {87C98B26-E658-4992-8810-201C3CE67011}.Debug|Win32.ActiveCfg = Debug|Win32 - {87C98B26-E658-4992-8810-201C3CE67011}.Debug|Win32.Build.0 = Debug|Win32 - {87C98B26-E658-4992-8810-201C3CE67011}.Release|Win32.ActiveCfg = Release|Win32 - {87C98B26-E658-4992-8810-201C3CE67011}.Release|Win32.Build.0 = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.ActiveCfg = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.Build.0 = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.ActiveCfg = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/mj2/MJ2_Wrapper.vcproj b/mj2/MJ2_Wrapper.vcproj deleted file mode 100644 index 2c0f5c2c..00000000 --- a/mj2/MJ2_Wrapper.vcproj +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mj2/Makefile b/mj2/Makefile deleted file mode 100644 index 18d6030d..00000000 --- a/mj2/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Makefile for the MJ2 codecs of the OpenJPEG library: frames_to_mj2, mj2_to_frames, extract_j2k_from_mj2 and wrap_j2k_in_mj2 - -CFLAGS = -O3 -lstdc++ # -g -p -pg - -all: frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2 - -frames_to_mj2: frames_to_mj2.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c mj2_convert.c mj2.c frames_to_mj2.c -o frames_to_mj2 -L.. -lopenjpeg -I ../libopenjpeg/ -lm - -mj2_to_frames: mj2_to_frames.c ../libopenjpeg.a - gcc $(CFLAGS) compat/getopt.c mj2_convert.c mj2.c mj2_to_frames.c -o mj2_to_frames -L.. -lopenjpeg -I ../libopenjpeg/ -lm - -extract_j2k_from_mj2: extract_j2k_from_mj2.c ../libopenjpeg.a - gcc $(CFLAGS) mj2.c extract_j2k_from_mj2.c -o extract_j2k_from_mj2 -L.. -lopenjpeg -I ../libopenjpeg/ -lm - -wrap_j2k_in_mj2: wrap_j2k_in_mj2.c ../libopenjpeg.a - gcc $(CFLAGS) mj2.c wrap_j2k_in_mj2.c -o wrap_j2k_in_mj2 -L.. -lopenjpeg -I ../libopenjpeg/ -lm - -clean: - rm -f frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2 diff --git a/mj2/compat/getopt.c b/mj2/compat/getopt.c deleted file mode 100644 index 5673f315..00000000 --- a/mj2/compat/getopt.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* last review : october 29th, 2002 */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt, /* character checked for validity */ - optreset; /* reset getopt */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define BADARG (int)':' -#define EMSG "" - -/* - * getopt -- - * Parse argc/argv argument vector. - */ -int getopt(nargc, nargv, ostr) -int nargc; -char *const *nargv; -const char *ostr; -{ -# define __progname nargv[0] - static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ - - if (optreset || !*place) { /* update scanning pointer */ - optreset = 0; - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return (-1); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return (-1); - } - } /* option letter okay? */ - if ((optopt = (int) *place++) == (int) ':' || - !(oli = strchr(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means -1. - */ - if (optopt == (int) '-') - return (-1); - if (!*place) - ++optind; - if (opterr && *ostr != ':') - (void) fprintf(stderr, - "%s: illegal option -- %c\n", __progname, optopt); - return (BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (*ostr == ':') - return (BADARG); - if (opterr) - (void) fprintf(stderr, - "%s: option requires an argument -- %c\n", - __progname, optopt); - return (BADCH); - } else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return (optopt); /* dump back option letter */ -} diff --git a/mj2/compat/getopt.h b/mj2/compat/getopt.h deleted file mode 100644 index 23299d1b..00000000 --- a/mj2/compat/getopt.h +++ /dev/null @@ -1,14 +0,0 @@ -/* last review : october 29th, 2002 */ - -#ifndef _GETOPT_H_ -#define _GETOPT_H_ - -extern int opterr; -extern int optind; -extern int optopt; -extern int optreset; -extern char *optarg; - -extern int getopt(int nargc, char *const *nargv, const char *ostr); - -#endif /* _GETOPT_H_ */ diff --git a/mj2/extract_j2k_from_mj2.c b/mj2/extract_j2k_from_mj2.c deleted file mode 100644 index 6ecaf834..00000000 --- a/mj2/extract_j2k_from_mj2.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2003-2007, Francois-Olivier Devaux - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -#include "openjpeg.h" -#include "j2k.h" -#include "jp2.h" -#include "mj2.h" - -/* -------------------------------------------------------------------------- */ - -/** -sample error callback expecting a FILE* client object -*/ -void error_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[ERROR] %s", msg); -} -/** -sample warning callback expecting a FILE* client object -*/ -void warning_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[WARNING] %s", msg); -} -/** -sample debug callback expecting a FILE* client object -*/ -void info_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[INFO] %s", msg); -} - -/* -------------------------------------------------------------------------- */ - - -int main(int argc, char *argv[]) { - opj_dinfo_t* dinfo; - opj_event_mgr_t event_mgr; /* event manager */ - int tnum; - unsigned int snum; - opj_mj2_t *movie; - mj2_tk_t *track; - mj2_sample_t *sample; - unsigned char* frame_codestream; - FILE *file, *outfile; - char outfilename[50]; - mj2_dparameters_t parameters; - - if (argc != 3) { - printf("Bad syntax: Usage: MJ2_extractor mj2filename output_location\n"); - printf("Example: MJ2_extractor foreman.mj2 output/foreman\n"); - return 1; - } - - file = fopen(argv[1], "rb"); - - if (!file) { - fprintf(stderr, "failed to open %s for reading\n", argv[1]); - return 1; - } - - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* get a MJ2 decompressor handle */ - dinfo = mj2_create_decompress(); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* setup the decoder decoding parameters using user parameters */ - movie = (opj_mj2_t*) dinfo->mj2_handle; - mj2_setup_decoder(dinfo->mj2_handle, ¶meters); - - if (mj2_read_struct(file, movie)) // Creating the movie structure - return 1; - - // Decode first video track - tnum = 0; - while (movie->tk[tnum].track_type != 0) - tnum ++; - - track = &movie->tk[tnum]; - - fprintf(stdout,"Extracting %d frames from file...\n",track->num_samples); - - for (snum=0; snum < track->num_samples; snum++) - { - sample = &track->sample[snum]; - frame_codestream = (unsigned char*) malloc (sample->sample_size-8); // Skipping JP2C marker - fseek(file,sample->offset+8,SEEK_SET); - fread(frame_codestream,sample->sample_size-8,1, file); // Assuming that jp and ftyp markers size do - - sprintf(outfilename,"%s_%05d.j2k",argv[2],snum); - outfile = fopen(outfilename, "wb"); - if (!outfile) { - fprintf(stderr, "failed to open %s for writing\n",outfilename); - return 1; - } - fwrite(frame_codestream,sample->sample_size-8,1,outfile); - fclose(outfile); - free(frame_codestream); - } - fclose(file); - fprintf(stdout, "%d frames correctly extracted\n", snum); - - /* free remaining structures */ - if(dinfo) { - mj2_destroy_decompress((opj_mj2_t*)dinfo->mj2_handle); - } - - return 0; -} diff --git a/mj2/frames_to_mj2.c b/mj2/frames_to_mj2.c deleted file mode 100644 index 299b8e66..00000000 --- a/mj2/frames_to_mj2.c +++ /dev/null @@ -1,806 +0,0 @@ -/* -* Copyright (c) 2003-2004, François-Olivier Devaux -* Copyright (c) 2002-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include - -#include "openjpeg.h" -#include "j2k_lib.h" -#include "j2k.h" -#include "jp2.h" -#include "cio.h" -#include "mj2.h" -#include "mj2_convert.h" -#include "compat/getopt.h" - -/** -Size of memory first allocated for MOOV box -*/ -#define TEMP_BUF 10000 - -/* -------------------------------------------------------------------------- */ - -/** -sample error callback expecting a FILE* client object -*/ -void error_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[ERROR] %s", msg); -} -/** -sample warning callback expecting a FILE* client object -*/ -void warning_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[WARNING] %s", msg); -} -/** -sample debug callback expecting a FILE* client object -*/ -void info_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[INFO] %s", msg); -} - -/* -------------------------------------------------------------------------- */ - - -void help_display() -{ - fprintf(stdout,"HELP\n----\n\n"); - fprintf(stdout,"- the -h option displays this help information on screen\n\n"); - - - fprintf(stdout,"List of parameters for the MJ2 encoder:\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"REMARKS:\n"); - fprintf(stdout,"---------\n"); - fprintf(stdout,"\n"); - fprintf - (stdout,"The markers written to the main_header are : SOC SIZ COD QCD COM.\n"); - fprintf - (stdout,"COD and QCD never appear in the tile_header.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"By default:\n"); - fprintf(stdout,"------------\n"); - fprintf(stdout,"\n"); - fprintf(stdout," * Lossless\n"); - fprintf(stdout," * 1 tile\n"); - fprintf(stdout," * Size of precinct : 2^15 x 2^15 (means 1 precinct)\n"); - fprintf(stdout," * Size of code-block : 64 x 64\n"); - fprintf(stdout," * Number of resolutions: 6\n"); - fprintf(stdout," * No SOP marker in the codestream\n"); - fprintf(stdout," * No EPH marker in the codestream\n"); - fprintf(stdout," * No sub-sampling in x or y direction\n"); - fprintf(stdout," * No mode switch activated\n"); - fprintf(stdout," * Progression order: LRCP\n"); - fprintf(stdout," * No index file\n"); - fprintf(stdout," * No ROI upshifted\n"); - fprintf(stdout," * No offset of the origin of the image\n"); - fprintf(stdout," * No offset of the origin of the tiles\n"); - fprintf(stdout," * Reversible DWT 5-3\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Parameters:\n"); - fprintf(stdout,"------------\n"); - fprintf(stdout,"\n"); - fprintf - (stdout,"Required Parameters (except with -h):\n"); - fprintf - (stdout,"-i : source file (-i source.yuv) \n"); - fprintf - (stdout,"-o : destination file (-o dest.mj2) \n"); - fprintf - (stdout,"Optional Parameters:\n"); - fprintf(stdout,"-h : display the help information \n"); - fprintf(stdout,"-r : different compression ratios for successive layers (-r 20,10,5)\n "); - fprintf(stdout," - The rate specified for each quality level is the desired \n"); - fprintf(stdout," compression factor.\n"); - fprintf(stdout," Example: -r 20,10,1 means quality 1: compress 20x, \n"); - fprintf(stdout," quality 2: compress 10x and quality 3: compress lossless\n"); - fprintf(stdout," (options -r and -q cannot be used together)\n "); - - fprintf(stdout,"-q : different psnr for successive layers (-q 30,40,50) \n "); - - fprintf(stdout," (options -r and -q cannot be used together)\n "); - - fprintf(stdout,"-n : number of resolutions (-n 3) \n"); - fprintf(stdout,"-b : size of code block (-b 32,32) \n"); - fprintf(stdout,"-c : size of precinct (-c 128,128) \n"); - fprintf(stdout,"-t : size of tile (-t 512,512) \n"); - fprintf - (stdout,"-p : progression order (-p LRCP) [LRCP, RLCP, RPCL, PCRL, CPRL] \n"); - fprintf - (stdout,"-s : subsampling factor (-s 2,2) [-s X,Y] \n"); - fprintf(stdout," Remark: subsampling bigger than 2 can produce error\n"); - fprintf - (stdout,"-SOP : write SOP marker before each packet \n"); - fprintf - (stdout,"-EPH : write EPH marker after each header packet \n"); - fprintf - (stdout,"-M : mode switch (-M 3) [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL)\n"); - fprintf - (stdout," 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)] \n"); - fprintf - (stdout," Indicate multiple modes by adding their values. \n"); - fprintf - (stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n"); - fprintf - (stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n"); - fprintf - (stdout," for component c=%%d [%%d = 0,1,2]\n"); - fprintf - (stdout," with a value of U=%%d [0 <= %%d <= 37] (i.e. -ROI:c=0,U=25) \n"); - fprintf - (stdout,"-d : offset of the origin of the image (-d 150,300) \n"); - fprintf - (stdout,"-T : offset of the origin of the tiles (-T 100,75) \n"); - fprintf(stdout,"-I : use the irreversible DWT 9-7 (-I) \n"); - fprintf(stdout,"-W : image width, height and the dx and dy subsampling \n"); - fprintf(stdout," of the Cb and Cr components for YUV files \n"); - fprintf(stdout," (default is '352,288,2,2' for CIF format's 352x288 and 4:2:0)\n"); - fprintf(stdout,"-F : video frame rate (set to 25 by default)\n"); - - fprintf(stdout,"\n"); - fprintf(stdout,"IMPORTANT:\n"); - fprintf(stdout,"-----------\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"The index file has the structure below:\n"); - fprintf(stdout,"---------------------------------------\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Image_height Image_width\n"); - fprintf(stdout,"progression order\n"); - fprintf(stdout,"Tiles_size_X Tiles_size_Y\n"); - fprintf(stdout,"Components_nb\n"); - fprintf(stdout,"Layers_nb\n"); - fprintf(stdout,"decomposition_levels\n"); - fprintf(stdout,"[Precincts_size_X_res_Nr Precincts_size_Y_res_Nr]...\n"); - fprintf(stdout," [Precincts_size_X_res_0 Precincts_size_Y_res_0]\n"); - fprintf(stdout,"Main_header_end_position\n"); - fprintf(stdout,"Codestream_size\n"); - fprintf(stdout,"Tile_0 start_pos end_Theader end_pos TotalDisto NumPix MaxMSE\n"); - fprintf(stdout,"Tile_1 '' '' '' '' '' ''\n"); - fprintf(stdout,"...\n"); - fprintf(stdout,"Tile_Nt '' '' '' '' '' ''\n"); - fprintf(stdout,"Tpacket_0 Tile layer res. comp. prec. start_pos end_pos disto\n"); - fprintf(stdout,"...\n"); - fprintf(stdout,"Tpacket_Np '' '' '' '' '' '' '' ''\n"); - - fprintf(stdout,"MaxDisto\n"); - - fprintf(stdout,"TotalDisto\n\n"); -} - -int give_progression(char progression[4]) -{ - if (progression[0] == 'L' && progression[1] == 'R' - && progression[2] == 'C' && progression[3] == 'P') { - return 0; - } else { - if (progression[0] == 'R' && progression[1] == 'L' - && progression[2] == 'C' && progression[3] == 'P') { - return 1; - } else { - if (progression[0] == 'R' && progression[1] == 'P' - && progression[2] == 'C' && progression[3] == 'L') { - return 2; - } else { - if (progression[0] == 'P' && progression[1] == 'C' - && progression[2] == 'R' && progression[3] == 'L') { - return 3; - } else { - if (progression[0] == 'C' && progression[1] == 'P' - && progression[2] == 'R' && progression[3] == 'L') { - return 4; - } else { - return -1; - } - } - } - } - } -} - - - - -int main(int argc, char **argv) -{ - mj2_cparameters_t mj2_parameters; /* MJ2 compression parameters */ - opj_cparameters_t *j2k_parameters; /* J2K compression parameters */ - opj_event_mgr_t event_mgr; /* event manager */ - opj_cio_t *cio; - char value; - opj_mj2_t *movie; - opj_image_t *img; - int i, j; - char *s, S1, S2, S3; - char *buf; - int x1, y1, len; - long mdat_initpos, offset; - FILE *mj2file; - int sampleno; - opj_cinfo_t* cinfo; - bool bSuccess; - int numframes; - double total_time = 0; - - /* default value */ - /* ------------- */ - mj2_parameters.Dim[0] = 0; - mj2_parameters.Dim[1] = 0; - mj2_parameters.w = 352; // CIF default value - mj2_parameters.h = 288; // CIF default value - mj2_parameters.CbCr_subsampling_dx = 2; // CIF default value - mj2_parameters.CbCr_subsampling_dy = 2; // CIF default value - mj2_parameters.frame_rate = 25; - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = NULL; - - /* set J2K encoding parameters to default values */ - opj_set_default_encoder_parameters(&mj2_parameters.j2k_parameters); - j2k_parameters = &mj2_parameters.j2k_parameters; - - /* Create comment for codestream */ - if(j2k_parameters->cp_comment == NULL) { - const char comment[] = "Created by OpenJPEG version "; - const size_t clen = strlen(comment); - const char *version = opj_version(); - j2k_parameters->cp_comment = (char*)malloc(clen+strlen(version)+1); - sprintf(j2k_parameters->cp_comment,"%s%s", comment, version); - } - - mj2_parameters.decod_format = 0; - mj2_parameters.cod_format = 0; - - while (1) { - int c = getopt(argc, argv, - "i:o:r:q:f:t:n:c:b:p:s:d:h P:S:E:M:R:T:C:I:W:F:"); - if (c == -1) - break; - switch (c) { - case 'i': /* IN fill */ - { - char *infile = optarg; - s = optarg; - while (*s) { - s++; - } - s--; - S3 = *s; - s--; - S2 = *s; - s--; - S1 = *s; - - if ((S1 == 'y' && S2 == 'u' && S3 == 'v') - || (S1 == 'Y' && S2 == 'U' && S3 == 'V')) { - mj2_parameters.decod_format = YUV_DFMT; - } - else { - fprintf(stderr, - "!! Unrecognized format for infile : %c%c%c [accept only *.yuv] !!\n\n", - S1, S2, S3); - return 1; - } - strncpy(mj2_parameters.infile, infile, sizeof(mj2_parameters.infile)-1); - } - break; - /* ----------------------------------------------------- */ - case 'o': /* OUT fill */ - { - char *outfile = optarg; - while (*outfile) { - outfile++; - } - outfile--; - S3 = *outfile; - outfile--; - S2 = *outfile; - outfile--; - S1 = *outfile; - - outfile = optarg; - - if ((S1 == 'm' && S2 == 'j' && S3 == '2') - || (S1 == 'M' && S2 == 'J' && S3 == '2')) - mj2_parameters.cod_format = MJ2_CFMT; - else { - fprintf(stderr, - "Unknown output format image *.%c%c%c [only *.mj2]!! \n", - S1, S2, S3); - return 1; - } - strncpy(mj2_parameters.outfile, outfile, sizeof(mj2_parameters.outfile)-1); - } - break; - /* ----------------------------------------------------- */ - case 'r': /* rates rates/distorsion */ - { - float rate; - s = optarg; - while (sscanf(s, "%f", &rate) == 1) { - j2k_parameters->tcp_rates[j2k_parameters->tcp_numlayers] = rate * 2; - j2k_parameters->tcp_numlayers++; - while (*s && *s != ',') { - s++; - } - if (!*s) - break; - s++; - } - j2k_parameters->cp_disto_alloc = 1; - } - break; - /* ----------------------------------------------------- */ - case 'q': /* add fixed_quality */ - s = optarg; - while (sscanf(s, "%f", &j2k_parameters->tcp_distoratio[j2k_parameters->tcp_numlayers]) == 1) { - j2k_parameters->tcp_numlayers++; - while (*s && *s != ',') { - s++; - } - if (!*s) - break; - s++; - } - j2k_parameters->cp_fixed_quality = 1; - break; - /* dda */ - /* ----------------------------------------------------- */ - case 'f': /* mod fixed_quality (before : -q) */ - { - int *row = NULL, *col = NULL; - int numlayers = 0, numresolution = 0, matrix_width = 0; - - s = optarg; - sscanf(s, "%d", &numlayers); - s++; - if (numlayers > 9) - s++; - - j2k_parameters->tcp_numlayers = numlayers; - numresolution = j2k_parameters->numresolution; - matrix_width = numresolution * 3; - j2k_parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int)); - s = s + 2; - - for (i = 0; i < numlayers; i++) { - row = &j2k_parameters->cp_matrice[i * matrix_width]; - col = row; - j2k_parameters->tcp_rates[i] = 1; - sscanf(s, "%d,", &col[0]); - s += 2; - if (col[0] > 9) - s++; - col[1] = 0; - col[2] = 0; - for (j = 1; j < numresolution; j++) { - col += 3; - sscanf(s, "%d,%d,%d", &col[0], &col[1], &col[2]); - s += 6; - if (col[0] > 9) - s++; - if (col[1] > 9) - s++; - if (col[2] > 9) - s++; - } - if (i < numlayers - 1) - s++; - } - j2k_parameters->cp_fixed_alloc = 1; - } - break; - /* ----------------------------------------------------- */ - case 't': /* tiles */ - sscanf(optarg, "%d,%d", &j2k_parameters->cp_tdx, &j2k_parameters->cp_tdy); - j2k_parameters->tile_size_on = true; - break; - /* ----------------------------------------------------- */ - case 'n': /* resolution */ - sscanf(optarg, "%d", &j2k_parameters->numresolution); - break; - /* ----------------------------------------------------- */ - case 'c': /* precinct dimension */ - { - char sep; - int res_spec = 0; - - char *s = optarg; - do { - sep = 0; - sscanf(s, "[%d,%d]%c", &j2k_parameters->prcw_init[res_spec], - &j2k_parameters->prch_init[res_spec], &sep); - j2k_parameters->csty |= 0x01; - res_spec++; - s = strpbrk(s, "]") + 2; - } - while (sep == ','); - j2k_parameters->res_spec = res_spec; - } - break; - - /* ----------------------------------------------------- */ - case 'b': /* code-block dimension */ - { - int cblockw_init = 0, cblockh_init = 0; - sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init); - if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 - || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) { - fprintf(stderr, - "!! Size of code_block error (option -b) !!\n\nRestriction :\n" - " * width*height<=4096\n * 4<=width,height<= 1024\n\n"); - return 1; - } - j2k_parameters->cblockw_init = cblockw_init; - j2k_parameters->cblockh_init = cblockh_init; - } - break; - /* ----------------------------------------------------- */ - case 'p': /* progression order */ - { - char progression[4]; - - strncpy(progression, optarg, 4); - j2k_parameters->prog_order = give_progression(progression); - if (j2k_parameters->prog_order == -1) { - fprintf(stderr, "Unrecognized progression order " - "[LRCP, RLCP, RPCL, PCRL, CPRL] !!\n"); - return 1; - } - } - break; - /* ----------------------------------------------------- */ - case 's': /* subsampling factor */ - { - if (sscanf(optarg, "%d,%d", &j2k_parameters->subsampling_dx, - &j2k_parameters->subsampling_dy) != 2) { - fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n"); - return 1; - } - } - break; - /* ----------------------------------------------------- */ - case 'd': /* coordonnate of the reference grid */ - { - if (sscanf(optarg, "%d,%d", &j2k_parameters->image_offset_x0, - &j2k_parameters->image_offset_y0) != 2) { - fprintf(stderr, "-d 'coordonnate of the reference grid' argument " - "error !! [-d x0,y0]\n"); - return 1; - } - } - break; - /* ----------------------------------------------------- */ - case 'h': /* Display an help description */ - help_display(); - return 0; - break; - /* ----------------------------------------------------- */ - case 'P': /* POC */ - { - int numpocs = 0; /* number of progression order change (POC) default 0 */ - opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */ - - char *s = optarg; - POC = j2k_parameters->POC; - - while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile, - &POC[numpocs].resno0, &POC[numpocs].compno0, - &POC[numpocs].layno1, &POC[numpocs].resno1, - &POC[numpocs].compno1, &POC[numpocs].progorder) == 7) { - POC[numpocs].prg1 = give_progression(POC[numpocs].progorder); - numpocs++; - while (*s && *s != '/') { - s++; - } - if (!*s) { - break; - } - s++; - } - j2k_parameters->numpocs = numpocs; - } - break; - /* ------------------------------------------------------ */ - case 'S': /* SOP marker */ - j2k_parameters->csty |= 0x02; - break; - /* ------------------------------------------------------ */ - case 'E': /* EPH marker */ - j2k_parameters->csty |= 0x04; - break; - /* ------------------------------------------------------ */ - case 'M': /* Mode switch pas tous au point !! */ - if (sscanf(optarg, "%d", &value) == 1) { - for (i = 0; i <= 5; i++) { - int cache = value & (1 << i); - if (cache) - j2k_parameters->mode |= (1 << i); - } - } - break; - /* ------------------------------------------------------ */ - case 'R': /* ROI */ - { - if (sscanf(optarg, "OI:c=%d,U=%d", &j2k_parameters->roi_compno, - &j2k_parameters->roi_shift) != 2) { - fprintf(stderr, "ROI error !! [-ROI:c='compno',U='shift']\n"); - return 1; - } - } - break; - /* ------------------------------------------------------ */ - case 'T': /* Tile offset */ - { - if (sscanf(optarg, "%d,%d", &j2k_parameters->cp_tx0, &j2k_parameters->cp_ty0) != 2) { - fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]"); - return 1; - } - } - break; - /* ------------------------------------------------------ */ - case 'C': /* Add a comment */ - { - j2k_parameters->cp_comment = (char*)malloc(strlen(optarg) + 1); - if(j2k_parameters->cp_comment) { - strcpy(j2k_parameters->cp_comment, optarg); - } - } - break; - /* ------------------------------------------------------ */ - case 'I': /* reversible or not */ - { - j2k_parameters->irreversible = 1; - } - break; - /* ------------------------------------------------------ */ - case 'W': /* Width and Height and Cb and Cr subsampling in case of YUV format files */ - if (sscanf - (optarg, "%d,%d,%d,%d", &mj2_parameters.w, &mj2_parameters.h, &mj2_parameters.CbCr_subsampling_dx, - &mj2_parameters.CbCr_subsampling_dy) != 4) { - fprintf(stderr, "-W argument error"); - return 1; - } - break; - /* ------------------------------------------------------ */ - case 'F': /* Video frame rate */ - if (sscanf(optarg, "%d", &mj2_parameters.frame_rate) != 1) { - fprintf(stderr, "-F argument error"); - return 1; - } - break; - /* ------------------------------------------------------ */ - default: - return 1; - } - } - - /* Error messages */ - /* -------------- */ - if (!mj2_parameters.cod_format || !mj2_parameters.decod_format) { - fprintf(stderr, - "Correct usage: mj2_encoder -i yuv-file -o mj2-file (+ options)\n"); - return 1; - } - - if ((j2k_parameters->cp_disto_alloc || j2k_parameters->cp_fixed_alloc || j2k_parameters->cp_fixed_quality) - && (!(j2k_parameters->cp_disto_alloc ^ j2k_parameters->cp_fixed_alloc ^ j2k_parameters->cp_fixed_quality))) { - fprintf(stderr, "Error: options -r -q and -f cannot be used together !!\n"); - return 1; - } /* mod fixed_quality */ - - /* if no rate entered, lossless by default */ - if (j2k_parameters->tcp_numlayers == 0) { - j2k_parameters->tcp_rates[0] = 0; /* MOD antonin : losslessbug */ - j2k_parameters->tcp_numlayers++; - j2k_parameters->cp_disto_alloc = 1; - } - - if((j2k_parameters->cp_tx0 > j2k_parameters->image_offset_x0) || (j2k_parameters->cp_ty0 > j2k_parameters->image_offset_y0)) { - fprintf(stderr, - "Error: Tile offset dimension is unnappropriate --> TX0(%d)<=IMG_X0(%d) TYO(%d)<=IMG_Y0(%d) \n", - j2k_parameters->cp_tx0, j2k_parameters->image_offset_x0, j2k_parameters->cp_ty0, j2k_parameters->image_offset_y0); - return 1; - } - - for (i = 0; i < j2k_parameters->numpocs; i++) { - if (j2k_parameters->POC[i].prg == -1) { - fprintf(stderr, - "Unrecognized progression order in option -P (POC n %d) [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n", - i + 1); - } - } - - if (j2k_parameters->cp_tdx > mj2_parameters.Dim[0] || j2k_parameters->cp_tdy > mj2_parameters.Dim[1]) { - fprintf(stderr, - "Error: Tile offset dimension is unnappropriate --> TX0(%d)<=IMG_X0(%d) TYO(%d)<=IMG_Y0(%d) \n", - j2k_parameters->cp_tdx, mj2_parameters.Dim[0], j2k_parameters->cp_tdy, mj2_parameters.Dim[1]); - return 1; - } - - /* to respect profile - 0 */ - /* ---------------------- */ - - x1 = !mj2_parameters.Dim[0] ? (mj2_parameters.w - 1) * j2k_parameters->subsampling_dx - + 1 : mj2_parameters.Dim[0] + (mj2_parameters.w - 1) * j2k_parameters->subsampling_dx + 1; - y1 = !mj2_parameters.Dim[1] ? (mj2_parameters.h - 1) * j2k_parameters->subsampling_dy - + 1 : mj2_parameters.Dim[1] + (mj2_parameters.h - 1) * j2k_parameters->subsampling_dy + 1; - mj2_parameters.numcomps = 3; /* Because YUV files only have 3 components */ - mj2_parameters.prec = 8; /* Because in YUV files, components have 8-bit depth */ - - j2k_parameters->tcp_mct = 0; - - mj2file = fopen(mj2_parameters.outfile, "wb"); - - if (!mj2file) { - fprintf(stderr, "failed to open %s for writing\n", argv[2]); - return 1; - } - - /* get a MJ2 decompressor handle */ - cinfo = mj2_create_compress(); - movie = cinfo->mj2_handle; - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); - - /* setup encoder parameters */ - mj2_setup_encoder(movie, &mj2_parameters); - - movie->tk[0].num_samples = yuv_num_frames(&movie->tk[0],mj2_parameters.infile); - if (movie->tk[0].num_samples == -1) { - return 1; - } - - // One sample per chunk - movie->tk[0].chunk = (mj2_chunk_t*) malloc(movie->tk[0].num_samples * sizeof(mj2_chunk_t)); - movie->tk[0].sample = (mj2_sample_t*) malloc(movie->tk[0].num_samples * sizeof(mj2_sample_t)); - - if (mj2_init_stdmovie(movie)) { - fprintf(stderr, "Error with movie initialization"); - return 1; - }; - - // Writing JP, FTYP and MDAT boxes - buf = (char*) malloc (300 * sizeof(char)); // Assuming that the JP and FTYP - // boxes won't be longer than 300 bytes - cio = opj_cio_open((opj_common_ptr)movie->cinfo, buf, 300); - mj2_write_jp(cio); - mj2_write_ftyp(movie, cio); - mdat_initpos = cio_tell(cio); - cio_skip(cio, 4); - cio_write(cio, MJ2_MDAT, 4); - fwrite(buf,cio_tell(cio),1,mj2file); - offset = cio_tell(cio); - opj_cio_close(cio); - free(buf); - - for (i = 0; i < movie->num_stk + movie->num_htk + movie->num_vtk; i++) { - if (movie->tk[i].track_type != 0) { - fprintf(stderr, "Unable to write sound or hint tracks\n"); - } else { - mj2_tk_t *tk; - int buflen = 0; - - tk = &movie->tk[i]; - tk->num_chunks = tk->num_samples; - numframes = tk->num_samples; - - fprintf(stderr, "Video Track number %d\n", i + 1); - - img = mj2_image_create(tk, j2k_parameters); - buflen = 2 * (tk->w * tk->h * 8); - buf = (char *) malloc(buflen*sizeof(char)); - - for (sampleno = 0; sampleno < numframes; sampleno++) { - double init_time = opj_clock(); - double elapsed_time; - if (yuvtoimage(tk, img, sampleno, j2k_parameters, mj2_parameters.infile)) { - fprintf(stderr, "Error with frame number %d in YUV file\n", sampleno); - return 1; - } - - /* setup the encoder parameters using the current image and user parameters */ - opj_setup_encoder(cinfo, j2k_parameters, img); - - cio = opj_cio_open((opj_common_ptr)movie->cinfo, buf, buflen); - - cio_skip(cio, 4); - cio_write(cio, JP2_JP2C, 4); // JP2C - - /* encode the image */ - bSuccess = opj_encode(cinfo, cio, img, NULL); - if (!bSuccess) { - opj_cio_close(cio); - fprintf(stderr, "failed to encode image\n"); - return 1; - } - - len = cio_tell(cio) - 8; - cio_seek(cio, 0); - cio_write(cio, len+8,4); - opj_cio_close(cio); - tk->sample[sampleno].sample_size = len+8; - tk->sample[sampleno].offset = offset; - tk->chunk[sampleno].offset = offset; // There is one sample per chunk - fwrite(buf, 1, len+8, mj2file); - offset += len+8; - elapsed_time = opj_clock()-init_time; - fprintf(stderr, "Frame number %d/%d encoded in %.2f mseconds\n", sampleno + 1, numframes, elapsed_time*1000); - total_time += elapsed_time; - - } - /* free buffer data */ - free(buf); - /* free image data */ - opj_image_destroy(img); - } - } - - fseek(mj2file, mdat_initpos, SEEK_SET); - - buf = (char*) malloc(4*sizeof(char)); - - // Init a cio to write box length variable in a little endian way - cio = opj_cio_open(NULL, buf, 4); - cio_write(cio, offset - mdat_initpos, 4); - fwrite(buf, 4, 1, mj2file); - fseek(mj2file,0,SEEK_END); - free(buf); - - // Writing MOOV box - buf = (char*) malloc ((TEMP_BUF+numframes*20) * sizeof(char)); - cio = opj_cio_open(movie->cinfo, buf, (TEMP_BUF+numframes*20)); - mj2_write_moov(movie, cio); - fwrite(buf,cio_tell(cio),1,mj2file); - free(buf); - - fprintf(stdout,"Total encoding time: %.2f s for %d frames (%.1f fps)\n", total_time, numframes, (float)numframes/total_time); - - // Ending program - - fclose(mj2file); - /* free remaining compression structures */ - mj2_destroy_compress(movie); - free(cinfo); - /* free user parameters structure */ - if(j2k_parameters->cp_comment) free(j2k_parameters->cp_comment); - if(j2k_parameters->cp_matrice) free(j2k_parameters->cp_matrice); - opj_cio_close(cio); - - return 0; -} - - diff --git a/mj2/frames_to_mj2.dsp b/mj2/frames_to_mj2.dsp deleted file mode 100644 index c1da2676..00000000 --- a/mj2/frames_to_mj2.dsp +++ /dev/null @@ -1,212 +0,0 @@ -# Microsoft Developer Studio Project File - Name="frames_to_mj2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=frames_to_mj2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "frames_to_mj2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "frames_to_mj2.mak" CFG="frames_to_mj2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "frames_to_mj2 - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "frames_to_mj2 - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "frames_to_mj2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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 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 -# SUBTRACT LINK32 /pdb:none /incremental:yes /debug - -!ELSEIF "$(CFG)" == "frames_to_mj2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "frames_to_mj2___Win32_Debug0" -# PROP BASE Intermediate_Dir "frames_to_mj2___Win32_Debug0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "frames_to_mj2___Win32_Debug0" -# PROP Intermediate_Dir "frames_to_mj2___Win32_Debug0" -# 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 /MT /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmt" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "frames_to_mj2 - Win32 Release" -# Name "frames_to_mj2 - Win32 Debug" -# Begin Group "MJ2" - -# PROP Default_Filter "" -# Begin Group "MJ2 Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\mj2.h -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.h -# End Source File -# End Group -# Begin Group "MJ2 Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\frames_to_mj2.c -# End Source File -# Begin Source File - -SOURCE=.\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\mj2.c -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.c -# End Source File -# End Group -# End Group -# Begin Group "Libopenjpeg Header files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\libopenjpeg\bio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\cio.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\dwt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\event.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\fix.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\image.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\int.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\j2k_lib.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jp2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\jpt.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mct.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\mqc.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\openjpeg.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\opj_includes.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\pi.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\raw.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t1.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\t2.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tcd.h -# End Source File -# Begin Source File - -SOURCE=..\libopenjpeg\tgt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/mj2/frames_to_mj2.dsw b/mj2/frames_to_mj2.dsw deleted file mode 100644 index 92c5fc17..00000000 --- a/mj2/frames_to_mj2.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "frames_to_mj2"=".\frames_to_mj2.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Project: "LibOpenJPEG"="..\LibOpenJPEG.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/mj2/frames_to_mj2.sln b/mj2/frames_to_mj2.sln deleted file mode 100644 index f62e33dc28310e3481cebc013182f6db78196f0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1508 zcmbW1-)@^Q6vlU3B;EnBn@*~cArPF4USKe-rgn=KX}g(JkzgWM1V{YoO`0d$MIWiJ z(8CfE+)f=0SN1vfIX{2?%=4coUAq;FQdTmnjh~`wlH8cpO)8`@lX+7MSs1a%`Gpb7 za+SauURG^zVqvUnpI_~9F!pq9TFQIAsL#y}q2VNClpsRg0NHkg5s7RYVI1IaVnfz- zw&oY((lE0!S@G(wmUpXr$GmtIupSm`sM^LiZs?DRM=4^CJw`4eAtGbnLvic{o*T0W zzOAWiXM2trumJM;ej4#LFH&AC1h3l8YgyI%6znT_wxZVES`$q0O3Wi?uvhIFM>RY-N>EUgC UlPL!i#lg*t{j - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mj2/meta_out.c b/mj2/meta_out.c deleted file mode 100644 index c77ec20a..00000000 --- a/mj2/meta_out.c +++ /dev/null @@ -1,2181 +0,0 @@ -/* meta_out.c */ -/* Dump MJ2, JP2 metadata (partial so far) to xml file */ -/* Callable from mj2_to_metadata */ -/* Contributed to Open JPEG by Glenn Pearson, contract software developer, U.S. National Library of Medicine. - -The base code in this file was developed by the author as part of a video archiving -project for the U.S. National Library of Medicine, Bethesda, MD. -It is the policy of NLM (and U.S. government) to not assert copyright. - -A non-exclusive copy of this code has been contributed to the Open JPEG project. -Except for copyright, inclusion of the code within Open JPEG for distribution and use -can be bound by the Open JPEG open-source license and disclaimer, expressed elsewhere. -*/ - -#include /* for time functions */ - -#include "opj_includes.h" -#include "mj2.h" - -#include -#include "meta_out.h" - -static BOOL notes = TRUE; -static BOOL sampletables = FALSE; -static BOOL raw = TRUE; -static BOOL derived = TRUE; - -opj_tcp_t *j2k_default_tcp; - -/* Forwards */ -int xml_write_overall_header(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, opj_event_mgr_t *event_mgr); -int xml_write_moov(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, opj_event_mgr_t *event_mgr); - -void uint_to_chars(unsigned int value, char* buf); - -void xml_write_trak(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum, unsigned int sampleframe, opj_event_mgr_t *event_mgr); -void xml_write_tkhd(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum); -void xml_write_udta(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum); -void xml_write_mdia(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum); -void xml_write_stbl(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum); - -void UnixTimeToFileTime(time_t t, LPFILETIME pft); -void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst); -void xml_time_out(FILE* xmlout, time_t t); - -void int16_to_3packedchars(short int value, char* buf); - -void xml_write_moov_udta(FILE* xmlout, opj_mj2_t * movie); -void xml_write_free_and_skip(FILE* xmlout, opj_mj2_t * movie); -void xml_write_uuid(FILE* xmlout, opj_mj2_t * movie); - -int xml_out_frame(FILE* file, FILE* xmlout, mj2_sample_t *sample, unsigned int snum, opj_event_mgr_t *event_mgr); - -void xml_out_frame_siz(FILE* xmlout, opj_image_t *img, opj_cp_t *cp); -void xml_out_frame_cod(FILE* xmlout, opj_tcp_t *tcp); -void xml_out_frame_coc(FILE* xmlout, opj_tcp_t *tcp, int numcomps); /* opj_image_t *img); */ -BOOL same_component_style(opj_tccp_t *tccp1, opj_tccp_t *tccp2); -void xml_out_frame_qcd(FILE* xmlout, opj_tcp_t *tcp); -void xml_out_frame_qcc(FILE* xmlout, opj_tcp_t *tcp, int numcomps); /* opj_image_t *img); */ -BOOL same_component_quantization(opj_tccp_t *tccp1, opj_tccp_t *tccp2); -void xml_out_frame_rgn(FILE* xmlout, opj_tcp_t *tcp, int numcomps);/* opj_image_t *img);*/ -void xml_out_frame_poc(FILE* xmlout, opj_tcp_t *tcp); -void xml_out_frame_ppm(FILE* xmlout, opj_cp_t *cp); -void xml_out_frame_ppt(FILE* xmlout, opj_tcp_t *tcp); -void xml_out_frame_tlm(FILE* xmlout); /* j2k_default_tcp is passed globally */ /* NO-OP. TLM NOT SAVED IN DATA STRUCTURE */ -void xml_out_frame_plm(FILE* xmlout); /* j2k_default_tcp is passed globally */ /* NO-OP. PLM NOT SAVED IN DATA STRUCTURE. opt in main; can be used in conjunction with PLT */ -void xml_out_frame_plt(FILE* xmlout, opj_tcp_t *tcp); /* NO-OP. PLM NOT SAVED IN DATA STRUCTURE. opt in main; can be used in conjunction with PLT */ -void xml_out_frame_crg(FILE* xmlout); /* j2k_default_tcp is passed globally */ /* opt in main; */ -void xml_out_frame_com(FILE* xmlout, opj_tcp_t *tcp); /* NO-OP. COM NOT SAVED IN DATA STRUCTURE */ /* opt in main; */ -void xml_out_dump_hex(FILE* xmlout, char *data, int data_len, char* s); -void xml_out_dump_hex_and_ascii(FILE* xmlout, char *data, int data_len, char* s); -void xml_out_frame_jp2h(FILE* xmlout, opj_jp2_t *jp2_struct); -#ifdef NOTYET -/* Shown with cp, extended, as data structure... but it could be a new different one */ -void xml_out_frame_jp2i(FILE* xmlout, opj_cp_t *cp);/* IntellectualProperty 'jp2i' (no restrictions on location) */ -void xml_out_frame_xml(FILE* xmlout, opj_cp_t *cp); /* XML 'xml\040' (0x786d6c20). Can appear multiply */ -void xml_out_frame_uuid(FILE* xmlout, opj_cp_t *cp); /* UUID 'uuid' (top level only) */ -void xml_out_frame_uinf(FILE* xmlout, opj_cp_t *cp); /* UUIDInfo 'uinf', includes UUIDList 'ulst' and URL 'url\40' */ -void xml_out_frame_unknown_type(FILE* xmlout, opj_cp_t *cp); -#endif - - -void xml_write_init(BOOL n, BOOL t, BOOL r, BOOL d) -{ - /* Init file globals */ - notes = n; - sampletables = t; - raw = r; - derived = d; -} - -int xml_write_struct(FILE* file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr) { - - if(stringDTD != NULL) - { - fprintf(xmlout,"\n"); - /* stringDTD is known to start with "SYSTEM " or "PUBLIC " */ - /* typical: SYSTEM mj2_to_metadata.dtd */ - stringDTD[6] = '\0'; /* Break into two strings at space, so quotes can be inserted. */ - fprintf(xmlout,"\n", stringDTD, stringDTD+7); - stringDTD[6] = ' '; /* restore for sake of debugger or memory allocator */ - } else - fprintf(xmlout,"\n"); - - fprintf(xmlout, "\n"); - xml_write_overall_header(file, xmlout, movie, sampleframe, event_mgr); - fprintf(xmlout, ""); - return 0; -} - -/* ------------- */ - -int xml_write_overall_header(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, opj_event_mgr_t *event_mgr) -{ - int i; - char buf[5]; - buf[4] = '\0'; - - fprintf(xmlout, " \n"); - // Called after structure initialized by mj2_read_ftyp - fprintf(xmlout, " \n"); - uint_to_chars(movie->brand, buf); - fprintf(xmlout, " %s\n", buf); /* 4 character; BR */ - fprintf(xmlout, " %u\n", movie->minversion); /* 4 char; MinV */ - fprintf(xmlout, " \n",movie->num_cl); - for (i = movie->num_cl - 1; i > -1; i--) /* read routine stored in reverse order, so let's undo damage */ - { - uint_to_chars(movie->cl[i], buf); - fprintf(xmlout, " %s\n", buf); /*4 characters, each CLi */ - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - xml_write_moov(file, xmlout, movie, sampleframe, event_mgr); - // To come? // This is the container for media data that can also be accessed through track structures, - // so is redundant, and simply not of interest as metadata - // // Allows incremental build up of movie. Probably not in Simple Profile - xml_write_free_and_skip(xmlout, movie); /* NO OP so far */ /* May be a place where user squirrels metadata */ - xml_write_uuid(xmlout, movie); /* NO OP so far */ /* May be a place where user squirrels metadata */ - return 0; -} - -/* ------------- */ - -int xml_write_moov(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, opj_event_mgr_t *event_mgr) -{ - unsigned int tnum; - mj2_tk_t *track; - - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", movie->creation_time); - if(notes) - fprintf(xmlout, " \n"); - /* 2082844800 = seconds between 1/1/04 and 1/1/70 */ - /* There's still a time zone offset problem not solved... but spec is ambigous as to whether stored time - should be local or UTC */ - if(derived) { - fprintf(xmlout, " "); - xml_time_out(xmlout, movie->creation_time - 2082844800); - fprintf(xmlout,"\n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", movie->modification_time); - if(derived) { - fprintf(xmlout, " "); - xml_time_out(xmlout, movie->modification_time - 2082844800); - fprintf(xmlout,"\n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", movie->timescale); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); /* Rate to play presentation (default = 0x00010000) */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - if(raw) - fprintf(xmlout, " 0x%08x\n", movie->rate); - if(derived) - fprintf(xmlout, " %12.6f\n", (double)movie->rate/(double)0x00010000); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", movie->duration); - if(derived) - fprintf(xmlout, " %12.3f\n", (double)movie->duration/(double)movie->timescale); // Make this double later to get fractional seconds - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - movie->volume = movie->volume << 8; -#endif - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - if(raw) - fprintf(xmlout, " 0x%04x\n", movie->volume); - if(derived) - fprintf(xmlout, " %6.3f\n", (double)movie->volume/(double)0x0100); - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - if(notes) - fprintf(xmlout, " \n"); - movie->volume = movie->volume >> 8; -#endif - /* Transformation matrix for video */ - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[0]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[1]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[2]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[3]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[4]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[5]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[6]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[7]); - fprintf(xmlout, " 0x%08x\n", movie->trans_matrix[8]); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n", movie->num_vtk); - fprintf(xmlout, " \n", movie->num_stk); - fprintf(xmlout, " %d\n", movie->num_htk); - if(notes) - fprintf(xmlout, " \n"); - /* See Part 3 Amend 2 Section 4.2 for relation of MJ2 to Part 12 Sections 7 and 10 hints */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - /* Idea for the future: It would be possible to add code to verify that the file values: - 1) are legal and self-consistent - 2) comply with particular JP2 and/or MJ2 profiles. - This could be reported here as additional XML elements */ - - // Find first video track - tnum = 0; - while (movie->tk[tnum].track_type != 0) - tnum ++; - - track = &(movie->tk[tnum]); - // For now, output info on first video track - xml_write_trak(file, xmlout, track, tnum, sampleframe, event_mgr); - - // to come: // possibly not in Simple Profile - xml_write_moov_udta(xmlout, movie); /* NO OP so far */ /* contains */ - fprintf(xmlout, " \n"); - return 0; -} - -/* --------------- */ - -void uint_to_chars(unsigned int value, char* buf) -{ - /* buf is at least char[5] */ - int i; - for (i = 3; i >= 0; i--) - { - buf[i] = (value & 0x000000ff); - value = (value >> 8); - } - buf[4] = '\0'; /* Precautionary */ -} - -/* ------------- */ - -/* WINDOWS SPECIFIC */ - -void UnixTimeToFileTime(time_t t, LPFILETIME pft) -{ - /* Windows specific. From MS Q167296 */ - /* 'time_t' represents seconds since midnight January 1, 1970 UTC (coordinated universal time). */ - /* 64-bit FILETIME structure represents the number of 100-nanosecond intervals since January 1, 1601 UTC (coordinate universal time). */ - LONGLONG ll; /* LONGLONG is a 64-bit value. */ - ll = Int32x32To64(t, 10000000) + 116444736000000000; - pft->dwLowDateTime = (DWORD)ll; - /* pft->dwLowDateTime = (DWORD)(0x00000000ffffffff & ll); */ - pft->dwHighDateTime = (DWORD)(ll >> 32); -} -// Once the UNIX time is converted to a FILETIME structure, -// other Win32 time formats can be easily obtained by using Win32 functions such -// as FileTimeToSystemTime() and FileTimeToDosDateTime(). - -/* ------------- */ - -void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst) -{ - /* Windows specific */ - FILETIME ft; - UnixTimeToFileTime(t, &ft); - FileTimeToLocalFileTime( &ft, &ft ); /* Adjust from UTC to local time zone */ - FileTimeToSystemTime(&ft, pst); -} - -/* ------------- */ - -void xml_time_out(FILE* xmlout, time_t t) -{ - /* Windows specific */ - SYSTEMTIME st; - char szLocalDate[255], szLocalTime[255]; - UnixTimeToSystemTime( t, &st ); - GetDateFormat( LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, szLocalDate, 255 ); - GetTimeFormat( LOCALE_USER_DEFAULT, 0, &st, NULL, szLocalTime, 255 ); - fprintf(xmlout, "%s %s", szLocalDate, szLocalTime ); -} - -/* END WINDOWS SPECIFIC */ - -/* ------------- */ - -void xml_write_moov_udta(FILE* xmlout, opj_mj2_t * movie) { - /* Compare with xml_write_udta */ -#ifdef NOTYET - /* NO-OP so far. Optional UserData 'udta' (zero or one in moov or each trak) - can contain multiple Copyright 'cprt' with different language codes */ - /* There may be nested non-standard boxes within udta */ - IMAGINE movie->udta, movie->copyright_count, movie->copyright_language[i] (array of 16bit ints), movie->copyright_notice[i] (array of buffers) - PROBABLY ALSO NEED movie->udta_len or special handler for non-standard boxes - char buf[5]; - int i; - - if(movie->udta != 1) - return; /* Not present */ - - fprintf(xmlout, " \n"); - for(i = 0; i < movie->copyright_count; i++) { - fprintf(xmlout, " Instance=\"%d\">\n", i+1); - int16_to_3packedchars((short int)movie->copyright_languages[i], buf); - fprintf(xmlout, " %s\n", buf); /* 3 chars */ - fprintf(xmlout, " %s\n",movie->copyright_notices[i]); - fprintf(xmlout, " \n", i+1); - } - /* TO DO: Non-standard boxes */ - fprintf(xmlout, " \n"); -#endif -} - -void xml_write_free_and_skip(FILE* xmlout, opj_mj2_t * movie) { -#ifdef NOTYET - /* NO-OP so far. There can be zero or more instances of free and/or skip - at the top level of the file. This may be a place where the user squirrel's metadata. - Let's assume unstructured, and do a dump */ - IMAGINE movie->free_and_skip, movie->free_and_skip_count, movie->free_and_skip_content[i] (array of buffers), - movie->free_and_skip_len[i] (array of ints), movie->is_skip[i] (array of BOOL) - int i; - - if(movie->free_and_skip != 1) - return; /* Not present */ - - for(i = 0; i < movie->free_and_skip_count; i++) { - if(movie->is_skip[i]) - fprintf(xmlout, " \n"); - else - fprintf(xmlout, " \n"); - - xml_out_dump_hex_and_ascii(xmlout, movie->free_and_skip_contents[i], movie->free_and_skip_len[i]); - - if(movie->is_skip[i]) - fprintf(xmlout, " \n"); - else - fprintf(xmlout, " \n"); - } -#endif -} - -void xml_write_uuid(FILE* xmlout, opj_mj2_t * movie) { -/* Univeral Unique IDs of 16 bytes. */ -#ifdef NOTYET - /* NO-OP so far. There can be zero or more instances of private uuid boxes in a file. - This function supports the top level of the file, but uuid may be elsewhere [not yet supported]. - This may be a place where the user squirrel's metadata. Let's assume unstructured, and do a dump */ - IMAGINE movie->uuid, movie->uuid_count, movie->uuid_content[i] (array of buffers), - movie->uuid_len[i] (array of ints), movie->uuid_type[i] (array of 17-byte (16+null termination) buffers) - int i; - - if(movie->uuid != 1) - return; /* Not present */ - - for(i = 0; i < movie->uuid_count; i++) { - fprintf(xmlout, " \n", movie->uuid_type[i]); - // See Part III section 5.2.1, 6.1, 6.2 - xml_out_dump_hex_and_ascii(xmlout, movie->uuid_contents[i], movie->uuid_len[i]); - fprintf(xmlout, " \n"); - } -#endif -} - -/* ------------- */ - -void xml_write_trak(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum, unsigned int sampleframe, opj_event_mgr_t *event_mgr) -{ - fprintf(xmlout, " \n", tnum); - xml_write_tkhd(file, xmlout, track, tnum); - // TO DO: TrackReferenceContainer 'tref' just used in hint track - // TO DO: EditListContainer 'edts', contains EditList 'elst' with media-time, segment-duration, media-rate - xml_write_mdia(file, xmlout, track, tnum); - xml_write_udta(file, xmlout, track, tnum); // NO-OP so far. Optional UserData 'udta', can contain multiple Copyright 'cprt' - - if(track->track_type==0) { /* Only do for visual track */ - /* sampleframe is from user option -f. 1 = first frame */ - /* sampleframe of 0 is a user requests: no jp2 header */ - /* Treat out-of-bounds values in the same way */ - if(sampleframe > 0 && sampleframe <= track->num_samples) - { - mj2_sample_t *sample; - unsigned int snum; - - snum = sampleframe-1; - // Someday maybe do a smart range scan... for (snum=0; snum < track->num_samples; snum++){ - // fprintf(stdout,"Frame %d: ",snum+1); - sample = &track->sample[snum]; - if(xml_out_frame(file, xmlout, sample, snum, event_mgr)) - return; /* Not great error handling here */ - } - } - fprintf(xmlout, " \n"); -} - -/* ------------- */ - -void xml_write_tkhd(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum) -{ - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " %u\n", track->track_ID); - if(track->track_type==0) /* For visual track */ - { - fprintf(xmlout, " %d\n", track->layer); - if(notes) - fprintf(xmlout," \n"); - } - if(track->track_type!=0) /* volume irrelevant for visual track */ - { -#ifdef CURRENTSTRUCT - track->volume = track->volume << 8; -#endif - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - } - if(raw) - fprintf(xmlout," 0x%04x\n", track->volume); - if(derived) - fprintf(xmlout," %6.3f\n", (double)track->volume/(double)0x0100); - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - if(notes) - fprintf(xmlout, " \n"); - track->volume = track->volume >> 8; -#endif - } - if(track->track_type==0) - { - /* Transformation matrix for video */ - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - } - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[0]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[1]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[2]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[3]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[4]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[5]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[6]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[7]); - fprintf(xmlout, " 0x%08x\n", track->trans_matrix[8]); - fprintf(xmlout, " \n"); - } -#ifdef CURRENTSTRUCT - track->w = track->w << 16; - track->h = track->h << 16; -#endif - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " 0x%08x\n", track->w); - if(derived) - fprintf(xmlout, " %12.6f\n", (double)track->w/(double)0x00010000); /* Rate to play presentation (default = 0x00010000) */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " 0x%08x\n", track->h); - if(derived) - fprintf(xmlout, " %12.6f\n", (double)track->h/(double)0x00010000); /* Rate to play presentation (default = 0x00010000) */ - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - track->w = track->w >> 16; - track->h = track->h >> 16; -#endif - fprintf(xmlout, " \n"); -} - -/* ------------- */ - -void xml_write_udta(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum) { - /* NO-OP so far. Optional UserData 'udta' (zero or one in moov or each trak) - can contain multiple Copyright 'cprt' with different language codes */ - /* There may be nested non-standard boxes within udta */ -#ifdef NOTYET - IMAGINE track->udta, track->copyright_count, track->copyright_language[i] (array of 16bit ints), track->copyright_notice[i] (array of buffers) - PROBABLY ALSO NEED track->udta_len or special handler for non-standard boxes - char buf[5]; - int i; - - if(track->udta != 1) - return; /* Not present */ - - fprintf(xmlout, " \n"); - for(i = 0; i < track->copyright_count; i++) { - fprintf(xmlout, " Instance=\"%d\">\n", i+1); - int16_to_3packedchars((short int)track->copyright_languages[i], buf); - fprintf(xmlout, " %s\n", buf); /* 3 chars */ - fprintf(xmlout, " %s\n",track->copyright_notices[i]); - fprintf(xmlout, " \n", i+1); - } - /* TO DO: Non-standard boxes */ - fprintf(xmlout, " \n"); -#endif -} - -/* ------------- */ - -void xml_write_mdia(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum) -{ - char buf[5]; - int i, k; - buf[4] = '\0'; - - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", track->creation_time); - if(notes) - fprintf(xmlout, " \n"); - /* 2082844800 = seconds between 1/1/04 and 1/1/70 */ - /* There's still a time zone offset problem not solved... but spec is ambigous as to whether stored time - should be local or UTC */ - if(derived) { - fprintf(xmlout, " "); - xml_time_out(xmlout, track->creation_time - 2082844800); - fprintf(xmlout,"\n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", track->modification_time); - if(derived) { - fprintf(xmlout, " "); - xml_time_out(xmlout, track->modification_time - 2082844800); - fprintf(xmlout,"\n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", track->timescale); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " %u\n", track->duration); - if(derived) - fprintf(xmlout, " %12.3f\n", (double)track->duration/(double)track->timescale); // Make this double later to get fractional seconds - fprintf(xmlout, " \n"); - int16_to_3packedchars((short int)track->language, buf); - fprintf(xmlout, " %s\n", buf); /* 3 chars */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - switch(track->track_type) - { - case 0: - fprintf(xmlout, " video media track\n"); break; - case 1: - fprintf(xmlout, " Sound\n"); break; - case 2: - fprintf(xmlout, " Hint\n"); break; - } - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - switch(track->track_type) - { - case 0: - fprintf(xmlout, " \n"); - fprintf(xmlout, " 0x%02x\n", track->graphicsmode); - if(notes) { - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); -/* fprintf(xmlout," \n"); This was evidently dropped upon amendment */ - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " 0x%02x\n", track->opcolor[0]); - fprintf(xmlout, " 0x%02x\n",track->opcolor[1]); - fprintf(xmlout, " 0x%02x\n",track->opcolor[2]); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - break; - case 1: - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - track->balance = track->balance << 8; -#endif - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - fprintf(xmlout," \n"); - } - if(raw) - fprintf(xmlout," 0x%04x\n", track->balance); - if(derived) - fprintf(xmlout," %6.3f\n", (double)track->balance/(double)0x0100); - fprintf(xmlout, " \n"); -#ifdef CURRENTSTRUCT - if(notes) - fprintf(xmlout," \n"); - track->balance = track->balance >> 8; -#endif - fprintf(xmlout, " \n"); - break; - case 2: - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", track->maxPDUsize); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " %d\n", track->avgPDUsize); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " %d\n", track->maxbitrate); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " %d\n", track->avgbitrate); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " %d\n", track->slidingavgbitrate); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " \n"); - break; - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n", track->num_url, track->num_urn); // table w. flags, URLs, URNs - // Data structure does not distinguish between single URL, single URN, or DREF table or URLs & URNs. - // We could infer those, but for now just present everything as a DREF table. - if(notes) - fprintf(xmlout, " \n"); - for(k = 0; k < track->num_url; k++) { - fprintf(xmlout, " \n"); // table w. flags, URLs, URNs - if(notes) - fprintf(xmlout," \n"); - for(i = 0; i < 4; i++) { - uint_to_chars(track->url[track->num_url].location[i], buf); - fprintf(xmlout, " %s\n"); - } - fprintf(xmlout, " \n"); // table w. flags, URLs, URNs - } - for(k = 0; k < track->num_urn; k++) { - fprintf(xmlout," \n"); // table w. flags, URLs, URNs - // Only the first 16 bytes are recorded in the data structure currently. - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " "); - for(i = 0; i < 4; i++) { - uint_to_chars(track->urn[track->num_urn].name[i], buf); - fprintf(xmlout,"%s", buf); - } - fprintf(xmlout, "\n"); - fprintf(xmlout, " "); - for(i = 0; i < 4; i++) { - uint_to_chars(track->urn[track->num_urn].location[i], buf); - fprintf(xmlout,"%s"); - } - fprintf(xmlout, "\n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - - xml_write_stbl(file, xmlout, track, tnum); /* SampleTable */ - - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); -} - -/* ------------- */ - -void xml_write_stbl(FILE* file, FILE* xmlout, mj2_tk_t *track, unsigned int tnum) -{ - char buf[5], buf33[33]; - int i, len; - buf[4] = '\0'; - - fprintf(xmlout, " \n"); - if(notes) - fprintf(xmlout, " \n"); - switch(track->track_type) - { - case 0: - // There could be multiple instances of this, but "entry_count" is just a local at read-time. - // And it's used wrong, too, as count of just visual type, when it's really all 3 types. - // This is referred to as "smj2" within mj2.c - fprintf(xmlout, " \n"); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - /* No shifting required. If CURRENTSTRUCT gets changed, then may need to revisit treatment of these */ - fprintf(xmlout, " %d\n", track->w); - fprintf(xmlout, " %d\n", track->h); -// Horizresolution and vertresolution don't require shifting, already stored right in CURRENTSTRUCT - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " 0x%08x\n", track->horizresolution); - if(derived) - fprintf(xmlout, " %12.6f\n", (double)track->horizresolution/(double)0x00010000); /* Rate to play presentation (default = 0x00010000) */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout, " 0x%08x\n", track->vertresolution); - if(derived) - fprintf(xmlout, " %12.6f\n", (double)track->vertresolution/(double)0x00010000); /* Rate to play presentation (default = 0x00010000) */ - fprintf(xmlout, " \n"); - - buf33[0] = '\0'; - for(i = 0; i < 8; i++) { - uint_to_chars((unsigned int)track->compressorname[i], buf); - strcat(buf33, buf); /* This loads up (4 * 8) + 1 chars, but trailing ones are usually junk */ - } - len = (int)buf33[0]; /* First byte has string length in bytes. There may be garbage beyond it. */ - buf33[len+1] = '\0'; /* Suppress it */ - fprintf(xmlout, " %s\n", buf33+1); /* Start beyond first byte */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " 0x%02x\n",track->depth); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - - xml_out_frame_jp2h(xmlout, &(track->jp2_struct)); /* JP2 Header */ - - /* Following subboxes are optional */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", (unsigned int)track->fieldcount); /* uchar as 1 byte uint */ - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", (unsigned int)track->fieldorder); /* uchar as 1 byte uint */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n",track->num_br); - for (i = 0; i < track->num_br; i++) /* read routine stored in reverse order, so let's undo damage */ - { - uint_to_chars(track->br[i], buf); - fprintf(xmlout, " %s\n", buf); /*4 characters, each CLi */ - } - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n",track->num_jp2x); - for (i = 0; i < track->num_jp2x; i++) - { // We'll probably need better formatting than this - fprintf(xmlout, " 0x%02x\n", track->jp2xdata[i]); /* Each entry is single byte */ - } - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n"); /* These values are all 1 byte */ - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", track->hsub); - fprintf(xmlout, " %d\n", track->vsub); - fprintf(xmlout, " %d\n", track->hoff); - fprintf(xmlout, " %d\n", track->voff); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); /* These values are all 1 byte */ - - fprintf(xmlout, " \n"); /* Part III Appx. 2 */ - fprintf(xmlout, " %u\n", (unsigned int)track->or_fieldcount); /* uchar as 1-byte uint */ - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %u\n", (unsigned int)track->or_fieldorder); /* uchar as 1-byte uint */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - break; - case 1: case 2: - if(notes) - fprintf(xmlout, " \n"); break; - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", track->num_samples); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n", track->num_tts); - for (i = 0; i < track->num_tts; i++) { - fprintf(xmlout, " \n", - i+1, track->tts[i].sample_count, track->tts[i].sample_delta); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n", track->num_samplestochunk); - for (i = 0; i < track->num_samplestochunk; i++) { - fprintf(xmlout, " %u\n",track->sampletochunk[i].first_chunk); /* 4 bytes */ - fprintf(xmlout, " %u\n",track->sampletochunk[i].samples_per_chunk); /* 4 bytes */ - fprintf(xmlout, " %u\n",track->sampletochunk[i].sample_descr_idx); /* 4 bytes */ - } - fprintf(xmlout, " \n"); - // After reading this info in, track->num_chunks is calculated and a decompressed table established internally. - - fprintf(xmlout, " \n"); - if(track->same_sample_size) { - // all values in track->sample[i].sample_size are equal. Grab the first one. - fprintf(xmlout, " %u\n", track->sample[0].sample_size); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - } else { - fprintf(xmlout, " 0\n"); - if(notes) - if(sampletables) - fprintf(xmlout," \n"); - else - fprintf(xmlout," \n"); - fprintf(xmlout, " %u\n", track->num_samples); - if(sampletables) - for (i = 0; i < (int)track->num_samples; i++) { - fprintf(xmlout, " %u\n", i+1, track->sample[i].sample_size); - } - } - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n"); - // Structure not yet - Variant ChunkLargeOffset 'co64' - fprintf(xmlout, " %u\n", track->num_chunks); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - if(sampletables) - for (i = 0; i < (int)track->num_chunks; i++) - fprintf(xmlout, " %u\n", i+1, track->chunk[i].offset); - fprintf(xmlout, " \n"); - - fprintf(xmlout, " \n"); -} - -/* ------------- */ - -int xml_out_frame(FILE* file, FILE* xmlout, mj2_sample_t *sample, unsigned int snum, opj_event_mgr_t *event_mgr) -{ - opj_dparameters_t parameters; /* decompression parameters */ - opj_image_t *img; - opj_cp_t *cp; - int i; - int numcomps; - unsigned char* frame_codestream; - opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ - opj_cio_t *cio = NULL; - opj_j2k_t *j2k; - - /* JPEG 2000 compressed image data */ - - /* get a decoder handle */ - dinfo = opj_create_decompress(CODEC_J2K); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, event_mgr, stderr); - - /* setup the decoder decoding parameters using the current image and user parameters */ - parameters.cp_limit_decoding = DECODE_ALL_BUT_PACKETS; - opj_setup_decoder(dinfo, ¶meters); - - frame_codestream = (unsigned char*) malloc (sample->sample_size-8); /* Skipping JP2C marker */ - if(frame_codestream == NULL) - return 1; - - fseek(file,sample->offset+8,SEEK_SET); - fread(frame_codestream,sample->sample_size-8,1, file); /* Assuming that jp and ftyp markers size do */ - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, frame_codestream, sample->sample_size-8); - - /* Decode J2K to image: */ - img = opj_decode(dinfo, cio); - if (!img) { - fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - return 1; - } - - j2k = (opj_j2k_t*)dinfo->j2k_handle; - j2k_default_tcp = j2k->default_tcp; - cp = j2k->cp; - - numcomps = img->numcomps; - /* Alignments: " < To help maintain xml pretty-printing */ - fprintf(xmlout, " \n", snum+1); - fprintf(xmlout, " \n"); - /* There can be multiple codestreams; a particular image is entirely within a single codestream */ - /* TO DO: A frame can be represented by two I-guess-contigious codestreams if its interleaved. */ - fprintf(xmlout, " \n"); - /* "cp" stands for "coding parameter"; "tcp" is tile coding parameters, "tccp" is tile-component coding parameters */ - xml_out_frame_siz(xmlout, img, cp); /* reqd in main */ - xml_out_frame_cod(xmlout, j2k_default_tcp); /* reqd in main */ - xml_out_frame_coc(xmlout, j2k_default_tcp, numcomps); /* opt in main, at most 1 per component */ - xml_out_frame_qcd(xmlout, j2k_default_tcp); /* reqd in main */ - xml_out_frame_qcc(xmlout, j2k_default_tcp, numcomps); /* opt in main, at most 1 per component */ - xml_out_frame_rgn(xmlout, j2k_default_tcp, numcomps); /* opt, at most 1 per component */ - xml_out_frame_poc(xmlout, j2k_default_tcp); /* opt (but reqd in main or tile for any progression order changes) */ - /* Next four get j2k_default_tcp passed globally: */ -#ifdef SUPPRESS_FOR_NOW - xml_out_frame_ppm(xmlout, cp); /* opt (but either PPM or PPT [distributed in tile headers] or codestream packet header reqd) */ -#endif - xml_out_frame_tlm(xmlout); /* NO-OP. TLM NOT SAVED IN DATA STRUCTURE */ /* opt */ - xml_out_frame_plm(xmlout); /* NO-OP. PLM NOT SAVED IN DATA STRUCTURE */ /* opt in main; can be used in conjunction with PLT */ - xml_out_frame_crg(xmlout); /* NO-OP. CRG NOT SAVED IN DATA STRUCTURE */ /* opt in main; */ - xml_out_frame_com(xmlout, j2k_default_tcp); /* NO-OP. COM NOT SAVED IN DATA STRUCTURE */ /* opt in main; */ - - fprintf(xmlout, " \n"); - - /* TO DO: all the tile headers (sigh) */ - fprintf(xmlout, " \n", cp->tileno_size); /* size of the vector tileno */ - for(i = 0; i < cp->tileno_size; i++) { /* I think cp->tileno_size will be same number as (cp->tw * cp->th) or as global j2k_curtileno */ - // Standard seems to use zero-based # for tile-part. - fprintf(xmlout, " \n", i, cp->tileno[i]); /* ID number of the tiles present in the codestream */ - fprintf(xmlout, " \n"); - /* All markers in tile-part headers (between SOT and SOD) are optional, unless structure requires. */ - if(i == 0) { - xml_out_frame_cod(xmlout, &(cp->tcps[i])); /* No more than 1 per tile */ - xml_out_frame_coc(xmlout, &(cp->tcps[i]), numcomps); /* No more than 1 per component */ - xml_out_frame_qcd(xmlout, &(cp->tcps[i])); /* No more than 1 per tile */ - xml_out_frame_qcc(xmlout, &(cp->tcps[i]), numcomps); /* No more than 1 per component */ - xml_out_frame_rgn(xmlout, &(cp->tcps[i]), numcomps); /* No more than 1 per component */ - } - xml_out_frame_poc(xmlout, &(cp->tcps[i])); /* Reqd only if any progression order changes different from main POC */ -#ifdef SUPPRESS_FOR_NOW - xml_out_frame_ppt(xmlout, &(cp->tcps[i])); /* Either PPT [distributed in tile headers] or PPM or codestream packet header reqd. */ -#endif - xml_out_frame_plt(xmlout, &(cp->tcps[i])); /* NO-OP. PLT NOT SAVED IN DATA STRUCTURE */ /* Can be used in conjunction with main's PLM */ - xml_out_frame_com(xmlout, &(cp->tcps[i])); /* NO-OP. COM NOT SAVED IN DATA STRUCTURE */ - /* opj_tcp_t * cp->tcps; "tile coding parameters" */ - /* Maybe not: fprintf(xmlout, " <>%d, cp->matrice[i]; */ /* Fixed layer */ - fprintf(xmlout, " \n"); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); /* size of the vector tileno */ - -#ifdef NOTYET - IMAGINE the cp object has data to support the following... but we could use an new different data structure instead - /* I'm unclear if the span of the original fread(frame_codestream...) included the following items if they're trailing. */ - /* ALSO TO DO, BUT DATA STRUCTURE DOESN'T HANDLE YET: boxes (anywhere in file except before the Filetype box): */ - xml_out_frame_jp2i(xmlout, &cp); /* IntellectualProperty 'jp2i' (no restrictions on location) */ - xml_out_frame_xml(xmlout, &cp); /* XML 'xml\040' (0x786d6c20). Can appear multiply */ - xml_out_frame_uuid(xmlout, &cp); /* UUID 'uuid' (top level only) */ - xml_out_frame_uinf(xmlout, &cp); /* UUIDInfo 'uinf', includes UUIDList 'ulst' and URL 'url\40' */ -#endif - - fprintf(xmlout, " \n"); - - /* Extra commentary: */ - if(notes) { - fprintf(xmlout, " \n"); - if (((img->numcomps == 3) && (img->comps[0].dx == img->comps[1].dx / 2) - && (img->comps[0].dx == img->comps[2].dx / 2 ) && (img->comps[0].dx == 1)) - || (img->numcomps == 1)) { - fprintf(xmlout, " \n"); - } - else if ((img->numcomps == 3) && - (img->comps[0].dx == 1) && (img->comps[1].dx == 1)&& - (img->comps[2].dx == 1)) {// If YUV 4:4:4 input --> to bmp - fprintf(xmlout, " \n"); - } - else { - fprintf(xmlout, " \n"); - } - } - - opj_destroy_decompress(dinfo); - opj_cio_close(cio); - free(frame_codestream); - - return 0; -} - -/* ------------- */ - -void int16_to_3packedchars(short int value, char* buf) -{ - /* This is to retrieve the 3-letter ASCII language code */ - /* Each char is packed into 5 bits, as difference from 0x60 */ - int i; - for (i = 2; i >= 0; i--) - { - buf[i] = (value & 0x001f) + 0x60; - value = (value >>5); - } - buf[3] = '\0'; -} - -/* ------------- */ - -void xml_out_frame_siz(FILE* xmlout, opj_image_t *img, opj_cp_t *cp) -{ - opj_image_comp_t *comp; - int i; - - fprintf(xmlout, " \n"); - // This is similar to j2k.c's j2k_dump_image. - // Not of interest: Lsiz, Rsiz - fprintf(xmlout, " %d\n", img->x1); - fprintf(xmlout, " %d\n", img->y1); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", img->x0); - fprintf(xmlout, " %d\n", img->y0); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", cp->tdx); - fprintf(xmlout, " %d\n", cp->tdy); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", cp->tx0); - fprintf(xmlout, " %d\n", cp->ty0); - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", img->numcomps); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - //fprintf(xmlout," \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - - for (i = 0; i < img->numcomps; i++) {/* image-components */ - comp = &(img->comps[i]); - fprintf(xmlout, " \n", i+1); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout," 0x%02x\n", (comp->sgnd << 7) & (comp->prec - 1)); - if(derived) { - fprintf(xmlout," %d\n", comp->sgnd); - fprintf(xmlout," %d\n", comp->prec); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", comp->dx); - fprintf(xmlout, " %d\n", comp->dy); - fprintf(xmlout, " %d\n", comp->w); - fprintf(xmlout, " %d\n", comp->h); - /* Rest of these aren't calculated when SIZ is read: - fprintf(xmlout, " %d\n", comp->x0); - fprintf(xmlout, " %d\n", comp->y0); - if(notes) - fprintf(xmlout," \n"); - fprintf(xmlout, " %d\n", comp->bpp); - fprintf(xmlout, " %d\n", comp->resno_decoded); */ - // SUPPRESS: n/a to mj2_to_metadata. fprintf(xmlout," %dfactor); - /* factor = number of division by 2 of the out image compare to the original size of image */ - // TO DO comp->data: int *data; /* image-component data */ - - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " \n"); -} - -/* ------------- */ - -void xml_out_frame_cod(FILE* xmlout, opj_tcp_t *tcp) -{ -/* Could be called with tcp = &j2k_default_tcp; -/* Or, for tile-part header, with &j2k_cp->tcps[j2k_curtileno] -/* Alignment for main:" < < < < To help maintain xml pretty-printing */ -/* Alignment for tile:" < < < To help maintain xml pretty-printing */ - opj_tccp_t *tccp; - int i; - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - tccp = &(tcp->tccps[0]); - - fprintf(xmlout, "%s\n",s); /* Required in main header */ - /* Not retained or of interest: Lcod */ - fprintf(xmlout, "%s 0x%02x\n", s, tcp->csty); /* 1 byte */ - if(notes) { - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - } - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s %d\n", s, tcp->prg); /* 1 byte, SGcod (A) */ - if(notes) { - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - } - fprintf(xmlout, "%s %d\n", s, tcp->numlayers); /* 2 bytes, SGcod (B) */ - fprintf(xmlout, "%s %d\n", s, tcp->mct); /* 1 byte, SGcod (C). More or less boolean */ - if(notes) - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - /* This code will compile only if declaration of j2k_default_tcp is changed from static (to implicit extern) in j2k.c */ - fprintf(xmlout, "%s \n",s); - /* Internal data structure tccp defines separate defaults for each component, but they all get the same values */ - /* So we only have to report the first component's values here. */ - /* Compare j2k_read_cox(...) */ - fprintf(xmlout, "%s %d\n", s, tccp->numresolutions - 1); /* 1 byte, SPcox (D) */ - fprintf(xmlout, "%s %d\n", s, tccp->cblkw - 2); /* 1 byte, SPcox (E) */ - fprintf(xmlout, "%s %d\n", s, tccp->cblkh - 2); /* 1 byte, SPcox (F) */ - if(notes) { - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s 0x%02x\n", s, tccp->cblksty); /* 1 byte, SPcox (G) */ - if(notes) { - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s \n",s); - } - fprintf(xmlout, "%s %d\n", s, tccp->qmfbid); /* 1 byte, SPcox (H) */ - if(notes) - fprintf(xmlout, "%s \n",s); - if (tccp->csty & J2K_CP_CSTY_PRT) { - fprintf(xmlout, "%s \n",s); /* 1 byte, SPcox (I_i) */ - if(notes) - fprintf(xmlout, "%s \n",s); - for (i = 0; i < tccp->numresolutions; i++) { - fprintf(xmlout, "%s \n", s, i); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, (tccp->prch[i] << 4) | tccp->prcw[i]); /* packed into 1 byte, SPcox (G) */ - if(derived) { - fprintf(xmlout,"%s %d\n", s, tccp->prcw[i]); - fprintf(xmlout,"%s %d\n", s, tccp->prch[i]); - } - fprintf(xmlout, "%s \n", s, i); - } - fprintf(xmlout, "%s \n",s); /* 1 byte, SPcox (I_i) */ - } - fprintf(xmlout, "%s \n",s); - fprintf(xmlout, "%s\n",s); -} - -/* ------------- */ - -void xml_out_frame_coc(FILE* xmlout, opj_tcp_t *tcp, int numcomps) /* Optional in main & tile-part headers */ -{ -/* Uses global j2k_default_tcp */ - opj_tccp_t *tccp, *firstcomp_tccp; - int i, compno; - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - - firstcomp_tccp = &(tcp->tccps[0]); - /* Internal data structure tccp defines separate defaults for each component, set from main */ - /* default, then selectively overwritten. */ - /* Compare j2k_read_cox(...) */ - /* We don't really know which was the default, and which were not */ - /* Let's pretend that [0] is the default and all others are not */ - if(notes) { - fprintf(xmlout, "%s\n", s); - if(tcp == j2k_default_tcp) - fprintf(xmlout, "%s\n", s); - else - fprintf(xmlout, "%s\n", s); - } - for (compno = 1; compno < numcomps; compno++) /* spec says components are zero-based */ - { - tccp = &tcp->tccps[compno]; - if(same_component_style(firstcomp_tccp, tccp)) - continue; - -/* Alignments: " < < < < < To help maintain xml pretty-printing */ - fprintf(xmlout, "%s\n", s); /* Optional in main header, at most 1 per component */ - if(notes) - fprintf(xmlout, "%s \n", s); - /* Overrides the main COD for the specific component */ - /* Not retained or of interest: Lcod */ - fprintf(xmlout, "%s 0x%02x\n", s, tccp->csty); /* 1 byte */ - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s %d\n", s, compno); /* 1 or 2 bytes */ - /* Unfortunately compo isn't retained in j2k_read_coc: compno = cio_read(j2k_img->numcomps <= 256 ? 1 : 2); /* Ccoc */ - /*if(j2k_img_numcomps <=256) - component is 1 byte - else - compno is 2 byte */ - - /* This code will compile only if declaration of j2k_default_tcp is changed from static (to implicit extern) in j2k.c */ - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s %d\n", s, tccp->numresolutions - 1); /* 1 byte, SPcox (D) */ - fprintf(xmlout, "%s %d\n", s, tccp->cblkw - 2); /* 1 byte, SPcox (E) */ - fprintf(xmlout, "%s %d\n", s, tccp->cblkh - 2); /* 1 byte, SPcox (F) */ - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s 0x%02x\n", s, tccp->cblksty); /* 1 byte, SPcox (G) */ - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s %d\n", s, tccp->qmfbid); /* 1 byte, SPcox (H) */ - if(notes) - fprintf(xmlout, "%s \n", s); - if (tccp->csty & J2K_CP_CSTY_PRT) { - fprintf(xmlout, "%s \n", s); /* 1 byte, SPcox (I_i) */ - if(notes) - fprintf(xmlout, "%s \n", s); - for (i = 0; i < tccp->numresolutions-1; i++) { /* subtract 1 to get # of decomposition levels */ - fprintf(xmlout, "%s \n", s, i); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, (tccp->prch[i] << 4) | tccp->prcw[i]); /* packed into 1 byte, SPcox (G) */ - if(derived) { - fprintf(xmlout,"%s %d\n", s, tccp->prcw[i]); - fprintf(xmlout,"%s %d\n", s, tccp->prch[i]); - } - fprintf(xmlout, "%s \n", s, i); - } - fprintf(xmlout, "%s \n", s); /* 1 byte, SPcox (I_i) */ - } - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s\n", s); - } -} - -/* ------------- */ - -BOOL same_component_style(opj_tccp_t *tccp1, opj_tccp_t *tccp2) -{ - int i; - - if(tccp1->numresolutions != tccp2->numresolutions) - return FALSE; - if(tccp1->cblkw != tccp2->cblkw) - return FALSE; - if(tccp1->cblkh != tccp2->cblkh) - return FALSE; - if(tccp1->cblksty != tccp2->cblksty) - return FALSE; - if(tccp1->csty != tccp2->csty) - return FALSE; - - if (tccp1->csty & J2K_CP_CSTY_PRT) { - for (i = 0; i < tccp1->numresolutions; i++) { - if(tccp1->prcw[i] != tccp2->prcw[i] || tccp1->prch[i] != tccp2->prch[i]) - return FALSE; - } - } - return TRUE; -} - -/* ------------- */ - -void xml_out_frame_qcd(FILE* xmlout, opj_tcp_t *tcp) -{ - /* This code will compile only if declaration of j2k_default_tcp is changed from static (to implicit extern) in j2k.c */ - opj_tccp_t *tccp; - int bandno, numbands; - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - - /* Compare j2k_read_qcx */ - fprintf(xmlout, "%s\n", s); /* Required in main header, single occurrence */ - tccp = &(tcp->tccps[0]); - /* Not retained or of interest: Lqcd */ - fprintf(xmlout, "%s \n", s); /* 1 byte */ - if(notes) - fprintf(xmlout, "%s \n", s); - if(raw) - fprintf(xmlout, "%s 0x%02x\n", s, (tccp->numgbits) << 5 | tccp->qntsty); - if(derived) - fprintf(xmlout, "%s %d\n", s, tccp->qntsty); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - if(derived) - fprintf(xmlout, "%s %d\n", s, tccp->numgbits); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - - /* Problem: numbands in some cases is calculated from len, which is not retained or available here at this time */ - /* So we'll just dump all internal values */ - /* We could calculate it, but I'm having trouble believing the length equations in the standard */ - - fprintf(xmlout, "%s \n", s); - switch(tccp->qntsty) { - case J2K_CCP_QNTSTY_NOQNT: /* no quantization */ - /* This is what standard says, but I don't believe it: len = 4 + (3*decomp); */ - numbands = J2K_MAXBANDS; /* should be: numbands = len - 1; */ - /* Better: IMAGINE numbands = tccp->stepsize_numbands; */ - /* Instead look for first zero exponent, quit there. Adequate? */ - fprintf(xmlout, "%s \n", s); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp->stepsizes[bandno].expn == 0) - break; /* Remove when we have real numbands */ - fprintf(xmlout, "%s \n", s, bandno); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, tccp->stepsizes[bandno].expn << 3); - if(derived) - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].expn); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s \n", s); - break; - case J2K_CCP_QNTSTY_SIQNT: /* scalar quantization derived */ - /* This is what standard says. Should I believe it:: len = 5; - /* numbands = 1; */ - fprintf(xmlout, "%s \n", s); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - - for (bandno = 1; bandno < J2K_MAXBANDS; bandno++) { - if(tccp->stepsizes[bandno].expn == 0) - break; - - fprintf(xmlout, "%s %d\n", s, bandno, tccp->stepsizes[bandno].expn); - } - - fprintf(xmlout, "%s \n", s); - break; - - default: /* J2K_CCP_QNTSTY_SEQNT */ /* scalar quantization expounded */ - /* This is what standard says, but should I believe it: len = 5 + 6*decomp; */ - numbands = J2K_MAXBANDS; /* should be: (len - 1) / 2;*/ - /* Better: IMAGINE numbands = tccp->stepsize_numbands; */ - fprintf(xmlout, "%s \n", s); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp->stepsizes[bandno].expn == 0 && tccp->stepsizes[bandno].mant == 0) - break; /* Remove when we have real numbands */ - - fprintf(xmlout, "%s \n", s, bandno); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, (tccp->stepsizes[bandno].expn << 11) | tccp->stepsizes[bandno].mant); - if(derived) { - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].expn); - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].mant); - } - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s \n", s); - break; - } /* switch */ - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s\n", s); - -/* Alignments: " < < < < < To help maintain xml pretty-printing */ -} - -/* ------------- */ - -void xml_out_frame_qcc(FILE* xmlout, opj_tcp_t *tcp, int numcomps) -{ -/* Uses global j2k_default_tcp */ - /* This code will compile only if declaration of j2k_default_tcp is changed from static (to implicit extern) in j2k.c */ - opj_tccp_t *tccp, *firstcomp_tccp; - int bandno, numbands; - int compno; - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - - firstcomp_tccp = &(tcp->tccps[0]); - /* Internal data structure tccp defines separate defaults for each component, set from main */ - /* default, then selectively overwritten. */ - /* Compare j2k_read_qcx(...) */ - /* We don't really know which was the default, and which were not */ - /* Let's pretend that [0] is the default and all others are not */ - if(notes) { - fprintf(xmlout, "%s\n", s); - if(tcp == j2k_default_tcp) - fprintf(xmlout, "%s\n", s); - else - fprintf(xmlout, "%s\n", s); - } - for (compno = 1; compno < numcomps; compno++) /* spec says components are zero-based */ - { - tccp = &(tcp->tccps[compno]); - if(same_component_quantization(firstcomp_tccp, tccp)) - continue; - - /* Compare j2k_read_qcx */ - fprintf(xmlout, "%s\n", s, compno); /* Required in main header, single occurrence */ - tccp = &j2k_default_tcp->tccps[0]; - /* Not retained or perhaps of interest: Lqcd It maybe can be calculated. */ - fprintf(xmlout, "%s \n", s); /* 1 byte */ - if(notes) - fprintf(xmlout, "%s \n", s); - if(raw) - fprintf(xmlout, "%s 0x%02x\n", s, (tccp->numgbits) << 5 | tccp->qntsty); - if(derived) - fprintf(xmlout, "%s %d\n", s, tccp->qntsty); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - if(derived) - fprintf(xmlout, "%s %d\n", s, tccp->numgbits); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - - /* Problem: numbands in some cases is calculated from len, which is not retained or available here at this time */ - /* So we'll just dump all internal values */ - fprintf(xmlout, "%s \n", s); - switch(tccp->qntsty) { - case J2K_CCP_QNTSTY_NOQNT: - numbands = J2K_MAXBANDS; /* should be: numbands = len - 1; */ - /* Better: IMAGINE numbands = tccp->stepsize_numbands; */ - - /* Instead look for first zero exponent, quit there. Adequate? */ - fprintf(xmlout, "%s \n", s); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp->stepsizes[bandno].expn == 0) - break; /* Remove this once we have real numbands */ - fprintf(xmlout, "%s \n", s, bandno); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, tccp->stepsizes[bandno].expn << 3); - if(derived) - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].expn); - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s \n", s); - break; - case J2K_CCP_QNTSTY_SIQNT: - /* numbands = 1; */ - fprintf(xmlout, "%s \n", s); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - - for (bandno = 1; bandno < J2K_MAXBANDS; bandno++) { - if(tccp->stepsizes[bandno].expn == 0) - break; - - fprintf(xmlout, "%s %d\n", s, bandno, tccp->stepsizes[bandno].expn); - } - fprintf(xmlout, "%s \n", s); - break; - - default: /* J2K_CCP_QNTSTY_SEQNT */ - numbands = J2K_MAXBANDS; /* should be: (len - 1) / 2;*/ - /* Better: IMAGINE numbands = tccp->stepsize_numbands; */ - fprintf(xmlout, "%s \n", s); - if(notes) { - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s \n", s); - } - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp->stepsizes[bandno].expn == 0 && tccp->stepsizes[bandno].mant == 0) - break; /* Remove this once we have real numbands count */ - fprintf(xmlout, "%s \n", s, bandno); - if(raw) - fprintf(xmlout,"%s 0x%02x\n", s, (tccp->stepsizes[bandno].expn << 11) | tccp->stepsizes[bandno].mant); - if(derived) { - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].expn); - fprintf(xmlout,"%s %d\n", s, tccp->stepsizes[bandno].mant); - } - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%s \n", s); - break; - } /* switch */ - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s\n", s); - } -/* Alignments: " < < < < < To help maintain xml pretty-printing */ -} - -/* ------------- */ - -BOOL same_component_quantization(opj_tccp_t *tccp1, opj_tccp_t *tccp2) -{ - int bandno, numbands; - - if(tccp1->qntsty != tccp2->qntsty) - return FALSE; - if(tccp1->numgbits != tccp2->numgbits) - return FALSE; - - switch(tccp1->qntsty) { - case J2K_CCP_QNTSTY_NOQNT: - numbands = J2K_MAXBANDS; /* should be: numbands = len - 1; */ - /* Instead look for first zero exponent, quit there. Adequate? */ - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp1->stepsizes[bandno].expn == 0) - break; - if(tccp1->stepsizes[bandno].expn != tccp2->stepsizes[bandno].expn) - return FALSE; - } - break; - case J2K_CCP_QNTSTY_SIQNT: - /* numbands = 1; */ - if(tccp1->stepsizes[0].expn != tccp2->stepsizes[0].expn || tccp1->stepsizes[0].mant != tccp2->stepsizes[0].mant) - return FALSE; - /* Don't need to check remainder, since they are calculated from [0] */ - break; - - default: /* J2K_CCP_QNTSTY_SEQNT */ - numbands = J2K_MAXBANDS; /* should be: (len - 1) / 2;*/ - /* This comparison may cause us problems with trailing junk values. */ - for (bandno = 0; bandno < numbands; bandno++) { - if(tccp1->stepsizes[bandno].expn != tccp2->stepsizes[bandno].expn || tccp1->stepsizes[bandno].mant != tccp2->stepsizes[bandno].mant); - return FALSE; - } - break; - } /* switch */ - return TRUE; -} - -/* ------------- */ - -void xml_out_frame_rgn(FILE* xmlout, opj_tcp_t *tcp, int numcomps) -{ - int compno, SPrgn; - /* MJ2 files can have regions of interest if hybridized with JPX Part II */ - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - - for(compno = 0; compno < numcomps; compno++) { - SPrgn = tcp->tccps[compno].roishift; /* 1 byte; SPrgn */ - if(SPrgn == 0) - continue; /* Yet another kludge */ - - fprintf(xmlout, "%s\n", s); /* Optional in main header, at most 1 per component */ - if(notes) - fprintf(xmlout, "%s\n", s); - /* Not retained or of interest: Lrgd */ - fprintf(xmlout, "%s 0\n", s); /* 1 byte */ - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "%s %d\n", s, compno); /* 1 or 2 bytes */ - fprintf(xmlout, "%s %d\n", s, SPrgn); /* 1 byte */ - if(notes) - fprintf(xmlout, "%s \n", s); - fprintf(xmlout, "POC != 1) - return; /* Not present */ - - fprintf(xmlout, "%s\n", s); /* Optional in main header, at most 1 per component */ - /* j2k_read_poc seems to allow accumulation of default pocs from multiple POC segments, but does - the spec really allow that? */ - /* 2 bytes, not retained; Lpoc */ - /* I probably didn't get this dump precisely right. */ - for (i = 0; i < tcp->numpocs; i++) { - poc = &tcp->pocs[i]; - fprintf(xmlout, "%s \n", s, i+1); - fprintf(xmlout, "%S %d\n", s, poc->resno0); /* 1 byte, RSpoc_i */ - if(notes) - fprintf(xmlout,"%s \n", s); - fprintf(xmlout, "%s %d\n", s, poc->compno0);/* j2k_img->numcomps <= 256 ? 1 byte : 2 bytes; CSpoc_i */ - if(notes) - fprintf(xmlout,"%s \n", s); - fprintf(xmlout, "%s %d\n", s, poc->layno1); /* int_min(cio_read(2), tcp->numlayers); /* 2 bytes; LYEpoc_i */ - if(notes) - fprintf(xmlout,"%s \n", s); - fprintf(xmlout, "%s %d\n", s, poc->resno1); /*int_min(cio_read(1), tccp->numresolutions); /* REpoc_i */ - if(notes) - fprintf(xmlout,"%s \n", s); - fprintf(xmlout, "%s %d\n", s, poc->compno1); /* int_min(cio_read(j2k_img->numcomps <= 256 ? 1 : 2), j2k_img->numcomps); /* CEpoc_i */ - if(notes) - fprintf(xmlout,"%s \n", s); - fprintf(xmlout, "%s %d\n", s, poc->prg); /* 1 byte Ppoc_i */ - if(notes) { - fprintf(xmlout,"%s \n", s); - fprintf(xmlout,"%s \n", s); - fprintf(xmlout,"%s \n", s); - } - fprintf(xmlout, "%s \n", s); - } - fprintf(xmlout, "%sppm != 1) - return; /* Not present */ -/* Main header uses indent of 10 spaces */ - fprintf(xmlout, " \n"); /* Optional in main header, but if not, must be in PPT or codestream */ - /* 2 bytes Lppm not saved */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - - /* 1 byte, not retained ; Zppm is sequence # of this PPM header */ - /* 4 bytes, possibly overwritten multiple times in j2k_cp->ppm_previous: Nppm */ - /* Use j symbol for index instead of i, to make comparable with j2k_read_ppm */ - /* Not real clear whether to use ppm->store or ppm_len as upper bound */ - fprintf(xmlout, " \n"); - xml_out_dump_hex(xmlout, cp->ppm_data, cp->ppm_len); - /* Dump packet headers 1 byte at a time: lppm[i][j] */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); /* Optional in main header, but if not, must be in PPT or codestream */ -} - -/* ------------- */ - -void xml_out_frame_ppt(FILE *xmlout, opj_tcp_t *tcp) { /* For tile-part header, not main (which uses PPM instead). */ -/* Either the PPM or PPT is required if the packet headers are not distributed in the bit stream */ -/* Use of PPM and PPT are mutually exclusive. */ -/* Compare j2k_read_ppt() */ - int j; - - if(tcp->ppt != 1) - return; /* Not present */ - - /* Tile-part indents are 12 spaces */ - fprintf(xmlout, " \n"); /* Optional in main header, but if not, must be in PPT or codestream */ - /* 2 bytes Lppm not saved */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - - /* 1 byte, not retained ; Zppt is sequence # of this PPT header */ - /* 4 bytes, possibly overwritten multiple times in j2k_cp->ppt_previous: Nppt */ - /* Use j symbol for index instead of i, to make comparable with j2k_read_ppt */ - /* Not real clear whether to use ppt->store or ppt_len as upper bound */ - fprintf(xmlout, " \n"); - xml_out_dump_hex(xmlout, tcp->ppt_data, tcp->ppt_len); - /* Dump packet headers 1 byte at a time: lppt[i][j] */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); /* Optional in tile-part header, but if not, must be in PPM or codestream */ -} -#endif SUPPRESS_FOR_NOW - -/* ------------- */ - -void xml_out_frame_tlm(FILE* xmlout) { /* opt, main header only. May be multiple. */ -/* Compare j2k_read_tlm()... which doesn't retain anything! */ -/* Plan: Since this is only called from main header, not tilepart, use global j2k_default_tcp rather than parameter */ -/* Main header indents are 10 spaces */ -} - -/* ------------- */ - -void xml_out_frame_plm(FILE* xmlout) { /* opt, main header only; can be used in conjunction with tile-part's PLT */ -/* NO-OP. PLM NOT SAVED IN DATA STRUCTURE */ - /* Compare j2k_read_plm()... which doesn't retain anything! */ -/* Plan: Since this is only called from main header, not tilepart, use global j2k_default_tcp rather than parameter */ -/* Main header indents are 10 spaces */ -} - -/* ------------- */ - -void xml_out_frame_plt(FILE* xmlout, opj_tcp_t *tcp) { /* opt, tile-part headers only; can be used in conjunction with main header's PLM */ -/* NO-OP. PLT NOT SAVED IN DATA STRUCTURE */ - /* Compare j2k_read_plt()... which doesn't retain anything! */ -/* Tile-part header indents are 12 spaces */ -} - -/* ------------- */ - -void xml_out_frame_crg(FILE* xmlout) { /* NO-OP. CRG NOT SAVED IN DATA STRUCTURE */ /* opt, main header only; */ -/* Compare j2k_read_crg()... which doesn't retain anything! */ -/* Plan: Since this is only called from main header, not tilepart, use global j2k_default_tcp rather than parameter */ -#ifdef NOTYET - THIS PSEUDOCODE IMAGINES THESE EXIST: j2k_default_tcp->crg, j2k_default_tcp->crg_i, j2k_default_tcp->crg_xcrg*, j2k_default_tcp->crg_ycrg* - (POSSIBLY DON'T NEED crg_i, CAN GET NUMBER OR COMPONENTS FROM ELSEWHERE) - if(j2k_default_tcp->crg != 1 || j2k_default_tcp->crg_i == 0) - return; /* Not present */ - -/* Main header indents are 10 spaces */ - fprintf(xmlout, " \n", j2k_default_tcp->crg_i); - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - /* This isn't the most compact form of table, but is OK when number of components is small, as is likely. */ - for (i = 0; i < j2k_default_tcp->crg_i; i++) { - fprintf(xmlout, " \n", i+1); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout," %d\n", j2k_default_tcp->crg_xcrg[i]); - if(derived) { - /* Calculate n * 100%/65536; 4 digits after decimal point is sufficiently accurate */ - fprintf(xmlout," %.4f\n", ((double)j2k_default_tcp->crg_xcrg[i])/655.36); - /* We could do another calculation that include XRsiz[i]; maybe later. */ - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - if(raw) - fprintf(xmlout," %d\n", j2k_default_tcp->crg_ycrg[i]); - if(derived) { - fprintf(xmlout," %f\n", ((double)j2k_default_tcp->crg_ycrg[i])/655.36); - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - - fprintf(xmlout, " \n"); - -#endif -} - -/* ------------- */ - -/* Regrettably from a metadata point of view, j2k_read_com() skips over any comments in main header or tile-part-header */ -void xml_out_frame_com(FILE* xmlout, opj_tcp_t *tcp) { /* NO-OP. COM NOT SAVED IN DATA STRUCTURE */ /* opt in main or tile-part headers; */ -/* Compare j2k_read_com()... which doesn't retain anything! */ -#ifdef NOTYET - char spaces[13] = " "; /* 12 spaces if tilepart*/ - char* s = spaces; - if(tcp == &j2k_default_tcp) { - s++;s++; /* shorten s to 10 spaces if main */ - } - THIS PSEUDOCODE IMAGINES THESE EXIST: tcp->com, tcp->com_len, tcp->com_data array - if(tcp->com != 1) - return; /* Not present */ - - fprintf(xmlout, "%s\n", s); /* Optional in main or tile-part header */ - xml_out_dump_hex_and_ascii(tcp->com_data, tcp->com_len, s); - fprintf(xmlout, "%s\n", s); -#endif -} - -void xml_out_dump_hex(FILE* xmlout, char *data, int data_len, char* s) { - /* s is a string of spaces for indent */ - int i; - - /* This is called when raw is true, or there is no appropriate derived form */ - fprintf(xmlout, "%s\n", s); - fprintf(xmlout, "%s ", s); /* Inadequate for pretty printing */ - for (i = 0; i < data_len; i++) { /* Dump packet headers */ - fprintf(xmlout, "%02x", data[i]); - } - fprintf(xmlout, "%s\n", s); -} - -/* Define this as an even number: */ -#define BYTES_PER_DUMP_LINE 40 -/* Current total width for Hex and ASCII is : 11 spaces lead + (3 * BPDL) + 2 spaces + BPDL */ -void xml_out_dump_hex_and_ascii(FILE* xmlout, char *data, int data_len, char* s) { - /* s is a string of spaces for indent */ - int i,j; - - if(raw) - xml_out_dump_hex(xmlout, data, data_len, s); - - if(derived) { - fprintf(xmlout, "%s\n", s); - for (i = 0; i < data_len; ) { - fprintf(xmlout,"%s ", s); /* Additional leading space added in loop */ - /* First column: hex */ - for (j = 0; j < BYTES_PER_DUMP_LINE; j++) /* Dump bytes */ - fprintf(xmlout," %02x", data[i+j]); - /* Space between columns... */ fprintf(xmlout, " "); - /* Second column: ASCII */ - for (j = 0; j < BYTES_PER_DUMP_LINE; j++, i++) { - if(isprint((int)data[i]) && i < data_len) - fprintf(xmlout,"%c", data[i]); - else - fprintf(xmlout," "); - } - /* If we also wanted to output UCS-2 Unicode as a third column, then entire document - must use fwprintf. Forget about it for now. As it stands, if data is UCS-2 format but still - the ASCII set, then we'll be able to read every other byte as ASCII in column 2. If - data is UTF-8 format but still ASCII, then we'll be able to read every byte as ASCII - in column 2. */ - } - fprintf(xmlout, "%s\n", s); - } -} - - -/* ------------- */ - -void xml_out_frame_jp2h(FILE* xmlout, opj_jp2_t *jp2_struct) { /* JP2 Header */ -/* Compare jp2_read_jp2h(opj_jp2_t * jp2_struct) */ - int i; - - fprintf(xmlout, " \n"); - -/* Compare jp2_read_ihdr(jp2_struct)) */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", jp2_struct->h); /* 4 bytes */ - fprintf(xmlout, " %d\n", jp2_struct->w); /* 4 bytes */ - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", jp2_struct->numcomps); /* 2 bytes */ - if(notes) - fprintf(xmlout, " \n"); /* 2 bytes */ - fprintf(xmlout, " \n"); /* 1 byte */ - if(jp2_struct->bpc == 255) { - fprintf(xmlout, " 0x%02x\n", jp2_struct->bpc); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); - } else { /* Not 0xff */ - if(raw) { - fprintf(xmlout, " 0x%02x\n", jp2_struct->bpc); /* 1 byte */ - if(notes) - fprintf(xmlout," \n"); - } - if(derived) { - fprintf(xmlout, " %d\n", jp2_struct->bpc & 0x7f); - fprintf(xmlout, " %d\n", jp2_struct->bpc >> 7); - } - } - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", jp2_struct->C); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); /* 2 bytes */ - fprintf(xmlout, " %d\n", jp2_struct->UnkC); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); /* 1 byte */ - fprintf(xmlout, " %d\n", jp2_struct->IPR); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); /* 2 bytes */ - fprintf(xmlout, " \n"); - - if (jp2_struct->bpc == 255) - { - fprintf(xmlout, " \n"); - if(notes) - fprintf(xmlout, " \n"); - /* Bits per pixel varies with components */ - /* Compare jp2_read_bpcc(jp2_struct) */ - for (i = 0; i < (int)jp2_struct->numcomps; i++) { - if(raw) - fprintf(xmlout," 0x%02x\n", jp2_struct->comps[i].bpcc); /* 1 byte */ - if(derived) { - fprintf(xmlout," %d\n", (jp2_struct->comps[i].bpcc & 0x7f)+1); - fprintf(xmlout," %d\n", jp2_struct->comps[i].bpcc >> 7); - } - } - fprintf(xmlout, " \n"); - } - - /* Compare jp2_read_colr(jp2_struct) */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", jp2_struct->meth); /* 1 byte */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - fprintf(xmlout, " %d\n", jp2_struct->precedence); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); - fprintf(xmlout, " %d\n", jp2_struct->approx); /* 1 byte */ - if(notes) - fprintf(xmlout, " \n"); - - if (jp2_struct->meth == 1) { - fprintf(xmlout, " %d\n", jp2_struct->enumcs); /* 4 bytes */ - if(notes) { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } - } - else - if(notes) - fprintf(xmlout, " \n"); - /* only 1 byte is read and nothing stored */ - fprintf(xmlout, " \n"); - - /* TO DO? No OpenJPEG support. - Palette 'pclr' - ComponentMapping 'cmap' - ChannelDefinition 'cdef' - Resolution 'res' - */ - fprintf(xmlout, " \n"); -} -/* ------------- */ - -#ifdef NOTYET -IMAGE these use cp structure, extended... but we could use a new data structure instead -void xml_out_frame_jp2i(FILE* xmlout, opj_cp_t *cp) { - /* IntellectualProperty 'jp2i' (no restrictions on location) */ - int i; - IMAGE cp->jp2i, cp->jp2i_count, cp->jp2i_data (array of chars), cp->cp2i_len (array of ints) - if(cp->jp2i != 1) - return; /* Not present */ - - for(i = 0; i < cp->jp2i_count; i++) - { - fprintf(xmlout, " \n"); - /* I think this can be anything, including binary, so do a dump */ - /* Is it better to indent or not indent this content? Indent is better for reading, but - worse for cut/paste. */ - xml_out_dump_hex_and_ascii(xmlout, cp->jp2i_data[i], cp->jp2i_len[i]); - fprintf(xmlout, " \n"); - } -} - -void xml_out_frame_xml(FILE* xmlout, opj_cp_t *cp) { - /* XML 'xml\040' (0x786d6c20). Can appear multiply, before or after jp2c codestreams */ - IMAGE cp->xml, cp->xml_count, cp->xml_data (array of chars) - MAYBE WE DON'T NEED cp->xml_len (array of ints) IF WE ASSUME xml_data IS NULL-TERMINATED. - ASSUME ASSUME EACH LINE IS ENDED BY \n. - int i; - if(cp->xml != 1) - return; /* Not present */ - - for(i = 0; i < cp->xml_count; i++) - { - fprintf(xmlout, " \n", i+1); - /* Is it better to indent or not indent this content? Indent is better for reading, but - worse for cut/paste. Being lazy, didn't indent here. */ - fprintf(xmlout,cp->xml_data[i]); /* May be multiple lines */ /* Could check if this is well-formed */ - fprintf(xmlout, " \n"); - } -} - -void xml_out_frame_uuid(FILE* xmlout, opj_cp_t *cp) { - /* UUID 'uuid' (top level only) */ - /* Part I 1.7.2 says: may appear multiply in JP2 file, anywhere except before File Type box */ - /* Part III 5.2.1 says: Private extensions shall be achieved through the 'uuid' type. */ - /* A UUID is a 16-byte value. There is a conventional string representation for it: - "0x12345678-9ABC-DEF0-1234-567890ABCDEF". Let's assume that is what is stored in uuid_value */ - - /* Part III 6.1 Any other MJ2 box type could be alternatively written as a 'uuid' box, with value given - as : 0xXXXXXXXX-0011-0010-8000-00AA00389B71, where the Xs are the boxtype in hex. However, - such a file is "not compliant; systems may choose to read [such] objects ... as equivalent to the box of - the same type, or not." Here, we choose not to. */ - int i; - IMAGE cp->uuid, cp->uuid_count, cp->uuid_value (array of uuids... let's say fixed-length strings) cp->uuid_data (array of char buffers), cp->uuid_len (array of ints) - if(cp->juuid != 1) - return; /* Not present */ - - for(i = 0; i < cp->uuid_count; i++) - { - fprintf(xmlout, " - fprintf(xmlout, " %s\n", cp->uuid_value[i]); - fprintf(xmlout, " \n"); - /* I think this can be anything, including binary, so do a dump */ - /* Is it better to indent or not indent this content? Indent is better for reading, but - worse for cut/paste. */ - xml_out_dump_hex_and_ascii(xmlout, cp->uuid_data[i], cp->uuid_len[i]); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } -} - -void xml_out_frame_uinf(FILE* xmlout, opj_cp_t *cp) { - /* UUIDInfo 'uinf', includes UUIDList 'ulst' and URL 'url\40' */ - /* Part I 1.7.3 says: may appear multiply in JP2 file, anywhere at the top level except before File Type box */ - /* So there may be multiple ulst's, and each can have multiple UUIDs listed (with a single URL) */ - /* This is not quite as vendor-specific as UUIDs, or at least is meant to be generally readable */ - /* Assume UUIDs stored in canonical string format */ - int i, j; - IMAGE cp->uinf, cp->uinf_count, cp->uinf_ulst_nu (array of ints) - cp->uinf_uuid (2 dimensional array of uuids... let's say fixed-length strings), - cp->uinf_url (array of char buffers) - - if(cp->uinf != 1) - return; /* Not present */ - - for(i = 0; i < cp->uuid_count; i++) - { - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n",cp->cp->uinf_ulst_nu[i]); - for(j = 0; j < cp->uinf_ulst_nu[i]; j++) - fprintf(xmlout, " %s\n", cp->uuif_uuid[i][j], j+1); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - /* Could add VERS and FLAG here */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " %s",cp->uinf_url[i]); /* Probably single line, so indent works */ /* In theory, could check if this is well-formed, or good live link */ - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - fprintf(xmlout, " \n"); - } -} - -IMAGE these use cp structure, extended... but we could use a new data structure instead -void xml_out_frame_unknown_type(FILE* xmlout, opj_cp_t *cp) { - /* Part III 5.2.1 says "Type fields not defined here are reserved. Private extensions - shall be acieved through the 'uuid' type." [This implies an unknown - type would be an error, but then...] "Boxes not explicitly defined in this standard, - or otherwise unrecognized by a reader, may be ignored." - Also, it says "the following types are not and will not be used, or used only in - their existing sense, in future versions of this specification, to avoid conflict - with existing content using earlier pre-standard versions of this format: - clip, crgn, matt, kmat, pnot, ctab, load, imap; - track reference types tmcd, chap, sync,scpt, ssrc" - [But good luck figuring out the mapping.] - Part III Amend. 2 4.1 is stronger: "All these specifications [of this family, e.g., - JP2 Part I, ISO Base format (Part 12) leading to MP4, Quicktime, and possibly including - MJ2] require that readers ignore objects that are unrecognizable to them". - */ - int i; - IMAGE cp->unknown_type, cp->unknown_type_count, cp->unknown_type_boxtype (array of buf[5]s), cp->unknown_type_data (array of chars), cp->unknown_type_len (array of ints) - if(cp->unknown_type != 1) - return; /* Not present */ - - for(i = 0; i < cp->unknown_type_count; i++) - { - fprintf(xmlout, " \n", cp->unknown_type_boxtype[i]); - /* Can be anything, including binary, so do a dump */ - /* Is it better to indent or not indent this content? Indent is better for reading, but - worse for cut/paste. */ - xml_out_dump_hex_and_ascii(xmlout, cp->unknown_type_data[i], cp->unknown_type_len[i]); - fprintf(xmlout, " \n"); - } -} - -#endif \ No newline at end of file diff --git a/mj2/meta_out.h b/mj2/meta_out.h deleted file mode 100644 index 293316d1..00000000 --- a/mj2/meta_out.h +++ /dev/null @@ -1,13 +0,0 @@ -/* meta_out.h */ -/* Dump MJ2, JP2 metadata (partial so far) to xml file */ -/* Callable from mj2_to_metadata */ -/* Contributed to Open JPEG by Glenn Pearson, U.S. National Library of Medicine */ - -#define BOOL int -#define FALSE 0 -#define TRUE 1 - -void xml_write_init(BOOL n, BOOL t, BOOL r, BOOL d); - -int xml_write_struct(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr); - diff --git a/mj2/mj2.c b/mj2/mj2.c deleted file mode 100644 index 1a15550d..00000000 --- a/mj2/mj2.c +++ /dev/null @@ -1,2906 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2003-2007, Francois-Olivier Devaux - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "opj_includes.h" -#include "mj2.h" - -/** @defgroup JP2 JP2 - JPEG-2000 file format reader/writer */ -/*@{*/ - -/** @name Local static functions */ -/*@{*/ - -/** -Read box headers -@param cinfo Codec context info -@param cio Input stream -@param box -@return Returns true if successful, returns false otherwise -*/ -static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box); - -/* -* -* Read box headers -* -*/ - -int mj2_read_boxhdr(mj2_box_t * box, opj_cio_t *cio) -{ - box->init_pos = cio_tell(cio); - box->length = cio_read(cio, 4); - box->type = cio_read(cio, 4); - if (box->length == 1) { - if (cio_read(cio, 4) != 0) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Cannot handle box sizes higher than 2^32\n"); - return 1; - }; - box->length = cio_read(cio, 4); - if (box->length == 0) - box->length = cio_numbytesleft(cio) + 12; - } - else if (box->length == 0) { - box->length = cio_numbytesleft(cio) + 8; - } - return 0; -} - -/* -* -* Initialisation of a Standard Movie, given a simple movie structure defined by the user -* The movie will have one sample per chunk -* -* Arguments: opj_mj2_t * movie -* Several variables of "movie" must be defined in order to enable a correct execution of -* this function: -* - The number of tracks of each type (movie->num_vtk, movie->num_stk, movie->num_htk) -* - The memory for each must be allocated (movie->tk) -* - For each track: -* The track type (tk->track_type) -* The number of sample (tk->num_samples) -* The sample rate (tk->sample_rate) -* -*/ - -int mj2_init_stdmovie(opj_mj2_t * movie) -{ - int i; - unsigned int j; - time_t ltime; - - movie->brand = MJ2_MJ2; - movie->minversion = 0; - movie->num_cl = 2; - movie->cl = (unsigned int*) opj_malloc(movie->num_cl * sizeof(unsigned int)); - - movie->cl[0] = MJ2_MJ2; - movie->cl[1] = MJ2_MJ2S; - time(<ime); /* Time since 1/1/70 */ - movie->creation_time = (unsigned int) ltime + 2082844800; /* Seconds between 1/1/04 and 1/1/70 */ - movie->timescale = 1000; - - movie->rate = 1 << 16; /* Rate to play presentation (default = 0x00010000) */ - movie->volume = 1 << 8; /* Movie volume (default = 0x0100) */ - movie->trans_matrix[0] = 0x00010000; /* Transformation matrix for video */ - movie->trans_matrix[1] = 0; /* Unity is { 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 } */ - movie->trans_matrix[2] = 0; - movie->trans_matrix[3] = 0; - movie->trans_matrix[4] = 0x00010000; - movie->trans_matrix[5] = 0; - movie->trans_matrix[6] = 0; - movie->trans_matrix[7] = 0; - movie->trans_matrix[8] = 0x40000000; - movie->next_tk_id = 1; - - for (i = 0; i < movie->num_htk + movie->num_stk + movie->num_vtk; i++) { - mj2_tk_t *tk = &movie->tk[i]; - movie->next_tk_id++; - tk->jp2_struct.comps = NULL; - tk->jp2_struct.cl = NULL; - - if (tk->track_type == 0) { - if (tk->num_samples == 0) - return 1; - - tk->Dim[0] = 0; - tk->Dim[1] = 0; - - tk->timescale = 1000; /* Timescale = 1 ms */ - - tk->chunk[0].num_samples = 1; - tk->chunk[0].sample_descr_idx = 1; - - tk->same_sample_size = 0; - - tk->num_samplestochunk = 1; /* One sample per chunk */ - tk->sampletochunk = (mj2_sampletochunk_t*) opj_malloc(tk->num_samplestochunk * sizeof(mj2_sampletochunk_t)); - tk->sampletochunk[0].first_chunk = 1; - tk->sampletochunk[0].samples_per_chunk = 1; - tk->sampletochunk[0].sample_descr_idx = 1; - - if (tk->sample_rate == 0) { - opj_event_msg(tk->cinfo, EVT_ERROR, - "Error while initializing MJ2 movie: Sample rate of track %d must be different from zero\n", - tk->track_ID); - return 1; - } - - for (j = 0; j < tk->num_samples; j++) { - tk->sample[j].sample_delta = tk->timescale / tk->sample_rate; - } - - tk->num_tts = 1; - tk->tts = (mj2_tts_t*) opj_malloc(tk->num_tts * sizeof(mj2_tts_t)); - tk->tts[0].sample_count = tk->num_samples; - tk->tts[0].sample_delta = tk->timescale / tk->sample_rate; - - tk->horizresolution = 0x00480000; /* Horizontal resolution (typically 72) */ - tk->vertresolution = 0x00480000; /* Vertical resolution (typically 72) */ - tk->compressorname[0] = 0x0f4d6f74; /* Compressor Name[]: Motion JPEG2000 */ - tk->compressorname[1] = 0x696f6e20; - tk->compressorname[2] = 0x4a504547; - tk->compressorname[3] = 0x32303030; - tk->compressorname[4] = 0x00120000; - tk->compressorname[5] = 0; - tk->compressorname[6] = 0x00000042; - tk->compressorname[7] = 0x000000DC; - tk->num_url = 0; /* Number of URL */ - tk->num_urn = 0; /* Number of URN */ - tk->graphicsmode = 0; /* Graphicsmode */ - tk->opcolor[0] = 0; /* OpColor */ - tk->opcolor[1] = 0; /* OpColor */ - tk->opcolor[2] = 0; /* OpColor */ - tk->creation_time = movie->creation_time; /* Seconds between 1/1/04 and 1/1/70 */ - tk->language = 0; /* Language (undefined) */ - tk->layer = 0; - tk->volume = 1 << 8; /* Movie volume (default = 0x0100) */ - tk->trans_matrix[0] = 0x00010000; /* Transformation matrix for track */ - tk->trans_matrix[1] = 0; /* Unity is { 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 } */ - tk->trans_matrix[2] = 0; - tk->trans_matrix[3] = 0; - tk->trans_matrix[4] = 0x00010000; - tk->trans_matrix[5] = 0; - tk->trans_matrix[6] = 0; - tk->trans_matrix[7] = 0; - tk->trans_matrix[8] = 0x40000000; - tk->fieldcount = 1; - tk->fieldorder = 0; - tk->or_fieldcount = 1; - tk->or_fieldorder = 0; - tk->num_br = 2; - tk->br = (unsigned int*) opj_malloc(tk->num_br * sizeof(unsigned int)); - tk->br[0] = MJ2_JP2; - tk->br[1] = MJ2_J2P0; - tk->num_jp2x = 0; - tk->hsub = 2; /* 4:2:0 */ - tk->vsub = 2; /* 4:2:0 */ - tk->hoff = 0; - tk->voff = 0; - tk->visual_w = tk->w << 16; - tk->visual_h = tk->h << 16; - } - else { - tk->num_br = 0; - tk->jp2xdata = NULL; - } - } - return 0; -} - -/* -* Time To Sample box Decompact -* -*/ -void mj2_tts_decompact(mj2_tk_t * tk) -{ - int i, j; - tk->num_samples = 0; - for (i = 0; i < tk->num_tts; i++) { - tk->num_samples += tk->tts[i].sample_count; - } - - tk->sample = (mj2_sample_t*) opj_malloc(tk->num_samples * sizeof(mj2_sample_t)); - - for (i = 0; i < tk->num_tts; i++) { - for (j = 0; j < tk->tts[i].sample_count; j++) { - tk->sample[j].sample_delta = tk->tts[i].sample_delta; - } - } -} - -/* -* Sample To Chunk box Decompact -* -*/ -void mj2_stsc_decompact(mj2_tk_t * tk) -{ - int j, i; - unsigned int k; - int sampleno=0; - - if (tk->num_samplestochunk == 1) { - tk->num_chunks = - (unsigned int) ceil((double) tk->num_samples / - (double) tk->sampletochunk[0].samples_per_chunk); - tk->chunk = (mj2_chunk_t*) opj_malloc(tk->num_chunks * sizeof(mj2_chunk_t)); - for (k = 0; k < tk->num_chunks; k++) { - tk->chunk[k].num_samples = tk->sampletochunk[0].samples_per_chunk; - } - - } else { - tk->chunk = (mj2_chunk_t*) opj_malloc(tk->num_samples * sizeof(mj2_chunk_t)); - tk->num_chunks = 0; - for (i = 0; i < tk->num_samplestochunk -1 ; i++) { - for (j = tk->sampletochunk[i].first_chunk - 1; - j < tk->sampletochunk[i + 1].first_chunk - 1; j++) { - tk->chunk[j].num_samples = tk->sampletochunk[i].samples_per_chunk; - tk->num_chunks++; - sampleno += tk->chunk[j].num_samples; - } - } - tk->num_chunks += (int)(tk->num_samples - sampleno) / tk->sampletochunk[tk->num_samplestochunk - 1].samples_per_chunk; - for (k = tk->sampletochunk[tk->num_samplestochunk - 1].first_chunk - 1; - k < tk->num_chunks; k++) { - tk->chunk[k].num_samples = - tk->sampletochunk[tk->num_samplestochunk - 1].samples_per_chunk; - } - tk->chunk = opj_realloc(tk->chunk, tk->num_chunks * sizeof(mj2_chunk_t)); - } - -} - - -/* -* Chunk offset box Decompact -* -*/ -void mj2_stco_decompact(mj2_tk_t * tk) -{ - int j; - unsigned int i; - int k = 0; - int intra_chunk_offset; - - for (i = 0; i < tk->num_chunks; i++) { - intra_chunk_offset = 0; - for (j = 0; j < tk->chunk[i].num_samples; j++) { - tk->sample[k].offset = intra_chunk_offset + tk->chunk[i].offset; - intra_chunk_offset += tk->sample[k].sample_size; - k++; - } - } -} - -/* -* Write the JP box -* -* JP Signature box -* -*/ -void mj2_write_jp(opj_cio_t *cio) -{ - mj2_box_t box; - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - - cio_write(cio, MJ2_JP, 4); /* JP */ - cio_write(cio, 0x0d0a870a, 4); /* 0x0d0a870a required in a JP box */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the JP box -* -* JPEG 2000 signature -* -*/ -int mj2_read_jp(opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_JP != box.type) { /* Check Marker */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected JP Marker\n"); - return 1; - } - if (0x0d0a870a != cio_read(cio, 4)) { /* read the 0x0d0a870a required in a JP box */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with JP Marker\n"); - return 1; - } - if (cio_tell(cio) - box.init_pos != box.length) { /* Check box length */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with JP Box size \n"); - return 1; - } - return 0; - -} - -/* -* Write the FTYP box -* -* File type box -* -*/ -void mj2_write_ftyp(opj_mj2_t * movie, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - - cio_write(cio, MJ2_FTYP, 4); /* FTYP */ - cio_write(cio, movie->brand, 4); /* BR */ - cio_write(cio, movie->minversion, 4); /* MinV */ - - for (i = 0; i < movie->num_cl; i++) - cio_write(cio, movie->cl[i], 4); /* CL */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* Length */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the FTYP box -* -* File type box -* -*/ -int mj2_read_ftyp(opj_mj2_t * movie, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); /* Box Size */ - if (MJ2_FTYP != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected FTYP Marker\n"); - return 1; - } - - movie->brand = cio_read(cio, 4); /* BR */ - movie->minversion = cio_read(cio, 4); /* MinV */ - movie->num_cl = (box.length - 16) / 4; - movie->cl = (unsigned int*) opj_malloc(movie->num_cl * sizeof(unsigned int)); - - for (i = movie->num_cl - 1; i > -1; i--) - movie->cl[i] = cio_read(cio, 4); /* CLi */ - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with FTYP Box\n"); - return 1; - } - return 0; -} - - -/* -* Write the STCO box -* -* Chunk Offset Box -* -*/ -void mj2_write_stco(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - unsigned int i; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STCO, 4); /* STCO */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->num_chunks, 4); /* Entry Count */ - - for (i = 0; i < tk->num_chunks; i++) { - cio_write(cio, tk->chunk[i].offset, 4); /* Entry offset */ - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STCO box -* -* Chunk Offset Box -* -*/ -int mj2_read_stco(mj2_tk_t * tk, opj_cio_t *cio) -{ - unsigned int i; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); /* Box Size */ - if (MJ2_STCO != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STCO Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in STCO box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in STCO box. Expected flag 0\n"); - return 1; - } - - - if (cio_read(cio, 4) != tk->num_chunks) { - opj_event_msg(cio->cinfo, EVT_ERROR, - "Error in STCO box: expecting same amount of entry-count as chunks \n"); - } else { - for (i = 0; i < tk->num_chunks; i++) { - tk->chunk[i].offset = cio_read(cio, 4); /* Entry offset */ - } - } - - mj2_stco_decompact(tk); - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STCO Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the STSZ box -* -* Sample size box -* -*/ -void mj2_write_stsz(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - unsigned int i; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STSZ, 4); /* STSZ */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - if (tk->same_sample_size == 1) { /* If they all have the same size */ - cio_write(cio, tk->sample[0].sample_size, 4); /* Size */ - - cio_write(cio, 1, 4); /* Entry count = 1 */ - } - - else { - cio_write(cio, 0, 4); /* Sample Size = 0 becase they all have different sizes */ - - cio_write(cio, tk->num_samples, 4); /* Sample Count */ - - for (i = 0; i < tk->num_samples; i++) { - cio_write(cio, tk->sample[i].sample_size, 4); - } - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STSZ box -* -* Sample size box -* -*/ -int mj2_read_stsz(mj2_tk_t * tk, opj_cio_t *cio) -{ - int sample_size; - unsigned int i; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); /* Box Size */ - if (MJ2_STSZ != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STSZ Marker\n"); - return 1; - } - - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in STSZ box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in STSZ box. Expected flag 0\n"); - return 1; - } - - sample_size = cio_read(cio, 4); - - if (sample_size != 0) { /* Samples do have the same size */ - tk->same_sample_size = 1; - for (i = 0; i < tk->num_samples; i++) { - tk->sample[i].sample_size = sample_size; - } - cio_skip(cio,4); /* Sample count = 1 */ - } else { - tk->same_sample_size = 0; - if (tk->num_samples != cio_read(cio, 4)) { /* Sample count */ - opj_event_msg(cio->cinfo, EVT_ERROR, - "Error in STSZ box. Expected that sample-count is number of samples in track\n"); - return 1; - } - for (i = 0; i < tk->num_samples; i++) { - tk->sample[i].sample_size = cio_read(cio, 4); /* Sample Size */ - } - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STSZ Box size\n"); - return 1; - } - } - return 0; - -} - -/* -* Write the STSC box -* -* Sample to Chunk -* -*/ -void mj2_write_stsc(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STSC, 4); /* STSC */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->num_samplestochunk, 4); /* Entry Count */ - - for (i = 0; i < tk->num_samplestochunk; i++) { - cio_write(cio, tk->sampletochunk[i].first_chunk, 4); /* First Chunk */ - cio_write(cio, tk->sampletochunk[i].samples_per_chunk, 4); /* Samples per chunk */ - cio_write(cio, tk->sampletochunk[i].sample_descr_idx, 4); /* Samples description index */ - } - - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STSC box -* -* Sample to Chunk -* -*/ -int mj2_read_stsc(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); /* Box Size */ - if (MJ2_STSC != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STSC Marker\n"); - return 1; - } - - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in STSC box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in STSC box. Expected flag 0\n"); - return 1; - } - - tk->num_samplestochunk = cio_read(cio, 4); - - tk->sampletochunk = (mj2_sampletochunk_t*) opj_malloc(tk->num_samplestochunk * sizeof(mj2_sampletochunk_t)); - - for (i = 0; i < tk->num_samplestochunk; i++) { - tk->sampletochunk[i].first_chunk = cio_read(cio, 4); - tk->sampletochunk[i].samples_per_chunk = cio_read(cio, 4); - tk->sampletochunk[i].sample_descr_idx = cio_read(cio, 4); - } - - mj2_stsc_decompact(tk); /* decompact sample to chunk box */ - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STSC Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the STTS box -* -* Time to Sample Box -* -*/ -void mj2_write_stts(mj2_tk_t * tk, opj_cio_t *cio) -{ - - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STTS, 4); /* STTS */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->num_tts, 4); /* entry_count */ - for (i = 0; i < tk->num_tts; i++) { - cio_write(cio, tk->tts[i].sample_count, 4); /* Sample-count */ - cio_write(cio, tk->tts[i].sample_delta, 4); /* Sample-Delta */ - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STTS box -* -* -* -*/ -int mj2_read_stts(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_STTS != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STTS Marker\n"); - return 1; - } - - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in STTS box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in STTS box. Expected flag 0\n"); - return 1; - } - - tk->num_tts = cio_read(cio, 4); - - tk->tts = (mj2_tts_t*) opj_malloc(tk->num_tts * sizeof(mj2_tts_t)); - - for (i = 0; i < tk->num_tts; i++) { - tk->tts[i].sample_count = cio_read(cio, 4); - tk->tts[i].sample_delta = cio_read(cio, 4); - } - - mj2_tts_decompact(tk); - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STTS Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the FIEL box -* -* Field coding Box -* -*/ -void mj2_write_fiel(mj2_tk_t * tk, opj_cio_t *cio) -{ - - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_FIEL, 4); /* STTS */ - - cio_write(cio, tk->fieldcount, 1); /* Field count */ - cio_write(cio, tk->fieldorder, 1); /* Field order */ - - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the FIEL box -* -* Field coding Box -* -*/ -int mj2_read_fiel(mj2_tk_t * tk, opj_cio_t *cio) -{ - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_FIEL != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected FIEL Marker\n"); - return 1; - } - - - tk->fieldcount = cio_read(cio, 1); - tk->fieldorder = cio_read(cio, 1); - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with FIEL Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the ORFO box -* -* Original Format Box -* -*/ -void mj2_write_orfo(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_ORFO, 4); - - cio_write(cio, tk->or_fieldcount, 1); /* Original Field count */ - cio_write(cio, tk->or_fieldorder, 1); /* Original Field order */ - - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the ORFO box -* -* Original Format Box -* -*/ -int mj2_read_orfo(mj2_tk_t * tk, opj_cio_t *cio) -{ - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_ORFO != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected ORFO Marker\n"); - return 1; - } - - - tk->or_fieldcount = cio_read(cio, 1); - tk->or_fieldorder = cio_read(cio, 1); - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with ORFO Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the JP2P box -* -* MJP2 Profile Box -* -*/ -void mj2_write_jp2p(mj2_tk_t * tk, opj_cio_t *cio) -{ - - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_JP2P, 4); - - cio_write(cio, 0, 4); /* Version 0, flags =0 */ - - for (i = 0; i < tk->num_br; i++) { - cio_write(cio, tk->br[i], 4); - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the JP2P box -* -* MJP2 Profile Box -* -*/ -int mj2_read_jp2p(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_JP2P != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected JP2P Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in JP2P box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in JP2P box. Expected flag 0\n"); - return 1; - } - - - tk->num_br = (box.length - 12) / 4; - tk->br = (unsigned int*) opj_malloc(tk->num_br * sizeof(unsigned int)); - - for (i = 0; i < tk->num_br; i++) { - tk->br[i] = cio_read(cio, 4); - } - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with JP2P Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the JP2X box -* -* MJP2 Prefix Box -* -*/ -void mj2_write_jp2x(mj2_tk_t * tk, opj_cio_t *cio) -{ - - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_JP2X, 4); - - for (i = 0; i < tk->num_jp2x; i++) { - cio_write(cio, tk->jp2xdata[i], 1); - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the JP2X box -* -* MJP2 Prefix Box -* -*/ -int mj2_read_jp2x(mj2_tk_t * tk, opj_cio_t *cio) -{ - unsigned int i; - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_JP2X != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected JP2X Marker\n"); - return 1; - } - - - tk->num_jp2x = (box.length - 8); - tk->jp2xdata = (unsigned char*) opj_malloc(tk->num_jp2x * sizeof(unsigned char)); - - for (i = 0; i < tk->num_jp2x; i++) { - tk->jp2xdata[i] = cio_read(cio, 1); - } - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with JP2X Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the JSUB box -* -* MJP2 Subsampling Box -* -*/ -void mj2_write_jsub(mj2_tk_t * tk, opj_cio_t *cio) -{ - - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_JSUB, 4); - - cio_write(cio, tk->hsub, 1); - cio_write(cio, tk->vsub, 1); - cio_write(cio, tk->hoff, 1); - cio_write(cio, tk->voff, 1); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the JSUB box -* -* MJP2 Subsampling Box -* -*/ -int mj2_read_jsub(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_JSUB != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected JSUB Marker\n"); - return 1; - } - - tk->hsub = cio_read(cio, 1); - tk->vsub = cio_read(cio, 1); - tk->hoff = cio_read(cio, 1);; - tk->voff = cio_read(cio, 1); - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with JSUB Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the SMJ2 box -* -* Visual Sample Entry Description -* -*/ -void mj2_write_smj2(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MJ2, 4); /* MJ2 */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, 1, 4); - - cio_write(cio, 0, 2); /* Pre-defined */ - - cio_write(cio, 0, 2); /* Reserved */ - - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - - cio_write(cio, tk->w, 2); /* Width */ - cio_write(cio, tk->h, 2); /* Height */ - - cio_write(cio, tk->horizresolution, 4); /* Horizontal resolution */ - cio_write(cio, tk->vertresolution, 4); /* Vertical resolution */ - - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, 1, 2); /* Pre-defined = 1 */ - - cio_write(cio, tk->compressorname[0], 4); /* Compressor Name */ - cio_write(cio, tk->compressorname[1], 4); - cio_write(cio, tk->compressorname[2], 4); - cio_write(cio, tk->compressorname[3], 4); - cio_write(cio, tk->compressorname[4], 4); - cio_write(cio, tk->compressorname[5], 4); - cio_write(cio, tk->compressorname[6], 4); - cio_write(cio, tk->compressorname[7], 4); - - cio_write(cio, tk->depth, 2); /* Depth */ - - cio_write(cio, 0xffff, 2); /* Pre-defined = -1 */ - - jp2_write_jp2h(&tk->jp2_struct, cio); - - mj2_write_fiel(tk, cio); - - if (tk->num_br != 0) - mj2_write_jp2p(tk, cio); - if (tk->num_jp2x != 0) - mj2_write_jp2x(tk, cio); - - mj2_write_jsub(tk, cio); - mj2_write_orfo(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the SMJ2 box -* -* Visual Sample Entry Description -* -*/ -int mj2_read_smj2(opj_image_t * img, mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - mj2_box_t box2; - int i; - - mj2_read_boxhdr(&box, cio); - - if (MJ2_MJ2 != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error in SMJ2 box: Expected MJ2 Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in MJP2 box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in MJP2 box. Expected flag 0\n"); - return 1; - } - - cio_skip(cio,4); - - cio_skip(cio,2); /* Pre-defined */ - - cio_skip(cio,2); /* Reserved */ - - cio_skip(cio,4); /* Pre-defined */ - cio_skip(cio,4); /* Pre-defined */ - cio_skip(cio,4); /* Pre-defined */ - - tk->w = cio_read(cio, 2); /* Width */ - tk->h = cio_read(cio, 2); /* Height */ - - tk->horizresolution = cio_read(cio, 4); /* Horizontal resolution */ - tk->vertresolution = cio_read(cio, 4); /* Vertical resolution */ - - cio_skip(cio,4); /* Reserved */ - - cio_skip(cio,2); /* Pre-defined = 1 */ - - tk->compressorname[0] = cio_read(cio, 4); /* Compressor Name */ - tk->compressorname[1] = cio_read(cio, 4); - tk->compressorname[2] = cio_read(cio, 4); - tk->compressorname[3] = cio_read(cio, 4); - tk->compressorname[4] = cio_read(cio, 4); - tk->compressorname[5] = cio_read(cio, 4); - tk->compressorname[6] = cio_read(cio, 4); - tk->compressorname[7] = cio_read(cio, 4); - - tk->depth = cio_read(cio, 2); /* Depth */ - - /* Init std value */ - tk->num_jp2x = 0; - tk->fieldcount = 1; - tk->fieldorder = 0; - tk->or_fieldcount = 1; - tk->or_fieldorder = 0; - - cio_skip(cio,2); /* Pre-defined = -1 */ - - if (!jp2_read_jp2h(&tk->jp2_struct, cio)) { - opj_event_msg(tk->cinfo, EVT_ERROR, "Error reading JP2H Box\n"); - return 1; - } - - tk->jp2_struct.comps = (opj_jp2_comps_t*) opj_malloc(tk->jp2_struct.numcomps * sizeof(opj_jp2_comps_t)); - tk->jp2_struct.cl = (int*) opj_malloc(sizeof(int)); - - tk->num_br = 0; - tk->num_jp2x = 0; - - for (i = 0; cio_tell(cio) - box.init_pos < box.length; i++) { - mj2_read_boxhdr(&box2, cio); - cio_seek(cio, box2.init_pos); - switch (box2.type) { - case MJ2_FIEL: - if (mj2_read_fiel(tk, cio)) - return 1; - break; - - case MJ2_JP2P: - if (mj2_read_jp2p(tk, cio)) - return 1; - break; - - case MJ2_JP2X: - if (mj2_read_jp2x(tk, cio)) - return 1; - break; - - case MJ2_JSUB: - if (mj2_read_jsub(tk, cio)) - return 1; - break; - - case MJ2_ORFO: - if (mj2_read_orfo(tk, cio)) - return 1; - break; - - default: - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MJP2 Box size\n"); - return 1; - break; - - } - } - return 0; -} - - -/* -* Write the STSD box -* -* Sample Description -* -*/ -void mj2_write_stsd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STSD, 4); /* STSD */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, 1, 4); /* entry_count = 1 (considering same JP2 headerboxes) */ - - if (tk->track_type == 0) { - mj2_write_smj2(tk, cio); - } else if (tk->track_type == 1) { - // Not implemented - } - if (tk->track_type == 2) { - // Not implemented - } - - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STSD box -* -* Sample Description -* -*/ -int mj2_read_stsd(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio) -{ - int i; - int entry_count, len_2skip; - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - - if (MJ2_STSD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STSD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in STSD box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in STSD box. Expected flag 0\n"); - return 1; - } - - entry_count = cio_read(cio, 4); - - if (tk->track_type == 0) { - for (i = 0; i < entry_count; i++) { - if (mj2_read_smj2(img, tk, cio)) - return 1; - } - } else if (tk->track_type == 1) { - len_2skip = cio_read(cio, 4); // Not implemented -> skipping box - cio_skip(cio,len_2skip - 4); - } else if (tk->track_type == 2) { - len_2skip = cio_read(cio, 4); // Not implemented -> skipping box - cio_skip(cio,len_2skip - 4); - } - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STSD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the STBL box -* -* Sample table box box -* -*/ -void mj2_write_stbl(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_STBL, 4); /* STBL */ - - mj2_write_stsd(tk, cio); - mj2_write_stts(tk, cio); - mj2_write_stsc(tk, cio); - mj2_write_stsz(tk, cio); - mj2_write_stco(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the STBL box -* -* Sample table box box -* -*/ -int mj2_read_stbl(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_STBL != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected STBL Marker\n"); - return 1; - } - - if (mj2_read_stsd(tk, img, cio)) - return 1; - if (mj2_read_stts(tk, cio)) - return 1; - if (mj2_read_stsc(tk, cio)) - return 1; - if (mj2_read_stsz(tk, cio)) - return 1; - if (mj2_read_stco(tk, cio)) - return 1; - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with STBL Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the URL box -* -* URL box -* -*/ -void mj2_write_url(mj2_tk_t * tk, int url_num, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_URL, 4); /* URL */ - - if (url_num == 0) - cio_write(cio, 1, 4); /* Version = 0, flags = 1 because stored in same file */ - else { - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - cio_write(cio, tk->url[url_num - 1].location[0], 4); - cio_write(cio, tk->url[url_num - 1].location[1], 4); - cio_write(cio, tk->url[url_num - 1].location[2], 4); - cio_write(cio, tk->url[url_num - 1].location[3], 4); - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the URL box -* -* URL box -* -*/ -int mj2_read_url(mj2_tk_t * tk, int urn_num, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_URL != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected URL Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in URL box\n"); - return 1; - } - - if (1 != cio_read(cio, 3)) { /* If flags = 1 --> media data in file */ - tk->url[urn_num].location[0] = cio_read(cio, 4); - tk->url[urn_num].location[1] = cio_read(cio, 4); - tk->url[urn_num].location[2] = cio_read(cio, 4); - tk->url[urn_num].location[3] = cio_read(cio, 4); - } else { - tk->num_url--; - } - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with URL Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the URN box -* -* URN box -* -*/ -void mj2_write_urn(mj2_tk_t * tk, int urn_num, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_URN, 4); /* URN */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->urn[urn_num].name[0], 4); - cio_write(cio, tk->urn[urn_num].name[1], 4); - cio_write(cio, tk->urn[urn_num].name[2], 4); - cio_write(cio, tk->urn[urn_num].name[3], 4); - cio_write(cio, tk->urn[urn_num].location[0], 4); - cio_write(cio, tk->urn[urn_num].location[1], 4); - cio_write(cio, tk->urn[urn_num].location[2], 4); - cio_write(cio, tk->urn[urn_num].location[3], 4); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the URN box -* -* URN box -* -*/ -int mj2_read_urn(mj2_tk_t * tk, int urn_num, opj_cio_t *cio) -{ - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_URN != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected URN Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in URN box\n"); - return 1; - } - - if (1 != cio_read(cio, 3)) { /* If flags = 1 --> media data in file */ - tk->urn[urn_num].name[0] = cio_read(cio, 4); - tk->urn[urn_num].name[1] = cio_read(cio, 4); - tk->urn[urn_num].name[2] = cio_read(cio, 4); - tk->urn[urn_num].name[3] = cio_read(cio, 4); - tk->urn[urn_num].location[0] = cio_read(cio, 4); - tk->urn[urn_num].location[1] = cio_read(cio, 4); - tk->urn[urn_num].location[2] = cio_read(cio, 4); - tk->urn[urn_num].location[3] = cio_read(cio, 4); - } - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with URN Box size\n"); - return 1; - } - return 0; -} - - -/* -* Write the DREF box -* -* Data reference box -* -*/ -void mj2_write_dref(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_DREF, 4); /* DREF */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - if (tk->num_url + tk->num_urn == 0) { /* Media data in same file */ - cio_write(cio, 1, 4); /* entry_count = 1 */ - mj2_write_url(tk, 0, cio); - } else { - cio_write(cio, tk->num_url + tk->num_urn, 4); /* entry_count */ - - for (i = 0; i < tk->num_url; i++) - mj2_write_url(tk, i + 1, cio); - - for (i = 0; i < tk->num_urn; i++) - mj2_write_urn(tk, i, cio); - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the DREF box -* -* Data reference box -* -*/ -int mj2_read_dref(mj2_tk_t * tk, opj_cio_t *cio) -{ - - int i; - int entry_count, marker; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_DREF != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected DREF Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in DREF box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in DREF box. Expected flag 0\n"); - return 1; - } - - entry_count = cio_read(cio, 4); - tk->num_url = 0; - tk->num_urn = 0; - - for (i = 0; i < entry_count; i++) { - cio_skip(cio,4); - marker = cio_read(cio, 4); - if (marker == MJ2_URL) { - cio_skip(cio,-8); - tk->num_url++; - if (mj2_read_url(tk, tk->num_url, cio)) - return 1; - } else if (marker == MJ2_URN) { - cio_skip(cio,-8); - tk->num_urn++; - if (mj2_read_urn(tk, tk->num_urn, cio)) - return 1; - } else { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with in DREF box. Expected URN or URL box\n"); - return 1; - } - - } - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with DREF Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the DINF box -* -* Data information box -* -*/ -void mj2_write_dinf(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_DINF, 4); /* DINF */ - - mj2_write_dref(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the DINF box -* -* Data information box -* -*/ -int mj2_read_dinf(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_DINF != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected DINF Marker\n"); - return 1; - } - - if (mj2_read_dref(tk, cio)) - return 1; - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with DINF Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the VMHD box -* -* Video Media information box -* -*/ -void mj2_write_vmhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_VMHD, 4); /* VMHD */ - - cio_write(cio, 1, 4); /* Version = 0, flags = 1 */ - - cio_write(cio, tk->graphicsmode, 2); - cio_write(cio, tk->opcolor[0], 2); - cio_write(cio, tk->opcolor[1], 2); - cio_write(cio, tk->opcolor[2], 2); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the VMHD box -* -* Video Media information box -* -*/ -int mj2_read_vmhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_VMHD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected VMHD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in VMHD box\n"); - return 1; - } - - if (1 != cio_read(cio, 3)) { /* Flags = 1 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in VMHD box. Expected flag 1\n"); - return 1; - } - - tk->track_type = 0; - tk->graphicsmode = cio_read(cio, 2); - tk->opcolor[0] = cio_read(cio, 2); - tk->opcolor[1] = cio_read(cio, 2); - tk->opcolor[2] = cio_read(cio, 2); - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with VMHD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the SMHD box -* -* Sound Media information box -* -*/ -void mj2_write_smhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_SMHD, 4); /* SMHD */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->balance, 2); - - cio_write(cio, 0, 2); /* Reserved */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the SMHD box -* -* Sound Media information box -* -*/ -int mj2_read_smhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_SMHD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected SMHD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in SMHD box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in SMHD box. Expected flag 0\n"); - return 1; - } - - tk->track_type = 1; - tk->balance = cio_read(cio, 2); - - /* Init variables to zero to avoid problems when freeeing memory - The values will possibly be overidded when decoding the track structure */ - tk->num_br = 0; - tk->num_url = 0; - tk->num_urn = 0; - tk->num_chunks = 0; - tk->num_tts = 0; - tk->num_samplestochunk = 0; - tk->num_samples = 0; - - cio_skip(cio,2); /* Reserved */ - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with SMHD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the HMHD box -* -* Hint Media information box -* -*/ -void mj2_write_hmhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_HMHD, 4); /* HMHD */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->maxPDUsize, 2); - cio_write(cio, tk->avgPDUsize, 2); - cio_write(cio, tk->maxbitrate, 4); - cio_write(cio, tk->avgbitrate, 4); - cio_write(cio, tk->slidingavgbitrate, 4); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the HMHD box -* -* Hint Media information box -* -*/ -int mj2_read_hmhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_HMHD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected HMHD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in HMHD box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in HMHD box. Expected flag 0\n"); - return 1; - } - - tk->track_type = 2; - tk->maxPDUsize = cio_read(cio, 2); - tk->avgPDUsize = cio_read(cio, 2); - tk->maxbitrate = cio_read(cio, 4); - tk->avgbitrate = cio_read(cio, 4); - tk->slidingavgbitrate = cio_read(cio, 4); - - /* Init variables to zero to avoid problems when freeeing memory - The values will possibly be overidded when decoding the track structure */ - tk->num_br = 0; - tk->num_url = 0; - tk->num_urn = 0; - tk->num_chunks = 0; - tk->num_tts = 0; - tk->num_samplestochunk = 0; - tk->num_samples = 0; - - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with HMHD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the MINF box -* -* Media information box -* -*/ -void mj2_write_minf(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MINF, 4); /* MINF */ - - if (tk->track_type == 0) { - mj2_write_vmhd(tk, cio); - } else if (tk->track_type == 1) { - mj2_write_smhd(tk, cio); - } else if (tk->track_type == 2) { - mj2_write_hmhd(tk, cio); - } - - mj2_write_dinf(tk, cio); - mj2_write_stbl(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the MINF box -* -* Media information box -* -*/ -int mj2_read_minf(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio) -{ - - unsigned int box_type; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_MINF != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MINF Marker\n"); - return 1; - } - - cio_skip(cio,4); - box_type = cio_read(cio, 4); - cio_skip(cio,-8); - - if (box_type == MJ2_VMHD) { - if (mj2_read_vmhd(tk, cio)) - return 1; - } else if (box_type == MJ2_SMHD) { - if (mj2_read_smhd(tk, cio)) - return 1; - } else if (box_type == MJ2_HMHD) { - if (mj2_read_hmhd(tk, cio)) - return 1; - } else { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error in MINF box expected vmhd, smhd or hmhd\n"); - return 1; - } - - if (mj2_read_dinf(tk, cio)) - return 1; - - if (mj2_read_stbl(tk, img, cio)) - return 1; - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MINF Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the HDLR box -* -* Handler reference box -* -*/ -void mj2_write_hdlr(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_HDLR, 4); /* HDLR */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, 0, 4); /* Predefine */ - - tk->name = 0; /* The track name is immediately determined by the track type */ - - if (tk->track_type == 0) { - tk->handler_type = 0x76696465; /* Handler type: vide */ - cio_write(cio, tk->handler_type, 4); - - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, 0x76696465, 4); - cio_write(cio, 0x6F206d65, 4); - cio_write(cio, 0x64696120, 4); - cio_write(cio, 0x74726163, 4); - cio_write(cio, 0x6b00, 2); /* String: video media track */ - } else if (tk->track_type == 1) { - tk->handler_type = 0x736F756E; /* Handler type: soun */ - cio_write(cio, tk->handler_type, 4); - - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, 0x536F756E, 4); - cio_write(cio, 0x6400, 2); /* String: Sound */ - } else if (tk->track_type == 2) { - tk->handler_type = 0x68696E74; /* Handler type: hint */ - cio_write(cio, tk->handler_type, 4); - - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, 0x48696E74, 4); - cio_write(cio, 0, 2); /* String: Hint */ - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the HDLR box -* -* Handler reference box -* -*/ -int mj2_read_hdlr(mj2_tk_t * tk, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_HDLR != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected HDLR Marker\n"); - return 1; - } - - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in HDLR box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in HDLR box. Expected flag 0\n"); - return 1; - } - - cio_skip(cio,4); /* Reserved */ - - tk->handler_type = cio_read(cio, 4); - cio_skip(cio,12); /* Reserved */ - - tk->name_size = box.length - 32; - - tk->name = (char*) opj_malloc(tk->name_size * sizeof(char)); - for (i = 0; i < tk->name_size; i++) { - tk->name[i] = cio_read(cio, 1); /* Name */ - } - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with HDLR Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the MDHD box -* -* Media Header Box -* -*/ -void mj2_write_mdhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - unsigned int i; - time_t ltime; - unsigned int modification_time; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MDHD, 4); /* MDHD */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - cio_write(cio, tk->creation_time, 4); /* Creation Time */ - - time(<ime); /* Time since 1/1/70 */ - modification_time = (unsigned int)ltime + 2082844800; /* Seoonds between 1/1/04 and 1/1/70 */ - - cio_write(cio, modification_time, 4); /* Modification Time */ - - cio_write(cio, tk->timescale, 4); /* Timescale */ - - tk->duration = 0; - - for (i = 0; i < tk->num_samples; i++) - tk->duration += tk->sample[i].sample_delta; - - cio_write(cio, tk->duration, 4); /* Duration */ - - cio_write(cio, tk->language, 2); /* Language */ - - cio_write(cio, 0, 2); /* Predefined */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the MDHD box -* -* Media Header Box -* -*/ -int mj2_read_mdhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (!(MJ2_MHDR == box.type || MJ2_MDHD == box.type)) { // Kakadu writes MHDR instead of MDHD - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MDHD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in MDHD box\n"); - return 1; - } - - if (0 != cio_read(cio, 3)) { /* Flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with flag in MDHD box. Expected flag 0\n"); - return 1; - } - - - tk->creation_time = cio_read(cio, 4); /* Creation Time */ - - tk->modification_time = cio_read(cio, 4); /* Modification Time */ - - tk->timescale = cio_read(cio, 4); /* Timescale */ - - tk->duration = cio_read(cio, 4); /* Duration */ - - tk->language = cio_read(cio, 2); /* Language */ - - cio_skip(cio,2); /* Predefined */ - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MDHD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the MDIA box -* -* Media box -* -*/ -void mj2_write_mdia(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MDIA, 4); /* MDIA */ - - mj2_write_mdhd(tk, cio); - mj2_write_hdlr(tk, cio); - mj2_write_minf(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the MDIA box -* -* Media box -* -*/ -int mj2_read_mdia(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_MDIA != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MDIA Marker\n"); - return 1; - } - - if (mj2_read_mdhd(tk, cio)) - return 1; - if (mj2_read_hdlr(tk, cio)) - return 1; - if (mj2_read_minf(tk, img, cio)) - return 1; - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MDIA Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the TKHD box -* -* Track Header box -* -*/ -void mj2_write_tkhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - unsigned int i; - time_t ltime; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - - cio_write(cio, MJ2_TKHD, 4); /* TKHD */ - - cio_write(cio, 3, 4); /* Version=0, flags=3 */ - - time(<ime); /* Time since 1/1/70 */ - tk->modification_time = (unsigned int)ltime + 2082844800; /* Seoonds between 1/1/04 and 1/1/70 */ - - cio_write(cio, tk->creation_time, 4); /* Creation Time */ - - cio_write(cio, tk->modification_time, 4); /* Modification Time */ - - cio_write(cio, tk->track_ID, 4); /* Track ID */ - - cio_write(cio, 0, 4); /* Reserved */ - - tk->duration = 0; - - for (i = 0; i < tk->num_samples; i++) - tk->duration += tk->sample[i].sample_delta; - - cio_write(cio, tk->duration, 4); /* Duration */ - - cio_write(cio, 0, 4); /* Reserved */ - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, tk->layer, 2); /* Layer */ - - cio_write(cio, 0, 2); /* Predefined */ - - cio_write(cio, tk->volume, 2); /* Volume */ - - cio_write(cio, 0, 2); /* Reserved */ - - cio_write(cio, tk->trans_matrix[0], 4); /* Transformation matrix for track */ - cio_write(cio, tk->trans_matrix[1], 4); - cio_write(cio, tk->trans_matrix[2], 4); - cio_write(cio, tk->trans_matrix[3], 4); - cio_write(cio, tk->trans_matrix[4], 4); - cio_write(cio, tk->trans_matrix[5], 4); - cio_write(cio, tk->trans_matrix[6], 4); - cio_write(cio, tk->trans_matrix[7], 4); - cio_write(cio, tk->trans_matrix[8], 4); - - cio_write(cio, tk->visual_w, 4); /* Video Visual Width */ - - cio_write(cio, tk->visual_h, 4); /* Video Visual Height */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the TKHD box -* -* Track Header box -* -*/ -int mj2_read_tkhd(mj2_tk_t * tk, opj_cio_t *cio) -{ - int flag; - - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - - if (MJ2_TKHD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected TKHD Marker\n"); - return 1; - } - - if (0 != cio_read(cio, 1)) { /* Version = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in TKHD box\n"); - return 1; - } - - flag = cio_read(cio, 3); - - if (!(flag == 1 || flag == 2 || flag == 3 || flag == 4)) { /* Flags = 1,2,3 or 4 */ - opj_event_msg(cio->cinfo, EVT_ERROR, - "Error with flag in TKHD box: Expected flag 1,2,3 or 4\n"); - return 1; - } - - tk->creation_time = cio_read(cio, 4); /* Creation Time */ - - tk->modification_time = cio_read(cio, 4); /* Modification Time */ - - tk->track_ID = cio_read(cio, 4); /* Track ID */ - - cio_skip(cio,4); /* Reserved */ - - tk->duration = cio_read(cio, 4); /* Duration */ - - cio_skip(cio,8); /* Reserved */ - - tk->layer = cio_read(cio, 2); /* Layer */ - - cio_read(cio, 2); /* Predefined */ - - tk->volume = cio_read(cio, 2); /* Volume */ - - cio_skip(cio,2); /* Reserved */ - - tk->trans_matrix[0] = cio_read(cio, 4); /* Transformation matrix for track */ - tk->trans_matrix[1] = cio_read(cio, 4); - tk->trans_matrix[2] = cio_read(cio, 4); - tk->trans_matrix[3] = cio_read(cio, 4); - tk->trans_matrix[4] = cio_read(cio, 4); - tk->trans_matrix[5] = cio_read(cio, 4); - tk->trans_matrix[6] = cio_read(cio, 4); - tk->trans_matrix[7] = cio_read(cio, 4); - tk->trans_matrix[8] = cio_read(cio, 4); - - tk->visual_w = cio_read(cio, 4); /* Video Visual Width */ - - tk->visual_h = cio_read(cio, 4); /* Video Visual Height */ - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with TKHD Box size\n"); - return 1; - } - return 0; -} - -/* -* Write the TRAK box -* -* Track box -* -*/ -void mj2_write_trak(mj2_tk_t * tk, opj_cio_t *cio) -{ - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - - cio_write(cio, MJ2_TRAK, 4); /* TRAK */ - - mj2_write_tkhd(tk, cio); - mj2_write_mdia(tk, cio); - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the TRAK box -* -* Track box -* -*/ -int mj2_read_trak(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_TRAK != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected TRAK Marker\n"); - return 1; - } - if (mj2_read_tkhd(tk, cio)) - return 1; - if (mj2_read_mdia(tk, img, cio)) - return 1; - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with TRAK Box\n"); - return 1; - } - return 0; -} - -/* -* Write the MVHD box -* -* Movie header Box -* -*/ -void mj2_write_mvhd(opj_mj2_t * movie, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - unsigned j; - time_t ltime; - int max_tk_num = 0; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MVHD, 4); /* MVHD */ - - cio_write(cio, 0, 4); /* Version = 0, flags = 0 */ - - time(<ime); /* Time since 1/1/70 */ - movie->modification_time = (unsigned int)ltime + 2082844800; /* Seoonds between 1/1/04 and 1/1/70 */ - - cio_write(cio, movie->creation_time, 4); /* Creation Time */ - - cio_write(cio, movie->modification_time, 4); /* Modification Time */ - - cio_write(cio, movie->timescale, 4); /* Timescale */ - - movie->duration = 0; - - for (i = 0; i < (movie->num_stk + movie->num_htk + movie->num_vtk); i++) { - mj2_tk_t *tk = &movie->tk[i]; - - for (j = 0; j < tk->num_samples; j++) { - movie->duration += tk->sample[j].sample_delta; - } - } - - cio_write(cio, movie->duration, 4); - - cio_write(cio, movie->rate, 4); /* Rate to play presentation */ - - cio_write(cio, movie->volume, 2); /* Volume */ - - cio_write(cio, 0, 2); /* Reserved */ - cio_write(cio, 0, 4); /* Reserved */ - cio_write(cio, 0, 4); /* Reserved */ - - cio_write(cio, movie->trans_matrix[0], 4); /* Transformation matrix for video */ - cio_write(cio, movie->trans_matrix[1], 4); - cio_write(cio, movie->trans_matrix[2], 4); - cio_write(cio, movie->trans_matrix[3], 4); - cio_write(cio, movie->trans_matrix[4], 4); - cio_write(cio, movie->trans_matrix[5], 4); - cio_write(cio, movie->trans_matrix[6], 4); - cio_write(cio, movie->trans_matrix[7], 4); - cio_write(cio, movie->trans_matrix[8], 4); - - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - cio_write(cio, 0, 4); /* Pre-defined */ - - - for (i = 0; i < movie->num_htk + movie->num_stk + movie->num_vtk; i++) { - if (max_tk_num < movie->tk[i].track_ID) - max_tk_num = movie->tk[i].track_ID; - } - - movie->next_tk_id = max_tk_num + 1; - - cio_write(cio, movie->next_tk_id, 4); /* ID of Next track to be added */ - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the MVHD box -* -* Movie header Box -* -*/ -int mj2_read_mvhd(opj_mj2_t * movie, opj_cio_t *cio) -{ - mj2_box_t box; - - mj2_read_boxhdr(&box, cio); - if (MJ2_MVHD != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MVHD Marker\n"); - return 1; - } - - - if (0 != cio_read(cio, 4)) { /* Version = 0, flags = 0 */ - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Only Version 0 handled in MVHD box\n"); - } - - movie->creation_time = cio_read(cio, 4); /* Creation Time */ - - movie->modification_time = cio_read(cio, 4); /* Modification Time */ - - movie->timescale = cio_read(cio, 4); /* Timescale */ - - movie->duration = cio_read(cio, 4); /* Duration */ - - movie->rate = cio_read(cio, 4); /* Rate to play presentation */ - - movie->volume = cio_read(cio, 2); /* Volume */ - - cio_skip(cio,10); /* Reserved */ - - movie->trans_matrix[0] = cio_read(cio, 4); /* Transformation matrix for video */ - movie->trans_matrix[1] = cio_read(cio, 4); - movie->trans_matrix[2] = cio_read(cio, 4); - movie->trans_matrix[3] = cio_read(cio, 4); - movie->trans_matrix[4] = cio_read(cio, 4); - movie->trans_matrix[5] = cio_read(cio, 4); - movie->trans_matrix[6] = cio_read(cio, 4); - movie->trans_matrix[7] = cio_read(cio, 4); - movie->trans_matrix[8] = cio_read(cio, 4); - - cio_skip(cio,24); /* Pre-defined */ - - movie->next_tk_id = cio_read(cio, 4); /* ID of Next track to be added */ - - if (cio_tell(cio) - box.init_pos != box.length) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MVHD Box Size\n"); - return 1; - } - return 0; -} - - -/* -* Write the MOOV box -* -* Movie Box -* -*/ -void mj2_write_moov(opj_mj2_t * movie, opj_cio_t *cio) -{ - int i; - mj2_box_t box; - - box.init_pos = cio_tell(cio); - cio_skip(cio,4); - cio_write(cio, MJ2_MOOV, 4); /* MOOV */ - - mj2_write_mvhd(movie, cio); - - for (i = 0; i < (movie->num_stk + movie->num_htk + movie->num_vtk); i++) { - mj2_write_trak(&movie->tk[i], cio); - } - - box.length = cio_tell(cio) - box.init_pos; - cio_seek(cio, box.init_pos); - cio_write(cio, box.length, 4); /* L */ - cio_seek(cio, box.init_pos + box.length); -} - -/* -* Read the MOOV box -* -* Movie Box -* -*/ -int mj2_read_moov(opj_mj2_t * movie, opj_image_t * img, opj_cio_t *cio) -{ - unsigned int i; - mj2_box_t box; - mj2_box_t box2; - - mj2_read_boxhdr(&box, cio); - if (MJ2_MOOV != box.type) { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MOOV Marker\n"); - return 1; - } - - if (mj2_read_mvhd(movie, cio)) - return 1; - - movie->tk = (mj2_tk_t*) opj_malloc((movie->next_tk_id - 1) * sizeof(mj2_tk_t)); - - for (i = 0; cio_tell(cio) - box.init_pos < box.length; i++) { - mj2_tk_t *tk = &movie->tk[i]; - tk->cinfo = movie->cinfo; - mj2_read_boxhdr(&box2, cio); - if (box2.type == MJ2_TRAK) { - cio_seek(cio, box2.init_pos); - if (mj2_read_trak(tk, img, cio)) - return 1; - - if (tk->track_type == 0) { - movie->num_vtk++; - } else if (tk->track_type == 1) { - movie->num_stk++; - } else if (tk->track_type == 2) { - movie->num_htk++; - } - } else if (box2.type == MJ2_MVEX) { - cio_seek(cio, box2.init_pos); - cio_skip(cio,box2.length); - i--; - } else { - opj_event_msg(cio->cinfo, EVT_ERROR, "Error with MOOV Box: Expected TRAK or MVEX box\n"); - return 1; - } - } - return 0; -} - -int mj2_read_struct(FILE *file, opj_mj2_t *movie) { - mj2_box_t box; - opj_image_t img; - char * src; - int fsresult; - int foffset; - opj_cio_t *cio; - - /* open a byte stream for reading */ - src = (char*) opj_malloc(300 * sizeof(char)); - - /* Assuming that jp and ftyp markers size do - not exceed 300 bytes */ - fread(src,300,1, file); - - cio = opj_cio_open((opj_common_ptr)movie->cinfo, src, 300); - - if (mj2_read_jp(cio)) - return 1; - if (mj2_read_ftyp(movie, cio)) - return 1; - - fsresult = fseek(file,cio_tell(cio),SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read data after FTYP box\n" ); - return 1; - } - - foffset = cio_tell(cio); - - box.type = 0; - - fread(src,30,1,file); - cio = opj_cio_open((opj_common_ptr)movie->cinfo, src, 300); - mj2_read_boxhdr(&box, cio); - - while(box.type != MJ2_MOOV) { - - switch(box.type) - { - case MJ2_MDAT: - fsresult = fseek(file,foffset+box.length,SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read MDAT box\n" ); - return 1; - } - foffset += box.length; - break; - - case MJ2_MOOF: - fsresult = fseek(file,foffset+box.length,SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read MOOF box\n" ); - return 1; - } - foffset += box.length; - break; - case MJ2_FREE: - fsresult = fseek(file,foffset+box.length,SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read FREE box\n" ); - return 1; - } - foffset += box.length; - break; - case MJ2_SKIP: - fsresult = fseek(file,foffset+box.length,SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read SKIP box\n" ); - return 1; - } - foffset += box.length; - break; - default: - opj_event_msg(cio->cinfo, EVT_ERROR, "Unknown box in MJ2 stream\n"); - fsresult = fseek(file,foffset+box.length,SEEK_SET); - if( fsresult ) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read end of unknown box\n"); - return 1; - } - foffset += box.length; - break; - } - fsresult = fread(src,8,1,file); - if (fsresult != 1) { - opj_event_msg(cio->cinfo, EVT_ERROR, "MOOV box not found in file\n"); - return 1; - } - cio = opj_cio_open((opj_common_ptr)movie->cinfo, src, 8); - mj2_read_boxhdr(&box, cio); - } - - fseek(file,foffset,SEEK_SET); - src = opj_realloc(src,box.length); - fsresult = fread(src,box.length,1,file); - if (fsresult != 1) { - opj_event_msg(cio->cinfo, EVT_ERROR, "End of file reached while trying to read MOOV box\n"); - return 1; - } - - cio = opj_cio_open((opj_common_ptr)movie->cinfo, src, box.length); - - if (mj2_read_moov(movie, &img, cio)) - return 1; - - opj_free(src); - return 0; -} - -/* ----------------------------------------------------------------------- */ -/* MJ2 decoder interface */ -/* ----------------------------------------------------------------------- */ - -opj_dinfo_t* mj2_create_decompress() { - opj_mj2_t* mj2; - opj_dinfo_t *dinfo = (opj_dinfo_t*) opj_calloc(1, sizeof(opj_dinfo_t)); - if(!dinfo) return NULL; - - dinfo->is_decompressor = true; - - mj2 = (opj_mj2_t*) opj_calloc(1, sizeof(opj_mj2_t)); - dinfo->mj2_handle = mj2; - if(mj2) { - mj2->cinfo = (opj_common_ptr)dinfo; - } - mj2->j2k = j2k_create_decompress((opj_common_ptr)dinfo); - dinfo->j2k_handle = mj2->j2k; - - return dinfo; -} - -void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) { - movie->num_vtk=0; - movie->num_stk=0; - movie->num_htk=0; - - /* setup the J2K decoder parameters */ - j2k_setup_decoder(movie->cinfo->j2k_handle, &mj2_parameters->j2k_parameters); - -} - -void mj2_destroy_decompress(opj_mj2_t *movie) { - if(movie) { - int i; - mj2_tk_t *tk=NULL; - - if (movie->cinfo->j2k_handle) - j2k_destroy_compress(movie->j2k); - - if (movie->num_cl != 0) - opj_free(movie->cl); - - for (i = 0; i < movie->num_vtk + movie->num_stk + movie->num_htk; i++) { - tk = &movie->tk[i]; - if (tk->name_size != 0) - opj_free(tk->name); - if (tk->track_type == 0) {// Video track - if (tk->jp2_struct.comps != 0) - opj_free(tk->jp2_struct.comps); - if (tk->jp2_struct.cl != 0) - opj_free(tk->jp2_struct.cl); - if (tk->num_jp2x != 0) - opj_free(tk->jp2xdata); - - } - if (tk->num_url != 0) - opj_free(tk->url); - if (tk->num_urn != 0) - opj_free(tk->urn); - if (tk->num_br != 0) - opj_free(tk->br); - if (tk->num_tts != 0) - opj_free(tk->tts); - if (tk->num_chunks != 0) - opj_free(tk->chunk); - if (tk->num_samplestochunk != 0) - opj_free(tk->sampletochunk); - if (tk->num_samples != 0) - opj_free(tk->sample); - } - - opj_free(movie->tk); - } - opj_free(movie); -} - -/* ----------------------------------------------------------------------- */ -/* MJ2 encoder interface */ -/* ----------------------------------------------------------------------- */ - - -opj_cinfo_t* mj2_create_compress() { - opj_mj2_t* mj2; - opj_cinfo_t *cinfo = (opj_cinfo_t*) opj_calloc(1, sizeof(opj_cinfo_t)); - if(!cinfo) return NULL; - - mj2 = (opj_mj2_t*) opj_calloc(1, sizeof(opj_mj2_t)); - cinfo->mj2_handle = mj2; - if(mj2) { - mj2->cinfo = (opj_common_ptr)cinfo; - } - - mj2->j2k = j2k_create_compress(mj2->cinfo); - cinfo->j2k_handle = mj2->j2k; - - return cinfo; -} - -void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) { - if(movie && parameters) { - opj_jp2_t *jp2_struct; - - movie->num_htk = 0; // No hint tracks - movie->num_stk = 0; // No sound tracks - movie->num_vtk = 1; // One video track - - movie->brand = MJ2_MJ2; // One brand: MJ2 - movie->num_cl = 2; // Two compatible brands: MJ2 and MJ2S - movie->cl = (unsigned int*) opj_malloc(movie->num_cl * sizeof(unsigned int)); - movie->cl[0] = MJ2_MJ2; - movie->cl[1] = MJ2_MJ2S; - movie->minversion = 0; // Minimum version: 0 - - movie->tk = (mj2_tk_t*) opj_malloc(sizeof(mj2_tk_t)); //Memory allocation for the video track - movie->tk[0].track_ID = 1; // Track ID = 1 - movie->tk[0].track_type = 0; // Video track - movie->tk[0].Dim[0] = parameters->Dim[0]; - movie->tk[0].Dim[1] = parameters->Dim[1]; - movie->tk[0].w = parameters->w; - movie->tk[0].h = parameters->h; - movie->tk[0].CbCr_subsampling_dx = parameters->CbCr_subsampling_dx; - movie->tk[0].CbCr_subsampling_dy = parameters->CbCr_subsampling_dy; - movie->tk[0].sample_rate = parameters->frame_rate; - movie->tk[0].name_size = 0; - movie->tk[0].chunk = (mj2_chunk_t*) opj_malloc(sizeof(mj2_chunk_t)); - movie->tk[0].sample = (mj2_sample_t*) opj_malloc(sizeof(mj2_sample_t)); - - jp2_struct = &movie->tk[0].jp2_struct; - jp2_struct->numcomps = 3; // NC - jp2_struct->comps = (opj_jp2_comps_t*) opj_malloc(jp2_struct->numcomps * sizeof(opj_jp2_comps_t)); - jp2_struct->precedence = 0; /* PRECEDENCE*/ - jp2_struct->approx = 0; /* APPROX*/ - jp2_struct->brand = JP2_JP2; /* BR */ - jp2_struct->minversion = 0; /* MinV */ - jp2_struct->numcl = 1; - jp2_struct->cl = (unsigned int*) opj_malloc(jp2_struct->numcl * sizeof(int)); - jp2_struct->cl[0] = JP2_JP2; /* CL0 : JP2 */ - jp2_struct->C = 7; /* C : Always 7*/ - jp2_struct->UnkC = 0; /* UnkC, colorspace specified in colr box*/ - jp2_struct->IPR = 0; /* IPR, no intellectual property*/ - jp2_struct->w = parameters->w; - jp2_struct->h = parameters->h; - jp2_struct->bpc = 7; - jp2_struct->meth = 1; - jp2_struct->enumcs = 18; // YUV - } -} - -void mj2_destroy_compress(opj_mj2_t *movie) { - if(movie) { - int i; - mj2_tk_t *tk=NULL; - - if (movie->cinfo->j2k_handle) { - j2k_destroy_compress(movie->j2k); - } - - if (movie->num_cl != 0) - opj_free(movie->cl); - - for (i = 0; i < movie->num_vtk + movie->num_stk + movie->num_htk; i++) { - tk = &movie->tk[i]; - if (tk->name_size != 0) - opj_free(tk->name); - if (tk->track_type == 0) {// Video track - if (tk->jp2_struct.comps != 0) - opj_free(tk->jp2_struct.comps); - if (tk->jp2_struct.cl != 0) - opj_free(tk->jp2_struct.cl); - if (tk->num_jp2x != 0) - opj_free(tk->jp2xdata); - - } - if (tk->num_url != 0) - opj_free(tk->url); - if (tk->num_urn != 0) - opj_free(tk->urn); - if (tk->num_br != 0) - opj_free(tk->br); - if (tk->num_tts != 0) - opj_free(tk->tts); - if (tk->num_chunks != 0) - opj_free(tk->chunk); - if (tk->num_samplestochunk != 0) - opj_free(tk->sampletochunk); - if (tk->num_samples != 0) - opj_free(tk->sample); - } - - opj_free(movie->tk); - } - opj_free(movie); -} diff --git a/mj2/mj2.h b/mj2/mj2.h deleted file mode 100644 index 97cf8ede..00000000 --- a/mj2/mj2.h +++ /dev/null @@ -1,391 +0,0 @@ -/* -* Copyright (c) 2003-2004, François-Olivier Devaux -* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium -* All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __MJ2_H -#define __MJ2_H -/** -@file mj2.h -@brief The Motion JPEG 2000 file format Reader/Writer (MJ22) - -*/ - -/** @defgroup MJ2 MJ2 - Motion JPEG 2000 file format reader/writer */ -/*@{*/ - -#define MJ2_JP 0x6a502020 -#define MJ2_FTYP 0x66747970 -#define MJ2_MJ2 0x6d6a7032 -#define MJ2_MJ2S 0x6d6a3273 -#define MJ2_MDAT 0x6d646174 -#define MJ2_MOOV 0x6d6f6f76 -#define MJ2_MVHD 0x6d766864 -#define MJ2_TRAK 0x7472616b -#define MJ2_TKHD 0x746b6864 -#define MJ2_MDIA 0x6d646961 -#define MJ2_MDHD 0x6d646864 -#define MJ2_MHDR 0x6d686472 -#define MJ2_HDLR 0x68646C72 -#define MJ2_MINF 0x6d696e66 -#define MJ2_VMHD 0x766d6864 -#define MJ2_SMHD 0x736d6864 -#define MJ2_HMHD 0x686d6864 -#define MJ2_DINF 0x64696e66 -#define MJ2_DREF 0x64726566 -#define MJ2_URL 0x75726c20 -#define MJ2_URN 0x75726e20 -#define MJ2_STBL 0x7374626c -#define MJ2_STSD 0x73747364 -#define MJ2_STTS 0x73747473 -#define MJ2_STSC 0x73747363 -#define MJ2_STSZ 0x7374737a -#define MJ2_STCO 0x7374636f -#define MJ2_MOOF 0x6d6f6f66 -#define MJ2_FREE 0x66726565 -#define MJ2_SKIP 0x736b6970 -#define MJ2_JP2C 0x6a703263 -#define MJ2_FIEL 0x6669656c -#define MJ2_JP2P 0x6a703270 -#define MJ2_JP2X 0x6a703278 -#define MJ2_JSUB 0x6a737562 -#define MJ2_ORFO 0x6f72666f -#define MJ2_MVEX 0x6d766578 -#define MJ2_JP2 0x6a703220 -#define MJ2_J2P0 0x4a325030 - -/** -Decompressed format used in parameters -YUV = 0 -*/ -#define YUV_DFMT 1 - -/** -Compressed format used in parameters -MJ2 = 0 -*/ -#define MJ2_CFMT 2 - - -/* ----------------------------------------------------------------------- */ - -/** -Time To Sample -*/ -typedef struct mj2_tts { - int sample_count; - int sample_delta; -} mj2_tts_t; - -/** -Chunk -*/ -typedef struct mj2_chunk { - int num_samples; - int sample_descr_idx; - int offset; -} mj2_chunk_t; - -/** -Sample to chunk -*/ -typedef struct mj2_sampletochunk { - int first_chunk; - int samples_per_chunk; - int sample_descr_idx; -} mj2_sampletochunk_t; - -/** -Sample -*/ -typedef struct mj2_sample { - unsigned int sample_size; - unsigned int offset; - unsigned int sample_delta; -} mj2_sample_t; - -/** -URL -*/ -typedef struct mj2_url { - int location[4]; -} mj2_url_t; - -/** -URN -*/ -typedef struct mj2_urn { - int name[2]; - int location[4]; -} mj2_urn_t; - -/** -Video Track Parameters -*/ -typedef struct mj2_tk { - /** codec context */ - opj_common_ptr cinfo; - int track_ID; - int track_type; - unsigned int creation_time; - unsigned int modification_time; - int duration; - int timescale; - int layer; - int volume; - int language; - int balance; - int maxPDUsize; - int avgPDUsize; - int maxbitrate; - int avgbitrate; - int slidingavgbitrate; - int graphicsmode; - int opcolor[3]; - int num_url; - mj2_url_t *url; - int num_urn; - mj2_urn_t *urn; - int Dim[2]; - int w; - int h; - int visual_w; - int visual_h; - int CbCr_subsampling_dx; - int CbCr_subsampling_dy; - int sample_rate; - int sample_description; - int horizresolution; - int vertresolution; - int compressorname[8]; - int depth; - unsigned char fieldcount; - unsigned char fieldorder; - unsigned char or_fieldcount; - unsigned char or_fieldorder; - int num_br; - unsigned int *br; - unsigned char num_jp2x; - unsigned char *jp2xdata; - unsigned char hsub; - unsigned char vsub; - unsigned char hoff; - unsigned char voff; - int trans_matrix[9]; - /** Number of samples */ - unsigned int num_samples; - int transorm; - int handler_type; - int name_size; - unsigned char same_sample_size; - int num_tts; - /** Time to sample */ - mj2_tts_t *tts; - unsigned int num_chunks; - mj2_chunk_t *chunk; - int num_samplestochunk; - mj2_sampletochunk_t *sampletochunk; - char *name; - opj_jp2_t jp2_struct; - /** Sample parameters */ - mj2_sample_t *sample; -} mj2_tk_t; - -/** -MJ2 box -*/ -typedef struct mj2_box { - int length; - int type; - int init_pos; -} mj2_box_t; - -/** -MJ2 Movie -*/ -typedef struct opj_mj2 { - /** codec context */ - opj_common_ptr cinfo; - /** handle to the J2K codec */ - opj_j2k_t *j2k; - unsigned int brand; - unsigned int minversion; - int num_cl; - unsigned int *cl; - unsigned int creation_time; - unsigned int modification_time; - int timescale; - unsigned int duration; - int rate; - int num_vtk; - int num_stk; - int num_htk; - int volume; - int trans_matrix[9]; - int next_tk_id; - /** Track Parameters */ - mj2_tk_t *tk; -} opj_mj2_t; - -/** -Decompression parameters -*/ -typedef struct mj2_dparameters { - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** J2K decompression parameters */ - opj_dparameters_t j2k_parameters; -} mj2_dparameters_t; - -/** -Compression parameters -*/ -typedef struct mj2_cparameters { - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** J2K compression parameters */ - opj_cparameters_t j2k_parameters; - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** input file format 0:MJ2 */ - int decod_format; - /** output file format 0:YUV */ - int cod_format; - /** Portion of the image coded */ - int Dim[2]; - /** YUV Frame width */ - int w; - /** YUV Frame height */ - int h; - /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ - int CbCr_subsampling_dx; - /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ - int CbCr_subsampling_dy; - /* Video Frame Rate */ - int frame_rate; - /* In YUV files, numcomps always considered as 3 */ - int numcomps; - /* In YUV files, precision always considered as 8 */ - int prec; -} mj2_cparameters_t; - - -/** @name Exported functions */ -/*@{*/ -/* ----------------------------------------------------------------------- */ -/** -Write the JP box -*/ -void mj2_write_jp(opj_cio_t *cio); -/** -Write the FTYP box -@param movie MJ2 movie -@param cio Output buffer stream -*/ -void mj2_write_ftyp(opj_mj2_t *movie, opj_cio_t *cio); -/** -Creates an MJ2 decompression structure -@return Returns a handle to a MJ2 decompressor if successful, returns NULL otherwise -*/ -opj_dinfo_t* mj2_create_decompress(); -/** -Destroy a MJ2 decompressor handle -@param movie MJ2 decompressor handle to destroy -*/ -void mj2_destroy_decompress(opj_mj2_t *movie); -/** -Setup the decoder decoding parameters using user parameters. -Decoding parameters are returned in mj2->j2k->cp. -@param movie MJ2 decompressor handle -@param parameters decompression parameters -*/ -void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters); -/** -Decode an image from a JPEG-2000 file stream -@param movie MJ2 decompressor handle -@param cio Input buffer stream -@return Returns a decoded image if successful, returns NULL otherwise -*/ -opj_image_t* mj2_decode(opj_mj2_t *movie, opj_cio_t *cio); -/** -Creates a MJ2 compression structure -@return Returns a handle to a MJ2 compressor if successful, returns NULL otherwise -*/ -opj_cinfo_t* mj2_create_compress(); -/** -Destroy a MJ2 compressor handle -@param movie MJ2 compressor handle to destroy -*/ -void mj2_destroy_compress(opj_mj2_t *movie); -/** -Setup the encoder parameters using the current image and using user parameters. -Coding parameters are returned in mj2->j2k->cp. -@param movie MJ2 compressor handle -@param parameters compression parameters -*/ -void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters); -/** -Encode an image into a JPEG-2000 file stream -@param movie MJ2 compressor handle -@param cio Output buffer stream -@param image Image to encode -@param index Name of the index file if required, NULL otherwise -@return Returns true if successful, returns false otherwise -*/ -bool mj2_encode(opj_mj2_t *movie, opj_cio_t *cio, opj_image_t *image, char *index); - -/** -Init a Standard MJ2 movie -@param movie MJ2 Movie -@return Returns 0 if successful, returns 1 otherwise -*/ -int mj2_init_stdmovie(opj_mj2_t *movie); -/** -Read the structure of an MJ2 file -@param File MJ2 input File -@param movie J2 movie structure -@return Returns 0 if successful, returns 1 otherwise -*/ -int mj2_read_struct(FILE *file, opj_mj2_t *mj2); -/** -Write the the MOOV box to an output buffer stream -@param movie MJ2 movie structure -@param cio Output buffer stream -*/ -void mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio); - - -/* ----------------------------------------------------------------------- */ -/*@}*/ - -/*@}*/ - -#endif /* __MJ2_H */ diff --git a/mj2/mj2_convert.c b/mj2/mj2_convert.c deleted file mode 100644 index c7e0c04f..00000000 --- a/mj2/mj2_convert.c +++ /dev/null @@ -1,329 +0,0 @@ -/* -* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium -* Copyright (c) 2002-2007, Professor Benoit Macq -* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "opj_includes.h" -#include "mj2.h" - -/* ----------------------- */ -/* */ -/* */ -/* Count the number of frames */ -/* in a YUV file */ -/* */ -/* ----------------------- */ - -int yuv_num_frames(mj2_tk_t * tk, char *infile) -{ - int numimages, frame_size; - long end_of_f; - FILE *f; - - f = fopen(infile,"rb"); - if (!f) { - fprintf(stderr, "failed to open %s for reading\n",infile); - return -1; - } - - frame_size = (int) (tk->w * tk->h * (1.0 + (double) 2 / (double) (tk->CbCr_subsampling_dx * tk->CbCr_subsampling_dy))); /* Calculate frame size */ - - fseek(f, 0, SEEK_END); - end_of_f = ftell(f); /* Calculate file size */ - - if (end_of_f < frame_size) { - fprintf(stderr, - "YUV does not contains any frame of %d x %d size\n", tk->w, - tk->h); - return -1; - } - - numimages = end_of_f / frame_size; /* Calculate number of images */ - fclose(f); - - return numimages; -} - -// ----------------------- -// -// -// YUV to IMAGE -// -// ----------------------- - -opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters) -{ - opj_image_cmptparm_t cmptparm[3]; - opj_image_t * img; - int i; - int numcomps = 3; - int subsampling_dx = parameters->subsampling_dx; - int subsampling_dy = parameters->subsampling_dy; - - /* initialize image components */ - memset(&cmptparm[0], 0, 3 * sizeof(opj_image_cmptparm_t)); - for(i = 0; i < numcomps; i++) { - cmptparm[i].prec = 8; - cmptparm[i].bpp = 8; - cmptparm[i].sgnd = 0; - cmptparm[i].dx = i ? subsampling_dx * tk->CbCr_subsampling_dx : subsampling_dx; - cmptparm[i].dy = i ? subsampling_dy * tk->CbCr_subsampling_dy : subsampling_dy; - cmptparm[i].w = tk->w; - cmptparm[i].h = tk->h; - } - /* create the image */ - img = opj_image_create(numcomps, cmptparm, CLRSPC_SRGB); - return img; -} - -char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile) -{ - int i, compno; - int offset; - long end_of_f, position; - int numcomps = 3; - int subsampling_dx = parameters->subsampling_dx; - int subsampling_dy = parameters->subsampling_dy; - FILE *yuvfile; - - yuvfile = fopen(infile,"rb"); - if (!yuvfile) { - fprintf(stderr, "failed to open %s for readings\n",parameters->infile); - return 1; - } - - offset = (int) ((double) (frame_num * tk->w * tk->h) * (1.0 + - 1.0 * (double) 2 / (double) (tk->CbCr_subsampling_dx * tk->CbCr_subsampling_dy))); - fseek(yuvfile, 0, SEEK_END); - end_of_f = ftell(yuvfile); - fseek(yuvfile, sizeof(unsigned char) * offset, SEEK_SET); - position = ftell(yuvfile); - if (position >= end_of_f) { - fprintf(stderr, "Cannot reach frame number %d in yuv file !!\n", - frame_num); - fclose(yuvfile); - return 1; - } - - img->x0 = tk->Dim[0]; - img->y0 = tk->Dim[1]; - img->x1 = !tk->Dim[0] ? (tk->w - 1) * subsampling_dx + 1 : tk->Dim[0] + - (tk->w - 1) * subsampling_dx + 1; - img->y1 = !tk->Dim[1] ? (tk->h - 1) * subsampling_dy + 1 : tk->Dim[1] + - (tk->h - 1) * subsampling_dy + 1; - - for(compno = 0; compno < numcomps; compno++) { - for (i = 0; i < (tk->w * tk->h / (img->comps[compno].dx * img->comps[compno].dy)) - && !feof(yuvfile); i++) { - if (!fread(&img->comps[compno].data[i], 1, 1, yuvfile)) { - fprintf(stderr, "Error reading %s file !!\n", infile); - return 1; - } - } - } - fclose(yuvfile); - - return 0; -} - - - -// ----------------------- -// -// -// IMAGE to YUV -// -// ----------------------- - - -bool imagetoyuv(opj_image_t * img, char *outfile) -{ - FILE *f; - int i; - - if (img->numcomps == 3) { - if (img->comps[0].dx != img->comps[1].dx / 2 - || img->comps[1].dx != img->comps[2].dx) { - fprintf(stderr, - "Error with the input image components size: cannot create yuv file)\n"); - return false; - } - } else if (!(img->numcomps == 1)) { - fprintf(stderr, - "Error with the number of image components(must be one or three)\n"); - return false; - } - - f = fopen(outfile, "a+b"); - if (!f) { - fprintf(stderr, "failed to open %s for writing\n", outfile); - return false; - } - - - for (i = 0; i < (img->comps[0].w * img->comps[0].h); i++) { - unsigned char y; - y = img->comps[0].data[i]; - fwrite(&y, 1, 1, f); - } - - - if (img->numcomps == 3) { - for (i = 0; i < (img->comps[1].w * img->comps[1].h); i++) { - unsigned char cb; - cb = img->comps[1].data[i]; - fwrite(&cb, 1, 1, f); - } - - - for (i = 0; i < (img->comps[2].w * img->comps[2].h); i++) { - unsigned char cr; - cr = img->comps[2].data[i]; - fwrite(&cr, 1, 1, f); - } - } else if (img->numcomps == 1) { - for (i = 0; i < (img->comps[0].w * img->comps[0].h * 0.25); i++) { - unsigned char cb = 125; - fwrite(&cb, 1, 1, f); - } - - - for (i = 0; i < (img->comps[0].w * img->comps[0].h * 0.25); i++) { - unsigned char cr = 125; - fwrite(&cr, 1, 1, f); - } - } - fclose(f); - return true; -} - -// ----------------------- -// -// -// IMAGE to BMP -// -// ----------------------- - -int imagetobmp(opj_image_t * img, char *outfile) { - int w,wr,h,hr,i,pad; - FILE *f; - - if (img->numcomps == 3 && img->comps[0].dx == img->comps[1].dx - && img->comps[1].dx == img->comps[2].dx - && img->comps[0].dy == img->comps[1].dy - && img->comps[1].dy == img->comps[2].dy - && img->comps[0].prec == img->comps[1].prec - && img->comps[1].prec == img->comps[2].prec) { - /* -->> -->> -->> -->> - - 24 bits color - - <<-- <<-- <<-- <<-- */ - - f = fopen(outfile, "wb"); - if (!f) { - fprintf(stderr, "failed to open %s for writing\n", outfile); - return 1; - } - - w = img->comps[0].w; - wr = int_ceildivpow2(img->comps[0].w, img->comps[0].factor); - - h = img->comps[0].h; - hr = int_ceildivpow2(img->comps[0].h, img->comps[0].factor); - - fprintf(f, "BM"); - - /* FILE HEADER */ - /* ------------- */ - fprintf(f, "%c%c%c%c", - (unsigned char) (hr * wr * 3 + 3 * hr * (wr % 2) + - 54) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2) + 54) - >> 8) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2) + 54) - >> 16) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2) + 54) - >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, - ((0) >> 16) & 0xff, ((0) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (54) & 0xff, ((54) >> 8) & 0xff, - ((54) >> 16) & 0xff, ((54) >> 24) & 0xff); - - /* INFO HEADER */ - /* ------------- */ - fprintf(f, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, - ((40) >> 16) & 0xff, ((40) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (unsigned char) ((wr) & 0xff), - (unsigned char) ((wr) >> 8) & 0xff, - (unsigned char) ((wr) >> 16) & 0xff, - (unsigned char) ((wr) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (unsigned char) ((hr) & 0xff), - (unsigned char) ((hr) >> 8) & 0xff, - (unsigned char) ((hr) >> 16) & 0xff, - (unsigned char) ((hr) >> 24) & 0xff); - fprintf(f, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff); - fprintf(f, "%c%c", (24) & 0xff, ((24) >> 8) & 0xff); - fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, - ((0) >> 16) & 0xff, ((0) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", - (unsigned char) (3 * hr * wr + - 3 * hr * (wr % 2)) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2)) >> - 8) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2)) >> - 16) & 0xff, - (unsigned char) ((hr * wr * 3 + 3 * hr * (wr % 2)) >> - 24) & 0xff); - fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, - ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, - ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, - ((0) >> 16) & 0xff, ((0) >> 24) & 0xff); - fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, - ((0) >> 16) & 0xff, ((0) >> 24) & 0xff); - - for (i = 0; i < wr * hr; i++) { - unsigned char R, G, B; - /* a modifier */ - // R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; - R = img->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]; - // G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; - G = img->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]; - // B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; - B = img->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]; - fprintf(f, "%c%c%c", B, G, R); - - if ((i + 1) % wr == 0) { - for (pad = (3 * wr) % 4 ? 4 - (3 * wr) % 4 : 0; pad > 0; pad--) /* ADD */ - fprintf(f, "%c", 0); - } - } - fclose(f); - } - return 0; -} diff --git a/mj2/mj2_convert.h b/mj2/mj2_convert.h deleted file mode 100644 index 78e6c470..00000000 --- a/mj2/mj2_convert.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2003-2004, François-Olivier Devaux -* Copyright (c) 2002-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include "mj2.h" - -#ifndef __MJ2_CONVERT_H -#define __MJ2_CONVERT_H - -int imagetoyuv(opj_image_t * img, char *outfile); - -int imagetobmp(opj_image_t * img, char *outfile); - -opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters); - -char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile); - -int yuv_num_frames(mj2_tk_t * tk, char *infile); - - -#endif diff --git a/mj2/mj2_to_frames.c b/mj2/mj2_to_frames.c deleted file mode 100644 index a3a50469..00000000 --- a/mj2/mj2_to_frames.c +++ /dev/null @@ -1,225 +0,0 @@ -/* -* Copyright (c) 2003-2004, François-Olivier Devaux -* Copyright (c) 2002-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include - -#include "openjpeg.h" -#include "j2k_lib.h" -#include "j2k.h" -#include "jp2.h" -#include "mj2.h" -#include "mj2_convert.h" - -/* -------------------------------------------------------------------------- */ - -/** -sample error callback expecting a FILE* client object -*/ -void error_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[ERROR] %s", msg); -} -/** -sample warning callback expecting a FILE* client object -*/ -void warning_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[WARNING] %s", msg); -} -/** -sample debug callback expecting a FILE* client object -*/ -void info_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[INFO] %s", msg); -} - -/* -------------------------------------------------------------------------- */ - - -int main(int argc, char *argv[]) { - mj2_dparameters_t mj2_parameters; /* decompression parameters */ - opj_dinfo_t* dinfo; - opj_event_mgr_t event_mgr; /* event manager */ - opj_cio_t *cio = NULL; - unsigned int tnum, snum; - opj_mj2_t *movie; - mj2_tk_t *track; - mj2_sample_t *sample; - unsigned char* frame_codestream; - FILE *file, *outfile; - char outfilename[50]; - opj_image_t *img = NULL; - unsigned int max_codstrm_size = 0; - double total_time = 0; - unsigned int numframes = 0; - - if (argc != 3) { - printf("Bad syntax: Usage: mj2_to_frames inputfile.mj2 outputfile.yuv\n"); - printf("Example: MJ2_decoder foreman.mj2 foreman.yuv\n"); - return 1; - } - - file = fopen(argv[1], "rb"); - - if (!file) { - fprintf(stderr, "failed to open %s for reading\n", argv[1]); - return 1; - } - - // Checking output file - outfile = fopen(argv[2], "w"); - if (!file) { - fprintf(stderr, "failed to open %s for writing\n", argv[2]); - return 1; - } - fclose(outfile); - - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = NULL; - - /* get a MJ2 decompressor handle */ - dinfo = mj2_create_decompress(); - movie = dinfo->mj2_handle; - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* set J2K decoding parameters to default values */ - opj_set_default_decoder_parameters(&mj2_parameters.j2k_parameters); - - /* setup the decoder decoding parameters using user parameters */ - mj2_setup_decoder(dinfo->mj2_handle, &mj2_parameters); - - if (mj2_read_struct(file, movie)) // Creating the movie structure - return 1; - - // Decode first video track - for (tnum=0; tnum < (unsigned int)(movie->num_htk + movie->num_stk + movie->num_vtk); tnum++) { - if (movie->tk[tnum].track_type == 0) - break; - } - - if (movie->tk[tnum].track_type != 0) { - printf("Error. Movie does not contain any video track\n"); - return 1; - } - - track = &movie->tk[tnum]; - - // Output info on first video tracl - fprintf(stdout,"The first video track contains %d frames.\nWidth: %d, Height: %d \n\n", - track->num_samples, track->w, track->h); - - max_codstrm_size = track->sample[0].sample_size-8; - frame_codestream = (unsigned char*) malloc(max_codstrm_size * sizeof(unsigned char)); - - numframes = track->num_samples; - - for (snum=0; snum < numframes; snum++) - { - double init_time = opj_clock(); - double elapsed_time; - - sample = &track->sample[snum]; - if (sample->sample_size-8 > max_codstrm_size) { - max_codstrm_size = sample->sample_size-8; - if ((frame_codestream = realloc(frame_codestream, max_codstrm_size)) == NULL) { - printf("Error reallocation memory\n"); - return 1; - }; - } - fseek(file,sample->offset+8,SEEK_SET); - fread(frame_codestream, sample->sample_size-8, 1, file); // Assuming that jp and ftyp markers size do - - /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, frame_codestream, sample->sample_size-8); - - img = opj_decode(dinfo, cio); // Decode J2K to image - - if (((img->numcomps == 3) && (img->comps[0].dx == img->comps[1].dx / 2) - && (img->comps[0].dx == img->comps[2].dx / 2 ) && (img->comps[0].dx == 1)) - || (img->numcomps == 1)) { - - if (!imagetoyuv(img, argv[2])) // Convert image to YUV - return 1; - } - else if ((img->numcomps == 3) && - (img->comps[0].dx == 1) && (img->comps[1].dx == 1)&& - (img->comps[2].dx == 1))// If YUV 4:4:4 input --> to bmp - { - fprintf(stdout,"The frames will be output in a bmp format (output_1.bmp, ...)\n"); - sprintf(outfilename,"output_%d.bmp",snum); - if (imagetobmp(img, outfilename)) // Convert image to BMP - return 1; - - } - else { - fprintf(stdout,"Image component dimensions are unknown. Unable to output image\n"); - fprintf(stdout,"The frames will be output in a j2k file (output_1.j2k, ...)\n"); - - sprintf(outfilename,"output_%d.j2k",snum); - outfile = fopen(outfilename, "wb"); - if (!outfile) { - fprintf(stderr, "failed to open %s for writing\n",outfilename); - return 1; - } - fwrite(frame_codestream,sample->sample_size-8,1,outfile); - fclose(outfile); - } - /* close the byte stream */ - opj_cio_close(cio); - /* free image data structure */ - opj_image_destroy(img); - elapsed_time = opj_clock()-init_time; - fprintf(stderr, "Frame number %d/%d decoded in %.2f mseconds\n", snum + 1, numframes, elapsed_time*1000); - total_time += elapsed_time; - - } - - free(frame_codestream); - fclose(file); - - /* free remaining structures */ - if(dinfo) { - mj2_destroy_decompress((opj_mj2_t*)dinfo->mj2_handle); - } - free(dinfo); - - fprintf(stdout, "%d frame(s) correctly decompressed\n", snum); - fprintf(stdout,"Total decoding time: %.2f seconds (%.1f fps)\n", total_time, (float)numframes/total_time); - - return 0; -} diff --git a/mj2/mj2_to_frames.dsp b/mj2/mj2_to_frames.dsp deleted file mode 100644 index 5b5bad61..00000000 --- a/mj2/mj2_to_frames.dsp +++ /dev/null @@ -1,159 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mj2_to_frames" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mj2_to_frames - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mj2_to_frames.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mj2_to_frames.mak" CFG="mj2_to_frames - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mj2_to_frames - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "mj2_to_frames - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mj2_to_frames - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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 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 - -!ELSEIF "$(CFG)" == "mj2_to_frames - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mj2_to_frames___Win32_Debug0" -# PROP BASE Intermediate_Dir "mj2_to_frames___Win32_Debug0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "mj2_to_frames___Win32_Debug0" -# PROP Intermediate_Dir "mj2_to_frames___Win32_Debug0" -# 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 /MT /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /GZ /c -# SUBTRACT CPP /X -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmtd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mj2_to_frames - Win32 Release" -# Name "mj2_to_frames - Win32 Debug" -# Begin Group "MJ2" - -# PROP Default_Filter "" -# Begin Group "MJ2 Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=.\mj2.h -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.h -# End Source File -# End Group -# Begin Group "MJ2 Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\compat\getopt.c - -!IF "$(CFG)" == "mj2_to_frames - Win32 Release" - -!ELSEIF "$(CFG)" == "mj2_to_frames - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\mj2.c - -!IF "$(CFG)" == "mj2_to_frames - Win32 Release" - -!ELSEIF "$(CFG)" == "mj2_to_frames - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.c - -!IF "$(CFG)" == "mj2_to_frames - Win32 Release" - -!ELSEIF "$(CFG)" == "mj2_to_frames - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\mj2_to_frames.c - -!IF "$(CFG)" == "mj2_to_frames - Win32 Release" - -!ELSEIF "$(CFG)" == "mj2_to_frames - Win32 Debug" - -!ENDIF - -# End Source File -# End Group -# End Group -# Begin Group "OpenJPEG Headers" - -# PROP Default_Filter "" -# End Group -# End Target -# End Project diff --git a/mj2/mj2_to_frames.dsw b/mj2/mj2_to_frames.dsw deleted file mode 100644 index 897121cf..00000000 --- a/mj2/mj2_to_frames.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"="..\LibOpenJPEG.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "mj2_to_frames"=".\mj2_to_frames.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/mj2/mj2_to_frames.sln b/mj2/mj2_to_frames.sln deleted file mode 100644 index e54e17ad..00000000 --- a/mj2/mj2_to_frames.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mj2_to_frames", "mj2_to_frames.vcproj", "{64325EAD-A083-4C8E-B852-71006428881D}" - ProjectSection(ProjectDependencies) = postProject - {4F27AA53-4181-4A1A-8238-3931B0A41048} = {4F27AA53-4181-4A1A-8238-3931B0A41048} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "..\LibOpenJPEG.vcproj", "{4F27AA53-4181-4A1A-8238-3931B0A41048}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64325EAD-A083-4C8E-B852-71006428881D}.Debug|Win32.ActiveCfg = Debug|Win32 - {64325EAD-A083-4C8E-B852-71006428881D}.Debug|Win32.Build.0 = Debug|Win32 - {64325EAD-A083-4C8E-B852-71006428881D}.Release|Win32.ActiveCfg = Release|Win32 - {64325EAD-A083-4C8E-B852-71006428881D}.Release|Win32.Build.0 = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.ActiveCfg = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Debug|Win32.Build.0 = Debug|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.ActiveCfg = Release|Win32 - {4F27AA53-4181-4A1A-8238-3931B0A41048}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/mj2/mj2_to_frames.vcproj b/mj2/mj2_to_frames.vcproj deleted file mode 100644 index 5ac797ad..00000000 --- a/mj2/mj2_to_frames.vcproj +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mj2/mj2_to_metadata.c b/mj2/mj2_to_metadata.c deleted file mode 100644 index a9c8893b..00000000 --- a/mj2/mj2_to_metadata.c +++ /dev/null @@ -1,312 +0,0 @@ -/* mj2_to_metadata.c */ -/* Dump MJ2, JP2 metadata (partial so far) to xml file */ -/* Contributed to Open JPEG by Glenn Pearson, contract software developer, U.S. National Library of Medicine. - -The base code in this file was developed by the author as part of a video archiving -project for the U.S. National Library of Medicine, Bethesda, MD. -It is the policy of NLM (and U.S. government) to not assert copyright. - -A non-exclusive copy of this code has been contributed to the Open JPEG project. -Except for copyright, inclusion of the code within Open JPEG for distribution and use -can be bound by the Open JPEG open-source license and disclaimer, expressed elsewhere. -*/ - -#include "opj_includes.h" -#include "mj2.h" - -#include "mj2_to_metadata.h" -#include -#include "compat/getopt.h" - -/* -------------------------------------------------------------------------- */ - -/** -sample error callback expecting a FILE* client object -*/ -void error_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[ERROR] %s", msg); -} -/** -sample warning callback expecting a FILE* client object -*/ -void warning_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[WARNING] %s", msg); -} -/** -sample debug callback expecting a FILE* client object -*/ -void info_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[INFO] %s", msg); -} - -/* -------------------------------------------------------------------------- */ - - - -/* ------------- */ - -void help_display() -{ - /* "1234567890123456789012345678901234567890123456789012345678901234567890123456789" */ - fprintf(stdout," Help for the 'mj2_to_metadata' Program\n"); - fprintf(stdout," ======================================\n"); - fprintf(stdout,"The -h option displays this information on screen.\n\n"); - - fprintf(stdout,"mj2_to_metadata generates an XML file from a Motion JPEG 2000 file.\n"); - fprintf(stdout,"The generated XML shows the structural, but not (yet) curatorial,\n"); - fprintf(stdout,"metadata from the movie header and from the JPEG 2000 image and tile\n"); - fprintf(stdout,"headers of a sample frame. Excluded: low-level packed-bits image data.\n\n"); - - fprintf(stdout,"By Default\n"); - fprintf(stdout,"----------\n"); - fprintf(stdout,"The metadata includes the jp2 image and tile headers of the first frame.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Metadata values are shown in 'raw' form (e.g., hexidecimal) as stored in the\n"); - fprintf(stdout,"file, and, if apt, in a 'derived' form that is more quickly grasped.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Notes explaining the XML are embedded as terse comments. These include\n"); - fprintf(stdout," meaning of non-obvious tag abbreviations;\n"); - fprintf(stdout," range and precision of valid values;\n"); - fprintf(stdout," interpretations of values, such as enumerations; and\n"); - fprintf(stdout," current implementation limitations.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"The sample-size and chunk-offset tables, each with 1 row per frame, are not reported.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"The file is self-contained and no verification (e.g., against a DTD) is requested.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Required Parameters (except with -h)\n"); - fprintf(stdout,"------------------------------------\n"); - fprintf(stdout,"[Caution: file strings that contain spaces should be wrapped with quotes.]\n"); - fprintf(stdout,"-i input.mj2 : where 'input' is any source file name or path.\n"); - fprintf(stdout," MJ2 files created with 'frames_to_mj2' are supported so far.\n"); - fprintf(stdout," These are silent, single-track, 'MJ2 Simple Profile' videos.\n"); - fprintf(stdout,"-o output.xml : where 'output' is any destination file name or path.\n"); - fprintf(stdout,"\n"); - fprintf(stdout,"Optional Parameters\n"); - fprintf(stdout,"-------------------\n"); - fprintf(stdout,"-h : Display this help information.\n"); - fprintf(stdout,"-n : Suppress all mj2_to_metadata notes.\n"); - fprintf(stdout,"-t : Include sample-size and chunk-offset tables.\n"); - fprintf(stdout,"-f n : where n > 0. Include jp2 header info for frame n [default=1].\n"); - fprintf(stdout,"-f 0 : No jp2 header info.\n"); - fprintf(stdout,"-r : Suppress all 'raw' data for which a 'derived' form exists.\n"); - fprintf(stdout,"-d : Suppress all 'derived' data.\n"); - fprintf(stdout," (If both -r and -d given, -r will be ignored.)\n"); - fprintf(stdout,"-v string : Verify against the DTD file located by the string.\n"); - fprintf(stdout," Prepend quoted 'string' with either SYSTEM or PUBLIC keyword.\n"); - fprintf(stdout," Thus, for the distributed DTD placed in the same directory as\n"); - fprintf(stdout," the output file: -v \"SYSTEM mj2_to_metadata.dtd\"\n"); - fprintf(stdout," \"PUBLIC\" is used with an access protocol (e.g., http:) + URL.\n"); - /* More to come */ - fprintf(stdout,"\n"); - /* "1234567890123456789012345678901234567890123456789012345678901234567890123456789" */ -} - -/* ------------- */ - -int main(int argc, char *argv[]) { - - opj_dinfo_t* dinfo; - opj_event_mgr_t event_mgr; /* event manager */ - - FILE *file, *xmlout; -/* char xmloutname[50]; */ - opj_mj2_t *movie; - - char* infile = 0; - char* outfile = 0; - char* s, S1, S2, S3; - int len; - unsigned int sampleframe = 1; /* First frame */ - char* stringDTD = NULL; - BOOL notes = TRUE; - BOOL sampletables = FALSE; - BOOL raw = TRUE; - BOOL derived = TRUE; - mj2_dparameters_t parameters; - - while (TRUE) { - /* ':' after letter means it takes an argument */ - int c = getopt(argc, argv, "i:o:f:v:hntrd"); - /* FUTURE: Reserve 'p' for pruning file (which will probably make -t redundant) */ - if (c == -1) - break; - switch (c) { - case 'i': /* IN file */ - infile = optarg; - s = optarg; - while (*s) { s++; } /* Run to filename end */ - s--; - S3 = *s; - s--; - S2 = *s; - s--; - S1 = *s; - - if ((S1 == 'm' && S2 == 'j' && S3 == '2') - || (S1 == 'M' && S2 == 'J' && S3 == '2')) { - break; - } - fprintf(stderr, "Input file name must have .mj2 extension, not .%c%c%c.\n", S1, S2, S3); - return 1; - - /* ----------------------------------------------------- */ - case 'o': /* OUT file */ - outfile = optarg; - while (*outfile) { outfile++; } /* Run to filename end */ - outfile--; - S3 = *outfile; - outfile--; - S2 = *outfile; - outfile--; - S1 = *outfile; - - outfile = optarg; - - if ((S1 == 'x' && S2 == 'm' && S3 == 'l') - || (S1 == 'X' && S2 == 'M' && S3 == 'L')) - break; - - fprintf(stderr, - "Output file name must have .xml extension, not .%c%c%c\n", S1, S2, S3); - return 1; - - /* ----------------------------------------------------- */ - case 'f': /* Choose sample frame. 0 = none */ - sscanf(optarg, "%u", &sampleframe); - break; - - /* ----------------------------------------------------- */ - case 'v': /* Verification by DTD. */ - stringDTD = optarg; - /* We will not insist upon last 3 chars being "dtd", since non-file - access protocol may be used. */ - if(strchr(stringDTD,'"') != NULL) { - fprintf(stderr, "-D's string must not contain any embedded double-quote characters.\n"); - return 1; - } - - if (strncmp(stringDTD,"PUBLIC ",7) == 0 || strncmp(stringDTD,"SYSTEM ",7) == 0) - break; - - fprintf(stderr, "-D's string must start with \"PUBLIC \" or \"SYSTEM \"\n"); - return 1; - - /* ----------------------------------------------------- */ - case 'n': /* Suppress comments */ - notes = FALSE; - break; - - /* ----------------------------------------------------- */ - case 't': /* Show sample size and chunk offset tables */ - sampletables = TRUE; - break; - - /* ----------------------------------------------------- */ - case 'h': /* Display an help description */ - help_display(); - return 0; - - /* ----------------------------------------------------- */ - case 'r': /* Suppress raw data */ - raw = FALSE; - break; - - /* ----------------------------------------------------- */ - case 'd': /* Suppress derived data */ - derived = FALSE; - break; - - /* ----------------------------------------------------- */ - default: - return 1; - } /* switch */ - } /* while */ - - if(!raw && !derived) - raw = TRUE; /* At least one of 'raw' and 'derived' must be true */ - - /* Error messages */ - /* -------------- */ - if (!infile || !outfile) { - fprintf(stderr,"Correct usage: mj2_to_metadata -i mj2-file -o xml-file (plus options)\n"); - return 1; - } - -/* was: - if (argc != 3) { - printf("Bad syntax: Usage: MJ2_to_metadata inputfile.mj2 outputfile.xml\n"); - printf("Example: MJ2_to_metadata foreman.mj2 foreman.xml\n"); - return 1; - } -*/ - len = strlen(infile); - if(infile[0] == ' ') - { - infile++; /* There may be a leading blank if user put space after -i */ - } - - file = fopen(infile, "rb"); /* was: argv[1] */ - - if (!file) { - fprintf(stderr, "Failed to open %s for reading.\n", infile); /* was: argv[1] */ - return 1; - } - - len = strlen(outfile); - if(outfile[0] == ' ') - { - outfile++; /* There may be a leading blank if user put space after -o */ - } - - // Checking output file - xmlout = fopen(outfile, "w"); /* was: argv[2] */ - if (!xmlout) { - fprintf(stderr, "Failed to open %s for writing.\n", outfile); /* was: argv[2] */ - return 1; - } - // Leave it open - - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* get a MJ2 decompressor handle */ - dinfo = mj2_create_decompress(); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); - - /* setup the decoder decoding parameters using user parameters */ - movie = (opj_mj2_t*) dinfo->mj2_handle; - mj2_setup_decoder(dinfo->mj2_handle, ¶meters); - - if (mj2_read_struct(file, movie)) // Creating the movie structure - { - fclose(xmlout); - return 1; - } - - xml_write_init(notes, sampletables, raw, derived); - xml_write_struct(file, xmlout, movie, sampleframe, stringDTD, &event_mgr); - fclose(xmlout); - - fprintf(stderr,"Metadata correctly extracted to XML file \n");; - - /* free remaining structures */ - if(dinfo) { - mj2_destroy_decompress((opj_mj2_t*)dinfo->mj2_handle); - } - - return 0; -} - - diff --git a/mj2/mj2_to_metadata.dsp b/mj2/mj2_to_metadata.dsp deleted file mode 100644 index 7b4e20fd..00000000 --- a/mj2/mj2_to_metadata.dsp +++ /dev/null @@ -1,140 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mj2_to_metadata" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mj2_to_metadata - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mj2_to_metadata.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mj2_to_metadata.mak" CFG="mj2_to_metadata - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mj2_to_metadata - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "mj2_to_metadata - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mj2_to_metadata - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmtd" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "mj2_to_metadata - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mj2_to_metadata___Win32_Debug0" -# PROP BASE Intermediate_Dir "mj2_to_metadata___Win32_Debug0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "mj2_to_metadata___Win32_Debug0" -# PROP Intermediate_Dir "mj2_to_metadata___Win32_Debug0" -# 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 /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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 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 /nodefaultlib:"libcmtd" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "mj2_to_metadata - Win32 Release" -# Name "mj2_to_metadata - Win32 Debug" -# Begin Group "MJ2" - -# PROP Default_Filter "" -# Begin Group "MJ2 Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\compat\getopt.h -# End Source File -# Begin Source File - -SOURCE=.\meta_out.h -# End Source File -# Begin Source File - -SOURCE=.\mj2.h -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.h -# End Source File -# Begin Source File - -SOURCE=.\mj2_to_metadata.h -# End Source File -# End Group -# Begin Group "MJ2 Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\compat\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\meta_out.c -# End Source File -# Begin Source File - -SOURCE=.\mj2.c -# End Source File -# Begin Source File - -SOURCE=.\mj2_convert.c -# End Source File -# Begin Source File - -SOURCE=.\mj2_to_metadata.c -# End Source File -# End Group -# End Group -# End Target -# End Project diff --git a/mj2/mj2_to_metadata.dsw b/mj2/mj2_to_metadata.dsw deleted file mode 100644 index f28254b4..00000000 --- a/mj2/mj2_to_metadata.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LibOpenJPEG"="..\LibOpenJPEG.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "mj2_to_metadata"=".\mj2_to_metadata.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name LibOpenJPEG - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/mj2/mj2_to_metadata.dtd b/mj2/mj2_to_metadata.dtd deleted file mode 100644 index 249de1a0..00000000 --- a/mj2/mj2_to_metadata.dtd +++ /dev/null @@ -1,425 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mj2/mj2_to_metadata.h b/mj2/mj2_to_metadata.h deleted file mode 100644 index f4c34919..00000000 --- a/mj2/mj2_to_metadata.h +++ /dev/null @@ -1,9 +0,0 @@ -/* mj2_to_metadata.h */ -/* Dump MJ2, JP2 metadata (partial so far) to xml file */ -/* Contributed to Open JPEG by Glenn Pearson, U.S. National Library of Medicine */ - -#define BOOL int -#define FALSE 0 -#define TRUE 1 - -#include "meta_out.h" diff --git a/mj2/mj2_to_metadata.sln b/mj2/mj2_to_metadata.sln deleted file mode 100644 index 32b926d4..00000000 --- a/mj2/mj2_to_metadata.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mj2_to_metadata", "mj2_to_metadata.vcproj", "{69BE42AB-E7CE-4DA1-BBD2-39FEA2C91E0B}" - ProjectSection(ProjectDependencies) = postProject - {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD} = {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "..\LibOpenJPEG.vcproj", "{0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {69BE42AB-E7CE-4DA1-BBD2-39FEA2C91E0B}.Debug|Win32.ActiveCfg = Debug|Win32 - {69BE42AB-E7CE-4DA1-BBD2-39FEA2C91E0B}.Debug|Win32.Build.0 = Debug|Win32 - {69BE42AB-E7CE-4DA1-BBD2-39FEA2C91E0B}.Release|Win32.ActiveCfg = Release|Win32 - {69BE42AB-E7CE-4DA1-BBD2-39FEA2C91E0B}.Release|Win32.Build.0 = Release|Win32 - {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD}.Debug|Win32.ActiveCfg = Debug|Win32 - {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD}.Debug|Win32.Build.0 = Debug|Win32 - {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD}.Release|Win32.ActiveCfg = Release|Win32 - {0B1B7713-35B6-40A7-9BFF-A7D0EB06A8BD}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/mj2/mj2_to_metadata.vcproj b/mj2/mj2_to_metadata.vcproj deleted file mode 100644 index 4207365c..00000000 --- a/mj2/mj2_to_metadata.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mj2/mj2_to_metadata_Notes.doc b/mj2/mj2_to_metadata_Notes.doc deleted file mode 100644 index 05ccec2068dd5bff73cf83aab716406f6c1db099..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35328 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 diff --git a/mj2/readme.txt b/mj2/readme.txt deleted file mode 100644 index 9419d2a2..00000000 --- a/mj2/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -Attention : the motion jpeg 2000 files currently only work with OpenJPEG v0.97 that you can find here : - -http://www.openjpeg.org/openjpeg_v097.tar.gz \ No newline at end of file diff --git a/mj2/wrap_j2k_in_mj2.c b/mj2/wrap_j2k_in_mj2.c deleted file mode 100644 index 92e0b157..00000000 --- a/mj2/wrap_j2k_in_mj2.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2003-2007, Francois-Olivier Devaux - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -#include "openjpeg.h" -#include "j2k.h" -#include "jp2.h" -#include "cio.h" -#include "mj2.h" - -static int int_ceildiv(int a, int b) { - return (a + b - 1) / b; -} - -/** -Size of memory first allocated for MOOV box -*/ -#define TEMP_BUF 10000 - - -/* -------------------------------------------------------------------------- */ - -/** -sample error callback expecting a FILE* client object -*/ -void error_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[ERROR] %s", msg); -} -/** -sample warning callback expecting a FILE* client object -*/ -void warning_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[WARNING] %s", msg); -} -/** -sample debug callback expecting a FILE* client object -*/ -void info_callback(const char *msg, void *client_data) { - FILE *stream = (FILE*)client_data; - fprintf(stream, "[INFO] %s", msg); -} - -/* -------------------------------------------------------------------------- */ - - - -static void read_siz_marker(FILE *file, opj_image_t *image) -{ - int len,i; - char buf, buf2[2]; - char *siz_buffer; - opj_cio_t *cio; - - fseek(file, 0, SEEK_SET); - do { - fread(&buf,1,1, file); - if (buf==(char)0xff) - fread(&buf,1,1, file); - } - while (!(buf==(char)0x51)); - - fread(buf2,2,1,file); /* Lsiz */ - len = ((buf2[0])<<8) + buf2[1]; - - siz_buffer = (char*) malloc(len * sizeof(char)); - fread(siz_buffer,len, 1, file); - cio = opj_cio_open(NULL, siz_buffer, len); - - cio_read(cio, 2); /* Rsiz (capabilities) */ - image->x1 = cio_read(cio, 4); /* Xsiz */ - image->y1 = cio_read(cio, 4); /* Ysiz */ - image->x0 = cio_read(cio, 4); /* X0siz */ - image->y0 = cio_read(cio, 4); /* Y0siz */ - cio_skip(cio, 16); /* XTsiz, YTsiz, XT0siz, YT0siz */ - - image->numcomps = cio_read(cio,2); /* Csiz */ - image->comps = - (opj_image_comp_t *) malloc(image->numcomps * sizeof(opj_image_comp_t)); - - for (i = 0; i < image->numcomps; i++) { - int tmp; - tmp = cio_read(cio,1); /* Ssiz_i */ - image->comps[i].prec = (tmp & 0x7f) + 1; - image->comps[i].sgnd = tmp >> 7; - image->comps[i].dx = cio_read(cio,1); /* XRsiz_i */ - image->comps[i].dy = cio_read(cio,1); /* YRsiz_i */ - image->comps[i].resno_decoded = 0; /* number of resolution decoded */ - image->comps[i].factor = 0; /* reducing factor by component */ - } - fseek(file, 0, SEEK_SET); - opj_cio_close(cio); -} - -static void setparams(opj_mj2_t *movie, opj_image_t *image) { - int i, depth_0, depth, sign; - - movie->tk[0].sample_rate = 25; - movie->tk[0].w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); - movie->tk[0].h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); - mj2_init_stdmovie(movie); - - movie->tk[0].depth = image->comps[0].prec; - - if (image->numcomps==3) { - if ((image->comps[0].dx == 1) - && (image->comps[1].dx == 1) - && (image->comps[2].dx == 1)) - movie->tk[0].CbCr_subsampling_dx = 1; - else - if ((image->comps[0].dx == 1) - && (image->comps[1].dx == 2) - && (image->comps[2].dx == 2)) - movie->tk[0].CbCr_subsampling_dx = 2; - else - fprintf(stderr,"Image component sizes are incoherent\n"); - - if ((image->comps[0].dy == 1) - && (image->comps[1].dy == 1) - && (image->comps[2].dy == 1)) - movie->tk[0].CbCr_subsampling_dy = 1; - else - if ((image->comps[0].dy == 1) - && (image->comps[1].dy == 2) - && (image->comps[2].dy == 2)) - movie->tk[0].CbCr_subsampling_dy = 2; - else - fprintf(stderr,"Image component sizes are incoherent\n"); - } - - movie->tk[0].sample_rate = 25; - - movie->tk[0].jp2_struct.numcomps = image->numcomps; // NC - - /* Init Standard jp2 structure */ - - movie->tk[0].jp2_struct.comps = - (opj_jp2_comps_t *) malloc(movie->tk[0].jp2_struct.numcomps * sizeof(opj_jp2_comps_t)); - movie->tk[0].jp2_struct.precedence = 0; /* PRECEDENCE*/ - movie->tk[0].jp2_struct.approx = 0; /* APPROX*/ - movie->tk[0].jp2_struct.brand = JP2_JP2; /* BR */ - movie->tk[0].jp2_struct.minversion = 0; /* MinV */ - movie->tk[0].jp2_struct.numcl = 1; - movie->tk[0].jp2_struct.cl = (unsigned int *) malloc(movie->tk[0].jp2_struct.numcl * sizeof(int)); - movie->tk[0].jp2_struct.cl[0] = JP2_JP2; /* CL0 : JP2 */ - movie->tk[0].jp2_struct.C = 7; /* C : Always 7*/ - movie->tk[0].jp2_struct.UnkC = 0; /* UnkC, colorspace specified in colr box*/ - movie->tk[0].jp2_struct.IPR = 0; /* IPR, no intellectual property*/ - movie->tk[0].jp2_struct.w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); - movie->tk[0].jp2_struct.h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); - - depth_0 = image->comps[0].prec - 1; - sign = image->comps[0].sgnd; - movie->tk[0].jp2_struct.bpc = depth_0 + (sign << 7); - - for (i = 1; i < image->numcomps; i++) { - depth = image->comps[i].prec - 1; - sign = image->comps[i].sgnd; - if (depth_0 != depth) - movie->tk[0].jp2_struct.bpc = 255; - } - - for (i = 0; i < image->numcomps; i++) - movie->tk[0].jp2_struct.comps[i].bpcc = - image->comps[i].prec - 1 + (image->comps[i].sgnd << 7); - - if ((image->numcomps == 1 || image->numcomps == 3) - && (movie->tk[0].jp2_struct.bpc != 255)) - movie->tk[0].jp2_struct.meth = 1; - else - movie->tk[0].jp2_struct.meth = 2; - - if (image->numcomps == 1) - movie->tk[0].jp2_struct.enumcs = 17; // Grayscale - - else - if ((image->comps[0].dx == 1) - && (image->comps[1].dx == 1) - && (image->comps[2].dx == 1) - && (image->comps[0].dy == 1) - && (image->comps[1].dy == 1) - && (image->comps[2].dy == 1)) - movie->tk[0].jp2_struct.enumcs = 16; // RGB - - else - if ((image->comps[0].dx == 1) - && (image->comps[1].dx == 2) - && (image->comps[2].dx == 2) - && (image->comps[0].dy == 1) - && (image->comps[1].dy == 2) - && (image->comps[2].dy == 2)) - movie->tk[0].jp2_struct.enumcs = 18; // YUV - - else - movie->tk[0].jp2_struct.enumcs = 0; // Unkown profile */ -} - -int main(int argc, char *argv[]) { - opj_cinfo_t* cinfo; - opj_event_mgr_t event_mgr; /* event manager */ - unsigned int snum; - opj_mj2_t *movie; - mj2_sample_t *sample; - unsigned char* frame_codestream; - FILE *mj2file, *j2kfile; - char j2kfilename[50]; - char *buf; - int offset, mdat_initpos; - opj_image_t img; - opj_cio_t *cio; - mj2_cparameters_t parameters; - - if (argc != 3) { - printf("Bad syntax: Usage: MJ2_Wrapper source_location mj2_filename\n"); - printf("Example: MJ2_Wrapper input/input output.mj2\n"); - return 1; - } - - mj2file = fopen(argv[2], "wb"); - - if (!mj2file) { - fprintf(stderr, "failed to open %s for writing\n", argv[2]); - return 1; - } - - /* - configure the event callbacks (not required) - setting of each callback is optionnal - */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* get a MJ2 decompressor handle */ - cinfo = mj2_create_compress(); - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); - - /* setup the decoder encoding parameters using user parameters */ - movie = (opj_mj2_t*) cinfo->mj2_handle; - mj2_setup_encoder(cinfo->mj2_handle, ¶meters); - - - /* Writing JP, FTYP and MDAT boxes - Assuming that the JP and FTYP boxes won't be longer than 300 bytes */ - - buf = (char*) malloc (300 * sizeof(char)); - cio = opj_cio_open(movie->cinfo, buf, 300); - mj2_write_jp(cio); - mj2_write_ftyp(movie, cio); - mdat_initpos = cio_tell(cio); - cio_skip(cio, 4); - cio_write(cio,MJ2_MDAT, 4); - fwrite(buf,cio_tell(cio),1,mj2file); - free(buf); - - // Insert each j2k codestream in a JP2C box - snum=0; - offset = 0; - while(1) - { - sample = &movie->tk[0].sample[snum]; - sprintf(j2kfilename,"%s_%05d.j2k",argv[1],snum); - j2kfile = fopen(j2kfilename, "rb"); - if (!j2kfile) { - if (snum==0) { // Could not open a single codestream - fprintf(stderr, "failed to open %s for reading\n",j2kfilename); - return 1; - } - else { // Tried to open a inexistant codestream - fprintf(stdout,"%d frames are being added to the MJ2 file\n",snum); - break; - } - } - - // Calculating offset for samples and chunks - offset += cio_tell(cio); - sample->offset = offset; - movie->tk[0].chunk[snum].offset = offset; // There will be one sample per chunk - - // Calculating sample size - fseek(j2kfile,0,SEEK_END); - sample->sample_size = ftell(j2kfile) + 8; // Sample size is codestream + JP2C box header - fseek(j2kfile,0,SEEK_SET); - - // Reading siz marker of j2k image for the first codestream - if (snum==0) - read_siz_marker(j2kfile, &img); - - // Writing JP2C box header - frame_codestream = (unsigned char*) malloc (sample->sample_size+8); - cio = opj_cio_open(movie->cinfo, frame_codestream, sample->sample_size); - cio_write(cio,sample->sample_size, 4); // Sample size - cio_write(cio,JP2_JP2C, 4); // JP2C - - // Writing codestream from J2K file to MJ2 file - fread(frame_codestream+8,sample->sample_size-8,1,j2kfile); - fwrite(frame_codestream,sample->sample_size,1,mj2file); - cio_skip(cio, sample->sample_size-8); - - // Ending loop - fclose(j2kfile); - snum++; - movie->tk[0].sample = realloc(movie->tk[0].sample, (snum+1) * sizeof(mj2_sample_t)); - movie->tk[0].chunk = realloc(movie->tk[0].chunk, (snum+1) * sizeof(mj2_chunk_t)); - free(frame_codestream); - } - - // Writing the MDAT box length in header - offset += cio_tell(cio); - buf = (char*) malloc (4 * sizeof(char)); - cio = opj_cio_open(movie->cinfo, buf, 4); - cio_write(cio,offset-mdat_initpos,4); - fseek(mj2file,(long)mdat_initpos,SEEK_SET); - fwrite(buf,4,1,mj2file); - fseek(mj2file,0,SEEK_END); - free(buf); - - // Setting movie parameters - movie->tk[0].num_samples=snum; - movie->tk[0].num_chunks=snum; - setparams(movie, &img); - - // Writing MOOV box - buf = (char*) malloc ((TEMP_BUF+snum*20) * sizeof(char)); - cio = opj_cio_open(movie->cinfo, buf, (TEMP_BUF+snum*20)); - mj2_write_moov(movie, cio); - fwrite(buf,cio_tell(cio),1,mj2file); - - // Ending program - fclose(mj2file); - free(img.comps); - opj_cio_close(cio); - mj2_destroy_compress(movie); - - return 0; -}