├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── abi_check.yml │ ├── build.yml │ ├── cifuzz.yml │ └── code_style.yml ├── .gitignore ├── .travis.yml ├── AUTHORS.md ├── CHANGELOG.md ├── CMakeLists.txt ├── CTestConfig.cmake ├── HOWTO-RELEASE ├── INSTALL.md ├── LICENSE ├── NEWS.md ├── README.md ├── THANKS.md ├── appveyor.yml ├── cmake ├── CTestCustom.cmake.in ├── EnsureFileInclude.cmake ├── FindCPPCHECK.cmake ├── FindFCGI.cmake ├── FindJPYLYZER.cmake ├── FindKAKADU.cmake ├── FindLCMS.cmake ├── FindLCMS2.cmake ├── JPIPTestDriver.cmake ├── OpenJPEGCPack.cmake ├── OpenJPEGConfig.cmake.in ├── TestFileOffsetBits.c ├── TestLargeFiles.c.cmake.in ├── TestLargeFiles.cmake ├── TestWindowsFSeek.c └── openjpeg_valgrind.supp ├── doc ├── CMakeLists.txt ├── Doxyfile.dox.cmake.in ├── jpip_architect.png ├── jpip_protocol.png ├── mainpage.dox.in ├── man │ ├── man1 │ │ ├── opj_compress.1 │ │ ├── opj_decompress.1 │ │ └── opj_dump.1 │ └── man3 │ │ └── libopenjp2.3 └── openjpip.dox.in ├── scripts ├── astyle.options ├── astyle.sh ├── prepare-commit.sh ├── remove_temporary_files.sh └── verify-indentation.sh ├── src ├── CMakeLists.txt ├── bin │ ├── CMakeLists.txt │ ├── common │ │ ├── CMakeLists.txt │ │ ├── color.c │ │ ├── color.h │ │ ├── format_defs.h │ │ ├── opj_apps_config.h.cmake.in │ │ ├── opj_getopt.c │ │ ├── opj_getopt.h │ │ └── opj_string.h │ ├── jp2 │ │ ├── CMakeLists.txt │ │ ├── convert.c │ │ ├── convert.h │ │ ├── convertbmp.c │ │ ├── convertpng.c │ │ ├── converttif.c │ │ ├── index.c │ │ ├── index.h │ │ ├── opj_compress.c │ │ ├── opj_decompress.c │ │ ├── opj_dump.c │ │ └── windirent.h │ ├── jpip │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── opj_dec_server.c │ │ ├── opj_jpip_addxml.c │ │ ├── opj_jpip_test.c │ │ ├── opj_jpip_transcode.c │ │ ├── opj_server.c │ │ ├── opj_viewer │ │ │ ├── dist │ │ │ │ └── manifest.txt │ │ │ └── src │ │ │ │ ├── ImageManager.java │ │ │ │ ├── ImageViewer.java │ │ │ │ ├── ImageWindow.java │ │ │ │ ├── ImgdecClient.java │ │ │ │ ├── JPIPHttpClient.java │ │ │ │ ├── MML.java │ │ │ │ ├── PnmImage.java │ │ │ │ ├── RegimViewer.java │ │ │ │ └── ResizeListener.java │ │ └── opj_viewer_xerces │ │ │ ├── dist │ │ │ └── manifest.txt.in │ │ │ └── src │ │ │ ├── ImageViewer.java │ │ │ ├── ImageWindow.java │ │ │ ├── JP2XMLparser.java │ │ │ └── OptionPanel.java │ └── wx │ │ ├── CMakeLists.txt │ │ └── OPJViewer │ │ ├── CMakeLists.txt │ │ ├── OPJViewer.iss │ │ ├── Readme.txt │ │ ├── about │ │ ├── about.htm │ │ └── opj_logo.png │ │ └── source │ │ ├── OPJAbout.cpp │ │ ├── OPJChild.ico │ │ ├── OPJChild16.xpm │ │ ├── OPJDialogs.cpp │ │ ├── OPJThreads.cpp │ │ ├── OPJViewer.cpp │ │ ├── OPJViewer.h │ │ ├── OPJViewer.ico │ │ ├── OPJViewer.rc │ │ ├── OPJViewer16.xpm │ │ ├── about_htm.h │ │ ├── build.h │ │ ├── icon1.xpm │ │ ├── icon2.xpm │ │ ├── icon3.xpm │ │ ├── icon4.xpm │ │ ├── icon5.xpm │ │ ├── imagjpeg2000.cpp │ │ ├── imagjpeg2000.h │ │ ├── imagmxf.cpp │ │ ├── imagmxf.h │ │ ├── license.txt │ │ ├── opj_logo.xpm │ │ ├── readmeafter.txt │ │ ├── readmebefore.txt │ │ ├── wxj2kparser.cpp │ │ └── wxjp2parser.cpp └── lib │ ├── CMakeLists.txt │ ├── openjp2 │ ├── CMakeLists.txt │ ├── bench_dwt.c │ ├── bio.c │ ├── bio.h │ ├── cidx_manager.c │ ├── cidx_manager.h │ ├── cio.c │ ├── cio.h │ ├── dwt.c │ ├── dwt.h │ ├── event.c │ ├── event.h │ ├── function_list.c │ ├── function_list.h │ ├── ht_dec.c │ ├── image.c │ ├── image.h │ ├── indexbox_manager.h │ ├── invert.c │ ├── invert.h │ ├── j2k.c │ ├── j2k.h │ ├── jp2.c │ ├── jp2.h │ ├── libopenjp2.pc.cmake.in │ ├── mct.c │ ├── mct.h │ ├── mqc.c │ ├── mqc.h │ ├── mqc_inl.h │ ├── openjpeg.c │ ├── openjpeg.h │ ├── opj_clock.c │ ├── opj_clock.h │ ├── opj_codec.h │ ├── opj_common.h │ ├── opj_config.h.cmake.in │ ├── opj_config_private.h.cmake.in │ ├── opj_includes.h │ ├── opj_intmath.h │ ├── opj_inttypes.h │ ├── opj_malloc.c │ ├── opj_malloc.h │ ├── opj_stdint.h │ ├── phix_manager.c │ ├── pi.c │ ├── pi.h │ ├── ppix_manager.c │ ├── sparse_array.c │ ├── sparse_array.h │ ├── t1.c │ ├── t1.h │ ├── t1_generate_luts.c │ ├── t1_ht_generate_luts.c │ ├── t1_ht_luts.h │ ├── t1_luts.h │ ├── t2.c │ ├── t2.h │ ├── tcd.c │ ├── tcd.h │ ├── test_sparse_array.c │ ├── tgt.c │ ├── tgt.h │ ├── thix_manager.c │ ├── thread.c │ ├── thread.h │ ├── tls_keys.h │ └── tpix_manager.c │ └── openjpip │ ├── CMakeLists.txt │ ├── auxtrans_manager.c │ ├── auxtrans_manager.h │ ├── box_manager.c │ ├── box_manager.h │ ├── boxheader_manager.c │ ├── boxheader_manager.h │ ├── byte_manager.c │ ├── byte_manager.h │ ├── cache_manager.c │ ├── cache_manager.h │ ├── cachemodel_manager.c │ ├── cachemodel_manager.h │ ├── channel_manager.c │ ├── channel_manager.h │ ├── codestream_manager.c │ ├── codestream_manager.h │ ├── dec_clientmsg_handler.c │ ├── dec_clientmsg_handler.h │ ├── faixbox_manager.c │ ├── faixbox_manager.h │ ├── ihdrbox_manager.c │ ├── ihdrbox_manager.h │ ├── imgreg_manager.c │ ├── imgreg_manager.h │ ├── imgsock_manager.c │ ├── imgsock_manager.h │ ├── index_manager.c │ ├── index_manager.h │ ├── j2kheader_manager.c │ ├── j2kheader_manager.h │ ├── jp2k_decoder.c │ ├── jp2k_decoder.h │ ├── jp2k_encoder.c │ ├── jp2k_encoder.h │ ├── jpip_parser.c │ ├── jpip_parser.h │ ├── jpipstream_manager.c │ ├── jpipstream_manager.h │ ├── libopenjpip.pc.cmake.in │ ├── manfbox_manager.c │ ├── manfbox_manager.h │ ├── marker_manager.c │ ├── marker_manager.h │ ├── metadata_manager.c │ ├── metadata_manager.h │ ├── mhixbox_manager.c │ ├── mhixbox_manager.h │ ├── msgqueue_manager.c │ ├── msgqueue_manager.h │ ├── openjpip.c │ ├── openjpip.h │ ├── placeholder_manager.c │ ├── placeholder_manager.h │ ├── query_parser.c │ ├── query_parser.h │ ├── session_manager.c │ ├── session_manager.h │ ├── sock_manager.c │ ├── sock_manager.h │ ├── target_manager.c │ └── target_manager.h ├── tests ├── CMakeLists.txt ├── compare_dump_files.c ├── compare_images.c ├── compare_raw_files.c ├── conformance │ └── CMakeLists.txt ├── fuzzers │ ├── GNUmakefile │ ├── README.TXT │ ├── build_google_oss_fuzzers.sh │ ├── build_seed_corpus.sh │ ├── fuzzingengine.c │ ├── opj_decompress_fuzzer_J2K.cpp │ └── opj_decompress_fuzzer_JP2.cpp ├── include_openjpeg.c ├── j2k_random_tile_access.c ├── nonregression │ ├── CMakeLists.txt │ ├── checkmd5refs.cmake │ ├── md5refs.txt │ └── test_suite.ctest.in ├── pdf2jp2.c ├── performance │ ├── compare_perfs.py │ ├── perf_test.py │ └── perf_test_filelist.csv ├── ppm2rgb3.c ├── profiling │ └── filter_massif_output.py ├── test_decode_area.c ├── test_tile_decoder.c ├── test_tile_encoder.c └── unit │ ├── CMakeLists.txt │ ├── testempty0.c │ ├── testempty1.c │ └── testempty2.c ├── thirdparty ├── CMakeLists.txt ├── README.txt ├── astyle │ ├── ASBeautifier.cpp │ ├── ASEnhancer.cpp │ ├── ASFormatter.cpp │ ├── ASLocalizer.cpp │ ├── ASLocalizer.h │ ├── ASResource.cpp │ ├── CMakeLists.txt │ ├── LICENSE.md │ ├── astyle.h │ ├── astyle_main.cpp │ └── astyle_main.h ├── include │ ├── zconf.h │ └── zlib.h ├── liblcms2 │ ├── CMakeLists.txt │ ├── COPYING │ ├── include │ │ ├── lcms2.h │ │ └── lcms2_plugin.h │ └── src │ │ ├── cmsalpha.c │ │ ├── cmscam02.c │ │ ├── cmscgats.c │ │ ├── cmscnvrt.c │ │ ├── cmserr.c │ │ ├── cmsgamma.c │ │ ├── cmsgmt.c │ │ ├── cmshalf.c │ │ ├── cmsintrp.c │ │ ├── cmsio0.c │ │ ├── cmsio1.c │ │ ├── cmslut.c │ │ ├── cmsmd5.c │ │ ├── cmsmtrx.c │ │ ├── cmsnamed.c │ │ ├── cmsopt.c │ │ ├── cmspack.c │ │ ├── cmspcs.c │ │ ├── cmsplugin.c │ │ ├── cmsps2.c │ │ ├── cmssamp.c │ │ ├── cmssm.c │ │ ├── cmstypes.c │ │ ├── cmsvirt.c │ │ ├── cmswtpnt.c │ │ ├── cmsxform.c │ │ └── lcms2_internal.h ├── libpng │ ├── CMakeLists.txt │ ├── LICENSE │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pngmem.c │ ├── pngpread.c │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtrans.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── libtiff │ ├── CMakeLists.txt │ ├── libport.h │ ├── libtiff.def │ ├── snprintf.c │ ├── t4.h │ ├── test_inline.c │ ├── tif_aux.c │ ├── tif_close.c │ ├── tif_codec.c │ ├── tif_color.c │ ├── tif_compress.c │ ├── tif_config.h.cmake.in │ ├── tif_config.h.in │ ├── tif_dir.c │ ├── tif_dir.h │ ├── tif_dirinfo.c │ ├── tif_dirread.c │ ├── tif_dirwrite.c │ ├── tif_dumpmode.c │ ├── tif_error.c │ ├── tif_extension.c │ ├── tif_fax3.c │ ├── tif_fax3.h │ ├── tif_fax3sm.c │ ├── tif_flush.c │ ├── tif_getimage.c │ ├── tif_jbig.c │ ├── tif_jpeg.c │ ├── tif_jpeg_12.c │ ├── tif_luv.c │ ├── tif_lzma.c │ ├── tif_lzw.c │ ├── tif_next.c │ ├── tif_ojpeg.c │ ├── tif_open.c │ ├── tif_packbits.c │ ├── tif_pixarlog.c │ ├── tif_predict.c │ ├── tif_predict.h │ ├── tif_print.c │ ├── tif_read.c │ ├── tif_stream.cxx │ ├── tif_strip.c │ ├── tif_swab.c │ ├── tif_thunder.c │ ├── tif_tile.c │ ├── tif_unix.c │ ├── tif_version.c │ ├── tif_warning.c │ ├── tif_win32.c │ ├── tif_write.c │ ├── tif_zip.c │ ├── tiff.h │ ├── tiffconf.h.cmake.in │ ├── tiffconf.h.in │ ├── tiffio.h │ ├── tiffio.hxx │ ├── tiffiop.h │ ├── tiffvers.h │ └── uvcode.h └── libz │ ├── CMakeLists.txt │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── tools ├── abi-tracker │ └── openjpeg.json ├── ctest_scripts │ ├── toolchain-mingw32.cmake │ ├── toolchain-mingw64.cmake │ └── travis-ci.cmake └── travis-ci │ ├── abi-check.sh │ ├── detect-avx2.c │ ├── install.sh │ ├── knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt │ ├── knownfailures-Ubuntu20.04-clang10.0.0-i386-Release-3rdP.txt │ ├── knownfailures-Ubuntu20.04-gcc9.4.0-x86_64-Release-3rdP.txt │ ├── knownfailures-all.txt │ ├── knownfailures-windows-vs2010-x86-Release-3rdP.txt │ ├── knownfailures-windows-vs2015-x64-avx2-Release-3rdP.txt │ ├── run.sh │ └── travis_rsa.enc └── wrapping ├── CMakeLists.txt └── java ├── CMakeLists.txt └── openjp2 ├── CMakeLists.txt ├── JavaOpenJPEG.c ├── JavaOpenJPEGDecoder.c ├── index.c ├── index.h ├── java-sources └── org │ └── openJpeg │ ├── OpenJPEGJavaDecoder.java │ └── OpenJPEGJavaEncoder.java ├── org_openJpeg_OpenJPEGJavaDecoder.h └── org_openJpeg_OpenJPEGJavaEncoder.h /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 15 | 16 | ## Expected behavior and actual behavior. 17 | 18 | ...to fill... 19 | 20 | ## Steps to reproduce the problem. 21 | 22 | ...to fill... 23 | 24 | ## Operating system 25 | 26 | ...to fill... 27 | 28 | ## openjpeg version 29 | 30 | ...to fill... 31 | -------------------------------------------------------------------------------- /.github/workflows/abi_check.yml: -------------------------------------------------------------------------------- 1 | name: ABI check 2 | 3 | on: [push, pull_request, workflow_dispatch] 4 | 5 | jobs: 6 | abi_check: 7 | runs-on: ubuntu-latest 8 | if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | 13 | - name: Install Requirements 14 | run: | 15 | sudo apt update 16 | sudo apt install -y gcc g++ libelf-dev elfutils texinfo exuberant-ctags libtiff-dev libwebp-dev libzstd-dev 17 | 18 | - name: Build 19 | run: | 20 | ./tools/travis-ci/install.sh 21 | ./tools/travis-ci/run.sh 22 | ./tools/travis-ci/abi-check.sh 23 | env: 24 | OPJ_CI_ABI_CHECK: 1 25 | -------------------------------------------------------------------------------- /.github/workflows/cifuzz.yml: -------------------------------------------------------------------------------- 1 | name: CIFuzz 2 | on: [pull_request] 3 | jobs: 4 | Fuzzing: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Build Fuzzers 8 | id: build 9 | uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master 10 | with: 11 | oss-fuzz-project-name: 'openjpeg' 12 | dry-run: false 13 | language: c 14 | - name: Run Fuzzers 15 | uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master 16 | with: 17 | oss-fuzz-project-name: 'openjpeg' 18 | fuzz-seconds: 600 19 | dry-run: false 20 | language: c 21 | - name: Upload Crash 22 | uses: actions/upload-artifact@v1 23 | if: failure() && steps.build.outcome == 'success' 24 | with: 25 | name: artifacts 26 | path: ./out/artifacts 27 | -------------------------------------------------------------------------------- /.github/workflows/code_style.yml: -------------------------------------------------------------------------------- 1 | name: Code Style 2 | 3 | on: [push, pull_request, workflow_dispatch] 4 | 5 | jobs: 6 | code_style: 7 | runs-on: ubuntu-latest 8 | if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Install Requirements 16 | run: | 17 | sudo apt update 18 | sudo apt install -y gcc g++ flip 19 | 20 | - name: Run check 21 | run: | 22 | ./tools/travis-ci/install.sh 23 | ./tools/travis-ci/run.sh 24 | env: 25 | OPJ_CI_CHECK_STYLE: 1 26 | OPJ_CI_SKIP_TESTS: 1 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore files and directories made by `cmake .`. 2 | CMakeFiles/ 3 | Makefile 4 | cmake_install.cmake 5 | /CMakeCache.txt 6 | /CPackConfig.cmake 7 | /CPackSourceConfig.cmake 8 | /CTestCustom.cmake 9 | /LICENSE.txt 10 | /OpenJPEGConfig.cmake 11 | /libopenjp2.pc 12 | /src/bin/common/opj_apps_config.h 13 | /src/lib/openjp2/opj_config.h 14 | /src/lib/openjp2/opj_config_private.h 15 | scripts/opjstyle* 16 | 17 | # Ignore directories made by `make`. 18 | /bin/ 19 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Authors of OpenJPEG 2 | See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md) 3 | 4 | David Janssens designed and implemented the first version of OpenJPEG. 5 | 6 | Kaori Hagihara designed and implemented the first version of OpenJPIP. 7 | 8 | Jerome Fimes implemented the alpha version of OpenJPEG 2.0. 9 | 10 | Giuseppe Baruffa added the JPWL functionalities. 11 | 12 | Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0. 13 | 14 | Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities. 15 | 16 | Yannick Verschueren, 17 | Herve Drolon, 18 | Francois-Olivier Devaux, 19 | Antonin Descampe 20 | improved the libraries and utilities. 21 | 22 | -------------------------------------------------------------------------------- /CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | set(CTEST_PROJECT_NAME "OPENJPEG") 2 | set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC") 3 | 4 | set(CTEST_DROP_METHOD "http") 5 | set(CTEST_DROP_SITE "my.cdash.org") 6 | set(CTEST_DROP_LOCATION "/submit.php?project=OPENJPEG") 7 | set(CTEST_DROP_SITE_CDASH TRUE) 8 | -------------------------------------------------------------------------------- /HOWTO-RELEASE: -------------------------------------------------------------------------------- 1 | Check-list OpenJPEG Release 2 | 3 | * update MAJOR, MINOR, BUILD, SOVERSION in CMakeLists.txt 4 | * update MAJOR, MINOR, BUILD in appveyor.yml 5 | * update CHANGELOG with 6 | `github_changelog_generator --token TOKEN_HERE --exclude-labels gcode_fixed,OpjVersion-1.x --release-url "https://github.com/uclouvain/openjpeg/releases/%s" --since-tag v2.3.1 --future-release v2.4.0 --output append2changelog.md --user uclouvain --project openjpeg --exclude-tags version.1.0` . TOKEN_HERE is created at https://github.com/settings/tokens 7 | * update NEWS.md 8 | * git tag -a v2.4.0 -m "OpenJPEG v2.4.0 release" 9 | * git push origin --tags 10 | * add post to OpenJPEG website in gh-pages branch in _posts/ subdirectory. See commit https://github.com/uclouvain/openjpeg/commit/6563d704f5fb896209dd862ccfc6b97eb9183c5c 11 | * change binversion of openjpeg website in _config.yml in gh-pages branch 12 | * update release description if needed 13 | * update openjpeg.json with latest release 14 | * update OPJ_LATEST_VERSION in abi-check.sh, uncomment and update OPJ_PREVIOUS_VERSION in abi-check.sh, and push 15 | * locally run: OPJ_CI_ABI_CHECK=1 ./tools/travis-ci/abi-check.sh 16 | * cd ~/abi-check/work/abi-check/ 17 | * put the sources of the new version in src/openjpeg/2.X.0/version.-2.X.0.tar.gz 18 | * PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-monitor -v 2.X.0 -build ./openjpeg.json 19 | * PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-tracker -build ./openjpeg.json 20 | * rm -rf src/openjpeg/current 21 | * rm -rf build_logs 22 | * git add --all . 23 | * git commit -m "Update ABI/API compatibility reports after 2.X.0 release" 24 | * git push 25 | * cd ~/openjpeg/openjpeg 26 | * comment back OPJ_PREVIOUS_VERSION and push 27 | * build doc and update Doxygen on website 28 | * manual build on Windows: 29 | - cmake .. -G "Visual Studio 15 2017" -A x64 -DCMAKE_CONFIGURATION_TYPES=Release -DBUILD_THIRDPARTY=ON -D CPACK_GENERATOR:STRING=ZIP -D CPACK_PACKAGE_FILE_NAME:STRING=openjpeg-v2.4.0-windows-x64 30 | - cmake --build . --target package --config Release 31 | * send email to ML opj, comp.compression, iiif 32 | * tweet 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 8 | * Copyright (c) 2002-2014, Professor Benoit Macq 9 | * Copyright (c) 2003-2014, Antonin Descampe 10 | * Copyright (c) 2003-2009, Francois-Olivier Devaux 11 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 12 | * Copyright (c) 2002-2003, Yannick Verschueren 13 | * Copyright (c) 2001-2003, David Janssens 14 | * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France 15 | * Copyright (c) 2012, CS Systemes d'Information, France 16 | * 17 | * All rights reserved. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions 21 | * are met: 22 | * 1. Redistributions of source code must retain the above copyright 23 | * notice, this list of conditions and the following disclaimer. 24 | * 2. Redistributions in binary form must reproduce the above copyright 25 | * notice, this list of conditions and the following disclaimer in the 26 | * documentation and/or other materials provided with the distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 32 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | -------------------------------------------------------------------------------- /THANKS.md: -------------------------------------------------------------------------------- 1 | # OpenJPEG THANKS file 2 | 3 | Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements, 4 | or submitting actual code. Here is a list of these people. Help me keep 5 | it complete and exempt of errors. 6 | 7 | * Giuseppe Baruffa 8 | * Ben Boeckel 9 | * Aaron Boxer 10 | * David Burken 11 | * Matthieu Darbois 12 | * Rex Dieter 13 | * Herve Drolon 14 | * Antonin Descampe 15 | * Francois-Olivier Devaux 16 | * Parvatha Elangovan 17 | * Jerôme Fimes 18 | * Bob Friesenhahn 19 | * Kaori Hagihara 20 | * Luc Hermitte 21 | * Luis Ibanez 22 | * David Janssens 23 | * Hans Johnson 24 | * Callum Lerwick 25 | * Ke Liu (Tencent's Xuanwu LAB) 26 | * Sebastien Lugan 27 | * Benoit Macq 28 | * Mathieu Malaterre 29 | * Julien Malik 30 | * Arnaud Maye 31 | * Vincent Nicolas 32 | * Aleksander Nikolic (Cisco Talos) 33 | * Glenn Pearson 34 | * Even Rouault 35 | * Dzonatas Sol 36 | * Winfried Szukalski 37 | * Vincent Torri 38 | * Yannick Verschueren 39 | * Peter Wimmer 40 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 2.5.0.{build} 2 | branches: 3 | except: 4 | - coverity_scan 5 | skip_tags: false 6 | clone_depth: 50 7 | environment: 8 | matrix: 9 | - OPJ_CI_ARCH: x64 10 | OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS) 11 | OPJ_CI_INSTRUCTION_SETS: "/arch:AVX2" 12 | - OPJ_CI_ARCH: x86 13 | OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS) 14 | OPJ_CI_INCLUDE_IF_DEPLOY: 1 15 | - OPJ_CI_ARCH: x64 16 | OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS) 17 | OPJ_CI_INCLUDE_IF_DEPLOY: 1 18 | - OPJ_CI_ARCH: x86 19 | OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS) 20 | install: 21 | - cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh 22 | build_script: 23 | - cmd: >- 24 | "%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH% 25 | 26 | bash ./tools/travis-ci/run.sh 27 | test: off 28 | #before_deploy: 29 | #- cmd: c:\cygwin\bin\bash ./tools/travis-ci/before_deploy.sh 30 | #deploy: 31 | # #release: openjpeg-$(appveyor_repo_tag_name) 32 | # description: 'OpenJPEG $(appveyor_repo_tag_name) has been released. More info [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/NEWS) and a detailed view [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/CHANGES).' 33 | # provider: GitHub 34 | # auth_token: 35 | # secure: XUL+IoRRw8U/4tupa/fMpinxurft7WRQHZiWHMLO5iuFbwZ+C3vCjVVVM+5Ebky7 # your encrypted token from GitHub 36 | # artifact: /.*\.zip/ # upload all zip packages to release assets 37 | # draft: true 38 | # prerelease: false 39 | # on: 40 | # appveyor_repo_tag: true # deploy on tag push only 41 | # OPJ_CI_INCLUDE_IF_DEPLOY: 1 42 | -------------------------------------------------------------------------------- /cmake/CTestCustom.cmake.in: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------- 2 | # 3 | # For further details regarding this file, 4 | # see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest 5 | # 6 | # and 7 | # http://www.kitware.com/blog/home/post/27 8 | # 9 | #---------------------------------------------------------------------- 10 | 11 | set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000) 12 | set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50) 13 | set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000) 14 | 15 | set(CTEST_CUSTOM_COVERAGE_EXCLUDE 16 | ${CTEST_CUSTOM_COVERAGE_EXCLUDE} 17 | 18 | # Exclude files from the Testing directories 19 | ".*/tests/.*" 20 | 21 | # Exclude files from the ThirdParty Utilities directories 22 | ".*/thirdparty/.*" 23 | ) 24 | 25 | set(CTEST_CUSTOM_WARNING_EXCEPTION 26 | ${CTEST_CUSTOM_WARNING_EXCEPTION} 27 | 28 | # Ignore clang's summary warning, assuming prior text has matched some 29 | # other warning expression: 30 | "[0-9,]+ warnings? generated." 31 | # Suppress warning caused by intentional messages about deprecation 32 | ".*warning,.* is deprecated" 33 | # java also warns about deprecated API 34 | ".*java.*deprecation" 35 | ".*deprecation.*" 36 | # suppress warnings caused by 3rd party libs: 37 | ".*thirdparty.*" 38 | "libtiff.*has no symbols" 39 | "libpng.*has no symbols" 40 | ) 41 | -------------------------------------------------------------------------------- /cmake/EnsureFileInclude.cmake: -------------------------------------------------------------------------------- 1 | # Ensure that an include file is provided by the system 2 | # Add the check about the mandatory status to the check_include_file macro 3 | # provided by cmake 4 | 5 | include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) 6 | 7 | macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS) 8 | 9 | #message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n" 10 | # "VARIABLE_NAME=${VARIABLE_NAME} \n" 11 | # "MANDATORY_STATUS=${MANDATORY_STATUS}") 12 | 13 | CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME}) 14 | 15 | #message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n" 16 | # "VARIABLE_NAME=${VARIABLE_NAME} \n" 17 | # "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n" 18 | # "MANDATORY_STATUS=${MANDATORY_STATUS}") 19 | 20 | if (NOT ${${VARIABLE_NAME}}) 21 | if (${MANDATORY_STATUS}) 22 | message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system") 23 | endif() 24 | endif() 25 | 26 | endmacro() 27 | -------------------------------------------------------------------------------- /cmake/FindCPPCHECK.cmake: -------------------------------------------------------------------------------- 1 | # cppcheck 2 | # 3 | # Copyright (c) 2011 Mathieu Malaterre 4 | # 5 | # Redistribution and use is allowed according to the terms of the New 6 | # BSD license. 7 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 8 | # 9 | 10 | find_program(CPPCHECK_EXECUTABLE 11 | cppcheck 12 | ) 13 | 14 | mark_as_advanced( 15 | CPPCHECK_EXECUTABLE 16 | ) 17 | -------------------------------------------------------------------------------- /cmake/FindFCGI.cmake: -------------------------------------------------------------------------------- 1 | # Look for the header file. 2 | find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h) 3 | 4 | # Look for the library. 5 | find_library(FCGI_LIBRARY NAMES fcgi) 6 | 7 | # Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE. 8 | include(FindPackageHandleStandardArgs) 9 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR) 10 | 11 | # Copy the results to the output variables. 12 | if(FCGI_FOUND) 13 | set(FCGI_LIBRARIES ${FCGI_LIBRARY}) 14 | set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR}) 15 | else() 16 | set(FCGI_LIBRARIES) 17 | set(FCGI_INCLUDE_DIRS) 18 | endif() 19 | 20 | mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY) 21 | -------------------------------------------------------------------------------- /cmake/FindJPYLYZER.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # this module looks for JPYLYZER 3 | # http://jpylyzer.openpreservation.org 4 | # 5 | 6 | find_program(JPYLYZER_EXECUTABLE 7 | jpylyzer 8 | ) 9 | 10 | mark_as_advanced( 11 | JPYLYZER_EXECUTABLE 12 | ) 13 | -------------------------------------------------------------------------------- /cmake/FindKAKADU.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # this module looks for KAKADU 3 | # http://www.kakadusoftware.com/ 4 | # 5 | # 6 | # Copyright (c) 2006-2014 Mathieu Malaterre 7 | # 8 | # Redistribution and use is allowed according to the terms of the New 9 | # BSD license. 10 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 11 | # 12 | 13 | find_program(KDU_EXPAND_EXECUTABLE 14 | kdu_expand 15 | ) 16 | 17 | find_program(KDU_COMPRESS_EXECUTABLE 18 | kdu_compress 19 | ) 20 | 21 | mark_as_advanced( 22 | KDU_EXPAND_EXECUTABLE 23 | KDU_COMPRESS_EXECUTABLE 24 | ) 25 | -------------------------------------------------------------------------------- /cmake/FindLCMS.cmake: -------------------------------------------------------------------------------- 1 | # - Find LCMS library 2 | # Find the native LCMS includes and library 3 | # Once done this will define 4 | # 5 | # LCMS_INCLUDE_DIR - Where to find lcms.h, etc. 6 | # LCMS_LIBRARIES - Libraries to link against to use LCMS. 7 | # LCMS_FOUND - If false, do not try to use LCMS. 8 | # 9 | # also defined, but not for general use are 10 | # LCMS_LIBRARY, where to find the LCMS library. 11 | 12 | #============================================================================= 13 | #============================================================================= 14 | 15 | find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include) 16 | 17 | set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static) 18 | 19 | find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} ) 20 | 21 | mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include(FindPackageHandleStandardArgs) 26 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR) 27 | 28 | if(LCMS_FOUND) 29 | set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR}) 30 | set( LCMS_LIBRARIES ${LCMS_LIBRARY} ) 31 | endif() 32 | -------------------------------------------------------------------------------- /cmake/FindLCMS2.cmake: -------------------------------------------------------------------------------- 1 | # - Find LCMS2 library 2 | # Find the native LCMS2 includes and library 3 | # Once done this will define 4 | # 5 | # LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc. 6 | # LCMS2_LIBRARIES - Libraries to link against to use LCMS2. 7 | # LCMS2_FOUND - If false, do not try to use LCMS2. 8 | # 9 | # also defined, but not for general use are 10 | # LCMS2_LIBRARY - Where to find the LCMS2 library. 11 | 12 | #============================================================================= 13 | #============================================================================= 14 | 15 | find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include) 16 | 17 | set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static) 18 | 19 | find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} ) 20 | 21 | mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include(FindPackageHandleStandardArgs) 26 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR) 27 | 28 | if(LCMS2_FOUND) 29 | set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR}) 30 | set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} ) 31 | endif() 32 | -------------------------------------------------------------------------------- /cmake/JPIPTestDriver.cmake: -------------------------------------------------------------------------------- 1 | # JPIP test driver 2 | #message(STATUS "${D_URL}") 3 | file(DOWNLOAD 4 | "${D_URL}" 5 | "${D_FILE}" 6 | LOG log 7 | EXPECTED_MD5 "${EXPECTED_MD5}" 8 | ) 9 | message(STATUS "LOG: ${log}") 10 | -------------------------------------------------------------------------------- /cmake/OpenJPEGCPack.cmake: -------------------------------------------------------------------------------- 1 | # package bundler 2 | if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 3 | if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake") 4 | set(CMAKE_INSTALL_MFC_LIBRARIES 0) 5 | set(CMAKE_INSTALL_DEBUG_LIBRARIES 0) 6 | if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) 7 | set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) 8 | endif() 9 | include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake) 10 | endif() 11 | 12 | set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.") 13 | set(OPJ_PACKAGE_CONTACT "openjpeg users ") 14 | 15 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY}) 16 | set(CPACK_PACKAGE_VENDOR "OpenJPEG Team") 17 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" 18 | "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY 19 | ) 20 | # For PackageMaker on MacOSX it is important to have a file extension: 21 | set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") 22 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt") 23 | set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}") 24 | set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}") 25 | set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}") 26 | set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") 27 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") 28 | 29 | # Make this explicit here, rather than accepting the CPack default value, 30 | # so we can refer to it: 31 | set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}") 32 | 33 | if(NOT DEFINED CPACK_SYSTEM_NAME) 34 | # make sure package is not Cygwin-unknown, for Cygwin just 35 | # cygwin is good for the system name 36 | if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") 37 | set(CPACK_SYSTEM_NAME Cygwin) 38 | else() 39 | set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) 40 | endif() 41 | endif() 42 | if(${CPACK_SYSTEM_NAME} MATCHES Windows) 43 | if(CMAKE_CL_64) 44 | set(CPACK_SYSTEM_NAME win64-x64) 45 | else() 46 | set(CPACK_SYSTEM_NAME win32-x86) 47 | endif() 48 | endif() 49 | 50 | if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) 51 | # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache 52 | # default to source package - system, on cygwin system is not 53 | # needed 54 | if(CYGWIN) 55 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") 56 | else() 57 | set(CPACK_PACKAGE_FILE_NAME 58 | "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}") 59 | endif() 60 | endif() 61 | 62 | set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") 63 | if(APPLE) 64 | configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist 65 | ${CMAKE_CURRENT_BINARY_DIR}/opj.plist) 66 | set(CPACK_BUNDLE_PLIST 67 | ${CMAKE_CURRENT_BINARY_DIR}/opj.plist) 68 | #include(BundleUtilities) 69 | endif() 70 | 71 | include(CPack) 72 | endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 73 | -------------------------------------------------------------------------------- /cmake/OpenJPEGConfig.cmake.in: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # OPENJPEGConfig.cmake - CMake configuration file for external projects. 4 | # 5 | # This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake 6 | # module to load OPENJPEG's settings for an external project. 7 | @OPENJPEG_CONFIG_INSTALL_ONLY@ 8 | @PACKAGE_INIT@ 9 | # The OPENJPEG version number. 10 | set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@") 11 | set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@") 12 | set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@") 13 | 14 | # The libraries. 15 | set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@") 16 | 17 | # The CMake macros dir. 18 | set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@") 19 | 20 | # The configuration options. 21 | set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@") 22 | 23 | # The "use" file. 24 | set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@") 25 | 26 | get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 27 | if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake) 28 | # This is an install tree 29 | include(${SELF_DIR}/OpenJPEGTargets.cmake) 30 | 31 | set(INC_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@OPENJPEG_INSTALL_SUBDIR@") 32 | get_filename_component(OPENJPEG_INCLUDE_DIRS "${INC_DIR}" ABSOLUTE) 33 | 34 | else() 35 | if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake) 36 | # This is a build tree 37 | set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@) 38 | 39 | include(${SELF_DIR}/OpenJPEGExports.cmake) 40 | 41 | else() 42 | message(FATAL_ERROR "ooops") 43 | endif() 44 | endif() 45 | 46 | set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake) 47 | 48 | # Backward compatible part: 49 | set(OPENJPEG_FOUND TRUE) 50 | 51 | -------------------------------------------------------------------------------- /cmake/TestFileOffsetBits.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Cause a compile-time error if off_t is smaller than 64 bits */ 4 | #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 5 | int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ]; 6 | 7 | int main(int argc, char **argv) 8 | { 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /cmake/TestLargeFiles.c.cmake.in: -------------------------------------------------------------------------------- 1 | #cmakedefine _LARGEFILE_SOURCE 2 | #cmakedefine _LARGE_FILES 3 | #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char **argv) 10 | { 11 | /* Cause a compile-time error if off_t is smaller than 64 bits, 12 | * and make sure we have ftello / fseeko. 13 | */ 14 | #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 15 | int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ]; 16 | FILE *fp = fopen(argv[0],"r"); 17 | off_t offset = ftello( fp ); 18 | 19 | fseeko( fp, offset, SEEK_CUR ); 20 | fclose(fp); 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /cmake/TestWindowsFSeek.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main() 5 | { 6 | __int64 off=0; 7 | 8 | _fseeki64(NULL, off, SEEK_SET); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /cmake/openjpeg_valgrind.supp: -------------------------------------------------------------------------------- 1 | 2 | 3 | { 4 | 5 | Memcheck:Cond 6 | fun:deflate 7 | obj:/lib/libpng12.so.0.42.0 8 | obj:/lib/libpng12.so.0.42.0 9 | obj:/lib/libpng12.so.0.42.0 10 | fun:png_write_row 11 | fun:imagetopng 12 | fun:main 13 | } 14 | { 15 | 16 | Memcheck:Value8 17 | fun:crc32 18 | obj:/lib/libpng12.so.0.42.0 19 | fun:png_write_chunk 20 | obj:/lib/libpng12.so.0.42.0 21 | obj:/lib/libpng12.so.0.42.0 22 | obj:/lib/libpng12.so.0.42.0 23 | obj:/lib/libpng12.so.0.42.0 24 | fun:png_write_row 25 | fun:imagetopng 26 | fun:main 27 | } 28 | { 29 | 30 | Memcheck:Param 31 | write(buf) 32 | fun:__write_nocancel 33 | fun:_IO_file_write@@GLIBC_2.2.5 34 | fun:_IO_do_write@@GLIBC_2.2.5 35 | fun:_IO_file_close_it@@GLIBC_2.2.5 36 | fun:fclose@@GLIBC_2.2.5 37 | fun:imagetopng 38 | fun:main 39 | } 40 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generate target to build the html documentation through CMake tool 2 | # After having configured the project with the BUILD_DOC option you can run make doc 3 | # to generate the html documentation in the doc/html repository of the build folder. 4 | 5 | # Try to find the doxygen tool 6 | find_package(Doxygen) 7 | 8 | if(DOXYGEN_FOUND) 9 | # Configure the doxygen config file with variable from CMake and move it 10 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in 11 | ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY) 12 | 13 | # Configure the html mainpage file of the doxygen documentation with variable 14 | # from CMake and move it 15 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in 16 | ${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY) 17 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in 18 | ${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY) 19 | # copy png file to make local (binary tree) documentation valid: 20 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png 21 | ${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY) 22 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png 23 | ${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY) 24 | 25 | file(GLOB headers 26 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h 27 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c 28 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h 29 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c 30 | ) 31 | # Generate new target to build the html documentation 32 | add_custom_command( 33 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html 34 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox 35 | DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox 36 | ${CMAKE_BINARY_DIR}/doc/mainpage.dox 37 | ${CMAKE_BINARY_DIR}/doc/openjpip.dox 38 | ${headers} 39 | ) 40 | add_custom_target(doc ALL 41 | DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html 42 | COMMENT "Building doxygen documentation" 43 | ) 44 | 45 | # install HTML documentation (install png files too): 46 | install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html 47 | DESTINATION ${CMAKE_INSTALL_DOCDIR} 48 | PATTERN ".svn" EXCLUDE 49 | ) 50 | else() 51 | message(STATUS "Doxygen not found, we cannot generate the documentation") 52 | endif() 53 | -------------------------------------------------------------------------------- /doc/jpip_architect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/doc/jpip_architect.png -------------------------------------------------------------------------------- /doc/jpip_protocol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/doc/jpip_protocol.png -------------------------------------------------------------------------------- /doc/mainpage.dox.in: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2011, Mickael Savinaud, Communications & Systemes 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /*! \mainpage OpenJPEG v@OPENJPEG_VERSION@ Documentation 31 | * 32 | * \section intro Introduction 33 | * This manual documents the low-level OpenJPEG C API.\n 34 | * The OpenJPEG library is an open-source JPEG 2000 library developed in order to promote the use of JPEG 2000.\n 35 | * This documents is focused on the main part of the library which try to implement Part 1 and Part 2 of the JPEG2000 norm.\n 36 | * 37 | * \section home Home page 38 | * 39 | * The Home Page of the OpenJPEG project can be found at: 40 | * 41 | * http://www.openjpeg.org/ 42 | * 43 | * The source code repository is available here: 44 | * 45 | * http://github.com/uclouvain/openjpeg 46 | * 47 | * The OpenJPEG mailing list is located here: 48 | * 49 | * http://groups.google.com/group/openjpeg 50 | * 51 | * The test files repository is available here: 52 | * 53 | * http://github.com/uclouvain/openjpeg-data 54 | * 55 | * \section license License 56 | * This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n 57 | * The only restriction is to retain the copyright in the sources or the binaries documentation.\n 58 | * Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage. 59 | * 60 | * \author OpenJPEG Team 61 | * 62 | */ 63 | -------------------------------------------------------------------------------- /doc/man/man1/opj_dump.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | '\" The line above instructs most `man' programs to invoke tbl 3 | '\" 4 | '\" Separate paragraphs; not the same as PP which resets indent level. 5 | .de SP 6 | .if t .sp .5 7 | .if n .sp 8 | .. 9 | '\" 10 | '\" Replacement em-dash for nroff (default is too short). 11 | .ie n .ds m " - 12 | .el .ds m \(em 13 | '\" 14 | '\" Placeholder macro for if longer nroff arrow is needed. 15 | .ds RA \(-> 16 | '\" 17 | '\" Decimal point set slightly raised 18 | .if t .ds d \v'-.15m'.\v'+.15m' 19 | .if n .ds d . 20 | '\" 21 | '\" Enclosure macro for examples 22 | .de EX 23 | .SP 24 | .nf 25 | .ft CW 26 | .. 27 | .de EE 28 | .ft R 29 | .SP 30 | .fi 31 | .. 32 | .TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files" 33 | .P 34 | .SH NAME 35 | opj_dump \- 36 | This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library. 37 | .SP 38 | Valid input image extensions are 39 | .B .j2k, .jp2, .jpt 40 | .SP 41 | .SH SYNOPSIS 42 | .P 43 | .B opj_dump \-i \fRinfile.j2k 44 | .P 45 | .B opj_dump \-ImgDir \fRimages/ \fRDump all files in images/ 46 | .P 47 | .B opj_dump \-h \fRPrint help message and exit 48 | .P 49 | .SH OPTIONS 50 | .TP 51 | .B \-\^i "name" 52 | (jpeg2000 input file name) 53 | .TP 54 | .B \-\^ImgDir "directory_name" 55 | (directory containing jpeg2000 input files) 56 | .P 57 | '\".SH BUGS 58 | .SH AUTHORS 59 | Copyright (c) 2010, Mathieu Malaterre 60 | .P 61 | .SH "SEE ALSO" 62 | opj_compress(1) opj_decompress(1) 63 | -------------------------------------------------------------------------------- /scripts/astyle.options: -------------------------------------------------------------------------------- 1 | --convert-tabs 2 | --lineend=linux 3 | --indent=spaces=4 4 | --style=kr 5 | --add-braces 6 | --max-code-length=80 7 | --break-after-logical 8 | --pad-header 9 | --pad-oper 10 | --unpad-paren 11 | --suffix=none 12 | -------------------------------------------------------------------------------- /scripts/astyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ########################################################################### 3 | # astyle.sh 4 | # --------------------- 5 | # Date : August 2008 6 | # Copyright : (C) 2008 by Juergen E. Fischer 7 | # Email : jef at norbit dot de 8 | ########################################################################### 9 | # # 10 | # This program is free software; you can redistribute it and/or modify # 11 | # it under the terms of the GNU General Public License as published by # 12 | # the Free Software Foundation; either version 2 of the License, or # 13 | # (at your option) any later version. # 14 | # # 15 | ########################################################################### 16 | 17 | for ASTYLE in ${OPJSTYLE} $(dirname $0)/opjstyle $(dirname $0)/RelWithDebInfo/opjstyle 18 | do 19 | if type -p $ASTYLE >/dev/null; then 20 | break 21 | fi 22 | ASTYLE= 23 | done 24 | 25 | if [ -z "$ASTYLE" ]; then 26 | echo "opjstyle not found - please enable WITH_ASTYLE in cmake and build it" >&2 27 | exit 1 28 | fi 29 | 30 | if type -p tput >/dev/null; then 31 | elcr="$ASTYLEPROGRESS$(tput el)$(tput cr)" 32 | else 33 | elcr="$ASTYLEPROGRESS \r" 34 | fi 35 | 36 | if ! type -p flip >/dev/null; then 37 | if type -p dos2unix >/dev/null; then 38 | flip() { 39 | dos2unix -k $2 40 | } 41 | else 42 | echo "flip not found" >&2 43 | flip() { 44 | : 45 | } 46 | fi 47 | fi 48 | 49 | if ! type -p autopep8 >/dev/null; then 50 | echo "autopep8 not found" >&2 51 | autopep8() { 52 | : 53 | } 54 | fi 55 | 56 | ASTYLEOPTS=$(dirname $0)/astyle.options 57 | if type -p cygpath >/dev/null; then 58 | ASTYLEOPTS="$(cygpath -w $ASTYLEOPTS)" 59 | fi 60 | 61 | set -e 62 | 63 | astyleit() { 64 | $ASTYLE --options="$ASTYLEOPTS" "$1" 65 | #modified=$1.unify_includes_modified 66 | #cp "$1" "$modified" 67 | #scripts/unify_includes.pl "$modified" 68 | #scripts/doxygen_space.pl "$modified" 69 | #diff "$1" "$modified" >/dev/null || mv "$modified" "$1" 70 | #rm -f "$modified" 71 | } 72 | 73 | for f in "$@"; do 74 | case "$f" in 75 | thirdparty/*) 76 | echo -ne "$f skipped $elcr" 77 | continue 78 | ;; 79 | 80 | *.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.hpp) 81 | if [ -x "$f" ]; then 82 | chmod a-x "$f" 83 | fi 84 | cmd=astyleit 85 | ;; 86 | 87 | *.py) 88 | #cmd="autopep8 --in-place --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701" 89 | echo -ne "Formatting $f $elcr" 90 | cmd="autopep8 --in-place --ignore=E261,E265,E402,E501" 91 | ;; 92 | 93 | 94 | *) 95 | echo -ne "$f skipped $elcr" 96 | continue 97 | ;; 98 | esac 99 | 100 | if ! [ -f "$f" ]; then 101 | echo "$f not found" >&2 102 | continue 103 | fi 104 | 105 | if [[ -f $f && `head -c 3 $f` == $'\xef\xbb\xbf' ]]; then 106 | mv $f $f.bom 107 | tail -c +4 $f.bom > $f 108 | echo "removed BOM from $f" 109 | fi 110 | 111 | modified=$f.flip_modified 112 | cp "$f" "$modified" 113 | flip -ub "$modified" 114 | diff "$f" "$modified" >/dev/null || mv "$modified" "$f" 115 | rm -f "$modified" 116 | eval "$cmd '$f'" 117 | done 118 | -------------------------------------------------------------------------------- /scripts/prepare-commit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ########################################################################### 3 | # prepare-commit.sh 4 | # --------------------- 5 | # Date : August 2008 6 | # Copyright : (C) 2008 by Juergen E. Fischer 7 | # Email : jef at norbit dot de 8 | ########################################################################### 9 | # # 10 | # This program is free software; you can redistribute it and/or modify # 11 | # it under the terms of the GNU General Public License as published by # 12 | # the Free Software Foundation; either version 2 of the License, or # 13 | # (at your option) any later version. # 14 | # # 15 | ########################################################################### 16 | 17 | TOPLEVEL=$(git rev-parse --show-toplevel) 18 | 19 | PATH=$TOPLEVEL/scripts:$PATH 20 | 21 | cd $TOPLEVEL 22 | 23 | # GNU prefix command for mac os support (gsed, gsplit) 24 | GP= 25 | if [[ "$OSTYPE" =~ darwin* ]]; then 26 | GP=g 27 | fi 28 | 29 | if ! type -p astyle.sh >/dev/null; then 30 | echo astyle.sh not found 31 | exit 1 32 | fi 33 | 34 | if ! type -p colordiff >/dev/null; then 35 | colordiff() 36 | { 37 | cat "$@" 38 | } 39 | fi 40 | 41 | if [ "$1" = "-c" ]; then 42 | echo "Cleaning..." 43 | remove_temporary_files.sh 44 | fi 45 | 46 | set -e 47 | 48 | # determine changed files 49 | MODIFIED=$(git status --porcelain| ${GP}sed -ne "s/^ *[MA] *//p" | sort -u) 50 | #MODIFIED=$(find src -name "*.h") 51 | 52 | if [ -z "$MODIFIED" ]; then 53 | echo nothing was modified 54 | exit 0 55 | fi 56 | 57 | # save original changes 58 | REV=$(git log -n1 --pretty=%H) 59 | git diff >sha-$REV.diff 60 | 61 | ASTYLEDIFF=astyle.$REV.diff 62 | >$ASTYLEDIFF 63 | 64 | # reformat 65 | i=0 66 | N=$(echo $MODIFIED | wc -w) 67 | for f in $MODIFIED; do 68 | (( i++ )) || true 69 | 70 | case "$f" in 71 | thirdparty/*) 72 | echo $f skipped 73 | continue 74 | ;; 75 | 76 | *.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py) 77 | ;; 78 | 79 | *) 80 | continue 81 | ;; 82 | esac 83 | 84 | m=$f.$REV.prepare 85 | 86 | cp $f $m 87 | ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f 88 | if diff -u $m $f >>$ASTYLEDIFF; then 89 | # no difference found 90 | rm $m 91 | fi 92 | done 93 | 94 | if [ -s "$ASTYLEDIFF" ]; then 95 | if tty -s; then 96 | # review astyle changes 97 | colordiff <$ASTYLEDIFF | less -r 98 | else 99 | echo "Files changed (see $ASTYLEDIFF)" 100 | fi 101 | exit 1 102 | else 103 | rm $ASTYLEDIFF 104 | fi 105 | 106 | 107 | # If there are whitespace errors, print the offending file names and fail. 108 | exec git diff-index --check --cached HEAD -- 109 | 110 | exit 0 111 | 112 | # vim: set ts=8 noexpandtab : 113 | -------------------------------------------------------------------------------- /scripts/remove_temporary_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ########################################################################### 3 | # remove_git_confict_files.sh 4 | # --------------------- 5 | # Date : April 2012 6 | # Copyright : (C) 2012 by Tim Sutton 7 | # Email : tim at kartoza dot com 8 | ########################################################################### 9 | # # 10 | # This program is free software; you can redistribute it and/or modify # 11 | # it under the terms of the GNU General Public License as published by # 12 | # the Free Software Foundation; either version 2 of the License, or # 13 | # (at your option) any later version. # 14 | # # 15 | ########################################################################### 16 | 17 | # 18 | # A simple script to get rid of QGIS related temporary files left in 19 | # your QGIS source folder by git 20 | 21 | # Tim Sutton, May 2008 22 | find . \ 23 | \( \ 24 | -name "*.orig" \ 25 | -o -name "*.prepare" \ 26 | -o -name "*.sortinc" \ 27 | -o -name "*.unify_includes_modified" \ 28 | -o -name "*.nocopyright" \ 29 | -o -name "astyle*.diff" \ 30 | -o -name "sha-*.diff" \ 31 | -o -name "*.astyle" \ 32 | -o -name "sha*.diff" \ 33 | -o -name "*.bom" \ 34 | -o -name "*.bak" \ 35 | -o -name "*.rej" \ 36 | -o -name "*.orig" \ 37 | -o -name "*.new" \ 38 | -o -name "*~" \ 39 | \) \ 40 | -print \ 41 | -delete 42 | -------------------------------------------------------------------------------- /scripts/verify-indentation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd $(git rev-parse --show-toplevel) 3 | 4 | export PATH=$PATH:$PWD/scripts 5 | 6 | if [ -z "$TRAVIS_COMMIT_RANGE" -a -z "$GITHUB_SHA" ]; then 7 | echo "No commit range given" 8 | exit 0 9 | fi 10 | 11 | if ! type -p astyle.sh >/dev/null; then 12 | echo astyle.sh not found 13 | exit 1 14 | fi 15 | 16 | set -e 17 | 18 | ASTYLEDIFF=/tmp/astyle.diff 19 | >$ASTYLEDIFF 20 | 21 | if [ ! -z $GITHUB_BASE_REF ] && [ ! -z $GITHUB_HEAD_REF ]; then 22 | # on a PR 23 | echo "GitHub PR COMMIT RANGE: ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF}" 24 | git branch tmp_${GITHUB_BASE_REF} origin/${GITHUB_BASE_REF} 25 | BASE_SHA1=$(git rev-parse tmp_${GITHUB_BASE_REF}) 26 | FILES=$(git diff --diff-filter=AMR --name-only ${BASE_SHA1}..${GITHUB_SHA} | tr '\n' ' ' ) 27 | elif [ ! -z $GITHUB_SHA ]; then 28 | echo "GitHub push COMMIT $GITHUB_SHA" 29 | FILES=$(git diff --diff-filter=AMR --name-only ${GITHUB_SHA}~1..${GITHUB_SHA} | tr '\n' ' ' ) 30 | elif [ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]; then 31 | # if on a PR, just analyse the changed files 32 | echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH" 33 | FILES=$(git diff --diff-filter=AMR --name-only $(git merge-base HEAD master) | tr '\n' ' ' ) 34 | elif [ ! -z $TRAVIS_COMMIT_RANGE ]; then 35 | echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE" 36 | FILES=$(git diff --diff-filter=AMR --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' ) 37 | fi 38 | 39 | for f in $FILES; do 40 | if ! [ -f "$f" ]; then 41 | echo "$f was removed." >>/tmp/ctest-important.log 42 | continue 43 | fi 44 | 45 | echo "Checking $f" >>/tmp/ctest-important.log 46 | case "$f" in 47 | thirdparty*) 48 | echo "$f skipped" 49 | continue 50 | ;; 51 | 52 | *.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py) 53 | ;; 54 | 55 | *) 56 | continue 57 | ;; 58 | esac 59 | 60 | m="$f.prepare" 61 | cp "$f" "$m" 62 | astyle.sh "$f" 63 | if diff -u "$m" "$f" >>$ASTYLEDIFF; then 64 | rm "$m" 65 | else 66 | echo "File $f needs indentation" 67 | fi 68 | done 69 | 70 | if [ -s "$ASTYLEDIFF" ]; then 71 | echo 72 | echo "Required indentation updates:" 73 | cat "$ASTYLEDIFF" 74 | 75 | cat <= 1.2.1) to format python code 80 | * Use "scripts/astyle.sh file" to fix the now badly indented files 81 | * Consider using scripts/prepare-commit.sh as pre-commit hook to avoid this 82 | in the future (ln -s scripts/prepare-commit.sh .git/hooks/pre-commit) or 83 | run it manually before each commit. 84 | EOF 85 | 86 | exit 1 87 | fi 88 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # required dep for server: 2 | #if(BUILD_JPIP_SERVER) 3 | # find_package(CURL REQUIRED) 4 | # find_package(FCGI REQUIRED) 5 | # find_package(Threads REQUIRED) 6 | # if(NOT CMAKE_USE_PTHREADS_INIT) 7 | # message(FATAL_ERROR "Only pthread are supported") 8 | # endif() 9 | #endif() 10 | 11 | #add_subdirectory(lib) 12 | #add_subdirectory(bin) 13 | -------------------------------------------------------------------------------- /src/bin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # source code for openjpeg apps: 2 | add_subdirectory(common) 3 | # Part 1 & 2: 4 | add_subdirectory(jp2) 5 | 6 | # optionals components: 7 | if(BUILD_JPIP) 8 | add_subdirectory(jpip) 9 | endif() 10 | 11 | # wx apps: 12 | add_subdirectory(wx) 13 | -------------------------------------------------------------------------------- /src/bin/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # opj_apps_config.h generation 3 | configure_file( 4 | ${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in 5 | ${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h 6 | @ONLY 7 | ) 8 | -------------------------------------------------------------------------------- /src/bin/common/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 8 | * Copyright (c) 2002-2014, Professor Benoit Macq 9 | * Copyright (c) 2001-2003, David Janssens 10 | * Copyright (c) 2002-2003, Yannick Verschueren 11 | * Copyright (c) 2003-2007, Francois-Olivier Devaux 12 | * Copyright (c) 2003-2014, Antonin Descampe 13 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * 1. Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | 38 | #ifndef _OPJ_COLOR_H_ 39 | #define _OPJ_COLOR_H_ 40 | 41 | extern void color_sycc_to_rgb(opj_image_t *img); 42 | extern void color_apply_icc_profile(opj_image_t *image); 43 | extern void color_cielab_to_rgb(opj_image_t *image); 44 | 45 | extern void color_cmyk_to_rgb(opj_image_t *image); 46 | extern void color_esycc_to_rgb(opj_image_t *image); 47 | #endif /* _OPJ_COLOR_H_ */ 48 | -------------------------------------------------------------------------------- /src/bin/common/format_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 8 | * Copyright (c) 2002-2014, Professor Benoit Macq 9 | * Copyright (c) 2001-2003, David Janssens 10 | * Copyright (c) 2002-2003, Yannick Verschueren 11 | * Copyright (c) 2003-2007, Francois-Olivier Devaux 12 | * Copyright (c) 2003-2014, Antonin Descampe 13 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * 1. Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | 38 | #ifndef _OPJ_FORMAT_DEFS_H_ 39 | #define _OPJ_FORMAT_DEFS_H_ 40 | 41 | #define J2K_CFMT 0 42 | #define JP2_CFMT 1 43 | #define JPT_CFMT 2 44 | 45 | #define PXM_DFMT 10 46 | #define PGX_DFMT 11 47 | #define BMP_DFMT 12 48 | #define YUV_DFMT 13 49 | #define TIF_DFMT 14 50 | #define RAW_DFMT 15 /* MSB / Big Endian */ 51 | #define TGA_DFMT 16 52 | #define PNG_DFMT 17 53 | #define RAWL_DFMT 18 /* LSB / Little Endian */ 54 | 55 | #endif /* _OPJ_FORMAT_DEFS_H_ */ 56 | -------------------------------------------------------------------------------- /src/bin/common/opj_apps_config.h.cmake.in: -------------------------------------------------------------------------------- 1 | #include "opj_config_private.h" 2 | 3 | /* create opj_apps_config.h for CMake */ 4 | 5 | #cmakedefine OPJ_HAVE_LIBPNG @HAVE_LIBPNG@ 6 | #cmakedefine OPJ_HAVE_PNG_H @HAVE_PNG_H@ 7 | #cmakedefine OPJ_HAVE_LIBTIFF @HAVE_LIBTIFF@ 8 | #cmakedefine OPJ_HAVE_TIFF_H @HAVE_TIFF_H@ 9 | 10 | #cmakedefine OPJ_HAVE_LIBLCMS1 11 | #cmakedefine OPJ_HAVE_LIBLCMS2 12 | #cmakedefine OPJ_HAVE_LCMS1_H 13 | #cmakedefine OPJ_HAVE_LCMS2_H 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/bin/common/opj_getopt.h: -------------------------------------------------------------------------------- 1 | /* last review : october 29th, 2002 */ 2 | 3 | #ifndef _GETOPT_H_ 4 | #define _GETOPT_H_ 5 | 6 | typedef struct opj_option { 7 | const char *name; 8 | int has_arg; 9 | int *flag; 10 | int val; 11 | } opj_option_t; 12 | 13 | #define NO_ARG 0 14 | #define REQ_ARG 1 15 | #define OPT_ARG 2 16 | 17 | extern int opj_opterr; 18 | extern int opj_optind; 19 | extern int opj_optopt; 20 | extern int opj_optreset; 21 | extern char *opj_optarg; 22 | 23 | extern int opj_getopt(int nargc, char *const *nargv, const char *ostr); 24 | extern int opj_getopt_long(int argc, char * const argv[], const char *optstring, 25 | const opj_option_t *longopts, int totlen); 26 | extern void opj_reset_options_reading(void); 27 | 28 | #endif /* _GETOPT_H_ */ 29 | -------------------------------------------------------------------------------- /src/bin/common/opj_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2015, Matthieu Darbois 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef OPJ_STRING_H 33 | #define OPJ_STRING_H 34 | 35 | #include 36 | #include 37 | 38 | /* strnlen is not standard, strlen_s is C11... */ 39 | /* keep in mind there still is a buffer read overflow possible */ 40 | static size_t opj_strnlen_s(const char *src, size_t max_len) 41 | { 42 | size_t len; 43 | 44 | if (src == NULL) { 45 | return 0U; 46 | } 47 | for (len = 0U; (*src != '\0') && (len < max_len); src++, len++); 48 | return len; 49 | } 50 | 51 | /* should be equivalent to C11 function except for the handler */ 52 | /* keep in mind there still is a buffer read overflow possible */ 53 | static int opj_strcpy_s(char* dst, size_t dst_size, const char* src) 54 | { 55 | size_t src_len = 0U; 56 | if ((dst == NULL) || (dst_size == 0U)) { 57 | return EINVAL; 58 | } 59 | if (src == NULL) { 60 | dst[0] = '\0'; 61 | return EINVAL; 62 | } 63 | src_len = opj_strnlen_s(src, dst_size); 64 | if (src_len >= dst_size) { 65 | return ERANGE; 66 | } 67 | memcpy(dst, src, src_len); 68 | dst[src_len] = '\0'; 69 | return 0; 70 | } 71 | 72 | #endif /* OPJ_STRING_H */ 73 | -------------------------------------------------------------------------------- /src/bin/jp2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Build the demo app, small examples 2 | 3 | # First thing define the common source: 4 | set(common_SRCS 5 | convert.c 6 | convert.h 7 | convertbmp.c 8 | index.c 9 | index.h 10 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c 11 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.h 12 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c 13 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h 14 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_string.h 15 | ) 16 | 17 | if(OPJ_HAVE_LIBTIFF) 18 | list(APPEND common_SRCS converttif.c) 19 | endif() 20 | if(OPJ_HAVE_LIBPNG) 21 | list(APPEND common_SRCS convertpng.c) 22 | endif() 23 | 24 | # Headers file are located here: 25 | include_directories( 26 | ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h 27 | ${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h 28 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2 29 | ${OPENJPEG_SOURCE_DIR}/src/bin/common 30 | ${LCMS_INCLUDE_DIRNAME} 31 | ${Z_INCLUDE_DIRNAME} 32 | ${PNG_INCLUDE_DIRNAME} 33 | ${TIFF_INCLUDE_DIRNAME} 34 | ) 35 | 36 | if(WIN32) 37 | if(BUILD_SHARED_LIBS) 38 | add_definitions(-DOPJ_EXPORTS) 39 | else() 40 | add_definitions(-DOPJ_STATIC) 41 | endif() 42 | endif() 43 | 44 | # Loop over all executables: 45 | foreach(exe opj_decompress opj_compress opj_dump) 46 | add_executable(${exe} ${exe}.c ${common_SRCS}) 47 | if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12") 48 | target_compile_options(${exe} PRIVATE ${OPENJP2_COMPILE_OPTIONS}) 49 | endif() 50 | target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME} 51 | ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} 52 | ) 53 | # To support universal exe: 54 | if(ZLIB_FOUND AND APPLE) 55 | target_link_libraries(${exe} z) 56 | else(ZLIB_FOUND AND APPLE) 57 | target_link_libraries(${exe} ${Z_LIBNAME}) 58 | endif() 59 | 60 | # On unix you need to link to the math library: 61 | if(UNIX) 62 | target_link_libraries(${exe} m) 63 | IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") 64 | target_link_libraries(${exe} rt) 65 | endif() 66 | endif() 67 | # Install exe 68 | install(TARGETS ${exe} 69 | EXPORT OpenJPEGTargets 70 | DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications 71 | ) 72 | if(OPJ_USE_DSYMUTIL) 73 | add_custom_command(TARGET ${exe} POST_BUILD 74 | COMMAND "dsymutil" "$" 75 | COMMENT "dsymutil $" 76 | DEPENDS ${exe}) 77 | endif() 78 | endforeach() 79 | 80 | if(BUILD_DOC) 81 | # Install man pages 82 | install( 83 | FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1 84 | ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_decompress.1 85 | ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1 86 | DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) 87 | # 88 | endif() 89 | -------------------------------------------------------------------------------- /src/bin/jp2/index.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 8 | * Copyright (c) 2002-2014, Professor Benoit Macq 9 | * Copyright (c) 2003-2007, Francois-Olivier Devaux 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __J2K_INDEX_H 35 | #define __J2K_INDEX_H 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | Write a structured index to a file 43 | @param cstr_info Codestream information 44 | @param index Index filename 45 | @return Returns 0 if successful, returns 1 otherwise 46 | */ 47 | int write_index_file(opj_codestream_info_t *cstr_info, char *index); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __J2K_INDEX_H */ 54 | 55 | -------------------------------------------------------------------------------- /src/bin/jpip/opj_jpip_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: test_index.c 46 2011-02-17 14:50:55Z kaori $ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /*! \file 32 | * \brief test_index is a program to test the index code format of a JP2 file 33 | * 34 | * \section impinst Implementing instructions 35 | * This program takes one argument, and print out text type index information to the terminal. \n 36 | * -# Input JP2 file\n 37 | * % ./test_index input.jp2\n 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #ifdef _WIN32 45 | #include 46 | #else 47 | #include 48 | #endif 49 | #include "openjpip.h" 50 | 51 | int 52 | main(int argc, char *argv[]) 53 | { 54 | int fd; 55 | index_t *jp2idx; 56 | if (argc < 2) { 57 | return 1; 58 | } 59 | 60 | if ((fd = open(argv[1], O_RDONLY)) == -1) { 61 | fprintf(stderr, "Error: Target %s not found\n", argv[1]); 62 | return -1; 63 | } 64 | 65 | if (!(jp2idx = get_index_from_JP2file(fd))) { 66 | fprintf(stderr, "JP2 file broken\n"); 67 | return -1; 68 | } 69 | 70 | output_index(jp2idx); 71 | destroy_index(&jp2idx); 72 | close(fd); 73 | 74 | return 0; 75 | } /* main */ 76 | -------------------------------------------------------------------------------- /src/bin/jpip/opj_viewer/dist/manifest.txt: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Ant-Version: Apache Ant 1.7.0 3 | Created-By: Kaori Hagihara 4 | Main-Class: ImageWindow 5 | -------------------------------------------------------------------------------- /src/bin/jpip/opj_viewer/src/ResizeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | import java.awt.*; 32 | import java.awt.event.*; 33 | import javax.swing.*; 34 | 35 | class ResizeListener implements ComponentListener 36 | { 37 | private ImageViewer iv; 38 | private Dimension largest; 39 | 40 | public ResizeListener( ImageViewer _iv) 41 | { 42 | iv = _iv; 43 | largest = iv.getSize(); 44 | } 45 | 46 | public void componentHidden(ComponentEvent e) {} 47 | 48 | public void componentMoved(ComponentEvent e) {} 49 | 50 | public void componentResized(ComponentEvent e) { 51 | Dimension cursize = iv.getSize(); 52 | if( largest.getWidth() < cursize.getWidth() || largest.getHeight() < cursize.getHeight()){ 53 | update_largest( cursize); 54 | iv.enlarge(); 55 | } 56 | } 57 | 58 | private void update_largest( Dimension cursize) 59 | { 60 | if( largest.getWidth() < cursize.getWidth()) 61 | largest.setSize( cursize.getWidth(), largest.getHeight()); 62 | if( largest.getHeight() < cursize.getHeight()) 63 | largest.setSize( largest.getWidth(), cursize.getHeight()); 64 | } 65 | 66 | public void componentShown(ComponentEvent e) {} 67 | } 68 | -------------------------------------------------------------------------------- /src/bin/jpip/opj_viewer_xerces/dist/manifest.txt.in: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Ant-Version: Apache Ant 1.7.0 3 | Created-By: Kaori Hagihara 4 | Main-Class: ImageWindow 5 | Class-Path: @APACHE_XERCES_JAR@ 6 | -------------------------------------------------------------------------------- /src/bin/wx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | if(BUILD_VIEWER) 3 | add_subdirectory(OPJViewer) 4 | endif() 5 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(viewer CXX) 2 | 3 | find_package(wxWidgets REQUIRED) 4 | include(${wxWidgets_USE_FILE}) 5 | 6 | include_directories( 7 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 8 | ${CMAKE_CURRENT_SOURCE_DIR}/.. 9 | ${OPENJPEG_SOURCE_DIR}/src/lib 10 | ${OPENJPEG_SOURCE_DIR}/src/bin 11 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2 12 | ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h 13 | ) 14 | 15 | # original flags: 16 | # -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS 17 | add_definitions(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0") 18 | set(OPJV_SRCS 19 | ${CMAKE_CURRENT_SOURCE_DIR}/source/imagjpeg2000.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/source/wxj2kparser.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJViewer.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/source/wxjp2parser.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJDialogs.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJThreads.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJAbout.cpp 26 | ${OPENJPEG_SOURCE_DIR}/src/bin/jp2/index.c 27 | ) 28 | add_executable(opjviewer ${OPJV_SRCS}) 29 | target_link_libraries(opjviewer ${wxWidgets_LIBRARIES} openjpeg) 30 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/OPJViewer.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | [Setup] 5 | AppName=OPJViewer 6 | AppVerName=OPJViewer 0.4 beta 7 | AppPublisher=OpenJPEG 8 | AppPublisherURL=http://www.openjpeg.org 9 | AppSupportURL=http://www.openjpeg.org 10 | AppUpdatesURL=http://www.openjpeg.org 11 | DefaultDirName={pf}\OPJViewer 12 | DefaultGroupName=OPJViewer 13 | OutputDir=setup 14 | OutputBaseFilename=OPJViewer04beta_setup 15 | Compression=lzma 16 | SolidCompression=true 17 | InfoBeforeFile=source\readmebefore.txt 18 | InfoAfterFile=source\readmeafter.txt 19 | LicenseFile=source\license.txt 20 | VersionInfoVersion=0.4.0.0 21 | VersionInfoCompany=OpenJPEG 22 | VersionInfoDescription=JPEG 2000 viewer 23 | ShowLanguageDialog=yes 24 | SetupIconFile=source\OPJViewer.ico 25 | 26 | [Languages] 27 | Name: english; MessagesFile: compiler:Default.isl 28 | 29 | [Tasks] 30 | Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked 31 | 32 | [Files] 33 | Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion 34 | ;Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion 35 | ;Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion 36 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 37 | 38 | [Icons] 39 | Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0 40 | Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe} 41 | Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0 42 | 43 | [Run] 44 | Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app} 45 | 46 | [Registry] 47 | Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages: 48 | Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages: 49 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/about/about.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/about/about.htm -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/about/opj_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/about/opj_logo.png -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJAbout.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/OPJAbout.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJChild.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/OPJChild.ico -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJChild16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *OPJChild16[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 6 1", 5 | " c black", 6 | ". c #008000", 7 | "X c red", 8 | "o c #800080", 9 | "O c gray100", 10 | "+ c None", 11 | /* pixels */ 12 | "++++++++++++++++", 13 | "+OOOOOOOOOOOOOO+", 14 | "+OooooooooooooO+", 15 | "+OooooooooooooO+", 16 | "+OooOOOOOOOOOoO+", 17 | "+OooO.......OoO+", 18 | "+OooO.......OoO+", 19 | "+OooO..OOO..OoO+", 20 | "+OooO..OXO..OoO+", 21 | "+OooO..OOO..OoO+", 22 | "+OooO.......OoO+", 23 | "+OooO.......OoO+", 24 | "+OooOOOOOOOOOoO+", 25 | "+OooooooooooooO+", 26 | "+OOOOOOOOOOOOOO+", 27 | "++++++++++++++++" 28 | }; 29 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJDialogs.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/OPJDialogs.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJThreads.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/OPJThreads.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJViewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/OPJViewer.ico -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJViewer.rc: -------------------------------------------------------------------------------- 1 | OPJChild16 ICON OPJChild.ico 2 | OPJViewer16 ICON OPJViewer.ico 3 | #include "wx/msw/wx.rc" -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/OPJViewer16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *OPJViewer16[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 4 1", 5 | " c black", 6 | ". c #800000", 7 | "X c red", 8 | "o c None", 9 | /* pixels */ 10 | "oooooooooooooooo", 11 | "ooo.XXXXoooooooo", 12 | "ooXXoo .Xooooooo", 13 | "o..oooo .ooooooo", 14 | "oX.oooo ooooooo", 15 | "oX.oooo .ooooooo", 16 | "oXXoooo .ooooooo", 17 | "o.XXoo .oooooooo", 18 | "oo.XXXXooooooooo", 19 | "ooooooooo.Xo .oo", 20 | "ooooooooo X. ooo", 21 | "oooooooooo...ooo", 22 | "oooooooooo XXooo", 23 | "oooooooooo .Xooo", 24 | "oooooooooooooooo", 25 | "oooooooooooooooo" 26 | }; 27 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/build.h: -------------------------------------------------------------------------------- 1 | wxT("491") 2 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/icon1.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *icon1_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 41 1", 5 | "> c #97C4E7", 6 | "# c #4381AA", 7 | "d c #FFFFFF", 8 | "< c #71B2DE", 9 | "+ c #538BB1", 10 | "& c #D1E5F5", 11 | "q c #63B3DE", 12 | "6 c #F1F4F7", 13 | "* c #CAE1F3", 14 | "y c #7AC4E5", 15 | "= c #C3DDF1", 16 | "X c #74A1BD", 17 | "- c #BCD9EF", 18 | "5 c #619BC4", 19 | "3 c #E6EAF1", 20 | "2 c #4B8EBF", 21 | "o c #6B97B6", 22 | ". c #4B82A8", 23 | " c None", 24 | "w c #54A6D8", 25 | "1 c #71A8D1", 26 | ", c #85BBE2", 27 | "t c #EFF6FC", 28 | "7 c #DEEDF8", 29 | "@ c #4388B4", 30 | "a c #F7FBFD", 31 | "$ c #D7E0E9", 32 | "r c #FAFCFE", 33 | "4 c #DAEAF7", 34 | "e c #E9F3FA", 35 | "0 c #76BAE2", 36 | "% c #7FA6C0", 37 | "s c #FDFDFE", 38 | "O c #5896BE", 39 | "p c #B6D5EE", 40 | "8 c #87ABC3", 41 | ": c #A5CCEA", 42 | "9 c #E5F0F9", 43 | "; c #AFD1EC", 44 | "i c #F4F9FD", 45 | "u c #8FB0C3", 46 | /* pixels */ 47 | " ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " .XXXooOO++@#$ ", 53 | " %&*=-;:>>,<123 ", 54 | " %4&*=-;:>>,1>56 ", 55 | " %74&*=-;:>>1*>56 ", 56 | " 89700qqqqwq1e*>X ", 57 | " 8e974&*=-;:1re*>8 ", 58 | " 8te974&*=-;11111# ", 59 | " 8tty000qqqqqww>,+ ", 60 | " uitte974&*=-p:>>+ ", 61 | " uaitte974&*=-p:>O ", 62 | " uaayyyy000qqqqp:O ", 63 | " uraaitte974&*=-po ", 64 | " urraaitte974&*=-o ", 65 | " usryyyyyyy000q*=X ", 66 | " ussrraaitte974&*X ", 67 | " udssrraaitte974&X ", 68 | " uddyyyyyyyyyy074% ", 69 | " udddssrraaitte97% ", 70 | " uddddssrraaitte9% ", 71 | " udddddssrraaitte8 ", 72 | " uddddddssrraaitt8 ", 73 | " uuuuuuuuuuuuuu88u ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " " 79 | }; 80 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/icon2.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *icon2_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 15 1", 5 | ". c Black", 6 | "O c #97C4E7", 7 | "$ c #63B3DE", 8 | "@ c #CAE1F3", 9 | "; c #7AC4E5", 10 | "* c #74A1BD", 11 | "+ c #619BC4", 12 | "o c #4B8EBF", 13 | " c None", 14 | "% c #54A6D8", 15 | "= c #FAFCFE", 16 | "& c #E9F3FA", 17 | "# c #76BAE2", 18 | "X c #C00000", 19 | "- c #87ABC3", 20 | /* pixels */ 21 | " ", 22 | " ", 23 | " ", 24 | " ", 25 | " ", 26 | " ............. ", 27 | " .XXXXXXXXXX.o. ", 28 | " .XXXXXXXXXX.O+. ", 29 | " .XXXXXXXXXX.@O+. ", 30 | " .XX##$$$$%$.&@O* ", 31 | " .XXXXXXXXXX.=&@O- ", 32 | " .XXXXXXXXXX...... ", 33 | " .XX;###$$$$$%%XX. ", 34 | " .XXXXXXXXXXXXXXX. ", 35 | " .XXXXXXXXXXXXXXX. ", 36 | " .XX;;;;###$$$$XX. ", 37 | " .XXXXXXXXXXXXXXX. ", 38 | " .XXXXXXXXXXXXXXX. ", 39 | " .XX;;;;;;;###$XX. ", 40 | " .XXXXXXXXXXXXXXX. ", 41 | " .XXXXXXXXXXXXXXX. ", 42 | " .XX;;;;;;;;;;#XX. ", 43 | " .XXXXXXXXXXXXXXX. ", 44 | " .XXXXXXXXXXXXXXX. ", 45 | " .XXXXXXXXXXXXXXX. ", 46 | " .XXXXXXXXXXXXXXX. ", 47 | " ................. ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " " 53 | }; 54 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/icon3.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *icon3_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 41 1", 5 | "6 c #EDF2FB", 6 | "- c #AAC1E8", 7 | ": c #B9CDED", 8 | "X c #295193", 9 | ", c #C6D6F0", 10 | "a c #4A7CCE", 11 | "u c #779DDB", 12 | "y c #7FA2DD", 13 | "$ c #3263B4", 14 | "5 c #EAF0FA", 15 | ". c #2D59A3", 16 | "o c #6E96D8", 17 | "* c #356AC1", 18 | "r c #F7F9FD", 19 | "> c #BED0EE", 20 | "3 c #E1E9F7", 21 | "7 c #F0F5FC", 22 | "< c #CBD9F1", 23 | "2 c #DAE5F6", 24 | "# c #3161B1", 25 | " c None", 26 | "0 c #FDFEFF", 27 | "= c #9FB9E5", 28 | "e c #AEC5EA", 29 | "t c #89A9DF", 30 | "q c #98B5E4", 31 | "p c #5584D1", 32 | "d c #3A70CA", 33 | "@ c #305FAC", 34 | "i c #5D89D3", 35 | "1 c #D2DFF4", 36 | "% c #3366B9", 37 | "9 c #FAFCFE", 38 | "8 c #F5F8FD", 39 | "s c #4075CC", 40 | "O c #638ED5", 41 | "w c #90AFE2", 42 | "& c #3467BC", 43 | "+ c #2F5DA9", 44 | "; c #B3C8EB", 45 | "4 c #E5EDF9", 46 | /* pixels */ 47 | " ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " ", 53 | " ......X ", 54 | " .oooooO+ ", 55 | " .ooooooo. ", 56 | " .+@@@##$%%&&&&&****. ", 57 | " .=-;:>,<12345678900. ", 58 | " .q=-;:>,<1234567890. ", 59 | " .wq=-e:>,<12345678r. ", 60 | " .twq=-e:>,<12345678. ", 61 | " .ytwq=-e:>,<1234567. ", 62 | " .uytwq=-e:>,<123456. ", 63 | " .ouytwq=-e:>,<12345. ", 64 | " .Oouytwq=-e;>,<1234. ", 65 | " .iOouytwq=-e;>,<123. ", 66 | " .piOouytwq=-e;>,<12. ", 67 | " .apiOouytwq=-e;>,<1. ", 68 | " .sapiOouytwq=-e;>,<. ", 69 | " .dsapiOouytwq=-e;>,. ", 70 | " ...................# ", 71 | " ", 72 | " ", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " " 79 | }; 80 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/icon4.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *icon4_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 5 1", 5 | ". c Black", 6 | "o c #8399B4", 7 | "X c #8DA0B9", 8 | " c None", 9 | "O c #800000", 10 | /* pixels */ 11 | " ", 12 | " ", 13 | " ", 14 | " ", 15 | " ", 16 | " ", 17 | " ....... ", 18 | " .XXXXXo. ", 19 | " .XXXXXXX. ", 20 | " .................... ", 21 | " .OOOOOOOOOOOOOOOOOO. ", 22 | " .OOOOOOOOOOOOOOOOOO. ", 23 | " .OOOOOOOOOOOOOOOOOO. ", 24 | " .OOOOOOOOOOOOOOOOOO. ", 25 | " .OOOOOOOOOOOOOOOOOO. ", 26 | " .OOOOOOOOOOOOOOOOOO. ", 27 | " .OOOOOOOOOOOOOOOOOO. ", 28 | " .OOOOOOOOOOOOOOOOOO. ", 29 | " .OOOOOOOOOOOOOOOOOO. ", 30 | " .OOOOOOOOOOOOOOOOOO. ", 31 | " .OOOOOOOOOOOOOOOOOO. ", 32 | " .OOOOOOOOOOOOOOOOOO. ", 33 | " .OOOOOOOOOOOOOOOOOO. ", 34 | " .................... ", 35 | " ", 36 | " ", 37 | " ", 38 | " ", 39 | " ", 40 | " ", 41 | " ", 42 | " " 43 | }; 44 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/icon5.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *icon5_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 41 1", 5 | "0 c #AAC1E8", 6 | "q c #B9CDED", 7 | "X c #295193", 8 | "e c #C6D6F0", 9 | "a c #4A7CCE", 10 | "& c #779DDB", 11 | "* c #7FA2DD", 12 | "2 c #EAF0FA", 13 | "@ c #2D59A3", 14 | "o c #6E96D8", 15 | "y c #356AC1", 16 | "d c #214279", 17 | "w c #BED0EE", 18 | "= c #85A7DF", 19 | "< c #E1E9F7", 20 | "3 c #F0F5FC", 21 | "s c #CBD9F1", 22 | ", c #DAE5F6", 23 | "7 c #3161B1", 24 | " c None", 25 | ". c #274D8B", 26 | "6 c #FDFEFF", 27 | "i c #E7EEF9", 28 | "9 c #9FB9E5", 29 | "- c #89A9DF", 30 | "8 c #98B5E4", 31 | "$ c #5584D1", 32 | "+ c #3569BF", 33 | "% c #305FAC", 34 | "O c #5D89D3", 35 | "> c #D2DFF4", 36 | "p c #3366B9", 37 | "5 c #FAFCFE", 38 | "4 c #F5F8FD", 39 | "t c #4075CC", 40 | "u c #638ED5", 41 | "r c #CEDCF2", 42 | "; c #90AFE2", 43 | "# c #2F5DA9", 44 | ": c #B3C8EB", 45 | "1 c #E5EDF9", 46 | /* pixels */ 47 | " ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " ", 53 | " ", 54 | " ......X ", 55 | " XoooooO. ", 56 | " Xoooooo+. ", 57 | " Xooooooo@XXXXXXXXXX# ", 58 | " Xoooooooooooooooooo# ", 59 | " Xoooooooooooooooooo# ", 60 | " Xoo$################### ", 61 | " Xoo%O&*=-;:>,<123445667 ", 62 | " XooX890:qwer>,<123445q# ", 63 | " Xoty;890:qwer>,<12344# ", 64 | " Xo%u-;890:qwer>,,,,<# ", 68 | " XX$Ouo&*-;890:qwer>s# ", 69 | " d%a$Ouo&*-;890:qwer# ", 70 | " d+ta$Ouo&*-;890:qwe# ", 71 | " d..................# ", 72 | " ", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " " 79 | }; 80 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/imagjpeg2000.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/imagjpeg2000.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/imagmxf.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/imagmxf.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/license.txt -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/readmeafter.txt: -------------------------------------------------------------------------------- 1 | This viewer is conceived to open and display information and image content of J2K, JP2, 2 | and MJ2 files. 3 | The viewer application interface is divided into three main panels: 4 | - a browsing pane; 5 | - a viewing pane; 6 | - a log/peek pane. 7 | 8 | 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: 9 | 10 | filename 11 | | 12 | |_ #000: Marker/Box short name (Hex code) 13 | | | 14 | | |_ *** Marker/Box long name *** 15 | | |_ startbyte > stopbyte, inner_length + marker/box sign length (total length) 16 | | |_ Additional info, depending on the marker/box type 17 | | |_ ... 18 | | 19 | |_ #001: Marker/Box short name (Hex code) 20 | | | 21 | | |_ ... 22 | | 23 | ... 24 | 25 | 26 | The viewing pane will display the decoded image contained in the JPEG 2000 file. 27 | 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. 28 | 29 | 30 | The log/peek pane is shared among two different subpanels: 31 | 32 | - the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library 33 | - 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. 34 | 35 | -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/readmebefore.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/readmebefore.txt -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/wxj2kparser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/wxj2kparser.cpp -------------------------------------------------------------------------------- /src/bin/wx/OPJViewer/source/wxjp2parser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/src/bin/wx/OPJViewer/source/wxjp2parser.cpp -------------------------------------------------------------------------------- /src/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # source code for openjpeg project: 2 | # Part 1 & 2: 3 | add_subdirectory(openjp2) 4 | 5 | if(BUILD_JPIP) 6 | add_subdirectory(openjpip) 7 | endif() 8 | -------------------------------------------------------------------------------- /src/lib/openjp2/cidx_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: cidx_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2003-2004, Yannick Verschueren 7 | * Copyright (c) 2010-2011, Kaori Hagihara 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /*! \file 33 | * \brief Modification of jpip.h from 2KAN indexer 34 | */ 35 | 36 | 37 | #ifndef CIDX_MANAGER_H_ 38 | # define CIDX_MANAGER_H_ 39 | 40 | #include "openjpeg.h" 41 | 42 | 43 | /* 44 | * Write Codestream index box (superbox) 45 | * 46 | * @param[in] offset offset of j2k codestream 47 | * @param[in] cio file output handle 48 | * @param[in] image image data 49 | * @param[in] cstr_info codestream information 50 | * @param[in] j2klen length of j2k codestream 51 | * @return length of cidx box 52 | */ 53 | int opj_write_cidx(int offset, opj_stream_private_t *cio, 54 | opj_codestream_info_t cstr_info, int j2klen, 55 | opj_event_mgr_t * p_manager); 56 | 57 | /* 58 | * Check if EPH option is used 59 | * 60 | * @param[in] coff offset of j2k codestream 61 | * @param[in] markers marker information 62 | * @param[in] marknum number of markers 63 | * @param[in] cio file output handle 64 | * @return true if EPH is used 65 | */ 66 | OPJ_BOOL opj_check_EPHuse(int coff, opj_marker_info_t *markers, int marknum, 67 | opj_stream_private_t *cio, 68 | opj_event_mgr_t * p_manager); 69 | 70 | #endif /* !CIDX_MANAGER_H_ */ 71 | -------------------------------------------------------------------------------- /src/lib/openjp2/image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef OPJ_IMAGE_H 32 | #define OPJ_IMAGE_H 33 | /** 34 | @file image.h 35 | @brief Implementation of operations on images (IMAGE) 36 | 37 | The functions in IMAGE.C have for goal to realize operations on images. 38 | */ 39 | 40 | struct opj_image; 41 | struct opj_cp; 42 | 43 | /** @defgroup IMAGE IMAGE - Implementation of operations on images */ 44 | /*@{*/ 45 | 46 | /** 47 | * Create an empty image 48 | * 49 | * @return returns an empty image if successful, returns NULL otherwise 50 | */ 51 | opj_image_t* opj_image_create0(void); 52 | 53 | 54 | 55 | /** 56 | * Updates the components characteristics of the image from the coding parameters. 57 | * 58 | * @param p_image_header the image header to update. 59 | * @param p_cp the coding parameters from which to update the image. 60 | */ 61 | void opj_image_comp_header_update(opj_image_t * p_image, 62 | const struct opj_cp* p_cp); 63 | 64 | void opj_copy_image_header(const opj_image_t* p_image_src, 65 | opj_image_t* p_image_dest); 66 | 67 | /*@}*/ 68 | 69 | #endif /* OPJ_IMAGE_H */ 70 | 71 | -------------------------------------------------------------------------------- /src/lib/openjp2/invert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2008, Jerome Fimes, Communications & Systemes 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef OPJ_INVERT_H 33 | #define OPJ_INVERT_H 34 | /** 35 | @file invert.h 36 | @brief Implementation of the matrix inversion 37 | 38 | The function in INVERT.H compute a matrix inversion with a LUP method 39 | */ 40 | 41 | /** @defgroup INVERT INVERT - Implementation of a matrix inversion */ 42 | /*@{*/ 43 | /** @name Exported functions */ 44 | /*@{*/ 45 | /* ----------------------------------------------------------------------- */ 46 | 47 | /** 48 | * Calculates a n x n double matrix inversion with a LUP method. Data is aligned, rows after rows (or columns after columns). 49 | * The function does not take ownership of any memory block, data must be fred by the user. 50 | * 51 | * @param pSrcMatrix the matrix to invert. 52 | * @param pDestMatrix data to store the inverted matrix. 53 | * @param nb_compo size of the matrix 54 | * @return OPJ_TRUE if the inversion is successful, OPJ_FALSE if the matrix is singular. 55 | */ 56 | OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix, 57 | OPJ_FLOAT32 * pDestMatrix, 58 | OPJ_UINT32 nb_compo); 59 | /* ----------------------------------------------------------------------- */ 60 | /*@}*/ 61 | 62 | /*@}*/ 63 | 64 | #endif /* OPJ_INVERT_H */ 65 | -------------------------------------------------------------------------------- /src/lib/openjp2/libopenjp2.pc.cmake.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | bindir=@bindir@ 3 | mandir=@mandir@ 4 | docdir=@docdir@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: openjp2 9 | Description: JPEG2000 library (Part 1 and 2) 10 | URL: http://www.openjpeg.org/ 11 | Version: @OPENJPEG_VERSION@ 12 | Libs: -L${libdir} -lopenjp2 13 | Libs.private: -lm 14 | Cflags: -I${includedir} 15 | Cflags.private: -DOPJ_STATIC 16 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_clock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #include "opj_includes.h" 33 | 34 | #ifdef _WIN32 35 | #include 36 | #else 37 | #include 38 | #include 39 | #include 40 | #endif /* _WIN32 */ 41 | 42 | OPJ_FLOAT64 opj_clock(void) 43 | { 44 | #ifdef _WIN32 45 | /* _WIN32: use QueryPerformance (very accurate) */ 46 | LARGE_INTEGER freq, t ; 47 | /* freq is the clock speed of the CPU */ 48 | QueryPerformanceFrequency(&freq) ; 49 | /* cout << "freq = " << ((double) freq.QuadPart) << endl; */ 50 | /* t is the high resolution performance counter (see MSDN) */ 51 | QueryPerformanceCounter(& t) ; 52 | return ((OPJ_FLOAT64) t.QuadPart / (OPJ_FLOAT64) freq.QuadPart) ; 53 | #else 54 | /* Unix or Linux: use resource usage */ 55 | struct rusage t; 56 | OPJ_FLOAT64 procTime; 57 | /* (1) Get the rusage data structure at this moment (man getrusage) */ 58 | getrusage(0, &t); 59 | /* (2) What is the elapsed time ? - CPU time = User time + System time */ 60 | /* (2a) Get the seconds */ 61 | procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); 62 | /* (2b) More precisely! Get the microseconds part ! */ 63 | return (procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 64 | 1e-6) ; 65 | #endif 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_clock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2005, Herve Drolon, FreeImage Team 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef OPJ_CLOCK_H 32 | #define OPJ_CLOCK_H 33 | /** 34 | @file opj_clock.h 35 | @brief Internal function for timing 36 | 37 | The functions in OPJ_CLOCK.C are internal utilities mainly used for timing. 38 | */ 39 | 40 | /** @defgroup MISC MISC - Miscellaneous internal functions */ 41 | /*@{*/ 42 | 43 | /** @name Exported functions */ 44 | /*@{*/ 45 | /* ----------------------------------------------------------------------- */ 46 | 47 | /** 48 | Difference in successive opj_clock() calls tells you the elapsed time 49 | @return Returns time in seconds 50 | */ 51 | OPJ_FLOAT64 opj_clock(void); 52 | 53 | /* ----------------------------------------------------------------------- */ 54 | /*@}*/ 55 | 56 | /*@}*/ 57 | 58 | #endif /* OPJ_CLOCK_H */ 59 | 60 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2017, IntoPIX SA 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef OPJ_COMMMON_H 32 | #define OPJ_COMMMON_H 33 | 34 | /* 35 | ========================================================== 36 | Common constants shared among several modules 37 | ========================================================== 38 | */ 39 | #define OPJ_COMMON_CBLK_DATA_EXTRA 2 /**< Margin for a fake FFFF marker */ 40 | 41 | 42 | #define OPJ_COMP_PARAM_DEFAULT_CBLOCKW 64 43 | #define OPJ_COMP_PARAM_DEFAULT_CBLOCKH 64 44 | #define OPJ_COMP_PARAM_DEFAULT_PROG_ORDER OPJ_LRCP 45 | #define OPJ_COMP_PARAM_DEFAULT_NUMRESOLUTION 6 46 | 47 | #endif /* OPJ_COMMMON_H */ 48 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_config.h.cmake.in: -------------------------------------------------------------------------------- 1 | /* create opj_config.h for CMake */ 2 | #cmakedefine OPJ_HAVE_STDINT_H @OPJ_HAVE_STDINT_H@ 3 | 4 | /*--------------------------------------------------------------------------*/ 5 | /* OpenJPEG Versioning */ 6 | 7 | /* Version number. */ 8 | #define OPJ_VERSION_MAJOR @OPENJPEG_VERSION_MAJOR@ 9 | #define OPJ_VERSION_MINOR @OPENJPEG_VERSION_MINOR@ 10 | #define OPJ_VERSION_BUILD @OPENJPEG_VERSION_BUILD@ 11 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_config_private.h.cmake.in: -------------------------------------------------------------------------------- 1 | /* create opj_config_private.h for CMake */ 2 | #cmakedefine OPJ_HAVE_INTTYPES_H @OPJ_HAVE_INTTYPES_H@ 3 | 4 | #define OPJ_PACKAGE_VERSION "@PACKAGE_VERSION@" 5 | 6 | /* Not used by openjp2*/ 7 | /*#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@*/ 8 | /*#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@*/ 9 | /*#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@*/ 10 | /*#cmakedefine HAVE_STRING_H @HAVE_STRING_H@*/ 11 | /*#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@*/ 12 | /*#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ */ 13 | /*#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@*/ 14 | 15 | #cmakedefine _LARGEFILE_SOURCE 16 | #cmakedefine _LARGE_FILES 17 | #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ 18 | #cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@ 19 | 20 | /* find whether or not have */ 21 | #cmakedefine OPJ_HAVE_MALLOC_H 22 | /* check if function `aligned_alloc` exists */ 23 | #cmakedefine OPJ_HAVE_ALIGNED_ALLOC 24 | /* check if function `_aligned_malloc` exists */ 25 | #cmakedefine OPJ_HAVE__ALIGNED_MALLOC 26 | /* check if function `memalign` exists */ 27 | #cmakedefine OPJ_HAVE_MEMALIGN 28 | /* check if function `posix_memalign` exists */ 29 | #cmakedefine OPJ_HAVE_POSIX_MEMALIGN 30 | 31 | #if !defined(_POSIX_C_SOURCE) 32 | #if defined(OPJ_HAVE_FSEEKO) || defined(OPJ_HAVE_POSIX_MEMALIGN) 33 | /* Get declarations of fseeko, ftello, posix_memalign. */ 34 | #define _POSIX_C_SOURCE 200112L 35 | #endif 36 | #endif 37 | 38 | /* Byte order. */ 39 | /* All compilers that support Mac OS X define either __BIG_ENDIAN__ or 40 | __LITTLE_ENDIAN__ to match the endianness of the architecture being 41 | compiled for. This is not necessarily the same as the architecture of the 42 | machine doing the building. In order to support Universal Binaries on 43 | Mac OS X, we prefer those defines to decide the endianness. 44 | On other platforms we use the result of the TRY_RUN. */ 45 | #if !defined(__APPLE__) 46 | #cmakedefine OPJ_BIG_ENDIAN 47 | #elif defined(__BIG_ENDIAN__) 48 | # define OPJ_BIG_ENDIAN 49 | #endif 50 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_inttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2012, Mathieu Malaterre 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef OPJ_INTTYPES_H 32 | #define OPJ_INTTYPES_H 33 | 34 | #include "opj_config_private.h" 35 | #ifdef OPJ_HAVE_INTTYPES_H 36 | #include 37 | #else 38 | #if defined(_WIN32) 39 | #define PRId64 "I64d" 40 | #define PRIi64 "I64i" 41 | #define PRIu64 "I64u" 42 | #define PRIx64 "I64x" 43 | #else 44 | #error unsupported platform 45 | #endif 46 | #endif 47 | 48 | #endif /* OPJ_INTTYPES_H */ 49 | -------------------------------------------------------------------------------- /src/lib/openjp2/opj_stdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2012, Mathieu Malaterre 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | #ifndef OPJ_STDINT_H 32 | #define OPJ_STDINT_H 33 | 34 | #include "opj_config.h" 35 | #ifdef OPJ_HAVE_STDINT_H 36 | #include 37 | #else 38 | #if defined(_WIN32) 39 | typedef signed __int8 int8_t; 40 | typedef unsigned __int8 uint8_t; 41 | typedef signed __int16 int16_t; 42 | typedef unsigned __int16 uint16_t; 43 | typedef signed __int32 int32_t; 44 | typedef unsigned __int32 uint32_t; 45 | typedef signed __int64 int64_t; 46 | typedef unsigned __int64 uint64_t; 47 | #else 48 | #error unsupported platform 49 | #endif 50 | #endif 51 | 52 | #endif /* OPJ_STDINT_H */ 53 | -------------------------------------------------------------------------------- /src/lib/openjp2/tls_keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2016, Even Rouault 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef OPJ_TLS_KEYS_H 33 | #define OPJ_TLS_KEYS_H 34 | 35 | #define OPJ_TLS_KEY_T1 0 36 | 37 | #endif /* OPJ_TLS_KEY_H */ 38 | -------------------------------------------------------------------------------- /src/lib/openjpip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_regular_expression("^.*$") 2 | 3 | add_definitions(-DUSE_JPIP) 4 | 5 | include_directories( 6 | ${CMAKE_CURRENT_SOURCE_DIR} 7 | ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h 8 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2 9 | ${FCGI_INCLUDE_DIRS} 10 | ${CURL_INCLUDE_DIRS} 11 | ) 12 | 13 | # Defines the source code for the library 14 | set(OPENJPIP_SRCS 15 | ${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c 16 | ${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c 17 | ${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c 18 | ${CMAKE_CURRENT_SOURCE_DIR}/marker_manager.c 19 | ${CMAKE_CURRENT_SOURCE_DIR}/msgqueue_manager.c 20 | ${CMAKE_CURRENT_SOURCE_DIR}/box_manager.c 21 | ${CMAKE_CURRENT_SOURCE_DIR}/faixbox_manager.c 22 | ${CMAKE_CURRENT_SOURCE_DIR}/index_manager.c 23 | ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.c 24 | ${CMAKE_CURRENT_SOURCE_DIR}/placeholder_manager.c 25 | ${CMAKE_CURRENT_SOURCE_DIR}/byte_manager.c 26 | ${CMAKE_CURRENT_SOURCE_DIR}/ihdrbox_manager.c 27 | ${CMAKE_CURRENT_SOURCE_DIR}/manfbox_manager.c 28 | ${CMAKE_CURRENT_SOURCE_DIR}/mhixbox_manager.c 29 | ${CMAKE_CURRENT_SOURCE_DIR}/target_manager.c 30 | ${CMAKE_CURRENT_SOURCE_DIR}/cachemodel_manager.c 31 | ${CMAKE_CURRENT_SOURCE_DIR}/j2kheader_manager.c 32 | ${CMAKE_CURRENT_SOURCE_DIR}/jp2k_encoder.c 33 | ${CMAKE_CURRENT_SOURCE_DIR}/openjpip.c 34 | ${CMAKE_CURRENT_SOURCE_DIR}/query_parser.c 35 | ${CMAKE_CURRENT_SOURCE_DIR}/channel_manager.c 36 | ${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c 37 | ${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c 38 | ${CMAKE_CURRENT_SOURCE_DIR}/sock_manager.c 39 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/opj_malloc.c 40 | ) 41 | 42 | set(SERVER_SRCS 43 | ${CMAKE_CURRENT_SOURCE_DIR}/auxtrans_manager.c 44 | ) 45 | 46 | set(LOCAL_SRCS 47 | ${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c 48 | ${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c 49 | ${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c 50 | ${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c 51 | ${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c 52 | ) 53 | 54 | # Build the library 55 | if(WIN32) 56 | if(BUILD_SHARED_LIBS) 57 | add_definitions(-DOPJ_EXPORTS) 58 | else() 59 | add_definitions(-DOPJ_STATIC) 60 | endif() 61 | endif() 62 | add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS}) 63 | set_target_properties(openjpip 64 | PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) 65 | if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12") 66 | target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS}) 67 | endif() 68 | target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME}) 69 | if(WIN32) 70 | # add Winsock on windows+mingw 71 | target_link_libraries(openjpip ws2_32) 72 | endif() 73 | 74 | # Install library 75 | install(TARGETS openjpip 76 | EXPORT OpenJPEGTargets 77 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications 78 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries 79 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries 80 | ) 81 | 82 | if(BUILD_JPIP_SERVER) 83 | add_library(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS}) 84 | target_link_libraries(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 85 | set_target_properties(openjpip_server 86 | PROPERTIES COMPILE_FLAGS "-DSERVER") 87 | install(TARGETS openjpip_server 88 | EXPORT OpenJPEGTargets 89 | DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries 90 | ) 91 | endif() 92 | -------------------------------------------------------------------------------- /src/lib/openjpip/auxtrans_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef AUXTRANS_MANAGER_H_ 32 | # define AUXTRANS_MANAGER_H_ 33 | 34 | #include "sock_manager.h" 35 | #include "opj_includes.h" 36 | 37 | /** auxiliary transport setting parameters*/ 38 | typedef struct auxtrans_param { 39 | int tcpauxport; /**< tcp port*/ 40 | int udpauxport; /**< udp port*/ 41 | SOCKET tcplistensock; /**< listenning socket for aux tcp (-1 if not open)*/ 42 | SOCKET udplistensock; /**< listenning socket for aux udp (-1 if not open)*/ 43 | } auxtrans_param_t; 44 | 45 | /** 46 | * Initialize auxiliary transport server of JPIP server 47 | * 48 | * @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152-65535) 49 | * @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535) 50 | * @return initialized transport parameters 51 | */ 52 | auxtrans_param_t init_aux_transport(int tcp_auxport, int udp_auxport); 53 | 54 | /** 55 | * Close auxiliary transport server of JPIP server 56 | * 57 | * @param[in] auxtrans closing transport server 58 | */ 59 | void close_aux_transport(auxtrans_param_t auxtrans); 60 | 61 | /** 62 | * Send response data on aux transport 63 | * 64 | * @param[in] istcp true if tcp, false if udp 65 | * @param[in] auxtrans available transport parameters 66 | * @param[in] cid channel ID 67 | * @param[in] data sending data 68 | * @param[in] length length of data 69 | * @param[in] maxlenPerFrame maximum data length to send per frame 70 | */ 71 | void send_responsedata_on_aux(OPJ_BOOL istcp, auxtrans_param_t auxtrans, 72 | const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame); 73 | 74 | #endif /* !AUXTRANS_MANAGER_H_ */ 75 | -------------------------------------------------------------------------------- /src/lib/openjpip/boxheader_manager.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "boxheader_manager.h" 36 | #include "opj_inttypes.h" 37 | 38 | #ifdef SERVER 39 | #include "fcgi_stdio.h" 40 | #define logstream FCGI_stdout 41 | #else 42 | #define FCGI_stdout stdout 43 | #define FCGI_stderr stderr 44 | #define logstream stderr 45 | #endif /*SERVER*/ 46 | 47 | 48 | boxheader_param_t * gene_boxheader(int fd, OPJ_OFF_T offset) 49 | { 50 | Byte8_t boxlen; 51 | Byte_t headlen; 52 | char *boxtype; 53 | boxheader_param_t *boxheader; 54 | 55 | boxlen = fetch_4bytebigendian(fd, offset); 56 | boxtype = (char *)fetch_bytes(fd, offset + 4, 4); 57 | headlen = 8; 58 | 59 | if (boxlen == 1) { /* read XLBox */ 60 | boxlen = fetch_8bytebigendian(fd, offset + 8); 61 | headlen = 16; 62 | } 63 | 64 | boxheader = (boxheader_param_t *)malloc(sizeof(boxheader_param_t)); 65 | boxheader->headlen = headlen; 66 | boxheader->length = boxlen; 67 | strncpy(boxheader->type, boxtype, 4); 68 | boxheader->next = NULL; 69 | 70 | free(boxtype); 71 | return boxheader; 72 | } 73 | 74 | boxheader_param_t * gene_childboxheader(box_param_t *superbox, OPJ_OFF_T offset) 75 | { 76 | return gene_boxheader(superbox->fd, get_DBoxoff(superbox) + offset); 77 | } 78 | 79 | void print_boxheader(boxheader_param_t *boxheader) 80 | { 81 | fprintf(logstream, "boxheader info:\n" 82 | "\t type: %.4s\n" 83 | "\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, 84 | boxheader->length); 85 | } 86 | -------------------------------------------------------------------------------- /src/lib/openjpip/boxheader_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef BOXHEADER_MANAGER_H_ 32 | # define BOXHEADER_MANAGER_H_ 33 | 34 | #include "openjpeg.h" 35 | #include "byte_manager.h" 36 | #include "box_manager.h" 37 | 38 | /** box header parameters*/ 39 | typedef struct boxheader_param { 40 | Byte_t headlen; /**< header length 8 or 16*/ 41 | Byte8_t length; /**< length of the reference Box*/ 42 | char type[4]; /**< type of information in the DBox*/ 43 | struct boxheader_param *next; /**< pointer to the next header box*/ 44 | } boxheader_param_t; 45 | 46 | 47 | /** 48 | * generate a box header at the given offset 49 | * 50 | * @param[in] fd file discriptor of the JP2 file 51 | * @param[in] offset Box offset 52 | * @return pointer to the structure of generate box header parameters 53 | */ 54 | boxheader_param_t * gene_boxheader(int fd, OPJ_OFF_T offset); 55 | 56 | /** 57 | * generate a child box header at the given offset 58 | * 59 | * @param[in] superbox super box pointer 60 | * @param[in] offset offset from DBox first byte of superbox 61 | * @return pointer to the structure of generate box header parameters 62 | */ 63 | boxheader_param_t * gene_childboxheader(box_param_t *superbox, 64 | OPJ_OFF_T offset); 65 | 66 | /** 67 | * print box header parameters 68 | * 69 | * @param[in] boxheader boxheader pointer 70 | */ 71 | void print_boxheader(boxheader_param_t *boxheader); 72 | 73 | #endif /* !BOXHEADER_MANAGER_H_ */ 74 | -------------------------------------------------------------------------------- /src/lib/openjpip/codestream_manager.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include "codestream_manager.h" 33 | #include "opj_inttypes.h" 34 | 35 | #ifdef SERVER 36 | #include "fcgi_stdio.h" 37 | #define logstream FCGI_stdout 38 | #else 39 | #define FCGI_stdout stdout 40 | #define FCGI_stderr stderr 41 | #define logstream stderr 42 | #endif /*SERVER */ 43 | 44 | codestream_param_t set_codestream(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length) 45 | { 46 | codestream_param_t cs; 47 | 48 | cs.fd = fd; 49 | cs.offset = offset; 50 | cs.length = length; 51 | 52 | return cs; 53 | } 54 | 55 | Byte_t * fetch_codestreambytes(codestream_param_t *cs, OPJ_OFF_T offset, 56 | OPJ_SIZE_T size) 57 | { 58 | return fetch_bytes(cs->fd, cs->offset + offset, size); 59 | } 60 | 61 | Byte_t fetch_codestream1byte(codestream_param_t *cs, OPJ_OFF_T offset) 62 | { 63 | return fetch_1byte(cs->fd, cs->offset + offset); 64 | } 65 | 66 | Byte2_t fetch_codestream2bytebigendian(codestream_param_t *cs, OPJ_OFF_T offset) 67 | { 68 | return fetch_2bytebigendian(cs->fd, cs->offset + offset); 69 | } 70 | 71 | Byte4_t fetch_codestream4bytebigendian(codestream_param_t *cs, OPJ_OFF_T offset) 72 | { 73 | return fetch_4bytebigendian(cs->fd, cs->offset + offset); 74 | } 75 | 76 | void print_codestream(codestream_param_t cs) 77 | { 78 | fprintf(logstream, "codestream info:\n" 79 | "\t fd: %d\n" 80 | "\t offset: %#" PRIx64 "\n" 81 | "\t length: %#" PRIx64 "\n", cs.fd, cs.offset, cs.length); 82 | } 83 | -------------------------------------------------------------------------------- /src/lib/openjpip/ihdrbox_manager.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | #include "ihdrbox_manager.h" 35 | 36 | ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist, 37 | Byte_t *jpipstream) 38 | { 39 | ihdrbox_param_t *ihdrbox; 40 | metadata_param_t *meta; 41 | box_param_t *jp2h, *ihdr; 42 | int bpc_val; 43 | 44 | jp2h = NULL; 45 | meta = metadatalist->first; 46 | while (meta) { 47 | if (meta->boxlist) { 48 | jp2h = search_box("jp2h", meta->boxlist); 49 | if (jp2h) { 50 | break; 51 | } 52 | } 53 | meta = meta->next; 54 | } 55 | if (!jp2h) { 56 | fprintf(stderr, "jp2h box not found\n"); 57 | return NULL; 58 | } 59 | 60 | ihdr = gene_boxbyTypeinStream(jpipstream, get_DBoxoff(jp2h), get_DBoxlen(jp2h), 61 | "ihdr"); 62 | 63 | if (!ihdr) { 64 | fprintf(stderr, "ihdr box not found\n"); 65 | return NULL; 66 | } 67 | 68 | ihdrbox = (ihdrbox_param_t *)malloc(sizeof(ihdrbox_param_t)); 69 | 70 | ihdrbox->height = big4(jpipstream + get_DBoxoff(ihdr)); 71 | ihdrbox->width = big4(jpipstream + get_DBoxoff(ihdr) + 4); 72 | ihdrbox->nc = big2(jpipstream + get_DBoxoff(ihdr) + 8); 73 | bpc_val = *(jpipstream + get_DBoxoff(ihdr) + 10) + 1; 74 | assert(bpc_val >= 0 && bpc_val <= 255); 75 | ihdrbox->bpc = (Byte_t)bpc_val; 76 | 77 | free(ihdr); 78 | 79 | return ihdrbox; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/lib/openjpip/ihdrbox_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef IHDRBOX_MANAGER_H_ 32 | # define IHDRBOX_MANAGER_H_ 33 | 34 | #include "byte_manager.h" 35 | #include "box_manager.h" 36 | #include "metadata_manager.h" 37 | 38 | /** I.5.3.1 Image Header box*/ 39 | typedef struct ihdrbox_param { 40 | Byte4_t height; 41 | Byte4_t width; 42 | Byte2_t nc; /**< number of components*/ 43 | Byte_t bpc; /**< bits per component*/ 44 | } ihdrbox_param_t; 45 | 46 | /** 47 | * generate ihdr box 48 | * 49 | * @param[in] metadatalist metadata list pointer 50 | * @param[in] jpipstream JPT/JPP stream 51 | * @return pointer to generated ihdr box 52 | */ 53 | ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist, 54 | Byte_t *jpipstream); 55 | 56 | 57 | #endif /* !IHDRBOX_MANAGER_H_ */ 58 | -------------------------------------------------------------------------------- /src/lib/openjpip/jp2k_decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef JP2K_DECODER_H_ 32 | # define JP2K_DECODER_H_ 33 | 34 | #include "byte_manager.h" 35 | #include "ihdrbox_manager.h" 36 | 37 | Byte_t * j2k_to_pnm(const char *fn, ihdrbox_param_t **ihdrbox); 38 | 39 | #endif /* !JP2K_DECODER_H_ */ 40 | -------------------------------------------------------------------------------- /src/lib/openjpip/jp2k_encoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * Copyright (c) 2011, Lucian Corlaciu, GSoC 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef JP2K_ENCODER_H_ 33 | # define JP2K_ENCODER_H_ 34 | 35 | #include "byte_manager.h" 36 | #include "msgqueue_manager.h" 37 | 38 | /** 39 | * reconstruct j2k codestream from message queue 40 | * 41 | * @param[in] msgqueue message queue pointer 42 | * @param[in] jpipstream original jpt- jpp- stream 43 | * @param[in] csn codestream number 44 | * @param[in] fw reconstructing image frame width 45 | * @param[in] fh reconstructing image frame height 46 | * @param[out] j2klen pointer to the j2k codestream length 47 | * @return generated reconstructed j2k codestream 48 | */ 49 | Byte_t * recons_j2k(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, 50 | int fw, int fh, Byte8_t *j2klen); 51 | 52 | 53 | /** 54 | * reconstruct jp2 file codestream from message queue 55 | * 56 | * @param[in] msgqueue message queue pointer 57 | * @param[in] jpipstream original jpt- jpp- stream 58 | * @param[in] csn codestream number 59 | * @param[out] jp2len pointer to the jp2 codestream length 60 | * @return generated reconstructed jp2 codestream 61 | */ 62 | Byte_t * recons_jp2(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, 63 | Byte8_t *jp2len); 64 | 65 | /** 66 | * reconstruct j2k codestream of mainheader from message queue 67 | * 68 | * @param[in] msgqueue message queue pointer 69 | * @param[in] jpipstream original jpt- jpp- stream 70 | * @param[in] csn codestream number 71 | * @param[out] j2klen pointer to the j2k codestream length 72 | * @return generated reconstructed j2k codestream 73 | */ 74 | Byte_t * recons_j2kmainhead(msgqueue_param_t *msgqueue, Byte_t *jpipstream, 75 | Byte8_t csn, Byte8_t *j2klen); 76 | 77 | #endif /* !JP2K_ENCODER_H_ */ 78 | -------------------------------------------------------------------------------- /src/lib/openjpip/jpipstream_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "byte_manager.h" 32 | #include "msgqueue_manager.h" 33 | #include "ihdrbox_manager.h" 34 | 35 | Byte_t * update_JPIPstream(Byte_t *newstream, OPJ_SIZE_T newstreamlen, 36 | Byte_t *cache_stream, OPJ_SIZE_T *streamlen); 37 | 38 | void save_codestream(Byte_t *codestream, OPJ_SIZE_T streamlen, const char *fmt); 39 | 40 | Byte_t * jpipstream_to_pnm(Byte_t *jpipstream, msgqueue_param_t *msgqueue, 41 | Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox); 42 | 43 | ihdrbox_param_t * get_SIZ_from_jpipstream(Byte_t *jpipstream, 44 | msgqueue_param_t *msgqueue, Byte8_t csn); 45 | -------------------------------------------------------------------------------- /src/lib/openjpip/libopenjpip.pc.cmake.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | bindir=@bindir@ 3 | mandir=@mandir@ 4 | docdir=@docdir@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: openjpip 9 | Description: JPEG2000 Interactivity tools, APIs and protocols (Part 9) 10 | URL: http://www.openjpeg.org/ 11 | Version: @OPENJPEG_VERSION@ 12 | Requires: libopenjp2 13 | Libs: -L${libdir} -lopenjpip 14 | Libs.private: -lm -lcurl -lfcgi -lpthread 15 | Cflags: -I${includedir} 16 | Cflags.private: -DOPJ_STATIC 17 | -------------------------------------------------------------------------------- /src/lib/openjpip/manfbox_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef MANFBOX_MANAGER_H_ 32 | # define MANFBOX_MANAGER_H_ 33 | 34 | #include "byte_manager.h" 35 | #include "box_manager.h" 36 | #include "boxheader_manager.h" 37 | 38 | 39 | /** manifest box parameters*/ 40 | /** I.3.2.3 Manifest box*/ 41 | typedef struct manfbox_param { 42 | boxheader_param_t *first; /**< top of the box header list*/ 43 | } manfbox_param_t; 44 | 45 | 46 | /** 47 | * generate manifest box 48 | * 49 | * @param[in] box pointer to the reference manf box 50 | * @return generated manfbox 51 | */ 52 | manfbox_param_t * gene_manfbox(box_param_t *box); 53 | 54 | 55 | /** 56 | * delete manifest box 57 | * 58 | * @param[in,out] manf addressof the manfbox pointer 59 | */ 60 | void delete_manfbox(manfbox_param_t **manf); 61 | 62 | 63 | /** 64 | * print manf box parameters 65 | * 66 | * @param[in] manf manf box pointer 67 | */ 68 | void print_manfbox(manfbox_param_t *manf); 69 | 70 | 71 | /** 72 | * search a boxheader by box type from manifest box 73 | * 74 | * @param[in] type box type 75 | * @param[in] manf manf box pointer 76 | * @return found box pointer 77 | */ 78 | boxheader_param_t * search_boxheader(const char type[], manfbox_param_t *manf); 79 | 80 | 81 | #endif /* !MANFBOX_MANAGER_H_ */ 82 | -------------------------------------------------------------------------------- /src/lib/openjpip/marker_manager.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 5 | * Copyright (c) 2002-2014, Professor Benoit Macq 6 | * Copyright (c) 2010-2011, Kaori Hagihara 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "marker_manager.h" 32 | 33 | #ifdef SERVER 34 | #include "fcgi_stdio.h" 35 | #define logstream FCGI_stdout 36 | #else 37 | #define FCGI_stdout stdout 38 | #define FCGI_stderr stderr 39 | #define logstream stderr 40 | #endif /*SERVER */ 41 | 42 | marker_param_t set_marker(codestream_param_t cs, Byte2_t code, OPJ_OFF_T offset, 43 | Byte2_t length) 44 | { 45 | marker_param_t mkr; 46 | 47 | mkr.cs = cs; 48 | mkr.code = code; 49 | mkr.offset = offset; 50 | mkr.length = length; 51 | 52 | return mkr; 53 | } 54 | 55 | 56 | Byte_t fetch_marker1byte(marker_param_t marker, OPJ_OFF_T offset) 57 | { 58 | return fetch_codestream1byte(&(marker.cs), marker.offset + offset); 59 | } 60 | 61 | Byte2_t fetch_marker2bytebigendian(marker_param_t marker, OPJ_OFF_T offset) 62 | { 63 | return fetch_codestream2bytebigendian(&(marker.cs), marker.offset + offset); 64 | } 65 | 66 | Byte4_t fetch_marker4bytebigendian(marker_param_t marker, OPJ_OFF_T offset) 67 | { 68 | return fetch_codestream4bytebigendian(&(marker.cs), marker.offset + offset); 69 | } 70 | -------------------------------------------------------------------------------- /tests/fuzzers/GNUmakefile: -------------------------------------------------------------------------------- 1 | default: dummyfuzzers 2 | 3 | clean: 4 | $(RM) -f *.o *.a 5 | 6 | fuzzingengine.o: fuzzingengine.c 7 | $(CC) $(CFLAGS) -c -o $@ $< 8 | 9 | dummyfuzzers: fuzzingengine.o 10 | $(AR) r libFuzzingEngine.a fuzzingengine.o 11 | LIB_FUZZING_ENGINE="-lFuzzingEngine" CXX="${CXX}" CXXFLAGS="-L. ${CXXFLAGS}" \ 12 | SRC=/tmp OUT=/tmp ./build_google_oss_fuzzers.sh 13 | OUT=/tmp ./build_seed_corpus.sh 14 | -------------------------------------------------------------------------------- /tests/fuzzers/README.TXT: -------------------------------------------------------------------------------- 1 | This directory contain fuzzer main functions and scripts for the 2 | Google OSS Fuzz project: https://github.com/google/oss-fuzz/ 3 | 4 | The main build scripts are in: 5 | https://github.com/google/oss-fuzz/tree/master/projects/openjpeg 6 | and call scripts in this directory. 7 | 8 | The list of issues is in: 9 | https://bugs.chromium.org/p/oss-fuzz/issues/list?q=openjpeg 10 | 11 | 12 | - Simulate the build of (dummy) fuzzers like OSS Fuzz does: 13 | 14 | Preliminary steps: 15 | $ cd ${ROOT_OF_OPENJPEG} 16 | $ git clone --depth 1 https://github.com/uclouvain/openjpeg-data data 17 | $ mkdir build 18 | $ cd build 19 | $ cmake .. 20 | $ make 21 | $ cd .. 22 | 23 | Actual building of fuzzer and seed corpus: 24 | $ cd tests/fuzzers 25 | $ make 26 | 27 | They are created in /tmp/*_fuzzer as well as with the 28 | /tmp/*_fuzzer_seed_corpus.zip files 29 | 30 | Run one: 31 | $ /tmp/opj_decompress_fuzzer a_file_name 32 | 33 | - Run locally OSS Fuzz: 34 | $ git clone https://github.com/google/oss-fuzz.git 35 | $ cd oss-fuzz 36 | $ python infra/helper.py build_image openjpeg 37 | 38 | Build fuzzers with the address sanitizer (could use undefined, etc...) 39 | $ python infra/helper.py build_fuzzers --sanitizer address openjpeg 40 | 41 | Test a particular fuzzer (replace opj_decompress_fuzzer by other fuzzers 42 | like the ones generated in /tmp by "make dummyfuzzers") 43 | $ python infra/helper.py run_fuzzer openjpeg opj_decompress_fuzzer 44 | 45 | 46 | How to deal with issues reported in https://bugs.chromium.org/p/oss-fuzz/issues/list?q=openjpeg ? 47 | 48 | 1. Leave a comment in (chromium database) bug entry to indicate that you work on it 49 | 2. Work 50 | 3. Commit a bug fix with log including "Credit to OSS-Fuzz" and a link to the bugs.chromium.org ticket 51 | 4. Add in the bugs.chromium.org ticket a link to the github commit implementing the fix. 52 | 5. Check chromium closed the bug (after one or two days typically) 53 | -------------------------------------------------------------------------------- /tests/fuzzers/build_google_oss_fuzzers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$SRC" == "" ]; then 6 | echo "SRC env var not defined" 7 | exit 1 8 | fi 9 | 10 | if [ "$OUT" == "" ]; then 11 | echo "OUT env var not defined" 12 | exit 1 13 | fi 14 | 15 | if [ "$CXX" == "" ]; then 16 | echo "CXX env var not defined" 17 | exit 1 18 | fi 19 | 20 | SRC_DIR=$(dirname $0)/../.. 21 | 22 | build_fuzzer() 23 | { 24 | fuzzerName=$1 25 | sourceFilename=$2 26 | shift 27 | shift 28 | echo "Building fuzzer $fuzzerName" 29 | $CXX $CXXFLAGS -std=c++11 -I$SRC_DIR/src/lib/openjp2 -I$SRC_DIR/build/src/lib/openjp2 \ 30 | $sourceFilename $* -o $OUT/$fuzzerName \ 31 | $LIB_FUZZING_ENGINE $SRC_DIR/build/bin/libopenjp2.a -lm -lpthread 32 | } 33 | 34 | fuzzerFiles=$(dirname $0)/*.cpp 35 | for F in $fuzzerFiles; do 36 | fuzzerName=$(basename $F .cpp) 37 | build_fuzzer $fuzzerName $F 38 | done 39 | 40 | -------------------------------------------------------------------------------- /tests/fuzzers/build_seed_corpus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$OUT" == "" ]; then 6 | echo "OUT env var not defined" 7 | exit 1 8 | fi 9 | 10 | SRC_DIR=$(dirname $0)/../.. 11 | 12 | cd $SRC_DIR/data/input/conformance 13 | rm -f $OUT/opj_decompress_fuzzer_seed_corpus.zip 14 | zip $OUT/opj_decompress_fuzzer_seed_corpus.zip *.jp2 *.j2k 15 | cd $OLDPWD 16 | 17 | cd $SRC_DIR/data/input/nonregression/htj2k 18 | zip $OUT/opj_decompress_fuzzer_seed_corpus.zip *.j2k *.jhc *.jph 19 | cd $OLDPWD 20 | -------------------------------------------------------------------------------- /tests/fuzzers/fuzzingengine.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The copyright in this software is being made available under the 2-clauses 3 | * BSD License, included below. This software may be subject to other third 4 | * party and contributor rights, including patent rights, and no such rights 5 | * are granted under this license. 6 | * 7 | * Copyright (c) 2017, IntoPix SA 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | int LLVMFuzzerTestOneInput(void *buf, size_t len); 36 | int LLVMFuzzerInitialize(int* argc, char*** argv); 37 | 38 | int main(int argc, char* argv[]) 39 | { 40 | LLVMFuzzerInitialize(&argc, &argv); 41 | if (argc < 2) { 42 | return LLVMFuzzerTestOneInput(" ", 1); 43 | } else { 44 | int nRet = 0; 45 | void* buf = NULL; 46 | int nLen = 0; 47 | FILE* f = fopen(argv[1], "rb"); 48 | if (!f) { 49 | fprintf(stderr, "%s does not exist.\n", argv[1]); 50 | exit(1); 51 | } 52 | fseek(f, 0, SEEK_END); 53 | nLen = (int)ftell(f); 54 | fseek(f, 0, SEEK_SET); 55 | buf = malloc(nLen); 56 | if (!buf) { 57 | fprintf(stderr, "malloc failed.\n"); 58 | fclose(f); 59 | exit(1); 60 | } 61 | if (fread(buf, nLen, 1, f) != 1) { 62 | fprintf(stderr, "fread failed.\n"); 63 | fclose(f); 64 | free(buf); 65 | exit(1); 66 | } 67 | fclose(f); 68 | nRet = LLVMFuzzerTestOneInput(buf, nLen); 69 | free(buf); 70 | return nRet; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tests/include_openjpeg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) 4 | { 5 | (void)argc; 6 | (void)argv; 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /tests/nonregression/checkmd5refs.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 Mathieu Malaterre 2 | # 3 | # Redistribution and use is allowed according to the terms of the New 4 | # BSD license. 5 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 6 | 7 | # check md5 refs 8 | # 9 | # This script will be used to make sure we never introduce a regression on any 10 | # of the nonregression file. 11 | # 12 | # The approach is relatively simple, we compute a md5sum for each of the decode 13 | # file. Anytime the md5sum is different from the reference one, we assume 14 | # something went wrong and simply fails. of course if could happen during the 15 | # course of openjpeg development that the internals are changed that impact the 16 | # decoding process that the output would be bitwise different (while PSNR would 17 | # be kept identical). 18 | 19 | # Another more conventional approach is to store the generated output from 20 | # openjpeg however storing the full generated output is generally useless since 21 | # we do not really care about the exact pixel value, we simply need to known 22 | # when a code change impact output generation. furthermore storing the 23 | # complete generated output file, tends to make the svn:/openjpeg-data really 24 | # big. 25 | 26 | # This script expect two inputs 27 | # REFFILE: Path to the md5sum.txt file 28 | # OUTFILENAME: The name of the generated file we want to check The script will 29 | # check whether a PGX or a PNG file was generated in the test suite (computed 30 | # from OUTFILENAME) 31 | 32 | get_filename_component(OUTFILENAME_NAME ${OUTFILENAME} NAME) 33 | string(FIND ${OUTFILENAME_NAME} "." SHORTEST_EXT_POS REVERSE) 34 | string(SUBSTRING ${OUTFILENAME_NAME} 0 ${SHORTEST_EXT_POS} OUTFILENAME_NAME_WE) 35 | file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png" "Temporary/${OUTFILENAME_NAME_WE}*.tif") 36 | if(NOT globfiles) 37 | message(SEND_ERROR "Could not find output PGX files: ${OUTFILENAME_NAME_WE}") 38 | endif() 39 | 40 | # REFFILE follow what `md5sum -c` would expect as input: 41 | file(READ ${REFFILE} variable) 42 | 43 | foreach(pgxfullpath ${globfiles}) 44 | file(MD5 ${pgxfullpath} output) 45 | get_filename_component(pgxfile ${pgxfullpath} NAME) 46 | 47 | string(REGEX MATCH "[0-9a-f]+ ${pgxfile}" output_var "${variable}") 48 | 49 | # Search for variant md5sum for libtiff >= 4.1 50 | string(REGEX MATCH "libtiff_4_1:[0-9a-f]+ ${pgxfile}" alternate_output_var "${variable}") 51 | 52 | set(output "${output} ${pgxfile}") 53 | 54 | if("${output_var}" STREQUAL "${output}") 55 | message(STATUS "equal: [${output_var}] vs [${output}]") 56 | elseif("${alternate_output_var}" STREQUAL "libtiff_4_1:${output}") 57 | message(STATUS "equal: [${alternate_output_var}] vs [libtiff_4_1:${output}]") 58 | else() 59 | message(SEND_ERROR "not equal: [${output_var}] vs [${output}]") 60 | endif() 61 | endforeach() 62 | -------------------------------------------------------------------------------- /tests/performance/perf_test_filelist.csv: -------------------------------------------------------------------------------- 1 | filename,iterations,threads,command,comment 2 | ../../data/input/nonregression/kodak_2layers_lrcp.j2c,3,1,DECOMPRESS, 3 | ../../data/input/nonregression/kodak_2layers_lrcp.j2c,5,2,DECOMPRESS, 4 | ../../data/input/nonregression/kodak_2layers_lrcp.j2c,10,4,DECOMPRESS, 5 | ../../data/input/conformance/p0_07.j2k,3,1,DECOMPRESS,128x128 tiles RLCP 3decomp 8layers no MCT reversible 6 | ../../data/input/conformance/p0_04.j2k,10,1,DECOMPRESS,precincts 128x128 irreversible 7 | ../../data/input/nonregression/X_4_2K_24_185_CBR_WB_000.tif,3,1,COMPRESS, 8 | -------------------------------------------------------------------------------- /tests/profiling/filter_massif_output.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright (c) 2017, IntoPIX SA 5 | # Contact: support@intopix.com 6 | # Author: Even Rouault 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | import sys 31 | 32 | lines = open(sys.argv[1], 'rt').readlines() 33 | display_next_lines = False 34 | for line in lines: 35 | line = line.replace('\n', '') 36 | if line == 'heap_tree=peak': 37 | display_next_lines = True 38 | elif display_next_lines: 39 | if line == '#-----------': 40 | break 41 | print(line) 42 | -------------------------------------------------------------------------------- /tests/unit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # UNIT TESTS 2 | 3 | include_directories( 4 | ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h 5 | ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2 6 | ) 7 | 8 | set(unit_test 9 | testempty0 10 | testempty1 11 | testempty2 12 | ) 13 | foreach(ut ${unit_test}) 14 | add_executable(${ut} ${ut}.c) 15 | target_link_libraries(${ut} openjp2) 16 | add_test(NAME ${ut} COMMAND ${ut}) 17 | endforeach() 18 | -------------------------------------------------------------------------------- /tests/unit/testempty0.c: -------------------------------------------------------------------------------- 1 | #include "openjpeg.h" 2 | 3 | int main(int argc, char **argv) { 4 | (void)argc; 5 | (void)argv; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains 3rd party libs (PNG, ZLIB)... 2 | 3 | They are convenient copy of code from people outside of the OpenJPEG community. 4 | They are solely provided for ease of build of OpenJPEG on system where those 5 | 3rd party libs are not easily accessible (typically non-UNIX). 6 | 7 | The OpenJPEG does not recommend using those 3rd party libs over your system 8 | installed libs. The OpenJPEG does not even guarantee that those libraries will 9 | work for you. 10 | -------------------------------------------------------------------------------- /thirdparty/astyle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(ASTYLE_SRCS 2 | astyle_main.cpp 3 | ASBeautifier.cpp 4 | ASEnhancer.cpp 5 | ASFormatter.cpp 6 | ASLocalizer.cpp 7 | ASResource.cpp 8 | ) 9 | 10 | if (CMAKE_VERSION VERSION_LESS "3.1") 11 | if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 12 | set (CMAKE_CXX_FLAGS "--std=c++11 ${CMAKE_CXX_FLAGS}") 13 | endif () 14 | else () 15 | set (CMAKE_CXX_STANDARD 11) 16 | endif () 17 | 18 | # No warnings for astyle build 19 | IF(NOT MSVC) 20 | SET_SOURCE_FILES_PROPERTIES(${ASTYLE_SRCS} PROPERTIES COMPILE_FLAGS -w) 21 | ENDIF(NOT MSVC) 22 | ADD_EXECUTABLE(opjstyle ${ASTYLE_SRCS}) 23 | SET_TARGET_PROPERTIES(opjstyle PROPERTIES LINKER_LANGUAGE CXX) 24 | SET_TARGET_PROPERTIES(opjstyle PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/scripts) 25 | 26 | IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 27 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++") 28 | ENDIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 29 | -------------------------------------------------------------------------------- /thirdparty/astyle/LICENSE.md: -------------------------------------------------------------------------------- 1 | ### MIT License 2 | 3 | Copyright (c) 2017 by Jim Pattee . 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/liblcms2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(liblcms2 C) 2 | # 3 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") 4 | # 5 | file(GLOB SRCS src/*.c) 6 | file(GLOB HDRS include/*.h) 7 | # 8 | set(LIBTARGET "lcms2") 9 | # 10 | add_library(${LIBTARGET} STATIC ${SRCS} ${HDRS}) 11 | # 12 | if(MSVC) 13 | set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib") 14 | endif(MSVC) 15 | # 16 | set_target_properties(${LIBTARGET} 17 | PROPERTIES 18 | OUTPUT_NAME "${LIBTARGET}" 19 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib) 20 | # 21 | -------------------------------------------------------------------------------- /thirdparty/liblcms2/COPYING: -------------------------------------------------------------------------------- 1 | Little CMS 2 | Copyright (c) 1998-2011 Marti Maria Saguer 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /thirdparty/liblcms2/src/cmscgats.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/thirdparty/liblcms2/src/cmscgats.c -------------------------------------------------------------------------------- /thirdparty/liblcms2/src/cmsopt.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/thirdparty/liblcms2/src/cmsopt.c -------------------------------------------------------------------------------- /thirdparty/liblcms2/src/cmstypes.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/thirdparty/liblcms2/src/cmstypes.c -------------------------------------------------------------------------------- /thirdparty/liblcms2/src/cmsvirt.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/thirdparty/liblcms2/src/cmsvirt.c -------------------------------------------------------------------------------- /thirdparty/liblcms2/src/cmsxform.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/thirdparty/liblcms2/src/cmsxform.c -------------------------------------------------------------------------------- /thirdparty/libpng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(libpng C) 2 | 3 | include_directories( 4 | "${CMAKE_CURRENT_SOURCE_DIR}" 5 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include 6 | ) 7 | 8 | file(GLOB SRCS *.c) 9 | file(GLOB HDRS *.h) 10 | set(EXT_HDRS 11 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h 12 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h 13 | ) 14 | # 15 | set(LIBTARGET "png") 16 | # 17 | add_library(${LIBTARGET} STATIC ${SRCS} ${HDRS} ${EXT_HDRS}) 18 | # 19 | if(MSVC) 20 | set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib") 21 | endif(MSVC) 22 | # 23 | target_link_libraries(${LIBTARGET} ${Z_LIBNAME} ${M_LIBRARY}) 24 | # 25 | set_target_properties(${LIBTARGET} 26 | PROPERTIES 27 | OUTPUT_NAME "${LIBTARGET}" 28 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib) 29 | # 30 | -------------------------------------------------------------------------------- /thirdparty/libtiff/libport.h: -------------------------------------------------------------------------------- 1 | /* $Id: libport.h,v 1.5 2015-08-19 02:31:04 bfriesen Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 2009 Frank Warmerdam 5 | * 6 | * Permission to use, copy, modify, distribute, and sell this software and 7 | * its documentation for any purpose is hereby granted without fee, provided 8 | * that (i) the above copyright notices and this permission notice appear in 9 | * all copies of the software and related documentation, and (ii) the names of 10 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 11 | * publicity relating to the software without the specific, prior written 12 | * permission of Sam Leffler and Silicon Graphics. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 16 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 17 | * 18 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 19 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 20 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 21 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 22 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 23 | * OF THIS SOFTWARE. 24 | */ 25 | 26 | #ifndef _LIBPORT_ 27 | #define _LIBPORT_ 28 | 29 | int getopt(int argc, char * const argv[], const char *optstring); 30 | extern char *optarg; 31 | extern int opterr; 32 | extern int optind; 33 | extern int optopt; 34 | 35 | int strcasecmp(const char *s1, const char *s2); 36 | 37 | #ifndef HAVE_GETOPT 38 | # define HAVE_GETOPT 1 39 | #endif 40 | 41 | #if 0 42 | unsigned long strtoul(const char *nptr, char **endptr, int base); 43 | #endif 44 | 45 | #if 0 46 | void * 47 | lfind(const void *key, const void *base, size_t *nmemb, size_t size, 48 | int(*compar)(const void *, const void *)); 49 | #endif 50 | 51 | #if !defined(HAVE_SNPRINTF) 52 | #undef vsnprintf 53 | #define vsnprintf _TIFF_vsnprintf_f 54 | 55 | #undef snprintf 56 | #define snprintf _TIFF_snprintf_f 57 | int snprintf(char* str, size_t size, const char* format, ...); 58 | #endif 59 | 60 | #endif /* ndef _LIBPORT_ */ 61 | -------------------------------------------------------------------------------- /thirdparty/libtiff/snprintf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Workaround for lack of snprintf(3) in Visual Studio. See 3 | * http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010/8712996#8712996 4 | * It's a trivial wrapper around the builtin _vsnprintf_s and 5 | * _vscprintf functions. 6 | */ 7 | 8 | #ifdef _MSC_VER 9 | 10 | #include 11 | #include 12 | #include "libport.h" 13 | 14 | int _TIFF_vsnprintf_f(char* str, size_t size, const char* format, va_list ap) 15 | { 16 | int count = -1; 17 | 18 | if (size != 0) 19 | count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); 20 | if (count == -1) 21 | count = _vscprintf(format, ap); 22 | 23 | return count; 24 | } 25 | 26 | int _TIFF_snprintf_f(char* str, size_t size, const char* format, ...) 27 | { 28 | int count; 29 | va_list ap; 30 | 31 | va_start(ap, format); 32 | count = vsnprintf(str, size, format, ap); 33 | va_end(ap); 34 | 35 | return count; 36 | } 37 | 38 | #endif // _MSC_VER 39 | -------------------------------------------------------------------------------- /thirdparty/libtiff/test_inline.c: -------------------------------------------------------------------------------- 1 | /* Test source lifted from /usr/share/autoconf/autoconf/c.m4 */ 2 | typedef int foo_t; 3 | static inline foo_t static_foo(){return 0;} 4 | foo_t foo(){return 0;} 5 | int main(int argc, char *argv[]){return 0;} 6 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tif_error.c: -------------------------------------------------------------------------------- 1 | /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.5 2010-03-10 18:56:48 bfriesen Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1988-1997 Sam Leffler 5 | * Copyright (c) 1991-1997 Silicon Graphics, Inc. 6 | * 7 | * Permission to use, copy, modify, distribute, and sell this software and 8 | * its documentation for any purpose is hereby granted without fee, provided 9 | * that (i) the above copyright notices and this permission notice appear in 10 | * all copies of the software and related documentation, and (ii) the names of 11 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 12 | * publicity relating to the software without the specific, prior written 13 | * permission of Sam Leffler and Silicon Graphics. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 17 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 18 | * 19 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 20 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 21 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 23 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24 | * OF THIS SOFTWARE. 25 | */ 26 | 27 | /* 28 | * TIFF Library. 29 | */ 30 | #include "tiffiop.h" 31 | 32 | TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL; 33 | 34 | TIFFErrorHandler 35 | TIFFSetErrorHandler(TIFFErrorHandler handler) 36 | { 37 | TIFFErrorHandler prev = _TIFFerrorHandler; 38 | _TIFFerrorHandler = handler; 39 | return (prev); 40 | } 41 | 42 | TIFFErrorHandlerExt 43 | TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler) 44 | { 45 | TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt; 46 | _TIFFerrorHandlerExt = handler; 47 | return (prev); 48 | } 49 | 50 | void 51 | TIFFError(const char* module, const char* fmt, ...) 52 | { 53 | va_list ap; 54 | va_start(ap, fmt); 55 | if (_TIFFerrorHandler) 56 | (*_TIFFerrorHandler)(module, fmt, ap); 57 | if (_TIFFerrorHandlerExt) 58 | (*_TIFFerrorHandlerExt)(0, module, fmt, ap); 59 | va_end(ap); 60 | } 61 | 62 | void 63 | TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...) 64 | { 65 | va_list ap; 66 | va_start(ap, fmt); 67 | if (_TIFFerrorHandler) 68 | (*_TIFFerrorHandler)(module, fmt, ap); 69 | if (_TIFFerrorHandlerExt) 70 | (*_TIFFerrorHandlerExt)(fd, module, fmt, ap); 71 | va_end(ap); 72 | } 73 | 74 | /* 75 | * Local Variables: 76 | * mode: c 77 | * c-basic-offset: 8 78 | * fill-column: 78 79 | * End: 80 | */ 81 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tif_jpeg_12.c: -------------------------------------------------------------------------------- 1 | 2 | #include "tiffiop.h" 3 | 4 | #if defined(JPEG_DUAL_MODE_8_12) 5 | 6 | # define TIFFInitJPEG TIFFInitJPEG_12 7 | 8 | # include LIBJPEG_12_PATH 9 | 10 | # include "tif_jpeg.c" 11 | 12 | int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode ) 13 | 14 | { 15 | JPEGState* sp; 16 | 17 | assert(scheme == COMPRESSION_JPEG); 18 | 19 | sp = JState(tif); 20 | sp->tif = tif; /* back link */ 21 | 22 | /* 23 | * Override parent get/set field methods. 24 | */ 25 | tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */ 26 | tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */ 27 | tif->tif_tagmethods.printdir = JPEGPrintDir; /* hook for codec tags */ 28 | 29 | /* 30 | * Install codec methods. 31 | */ 32 | tif->tif_fixuptags = JPEGFixupTags; 33 | tif->tif_setupdecode = JPEGSetupDecode; 34 | tif->tif_predecode = JPEGPreDecode; 35 | tif->tif_decoderow = JPEGDecode; 36 | tif->tif_decodestrip = JPEGDecode; 37 | tif->tif_decodetile = JPEGDecode; 38 | tif->tif_setupencode = JPEGSetupEncode; 39 | tif->tif_preencode = JPEGPreEncode; 40 | tif->tif_postencode = JPEGPostEncode; 41 | tif->tif_encoderow = JPEGEncode; 42 | tif->tif_encodestrip = JPEGEncode; 43 | tif->tif_encodetile = JPEGEncode; 44 | tif->tif_cleanup = JPEGCleanup; 45 | tif->tif_defstripsize = JPEGDefaultStripSize; 46 | tif->tif_deftilesize = JPEGDefaultTileSize; 47 | tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */ 48 | 49 | sp->cinfo_initialized = FALSE; 50 | 51 | if( is_encode ) 52 | return JPEGSetupEncode(tif); 53 | else 54 | return JPEGSetupDecode(tif); 55 | } 56 | 57 | #endif /* defined(JPEG_DUAL_MODE_8_12) */ 58 | 59 | /* 60 | * Local Variables: 61 | * mode: c 62 | * c-basic-offset: 8 63 | * fill-column: 78 64 | * End: 65 | */ 66 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tif_predict.h: -------------------------------------------------------------------------------- 1 | /* $Id: tif_predict.h,v 1.8 2010-03-10 18:56:49 bfriesen Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1995-1997 Sam Leffler 5 | * Copyright (c) 1995-1997 Silicon Graphics, Inc. 6 | * 7 | * Permission to use, copy, modify, distribute, and sell this software and 8 | * its documentation for any purpose is hereby granted without fee, provided 9 | * that (i) the above copyright notices and this permission notice appear in 10 | * all copies of the software and related documentation, and (ii) the names of 11 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 12 | * publicity relating to the software without the specific, prior written 13 | * permission of Sam Leffler and Silicon Graphics. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 17 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 18 | * 19 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 20 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 21 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 23 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24 | * OF THIS SOFTWARE. 25 | */ 26 | 27 | #ifndef _TIFFPREDICT_ 28 | #define _TIFFPREDICT_ 29 | /* 30 | * ``Library-private'' Support for the Predictor Tag 31 | */ 32 | 33 | /* 34 | * Codecs that want to support the Predictor tag must place 35 | * this structure first in their private state block so that 36 | * the predictor code can cast tif_data to find its state. 37 | */ 38 | typedef struct { 39 | int predictor; /* predictor tag value */ 40 | tmsize_t stride; /* sample stride over data */ 41 | tmsize_t rowsize; /* tile/strip row size */ 42 | 43 | TIFFCodeMethod encoderow; /* parent codec encode/decode row */ 44 | TIFFCodeMethod encodestrip; /* parent codec encode/decode strip */ 45 | TIFFCodeMethod encodetile; /* parent codec encode/decode tile */ 46 | TIFFPostMethod encodepfunc; /* horizontal differencer */ 47 | 48 | TIFFCodeMethod decoderow; /* parent codec encode/decode row */ 49 | TIFFCodeMethod decodestrip; /* parent codec encode/decode strip */ 50 | TIFFCodeMethod decodetile; /* parent codec encode/decode tile */ 51 | TIFFPostMethod decodepfunc; /* horizontal accumulator */ 52 | 53 | TIFFVGetMethod vgetparent; /* super-class method */ 54 | TIFFVSetMethod vsetparent; /* super-class method */ 55 | TIFFPrintMethod printdir; /* super-class method */ 56 | TIFFBoolMethod setupdecode; /* super-class method */ 57 | TIFFBoolMethod setupencode; /* super-class method */ 58 | } TIFFPredictorState; 59 | 60 | #if defined(__cplusplus) 61 | extern "C" { 62 | #endif 63 | extern int TIFFPredictorInit(TIFF*); 64 | extern int TIFFPredictorCleanup(TIFF*); 65 | #if defined(__cplusplus) 66 | } 67 | #endif 68 | #endif /* _TIFFPREDICT_ */ 69 | 70 | /* vim: set ts=8 sts=8 sw=8 noet: */ 71 | /* 72 | * Local Variables: 73 | * mode: c 74 | * c-basic-offset: 8 75 | * fill-column: 78 76 | * End: 77 | */ 78 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tif_version.c: -------------------------------------------------------------------------------- 1 | /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */ 2 | /* 3 | * Copyright (c) 1992-1997 Sam Leffler 4 | * Copyright (c) 1992-1997 Silicon Graphics, Inc. 5 | * 6 | * Permission to use, copy, modify, distribute, and sell this software and 7 | * its documentation for any purpose is hereby granted without fee, provided 8 | * that (i) the above copyright notices and this permission notice appear in 9 | * all copies of the software and related documentation, and (ii) the names of 10 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 11 | * publicity relating to the software without the specific, prior written 12 | * permission of Sam Leffler and Silicon Graphics. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 16 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 17 | * 18 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 19 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 20 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 21 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 22 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 23 | * OF THIS SOFTWARE. 24 | */ 25 | #include "tiffiop.h" 26 | 27 | static const char TIFFVersion[] = TIFFLIB_VERSION_STR; 28 | 29 | const char* 30 | TIFFGetVersion(void) 31 | { 32 | return (TIFFVersion); 33 | } 34 | /* 35 | * Local Variables: 36 | * mode: c 37 | * c-basic-offset: 8 38 | * fill-column: 78 39 | * End: 40 | */ 41 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tif_warning.c: -------------------------------------------------------------------------------- 1 | /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1988-1997 Sam Leffler 5 | * Copyright (c) 1991-1997 Silicon Graphics, Inc. 6 | * 7 | * Permission to use, copy, modify, distribute, and sell this software and 8 | * its documentation for any purpose is hereby granted without fee, provided 9 | * that (i) the above copyright notices and this permission notice appear in 10 | * all copies of the software and related documentation, and (ii) the names of 11 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 12 | * publicity relating to the software without the specific, prior written 13 | * permission of Sam Leffler and Silicon Graphics. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 17 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 18 | * 19 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 20 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 21 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 23 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24 | * OF THIS SOFTWARE. 25 | */ 26 | 27 | /* 28 | * TIFF Library. 29 | */ 30 | #include "tiffiop.h" 31 | 32 | TIFFErrorHandlerExt _TIFFwarningHandlerExt = NULL; 33 | 34 | TIFFErrorHandler 35 | TIFFSetWarningHandler(TIFFErrorHandler handler) 36 | { 37 | TIFFErrorHandler prev = _TIFFwarningHandler; 38 | _TIFFwarningHandler = handler; 39 | return (prev); 40 | } 41 | 42 | TIFFErrorHandlerExt 43 | TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler) 44 | { 45 | TIFFErrorHandlerExt prev = _TIFFwarningHandlerExt; 46 | _TIFFwarningHandlerExt = handler; 47 | return (prev); 48 | } 49 | 50 | void 51 | TIFFWarning(const char* module, const char* fmt, ...) 52 | { 53 | va_list ap; 54 | va_start(ap, fmt); 55 | if (_TIFFwarningHandler) 56 | (*_TIFFwarningHandler)(module, fmt, ap); 57 | if (_TIFFwarningHandlerExt) 58 | (*_TIFFwarningHandlerExt)(0, module, fmt, ap); 59 | va_end(ap); 60 | } 61 | 62 | void 63 | TIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...) 64 | { 65 | va_list ap; 66 | va_start(ap, fmt); 67 | if (_TIFFwarningHandler) 68 | (*_TIFFwarningHandler)(module, fmt, ap); 69 | if (_TIFFwarningHandlerExt) 70 | (*_TIFFwarningHandlerExt)(fd, module, fmt, ap); 71 | va_end(ap); 72 | } 73 | 74 | 75 | /* 76 | * Local Variables: 77 | * mode: c 78 | * c-basic-offset: 8 79 | * fill-column: 78 80 | * End: 81 | */ 82 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tiffio.hxx: -------------------------------------------------------------------------------- 1 | /* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1988-1997 Sam Leffler 5 | * Copyright (c) 1991-1997 Silicon Graphics, Inc. 6 | * 7 | * Permission to use, copy, modify, distribute, and sell this software and 8 | * its documentation for any purpose is hereby granted without fee, provided 9 | * that (i) the above copyright notices and this permission notice appear in 10 | * all copies of the software and related documentation, and (ii) the names of 11 | * Sam Leffler and Silicon Graphics may not be used in any advertising or 12 | * publicity relating to the software without the specific, prior written 13 | * permission of Sam Leffler and Silicon Graphics. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 17 | * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 18 | * 19 | * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 20 | * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 21 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 | * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 23 | * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24 | * OF THIS SOFTWARE. 25 | */ 26 | 27 | #ifndef _TIFFIO_HXX_ 28 | #define _TIFFIO_HXX_ 29 | 30 | /* 31 | * TIFF I/O library definitions which provide C++ streams API. 32 | */ 33 | 34 | #include 35 | #include "tiff.h" 36 | 37 | extern TIFF* TIFFStreamOpen(const char*, std::ostream *); 38 | extern TIFF* TIFFStreamOpen(const char*, std::istream *); 39 | 40 | #endif /* _TIFFIO_HXX_ */ 41 | 42 | /* vim: set ts=8 sts=8 sw=8 noet: */ 43 | /* 44 | * Local Variables: 45 | * mode: c++ 46 | * c-basic-offset: 8 47 | * fill-column: 78 48 | * End: 49 | */ 50 | -------------------------------------------------------------------------------- /thirdparty/libtiff/tiffvers.h: -------------------------------------------------------------------------------- 1 | #define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.6\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." 2 | /* 3 | * This define can be used in code that requires 4 | * compilation-related definitions specific to a 5 | * version or versions of the library. Runtime 6 | * version checking should be done based on the 7 | * string returned by TIFFGetVersion. 8 | */ 9 | #define TIFFLIB_VERSION 20150912 10 | -------------------------------------------------------------------------------- /thirdparty/libz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #based on zlib-1.2.5/CMakeLists.txt 2 | # 3 | cmake_minimum_required(VERSION 2.6) 4 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) 5 | 6 | project(zlib C) 7 | 8 | include(CheckTypeSize) 9 | include(CheckFunctionExists) 10 | include(CheckIncludeFile) 11 | include(CheckCSourceCompiles) 12 | 13 | CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) 14 | CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) 15 | CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H) 16 | 17 | # 18 | # Check to see if we have large file support 19 | # 20 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) 21 | # We add these other definitions here because CheckTypeSize.cmake 22 | # in CMake 2.4.x does not automatically do so and we want 23 | # compatibility with CMake 2.4.x. 24 | if(HAVE_SYS_TYPES_H) 25 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) 26 | endif() 27 | if(HAVE_STDINT_H) 28 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) 29 | endif() 30 | if(HAVE_STDDEF_H) 31 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) 32 | endif() 33 | CHECK_TYPE_SIZE(off64_t OFF64_T) 34 | if(HAVE_OFF64_T) 35 | add_definitions(-D_LARGEFILE64_SOURCE=1) 36 | endif() 37 | set(CMAKE_REQUIRED_DEFINITIONS) # clear variable 38 | # 39 | # Check for fseeko 40 | # 41 | CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) 42 | if(NOT HAVE_FSEEKO) 43 | add_definitions(-DNO_FSEEKO) 44 | endif() 45 | # 46 | # Check for unistd.h 47 | # 48 | CHECK_INCLUDE_FILE(unistd.h Z_HAVE_UNISTD_H) 49 | 50 | include_directories( 51 | ${CMAKE_CURRENT_SOURCE_DIR} 52 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include 53 | ) 54 | # 55 | set(EXT_HDRS 56 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h 57 | ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h 58 | ) 59 | 60 | set(HDRS 61 | crc32.h 62 | deflate.h 63 | gzguts.h 64 | inffast.h 65 | inffixed.h 66 | inflate.h 67 | inftrees.h 68 | trees.h 69 | zutil.h 70 | ) 71 | set(SRCS 72 | adler32.c 73 | compress.c 74 | crc32.c 75 | deflate.c 76 | gzclose.c 77 | gzlib.c 78 | gzread.c 79 | gzwrite.c 80 | inflate.c 81 | infback.c 82 | inftrees.c 83 | inffast.c 84 | trees.c 85 | uncompr.c 86 | zutil.c 87 | ) 88 | 89 | set(LIBTARGET "z") 90 | # 91 | add_library(${LIBTARGET} STATIC ${SRCS} ${EXT_HDRS} ${HDRS}) 92 | # 93 | if(MSVC) 94 | set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib") 95 | endif(MSVC) 96 | 97 | set_target_properties(${LIBTARGET} 98 | PROPERTIES 99 | OUTPUT_NAME "${LIBTARGET}" 100 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib 101 | ) 102 | # 103 | -------------------------------------------------------------------------------- /thirdparty/libz/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (z_const Bytef *)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 79 | (sourceLen >> 25) + 13; 80 | } 81 | -------------------------------------------------------------------------------- /thirdparty/libz/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /thirdparty/libz/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /thirdparty/libz/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /thirdparty/libz/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | 20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 21 | enough memory, Z_BUF_ERROR if there was not enough room in the output 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. 23 | */ 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 25 | Bytef *dest; 26 | uLongf *destLen; 27 | const Bytef *source; 28 | uLong sourceLen; 29 | { 30 | z_stream stream; 31 | int err; 32 | 33 | stream.next_in = (z_const Bytef *)source; 34 | stream.avail_in = (uInt)sourceLen; 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | 45 | err = inflateInit(&stream); 46 | if (err != Z_OK) return err; 47 | 48 | err = inflate(&stream, Z_FINISH); 49 | if (err != Z_STREAM_END) { 50 | inflateEnd(&stream); 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 52 | return Z_DATA_ERROR; 53 | return err; 54 | } 55 | *destLen = stream.total_out; 56 | 57 | err = inflateEnd(&stream); 58 | return err; 59 | } 60 | -------------------------------------------------------------------------------- /tools/ctest_scripts/toolchain-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # http://www.cmake.org/Wiki/CmakeMingw 2 | # 3 | # Copyright (c) 2006-2014 Mathieu Malaterre 4 | # 5 | # Redistribution and use is allowed according to the terms of the New 6 | # BSD license. 7 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 8 | # 9 | 10 | # the name of the target operating system 11 | set(CMAKE_SYSTEM_NAME Windows) 12 | 13 | # which compilers to use for C and C++ 14 | set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) 15 | set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) 16 | set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) 17 | 18 | # here is the target environment located 19 | set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) 20 | 21 | # adjust the default behaviour of the FIND_XXX() commands: 22 | # search headers and libraries in the target environment, search 23 | # programs in the host environment 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | -------------------------------------------------------------------------------- /tools/ctest_scripts/toolchain-mingw64.cmake: -------------------------------------------------------------------------------- 1 | # http://www.cmake.org/Wiki/CmakeMingw 2 | # 3 | # Copyright (c) 2006-2014 Mathieu Malaterre 4 | # 5 | # Redistribution and use is allowed according to the terms of the New 6 | # BSD license. 7 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 8 | # 9 | 10 | # the name of the target operating system 11 | set(CMAKE_SYSTEM_NAME Windows) 12 | 13 | # which compilers to use for C and C++ 14 | set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) 15 | set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) 16 | set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) 17 | 18 | # here is the target environment located 19 | set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) 20 | 21 | # adjust the default behaviour of the FIND_XXX() commands: 22 | # search headers and libraries in the target environment, search 23 | # programs in the host environment 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt: -------------------------------------------------------------------------------- 1 | NR-C1P0-p0_04.j2k-compare2base 2 | NR-C1P0-p0_05.j2k-compare2base 3 | NR-C1P0-p0_06.j2k-compare2base 4 | NR-C1P1-p1_02.j2k-compare2base 5 | NR-C1P1-p1_03.j2k-compare2base 6 | NR-C1P1-p1_04.j2k-compare2base 7 | NR-C1P1-p1_05.j2k-compare2base 8 | NR-JP2-file2.jp2-compare2base 9 | NR-JP2-file3.jp2-compare2base 10 | NR-RIC-subsampling_1.jp2-compare2base 11 | NR-RIC-subsampling_2.jp2-compare2base 12 | NR-RIC-zoo1.jp2-compare2base 13 | NR-RIC-zoo2.jp2-compare2base 14 | NR-DEC-_00042.j2k-2-decode-md5 15 | NR-DEC-buxI.j2k-9-decode-md5 16 | NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 17 | NR-DEC-Marrin.jp2-18-decode-md5 18 | NR-DEC-file409752.jp2-40-decode-md5 19 | NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 20 | NR-DEC-issue206_image-000.jp2-42-decode-md5 21 | NR-DEC-issue205.jp2-43-decode-md5 22 | NR-DEC-issue228.j2k-60-decode-md5 23 | NR-DEC-issue134.jp2-67-decode-md5 24 | NR-DEC-issue208.jp2-69-decode-md5 25 | NR-DEC-issue211.jp2-70-decode-md5 26 | NR-DEC-issue414.jp2-110-decode-md5 27 | NR-DEC-p1_04.j2k-124-decode-md5 28 | NR-DEC-p1_04.j2k-125-decode-md5 29 | NR-DEC-p1_04.j2k-126-decode-md5 30 | NR-DEC-p1_04.j2k-127-decode-md5 31 | NR-DEC-p1_04.j2k-128-decode-md5 32 | NR-DEC-p1_04.j2k-129-decode-md5 33 | NR-DEC-p1_04.j2k-131-decode-md5 34 | NR-DEC-p1_04.j2k-134-decode-md5 35 | NR-DEC-p1_04.j2k-138-decode-md5 36 | NR-DEC-p1_04.j2k-140-decode-md5 37 | NR-DEC-p0_04.j2k-166-decode-md5 38 | NR-DEC-p0_04.j2k-168-decode-md5 39 | NR-DEC-p0_04.j2k-172-decode-md5 40 | NR-DEC-issue205.jp2-253-decode-md5 41 | NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5 42 | NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 43 | NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 44 | NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 45 | NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 46 | NR-DEC-issue135.j2k-68-decode-md5 47 | NR-DEC-db11217111510058.jp2-306-decode-md5 48 | NR-DEC-tnsot_zero.jp2-307-decode-md5 49 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-Ubuntu20.04-clang10.0.0-i386-Release-3rdP.txt: -------------------------------------------------------------------------------- 1 | NR-C1P0-p0_04.j2k-compare2base 2 | NR-C1P0-p0_05.j2k-compare2base 3 | NR-C1P0-p0_06.j2k-compare2base 4 | NR-C1P1-p1_02.j2k-compare2base 5 | NR-C1P1-p1_03.j2k-compare2base 6 | NR-C1P1-p1_04.j2k-compare2base 7 | NR-C1P1-p1_05.j2k-compare2base 8 | NR-JP2-file2.jp2-compare2base 9 | NR-JP2-file3.jp2-compare2base 10 | NR-RIC-subsampling_1.jp2-compare2base 11 | NR-RIC-subsampling_2.jp2-compare2base 12 | NR-RIC-zoo1.jp2-compare2base 13 | NR-RIC-zoo2.jp2-compare2base 14 | NR-DEC-_00042.j2k-2-decode-md5 15 | NR-DEC-buxI.j2k-9-decode-md5 16 | NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 17 | NR-DEC-Marrin.jp2-18-decode-md5 18 | NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 19 | NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 20 | NR-DEC-file409752.jp2-40-decode-md5 21 | NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 22 | NR-DEC-issue206_image-000.jp2-42-decode-md5 23 | NR-DEC-issue205.jp2-43-decode-md5 24 | NR-DEC-issue228.j2k-60-decode-md5 25 | NR-DEC-issue134.jp2-67-decode-md5 26 | NR-DEC-issue135.j2k-68-decode-md5 27 | NR-DEC-issue208.jp2-69-decode-md5 28 | NR-DEC-issue211.jp2-70-decode-md5 29 | NR-DEC-issue414.jp2-110-decode-md5 30 | NR-DEC-p1_04.j2k-124-decode-md5 31 | NR-DEC-p1_04.j2k-125-decode-md5 32 | NR-DEC-p1_04.j2k-126-decode-md5 33 | NR-DEC-p1_04.j2k-127-decode-md5 34 | NR-DEC-p1_04.j2k-128-decode-md5 35 | NR-DEC-p1_04.j2k-129-decode-md5 36 | NR-DEC-p1_04.j2k-131-decode-md5 37 | NR-DEC-p1_04.j2k-134-decode-md5 38 | NR-DEC-p1_04.j2k-138-decode-md5 39 | NR-DEC-p1_04.j2k-140-decode-md5 40 | NR-DEC-p0_04.j2k-166-decode-md5 41 | NR-DEC-p0_04.j2k-168-decode-md5 42 | NR-DEC-p0_04.j2k-172-decode-md5 43 | NR-DEC-issue205.jp2-253-decode-md5 44 | NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5 45 | NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 46 | NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 47 | NR-DEC-db11217111510058.jp2-306-decode-md5 48 | NR-DEC-tnsot_zero.jp2-307-decode-md5 49 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-Ubuntu20.04-gcc9.4.0-x86_64-Release-3rdP.txt: -------------------------------------------------------------------------------- 1 | NR-DEC-_00042.j2k-2-decode-md5 2 | NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 3 | NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 4 | NR-DEC-issue205.jp2-43-decode-md5 5 | NR-DEC-issue135.j2k-68-decode-md5 6 | NR-DEC-issue208.jp2-69-decode-md5 7 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-all.txt: -------------------------------------------------------------------------------- 1 | NR-DEC-issue226.j2k-74-decode-md5 2 | NR-DEC-issue226.j2k-74-decode 3 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-windows-vs2010-x86-Release-3rdP.txt: -------------------------------------------------------------------------------- 1 | NR-C1P0-p0_04.j2k-compare2base 2 | NR-C1P0-p0_05.j2k-compare2base 3 | NR-C1P0-p0_06.j2k-compare2base 4 | NR-C1P1-p1_02.j2k-compare2base 5 | NR-C1P1-p1_03.j2k-compare2base 6 | NR-C1P1-p1_04.j2k-compare2base 7 | NR-C1P1-p1_05.j2k-compare2base 8 | NR-RIC-subsampling_1.jp2-compare2base 9 | NR-RIC-subsampling_2.jp2-compare2base 10 | NR-RIC-zoo1.jp2-compare2base 11 | NR-RIC-zoo2.jp2-compare2base 12 | NR-DEC-_00042.j2k-2-decode-md5 13 | NR-DEC-buxI.j2k-9-decode-md5 14 | NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 15 | NR-DEC-Marrin.jp2-18-decode-md5 16 | NR-DEC-file409752.jp2-40-decode-md5 17 | NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 18 | NR-DEC-issue206_image-000.jp2-42-decode-md5 19 | NR-DEC-issue205.jp2-43-decode-md5 20 | NR-DEC-issue228.j2k-60-decode-md5 21 | NR-DEC-issue134.jp2-67-decode-md5 22 | NR-DEC-issue208.jp2-69-decode-md5 23 | NR-DEC-issue211.jp2-70-decode-md5 24 | NR-DEC-issue414.jp2-110-decode-md5 25 | NR-DEC-p1_04.j2k-124-decode-md5 26 | NR-DEC-p1_04.j2k-125-decode-md5 27 | NR-DEC-p1_04.j2k-126-decode-md5 28 | NR-DEC-p1_04.j2k-127-decode-md5 29 | NR-DEC-p1_04.j2k-128-decode-md5 30 | NR-DEC-p1_04.j2k-129-decode-md5 31 | NR-DEC-p1_04.j2k-131-decode-md5 32 | NR-DEC-p1_04.j2k-134-decode-md5 33 | NR-DEC-p1_04.j2k-138-decode-md5 34 | NR-DEC-p1_04.j2k-140-decode-md5 35 | NR-DEC-p0_04.j2k-166-decode-md5 36 | NR-DEC-p0_04.j2k-168-decode-md5 37 | NR-DEC-p0_04.j2k-172-decode-md5 38 | NR-DEC-issue205.jp2-253-decode-md5 39 | NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5 40 | NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 41 | NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 42 | NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 43 | NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 44 | NR-DEC-issue135.j2k-68-decode-md5 45 | NR-DEC-db11217111510058.jp2-306-decode-md5 46 | NR-DEC-tnsot_zero.jp2-307-decode-md5 47 | NR-DEC-Bretagne1_ht_lossy.j2k-311-decode-md5 48 | -------------------------------------------------------------------------------- /tools/travis-ci/knownfailures-windows-vs2015-x64-avx2-Release-3rdP.txt: -------------------------------------------------------------------------------- 1 | NR-C1P0-p0_04.j2k-compare2base 2 | NR-C1P0-p0_05.j2k-compare2base 3 | NR-C1P0-p0_06.j2k-compare2base 4 | NR-C1P1-p1_02.j2k-compare2base 5 | NR-C1P1-p1_03.j2k-compare2base 6 | NR-C1P1-p1_04.j2k-compare2base 7 | NR-C1P1-p1_05.j2k-compare2base 8 | NR-RIC-subsampling_1.jp2-compare2base 9 | NR-RIC-subsampling_2.jp2-compare2base 10 | NR-RIC-zoo1.jp2-compare2base 11 | NR-RIC-zoo2.jp2-compare2base 12 | NR-DEC-_00042.j2k-2-decode-md5 13 | NR-DEC-buxI.j2k-9-decode-md5 14 | NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 15 | NR-DEC-Marrin.jp2-18-decode-md5 16 | NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 17 | NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 18 | NR-DEC-file409752.jp2-40-decode-md5 19 | NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 20 | NR-DEC-issue206_image-000.jp2-42-decode-md5 21 | NR-DEC-issue205.jp2-43-decode-md5 22 | NR-DEC-issue228.j2k-60-decode-md5 23 | NR-DEC-issue142.j2k-66-decode-md5 24 | NR-DEC-issue134.jp2-67-decode-md5 25 | NR-DEC-issue135.j2k-68-decode-md5 26 | NR-DEC-issue208.jp2-69-decode-md5 27 | NR-DEC-issue211.jp2-70-decode-md5 28 | NR-DEC-p1_04.j2k-124-decode-md5 29 | NR-DEC-p1_04.j2k-125-decode-md5 30 | NR-DEC-p1_04.j2k-126-decode-md5 31 | NR-DEC-p1_04.j2k-127-decode-md5 32 | NR-DEC-p1_04.j2k-128-decode-md5 33 | NR-DEC-p1_04.j2k-129-decode-md5 34 | NR-DEC-p1_04.j2k-131-decode-md5 35 | NR-DEC-p1_04.j2k-138-decode-md5 36 | NR-DEC-p1_04.j2k-140-decode-md5 37 | NR-DEC-p0_04.j2k-166-decode-md5 38 | NR-DEC-p0_04.j2k-167-decode-md5 39 | NR-DEC-p0_04.j2k-168-decode-md5 40 | NR-DEC-p0_04.j2k-172-decode-md5 41 | NR-DEC-issue205.jp2-253-decode-md5 42 | NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 43 | NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 44 | NR-DEC-db11217111510058.jp2-306-decode-md5 45 | NR-DEC-tnsot_zero.jp2-307-decode-md5 46 | NR-DEC-Bretagne1_ht_lossy.j2k-311-decode-md5 47 | -------------------------------------------------------------------------------- /tools/travis-ci/travis_rsa.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornerstonejs/openjpeg/2d606701e8b7aa83f657d113c3367508e99bd12b/tools/travis-ci/travis_rsa.enc -------------------------------------------------------------------------------- /wrapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # wrapping 2 | if(BUILD_JAVA) 3 | add_subdirectory(java) 4 | endif() 5 | -------------------------------------------------------------------------------- /wrapping/java/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | add_subdirectory(openjp2) 3 | -------------------------------------------------------------------------------- /wrapping/java/openjp2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #JavaOpenJPEG/CMakeLists.txt 2 | 3 | # First thing define the common source: 4 | set(openjpegjni_SRCS 5 | JavaOpenJPEGDecoder.c 6 | JavaOpenJPEG.c 7 | ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c 8 | ${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c 9 | index.c 10 | ) 11 | 12 | # JNI binding: 13 | find_package(JNI REQUIRED) 14 | include_directories(${JNI_INCLUDE_DIRS}) 15 | 16 | # required header file: 17 | include_directories( 18 | ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h 19 | ${OPENJPEG_SOURCE_DIR}/src/lib/openmj2 20 | ${OPENJPEG_SOURCE_DIR}/src/bin/common 21 | ${OPENJPEG_SOURCE_DIR}/src/bin/jp2 22 | ) 23 | 24 | add_library(openjpegjni MODULE 25 | ${openjpegjni_SRCS} 26 | ) 27 | # Java module should not have a SONAME: 28 | set_property(TARGET openjpegjni PROPERTY NO_SONAME 1) 29 | 30 | # FIXME (need to use old API): 31 | target_link_libraries(openjpegjni 32 | ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${Z_LIBNAME} 33 | ) 34 | if(UNIX) 35 | target_link_libraries(openjpegjni m) 36 | endif() 37 | 38 | install(TARGETS openjpegjni 39 | EXPORT OpenJPEGTargets 40 | LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries 41 | ) 42 | 43 | # build jar: 44 | find_package(Java 1.6 REQUIRED) # javac, jar 45 | 46 | # build dep list: 47 | file(GLOB java_srcs "java-sources/org/openJpeg/*.java") 48 | 49 | # make sure target javac dir exists: 50 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes) 51 | # Build java 52 | add_custom_command( 53 | OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar 54 | COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources" 55 | ${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes 56 | COMMAND ${Java_JAR_EXECUTABLE} cvf ${LIBRARY_OUTPUT_PATH}/openjpeg.jar org 57 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes 58 | DEPENDS ${java_srcs} 59 | COMMENT "javac *.java; jar cvf -> openjpeg.jar" 60 | ) 61 | 62 | # name the target 63 | add_custom_target(OpenJPEGJavaJar ALL 64 | DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar 65 | COMMENT "building openjpeg.jar" 66 | ) 67 | 68 | install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar 69 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} COMPONENT JavaModule 70 | ) 71 | -------------------------------------------------------------------------------- /wrapping/java/openjp2/index.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 3 | * Copyright (c) 2002-2014, Professor Benoit Macq 4 | * Copyright (c) 2003-2007, Francois-Olivier Devaux 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef __J2K_INDEX_H 30 | #define __J2K_INDEX_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | Write a structured index to a file 38 | @param cstr_info Codestream information 39 | @param index Index filename 40 | @return Returns 0 if successful, returns 1 otherwise 41 | */ 42 | int write_index_file(opj_codestream_info_t *cstr_info, char *index); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* __J2K_INDEX_H */ 49 | 50 | -------------------------------------------------------------------------------- /wrapping/java/openjp2/org_openJpeg_OpenJPEGJavaDecoder.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_openJpeg_OpenJPEGJavaDecoder */ 4 | 5 | #ifndef _Included_org_openJpeg_OpenJPEGJavaDecoder 6 | #define _Included_org_openJpeg_OpenJPEGJavaDecoder 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_openJpeg_OpenJPEGJavaDecoder 12 | * Method: internalDecodeJ2KtoImage 13 | * Signature: ([Ljava/lang/String;)I 14 | */ 15 | JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage 16 | (JNIEnv *, jobject, jobjectArray); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /wrapping/java/openjp2/org_openJpeg_OpenJPEGJavaEncoder.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_openJpeg_OpenJPEGJavaEncoder */ 4 | 5 | #ifndef _Included_org_openJpeg_OpenJPEGJavaEncoder 6 | #define _Included_org_openJpeg_OpenJPEGJavaEncoder 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_openJpeg_OpenJPEGJavaEncoder 12 | * Method: internalEncodeImageToJ2K 13 | * Signature: ([Ljava/lang/String;)J 14 | */ 15 | JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K 16 | (JNIEnv *, jobject, jobjectArray); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | --------------------------------------------------------------------------------