Compare commits
No commits in common. "main" and "openjpeg3d" have entirely different histories.
main
...
openjpeg3d
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,17 +0,0 @@
|
||||
# Ignore files and directories made by `cmake .`.
|
||||
CMakeFiles/
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
/CMakeCache.txt
|
||||
/CPackConfig.cmake
|
||||
/CPackSourceConfig.cmake
|
||||
/CTestCustom.cmake
|
||||
/LICENSE.txt
|
||||
/OpenJPEGConfig.cmake
|
||||
/libopenjp2.pc
|
||||
/src/bin/common/opj_apps_config.h
|
||||
/src/lib/openjp2/opj_config.h
|
||||
/src/lib/openjp2/opj_config_private.h
|
||||
|
||||
# Ignore directories made by `make`.
|
||||
/bin/
|
93
.travis.yml
93
.travis.yml
@ -1,93 +0,0 @@
|
||||
language: c
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
|
||||
- os: linux
|
||||
compiler: clang-3.8
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-precise-3.8
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-3.8
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-i686
|
||||
- gcc-mingw-w64-i686
|
||||
- gcc-mingw-w64
|
||||
- os: linux
|
||||
compiler: gcc-4.8
|
||||
env: OPJ_CI_ABI_CHECK=1
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- libelf-dev
|
||||
- elfutils
|
||||
- texinfo
|
||||
- exuberant-ctags
|
||||
|
||||
install:
|
||||
- ./tools/travis-ci/install.sh
|
||||
|
||||
script:
|
||||
- ./tools/travis-ci/run.sh
|
||||
- ./tools/travis-ci/abi-check.sh
|
||||
|
||||
before_deploy:
|
||||
- export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*)
|
||||
- echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases"
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: Npi13uOffALCVNwea4p4q8v85Lo/WsRqaeZQcWrAkt8MxRnfvWQtmnuwmHnVB6Cig+T1lVUHrklOaJIApIb6nkGq3CS/9bD8+SCS2NEdAAP/QYWnBi0ubWXVMRyDLypmwRpzLNSZ0xLYGFUl2PjieZYKRcz1dd/J7S+FnXhPtdjXweq0FS63zTcMe7ggjfmzSOWUCEFmMjZPaM0Be+3PweieCO1dxlHuy7ugCkx2S7d+5hNsicIhQmTADjqtJAkHoMhYqu6/yLFxhjO/+f938PATFULdODTvjCsUwdN/ySWi1Oj4uPAntfytZP7H6YrzLh8dS73QCsdkhhDJIgJskHIBSbRyyEVUnOvQgD9VaBVGHtc1KtZQTwc41OUO3BGPHl97s3oX6bqWqo/L53dB3TPHGx+1+2HL/F0zaDZuHhAKMkPwe8LFPMPB/ur65zXMHjnWb2ZTVVdoIvkbQ7nu8ApI60ejxocYBsEyAuC2CPXU2ki4jdEhm0E1hIziWNE9/LTuM17ziQuJ6WpXOSMrfP4o5aVDmLp5ZGBSocrspOksgyI9XogHaO/r+Y6N3exy+giObFfMHkZVUpsKrKmtOJ7TC1Vg5HsYGlWW8RN8dkJV47bUXm9K4sMos9eYMUt/czykPAs+132cogpII3QxXpFZQqZg6SEPVfOiyqQzTUI=
|
||||
file_glob: true
|
||||
file: "${OPJ_RELEASE_PKG_FILE}"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: uclouvain/openjpeg
|
||||
tags: true
|
||||
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"
|
||||
|
21
AUTHORS.md
21
AUTHORS.md
@ -1,21 +0,0 @@
|
||||
# Authors of OpenJPEG
|
||||
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
|
||||
|
||||
David Janssens designed and implemented the first version of OpenJPEG.
|
||||
|
||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
|
||||
|
||||
Giuseppe Baruffa added the JPWL functionalities.
|
||||
|
||||
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.
|
||||
|
||||
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
|
||||
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
Antonin Descampe
|
||||
improved the libraries and utilities.
|
||||
|
446
CHANGELOG.md
446
CHANGELOG.md
@ -1,446 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
|
||||
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
|
||||
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
|
||||
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
|
||||
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
|
||||
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
|
||||
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
|
||||
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
|
||||
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
|
||||
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
|
||||
- Please make a new release [\#782](https://github.com/uclouvain/openjpeg/issues/782)
|
||||
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
|
||||
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
|
||||
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
|
||||
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
|
||||
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
|
||||
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
|
||||
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
|
||||
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
|
||||
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
|
||||
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
|
||||
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
|
||||
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
|
||||
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
|
||||
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
|
||||
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
|
||||
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
|
||||
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
|
||||
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
|
||||
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
|
||||
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
|
||||
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
|
||||
|
||||
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
|
||||
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
|
||||
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
|
||||
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
|
||||
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
|
||||
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
|
||||
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
|
||||
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
|
||||
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
|
||||
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
|
||||
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
|
||||
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
|
||||
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
|
||||
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
|
||||
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
|
||||
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
|
||||
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
|
||||
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
|
||||
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
|
||||
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
|
||||
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
|
||||
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
|
||||
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
|
||||
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
|
||||
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
|
||||
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
|
||||
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
|
||||
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
|
||||
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
|
||||
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
|
||||
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
|
||||
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
|
||||
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
|
||||
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
|
||||
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
|
||||
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
|
||||
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
|
||||
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
|
||||
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
|
||||
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
|
||||
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
|
||||
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
|
||||
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
|
||||
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
|
||||
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
|
||||
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
|
||||
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
|
||||
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
|
||||
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
|
||||
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
|
||||
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
|
||||
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
|
||||
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
|
||||
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
|
||||
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
|
||||
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
|
||||
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
|
||||
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
|
||||
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
|
||||
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
|
||||
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
|
||||
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
|
||||
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
|
||||
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
|
||||
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
|
||||
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
|
||||
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
|
||||
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
|
||||
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
|
||||
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
|
||||
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
|
||||
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
|
||||
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
|
||||
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
|
||||
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
|
||||
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
|
||||
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
|
||||
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
|
||||
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
|
||||
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
|
||||
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
|
||||
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
|
||||
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
|
||||
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
|
||||
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
|
||||
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
|
||||
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
|
||||
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
|
||||
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
|
||||
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
|
||||
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
|
||||
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
|
||||
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
|
||||
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
|
||||
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
|
||||
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
|
||||
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
|
||||
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
|
||||
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
|
||||
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
|
||||
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
|
||||
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
|
||||
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
|
||||
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
|
||||
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
|
||||
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
|
||||
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
|
||||
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
|
||||
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
|
||||
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
|
||||
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
|
||||
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
|
||||
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
|
||||
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
|
||||
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
|
||||
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
|
||||
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
|
||||
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
|
||||
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
|
||||
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
|
||||
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
|
||||
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
|
||||
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
|
||||
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
|
||||
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
|
||||
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
|
||||
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
|
||||
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
|
||||
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
|
||||
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
|
||||
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
|
||||
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
|
||||
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
|
||||
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
|
||||
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
|
||||
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
|
||||
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
|
||||
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
|
||||
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
|
||||
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
|
||||
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
|
||||
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
|
||||
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
|
||||
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
|
||||
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
|
||||
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
|
||||
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
|
||||
- openjpeg@googlegroups.com has disappeard [\#153](https://github.com/uclouvain/openjpeg/issues/153)
|
||||
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
|
||||
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
|
||||
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
|
||||
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
|
||||
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
|
||||
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
|
||||
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
|
||||
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
|
||||
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
|
||||
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
|
||||
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
|
||||
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
|
||||
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
|
||||
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
|
||||
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
|
||||
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
|
||||
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
|
||||
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
|
||||
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
|
||||
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
|
||||
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
|
||||
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
|
||||
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
|
||||
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
|
||||
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
|
||||
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
|
||||
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
|
||||
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
|
||||
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
|
||||
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
|
||||
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
|
||||
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
|
||||
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
|
||||
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
|
||||
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
|
||||
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
|
||||
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
|
||||
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
|
||||
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
|
||||
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
|
||||
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
|
||||
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
|
||||
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
|
||||
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
|
||||
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
|
||||
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
|
||||
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
|
||||
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
|
||||
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
|
||||
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
|
||||
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
|
||||
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
|
||||
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
|
||||
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
|
||||
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
|
||||
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
|
||||
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
|
||||
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
|
||||
- lossy encoding a 16 bit TIF file : severe artifiacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
|
||||
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
|
||||
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
|
||||
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
|
||||
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
|
||||
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
|
||||
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
|
||||
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
|
||||
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
|
||||
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
|
||||
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
|
||||
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
|
||||
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
|
||||
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
|
||||
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
|
||||
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
|
||||
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
|
||||
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
|
||||
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
|
||||
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
|
||||
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
|
||||
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
|
||||
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
|
||||
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
|
||||
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
|
||||
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
|
||||
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
|
||||
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
|
||||
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
|
||||
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
|
||||
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
|
||||
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
|
||||
- Use lowercase for cmake commands consistenly [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
|
||||
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
|
||||
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
|
||||
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
|
||||
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
|
||||
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
|
||||
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
|
||||
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
|
||||
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
|
||||
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
|
||||
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
|
||||
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
|
||||
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
|
||||
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
|
||||
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
|
||||
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
|
||||
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
|
||||
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
|
||||
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
|
||||
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
|
||||
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
|
||||
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
|
||||
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
|
||||
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
|
||||
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
|
||||
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
|
||||
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
|
||||
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
|
||||
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
|
||||
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
|
||||
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
|
||||
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
|
||||
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
|
||||
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
|
||||
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
|
||||
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
|
||||
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
|
||||
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
|
||||
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
|
||||
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
|
||||
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
|
||||
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
|
||||
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
|
||||
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
|
||||
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
|
||||
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
|
||||
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
|
||||
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
|
||||
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
|
||||
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
|
||||
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
|
||||
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
|
||||
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
|
||||
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
|
||||
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
|
||||
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
|
||||
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
|
||||
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
|
||||
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
|
||||
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
|
||||
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
|
||||
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
|
||||
|
||||
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
|
||||
|
||||
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
|
||||
|
||||
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
|
||||
|
||||
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
|
||||
|
||||
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
|
||||
|
||||
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
|
||||
|
||||
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
|
||||
|
||||
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
|
||||
|
||||
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
|
||||
|
||||
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
903
CHANGES
Normal file
903
CHANGES
Normal file
@ -0,0 +1,903 @@
|
||||
What's New for OpenJPEG
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
April 16, 2011
|
||||
! [antonin] renamed "openjpeg3d" in "openjp3d"
|
||||
|
||||
April 13, 2011
|
||||
! [antonin] moved "openjpeg3d" directory from the trunk to the branches directory.
|
||||
! [antonin] renamed and reorganized "jp3d" directory to "openjpeg3d". Is now a standalone directory, with independent cmake files. Done as it uses its own version of the openjpeg library and does not depend on the one currently developped. Will be removed from the trunk and stored in a branch.
|
||||
|
||||
April 12, 2011
|
||||
* [antonin] Fixed internal function names conflict with Jasper (http://code.google.com/p/openjpeg/issues/detail?id=30)
|
||||
* [antonin] convert.c: ENDIAN condition removed, tiftoimage and imagetotif updated (ALPHA added for RGB and GRAY, correct handling of 12-bit precision), small bugfixes (credit to Winfried)
|
||||
* [antonin] small fix in configure.ac (credit to Vincent Torri)
|
||||
|
||||
March 21, 2011
|
||||
+ [antonin] added two files FindLCMS.cmake and FindLCMS2.cmake as they are not shipped by default with other cmake modules.
|
||||
|
||||
March 20, 2011
|
||||
+ [antonin] added a 'thirdparty' directory to include main source files of libtiff, libpng, libz and liblcms to enable support of these formats in the codec executables. CMake will try to statically build these libraries if they are not found on the system. Note that these third party libraries are not required to build libopenjpeg (which has no dependencies).
|
||||
- [antonin] removed the 'libs' directory containing win32 compiled versions of libpng, libtiff and liblcms.
|
||||
|
||||
March 10, 2011
|
||||
* [antonin] fixed lt_version in configure.ac
|
||||
|
||||
March 5, 2011
|
||||
! [antonin] cosmetic change for status report of ./configure
|
||||
|
||||
March 4, 2011
|
||||
* [antonin] now assume MinGW does not have dirent.h (actually have it but without opendir function). Fixed also a WIN32 check in jp3d/libjp3dvm/openjpeg3d.h.
|
||||
! [antonin] updated autotools files to improve build and install procedures (credit to Vincent Torri).
|
||||
|
||||
February 17, 2011
|
||||
* [antonin] replaced 'long' by 'size_t' in dwt.c to be sure to cast to a pointer size.
|
||||
* [antonin] now allows 16-bit precision for mj2 encoding and decoding (solves Issue 49 and Issue 63). Credit to Winfried.
|
||||
|
||||
February 9, 2011
|
||||
! [antonin] renamed "java sources" to "java-sources" to avoid blank space
|
||||
- [antonin] removed opj_config.h.in from svn, as it is automaticaly generated by autoheader when calling ./bootstrap.sh
|
||||
|
||||
February 6, 2011
|
||||
* [antonin] cmake : fixed installed links to openjpeg.h and openjpeg3d.h.
|
||||
|
||||
January 30, 2011
|
||||
* [antonin] fixed warnings in jp2.c (signed compared to unsigned) and dwt.c (bad cast)
|
||||
- [antonin] removed depcomp file from trunk (automatically copied by automake in main folder)
|
||||
|
||||
January 29, 2011
|
||||
* [antonin] removed 'é' in license header to prevent warning C4819 (see Issue 57).
|
||||
|
||||
January 24, 2011
|
||||
- [antonin] remove more obsolete VS files. Left only mj2_to_metadata VS files, as this is the only executable not yet handled by CMake.
|
||||
|
||||
January 23, 2011
|
||||
- [antonin] removed obsolete VS files
|
||||
! [antonin] MJ2 module:
|
||||
- Add two components to mj2.h: meth, enumcs.
|
||||
- Define or reset all components of mj2_cparameters_t before its usage.
|
||||
- Add argument '-D prec' to frames_to_mj2.c and use the precision in mj2_convert.c (solves Issue 49).
|
||||
* [antonin] move 'KK' definition from rs.h to rs.c to prevent duplicate symbol error when building jpwl with autotools.
|
||||
|
||||
January 18, 2011
|
||||
! [rdieter] cmake: SOVERSION change to 1 (from 1.4) to match auto-tools
|
||||
|
||||
January 17, 2011
|
||||
- [rdieter] remove generated files (Issue 52)
|
||||
|
||||
January 16, 2011
|
||||
* [antonin] convert.c: inclusion of endian.h has to be different on APPLE platforms
|
||||
|
||||
January 13, 2011
|
||||
+ [rdieter] add pkg-config support to cmake
|
||||
! [rdieter] adjust autotools pkg-config support to match
|
||||
* [rdieter] fix symlink creation (cmake)
|
||||
|
||||
January 9, 2011
|
||||
- [antonin] removed forgotten debug info in imagetopnm().
|
||||
|
||||
January 9, 2011
|
||||
! [antonin] imagetopnm() has been rewritten to allow 16-bits precision, and PAM (P7) support. See Netpbm for more info. (patch from szukw000).
|
||||
|
||||
January 7, 2011
|
||||
! [szukw000] changed report code in Makefile.am
|
||||
|
||||
January 3, 2011
|
||||
- [antonin] removed badly written tests from CTest in 'codec/CMakeLists.txt'
|
||||
|
||||
_______ R697 : OPENJPEG 1.4 RELEASED ______________________________
|
||||
|
||||
January 2, 2011
|
||||
* [antonin] bug fixes to enable cmake compilation on WIN32 platform
|
||||
- fixed getopt bug in jpwl/CMakeLists.txt
|
||||
- added png, zlib and lcms win32 libraries to libs directory
|
||||
- updated libs/libtiff library
|
||||
- moved j2k_dump_{image,cp} to j2k_dump.c to remain consistent with API interface
|
||||
- changed mj2 cmake compilation method: as long as mj2 binaries do not strictly use the API interface, libopenjpeg source files are directly included in mj2 executables compilation.
|
||||
! [antonin] small update to xcode project
|
||||
|
||||
December 14, 2010
|
||||
! [szukw000] adapted Makefile.am/Makefile.nix to build
|
||||
choice: shared xor static
|
||||
|
||||
December 11, 2010
|
||||
* [antonin] fixed flags when building jp3d with MinGW
|
||||
|
||||
December 10, 2010
|
||||
! [szukw000] changed build choice in configure.ac/Makefile.am/Makefile.nix:
|
||||
shared xor static
|
||||
|
||||
December 9, 2010
|
||||
! [antonin] removed LCMS dependency in jp3d/libjp3dvm/CMakeLists.txt
|
||||
! [antonin] updated xcode project
|
||||
! [antonin] renamed jp3d/libjp3dvm/openjpeg.h => jp3d/libjp3dvm/openjpeg3d.h
|
||||
- [antonin] removed "codec/compat/" directory
|
||||
* [szukw000] updated Makefile.in
|
||||
! [szukw000] removed LCMS dependencies from Makefile.am/Makefile.nix
|
||||
|
||||
December 8, 2010
|
||||
(thanks to Winfried for his help)
|
||||
* [antonin] changed remaining "WIN32" to "_WIN32"
|
||||
! [antonin] libopenjpeg has no more dependency on LCMS lib. Everything concerning color (icc profile, conversion to rgb, etc) has been put outside libopenjpeg and is used in j2k_to_image.c and mj2_to_frames.c.
|
||||
- [antonin] removed 'opj_convert{.c,.h}'
|
||||
+ [antonin] added a directory 'common/' that contains 'getopt{.c,.h}' (previously in 'codec/compat').
|
||||
+ [antonin] added files 'color{.c,.h}' in 'common/' that define the code for icc profile management and sycc_to_rgb conversion
|
||||
+ [antonin] added 'common/format_defs.h' that contains common definitions used in image_to_j2k, j2k_to_image, j2k_dump.
|
||||
|
||||
December 5, 2010
|
||||
! [antonin] revert to previous behaviour for cmake: builds (and links) dynamically by default. Static build only if -DBUILD_SHARED_LIBS is set to OFF.
|
||||
* [antonin] added a definition in getopt.h and an initial value in convert.c
|
||||
|
||||
December 3, 2010
|
||||
* [antonin] workaround for name clash when building static and dynamic on WIN32 (see http://www.vtk.org/Bug/view.php?id=10190 for description)
|
||||
|
||||
November 28, 2010
|
||||
* [antonin] fixed a bug in codec/convert.c that prevented to build executables with WIN32 compiler (thanks winfried)
|
||||
! [antonin] changed cmake behaviour: executables are now always statically linked. When -DBUIL_SHARED_LIBS option is ON (the default), the shared versions of the libraries are also built (but executables remain linked against the static libraries).
|
||||
|
||||
November 25, 2010
|
||||
* [antonin] fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode)
|
||||
|
||||
November 22, 2010
|
||||
! [antonin] xcode : changed to native architecture build by default
|
||||
* [antonin] reverted 'include "../opj_config.h"' to 'include "opj_config.h"'
|
||||
|
||||
November 17, 2010
|
||||
! [antonin] install man pages by default. install CHANGES and LICENSE
|
||||
! [antonin] minor changes in cmake files (from winfried)
|
||||
|
||||
November 16, 2010
|
||||
! [antonin] minor changes in cmake flags
|
||||
|
||||
November 15, 2010
|
||||
! [antonin] xcode project rewrite.
|
||||
! [antonin] changed imagetopng() function to correctly deal with non-standard bit-depths. Add png support for win32. (from winfried)
|
||||
* [antonin] minor changes in header inclusions
|
||||
* [antonin] complete rewrite of opj_convert.c with correct values (from winfried)
|
||||
|
||||
November 11, 2010
|
||||
- [antonin] removed call to dirent.h in jp3d;
|
||||
|
||||
October 28, 2010
|
||||
* [ben.boeckel] Set the soname and soversion on the jpwl library with CMake
|
||||
+ [ben.boeckel] Install jpwl binaries with CMake
|
||||
|
||||
October 26, 2010
|
||||
* [ben.boeckel] Install symlinks to versioned directory headers when using CMake
|
||||
+ [ben.boeckel] Set the library version on jp3d when using CMake
|
||||
|
||||
October 25, 2010
|
||||
* [ben.boeckel] Fix jp3d version
|
||||
|
||||
October 24, 2010
|
||||
* [antonin] Fixed doxygen data inside source code (from winfried)
|
||||
|
||||
October 22, 2010
|
||||
* [ben.boeckel] Don't install jp3d and libopenjpeg headers to the same place
|
||||
|
||||
October 22, 2010
|
||||
* [ben.boeckel] Install man pages when using CMake
|
||||
|
||||
October 22, 2010
|
||||
! [ben.boeckel] Default to building shared libraries
|
||||
|
||||
October 22, 2010
|
||||
* [antonin] Patch to support the MSVC Win 64 builds (from szekerest)
|
||||
|
||||
October 22, 2010
|
||||
* [antonin] Currently the Visual Studio builds are broken in the SVN. Attached a patch to fix this issue (from szekerest)
|
||||
|
||||
October 22, 2010
|
||||
* [szukw000] replaced 'cp -d' with 'cp -P' for MacOSX
|
||||
|
||||
October 22, 2010
|
||||
* [szukw000] 'jpwl/Makefile.am': added CFLAGS for bin_PROGRAMS
|
||||
|
||||
October 22, 2010
|
||||
+ [szukw000] added 'libopenjpeg.pc.in'
|
||||
! [szukw000] changed 'configure.ac' to create 'libopenjpeg.pc'
|
||||
! [szukw000] changed 'Makefile.am' to [un]install 'libopenjpeg.pc'
|
||||
! [szukw000] changed 'doc/Makefile.am' : 'uninstall-hook' added
|
||||
|
||||
October 20, 2010
|
||||
* [antonin] fixed help display (patch from winfried)
|
||||
|
||||
October 20, 2010
|
||||
* [antonin]
|
||||
fixed paths to png and tiff in CMakeLists.txt (patch from winfried)
|
||||
fixed link to lcms library (patch from winfried)
|
||||
|
||||
October 18, 2010
|
||||
* [antonin] fixed options and help display (patch from winfried)
|
||||
|
||||
October 18, 2010
|
||||
! [szukw000]
|
||||
doc/Makefile.am
|
||||
doc/Makefile.nix
|
||||
jp3d/Makefile.nix
|
||||
jpwl/Makefile.nix
|
||||
Makefile.nix
|
||||
config.nix
|
||||
|
||||
October 17, 2010
|
||||
! [szukw000]
|
||||
configure.ac : 'enable_shared' YES by default
|
||||
doc/Makefile.am :
|
||||
'all-local' and 'install-data-hook' added
|
||||
'with_doxygen' conditional added
|
||||
Makefile.am : 'doc' directory no longer substituted in SUBDIRS
|
||||
|
||||
to link binaries statically: '-static' added to:
|
||||
codec/Makefile.am
|
||||
mj2/Makefile.am
|
||||
jpwl/Makefile.am
|
||||
jp3d/codec/Makefile.am
|
||||
|
||||
mj2/Makefile.am : 'with_libjpwl' removed
|
||||
mj2/Makefile.nix : 'with_libjpwl' removed
|
||||
|
||||
config.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||
doc/Makefile.nix : 'clean', 'install', 'uninstall' added
|
||||
Makefile.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||
|
||||
INSTALL : topic 3) changed regarding the changes in 'config.nix'
|
||||
|
||||
October 13, 2010
|
||||
! [szukw000]
|
||||
configure.ac
|
||||
bootstrap.sh
|
||||
|
||||
'with_libjpwl' removed from:
|
||||
libopenjpeg/Makefile.am
|
||||
codec/Makefile.am
|
||||
codec/Makefile.nix
|
||||
Makefile.nix
|
||||
|
||||
October 10, 2010
|
||||
* [antonin] Patch from winfried
|
||||
|
||||
1. The jp3d/libjp3dvm/Makefile.am has been changed:
|
||||
|
||||
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/
|
||||
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
PREFIX/include:
|
||||
|
||||
23 openjpeg.h -> openjpeg-1.4/openjpeg.h
|
||||
27 openjpeg3d.h -> openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
28773 openjpeg-1.4/openjpeg.h
|
||||
22158 openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
2. The jp3d/Makefile.nix has been changed respectivly.
|
||||
|
||||
3. The mj2/Makefile.nix contained a wrong path to 'compat/'
|
||||
|
||||
4. opj_config.h.in.user contained a comment within a comment.
|
||||
|
||||
5. 'autoreconf' reported that AC_PROG_RANLIB is no longer
|
||||
necessary in 'configure.ac'.
|
||||
|
||||
October 08, 2010
|
||||
* [antonin] fixed a bug in mj2.c that prevented extract_j2k_from_mj2 to build properly. Patch from winfried.
|
||||
|
||||
October 04, 2010
|
||||
+ [antonin] Added files to let people build openjpeg with 'configure' tools
|
||||
+ [antonin] Added makefiles to let people manually build openjpeg on *nix platforms
|
||||
- [antonin] Removed obsolete Makefiles
|
||||
! [antonin] Renamed dirent.h to windirent.h
|
||||
! [antonin] Made optional the PNG, TIFF, and LCMS support in CMake files
|
||||
+ [antonin] Added opj_config* files to configure openjpeg before building it (opj_config.h generated by 'configure', cmake, or manually by the user)
|
||||
! [antonin] Renamed this file from ChangeLog to CHANGES
|
||||
! [antonin] Renamed 'License.txt' to 'LICENSE'
|
||||
! [antonin] Updated README files
|
||||
+ [antonin] Added INSTALL and LICENSE files
|
||||
+ [antonin] Added man pages
|
||||
|
||||
June 22, 2010
|
||||
+ [MM] Apply patch from w. szukalski (sent to list)
|
||||
+ [MM] Also dump the image info as well as cp info.
|
||||
|
||||
June 21, 2010
|
||||
+ [MM] Added a j2k_dump to simply dump the parameter of a J2K file
|
||||
|
||||
May 26, 2010
|
||||
+ [antonin] Added CTestConfig.cmake to the root directory to incorporate the testing dashboard.
|
||||
+ [antonin] MACOSX : Added a "build all" target to the XCode project file.
|
||||
|
||||
April 16, 2010
|
||||
* [antonin] MACOSX : Fixed the XCode project file to link with the PNG library. Library and header should be located in /usr/local/lib/ and /usr/local/include/, respectively. Check http://ethan.tira-thompson.org/Mac_OS_X_Ports.html if it is not the case on your mac.
|
||||
|
||||
April 8, 2010
|
||||
* [FOD] Fixed issue 6 on google code. Variable "pi" not freed or pointed-to in function "pi_create_encode". Thanks to Kent Mein for reporting this.
|
||||
* [FOD] Fixed problem with Borland C++ Builder (Borland C do not have lrintf). Thanks Marek Mauder for this fix.
|
||||
* [FOD] Fixed pi.c bug (issue 15 on google code). Thanks to Anton Lionel for catching this.
|
||||
* [FOD] Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches
|
||||
* [FOD] Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
|
||||
! [FOD] Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter)
|
||||
|
||||
March 26, 2010
|
||||
+ [FOD] Added support for "jpc" codestreams which are equivalent to "j2c" codestreams. Thanks to Winfried for this patch
|
||||
* [FOD] Added support for PNG image format [Not yet functional under WIN32]. Thanks to Winfried for this patch. See details here http://code.google.com/p/openjpeg/issues/detail?id=16
|
||||
|
||||
March 24, 2010
|
||||
* [FOD] Code improvements using 'g++-4.4.0' to trace the code. Thanks to Winfried for this patch.
|
||||
|
||||
March 7, 2010
|
||||
* [FOD] Fixed small compatibility issues with win32 in codec (moved include <strings.h>)
|
||||
|
||||
March 5, 2010
|
||||
! [FOD] Updated makefiles for v1.4 and v2.0
|
||||
+ [FOD] First import of OPJ_Validate tool
|
||||
|
||||
February 18, 2010
|
||||
* [FOD] JP3D Module. Fixed issue when computing the number of elements in an array that leads to crash (thanks Kristof). Updated JP3D makefiles.
|
||||
|
||||
January 20, 2010
|
||||
! [FOD] Created a new constant in openjpeg.h to differentiate the case when the colorspace is not supported by the library and when it is not specified in the codestream. Suggested by Matteo Italia.
|
||||
|
||||
November 5, 2009
|
||||
* [antonin] fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info.
|
||||
|
||||
November 5, 2009
|
||||
* [antonin] fixed "tiffio" header inclusion to use user version on Win32 system only (otherwise assume its existence in system headers).
|
||||
|
||||
September 10, 2009
|
||||
* [antonin] fixed minor bugs which were triggering warnings at compilation (different signedness, wrong pointer type, etc)
|
||||
|
||||
September 8, 2009
|
||||
* [antonin] openjpeg.c : fixed initialization of parameters->cp_disto_alloc/fixed_quality/fixed_alloc/tcp_numlayers because they were preventing to use the -q and -f options.
|
||||
|
||||
August 31, 2009
|
||||
* [antonin] JavaOpenJpegDecoder.c : fixed a signed/unsigned behaviour when returning form C to JAVA
|
||||
|
||||
August 21, 2008
|
||||
* [antonin] found a bug in tcd.c that was preventing to find the correct threshold in tcd_rateallocate.c for high-precision images. Applied a temporary patch but a better solution should be found.
|
||||
|
||||
August 21, 2008
|
||||
* [antonin] fixed a bug in image_to_j2k.c that was preventing the 'r' option to work properly (everything was compressed lossless regardless of the specified rate).
|
||||
|
||||
August 8, 2008
|
||||
! [FOD] Modified the way raw images with more that 8bpp are read and written
|
||||
|
||||
July 9, 2008
|
||||
+ [Parvatha] Added the default lossless parameter to opj_set_default_encoder_parameters in openjpeg.c.
|
||||
|
||||
June 12, 2008
|
||||
* [antonin] fixed a bug in dirent.h that prevented codec on Linux Alpha Systems to compile correctly. Thanks to RobinC.
|
||||
|
||||
May 22, 2008
|
||||
* [antonin] fixed a bug in j2k.c (j2k_write_sod) that allowed to get negative rates, thanks zhong1985624 for pointing this.
|
||||
|
||||
May 22, 2008
|
||||
* [antonin] additional test to avoid crash due to invalid image size, patch by Christopher Layne
|
||||
|
||||
May 20, 2008
|
||||
* [antonin] memory leak fixed in openjpeg.c (opj_destroy_cstr_info()), patch by Carsten Juttner
|
||||
|
||||
March 12, 2008
|
||||
+ [GB] help line for the -F option in j2k_to_image
|
||||
|
||||
March 4, 2008
|
||||
! [FOD] Changed Java files copyright in JavaOpenJPEG module
|
||||
|
||||
February 28, 2008
|
||||
* [FOD] Fixed openjpeg.c for proper initialization of codec context structures (dinfo in opj_create_compress()
|
||||
and opj_create_decompress(). Bug fix suggested by Andrey V. Kiselev
|
||||
* [FOD] Clean up of opj_aligned_malloc(), to just forgo the use of posix_memalign(),
|
||||
as apparently memalign() is what is working better for everyone. Patch by Callum.
|
||||
|
||||
February 28, 2008
|
||||
- [FOD] Removed the J2KViewer module, which has been replaced by OPJViewer
|
||||
* [FOD] Fixed the error handling of j2k_decode in jp2.c, thanks to Robin Cornelius
|
||||
|
||||
February 11, 2008
|
||||
* [GB] Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified
|
||||
! [GB] Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
|
||||
|
||||
February 5, 2008
|
||||
! [Parvatha] In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in
|
||||
tcd_init_encode(). Thanks to Jeremy Furtek and Jérôme Fimes.
|
||||
|
||||
January 31, 2008
|
||||
! [GB] In opjviewer, unification of JPEG 2000 family handlers (*.jp2, *.mj2, *.j2k) in a single file
|
||||
|
||||
January 22, 2008
|
||||
! [FOD] In image.c, changed the opj_image_create0() memory allocation from malloc() to calloc() in order
|
||||
to avoid segfaults when freeing the memory allocated for the coding of bad images.
|
||||
Thanks to Christopher Layne for this improvement.
|
||||
|
||||
January 17, 2008
|
||||
+ [antonin] Initial commit of Xcode project directory (XCode 2.5 for macosx)
|
||||
available targets : libopenjpeg (stat and dyn), image_to_j2k, j2k_to_image
|
||||
|
||||
January 16, 2008
|
||||
* [antonin] fixed opj_malloc.h for macosx (bugfix provided by janpeder, thanks)
|
||||
|
||||
January 11, 2008
|
||||
+ [FOD] Added missing files to JavaOpenJPEG project (files from Patrick Piscaglia)
|
||||
|
||||
January 4, 2008
|
||||
* [Parvatha] Patch by Callum Lerwick. Fixed bug during encoding using tile option in tcd.c
|
||||
|
||||
----------------------
|
||||
December 21, 2007
|
||||
VERSION 1.3.0 RELEASED
|
||||
----------------------
|
||||
|
||||
December 21, 2007
|
||||
* [FOD] Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h
|
||||
! [FOD] Possible errors in pi_create_encode handled
|
||||
|
||||
December 19, 2007
|
||||
* [Antonin] changed variables names alpha, beta, gamma, delta in dwt.c to avoid re-declarations on Macosx
|
||||
! [Parvatha] In pi.c, removed the Recursive function pi_check_next_level() and modified the code.
|
||||
* [FOD] Fixed allocation problem in pi.c
|
||||
|
||||
December 19, 2007
|
||||
+ [FOD] In mqc.h, changed MQC_NUMCTXS from 32 to 19 as there are only 19 possible contexts
|
||||
|
||||
December 10, 2007
|
||||
+ [FOD] First import of JAVAOpenJPEG, a Java wrapper of OpenJPEG, developed by Patrick Piscaglia of Telemis (www.telemis.com).
|
||||
Thank you Patrick for this new module !
|
||||
|
||||
November 29, 2007
|
||||
! [GB] Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files.
|
||||
|
||||
November 14, 2007
|
||||
+ [FOD] Created the file index.c in the codec directory. This file handles the creation of index files,
|
||||
at encoding and decoding.
|
||||
* [FOD] Fixed bugs during the creation of the index (PCRL progression order)
|
||||
* [FOD] Fixed the maximum number of resolutions a user can discard while decoding.
|
||||
Added an error state in J2K_STATE (j2k.c)
|
||||
|
||||
November 14, 2007
|
||||
! [FOD] - First Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c
|
||||
- Second Patch by Callum Lerwick. This patch rearranges the largest memory allocations so they're allocated as
|
||||
late as possible, and freed as soon as possible. This cuts memory usage by about half on two large test images.
|
||||
- Third Patch by Callum Lerwick. The opj_tcd_cblk array is one of the largest allocations, because it
|
||||
contains a bunch of static buffers. This also makes it a major source of cache thrashing. This patch allocates
|
||||
the buffers from the heap, and dynamically sizes them in the decoder. I have not yet managed to dynamically size
|
||||
them in the encoder, getting the decoder to do it was tricky enough... I also split opj_tcd_cblk_t into separate
|
||||
encode and decode versions. A lot of fields were not used by both, so this cuts its size even further.
|
||||
|
||||
* [FOD] Avoided ABI breakage
|
||||
|
||||
November 13, 2007
|
||||
! [FOD] Patch by Dzonatas and Callum Lerwick.
|
||||
Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point,
|
||||
eliminating a few rounds of int/fp conversion, resulting in a vast performance improvement,
|
||||
and an increase in accuracy.
|
||||
|
||||
November 8, 2007
|
||||
! [FOD] In t1.c, small change to avoid calling twice t1_getwmsedec()
|
||||
Patches from Callum Lewick:
|
||||
- Basic gcc optimization flags in cmake and makefile match.
|
||||
- Fixed some spelling errors in dwt.c.
|
||||
|
||||
November 5, 2007
|
||||
*+ [GB] Fixed a bug which prevented JPWL from working on multi-tiled images; added some more fields in the interface info structures
|
||||
(keep a list of markers, save start packet number for each tile)
|
||||
|
||||
October 23, 2007
|
||||
* [GB] Improved success for the linux build; OPJViewer shows all the COM contents
|
||||
|
||||
October 18, 2007
|
||||
* [FOD] Changed the ROI parameter in the image_to_j2k codec to make it correspond to the documentation (i.e. -ROI c=0,U=25)
|
||||
* [FOD] Patch from Callum Lewick. Memset patch.
|
||||
The main idea of the patch is that currently opj_malloc clears all allocations, which unnecessarily
|
||||
dirties up the cache and eats bandwidth. This patch makes it no longer do so, and I've painstakingly determined which allocations actually need
|
||||
to be cleared and changed them to use opj_calloc() instead. I previously tried to just get rid of the opj_*alloc wrappers but that
|
||||
idea was nixed, so this time I'm trying it with macros. I also put in a gcc pragma that helps enforce their use. Which got messy. :) It caught a
|
||||
few places they weren't used but it also revealed that the mj2 tools are not very cleanly separated from the library. It includes all the
|
||||
internal headers, but it wasn't using the malloc wrappers. I figured the binaries should be "external" and have minimal knowledge of the
|
||||
internals of the library. I patched them to not include opj_includes.h, and include only the internal headers they actually need. However,
|
||||
they're using the opj_clock() function, which is in with the malloc wrappers. So I decided to move the malloc wrappers to their own header.
|
||||
But mj2.c seems to want to be "internal", so I patched it to use the wrappers. Note that this patch changes the semantics of opj_malloc, it no longer
|
||||
clears the memory it allocates. If you need it to be cleared, you must use opj_calloc instead, or memset it yourself. It is also somewhat
|
||||
invasive, please test it extensively. I've been pounding on it all summer with my test suite, Second Life, and valgrind, and it checks out clean.
|
||||
|
||||
October 12, 2007
|
||||
* [FOD] Changed the way the image structure is allocated when the decoding parameters include some resolutions to discard.
|
||||
This should have a significant impact for the decoding of huge images when some resolutions are discarder (-r parameter)
|
||||
Warning: The output image size is now reduced when discarding resolutions !
|
||||
|
||||
October 10, 2007
|
||||
* [FOD] Patch from Callum Lewick. Clean up of j2klib.h for the aligned malloc stuff.
|
||||
It makes it work right with mingw, as _mm_malloc() isn't a macro, attempts to pave the way to using cmake
|
||||
to check for this stuff and combines a patch from Dana Fagerstrom at Sun that makes it use memalign() on Solaris
|
||||
convert.c: Changed some error comments for TIFF images
|
||||
|
||||
September 27, 2007
|
||||
* [FOD] Patch from Callum Lewick. Fixed dwt.c where an alignment in buffer was problematic under x86_64.
|
||||
|
||||
September 25, 2007
|
||||
* [Mathieu Malaterre] BUG: Fix previous patch from Callum Lerwick. I have no
|
||||
clue what CMAKE_INSTALL_LIBDIR refers too. Bump up cmake 2.2 restriction to
|
||||
cmake 2.4 because of previous patch (not backward compatible). Properly set the SOVERSION in a cross plateform way (yes WIN32 is a platform)
|
||||
|
||||
September 19, 2007
|
||||
* [Parvatha] Fixed issues with generation of SOP marker.
|
||||
|
||||
September 18, 2007
|
||||
* [Parvatha] Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
|
||||
* [Parvatha] Fixed issues relating to using user specified rates for CINEMA option for multiple images.
|
||||
|
||||
September 17, 2007
|
||||
* [FOD] Fixed issues with cstr_info when codestream has components with different number of resolutions.
|
||||
! [FOD] OpenJPEG library interface modified to retain compatibility with version 1.2
|
||||
|
||||
September 12, 2007
|
||||
* [FOD] Patch from Callum Lerwick.
|
||||
Fixed the library linking so it links with the soversion properly set.
|
||||
Fixes up the install targets so that it interacts properly with RPM.
|
||||
Install target for MJ2. Sets some necessary and useful CFLAGS if gcc is in use.
|
||||
* [FOD] Updated the MJ2 codec to be compatible with the recent changes in the OpenJPEG library
|
||||
|
||||
September 11, 2007
|
||||
* [GB] JPWL encoding is finalized correctly into the JP2 file format; added an additional structure in opj_codestream_info, to keep a record of the written markers
|
||||
|
||||
September 8, 2007
|
||||
* [GB] Adapted the JPWL and OPJViewer code to new interface; fixed a samll bug in JPWL which created large EPBs even when null protection was specified
|
||||
|
||||
September 7, 2007
|
||||
+ [FOD] Indexes can now be generated when decoding J2K codestreams.
|
||||
* [Mathieu Malaterre] Upon failure, properly return error code (!=0).
|
||||
* [Mathieu Malaterre] CMake: Add cmake code to do testing if user has properly setup a testimages directory
|
||||
|
||||
September 6, 2007
|
||||
+ [Mathieu Malaterre] CMake: start compiling mj2, jpwl and jp3d
|
||||
+ [Mathieu Malaterre] CMake: output all executable/libs into one single directory
|
||||
+ [Mathieu Malaterre] CMake: start compiling index_create
|
||||
+ [Mathieu Malaterre] OpenJPEG.rc update copyright year
|
||||
+ [Mathieu Malaterre] CMake: add Java j2kviewer but do not compile it using cmake since cmake has too poor support for Java. Should create a custom command running ant instead.
|
||||
+ [Mathieu Malaterre] CMake: Add doxygen output
|
||||
+ [GB] One more field in the codestream_info struct for recording the number of packets per tile part; JPWL now distributes the EPBs in all the tile part headers
|
||||
+ [Mathieu Malaterre] CMake: Add very simple tests (simply run command line with no option)
|
||||
* [Mathieu Malaterre] Fix unitialized read in img_fol (we may need a smarter initialize than memset)
|
||||
|
||||
September 4, 2007
|
||||
+ [GB] Added some fields in the codestream_info structure: they are used to record the position of single tile parts.
|
||||
Changed also the write_index function in the codec, to reflect the presence of this new information.
|
||||
|
||||
September 3, 2007
|
||||
+ [GB] Added the knowledge of JPSEC SEC and INSEC markers (you have to compile the JPWL project). Management of these markers is limited to skipping them without crashing:
|
||||
no real security function at this stage. Deprecated USE_JPSEC will be removed next
|
||||
|
||||
August 31, 2007
|
||||
* [GB] Fixed save capabilities in OPJViewer due to recent code upgrade
|
||||
|
||||
August 30, 2007
|
||||
* [FOD] Changed the OpenJPEG library interface to enable users to access information regarding the codestream (also called codestream index).
|
||||
This index is usefull for all applications requiring to have a scalable acces to the codestream (like JPIP applications, ...)
|
||||
Currently, this information is only available when encoding an image.
|
||||
+ [FOD] Added the information regarding the end of packet position in the index
|
||||
|
||||
August 28, 2007
|
||||
* [FOD] Fixed wrong destructors called in openjpeg.c
|
||||
* [FOD] Fixed bug in j2k_decode_jpt_stream
|
||||
|
||||
August 24, 2007
|
||||
* [Parvatha] The end of main header is calculated after TLM and POC marker for Dcinema.
|
||||
|
||||
August 21, 2007
|
||||
+ [FOD] Added support for Visual Studio 2005
|
||||
* [FOD] Robustified MJ2 codecs
|
||||
* [Parvatha] Solved problems with codec reading from image file directory when filename had more than one "." in name
|
||||
* [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler
|
||||
* [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code
|
||||
* [Callum Lerwick] Memory leaks fixed
|
||||
* [Callum Lerwick] Reworks of t1_updateflags to get rid of the shift operation
|
||||
* [Callum Lerwick] mqc_setcurctx moved to the header to allow it to be inlined into the t1.
|
||||
* [Callum Lerwick] Consolidated some calls to mqc_setcurctx.
|
||||
* [Callum Lerwick] Cleaned up t1_generate_luts to output the proper types.
|
||||
* [Callum Lerwick] Replaced the large ctxno_mag lookup table with a small bit of inline-able branchless code
|
||||
* [Callum Lerwick] Moved the orient flipping into the ctxno_zc table.
|
||||
|
||||
August 20, 2007
|
||||
+ [FOD] Added support for the TGA file format in the codec
|
||||
|
||||
August 08, 2007
|
||||
* [Parvatha] Fixed the DCinema filesize allocation. It now includes the SOT marker size
|
||||
|
||||
August 02, 2007
|
||||
+ [GB] Added a basic saving capability to OPJViewer
|
||||
|
||||
July 18, 2007
|
||||
! [FOD] Updated libtiff library version to 3.8.2 (for WIN32)
|
||||
* [FOD] Updated BMP and PxM truncation when decoding J2K files with more than 8 bits
|
||||
|
||||
July 17, 2007
|
||||
* [FOD] Fixed raw option for images with more than three components
|
||||
|
||||
July 17, 2007
|
||||
+ [FOD] Added support for RAW images. This module has been developped by the University of Perugia team. Thanks to them ! [image_to_j2k.c j2k_to_image.c convert.c convert.h]
|
||||
|
||||
July 13, 2007
|
||||
! [FOD] Modified the memory allocation for codestreams containing multiple tiles. The memory is now allocated for each tile indenpendently,
|
||||
leading to an important decrease of the virtual memory needed. [j2k.c tcd.h tcd.c]
|
||||
! [FOD] Modified old comments about the ability to decode mega-images and comments about the disk size necessary to do this. [image_to_j2k.c and frames_to_mj2.c]
|
||||
* [FOD] Added 2000 bytes for the memory allocation in cio.c for the minimum size of headers (useful in case of very small images) [cio.c]
|
||||
|
||||
July 12, 2007
|
||||
* [GB] fixed a bug in JPWL module, which prevented to exploit the full error correction capability of RS codes (e.g. it gave up at 5 errors,
|
||||
even if 6 were correctable); defined a JPWL_MAXIMUM_EPB_ROOM for better customization of the maximum dimension of EPBs (the dimension
|
||||
is pre-calculated on an hypothesis, if it goes beyond 65535 there will be problems, thus we give a little less than the max, let's say 65450)
|
||||
|
||||
July 8, 2007
|
||||
* [ANTONIN] fixed the size of the memory allocation in cio.c (confusion between bits and bytes)
|
||||
|
||||
June 21, 2007
|
||||
* [FOD] Output image color space set when decoding a JP2 file in jp2.c
|
||||
+ [GB] Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer
|
||||
|
||||
June 18, 2007
|
||||
* [GB] Reload image doesn't crash in OPJViewer; more settings saved to registry
|
||||
|
||||
June 16, 2007
|
||||
+ [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry
|
||||
|
||||
June 15, 2007
|
||||
* [FOD] Fixed the generation of index files
|
||||
|
||||
|
||||
----------------------
|
||||
MAY 4, 2007
|
||||
VERSION 1.2.0 RELEASED
|
||||
----------------------
|
||||
|
||||
May 4, 2007
|
||||
* [FOD] Bugs corrected in decoding of command line (getopt.c), in the handling of 16 bit files (t1.c and tcd.c) and the calculation of elapsed time for multiple tiles parts (tcd.c and tdc.h).
|
||||
|
||||
June 2, 2007
|
||||
+ [GB] OPJViewer opens now BMP, PNG, GIF, PNM, TIFF (with wxWidgets internals); added an encoder settings tab, for future integration with "save file as..." in JPEG 2000 format
|
||||
|
||||
May 31, 2007
|
||||
* [FOD] Fixed the handling of 16bit TIFF files for cinema compression. Modified "convert.c"
|
||||
* [FOD] Fixed the parameters used for cinema compression (9-7 transform used instead of 5-3). Modified "image_to_j2k.c"
|
||||
|
||||
May 24, 2007
|
||||
* [FOD] Bug fixed by Sylvain Munaut. Change in the reading of the POC marker. Since COD/COC can be anywhere in the header, the decoder cannot always know while decoding the POC marker
|
||||
the value of numlayers and numresolution.
|
||||
|
||||
May 23, 2007
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This makes the t1 data arrays dynamic, which greatly reduces cache thrashing. Also, some minor cleanup to prevent unnecessary casts"
|
||||
|
||||
May 22, 2007
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "Some formatting cleanups,
|
||||
so that the long function definitions and calls fit on screen. Use of prefix increment which is theoretically faster, in practice any sane compiler can optimize a postfix
|
||||
increment but its best not to count on such things. Consolidation of some redundant calculations in the inner loops, which becomes very useful in the future autovectorize patch."
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This changes the flag code in t1 to use a flag_t type, which can then be changed to reduce RAM usage. It is now typedef to a short."
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This patch makes the t1 LUTs static. I actually intend this as a prelude to possibly eliminating some or all of the LUTs entirely."
|
||||
|
||||
May 11, 2007
|
||||
- [FOD] JP3D library Binaries removed from SVN.
|
||||
! [FOD] MJ2 codec updated from LibOpenJPEG version 0.97 to LibOpenJPEG version 1. Hence, the MJ2 codec will now take advantage of all the improvements and optimizations done on the LibOpenJPEG library.
|
||||
! [FOD] Possibility to choose to apply MCT (multiple component transform) enabled, and new decoding_limit: DECODE_ALL_BUT_PACKETS (openjpeg.h)
|
||||
|
||||
April 26, 2007
|
||||
+ [gdcm] Add basic steps on how to use CMake for building examples (README.cmake)
|
||||
|
||||
April 25, 2007
|
||||
+ [FOD] Modification of the openjpeg.h file to avoid and ABI break with v1.1, removed the dangerous #IFDEF JPWL and added tcp_mct in cparameters.
|
||||
|
||||
April 23, 2007
|
||||
+ [GB] Enable/disable image decoding in OPJViewer
|
||||
|
||||
April 12,2007
|
||||
* [Parvatha] Fixed Error in tiftoimage(). Modification in convert.c.
|
||||
|
||||
April 10,2007
|
||||
+ [Parvatha] Accepting "j2c" as format for Encoding and Decoding. Modification in image_to_j2k.c.
|
||||
* [Parvatha] Modified imagetotif() to read images with signed data. Modification in convert.c.
|
||||
|
||||
April 5, 2007
|
||||
! [FOD] fix.h optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||
! [FOD] dwt.c optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||
! [FOD] t1.c optimized. Thanks a lot to Callum Lerwick <seg at haxxed.com> !
|
||||
|
||||
April 4,2007
|
||||
+ [Parvatha] Digital cinema compliance for 4K chosen by "-cinema4K" option. Modification in image_to_j2k.c.
|
||||
+ [Parvatha] Bit rate limitation for each color component. Modification in image_to_j2k.c, t2.c.
|
||||
* [Parvatha] Modified and tested Progression order change "-POC" option. Modification in image_to_j2k.c, j2k.c, pi.c.
|
||||
+ [Parvatha] Function j2k_check_poc_val() to check for possible loss of packets in case of wrong POC declaration. Modification in j2k.c.
|
||||
+ [Parvatha] Structure T2_MODE. This tells if the t2_encode_packets() is called during Threshold calculation or in Final pass. Modification in j2k.h, tcd.c
|
||||
|
||||
March 30, 2007
|
||||
* [GB] OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit.
|
||||
|
||||
March 29, 2007
|
||||
* [Parvatha] Enable accepting file names with `-´ symbol .Modification getopt.c
|
||||
* [Parvatha] Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
|
||||
! [Parvatha] renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
|
||||
* [Parvatha] Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
|
||||
! [Parvatha] j2k_setup_encoder to set bit rate limitation for digital cinema compliance with quality option. Modification in j2k.c
|
||||
* [Parvatha] Equation to check multiple tile precincts. Modification pi.c
|
||||
! [Parvatha] array size generation of pi->include in pi_initialise_encode().Modification in pi.c
|
||||
* [Parvatha] modification in pi_create_encode for tile part generation.Modification in pi.c
|
||||
+ [Parvatha] In tcd_rateallocate a variable stable_threshold which holds the valid threshold value.
|
||||
This is used to avoid error in case of a wrong threshold value in the last iteration. Modification in tcd.c.
|
||||
|
||||
March 28, 2007
|
||||
* [FOD] Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha !
|
||||
|
||||
March 27, 2007
|
||||
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits;
|
||||
can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
|
||||
* [GB] Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c,
|
||||
have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)
|
||||
+ [GB] Added linking to TIFF library in the JPWL VC6 workspaces
|
||||
|
||||
March 23, 2007
|
||||
* [antonin] Fixed Makefile.osx and changed Readme.osx accordingly
|
||||
|
||||
March 21, 2007
|
||||
* [Parvatha] Fixed j2k_prog_order_list[]. Modifications in j2k.c.
|
||||
* [Parvatha] Fixed t1_decode_cblks. Modifications in t1.c.
|
||||
|
||||
March 20, 2007
|
||||
+ [Parvatha] Added feature for generation of tile parts. Modifications in image_to_j2k.c, openjpeg.c, j2k.c, pi.c
|
||||
+ [Parvatha] Added function j2k_write_tlm(),to generate TLM marker for a Digital cinema compliant codestream. Modifications in j2k.c.
|
||||
|
||||
March 14, 2007
|
||||
* [FOD] Fixed linux makefile, with help from David Fries and Guido
|
||||
|
||||
March 7, 2007
|
||||
+ [Parvatha] Added option for Digital cinema profile compliant codestream. This can be chosen by "-cinema2K" or "-cinema4K" for a 2K and 4K compliance respectively. The feature for tileparts has not been implemented in this version. Modification in image_to_j2k.c
|
||||
+ [Parvatha] Added the Digital Cinema profiles (CINEMA2K and CINEMA4K) to the list of profiles recognized in the codestream SIZ marker segment. Modification in openjpeg.h,j2k.c
|
||||
+ [Parvatha] Added feature for constant quality within bitrate defined in Digital cinema standards. Modification in tcd.c
|
||||
! [Parvatha] Modified the method of generation of buffer length. Modification in cio.c
|
||||
|
||||
|
||||
March 1, 2007
|
||||
* [FOD] Modified codec projects (*.dsp) and makefile to include the tiff library (modified codec/image_to_j2k.dsp codec/j2k_to_image.dsp and codec/makefile)
|
||||
+ [GB] Zoom capability and decoder settings dialog in OPJViewer; modified JPWL library .dsp project in order to create a library with embedded JPWL functions
|
||||
|
||||
February 28, 2007
|
||||
+ [Parvatha] Enabled compression of TIF image format to j2k by tifftoimage() and decompression of codestream to TIF image format using imagetotif(). Modifications in image_to_j2k.c, j2k_to_image.c, convert.c, convert.h
|
||||
* [antonin] fixed a bug in context numerotation that prevented the RESET switch to work correctly : mqc_reset_enc in mqc.c
|
||||
* [Fod] Corrected codec Makefile by adding the compilation of "compat/getopt.c"
|
||||
|
||||
February 27, 2007
|
||||
* [Parvatha] Made get_file_format function more robust. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
|
||||
February 26, 2007
|
||||
+ [Parvatha] Option to read images from a Folder whose path is specified in the Input parameters by "-ImgDir" along with output decod format specified by "-OutFor" . Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
+ [Parvatha] Enabling use of multi character input parameters in the codec. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
|
||||
----------------------
|
||||
February 23, 2007
|
||||
VERSION 1.1.1 RELEASED
|
||||
----------------------
|
||||
|
||||
February 23, 2007
|
||||
* [GB] Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c.
|
||||
As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib
|
||||
+ [GB] Linux makefile for the JPWL module; newlines at end of JPWL files
|
||||
|
||||
February 22, 2007
|
||||
+ [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia
|
||||
|
||||
February 21, 2007
|
||||
+ [FOD] Algorithmic optimizations in t1.c, thanks to Guido J. !
|
||||
|
||||
February 19, 2007
|
||||
+ [FOD] Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header (modified openjpeg.c, openjpeg.h, j2k.c and j2k.h)
|
||||
|
||||
February 13, 2007
|
||||
! [FOD] David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
|
||||
! [FOD] David Fries suggestions. Makefile modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
|
||||
|
||||
January 31, 2007
|
||||
! [FOD] Extra tokens at the end of #endif directive corrected in openjpeg.c, j2k.c and image_to_j2k.c -> no more warnings in linux compilation
|
||||
! [FOD] Linux Makefile added for the codec
|
||||
|
||||
January 30, 2007
|
||||
! [FOD] Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c
|
||||
! [FOD] Correction of the syntax usage in MJ2_codec/mj2_to_frames.c
|
||||
|
||||
January 23, 2007
|
||||
! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h
|
||||
|
||||
December 07, 2006
|
||||
+ [Giuseppe Baruffa] Antonin verified that the MacOS build suffered from a missing definition of the "min" macro; I've added this definition (properly #ifndef'ed) into both jpwl.h and rs.h
|
||||
|
||||
December 05, 2006
|
||||
* [Giuseppe Baruffa] Better fix of the TPH EPBs bug in JPWL module
|
||||
* [GB] Fixed the UEP bug in JPWL module; now, during a UEP specification, RS protection or CRC check can be switched off for selected range of packets, and consequently reswitched on without confusing the decoder
|
||||
+ [GB] Added some lines in the help of JPWL_image_to_j2k, specifying that when using error protection on data packets, this must be paired with header protection, i.e. there cannot be packet protection without header protection
|
||||
|
||||
December 04, 2006
|
||||
|
||||
+ [Francois-Olivier Devaux] New tag: version1.0 (includes codec and libopenjpeg directories)
|
||||
Total update of JPWL module
|
||||
- [FOD] removed directories jpwl/decoder, jpwl/encoder, jpwl/decoder_02, jpwl/encoder_02
|
||||
+ [FOD] added in JPWL directory crc.h, jpwl.h, rs.h, crc.c, jpwl.c, jpwl_lib.c, rs.c, JPWL_image_to_j2k.dsp, JPWL_j2k_to_image.dsp, LibOpenJPEG_JPWL.dsp, JPWL_image_to_j2k.dsw, JPWL_j2k_to_image.dsw
|
||||
! [FOD] Modifications of libopenjpeg to integrate JPWL module (in libopenjpeg directory): j2k.c, j2k.h, openjpeg.c, openjpeg.h, opj_includes.g, t2.c
|
||||
! [FOD] Modification of codec to integrate JPWL module (in codec directory): image_to_j2k.c, j2k_to_image.c
|
||||
* [FOD] Corrected incorrect fprintf() formatting in codec/convert.c
|
||||
* [FOD] Code optimization usinq vsprintf() command in libopenjpeg/event.c
|
||||
* [Giuseppe Baruffa] Fixed a bug in TPH EPBs parameters: now, "last in current header" information is correctly signaled
|
||||
|
||||
October 31, 2006
|
||||
* [Antonin] fixed a bug in the computation of the mantissa (mu)
|
||||
+ [Antonin] added the ability to specify the rate as "float" (before : integer)
|
||||
|
||||
August 18, 2006
|
||||
* [Antonin] fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly.
|
||||
|
||||
August 4, 2006
|
||||
* [Antonin] fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level.
|
||||
|
||||
July 28, 2006
|
||||
+ [Antonin Descampe] added a readme in /mj2 to warn people that it only works with opj0.97
|
||||
|
||||
July 21, 2006
|
||||
* [Mathieu Malaterre] Install exe and lib and include correctly
|
||||
* [Mathieu Malaterre] Fixed mem leaks and greyscale bmp
|
||||
* [Mathieu Malaterre] Fix pgx name length + random memory access
|
||||
! [Mathieu Malaterre] API is now const
|
||||
|
||||
March 19, 2006
|
||||
* [Antonin] fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug)
|
||||
|
||||
February 12, 2006
|
||||
- [Herve Drolon] removed unneeded working variables in opj_tcd_t
|
||||
|
||||
February 04, 2006
|
||||
* [galt] fixed a bug in codec/convert.c::imagetobmp
|
||||
|
||||
February 01, 2006
|
||||
! [Herve Drolon] changed function definitions of INT and FIX modules to 'inline'
|
||||
+ [Herve Drolon] added a VERSION resource to the DLL version of OpenJPEG
|
||||
|
||||
January 31, 2006
|
||||
* [Mathieu Malaterre] Fix compilation using default openjpeg.dsw
|
||||
* [Herve Drolon] fixed various minor warnings occuring under icc9 and bcc32
|
||||
- [Mathieu Malaterre] Remove all references to OPJ_EXPORT, no declspec in header file anymore
|
||||
+ [Mathieu Malaterre] Add a def.in file which is a template for Module Definition
|
||||
+ [Herve Drolon] added MSVC project and compiler directives to build a 'standard' WIN32 DLL
|
||||
! [Mathieu Malaterre] Update CMake to match the new shared lib system (no more def file)
|
||||
|
||||
January 27, 2006
|
||||
* [Antonin Descampe] fixed a two initialization problems in t1.c and tcd.c
|
||||
|
||||
January 26, 2006
|
||||
* [Herve Drolon] fixed various minor warnings occuring under gcc
|
||||
* [__david__] fixed a segfault in codec/image_to_j2k.c & codec/j2k_to_image.c
|
||||
* [__david__] fixed help option in codec/j2k_to_image & codec/image_to_j2k
|
||||
|
||||
January 25, 2006
|
||||
! [Mathieu Malaterre] Sync with ITK repository, also add ref to doxygen
|
||||
! [Mathieu Malaterre] Add a lot of comments on the CMake build system
|
||||
! [Mathieu Malaterre] Fix MINGW32 and BORLAND compilation problems.
|
||||
|
||||
January 25, 2006
|
||||
* [Antonin Descampe] fixed a problem in convert.c when multiple comments
|
||||
+ [Antonin Descampe] added cmake files to the project
|
||||
! [Antonin Descampe] fix.c : replaced "WIN32" by "_MSC_VER" for int64
|
||||
+ [Antonin Descampe] added "OPJ_EXPORT" in openjpeg.h to generate shared lib with win32
|
||||
! [Antonin Descampe] removed all CtrlM from files
|
||||
|
||||
January 24, 2006
|
||||
! [Antonin Descampe] event.c : replaced "WIN32" by "_MSC_VER" for i2a
|
||||
|
||||
January 20, 2006
|
||||
* [Antonin Descampe] fixed various minor warnings with gdcm patches
|
||||
|
||||
January 19, 2006
|
||||
* [Herve Drolon] fixed a bug in jp2_read_ihdr (need to allocate jp2->comps)
|
||||
|
||||
January 18, 2006
|
||||
* [Herve Drolon] changed the name of j2k_realloc to opj_realloc
|
||||
* [Herve Drolon] fixed a bug in opj_cio_open when saving 48-bit images (wrong buffer size calculation)
|
||||
|
||||
December 8, 2005
|
||||
* [Antonin Descampe] fixed a bug when specifying a rate '-r' => no distortion info was available in the index
|
||||
* [Antonin Descampe] fixed a bug in t1_getwmsedec (stepsize was divided by 8192)
|
||||
|
||||
December 5, 2005 - 1.1.0
|
15
CMake/CheckHaveGetopt.cmake
Normal file
15
CMake/CheckHaveGetopt.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
# Check if getopt is present:
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
SET(DONT_HAVE_GETOPT 1)
|
||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||
# Seems like we need the contrary:
|
||||
IF(CMAKE_HAVE_GETOPT_H)
|
||||
SET(DONT_HAVE_GETOPT 0)
|
||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
48
CMake/OpenJP3DConfig.cmake.in
Normal file
48
CMake/OpenJP3DConfig.cmake.in
Normal file
@ -0,0 +1,48 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# OPENJP3DConfig.cmake - CMake configuration file for external projects.
|
||||
#
|
||||
# This file is configured by OPENJP3D and used by the UseOPENJP3D.cmake
|
||||
# module to load OPENJP3D's settings for an external project.
|
||||
@OPENJP3D_CONFIG_INSTALL_ONLY@
|
||||
# The OPENJP3D version number.
|
||||
SET(OPENJP3D_MAJOR_VERSION "@OPENJP3D_VERSION_MAJOR@")
|
||||
SET(OPENJP3D_MINOR_VERSION "@OPENJP3D_VERSION_MINOR@")
|
||||
SET(OPENJP3D_BUILD_VERSION "@OPENJP3D_VERSION_BUILD@")
|
||||
|
||||
# The libraries.
|
||||
SET(OPENJP3D_LIBRARIES "@OPENJP3D_LIBRARIES@")
|
||||
|
||||
# The CMake macros dir.
|
||||
SET(OPENJP3D_CMAKE_DIR "@OPENJP3D_CMAKE_DIR_CONFIG@")
|
||||
|
||||
# The configuration options.
|
||||
SET(OPENJP3D_BUILD_SHARED_LIBS "@OPENJP3D_BUILD_SHARED_LIBS@")
|
||||
|
||||
# The "use" file.
|
||||
SET(OPENJP3D_USE_FILE "@OPENJP3D_USE_FILE_CONFIG@")
|
||||
|
||||
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
if(EXISTS ${SELF_DIR}/OpenJP3DTargets.cmake)
|
||||
# This is an install tree
|
||||
include(${SELF_DIR}/OpenJP3DTargets.cmake)
|
||||
get_filename_component(OPENJP3D_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJP3D_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||
set(OPENJP3D_INCLUDE_DIRS ${OPENJP3D_INCLUDE_ROOT})
|
||||
|
||||
else(EXISTS ${SELF_DIR}/OpenJP3DTargets.cmake)
|
||||
if(EXISTS ${SELF_DIR}/OpenJP3DExports.cmake)
|
||||
# This is a build tree
|
||||
SET( OPENJP3D_INCLUDE_DIRS @OPENJP3D_INCLUDE_PATH@)
|
||||
|
||||
include(${SELF_DIR}/OpenJP3DExports.cmake)
|
||||
|
||||
else(EXISTS ${SELF_DIR}/OpenJP3DExports.cmake)
|
||||
message(FATAL_ERROR "ooops")
|
||||
endif(EXISTS ${SELF_DIR}/OpenJP3DExports.cmake)
|
||||
endif(EXISTS ${SELF_DIR}/OpenJP3DTargets.cmake)
|
||||
|
||||
set(OPENJP3D_USE_FILE ${SELF_DIR}/UseOPENJP3D.cmake)
|
||||
|
||||
# Backward compatible part:
|
||||
SET(OPENJP3D_FOUND TRUE)
|
||||
|
499
CMakeLists.txt
499
CMakeLists.txt
@ -1,86 +1,58 @@
|
||||
# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
|
||||
# Main CMakeLists.txt to build the OpenJP3D 3D project using CMake (www.cmake.org)
|
||||
# Written by Mathieu Malaterre
|
||||
|
||||
# This CMake project will by default create a library called openjpeg
|
||||
# This CMake project will by default create a library called openjp3d
|
||||
# But if you want to use this project within your own (CMake) project
|
||||
# you will eventually like to prefix the library to avoid linking confusion
|
||||
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||
# For this purpose you can define a CMake var: OPENJP3D_NAMESPACE to whatever you like
|
||||
# e.g.:
|
||||
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
# SET(OPENJP3D_NAMESPACE "GDCMOPENJP3D")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
if(COMMAND CMAKE_POLICY)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
endif()
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
|
||||
if(NOT OPENJPEG_NAMESPACE)
|
||||
set(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
set(OPENJPEG_STANDALONE 1)
|
||||
endif()
|
||||
IF(NOT OPENJP3D_NAMESPACE)
|
||||
SET(OPENJP3D_NAMESPACE "OPENJP3D")
|
||||
SET(OPENJP3D_STANDALONE 1)
|
||||
ENDIF(NOT OPENJP3D_NAMESPACE)
|
||||
# In all cases:
|
||||
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||
set(OPENJPEG_LIBRARY_NAME openjp2)
|
||||
STRING(TOLOWER ${OPENJP3D_NAMESPACE} OPENJP3D_LIBRARY_NAME)
|
||||
|
||||
project(${OPENJPEG_NAMESPACE} C)
|
||||
PROJECT(${OPENJP3D_NAMESPACE} C)
|
||||
|
||||
# Do full dependency headers.
|
||||
include_regular_expression("^.*$")
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
set(OPENJPEG_VERSION_MAJOR 2)
|
||||
set(OPENJPEG_VERSION_MINOR 2)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
set(PACKAGE_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
|
||||
# Because autotools does not support X.Y notation for SOVERSION, we have to use
|
||||
# two numbering, one for the openjpeg version and one for openjpeg soversion
|
||||
# version | soversion
|
||||
# 1.0 | 0
|
||||
# 1.1 | 1
|
||||
# 1.2 | 2
|
||||
# 1.3 | 3
|
||||
# 1.4 | 4
|
||||
# 1.5 | 5
|
||||
# 1.5.1 | 5
|
||||
# 2.0 | 6
|
||||
# 2.0.1 | 6
|
||||
# 2.1 | 7
|
||||
# 2.1.1 | 7
|
||||
# 2.1.2 | 7
|
||||
# 2.2.0 | 8
|
||||
# above is the recommendation by the OPJ team. If you really need to override this default,
|
||||
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
|
||||
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
|
||||
if(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_SOVERSION 7)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||
# OPENJP3D version number, useful for packaging and doxygen doc:
|
||||
SET(OPENJP3D_VERSION_MAJOR 1)
|
||||
SET(OPENJP3D_VERSION_MINOR 3)
|
||||
SET(OPENJP3D_VERSION_BUILD 0)
|
||||
SET(OPENJP3D_VERSION
|
||||
"${OPENJP3D_VERSION_MAJOR}.${OPENJP3D_VERSION_MINOR}.${OPENJP3D_VERSION_BUILD}")
|
||||
SET(PACKAGE_VERSION
|
||||
"${OPENJP3D_VERSION_MAJOR}.${OPENJP3D_VERSION_MINOR}.${OPENJP3D_VERSION_BUILD}")
|
||||
SET(OPENJP3D_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJP3D_VERSION_MAJOR}.${OPENJP3D_VERSION_MINOR}.${OPENJP3D_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJP3D_VERSION_MAJOR}"
|
||||
)
|
||||
# You will also need to define a value for the following variables:
|
||||
# OPENJP3D_INSTALL_BIN_DIR - binary dir (executables)
|
||||
# OPENJP3D_INSTALL_LIB_DIR - library dir (libs)
|
||||
# OPENJP3D_INSTALL_DATA_DIR - share dir (say, examples, data, etc)
|
||||
# OPENJP3D_INSTALL_INCLUDE_DIR - include dir (headers)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||
# warnings
|
||||
if(WIN32)
|
||||
if(NOT BORLAND)
|
||||
if(NOT CYGWIN)
|
||||
if(NOT MINGW)
|
||||
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
add_definitions(
|
||||
IF(WIN32)
|
||||
IF(NOT BORLAND)
|
||||
IF(NOT CYGWIN)
|
||||
IF(NOT MINGW)
|
||||
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ADD_DEFINITIONS(
|
||||
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||
@ -92,297 +64,160 @@ if(WIN32)
|
||||
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ENDIF(NOT MINGW)
|
||||
ENDIF(NOT CYGWIN)
|
||||
ENDIF(NOT BORLAND)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Install directories
|
||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
|
||||
string(TOLOWER ${PROJECT_NAME} projectname)
|
||||
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
STRING(TOLOWER ${PROJECT_NAME} projectname)
|
||||
SET(subdir "${projectname}-${OPENJP3D_VERSION_MAJOR}.${OPENJP3D_VERSION_MINOR}")
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
set(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_BIN_DIR)
|
||||
SET(OPENJP3D_INSTALL_BIN_DIR "bin")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_BIN_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
set(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_LIB_DIR)
|
||||
SET(OPENJP3D_INSTALL_LIB_DIR "lib")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_LIB_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
set(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_DATA_DIR)
|
||||
SET(OPENJP3D_INSTALL_DATA_DIR "share/${subdir}")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_DATA_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_INCLUDE_DIR)
|
||||
SET(OPENJP3D_INSTALL_INCLUDE_DIR "include/")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_INCLUDE_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_MAN_DIR)
|
||||
SET(OPENJP3D_INSTALL_MAN_DIR "share/man/")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_MAN_DIR)
|
||||
|
||||
if(BUILD_DOC)
|
||||
if(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_DOC_DIR)
|
||||
SET(OPENJP3D_INSTALL_DOC_DIR "share/doc/${subdir}")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_DOC_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||
if(WIN32)
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
|
||||
else()
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
# We could install *.cmake files in share/ however those files contains
|
||||
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
|
||||
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
|
||||
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}")
|
||||
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
|
||||
endif()
|
||||
IF(NOT OPENJP3D_INSTALL_PACKAGE_DIR)
|
||||
SET(OPENJP3D_INSTALL_PACKAGE_DIR ${OPENJP3D_INSTALL_LIB_DIR}/${subdir}
|
||||
CACHE INTERNAL "")
|
||||
ENDIF(NOT OPENJP3D_INSTALL_PACKAGE_DIR)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Big endian test:
|
||||
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||
# Test for some required system information.
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
configure_file(
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/CTestCustom.cmake
|
||||
@ONLY
|
||||
)
|
||||
# Test for getopt being available in this system
|
||||
INCLUDE (${PROJECT_SOURCE_DIR}/CMake/CheckHaveGetopt.cmake )
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
# OpenJP3D build configuration options.
|
||||
OPTION(BUILD_SHARED_LIBS "Build OpenJP3D shared library and link executables against it." ON)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
SET (EXECUTABLE_OUTPUT_PATH ${OPENJP3D_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
SET (LIBRARY_OUTPUT_PATH ${OPENJP3D_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
|
||||
|
||||
# configure name mangling to allow multiple libraries to coexist
|
||||
# peacefully
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||
@ONLY)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (1/2)
|
||||
|
||||
# Check if some include files are provided by the system
|
||||
include(EnsureFileInclude)
|
||||
# These files are mandatory
|
||||
ensure_file_include("string.h" HAVE_STRING_H YES)
|
||||
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
|
||||
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
|
||||
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
|
||||
ensure_file_include("math.h" HAVE_MATH_H YES)
|
||||
ensure_file_include("float.h" HAVE_FLOAT_H YES)
|
||||
ensure_file_include("time.h" HAVE_TIME_H YES)
|
||||
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
|
||||
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
|
||||
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
|
||||
|
||||
# For the following files, we provide an alternative, they are not mandatory
|
||||
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
|
||||
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
|
||||
|
||||
# why check this one ? for openjpip ?
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
|
||||
# Enable Large file support
|
||||
include(TestLargeFiles)
|
||||
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||
|
||||
# Allocating Aligned Memory Blocks
|
||||
include(CheckIncludeFiles)
|
||||
check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
|
||||
include(CheckSymbolExists)
|
||||
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
|
||||
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
|
||||
# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
|
||||
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
# memalign (obsolete)
|
||||
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Library
|
||||
if(BUILD_JPIP_SERVER)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(FCGI REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
message(FATAL_ERROR "Only pthread are supported")
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src/lib)
|
||||
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
option(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||
if(BUILD_JPIP)
|
||||
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||
endif()
|
||||
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||
option(BUILD_JP3D "Build the JP3D comp" OFF)
|
||||
mark_as_advanced(BUILD_VIEWER)
|
||||
mark_as_advanced(BUILD_JAVA)
|
||||
mark_as_advanced(BUILD_JP3D)
|
||||
|
||||
if(BUILD_CODEC OR BUILD_MJ2)
|
||||
# OFF: It will only build 3rd party libs if they are not found on the system
|
||||
# ON: 3rd party libs will ALWAYS be build, and used
|
||||
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
add_subdirectory(thirdparty)
|
||||
add_subdirectory(src/bin)
|
||||
endif ()
|
||||
add_subdirectory(wrapping)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (2/2)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# build documentation in doc subdir:
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Buld Testing
|
||||
option(BUILD_TESTING "Build the tests." OFF)
|
||||
if(BUILD_TESTING)
|
||||
if(BUILD_CODEC)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
# Search openjpeg data needed for the tests
|
||||
# They could be found via git on the OpenJPEG GitHub code project
|
||||
# git clone https://github.com/uclouvain/openjpeg-data.git
|
||||
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
# Add repository where to find tests
|
||||
add_subdirectory(tests)
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "You need build codec to run the tests")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install all targets referenced as OPENJPEGTargets
|
||||
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install CHANGES and LICENSE
|
||||
if(BUILD_DOC)
|
||||
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
|
||||
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
|
||||
include (cmake/OpenJPEGCPack.cmake)
|
||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjp3d_mangle.h.in)
|
||||
SET(MANGLE_PREFIX ${OPENJP3D_LIBRARY_NAME})
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjp3d_mangle.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjp3d_mangle.h
|
||||
@ONLY IMMEDIATE)
|
||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjp3d_mangle.h.in)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
# enabled by default on Unix, disabled by default on other platforms
|
||||
if(UNIX)
|
||||
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON)
|
||||
else()
|
||||
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF)
|
||||
endif()
|
||||
if(BUILD_PKGCONFIG_FILES)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
#
|
||||
if(BUILD_JPWL)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpwl/libopenjpwl.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JPIP)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JP3D)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp3d/libopenjp3d.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
endif()
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjp3d.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION ${OPENJP3D_INSTALL_LIB_DIR}/pkgconfig )
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Always build the library
|
||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
SUBDIRS(libopenjp3d)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjp3d is std99 compliant:
|
||||
# SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
# install all targets referenced as OPENJP3DTargets
|
||||
install(EXPORT OpenJP3DTargets DESTINATION ${OPENJP3D_INSTALL_PACKAGE_DIR})
|
||||
CONFIGURE_FILE( ${OPENJP3D_SOURCE_DIR}/CMake/OpenJP3DConfig.cmake.in
|
||||
${OPENJP3D_BINARY_DIR}/OpenJP3DConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
INSTALL( FILES ${OPENJP3D_BINARY_DIR}/OpenJP3DConfig.cmake
|
||||
DESTINATION ${OPENJP3D_INSTALL_PACKAGE_DIR}
|
||||
)
|
||||
# install CHANGES and LICENSE
|
||||
INSTALL(
|
||||
FILES LICENSE
|
||||
DESTINATION ${OPENJP3D_INSTALL_DOC_DIR})
|
||||
#
|
||||
FIND_FILE(HAVE_STRINGS_H_FOUND strings.h)
|
||||
IF(NOT HAVE_STRINGS_H_FOUND STREQUAL "HAVE_STRINGS_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STRINGS_H strings.h)
|
||||
SET(HAS_STRINGS_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_INTTYPES_H_FOUND inttypes.h)
|
||||
IF(NOT HAVE_INTTYPES_H_FOUND STREQUAL "HAVE_INTTYPES_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_INTTYPES_H inttypes.h)
|
||||
SET(HAS_INTTYPES_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_MEMORY_H_FOUND memory.h)
|
||||
IF(NOT HAVE_MEMORY_H_FOUND STREQUAL "HAVE_MEMORY_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_MEMORY_H memory.h)
|
||||
SET(HAS_MEMORY_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STDINT_H_FOUND stdint.h)
|
||||
IF(NOT HAVE_STDINT_H_FOUND STREQUAL "HAVE_STDINT_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STDINT_H stdint.h)
|
||||
SET(HAS_STDINT_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STDLIB_H_FOUND stdlib.h)
|
||||
IF(NOT HAVE_STDLIB_H_FOUND STREQUAL "HAVE_STDLIB_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STDLIB_H stdlib.h)
|
||||
SET(HAS_STDLIB_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STRING_H_FOUND string.h)
|
||||
IF(NOT HAVE_STRING_H_FOUND STREQUAL "HAVE_STRING_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STRING_H string.h)
|
||||
SET(HAS_STRING_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_SYS_STAT_H_FOUND sys/stat.h)
|
||||
IF(NOT HAVE_SYS_STAT_H_FOUND STREQUAL "HAVE_SYS_STAT_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_SYS_STAT_H sys/stat.h)
|
||||
SET(HAS_SYS_STAT_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_SYS_TYPES_H_FOUND sys/types.h)
|
||||
IF(NOT HAVE_SYS_TYPES_H_FOUND STREQUAL "HAVE_SYS_TYPES_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_SYS_TYPES_H sys/types.h)
|
||||
SET(HAS_SYS_TYPES_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_UNISTD_H_FOUND unistd.h)
|
||||
IF(NOT HAVE_UNISTD_H_FOUND STREQUAL "HAVE_UNISTD_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_UNISTD_H unistd.h)
|
||||
SET(HAS_UNISTD_H 1)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/codec
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libopenjp3d
|
||||
)
|
||||
|
||||
|
||||
SUBDIRS(codec)
|
||||
|
@ -1,7 +0,0 @@
|
||||
set(CTEST_PROJECT_NAME "OPENJPEG")
|
||||
set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "my.cdash.org")
|
||||
set(CTEST_DROP_LOCATION "/submit.php?project=OPENJPEG")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
25
INSTALL
Normal file
25
INSTALL
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
How to build and install openjp3d binaries
|
||||
==========================================
|
||||
|
||||
REQUIREMENT : cmake (see www.cmake.org)
|
||||
|
||||
Type:
|
||||
cmake .
|
||||
make
|
||||
|
||||
If you are root:
|
||||
make install
|
||||
make clean
|
||||
|
||||
else:
|
||||
sudo make install
|
||||
make clean
|
||||
|
||||
Binaries are located in the 'bin' directory.
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path'
|
||||
* To build the shared libraries and links the executables against it: '-DBUILD_SHARED_LIBS:bool=on' (default: 'ON')
|
||||
Note: when using this option, static libraries are not built and executables are dynamically linked.
|
||||
|
75
INSTALL.md
75
INSTALL.md
@ -1,75 +0,0 @@
|
||||
|
||||
# OpenJPEG installation
|
||||
|
||||
The build method maintained by OpenJPEG is [CMake](https://cmake.org/).
|
||||
|
||||
## UNIX/LINUX - MacOS (terminal) - WINDOWS (cygwin, MinGW)
|
||||
|
||||
To build the library, type from source tree directory:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
Binaries are then located in the 'bin' directory.
|
||||
|
||||
To install the library, type with root privileges:
|
||||
```
|
||||
make install
|
||||
make clean
|
||||
```
|
||||
|
||||
To build the html documentation, you need doxygen to be installed on your system.
|
||||
It will create an "html" directory in TOP\_LEVEL/build/doc)
|
||||
```
|
||||
make doc
|
||||
```
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
|
||||
* To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
|
||||
> Note: when using this option, static libraries are not built and executables are dynamically linked.
|
||||
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
|
||||
* [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPWL executables and JPWL library: '-DBUILD\_JPWL:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPIP client (java compiler recommended) library and executables: '-DBUILD\_JPIP:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPIP server (need fcgi) library and executables: '-DBUILD\_JPIP\_SERVER:bool=on' (default: 'OFF')
|
||||
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
|
||||
```
|
||||
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory' -DBUILDNAME:STRING='name_of_the_build'
|
||||
make
|
||||
make Experimental
|
||||
```
|
||||
Note : test data is available on the following github repo: https://github.com/uclouvain/openjpeg-data
|
||||
|
||||
If '-DOPJ\_DATA\_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE\_SOURCE\_DIR}/../data'.
|
||||
|
||||
Note 2 : to execute the encoding test suite, kakadu binaries are needed to decode encoded image and compare it to the baseline. Kakadu binaries are freely available for non-commercial purposes at http://www.kakadusoftware.com. kdu\_expand will need to be in your PATH for cmake to find it.
|
||||
|
||||
Note 3 : OpenJPEG encoder and decoder (not the library itself !) depends on several libraries: png, tiff, lcms, z. If these libraries are not found on the system, they are automatically built from the versions available in the source tree. You can force the use of these embedded version with BUILD\_THIRDPARTY:BOOL=ON. On a Debian-like system you can also simply install these libraries with:
|
||||
```
|
||||
sudo apt-get install liblcms2-dev libtiff-dev libpng-dev libz-dev
|
||||
```
|
||||
|
||||
Note 4 : On MacOS, if it does not work, try adding the following flag to the cmake command :
|
||||
```
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING=i386
|
||||
```
|
||||
|
||||
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
|
||||
|
||||
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
|
||||
Type 'cmake --help' for available generators on your platform.
|
||||
|
||||
# Using OpenJPEG
|
||||
|
||||
To use openjpeg exported cmake file, simply create your application doing:
|
||||
|
||||
```
|
||||
$ cat CMakeLists.txt
|
||||
find_package(OpenJPEG REQUIRED)
|
||||
include_directories(${OPENJPEG_INCLUDE_DIRS})
|
||||
add_executable(myapp myapp.c)
|
||||
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
|
||||
```
|
69
LICENSE
Normal file → Executable file
69
LICENSE
Normal file → Executable file
@ -1,39 +1,30 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2009, Francois-Olivier Devaux
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyright (c) 2006, Mónica Díez, Image Processing Laboratory (LPI) - University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
6
Makefile.am
Normal file
6
Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = libjp3dvm codec
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt
|
72
NEWS.md
72
NEWS.md
@ -1,72 +0,0 @@
|
||||
# OpenJPEG NEWS
|
||||
|
||||
More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
|
||||
|
||||
## OpenJPEG 2.1.2
|
||||
|
||||
* Bug fixes (including security fixes)
|
||||
* No API/ABI break compared to v2.1.1
|
||||
|
||||
## OpenJPEG 2.1.1
|
||||
|
||||
* Huge amount of critical bugfixes
|
||||
* Speed improvements
|
||||
* No API/ABI break compared to v2.1
|
||||
|
||||
## OpenJPEG 2.1.0
|
||||
|
||||
### New Features
|
||||
|
||||
* Digital Cinema profiles have been fixed and updated
|
||||
* New option to disable MCT if needed
|
||||
* extended RAW support: it is now possible to input raw images
|
||||
with subsampled color components (422, 420, etc)
|
||||
* New way to deal with profiles
|
||||
|
||||
### API/ABI modifications
|
||||
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
|
||||
|
||||
* Removed deprecated functions
|
||||
* opj_stream_create_default_file_stream(FILE*,...)
|
||||
* opj_stream_create_file_stream(FILE*,...)
|
||||
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
|
||||
* Added
|
||||
* opj_stream_create_default_file_stream(char*,...)
|
||||
* opj_stream_create_file_stream(char*,...)
|
||||
* opj_stream_destroy(opj_stream_t*)
|
||||
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
|
||||
... opj_stream_free_user_data_fn p_function)
|
||||
* JPEG 2000 profiles and Part-2 extensions defined through '#define'
|
||||
* Changed
|
||||
* 'alpha' field added to 'opj_image_comp' structure
|
||||
* 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
|
||||
* 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
|
||||
* 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
|
||||
(not yet used in use)
|
||||
* 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
|
||||
|
||||
### Misc
|
||||
|
||||
* OpenJPEG is now officially conformant with JPEG 2000 Part-1
|
||||
and will soon become official reference software at the
|
||||
JPEG committee.
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
|
||||
|
||||
## OpenJPEG 2.0.0
|
||||
|
||||
### New Features
|
||||
|
||||
* streaming capabilities
|
||||
* merge JP3D
|
||||
|
||||
### API modifications
|
||||
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
|
||||
|
||||
* Use a 64bits capable API
|
||||
|
||||
### Misc
|
||||
|
||||
* removed autotools build system
|
||||
* folders hierarchies reorganisation
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
251
README
Executable file
251
README
Executable file
@ -0,0 +1,251 @@
|
||||
===============================================================================
|
||||
JPEG2000 Part 10 (ISO/IEC 15444-10 JP3D) Verification Model
|
||||
|
||||
Version 1.1
|
||||
===============================================================================
|
||||
|
||||
|
||||
1. Scope
|
||||
================
|
||||
|
||||
This document describes the installation and the use of the JP3D VM decoder and encoder under several operating systems (Linux, Unix, Windows, ...). Version 1.1 contains a complete JPEG 2000 Part 10 encoder, as well as a decoder.
|
||||
The supported functionalities are compliant with the JPEG2000 part 10 algorithm as described in the WD 6.0.
|
||||
The provided encoder and the decoder are compatible also with the International standard IS 15444-1 (core coding system).
|
||||
This implementation has been developped from OpenJPEG implementation of JPEG2000 standard, and for this reason it is written in C language.
|
||||
|
||||
If you find some bugs or if you have problems using the encoder/decoder, please send an e-mail to jp3d@lpi.tel.uva.es
|
||||
|
||||
2. Installing the code
|
||||
======================================================
|
||||
|
||||
- After decompressing the zip file provided, you should find
|
||||
at least the following files in the created 'openjp3d' directory:
|
||||
|
||||
* libopenjp3d - This directory contains all library related code
|
||||
* codec - This directory contains all codec related code
|
||||
* tcltk - This directory contains the API scripts
|
||||
* README - The file you are reading
|
||||
* LICENSE - Copyright statement of the JP3D VM software
|
||||
|
||||
2.1. Compilation
|
||||
-----------------
|
||||
|
||||
see INSTALL file for compilation and installation instructions
|
||||
|
||||
3. Running the JP3D VM
|
||||
====================================================
|
||||
|
||||
3.1. JP3D ENCODER
|
||||
====================================================
|
||||
|
||||
Required arguments
|
||||
------------------------
|
||||
|
||||
* Input file(s): -i Involume [*.bin, *.pgx]
|
||||
|
||||
Specifies the volume to compress. Accepted formats are *.BIN (raw binary data) or *.PGX files.
|
||||
Both formats need some particular settings:
|
||||
|
||||
a) BIN format. As it has no header, volume characteristics will be obtained from a .IMG file. Its location will be specified through the following argument:
|
||||
-m Involumeinfo.IMG
|
||||
This file shall have the following structure, with the appropiate value in each case (bit per voxel, color map, dimensions in X,Y,Z):
|
||||
o Bpp %d
|
||||
o Color Map %d
|
||||
o Dimensions %d %d %d
|
||||
|
||||
b) PGX format. Program will consider it as a volume slice. In order to denote a volume through a sequence of slices, you can define the input filename with the common pattern of the set of PGX files followed by a dash (as a wildcard character for the sequence numbers).
|
||||
|
||||
* Output file: -o Outfile [*.jp3d, *j2k]
|
||||
|
||||
Specifies the name of the file where the codestream will be saved.
|
||||
Part 1 compliant codestream will be created when an outfile has .j2k format.
|
||||
|
||||
Options
|
||||
--------
|
||||
|
||||
* Rate values : -r 20,10,5
|
||||
This option offers the possibility to define the compression rate to apply.
|
||||
Each value is a factor of compression (i.e. 20 : 1) and will generate a different quality layer. A lossless compression will be signified by the value 1.
|
||||
NOTE : The order used to define the different levels of compression is important and must be from left to right in descending order.
|
||||
|
||||
* Quality values : -q 30,35,40
|
||||
This option offers the possibility to define the quality level to achieve. Each value is a psnr, to be given in dB, and represents a quality layer.
|
||||
NOTE : The order used to define the different psnr-values is important and must be from left to right in ascending order.
|
||||
|
||||
|
||||
* Number of resolutions : -n 3,3,2
|
||||
This option offers the possibility to define the number of resolution levels computed for each dimension of the volume through the discret wavelet transform (DWT). Resolution in axial dimension can have a different value than in horizontal and vertical cases, but must be lower.
|
||||
DEFAULT VALUE : 3,3,1
|
||||
|
||||
|
||||
* Switch modes : -M 3
|
||||
This option offers the possibility to use a mode switch during the encoding process:
|
||||
o BYPASS(LAZY) [1]
|
||||
o RESET [2]
|
||||
o RESTART(TERMALL) [4]
|
||||
o VSC [8]
|
||||
o ERTERM(SEGTERM) [16]
|
||||
o SEGMARK(SEGSYM) [32]
|
||||
o 3D_CONTEXT [64]
|
||||
For several mode switch just sum corresponding values: i.e. -M 38 => RESTART(4) + RESET(2) + SEGMARK(32)
|
||||
DEFAULT VALUE: 0
|
||||
|
||||
|
||||
* Progression order : -p LRCP
|
||||
This option offers the possibility to specify the progression order. Possible progression orders are : LRCP, RLCP, RPCL, PCRL and CPRL.
|
||||
DEFAULT VALUE: LRCP.
|
||||
|
||||
|
||||
* Code-block size : -b 32,32,32
|
||||
This option offers the possibility to define the size of the code-block. The dimension must respect the constraint defined in the JPEG-2000 standard. The maximum value autorized is 64x64x64.
|
||||
DEFAULT VALUE: 64,64,64
|
||||
|
||||
|
||||
* Precinct size : -c [128,128,128],[128,128,128],...
|
||||
This option offers the possibility to define the size of the precincts at each resolution. Multiple records may be supplied, in which case the first record refers to the highest resolution level and subsequent records to lower resolution levels. The last specified record is right-shifted for each remaining lower resolution levels.
|
||||
NOTE : specified values must be power of 2.
|
||||
DEFAULT VALUE: 2^15 x 2^15 x 2^15
|
||||
|
||||
|
||||
* Tile size : -t 512,512,512
|
||||
This option offers the possibility to divide the volume in several tiles. The three values define the width, the heigth and the depth of the tile respectivily.
|
||||
DEFAULT VALUE: Volume dimensions (one tile)
|
||||
|
||||
|
||||
* Subsampling factor : -s 2,2,2
|
||||
This option offers the possibility to apply a subsampling factor for X, Y and Z axis. Value higher than 2 can be a source of error !
|
||||
DEFAULT VALUE: 1,1,1
|
||||
|
||||
|
||||
* SOP marker before each packet : -SOP
|
||||
This option offers the possibility to add a specific marker before each packet. It is the marker SOP (Start of packet). If the option is not used no SOP marker will be added.
|
||||
|
||||
|
||||
* EPH marker after each packet header : -EPH
|
||||
This option offers the possibility to add a specific marker at the head of each packet header. It is the marker EPH (End of packet Header). If the option is not used no EPH marker will be added.
|
||||
|
||||
|
||||
* Offset of the volume origin : -d 150,300,10
|
||||
This option offers the possibility to move the origine of the volume in X, Y and/or Z axis. The division in tile could be modified as the anchor point for tiling will be different than the volume origin.
|
||||
NOTE : the offset of the volume can not be higher than the tile dimension if the tile option is used.
|
||||
DEFAULT VALUE: 0,0,0
|
||||
|
||||
|
||||
* Offset of the tile origin : -T 100,75,5
|
||||
This option offers the possibility to move the anchor point of the volume in X, Y and/or Z axis.
|
||||
NOTE : the tile anchor point can not be on the volume area.
|
||||
DEFAULT VALUE: 0,0,0
|
||||
|
||||
|
||||
* Display the help menu : -help
|
||||
This option displays on screen the content of this page
|
||||
|
||||
Additional options
|
||||
----------------------------------
|
||||
|
||||
* Encoding information file: -x index_name.idx
|
||||
This option offers the possibility to create a text file with some structured information generated through the encoding. The name of the file must be specified, with .idx extension. The information structure is the following:
|
||||
o Volume size:
|
||||
+ VolW + VolH + VolD
|
||||
o Progression Order:
|
||||
+ Prog
|
||||
o Tile size:
|
||||
+ TileW + TileH + TileD
|
||||
o Number of components:
|
||||
+ NumComp
|
||||
o Number of layers:
|
||||
+ NumLayer
|
||||
o Number of decompositions (=(number of resolutions - 1)):
|
||||
+ NumDWTx + NumDWTy + NumDWTz
|
||||
o Precinct size:
|
||||
+ [Precinct_width(NumDWT),Precinct_height(NumDWT),Precinct_depth(NumDWT)]
|
||||
+ [Precinct_width(NumDWT-1),Precinct_height(NumDWT-1),Precinct_depth(NumDWT-1)]
|
||||
+ ...
|
||||
+ [Precinct_width(0),Precinct_height(0),Precinct_depth(0)]
|
||||
o Main Header end position:
|
||||
+ MH_EndPos
|
||||
o Codestream size:
|
||||
+ CSSize
|
||||
o Tile 0 information:
|
||||
+ TileNum (0)
|
||||
+ StartPos
|
||||
+ TileHeader_EndPos
|
||||
+ EndPos
|
||||
+ TotalDisto (this is the sum of the distortion reductions brought by each packet belonging to this tile)
|
||||
+ NumPix (this is the number of pixels in the tile)
|
||||
+ MaxMSE (=TotalDisto/NumPix)
|
||||
o Tile1 information:
|
||||
+ TileNum (1)
|
||||
+ ...
|
||||
o ...
|
||||
o Tile N information:
|
||||
+ TileNum (N)
|
||||
+ ...
|
||||
o Packet 0 from Tile 0 information:
|
||||
+ PackNum (0)
|
||||
+ TileNum (0)
|
||||
+ LayerNum
|
||||
+ ResNum
|
||||
+ CompNum
|
||||
+ PrecNum
|
||||
+ StartPos
|
||||
+ EndPos
|
||||
+ Disto (distortion reduction brought by this packet)
|
||||
o Packet 1 from Tile 0 information:
|
||||
+ PackNum (1)
|
||||
+ ...
|
||||
o ...
|
||||
o Packet M from Tile 0 information
|
||||
o Packet 0 from Tile 1 information
|
||||
o ...
|
||||
o Packet M from Tile N information
|
||||
o Maximum distortion reduction on the whole volume:
|
||||
+ MaxDisto
|
||||
o Total distortion on the whole volume (sum of the distortion reductions from all packets in the volume):
|
||||
+ TotalDisto
|
||||
|
||||
3.2. JP3D DECODER
|
||||
====================================================
|
||||
|
||||
Required arguments
|
||||
------------------------
|
||||
|
||||
* Infile : -i compressed file
|
||||
Currently accepts JP3D and J2K-files. The file type is identified based on its suffix (*.jp3d, *.j2k).
|
||||
|
||||
|
||||
* Outfile(s) : -o decompressed file(s)
|
||||
Currently accepts BIN-files and PGX-files. Binary data is written to the file (not ascii).
|
||||
If a BIN-file is defined, decoder will create automatically the volume characteristic file appending a .IMG extension to the provided output filename.
|
||||
If a PGX-file is defined, decoder will understand this as a file pattern, appending corresponding indice from 0 to the number of decoded slices.
|
||||
NOTE : There will be as many output files as there are components: an indice starting from 0 will then be appended to the output filename, just before the extension.
|
||||
|
||||
|
||||
Options available
|
||||
------------------------
|
||||
|
||||
* Reduce factor : -r 1,1,0
|
||||
Set the number of highest resolution levels to be discarded in each dimension. The decoded volume size is effectively divided by 2 to the power of the number of discarded levels.
|
||||
NOTE : The reduce factor is limited by the smallest total number of decomposition levels among tiles.
|
||||
|
||||
|
||||
* Layer number : -l 2
|
||||
Set the maximum number of quality layers to decode. If there are less quality layers than the specified number, all the quality layers are decoded.
|
||||
|
||||
|
||||
* Performance comparisons : -O original-file
|
||||
This option offers the possibility to compute some quality results for the decompressed volume, like the PSNR value achieved or the global SSIM value. Needs the original file in order to compare with the new one.
|
||||
NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions)
|
||||
NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option.
|
||||
(i.e. -O original-BIN-file -m original-IMG-file)
|
||||
|
||||
|
||||
* Byte order (Big-endian / Little-endian) : -BE
|
||||
This option offers the possibility to save the decompressed volume with a predefined byte order.
|
||||
DEFAULT VALUE: Little-endian
|
||||
|
||||
|
||||
* Display the help menu : -help
|
||||
This option displays on screen the content of this page
|
||||
|
||||
|
82
README.md
82
README.md
@ -1,82 +0,0 @@
|
||||
|
||||
# OPENJPEG Library and Applications
|
||||
|
||||
## What is OpenJPEG ?
|
||||
|
||||
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
|
||||
|
||||
## Who can use the code ?
|
||||
[![badge-license]][link-license]
|
||||
|
||||
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
|
||||
|
||||
## How to install and use OpenJPEG ?
|
||||
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
|
||||
|
||||
## Current Status
|
||||
[![badge-build]][link-build]
|
||||
|
||||
[![badge-msvc-build]][link-msvc-build]
|
||||
|
||||
[![badge-coverity]][link-coverity]
|
||||
|
||||
## Who are the developers ?
|
||||
|
||||
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
|
||||
|
||||
## Details on folders hierarchy
|
||||
|
||||
* src
|
||||
* lib
|
||||
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* openjp3d: JP3D implementation
|
||||
* openmj2: MJ2 implementation
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* jp2: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* jp3d: JP3D applications
|
||||
* tcltk: a test tool for JP3D
|
||||
* wx
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* wrapping
|
||||
* java: java jni to use openjpeg in a java program
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* doc: doxygen documentation setup file and man pages
|
||||
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
|
||||
* cmake: cmake related files
|
||||
|
||||
See [LICENSE][link-license] for license and copyright information.
|
||||
|
||||
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
|
||||
|
||||
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
|
||||
|
||||
## API/ABI
|
||||
|
||||
An API/ABI timeline is automatically updated [here][link-api-timeline].
|
||||
|
||||
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
|
||||
only exposes a limited subset of its functions. It uses a mechanism of
|
||||
exporting/hiding functions. If you are unsure which functions you can use in
|
||||
your applications, you should compile OpenJPEG using something similar to gcc:
|
||||
`-fvisibility=hidden` compilation flag.
|
||||
See also: http://gcc.gnu.org/wiki/Visibility
|
||||
|
||||
On windows, MSVC directly supports export/hiding function and as such the only
|
||||
API available is the one supported by OpenJPEG.
|
||||
|
||||
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
|
||||
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause "Simplified" License"
|
||||
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause "Simplified" License"
|
||||
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
|
||||
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
|
||||
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
|
||||
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
|
||||
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
|
||||
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
|
||||
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"
|
39
THANKS.md
39
THANKS.md
@ -1,39 +0,0 @@
|
||||
# OpenJPEG THANKS file
|
||||
|
||||
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
|
||||
or submitting actual code. Here is a list of these people. Help me keep
|
||||
it complete and exempt of errors.
|
||||
|
||||
* Giuseppe Baruffa
|
||||
* Ben Boeckel
|
||||
* Aaron Boxer
|
||||
* David Burken
|
||||
* Matthieu Darbois
|
||||
* Rex Dieter
|
||||
* Herve Drolon
|
||||
* Antonin Descampe
|
||||
* Francois-Olivier Devaux
|
||||
* Parvatha Elangovan
|
||||
* Jerôme Fimes
|
||||
* Bob Friesenhahn
|
||||
* Kaori Hagihara
|
||||
* Luc Hermitte
|
||||
* Luis Ibanez
|
||||
* David Janssens
|
||||
* Hans Johnson
|
||||
* Callum Lerwick
|
||||
* Ke Liu (Tencent's Xuanwu LAB)
|
||||
* Sebastien Lugan
|
||||
* Benoit Macq
|
||||
* Mathieu Malaterre
|
||||
* Julien Malik
|
||||
* Arnaud Maye
|
||||
* Vincent Nicolas
|
||||
* Aleksander Nikolic (Cisco Talos)
|
||||
* Glenn Pearson
|
||||
* Even Rouault
|
||||
* Dzonatas Sol
|
||||
* Winfried Szukalski
|
||||
* Vincent Torri
|
||||
* Yannick Verschueren
|
||||
* Peter Wimmer
|
38
appveyor.yml
38
appveyor.yml
@ -1,38 +0,0 @@
|
||||
version: 2.1.1.{build}
|
||||
branches:
|
||||
except:
|
||||
- coverity_scan
|
||||
skip_tags: false
|
||||
clone_depth: 50
|
||||
environment:
|
||||
matrix:
|
||||
- OPJ_CI_ARCH: x86
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- OPJ_CI_ARCH: x64
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- OPJ_CI_ARCH: x86
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS)
|
||||
install:
|
||||
- cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh
|
||||
build_script:
|
||||
- cmd: >-
|
||||
"%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH%
|
||||
|
||||
bash ./tools/travis-ci/run.sh
|
||||
test: off
|
||||
#before_deploy:
|
||||
#- cmd: c:\cygwin\bin\bash ./tools/travis-ci/before_deploy.sh
|
||||
deploy:
|
||||
#release: openjpeg-$(appveyor_repo_tag_name)
|
||||
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).'
|
||||
provider: GitHub
|
||||
auth_token:
|
||||
secure: Huk03f1heCD/HMyA+4ZeVmICdmKn9rPxK5p8/KxzgL+FtJDHlqcllcCrtN9bDxRH # your encrypted token from GitHub
|
||||
artifact: /.*\.zip/ # upload all zip packages to release assets
|
||||
draft: false
|
||||
prerelease: false
|
||||
on:
|
||||
appveyor_repo_tag: true # deploy on tag push only
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
@ -1,40 +0,0 @@
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# For further details regarding this file,
|
||||
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||
#
|
||||
# and
|
||||
# http://www.kitware.com/blog/home/post/27
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||
|
||||
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
|
||||
# Exclude files from the Testing directories
|
||||
".*/tests/.*"
|
||||
|
||||
# Exclude files from the ThirdParty Utilities directories
|
||||
".*/thirdparty/.*"
|
||||
)
|
||||
|
||||
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||
|
||||
# Ignore clang's summary warning, assuming prior text has matched some
|
||||
# other warning expression:
|
||||
"[0-9,]+ warnings? generated."
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
# java also warns about deprecated API
|
||||
".*java.*deprecation"
|
||||
".*deprecation.*"
|
||||
# suppress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
"libpng.*has no symbols"
|
||||
)
|
@ -1,26 +0,0 @@
|
||||
# Ensure that an include file is provided by the system
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# provided by cmake
|
||||
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
|
||||
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
if (NOT ${${VARIABLE_NAME}})
|
||||
if (${MANDATORY_STATUS})
|
||||
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
@ -1,16 +0,0 @@
|
||||
# cppcheck
|
||||
#
|
||||
# Copyright (c) 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
find_program(CPPCHECK_EXECUTABLE
|
||||
cppcheck
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
CPPCHECK_EXECUTABLE
|
||||
)
|
@ -1,20 +0,0 @@
|
||||
# Look for the header file.
|
||||
find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h)
|
||||
|
||||
# Look for the library.
|
||||
find_library(FCGI_LIBRARY NAMES fcgi)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
if(FCGI_FOUND)
|
||||
set(FCGI_LIBRARIES ${FCGI_LIBRARY})
|
||||
set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
|
||||
else()
|
||||
set(FCGI_LIBRARIES)
|
||||
set(FCGI_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY)
|
@ -1,12 +0,0 @@
|
||||
#
|
||||
# this module looks for JPYLYZER
|
||||
# http://jpylyzer.openpreservation.org
|
||||
#
|
||||
|
||||
find_program(JPYLYZER_EXECUTABLE
|
||||
jpylyzer
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
JPYLYZER_EXECUTABLE
|
||||
)
|
@ -1,24 +0,0 @@
|
||||
#
|
||||
# this module looks for KAKADU
|
||||
# http://www.kakadusoftware.com/
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
find_program(KDU_EXPAND_EXECUTABLE
|
||||
kdu_expand
|
||||
)
|
||||
|
||||
find_program(KDU_COMPRESS_EXECUTABLE
|
||||
kdu_compress
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
KDU_EXPAND_EXECUTABLE
|
||||
KDU_COMPRESS_EXECUTABLE
|
||||
)
|
@ -1,31 +0,0 @@
|
||||
# - Find LCMS library
|
||||
# Find the native LCMS includes and library
|
||||
# Once done this will define
|
||||
#
|
||||
# LCMS_INCLUDE_DIR - Where to find lcms.h, etc.
|
||||
# LCMS_LIBRARIES - Libraries to link against to use LCMS.
|
||||
# LCMS_FOUND - If false, do not try to use LCMS.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# LCMS_LIBRARY, where to find the LCMS library.
|
||||
|
||||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
|
||||
set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
||||
|
||||
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
||||
|
||||
if(LCMS_FOUND)
|
||||
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||
endif()
|
@ -1,31 +0,0 @@
|
||||
# - Find LCMS2 library
|
||||
# Find the native LCMS2 includes and library
|
||||
# Once done this will define
|
||||
#
|
||||
# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
|
||||
# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
|
||||
# LCMS2_FOUND - If false, do not try to use LCMS2.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# LCMS2_LIBRARY - Where to find the LCMS2 library.
|
||||
|
||||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
|
||||
set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
||||
|
||||
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
||||
|
||||
if(LCMS2_FOUND)
|
||||
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||
endif()
|
@ -1,9 +0,0 @@
|
||||
# JPIP test driver
|
||||
#message(STATUS "${D_URL}")
|
||||
file(DOWNLOAD
|
||||
"${D_URL}"
|
||||
"${D_FILE}"
|
||||
LOG log
|
||||
EXPECTED_MD5 "${EXPECTED_MD5}"
|
||||
)
|
||||
message(STATUS "LOG: ${log}")
|
@ -1,72 +0,0 @@
|
||||
# package bundler
|
||||
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||
set(CMAKE_INSTALL_MFC_LIBRARIES 0)
|
||||
set(CMAKE_INSTALL_DEBUG_LIBRARIES 0)
|
||||
if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
endif()
|
||||
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||
endif()
|
||||
|
||||
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
||||
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
set(CPACK_PACKAGE_VENDOR "OpenJPEG Team")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY
|
||||
)
|
||||
# For PackageMaker on MacOSX it is important to have a file extension:
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
|
||||
# Make this explicit here, rather than accepting the CPack default value,
|
||||
# so we can refer to it:
|
||||
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||
|
||||
if(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||
# make sure package is not Cygwin-unknown, for Cygwin just
|
||||
# cygwin is good for the system name
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
set(CPACK_SYSTEM_NAME Cygwin)
|
||||
else()
|
||||
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
endif()
|
||||
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
if(CMAKE_CL_64)
|
||||
set(CPACK_SYSTEM_NAME win64-x64)
|
||||
else()
|
||||
set(CPACK_SYSTEM_NAME win32-x86)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
|
||||
# default to source package - system, on cygwin system is not
|
||||
# needed
|
||||
if(CYGWIN)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||
if(APPLE)
|
||||
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
set(CPACK_BUNDLE_PLIST
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
#include(BundleUtilities)
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
@ -1,48 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# OPENJPEGConfig.cmake - CMake configuration file for external projects.
|
||||
#
|
||||
# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
|
||||
# module to load OPENJPEG's settings for an external project.
|
||||
@OPENJPEG_CONFIG_INSTALL_ONLY@
|
||||
# The OPENJPEG version number.
|
||||
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
|
||||
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
||||
set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
||||
|
||||
# The libraries.
|
||||
set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
|
||||
|
||||
# The CMake macros dir.
|
||||
set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
|
||||
|
||||
# The configuration options.
|
||||
set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||
|
||||
# The "use" file.
|
||||
set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
||||
|
||||
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
# This is an install tree
|
||||
include(${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
||||
|
||||
else()
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
# This is a build tree
|
||||
set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
||||
|
||||
include(${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "ooops")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
|
||||
|
||||
# Backward compatible part:
|
||||
set(OPENJPEG_FOUND TRUE)
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
#cmakedefine _LARGEFILE_SOURCE
|
||||
#cmakedefine _LARGE_FILES
|
||||
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits,
|
||||
* and make sure we have ftello / fseeko.
|
||||
*/
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
FILE *fp = fopen(argv[0],"r");
|
||||
off_t offset = ftello( fp );
|
||||
|
||||
fseeko( fp, offset, SEEK_CUR );
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,134 +0,0 @@
|
||||
# - Define macro to check large file support
|
||||
#
|
||||
# OPJ_TEST_LARGE_FILES(VARIABLE)
|
||||
#
|
||||
# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
|
||||
# This macro will also defines the necessary variable enable large file support, for instance
|
||||
# _LARGE_FILES
|
||||
# _LARGEFILE_SOURCE
|
||||
# _FILE_OFFSET_BITS 64
|
||||
# OPJ_HAVE_FSEEKO
|
||||
#
|
||||
# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
|
||||
# end up in a config.h file that is included in your source if necessary!
|
||||
#
|
||||
# Adapted from Gromacs project (http://www.gromacs.org/)
|
||||
# by Julien Malik
|
||||
#
|
||||
|
||||
macro(OPJ_TEST_LARGE_FILES VARIABLE)
|
||||
if(NOT DEFINED ${VARIABLE})
|
||||
|
||||
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
|
||||
# and then separately fseeko. However, in the future we might have 128-bit filesystems
|
||||
# (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
|
||||
|
||||
message(STATUS "Checking for 64-bit off_t")
|
||||
|
||||
# First check without any special flags
|
||||
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present")
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _FILE_OFFSET_BITS=64
|
||||
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
|
||||
set(_FILE_OFFSET_BITS 64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _LARGE_FILES
|
||||
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGE_FILES" )
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
|
||||
set(_LARGE_FILES 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _LARGEFILE_SOURCE
|
||||
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
|
||||
set(_LARGEFILE_SOURCE 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#if(NOT FILE64_OK)
|
||||
# # now check for Windows stuff
|
||||
# try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||
# "${PROJECT_SOURCE_DIR}/cmake/TestWindowsFSeek.c")
|
||||
# if(FILE64_OK)
|
||||
# message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
|
||||
# set(HAVE__FSEEKI64 1)
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - not present")
|
||||
endif()
|
||||
|
||||
set(_FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} CACHE INTERNAL "Result of test for needed _FILE_OFFSET_BITS=64")
|
||||
set(_LARGE_FILES ${_LARGE_FILES} CACHE INTERNAL "Result of test for needed _LARGE_FILES")
|
||||
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
|
||||
|
||||
# Set the flags we might have determined to be required above
|
||||
configure_file("${PROJECT_SOURCE_DIR}/cmake/TestLargeFiles.c.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||
|
||||
message(STATUS "Checking for fseeko/ftello")
|
||||
|
||||
# Test if ftello/fseeko are available
|
||||
try_compile(FSEEKO_COMPILE_OK
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
message(STATUS "Checking for fseeko/ftello - present")
|
||||
endif()
|
||||
|
||||
if(NOT FSEEKO_COMPILE_OK)
|
||||
# glibc 2.2 needs _LARGEFILE_SOURCE for fseeko (but not for 64-bit off_t...)
|
||||
try_compile(FSEEKO_COMPILE_OK
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
|
||||
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
|
||||
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
set(OPJ_HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
else()
|
||||
message(STATUS "Checking for fseeko/ftello - not found")
|
||||
set(OPJ_HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
endif()
|
||||
|
||||
if(FILE64_OK AND FSEEKO_COMPILE_OK)
|
||||
message(STATUS "Large File support - found")
|
||||
set(${VARIABLE} ON CACHE INTERNAL "Result of test for large file support")
|
||||
else()
|
||||
message(STATUS "Large File support - not found")
|
||||
set(${VARIABLE} OFF CACHE INTERNAL "Result of test for large file support")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__int64 off=0;
|
||||
|
||||
_fseeki64(NULL, off, SEEK_SET);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
|
||||
|
||||
{
|
||||
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||
Memcheck:Cond
|
||||
fun:deflate
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
fun:png_write_row
|
||||
fun:imagetopng
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||
Memcheck:Value8
|
||||
fun:crc32
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
fun:png_write_chunk
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
obj:/lib/libpng12.so.0.42.0
|
||||
fun:png_write_row
|
||||
fun:imagetopng
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||
Memcheck:Param
|
||||
write(buf)
|
||||
fun:__write_nocancel
|
||||
fun:_IO_file_write@@GLIBC_2.2.5
|
||||
fun:_IO_do_write@@GLIBC_2.2.5
|
||||
fun:_IO_file_close_it@@GLIBC_2.2.5
|
||||
fun:fclose@@GLIBC_2.2.5
|
||||
fun:imagetopng
|
||||
fun:main
|
||||
}
|
29
codec/CMakeLists.txt
Normal file
29
codec/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
# Build the demo app, small examples
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
convert.c
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
||||
ELSE(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Loop over all executables:
|
||||
FOREACH(exe jp3d_to_volume volume_to_jp3d)
|
||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||
TARGET_LINK_LIBRARIES(${exe} ${OPENJP3D_LIBRARY_NAME})
|
||||
# On unix you need to link to the math library:
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${exe} m)
|
||||
ENDIF(UNIX)
|
||||
# Install exe
|
||||
INSTALL(TARGETS ${exe}
|
||||
EXPORT OpenJP3DTargets
|
||||
DESTINATION ${OPENJP3D_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
ENDFOREACH(exe)
|
23
codec/Makefile.am
Normal file
23
codec/Makefile.am
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = jp3d_to_volume volume_to_jp3d
|
||||
LDADD = $(USERLIBS) ../libjp3dvm/libopenjp3dvm.la
|
||||
|
||||
jp3d_to_volume_CPPFLAGS =
|
||||
jp3d_to_volume_CFLAGS =
|
||||
jp3d_to_volume_LDADD = $(top_builddir)/jp3d/libjp3dvm/libopenjp3dvm.la -lm
|
||||
jp3d_to_volume_SOURCES = getopt.c convert.c jp3d_to_volume.c convert.h
|
||||
|
||||
volume_to_jp3d_CPPFLAGS =
|
||||
volume_to_jp3d_CFLAGS =
|
||||
volume_to_jp3d_LDADD = $(top_builddir)/jp3d/libjp3dvm/libopenjp3dvm.la
|
||||
volume_to_jp3d_SOURCES = getopt.c convert.c volume_to_jp3d.c convert.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
windirent.h
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/jp3d_to_volume$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/volume_to_jp3d$(EXEEXT)" >> $(top_builddir)/report.txt
|
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
@ -158,7 +153,7 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
int i, s, numcomps, maxvalue, sliceno, slicepos, maxslice = 0;
|
||||
|
||||
OPJ_COLOR_SPACE color_space;
|
||||
opj_volume_cmptparm_t cmptparm; /* maximum of 1 component */
|
||||
opj_volume_cmptparm_t cmptparm; // maximum of 1 component
|
||||
opj_volume_t * volume = NULL;
|
||||
|
||||
char endian1,endian2,sign;
|
||||
@ -187,13 +182,13 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
|
||||
/* Separación del caso de un único slice frente al de muchos */
|
||||
if ((tmp = strrchr(relpath,'-')) == NULL){
|
||||
/*fprintf(stdout,"[INFO] A volume of only one slice....\n");*/
|
||||
//fprintf(stdout,"[INFO] A volume of only one slice....\n");
|
||||
sliceno = 1;
|
||||
maxslice = 1;
|
||||
strcpy(pgxfiles[0],relpath);
|
||||
|
||||
} else {
|
||||
/*Fetch only the path */
|
||||
//Fetch only the path
|
||||
strcpy(tmpdirpath,relpath);
|
||||
if ((tmp = strrchr(tmpdirpath,'/')) != NULL){
|
||||
tmp++; *tmp='\0';
|
||||
@ -202,7 +197,7 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
strcpy(dirpath,"./");
|
||||
}
|
||||
|
||||
/*Fetch the pattern of the volume slices*/
|
||||
//Fetch the pattern of the volume slices
|
||||
if ((tmp = strrchr (relpath,'/')) != NULL)
|
||||
tmp++;
|
||||
else
|
||||
@ -233,7 +228,7 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
strcpy(tmp,dirpath);
|
||||
tmp = strcat(tmp,direntp->d_name);
|
||||
|
||||
/*Obtenemos el index de la secuencia de slices*/
|
||||
//Obtenemos el index de la secuencia de slices
|
||||
if ((tmp2 = strpbrk (direntp->d_name, "0123456789")) == NULL)
|
||||
continue;
|
||||
i = 0;
|
||||
@ -243,18 +238,18 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
tmp2 = strpbrk (tmp2+1,"0123456789");
|
||||
}tmpno[i]='\0';
|
||||
|
||||
/*Comprobamos que no estamos leyendo algo raro como pattern.jp3d*/
|
||||
//Comprobamos que no estamos leyendo algo raro como pattern.jp3d
|
||||
if ((point = strpbrk (point,".")) == NULL){
|
||||
break;
|
||||
}
|
||||
/*Slicepos --> index de slice; Sliceno --> no de slices hasta el momento*/
|
||||
//Slicepos --> index de slice; Sliceno --> no de slices hasta el momento
|
||||
slicepos = atoi(tmpno);
|
||||
pgxslicepos[sliceno] = slicepos - 1;
|
||||
sliceno++;
|
||||
if (slicepos>maxslice)
|
||||
maxslice = slicepos;
|
||||
|
||||
/*Colocamos el slices en su posicion correspondiente*/
|
||||
//Colocamos el slices en su posicion correspondiente
|
||||
strcpy(pgxfiles[slicepos-1],tmp);
|
||||
}
|
||||
}
|
||||
@ -339,7 +334,7 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
/* set volume data :only one component, that is a volume*/
|
||||
comp = &volume->comps[0];
|
||||
|
||||
}/*if sliceno==1*/
|
||||
}//if sliceno==1
|
||||
|
||||
offset = w * h * s;
|
||||
|
||||
@ -370,11 +365,11 @@ opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||
|
||||
}
|
||||
fclose(f);
|
||||
} /* for s --> sliceno*/
|
||||
} // for s --> sliceno
|
||||
comp->bpp = int_floorlog2(maxvalue) + 1;
|
||||
if (sliceno != 1)
|
||||
closedir( dirp );
|
||||
/*dump_volume(stdout, volume);*/
|
||||
//dump_volume(stdout, volume);
|
||||
return volume;
|
||||
}
|
||||
|
||||
@ -437,7 +432,7 @@ int volumetopgx(opj_volume_t * volume, char *outfile) {
|
||||
|
||||
offset = (sliceno / lrr * l) + (sliceno % lrr);
|
||||
offset = wrr * hrr * offset;
|
||||
/*fprintf(stdout,"%d %d %d %d\n",offset,wrr*hrr,wrr,w);*/
|
||||
//fprintf(stdout,"%d %d %d %d\n",offset,wrr*hrr,wrr,w);
|
||||
for (i = 0; i < wrr * hrr; i++) {
|
||||
int v = volume->comps[0].data[(i / wrr * w) + (i % wrr) + offset];
|
||||
if (volume->comps[0].bigendian) {
|
||||
@ -454,8 +449,8 @@ int volumetopgx(opj_volume_t * volume, char *outfile) {
|
||||
}
|
||||
|
||||
fclose(fdest);
|
||||
}/*for sliceno*/
|
||||
}/*for compno*/
|
||||
}//for sliceno
|
||||
}//for compno
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -474,7 +469,7 @@ opj_volume_t* bintovolume(char *filename, char *fileimg, opj_cparameters_t *para
|
||||
int i, compno, w, h, l, numcomps = 1;
|
||||
int prec, max = 0;
|
||||
|
||||
/* char temp[32];*/
|
||||
// char temp[32];
|
||||
char line[100];
|
||||
int bigendian;
|
||||
|
||||
@ -497,7 +492,7 @@ opj_volume_t* bintovolume(char *filename, char *fileimg, opj_cparameters_t *para
|
||||
fseek(fimg, 0, SEEK_SET);
|
||||
while (!feof(fimg)) {
|
||||
fgets(line,100,fimg);
|
||||
/*fprintf(stdout,"%s %d \n",line,feof(fimg));*/
|
||||
//fprintf(stdout,"%s %d \n",line,feof(fimg));
|
||||
if (strncmp(line,"Bpp",3) == 0){
|
||||
sscanf(line,"%*s%*[ \t]%d",&prec);
|
||||
} else if (strncmp(line,"Color",5) == 0){
|
||||
@ -506,9 +501,9 @@ opj_volume_t* bintovolume(char *filename, char *fileimg, opj_cparameters_t *para
|
||||
sscanf(line, "%*s%*[ \t]%d%*[ \t]%d%*[ \t]%d",&w,&h,&l);
|
||||
}
|
||||
}
|
||||
/*fscanf(fimg, "Bpp%[ \t]%d%[ \t\n]",temp,&prec,temp);*/
|
||||
/*fscanf(fimg, "Color Map%[ \t]%d%[ \n\t]Dimensions%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&color_space,temp,temp,&w,temp,&h,temp,&l,temp);*/
|
||||
/*fscanf(fimg, "Resolution(mm)%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&subsampling_dx,temp,&subsampling_dy,temp,&subsampling_dz,temp);*/
|
||||
//fscanf(fimg, "Bpp%[ \t]%d%[ \t\n]",temp,&prec,temp);
|
||||
//fscanf(fimg, "Color Map%[ \t]%d%[ \n\t]Dimensions%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&color_space,temp,temp,&w,temp,&h,temp,&l,temp);
|
||||
//fscanf(fimg, "Resolution(mm)%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&subsampling_dx,temp,&subsampling_dy,temp,&subsampling_dz,temp);
|
||||
|
||||
#ifdef VERBOSE
|
||||
fprintf(stdout, "[INFO] %d \t %d %d %d \t %3.2f %2.2f %2.2f \t %d \n",color_space,w,h,l,subsampling_dx,subsampling_dy,subsampling_dz,prec);
|
||||
@ -684,10 +679,10 @@ int volumetobin(opj_volume_t * volume, char *outfile) {
|
||||
int offset, sliceno;
|
||||
FILE *fdest = NULL;
|
||||
FILE *fimgdest = NULL;
|
||||
/* char *imgtemp;*/
|
||||
// char *imgtemp;
|
||||
char name[256];
|
||||
|
||||
for (compno = 0; compno < 1; compno++) { /*Only one component*/
|
||||
for (compno = 0; compno < 1; compno++) { //Only one component
|
||||
|
||||
fdest = fopen(outfile, "wb");
|
||||
if (!fdest) {
|
||||
@ -722,7 +717,7 @@ int volumetobin(opj_volume_t * volume, char *outfile) {
|
||||
nbytes = 4;
|
||||
}
|
||||
|
||||
/*fprintf(stdout,"w %d wr %d wrr %d h %d hr %d hrr %d l %d lr %d lrr %d max %d nbytes %d\n Factor %d %d %d",w,wr,wrr,h,hr,hrr,l,lr,lrr,max,nbytes,volume->comps[compno].factor[0],volume->comps[compno].factor[1],volume->comps[compno].factor[2]);*/
|
||||
//fprintf(stdout,"w %d wr %d wrr %d h %d hr %d hrr %d l %d lr %d lrr %d max %d nbytes %d\n Factor %d %d %d",w,wr,wrr,h,hr,hrr,l,lr,lrr,max,nbytes,volume->comps[compno].factor[0],volume->comps[compno].factor[1],volume->comps[compno].factor[2]);
|
||||
|
||||
for(sliceno = 0; sliceno < lrr; sliceno++) {
|
||||
offset = (sliceno / lrr * l) + (sliceno % lrr);
|
||||
@ -792,7 +787,7 @@ opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*Fetch only the path */
|
||||
//Fetch only the path
|
||||
strcpy(tmpdirpath,fileimg);
|
||||
if ((tmp = strrchr(tmpdirpath,'/')) != NULL){
|
||||
tmp++; *tmp='\0';
|
||||
@ -804,7 +799,7 @@ opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters) {
|
||||
fseek(fimg, 0, SEEK_SET);
|
||||
while (!feof(fimg)) {
|
||||
fgets(line,100,fimg);
|
||||
/*fprintf(stdout,"%s %d \n",line,feof(fimg));*/
|
||||
//fprintf(stdout,"%s %d \n",line,feof(fimg));
|
||||
if (strncmp(line,"Image",5) == 0){
|
||||
sscanf(line,"%*s%*[ \t]%s",datatype);
|
||||
} else if (strncmp(line,"File",4) == 0){
|
@ -33,9 +33,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjp3d.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "getopt.h"
|
||||
#include "convert.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -88,7 +87,7 @@ static double calc_PSNR(opj_volume_t *original, opj_volume_t *decoded)
|
||||
return -1.0;
|
||||
|
||||
return total;
|
||||
/*return 20 * log10((max - 1) / sqrt(sum));*/
|
||||
//return 20 * log10((max - 1) / sqrt(sum));
|
||||
}
|
||||
|
||||
static double calc_SSIM(opj_volume_t *original, opj_volume_t *decoded)
|
||||
@ -96,29 +95,29 @@ static double calc_SSIM(opj_volume_t *original, opj_volume_t *decoded)
|
||||
int max, i, compno = 0, size, sizeM;
|
||||
double sum;
|
||||
double mux = 0.0, muy = 0.0, sigmax = 0.0, sigmay = 0.0,
|
||||
sigmaxy = 0.0/*, structx = 0.0, structy = 0.0*/;
|
||||
sigmaxy = 0.0, structx = 0.0, structy = 0.0;
|
||||
double lcomp,ccomp,scomp;
|
||||
double C1,C2,C3;
|
||||
|
||||
max = (original->comps[compno].prec <= 8) ? 255 : (1 << original->comps[compno].prec) - 1;
|
||||
size = (original->x1 - original->x0) * (original->y1 - original->y0) * (original->z1 - original->z0);
|
||||
|
||||
/*MSSIM*/
|
||||
//MSSIM
|
||||
|
||||
/* sizeM = size / (original->z1 - original->z0);*/
|
||||
// sizeM = size / (original->z1 - original->z0);
|
||||
|
||||
sizeM = size;
|
||||
for(sum = 0, i = 0; i < sizeM; ++i) {
|
||||
/* First, the luminance of each signal is compared.*/
|
||||
// First, the luminance of each signal is compared.
|
||||
mux += original->comps[compno].data[i];
|
||||
muy += decoded->comps[compno].data[i];
|
||||
}
|
||||
mux /= sizeM;
|
||||
muy /= sizeM;
|
||||
|
||||
/*We use the standard deviation (the square root of variance) as an estimate of the signal contrast.*/
|
||||
//We use the standard deviation (the square root of variance) as an estimate of the signal contrast.
|
||||
for(sum = 0, i = 0; i < sizeM; ++i) {
|
||||
/* First, the luminance of each signal is compared.*/
|
||||
// First, the luminance of each signal is compared.
|
||||
sigmax += (original->comps[compno].data[i] - mux) * (original->comps[compno].data[i] - mux);
|
||||
sigmay += (decoded->comps[compno].data[i] - muy) * (decoded->comps[compno].data[i] - muy);
|
||||
sigmaxy += (original->comps[compno].data[i] - mux) * (decoded->comps[compno].data[i] - muy);
|
||||
@ -131,19 +130,19 @@ static double calc_SSIM(opj_volume_t *original, opj_volume_t *decoded)
|
||||
sigmay = sqrt(sigmay);
|
||||
sigmaxy = sqrt(sigmaxy);
|
||||
|
||||
/*Third, the signal is normalized (divided) by its own standard deviation, */
|
||||
/*so that the two signals being compared have unit standard deviation.*/
|
||||
//Third, the signal is normalized (divided) by its own standard deviation,
|
||||
//so that the two signals being compared have unit standard deviation.
|
||||
|
||||
/*Luminance comparison*/
|
||||
//Luminance comparison
|
||||
C1 = (0.01 * max) * (0.01 * max);
|
||||
lcomp = ((2 * mux * muy) + C1)/((mux*mux) + (muy*mux) + C1);
|
||||
/*Constrast comparison*/
|
||||
//Constrast comparison
|
||||
C2 = (0.03 * max) * (0.03 * max);
|
||||
ccomp = ((2 * sigmax * sigmay) + C2)/((sigmax*sigmax) + (sigmay*sigmay) + C2);
|
||||
/*Structure comparison*/
|
||||
//Structure comparison
|
||||
C3 = C2 / 2;
|
||||
scomp = (sigmaxy + C3) / (sigmax * sigmay + C3);
|
||||
/*Similarity measure*/
|
||||
//Similarity measure
|
||||
|
||||
sum = lcomp * ccomp * scomp;
|
||||
return sum;
|
||||
@ -218,13 +217,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
/* parse the command line */
|
||||
|
||||
while (1) {
|
||||
int c = opj_getopt(argc, argv, "i:o:O:r:l:B:m:h");
|
||||
int c = getopt(argc, argv, "i:o:O:r:l:B:m:h");
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = opj_optarg;
|
||||
char *infile = optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J3D_CFMT:
|
||||
@ -243,7 +242,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
|
||||
case 'm': /* img file */
|
||||
{
|
||||
char *imgfile = opj_optarg;
|
||||
char *imgfile = optarg;
|
||||
int imgformat = get_file_format(imgfile);
|
||||
switch(imgformat) {
|
||||
case IMG_DFMT:
|
||||
@ -262,7 +261,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = opj_optarg;
|
||||
char *outfile = optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case PGX_DFMT:
|
||||
@ -283,7 +282,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
|
||||
case 'O': /* Original image for PSNR computing */
|
||||
{
|
||||
char *original = opj_optarg;
|
||||
char *original = optarg;
|
||||
parameters->orig_format = get_file_format(original);
|
||||
switch(parameters->orig_format) {
|
||||
case PGX_DFMT:
|
||||
@ -303,9 +302,9 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
|
||||
case 'r': /* reduce option */
|
||||
{
|
||||
/*sscanf(opj_optarg, "%d, %d, %d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);*/
|
||||
//sscanf(optarg, "%d, %d, %d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);
|
||||
int aux;
|
||||
aux = sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);
|
||||
aux = sscanf(optarg, "%d,%d,%d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);
|
||||
if (aux == 2)
|
||||
parameters->cp_reduce[2] = 0;
|
||||
else if (aux == 1) {
|
||||
@ -323,7 +322,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
|
||||
case 'l': /* layering option */
|
||||
{
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||
sscanf(optarg, "%d", ¶meters->cp_layer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -355,7 +354,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters)
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stdout,"[WARNING] This option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
fprintf(stdout,"[WARNING] This option is not valid \"-%c %s\"\n",c, optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -518,8 +517,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout, "[RESULT] Volume: %d x %d x %d (x %d bpv)\n ",
|
||||
(volume->comps[0].w >> volume->comps[0].factor[0]),
|
||||
(volume->comps[0].h >> volume->comps[0].factor[1]),
|
||||
(volume->comps[0].l >> volume->comps[0].factor[2]),
|
||||
volume->comps[0].prec);
|
||||
(volume->comps[0].l >> volume->comps[0].factor[2]),volume->comps[0].prec);
|
||||
|
||||
if(original){
|
||||
psnr = calc_PSNR(original,volume);
|
@ -32,9 +32,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjp3d.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "getopt.h"
|
||||
#include "convert.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -239,13 +238,13 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
/* parse the command line */
|
||||
|
||||
while (1) {
|
||||
int c = opj_getopt(argc, argv, "i:m:o:r:q:f:t:n:c:b:x:p:s:d:hP:S:E:M:D:R:l:T:C:A:I");
|
||||
int c = getopt(argc, argv, "i:m:o:r:q:f:t:n:c:b:x:p:s:d:hP:S:E:M:D:R:l:T:C:A:I");
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = opj_optarg;
|
||||
char *infile = optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case PGX_DFMT:
|
||||
@ -266,7 +265,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
/* ----------------------------------------------------- */
|
||||
case 'm': /* input IMG file */
|
||||
{
|
||||
char *imgfile = opj_optarg;
|
||||
char *imgfile = optarg;
|
||||
int imgformat = get_file_format(imgfile);
|
||||
switch(imgformat) {
|
||||
case IMG_DFMT:
|
||||
@ -284,7 +283,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
/* ----------------------------------------------------- */
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = opj_optarg;
|
||||
char *outfile = optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case J3D_CFMT:
|
||||
@ -305,7 +304,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'r': /* define compression rates for each layer */
|
||||
{
|
||||
char *s = opj_optarg;
|
||||
char *s = optarg;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -323,7 +322,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'q': /* define distorsion (PSNR) for each layer */
|
||||
{
|
||||
char *s = opj_optarg;
|
||||
char *s = optarg;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -347,7 +346,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
/*int *row = NULL, *col = NULL;
|
||||
int numlayers = 0, matrix_width = 0;
|
||||
|
||||
char *s = opj_optarg;
|
||||
char *s = optarg;
|
||||
sscanf(s, "%d", &numlayers);
|
||||
s++;
|
||||
if (numlayers > 9)
|
||||
@ -390,7 +389,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 't': /* tiles */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy, ¶meters->cp_tdz) !=3) {
|
||||
if (sscanf(optarg, "%d,%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy, ¶meters->cp_tdz) !=3) {
|
||||
fprintf(stdout, "[ERROR] '-t' 'dimensions of tiles' argument error ! [-t tdx,tdy,tdz]\n");
|
||||
return 1;
|
||||
}
|
||||
@ -403,7 +402,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
case 'n': /* resolution */
|
||||
{
|
||||
int aux;
|
||||
aux = sscanf(opj_optarg, "%d,%d,%d", ¶meters->numresolution[0], ¶meters->numresolution[1], ¶meters->numresolution[2]);
|
||||
aux = sscanf(optarg, "%d,%d,%d", ¶meters->numresolution[0], ¶meters->numresolution[1], ¶meters->numresolution[2]);
|
||||
if (aux == 2)
|
||||
parameters->numresolution[2] = 1;
|
||||
else if (aux == 1) {
|
||||
@ -423,7 +422,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
char sep;
|
||||
int res_spec = 0;
|
||||
int aux;
|
||||
char *s = opj_optarg;
|
||||
char *s = optarg;
|
||||
do {
|
||||
sep = 0;
|
||||
aux = sscanf(s, "[%d,%d,%d]%c", ¶meters->prct_init[0][res_spec], ¶meters->prct_init[1][res_spec], ¶meters->prct_init[2][res_spec], &sep);
|
||||
@ -445,7 +444,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
case 'b': /* code-block dimension */
|
||||
{
|
||||
int cblockw_init = 0, cblockh_init = 0, cblockl_init = 0;
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", &cblockw_init, &cblockh_init, &cblockl_init) != 3) {
|
||||
if (sscanf(optarg, "%d,%d,%d", &cblockw_init, &cblockh_init, &cblockl_init) != 3) {
|
||||
fprintf(stdout, "[ERROR] '-b' 'dimensions of codeblocks' argument error ! [-b cblkx,cblky,cblkz]\n");
|
||||
return 1;
|
||||
}
|
||||
@ -463,7 +462,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'x': /* creation of index file */
|
||||
{
|
||||
char *index = opj_optarg;
|
||||
char *index = optarg;
|
||||
strncpy(parameters->index, index, MAX_PATH);
|
||||
parameters->index_on = 1;
|
||||
}
|
||||
@ -475,7 +474,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
{
|
||||
char progression[4];
|
||||
|
||||
strncpy(progression, opj_optarg, 4);
|
||||
strncpy(progression, optarg, 4);
|
||||
parameters->prog_order = give_progression(progression);
|
||||
if (parameters->prog_order == -1) {
|
||||
fprintf(stdout, "[ERROR] Unrecognized progression order [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n");
|
||||
@ -488,7 +487,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 's': /* subsampling factor */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->subsampling_dx, ¶meters->subsampling_dy, ¶meters->subsampling_dz) != 3) {
|
||||
if (sscanf(optarg, "%d,%d,%d", ¶meters->subsampling_dx, ¶meters->subsampling_dy, ¶meters->subsampling_dz) != 2) {
|
||||
fprintf(stdout, "[ERROR] '-s' sub-sampling argument error ! [-s dx,dy,dz]\n");
|
||||
return 1;
|
||||
}
|
||||
@ -499,7 +498,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'd': /* coordonnate of the reference grid */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->volume_offset_x0, ¶meters->volume_offset_y0, ¶meters->volume_offset_z0) != 3) {
|
||||
if (sscanf(optarg, "%d,%d,%d", ¶meters->volume_offset_x0, ¶meters->volume_offset_y0, ¶meters->volume_offset_z0) != 3) {
|
||||
fprintf(stdout, "[ERROR] -d 'coordonnate of the reference grid' argument error !! [-d x0,y0,z0]\n");
|
||||
return 1;
|
||||
}
|
||||
@ -522,7 +521,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||
|
||||
char *s = opj_optarg;
|
||||
char *s = optarg;
|
||||
POC = parameters->POC;
|
||||
|
||||
fprintf(stdout, "/----------------------------------\\\n");
|
||||
@ -570,7 +569,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
{
|
||||
fprintf(stdout, "[INFO] Mode switch option not fully tested !!\n");
|
||||
value = 0;
|
||||
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||
if (sscanf(optarg, "%d", &value) == 1) {
|
||||
for (i = 0; i <= 6; i++) {
|
||||
int cache = value & (1 << i);
|
||||
if (cache)
|
||||
@ -584,7 +583,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'D': /* DCO */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d", ¶meters->dcoffset) != 1) {
|
||||
if (sscanf(optarg, "%d", ¶meters->dcoffset) != 1) {
|
||||
fprintf(stdout, "[ERROR] DC offset error !! [-D %d]\n",parameters->dcoffset);
|
||||
return 1;
|
||||
}
|
||||
@ -595,7 +594,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'R': /* ROI */
|
||||
{
|
||||
if (sscanf(opj_optarg, "OI:c=%d,U=%d", ¶meters->roi_compno, ¶meters->roi_shift) != 2) {
|
||||
if (sscanf(optarg, "OI:c=%d,U=%d", ¶meters->roi_compno, ¶meters->roi_shift) != 2) {
|
||||
fprintf(stdout, "[ERROR] ROI error !! [-ROI:c='compno',U='shift']\n");
|
||||
return 1;
|
||||
}
|
||||
@ -606,7 +605,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 'l': /* Tile offset */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0, ¶meters->cp_tz0) != 3) {
|
||||
if (sscanf(optarg, "%d,%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0, ¶meters->cp_tz0) != 3) {
|
||||
fprintf(stdout, "[ERROR] -l 'tile offset' argument error !! [-l X0,Y0,Z0]");
|
||||
return 1;
|
||||
}
|
||||
@ -619,7 +618,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
{
|
||||
char transform[4];
|
||||
|
||||
strncpy(transform, opj_optarg, 4);
|
||||
strncpy(transform, optarg, 4);
|
||||
parameters->transform_format = give_transform(transform);
|
||||
if (parameters->transform_format == -1) {
|
||||
fprintf(stdout, "[ERROR] -T 'Transform domain' argument error !! [-T 2DWT, 3DWT, 3RLS or 3LSE only]");
|
||||
@ -634,7 +633,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
{
|
||||
char coding[3];
|
||||
|
||||
strncpy(coding, opj_optarg, 3);
|
||||
strncpy(coding, optarg, 3);
|
||||
parameters->encoding_format = give_coding(coding);
|
||||
if (parameters->encoding_format == -1) {
|
||||
fprintf(stdout, "[ERROR] -C 'Coding algorithm' argument error !! [-C 2EB, 3EB, 2GR, 3GR or GRI only]");
|
||||
@ -652,7 +651,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout, "[ERROR] This option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||
fprintf(stdout, "[ERROR] This option is not valid \"-%c %s\"\n", c, optarg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -710,10 +709,10 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
if(parameters->numresolution[2] != 1) {
|
||||
parameters->transform_format = TRF_3D_DWT;
|
||||
/*fprintf(stdout, "[Warning] Resolution level in axial dim > 1 : 3D-DWT will be performed... \n");*/
|
||||
//fprintf(stdout, "[Warning] Resolution level in axial dim > 1 : 3D-DWT will be performed... \n");
|
||||
} else if (parameters->numresolution[2] == 1) {
|
||||
parameters->transform_format = TRF_2D_DWT;
|
||||
/*fprintf(stdout, "[Warning] Resolution level in axial dim == 1 : 2D-DWT will be performed... \n");*/
|
||||
//fprintf(stdout, "[Warning] Resolution level in axial dim == 1 : 2D-DWT will be performed... \n");
|
||||
}
|
||||
|
||||
if ((parameters->cod_format == J2K_CFMT) && (parameters->transform_format != TRF_2D_DWT || parameters->encoding_format != ENCOD_2EB)) {
|
||||
@ -861,7 +860,7 @@ int main(int argc, char **argv) {
|
||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||
|
||||
/* encode the volume */
|
||||
/*fprintf(stdout, "[INFO] Encode the volume\n");*/
|
||||
//fprintf(stdout, "[INFO] Encode the volume\n");
|
||||
bSuccess = opj_encode(cinfo, cio, volume, parameters.index);
|
||||
if (!bSuccess) {
|
||||
opj_cio_close(cio);
|
@ -242,7 +242,7 @@
|
||||
* Substitute for real dirent structure. Note that `d_name' field is a
|
||||
* true character array although we have it copied in the implementation
|
||||
* dependent data. We could save some memory if we had declared `d_name'
|
||||
* as a pointer referring the name within implementation dependent data.
|
||||
* as a pointer refering the name within implementation dependent data.
|
||||
* We have not done that since some code may rely on sizeof(d_name) to be
|
||||
* something other than four. Besides, directory entries are typically so
|
||||
* small that it takes virtually no time to copy them from place to place.
|
||||
@ -410,7 +410,7 @@ static DIR *opendir(const char *dirname)
|
||||
* capacity of d_name with different macros and some systems do not define
|
||||
* capacity at all (besides actual declaration of the field). If you really
|
||||
* need to find out storage capacity of d_name then you might want to try
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard although
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
|
||||
* there are many MS-DOS and MS-Windows implementations those do not define
|
||||
* it. There are also systems that declare d_name as "char d_name[1]" and
|
||||
* then allocate suitable amount of memory at run-time. Thanks to Alain
|
||||
@ -465,7 +465,7 @@ readdir (DIR *dirp)
|
||||
/* fill in entry and return that */
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* Last file has been processed or an error occurred */
|
||||
/* Last file has been processed or an error occured */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
@ -1,52 +0,0 @@
|
||||
# Generate target to build the html documentation through CMake tool
|
||||
# After having configured the project with the BUILD_DOC option you can run make doc
|
||||
# to generate the html documentation in the doc/html repository of the build folder.
|
||||
|
||||
# Try to find the doxygen tool
|
||||
find_package(Doxygen)
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
# Configure the doxygen config file with variable from CMake and move it
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
|
||||
${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
|
||||
|
||||
# Configure the html mainpage file of the doxygen documentation with variable
|
||||
# from CMake and move it
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in
|
||||
${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in
|
||||
${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY)
|
||||
# copy png file to make local (binary tree) documentation valid:
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png
|
||||
${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png
|
||||
${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY)
|
||||
|
||||
file(GLOB headers
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c
|
||||
)
|
||||
# Generate new target to build the html documentation
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
|
||||
${CMAKE_BINARY_DIR}/doc/mainpage.dox
|
||||
${CMAKE_BINARY_DIR}/doc/openjpip.dox
|
||||
${headers}
|
||||
)
|
||||
add_custom_target(doc ALL
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
|
||||
COMMENT "Building doxygen documentation"
|
||||
)
|
||||
|
||||
# install HTML documentation (install png files too):
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
|
||||
DESTINATION share/doc
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
else()
|
||||
message(STATUS "Doxygen not found, we cannot generate the documentation")
|
||||
endif()
|
@ -1,285 +0,0 @@
|
||||
# Doxyfile 1.7.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = OpenJPEG
|
||||
PROJECT_NUMBER = @OPENJPEG_VERSION@
|
||||
OUTPUT_DIRECTORY = @OPENJPEG_BINARY_DIR@/doc
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH = C://
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
EXTENSION_MAPPING =
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
SYMBOL_CACHE_SIZE = 0
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = @OPENJPEG_SOURCE_DIR@/src/lib/openjp2 \
|
||||
@OPENJPEG_SOURCE_DIR@/src/lib/openjpip \
|
||||
@OPENJPEG_BINARY_DIR@/doc
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.h \
|
||||
*.c \
|
||||
*.dox
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */.svn/*
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = @OPENJPEG_SOURCE_DIR@/doc
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = ./html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = org.doxygen.Project
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
USE_INLINE_TREES = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
SEARCHENGINE = NO
|
||||
SERVER_BASED_SEARCH = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = USE_JPWL \
|
||||
USE_JPSEC
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
Binary file not shown.
Before Width: | Height: | Size: 61 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB |
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \mainpage OpenJPEG v@OPENJPEG_VERSION@ Documentation
|
||||
*
|
||||
* \section intro Introduction
|
||||
* This manual documents the low-level OpenJPEG C API.\n
|
||||
* The OpenJPEG library is an open-source JPEG 2000 library developed in order to promote the use of JPEG 2000.\n
|
||||
* 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
|
||||
*
|
||||
* \section home Home page
|
||||
*
|
||||
* The Home Page of the OpenJPEG project can be found at:
|
||||
*
|
||||
* http://www.openjpeg.org/
|
||||
*
|
||||
* The source code repository is available here:
|
||||
*
|
||||
* http://github.com/uclouvain/openjpeg
|
||||
*
|
||||
* The OpenJPEG mailing list is located here:
|
||||
*
|
||||
* http://groups.google.com/group/openjpeg
|
||||
*
|
||||
* The test files repository is available here:
|
||||
*
|
||||
* http://github.com/uclouvain/openjpeg-data
|
||||
*
|
||||
* \section license License
|
||||
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
||||
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
|
||||
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
|
||||
*
|
||||
* \author OpenJPEG Team
|
||||
*
|
||||
*/
|
@ -1,222 +0,0 @@
|
||||
'\" t
|
||||
'\" The line above instructs most `man' programs to invoke tbl
|
||||
'\"
|
||||
'\" Separate paragraphs; not the same as PP which resets indent level.
|
||||
.de SP
|
||||
.if t .sp .5
|
||||
.if n .sp
|
||||
..
|
||||
'\"
|
||||
'\" Replacement em-dash for nroff (default is too short).
|
||||
.ie n .ds m " -
|
||||
.el .ds m \(em
|
||||
'\"
|
||||
'\" Placeholder macro for if longer nroff arrow is needed.
|
||||
.ds RA \(->
|
||||
'\"
|
||||
'\" Decimal point set slightly raised
|
||||
.if t .ds d \v'-.15m'.\v'+.15m'
|
||||
.if n .ds d .
|
||||
'\"
|
||||
'\" Enclosure macro for examples
|
||||
.de EX
|
||||
.SP
|
||||
.nf
|
||||
.ft CW
|
||||
..
|
||||
.de EE
|
||||
.ft R
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_compress 1 "Version 2.1.1" "opj_compress" "converts to jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_compress \-
|
||||
This program reads in an image of a certain type and converts it to a
|
||||
jpeg2000 file. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
Valid input image extensions are
|
||||
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
|
||||
.SP
|
||||
Valid output image extensions are
|
||||
.B .j2k, .jp2
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_compress \-i \fRinfile.bmp \fB-o \fRoutfile.j2k
|
||||
.P
|
||||
.B opj_compress \-ImgDir \fRdirectory_name \fB-OutFor \fRjp2
|
||||
.P
|
||||
.B opj_compress \-h \fRPrint a help message and exit.
|
||||
.P
|
||||
.R See JPWL OPTIONS for special options
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-\^b " n,n"
|
||||
(Size of code block (e.g. \-b 32,32). Default: 64 x 64)
|
||||
.TP
|
||||
.B \-\^c " n"
|
||||
(Size of precinct (e.g. \-c 128,128). Default: 2^15 x 2^15)
|
||||
.TP
|
||||
.B \-\^cinema2K " fps"
|
||||
Digital Cinema 2K profile compliant codestream. Valid \fBfps\fR values are 24 or 48.
|
||||
.TP
|
||||
.B \-\^cinema4K
|
||||
Digital Cinema 4K profile compliant codestream. Does not need an fps: default is 24 fps.
|
||||
.TP
|
||||
.B \-\^d " X,Y"
|
||||
(Offset of image origin (e.g. \-d 150,300))
|
||||
.TP
|
||||
.B \-\^h
|
||||
Print a help message and exit.
|
||||
.TP
|
||||
.B \-\^i " name"
|
||||
(input file name)
|
||||
.TP
|
||||
.B \-\^n " n"
|
||||
(Number of resolutions. Default: 6)
|
||||
.TP
|
||||
.B \-\^o " name"
|
||||
(output file name)
|
||||
.TP
|
||||
.B \-\^p " name"
|
||||
Progression order. \fBname\fR can be one out of:LRCP, RLCP, RPCL, PCRL, CPRL. Default: LRCP.
|
||||
.TP
|
||||
.B \-\^q " n"
|
||||
different psnr for successive layers
|
||||
.br
|
||||
.B Note: \fR(options \-r and \-q cannot be used together)
|
||||
.TP
|
||||
.B \-\^r " n"
|
||||
different compression ratio(s) for successive layers. The rate specified for each quality level is the desired compression factor.
|
||||
.br
|
||||
.B Note: \fR(options \-r and \-q cannot be used together)
|
||||
.TP
|
||||
.B \-\^s " X,Y"
|
||||
sub-sampling factor (e.g. \-s 2,2). Default: No sub-sampling in x or y direction.
|
||||
.br
|
||||
.B Remark: \fRsub-sampling bigger than 2 can produce errors.
|
||||
.TP
|
||||
.B \-\^t " W,H"
|
||||
(Size of tile (e.g. \-t 512,512) )
|
||||
.TP
|
||||
.B \-\^x " name"
|
||||
(Create index file and fill it. Default: no index file)
|
||||
.TP
|
||||
.B \-\^EPH
|
||||
(Write EPH marker after each header packet. Default:no EPH)
|
||||
.TP
|
||||
.B \-\^F " rawWidth,rawHeight,rawComp,rawBitDepth,s_or_u"
|
||||
characteristics of the raw input image
|
||||
.TP
|
||||
.B \-\^I
|
||||
(Use the irreversible DWT 9-7. Default: Reversible DWT 5-3)
|
||||
.TP
|
||||
.B \-\^ImgDir " directory_name"
|
||||
(directory containing input files)
|
||||
.TP
|
||||
.B \-\^M " n"
|
||||
mode switch with values: 1, 2, 4, 8, 16, 32. Default:No mode switch activated.
|
||||
.br
|
||||
\fIMeaning:\fR
|
||||
.br
|
||||
BYPASS(1)
|
||||
.br
|
||||
RESET(2)
|
||||
.br
|
||||
RESTART(4)
|
||||
.br
|
||||
VSC(8)
|
||||
.br
|
||||
ERTERM(16)
|
||||
.br
|
||||
SEGMARK(32)
|
||||
.br
|
||||
Values can be added: RESTART(4) + RESET(2) + SEGMARK(32) = \-M 38
|
||||
.TP
|
||||
.B \-\^OutFor "ext"
|
||||
(extension for output files)
|
||||
.TP
|
||||
.B \-\^POC "TtileNr=resolutionStart, componentStart, layerEnd, resolutionEnd, componentEnd, progressionOrder"
|
||||
(see Examples)
|
||||
.TP
|
||||
.B \-\^ROI "c=n,U=n"
|
||||
quantization indices upshifted for component c (0 or 1 or 2) with a value of U (>= 0 and <= 37)
|
||||
.br
|
||||
e.g. \fB-ROI c=0,U=25\fR
|
||||
.TP
|
||||
.B \-\^SOP
|
||||
(Write SOP marker before each packet. Default: No SOP marker in the codestream.)
|
||||
.TP
|
||||
.B \-\^T "X,Y"
|
||||
(Offset of the origin of the tiles (e.g. \-T 100,75) )
|
||||
.TP
|
||||
.B \-\^W
|
||||
(see JPWL OPTIONS)
|
||||
.P
|
||||
.SH JPWL OPTIONS
|
||||
Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
||||
.P
|
||||
.B \-W h<tilepart><=type>, s<tilepart><=method>, a=<addr>, z=<size>, g=<range>, p<tilepart:pack><=type>
|
||||
.P
|
||||
.B h\fR selects the header error protection (EPB): \fBtype\fR can be
|
||||
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
|
||||
if \fBtilepart\fR is absent, it is for main and tile headers
|
||||
if \fBtilepart\fR is present, it applies from that tile
|
||||
onwards, up to the next h<> spec, or to the last tilepart
|
||||
in the codestream (max. 16 specs)
|
||||
.P
|
||||
.B p \fRselects the packet error protection (EEP/UEP with EPBs)
|
||||
to be applied to raw data: \fBtype\fR can be
|
||||
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
|
||||
if \fBtilepart:pack\fR is absent, it is from tile 0, packet 0
|
||||
if \fBtilepart:pack\fR is present, it applies from that tile
|
||||
and that packet onwards, up to the next packet spec
|
||||
or to the last packet in the last tilepart in the stream
|
||||
(max. 16 specs)
|
||||
.P
|
||||
.B s \fRenables sensitivity data insertion (ESD): \fBmethod\fR can be
|
||||
[\-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR
|
||||
4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED]
|
||||
if \fBtilepart\fR is absent, it is for main header only
|
||||
if \fBtilepart\fR is present, it applies from that tile
|
||||
onwards, up to the next s<> spec, or to the last tilepart
|
||||
in the codestream (max. 16 specs)
|
||||
.P
|
||||
.B g \fRdetermines the addressing mode: \fBrange\fR can be
|
||||
[0=PACKET 1=BYTE RANGE 2=PACKET RANGE]
|
||||
.P
|
||||
.B a \fRdetermines the size of data addressing: \fBaddr\fR can be
|
||||
2/4 bytes (small/large codestreams). If not set, auto-mode
|
||||
.P
|
||||
.B z \fRdetermines the size of sensitivity values: \fBsize\fR can be
|
||||
1/2 bytes, for the transformed pseudo-floating point value
|
||||
.P
|
||||
.SH EXAMPLES
|
||||
.P
|
||||
.B opj_compress \-i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
|
||||
.P
|
||||
.B opj_compress \-i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
|
||||
.P
|
||||
.B opj_compress \-i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
|
||||
.P
|
||||
.B opj_compress \-i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
||||
.P
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
.br
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
.br
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
.br
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
.br
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
.br
|
||||
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
.br
|
||||
Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
.P
|
||||
.SH "SEE ALSO"
|
||||
opj_decompress(1) opj_dump(1)
|
||||
|
@ -1,119 +0,0 @@
|
||||
'\" t
|
||||
'\" The line above instructs most `man' programs to invoke tbl
|
||||
'\"
|
||||
'\" Separate paragraphs; not the same as PP which resets indent level.
|
||||
.de SP
|
||||
.if t .sp .5
|
||||
.if n .sp
|
||||
..
|
||||
'\"
|
||||
'\" Replacement em-dash for nroff (default is too short).
|
||||
.ie n .ds m " -
|
||||
.el .ds m \(em
|
||||
'\"
|
||||
'\" Placeholder macro for if longer nroff arrow is needed.
|
||||
.ds RA \(->
|
||||
'\"
|
||||
'\" Decimal point set slightly raised
|
||||
.if t .ds d \v'-.15m'.\v'+.15m'
|
||||
.if n .ds d .
|
||||
'\"
|
||||
'\" Enclosure macro for examples
|
||||
.de EX
|
||||
.SP
|
||||
.nf
|
||||
.ft CW
|
||||
..
|
||||
.de EE
|
||||
.ft R
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_decompress 1 "Version 2.1.1" "opj_decompress" "converts jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_decompress \-
|
||||
This program reads in a jpeg2000 image and converts it to another
|
||||
image type. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
Valid input image extensions are
|
||||
.B .j2k, .jp2, .j2c, .jpt
|
||||
.SP
|
||||
Valid output image extensions are
|
||||
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_decompress \-i \fRinfile.j2k \fB-o \fRoutfile.png
|
||||
.P
|
||||
.B opj_decompress \-ImgDir \fRimages/ \fB-OutFor \fRbmp
|
||||
.P
|
||||
.B opj_decompress \-h \fRPrint help message and exit
|
||||
.P
|
||||
.R See JPWL OPTIONS for special options
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-\^i "name"
|
||||
(jpeg2000 input file name)
|
||||
.TP
|
||||
.B \-\^l "n"
|
||||
n is the maximum number of quality layers to decode. See LAYERS below)
|
||||
.TP
|
||||
.B \-\^o "name"
|
||||
(output file name with extension)
|
||||
.TP
|
||||
.B \-\^r "n"
|
||||
(n is the highest resolution level to be discarded. See REDUCTION below)
|
||||
.TP
|
||||
.B \-\^x "name"
|
||||
(use name as index file and fill it)
|
||||
.TP
|
||||
.B \-\^ImgDir "directory_name"
|
||||
(directory containing input files)
|
||||
.TP
|
||||
.B \-\^OutFor "ext"
|
||||
(extension for output files)
|
||||
.P
|
||||
.SH JPIP OPTIONS
|
||||
Options usable only if the library has been compiled with
|
||||
.B BUILD_JPIP
|
||||
.TP
|
||||
.B -jpip
|
||||
Embed index table box into the output JP2 file (compulsory for JPIP)
|
||||
.TP
|
||||
.B -TP R
|
||||
Partition a tile into tile parts of different resolution levels (compulsory for JPT-stream)
|
||||
.P
|
||||
.SH JPWL OPTIONS
|
||||
Options usable only if the library has been compiled with
|
||||
.B BUILD_JPWL
|
||||
.TP
|
||||
.B -W c\fR[=Nc] (Nc is the number of expected components in the codestream; default:3)
|
||||
.TP
|
||||
.B -W t\fR[=Nt] (Nt is the maximum number of tiles in the codestream; default:8192)
|
||||
.TP
|
||||
.B -W c\fR[=Nc]\fB, t\fR[=Nt] \fR(same as above)
|
||||
.P
|
||||
.SH REDUCTION
|
||||
Set the number of highest resolution levels to be discarded.
|
||||
The image resolution is effectively divided by 2 to the power of the number of discarded levels. The reduce factor is limited by the smallest total number of decomposition levels among tiles.
|
||||
.SH TILES
|
||||
Set the maximum number of quality layers to decode. If there are less quality layers than the specified number, all the quality layers are decoded.
|
||||
.P
|
||||
'\".SH BUGS
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
.br
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
.br
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
.br
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
.br
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
.br
|
||||
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
.br
|
||||
Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
.P
|
||||
.SH "SEE ALSO"
|
||||
opj_compress(1) opj_dump(1)
|
@ -1,62 +0,0 @@
|
||||
'\" t
|
||||
'\" The line above instructs most `man' programs to invoke tbl
|
||||
'\"
|
||||
'\" Separate paragraphs; not the same as PP which resets indent level.
|
||||
.de SP
|
||||
.if t .sp .5
|
||||
.if n .sp
|
||||
..
|
||||
'\"
|
||||
'\" Replacement em-dash for nroff (default is too short).
|
||||
.ie n .ds m " -
|
||||
.el .ds m \(em
|
||||
'\"
|
||||
'\" Placeholder macro for if longer nroff arrow is needed.
|
||||
.ds RA \(->
|
||||
'\"
|
||||
'\" Decimal point set slightly raised
|
||||
.if t .ds d \v'-.15m'.\v'+.15m'
|
||||
.if n .ds d .
|
||||
'\"
|
||||
'\" Enclosure macro for examples
|
||||
.de EX
|
||||
.SP
|
||||
.nf
|
||||
.ft CW
|
||||
..
|
||||
.de EE
|
||||
.ft R
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_dump \-
|
||||
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
Valid input image extensions are
|
||||
.B .j2k, .jp2, .jpt
|
||||
.SP
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_dump \-i \fRinfile.j2k
|
||||
.P
|
||||
.B opj_dump \-ImgDir \fRimages/ \fRDump all files in images/
|
||||
.P
|
||||
.B opj_dump \-h \fRPrint help message and exit
|
||||
.P
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-\^i "name"
|
||||
(jpeg2000 input file name)
|
||||
.TP
|
||||
.B \-\^ImgDir "directory_name"
|
||||
(directory containing jpeg2000 input files)
|
||||
.P
|
||||
'\".SH BUGS
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2010, Mathieu Malaterre
|
||||
.P
|
||||
.SH "SEE ALSO"
|
||||
opj_compress(1) opj_decompress(1)
|
@ -1,337 +0,0 @@
|
||||
'\" t
|
||||
'\" The line above instructs most `man' programs to invoke tbl
|
||||
'\"
|
||||
'\" Separate paragraphs; not the same as PP which resets indent level.
|
||||
.de SP
|
||||
.if t .sp .5
|
||||
.if n .sp
|
||||
..
|
||||
'\"
|
||||
'\" Replacement em-dash for nroff (default is too short).
|
||||
.ie n .ds m " -
|
||||
.el .ds m \(em
|
||||
'\"
|
||||
'\" Placeholder macro for if longer nroff arrow is needed.
|
||||
.ds RA \(->
|
||||
'\"
|
||||
'\" Decimal point set slightly raised
|
||||
.if t .ds d \v'-.15m'.\v'+.15m'
|
||||
.if n .ds d .
|
||||
'\"
|
||||
'\" Enclosure macro for examples
|
||||
.de EX
|
||||
.SP
|
||||
.nf
|
||||
.ft CW
|
||||
..
|
||||
.de EE
|
||||
.ft R
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH libopenjp2 3 "Oct 2010" "Version 1.4.0" "Oct 2010"
|
||||
.P
|
||||
.SH NAME
|
||||
libopenjp2 -
|
||||
a library for reading and writing JPEG2000 image files.
|
||||
.SP
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B #include <openjpeg.h>
|
||||
.P
|
||||
.SS CONVERSION FORMATS
|
||||
.B PGX: imagetopgx() \fR/\fB pgxtoimage()
|
||||
.P
|
||||
.B PXM: imagetopnm() \fR/\fB pnmtoimage()
|
||||
.P
|
||||
.B BMP: imagetobmp() \fR/\fB bmptoimage()
|
||||
.P
|
||||
.B TIF: imagetotif() \fR/\fB tiftoimage()
|
||||
.P
|
||||
.B RAW: imagetoraw() \fR/\fB rawtoimage()
|
||||
.P
|
||||
.B TGA: imagetotga() \fR/\fB tgatoimage()
|
||||
.P
|
||||
.B PNG: imagetopng() \fR/\fB pngtoimage()
|
||||
.P
|
||||
.B YUV: imagetoyuv() \fR/\fB yuvtoimage() \fR(MJ2)
|
||||
.P
|
||||
.SS READ
|
||||
.B opj_set_default_decoder_parameters(opj_dparameters_t *\fIparams\fB);
|
||||
.P
|
||||
.B opj_dinfo_t *opj_create_decompress(OPJ_CODEC_FORMAT \fIformat\fB);
|
||||
.P
|
||||
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
|
||||
.P
|
||||
.B void opj_setup_decoder(opj_dinfo_t *\fIdinfo\fB, opj_dparameters_t * \fIparams\fB);
|
||||
.P
|
||||
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIinfo\fB, unsigned char *\fIbuf\fB, int \fIbuf_len\fB);
|
||||
.P
|
||||
.B opj_image_t *opj_decode(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB);
|
||||
.P
|
||||
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
|
||||
.P
|
||||
.B void opj_destroy_decompress(opj_dinfo_t *\fIdinfo\fB);
|
||||
.P
|
||||
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
|
||||
.P
|
||||
.SS WRITE
|
||||
.B void opj_set_default_encoder_parameters(opj_cparameters_t *\fIparams\fB);
|
||||
.P
|
||||
/*
|
||||
.B opj_image_t *FORMATtoimage(const char *\fIfname\fB, opj_cparameters_t *\fIparams\fB);
|
||||
.P
|
||||
*/
|
||||
.br
|
||||
.B opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT \fIformat\fB);
|
||||
.P
|
||||
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
|
||||
.P
|
||||
.B void opj_setup_encoder(opj_cinfo_t *\fIcinfo\fB, opj_cparameters_t *\fIparams\fB, opj_image_t *\fIimage\fB);
|
||||
.P
|
||||
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIcinfo\fB, \fINULL\fB, \fI0\fB);
|
||||
.P
|
||||
.B bool opj_encode(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, char *\fIindex\fB);
|
||||
.P
|
||||
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
|
||||
.P
|
||||
.B void opj_destroy_compress(opj_cinfo_t *\fIcinfo\fB);
|
||||
.P
|
||||
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
|
||||
.P
|
||||
.SS GENERAL
|
||||
.P
|
||||
.B void opj_image_create(int \fInumcmpts\fB, opj_image_cmptparm_t *\fIcmptparms\fB, OPJ_COLOR_SPACE \fIclrspc\fB);
|
||||
.P
|
||||
.B int cio_tell(opj_cio_t *\fIcio\fB);
|
||||
.P
|
||||
.B void cio_seek(opj_cio_t *\fIcio\fB, int \fIpos\fB);
|
||||
.P
|
||||
.B opj_image_t *opj_decode_with_info(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB, opj_codestream_info_t *\fIcstr_info\fB);
|
||||
.P
|
||||
.B bool opj_encode_with_info(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, opj_codestream_info_t *\fIcstr_info\fB);
|
||||
.P
|
||||
.B void opj_destroy_cstr_info(opj_codestream_info_t *\fIcstr_info\fB);
|
||||
.P
|
||||
.B const char *opj_version(\fIvoid\fB);
|
||||
.P
|
||||
.SH OPJ_CODEC_FORMAT
|
||||
.P
|
||||
.B CODEC_J2K\fR or \fBCODEC_JPT\fR or \fBCODEC_JP2
|
||||
.P
|
||||
.SH OPJ_COLOR_SPACE
|
||||
.P
|
||||
.B CLRSPC_UNKNOWN\fR or \fBCLRSPC_UNSPECIFIED\fR or \fBCLRSPC_SRGB\fR or \fBCLRSPC_GRAY\fR or \fBCLRSPC_SYCC
|
||||
.P
|
||||
.SH DECOMPRESSION PARAMETERS
|
||||
.p
|
||||
typedef struct opj_dparameters
|
||||
.br
|
||||
{
|
||||
/*
|
||||
Set the number of highest resolution levels to be discarded.
|
||||
The image resolution is effectively divided by 2 to the power
|
||||
of the number of discarded levels.
|
||||
The reduce factor is limited by the smallest total number of
|
||||
decomposition levels among tiles.
|
||||
if != 0, then original dimension divided by 2^(reduce);
|
||||
if == 0 or not used, image is decoded to the full resolution
|
||||
*/
|
||||
\fBint\fR cp_reduce;
|
||||
/*
|
||||
Set the maximum number of quality layers to decode.
|
||||
If there are less quality layers than the specified number,
|
||||
all the quality layers are decoded.
|
||||
if != 0, then only the first "layer" layers are decoded;
|
||||
if == 0 or not used, all the quality layers are decoded
|
||||
*/
|
||||
\fBint\fR cp_layer;
|
||||
|
||||
/*command line encoder parameters (not used inside the library) */
|
||||
/* input file name */
|
||||
\fBchar\fR infile[OPJ_PATH_LEN];
|
||||
/* output file name */
|
||||
\fBchar\fR outfile[OPJ_PATH_LEN];
|
||||
/* input file format: see OPJ_CODEC_FORMAT */
|
||||
\fBint\fR decod_format;
|
||||
/* output file format */
|
||||
\fBint\fR cod_format;
|
||||
|
||||
/*JPWL decoding parameters */
|
||||
/* activates the JPWL correction capabilities */
|
||||
\fBbool\fR jpwl_correct;
|
||||
/* expected number of components */
|
||||
\fBint\fR jpwl_exp_comps;
|
||||
/* maximum number of tiles */
|
||||
\fBint\fR jpwl_max_tiles;
|
||||
|
||||
/*
|
||||
Specify whether the decoding should be done on the entire
|
||||
codestream, or be limited to the main header
|
||||
Limiting the decoding to the main header makes it possible
|
||||
to extract the characteristics of the codestream
|
||||
if == NO_LIMITATION, the entire codestream is decoded;
|
||||
if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
|
||||
*/
|
||||
\fBOPJ_LIMIT_DECODING\fR cp_limit_decoding;
|
||||
.br
|
||||
} opj_dparameters_t;
|
||||
|
||||
.SH COMPRESSION PARAMETERS
|
||||
.P
|
||||
typedef struct opj_cparameters
|
||||
.br
|
||||
{
|
||||
/* size of tile: tile_size_on = false (not in argument)
|
||||
or tile_size_on = true (in argument) */
|
||||
\fBbool\fR tile_size_on;
|
||||
/* XTOsiz */
|
||||
\fBint\fR cp_tx0;
|
||||
/* YTOsiz */
|
||||
\fBint\fR cp_ty0;
|
||||
/* XTsiz */
|
||||
\fBint\fR cp_tdx;
|
||||
/* YTsiz */
|
||||
\fBint\fR cp_tdy;
|
||||
/* allocation by rate/distortion */
|
||||
\fBint\fR cp_disto_alloc;
|
||||
/* allocation by fixed layer */
|
||||
\fBint\fR cp_fixed_alloc;
|
||||
/* add fixed_quality */
|
||||
\fBint\fR cp_fixed_quality;
|
||||
/* fixed layer */
|
||||
\fBint *\fRcp_matrice;
|
||||
/* comment for coding */
|
||||
\fBchar *\fRcp_comment;
|
||||
/* coding style */
|
||||
\fBint\fR csty;
|
||||
/* progression order:
|
||||
PROG_UNKNOWN, LRCP(default), RLCP, RPCL, PCRL, CPRL */
|
||||
\fBOPJ_PROG_ORDER\fR prog_order;
|
||||
/* progression order changes */
|
||||
\fBopj_poc_t\fR POC[32];
|
||||
/* number of progression order changes (POC), default: 0 */
|
||||
\fBint\fR numpocs;
|
||||
/* number of layers */
|
||||
\fBint\fR tcp_numlayers;
|
||||
/* rates of layers */
|
||||
\fBfloat\fR tcp_rates[100];
|
||||
/* different psnr for successive layers */
|
||||
\fBfloat\fR tcp_distoratio[100];
|
||||
/* number of resolutions */
|
||||
\fBint\fR numresolution;
|
||||
/* initial code block width, default: 64 */
|
||||
\fBint\fR cblockw_init;
|
||||
/* initial code block height, default: 64 */
|
||||
\fBint\fR cblockh_init;
|
||||
/* mode switch (cblk_style) */
|
||||
/* 1 : use the irreversible DWT 9-7,
|
||||
0 : use lossless compression (default) */
|
||||
\fBint\fR irreversible;
|
||||
/* region of interest: affected component in [0..3],
|
||||
-1 means no ROI */
|
||||
\fBint\fR roi_compno;
|
||||
/* region of interest: upshift value */
|
||||
\fBint\fR roi_shift;
|
||||
/* number of precinct size specifications */
|
||||
\fBint\fR res_spec;
|
||||
/* initial precinct width */
|
||||
\fBint\fR prcw_init[J2K_MAXRLVLS];
|
||||
/* initial precinct height */
|
||||
\fBint\fR prch_init[J2K_MAXRLVLS];
|
||||
|
||||
/*command line encoder parameters (not used inside the library) */
|
||||
/* input file name */
|
||||
\fBchar\fR infile[OPJ_PATH_LEN];
|
||||
/* output file name */
|
||||
\fBchar\fR outfile[OPJ_PATH_LEN];
|
||||
/* DEPRECATED. Index generation is now handeld with the
|
||||
opj_encode_with_info() function. Set to NULL */
|
||||
\fBint\fR index_on;
|
||||
/* DEPRECATED. Index generation is now handeld with the
|
||||
opj_encode_with_info() function. Set to NULL */
|
||||
\fBchar\fR index[OPJ_PATH_LEN];
|
||||
/* subimage encoding: origin image offset in x direction */
|
||||
\fBint\fR image_offset_x0;
|
||||
/* subimage encoding: origin image offset in y direction */
|
||||
\fBint\fR image_offset_y0;
|
||||
/* subsampling value for dx */
|
||||
\fBint\fR subsampling_dx;
|
||||
/* subsampling value for dy */
|
||||
\fBint\fR subsampling_dy;
|
||||
/* input file format */
|
||||
\fBint\fR decod_format;
|
||||
/* output file format: see OPJ_CODEC_FORMAT */
|
||||
\fBint\fR cod_format;
|
||||
|
||||
/*JPWL encoding parameters */
|
||||
/* enables writing of EPC in MH, thus activating JPWL */
|
||||
\fBbool\fR jpwl_epc_on;
|
||||
/* error protection method for MH (0,1,16,32,37-128) */
|
||||
\fBint\fR jpwl_hprot_MH;
|
||||
/* tile number of header protection specification (>=0) */
|
||||
\fBint\fR jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
|
||||
/* error protection methods for TPHs (0,1,16,32,37-128) */
|
||||
\fBint\fR jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS];
|
||||
/* tile number of packet protection specification (>=0) */
|
||||
\fBint\fR jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS];
|
||||
/* packet number of packet protection specification (>=0) */
|
||||
\fBint\fR jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS];
|
||||
/* error protection methods for packets (0,1,16,32,37-128) */
|
||||
\fBint\fR jpwl_pprot[JPWL_MAX_NO_PACKSPECS];
|
||||
/* enables writing of ESD, (0=no/1/2 bytes) */
|
||||
\fBint\fR jpwl_sens_size;
|
||||
/* sensitivity addressing size (0=auto/2/4 bytes) */
|
||||
\fBint\fR jpwl_sens_addr;
|
||||
/* sensitivity range (0-3) */
|
||||
\fBint\fR jpwl_sens_range;
|
||||
/* sensitivity method for MH (-1=no,0-7) */
|
||||
\fBint\fR jpwl_sens_MH;
|
||||
/* tile number of sensitivity specification (>=0) */
|
||||
\fBint\fR jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
|
||||
/* sensitivity methods for TPHs (-1=no,0-7) */
|
||||
\fBint\fR jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS];
|
||||
|
||||
/* Digital Cinema compliance: OFF-not compliant,
|
||||
CINEMA2K_24, CINEMA2K_48, CINEMA4K_24 */
|
||||
\fBOPJ_CINEMA_MODE\fR cp_cinema;
|
||||
/* Maximum rate for each component.
|
||||
If == 0, component size limitation is not considered */
|
||||
\fBint\fR max_comp_size;
|
||||
/* Profile name*/
|
||||
\fBOPJ_RSIZ_CAPABILITIES\fR cp_rsiz;
|
||||
/* Tile part generation*/
|
||||
\fBchar\fR tp_on;
|
||||
/* Flag for Tile part generation*/
|
||||
\fBchar\fR tp_flag;
|
||||
/* MCT (multiple component transform) */
|
||||
\fBchar\fR tcp_mct;
|
||||
.br
|
||||
} opj_cparameters_t;
|
||||
|
||||
|
||||
'\".SH OPTIONS
|
||||
'\".SH BUGS
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
|
||||
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
|
||||
Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
|
||||
.P
|
||||
.SH "SEE ALSO"
|
||||
\fBimage_to_j2k\fR(1) \fBj2k_to_image\fR(1) \fBj2k_dump\fR(1)
|
||||
|
||||
\fBJPWL_image_to_j2k\fR(1) \fBJPWL_j2k_to_image\fR(1)
|
||||
|
||||
\fBextract_j2k_from_mj2\fR(1) \fBwrap_j2k_in_mj2\fR(1)
|
||||
\fBframes_to_mj2\fR(1) \fBmj2_to_frames\fR(1)
|
@ -1,94 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \page openjpippage OpenJPIP v@OPENJPEG_VERSION@ Documentation
|
||||
*
|
||||
* \section intro Introduction
|
||||
* This manual documents the low-level OpenJPIP C API.\n
|
||||
* OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools, APIs and protocols (JPIP).\n
|
||||
* ( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html)\n
|
||||
*
|
||||
* This whole documents covers the following six programs.\n
|
||||
* - opj_server.c JPIP server supporting HTTP connection and JPT/JPP-stream
|
||||
* - opj_dec_server.c Server to decode JPT/JPP-stream and communicate locally with JPIP client, which is coded in java
|
||||
* - opj_jpip_addxml.c To Embed metadata into JP2 file
|
||||
* - opj_jpip_transcode.c To Convert JPT/JPP-stream to JP2 or J2K
|
||||
* - opj_jpip_test.c To test index code format of a JP2 file
|
||||
*
|
||||
* \section license License
|
||||
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
||||
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
|
||||
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
|
||||
*
|
||||
*
|
||||
* \section reqlibs Required libraries
|
||||
* - OpenJPEG library
|
||||
* - FastCGI development kit (C libraries) at server (http://www.fastcgi.com)
|
||||
* - libcURL library
|
||||
*
|
||||
* We tested this software with a virtual server running on the same Linux machine as the clients.
|
||||
*
|
||||
*
|
||||
* \section compilenotes Compiling Notes
|
||||
* When you are making opj_server, set anything (e.g. yes) to the parameter jpipserver to define itself in the Makefile, which enables to make it in server mode.\n
|
||||
* Otherwise do not define (or do not set to) the parameter jpipserver.\n
|
||||
* Be sure that any object files and library file libopenjpip.a are not reused to compile in the two different mode (server mode and non server mode).\n
|
||||
* In other words, do make clean before making new targets which are in different modes as previous make.\n
|
||||
*
|
||||
*
|
||||
* \section sysarchtect System Architecture
|
||||
* JPIP protocol is implemented between the JPIP server program (opj_server) and the JPIP client java program (opj_viewer).\n
|
||||
* Figure below represents the overview of our system architecture.\n
|
||||
* The JPIP server parses JPIP query and sends corresponding JPT/JPP-stream.
|
||||
* The JPIP client viewer is an image viewer with GUI to publish JPIP requests and receive JPT/JPP-stream.\n
|
||||
* Particularly, our system has the image decoding module implemented on a server (opj_dec_server, Image decoding Server).
|
||||
* Image decoding Server and JPIP client viewer communicate closely.
|
||||
* This specific architecture enables sharing cache of image codestream data among all viewers connected to the same Image decoding Server not only locally but also remotely.
|
||||
*
|
||||
* \image html jpip_architect.png "OpenJPIP system architecture"
|
||||
*
|
||||
* JPIP server follows up the client cache during a session. \n
|
||||
* Concretely, the JPIP server models cache in each session, to which Channel IDs are associated.
|
||||
* A Channel ID identifies a JPIP client viewer.
|
||||
* And, new viewers can belong to a session by referring to one of its channel ID.
|
||||
* The Image decoding Server maintains the association between channel IDs and targets, and provides a reference channel ID to a Viewer on demand.\n
|
||||
*
|
||||
* Typical requests and replies among JPIP server, JPIP client, and Image decoding server is presented below.\n
|
||||
* The JPIP server parses HTTP query and sends corresponding JPT/JPP-stream back to the JPIP client (Viewer).
|
||||
* JPT/JPP-stream is unreadable by JPIP client, and it is directly passed to Image decoding Server, and which provides the image in raw format (PGM or PPM) to the JPIP client.
|
||||
* The Image decoding Server handles the decoding and caching of JPT/JPP-stream.
|
||||
* JPIP client can read PGM and PPM images natively.
|
||||
* Before connecting to the JPIP server, every JPIP client checks local cache data of the requesting image with the image decoding server.
|
||||
* If its cache exists, the image decoding server provides ChannelID (CID), which identifies the image and its cache model on the JPIP server, and the whole system can continue the session using the CID.
|
||||
*
|
||||
* \image html jpip_protocol.png "Message Sequence Chart of OpenJPIP impementation"
|
||||
*
|
||||
* \author Kaori Hagihara UCL/SST/ICTM/ELEN
|
||||
*/
|
12
libopenjp3d.pc.cmake
Normal file
12
libopenjp3d.pc.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
bindir=@OPENJP3D_INSTALL_BIN_DIR@
|
||||
datadir=@OPENJP3D_INSTALL_DATA_DIR@
|
||||
libdir=@OPENJP3D_INSTALL_LIB_DIR@
|
||||
includedir=@OPENJP3D_INSTALL_INCLUDE_DIR@
|
||||
|
||||
Name: openjp3d
|
||||
Description: JPEG2000 files library
|
||||
URL: http://www.openjpeg.org/
|
||||
Version: @OPENJP3D_VERSION@
|
||||
Libs: -L${libdir} -lopenjp3d
|
||||
Cflags: -I${includedir}
|
37
libopenjp3d/CMakeLists.txt
Normal file
37
libopenjp3d/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
|
||||
# Defines the source code for the library
|
||||
SET(OPENJP3D_SRCS
|
||||
bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjp3d.c pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
|
||||
)
|
||||
|
||||
# Build the library
|
||||
IF(WIN32)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
||||
ELSE(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
ENDIF(WIN32)
|
||||
ADD_LIBRARY(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${OPENJP3D_LIBRARY_NAME} m)
|
||||
ENDIF(UNIX)
|
||||
SET_TARGET_PROPERTIES(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJP3D_LIBRARY_PROPERTIES})
|
||||
|
||||
# Install library
|
||||
INSTALL(TARGETS ${OPENJP3D_LIBRARY_NAME}
|
||||
EXPORT OpenJP3DTargets
|
||||
DESTINATION ${OPENJP3D_INSTALL_LIB_DIR}
|
||||
COMPONENT Libraries
|
||||
)
|
||||
|
||||
# Install includes files
|
||||
INSTALL(FILES openjp3d.h
|
||||
DESTINATION ${OPENJP3D_INSTALL_INCLUDE_DIR}/${subdir}
|
||||
COMPONENT Headers
|
||||
)
|
||||
INSTALL(CODE
|
||||
"EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${subdir}/openjp3d.h \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENJP3D_INSTALL_INCLUDE_DIR}/openjp3d.h)")
|
||||
|
88
libopenjp3d/Makefile.am
Normal file
88
libopenjp3d/Makefile.am
Normal file
@ -0,0 +1,88 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
lib_LTLIBRARIES = libopenjp3dvm.la
|
||||
|
||||
includesdir = ${includedir}/openjp3d-@JP3D_MAJOR_NR@.@JP3D_MINOR_NR@
|
||||
includes_HEADERS = openjp3d.h
|
||||
|
||||
libopenjp3dvm_la_LDFLAGS = -no-undefined -version-info @lt_version_jp3d@
|
||||
|
||||
libopenjp3dvm_la_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/jp3d/libjp3dvm \
|
||||
-I$(top_builddir)/jp3d/libjp3dvm
|
||||
libopenjp3dvm_la_CFLAGS =
|
||||
libopenjp3dvm_la_LIBADD = -lm
|
||||
libopenjp3dvm_la_SOURCES = \
|
||||
bio.c \
|
||||
cio.c \
|
||||
dwt.c \
|
||||
event.c \
|
||||
jp3d.c \
|
||||
jp3d_lib.c \
|
||||
volume.c \
|
||||
mct.c \
|
||||
mqc.c \
|
||||
openjp3d.c \
|
||||
pi.c \
|
||||
raw.c \
|
||||
t1.c \
|
||||
t1_3d.c \
|
||||
t2.c \
|
||||
tcd.c \
|
||||
tgt.c \
|
||||
bio.h \
|
||||
cio.h \
|
||||
dwt.h \
|
||||
event.h \
|
||||
fix.h \
|
||||
int.h \
|
||||
jp3d.h \
|
||||
jp3d_lib.h \
|
||||
mct.h \
|
||||
mqc.h \
|
||||
opj_includes.h \
|
||||
pi.h \
|
||||
raw.h \
|
||||
t1.h \
|
||||
t1_3d.h \
|
||||
t2.h \
|
||||
tcd.h \
|
||||
tgt.h \
|
||||
volume.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt
|
||||
|
||||
install-data-hook:
|
||||
cd $(DESTDIR)$(includedir) && \
|
||||
rm -f openjp3d.h && \
|
||||
$(LN_S) openjp3d-@JP3D_MAJOR_NR@.@JP3D_MINOR_NR@/openjp3d.h \
|
||||
openjp3d.h
|
||||
@echo -e " (LA)\t$(libdir)/libopenjp3dvm.la" >> $(top_builddir)/report.txt
|
||||
@( $(call solist) ) >> $(top_builddir)/report.txt
|
||||
@echo -e " (A)\t$(base)/$(a)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (H)\t$(includedir)/openjp3d-$(MAJOR_NR).$(MINOR_NR)/openjp3d.h" >> $(top_builddir)/report.txt
|
||||
@echo -e " (LN)\t$(includedir)/openjp3d.h" >> $(top_builddir)/report.txt
|
||||
|
||||
uninstall-hook:
|
||||
rm -f $(DESTDIR)$(includedir)/openjp3d.h
|
||||
|
||||
solist = $(foreach f, $(dll) $(so), echo -e ' $(SO_PREFIX)\t$(base)/$(f)' ;)
|
||||
get_tok = $(shell grep -E "^$(1)=" $(lib_LTLIBRARIES) | cut -d "'" -f 2)
|
||||
base = $(call get_tok,libdir)
|
||||
so = $(call get_tok,library_names)
|
||||
a = $(call get_tok,old_library)
|
||||
|
||||
if HAVE_WIN32
|
||||
SO_PREFIX = (DLL)
|
||||
dll = $(call get_tok,dlname)
|
||||
else
|
||||
if HAVE_DARWIN
|
||||
SO_PREFIX = (DY)
|
||||
dll =
|
||||
else
|
||||
SO_PREFIX = (SO)
|
||||
dll =
|
||||
endif
|
||||
endif
|
383
src/lib/openjp3d/bio.c → libopenjp3d/bio.c
Normal file → Executable file
383
src/lib/openjp3d/bio.c → libopenjp3d/bio.c
Normal file → Executable file
@ -1,194 +1,189 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/** @name Local static functions */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Write a bit
|
||||
@param bio BIO handle
|
||||
@param b Bit to write (0 or 1)
|
||||
*/
|
||||
static void bio_putbit(opj_bio_t *bio, int b);
|
||||
/**
|
||||
Read a bit
|
||||
@param bio BIO handle
|
||||
@return Returns the read bit
|
||||
*/
|
||||
static int bio_getbit(opj_bio_t *bio);
|
||||
/**
|
||||
Write a byte
|
||||
@param bio BIO handle
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
static int bio_byteout(opj_bio_t *bio);
|
||||
/**
|
||||
Read a byte
|
||||
@param bio BIO handle
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
static int bio_bytein(opj_bio_t *bio);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
local functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
static int bio_byteout(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
return 1;
|
||||
}
|
||||
*bio->bp++ = bio->buf >> 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bio_bytein(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
return 1;
|
||||
}
|
||||
bio->buf |= *bio->bp++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bio_putbit(opj_bio_t *bio, int b) {
|
||||
if (bio->ct == 0) {
|
||||
bio_byteout(bio);
|
||||
}
|
||||
bio->ct--;
|
||||
bio->buf |= b << bio->ct;
|
||||
}
|
||||
|
||||
/* MOD antonin */
|
||||
static int bio_getbit(opj_bio_t *bio) {
|
||||
/* DOM */
|
||||
if (bio->ct == 0) {
|
||||
bio_bytein(bio);
|
||||
}
|
||||
bio->ct--;
|
||||
return (bio->buf >> bio->ct) & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Bit Input/Output interface
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_bio_t* bio_create() {
|
||||
opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t));
|
||||
return bio;
|
||||
}
|
||||
|
||||
void bio_destroy(opj_bio_t *bio) {
|
||||
if(bio) {
|
||||
opj_free(bio);
|
||||
}
|
||||
}
|
||||
|
||||
int bio_numbytes(opj_bio_t *bio) {
|
||||
return (bio->bp - bio->start);
|
||||
}
|
||||
|
||||
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len) {
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 8;
|
||||
}
|
||||
|
||||
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len) {
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 0;
|
||||
}
|
||||
|
||||
void bio_write(opj_bio_t *bio, int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
bio_putbit(bio, (v >> i) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
int bio_read(opj_bio_t *bio, int n) {
|
||||
int i, v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += bio_getbit(bio) << i;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
int bio_flush(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if (bio_byteout(bio)) {
|
||||
return 1;
|
||||
}
|
||||
if (bio->ct == 7) {
|
||||
bio->ct = 0;
|
||||
if (bio_byteout(bio)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bio_inalign(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if ((bio->buf & 0xff) == 0xff) {
|
||||
if (bio_bytein(bio)) {
|
||||
return 1;
|
||||
}
|
||||
bio->ct = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/** @name Local static functions */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Write a bit
|
||||
@param bio BIO handle
|
||||
@param b Bit to write (0 or 1)
|
||||
*/
|
||||
static void bio_putbit(opj_bio_t *bio, int b);
|
||||
/**
|
||||
Read a bit
|
||||
@param bio BIO handle
|
||||
@return Returns the read bit
|
||||
*/
|
||||
static int bio_getbit(opj_bio_t *bio);
|
||||
/**
|
||||
Write a byte
|
||||
@param bio BIO handle
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
static int bio_byteout(opj_bio_t *bio);
|
||||
/**
|
||||
Read a byte
|
||||
@param bio BIO handle
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
static int bio_bytein(opj_bio_t *bio);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
local functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
static int bio_byteout(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
return 1;
|
||||
}
|
||||
*bio->bp++ = bio->buf >> 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bio_bytein(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
return 1;
|
||||
}
|
||||
bio->buf |= *bio->bp++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bio_putbit(opj_bio_t *bio, int b) {
|
||||
if (bio->ct == 0) {
|
||||
bio_byteout(bio);
|
||||
}
|
||||
bio->ct--;
|
||||
bio->buf |= b << bio->ct;
|
||||
}
|
||||
|
||||
/* MOD antonin */
|
||||
static int bio_getbit(opj_bio_t *bio) {
|
||||
/* DOM */
|
||||
if (bio->ct == 0) {
|
||||
bio_bytein(bio);
|
||||
}
|
||||
bio->ct--;
|
||||
return (bio->buf >> bio->ct) & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Bit Input/Output interface
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_bio_t* bio_create() {
|
||||
opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t));
|
||||
return bio;
|
||||
}
|
||||
|
||||
void bio_destroy(opj_bio_t *bio) {
|
||||
if(bio) {
|
||||
opj_free(bio);
|
||||
}
|
||||
}
|
||||
|
||||
int bio_numbytes(opj_bio_t *bio) {
|
||||
return (bio->bp - bio->start);
|
||||
}
|
||||
|
||||
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len) {
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 8;
|
||||
}
|
||||
|
||||
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len) {
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 0;
|
||||
}
|
||||
|
||||
void bio_write(opj_bio_t *bio, int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
bio_putbit(bio, (v >> i) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
int bio_read(opj_bio_t *bio, int n) {
|
||||
int i, v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += bio_getbit(bio) << i;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
int bio_flush(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if (bio_byteout(bio)) {
|
||||
return 1;
|
||||
}
|
||||
if (bio->ct == 7) {
|
||||
bio->ct = 0;
|
||||
if (bio_byteout(bio)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bio_inalign(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if ((bio->buf & 0xff) == 0xff) {
|
||||
if (bio_bytein(bio)) {
|
||||
return 1;
|
||||
}
|
||||
bio->ct = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
269
src/lib/openjp3d/bio.h → libopenjp3d/bio.h
Normal file → Executable file
269
src/lib/openjp3d/bio.h → libopenjp3d/bio.h
Normal file → Executable file
@ -1,137 +1,132 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __BIO_H
|
||||
#define __BIO_H
|
||||
/**
|
||||
@file bio.h
|
||||
@brief Implementation of an individual bit input-output (BIO)
|
||||
|
||||
The functions in BIO.C have for goal to realize an individual bit input - output.
|
||||
*/
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Individual bit input-output stream (BIO)
|
||||
*/
|
||||
typedef struct opj_bio {
|
||||
/** pointer to the start of the buffer */
|
||||
unsigned char *start;
|
||||
/** pointer to the end of the buffer */
|
||||
unsigned char *end;
|
||||
/** pointer to the present position in the buffer */
|
||||
unsigned char *bp;
|
||||
/** temporary place where each byte is read or written */
|
||||
unsigned int buf;
|
||||
/** coder : number of bits free to write. decoder : number of bits read */
|
||||
int ct;
|
||||
} opj_bio_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new BIO handle
|
||||
@return Returns a new BIO handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_bio_t* bio_create(void);
|
||||
/**
|
||||
Destroy a previously created BIO handle
|
||||
@param bio BIO handle to destroy
|
||||
*/
|
||||
void bio_destroy(opj_bio_t *bio);
|
||||
/**
|
||||
Number of bytes written.
|
||||
@param bio BIO handle
|
||||
@return Returns the number of bytes written
|
||||
*/
|
||||
int bio_numbytes(opj_bio_t *bio);
|
||||
/**
|
||||
Init encoder
|
||||
@param bio BIO handle
|
||||
@param bp Output buffer
|
||||
@param len Output buffer length
|
||||
*/
|
||||
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len);
|
||||
/**
|
||||
Init decoder
|
||||
@param bio BIO handle
|
||||
@param bp Input buffer
|
||||
@param len Input buffer length
|
||||
*/
|
||||
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len);
|
||||
/**
|
||||
Write bits
|
||||
@param bio BIO handle
|
||||
@param v Value of bits
|
||||
@param n Number of bits to write
|
||||
*/
|
||||
void bio_write(opj_bio_t *bio, int v, int n);
|
||||
/**
|
||||
Read bits
|
||||
@param bio BIO handle
|
||||
@param n Number of bits to read
|
||||
@return Returns the corresponding read number
|
||||
*/
|
||||
int bio_read(opj_bio_t *bio, int n);
|
||||
/**
|
||||
Flush bits
|
||||
@param bio BIO handle
|
||||
@return Returns 1 if successful, returns 0 otherwise
|
||||
*/
|
||||
int bio_flush(opj_bio_t *bio);
|
||||
/**
|
||||
Passes the ending bits (coming from flushing)
|
||||
@param bio BIO handle
|
||||
@return Returns 1 if successful, returns 0 otherwise
|
||||
*/
|
||||
int bio_inalign(opj_bio_t *bio);
|
||||
/**
|
||||
Read a bit
|
||||
@param bio BIO handle
|
||||
@return Returns the read bit
|
||||
*/
|
||||
/* MOD antonin */
|
||||
/*int bio_getbit(opj_bio_t *bio);*/
|
||||
/* DOM */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __BIO_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __BIO_H
|
||||
#define __BIO_H
|
||||
/**
|
||||
@file bio.h
|
||||
@brief Implementation of an individual bit input-output (BIO)
|
||||
|
||||
The functions in BIO.C have for goal to realize an individual bit input - output.
|
||||
*/
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Individual bit input-output stream (BIO)
|
||||
*/
|
||||
typedef struct opj_bio {
|
||||
/** pointer to the start of the buffer */
|
||||
unsigned char *start;
|
||||
/** pointer to the end of the buffer */
|
||||
unsigned char *end;
|
||||
/** pointer to the present position in the buffer */
|
||||
unsigned char *bp;
|
||||
/** temporary place where each byte is read or written */
|
||||
unsigned int buf;
|
||||
/** coder : number of bits free to write. decoder : number of bits read */
|
||||
int ct;
|
||||
} opj_bio_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new BIO handle
|
||||
@return Returns a new BIO handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_bio_t* bio_create();
|
||||
/**
|
||||
Destroy a previously created BIO handle
|
||||
@param bio BIO handle to destroy
|
||||
*/
|
||||
void bio_destroy(opj_bio_t *bio);
|
||||
/**
|
||||
Number of bytes written.
|
||||
@param bio BIO handle
|
||||
@return Returns the number of bytes written
|
||||
*/
|
||||
int bio_numbytes(opj_bio_t *bio);
|
||||
/**
|
||||
Init encoder
|
||||
@param bio BIO handle
|
||||
@param bp Output buffer
|
||||
@param len Output buffer length
|
||||
*/
|
||||
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len);
|
||||
/**
|
||||
Init decoder
|
||||
@param bio BIO handle
|
||||
@param bp Input buffer
|
||||
@param len Input buffer length
|
||||
*/
|
||||
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len);
|
||||
/**
|
||||
Write bits
|
||||
@param bio BIO handle
|
||||
@param v Value of bits
|
||||
@param n Number of bits to write
|
||||
*/
|
||||
void bio_write(opj_bio_t *bio, int v, int n);
|
||||
/**
|
||||
Read bits
|
||||
@param bio BIO handle
|
||||
@param n Number of bits to read
|
||||
@return Returns the corresponding read number
|
||||
*/
|
||||
int bio_read(opj_bio_t *bio, int n);
|
||||
/**
|
||||
Flush bits
|
||||
@param bio BIO handle
|
||||
@return Returns 1 if successful, returns 0 otherwise
|
||||
*/
|
||||
int bio_flush(opj_bio_t *bio);
|
||||
/**
|
||||
Passes the ending bits (coming from flushing)
|
||||
@param bio BIO handle
|
||||
@return Returns 1 if successful, returns 0 otherwise
|
||||
*/
|
||||
int bio_inalign(opj_bio_t *bio);
|
||||
/**
|
||||
Read a bit
|
||||
@param bio BIO handle
|
||||
@return Returns the read bit
|
||||
*/
|
||||
/* MOD antonin */
|
||||
//int bio_getbit(opj_bio_t *bio);
|
||||
/* DOM */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __BIO_H */
|
||||
|
440
src/lib/openjp3d/cio.c → libopenjp3d/cio.c
Normal file → Executable file
440
src/lib/openjp3d/cio.c → libopenjp3d/cio.c
Normal file → Executable file
@ -1,223 +1,217 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length) {
|
||||
opj_cp_t *cp = NULL;
|
||||
opj_cio_t *cio = (opj_cio_t*)opj_malloc(sizeof(opj_cio_t));
|
||||
if(!cio) return NULL;
|
||||
cio->cinfo = cinfo;
|
||||
if(buffer && length) {
|
||||
/* wrap a user buffer containing the encoded image */
|
||||
cio->openmode = OPJ_STREAM_READ;
|
||||
cio->buffer = buffer;
|
||||
cio->length = length;
|
||||
}
|
||||
else if(!buffer && !length && cinfo) {
|
||||
/* allocate a buffer for the encoded image */
|
||||
cio->openmode = OPJ_STREAM_WRITE;
|
||||
switch(cinfo->codec_format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
cp = ((opj_j3d_t*)cinfo->j3d_handle)->cp;
|
||||
break;
|
||||
default:
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
cio->length = cp->tdx * cp->tdy * cp->tdz * cp->tw * cp->th * cp->tl * 4;
|
||||
cio->buffer = (unsigned char *)opj_malloc(cio->length);
|
||||
if(!cio->buffer) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "Error allocating memory for compressed bitstream\n");
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize byte IO */
|
||||
cio->start = cio->buffer;
|
||||
cio->end = cio->buffer + cio->length;
|
||||
cio->bp = cio->buffer;
|
||||
|
||||
return cio;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio) {
|
||||
if(cio) {
|
||||
if(cio->openmode == OPJ_STREAM_WRITE) {
|
||||
/* destroy the allocated buffer */
|
||||
opj_free(cio->buffer);
|
||||
}
|
||||
/* destroy the cio */
|
||||
opj_free(cio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Get position in byte stream.
|
||||
*/
|
||||
int OPJ_CALLCONV cio_tell(opj_cio_t *cio) {
|
||||
return cio->bp - cio->start;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set position in byte stream.
|
||||
*
|
||||
* pos : position, in number of bytes, from the beginning of the stream
|
||||
*/
|
||||
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos) {
|
||||
cio->bp = cio->start + pos;
|
||||
}
|
||||
|
||||
/*
|
||||
* Number of bytes left before the end of the stream.
|
||||
*/
|
||||
int cio_numbytesleft(opj_cio_t *cio) {
|
||||
return cio->end - cio->bp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get pointer to the current position in the stream.
|
||||
*/
|
||||
unsigned char *cio_getbp(opj_cio_t *cio) {
|
||||
return cio->bp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a byte.
|
||||
*/
|
||||
static bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
||||
if (cio->bp >= cio->end) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
||||
return false;
|
||||
}
|
||||
*cio->bp++ = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read a byte.
|
||||
*/
|
||||
static unsigned char cio_bytein(opj_cio_t *cio) {
|
||||
if (cio->bp >= cio->end) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "read error\n");
|
||||
return 0;
|
||||
}
|
||||
return *cio->bp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write some bytes.
|
||||
*
|
||||
* v : value to write
|
||||
* n : number of bytes to write
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
|
||||
return 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read some bytes.
|
||||
*
|
||||
* n : number of bytes to read
|
||||
*
|
||||
* return : value of the n bytes read
|
||||
*/
|
||||
unsigned int cio_read(opj_cio_t *cio, int n) {
|
||||
int i;
|
||||
unsigned int v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += cio_bytein(cio) << (i << 3);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip some bytes.
|
||||
*
|
||||
* n : number of bytes to skip
|
||||
*/
|
||||
void cio_skip(opj_cio_t *cio, int n) {
|
||||
cio->bp += n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write some bytes.
|
||||
*
|
||||
* v : value to write
|
||||
* n : number of bytes to write
|
||||
*/
|
||||
int cio_write_int(opj_cio_t *cio, int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
if( !cio_byteout(cio, (char) ((v >> (i << 3)) & 0xff)) )
|
||||
return 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read some bytes.
|
||||
*
|
||||
* n : number of bytes to read
|
||||
*
|
||||
* return : value of the n bytes read
|
||||
*/
|
||||
int cio_read_int(opj_cio_t *cio, int n) {
|
||||
int i;
|
||||
int v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += cio_bytein(cio) << (i << 3);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length) {
|
||||
opj_cp_t *cp = NULL;
|
||||
opj_cio_t *cio = (opj_cio_t*)opj_malloc(sizeof(opj_cio_t));
|
||||
if(!cio) return NULL;
|
||||
cio->cinfo = cinfo;
|
||||
if(buffer && length) {
|
||||
/* wrap a user buffer containing the encoded image */
|
||||
cio->openmode = OPJ_STREAM_READ;
|
||||
cio->buffer = buffer;
|
||||
cio->length = length;
|
||||
}
|
||||
else if(!buffer && !length && cinfo) {
|
||||
/* allocate a buffer for the encoded image */
|
||||
cio->openmode = OPJ_STREAM_WRITE;
|
||||
switch(cinfo->codec_format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
cp = ((opj_j3d_t*)cinfo->j3d_handle)->cp;
|
||||
break;
|
||||
default:
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
cio->length = cp->tdx * cp->tdy * cp->tdz * cp->tw * cp->th * cp->tl * 4;
|
||||
cio->buffer = (unsigned char *)opj_malloc(cio->length);
|
||||
if(!cio->buffer) {
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
opj_free(cio);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize byte IO */
|
||||
cio->start = cio->buffer;
|
||||
cio->end = cio->buffer + cio->length;
|
||||
cio->bp = cio->buffer;
|
||||
|
||||
return cio;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio) {
|
||||
if(cio) {
|
||||
if(cio->openmode == OPJ_STREAM_WRITE) {
|
||||
/* destroy the allocated buffer */
|
||||
opj_free(cio->buffer);
|
||||
}
|
||||
/* destroy the cio */
|
||||
opj_free(cio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Get position in byte stream.
|
||||
*/
|
||||
int OPJ_CALLCONV cio_tell(opj_cio_t *cio) {
|
||||
return cio->bp - cio->start;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set position in byte stream.
|
||||
*
|
||||
* pos : position, in number of bytes, from the beginning of the stream
|
||||
*/
|
||||
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos) {
|
||||
cio->bp = cio->start + pos;
|
||||
}
|
||||
|
||||
/*
|
||||
* Number of bytes left before the end of the stream.
|
||||
*/
|
||||
int cio_numbytesleft(opj_cio_t *cio) {
|
||||
return cio->end - cio->bp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get pointer to the current position in the stream.
|
||||
*/
|
||||
unsigned char *cio_getbp(opj_cio_t *cio) {
|
||||
return cio->bp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a byte.
|
||||
*/
|
||||
bool cio_byteout(opj_cio_t *cio, unsigned char v) {
|
||||
if (cio->bp >= cio->end) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "write error\n");
|
||||
return false;
|
||||
}
|
||||
*cio->bp++ = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read a byte.
|
||||
*/
|
||||
unsigned char cio_bytein(opj_cio_t *cio) {
|
||||
if (cio->bp >= cio->end) {
|
||||
opj_event_msg(cio->cinfo, EVT_ERROR, "read error\n");
|
||||
return 0;
|
||||
}
|
||||
return *cio->bp++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write some bytes.
|
||||
*
|
||||
* v : value to write
|
||||
* n : number of bytes to write
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
|
||||
return 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read some bytes.
|
||||
*
|
||||
* n : number of bytes to read
|
||||
*
|
||||
* return : value of the n bytes read
|
||||
*/
|
||||
unsigned int cio_read(opj_cio_t *cio, int n) {
|
||||
int i;
|
||||
unsigned int v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += cio_bytein(cio) << (i << 3);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip some bytes.
|
||||
*
|
||||
* n : number of bytes to skip
|
||||
*/
|
||||
void cio_skip(opj_cio_t *cio, int n) {
|
||||
cio->bp += n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write some bytes.
|
||||
*
|
||||
* v : value to write
|
||||
* n : number of bytes to write
|
||||
*/
|
||||
int cio_write_int(opj_cio_t *cio, int v, int n) {
|
||||
int i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
if( !cio_byteout(cio, (char) ((v >> (i << 3)) & 0xff)) )
|
||||
return 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read some bytes.
|
||||
*
|
||||
* n : number of bytes to read
|
||||
*
|
||||
* return : value of the n bytes read
|
||||
*/
|
||||
int cio_read_int(opj_cio_t *cio, int n) {
|
||||
int i;
|
||||
int v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
v += cio_bytein(cio) << (i << 3);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
205
src/lib/openjp3d/cio.h → libopenjp3d/cio.h
Normal file → Executable file
205
src/lib/openjp3d/cio.h → libopenjp3d/cio.h
Normal file → Executable file
@ -1,105 +1,100 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __CIO_H
|
||||
#define __CIO_H
|
||||
/**
|
||||
@file cio.h
|
||||
@brief Implementation of a byte input-output process (CIO)
|
||||
|
||||
The functions in CIO.C have for goal to realize a byte input / output process.
|
||||
*/
|
||||
|
||||
/** @defgroup CIO CIO - byte input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales (see also openjp3d.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Number of bytes left before the end of the stream
|
||||
@param cio CIO handle
|
||||
@return Returns the number of bytes before the end of the stream
|
||||
*/
|
||||
int cio_numbytesleft(opj_cio_t *cio);
|
||||
/**
|
||||
Get pointer to the current position in the stream
|
||||
@param cio CIO handle
|
||||
@return Returns a pointer to the current position
|
||||
*/
|
||||
unsigned char *cio_getbp(opj_cio_t *cio);
|
||||
/**
|
||||
Write some bytes
|
||||
@param cio CIO handle
|
||||
@param v Value to write
|
||||
@param n Number of bytes to write
|
||||
@return Returns the number of bytes written or 0 if an error occurred
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n);
|
||||
/**
|
||||
Read some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to read
|
||||
@return Returns the value of the n bytes read
|
||||
*/
|
||||
unsigned int cio_read(opj_cio_t *cio, int n);
|
||||
/**
|
||||
Skip some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to skip
|
||||
*/
|
||||
void cio_skip(opj_cio_t *cio, int n);
|
||||
/**
|
||||
Write some bytes
|
||||
@param cio CIO handle
|
||||
@param v Signed integer value to write
|
||||
@param n Number of bytes to write
|
||||
@return Returns the number of bytes written or 0 if an error occurred
|
||||
*/
|
||||
int cio_write_int(opj_cio_t *cio, int v, int n);
|
||||
/**
|
||||
Read some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to read
|
||||
@return Returns the value of the n bytes read
|
||||
*/
|
||||
int cio_read_int(opj_cio_t *cio, int n);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __CIO_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __CIO_H
|
||||
#define __CIO_H
|
||||
/**
|
||||
@file cio.h
|
||||
@brief Implementation of a byte input-output process (CIO)
|
||||
|
||||
The functions in CIO.C have for goal to realize a byte input / output process.
|
||||
*/
|
||||
|
||||
/** @defgroup CIO CIO - byte input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales (see also openjp3d.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Number of bytes left before the end of the stream
|
||||
@param cio CIO handle
|
||||
@return Returns the number of bytes before the end of the stream
|
||||
*/
|
||||
int cio_numbytesleft(opj_cio_t *cio);
|
||||
/**
|
||||
Get pointer to the current position in the stream
|
||||
@param cio CIO handle
|
||||
@return Returns a pointer to the current position
|
||||
*/
|
||||
unsigned char *cio_getbp(opj_cio_t *cio);
|
||||
/**
|
||||
Write some bytes
|
||||
@param cio CIO handle
|
||||
@param v Value to write
|
||||
@param n Number of bytes to write
|
||||
@return Returns the number of bytes written or 0 if an error occured
|
||||
*/
|
||||
unsigned int cio_write(opj_cio_t *cio, unsigned int v, int n);
|
||||
/**
|
||||
Read some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to read
|
||||
@return Returns the value of the n bytes read
|
||||
*/
|
||||
unsigned int cio_read(opj_cio_t *cio, int n);
|
||||
/**
|
||||
Skip some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to skip
|
||||
*/
|
||||
void cio_skip(opj_cio_t *cio, int n);
|
||||
/**
|
||||
Write some bytes
|
||||
@param cio CIO handle
|
||||
@param v Signed integer value to write
|
||||
@param n Number of bytes to write
|
||||
@return Returns the number of bytes written or 0 if an error occured
|
||||
*/
|
||||
int cio_write_int(opj_cio_t *cio, int v, int n);
|
||||
/**
|
||||
Read some bytes
|
||||
@param cio CIO handle
|
||||
@param n Number of bytes to read
|
||||
@return Returns the value of the n bytes read
|
||||
*/
|
||||
int cio_read_int(opj_cio_t *cio, int n);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __CIO_H */
|
||||
|
89
src/lib/openjp3d/dwt.c → libopenjp3d/dwt.c
Normal file → Executable file
89
src/lib/openjp3d/dwt.c → libopenjp3d/dwt.c
Normal file → Executable file
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
@ -63,7 +58,7 @@
|
||||
|
||||
/** @name Local static functions */
|
||||
/*@{*/
|
||||
/*unsigned int ops;*/
|
||||
unsigned int ops;
|
||||
/**
|
||||
Forward lazy transform (horizontal)
|
||||
*/
|
||||
@ -89,12 +84,12 @@ Inverse lazy transform (axial)
|
||||
*/
|
||||
static void dwt_interleave_z(int *a, int *b, int dn, int sn, int xy, int cas);
|
||||
/**
|
||||
Forward 5-3 wavelet transform in 1-D
|
||||
Forward 5-3 wavelet tranform in 1-D
|
||||
*/
|
||||
static void dwt_encode_53(int *a, int dn, int sn, int cas);
|
||||
static void dwt_encode_97(int *a, int dn, int sn, int cas);
|
||||
/**
|
||||
Inverse 5-3 wavelet transform in 1-D
|
||||
Inverse 5-3 wavelet tranform in 1-D
|
||||
*/
|
||||
static void dwt_decode_53(int *a, int dn, int sn, int cas);
|
||||
static void dwt_decode_97(int *a, int dn, int sn, int cas);
|
||||
@ -333,22 +328,22 @@ static void dwt_interleave_z(int *a, int *b, int dn, int sn, int xy, int cas) {
|
||||
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 5-3 or 9-7 wavelet transform in 1-D. */
|
||||
/* Forward 5-3 or 9-7 wavelet tranform in 1-D. */
|
||||
/* </summary> */
|
||||
static void dwt_encode_53(int *a, int dn, int sn, int cas) {
|
||||
int i;
|
||||
|
||||
if (!cas) {
|
||||
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
|
||||
/*for (i = 0; i < dn; i++) D(i) -= (S_(i) + S_(i + 1)) >> 1;*/
|
||||
/*for (i = 0; i < sn; i++) S(i) += (D_(i - 1) + D_(i) + 2) >> 2;*/
|
||||
//for (i = 0; i < dn; i++) D(i) -= (S_(i) + S_(i + 1)) >> 1;
|
||||
//for (i = 0; i < sn; i++) S(i) += (D_(i - 1) + D_(i) + 2) >> 2;
|
||||
for (i = 0; i < dn; i++){
|
||||
D(i) -= (S_(i) + S_(i + 1)) >> 1;
|
||||
/*ops += 2;*/
|
||||
//ops += 2;
|
||||
}
|
||||
for (i = 0; i < sn; i++){
|
||||
S(i) += (D_(i - 1) + D_(i) + 2) >> 2;
|
||||
/*ops += 3;*/
|
||||
//ops += 3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -360,15 +355,15 @@ static void dwt_encode_53(int *a, int dn, int sn, int cas) {
|
||||
}*/
|
||||
if (!sn && dn == 1){
|
||||
S(0) *= 2;
|
||||
/*ops++;*/
|
||||
//ops++;
|
||||
} else {
|
||||
for (i = 0; i < dn; i++){
|
||||
S(i) -= (DD_(i) + DD_(i - 1)) >> 1;
|
||||
/* ops += 2;*/
|
||||
// ops += 2;
|
||||
}
|
||||
for (i = 0; i < sn; i++){
|
||||
D(i) += (SS_(i) + SS_(i + 1) + 2) >> 2;
|
||||
/* ops += 3;*/
|
||||
// ops += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -409,7 +404,7 @@ static void dwt_encode_97(int *a, int dn, int sn, int cas) {
|
||||
}
|
||||
}
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 or 9-7 wavelet transform in 1-D. */
|
||||
/* Inverse 5-3 or 9-7 wavelet tranform in 1-D. */
|
||||
/* </summary> */
|
||||
static void dwt_decode_53(int *a, int dn, int sn, int cas) {
|
||||
int i;
|
||||
@ -471,17 +466,17 @@ static int upandconv(double *nXPS, double *LPS, int lenXPS, int lenLPS) {
|
||||
/* Perform the convolution of the vectors. */
|
||||
int i,j;
|
||||
double *tmp = (double *)opj_malloc(2*lenXPS * sizeof(double));
|
||||
/*Upsample*/
|
||||
//Upsample
|
||||
memset(tmp, 0, 2*lenXPS*sizeof(double));
|
||||
for (i = 0; i < lenXPS; i++) {
|
||||
*(tmp + 2*i) = *(nXPS + i);
|
||||
*(nXPS + i) = 0;
|
||||
}
|
||||
/*Convolution*/
|
||||
//Convolution
|
||||
for (i = 0; i < 2*lenXPS; i++) {
|
||||
for (j = 0; j < lenLPS; j++) {
|
||||
*(nXPS+i+j) = *(nXPS+i+j) + *(tmp + i) * *(LPS + j);
|
||||
/*fprintf(stdout,"*(tmp + %d) * *(LPS + %d) = %f * %f \n",i,j,*(tmp + i),*(LPS + j));*/
|
||||
//fprintf(stdout,"*(tmp + %d) * *(LPS + %d) = %f * %f \n",i,j,*(tmp + i),*(LPS + j));
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
@ -498,7 +493,7 @@ static double dwt_calc_wtnorms(int orient, int level[3], int dwtid[3], opj_wtfil
|
||||
levely = (orient == 0) ? level[1]-1 : level[1];
|
||||
levelz = (orient == 0) ? level[2]-1 : level[2];
|
||||
|
||||
/*X axis*/
|
||||
//X axis
|
||||
lenLPS = wtfiltX->lenLPS;
|
||||
lenHPS = wtfiltX->lenHPS;
|
||||
for (i = 0; i < levelx; i++) {
|
||||
@ -527,7 +522,7 @@ static double dwt_calc_wtnorms(int orient, int level[3], int dwtid[3], opj_wtfil
|
||||
free(nLPSx);
|
||||
free(nHPSx);
|
||||
|
||||
/*Y axis*/
|
||||
//Y axis
|
||||
if (dwtid[0] != dwtid[1] || level[0] != level[1]){
|
||||
lenLPS = wtfiltY->lenLPS;
|
||||
lenHPS = wtfiltY->lenHPS;
|
||||
@ -560,7 +555,7 @@ static double dwt_calc_wtnorms(int orient, int level[3], int dwtid[3], opj_wtfil
|
||||
Ly = Lx;
|
||||
Hy = Hx;
|
||||
}
|
||||
/*Z axis*/
|
||||
//Z axis
|
||||
if (levelz >= 0) {
|
||||
lenLPS = wtfiltZ->lenLPS;
|
||||
lenHPS = wtfiltZ->lenHPS;
|
||||
@ -615,7 +610,7 @@ static double dwt_calc_wtnorms(int orient, int level[3], int dwtid[3], opj_wtfil
|
||||
|
||||
}
|
||||
static void dwt_getwtfilters(opj_wtfilt_t *wtfilt, int dwtid) {
|
||||
if (dwtid == 0) { /*DWT 9-7 */
|
||||
if (dwtid == 0) { //DWT 9-7
|
||||
wtfilt->lenLPS = 7; wtfilt->lenHPS = 9;
|
||||
wtfilt->LPS = (double *)opj_malloc(wtfilt->lenLPS * sizeof(double));
|
||||
wtfilt->HPS = (double *)opj_malloc(wtfilt->lenHPS * sizeof(double));
|
||||
@ -628,7 +623,7 @@ static void dwt_getwtfilters(opj_wtfilt_t *wtfilt, int dwtid) {
|
||||
wtfilt->LPS[6] = -0.091271763114; wtfilt->HPS[6] = -0.078223266529;
|
||||
wtfilt->HPS[7] = 0.016864118443;
|
||||
wtfilt->HPS[8] = 0.026748757411;
|
||||
} else if (dwtid == 1) { /*DWT 5-3 */
|
||||
} else if (dwtid == 1) { //DWT 5-3
|
||||
wtfilt->lenLPS = 3; wtfilt->lenHPS = 5;
|
||||
wtfilt->LPS = (double *)opj_malloc(wtfilt->lenLPS * sizeof(double));
|
||||
wtfilt->HPS = (double *)opj_malloc(wtfilt->lenHPS * sizeof(double));
|
||||
@ -651,8 +646,8 @@ static void dwt_encode_stepsize(int stepsize, int numbps, opj_stepsize_t *bandno
|
||||
n = 11 - int_floorlog2(stepsize);
|
||||
bandno_stepsize->mant = (n < 0 ? stepsize >> -n : stepsize << n) & 0x7ff;
|
||||
bandno_stepsize->expn = numbps - p;
|
||||
/*if J3D_CCP_QNTSTY_NOQNT --> stepsize = 8192.0 --> p = 0, n = -2 --> mant = 0; expn = (prec+gain)*/
|
||||
/*else --> bandno_stepsize = (1<<(numbps - expn)) + (1<<(numbps - expn - 11)) * Ub*/
|
||||
//if J3D_CCP_QNTSTY_NOQNT --> stepsize = 8192.0 --> p = 0, n = -2 --> mant = 0; expn = (prec+gain)
|
||||
//else --> bandno_stepsize = (1<<(numbps - expn)) + (1<<(numbps - expn - 11)) * Ub
|
||||
}
|
||||
|
||||
/*
|
||||
@ -661,7 +656,7 @@ static void dwt_encode_stepsize(int stepsize, int numbps, opj_stepsize_t *bandno
|
||||
==========================================================
|
||||
*/
|
||||
/* <summary> */
|
||||
/* Forward 5-3 wavelet transform in 3-D. */
|
||||
/* Forward 5-3 wavelet tranform in 3-D. */
|
||||
/* </summary> */
|
||||
void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
int i, j, k;
|
||||
@ -673,7 +668,7 @@ void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
int *bj = NULL;
|
||||
int *cj = NULL;
|
||||
|
||||
/*ops = 0;*/
|
||||
ops = 0;
|
||||
|
||||
memset(flagnorm,0,8000*sizeof(int));
|
||||
w = tilec->x1-tilec->x0;
|
||||
@ -720,7 +715,7 @@ void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
|
||||
cj = a + (i * wh);
|
||||
|
||||
/*Horizontal*/
|
||||
//Horizontal
|
||||
sn = rw1;
|
||||
dn = rw - rw1;
|
||||
bj = (int*)opj_malloc(rw * sizeof(int));
|
||||
@ -741,7 +736,7 @@ void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
}
|
||||
opj_free(bj);
|
||||
|
||||
/*Vertical*/
|
||||
//Vertical
|
||||
sn = rh1;
|
||||
dn = rh - rh1;
|
||||
bj = (int*)opj_malloc(rh * sizeof(int));
|
||||
@ -764,7 +759,7 @@ void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
}
|
||||
|
||||
if (z < levelz){
|
||||
/*Axial fprintf(stdout,"Axial DWT Transform %d %d %d\n",z,rd,rd1);*/
|
||||
//Axial fprintf(stdout,"Axial DWT Transform %d %d %d\n",z,rd,rd1);
|
||||
sn = rd1;
|
||||
dn = rd - rd1;
|
||||
bj = (int*)opj_malloc(rd * sizeof(int));
|
||||
@ -787,12 +782,12 @@ void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]) {
|
||||
}
|
||||
}
|
||||
|
||||
/*fprintf(stdout,"[INFO] Ops: %d \n",ops);*/
|
||||
//fprintf(stdout,"[INFO] Ops: %d \n",ops);
|
||||
}
|
||||
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 3-D. */
|
||||
/* Inverse 5-3 wavelet tranform in 3-D. */
|
||||
/* </summary> */
|
||||
void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]) {
|
||||
int i, j, k;
|
||||
@ -847,7 +842,7 @@ void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]) {
|
||||
fprintf(stdout,"IDWT Transform %d %d %d %d\n",level, z, rd,rd1);*/
|
||||
|
||||
if (z >= stops[2] && rd != rd1) {
|
||||
/*fprintf(stdout,"Axial Transform %d %d %d %d\n",levelz, z, rd,rd1);*/
|
||||
//fprintf(stdout,"Axial Transform %d %d %d %d\n",levelz, z, rd,rd1);
|
||||
sn = rd1;
|
||||
dn = rd - rd1;
|
||||
bj = (int*)opj_malloc(rd * sizeof(int));
|
||||
@ -870,10 +865,10 @@ void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]) {
|
||||
}
|
||||
|
||||
for (i = 0; i < rd; i++) {
|
||||
/*Fetch corresponding slice for doing DWT-2D*/
|
||||
//Fetch corresponding slice for doing DWT-2D
|
||||
cj = tilec->data + (i * wh);
|
||||
|
||||
/*Vertical*/
|
||||
//Vertical
|
||||
sn = rh1;
|
||||
dn = rh - rh1;
|
||||
bj = (int*)opj_malloc(rh * sizeof(int));
|
||||
@ -894,7 +889,7 @@ void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]) {
|
||||
}
|
||||
opj_free(bj);
|
||||
|
||||
/*Horizontal*/
|
||||
//Horizontal
|
||||
sn = rw1;
|
||||
dn = rw - rw1;
|
||||
bj = (int*)opj_malloc(rw * sizeof(int));
|
||||
@ -936,7 +931,7 @@ int dwt_getgain(int orient, int reversible) {
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
/*else if (reversible == 0){*/
|
||||
//else if (reversible == 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -951,25 +946,25 @@ double dwt_getnorm(int orient, int level[3], int dwtid[3]) {
|
||||
|
||||
if (flagnorm[levelx][levely][levelz][orient] == 1) {
|
||||
norm = dwt_norm[levelx][levely][levelz][orient];
|
||||
/*fprintf(stdout,"[INFO] Level: %d %d %d Orient %d Dwt_norm: %f \n",level[0],level[1],level[2],orient,norm);*/
|
||||
//fprintf(stdout,"[INFO] Level: %d %d %d Orient %d Dwt_norm: %f \n",level[0],level[1],level[2],orient,norm);
|
||||
} else {
|
||||
opj_wtfilt_t *wtfiltx =(opj_wtfilt_t *) opj_malloc(sizeof(opj_wtfilt_t));
|
||||
opj_wtfilt_t *wtfilty =(opj_wtfilt_t *) opj_malloc(sizeof(opj_wtfilt_t));
|
||||
opj_wtfilt_t *wtfiltz =(opj_wtfilt_t *) opj_malloc(sizeof(opj_wtfilt_t));
|
||||
/*Fetch equivalent filters for each dimension*/
|
||||
//Fetch equivalent filters for each dimension
|
||||
dwt_getwtfilters(wtfiltx, dwtid[0]);
|
||||
dwt_getwtfilters(wtfilty, dwtid[1]);
|
||||
dwt_getwtfilters(wtfiltz, dwtid[2]);
|
||||
/*Calculate the corresponding norm */
|
||||
//Calculate the corresponding norm
|
||||
norm = dwt_calc_wtnorms(orient, level, dwtid, wtfiltx, wtfilty, wtfiltz);
|
||||
/*Save norm in array (no recalculation)*/
|
||||
//Save norm in array (no recalculation)
|
||||
dwt_norm[levelx][levely][levelz][orient] = norm;
|
||||
flagnorm[levelx][levely][levelz][orient] = 1;
|
||||
/*Free reserved space*/
|
||||
//Free reserved space
|
||||
opj_free(wtfiltx->LPS); opj_free(wtfilty->LPS); opj_free(wtfiltz->LPS);
|
||||
opj_free(wtfiltx->HPS); opj_free(wtfilty->HPS); opj_free(wtfiltz->HPS);
|
||||
opj_free(wtfiltx); opj_free(wtfilty); opj_free(wtfiltz);
|
||||
/*fprintf(stdout,"[INFO] Dwtid: %d %d %d Level: %d %d %d Orient %d Norm: %f \n",dwtid[0],dwtid[1],dwtid[2],level[0],level[1],level[2],orient,norm);*/
|
||||
//fprintf(stdout,"[INFO] Dwtid: %d %d %d Level: %d %d %d Orient %d Norm: %f \n",dwtid[0],dwtid[1],dwtid[2],level[0],level[1],level[2],orient,norm);
|
||||
}
|
||||
return norm;
|
||||
}
|
||||
@ -1009,10 +1004,10 @@ void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec) {
|
||||
if (tccp->qntsty == J3D_CCP_QNTSTY_NOQNT) {
|
||||
stepsize = 1.0;
|
||||
} else {
|
||||
double norm = dwt_getnorm(orient,level,tccp->dwtid); /*Fetch norms if irreversible transform (by the moment only I9.7)*/
|
||||
double norm = dwt_getnorm(orient,level,tccp->dwtid); //Fetch norms if irreversible transform (by the moment only I9.7)
|
||||
stepsize = (1 << (gain + 1)) / norm;
|
||||
}
|
||||
/*fprintf(stdout,"[INFO] Bandno: %d Orient: %d Level: %d %d %d Stepsize: %f\n",bandno,orient,level[0],level[1],level[2],stepsize);*/
|
||||
//fprintf(stdout,"[INFO] Bandno: %d Orient: %d Level: %d %d %d Stepsize: %f\n",bandno,orient,level[0],level[1],level[2],stepsize);
|
||||
dwt_encode_stepsize((int) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
|
||||
}
|
||||
}
|
206
src/lib/openjp3d/dwt.h → libopenjp3d/dwt.h
Normal file → Executable file
206
src/lib/openjp3d/dwt.h → libopenjp3d/dwt.h
Normal file → Executable file
@ -1,106 +1,100 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyrigth (c) 2006, Mónica Díez, LPI-UVA, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __DWT_H
|
||||
#define __DWT_H
|
||||
/**
|
||||
@file dwt.h
|
||||
@brief Implementation of a discrete wavelet transform (DWT)
|
||||
|
||||
The functions in DWT.C have for goal to realize forward and inverse discret wavelet
|
||||
transform with filter 5-3 (reversible) and filter 9-7 (irreversible). The functions in
|
||||
DWT.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup DWT DWT - Implementation of a discrete wavelet transform */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
DCCS-LIWT properties
|
||||
*/
|
||||
|
||||
|
||||
typedef struct opj_wtfilt {
|
||||
double *LPS;
|
||||
int lenLPS;
|
||||
double *HPS;
|
||||
int lenHPS;
|
||||
} opj_wtfilt_t;
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Forward 5-3 wavelet transform in 3-D.
|
||||
Apply a reversible DWT transform to a component of an volume.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param dwtid Number of identification of wavelet kernel(s) used in DWT in each direction
|
||||
*/
|
||||
void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]);
|
||||
/**
|
||||
Inverse 5-3 wavelet transform in 3-D.
|
||||
Apply a reversible inverse DWT transform to a component of an volume.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param stops Number of decoded resolution levels in each dimension
|
||||
@param dwtid Number of identification of wavelet kernel(s) used in DWT in each dimension
|
||||
*/
|
||||
void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Get the gain of a subband for the reversible 3-D DWT.
|
||||
@param orient Number that identifies the subband (0->LLL, 1->HLL, 2->LHL, 3->HHL, 4->LLH, 5->HLH, 6->LHH, 7->HHH)
|
||||
@param reversible Wavelet transformation type
|
||||
@return Returns 0 if orient = 0, returns 1 if orient = 1,2 or 4, returns 2 if orient = 3,5 or 6, returns 3 otherwise
|
||||
*/
|
||||
int dwt_getgain(int orient, int reversible);
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT or irreversible 9-7 in 3-D.
|
||||
@param orient Band of the wavelet function
|
||||
@param level Levels of the wavelet function in X,Y,Z axis
|
||||
@param dwtid Wavelet transformation identifier
|
||||
@return Returns the norm of the wavelet function
|
||||
*/
|
||||
double dwt_getnorm(int orient, int level[3], int dwtid[3]);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Calcula el valor del escalón de cuantificación correspondiente a cada subbanda.
|
||||
@param tccp Tile component coding parameters
|
||||
@param prec Precision of data
|
||||
*/
|
||||
void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec);
|
||||
/*@}*/
|
||||
/*@}*/
|
||||
|
||||
#endif /* __DWT_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyrigth (c) 2006, Mónica Díez, LPI-UVA, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __DWT_H
|
||||
#define __DWT_H
|
||||
/**
|
||||
@file dwt.h
|
||||
@brief Implementation of a discrete wavelet transform (DWT)
|
||||
|
||||
The functions in DWT.C have for goal to realize forward and inverse discret wavelet
|
||||
transform with filter 5-3 (reversible) and filter 9-7 (irreversible). The functions in
|
||||
DWT.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup DWT DWT - Implementation of a discrete wavelet transform */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
DCCS-LIWT properties
|
||||
*/
|
||||
|
||||
|
||||
typedef struct opj_wtfilt {
|
||||
double *LPS;
|
||||
int lenLPS;
|
||||
double *HPS;
|
||||
int lenHPS;
|
||||
} opj_wtfilt_t;
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Forward 5-3 wavelet tranform in 3-D.
|
||||
Apply a reversible DWT transform to a component of an volume.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param dwtid Number of identification of wavelet kernel(s) used in DWT in each direction
|
||||
*/
|
||||
void dwt_encode(opj_tcd_tilecomp_t * tilec, int dwtid[3]);
|
||||
/**
|
||||
Inverse 5-3 wavelet tranform in 3-D.
|
||||
Apply a reversible inverse DWT transform to a component of an volume.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param stops Number of decoded resolution levels in each dimension
|
||||
@param dwtid Number of identification of wavelet kernel(s) used in DWT in each dimension
|
||||
*/
|
||||
void dwt_decode(opj_tcd_tilecomp_t * tilec, int stops[3], int dwtid[3]);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Get the gain of a subband for the reversible 3-D DWT.
|
||||
@param orient Number that identifies the subband (0->LLL, 1->HLL, 2->LHL, 3->HHL, 4->LLH, 5->HLH, 6->LHH, 7->HHH)
|
||||
@param reversible Wavelet transformation type
|
||||
@return Returns 0 if orient = 0, returns 1 if orient = 1,2 or 4, returns 2 if orient = 3,5 or 6, returns 3 otherwise
|
||||
*/
|
||||
int dwt_getgain(int orient, int reversible);
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT or irreversible 9-7 in 3-D.
|
||||
@param orient Band of the wavelet function
|
||||
@param level Levels of the wavelet function in X,Y,Z axis
|
||||
@param dwtid Wavelet transformation identifier
|
||||
@return Returns the norm of the wavelet function
|
||||
*/
|
||||
double dwt_getnorm(int orient, int level[3], int dwtid[3]);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Calcula el valor del escalón de cuantificación correspondiente a cada subbanda.
|
||||
@param tccp Tile component coding parameters
|
||||
@param prec Precision of data
|
||||
*/
|
||||
void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec);
|
||||
/*@}*/
|
||||
|
||||
#endif /* __DWT_H */
|
367
src/lib/openjp3d/event.c → libopenjp3d/event.c
Normal file → Executable file
367
src/lib/openjp3d/event.c → libopenjp3d/event.c
Normal file → Executable file
@ -1,186 +1,181 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ==========================================================
|
||||
// Utility functions
|
||||
// ==========================================================*/
|
||||
|
||||
#ifndef _WIN32
|
||||
static char*
|
||||
i2a(unsigned i, char *a, unsigned r) {
|
||||
if (i/r > 0) a = i2a(i/r,a,r);
|
||||
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i%r];
|
||||
return a+1;
|
||||
}
|
||||
|
||||
/**
|
||||
Transforms integer i into an ascii string and stores the result in a;
|
||||
string is encoded in the base indicated by r.
|
||||
@param i Number to be converted
|
||||
@param a String result
|
||||
@param r Base of value; must be in the range 2 - 36
|
||||
@return Returns a
|
||||
*/
|
||||
static char *
|
||||
_itoa(int i, char *a, int r) {
|
||||
r = ((r < 2) || (r > 36)) ? 10 : r;
|
||||
if(i < 0) {
|
||||
*a = '-';
|
||||
*i2a(-i, a+1, r) = 0;
|
||||
}
|
||||
else *i2a(i, a, r) = 0;
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
|
||||
if(cinfo) {
|
||||
opj_event_mgr_t *previous = cinfo->event_mgr;
|
||||
cinfo->event_mgr = event_mgr;
|
||||
cinfo->client_data = context;
|
||||
return previous;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||
opj_msg_callback msg_handler = NULL;
|
||||
|
||||
opj_event_mgr_t *event_mgr = cinfo->event_mgr;
|
||||
if(event_mgr != NULL) {
|
||||
switch(event_type) {
|
||||
case EVT_ERROR:
|
||||
msg_handler = event_mgr->error_handler;
|
||||
break;
|
||||
case EVT_WARNING:
|
||||
msg_handler = event_mgr->warning_handler;
|
||||
break;
|
||||
case EVT_INFO:
|
||||
msg_handler = event_mgr->info_handler;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(msg_handler == NULL) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((fmt != NULL) && (event_mgr != NULL)) {
|
||||
va_list arg;
|
||||
int str_length, i, j;
|
||||
char message[MSG_SIZE];
|
||||
memset(message, 0, MSG_SIZE);
|
||||
/* initialize the optional parameter list */
|
||||
va_start(arg, fmt);
|
||||
/* check the length of the format string */
|
||||
str_length = (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt);
|
||||
/* parse the format string and put the result in 'message' */
|
||||
for (i = 0, j = 0; i < str_length; ++i) {
|
||||
if (fmt[i] == '%') {
|
||||
if (i + 1 < str_length) {
|
||||
switch(tolower(fmt[i + 1])) {
|
||||
case '%' :
|
||||
message[j++] = '%';
|
||||
break;
|
||||
case 'o' : /* octal numbers */
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 8);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'i' : /* decimal numbers */
|
||||
case 'd' :
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 10);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'x' : /* hexadecimal numbers */
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 16);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 's' : /* strings */
|
||||
{
|
||||
char *tmp = va_arg(arg, char*);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'f' : /* floats */
|
||||
{
|
||||
char tmp[16];
|
||||
double value = va_arg(arg, double);
|
||||
sprintf(tmp, "%f", value);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
message[j++] = fmt[i];
|
||||
}
|
||||
} else {
|
||||
message[j++] = fmt[i];
|
||||
};
|
||||
}
|
||||
/* deinitialize the optional parameter list */
|
||||
va_end(arg);
|
||||
|
||||
/* output the message to the user program */
|
||||
msg_handler(message, cinfo->client_data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
// ==========================================================
|
||||
// Utility functions
|
||||
// ==========================================================
|
||||
|
||||
#ifndef _WIN32
|
||||
static char*
|
||||
i2a(unsigned i, char *a, unsigned r) {
|
||||
if (i/r > 0) a = i2a(i/r,a,r);
|
||||
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i%r];
|
||||
return a+1;
|
||||
}
|
||||
|
||||
/**
|
||||
Transforms integer i into an ascii string and stores the result in a;
|
||||
string is encoded in the base indicated by r.
|
||||
@param i Number to be converted
|
||||
@param a String result
|
||||
@param r Base of value; must be in the range 2 - 36
|
||||
@return Returns a
|
||||
*/
|
||||
static char *
|
||||
_itoa(int i, char *a, int r) {
|
||||
r = ((r < 2) || (r > 36)) ? 10 : r;
|
||||
if(i < 0) {
|
||||
*a = '-';
|
||||
*i2a(-i, a+1, r) = 0;
|
||||
}
|
||||
else *i2a(i, a, r) = 0;
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif // !_WIN32
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
|
||||
if(cinfo) {
|
||||
opj_event_mgr_t *previous = cinfo->event_mgr;
|
||||
cinfo->event_mgr = event_mgr;
|
||||
cinfo->client_data = context;
|
||||
return previous;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...) {
|
||||
#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||
opj_msg_callback msg_handler = NULL;
|
||||
|
||||
opj_event_mgr_t *event_mgr = cinfo->event_mgr;
|
||||
if(event_mgr != NULL) {
|
||||
switch(event_type) {
|
||||
case EVT_ERROR:
|
||||
msg_handler = event_mgr->error_handler;
|
||||
break;
|
||||
case EVT_WARNING:
|
||||
msg_handler = event_mgr->warning_handler;
|
||||
break;
|
||||
case EVT_INFO:
|
||||
msg_handler = event_mgr->info_handler;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(msg_handler == NULL) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((fmt != NULL) && (event_mgr != NULL)) {
|
||||
va_list arg;
|
||||
int str_length, i, j;
|
||||
char message[MSG_SIZE];
|
||||
memset(message, 0, MSG_SIZE);
|
||||
/* initialize the optional parameter list */
|
||||
va_start(arg, fmt);
|
||||
/* check the length of the format string */
|
||||
str_length = (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt);
|
||||
/* parse the format string and put the result in 'message' */
|
||||
for (i = 0, j = 0; i < str_length; ++i) {
|
||||
if (fmt[i] == '%') {
|
||||
if (i + 1 < str_length) {
|
||||
switch(tolower(fmt[i + 1])) {
|
||||
case '%' :
|
||||
message[j++] = '%';
|
||||
break;
|
||||
case 'o' : /* octal numbers */
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 8);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'i' : /* decimal numbers */
|
||||
case 'd' :
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 10);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'x' : /* hexadecimal numbers */
|
||||
{
|
||||
char tmp[16];
|
||||
_itoa(va_arg(arg, int), tmp, 16);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 's' : /* strings */
|
||||
{
|
||||
char *tmp = va_arg(arg, char*);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
case 'f' : /* floats */
|
||||
{
|
||||
char tmp[16];
|
||||
double value = va_arg(arg, double);
|
||||
sprintf(tmp, "%f", value);
|
||||
strcat(message, tmp);
|
||||
j += strlen(tmp);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
message[j++] = fmt[i];
|
||||
}
|
||||
} else {
|
||||
message[j++] = fmt[i];
|
||||
};
|
||||
}
|
||||
/* deinitialize the optional parameter list */
|
||||
va_end(arg);
|
||||
|
||||
/* output the message to the user program */
|
||||
msg_handler(message, cinfo->client_data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
121
src/lib/openjp3d/event.h → libopenjp3d/event.h
Normal file → Executable file
121
src/lib/openjp3d/event.h → libopenjp3d/event.h
Normal file → Executable file
@ -1,63 +1,58 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __EVENT_H
|
||||
#define __EVENT_H
|
||||
/**
|
||||
@file event.h
|
||||
@brief Implementation of a event callback system
|
||||
|
||||
The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user.
|
||||
*/
|
||||
|
||||
#define EVT_ERROR 1 /**< Error event type */
|
||||
#define EVT_WARNING 2 /**< Warning event type */
|
||||
#define EVT_INFO 4 /**< Debug event type */
|
||||
|
||||
/** @defgroup EVENT EVENT - Implementation of a event callback system */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales (see also openjp3d.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Write formatted data to a string and send the string to a user callback.
|
||||
@param cinfo Codec context info
|
||||
@param event_type Event type or callback to use to send the message
|
||||
@param fmt Format-control string (plus optionnal arguments)
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __EVENT_H */
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __EVENT_H
|
||||
#define __EVENT_H
|
||||
/**
|
||||
@file event.h
|
||||
@brief Implementation of a event callback system
|
||||
|
||||
The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user.
|
||||
*/
|
||||
|
||||
#define EVT_ERROR 1 /**< Error event type */
|
||||
#define EVT_WARNING 2 /**< Warning event type */
|
||||
#define EVT_INFO 4 /**< Debug event type */
|
||||
|
||||
/** @defgroup EVENT EVENT - Implementation of a event callback system */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales (see also openjp3d.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Write formatted data to a string and send the string to a user callback.
|
||||
@param cinfo Codec context info
|
||||
@param event_type Event type or callback to use to send the message
|
||||
@param fmt Format-control string (plus optionnal arguments)
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __EVENT_H */
|
5
src/lib/openjp3d/fix.h → libopenjp3d/fix.h
Normal file → Executable file
5
src/lib/openjp3d/fix.h → libopenjp3d/fix.h
Normal file → Executable file
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
5
src/lib/openjp3d/int.h → libopenjp3d/int.h
Normal file → Executable file
5
src/lib/openjp3d/int.h → libopenjp3d/int.h
Normal file → Executable file
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
4689
src/lib/openjp3d/jp3d.c → libopenjp3d/jp3d.c
Normal file → Executable file
4689
src/lib/openjp3d/jp3d.c → libopenjp3d/jp3d.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
1041
src/lib/openjp3d/jp3d.h → libopenjp3d/jp3d.h
Normal file → Executable file
1041
src/lib/openjp3d/jp3d.h → libopenjp3d/jp3d.h
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
157
src/lib/openjp3d/jp3d_lib.c → libopenjp3d/jp3d_lib.c
Normal file → Executable file
157
src/lib/openjp3d/jp3d_lib.c → libopenjp3d/jp3d_lib.c
Normal file → Executable file
@ -1,81 +1,76 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/times.h>
|
||||
#endif /* _WIN32 */
|
||||
#include "opj_includes.h"
|
||||
|
||||
double opj_clock() {
|
||||
#ifdef _WIN32
|
||||
/* WIN32: use QueryPerformance (very accurate) */
|
||||
LARGE_INTEGER freq , t ;
|
||||
/* freq is the clock speed of the CPU */
|
||||
QueryPerformanceFrequency(&freq) ;
|
||||
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
||||
/* t is the high resolution performance counter (see MSDN) */
|
||||
QueryPerformanceCounter ( & t ) ;
|
||||
return ( t.QuadPart /(double) freq.QuadPart ) ;
|
||||
#else
|
||||
/* Unix or Linux: use resource usage */
|
||||
struct rusage t;
|
||||
double procTime;
|
||||
/* (1) Get the rusage data structure at this moment (man getrusage) */
|
||||
getrusage(0,&t);
|
||||
/* (2) What is the elapsed time ? - CPU time = User time + System time */
|
||||
/* (2a) Get the seconds */
|
||||
procTime = t.ru_utime.tv_sec + t.ru_stime.tv_sec;
|
||||
/* (2b) More precisely! Get the microseconds part ! */
|
||||
return ( procTime + (t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ;
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
void* opj_malloc( size_t size ) {
|
||||
void *memblock = malloc(size);
|
||||
if(memblock) {
|
||||
memset(memblock, 0, size);
|
||||
}
|
||||
return memblock;
|
||||
}
|
||||
|
||||
void* opj_realloc( void *memblock, size_t size ) {
|
||||
return realloc(memblock, size);
|
||||
}
|
||||
|
||||
void opj_free( void *memblock ) {
|
||||
free(memblock);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/times.h>
|
||||
#endif /* _WIN32 */
|
||||
#include "opj_includes.h"
|
||||
|
||||
double opj_clock() {
|
||||
#ifdef _WIN32
|
||||
/* WIN32: use QueryPerformance (very accurate) */
|
||||
LARGE_INTEGER freq , t ;
|
||||
/* freq is the clock speed of the CPU */
|
||||
QueryPerformanceFrequency(&freq) ;
|
||||
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
||||
/* t is the high resolution performance counter (see MSDN) */
|
||||
QueryPerformanceCounter ( & t ) ;
|
||||
return ( t.QuadPart /(double) freq.QuadPart ) ;
|
||||
#else
|
||||
/* Unix or Linux: use resource usage */
|
||||
struct rusage t;
|
||||
double procTime;
|
||||
/* (1) Get the rusage data structure at this moment (man getrusage) */
|
||||
getrusage(0,&t);
|
||||
/* (2) What is the elapsed time ? - CPU time = User time + System time */
|
||||
/* (2a) Get the seconds */
|
||||
procTime = t.ru_utime.tv_sec + t.ru_stime.tv_sec;
|
||||
/* (2b) More precisely! Get the microseconds part ! */
|
||||
return ( procTime + (t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ;
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
void* opj_malloc( size_t size ) {
|
||||
void *memblock = malloc(size);
|
||||
if(memblock) {
|
||||
memset(memblock, 0, size);
|
||||
}
|
||||
return memblock;
|
||||
}
|
||||
|
||||
void* opj_realloc( void *memblock, size_t size ) {
|
||||
return realloc(memblock, size);
|
||||
}
|
||||
|
||||
void opj_free( void *memblock ) {
|
||||
free(memblock);
|
||||
}
|
||||
|
||||
|
155
src/lib/openjp3d/jp3d_lib.h → libopenjp3d/jp3d_lib.h
Normal file → Executable file
155
src/lib/openjp3d/jp3d_lib.h → libopenjp3d/jp3d_lib.h
Normal file → Executable file
@ -1,80 +1,75 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __J3D_LIB_H
|
||||
#define __J3D_LIB_H
|
||||
/**
|
||||
@file jp3d_lib.h
|
||||
@brief Internal functions
|
||||
|
||||
The functions in JP3D_LIB.C are internal utilities mainly used for memory management.
|
||||
*/
|
||||
|
||||
/** @defgroup MISC MISC - Miscellaneous internal functions */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Difference in successive opj_clock() calls tells you the elapsed time
|
||||
@return Returns time in seconds
|
||||
*/
|
||||
double opj_clock(void);
|
||||
|
||||
/**
|
||||
Allocate a memory block with elements initialized to 0
|
||||
@param size Bytes to allocate
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
void* opj_malloc( size_t size );
|
||||
|
||||
/**
|
||||
Reallocate memory blocks.
|
||||
@param memblock Pointer to previously allocated memory block
|
||||
@param size New size in bytes
|
||||
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
||||
*/
|
||||
void* opj_realloc( void *memblock, size_t size );
|
||||
|
||||
/**
|
||||
Deallocates or frees a memory block.
|
||||
@param memblock Previously allocated memory block to be freed
|
||||
*/
|
||||
void opj_free( void *memblock );
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __J3D_LIB_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __J3D_LIB_H
|
||||
#define __J3D_LIB_H
|
||||
/**
|
||||
@file jp3d_lib.h
|
||||
@brief Internal functions
|
||||
|
||||
The functions in JP3D_LIB.C are internal utilities mainly used for memory management.
|
||||
*/
|
||||
|
||||
/** @defgroup MISC MISC - Miscellaneous internal functions */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Difference in successive opj_clock() calls tells you the elapsed time
|
||||
@return Returns time in seconds
|
||||
*/
|
||||
double opj_clock();
|
||||
|
||||
/**
|
||||
Allocate a memory block with elements initialized to 0
|
||||
@param size Bytes to allocate
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
void* opj_malloc( size_t size );
|
||||
|
||||
/**
|
||||
Reallocate memory blocks.
|
||||
@param memblock Pointer to previously allocated memory block
|
||||
@param size New size in bytes
|
||||
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
||||
*/
|
||||
void* opj_realloc( void *memblock, size_t size );
|
||||
|
||||
/**
|
||||
Deallocates or frees a memory block.
|
||||
@param memblock Previously allocated memory block to be freed
|
||||
*/
|
||||
void opj_free( void *memblock );
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __J3D_LIB_H */
|
||||
|
267
src/lib/openjp3d/mct.c → libopenjp3d/mct.c
Normal file → Executable file
267
src/lib/openjp3d/mct.c → libopenjp3d/mct.c
Normal file → Executable file
@ -1,136 +1,131 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* <summary> */
|
||||
/* This table contains the norms of the basis function of the reversible MCT. */
|
||||
/* </summary> */
|
||||
static const double mct_norms[3] = { 1.732, .8292, .8292 };
|
||||
|
||||
/* <summary> */
|
||||
/* This table contains the norms of the basis function of the irreversible MCT. */
|
||||
/* </summary> */
|
||||
static const double mct_norms_real[3] = { 1.732, 1.805, 1.573 };
|
||||
|
||||
/* <summary> */
|
||||
/* Forward reversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_encode(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int r, g, b, y, u, v;
|
||||
r = c0[i];
|
||||
g = c1[i];
|
||||
b = c2[i];
|
||||
y = (r + (g << 1) + b) >> 2;
|
||||
u = b - g;
|
||||
v = r - g;
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse reversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_decode(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int y, u, v, r, g, b;
|
||||
y = c0[i];
|
||||
u = c1[i];
|
||||
v = c2[i];
|
||||
g = y - ((u + v) >> 2);
|
||||
r = v + g;
|
||||
b = u + g;
|
||||
c0[i] = r;
|
||||
c1[i] = g;
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get norm of basis function of reversible MCT. */
|
||||
/* </summary> */
|
||||
double mct_getnorm(int compno) {
|
||||
return mct_norms[compno];
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Forward irreversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_encode_real(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int r, g, b, y, u, v;
|
||||
r = c0[i];
|
||||
g = c1[i];
|
||||
b = c2[i];
|
||||
y = fix_mul(r, 2449) + fix_mul(g, 4809) + fix_mul(b, 934);
|
||||
u = -fix_mul(r, 1382) - fix_mul(g, 2714) + fix_mul(b, 4096);
|
||||
v = fix_mul(r, 4096) - fix_mul(g, 3430) - fix_mul(b, 666);
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse irreversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_decode_real(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int y, u, v, r, g, b;
|
||||
y = c0[i];
|
||||
u = c1[i];
|
||||
v = c2[i];
|
||||
r = y + fix_mul(v, 11485);
|
||||
g = y - fix_mul(u, 2819) - fix_mul(v, 5850);
|
||||
b = y + fix_mul(u, 14516);
|
||||
c0[i] = r;
|
||||
c1[i] = g;
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get norm of basis function of irreversible MCT. */
|
||||
/* </summary> */
|
||||
double mct_getnorm_real(int compno) {
|
||||
return mct_norms_real[compno];
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* <summary> */
|
||||
/* This table contains the norms of the basis function of the reversible MCT. */
|
||||
/* </summary> */
|
||||
static const double mct_norms[3] = { 1.732, .8292, .8292 };
|
||||
|
||||
/* <summary> */
|
||||
/* This table contains the norms of the basis function of the irreversible MCT. */
|
||||
/* </summary> */
|
||||
static const double mct_norms_real[3] = { 1.732, 1.805, 1.573 };
|
||||
|
||||
/* <summary> */
|
||||
/* Foward reversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_encode(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int r, g, b, y, u, v;
|
||||
r = c0[i];
|
||||
g = c1[i];
|
||||
b = c2[i];
|
||||
y = (r + (g << 1) + b) >> 2;
|
||||
u = b - g;
|
||||
v = r - g;
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse reversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_decode(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int y, u, v, r, g, b;
|
||||
y = c0[i];
|
||||
u = c1[i];
|
||||
v = c2[i];
|
||||
g = y - ((u + v) >> 2);
|
||||
r = v + g;
|
||||
b = u + g;
|
||||
c0[i] = r;
|
||||
c1[i] = g;
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get norm of basis function of reversible MCT. */
|
||||
/* </summary> */
|
||||
double mct_getnorm(int compno) {
|
||||
return mct_norms[compno];
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Foward irreversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_encode_real(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int r, g, b, y, u, v;
|
||||
r = c0[i];
|
||||
g = c1[i];
|
||||
b = c2[i];
|
||||
y = fix_mul(r, 2449) + fix_mul(g, 4809) + fix_mul(b, 934);
|
||||
u = -fix_mul(r, 1382) - fix_mul(g, 2714) + fix_mul(b, 4096);
|
||||
v = fix_mul(r, 4096) - fix_mul(g, 3430) - fix_mul(b, 666);
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse irreversible MCT. */
|
||||
/* </summary> */
|
||||
void mct_decode_real(int *c0, int *c1, int *c2, int n) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int y, u, v, r, g, b;
|
||||
y = c0[i];
|
||||
u = c1[i];
|
||||
v = c2[i];
|
||||
r = y + fix_mul(v, 11485);
|
||||
g = y - fix_mul(u, 2819) - fix_mul(v, 5850);
|
||||
b = y + fix_mul(u, 14516);
|
||||
c0[i] = r;
|
||||
c1[i] = g;
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get norm of basis function of irreversible MCT. */
|
||||
/* </summary> */
|
||||
double mct_getnorm_real(int compno) {
|
||||
return mct_norms_real[compno];
|
||||
}
|
199
src/lib/openjp3d/mct.h → libopenjp3d/mct.h
Normal file → Executable file
199
src/lib/openjp3d/mct.h → libopenjp3d/mct.h
Normal file → Executable file
@ -1,102 +1,97 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MCT_H
|
||||
#define __MCT_H
|
||||
/**
|
||||
@file mct.h
|
||||
@brief Implementation of a multi-component transforms (MCT)
|
||||
|
||||
The functions in MCT.C have for goal to realize reversible and irreversible multicomponent
|
||||
transform. The functions in MCT.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup MCT MCT - Implementation of a multi-component transform */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Apply a reversible multi-component transform to an image
|
||||
@param c0 Samples for red component
|
||||
@param c1 Samples for green component
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_encode(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Apply a reversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@param c1 Samples for red chrominance component
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_decode(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Get norm of the basis function used for the reversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
@return
|
||||
*/
|
||||
double mct_getnorm(int compno);
|
||||
|
||||
/**
|
||||
Apply an irreversible multi-component transform to an image
|
||||
@param c0 Samples for red component
|
||||
@param c1 Samples for green component
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_encode_real(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Apply an irreversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@param c1 Samples for red chrominance component
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_decode_real(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Get norm of the basis function used for the irreversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
@return
|
||||
*/
|
||||
double mct_getnorm_real(int compno);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __MCT_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MCT_H
|
||||
#define __MCT_H
|
||||
/**
|
||||
@file mct.h
|
||||
@brief Implementation of a multi-component transforms (MCT)
|
||||
|
||||
The functions in MCT.C have for goal to realize reversible and irreversible multicomponent
|
||||
transform. The functions in MCT.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup MCT MCT - Implementation of a multi-component transform */
|
||||
/*@{*/
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Apply a reversible multi-component transform to an image
|
||||
@param c0 Samples for red component
|
||||
@param c1 Samples for green component
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_encode(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Apply a reversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@param c1 Samples for red chrominance component
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_decode(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Get norm of the basis function used for the reversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
@return
|
||||
*/
|
||||
double mct_getnorm(int compno);
|
||||
|
||||
/**
|
||||
Apply an irreversible multi-component transform to an image
|
||||
@param c0 Samples for red component
|
||||
@param c1 Samples for green component
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_encode_real(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Apply an irreversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@param c1 Samples for red chrominance component
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void mct_decode_real(int *c0, int *c1, int *c2, int n);
|
||||
/**
|
||||
Get norm of the basis function used for the irreversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
@return
|
||||
*/
|
||||
double mct_getnorm_real(int compno);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __MCT_H */
|
1101
src/lib/openjp3d/mqc.c → libopenjp3d/mqc.c
Normal file → Executable file
1101
src/lib/openjp3d/mqc.c → libopenjp3d/mqc.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
407
src/lib/openjp3d/mqc.h → libopenjp3d/mqc.h
Normal file → Executable file
407
src/lib/openjp3d/mqc.h → libopenjp3d/mqc.h
Normal file → Executable file
@ -1,206 +1,201 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MQC_H
|
||||
#define __MQC_H
|
||||
/**
|
||||
@file mqc.h
|
||||
@brief Implementation of an MQ-Coder (MQC)
|
||||
|
||||
The functions in MQC.C have for goal to realize the MQ-coder operations. The functions
|
||||
in MQC.C are used by some function in T1.C.
|
||||
*/
|
||||
|
||||
/** @defgroup MQC MQC - Implementation of an MQ-Coder */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
This struct defines the state of a context.
|
||||
*/
|
||||
typedef struct opj_mqc_state {
|
||||
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
|
||||
unsigned int qeval;
|
||||
/** the Most Probable Symbol (0 or 1) */
|
||||
int mps;
|
||||
/** next state if the next encoded symbol is the MPS */
|
||||
struct opj_mqc_state *nmps;
|
||||
/** next state if the next encoded symbol is the LPS */
|
||||
struct opj_mqc_state *nlps;
|
||||
} opj_mqc_state_t;
|
||||
|
||||
#define MQC_NUMCTXS 32
|
||||
|
||||
/**
|
||||
MQ coder
|
||||
*/
|
||||
typedef struct opj_mqc {
|
||||
unsigned int c;
|
||||
unsigned int a;
|
||||
unsigned int ct;
|
||||
unsigned char *bp;
|
||||
unsigned char *start;
|
||||
unsigned char *end;
|
||||
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
|
||||
opj_mqc_state_t **curctx;
|
||||
} opj_mqc_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new MQC handle
|
||||
@return Returns a new MQC handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_mqc_t* mqc_create(void);
|
||||
/**
|
||||
Destroy a previously created MQC handle
|
||||
@param mqc MQC handle to destroy
|
||||
*/
|
||||
void mqc_destroy(opj_mqc_t *mqc);
|
||||
/**
|
||||
Return the number of bytes written/read since initialisation
|
||||
@param mqc MQC handle
|
||||
@return Returns the number of bytes already encoded
|
||||
*/
|
||||
int mqc_numbytes(opj_mqc_t *mqc);
|
||||
/**
|
||||
Reset the states of all the context of the coder/decoder
|
||||
(each context is set to a state where 0 and 1 are more or less equiprobable)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_resetstates(opj_mqc_t *mqc);
|
||||
/**
|
||||
Set the state of a particular context
|
||||
@param mqc MQC handle
|
||||
@param ctxno Number that identifies the context
|
||||
@param msb The MSB of the new state of the context
|
||||
@param prob Number that identifies the probability of the symbols for the new state of the context
|
||||
*/
|
||||
void mqc_setstate(opj_mqc_t *mqc, int ctxno, int msb, int prob);
|
||||
/**
|
||||
Initialize the encoder
|
||||
@param mqc MQC handle
|
||||
@param bp Pointer to the start of the buffer where the bytes will be written
|
||||
*/
|
||||
void mqc_init_enc(opj_mqc_t *mqc, unsigned char *bp);
|
||||
/**
|
||||
Set the current context used for coding/decoding
|
||||
@param mqc MQC handle
|
||||
@param ctxno Number that identifies the context
|
||||
*/
|
||||
void mqc_setcurctx(opj_mqc_t *mqc, int ctxno);
|
||||
/**
|
||||
Encode a symbol using the MQ-coder
|
||||
@param mqc MQC handle
|
||||
@param d The symbol to be encoded (0 or 1)
|
||||
*/
|
||||
void mqc_encode(opj_mqc_t *mqc, int d);
|
||||
/**
|
||||
Flush the encoder, so that all remaining data is written
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_flush(opj_mqc_t *mqc);
|
||||
/**
|
||||
BYPASS mode switch, initialization operation.
|
||||
JPEG 2000 p 505.
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_bypass_init_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
BYPASS mode switch, coding operation.
|
||||
JPEG 2000 p 505.
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
@param d The symbol to be encoded (0 or 1)
|
||||
*/
|
||||
void mqc_bypass_enc(opj_mqc_t *mqc, int d);
|
||||
/**
|
||||
BYPASS mode switch, flush operation
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
@return Returns 1 (always)
|
||||
*/
|
||||
int mqc_bypass_flush_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESET mode switch
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_reset_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESET mode switch
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_reset_enc_3(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESTART mode switch (TERMALL)
|
||||
@param mqc MQC handle
|
||||
@return Returns 1 (always)
|
||||
*/
|
||||
int mqc_restart_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESTART mode switch (TERMALL) reinitialisation
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_restart_init_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
ERTERM mode switch (PTERM)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_erterm_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
SEGMARK mode switch (SEGSYM)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_segmark_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
Initialize the decoder
|
||||
@param mqc MQC handle
|
||||
@param bp Pointer to the start of the buffer from which the bytes will be read
|
||||
@param len Length of the input buffer
|
||||
*/
|
||||
void mqc_init_dec(opj_mqc_t *mqc, unsigned char *bp, int len);
|
||||
/**
|
||||
Decode a symbol
|
||||
@param mqc MQC handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
int mqc_decode(opj_mqc_t *mqc);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __MQC_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MQC_H
|
||||
#define __MQC_H
|
||||
/**
|
||||
@file mqc.h
|
||||
@brief Implementation of an MQ-Coder (MQC)
|
||||
|
||||
The functions in MQC.C have for goal to realize the MQ-coder operations. The functions
|
||||
in MQC.C are used by some function in T1.C.
|
||||
*/
|
||||
|
||||
/** @defgroup MQC MQC - Implementation of an MQ-Coder */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
This struct defines the state of a context.
|
||||
*/
|
||||
typedef struct opj_mqc_state {
|
||||
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
|
||||
unsigned int qeval;
|
||||
/** the Most Probable Symbol (0 or 1) */
|
||||
int mps;
|
||||
/** next state if the next encoded symbol is the MPS */
|
||||
struct opj_mqc_state *nmps;
|
||||
/** next state if the next encoded symbol is the LPS */
|
||||
struct opj_mqc_state *nlps;
|
||||
} opj_mqc_state_t;
|
||||
|
||||
#define MQC_NUMCTXS 32
|
||||
|
||||
/**
|
||||
MQ coder
|
||||
*/
|
||||
typedef struct opj_mqc {
|
||||
unsigned int c;
|
||||
unsigned int a;
|
||||
unsigned int ct;
|
||||
unsigned char *bp;
|
||||
unsigned char *start;
|
||||
unsigned char *end;
|
||||
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
|
||||
opj_mqc_state_t **curctx;
|
||||
} opj_mqc_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new MQC handle
|
||||
@return Returns a new MQC handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_mqc_t* mqc_create();
|
||||
/**
|
||||
Destroy a previously created MQC handle
|
||||
@param mqc MQC handle to destroy
|
||||
*/
|
||||
void mqc_destroy(opj_mqc_t *mqc);
|
||||
/**
|
||||
Return the number of bytes written/read since initialisation
|
||||
@param mqc MQC handle
|
||||
@return Returns the number of bytes already encoded
|
||||
*/
|
||||
int mqc_numbytes(opj_mqc_t *mqc);
|
||||
/**
|
||||
Reset the states of all the context of the coder/decoder
|
||||
(each context is set to a state where 0 and 1 are more or less equiprobable)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_resetstates(opj_mqc_t *mqc);
|
||||
/**
|
||||
Set the state of a particular context
|
||||
@param mqc MQC handle
|
||||
@param ctxno Number that identifies the context
|
||||
@param msb The MSB of the new state of the context
|
||||
@param prob Number that identifies the probability of the symbols for the new state of the context
|
||||
*/
|
||||
void mqc_setstate(opj_mqc_t *mqc, int ctxno, int msb, int prob);
|
||||
/**
|
||||
Initialize the encoder
|
||||
@param mqc MQC handle
|
||||
@param bp Pointer to the start of the buffer where the bytes will be written
|
||||
*/
|
||||
void mqc_init_enc(opj_mqc_t *mqc, unsigned char *bp);
|
||||
/**
|
||||
Set the current context used for coding/decoding
|
||||
@param mqc MQC handle
|
||||
@param ctxno Number that identifies the context
|
||||
*/
|
||||
void mqc_setcurctx(opj_mqc_t *mqc, int ctxno);
|
||||
/**
|
||||
Encode a symbol using the MQ-coder
|
||||
@param mqc MQC handle
|
||||
@param d The symbol to be encoded (0 or 1)
|
||||
*/
|
||||
void mqc_encode(opj_mqc_t *mqc, int d);
|
||||
/**
|
||||
Flush the encoder, so that all remaining data is written
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_flush(opj_mqc_t *mqc);
|
||||
/**
|
||||
BYPASS mode switch, initialization operation.
|
||||
JPEG 2000 p 505.
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_bypass_init_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
BYPASS mode switch, coding operation.
|
||||
JPEG 2000 p 505.
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
@param d The symbol to be encoded (0 or 1)
|
||||
*/
|
||||
void mqc_bypass_enc(opj_mqc_t *mqc, int d);
|
||||
/**
|
||||
BYPASS mode switch, flush operation
|
||||
<h2>Not fully implemented and tested !!</h2>
|
||||
@param mqc MQC handle
|
||||
@return Returns 1 (always)
|
||||
*/
|
||||
int mqc_bypass_flush_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESET mode switch
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_reset_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESET mode switch
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_reset_enc_3(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESTART mode switch (TERMALL)
|
||||
@param mqc MQC handle
|
||||
@return Returns 1 (always)
|
||||
*/
|
||||
int mqc_restart_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
RESTART mode switch (TERMALL) reinitialisation
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_restart_init_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
ERTERM mode switch (PTERM)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_erterm_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
SEGMARK mode switch (SEGSYM)
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
void mqc_segmark_enc(opj_mqc_t *mqc);
|
||||
/**
|
||||
Initialize the decoder
|
||||
@param mqc MQC handle
|
||||
@param bp Pointer to the start of the buffer from which the bytes will be read
|
||||
@param len Length of the input buffer
|
||||
*/
|
||||
void mqc_init_dec(opj_mqc_t *mqc, unsigned char *bp, int len);
|
||||
/**
|
||||
Decode a symbol
|
||||
@param mqc MQC handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
int mqc_decode(opj_mqc_t *mqc);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __MQC_H */
|
420
src/lib/openjp3d/openjp3d.c → libopenjp3d/openjp3d.c
Normal file → Executable file
420
src/lib/openjp3d/openjp3d.c → libopenjp3d/openjp3d.c
Normal file → Executable file
@ -1,213 +1,207 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_includes.h"
|
||||
#include "openjp3d.h"
|
||||
#define JP3D_VERSION "1.3.0"
|
||||
/* ---------------------------------------------------------------------- */
|
||||
#ifdef _WIN32
|
||||
#ifndef OPJ_STATIC
|
||||
BOOL APIENTRY
|
||||
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH :
|
||||
break;
|
||||
case DLL_PROCESS_DETACH :
|
||||
break;
|
||||
case DLL_THREAD_ATTACH :
|
||||
case DLL_THREAD_DETACH :
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* OPJ_STATIC */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
const char* OPJ_CALLCONV opj_version() {
|
||||
return JP3D_VERSION;
|
||||
}
|
||||
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
||||
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_malloc(sizeof(opj_dinfo_t));
|
||||
if(!dinfo) return NULL;
|
||||
dinfo->is_decompressor = true;
|
||||
switch(format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
/* get a J3D decoder handle */
|
||||
dinfo->j3d_handle = (void*)j3d_create_decompress((opj_common_ptr)dinfo);
|
||||
if(!dinfo->j3d_handle) {
|
||||
opj_free(dinfo);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opj_free(dinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dinfo->codec_format = format;
|
||||
|
||||
return dinfo;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo) {
|
||||
if(dinfo) {
|
||||
/* destroy the codec */
|
||||
if(dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_destroy_decompress((opj_j3d_t*)dinfo->j3d_handle);
|
||||
}
|
||||
/* destroy the decompressor */
|
||||
opj_free(dinfo);
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters) {
|
||||
if(parameters) {
|
||||
memset(parameters, 0, sizeof(opj_dparameters_t));
|
||||
/* default decoding parameters */
|
||||
parameters->cp_layer = 0;
|
||||
parameters->cp_reduce[0] = 0;
|
||||
parameters->cp_reduce[1] = 0;
|
||||
parameters->cp_reduce[2] = 0;
|
||||
parameters->bigendian = 0;
|
||||
|
||||
parameters->decod_format = -1;
|
||||
parameters->cod_format = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) {
|
||||
if(dinfo && parameters) {
|
||||
if (dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_setup_decoder((opj_j3d_t*)dinfo->j3d_handle, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
opj_volume_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) {
|
||||
if(dinfo && cio) {
|
||||
if (dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
return j3d_decode((opj_j3d_t*)dinfo->j3d_handle, cio);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
||||
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_malloc(sizeof(opj_cinfo_t));
|
||||
if(!cinfo) return NULL;
|
||||
cinfo->is_decompressor = false;
|
||||
switch(format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
/* get a J3D coder handle */
|
||||
cinfo->j3d_handle = (void*)j3d_create_compress((opj_common_ptr)cinfo);
|
||||
if(!cinfo->j3d_handle) {
|
||||
opj_free(cinfo);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opj_free(cinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cinfo->codec_format = format;
|
||||
|
||||
return cinfo;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo) {
|
||||
if(cinfo) {
|
||||
/* destroy the codec */
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_destroy_compress((opj_j3d_t*)cinfo->j3d_handle);
|
||||
}
|
||||
/* destroy the decompressor */
|
||||
opj_free(cinfo);
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters) {
|
||||
if(parameters) {
|
||||
memset(parameters, 0, sizeof(opj_cparameters_t));
|
||||
/* default coding parameters */
|
||||
parameters->numresolution[0] = 3;
|
||||
parameters->numresolution[1] = 3;
|
||||
parameters->numresolution[2] = 1;
|
||||
parameters->cblock_init[0] = 64;
|
||||
parameters->cblock_init[1] = 64;
|
||||
parameters->cblock_init[2] = 64;
|
||||
parameters->prog_order = LRCP;
|
||||
parameters->roi_compno = -1; /* no ROI */
|
||||
parameters->atk_wt[0] = 1; /* 5-3 WT */
|
||||
parameters->atk_wt[1] = 1; /* 5-3 WT */
|
||||
parameters->atk_wt[2] = 1; /* 5-3 WT */
|
||||
parameters->irreversible = 0;
|
||||
parameters->subsampling_dx = 1;
|
||||
parameters->subsampling_dy = 1;
|
||||
parameters->subsampling_dz = 1;
|
||||
|
||||
parameters->decod_format = -1;
|
||||
parameters->cod_format = -1;
|
||||
parameters->encoding_format = ENCOD_2EB;
|
||||
parameters->transform_format = TRF_2D_DWT;
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_volume_t *volume) {
|
||||
if(cinfo && parameters && volume) {
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_setup_encoder((opj_j3d_t*)cinfo->j3d_handle, parameters, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_volume_t *volume, char *index) {
|
||||
if(cinfo && cio && volume) {
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
return j3d_encode((opj_j3d_t*)cinfo->j3d_handle, cio, volume, index);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_includes.h"
|
||||
#define JP3D_VERSION "1.3.0"
|
||||
/* ---------------------------------------------------------------------- */
|
||||
#ifdef _WIN32
|
||||
#ifndef OPJ_STATIC
|
||||
BOOL APIENTRY
|
||||
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH :
|
||||
break;
|
||||
case DLL_PROCESS_DETACH :
|
||||
break;
|
||||
case DLL_THREAD_ATTACH :
|
||||
case DLL_THREAD_DETACH :
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* OPJ_STATIC */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
const char* OPJ_CALLCONV opj_version() {
|
||||
return JP3D_VERSION;
|
||||
}
|
||||
opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) {
|
||||
opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_malloc(sizeof(opj_dinfo_t));
|
||||
if(!dinfo) return NULL;
|
||||
dinfo->is_decompressor = true;
|
||||
switch(format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
/* get a J3D decoder handle */
|
||||
dinfo->j3d_handle = (void*)j3d_create_decompress((opj_common_ptr)dinfo);
|
||||
if(!dinfo->j3d_handle) {
|
||||
opj_free(dinfo);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opj_free(dinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dinfo->codec_format = format;
|
||||
|
||||
return dinfo;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo) {
|
||||
if(dinfo) {
|
||||
/* destroy the codec */
|
||||
if(dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_destroy_decompress((opj_j3d_t*)dinfo->j3d_handle);
|
||||
}
|
||||
/* destroy the decompressor */
|
||||
opj_free(dinfo);
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters) {
|
||||
if(parameters) {
|
||||
memset(parameters, 0, sizeof(opj_dparameters_t));
|
||||
/* default decoding parameters */
|
||||
parameters->cp_layer = 0;
|
||||
parameters->cp_reduce[0] = 0;
|
||||
parameters->cp_reduce[1] = 0;
|
||||
parameters->cp_reduce[2] = 0;
|
||||
parameters->bigendian = 0;
|
||||
|
||||
parameters->decod_format = -1;
|
||||
parameters->cod_format = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) {
|
||||
if(dinfo && parameters) {
|
||||
if (dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_setup_decoder((opj_j3d_t*)dinfo->j3d_handle, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
opj_volume_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) {
|
||||
if(dinfo && cio) {
|
||||
if (dinfo->codec_format != CODEC_UNKNOWN) {
|
||||
return j3d_decode((opj_j3d_t*)dinfo->j3d_handle, cio);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) {
|
||||
opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_malloc(sizeof(opj_cinfo_t));
|
||||
if(!cinfo) return NULL;
|
||||
cinfo->is_decompressor = false;
|
||||
switch(format) {
|
||||
case CODEC_J3D:
|
||||
case CODEC_J2K:
|
||||
/* get a J3D coder handle */
|
||||
cinfo->j3d_handle = (void*)j3d_create_compress((opj_common_ptr)cinfo);
|
||||
if(!cinfo->j3d_handle) {
|
||||
opj_free(cinfo);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opj_free(cinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cinfo->codec_format = format;
|
||||
|
||||
return cinfo;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo) {
|
||||
if(cinfo) {
|
||||
/* destroy the codec */
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_destroy_compress((opj_j3d_t*)cinfo->j3d_handle);
|
||||
}
|
||||
/* destroy the decompressor */
|
||||
opj_free(cinfo);
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters) {
|
||||
if(parameters) {
|
||||
memset(parameters, 0, sizeof(opj_cparameters_t));
|
||||
/* default coding parameters */
|
||||
parameters->numresolution[0] = 3;
|
||||
parameters->numresolution[1] = 3;
|
||||
parameters->numresolution[2] = 1;
|
||||
parameters->cblock_init[0] = 64;
|
||||
parameters->cblock_init[1] = 64;
|
||||
parameters->cblock_init[2] = 64;
|
||||
parameters->prog_order = LRCP;
|
||||
parameters->roi_compno = -1; /* no ROI */
|
||||
parameters->atk_wt[0] = 1; /* 5-3 WT */
|
||||
parameters->atk_wt[1] = 1; /* 5-3 WT */
|
||||
parameters->atk_wt[2] = 1; /* 5-3 WT */
|
||||
parameters->irreversible = 0;
|
||||
parameters->subsampling_dx = 1;
|
||||
parameters->subsampling_dy = 1;
|
||||
parameters->subsampling_dz = 1;
|
||||
|
||||
parameters->decod_format = -1;
|
||||
parameters->cod_format = -1;
|
||||
parameters->encoding_format = ENCOD_2EB;
|
||||
parameters->transform_format = TRF_2D_DWT;
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_volume_t *volume) {
|
||||
if(cinfo && parameters && volume) {
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
j3d_setup_encoder((opj_j3d_t*)cinfo->j3d_handle, parameters, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_volume_t *volume, char *index) {
|
||||
if(cinfo && cio && volume) {
|
||||
if (cinfo->codec_format != CODEC_UNKNOWN) {
|
||||
return j3d_encode((opj_j3d_t*)cinfo->j3d_handle, cio, volume, index);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
1439
src/lib/openjp3d/openjp3d.h → libopenjp3d/openjp3d.h
Normal file → Executable file
1439
src/lib/openjp3d/openjp3d.h → libopenjp3d/openjp3d.h
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
8
src/lib/openjp3d/opj_includes.h → libopenjp3d/opj_includes.h
Normal file → Executable file
8
src/lib/openjp3d/opj_includes.h → libopenjp3d/opj_includes.h
Normal file → Executable file
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -80,4 +75,7 @@
|
||||
#include "int.h"
|
||||
#include "fix.h"
|
||||
|
||||
//#include "pred.h"
|
||||
//#include "golomb.h"
|
||||
|
||||
#endif /* OPJ_INCLUDES_H */
|
1268
src/lib/openjp3d/pi.c → libopenjp3d/pi.c
Normal file → Executable file
1268
src/lib/openjp3d/pi.c → libopenjp3d/pi.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
295
src/lib/openjp3d/pi.h → libopenjp3d/pi.h
Normal file → Executable file
295
src/lib/openjp3d/pi.h → libopenjp3d/pi.h
Normal file → Executable file
@ -1,150 +1,145 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __PI_H
|
||||
#define __PI_H
|
||||
/**
|
||||
@file pi.h
|
||||
@brief Implementation of a packet iterator (PI)
|
||||
|
||||
The functions in PI.C have for goal to realize a packet iterator that permits to get the next
|
||||
packet following the progression order and change of it. The functions in PI.C are used
|
||||
by some function in T2.C.
|
||||
*/
|
||||
|
||||
/** @defgroup PI PI - Implementation of a packet iterator */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Packet iterator : resolution level information
|
||||
*/
|
||||
typedef struct opj_pi_resolution {
|
||||
/** Size of precints in horizontal axis */
|
||||
int pdx;
|
||||
/** Size of precints in vertical axis */
|
||||
int pdy;
|
||||
/** Size of precints in axial axis */
|
||||
int pdz;
|
||||
/** Number of precints in each axis */
|
||||
int prctno[3];
|
||||
} opj_pi_resolution_t;
|
||||
|
||||
/**
|
||||
Packet iterator : component information
|
||||
*/
|
||||
typedef struct opj_pi_comp {
|
||||
/** Size in horizontal axis */
|
||||
int dx;
|
||||
/** Size in vertical axis */
|
||||
int dy;
|
||||
/** Size in axial axis */
|
||||
int dz;
|
||||
/** Number of resolution levels */
|
||||
int numresolution[3];
|
||||
/** Packet iterator : resolution level information */
|
||||
opj_pi_resolution_t *resolutions;
|
||||
} opj_pi_comp_t;
|
||||
|
||||
/**
|
||||
Packet iterator
|
||||
*/
|
||||
typedef struct opj_pi_iterator {
|
||||
/** precise if the packet has been already used (useful for progression order change) */
|
||||
short int *include;
|
||||
/** layer step used to localize the packet in the include vector */
|
||||
int step_l;
|
||||
/** resolution step used to localize the packet in the include vector */
|
||||
int step_r;
|
||||
/** component step used to localize the packet in the include vector */
|
||||
int step_c;
|
||||
/** precinct step used to localize the packet in the include vector */
|
||||
int step_p;
|
||||
/** component that identify the packet */
|
||||
int compno;
|
||||
/** resolution that identify the packet */
|
||||
int resno;
|
||||
/** precinct that identify the packet */
|
||||
int precno;
|
||||
/** layer that identify the packet */
|
||||
int layno;
|
||||
/** 0 if the first packet */
|
||||
int first;
|
||||
/** progression order change information */
|
||||
opj_poc_t poc;
|
||||
/** Packet iterator : component information */
|
||||
opj_pi_comp_t *comps;
|
||||
|
||||
int numcomps;
|
||||
int tx0, ty0, tz0;
|
||||
int tx1, ty1, tz1;
|
||||
int x, y, z;
|
||||
int dx, dy, dz;
|
||||
} opj_pi_iterator_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a packet iterator
|
||||
@param volume Raw volume for which the packets will be listed
|
||||
@param cp Coding parameters
|
||||
@param tileno Number that identifies the tile for which to list the packets
|
||||
@return Returns a packet iterator that points to the first packet of the tile
|
||||
@see pi_destroy
|
||||
*/
|
||||
opj_pi_iterator_t *pi_create(opj_volume_t * volume, opj_cp_t * cp, int tileno);
|
||||
|
||||
/**
|
||||
Destroy a packet iterator
|
||||
@param pi Previously created packet iterator
|
||||
@param cp Coding parameters
|
||||
@param tileno Number that identifies the tile for which the packets were listed
|
||||
@see pi_create
|
||||
*/
|
||||
void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno);
|
||||
|
||||
/**
|
||||
Modify the packet iterator to point to the next packet
|
||||
@param pi Packet iterator to modify
|
||||
@return Returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
bool pi_next(opj_pi_iterator_t * pi);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __PI_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __PI_H
|
||||
#define __PI_H
|
||||
/**
|
||||
@file pi.h
|
||||
@brief Implementation of a packet iterator (PI)
|
||||
|
||||
The functions in PI.C have for goal to realize a packet iterator that permits to get the next
|
||||
packet following the progression order and change of it. The functions in PI.C are used
|
||||
by some function in T2.C.
|
||||
*/
|
||||
|
||||
/** @defgroup PI PI - Implementation of a packet iterator */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Packet iterator : resolution level information
|
||||
*/
|
||||
typedef struct opj_pi_resolution {
|
||||
/** Size of precints in horizontal axis */
|
||||
int pdx;
|
||||
/** Size of precints in vertical axis */
|
||||
int pdy;
|
||||
/** Size of precints in axial axis */
|
||||
int pdz;
|
||||
/** Number of precints in each axis */
|
||||
int prctno[3];
|
||||
} opj_pi_resolution_t;
|
||||
|
||||
/**
|
||||
Packet iterator : component information
|
||||
*/
|
||||
typedef struct opj_pi_comp {
|
||||
/** Size in horizontal axis */
|
||||
int dx;
|
||||
/** Size in vertical axis */
|
||||
int dy;
|
||||
/** Size in axial axis */
|
||||
int dz;
|
||||
/** Number of resolution levels */
|
||||
int numresolution[3];
|
||||
/** Packet iterator : resolution level information */
|
||||
opj_pi_resolution_t *resolutions;
|
||||
} opj_pi_comp_t;
|
||||
|
||||
/**
|
||||
Packet iterator
|
||||
*/
|
||||
typedef struct opj_pi_iterator {
|
||||
/** precise if the packet has been already used (usefull for progression order change) */
|
||||
short int *include;
|
||||
/** layer step used to localize the packet in the include vector */
|
||||
int step_l;
|
||||
/** resolution step used to localize the packet in the include vector */
|
||||
int step_r;
|
||||
/** component step used to localize the packet in the include vector */
|
||||
int step_c;
|
||||
/** precinct step used to localize the packet in the include vector */
|
||||
int step_p;
|
||||
/** component that identify the packet */
|
||||
int compno;
|
||||
/** resolution that identify the packet */
|
||||
int resno;
|
||||
/** precinct that identify the packet */
|
||||
int precno;
|
||||
/** layer that identify the packet */
|
||||
int layno;
|
||||
/** 0 if the first packet */
|
||||
int first;
|
||||
/** progression order change information */
|
||||
opj_poc_t poc;
|
||||
/** Packet iterator : component information */
|
||||
opj_pi_comp_t *comps;
|
||||
|
||||
int numcomps;
|
||||
int tx0, ty0, tz0;
|
||||
int tx1, ty1, tz1;
|
||||
int x, y, z;
|
||||
int dx, dy, dz;
|
||||
} opj_pi_iterator_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a packet iterator
|
||||
@param volume Raw volume for which the packets will be listed
|
||||
@param cp Coding parameters
|
||||
@param tileno Number that identifies the tile for which to list the packets
|
||||
@return Returns a packet iterator that points to the first packet of the tile
|
||||
@see pi_destroy
|
||||
*/
|
||||
opj_pi_iterator_t *pi_create(opj_volume_t * volume, opj_cp_t * cp, int tileno);
|
||||
|
||||
/**
|
||||
Destroy a packet iterator
|
||||
@param pi Previously created packet iterator
|
||||
@param cp Coding parameters
|
||||
@param tileno Number that identifies the tile for which the packets were listed
|
||||
@see pi_create
|
||||
*/
|
||||
void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno);
|
||||
|
||||
/**
|
||||
Modify the packet iterator to point to the next packet
|
||||
@param pi Packet iterator to modify
|
||||
@return Returns false if pi pointed to the last packet or else returns true
|
||||
*/
|
||||
bool pi_next(opj_pi_iterator_t * pi);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __PI_H */
|
177
src/lib/openjp3d/raw.c → libopenjp3d/raw.c
Normal file → Executable file
177
src/lib/openjp3d/raw.c → libopenjp3d/raw.c
Normal file → Executable file
@ -1,91 +1,86 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
local functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
RAW encoding interface
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_raw_t* raw_create() {
|
||||
opj_raw_t *raw = (opj_raw_t*)opj_malloc(sizeof(opj_raw_t));
|
||||
return raw;
|
||||
}
|
||||
|
||||
void raw_destroy(opj_raw_t *raw) {
|
||||
if(raw) {
|
||||
opj_free(raw);
|
||||
}
|
||||
}
|
||||
|
||||
int raw_numbytes(opj_raw_t *raw) {
|
||||
return raw->bp - raw->start;
|
||||
}
|
||||
|
||||
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) {
|
||||
raw->start = bp;
|
||||
raw->lenmax = len;
|
||||
raw->len = 0;
|
||||
raw->c = 0;
|
||||
raw->ct = 0;
|
||||
}
|
||||
|
||||
int raw_decode(opj_raw_t *raw) {
|
||||
int d;
|
||||
if (raw->ct == 0) {
|
||||
raw->ct = 8;
|
||||
if (raw->len == raw->lenmax) {
|
||||
raw->c = 0xff;
|
||||
} else {
|
||||
if (raw->c == 0xff) {
|
||||
raw->ct = 7;
|
||||
}
|
||||
raw->c = *(raw->start + raw->len);
|
||||
raw->len++;
|
||||
}
|
||||
}
|
||||
raw->ct--;
|
||||
d = (raw->c >> raw->ct) & 0x01;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
local functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
RAW encoding interface
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_raw_t* raw_create() {
|
||||
opj_raw_t *raw = (opj_raw_t*)opj_malloc(sizeof(opj_raw_t));
|
||||
return raw;
|
||||
}
|
||||
|
||||
void raw_destroy(opj_raw_t *raw) {
|
||||
if(raw) {
|
||||
opj_free(raw);
|
||||
}
|
||||
}
|
||||
|
||||
int raw_numbytes(opj_raw_t *raw) {
|
||||
return raw->bp - raw->start;
|
||||
}
|
||||
|
||||
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) {
|
||||
raw->start = bp;
|
||||
raw->lenmax = len;
|
||||
raw->len = 0;
|
||||
raw->c = 0;
|
||||
raw->ct = 0;
|
||||
}
|
||||
|
||||
int raw_decode(opj_raw_t *raw) {
|
||||
int d;
|
||||
if (raw->ct == 0) {
|
||||
raw->ct = 8;
|
||||
if (raw->len == raw->lenmax) {
|
||||
raw->c = 0xff;
|
||||
} else {
|
||||
if (raw->c == 0xff) {
|
||||
raw->ct = 7;
|
||||
}
|
||||
raw->c = *(raw->start + raw->len);
|
||||
raw->len++;
|
||||
}
|
||||
}
|
||||
raw->ct--;
|
||||
d = (raw->c >> raw->ct) & 0x01;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
203
src/lib/openjp3d/raw.h → libopenjp3d/raw.h
Normal file → Executable file
203
src/lib/openjp3d/raw.h → libopenjp3d/raw.h
Normal file → Executable file
@ -1,104 +1,99 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __RAW_H
|
||||
#define __RAW_H
|
||||
/**
|
||||
@file raw.h
|
||||
@brief Implementation of operations for raw encoding (RAW)
|
||||
|
||||
The functions in RAW.C have for goal to realize the operation of raw encoding linked
|
||||
with the corresponding mode switch.
|
||||
*/
|
||||
|
||||
/** @defgroup RAW RAW - Implementation of operations for raw encoding */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
RAW encoding operations
|
||||
*/
|
||||
typedef struct opj_raw {
|
||||
/** Temporary buffer where bits are coded or decoded */
|
||||
unsigned char c;
|
||||
/** Number of bits already read or free to write */
|
||||
unsigned int ct;
|
||||
/** Maximum length to decode */
|
||||
unsigned int lenmax;
|
||||
/** Length decoded */
|
||||
unsigned int len;
|
||||
/** Pointer to the current position in the buffer */
|
||||
unsigned char *bp;
|
||||
/** Pointer to the start of the buffer */
|
||||
unsigned char *start;
|
||||
/** Pointer to the end of the buffer */
|
||||
unsigned char *end;
|
||||
} opj_raw_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new RAW handle
|
||||
@return Returns a new RAW handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_raw_t* raw_create(void);
|
||||
/**
|
||||
Destroy a previously created RAW handle
|
||||
@param raw RAW handle to destroy
|
||||
*/
|
||||
void raw_destroy(opj_raw_t *raw);
|
||||
/**
|
||||
Return the number of bytes written/read since initialisation
|
||||
@param raw RAW handle to destroy
|
||||
@return Returns the number of bytes already encoded
|
||||
*/
|
||||
int raw_numbytes(opj_raw_t *raw);
|
||||
/**
|
||||
Initialize the decoder
|
||||
@param raw RAW handle
|
||||
@param bp Pointer to the start of the buffer from which the bytes will be read
|
||||
@param len Length of the input buffer
|
||||
*/
|
||||
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len);
|
||||
/**
|
||||
Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN
|
||||
@param raw RAW handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
int raw_decode(opj_raw_t *raw);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __RAW_H */
|
||||
/*
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __RAW_H
|
||||
#define __RAW_H
|
||||
/**
|
||||
@file raw.h
|
||||
@brief Implementation of operations for raw encoding (RAW)
|
||||
|
||||
The functions in RAW.C have for goal to realize the operation of raw encoding linked
|
||||
with the corresponding mode switch.
|
||||
*/
|
||||
|
||||
/** @defgroup RAW RAW - Implementation of operations for raw encoding */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
RAW encoding operations
|
||||
*/
|
||||
typedef struct opj_raw {
|
||||
/** Temporary buffer where bits are coded or decoded */
|
||||
unsigned char c;
|
||||
/** Number of bits already read or free to write */
|
||||
unsigned int ct;
|
||||
/** Maximum length to decode */
|
||||
unsigned int lenmax;
|
||||
/** Length decoded */
|
||||
unsigned int len;
|
||||
/** Pointer to the current position in the buffer */
|
||||
unsigned char *bp;
|
||||
/** Pointer to the start of the buffer */
|
||||
unsigned char *start;
|
||||
/** Pointer to the end of the buffer */
|
||||
unsigned char *end;
|
||||
} opj_raw_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new RAW handle
|
||||
@return Returns a new RAW handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_raw_t* raw_create();
|
||||
/**
|
||||
Destroy a previously created RAW handle
|
||||
@param raw RAW handle to destroy
|
||||
*/
|
||||
void raw_destroy(opj_raw_t *raw);
|
||||
/**
|
||||
Return the number of bytes written/read since initialisation
|
||||
@param raw RAW handle to destroy
|
||||
@return Returns the number of bytes already encoded
|
||||
*/
|
||||
int raw_numbytes(opj_raw_t *raw);
|
||||
/**
|
||||
Initialize the decoder
|
||||
@param raw RAW handle
|
||||
@param bp Pointer to the start of the buffer from which the bytes will be read
|
||||
@param len Length of the input buffer
|
||||
*/
|
||||
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len);
|
||||
/**
|
||||
Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN
|
||||
@param raw RAW handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
int raw_decode(opj_raw_t *raw);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __RAW_H */
|
2367
src/lib/openjp3d/t1.c → libopenjp3d/t1.c
Normal file → Executable file
2367
src/lib/openjp3d/t1.c → libopenjp3d/t1.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
351
src/lib/openjp3d/t1.h → libopenjp3d/t1.h
Normal file → Executable file
351
src/lib/openjp3d/t1.h → libopenjp3d/t1.h
Normal file → Executable file
@ -1,178 +1,173 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T1_H
|
||||
#define __T1_H
|
||||
/**
|
||||
@file t1.h
|
||||
@brief Implementation of the tier-1 coding (coding of code-block coefficients) (T1)
|
||||
|
||||
The functions in T1.C have for goal to realize the tier-1 coding operation. The functions
|
||||
in T1.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup T1 T1 - Implementation of the tier-1 coding */
|
||||
/*@{*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
#define T1_NMSEDEC_BITS 7
|
||||
|
||||
#define T1_MAXCBLKW 256 /*< Maximum size of code-block (width) */
|
||||
#define T1_MAXCBLKH 256 /*< Maximum size of code-block (heigth) */
|
||||
#define T1_MAXCBLKD 256 /*< Maximum size of code-block (depth) */
|
||||
#define T1_MINCBLKW 4 /*< Minimum size of code-block (width) */
|
||||
#define T1_MINCBLKH 4 /*< Minimum size of code-block (heigth) */
|
||||
#define T1_MINCBLKD 4 /*< Minimum size of code-block (depth) */
|
||||
#define T1_MAXWHD 18
|
||||
#define T1_CBLKW 256
|
||||
#define T1_CBLKH 256
|
||||
#define T1_CBLKD 256
|
||||
|
||||
#define T1_SIG_NE 0x0001 /*< Context orientation : North-East direction */
|
||||
#define T1_SIG_SE 0x0002 /*< Context orientation : South-East direction */
|
||||
#define T1_SIG_SW 0x0004 /*< Context orientation : South-West direction */
|
||||
#define T1_SIG_NW 0x0008 /*< Context orientation : North-West direction */
|
||||
#define T1_SIG_N 0x0010 /*< Context orientation : North direction */
|
||||
#define T1_SIG_E 0x0020 /*< Context orientation : East direction */
|
||||
#define T1_SIG_S 0x0040 /*< Context orientation : South direction */
|
||||
#define T1_SIG_W 0x0080 /*< Context orientation : West direction */
|
||||
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
|
||||
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
|
||||
|
||||
#define T1_SGN_N 0x0100
|
||||
#define T1_SGN_E 0x0200
|
||||
#define T1_SGN_S 0x0400
|
||||
#define T1_SGN_W 0x0800
|
||||
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
|
||||
|
||||
#define T1_SIG 0x1000
|
||||
#define T1_REFINE 0x2000
|
||||
#define T1_VISIT 0x4000
|
||||
|
||||
#define T1_NUMCTXS_AGG 1
|
||||
#define T1_NUMCTXS_ZC 9
|
||||
#define T1_NUMCTXS_MAG 3
|
||||
#define T1_NUMCTXS_SC 5
|
||||
#define T1_NUMCTXS_UNI 1
|
||||
|
||||
#define T1_CTXNO_AGG 0
|
||||
#define T1_CTXNO_ZC (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
|
||||
#define T1_CTXNO_MAG (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
|
||||
#define T1_CTXNO_SC (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
|
||||
#define T1_CTXNO_UNI (T1_CTXNO_SC+T1_NUMCTXS_SC)
|
||||
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
|
||||
|
||||
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
|
||||
|
||||
#define T1_TYPE_MQ 0 /*< Normal coding using entropy coder */
|
||||
#define T1_TYPE_RAW 1 /*< No encoding the information is store under raw format in codestream (mode switch RAW)*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Tier-1 coding (coding of code-block coefficients)
|
||||
*/
|
||||
typedef struct opj_t1 {
|
||||
/** codec context */
|
||||
opj_common_ptr cinfo;
|
||||
|
||||
/** MQC component */
|
||||
opj_mqc_t *mqc;
|
||||
/** RAW component */
|
||||
opj_raw_t *raw;
|
||||
/** LUTs for context-based coding */
|
||||
int lut_ctxno_zc[1024];
|
||||
int lut_ctxno_sc[256];
|
||||
int lut_ctxno_mag[4096];
|
||||
int lut_spb[256];
|
||||
/** LUTs for decoding normalised MSE */
|
||||
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
|
||||
/** Codeblock data */
|
||||
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];/*int ***data;*/
|
||||
/** Context information for each voxel in codeblock */
|
||||
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];/*int ***flags;*/
|
||||
} opj_t1_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new T1 handle
|
||||
and initialize the look-up tables of the Tier-1 coder/decoder
|
||||
@return Returns a new T1 handle if successful, returns NULL otherwise
|
||||
@see t1_init_luts
|
||||
*/
|
||||
opj_t1_t* t1_create(opj_common_ptr cinfo);
|
||||
/**
|
||||
Destroy a previously created T1 handle
|
||||
@param t1 T1 handle to destroy
|
||||
*/
|
||||
void t1_destroy(opj_t1_t *t1);
|
||||
/**
|
||||
Encode the code-blocks of a tile
|
||||
@param t1 T1 handle
|
||||
@param tile The tile to encode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@param t1 T1 handle
|
||||
@param tile The tile to decode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Get weigths of MSE decoding
|
||||
@param nmsedec The normalized MSE reduction
|
||||
@param compno
|
||||
@param level
|
||||
@param orient
|
||||
@param bpno
|
||||
@param stepsize
|
||||
@param numcomps
|
||||
@param dwtid
|
||||
returns MSE associated to decoding pass
|
||||
*/
|
||||
double t1_getwmsedec(int nmsedec, int compno, int level[3], int orient, int bpno, double stepsize, int numcomps, int dwtid[3]);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T1_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T1_H
|
||||
#define __T1_H
|
||||
/**
|
||||
@file t1.h
|
||||
@brief Implementation of the tier-1 coding (coding of code-block coefficients) (T1)
|
||||
|
||||
The functions in T1.C have for goal to realize the tier-1 coding operation. The functions
|
||||
in T1.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup T1 T1 - Implementation of the tier-1 coding */
|
||||
/*@{*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
#define T1_NMSEDEC_BITS 7
|
||||
|
||||
#define T1_MAXCBLKW 256 /*< Maximum size of code-block (width) */
|
||||
#define T1_MAXCBLKH 256 /*< Maximum size of code-block (heigth) */
|
||||
#define T1_MAXCBLKD 256 /*< Maximum size of code-block (depth) */
|
||||
#define T1_MINCBLKW 4 /*< Minimum size of code-block (width) */
|
||||
#define T1_MINCBLKH 4 /*< Minimum size of code-block (heigth) */
|
||||
#define T1_MINCBLKD 4 /*< Minimum size of code-block (depth) */
|
||||
#define T1_MAXWHD 18
|
||||
#define T1_CBLKW 256
|
||||
#define T1_CBLKH 256
|
||||
#define T1_CBLKD 256
|
||||
|
||||
#define T1_SIG_NE 0x0001 /*< Context orientation : North-East direction */
|
||||
#define T1_SIG_SE 0x0002 /*< Context orientation : South-East direction */
|
||||
#define T1_SIG_SW 0x0004 /*< Context orientation : South-West direction */
|
||||
#define T1_SIG_NW 0x0008 /*< Context orientation : North-West direction */
|
||||
#define T1_SIG_N 0x0010 /*< Context orientation : North direction */
|
||||
#define T1_SIG_E 0x0020 /*< Context orientation : East direction */
|
||||
#define T1_SIG_S 0x0040 /*< Context orientation : South direction */
|
||||
#define T1_SIG_W 0x0080 /*< Context orientation : West direction */
|
||||
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
|
||||
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
|
||||
|
||||
#define T1_SGN_N 0x0100
|
||||
#define T1_SGN_E 0x0200
|
||||
#define T1_SGN_S 0x0400
|
||||
#define T1_SGN_W 0x0800
|
||||
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
|
||||
|
||||
#define T1_SIG 0x1000
|
||||
#define T1_REFINE 0x2000
|
||||
#define T1_VISIT 0x4000
|
||||
|
||||
#define T1_NUMCTXS_AGG 1
|
||||
#define T1_NUMCTXS_ZC 9
|
||||
#define T1_NUMCTXS_MAG 3
|
||||
#define T1_NUMCTXS_SC 5
|
||||
#define T1_NUMCTXS_UNI 1
|
||||
|
||||
#define T1_CTXNO_AGG 0
|
||||
#define T1_CTXNO_ZC (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
|
||||
#define T1_CTXNO_MAG (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
|
||||
#define T1_CTXNO_SC (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
|
||||
#define T1_CTXNO_UNI (T1_CTXNO_SC+T1_NUMCTXS_SC)
|
||||
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
|
||||
|
||||
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
|
||||
|
||||
#define T1_TYPE_MQ 0 /*< Normal coding using entropy coder */
|
||||
#define T1_TYPE_RAW 1 /*< No encoding the information is store under raw format in codestream (mode switch RAW)*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Tier-1 coding (coding of code-block coefficients)
|
||||
*/
|
||||
typedef struct opj_t1 {
|
||||
/** codec context */
|
||||
opj_common_ptr cinfo;
|
||||
|
||||
/** MQC component */
|
||||
opj_mqc_t *mqc;
|
||||
/** RAW component */
|
||||
opj_raw_t *raw;
|
||||
/** LUTs for context-based coding */
|
||||
int lut_ctxno_zc[1024];
|
||||
int lut_ctxno_sc[256];
|
||||
int lut_ctxno_mag[4096];
|
||||
int lut_spb[256];
|
||||
/** LUTs for decoding normalised MSE */
|
||||
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
|
||||
/** Codeblock data */
|
||||
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];//int ***data;
|
||||
/** Context information for each voxel in codeblock */
|
||||
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];//int ***flags;
|
||||
} opj_t1_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new T1 handle
|
||||
and initialize the look-up tables of the Tier-1 coder/decoder
|
||||
@return Returns a new T1 handle if successful, returns NULL otherwise
|
||||
@see t1_init_luts
|
||||
*/
|
||||
opj_t1_t* t1_create(opj_common_ptr cinfo);
|
||||
/**
|
||||
Destroy a previously created T1 handle
|
||||
@param t1 T1 handle to destroy
|
||||
*/
|
||||
void t1_destroy(opj_t1_t *t1);
|
||||
/**
|
||||
Encode the code-blocks of a tile
|
||||
@param t1 T1 handle
|
||||
@param tile The tile to encode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@param t1 T1 handle
|
||||
@param tile The tile to decode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Get weigths of MSE decoding
|
||||
@param nmsedec The normalized MSE reduction
|
||||
@param compno
|
||||
@param level
|
||||
@param orient
|
||||
@param bpno
|
||||
@param stepsize
|
||||
@param numcomps
|
||||
@param dwtid
|
||||
returns MSE associated to decoding pass
|
||||
*/
|
||||
double t1_getwmsedec(int nmsedec, int compno, int level[3], int orient, int bpno, double stepsize, int numcomps, int dwtid[3]);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T1_H */
|
2460
src/lib/openjp3d/t1_3d.c → libopenjp3d/t1_3d.c
Normal file → Executable file
2460
src/lib/openjp3d/t1_3d.c → libopenjp3d/t1_3d.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
346
src/lib/openjp3d/t1_3d.h → libopenjp3d/t1_3d.h
Normal file → Executable file
346
src/lib/openjp3d/t1_3d.h → libopenjp3d/t1_3d.h
Normal file → Executable file
@ -1,173 +1,173 @@
|
||||
/*
|
||||
* Copyrigth (c) 2006, Mónica Díez, LPI-UVA, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T1_3D_H
|
||||
#define __T1_3D_H
|
||||
/**
|
||||
@file t1_3d.h
|
||||
@brief Implementation of the tier-1 coding (coding of code-block coefficients) (T1)
|
||||
|
||||
The functions in T1_3D.C have for goal to realize the tier-1 coding operation of 3D-EBCOT.
|
||||
The functions in T1_3D.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup T1_3D T1_3D - Implementation of the tier-1 coding */
|
||||
/*@{*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/* Neighbourhood of 3D EBCOT (Significance context)*/
|
||||
#define T1_3D_SIG_NE 0x00000001 /*< Context orientation : North-East direction */
|
||||
#define T1_3D_SIG_SE 0x00000002 /*< Context orientation : South-East direction */
|
||||
#define T1_3D_SIG_SW 0x00000004 /*< Context orientation : South-West direction */
|
||||
#define T1_3D_SIG_NW 0x00000008 /* Context orientation : North-West direction */
|
||||
#define T1_3D_SIG_N 0x00000010 /*< Context orientation : North direction */
|
||||
#define T1_3D_SIG_E 0x00000020 /*< Context orientation : East direction */
|
||||
#define T1_3D_SIG_S 0x00000040 /*< Context orientation : South direction */
|
||||
#define T1_3D_SIG_W 0x00000080 /*< Context orientation : West direction */
|
||||
#define T1_3D_SIG_FC 0x00000100 /*< Context orientation : Forward Central direction */
|
||||
#define T1_3D_SIG_BC 0x00000200 /*< Context orientation : Backward Central direction */
|
||||
#define T1_3D_SIG_FNE 0x00000400 /*< Context orientation : Forward North-East direction */
|
||||
#define T1_3D_SIG_FSE 0x00000800 /*< Context orientation : Forward South-East direction */
|
||||
#define T1_3D_SIG_FSW 0x00001000 /*< Context orientation : Forward South-West direction */
|
||||
#define T1_3D_SIG_FNW 0x00002000 /*< Context orientation : Forward North-West direction */
|
||||
#define T1_3D_SIG_FN 0x00004000 /*< Context orientation : Forward North direction */
|
||||
#define T1_3D_SIG_FE 0x00008000 /*< Context orientation : Forward East direction */
|
||||
#define T1_3D_SIG_FS 0x00010000 /*< Context orientation : Forward South direction */
|
||||
#define T1_3D_SIG_FW 0x00020000 /*< Context orientation : Forward West direction */
|
||||
#define T1_3D_SIG_BNE 0x00040000 /*< Context orientation : Backward North-East direction */
|
||||
#define T1_3D_SIG_BSE 0x00080000 /*< Context orientation : Backward South-East direction */
|
||||
#define T1_3D_SIG_BSW 0x00100000 /*< Context orientation : Backward South-West direction */
|
||||
#define T1_3D_SIG_BNW 0x00200000 /*< Context orientation : Backward North-West direction */
|
||||
#define T1_3D_SIG_BN 0x00400000 /*< Context orientation : Backward North direction */
|
||||
#define T1_3D_SIG_BE 0x00800000 /*< Context orientation : Backward East direction */
|
||||
#define T1_3D_SIG_BS 0x01000000 /*< Context orientation : Backward South direction */
|
||||
#define T1_3D_SIG_BW 0x02000000 /*< Context orientation : Backward West direction */
|
||||
#define T1_3D_SIG_COTH (T1_3D_SIG_N|T1_3D_SIG_NE|T1_3D_SIG_E|T1_3D_SIG_SE|T1_3D_SIG_S|T1_3D_SIG_SW|T1_3D_SIG_W|T1_3D_SIG_NW)
|
||||
#define T1_3D_SIG_BOTH (T1_3D_SIG_BN|T1_3D_SIG_BNE|T1_3D_SIG_BE|T1_3D_SIG_BSE|T1_3D_SIG_BS|T1_3D_SIG_BSW|T1_3D_SIG_BW|T1_3D_SIG_BNW|T1_3D_SIG_BC)
|
||||
#define T1_3D_SIG_FOTH (T1_3D_SIG_FN|T1_3D_SIG_FNE|T1_3D_SIG_FE|T1_3D_SIG_FSE|T1_3D_SIG_FS|T1_3D_SIG_FSW|T1_3D_SIG_FW|T1_3D_SIG_FNW|T1_3D_SIG_FC)
|
||||
#define T1_3D_SIG_OTH (T1_3D_SIG_FOTH|T1_3D_SIG_BOTH|T1_3D_SIG_COTH)
|
||||
#define T1_3D_SIG_PRIM (T1_3D_SIG_N|T1_3D_SIG_E|T1_3D_SIG_S|T1_3D_SIG_W|T1_3D_SIG_FC|T1_3D_SIG_BC)
|
||||
|
||||
#define T1_3D_SGN_N 0x0400
|
||||
#define T1_3D_SGN_E 0x0800
|
||||
#define T1_3D_SGN_S 0x1000
|
||||
#define T1_3D_SGN_W 0x2000
|
||||
#define T1_3D_SGN_F 0x4000
|
||||
#define T1_3D_SGN_B 0x8000
|
||||
#define T1_3D_SGN (T1_3D_SGN_N|T1_3D_SGN_E|T1_3D_SGN_S|T1_3D_SGN_W|T1_3D_SGN_F|T1_3D_SGN_B)
|
||||
|
||||
#define T1_3D_SIG 0x0001 /*Significance state*/
|
||||
#define T1_3D_REFINE 0x0002 /*Delayed significance*/
|
||||
#define T1_3D_VISIT 0x0004 /*First-pass membership*/
|
||||
|
||||
#define T1_3D_NUMCTXS_AGG 1
|
||||
#define T1_3D_NUMCTXS_ZC 16
|
||||
#define T1_3D_NUMCTXS_MAG 3
|
||||
#define T1_3D_NUMCTXS_SC 6
|
||||
#define T1_3D_NUMCTXS_UNI 1
|
||||
|
||||
#define T1_3D_CTXNO_AGG 0
|
||||
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) /*1*/
|
||||
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) /*17*/
|
||||
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) /*20*/
|
||||
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) /*26*/
|
||||
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) /*27*/
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Tier-1 coding (coding of code-block coefficients)
|
||||
*/
|
||||
typedef struct opj_t1_3d {
|
||||
/** Codec context */
|
||||
opj_common_ptr cinfo;
|
||||
/** MQC component */
|
||||
opj_mqc_t *mqc;
|
||||
/** RAW component */
|
||||
opj_raw_t *raw;
|
||||
/** LUTs for decoding normalised MSE */
|
||||
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
|
||||
/** Codeblock data */
|
||||
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];
|
||||
/** Context information for each voxel in codeblock */
|
||||
unsigned int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
|
||||
/** Voxel information (significance/visited/refined) */
|
||||
int flagSVR[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
|
||||
} opj_t1_3d_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new T1_3D handle
|
||||
and initialize the look-up tables of the Tier-1 coder/decoder
|
||||
@return Returns a new T1 handle if successful, returns NULL otherwise
|
||||
@see t1_init_luts
|
||||
*/
|
||||
opj_t1_3d_t* t1_3d_create(opj_common_ptr cinfo);
|
||||
/**
|
||||
Destroy a previously created T1_3D handle
|
||||
@param t1 T1_3D handle to destroy
|
||||
*/
|
||||
void t1_3d_destroy(opj_t1_3d_t *t1);
|
||||
/**
|
||||
Encode the code-blocks of a tile
|
||||
@param t1 T1_3D handle
|
||||
@param tile The tile to encode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_3d_encode_cblks(opj_t1_3d_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@param t1 T1_3D handle
|
||||
@param tile The tile to decode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_3d_decode_cblks(opj_t1_3d_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Get weigths of MSE decoding
|
||||
@param nmsedec The normalized MSE reduction
|
||||
@param compno
|
||||
@param level
|
||||
@param orient
|
||||
@param bpno
|
||||
@param reversible
|
||||
@param stepsize
|
||||
@param numcomps
|
||||
@param dwtid
|
||||
returns MSE associated to decoding pass
|
||||
double t1_3d_getwmsedec(int nmsedec, int compno, int levelxy, int levelz, int orient, int bpno, int reversible, double stepsize, int numcomps, int dwtid);
|
||||
*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T1_H */
|
||||
/*
|
||||
* Copyrigth (c) 2006, Mónica Díez, LPI-UVA, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T1_3D_H
|
||||
#define __T1_3D_H
|
||||
/**
|
||||
@file t1_3d.h
|
||||
@brief Implementation of the tier-1 coding (coding of code-block coefficients) (T1)
|
||||
|
||||
The functions in T1_3D.C have for goal to realize the tier-1 coding operation of 3D-EBCOT.
|
||||
The functions in T1_3D.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup T1_3D T1_3D - Implementation of the tier-1 coding */
|
||||
/*@{*/
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/* Neighbourhood of 3D EBCOT (Significance context)*/
|
||||
#define T1_3D_SIG_NE 0x00000001 /*< Context orientation : North-East direction */
|
||||
#define T1_3D_SIG_SE 0x00000002 /*< Context orientation : South-East direction */
|
||||
#define T1_3D_SIG_SW 0x00000004 /*< Context orientation : South-West direction */
|
||||
#define T1_3D_SIG_NW 0x00000008 /* Context orientation : North-West direction */
|
||||
#define T1_3D_SIG_N 0x00000010 /*< Context orientation : North direction */
|
||||
#define T1_3D_SIG_E 0x00000020 /*< Context orientation : East direction */
|
||||
#define T1_3D_SIG_S 0x00000040 /*< Context orientation : South direction */
|
||||
#define T1_3D_SIG_W 0x00000080 /*< Context orientation : West direction */
|
||||
#define T1_3D_SIG_FC 0x00000100 /*< Context orientation : Forward Central direction */
|
||||
#define T1_3D_SIG_BC 0x00000200 /*< Context orientation : Backward Central direction */
|
||||
#define T1_3D_SIG_FNE 0x00000400 /*< Context orientation : Forward North-East direction */
|
||||
#define T1_3D_SIG_FSE 0x00000800 /*< Context orientation : Forward South-East direction */
|
||||
#define T1_3D_SIG_FSW 0x00001000 /*< Context orientation : Forward South-West direction */
|
||||
#define T1_3D_SIG_FNW 0x00002000 /*< Context orientation : Forward North-West direction */
|
||||
#define T1_3D_SIG_FN 0x00004000 /*< Context orientation : Forward North direction */
|
||||
#define T1_3D_SIG_FE 0x00008000 /*< Context orientation : Forward East direction */
|
||||
#define T1_3D_SIG_FS 0x00010000 /*< Context orientation : Forward South direction */
|
||||
#define T1_3D_SIG_FW 0x00020000 /*< Context orientation : Forward West direction */
|
||||
#define T1_3D_SIG_BNE 0x00040000 /*< Context orientation : Backward North-East direction */
|
||||
#define T1_3D_SIG_BSE 0x00080000 /*< Context orientation : Backward South-East direction */
|
||||
#define T1_3D_SIG_BSW 0x00100000 /*< Context orientation : Backward South-West direction */
|
||||
#define T1_3D_SIG_BNW 0x00200000 /*< Context orientation : Backward North-West direction */
|
||||
#define T1_3D_SIG_BN 0x00400000 /*< Context orientation : Backward North direction */
|
||||
#define T1_3D_SIG_BE 0x00800000 /*< Context orientation : Backward East direction */
|
||||
#define T1_3D_SIG_BS 0x01000000 /*< Context orientation : Backward South direction */
|
||||
#define T1_3D_SIG_BW 0x02000000 /*< Context orientation : Backward West direction */
|
||||
#define T1_3D_SIG_COTH (T1_3D_SIG_N|T1_3D_SIG_NE|T1_3D_SIG_E|T1_3D_SIG_SE|T1_3D_SIG_S|T1_3D_SIG_SW|T1_3D_SIG_W|T1_3D_SIG_NW)
|
||||
#define T1_3D_SIG_BOTH (T1_3D_SIG_BN|T1_3D_SIG_BNE|T1_3D_SIG_BE|T1_3D_SIG_BSE|T1_3D_SIG_BS|T1_3D_SIG_BSW|T1_3D_SIG_BW|T1_3D_SIG_BNW|T1_3D_SIG_BC)
|
||||
#define T1_3D_SIG_FOTH (T1_3D_SIG_FN|T1_3D_SIG_FNE|T1_3D_SIG_FE|T1_3D_SIG_FSE|T1_3D_SIG_FS|T1_3D_SIG_FSW|T1_3D_SIG_FW|T1_3D_SIG_FNW|T1_3D_SIG_FC)
|
||||
#define T1_3D_SIG_OTH (T1_3D_SIG_FOTH|T1_3D_SIG_BOTH|T1_3D_SIG_COTH)
|
||||
#define T1_3D_SIG_PRIM (T1_3D_SIG_N|T1_3D_SIG_E|T1_3D_SIG_S|T1_3D_SIG_W|T1_3D_SIG_FC|T1_3D_SIG_BC)
|
||||
|
||||
#define T1_3D_SGN_N 0x0400
|
||||
#define T1_3D_SGN_E 0x0800
|
||||
#define T1_3D_SGN_S 0x1000
|
||||
#define T1_3D_SGN_W 0x2000
|
||||
#define T1_3D_SGN_F 0x4000
|
||||
#define T1_3D_SGN_B 0x8000
|
||||
#define T1_3D_SGN (T1_3D_SGN_N|T1_3D_SGN_E|T1_3D_SGN_S|T1_3D_SGN_W|T1_3D_SGN_F|T1_3D_SGN_B)
|
||||
|
||||
#define T1_3D_SIG 0x0001 //Significance state
|
||||
#define T1_3D_REFINE 0x0002 //Delayed significance
|
||||
#define T1_3D_VISIT 0x0004 //First-pass membership
|
||||
|
||||
#define T1_3D_NUMCTXS_AGG 1
|
||||
#define T1_3D_NUMCTXS_ZC 16
|
||||
#define T1_3D_NUMCTXS_MAG 3
|
||||
#define T1_3D_NUMCTXS_SC 6
|
||||
#define T1_3D_NUMCTXS_UNI 1
|
||||
|
||||
#define T1_3D_CTXNO_AGG 0
|
||||
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) //1
|
||||
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) //17
|
||||
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) //20
|
||||
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) //26
|
||||
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) //27
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Tier-1 coding (coding of code-block coefficients)
|
||||
*/
|
||||
typedef struct opj_t1_3d {
|
||||
/** Codec context */
|
||||
opj_common_ptr cinfo;
|
||||
/** MQC component */
|
||||
opj_mqc_t *mqc;
|
||||
/** RAW component */
|
||||
opj_raw_t *raw;
|
||||
/** LUTs for decoding normalised MSE */
|
||||
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
|
||||
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
|
||||
/** Codeblock data */
|
||||
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];
|
||||
/** Context information for each voxel in codeblock */
|
||||
unsigned int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
|
||||
/** Voxel information (significance/visited/refined) */
|
||||
int flagSVR[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
|
||||
} opj_t1_3d_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new T1_3D handle
|
||||
and initialize the look-up tables of the Tier-1 coder/decoder
|
||||
@return Returns a new T1 handle if successful, returns NULL otherwise
|
||||
@see t1_init_luts
|
||||
*/
|
||||
opj_t1_3d_t* t1_3d_create(opj_common_ptr cinfo);
|
||||
/**
|
||||
Destroy a previously created T1_3D handle
|
||||
@param t1 T1_3D handle to destroy
|
||||
*/
|
||||
void t1_3d_destroy(opj_t1_3d_t *t1);
|
||||
/**
|
||||
Encode the code-blocks of a tile
|
||||
@param t1 T1_3D handle
|
||||
@param tile The tile to encode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_3d_encode_cblks(opj_t1_3d_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@param t1 T1_3D handle
|
||||
@param tile The tile to decode
|
||||
@param tcp Tile coding parameters
|
||||
*/
|
||||
void t1_3d_decode_cblks(opj_t1_3d_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
|
||||
/**
|
||||
Get weigths of MSE decoding
|
||||
@param nmsedec The normalized MSE reduction
|
||||
@param compno
|
||||
@param level
|
||||
@param orient
|
||||
@param bpno
|
||||
@param reversible
|
||||
@param stepsize
|
||||
@param numcomps
|
||||
@param dwtid
|
||||
returns MSE associated to decoding pass
|
||||
double t1_3d_getwmsedec(int nmsedec, int compno, int levelxy, int levelz, int orient, int bpno, int reversible, double stepsize, int numcomps, int dwtid);
|
||||
*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T1_H */
|
1356
src/lib/openjp3d/t2.c → libopenjp3d/t2.c
Normal file → Executable file
1356
src/lib/openjp3d/t2.c → libopenjp3d/t2.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
207
src/lib/openjp3d/t2.h → libopenjp3d/t2.h
Normal file → Executable file
207
src/lib/openjp3d/t2.h → libopenjp3d/t2.h
Normal file → Executable file
@ -1,106 +1,101 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T2_H
|
||||
#define __T2_H
|
||||
/**
|
||||
@file t2.h
|
||||
@brief Implementation of a tier-2 coding (packetization of code-block data) (T2)
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup T2 T2 - Implementation of a tier-2 coding */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Tier-2 coding
|
||||
*/
|
||||
typedef struct opj_t2 {
|
||||
/** Codec context */
|
||||
opj_common_ptr cinfo;
|
||||
/** Encoding: pointer to the src volume. Decoding: pointer to the dst volume. */
|
||||
opj_volume_t *volume;
|
||||
/** Pointer to the volume coding parameters */
|
||||
opj_cp_t *cp;
|
||||
} opj_t2_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Encode the packets of a tile to a destination buffer
|
||||
@param t2 T2 handle
|
||||
@param tileno number of the tile encoded
|
||||
@param tile the tile for which to write the packets
|
||||
@param maxlayers maximum number of layers
|
||||
@param dest the destination buffer
|
||||
@param len the length of the destination buffer
|
||||
@param volume_info structure to create an index file
|
||||
@return Number of bytes written from packets
|
||||
*/
|
||||
int t2_encode_packets(opj_t2_t* t2, int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_volume_info_t *volume_info);
|
||||
|
||||
/**
|
||||
Decode the packets of a tile from a source buffer
|
||||
@param t2 T2 handle
|
||||
@param src the source buffer
|
||||
@param len length of the source buffer
|
||||
@param tileno number that identifies the tile for which to decode the packets
|
||||
@param tile tile for which to decode the packets
|
||||
@return Number of bytes read from packets
|
||||
*/
|
||||
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile);
|
||||
|
||||
/**
|
||||
Create a T2 handle
|
||||
@param cinfo Codec context info
|
||||
@param volume Source or destination volume
|
||||
@param cp Volume coding parameters
|
||||
@return Returns a new T2 handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_t2_t* t2_create(opj_common_ptr cinfo, opj_volume_t *volume, opj_cp_t *cp);
|
||||
/**
|
||||
Destroy a T2 handle
|
||||
@param t2 T2 handle to destroy
|
||||
*/
|
||||
void t2_destroy(opj_t2_t *t2);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T2_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __T2_H
|
||||
#define __T2_H
|
||||
/**
|
||||
@file t2.h
|
||||
@brief Implementation of a tier-2 coding (packetization of code-block data) (T2)
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup T2 T2 - Implementation of a tier-2 coding */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Tier-2 coding
|
||||
*/
|
||||
typedef struct opj_t2 {
|
||||
/** Codec context */
|
||||
opj_common_ptr cinfo;
|
||||
/** Encoding: pointer to the src volume. Decoding: pointer to the dst volume. */
|
||||
opj_volume_t *volume;
|
||||
/** Pointer to the volume coding parameters */
|
||||
opj_cp_t *cp;
|
||||
} opj_t2_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Encode the packets of a tile to a destination buffer
|
||||
@param t2 T2 handle
|
||||
@param tileno number of the tile encoded
|
||||
@param tile the tile for which to write the packets
|
||||
@param maxlayers maximum number of layers
|
||||
@param dest the destination buffer
|
||||
@param len the length of the destination buffer
|
||||
@param volume_info structure to create an index file
|
||||
@return Number of bytes written from packets
|
||||
*/
|
||||
int t2_encode_packets(opj_t2_t* t2, int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_volume_info_t *volume_info);
|
||||
|
||||
/**
|
||||
Decode the packets of a tile from a source buffer
|
||||
@param t2 T2 handle
|
||||
@param src the source buffer
|
||||
@param len length of the source buffer
|
||||
@param tileno number that identifies the tile for which to decode the packets
|
||||
@param tile tile for which to decode the packets
|
||||
@return Number of bytes read from packets
|
||||
*/
|
||||
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile);
|
||||
|
||||
/**
|
||||
Create a T2 handle
|
||||
@param cinfo Codec context info
|
||||
@param volume Source or destination volume
|
||||
@param cp Volume coding parameters
|
||||
@return Returns a new T2 handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_t2_t* t2_create(opj_common_ptr cinfo, opj_volume_t *volume, opj_cp_t *cp);
|
||||
/**
|
||||
Destroy a T2 handle
|
||||
@param t2 T2 handle to destroy
|
||||
*/
|
||||
void t2_destroy(opj_t2_t *t2);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __T2_H */
|
3482
src/lib/openjp3d/tcd.c → libopenjp3d/tcd.c
Normal file → Executable file
3482
src/lib/openjp3d/tcd.c → libopenjp3d/tcd.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
7
src/lib/openjp3d/tcd.h → libopenjp3d/tcd.h
Normal file → Executable file
7
src/lib/openjp3d/tcd.h → libopenjp3d/tcd.h
Normal file → Executable file
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
@ -120,7 +115,7 @@ typedef struct opj_tcd_cblk {
|
||||
opj_tcd_pass_t passes[100];
|
||||
/* Data */
|
||||
unsigned char data[524288];
|
||||
/*unsigned char *data;*/
|
||||
//unsigned char *data;
|
||||
} opj_tcd_cblk_t;
|
||||
|
||||
/**
|
512
src/lib/openjp3d/tgt.c → libopenjp3d/tgt.c
Normal file → Executable file
512
src/lib/openjp3d/tgt.c → libopenjp3d/tgt.c
Normal file → Executable file
@ -1,256 +1,256 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Tag-tree coder interface
|
||||
==========================================================
|
||||
*/
|
||||
void tgt_tree_dump (FILE *fd, opj_tgt_tree_t * tree){
|
||||
int nodesno;
|
||||
|
||||
fprintf(fd, "TGT_TREE {\n");
|
||||
fprintf(fd, " numnodes: %d \n", tree->numnodes);
|
||||
fprintf(fd, " numleafsh: %d, numleafsv: %d, numleafsz: %d,\n", tree->numleafsh, tree->numleafsv, tree->numleafsz);
|
||||
|
||||
for (nodesno = 0; nodesno < tree->numnodes; nodesno++) {
|
||||
fprintf(fd, "tgt_node %d {\n", nodesno);
|
||||
fprintf(fd, " value: %d \n", tree->nodes[nodesno].value);
|
||||
fprintf(fd, " low: %d \n", tree->nodes[nodesno].low);
|
||||
fprintf(fd, " known: %d \n", tree->nodes[nodesno].known);
|
||||
if (tree->nodes[nodesno].parent) {
|
||||
fprintf(fd, " parent.value: %d \n", tree->nodes[nodesno].parent->value);
|
||||
fprintf(fd, " parent.low: %d \n", tree->nodes[nodesno].parent->low);
|
||||
fprintf(fd, " parent.known: %d \n", tree->nodes[nodesno].parent->known);
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
opj_tgt_tree_t *tgt_create(int numleafsh, int numleafsv, int numleafsz) {
|
||||
|
||||
int nplh[32];
|
||||
int nplv[32];
|
||||
int nplz[32];
|
||||
opj_tgt_node_t *node = NULL;
|
||||
opj_tgt_node_t *parentnode = NULL;
|
||||
opj_tgt_node_t *parentnode0 = NULL;
|
||||
opj_tgt_node_t *parentnode1 = NULL;
|
||||
opj_tgt_tree_t *tree = NULL;
|
||||
int i, j, k, p, p0;
|
||||
int numlvls;
|
||||
int n, z = 0;
|
||||
|
||||
tree = (opj_tgt_tree_t *) opj_malloc(sizeof(opj_tgt_tree_t));
|
||||
if(!tree)
|
||||
return NULL;
|
||||
tree->numleafsh = numleafsh;
|
||||
tree->numleafsv = numleafsv;
|
||||
tree->numleafsz = numleafsz;
|
||||
|
||||
numlvls = 0;
|
||||
nplh[0] = numleafsh;
|
||||
nplv[0] = numleafsv;
|
||||
nplz[0] = numleafsz;
|
||||
tree->numnodes = 0;
|
||||
do {
|
||||
n = nplh[numlvls] * nplv[numlvls] * nplz[numlvls];
|
||||
nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
|
||||
nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
|
||||
nplz[numlvls + 1] = (nplz[numlvls] + 1) / 2;
|
||||
tree->numnodes += n;
|
||||
++numlvls;
|
||||
} while (n > 1);
|
||||
|
||||
if (tree->numnodes == 0) {
|
||||
opj_free(tree);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tree->nodes = (opj_tgt_node_t *) opj_malloc(tree->numnodes * sizeof(opj_tgt_node_t));
|
||||
if(!tree->nodes) {
|
||||
opj_free(tree);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node = tree->nodes;
|
||||
parentnode = &tree->nodes[tree->numleafsh * tree->numleafsv * tree->numleafsz];
|
||||
parentnode0 = parentnode;
|
||||
parentnode1 = parentnode;
|
||||
/*fprintf(stdout,"\nH %d V %d Z %d numlvls %d nodes %d\n",tree->numleafsh,tree->numleafsv,tree->numleafsz,numlvls,tree->numnodes);*/
|
||||
for (i = 0; i < numlvls - 1; ++i) {
|
||||
for (z = 0; z < nplz[i]; ++z) {
|
||||
for (j = 0; j < nplv[i]; ++j) {
|
||||
k = nplh[i];
|
||||
while(--k >= 0) {
|
||||
node->parent = parentnode; /*fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);*/
|
||||
++node;
|
||||
if(--k >= 0) {
|
||||
node->parent = parentnode; /*fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);*/
|
||||
++node;
|
||||
}
|
||||
++parentnode;
|
||||
}
|
||||
if((j & 1) || j == nplv[i] - 1) {
|
||||
parentnode0 = parentnode;
|
||||
} else {
|
||||
parentnode = parentnode0;
|
||||
}
|
||||
}
|
||||
if ((z & 1) || z == nplz[i] - 1) {
|
||||
parentnode1 = parentnode;
|
||||
} else {
|
||||
parentnode0 = parentnode1;
|
||||
parentnode = parentnode1;
|
||||
}
|
||||
}
|
||||
}
|
||||
node->parent = 0;
|
||||
|
||||
|
||||
tgt_reset(tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
void tgt_destroy(opj_tgt_tree_t *tree) {
|
||||
opj_free(tree->nodes);
|
||||
opj_free(tree);
|
||||
}
|
||||
|
||||
void tgt_reset(opj_tgt_tree_t *tree) {
|
||||
int i;
|
||||
|
||||
if (NULL == tree)
|
||||
return;
|
||||
|
||||
for (i = 0; i < tree->numnodes; i++) {
|
||||
tree->nodes[i].value = 999;
|
||||
tree->nodes[i].low = 0;
|
||||
tree->nodes[i].known = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void tgt_setvalue(opj_tgt_tree_t *tree, int leafno, int value) {
|
||||
opj_tgt_node_t *node;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node && node->value > value) {
|
||||
node->value = value;
|
||||
node = node->parent;
|
||||
}
|
||||
}
|
||||
|
||||
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold) {
|
||||
opj_tgt_node_t *stk[31];
|
||||
opj_tgt_node_t **stkptr;
|
||||
opj_tgt_node_t *node;
|
||||
int low;
|
||||
|
||||
stkptr = stk;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node->parent) {
|
||||
*stkptr++ = node;
|
||||
node = node->parent;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if (low > node->low) {
|
||||
node->low = low;
|
||||
} else {
|
||||
low = node->low;
|
||||
}
|
||||
|
||||
while (low < threshold) {
|
||||
if (low >= node->value) {
|
||||
if (!node->known) {
|
||||
bio_write(bio, 1, 1);
|
||||
node->known = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
bio_write(bio, 0, 1);
|
||||
++low;
|
||||
}
|
||||
|
||||
node->low = low;
|
||||
if (stkptr == stk)
|
||||
break;
|
||||
node = *--stkptr;
|
||||
}
|
||||
}
|
||||
|
||||
int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold) {
|
||||
opj_tgt_node_t *stk[31];
|
||||
opj_tgt_node_t **stkptr;
|
||||
opj_tgt_node_t *node;
|
||||
int low;
|
||||
|
||||
stkptr = stk;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node->parent) {
|
||||
*stkptr++ = node;
|
||||
node = node->parent;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if (low > node->low) {
|
||||
node->low = low;
|
||||
} else {
|
||||
low = node->low;
|
||||
}
|
||||
while (low < threshold && low < node->value) {
|
||||
if (bio_read(bio, 1)) {
|
||||
node->value = low;
|
||||
} else {
|
||||
++low;
|
||||
}
|
||||
}
|
||||
node->low = low;
|
||||
if (stkptr == stk) {
|
||||
break;
|
||||
}
|
||||
node = *--stkptr;
|
||||
}
|
||||
|
||||
return (node->value < threshold) ? 1 : 0;
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Tag-tree coder interface
|
||||
==========================================================
|
||||
*/
|
||||
void tgt_tree_dump (FILE *fd, opj_tgt_tree_t * tree){
|
||||
int nodesno;
|
||||
|
||||
fprintf(fd, "TGT_TREE {\n");
|
||||
fprintf(fd, " numnodes: %d \n", tree->numnodes);
|
||||
fprintf(fd, " numleafsh: %d, numleafsv: %d, numleafsz: %d,\n", tree->numleafsh, tree->numleafsv, tree->numleafsz);
|
||||
|
||||
for (nodesno = 0; nodesno < tree->numnodes; nodesno++) {
|
||||
fprintf(fd, "tgt_node %d {\n", nodesno);
|
||||
fprintf(fd, " value: %d \n", tree->nodes[nodesno].value);
|
||||
fprintf(fd, " low: %d \n", tree->nodes[nodesno].low);
|
||||
fprintf(fd, " known: %d \n", tree->nodes[nodesno].known);
|
||||
if (tree->nodes[nodesno].parent) {
|
||||
fprintf(fd, " parent.value: %d \n", tree->nodes[nodesno].parent->value);
|
||||
fprintf(fd, " parent.low: %d \n", tree->nodes[nodesno].parent->low);
|
||||
fprintf(fd, " parent.known: %d \n", tree->nodes[nodesno].parent->known);
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
opj_tgt_tree_t *tgt_create(int numleafsh, int numleafsv, int numleafsz) {
|
||||
|
||||
int nplh[32];
|
||||
int nplv[32];
|
||||
int nplz[32];
|
||||
opj_tgt_node_t *node = NULL;
|
||||
opj_tgt_node_t *parentnode = NULL;
|
||||
opj_tgt_node_t *parentnode0 = NULL;
|
||||
opj_tgt_tree_t *tree = NULL;
|
||||
int i, j, k, p, p0;
|
||||
int numlvls;
|
||||
int n, z = 0;
|
||||
|
||||
tree = (opj_tgt_tree_t *) opj_malloc(sizeof(opj_tgt_tree_t));
|
||||
if(!tree)
|
||||
return NULL;
|
||||
tree->numleafsh = numleafsh;
|
||||
tree->numleafsv = numleafsv;
|
||||
tree->numleafsz = numleafsz;
|
||||
|
||||
numlvls = 0;
|
||||
nplh[0] = numleafsh;
|
||||
nplv[0] = numleafsv;
|
||||
nplz[0] = numleafsz;
|
||||
tree->numnodes = 0;
|
||||
do {
|
||||
n = nplh[numlvls] * nplv[numlvls] * nplz[numlvls];
|
||||
nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
|
||||
nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
|
||||
nplz[numlvls + 1] = (nplz[numlvls] + 1) / 2;
|
||||
tree->numnodes += n;
|
||||
++numlvls;
|
||||
} while (n > 1);
|
||||
|
||||
if (tree->numnodes == 0) {
|
||||
opj_free(tree);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tree->nodes = (opj_tgt_node_t *) opj_malloc(tree->numnodes * sizeof(opj_tgt_node_t));
|
||||
if(!tree->nodes) {
|
||||
opj_free(tree);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node = tree->nodes;
|
||||
parentnode = &tree->nodes[tree->numleafsh * tree->numleafsv * tree->numleafsz];
|
||||
parentnode0 = parentnode;
|
||||
|
||||
p = tree->numleafsh * tree->numleafsv * tree->numleafsz;
|
||||
p0 = p;
|
||||
n = 0;
|
||||
//fprintf(stdout,"\nH %d V %d Z %d numlvls %d nodes %d\n",tree->numleafsh,tree->numleafsv,tree->numleafsz,numlvls,tree->numnodes);
|
||||
for (i = 0; i < numlvls - 1; ++i) {
|
||||
for (j = 0; j < nplv[i]; ++j) {
|
||||
k = nplh[i]*nplz[i];
|
||||
while (--k >= 0) {
|
||||
node->parent = parentnode; //fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);
|
||||
++node; ++n;
|
||||
if (--k >= 0 && n < p) {
|
||||
node->parent = parentnode; //fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);
|
||||
++node; ++n;
|
||||
}
|
||||
if (nplz[i] != 1){ //2D operation vs 3D operation
|
||||
if (--k >= 0 && n < p) {
|
||||
node->parent = parentnode; //fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);
|
||||
++node; ++n;
|
||||
}
|
||||
if (--k >= 0 && n < p) {
|
||||
node->parent = parentnode; //fprintf(stdout,"node[%d].parent = node[%d]\n",n,p);
|
||||
++node; ++n;
|
||||
}
|
||||
}
|
||||
++parentnode; ++p;
|
||||
}
|
||||
if ((j & 1) || j == nplv[i] - 1) {
|
||||
parentnode0 = parentnode; p0 = p; //fprintf(stdout,"parent = node[%d] \n",p);
|
||||
} else {
|
||||
parentnode = parentnode0; p = p0; //fprintf(stdout,"parent = node[%d] \n",p);
|
||||
parentnode0 += nplh[i]*nplz[i]; p0 += nplh[i]*nplz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
node->parent = 0;
|
||||
|
||||
|
||||
tgt_reset(tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
void tgt_destroy(opj_tgt_tree_t *tree) {
|
||||
opj_free(tree->nodes);
|
||||
opj_free(tree);
|
||||
}
|
||||
|
||||
void tgt_reset(opj_tgt_tree_t *tree) {
|
||||
int i;
|
||||
|
||||
if (NULL == tree)
|
||||
return;
|
||||
|
||||
for (i = 0; i < tree->numnodes; i++) {
|
||||
tree->nodes[i].value = 999;
|
||||
tree->nodes[i].low = 0;
|
||||
tree->nodes[i].known = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void tgt_setvalue(opj_tgt_tree_t *tree, int leafno, int value) {
|
||||
opj_tgt_node_t *node;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node && node->value > value) {
|
||||
node->value = value;
|
||||
node = node->parent;
|
||||
}
|
||||
}
|
||||
|
||||
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold) {
|
||||
opj_tgt_node_t *stk[31];
|
||||
opj_tgt_node_t **stkptr;
|
||||
opj_tgt_node_t *node;
|
||||
int low;
|
||||
|
||||
stkptr = stk;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node->parent) {
|
||||
*stkptr++ = node;
|
||||
node = node->parent;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if (low > node->low) {
|
||||
node->low = low;
|
||||
} else {
|
||||
low = node->low;
|
||||
}
|
||||
|
||||
while (low < threshold) {
|
||||
if (low >= node->value) {
|
||||
if (!node->known) {
|
||||
bio_write(bio, 1, 1);
|
||||
node->known = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
bio_write(bio, 0, 1);
|
||||
++low;
|
||||
}
|
||||
|
||||
node->low = low;
|
||||
if (stkptr == stk)
|
||||
break;
|
||||
node = *--stkptr;
|
||||
}
|
||||
}
|
||||
|
||||
int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold) {
|
||||
opj_tgt_node_t *stk[31];
|
||||
opj_tgt_node_t **stkptr;
|
||||
opj_tgt_node_t *node;
|
||||
int low;
|
||||
|
||||
stkptr = stk;
|
||||
node = &tree->nodes[leafno];
|
||||
while (node->parent) {
|
||||
*stkptr++ = node;
|
||||
node = node->parent;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if (low > node->low) {
|
||||
node->low = low;
|
||||
} else {
|
||||
low = node->low;
|
||||
}
|
||||
while (low < threshold && low < node->value) {
|
||||
if (bio_read(bio, 1)) {
|
||||
node->value = low;
|
||||
} else {
|
||||
++low;
|
||||
}
|
||||
}
|
||||
node->low = low;
|
||||
if (stkptr == stk) {
|
||||
break;
|
||||
}
|
||||
node = *--stkptr;
|
||||
}
|
||||
|
||||
return (node->value < threshold) ? 1 : 0;
|
||||
}
|
254
src/lib/openjp3d/tgt.h → libopenjp3d/tgt.h
Normal file → Executable file
254
src/lib/openjp3d/tgt.h → libopenjp3d/tgt.h
Normal file → Executable file
@ -1,130 +1,124 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TGT_H
|
||||
#define __TGT_H
|
||||
/**
|
||||
@file tgt.h
|
||||
@brief Implementation of a tag-tree coder (TGT)
|
||||
|
||||
The functions in TGT.C have for goal to realize a tag-tree coder. The functions in TGT.C
|
||||
are used by some function in T2.C.
|
||||
*/
|
||||
|
||||
/** @defgroup TGT TGT - Implementation of a tag-tree coder */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Tag node
|
||||
*/
|
||||
typedef struct opj_tgt_node {
|
||||
/** Node parent reference */
|
||||
struct opj_tgt_node *parent;
|
||||
/** */
|
||||
int value;
|
||||
/** */
|
||||
int low;
|
||||
/** */
|
||||
int known;
|
||||
} opj_tgt_node_t;
|
||||
|
||||
/**
|
||||
Tag tree
|
||||
*/
|
||||
typedef struct opj_tgt_tree {
|
||||
/** Number of leaves from horizontal axis */
|
||||
int numleafsh;
|
||||
/** Number of leaves from vertical axis */
|
||||
int numleafsv;
|
||||
/** Number of leaves from axial axis */
|
||||
int numleafsz;
|
||||
/** Number of nodes */
|
||||
int numnodes;
|
||||
/** Reference to each node instance */
|
||||
opj_tgt_node_t *nodes;
|
||||
} opj_tgt_tree_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a tag-tree
|
||||
@param numleafsh Width of the array of leafs of the tree
|
||||
@param numleafsv Height of the array of leafs of the tree
|
||||
@param numleafsz Depth of the array of leafs of the tree
|
||||
@return Returns a new tag-tree if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *tgt_create(int numleafsh, int numleafsv, int numleafsz);
|
||||
/**
|
||||
Destroy a tag-tree, liberating memory
|
||||
@param tree Tag-tree to destroy
|
||||
*/
|
||||
void tgt_destroy(opj_tgt_tree_t *tree);
|
||||
/**
|
||||
Reset a tag-tree (set all leaves to 0)
|
||||
@param tree Tag-tree to reset
|
||||
*/
|
||||
void tgt_reset(opj_tgt_tree_t *tree);
|
||||
/**
|
||||
Set the value of a leaf of a tag-tree
|
||||
@param tree Tag-tree to modify
|
||||
@param leafno Number that identifies the leaf to modify
|
||||
@param value New value of the leaf
|
||||
*/
|
||||
void tgt_setvalue(opj_tgt_tree_t *tree, int leafno, int value);
|
||||
/**
|
||||
Encode the value of a leaf of the tag-tree up to a given threshold
|
||||
@param bio Pointer to a BIO handle
|
||||
@param tree Tag-tree to modify
|
||||
@param leafno Number that identifies the leaf to encode
|
||||
@param threshold Threshold to use when encoding value of the leaf
|
||||
*/
|
||||
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
|
||||
/**
|
||||
Decode the value of a leaf of the tag-tree up to a given threshold
|
||||
@param bio Pointer to a BIO handle
|
||||
@param tree Tag-tree to decode
|
||||
@param leafno Number that identifies the leaf to decode
|
||||
@param threshold Threshold to use when decoding value of the leaf
|
||||
@return Returns 1 if the node's value < threshold, returns 0 otherwise
|
||||
*/
|
||||
int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
|
||||
|
||||
/*@}*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
void tgt_tree_dump (FILE *fd, opj_tgt_tree_t * tree);
|
||||
/*@}*/
|
||||
|
||||
#endif /* __TGT_H */
|
||||
/*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TGT_H
|
||||
#define __TGT_H
|
||||
/**
|
||||
@file tgt.h
|
||||
@brief Implementation of a tag-tree coder (TGT)
|
||||
|
||||
The functions in TGT.C have for goal to realize a tag-tree coder. The functions in TGT.C
|
||||
are used by some function in T2.C.
|
||||
*/
|
||||
|
||||
/** @defgroup TGT TGT - Implementation of a tag-tree coder */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Tag node
|
||||
*/
|
||||
typedef struct opj_tgt_node {
|
||||
/** Node parent reference */
|
||||
struct opj_tgt_node *parent;
|
||||
/** */
|
||||
int value;
|
||||
/** */
|
||||
int low;
|
||||
/** */
|
||||
int known;
|
||||
} opj_tgt_node_t;
|
||||
|
||||
/**
|
||||
Tag tree
|
||||
*/
|
||||
typedef struct opj_tgt_tree {
|
||||
/** Number of leaves from horizontal axis */
|
||||
int numleafsh;
|
||||
/** Number of leaves from vertical axis */
|
||||
int numleafsv;
|
||||
/** Number of leaves from axial axis */
|
||||
int numleafsz;
|
||||
/** Number of nodes */
|
||||
int numnodes;
|
||||
/** Reference to each node instance */
|
||||
opj_tgt_node_t *nodes;
|
||||
} opj_tgt_tree_t;
|
||||
|
||||
/** @name Funciones generales */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a tag-tree
|
||||
@param numleafsh Width of the array of leafs of the tree
|
||||
@param numleafsv Height of the array of leafs of the tree
|
||||
@param numleafsz Depth of the array of leafs of the tree
|
||||
@return Returns a new tag-tree if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *tgt_create(int numleafsh, int numleafsv, int numleafsz);
|
||||
/**
|
||||
Destroy a tag-tree, liberating memory
|
||||
@param tree Tag-tree to destroy
|
||||
*/
|
||||
void tgt_destroy(opj_tgt_tree_t *tree);
|
||||
/**
|
||||
Reset a tag-tree (set all leaves to 0)
|
||||
@param tree Tag-tree to reset
|
||||
*/
|
||||
void tgt_reset(opj_tgt_tree_t *tree);
|
||||
/**
|
||||
Set the value of a leaf of a tag-tree
|
||||
@param tree Tag-tree to modify
|
||||
@param leafno Number that identifies the leaf to modify
|
||||
@param value New value of the leaf
|
||||
*/
|
||||
void tgt_setvalue(opj_tgt_tree_t *tree, int leafno, int value);
|
||||
/**
|
||||
Encode the value of a leaf of the tag-tree up to a given threshold
|
||||
@param bio Pointer to a BIO handle
|
||||
@param tree Tag-tree to modify
|
||||
@param leafno Number that identifies the leaf to encode
|
||||
@param threshold Threshold to use when encoding value of the leaf
|
||||
*/
|
||||
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
|
||||
/**
|
||||
Decode the value of a leaf of the tag-tree up to a given threshold
|
||||
@param bio Pointer to a BIO handle
|
||||
@param tree Tag-tree to decode
|
||||
@param leafno Number that identifies the leaf to decode
|
||||
@param threshold Threshold to use when decoding value of the leaf
|
||||
@return Returns 1 if the node's value < threshold, returns 0 otherwise
|
||||
*/
|
||||
int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
|
||||
|
||||
/*@}*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
void tgt_tree_dump (FILE *fd, opj_tgt_tree_t * tree);
|
||||
|
||||
#endif /* __TGT_H */
|
185
src/lib/openjp3d/volume.c → libopenjp3d/volume.c
Normal file → Executable file
185
src/lib/openjp3d/volume.c → libopenjp3d/volume.c
Normal file → Executable file
@ -1,96 +1,89 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
#include "volume.h"
|
||||
#include "openjp3d.h"
|
||||
|
||||
opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {
|
||||
int compno;
|
||||
opj_volume_t *volume = NULL;
|
||||
|
||||
volume = (opj_volume_t*)opj_malloc(sizeof(opj_volume_t));
|
||||
if(volume) {
|
||||
volume->color_space = clrspc;
|
||||
volume->numcomps = numcmpts;
|
||||
/* allocate memory for the per-component information */
|
||||
volume->comps = (opj_volume_comp_t*)opj_malloc(volume->numcomps * sizeof(opj_volume_comp_t));
|
||||
if(!volume->comps) {
|
||||
opj_volume_destroy(volume);
|
||||
return NULL;
|
||||
}
|
||||
/* create the individual volume components */
|
||||
for(compno = 0; compno < numcmpts; compno++) {
|
||||
opj_volume_comp_t *comp = &volume->comps[compno];
|
||||
comp->dx = cmptparms[compno].dx;
|
||||
comp->dy = cmptparms[compno].dy;
|
||||
comp->dz = cmptparms[compno].dz;
|
||||
comp->w = cmptparms[compno].w;
|
||||
comp->h = cmptparms[compno].h;
|
||||
comp->l = cmptparms[compno].l;
|
||||
comp->x0 = cmptparms[compno].x0;
|
||||
comp->y0 = cmptparms[compno].y0;
|
||||
comp->z0 = cmptparms[compno].z0;
|
||||
comp->prec = cmptparms[compno].prec;
|
||||
comp->bpp = cmptparms[compno].bpp;
|
||||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
comp->bigendian = cmptparms[compno].bigendian;
|
||||
comp->dcoffset = cmptparms[compno].dcoffset;
|
||||
comp->data = (int*)opj_malloc(comp->w * comp->h * comp->l * sizeof(int));
|
||||
if(!comp->data) {
|
||||
fprintf(stdout,"Unable to malloc comp->data (%d x %d x %d x bytes)",comp->w,comp->h,comp->l);
|
||||
opj_volume_destroy(volume);
|
||||
return NULL;
|
||||
}
|
||||
/*fprintf(stdout,"%d %d %d %d %d %d %d %d %d", comp->w,comp->h, comp->l, comp->dx, comp->dy, comp->dz, comp->prec, comp->bpp, comp->sgnd);*/
|
||||
}
|
||||
}
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_volume_destroy(opj_volume_t *volume) {
|
||||
int i;
|
||||
if(volume) {
|
||||
if(volume->comps) {
|
||||
/* volume components */
|
||||
for(i = 0; i < volume->numcomps; i++) {
|
||||
opj_volume_comp_t *volume_comp = &volume->comps[i];
|
||||
if(volume_comp->data) {
|
||||
opj_free(volume_comp->data);
|
||||
}
|
||||
}
|
||||
opj_free(volume->comps);
|
||||
}
|
||||
opj_free(volume);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {
|
||||
int compno;
|
||||
opj_volume_t *volume = NULL;
|
||||
|
||||
volume = (opj_volume_t*)opj_malloc(sizeof(opj_volume_t));
|
||||
if(volume) {
|
||||
volume->color_space = clrspc;
|
||||
volume->numcomps = numcmpts;
|
||||
/* allocate memory for the per-component information */
|
||||
volume->comps = (opj_volume_comp_t*)opj_malloc(volume->numcomps * sizeof(opj_volume_comp_t));
|
||||
if(!volume->comps) {
|
||||
opj_volume_destroy(volume);
|
||||
return NULL;
|
||||
}
|
||||
/* create the individual volume components */
|
||||
for(compno = 0; compno < numcmpts; compno++) {
|
||||
opj_volume_comp_t *comp = &volume->comps[compno];
|
||||
comp->dx = cmptparms[compno].dx;
|
||||
comp->dy = cmptparms[compno].dy;
|
||||
comp->dz = cmptparms[compno].dz;
|
||||
comp->w = cmptparms[compno].w;
|
||||
comp->h = cmptparms[compno].h;
|
||||
comp->l = cmptparms[compno].l;
|
||||
comp->x0 = cmptparms[compno].x0;
|
||||
comp->y0 = cmptparms[compno].y0;
|
||||
comp->z0 = cmptparms[compno].z0;
|
||||
comp->prec = cmptparms[compno].prec;
|
||||
comp->bpp = cmptparms[compno].bpp;
|
||||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
comp->bigendian = cmptparms[compno].bigendian;
|
||||
comp->dcoffset = cmptparms[compno].dcoffset;
|
||||
comp->data = (int*)opj_malloc(comp->w * comp->h * comp->l * sizeof(int));
|
||||
if(!comp->data) {
|
||||
fprintf(stdout,"Unable to malloc comp->data (%d x %d x %d x bytes)",comp->w,comp->h,comp->l);
|
||||
opj_volume_destroy(volume);
|
||||
return NULL;
|
||||
}
|
||||
//fprintf(stdout,"%d %d %d %d %d %d %d %d %d", comp->w,comp->h, comp->l, comp->dx, comp->dy, comp->dz, comp->prec, comp->bpp, comp->sgnd);
|
||||
}
|
||||
}
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_volume_destroy(opj_volume_t *volume) {
|
||||
int i;
|
||||
if(volume) {
|
||||
if(volume->comps) {
|
||||
/* volume components */
|
||||
for(i = 0; i < volume->numcomps; i++) {
|
||||
opj_volume_comp_t *volume_comp = &volume->comps[i];
|
||||
if(volume_comp->data) {
|
||||
opj_free(volume_comp->data);
|
||||
}
|
||||
}
|
||||
opj_free(volume->comps);
|
||||
}
|
||||
opj_free(volume);
|
||||
}
|
||||
}
|
||||
|
91
src/lib/openjp3d/volume.h → libopenjp3d/volume.h
Normal file → Executable file
91
src/lib/openjp3d/volume.h → libopenjp3d/volume.h
Normal file → Executable file
@ -1,48 +1,43 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __VOLUME_H
|
||||
#define __VOLUME_H
|
||||
/**
|
||||
@file volume.h
|
||||
@brief Implementation of operations on volumes (VOLUME)
|
||||
|
||||
The functions in VOLUME.C have for goal to realize operations on volumes.
|
||||
*/
|
||||
|
||||
/** @defgroup VOLUME VOLUME - Implementation of operations on volumes */
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __VOLUME_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __VOLUME_H
|
||||
#define __VOLUME_H
|
||||
/**
|
||||
@file volume.h
|
||||
@brief Implementation of operations on volumes (VOLUME)
|
||||
|
||||
The functions in VOLUME.C have for goal to realize operations on volumes.
|
||||
*/
|
||||
|
||||
/** @defgroup VOLUME VOLUME - Implementation of operations on volumes */
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __VOLUME_H */
|
||||
|
@ -1,12 +0,0 @@
|
||||
# required dep for server:
|
||||
#if(BUILD_JPIP_SERVER)
|
||||
# find_package(CURL REQUIRED)
|
||||
# find_package(FCGI REQUIRED)
|
||||
# find_package(Threads REQUIRED)
|
||||
# if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
# message(FATAL_ERROR "Only pthread are supported")
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
#add_subdirectory(lib)
|
||||
#add_subdirectory(bin)
|
@ -1,21 +0,0 @@
|
||||
# source code for openjpeg apps:
|
||||
add_subdirectory(common)
|
||||
# Part 1 & 2:
|
||||
add_subdirectory(jp2)
|
||||
|
||||
# optionals components:
|
||||
if(BUILD_JPWL)
|
||||
add_subdirectory(jpwl)
|
||||
endif()
|
||||
if(BUILD_MJ2)
|
||||
add_subdirectory(mj2)
|
||||
endif()
|
||||
if(BUILD_JPIP)
|
||||
add_subdirectory(jpip)
|
||||
endif()
|
||||
if(BUILD_JP3D)
|
||||
add_subdirectory(jp3d)
|
||||
endif()
|
||||
|
||||
# wx apps:
|
||||
add_subdirectory(wx)
|
@ -1,7 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_apps_config.h generation
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
|
||||
@ONLY
|
||||
)
|
@ -1,965 +0,0 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "color.h"
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPJ_USE_LEGACY
|
||||
#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
|
||||
#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------
|
||||
Matrix for sYCC, Amendment 1 to IEC 61966-2-1
|
||||
|
||||
Y : 0.299 0.587 0.114 :R
|
||||
Cb: -0.1687 -0.3312 0.5 :G
|
||||
Cr: 0.5 -0.4187 -0.0812 :B
|
||||
|
||||
Inverse:
|
||||
|
||||
R: 1 -3.68213e-05 1.40199 :Y
|
||||
G: 1.00003 -0.344125 -0.714128 :Cb - 2^(prec - 1)
|
||||
B: 0.999823 1.77204 -8.04142e-06 :Cr - 2^(prec - 1)
|
||||
|
||||
-----------------------------------------------------------*/
|
||||
static void sycc_to_rgb(int offset, int upb, int y, int cb, int cr,
|
||||
int *out_r, int *out_g, int *out_b)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
cb -= offset; cr -= offset;
|
||||
r = y + (int)(1.402 * (float)cr);
|
||||
if(r < 0) r = 0; else if(r > upb) r = upb; *out_r = r;
|
||||
|
||||
g = y - (int)(0.344 * (float)cb + 0.714 * (float)cr);
|
||||
if(g < 0) g = 0; else if(g > upb) g = upb; *out_g = g;
|
||||
|
||||
b = y + (int)(1.772 * (float)cb);
|
||||
if(b < 0) b = 0; else if(b > upb) b = upb; *out_b = b;
|
||||
}
|
||||
|
||||
static void sycc444_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b;
|
||||
const int *y, *cb, *cr;
|
||||
size_t maxw, maxh, max, i;
|
||||
int offset, upb;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
|
||||
if(r == NULL || g == NULL || b == NULL) goto fails;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++cb; ++cr; ++r; ++g; ++b;
|
||||
}
|
||||
free(img->comps[0].data); img->comps[0].data = d0;
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
img->color_space = OPJ_CLRSPC_SRGB;
|
||||
return;
|
||||
|
||||
fails:
|
||||
free(r);
|
||||
free(g);
|
||||
free(b);
|
||||
}/* sycc444_to_rgb() */
|
||||
|
||||
static void sycc422_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b;
|
||||
const int *y, *cb, *cr;
|
||||
size_t maxw, maxh, max, offx, loopmaxw;
|
||||
int offset, upb;
|
||||
size_t i;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
|
||||
if(r == NULL || g == NULL || b == NULL) goto fails;
|
||||
|
||||
/* if img->x0 is odd, then first column shall use Cb/Cr = 0 */
|
||||
offx = img->x0 & 1U;
|
||||
loopmaxw = maxw - offx;
|
||||
|
||||
for(i=0U; i < maxh; ++i)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
if (offx > 0U) {
|
||||
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
}
|
||||
|
||||
for(j=0U; j < (loopmaxw & ~(size_t)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b; ++cb; ++cr;
|
||||
}
|
||||
if (j < loopmaxw) {
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b; ++cb; ++cr;
|
||||
}
|
||||
}
|
||||
|
||||
free(img->comps[0].data); img->comps[0].data = d0;
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
|
||||
img->comps[1].w = img->comps[2].w = img->comps[0].w;
|
||||
img->comps[1].h = img->comps[2].h = img->comps[0].h;
|
||||
img->comps[1].dx = img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[2].dy = img->comps[0].dy;
|
||||
img->color_space = OPJ_CLRSPC_SRGB;
|
||||
return;
|
||||
|
||||
fails:
|
||||
free(r);
|
||||
free(g);
|
||||
free(b);
|
||||
}/* sycc422_to_rgb() */
|
||||
|
||||
static void sycc420_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b, *nr, *ng, *nb;
|
||||
const int *y, *cb, *cr, *ny;
|
||||
size_t maxw, maxh, max, offx, loopmaxw, offy, loopmaxh;
|
||||
int offset, upb;
|
||||
size_t i;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
|
||||
if (r == NULL || g == NULL || b == NULL) goto fails;
|
||||
|
||||
/* if img->x0 is odd, then first column shall use Cb/Cr = 0 */
|
||||
offx = img->x0 & 1U;
|
||||
loopmaxw = maxw - offx;
|
||||
/* if img->y0 is odd, then first line shall use Cb/Cr = 0 */
|
||||
offy = img->y0 & 1U;
|
||||
loopmaxh = maxh - offy;
|
||||
|
||||
if (offy > 0U) {
|
||||
size_t j;
|
||||
|
||||
for(j=0; j < maxw; ++j)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0U; i < (loopmaxh & ~(size_t)1U); i += 2U)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
ny = y + maxw;
|
||||
nr = r + maxw; ng = g + maxw; nb = b + maxw;
|
||||
|
||||
if (offx > 0U) {
|
||||
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
++ny; ++nr; ++ng; ++nb;
|
||||
}
|
||||
|
||||
for(j=0; j < (loopmaxw & ~(size_t)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
++ny; ++nr; ++ng; ++nb;
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
|
||||
}
|
||||
if(j < loopmaxw)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
|
||||
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
|
||||
}
|
||||
y += maxw; r += maxw; g += maxw; b += maxw;
|
||||
}
|
||||
if(i < loopmaxh)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
for(j=0U; j < (maxw & ~(size_t)1U); j += 2U)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b;
|
||||
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
|
||||
++y; ++r; ++g; ++b; ++cb; ++cr;
|
||||
}
|
||||
if(j < maxw)
|
||||
{
|
||||
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
free(img->comps[0].data); img->comps[0].data = d0;
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
|
||||
img->comps[1].w = img->comps[2].w = img->comps[0].w;
|
||||
img->comps[1].h = img->comps[2].h = img->comps[0].h;
|
||||
img->comps[1].dx = img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[2].dy = img->comps[0].dy;
|
||||
img->color_space = OPJ_CLRSPC_SRGB;
|
||||
return;
|
||||
|
||||
fails:
|
||||
free(r);
|
||||
free(g);
|
||||
free(b);
|
||||
}/* sycc420_to_rgb() */
|
||||
|
||||
void color_sycc_to_rgb(opj_image_t *img)
|
||||
{
|
||||
if(img->numcomps < 3)
|
||||
{
|
||||
img->color_space = OPJ_CLRSPC_GRAY;
|
||||
return;
|
||||
}
|
||||
|
||||
if((img->comps[0].dx == 1)
|
||||
&& (img->comps[1].dx == 2)
|
||||
&& (img->comps[2].dx == 2)
|
||||
&& (img->comps[0].dy == 1)
|
||||
&& (img->comps[1].dy == 2)
|
||||
&& (img->comps[2].dy == 2))/* horizontal and vertical sub-sample */
|
||||
{
|
||||
sycc420_to_rgb(img);
|
||||
}
|
||||
else
|
||||
if((img->comps[0].dx == 1)
|
||||
&& (img->comps[1].dx == 2)
|
||||
&& (img->comps[2].dx == 2)
|
||||
&& (img->comps[0].dy == 1)
|
||||
&& (img->comps[1].dy == 1)
|
||||
&& (img->comps[2].dy == 1))/* horizontal sub-sample only */
|
||||
{
|
||||
sycc422_to_rgb(img);
|
||||
}
|
||||
else
|
||||
if((img->comps[0].dx == 1)
|
||||
&& (img->comps[1].dx == 1)
|
||||
&& (img->comps[2].dx == 1)
|
||||
&& (img->comps[0].dy == 1)
|
||||
&& (img->comps[1].dy == 1)
|
||||
&& (img->comps[2].dy == 1))/* no sub-sample */
|
||||
{
|
||||
sycc444_to_rgb(img);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
|
||||
return;
|
||||
}
|
||||
}/* color_sycc_to_rgb() */
|
||||
|
||||
#if defined(OPJ_HAVE_LIBLCMS2) || defined(OPJ_HAVE_LIBLCMS1)
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
/* Bob Friesenhahn proposed:*/
|
||||
#define cmsSigXYZData icSigXYZData
|
||||
#define cmsSigLabData icSigLabData
|
||||
#define cmsSigCmykData icSigCmykData
|
||||
#define cmsSigYCbCrData icSigYCbCrData
|
||||
#define cmsSigLuvData icSigLuvData
|
||||
#define cmsSigGrayData icSigGrayData
|
||||
#define cmsSigRgbData icSigRgbData
|
||||
#define cmsUInt32Number DWORD
|
||||
|
||||
#define cmsColorSpaceSignature icColorSpaceSignature
|
||||
#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent
|
||||
|
||||
#endif /* OPJ_HAVE_LIBLCMS1 */
|
||||
|
||||
/*#define DEBUG_PROFILE*/
|
||||
void color_apply_icc_profile(opj_image_t *image)
|
||||
{
|
||||
cmsHPROFILE in_prof, out_prof;
|
||||
cmsHTRANSFORM transform;
|
||||
cmsColorSpaceSignature in_space, out_space;
|
||||
cmsUInt32Number intent, in_type, out_type;
|
||||
int *r, *g, *b;
|
||||
size_t nr_samples, i, max, max_w, max_h;
|
||||
int prec, ok = 0;
|
||||
OPJ_COLOR_SPACE new_space;
|
||||
|
||||
in_prof = cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
|
||||
#ifdef DEBUG_PROFILE
|
||||
FILE *icm = fopen("debug.icm","wb");
|
||||
fwrite( image->icc_profile_buf,1, image->icc_profile_len,icm);
|
||||
fclose(icm);
|
||||
#endif
|
||||
|
||||
if(in_prof == NULL) return;
|
||||
|
||||
in_space = cmsGetPCS(in_prof);
|
||||
out_space = cmsGetColorSpace(in_prof);
|
||||
intent = cmsGetHeaderRenderingIntent(in_prof);
|
||||
|
||||
|
||||
max_w = image->comps[0].w;
|
||||
max_h = image->comps[0].h;
|
||||
prec = (int)image->comps[0].prec;
|
||||
|
||||
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
||||
{
|
||||
if( prec <= 8 )
|
||||
{
|
||||
in_type = TYPE_RGB_8;
|
||||
out_type = TYPE_RGB_8;
|
||||
}
|
||||
else
|
||||
{
|
||||
in_type = TYPE_RGB_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
}
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
new_space = OPJ_CLRSPC_SRGB;
|
||||
}
|
||||
else if(out_space == cmsSigGrayData) /* enumCS 17 */
|
||||
{
|
||||
in_type = TYPE_GRAY_8;
|
||||
out_type = TYPE_RGB_8;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
new_space = OPJ_CLRSPC_SRGB;
|
||||
}
|
||||
else if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
||||
{
|
||||
in_type = TYPE_YCbCr_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
new_space = OPJ_CLRSPC_SRGB;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_PROFILE
|
||||
fprintf(stderr,"%s:%d: color_apply_icc_profile\n\tICC Profile has unknown "
|
||||
"output colorspace(%#x)(%c%c%c%c)\n\tICC Profile ignored.\n",
|
||||
__FILE__,__LINE__,out_space,
|
||||
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
|
||||
(out_space>>8) & 0xff, out_space & 0xff);
|
||||
#endif
|
||||
cmsCloseProfile(in_prof);
|
||||
|
||||
return;
|
||||
}
|
||||
if(out_prof == NULL)
|
||||
{
|
||||
cmsCloseProfile(in_prof);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PROFILE
|
||||
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tchannels(%d) prec(%d) w(%d) h(%d)"
|
||||
"\n\tprofile: in(%p) out(%p)\n",__FILE__,__LINE__,image->numcomps,prec,
|
||||
max_w,max_h, (void*)in_prof,(void*)out_prof);
|
||||
|
||||
fprintf(stderr,"\trender_intent (%u)\n\t"
|
||||
"color_space: in(%#x)(%c%c%c%c) out:(%#x)(%c%c%c%c)\n\t"
|
||||
" type: in(%u) out:(%u)\n",
|
||||
intent,
|
||||
in_space,
|
||||
(in_space>>24) & 0xff,(in_space>>16) & 0xff,
|
||||
(in_space>>8) & 0xff, in_space & 0xff,
|
||||
|
||||
out_space,
|
||||
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
|
||||
(out_space>>8) & 0xff, out_space & 0xff,
|
||||
|
||||
in_type,out_type
|
||||
);
|
||||
#else
|
||||
(void)prec;
|
||||
(void)in_space;
|
||||
#endif /* DEBUG_PROFILE */
|
||||
|
||||
transform = cmsCreateTransform(in_prof, in_type, out_prof, out_type, intent, 0);
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
/* Possible for: LCMS_VERSION >= 2000 :*/
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
|
||||
if(transform == NULL)
|
||||
{
|
||||
#ifdef DEBUG_PROFILE
|
||||
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
"ICC Profile ignored.\n",__FILE__,__LINE__);
|
||||
#endif
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if(image->numcomps > 2)/* RGB, RGBA */
|
||||
{
|
||||
if( prec <= 8 )
|
||||
{
|
||||
unsigned char *inbuf, *outbuf, *in, *out;
|
||||
|
||||
max = max_w * max_h;
|
||||
nr_samples = (size_t)(max * 3U * sizeof(unsigned char));
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
|
||||
if(inbuf == NULL || outbuf == NULL) goto fails0;
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
*in++ = (unsigned char)*r++;
|
||||
*in++ = (unsigned char)*g++;
|
||||
*in++ = (unsigned char)*b++;
|
||||
}
|
||||
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++;
|
||||
*g++ = (int)*out++;
|
||||
*b++ = (int)*out++;
|
||||
}
|
||||
ok = 1;
|
||||
|
||||
fails0:
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
}
|
||||
else /* prec > 8 */
|
||||
{
|
||||
unsigned short *inbuf, *outbuf, *in, *out;
|
||||
|
||||
max = max_w * max_h;
|
||||
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
|
||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||
|
||||
if(inbuf == NULL || outbuf == NULL) goto fails1;
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0U ; i < max; ++i)
|
||||
{
|
||||
*in++ = (unsigned short)*r++;
|
||||
*in++ = (unsigned short)*g++;
|
||||
*in++ = (unsigned short)*b++;
|
||||
}
|
||||
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++;
|
||||
*g++ = (int)*out++;
|
||||
*b++ = (int)*out++;
|
||||
}
|
||||
ok = 1;
|
||||
|
||||
fails1:
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
}
|
||||
}
|
||||
else /* image->numcomps <= 2 : GRAY, GRAYA */
|
||||
{
|
||||
if(prec <= 8)
|
||||
{
|
||||
unsigned char *in, *inbuf, *out, *outbuf;
|
||||
opj_image_comp_t *new_comps;
|
||||
|
||||
max = max_w * max_h;
|
||||
nr_samples = (size_t)(max * 3 * sizeof(unsigned char));
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
g = (int*)calloc((size_t)max, sizeof(int));
|
||||
b = (int*)calloc((size_t)max, sizeof(int));
|
||||
|
||||
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails2;
|
||||
|
||||
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
||||
|
||||
if(new_comps == NULL) goto fails2;
|
||||
|
||||
image->comps = new_comps;
|
||||
|
||||
if(image->numcomps == 2)
|
||||
image->comps[3] = image->comps[1];
|
||||
|
||||
image->comps[1] = image->comps[0];
|
||||
image->comps[2] = image->comps[0];
|
||||
|
||||
image->comps[1].data = g;
|
||||
image->comps[2].data = b;
|
||||
|
||||
image->numcomps += 2;
|
||||
|
||||
r = image->comps[0].data;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
*in++ = (unsigned char)*r++;
|
||||
}
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
|
||||
}
|
||||
r = g = b = NULL;
|
||||
ok = 1;
|
||||
|
||||
fails2:
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
free(g);
|
||||
free(b);
|
||||
}
|
||||
else /* prec > 8 */
|
||||
{
|
||||
unsigned short *in, *inbuf, *out, *outbuf;
|
||||
opj_image_comp_t *new_comps;
|
||||
|
||||
max = max_w * max_h;
|
||||
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
|
||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||
g = (int*)calloc((size_t)max, sizeof(int));
|
||||
b = (int*)calloc((size_t)max, sizeof(int));
|
||||
|
||||
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails3;
|
||||
|
||||
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
||||
|
||||
if(new_comps == NULL) goto fails3;
|
||||
|
||||
image->comps = new_comps;
|
||||
|
||||
if(image->numcomps == 2)
|
||||
image->comps[3] = image->comps[1];
|
||||
|
||||
image->comps[1] = image->comps[0];
|
||||
image->comps[2] = image->comps[0];
|
||||
|
||||
image->comps[1].data = g;
|
||||
image->comps[2].data = b;
|
||||
|
||||
image->numcomps += 2;
|
||||
|
||||
r = image->comps[0].data;
|
||||
|
||||
for(i = 0U; i < max; ++i)
|
||||
{
|
||||
*in++ = (unsigned short)*r++;
|
||||
}
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
|
||||
}
|
||||
r = g = b = NULL;
|
||||
ok = 1;
|
||||
|
||||
fails3:
|
||||
free(inbuf);
|
||||
free(outbuf);
|
||||
free(g);
|
||||
free(b);
|
||||
}
|
||||
}/* if(image->numcomps > 2) */
|
||||
|
||||
cmsDeleteTransform(transform);
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
if(ok)
|
||||
{
|
||||
image->color_space = new_space;
|
||||
}
|
||||
}/* color_apply_icc_profile() */
|
||||
|
||||
void color_cielab_to_rgb(opj_image_t *image)
|
||||
{
|
||||
int *row;
|
||||
int enumcs, numcomps;
|
||||
OPJ_COLOR_SPACE new_space;
|
||||
|
||||
numcomps = (int)image->numcomps;
|
||||
|
||||
if(numcomps != 3)
|
||||
{
|
||||
fprintf(stderr,"%s:%d:\n\tnumcomps %d not handled. Quitting.\n",
|
||||
__FILE__,__LINE__,numcomps);
|
||||
return;
|
||||
}
|
||||
|
||||
row = (int*)image->icc_profile_buf;
|
||||
enumcs = row[0];
|
||||
|
||||
if(enumcs == 14) /* CIELab */
|
||||
{
|
||||
int *L, *a, *b, *red, *green, *blue;
|
||||
int *src0, *src1, *src2, *dst0, *dst1, *dst2;
|
||||
double rl, ol, ra, oa, rb, ob, prec0, prec1, prec2;
|
||||
double minL, maxL, mina, maxa, minb, maxb;
|
||||
unsigned int default_type;
|
||||
unsigned int i, max;
|
||||
cmsHPROFILE in, out;
|
||||
cmsHTRANSFORM transform;
|
||||
cmsUInt16Number RGB[3];
|
||||
cmsCIELab Lab;
|
||||
|
||||
in = cmsCreateLab4Profile(NULL);
|
||||
if(in == NULL){
|
||||
return;
|
||||
}
|
||||
out = cmsCreate_sRGBProfile();
|
||||
if(out == NULL){
|
||||
cmsCloseProfile(in);
|
||||
return;
|
||||
}
|
||||
transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0);
|
||||
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
cmsCloseProfile(in);
|
||||
cmsCloseProfile(out);
|
||||
#endif
|
||||
if(transform == NULL)
|
||||
{
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in);
|
||||
cmsCloseProfile(out);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
new_space = OPJ_CLRSPC_SRGB;
|
||||
|
||||
prec0 = (double)image->comps[0].prec;
|
||||
prec1 = (double)image->comps[1].prec;
|
||||
prec2 = (double)image->comps[2].prec;
|
||||
|
||||
default_type = (unsigned int)row[1];
|
||||
|
||||
if(default_type == 0x44454600)/* DEF : default */
|
||||
{
|
||||
rl = 100; ra = 170; rb = 200;
|
||||
ol = 0;
|
||||
oa = pow(2, prec1 - 1);
|
||||
ob = pow(2, prec2 - 2) + pow(2, prec2 - 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
rl = row[2]; ra = row[4]; rb = row[6];
|
||||
ol = row[3]; oa = row[5]; ob = row[7];
|
||||
}
|
||||
|
||||
L = src0 = image->comps[0].data;
|
||||
a = src1 = image->comps[1].data;
|
||||
b = src2 = image->comps[2].data;
|
||||
|
||||
max = image->comps[0].w * image->comps[0].h;
|
||||
|
||||
red = dst0 = (int*)malloc(max * sizeof(int));
|
||||
green = dst1 = (int*)malloc(max * sizeof(int));
|
||||
blue = dst2 = (int*)malloc(max * sizeof(int));
|
||||
|
||||
if(red == NULL || green == NULL || blue == NULL) goto fails;
|
||||
|
||||
minL = -(rl * ol)/(pow(2, prec0)-1);
|
||||
maxL = minL + rl;
|
||||
|
||||
mina = -(ra * oa)/(pow(2, prec1)-1);
|
||||
maxa = mina + ra;
|
||||
|
||||
minb = -(rb * ob)/(pow(2, prec2)-1);
|
||||
maxb = minb + rb;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
Lab.L = minL + (double)(*L) * (maxL - minL)/(pow(2, prec0)-1); ++L;
|
||||
Lab.a = mina + (double)(*a) * (maxa - mina)/(pow(2, prec1)-1); ++a;
|
||||
Lab.b = minb + (double)(*b) * (maxb - minb)/(pow(2, prec2)-1); ++b;
|
||||
|
||||
cmsDoTransform(transform, &Lab, RGB, 1);
|
||||
|
||||
*red++ = RGB[0];
|
||||
*green++ = RGB[1];
|
||||
*blue++ = RGB[2];
|
||||
}
|
||||
cmsDeleteTransform(transform);
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in);
|
||||
cmsCloseProfile(out);
|
||||
#endif
|
||||
free(src0); image->comps[0].data = dst0;
|
||||
free(src1); image->comps[1].data = dst1;
|
||||
free(src2); image->comps[2].data = dst2;
|
||||
|
||||
image->color_space = new_space;
|
||||
image->comps[0].prec = 16;
|
||||
image->comps[1].prec = 16;
|
||||
image->comps[2].prec = 16;
|
||||
|
||||
return;
|
||||
|
||||
fails:
|
||||
cmsDeleteTransform(transform);
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in);
|
||||
cmsCloseProfile(out);
|
||||
#endif
|
||||
if(red) free(red);
|
||||
if(green) free(green);
|
||||
if(blue) free(blue);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs);
|
||||
}/* color_cielab_to_rgb() */
|
||||
|
||||
#endif /* OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 */
|
||||
|
||||
void color_cmyk_to_rgb(opj_image_t *image)
|
||||
{
|
||||
float C, M, Y, K;
|
||||
float sC, sM, sY, sK;
|
||||
unsigned int w, h, max, i;
|
||||
|
||||
w = image->comps[0].w;
|
||||
h = image->comps[0].h;
|
||||
|
||||
if (
|
||||
(image->numcomps < 4)
|
||||
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx) || (image->comps[0].dx != image->comps[3].dx)
|
||||
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy) || (image->comps[0].dy != image->comps[3].dy)
|
||||
) {
|
||||
fprintf(stderr,"%s:%d:color_cmyk_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
max = w * h;
|
||||
|
||||
sC = 1.0F / (float)((1 << image->comps[0].prec) - 1);
|
||||
sM = 1.0F / (float)((1 << image->comps[1].prec) - 1);
|
||||
sY = 1.0F / (float)((1 << image->comps[2].prec) - 1);
|
||||
sK = 1.0F / (float)((1 << image->comps[3].prec) - 1);
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
/* CMYK values from 0 to 1 */
|
||||
C = (float)(image->comps[0].data[i]) * sC;
|
||||
M = (float)(image->comps[1].data[i]) * sM;
|
||||
Y = (float)(image->comps[2].data[i]) * sY;
|
||||
K = (float)(image->comps[3].data[i]) * sK;
|
||||
|
||||
/* Invert all CMYK values */
|
||||
C = 1.0F - C;
|
||||
M = 1.0F - M;
|
||||
Y = 1.0F - Y;
|
||||
K = 1.0F - K;
|
||||
|
||||
/* CMYK -> RGB : RGB results from 0 to 255 */
|
||||
image->comps[0].data[i] = (int)(255.0F * C * K); /* R */
|
||||
image->comps[1].data[i] = (int)(255.0F * M * K); /* G */
|
||||
image->comps[2].data[i] = (int)(255.0F * Y * K); /* B */
|
||||
}
|
||||
|
||||
free(image->comps[3].data); image->comps[3].data = NULL;
|
||||
image->comps[0].prec = 8;
|
||||
image->comps[1].prec = 8;
|
||||
image->comps[2].prec = 8;
|
||||
image->numcomps -= 1;
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
|
||||
for (i = 3; i < image->numcomps; ++i) {
|
||||
memcpy(&(image->comps[i]), &(image->comps[i+1]), sizeof(image->comps[i]));
|
||||
}
|
||||
|
||||
}/* color_cmyk_to_rgb() */
|
||||
|
||||
/*
|
||||
* This code has been adopted from sjpx_openjpeg.c of ghostscript
|
||||
*/
|
||||
void color_esycc_to_rgb(opj_image_t *image)
|
||||
{
|
||||
int y, cb, cr, sign1, sign2, val;
|
||||
unsigned int w, h, max, i;
|
||||
int flip_value = (1 << (image->comps[0].prec-1));
|
||||
int max_value = (1 << image->comps[0].prec) - 1;
|
||||
|
||||
if (
|
||||
(image->numcomps < 3)
|
||||
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx)
|
||||
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy)
|
||||
) {
|
||||
fprintf(stderr,"%s:%d:color_esycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
w = image->comps[0].w;
|
||||
h = image->comps[0].h;
|
||||
|
||||
sign1 = (int)image->comps[1].sgnd;
|
||||
sign2 = (int)image->comps[2].sgnd;
|
||||
|
||||
max = w * h;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
|
||||
y = image->comps[0].data[i]; cb = image->comps[1].data[i]; cr = image->comps[2].data[i];
|
||||
|
||||
if( !sign1) cb -= flip_value;
|
||||
if( !sign2) cr -= flip_value;
|
||||
|
||||
val = (int)
|
||||
((float)y - (float)0.0000368 * (float)cb
|
||||
+ (float)1.40199 * (float)cr + (float)0.5);
|
||||
|
||||
if(val > max_value) val = max_value; else if(val < 0) val = 0;
|
||||
image->comps[0].data[i] = val;
|
||||
|
||||
val = (int)
|
||||
((float)1.0003 * (float)y - (float)0.344125 * (float)cb
|
||||
- (float)0.7141128 * (float)cr + (float)0.5);
|
||||
|
||||
if(val > max_value) val = max_value; else if(val < 0) val = 0;
|
||||
image->comps[1].data[i] = val;
|
||||
|
||||
val = (int)
|
||||
((float)0.999823 * (float)y + (float)1.77204 * (float)cb
|
||||
- (float)0.000008 *(float)cr + (float)0.5);
|
||||
|
||||
if(val > max_value) val = max_value; else if(val < 0) val = 0;
|
||||
image->comps[2].data[i] = val;
|
||||
}
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
|
||||
}/* color_esycc_to_rgb() */
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _OPJ_COLOR_H_
|
||||
#define _OPJ_COLOR_H_
|
||||
|
||||
extern void color_sycc_to_rgb(opj_image_t *img);
|
||||
extern void color_apply_icc_profile(opj_image_t *image);
|
||||
extern void color_cielab_to_rgb(opj_image_t *image);
|
||||
|
||||
extern void color_cmyk_to_rgb(opj_image_t *image);
|
||||
extern void color_esycc_to_rgb(opj_image_t *image);
|
||||
#endif /* _OPJ_COLOR_H_ */
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _OPJ_FORMAT_DEFS_H_
|
||||
#define _OPJ_FORMAT_DEFS_H_
|
||||
|
||||
#define J2K_CFMT 0
|
||||
#define JP2_CFMT 1
|
||||
#define JPT_CFMT 2
|
||||
|
||||
#define PXM_DFMT 10
|
||||
#define PGX_DFMT 11
|
||||
#define BMP_DFMT 12
|
||||
#define YUV_DFMT 13
|
||||
#define TIF_DFMT 14
|
||||
#define RAW_DFMT 15 /* MSB / Big Endian */
|
||||
#define TGA_DFMT 16
|
||||
#define PNG_DFMT 17
|
||||
#define RAWL_DFMT 18 /* LSB / Little Endian */
|
||||
|
||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
@ -1,15 +0,0 @@
|
||||
#include "opj_config_private.h"
|
||||
|
||||
/* create opj_apps_config.h for CMake */
|
||||
|
||||
#cmakedefine OPJ_HAVE_LIBPNG @HAVE_LIBPNG@
|
||||
#cmakedefine OPJ_HAVE_PNG_H @HAVE_PNG_H@
|
||||
#cmakedefine OPJ_HAVE_LIBTIFF @HAVE_LIBTIFF@
|
||||
#cmakedefine OPJ_HAVE_TIFF_H @HAVE_TIFF_H@
|
||||
|
||||
#cmakedefine OPJ_HAVE_LIBLCMS1
|
||||
#cmakedefine OPJ_HAVE_LIBLCMS2
|
||||
#cmakedefine OPJ_HAVE_LCMS1_H
|
||||
#cmakedefine OPJ_HAVE_LCMS2_H
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user