Compare commits
324 Commits
master
...
openjpeg-1
Author | SHA1 | Date |
---|---|---|
mayeut | f0dd842b11 | |
mayeut | 96c3a8315b | |
mayeut | 6711fa669a | |
mayeut | 935816e8c9 | |
mayeut | c0abb808f5 | |
mayeut | 348e96e44b | |
mayeut | e94720fea0 | |
mayeut | 04291bf0ab | |
mayeut | 46440fe368 | |
mayeut | 9cf9018ffc | |
mayeut | 001cd957ba | |
mayeut | a024c148fc | |
mayeut | a4bd2ed06e | |
mayeut | 66f65919cf | |
mayeut | 7ad3e2a870 | |
mayeut | 9542c08d62 | |
mayeut | cbaa2d7d98 | |
mayeut | 650df81e09 | |
Antonin Descampe | 618e50954f | |
Antonin Descampe | 959ebdab5e | |
Antonin Descampe | 3cee252347 | |
Antonin Descampe | 2a4101c60e | |
Antonin Descampe | 32b04ad49d | |
Antonin Descampe | 5e3fae7f48 | |
Pedro Gimeno | 4469a98cd7 | |
Antonin Descampe | 93c79f8fb1 | |
Antonin Descampe | e755ebd1b0 | |
Antonin Descampe | f35aaa8a82 | |
Antonin Descampe | b44e07fe19 | |
Antonin Descampe | d3c0915992 | |
Antonin Descampe | c91e2099b1 | |
Antonin Descampe | d0e85b0c52 | |
Antonin Descampe | 31e35fcf7b | |
Antonin Descampe | 2d47938b25 | |
Antonin Descampe | 2e508f1c89 | |
Antonin Descampe | f8013bec95 | |
Antonin Descampe | 770e81eebc | |
Antonin Descampe | 2c3f5c269a | |
Antonin Descampe | 0ec0b2594c | |
Mathieu Malaterre | 2eebb05ca2 | |
Mathieu Malaterre | ff72d131ed | |
Mathieu Malaterre | 7d6d19c473 | |
Mathieu Malaterre | 78053c44c8 | |
Mathieu Malaterre | 902fe2569c | |
Mathieu Malaterre | 8c71728242 | |
Mathieu Malaterre | 4140dfdea8 | |
Rex Dieter | 259f629a46 | |
Rex Dieter | c302efcf86 | |
Rex Dieter | e0b5b08f9a | |
Mathieu Malaterre | dac95eff3a | |
Mathieu Malaterre | 4f4de7070e | |
Mathieu Malaterre | 78d1820881 | |
Mathieu Malaterre | de73cfeec1 | |
Mathieu Malaterre | 49044ae2a8 | |
Mathieu Malaterre | 6e0162a8a6 | |
Mathieu Malaterre | 910af7edec | |
Mathieu Malaterre | 69cd4f9211 | |
Mathieu Malaterre | 6fc2b56847 | |
Mathieu Malaterre | 773bd89130 | |
Mathieu Malaterre | 5d356d6fcb | |
Mathieu Malaterre | a2f90ab2cb | |
Mathieu Malaterre | a05a9aa4ed | |
Mathieu Malaterre | af2be2d456 | |
Mathieu Malaterre | 96dba34ddc | |
Mathieu Malaterre | 6aad1208b2 | |
Mathieu Malaterre | d2be8c5d21 | |
Mathieu Malaterre | b42f76cb7f | |
Mathieu Malaterre | 07163be7ed | |
Mathieu Malaterre | 4e672cc1e9 | |
Mathieu Malaterre | ced9a50367 | |
Mathieu Malaterre | a1683bd7c2 | |
Antonin Descampe | f968a70e22 | |
Mickael Savinaud | 2fe6bac6eb | |
Mathieu Malaterre | 15243144c4 | |
Mickael Savinaud | c0c69d1c36 | |
Rex Dieter | d9d62a77ee | |
Mathieu Malaterre | 15488c94d2 | |
Mathieu Malaterre | 75175b715c | |
Mathieu Malaterre | 46831582b2 | |
Mathieu Malaterre | e55d5e29e0 | |
Mathieu Malaterre | c02f145cd1 | |
Mathieu Malaterre | 6280b5ad8d | |
Mathieu Malaterre | 7720188fa7 | |
Mathieu Malaterre | 20f9f96719 | |
Mathieu Malaterre | 4776f48477 | |
Mathieu Malaterre | c2f32bb485 | |
Mathieu Malaterre | bba708462d | |
Mathieu Malaterre | 4935eaf773 | |
Mathieu Malaterre | bad9a71e77 | |
Mathieu Malaterre | a74a41b932 | |
Mathieu Malaterre | 6b5bbc2645 | |
Mathieu Malaterre | 8b5f815925 | |
Mathieu Malaterre | abce31e706 | |
Mathieu Malaterre | 8062f74deb | |
Mathieu Malaterre | b8fecbbc99 | |
Mathieu Malaterre | cd8896968d | |
Mathieu Malaterre | b94bc0dbe2 | |
Mathieu Malaterre | 083d4c2361 | |
Mathieu Malaterre | 6c5a066b20 | |
Mathieu Malaterre | 835bf5357f | |
Mathieu Malaterre | 8a279881d4 | |
Mathieu Malaterre | 6da56bb11a | |
Mathieu Malaterre | 8cd13f3a55 | |
Mathieu Malaterre | eeca4a220c | |
Mathieu Malaterre | e17dcf58c9 | |
Mathieu Malaterre | 39ac7c479f | |
Mathieu Malaterre | 401e9cbb5c | |
Mathieu Malaterre | 5dbf771bb9 | |
Mathieu Malaterre | ce9d5083ef | |
Mathieu Malaterre | baa7e32f9c | |
Mathieu Malaterre | 097496a9f0 | |
Mathieu Malaterre | 6b649f3bf6 | |
Mathieu Malaterre | 65f8ae765e | |
Mathieu Malaterre | 3aba3e203b | |
Mathieu Malaterre | 95cf10e979 | |
Mathieu Malaterre | 3a643798bd | |
Mathieu Malaterre | 875591f664 | |
Mathieu Malaterre | 4e8aea6b5a | |
Mathieu Malaterre | 5379ec5715 | |
Mathieu Malaterre | b431cb0a41 | |
Mathieu Malaterre | dfbab28b4d | |
Mathieu Malaterre | 3819c1b5f4 | |
Mathieu Malaterre | b09cd38b08 | |
Mathieu Malaterre | da453218a4 | |
Mathieu Malaterre | e0795464c1 | |
Mathieu Malaterre | fab8de59d3 | |
Mathieu Malaterre | dcf78f14f6 | |
Mathieu Malaterre | d1a1653f2a | |
Mathieu Malaterre | 5a817eba3d | |
Mathieu Malaterre | ce5bbefff0 | |
Mathieu Malaterre | a5d96e54b9 | |
Mathieu Malaterre | 2dddf54f8b | |
Mathieu Malaterre | 992409c00c | |
Mathieu Malaterre | ee9c46d350 | |
Mathieu Malaterre | 87a1081f7c | |
Mathieu Malaterre | 83332e13ad | |
Mathieu Malaterre | 675f34fabd | |
Mathieu Malaterre | 0c7b21c46f | |
Mathieu Malaterre | 590ba6d460 | |
Mathieu Malaterre | 6f314ae48e | |
Mathieu Malaterre | 24ab49a363 | |
Mathieu Malaterre | ecb36f02c8 | |
Mathieu Malaterre | 8c9fd1b351 | |
Mathieu Malaterre | dd999a2840 | |
Mathieu Malaterre | b3b2ee0925 | |
Mathieu Malaterre | 58cfcaff9f | |
Mathieu Malaterre | c1c2d24b16 | |
Mathieu Malaterre | cefa643823 | |
Kaori Hagihara | 64e37e2a66 | |
Rex Dieter | 545680cdb4 | |
Rex Dieter | 23cab09e07 | |
Kaori Hagihara | 8336ace29a | |
Rex Dieter | a794ee233d | |
Mathieu Malaterre | a39e4a2a82 | |
Mathieu Malaterre | b267239603 | |
Mathieu Malaterre | 54e4e8f809 | |
Mathieu Malaterre | 8fc06de0c5 | |
Mathieu Malaterre | 9a5ab44e35 | |
Mathieu Malaterre | 4d76145884 | |
Mathieu Malaterre | bdf1343f62 | |
Mathieu Malaterre | 52f5452d4d | |
Mathieu Malaterre | a9b7c7b0b4 | |
Mathieu Malaterre | 07521a5dc2 | |
Mathieu Malaterre | d1bb3ed1f2 | |
Mathieu Malaterre | 6c6cd79820 | |
Kaori Hagihara | 7b6ae8810d | |
Kaori Hagihara | 699f172e6c | |
Antonin Descampe | 5fbf79e730 | |
Antonin Descampe | aa28216f9b | |
Rex Dieter | e449cb706f | |
Rex Dieter | a85c5151ce | |
Rex Dieter | ed58a22d2e | |
Antonin Descampe | 3408787101 | |
Antonin Descampe | 948dfd50c0 | |
Antonin Descampe | 46da9f2294 | |
Antonin Descampe | 995b145f09 | |
Mathieu Malaterre | 451a41064e | |
Mathieu Malaterre | c6b02b10fe | |
Mathieu Malaterre | 36b66a8796 | |
Mathieu Malaterre | f1e441596e | |
Antonin Descampe | d5fa5605c4 | |
Mathieu Malaterre | 427b2427d4 | |
Vincent Torri | 09522e65af | |
Mathieu Malaterre | 19cfaac52e | |
Mathieu Malaterre | 21c38214ef | |
Mathieu Malaterre | 577fdbc8a5 | |
Mathieu Malaterre | f93aed8031 | |
Mathieu Malaterre | 326c58b4e1 | |
Mathieu Malaterre | ec0c69af7a | |
Mathieu Malaterre | 21509a3955 | |
Mathieu Malaterre | 5b2ca9caf6 | |
Mathieu Malaterre | 529006f136 | |
Mathieu Malaterre | 7d96e7c1c0 | |
Mathieu Malaterre | e2948acd92 | |
Mathieu Malaterre | 6dc8635e28 | |
Mathieu Malaterre | 7d0a419c87 | |
Mathieu Malaterre | 0ea0e8b915 | |
Mathieu Malaterre | 8e53bad7fb | |
Mathieu Malaterre | 9c51a37dbf | |
Mathieu Malaterre | aa00142949 | |
Mathieu Malaterre | 87b05f2885 | |
Mathieu Malaterre | baf01b98fd | |
Mathieu Malaterre | 6dd7da0e05 | |
Mathieu Malaterre | 4949b593be | |
Mathieu Malaterre | 0ed7aa7c1b | |
Vincent Torri | 02b906f6ad | |
Vincent Torri | 6a03e3a438 | |
Antonin Descampe | ec33653961 | |
Antonin Descampe | 133426ddfe | |
Vincent Torri | aab317eb8c | |
Vincent Torri | f3f86e1eb7 | |
Antonin Descampe | 040c9a68b6 | |
Mathieu Malaterre | 2b746a71cb | |
Antonin Descampe | ba01e855a3 | |
Mathieu Malaterre | d3c1a49246 | |
Mathieu Malaterre | 85bbc6def8 | |
Mathieu Malaterre | 5bd5d894eb | |
Mathieu Malaterre | 452403d393 | |
Mathieu Malaterre | fc268dff90 | |
Mathieu Malaterre | 180dd26df1 | |
Mathieu Malaterre | d27bc19d71 | |
Mathieu Malaterre | b7b72bbf97 | |
Mathieu Malaterre | e1340fe087 | |
Mathieu Malaterre | 32e80bc4a7 | |
Mathieu Malaterre | 8d18c77a7d | |
Mathieu Malaterre | f492f0a3d6 | |
Mathieu Malaterre | 6b43ba091e | |
Antonin Descampe | 5dfadb2eb1 | |
Mathieu Malaterre | 30944454de | |
Mathieu Malaterre | 0e7529c272 | |
Mathieu Malaterre | c9986d1b78 | |
Vincent Torri | 4bc00a40ca | |
Mathieu Malaterre | 80f69364b0 | |
Mathieu Malaterre | 2e3900780d | |
Mathieu Malaterre | d530d35024 | |
Mathieu Malaterre | e96f7a5f50 | |
Mathieu Malaterre | 79ce6ccce5 | |
Mathieu Malaterre | b7e489c901 | |
Mathieu Malaterre | dbd60c1469 | |
Kaori Hagihara | 007409e2af | |
Mathieu Malaterre | b82b6cbd05 | |
Mathieu Malaterre | f26b96dd5c | |
Mathieu Malaterre | 7e6c287d78 | |
Mathieu Malaterre | 6b1e9d1b4e | |
Mathieu Malaterre | d88dfc3472 | |
Mathieu Malaterre | 64f08e216b | |
Mathieu Malaterre | c9ae2a5fbc | |
Mathieu Malaterre | 51ae8b7926 | |
Mathieu Malaterre | 3280dc344f | |
Mathieu Malaterre | 0b7e0166a7 | |
Mathieu Malaterre | 5fe8eed4da | |
Mathieu Malaterre | 9d4d3b2cd0 | |
Mathieu Malaterre | 02d9f43802 | |
Mathieu Malaterre | 00b479cb79 | |
Mathieu Malaterre | 6219ad32b0 | |
Mathieu Malaterre | a3a161660a | |
Mathieu Malaterre | 2643f79069 | |
Mathieu Malaterre | fba8f701c4 | |
Mathieu Malaterre | 4bcd3a1e42 | |
Mathieu Malaterre | 594148ae83 | |
Mathieu Malaterre | 2a2f169b27 | |
Mathieu Malaterre | e576aa9f06 | |
Mathieu Malaterre | c469e1339f | |
Mathieu Malaterre | abf9809c22 | |
Mathieu Malaterre | 3ebdd674d8 | |
Mathieu Malaterre | a13abdaf65 | |
Mathieu Malaterre | 72867bc692 | |
Mathieu Malaterre | b081ff2813 | |
Mathieu Malaterre | 9d1bd03be4 | |
Mathieu Malaterre | 82e539d333 | |
Mathieu Malaterre | 548a49bb7f | |
Mickael Savinaud | dc9a8b03aa | |
Kaori Hagihara | c6e0b71633 | |
Vincent Torri | 0c350f4908 | |
Kaori Hagihara | 01749cb8a2 | |
Vincent Torri | 49f1a5ff54 | |
Kaori Hagihara | ff1f022d47 | |
Kaori Hagihara | 3459199eba | |
Kaori Hagihara | 544e8c9de0 | |
Kaori Hagihara | 735b40989d | |
Antonin Descampe | 09f2926cd5 | |
Antonin Descampe | 238b767917 | |
Antonin Descampe | 49a0f0db8f | |
Mickael Savinaud | 6a1530e4b1 | |
Mickael Savinaud | 8d8841c84f | |
Mickael Savinaud | 1dc6eddf1c | |
Antonin Descampe | c1510793e3 | |
Antonin Descampe | d728868263 | |
Antonin Descampe | 8a2af121a4 | |
Antonin Descampe | 9e60c2f8e9 | |
Vincent Torri | d35f647aaa | |
Vincent Torri | adbccc2e56 | |
Mickael Savinaud | 642d09f5cb | |
Mickael Savinaud | d1cb786dd8 | |
Mickael Savinaud | 182e4b1882 | |
Mickael Savinaud | 73106fe839 | |
Mickael Savinaud | 40b4ecfaec | |
Vincent Torri | fb82b6d7d9 | |
Antonin Descampe | 5d6ac5ea72 | |
Antonin Descampe | 3d06f03072 | |
Mickael Savinaud | 5213675ba8 | |
Antonin Descampe | 9a89e2f162 | |
Antonin Descampe | e89eb575ac | |
Antonin Descampe | d15f01b6e3 | |
Antonin Descampe | 9ec5e8cf9a | |
Antonin Descampe | 4c9acc22b8 | |
Antonin Descampe | 6adb5f5070 | |
Antonin Descampe | d1d662768d | |
Antonin Descampe | 4091882dfb | |
Antonin Descampe | 61e0ed6a96 | |
Antonin Descampe | 9c7899372b | |
Antonin Descampe | a098921d34 | |
Mickael Savinaud | 8ed4cb1a1e | |
Antonin Descampe | 721904bc26 | |
Mickael Savinaud | 2724f85cad | |
Antonin Descampe | 40b989ce00 | |
Vincent Torri | 3e1d8d6aef | |
Vincent Torri | fda0cada0e | |
Vincent Torri | a58987d082 | |
Vincent Torri | 0f101066f2 | |
Antonin Descampe | cbe26cbb88 | |
Antonin Descampe | f753a1c36c | |
Antonin Descampe | c0ea54e518 | |
Antonin Descampe | c85e1a10cf |
|
@ -1,30 +0,0 @@
|
|||
<!--
|
||||
IMPORTANT: Do NOT use GitHub to post any questions or support requests!
|
||||
They will be closed immediately and ignored.
|
||||
|
||||
Questions should go to the OpenJPEG mailing list at
|
||||
https://groups.google.com/g/openjpeg or other support forums.
|
||||
GitHub issues are for bug reports and suggestions for new features.
|
||||
|
||||
The OpenJPEG project is made of contributions from various individuals and
|
||||
organizations, each with their own focus. The issue you are facing is
|
||||
not necessarily in the priority list of those contributors and consequently
|
||||
there is no guarantee that it will be addressed in a timely manner.
|
||||
|
||||
-->
|
||||
|
||||
## Expected behavior and actual behavior.
|
||||
|
||||
...to fill...
|
||||
|
||||
## Steps to reproduce the problem.
|
||||
|
||||
...to fill...
|
||||
|
||||
## Operating system
|
||||
|
||||
...to fill...
|
||||
|
||||
## openjpeg version
|
||||
|
||||
...to fill...
|
|
@ -1,24 +0,0 @@
|
|||
name: ABI check
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
abi_check:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y gcc g++ libelf-dev elfutils texinfo exuberant-ctags libtiff-dev libwebp-dev libzstd-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
./tools/travis-ci/abi-check.sh
|
||||
env:
|
||||
OPJ_CI_ABI_CHECK: 1
|
|
@ -1,189 +0,0 @@
|
|||
name: Build
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
regular:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y gcc g++ libtiff-dev libwebp-dev libzstd-dev
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_ARCH: x86_64
|
||||
OPJ_CI_BUILD_CONFIGURATION: Release
|
||||
OPJ_CI_PERF_TESTS: 1
|
||||
OPJ_CI_BUILD_FUZZERS: 1
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: build/openjpeg-*.tar.gz
|
||||
|
||||
asan:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y gcc g++
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_ARCH: x86_64
|
||||
OPJ_CI_BUILD_CONFIGURATION: Debug
|
||||
OPJ_CI_ASAN: 1
|
||||
OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
clang_32bit:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y clang gcc-multilib
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_CC: clang
|
||||
OPJ_CI_CXX: clang++
|
||||
OPJ_CI_INSTRUCTION_SETS: "-mavx2"
|
||||
OPJ_CI_BUILD_CONFIGURATION: Release
|
||||
OPJ_CI_ARCH: i386
|
||||
OPJ_NUM_THREADS: 2
|
||||
OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
mingw_64:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y gcc-mingw-w64-base binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 gcc-mingw-w64 g++-mingw-w64-x86-64
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_CC: x86_64-w64-mingw32-gcc
|
||||
OPJ_CI_CXX: x86_64-w64-mingw32-g++
|
||||
OPJ_CI_ARCH: x86_64
|
||||
OPJ_CI_BUILD_CONFIGURATION: Release
|
||||
OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_ARCH: x86_64
|
||||
OPJ_CI_BUILD_CONFIGURATION: Release
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
#OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: build/openjpeg-*.zip
|
||||
|
||||
windows_build:
|
||||
runs-on: windows-2019
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- VS_VER: 2019
|
||||
OPJ_CI_ARCH: x64
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- VS_VER: 2019
|
||||
OPJ_CI_ARCH: x86
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- VS_VER: 2019
|
||||
OPJ_CI_ARCH: x64
|
||||
# We do have specific failures noted in tools/travis-ci/knownfailures-windows-vs2015-x64-avx2-Release-3rdP.txt
|
||||
# not sure why that happens
|
||||
OPJ_CI_INSTRUCTION_SETS: "/arch:AVX2"
|
||||
|
||||
env:
|
||||
VS_VER: ${{ matrix.VS_VER }}
|
||||
OPJ_CI_ARCH: ${{ matrix.OPJ_CI_ARCH }}
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: ${{ matrix.OPJ_CI_INCLUDE_IF_DEPLOY }}
|
||||
OPJ_CI_INSTRUCTION_SETS: ${{ matrix.OPJ_CI_INSTRUCTION_SETS }}
|
||||
#OPJ_NONCOMMERCIAL: 1
|
||||
|
||||
steps:
|
||||
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set compiler environment
|
||||
shell: cmd
|
||||
run: |
|
||||
if "%VS_VER%" == "2019" CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=%OPJ_CI_ARCH%
|
||||
echo PATH=%PATH%>> %GITHUB_ENV%
|
||||
echo INCLUDE=%INCLUDE%>> %GITHUB_ENV%
|
||||
echo LIB=%LIB%>> %GITHUB_ENV%
|
||||
echo LIBPATH=%LIBPATH%>> %GITHUB_ENV%
|
||||
|
||||
- name: Install wget
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install wget --no-progress
|
||||
|
||||
- name: Build and run tests
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
shell: bash
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{startsWith(github.ref, 'refs/tags/') && env.OPJ_CI_INCLUDE_IF_DEPLOY == 1}}
|
||||
with:
|
||||
files: build/openjpeg-*.zip
|
|
@ -1,26 +0,0 @@
|
|||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
id: build
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'openjpeg'
|
||||
dry-run: false
|
||||
language: c
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'openjpeg'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
language: c
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
|
@ -1,26 +0,0 @@
|
|||
name: Code Style
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
code_style:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Requirements
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y gcc g++ flip
|
||||
|
||||
- name: Run check
|
||||
run: |
|
||||
./tools/travis-ci/install.sh
|
||||
./tools/travis-ci/run.sh
|
||||
env:
|
||||
OPJ_CI_CHECK_STYLE: 1
|
||||
OPJ_CI_SKIP_TESTS: 1
|
|
@ -1,21 +1,4 @@
|
|||
# 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
|
||||
scripts/opjstyle*
|
||||
|
||||
# Ignore directories made by `make`.
|
||||
/bin/
|
||||
build
|
||||
SDK
|
||||
*.lha
|
||||
CMakeLists.txt.user
|
||||
|
||||
*.bak
|
||||
|
|
163
.travis.yml
|
@ -1,163 +0,0 @@
|
|||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# OSX
|
||||
# OPJ_NONCOMMERCIAL=0 because Kakadu install hangs (cf https://travis-ci.org/github/uclouvain/openjpeg/builds/769447606)
|
||||
# - os: osx
|
||||
# compiler: clang
|
||||
# env: OPJ_NONCOMMERCIAL=0 OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
|
||||
|
||||
# Test code style
|
||||
- os: linux
|
||||
compiler: clang-3.8
|
||||
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_CHECK_STYLE=1 OPJ_CI_SKIP_TESTS=1
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-precise-3.8
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-3.8
|
||||
- flip
|
||||
|
||||
# Performance test with GCC
|
||||
# Disabled because tests fail
|
||||
# - os: linux
|
||||
# compiler: g++
|
||||
# dist: precise
|
||||
# env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 OPJ_CI_PERF_TESTS=1
|
||||
|
||||
# Test compilation with AVX2
|
||||
- os: linux
|
||||
# "sudo: yes" and "dist: trusty" give us a worker with the AVX2 instruction set
|
||||
sudo: yes
|
||||
dist: trusty
|
||||
compiler: clang-3.8
|
||||
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-precise-3.8
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-3.8
|
||||
|
||||
# Test multi-threading
|
||||
# Disabled because tests fail (cf https://travis-ci.org/github/uclouvain/openjpeg/builds/769447606)
|
||||
# - os: linux
|
||||
# compiler: g++
|
||||
# dist: precise
|
||||
# env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
|
||||
|
||||
# Test 32-bit compilation
|
||||
# Disabled because tests fail (cf https://travis-ci.org/github/uclouvain/openjpeg/builds/769447606)
|
||||
# - os: linux
|
||||
# compiler: g++
|
||||
# env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
# dist: trusty
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - gcc-multilib
|
||||
# - g++-multilib
|
||||
|
||||
# Profile code (gcc -pg)
|
||||
# Disabled because tests fail (cf https://travis-ci.org/github/uclouvain/openjpeg/builds/769447606)
|
||||
# - os: linux
|
||||
# compiler: g++
|
||||
# env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_PROFILE=1
|
||||
# dist: trusty
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - valgrind
|
||||
|
||||
# Test under ASAN
|
||||
# Temporarily disabled since broken. See https://github.com/uclouvain/openjpeg/issues/1091
|
||||
# - os: linux
|
||||
# compiler: clang
|
||||
# env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
|
||||
|
||||
# Test with CLang 3.8
|
||||
- os: linux
|
||||
compiler: clang-3.8
|
||||
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_PERF_TESTS=1 OPJ_CI_BUILD_FUZZERS=1
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-precise-3.8
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-3.8
|
||||
|
||||
# Test with mingw 32 bit
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-g++
|
||||
env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-i686
|
||||
- gcc-mingw-w64-i686
|
||||
- gcc-mingw-w64
|
||||
- g++-mingw-w64-i686
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
|
||||
# Test with mingw 64 bit
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-g++
|
||||
env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- g++-mingw-w64-x86-64
|
||||
|
||||
# Test with gcc 4.8
|
||||
- os: linux
|
||||
compiler: g++-4.8
|
||||
env: OPJ_CI_CC=gcc-4.8 OPJ_CI_CXX=g++-4.8 OPJ_CI_ABI_CHECK=1
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- g++-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: dJXdzoFwk9wYWIKztnXKlVIr1QDmeXtk3oK+2MEzy22fBTKPuphU/cYMvhi5B7sWDwm77f43vbAYO6z7IFmuThwhkuVMD/o+lUyCqGffGeiU1pKpxEvB+LbO/C5asdSnor3RfYdOyo3x4cNlhNtfhXIn7FcAg371yEY6VSIP87adoQcuE+taig0cYWcrNWYGHirHlzEz1utnKwCT/nlhV4nSIWxjwYUp3nt8PAw3RbqQkPPNBniW92g6JA25vLRc3HMD18ISCfNLC2fI6a/dTR+vd+bCySA7JvqeDZnv8SxbVIabu5T+A5CHzHbdp2l2kynPwqHOO47pGa+VfisXEwSsOpa+4EZsPLdwOhaFFnvDwKwR3EjI1TkRVd26IcK61Y5zVZQgalnXBowBEZoI4fT/oEPF7VZMjN3sy/do1U6d5kO0UGqCHCJIVwPeELhwq5z7Ld04K7dSFFVenZhhQKCwxI1o8vgkGNJUWD2Ii6ZLrZKYZ0lC65hr2d39e/KoK3Yh5KHF0cVn6ppBTcUjYr/tdHHO43rwoaf3r1CdAQAYpFvfi3900hl9I/GPwky0YJ6W2QDS2vincwaqWDQ0+WNGf4AKSdx5kCgQU45PSfDb/lxAyXkqmBuI3h/C2ellleaWVL9sGtNRWa/w6WseGMGwfCXgN82XRVM2bgP6pYg=
|
||||
file_glob: true
|
||||
file: "${OPJ_RELEASE_PKG_FILE}"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: uclouvain/openjpeg
|
||||
tags: true
|
||||
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"
|
|
@ -0,0 +1,13 @@
|
|||
Authors of OpenJPEG
|
||||
See also the files THANKS and CHANGES
|
||||
|
||||
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 v2.
|
||||
Giuseppe Baruffa added the JPWL functionalities.
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
Antonin Descampe
|
||||
improved the libraries and utilities.
|
||||
|
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.
|
||||
|
889
CHANGELOG.md
|
@ -1,889 +0,0 @@
|
|||
# Changelog
|
||||
|
||||
## [v2.5.0](https://github.com/uclouvain/openjpeg/releases/v2.5.0) (2022-05-13)
|
||||
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.4.0...v2.5.0)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- tools/travis-ci/install.sh: git clone with https:// to fix 'The unaut… [\#1419](https://github.com/uclouvain/openjpeg/pull/1419) ([rouault](https://github.com/rouault))
|
||||
- Java Support 1.8 now... [\#1418](https://github.com/uclouvain/openjpeg/pull/1418) ([jiapei100](https://github.com/jiapei100))
|
||||
- Separate fuzz targets to increase coverage [\#1416](https://github.com/uclouvain/openjpeg/pull/1416) ([Navidem](https://github.com/Navidem))
|
||||
- CMakeLists.txt: do not set INSTALL\_NAME\_DIR for MacOS builds for CMake \>= 3.0 \(fixes \#1404\) [\#1410](https://github.com/uclouvain/openjpeg/pull/1410) ([rouault](https://github.com/rouault))
|
||||
- Avoid integer overflows in DWT. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44544 [\#1408](https://github.com/uclouvain/openjpeg/pull/1408) ([rouault](https://github.com/rouault))
|
||||
- Updated "added support for partial bitstream decoding" [\#1407](https://github.com/uclouvain/openjpeg/pull/1407) ([Neopallium](https://github.com/Neopallium))
|
||||
- opj\_encoder\_set\_extra\_options\(\): add a GUARD\_BITS=value option [\#1403](https://github.com/uclouvain/openjpeg/pull/1403) ([rouault](https://github.com/rouault))
|
||||
- More overflow related bug fixes [\#1402](https://github.com/uclouvain/openjpeg/pull/1402) ([Eharve14](https://github.com/Eharve14))
|
||||
- opj\_j2k\_setup\_encoder\(\): validate number of tiles to avoid illegal values and potential overflow \(fixes \#1399\) [\#1401](https://github.com/uclouvain/openjpeg/pull/1401) ([rouault](https://github.com/rouault))
|
||||
- Missed conversion from unsigned int to OPJ\_INT32 [\#1398](https://github.com/uclouvain/openjpeg/pull/1398) ([Eharve14](https://github.com/Eharve14))
|
||||
- Added check for integer overflow in get\_num\_images [\#1397](https://github.com/uclouvain/openjpeg/pull/1397) ([Eharve14](https://github.com/Eharve14))
|
||||
- Added overflow check for CVE-2021-29338 [\#1396](https://github.com/uclouvain/openjpeg/pull/1396) ([Eharve14](https://github.com/Eharve14))
|
||||
- Fix integer overflow in num\_images [\#1395](https://github.com/uclouvain/openjpeg/pull/1395) ([baparham](https://github.com/baparham))
|
||||
- Remove duplicate assignments in function tiftoimage [\#1392](https://github.com/uclouvain/openjpeg/pull/1392) ([stweil](https://github.com/stweil))
|
||||
- Fix some typos \(found by codespell\) [\#1390](https://github.com/uclouvain/openjpeg/pull/1390) ([stweil](https://github.com/stweil))
|
||||
- CI: Add CIFuzz action [\#1386](https://github.com/uclouvain/openjpeg/pull/1386) ([DavidKorczynski](https://github.com/DavidKorczynski))
|
||||
- Feature/decimation [\#1384](https://github.com/uclouvain/openjpeg/pull/1384) ([msheby](https://github.com/msheby))
|
||||
- API: deprecate 'bpp' member in favor of 'prec' [\#1383](https://github.com/uclouvain/openjpeg/pull/1383) ([rouault](https://github.com/rouault))
|
||||
- Added support for high throughput \(HTJ2K\) decoding. [\#1381](https://github.com/uclouvain/openjpeg/pull/1381) ([rouault](https://github.com/rouault))
|
||||
- verify-indentation.sh: fix for pull request from bar/master to foo/master [\#1380](https://github.com/uclouvain/openjpeg/pull/1380) ([rouault](https://github.com/rouault))
|
||||
- Change integer for version libtiff 4.3.0 [\#1377](https://github.com/uclouvain/openjpeg/pull/1377) ([Jamaika1](https://github.com/Jamaika1))
|
||||
- Port continuous integration to github actions [\#1376](https://github.com/uclouvain/openjpeg/pull/1376) ([rouault](https://github.com/rouault))
|
||||
- Avoid integer overflows in DWT. [\#1375](https://github.com/uclouvain/openjpeg/pull/1375) ([rouault](https://github.com/rouault))
|
||||
- LGTM warning: Comparison result is always the same [\#1373](https://github.com/uclouvain/openjpeg/pull/1373) ([DimitriPapadopoulos](https://github.com/DimitriPapadopoulos))
|
||||
- A couple typos found by codespell [\#1371](https://github.com/uclouvain/openjpeg/pull/1371) ([DimitriPapadopoulos](https://github.com/DimitriPapadopoulos))
|
||||
- cmake: add install interface include directory [\#1370](https://github.com/uclouvain/openjpeg/pull/1370) ([madebr](https://github.com/madebr))
|
||||
- fix issues 1368: exist a issues of freeing uninitialized pointer in src/bin/jp2/opj\_decompress.c,that will cause a segfault [\#1369](https://github.com/uclouvain/openjpeg/pull/1369) ([xiaoxiaoafeifei](https://github.com/xiaoxiaoafeifei))
|
||||
- opj\_j2k\_is\_imf\_compliant: Fix out of bounds access [\#1366](https://github.com/uclouvain/openjpeg/pull/1366) ([sebras](https://github.com/sebras))
|
||||
- opj\_j2k\_is\_imf\_compliant: Fix argument formatting for warnings. [\#1365](https://github.com/uclouvain/openjpeg/pull/1365) ([sebras](https://github.com/sebras))
|
||||
- CMakeLists.txt/appveyor.yml: update version number to 2.5.0… [\#1361](https://github.com/uclouvain/openjpeg/pull/1361) ([rouault](https://github.com/rouault))
|
||||
- .travis.yml: try to fix gcc 4.8 config by updating to xenial [\#1360](https://github.com/uclouvain/openjpeg/pull/1360) ([rouault](https://github.com/rouault))
|
||||
- Add support for enabling generation of TLM markers in encoder [\#1359](https://github.com/uclouvain/openjpeg/pull/1359) ([rouault](https://github.com/rouault))
|
||||
- Fix various compiler warnings [\#1358](https://github.com/uclouvain/openjpeg/pull/1358) ([rouault](https://github.com/rouault))
|
||||
- fix \#1345: don't remove big endian test for other platforms [\#1354](https://github.com/uclouvain/openjpeg/pull/1354) ([msabwat](https://github.com/msabwat))
|
||||
- Remove obsolete components JPWL, JP3D and MJ2 [\#1350](https://github.com/uclouvain/openjpeg/pull/1350) ([rouault](https://github.com/rouault))
|
||||
- tools/travis-ci/install.sh: fix links to Kakadu and jpylyzer binaries [\#1348](https://github.com/uclouvain/openjpeg/pull/1348) ([rouault](https://github.com/rouault))
|
||||
- emscripten: disable big endian test [\#1345](https://github.com/uclouvain/openjpeg/pull/1345) ([msabwat](https://github.com/msabwat))
|
||||
- Fix cmake file with DESTDIR [\#1321](https://github.com/uclouvain/openjpeg/pull/1321) ([ffontaine](https://github.com/ffontaine))
|
||||
- CMakeLists.txt: Don't require a C++ compiler [\#1317](https://github.com/uclouvain/openjpeg/pull/1317) ([ffontaine](https://github.com/ffontaine))
|
||||
- Import files tiff and yuv\(raw\) [\#1316](https://github.com/uclouvain/openjpeg/pull/1316) ([Jamaika1](https://github.com/Jamaika1))
|
||||
- Fix year in NEWS [\#1312](https://github.com/uclouvain/openjpeg/pull/1312) ([stweil](https://github.com/stweil))
|
||||
- Fix lcms2 static linking using pgk config [\#867](https://github.com/uclouvain/openjpeg/pull/867) ([pseiderer](https://github.com/pseiderer))
|
||||
- fix static build only against tiff and its indirect dependencies [\#866](https://github.com/uclouvain/openjpeg/pull/866) ([tSed](https://github.com/tSed))
|
||||
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- integer constant is too large for 'long' type [\#61](https://github.com/uclouvain/openjpeg/issues/61)
|
||||
- Openjpeg3D lossy compression not working [\#501](https://github.com/uclouvain/openjpeg/issues/501)
|
||||
- mj2: Array overflow [\#485](https://github.com/uclouvain/openjpeg/issues/485)
|
||||
- OPJ fails to decode image that KDU manages correctly [\#419](https://github.com/uclouvain/openjpeg/issues/419)
|
||||
- yuvtoimage\(\) bug in v1 and v2 for 16-Bit: please apply ASAP [\#384](https://github.com/uclouvain/openjpeg/issues/384)
|
||||
- JP3D: Fix CVE-2013-4289 CVE-2013-4290 [\#298](https://github.com/uclouvain/openjpeg/issues/298)
|
||||
- MJ2 libraries are installed in lib [\#204](https://github.com/uclouvain/openjpeg/issues/204)
|
||||
- MJ2: realloc is misused and may leak memory [\#168](https://github.com/uclouvain/openjpeg/issues/168)
|
||||
- MJ2 wrapper not functional [\#143](https://github.com/uclouvain/openjpeg/issues/143)
|
||||
- JPWL is broken in trunk [\#137](https://github.com/uclouvain/openjpeg/issues/137)
|
||||
- MJ2 files not using OPENJPEG API correctly [\#53](https://github.com/uclouvain/openjpeg/issues/53)
|
||||
- Maximum bit depth supported by the OpenJPEG implementation of JP3D [\#9](https://github.com/uclouvain/openjpeg/issues/9)
|
||||
- does openjpeg support either visually lossless or numerically lossless jpeg2000 compression? [\#1406](https://github.com/uclouvain/openjpeg/issues/1406)
|
||||
- extract jpeg2000 tile without decompression [\#1405](https://github.com/uclouvain/openjpeg/issues/1405)
|
||||
- openjpeg doesn't install a relocatable shared lib on macOS [\#1404](https://github.com/uclouvain/openjpeg/issues/1404)
|
||||
- pull request - the cinema industry awaits! [\#1400](https://github.com/uclouvain/openjpeg/issues/1400)
|
||||
- Integer overflows in j2K [\#1399](https://github.com/uclouvain/openjpeg/issues/1399)
|
||||
- why lossly compression performance worse than jpeg when compress png? [\#1393](https://github.com/uclouvain/openjpeg/issues/1393)
|
||||
- cect [\#1389](https://github.com/uclouvain/openjpeg/issues/1389)
|
||||
- the docs don't describe bpp and prec in opj\_image\_comp very well [\#1379](https://github.com/uclouvain/openjpeg/issues/1379)
|
||||
- converting .png to .jp2 by opj\_compress is different from the original image [\#1378](https://github.com/uclouvain/openjpeg/issues/1378)
|
||||
- Comparison result is always the same [\#1372](https://github.com/uclouvain/openjpeg/issues/1372)
|
||||
- Exist a issues of freeing uninitialized pointer in src/bin/jp2/opj\_decompress.c,that will cause a segfault [\#1368](https://github.com/uclouvain/openjpeg/issues/1368)
|
||||
- \[TEST NOT RUNNING\]: bigendian test [\#1355](https://github.com/uclouvain/openjpeg/issues/1355)
|
||||
- opj\_decompress 2.4.0 built with library 2.3.0. [\#1352](https://github.com/uclouvain/openjpeg/issues/1352)
|
||||
- New library htjpeg2000 [\#1351](https://github.com/uclouvain/openjpeg/issues/1351)
|
||||
- Integer Overflow in num\_images [\#1338](https://github.com/uclouvain/openjpeg/issues/1338)
|
||||
- All IMF Profile Selections Result in PART1 [\#1337](https://github.com/uclouvain/openjpeg/issues/1337)
|
||||
- grayscale image [\#1334](https://github.com/uclouvain/openjpeg/issues/1334)
|
||||
- error C2169: 'lrintf': intrinsic function, cannot be defined [\#1333](https://github.com/uclouvain/openjpeg/issues/1333)
|
||||
- Generate lower-case extension [\#1332](https://github.com/uclouvain/openjpeg/issues/1332)
|
||||
- color of reconstructed png file much darker [\#1330](https://github.com/uclouvain/openjpeg/issues/1330)
|
||||
- CVE-2019-6988, CVE-2018-20846 and CVE-2018-16376 [\#1328](https://github.com/uclouvain/openjpeg/issues/1328)
|
||||
- opj 2.4.0: opj\_free missing in opj3d [\#1327](https://github.com/uclouvain/openjpeg/issues/1327)
|
||||
- Not able to compress volumetric data [\#1326](https://github.com/uclouvain/openjpeg/issues/1326)
|
||||
- HTML documents are not installed in specified place [\#1322](https://github.com/uclouvain/openjpeg/issues/1322)
|
||||
- Can't find openjpeg.h when cross-compile. [\#1320](https://github.com/uclouvain/openjpeg/issues/1320)
|
||||
- OpenJPEG is available with EasyConfig [\#1319](https://github.com/uclouvain/openjpeg/issues/1319)
|
||||
- Building Test Programs [\#1318](https://github.com/uclouvain/openjpeg/issues/1318)
|
||||
- Builds are not reproducible [\#1275](https://github.com/uclouvain/openjpeg/issues/1275)
|
||||
- strange behaviour of opj\_jp3d\_compress/decompress utility [\#1274](https://github.com/uclouvain/openjpeg/issues/1274)
|
||||
- Potential heap-based buffer overflow in function t2\_encode\_packet in src/lib/openmj2/t2.c and src/lib/openjp3d/t2.c [\#1272](https://github.com/uclouvain/openjpeg/issues/1272)
|
||||
- Function tgatoimage in src/bin/jpwl/convert.c need to check that the file is big enough to avoid excessive memory allocations [\#1271](https://github.com/uclouvain/openjpeg/issues/1271)
|
||||
- memory & cpu are exhausted when converting jp2 file into png [\#1250](https://github.com/uclouvain/openjpeg/issues/1250)
|
||||
- Cannot compress PGX into JP3D despite following the directions? [\#1134](https://github.com/uclouvain/openjpeg/issues/1134)
|
||||
- sscanf buffer overflow in opj\_jp3d\_compress.c [\#1130](https://github.com/uclouvain/openjpeg/issues/1130)
|
||||
- integer underflow may lead to writing garbage [\#1089](https://github.com/uclouvain/openjpeg/issues/1089)
|
||||
- sscanf buffer overflow [\#1087](https://github.com/uclouvain/openjpeg/issues/1087)
|
||||
- strcpy overflows [\#1086](https://github.com/uclouvain/openjpeg/issues/1086)
|
||||
- sprintf buffer overflows [\#1084](https://github.com/uclouvain/openjpeg/issues/1084)
|
||||
- strcpy buffer overflow [\#1083](https://github.com/uclouvain/openjpeg/issues/1083)
|
||||
- integer overflow in malloc\(\) [\#1082](https://github.com/uclouvain/openjpeg/issues/1082)
|
||||
- out of bounds writes [\#1078](https://github.com/uclouvain/openjpeg/issues/1078)
|
||||
- out of bounds writes [\#1077](https://github.com/uclouvain/openjpeg/issues/1077)
|
||||
- divide by zero, perhaps multiplication overflow [\#1076](https://github.com/uclouvain/openjpeg/issues/1076)
|
||||
- missing format string parameter [\#1075](https://github.com/uclouvain/openjpeg/issues/1075)
|
||||
- leaks from cppcheck in lib folder [\#1038](https://github.com/uclouvain/openjpeg/issues/1038)
|
||||
- How to initialize DEBUG\_PROFILE in color.c? [\#958](https://github.com/uclouvain/openjpeg/issues/958)
|
||||
- JP3D sample files [\#865](https://github.com/uclouvain/openjpeg/issues/865)
|
||||
- BIG\_ENDIAN bug in jpwl.c [\#839](https://github.com/uclouvain/openjpeg/issues/839)
|
||||
- OpenJPEG fails to decode partial j2c where kdu succeeds [\#715](https://github.com/uclouvain/openjpeg/issues/715)
|
||||
- building mj2 binaries fails [\#652](https://github.com/uclouvain/openjpeg/issues/652)
|
||||
- openmj2\mj2.c: Out of bounds [\#646](https://github.com/uclouvain/openjpeg/issues/646)
|
||||
- bin\mj2\opj\_mj2\_decompress.c 101 wrong check / leak [\#608](https://github.com/uclouvain/openjpeg/issues/608)
|
||||
|
||||
|
||||
## [v2.4.0](https://github.com/uclouvain/openjpeg/releases/v2.4.0) (2020-12-28)
|
||||
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.3.1...v2.4.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- OPENJPEG\_INSTALL\_DOC\_DIR does not control a destination directory where HTML docs would be installed. [\#1309](https://github.com/uclouvain/openjpeg/issues/1309)
|
||||
- Heap-buffer-overflow in lib/openjp2/pi.c:312 [\#1302](https://github.com/uclouvain/openjpeg/issues/1302)
|
||||
- Heap-buffer-overflow in lib/openjp2/t2.c:973 [\#1299](https://github.com/uclouvain/openjpeg/issues/1299)
|
||||
- Heap-buffer-overflow in lib/openjp2/pi.c:623 [\#1293](https://github.com/uclouvain/openjpeg/issues/1293)
|
||||
- Global-buffer-overflow in lib/openjp2/dwt.c:1980 [\#1286](https://github.com/uclouvain/openjpeg/issues/1286)
|
||||
- Heap-buffer-overflow in lib/openjp2/tcd.c:2417 [\#1284](https://github.com/uclouvain/openjpeg/issues/1284)
|
||||
- Heap-buffer-overflow in lib/openjp2/mqc.c:499 [\#1283](https://github.com/uclouvain/openjpeg/issues/1283)
|
||||
- Openjpeg could not encode 32bit RGB float image [\#1281](https://github.com/uclouvain/openjpeg/issues/1281)
|
||||
- Openjpeg could not encode 32bit RGB float image [\#1280](https://github.com/uclouvain/openjpeg/issues/1280)
|
||||
- ISO/IEC 15444-1:2019 \(E\) compared with 'cio.h' [\#1277](https://github.com/uclouvain/openjpeg/issues/1277)
|
||||
- Test-suite failure due to hash mismatch [\#1264](https://github.com/uclouvain/openjpeg/issues/1264)
|
||||
- Heap use-after-free [\#1261](https://github.com/uclouvain/openjpeg/issues/1261)
|
||||
- Memory leak when failing to allocate object... [\#1259](https://github.com/uclouvain/openjpeg/issues/1259)
|
||||
- Memory leak of Tier 1 handle when OpenJPEG fails to set it as TLS... [\#1257](https://github.com/uclouvain/openjpeg/issues/1257)
|
||||
- Any plan to build release for CVE-2020-8112/CVE-2020-6851 [\#1247](https://github.com/uclouvain/openjpeg/issues/1247)
|
||||
- failing to convert 16-bit file: opj\_t2\_encode\_packet\(\): only 5251 bytes remaining in output buffer. 5621 needed. [\#1243](https://github.com/uclouvain/openjpeg/issues/1243)
|
||||
- CMake+VS2017 Compile OK, thirdparty Compile OK, but thirdparty not install [\#1239](https://github.com/uclouvain/openjpeg/issues/1239)
|
||||
- New release to solve CVE-2019-6988 ? [\#1238](https://github.com/uclouvain/openjpeg/issues/1238)
|
||||
- Many tests fail to pass after the update of libtiff to version 4.1.0 [\#1233](https://github.com/uclouvain/openjpeg/issues/1233)
|
||||
- Another heap buffer overflow in libopenjp2 [\#1231](https://github.com/uclouvain/openjpeg/issues/1231)
|
||||
- Heap buffer overflow in libopenjp2 [\#1228](https://github.com/uclouvain/openjpeg/issues/1228)
|
||||
- Endianness of binary volume \(JP3D\) [\#1224](https://github.com/uclouvain/openjpeg/issues/1224)
|
||||
- New release to resolve CVE-2019-12973 [\#1222](https://github.com/uclouvain/openjpeg/issues/1222)
|
||||
- how to set the block size,like 128,256 ? [\#1216](https://github.com/uclouvain/openjpeg/issues/1216)
|
||||
- compress YUV files to motion jpeg2000 standard [\#1213](https://github.com/uclouvain/openjpeg/issues/1213)
|
||||
- Repair/update Java wrapper, and include in release [\#1208](https://github.com/uclouvain/openjpeg/issues/1208)
|
||||
- abc [\#1206](https://github.com/uclouvain/openjpeg/issues/1206)
|
||||
- Slow decoding [\#1202](https://github.com/uclouvain/openjpeg/issues/1202)
|
||||
- Installation question [\#1201](https://github.com/uclouvain/openjpeg/issues/1201)
|
||||
- Typo in test\_decode\_area - \*ptilew is assigned instead of \*ptileh [\#1195](https://github.com/uclouvain/openjpeg/issues/1195)
|
||||
- Creating a J2K file with one POC is broken [\#1191](https://github.com/uclouvain/openjpeg/issues/1191)
|
||||
- Make fails on Arch Linux [\#1174](https://github.com/uclouvain/openjpeg/issues/1174)
|
||||
- Heap buffer overflow in opj\_t1\_clbl\_decode\_processor\(\) triggered with Ghostscript [\#1158](https://github.com/uclouvain/openjpeg/issues/1158)
|
||||
- opj\_stream\_get\_number\_byte\_left: Assertion `p\_stream-\>m\_byte\_offset \>= 0' failed. [\#1151](https://github.com/uclouvain/openjpeg/issues/1151)
|
||||
- The fuzzer ignores too many inputs [\#1079](https://github.com/uclouvain/openjpeg/issues/1079)
|
||||
- out of bounds read [\#1068](https://github.com/uclouvain/openjpeg/issues/1068)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Change defined WIN32 [\#1310](https://github.com/uclouvain/openjpeg/pull/1310) ([Jamaika1](https://github.com/Jamaika1))
|
||||
- docs: fix simple typo, producted -\> produced [\#1308](https://github.com/uclouvain/openjpeg/pull/1308) ([timgates42](https://github.com/timgates42))
|
||||
- Set ${OPENJPEG\_INSTALL\_DOC\_DIR} to DESTINATION of HTMLs [\#1307](https://github.com/uclouvain/openjpeg/pull/1307) ([lemniscati](https://github.com/lemniscati))
|
||||
- Use INC\_DIR for OPENJPEG\_INCLUDE\_DIRS \(fixes uclouvain\#1174\) [\#1306](https://github.com/uclouvain/openjpeg/pull/1306) ([matthew-sharp](https://github.com/matthew-sharp))
|
||||
- pi.c: avoid out of bounds access with POC \(fixes \#1302\) [\#1304](https://github.com/uclouvain/openjpeg/pull/1304) ([rouault](https://github.com/rouault))
|
||||
- Encoder: grow again buffer size [\#1303](https://github.com/uclouvain/openjpeg/pull/1303) ([zodf0055980](https://github.com/zodf0055980))
|
||||
- opj\_j2k\_write\_sod\(\): avoid potential heap buffer overflow \(fixes \#1299\) \(probably master only\) [\#1301](https://github.com/uclouvain/openjpeg/pull/1301) ([rouault](https://github.com/rouault))
|
||||
- pi.c: avoid out of bounds access with POC \(refs https://github.com/uclouvain/openjpeg/issues/1293\#issuecomment-737122836\) [\#1300](https://github.com/uclouvain/openjpeg/pull/1300) ([rouault](https://github.com/rouault))
|
||||
- opj\_t2\_encode\_packet\(\): avoid out of bound access of \#1297, but likely not the proper fix [\#1298](https://github.com/uclouvain/openjpeg/pull/1298) ([rouault](https://github.com/rouault))
|
||||
- opj\_t2\_encode\_packet\(\): avoid out of bound access of \#1294, but likely not the proper fix [\#1296](https://github.com/uclouvain/openjpeg/pull/1296) ([rouault](https://github.com/rouault))
|
||||
- opj\_j2k\_setup\_encoder\(\): validate POC compno0 and compno1 \(fixes \#1293\) [\#1295](https://github.com/uclouvain/openjpeg/pull/1295) ([rouault](https://github.com/rouault))
|
||||
- Encoder: avoid global buffer overflow on irreversible conversion when… [\#1292](https://github.com/uclouvain/openjpeg/pull/1292) ([rouault](https://github.com/rouault))
|
||||
- Decoding: deal with some SPOT6 images that have tiles with a single tile-part with TPsot == 0 and TNsot == 0, and with missing EOC [\#1291](https://github.com/uclouvain/openjpeg/pull/1291) ([rouault](https://github.com/rouault))
|
||||
- Free p\_tcd\_marker\_info to avoid memory leak [\#1288](https://github.com/uclouvain/openjpeg/pull/1288) ([zodf0055980](https://github.com/zodf0055980))
|
||||
- Encoder: grow again buffer size [\#1287](https://github.com/uclouvain/openjpeg/pull/1287) ([zodf0055980](https://github.com/zodf0055980))
|
||||
- Encoder: avoid uint32 overflow when allocating memory for codestream buffer \(fixes \#1243\) [\#1276](https://github.com/uclouvain/openjpeg/pull/1276) ([rouault](https://github.com/rouault))
|
||||
- Java compatibility from 1.5 to 1.6 [\#1263](https://github.com/uclouvain/openjpeg/pull/1263) ([jiapei100](https://github.com/jiapei100))
|
||||
- opj\_decompress: fix double-free on input directory with mix of valid and invalid images [\#1262](https://github.com/uclouvain/openjpeg/pull/1262) ([rouault](https://github.com/rouault))
|
||||
- openjp2: Plug image leak when failing to allocate codestream index. [\#1260](https://github.com/uclouvain/openjpeg/pull/1260) ([sebras](https://github.com/sebras))
|
||||
- openjp2: Plug memory leak when setting data as TLS fails. [\#1258](https://github.com/uclouvain/openjpeg/pull/1258) ([sebras](https://github.com/sebras))
|
||||
- openjp2: Error out if failing to create Tier 1 handle. [\#1256](https://github.com/uclouvain/openjpeg/pull/1256) ([sebras](https://github.com/sebras))
|
||||
- Testing for invalid values of width, height, numcomps [\#1254](https://github.com/uclouvain/openjpeg/pull/1254) ([szukw000](https://github.com/szukw000))
|
||||
- Single-threaded performance improvements in forward DWT for 5-3 and 9-7 \(and other improvements\) [\#1253](https://github.com/uclouvain/openjpeg/pull/1253) ([rouault](https://github.com/rouault))
|
||||
- Add support for multithreading in encoder [\#1248](https://github.com/uclouvain/openjpeg/pull/1248) ([rouault](https://github.com/rouault))
|
||||
- Add support for generation of PLT markers in encoder [\#1246](https://github.com/uclouvain/openjpeg/pull/1246) ([rouault](https://github.com/rouault))
|
||||
- Fix warnings about signed/unsigned casts in pi.c [\#1244](https://github.com/uclouvain/openjpeg/pull/1244) ([rouault](https://github.com/rouault))
|
||||
- opj\_decompress: add sanity checks to avoid segfault in case of decoding error [\#1240](https://github.com/uclouvain/openjpeg/pull/1240) ([rouault](https://github.com/rouault))
|
||||
- ignore wrong icc [\#1236](https://github.com/uclouvain/openjpeg/pull/1236) ([szukw000](https://github.com/szukw000))
|
||||
- Implement writing of IMF profiles [\#1235](https://github.com/uclouvain/openjpeg/pull/1235) ([rouault](https://github.com/rouault))
|
||||
- tests: add alternate checksums for libtiff 4.1 [\#1234](https://github.com/uclouvain/openjpeg/pull/1234) ([rouault](https://github.com/rouault))
|
||||
- opj\_tcd\_init\_tile\(\): avoid integer overflow [\#1232](https://github.com/uclouvain/openjpeg/pull/1232) ([rouault](https://github.com/rouault))
|
||||
- tests/fuzzers: link fuzz binaries using $LIB\_FUZZING\_ENGINE. [\#1230](https://github.com/uclouvain/openjpeg/pull/1230) ([Dor1s](https://github.com/Dor1s))
|
||||
- opj\_j2k\_update\_image\_dimensions\(\): reject images whose coordinates are beyond INT\_MAX \(fixes \#1228\) [\#1229](https://github.com/uclouvain/openjpeg/pull/1229) ([rouault](https://github.com/rouault))
|
||||
- Fix resource leaks [\#1226](https://github.com/uclouvain/openjpeg/pull/1226) ([dodys](https://github.com/dodys))
|
||||
- abi-check.sh: fix false positive ABI error, and display output error log [\#1218](https://github.com/uclouvain/openjpeg/pull/1218) ([rouault](https://github.com/rouault))
|
||||
- pi.c: avoid integer overflow, resulting in later invalid access to memory in opj\_t2\_decode\_packets\(\) [\#1217](https://github.com/uclouvain/openjpeg/pull/1217) ([rouault](https://github.com/rouault))
|
||||
- Add check to validate SGcod/SPcoc/SPcod parameter values. [\#1211](https://github.com/uclouvain/openjpeg/pull/1211) ([sebras](https://github.com/sebras))
|
||||
- Fix buffer overflow reading an image file less than four characters [\#1196](https://github.com/uclouvain/openjpeg/pull/1196) ([robert-ancell](https://github.com/robert-ancell))
|
||||
- compression: emit POC marker when only one single POC is requested \(f… [\#1192](https://github.com/uclouvain/openjpeg/pull/1192) ([rouault](https://github.com/rouault))
|
||||
- Fix several potential vulnerabilities [\#1185](https://github.com/uclouvain/openjpeg/pull/1185) ([Young-X](https://github.com/Young-X))
|
||||
- openjp2/j2k: Report error if all wanted components are not decoded. [\#1164](https://github.com/uclouvain/openjpeg/pull/1164) ([sebras](https://github.com/sebras))
|
||||
|
||||
## [v2.3.1](https://github.com/uclouvain/openjpeg/releases/v2.3.1) (2019-04-02)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.3.0...v2.3.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- v2.2.0 regression for decoding images where TNsot == 0 [\#1120](https://github.com/uclouvain/openjpeg/issues/1120)
|
||||
- Int overflow in jp3d [\#1162](https://github.com/uclouvain/openjpeg/issues/1162)
|
||||
- Heap buffer overflow in opj\_j2k\_update\_image\_data\(\) triggered with Ghostscript [\#1157](https://github.com/uclouvain/openjpeg/issues/1157)
|
||||
- LINUX install doesn't work when building shared libraries is disabled [\#1155](https://github.com/uclouvain/openjpeg/issues/1155)
|
||||
- OPENJPEG null ptr dereference in openjpeg-2.3.0/src/bin/jp2/convert.c:2243 [\#1152](https://github.com/uclouvain/openjpeg/issues/1152)
|
||||
- How to drop certain subbands/layers in DWT [\#1147](https://github.com/uclouvain/openjpeg/issues/1147)
|
||||
- where is the MQ-Coder ouput stream in t2.c? [\#1146](https://github.com/uclouvain/openjpeg/issues/1146)
|
||||
- OpenJPEG 2.3 \(and 2.2?\) multi component image fails to decode with KDU v7.10 [\#1132](https://github.com/uclouvain/openjpeg/issues/1132)
|
||||
- Missing checks for header\_info.height and header\_info.width in function pnmtoimage in src/bin/jpwl/convert.c, which can lead to heap buffer overflow [\#1126](https://github.com/uclouvain/openjpeg/issues/1126)
|
||||
- Assertion Failure in jp2.c [\#1125](https://github.com/uclouvain/openjpeg/issues/1125)
|
||||
- Division-by-zero vulnerabilities in the function pi\_next\_pcrl, pi\_next\_cprl and pi\_next\_rpcl in src/lib/openjp3d/pi.c [\#1123](https://github.com/uclouvain/openjpeg/issues/1123)
|
||||
- Precinct switch \(-c\) doesn't right-shift last record to remaining resolution levels [\#1117](https://github.com/uclouvain/openjpeg/issues/1117)
|
||||
- Sample: encode J2K a data using streams??? [\#1114](https://github.com/uclouvain/openjpeg/issues/1114)
|
||||
- HIGH THROUGHPUT JPEG 2000 \(HTJ2K\) [\#1112](https://github.com/uclouvain/openjpeg/issues/1112)
|
||||
- How to build openjpeg for arm linux? [\#1108](https://github.com/uclouvain/openjpeg/issues/1108)
|
||||
- crash [\#1106](https://github.com/uclouvain/openjpeg/issues/1106)
|
||||
- JP2000 returning OPJ\_CLRSPC\_UNKNOWN color space [\#1103](https://github.com/uclouvain/openjpeg/issues/1103)
|
||||
- Compilation successful but install unsuccessful: Calling executables throws libraries missing error [\#1102](https://github.com/uclouvain/openjpeg/issues/1102)
|
||||
- fprintf format string requires 1 parameter but only 0 are given [\#1093](https://github.com/uclouvain/openjpeg/issues/1093)
|
||||
- fprintf format string requires 1 parameter but only 0 are given [\#1092](https://github.com/uclouvain/openjpeg/issues/1092)
|
||||
- sprintf buffer overflow [\#1088](https://github.com/uclouvain/openjpeg/issues/1088)
|
||||
- sprintf buffer overflow [\#1085](https://github.com/uclouvain/openjpeg/issues/1085)
|
||||
- Infinite loop when reading jp2 [\#1081](https://github.com/uclouvain/openjpeg/issues/1081)
|
||||
- missing format string parameter [\#1074](https://github.com/uclouvain/openjpeg/issues/1074)
|
||||
- Excessive Iteration in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1059](https://github.com/uclouvain/openjpeg/issues/1059)
|
||||
- Out-of-bound left shift in opj\_j2k\_setup\_encoder \(src/lib/openjp2/j2k.c\) [\#1057](https://github.com/uclouvain/openjpeg/issues/1057)
|
||||
- Encode image on Unsplash [\#1054](https://github.com/uclouvain/openjpeg/issues/1054)
|
||||
- Integer overflow in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1053](https://github.com/uclouvain/openjpeg/issues/1053)
|
||||
- Signed Integer Overflow - 68065512 [\#1048](https://github.com/uclouvain/openjpeg/issues/1048)
|
||||
- Similar vulnerable functions related to CVE-2017-14041 [\#1044](https://github.com/uclouvain/openjpeg/issues/1044)
|
||||
- \[ERROR\] COD marker already read. No more than one COD marker per tile. [\#1043](https://github.com/uclouvain/openjpeg/issues/1043)
|
||||
- failing to install latest version of openjpeg from source [\#1041](https://github.com/uclouvain/openjpeg/issues/1041)
|
||||
- Trouble compressing large raw image [\#1032](https://github.com/uclouvain/openjpeg/issues/1032)
|
||||
- Download and installed code from 2.3 archive. Installing 2.2? [\#1030](https://github.com/uclouvain/openjpeg/issues/1030)
|
||||
- missing fclose [\#1029](https://github.com/uclouvain/openjpeg/issues/1029)
|
||||
- NULL Pointer Access in function imagetopnm of convert.c\(jp2\):1289 [\#860](https://github.com/uclouvain/openjpeg/issues/860)
|
||||
- NULL Pointer Access in function imagetopnm of convert.c:2226\(jp2\) [\#859](https://github.com/uclouvain/openjpeg/issues/859)
|
||||
- Heap Buffer Overflow in function imagetotga of convert.c\(jp2\):942 [\#858](https://github.com/uclouvain/openjpeg/issues/858)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- abi-check.sh: fix broken download URL [\#1188](https://github.com/uclouvain/openjpeg/pull/1188) ([rouault](https://github.com/rouault))
|
||||
- opj\_t1\_encode\_cblks: fix UBSAN signed integer overflow [\#1187](https://github.com/uclouvain/openjpeg/pull/1187) ([rouault](https://github.com/rouault))
|
||||
- convertbmp: detect invalid file dimensions early \(CVE-2018-6616\) [\#1172](https://github.com/uclouvain/openjpeg/pull/1172) ([hlef](https://github.com/hlef))
|
||||
- color\_apply\_icc\_profile: avoid potential heap buffer overflow [\#1170](https://github.com/uclouvain/openjpeg/pull/1170) ([rouault](https://github.com/rouault))
|
||||
- Fix multiple potential vulnerabilities and bugs [\#1168](https://github.com/uclouvain/openjpeg/pull/1168) ([Young-X](https://github.com/Young-X))
|
||||
- Fix several memory and resource leaks [\#1163](https://github.com/uclouvain/openjpeg/pull/1163) ([nforro](https://github.com/nforro))
|
||||
- Fix some potential overflow issues [\#1161](https://github.com/uclouvain/openjpeg/pull/1161) ([stweil](https://github.com/stweil))
|
||||
- jp3d/jpwl convert: fix write stack buffer overflow [\#1160](https://github.com/uclouvain/openjpeg/pull/1160) ([hlef](https://github.com/hlef))
|
||||
- Int overflow fixed [\#1159](https://github.com/uclouvain/openjpeg/pull/1159) ([ichlubna](https://github.com/ichlubna))
|
||||
- Update knownfailures- files given current configurations [\#1149](https://github.com/uclouvain/openjpeg/pull/1149) ([rouault](https://github.com/rouault))
|
||||
- CVE-2018-5785: fix issues with zero bitmasks [\#1148](https://github.com/uclouvain/openjpeg/pull/1148) ([hlef](https://github.com/hlef))
|
||||
- openjp2/jp2: Fix two format strings [\#1143](https://github.com/uclouvain/openjpeg/pull/1143) ([stweil](https://github.com/stweil))
|
||||
- Changes in pnmtoimage if image data are missing [\#1141](https://github.com/uclouvain/openjpeg/pull/1141) ([szukw000](https://github.com/szukw000))
|
||||
- Relative path to header files is hardcoded in OpenJPEGConfig.cmake.in file [\#1140](https://github.com/uclouvain/openjpeg/pull/1140) ([bukatlib](https://github.com/bukatlib))
|
||||
- Cast on uint ceildiv [\#1136](https://github.com/uclouvain/openjpeg/pull/1136) ([reverson](https://github.com/reverson))
|
||||
- Add -DBUILD\_PKGCONFIG\_FILES to install instructions [\#1133](https://github.com/uclouvain/openjpeg/pull/1133) ([robe2](https://github.com/robe2))
|
||||
- Fix some typos in code comments and documentation [\#1128](https://github.com/uclouvain/openjpeg/pull/1128) ([stweil](https://github.com/stweil))
|
||||
- Fix regression in reading files with TNsot == 0 \(refs \#1120\) [\#1121](https://github.com/uclouvain/openjpeg/pull/1121) ([rouault](https://github.com/rouault))
|
||||
- Use local type declaration for POSIX standard type only for MS compiler [\#1119](https://github.com/uclouvain/openjpeg/pull/1119) ([stweil](https://github.com/stweil))
|
||||
- Fix Mac builds [\#1104](https://github.com/uclouvain/openjpeg/pull/1104) ([rouault](https://github.com/rouault))
|
||||
- jp3d: Replace sprintf\(\) by snprintf\(\) in volumetobin\(\) [\#1101](https://github.com/uclouvain/openjpeg/pull/1101) ([kbabioch](https://github.com/kbabioch))
|
||||
- opj\_mj2\_extract: Rename output\_location to output\_prefix [\#1096](https://github.com/uclouvain/openjpeg/pull/1096) ([kbabioch](https://github.com/kbabioch))
|
||||
- mj2: Add missing variable to format string in fprintf\(\) invocation in meta\_out.c [\#1094](https://github.com/uclouvain/openjpeg/pull/1094) ([kbabioch](https://github.com/kbabioch))
|
||||
- Convert files to UTF-8 encoding [\#1090](https://github.com/uclouvain/openjpeg/pull/1090) ([stweil](https://github.com/stweil))
|
||||
- fix unchecked integer multiplication overflow [\#1080](https://github.com/uclouvain/openjpeg/pull/1080) ([setharnold](https://github.com/setharnold))
|
||||
- Fixed typos [\#1062](https://github.com/uclouvain/openjpeg/pull/1062) ([radarhere](https://github.com/radarhere))
|
||||
- Note that seek uses SEEK\_SET behavior. [\#1055](https://github.com/uclouvain/openjpeg/pull/1055) ([ideasman42](https://github.com/ideasman42))
|
||||
- Some Doxygen tags are removed [\#1050](https://github.com/uclouvain/openjpeg/pull/1050) ([szukw000](https://github.com/szukw000))
|
||||
- Fix resource leak \(CID 179466\) [\#1047](https://github.com/uclouvain/openjpeg/pull/1047) ([stweil](https://github.com/stweil))
|
||||
- Changed cmake version test to allow for cmake 2.8.11.x [\#1042](https://github.com/uclouvain/openjpeg/pull/1042) ([radarhere](https://github.com/radarhere))
|
||||
- Add missing fclose\(\) statement in error condition. [\#1037](https://github.com/uclouvain/openjpeg/pull/1037) ([gfiumara](https://github.com/gfiumara))
|
||||
|
||||
## [v2.3.0](https://github.com/uclouvain/openjpeg/releases/v2.3.0) (2017-10-04)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.2.0...v2.3.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Sub-tile decoding: only decode precincts and codeblocks that intersect the window specified in opj_set_decode_area() [\#990](https://github.com/uclouvain/openjpeg/pull/990) ([rouault](https://github.com/rouault))
|
||||
- Sub-tile decoding: only apply IDWT on areas that participate to the window of interest [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) ([rouault](https://github.com/rouault))
|
||||
- Sub-tile decoding: memory use reduction and perf improvements [\#1010](https://github.com/uclouvain/openjpeg/pull/1010) ([rouault](https://github.com/rouault))
|
||||
- Add capability to decode only a subset of all components of an image. [\#1022](https://github.com/uclouvain/openjpeg/pull/1022) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Setting x offset of decode region to -1 causes opj\_decompress to go into infinite loop [\#736](https://github.com/uclouvain/openjpeg/issues/736)
|
||||
- Problem decoding multiple tiles with get\_decoded\_tile when cmap/pclr/cdef boxes are present in jp2 file [\#484](https://github.com/uclouvain/openjpeg/issues/484)
|
||||
- set reduce\_factor\_may\_fail [\#474](https://github.com/uclouvain/openjpeg/issues/474)
|
||||
- opj\_compress.exe, command line parser, infinite loop [\#469](https://github.com/uclouvain/openjpeg/issues/469)
|
||||
- Various memory access issues found via fuzzing [\#448](https://github.com/uclouvain/openjpeg/issues/448)
|
||||
- Multiple warnings when building OpenJPEG \(trunk\) [\#442](https://github.com/uclouvain/openjpeg/issues/442)
|
||||
- Bulk fuzz-testing report [\#427](https://github.com/uclouvain/openjpeg/issues/427)
|
||||
- remove all printf from openjpeg / use proper function pointer for logging [\#371](https://github.com/uclouvain/openjpeg/issues/371)
|
||||
- minor changes, clean-up [\#349](https://github.com/uclouvain/openjpeg/issues/349)
|
||||
- image-\>numcomps \> 4 [\#333](https://github.com/uclouvain/openjpeg/issues/333)
|
||||
- Improve support for region of interest [\#39](https://github.com/uclouvain/openjpeg/issues/39)
|
||||
- Public function to tell kernel type used \(5x3 vs 9x7\) [\#3](https://github.com/uclouvain/openjpeg/issues/3)
|
||||
- elf binary in source package ? [\#1026](https://github.com/uclouvain/openjpeg/issues/1026)
|
||||
- opj\_cio\_open [\#1025](https://github.com/uclouvain/openjpeg/issues/1025)
|
||||
- Building with Visual Studio 2015 [\#1023](https://github.com/uclouvain/openjpeg/issues/1023)
|
||||
- tcd.cpp\>:1617:33: error: assigning to 'OPJ\_INT32 \*' \(aka 'int \*'\) from incompatible type 'void \*' [\#1021](https://github.com/uclouvain/openjpeg/issues/1021)
|
||||
- j2k.cpp \> comparison of address of 'p\_j2k-\>m\_cp.tcps\[0\].m\_data' not equal to a null pointer is always true [\#1020](https://github.com/uclouvain/openjpeg/issues/1020)
|
||||
- Openjpeg 2.2.0 always build shared library even though -DBUILD\_SHARED\_LIBS:bool=off [\#1019](https://github.com/uclouvain/openjpeg/issues/1019)
|
||||
- missing fclose [\#1018](https://github.com/uclouvain/openjpeg/issues/1018)
|
||||
- Use opj\_image\_data\_free instead of opj\_free for image-\>comps\[\].data [\#1014](https://github.com/uclouvain/openjpeg/issues/1014)
|
||||
- malloc poison on some compilers - cross compiling [\#1013](https://github.com/uclouvain/openjpeg/issues/1013)
|
||||
- Add OPJ\_VERSION\_MAJOR, OPJ\_VERSION\_MINOR, OPJ\_VERSION\_MICRO macros in openjpeg.h [\#1011](https://github.com/uclouvain/openjpeg/issues/1011)
|
||||
- Encode: do not perform rate control for single-tile lossless [\#1009](https://github.com/uclouvain/openjpeg/issues/1009)
|
||||
- opj\_set\_decoded\_resolution\_factor\(\): bad interaction with opj\_set\_decode\_area\(\) and/or opj\_decode\(\) [\#1006](https://github.com/uclouvain/openjpeg/issues/1006)
|
||||
- memory allocation failure with .pgx file [\#999](https://github.com/uclouvain/openjpeg/issues/999)
|
||||
- Unable to fuzz with raw image as input [\#998](https://github.com/uclouvain/openjpeg/issues/998)
|
||||
- stack-based buffer overflow write in pgxtoimage \(/convert.c\) [\#997](https://github.com/uclouvain/openjpeg/issues/997)
|
||||
- freeze with a crafted bmp [\#996](https://github.com/uclouvain/openjpeg/issues/996)
|
||||
- invalid memory write in tgatoimage \(convert.c\) [\#995](https://github.com/uclouvain/openjpeg/issues/995)
|
||||
- static build on Windows fails [\#994](https://github.com/uclouvain/openjpeg/issues/994)
|
||||
- another heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#993](https://github.com/uclouvain/openjpeg/issues/993)
|
||||
- heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#992](https://github.com/uclouvain/openjpeg/issues/992)
|
||||
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) \(unfixed \#985\) [\#991](https://github.com/uclouvain/openjpeg/issues/991)
|
||||
- heap overflow in opj\_compress [\#988](https://github.com/uclouvain/openjpeg/issues/988)
|
||||
- heap overflow in opj\_decompress [\#987](https://github.com/uclouvain/openjpeg/issues/987)
|
||||
- heap-based buffer overflow in opj\_bio\_byteout \(bio.c\) [\#986](https://github.com/uclouvain/openjpeg/issues/986)
|
||||
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) [\#985](https://github.com/uclouvain/openjpeg/issues/985)
|
||||
- memory allocation failure in opj\_aligned\_alloc\_n \(opj\_malloc.c\) [\#983](https://github.com/uclouvain/openjpeg/issues/983)
|
||||
- heap-base buffer overflow in opj\_mqc\_flush \(mqc.c\) [\#982](https://github.com/uclouvain/openjpeg/issues/982)
|
||||
- Decode fails for JP2s with ICC profile [\#981](https://github.com/uclouvain/openjpeg/issues/981)
|
||||
- Unit tests failing on Ubuntu 17.04 [\#916](https://github.com/uclouvain/openjpeg/issues/916)
|
||||
- Encoder crashes on small images [\#901](https://github.com/uclouvain/openjpeg/issues/901)
|
||||
- openjpeg-1.5.3 fails to compile [\#830](https://github.com/uclouvain/openjpeg/issues/830)
|
||||
- opj\_compress crops image \(win\) or creates a jp2 which cannot be decompressed \(lin\) [\#716](https://github.com/uclouvain/openjpeg/issues/716)
|
||||
- -d flag is silently ignored when decoding a single tile [\#693](https://github.com/uclouvain/openjpeg/issues/693)
|
||||
- transition away from dev-utils [\#628](https://github.com/uclouvain/openjpeg/issues/628)
|
||||
- update instructions to build with Visual Studio and 64-Bit Visual C++ Toolset. [\#1028](https://github.com/uclouvain/openjpeg/pull/1028) ([quangnh89](https://github.com/quangnh89))
|
||||
- Add missing newline at end of file [\#1024](https://github.com/uclouvain/openjpeg/pull/1024) ([stweil](https://github.com/stweil))
|
||||
- merge master into coverity\_scan to update coverity results [\#1008](https://github.com/uclouvain/openjpeg/pull/1008) ([detonin](https://github.com/detonin))
|
||||
- Use more const qualifiers [\#984](https://github.com/uclouvain/openjpeg/pull/984) ([stweil](https://github.com/stweil))
|
||||
- Changes in converttif.c for PPC64 [\#980](https://github.com/uclouvain/openjpeg/pull/980) ([szukw000](https://github.com/szukw000))
|
||||
|
||||
## [v2.2.0](https://github.com/uclouvain/openjpeg/releases/v2.2.0) (2017-08-10)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.2...v2.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968) ([rouault](https://github.com/rouault))
|
||||
- T1 & DWT multithreading decoding optimizations [\#786](https://github.com/uclouvain/openjpeg/pull/786) ([rouault](https://github.com/rouault))
|
||||
- Tier1 decoder speed optimizations [\#783](https://github.com/uclouvain/openjpeg/pull/783) ([rouault](https://github.com/rouault))
|
||||
- Inverse DWT 5x3: lift implementation / SSE accelerated version [\#953](https://github.com/uclouvain/openjpeg/issues/953)
|
||||
- install static libraries [\#969](https://github.com/uclouvain/openjpeg/pull/969) ([jeroen](https://github.com/jeroen))
|
||||
- IDWT 5x3 single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957) ([rouault](https://github.com/rouault))
|
||||
- build both shared and static library [\#954](https://github.com/uclouvain/openjpeg/pull/954) ([jeroen](https://github.com/jeroen))
|
||||
- T1 flag optimizations \(\#172\) [\#945](https://github.com/uclouvain/openjpeg/pull/945) ([rouault](https://github.com/rouault))
|
||||
- CMake: add stronger warnings for openjp2 lib/bin by default, and error out on declaration-after-statement [\#936](https://github.com/uclouvain/openjpeg/pull/936) ([rouault](https://github.com/rouault))
|
||||
- Quiet mode for opj\_decompress via -quiet long parameter. [\#928](https://github.com/uclouvain/openjpeg/pull/928) ([RussellMcOrmond](https://github.com/RussellMcOrmond))
|
||||
- Implement predictive termination check [\#800](https://github.com/uclouvain/openjpeg/pull/800) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Several issues spotted by Google OSS Fuzz - [see here](https://github.com/search?l=&q=OSS+Fuzz+author-date%3A2017-07-04..2017-08-01+repo%3Auclouvain%2Fopenjpeg&ref=advsearch&type=Commits&utf8=%E2%9C%93)
|
||||
- Missing fclose [\#976](https://github.com/uclouvain/openjpeg/issues/976)
|
||||
- Heap buffer overflow read in openjpeg imagetopnm [\#970](https://github.com/uclouvain/openjpeg/issues/970)
|
||||
- opj\_decompress opj\_j2k\_update\_image\_data\(\) Segment falut [\#948](https://github.com/uclouvain/openjpeg/issues/948)
|
||||
- Generic Crash in 1.5.0 [\#941](https://github.com/uclouvain/openjpeg/issues/941)
|
||||
- Segmentation Faults [\#940](https://github.com/uclouvain/openjpeg/issues/940)
|
||||
- Assertions thrown [\#939](https://github.com/uclouvain/openjpeg/issues/939)
|
||||
- Floating Point Errors [\#938](https://github.com/uclouvain/openjpeg/issues/938)
|
||||
- Division by zero crash [\#937](https://github.com/uclouvain/openjpeg/issues/937)
|
||||
- malformed jp2 can cause heap-buffer-overflow [\#909](https://github.com/uclouvain/openjpeg/issues/909)
|
||||
- NULL dereference can cause by malformed file [\#908](https://github.com/uclouvain/openjpeg/issues/908)
|
||||
- Out of bound read in opj\_j2k\_add\_mct [\#907](https://github.com/uclouvain/openjpeg/issues/907)
|
||||
- Check bpno\_plus\_one in opj\_t1\_decode\_cblk [\#903](https://github.com/uclouvain/openjpeg/issues/903)
|
||||
- Undefined-shift in opj\_j2k\_read\_siz [\#902](https://github.com/uclouvain/openjpeg/issues/902)
|
||||
- opj\_compress v2.1.2 can create images opj\_decompress cannot read [\#891](https://github.com/uclouvain/openjpeg/issues/891)
|
||||
- Improper usage of opj\_int\_ceildiv can cause overflows [\#889](https://github.com/uclouvain/openjpeg/issues/889)
|
||||
- Undefined shift in opj\_get\_all\_encoding\_parameters [\#885](https://github.com/uclouvain/openjpeg/issues/885)
|
||||
- Denial of service \(crash\) due to use-after-free when decoding an illegal JPEG2000 image file v2.1.2 \(2017-04 [\#880](https://github.com/uclouvain/openjpeg/issues/880)
|
||||
- Denial of service \(crash\) when decoding an illegal JPEG2000 image file v2.1.2 \(2017-03\) [\#879](https://github.com/uclouvain/openjpeg/issues/879)
|
||||
- bug png 2 j2k [\#868](https://github.com/uclouvain/openjpeg/issues/868)
|
||||
- Inconsistent compression using cinema settings on folder of non-compliant image [\#864](https://github.com/uclouvain/openjpeg/issues/864)
|
||||
- Openjpeg-2.1.2 Heap Buffer Overflow Vulnerability due to Insufficient check [\#862](https://github.com/uclouvain/openjpeg/issues/862)
|
||||
- Heap Buffer Overflow in function pnmtoimage of convert.c [\#861](https://github.com/uclouvain/openjpeg/issues/861)
|
||||
- CVE-2016-9112 FPE\(Floating Point Exception\) in lib/openjp2/pi.c:523 [\#855](https://github.com/uclouvain/openjpeg/issues/855)
|
||||
- CVE-2016-5139, CVE-2016-5152, CVE-2016-5158, CVE-2016-5159 [\#854](https://github.com/uclouvain/openjpeg/issues/854)
|
||||
- Undefined Reference error [\#853](https://github.com/uclouvain/openjpeg/issues/853)
|
||||
- opj\_compress with lossy compression results in strange pixel values [\#851](https://github.com/uclouvain/openjpeg/issues/851)
|
||||
- CVE-2016-1626 and CVE-2016-1628 [\#850](https://github.com/uclouvain/openjpeg/issues/850)
|
||||
- Out-of-Bounds Write in opj\_mqc\_byteout of mqc.c [\#835](https://github.com/uclouvain/openjpeg/issues/835)
|
||||
- WARNING in tgt\_create tree-\>numnodes == 0, no tree created. [\#794](https://github.com/uclouvain/openjpeg/issues/794)
|
||||
- Potential overflow when precision is larger than 32 [\#781](https://github.com/uclouvain/openjpeg/issues/781)
|
||||
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 366\) [\#780](https://github.com/uclouvain/openjpeg/issues/780)
|
||||
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 363\) [\#779](https://github.com/uclouvain/openjpeg/issues/779)
|
||||
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 447\) [\#778](https://github.com/uclouvain/openjpeg/issues/778)
|
||||
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 444\) [\#777](https://github.com/uclouvain/openjpeg/issues/777)
|
||||
- Encoding the following file with 32x32 tiling produces jp2 image with artifact [\#737](https://github.com/uclouvain/openjpeg/issues/737)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 526 of pi.c\) [\#732](https://github.com/uclouvain/openjpeg/issues/732)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 523 of pi.c\) [\#731](https://github.com/uclouvain/openjpeg/issues/731)
|
||||
- OpenJpeg 2.1 and 1.4 fails to decompress this file correctly [\#721](https://github.com/uclouvain/openjpeg/issues/721)
|
||||
- MQ Encode :uninitialized memory access when first pass does not output any bytes [\#709](https://github.com/uclouvain/openjpeg/issues/709)
|
||||
- Out-of-bounds read in opj\_j2k\_update\_image\_data and opj\_tgt\_reset function [\#704](https://github.com/uclouvain/openjpeg/issues/704)
|
||||
- Remove opj\_aligned\_malloc / opj\_aligned\_realloc / opj\_aligned\_free? [\#689](https://github.com/uclouvain/openjpeg/issues/689)
|
||||
- There is an issue with rendering some type of jpeg file. Please ref the link. [\#672](https://github.com/uclouvain/openjpeg/issues/672)
|
||||
- Null Dereference in tcd\_malloc\_decode\_tile [\#657](https://github.com/uclouvain/openjpeg/issues/657)
|
||||
- ETS-C1P0-p0\_12.j2k-compare2ref & NR-C1P0-p0\_12.j2k-compare2base failing under windows [\#655](https://github.com/uclouvain/openjpeg/issues/655)
|
||||
- Memory leak [\#631](https://github.com/uclouvain/openjpeg/issues/631)
|
||||
- Test 481 reports error in valgrind memcheck [\#612](https://github.com/uclouvain/openjpeg/issues/612)
|
||||
- reserved identifier violation [\#587](https://github.com/uclouvain/openjpeg/issues/587)
|
||||
- Buffer overflow when compressing some 16 bits images of the test suite [\#539](https://github.com/uclouvain/openjpeg/issues/539)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#480](https://github.com/uclouvain/openjpeg/issues/480)
|
||||
- Automated fuzz testing [\#468](https://github.com/uclouvain/openjpeg/issues/468)
|
||||
- Expected to find EPH marker [\#425](https://github.com/uclouvain/openjpeg/issues/425)
|
||||
- read: segment too long \(6182\) with max \(35872\) for codeblock 0 \(p=19, b=2, r=5, c=1\) [\#284](https://github.com/uclouvain/openjpeg/issues/284)
|
||||
- building 64bit version has lots of warnings [\#244](https://github.com/uclouvain/openjpeg/issues/244)
|
||||
- Wrong encoding of small tiles with high level number [\#239](https://github.com/uclouvain/openjpeg/issues/239)
|
||||
- Errors raised in pi.c by VS11 analyzer [\#190](https://github.com/uclouvain/openjpeg/issues/190)
|
||||
- Undocumented optimization found in v2 branch of openjpeg [\#183](https://github.com/uclouvain/openjpeg/issues/183)
|
||||
- T1 optimisations jpeg2000 [\#172](https://github.com/uclouvain/openjpeg/issues/172)
|
||||
- Remove OPJ\_NOSANITIZE in opj\_bio\_read\(\) and opj\_bio\_write\(\) \(\#761\) [\#955](https://github.com/uclouvain/openjpeg/pull/955) ([rouault](https://github.com/rouault))
|
||||
- Fix bypass pterm termall and lossless decomposition issue \(\#891, \#892\) [\#949](https://github.com/uclouvain/openjpeg/pull/949) ([rouault](https://github.com/rouault))
|
||||
- Escape quotes to ensure README renders on GitHub correctly [\#914](https://github.com/uclouvain/openjpeg/pull/914) ([alexwlchan](https://github.com/alexwlchan))
|
||||
- Remove spurious .R macros from manpages [\#899](https://github.com/uclouvain/openjpeg/pull/899) ([jwilk](https://github.com/jwilk))
|
||||
- Remove warnings related to empty tag-trees. [\#893](https://github.com/uclouvain/openjpeg/pull/893) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Maintenance-related tasks:**
|
||||
|
||||
- Submit OpenJPEG to oss-fuzz [\#965](https://github.com/uclouvain/openjpeg/issues/965)
|
||||
- Updates for Doxygen to suppress warnings [\#849](https://github.com/uclouvain/openjpeg/issues/849)
|
||||
- Remove useless knownfailures \(since LAZY encoding is fixed\) [\#964](https://github.com/uclouvain/openjpeg/pull/964) ([rouault](https://github.com/rouault))
|
||||
- Enable AVX2 at runtime on Travis-CI and AppVeyor [\#963](https://github.com/uclouvain/openjpeg/pull/963) ([rouault](https://github.com/rouault))
|
||||
- Tests: test opj\_compress in VSC mode \(related to \#172\) [\#935](https://github.com/uclouvain/openjpeg/pull/935) ([rouault](https://github.com/rouault))
|
||||
- Reformat: apply reformattin on .h files \(\#128\) [\#926](https://github.com/uclouvain/openjpeg/pull/926) ([rouault](https://github.com/rouault))
|
||||
- Add mechanisms to reformat and check code style, and reformat whole codebase \(\#128\) [\#919](https://github.com/uclouvain/openjpeg/pull/919) ([rouault](https://github.com/rouault))
|
||||
- Add profiling of CPU and memory usage \(\#912\) [\#918](https://github.com/uclouvain/openjpeg/pull/918) ([rouault](https://github.com/rouault))
|
||||
- Add performance benchmarking scripts [\#917](https://github.com/uclouvain/openjpeg/pull/917) ([rouault](https://github.com/rouault))
|
||||
- Fix retrieval of jpylyzer in AppVeyor [\#915](https://github.com/uclouvain/openjpeg/pull/915) ([rouault](https://github.com/rouault))
|
||||
|
||||
## [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)
|
||||
- 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 disappeared [\#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 artifacts 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 consistently [\#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)*
|
|
@ -8,11 +8,11 @@
|
|||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
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_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
|
||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
|
||||
# Exclude files from the Testing directories
|
||||
|
@ -22,18 +22,12 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
|||
".*/thirdparty/.*"
|
||||
)
|
||||
|
||||
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
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:
|
||||
# supress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
"libpng.*has no symbols"
|
|
@ -0,0 +1,20 @@
|
|||
# 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(FCGI_FOUND)
|
||||
SET(FCGI_LIBRARIES)
|
||||
SET(FCGI_INCLUDE_DIRS)
|
||||
ENDIF(FCGI_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(FCGI_INCLUDE_DIR FCGI_LIBRARY)
|
|
@ -1,24 +1,19 @@
|
|||
#
|
||||
# this module looks for KAKADU
|
||||
# this module looks for KAKADu
|
||||
# http://www.kakadusoftware.com/
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
# Copyright (c) 2006-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(KDU_EXPAND_EXECUTABLE
|
||||
FIND_PROGRAM(KDU_EXPAND_EXECUTABLE
|
||||
kdu_expand
|
||||
)
|
||||
|
||||
find_program(KDU_COMPRESS_EXECUTABLE
|
||||
kdu_compress
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
MARK_AS_ADVANCED(
|
||||
KDU_EXPAND_EXECUTABLE
|
||||
KDU_COMPRESS_EXECUTABLE
|
||||
)
|
|
@ -12,20 +12,20 @@
|
|||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
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)
|
||||
SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
||||
|
||||
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||
FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
||||
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)
|
||||
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()
|
||||
IF(LCMS_FOUND)
|
||||
SET( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||
ENDIF(LCMS_FOUND)
|
|
@ -12,20 +12,20 @@
|
|||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
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)
|
||||
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
||||
|
||||
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
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()
|
||||
IF(LCMS2_FOUND)
|
||||
SET( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||
ENDIF(LCMS2_FOUND)
|
|
@ -7,7 +7,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
|||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
endif()
|
||||
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||
endif()
|
||||
endif(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||
|
||||
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
||||
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
||||
|
@ -28,45 +28,43 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
|||
|
||||
# Make this explicit here, rather than accepting the CPack default value,
|
||||
# so we can refer to it:
|
||||
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||
SET(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||
|
||||
if(NOT DEFINED CPACK_SYSTEM_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("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
SET(CPACK_SYSTEM_NAME Cygwin)
|
||||
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
IF(CMAKE_CL_64)
|
||||
SET(CPACK_SYSTEM_NAME win64-x64)
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(CPACK_SYSTEM_NAME win32-x86)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
|
||||
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
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
|
||||
# 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
|
||||
IF(CYGWIN)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
ELSE(CYGWIN)
|
||||
SET(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(CYGWIN)
|
||||
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
|
||||
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()
|
||||
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)
|
||||
|
||||
include(CPack)
|
||||
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
|
@ -0,0 +1,54 @@
|
|||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 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)
|
||||
# The following is inspired from:
|
||||
# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Packaging_and_Exporting
|
||||
# However the following is difficult to handle:
|
||||
# get_filename_component(myproj_INCLUDE_DIRS "${SELF_DIR}/../../include/myproj" ABSOLUTE)
|
||||
# it asssumes a non multi-arch system, where 'include' is located '../include' from lib
|
||||
# therefore we need to take into account the number of subdirs in OPENJPEG_INSTALL_LIB_DIR
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
# This is an install tree
|
||||
include(${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/@relative_parent@/@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
||||
|
||||
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
# This is a build tree
|
||||
SET( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
||||
|
||||
include(${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
|
||||
else(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
message(FATAL_ERROR "ooops")
|
||||
endif(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
endif(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
|
||||
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
|
||||
|
||||
# Backward compatible part:
|
||||
SET(OPENJPEG_FOUND TRUE)
|
||||
|
408
CMakeLists.txt
|
@ -6,41 +6,40 @@
|
|||
# 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
|
||||
# e.g.:
|
||||
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
cmake_minimum_required(VERSION 2.8.5)
|
||||
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
if(COMMAND CMAKE_POLICY)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
|
||||
if(NOT OPENJPEG_NAMESPACE)
|
||||
set(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
set(OPENJPEG_STANDALONE 1)
|
||||
endif()
|
||||
IF(NOT OPENJPEG_NAMESPACE)
|
||||
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
SET(OPENJPEG_STANDALONE 1)
|
||||
ENDIF(NOT OPENJPEG_NAMESPACE)
|
||||
# In all cases:
|
||||
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||
set(OPENJPEG_LIBRARY_NAME openjp2)
|
||||
STRING(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||
|
||||
project(${OPENJPEG_NAMESPACE} C)
|
||||
PROJECT(${OPENJPEG_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 5)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION
|
||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
||||
SET(OPENJPEG_VERSION_MINOR 5)
|
||||
SET(OPENJPEG_VERSION_BUILD 3)
|
||||
SET(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
set(PACKAGE_VERSION
|
||||
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
|
||||
# two numerorations, one for the openjpeg version and one for openjpeg soversion
|
||||
# version | soversion
|
||||
# 1.0 | 0
|
||||
# 1.1 | 1
|
||||
|
@ -50,41 +49,32 @@ set(PACKAGE_VERSION
|
|||
# 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 | 7
|
||||
# 2.3.0 | 7
|
||||
# 2.3.1 | 7
|
||||
# 2.4.0 | 7
|
||||
# 2.5.0 | 7
|
||||
# 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)
|
||||
SET(OPENJPEG_SOVERSION 5)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
SET(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||
)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
|
||||
SET(CMAKE_MODULE_PATH
|
||||
${CMAKE_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
|
||||
|
@ -96,276 +86,224 @@ 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
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# 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}")
|
||||
|
||||
set(OPENJPEG_INSTALL_SUBDIR "${PROJECT_NAME}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
|
||||
# The following will compute the amount of parent dir to go
|
||||
# from include to lib. it works nicely with
|
||||
# OPENJPEG_INSTALL_LIB_DIR=lib
|
||||
# OPENJPEG_INSTALL_LIB_DIR=lib/
|
||||
# OPENJPEG_INSTALL_LIB_DIR=/lib
|
||||
# OPENJPEG_INSTALL_LIB_DIR=lib/gnu-linux-x64
|
||||
STRING(REPLACE "/" ";" relative_to_lib ${OPENJPEG_INSTALL_LIB_DIR})
|
||||
set(relative_parent "..")
|
||||
foreach( elem ${relative_to_lib})
|
||||
set( relative_parent "${relative_parent}/.." )
|
||||
endforeach()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
SET(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||
if(WIN32)
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
|
||||
else()
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
set(OPENJPEG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (${CMAKE_VERSION} VERSION_LESS 3.0)
|
||||
# For cmake >= 3.0, we turn on CMP0042 and
|
||||
# https://cmake.org/cmake/help/v3.0/policy/CMP0042.html mentions
|
||||
# "Projects wanting @rpath in a target’s install name may remove any setting of the INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables"
|
||||
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
endif()
|
||||
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
|
||||
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(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Big endian test:
|
||||
if (NOT EMSCRIPTEN)
|
||||
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
configure_file(
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/CTestCustom.cmake
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
|
||||
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
option(BUILD_STATIC_LIBS "Build OpenJPEG static library." 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)
|
||||
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)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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
|
||||
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()
|
||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
IF(UNIX)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
\"libopenjpeg1.pc\"
|
||||
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig/libopenjpeg.pc\")")
|
||||
ENDIF(UNIX)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
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.
|
||||
# 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>")
|
||||
set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>" -Wall -Wextra -Wconversion -Wunused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement)
|
||||
endif()
|
||||
SET(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_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)
|
||||
if(UNIX)
|
||||
option(BUILD_UNIT_TESTS "Build unit tests (bench_dwt, test_sparse_array, etc..)" OFF)
|
||||
endif()
|
||||
INCLUDE_DIRECTORIES(BEFORE ${OPENJPEG_BINARY_DIR})
|
||||
ADD_SUBDIRECTORY(libopenjpeg)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
option(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
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)
|
||||
mark_as_advanced(BUILD_VIEWER)
|
||||
mark_as_advanced(BUILD_JAVA)
|
||||
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(BUILD_JPIP)
|
||||
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||
OPTION(USE_SYSTEM_GETOPT "Prefer system installed getopt()" OFF)
|
||||
MARK_AS_ADVANCED(USE_SYSTEM_GETOPT)
|
||||
MARK_AS_ADVANCED(BUILD_VIEWER)
|
||||
MARK_AS_ADVANCED(BUILD_JAVA)
|
||||
|
||||
if(BUILD_CODEC)
|
||||
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)
|
||||
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
ADD_SUBDIRECTORY(thirdparty)
|
||||
ADD_SUBDIRECTORY(applications)
|
||||
ENDIF (BUILD_CODEC OR BUILD_MJ2)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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
|
||||
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
|
||||
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# build documentation in doc subdir:
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||
OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
IF(BUILD_DOC)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
ENDIF(BUILD_DOC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Testing
|
||||
option(BUILD_TESTING "Build the tests." OFF)
|
||||
if(BUILD_TESTING)
|
||||
if(BUILD_CODEC)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
# 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
|
||||
# They could be found via svn on the OpenJPEG google code project
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
|
||||
${CMAKE_SOURCE_DIR}/../../data
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
# Add repository where to find tests
|
||||
add_subdirectory(tests)
|
||||
|
||||
else()
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
||||
ELSE(BUILD_CODEC)
|
||||
message(FATAL_ERROR "You need build codec to run the tests")
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(BUILD_CODEC)
|
||||
ENDIF(BUILD_TESTING)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install all targets referenced as OPENJPEGTargets (relocatable with CMake 3.0+)
|
||||
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
if (${CMAKE_VERSION} VERSION_LESS 3.0)
|
||||
set(PACKAGE_INIT)
|
||||
set(PACKAGE_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
else()
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
INSTALL_DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
|
||||
endif()
|
||||
|
||||
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
# install all targets referenced as OPENJPEGTargets
|
||||
INSTALL(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
|
||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install CHANGES and LICENSE
|
||||
IF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
INSTALL(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
ENDIF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
INSTALL(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
|
||||
include (cmake/OpenJPEGCPack.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
# enabled by default on Unix or if using GCC, disabled by default on other platforms
|
||||
if(UNIX OR CMAKE_COMPILER_IS_GNUCC)
|
||||
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)
|
||||
macro(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
|
||||
if(IS_ABSOLUTE "${rel_or_abs_path}")
|
||||
set(${var} "${rel_or_abs_path}")
|
||||
else()
|
||||
set(${var} "${root}/${rel_or_abs_path}")
|
||||
endif()
|
||||
endmacro()
|
||||
set_variable_from_rel_or_absolute_path("bindir" "\\\${prefix}" "${CMAKE_INSTALL_BINDIR}")
|
||||
set_variable_from_rel_or_absolute_path("mandir" "\\\${prefix}" "${CMAKE_INSTALL_MANDIR}")
|
||||
set_variable_from_rel_or_absolute_path("docdir" "\\\${prefix}" "${CMAKE_INSTALL_DOCDIR}")
|
||||
set_variable_from_rel_or_absolute_path("libdir" "\\\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
set_variable_from_rel_or_absolute_path("includedir" "\\\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
|
||||
# install in lib and not share (CMAKE_INSTALL_LIBDIR takes care of it for multi-arch)
|
||||
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
|
||||
${CMAKE_INSTALL_LIBDIR}/pkgconfig )
|
||||
#
|
||||
if(BUILD_JPIP)
|
||||
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
|
||||
${CMAKE_INSTALL_LIBDIR}/pkgconfig )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# build our version of astyle
|
||||
SET (WITH_ASTYLE FALSE CACHE BOOL "If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)")
|
||||
INCLUDE (CMake/OpenJPEGCPack.cmake)
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
Check-list OpenJPEG Release
|
||||
|
||||
* update MAJOR, MINOR, BUILD, SOVERSION in CMakeLists.txt
|
||||
* update MAJOR, MINOR, BUILD in appveyor.yml
|
||||
* update CHANGELOG with
|
||||
`github_changelog_generator --token TOKEN_HERE --exclude-labels gcode_fixed,OpjVersion-1.x --release-url "https://github.com/uclouvain/openjpeg/releases/%s" --since-tag v2.3.1 --future-release v2.4.0 --output append2changelog.md --user uclouvain --project openjpeg --exclude-tags version.1.0` . TOKEN_HERE is created at https://github.com/settings/tokens
|
||||
* update NEWS.md
|
||||
* git tag -a v2.4.0 -m "OpenJPEG v2.4.0 release"
|
||||
* git push origin --tags
|
||||
* add post to OpenJPEG website in gh-pages branch in _posts/ subdirectory. See commit https://github.com/uclouvain/openjpeg/commit/6563d704f5fb896209dd862ccfc6b97eb9183c5c
|
||||
* change binversion of openjpeg website in _config.yml in gh-pages branch
|
||||
* update release description if needed
|
||||
* update openjpeg.json with latest release
|
||||
* update OPJ_LATEST_VERSION in abi-check.sh, uncomment and update OPJ_PREVIOUS_VERSION in abi-check.sh, and push
|
||||
* locally run: OPJ_CI_ABI_CHECK=1 ./tools/travis-ci/abi-check.sh
|
||||
* cd ~/abi-check/work/abi-check/
|
||||
* put the sources of the new version in src/openjpeg/2.X.0/version.-2.X.0.tar.gz
|
||||
* PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-monitor -v 2.X.0 -build ./openjpeg.json
|
||||
* PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-tracker -build ./openjpeg.json
|
||||
* rm -rf src/openjpeg/current
|
||||
* rm -rf build_logs
|
||||
* git add --all .
|
||||
* git commit -m "Update ABI/API compatibility reports after 2.X.0 release"
|
||||
* git push
|
||||
* cd ~/openjpeg/openjpeg
|
||||
* comment back OPJ_PREVIOUS_VERSION and push
|
||||
* build doc and update Doxygen on website
|
||||
* manual build on Windows:
|
||||
- cmake .. -G "Visual Studio 15 2017" -A x64 -DCMAKE_CONFIGURATION_TYPES=Release -DBUILD_THIRDPARTY=ON -D CPACK_GENERATOR:STRING=ZIP -D CPACK_PACKAGE_FILE_NAME:STRING=openjpeg-v2.4.0-windows-x64
|
||||
- cmake --build . --target package --config Release
|
||||
* send email to ML opj, comp.compression, iiif
|
||||
* tweet
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
How to build and install openjpeg binaries
|
||||
==========================================
|
||||
|
||||
UNIX/LINUX similar systems
|
||||
--------------------------
|
||||
|
||||
1) Using autotools
|
||||
|
||||
It is highly recommended that pkg-config is installed. If needed, you have to
|
||||
properly set the environment variable PKG_CONFIG_PATH so that the .pc files
|
||||
are found.
|
||||
|
||||
To build from top-level directory, you can simply type:
|
||||
./bootstrap.sh
|
||||
./configure
|
||||
make
|
||||
|
||||
To keep all build files in a separate directory, you can type instead:
|
||||
./bootstrap.sh
|
||||
mkdir build
|
||||
cd build
|
||||
../configure
|
||||
make
|
||||
|
||||
To install:
|
||||
sudo make install
|
||||
|
||||
To clean:
|
||||
make clean
|
||||
make distclean
|
||||
|
||||
To build doc (requires 'doxygen' to be found on your system):
|
||||
(this will create an html directory in TOP_LEVEL/doc)
|
||||
make doc
|
||||
|
||||
Main './configure' options (type './configure --help' for more details)
|
||||
'--enable-mj2'
|
||||
'--enable-jpwl'
|
||||
'--enable-jpip'
|
||||
'--prefix=/path/to/install/directory' (example : '--prefix=$PWD/installed')
|
||||
'--enable-debug' (default : disabled)
|
||||
|
||||
You can also specify your own CFLAGS and LDFLAGS with (for example):
|
||||
CFLAGS="-O3 -pipe" LDFLAGS="-Wl,-s" ./configure
|
||||
|
||||
The (optional) dependencies of some binaries are libpng, libtiff, libcms 1 or 2
|
||||
and FastCGI. Only libtiff and FastCGI have no .pc file. There should be some
|
||||
automatic detection if they are installed in /usr, /usr/local or /opt/local.
|
||||
Otherwise, you can tune their detection (as well as for libpng and libcms1 or 2
|
||||
too) with the environment variables:
|
||||
|
||||
TIFF_CFLAGS
|
||||
TIFF_LIBS
|
||||
FCGI_CFLAGS
|
||||
FCGI_LIBS
|
||||
|
||||
See './configure --help' output for more details.
|
||||
|
||||
|
||||
2) Using cmake (see www.cmake.org)
|
||||
|
||||
Type:
|
||||
cmake .
|
||||
make
|
||||
|
||||
If you are root:
|
||||
make install
|
||||
|
||||
else if you have sudo power:
|
||||
sudo make install
|
||||
|
||||
else
|
||||
DESTDIR=$HOME/local make install
|
||||
|
||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
(A 'html' directory is generated in the 'doc' directory)
|
||||
make doc
|
||||
|
||||
Binaries are located in the 'bin' directory.
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path', or use DESTDIR env variable (see above)
|
||||
* 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')
|
||||
* To build the MJ2 executables: '-DBUILD_MJ2:bool=on' (default: 'OFF')
|
||||
* To build the JPWL executables and JPWL library: '-DBUILD_JPWL:bool=on' (default: 'OFF')
|
||||
* To build the JPIP library and utilities: '-DBUILD_JPIP: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'
|
||||
make
|
||||
make Experimental
|
||||
Note : JPEG2000 test files are available with 'svn checkout http://openjpeg.googlecode.com/svn/data' (about 70 Mo).
|
||||
If '-DOPJ_DATA_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE_SOURCE_DIR}/../data',
|
||||
corresponding to the location of the data directory when compiling from the trunk (and assuming the data directory has
|
||||
been checked out of course).
|
||||
|
||||
MACOSX
|
||||
------
|
||||
|
||||
The same building procedures as above (autotools and cmake) work for MACOSX.
|
||||
The xcode project file can also be used.
|
||||
|
||||
If it does not work, try adding the following flag to the cmake command :
|
||||
'-DCMAKE_OSX_ARCHITECTURES:STRING=i386'
|
||||
|
||||
WINDOWS
|
||||
-------
|
||||
|
||||
If you're using cygwin or MinGW+MSYS, the same procedures as for Unix can be used.
|
||||
|
||||
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
|
||||
Type 'cmake --help' for available generators on your platform.
|
138
INSTALL.md
|
@ -1,138 +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 .. -DCMAKE_BUILD_TYPE=Release
|
||||
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.
|
||||
* PKG_CONFIG files are by default built for Unix compile, you can force to build on other platforms by adding: '-DBUILD_PKGCONFIG_FILES=on'
|
||||
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
|
||||
* To build opjstyle (internal version of astyle) for OpenJPEG development: '-DWITH_ASTYLE=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.
|
||||
|
||||
Examples for Windows with Visual Studio C++ compiler:
|
||||
|
||||
If using directly the cl compiler:
|
||||
|
||||
```
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
|
||||
```
|
||||
|
||||
To compile a 64-bit application, open 64-Bit Visual C\+\+ toolset on the command line and run cmake. For further information, please refer to: [How to: Enable a 64-Bit Visual C\+\+ Toolset on the Command Line](https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx).
|
||||
|
||||
|
||||
If you do not want directly use the cl compiler, you could use:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
|
||||
```
|
||||
|
||||
To create Visual Studio solution (.sln) and project files (.vcproj / .vcxproj):
|
||||
```
|
||||
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
|
||||
```
|
||||
|
||||
64-bit application:
|
||||
```
|
||||
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
|
||||
```
|
||||
|
||||
|
||||
# Enabling CPU specific optimizations
|
||||
|
||||
For Intel/AMD processors, OpenJPEG implements optimizations using the SSE4.1
|
||||
instruction set (for example, for the 9x7 inverse MCT transform) and the AVX2
|
||||
instruction set (for example, for the 5x3 inverse discrete wavelet transform).
|
||||
Currently, those optimizations are only available if OpenJPEG is built to
|
||||
use those instruction sets (and the resulting binary will only run on compatible
|
||||
CPUs)
|
||||
|
||||
With gcc/clang, it is possible to enable those instruction sets with the following :
|
||||
|
||||
```
|
||||
cmake -DCMAKE_C_FLAGS="-O3 -msse4.1 -DNDEBUG" ..
|
||||
```
|
||||
|
||||
```
|
||||
cmake -DCMAKE_C_FLAGS="-O3 -mavx2 -DNDEBUG" ..
|
||||
```
|
||||
|
||||
(AVX2 implies SSE4.1)
|
||||
|
||||
Or if the binary is dedicated to run on the machine where it has
|
||||
been compiled :
|
||||
|
||||
```
|
||||
cmake -DCMAKE_C_FLAGS="-O3 -march=native -DNDEBUG" ..
|
||||
```
|
||||
|
||||
# Modifying OpenJPEG
|
||||
|
||||
Before committing changes, run:
|
||||
```scripts/prepare-commit.sh```
|
||||
|
||||
# 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})
|
||||
```
|
14
LICENSE
|
@ -1,19 +1,11 @@
|
|||
/*
|
||||
* 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) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2012, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2012, 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
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpip-server=yes --enable-jpwl=yes --enable-mj2=yes
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = libopenjpeg applications doc
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libopenjpeg1.pc
|
||||
|
||||
if WANT_JPWL
|
||||
pkgconfig_DATA += libopenjpeg-jpwl.pc
|
||||
endif
|
||||
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
aclocal.m4 \
|
||||
config.guess \
|
||||
opj_config.h.in \
|
||||
opj_config.h.in~ \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
missing
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMake/CTestCustom.cmake.in \
|
||||
CMake/FindFCGI.cmake \
|
||||
CMake/FindLCMS2.cmake \
|
||||
CMake/FindLCMS.cmake \
|
||||
CMake/OpenJPEGConfig.cmake.in \
|
||||
CMakeLists.txt \
|
||||
CTestConfig.cmake \
|
||||
AUTHORS \
|
||||
CHANGES \
|
||||
INSTALL \
|
||||
LICENSE \
|
||||
NEWS \
|
||||
README \
|
||||
THANKS \
|
||||
bootstrap.sh \
|
||||
libopenjpeg1.pc.cmake \
|
||||
libopenjpeg1.pc.in \
|
||||
libopenjpeg-jpwl.pc.in \
|
||||
opj_config.h.cmake.in \
|
||||
m4/opj_check_lib.m4 \
|
||||
m4/opj_doxygen.m4 \
|
||||
m4/pkg.m4
|
||||
|
||||
.PHONY: doc
|
||||
|
||||
# Documentation
|
||||
|
||||
doc:
|
||||
@echo "entering doc/"
|
||||
@cd doc && make doc
|
||||
|
||||
install-data-hook:
|
||||
if HAVE_WIN32
|
||||
$(LN_S) -f libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
else
|
||||
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
endif
|
||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
|
||||
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
|
||||
if WANT_JPWL
|
||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg-jpwl.pc" >> $(top_builddir)/report.txt
|
||||
endif
|
||||
@cat $(top_builddir)/report.txt
|
||||
@rm $(top_builddir)/report.txt
|
||||
|
||||
uninstall-hook:
|
||||
rm -f $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
55
Makefile.os4
|
@ -1,55 +0,0 @@
|
|||
|
||||
USE_CLIB2=YES
|
||||
ifeq ($(USE_CLIB2), YES)
|
||||
LIBC=clib2
|
||||
CODEC=OFF
|
||||
else
|
||||
LIBC=newlib
|
||||
CODEC=ON
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CROSSCOMPILING=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(realpath amigaos4.cmake) \
|
||||
-DCMAKE_C_FLAGS="-mcrt=${LIBC} -O2 -fPIC" \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS="-mcrt=${LIBC} -lpthread -athread=native" \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_CODEC=${CODEC} \
|
||||
-DBUILD_SHARED_LIBS=OFF && \
|
||||
make
|
||||
|
||||
clean:
|
||||
@echo "Clean the build"
|
||||
@rm -rf build
|
||||
|
||||
cleanall: clean
|
||||
@echo "Clean the build and the release files"
|
||||
@rm -rf SDK
|
||||
@rm libopenjpeg.lha
|
||||
|
||||
release:
|
||||
@echo "Create release folders..."
|
||||
@mkdir -p SDK/local/common/include
|
||||
@mkdir -p SDK/local/clib2/lib
|
||||
@mkdir -p SDK/local/newlib/lib SDK/local/newlib/bin
|
||||
|
||||
@echo "Building clib2 based libraries..."
|
||||
@make -f Makefile.os4 USE_CLIB2=YES
|
||||
@cp ./build/bin/libopenjp2.a SDK/local/clib2/lib/
|
||||
@cp ./src/lib/openjp2/openjpeg.h SDK/local/common/include/
|
||||
|
||||
@echo "Clean build and libraries files..."
|
||||
@make -f Makefile.os4 clean
|
||||
|
||||
@echo "Building newlib based libraries..."
|
||||
@make -f Makefile.os4 USE_CLIB2=NO
|
||||
@cp ./build/bin/libopenjp2.a SDK/local/newlib/lib/
|
||||
@cp ./build/bin/opj_* SDK/local/newlib/bin/
|
||||
|
||||
@echo "Creating the lha release file..."
|
||||
@lha -aeq libopenjpeg.lha SDK/
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
OpenJPEG NEWS - user visible changes
|
||||
====================================
|
||||
|
||||
Changes from OpenJPEG 1.5.1 to OpenJPEG 1.5.0
|
||||
----------------------------------------------
|
||||
|
||||
Security:
|
||||
|
||||
* Fixes: CVE-2012-3535
|
||||
* Fixes: CVE-2012-3358
|
||||
|
||||
New Features:
|
||||
|
||||
* Use a new API scheme and solve the SOVERSIONing in OpenJPEG
|
||||
* Allow better integration with multi-arch system
|
||||
* Compile & Install Java bindings (CMake)
|
||||
* Install required addXMLinJP2 (JPIP)
|
||||
|
||||
Misc:
|
||||
|
||||
* fix linker error by resolving all symbols (eg. missing -lm)
|
||||
* fix some man page typos
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
130
NEWS.md
|
@ -1,130 +0,0 @@
|
|||
# OpenJPEG NEWS
|
||||
|
||||
More details in the [CHANGELOG](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
|
||||
|
||||
## OpenJPEG 2.5.0 (May 2022)
|
||||
|
||||
No API/ABI break compared to v2.4.0, but additional symbols for subset of components decoding (hence the MINOR version bump).
|
||||
|
||||
* Encoder: add support for generation of TLM markers [\#1359](https://github.com/uclouvain/openjpeg/pull/1359)
|
||||
* Decoder: add support for high throughput \(HTJ2K\) decoding. [\#1381](https://github.com/uclouvain/openjpeg/pull/1381)
|
||||
* Decoder: add support for partial bitstream decoding [\#1407](https://github.com/uclouvain/openjpeg/pull/1407)
|
||||
* Bug fixes (including security fixes)
|
||||
|
||||
## OpenJPEG 2.4.0 (December 2020)
|
||||
|
||||
No API/ABI break compared to v2.3.1, but additional symbols for subset of components decoding (hence the MINOR version bump).
|
||||
|
||||
* Encoder: add support for multithreading [\#1248](https://github.com/uclouvain/openjpeg/pull/1248)
|
||||
* Encoder: add support for generation of PLT markers [\#1246](https://github.com/uclouvain/openjpeg/pull/1246)
|
||||
* Encoder: single-threaded performance improvements in forward DWT for 5-3 and 9-7 (and other improvements) [\#1253](https://github.com/uclouvain/openjpeg/pull/1253)
|
||||
* Encoder: support IMF profiles [\#1235](https://github.com/uclouvain/openjpeg/pull/1235)
|
||||
* Many bug fixes (including security fixes)
|
||||
|
||||
## OpenJPEG 2.3.1 (April 2019)
|
||||
|
||||
No API/ABI break compared to v2.3.0
|
||||
|
||||
* Many bug fixes (including security fixes)
|
||||
|
||||
## OpenJPEG 2.3.0 (October 2017)
|
||||
|
||||
No API/ABI break compared to v2.2.0 but additional symbols for subset of components decoding (hence the MINOR version bump).
|
||||
|
||||
* Sub-tile decoding: when setting a window of interest through the API function opj_set_decode_area(), only codeblocks that intersect this window are now decoded (i.e. MCT, IDWT, and entropy decoding are only done on the window of interest). Moreover, memory allocation now depends on the size of the window of interest (instead of the full tile size).
|
||||
[\#990](https://github.com/uclouvain/openjpeg/pull/990) [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) [\#1010](https://github.com/uclouvain/openjpeg/pull/1010)
|
||||
* Ability to decode only a subset of components. This adds the following function `opj_set_decoded_components(opj_codec_t p_codec, OPJ_UINT32 numcomps, const OPJ_UINT32 comps_indices, OPJ_BOOL apply_color_transforms)` and equivalent `opj_decompress -c compno[,compno]*`
|
||||
option.
|
||||
[\#1022](https://github.com/uclouvain/openjpeg/pull/1022)
|
||||
* Many bug fixes (including security fixes)
|
||||
|
||||
## OpenJPEG 2.2.0 (August 2017)
|
||||
|
||||
No API/ABI break compared to v2.1.2 but additional symbols for multithreading support (hence the MINOR version bump).
|
||||
|
||||
### Codebase improvements
|
||||
|
||||
* Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968)
|
||||
* Multi-threading support at decoding side [\#786](https://github.com/uclouvain/openjpeg/pull/786)
|
||||
* Tier-1 speed optimizations (encoder and decoder) [\#945](https://github.com/uclouvain/openjpeg/pull/945)
|
||||
* Tier-1 decoder further optimization [\#783](https://github.com/uclouvain/openjpeg/pull/783)
|
||||
* Inverse 5x3 DWT speed optimization: single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957)
|
||||
* Fixed a bug that prevented OpenJPEG to compress losslessly in some situations [\#949](https://github.com/uclouvain/openjpeg/pull/949)
|
||||
* Fixed BYPASS/LAZY, RESTART/TERMALL and PTERM mode switches
|
||||
* Many other bug fixes (including security fixes)
|
||||
|
||||
### Maintenance improvements
|
||||
|
||||
* Benchmarking scripts to automatically compare the speed of latest OpenJPEG build with latest release and/or Kakadu binaries [\#917](https://github.com/uclouvain/openjpeg/pull/917)
|
||||
* CPU and RAM usage profiling scripts [\#918](https://github.com/uclouvain/openjpeg/pull/918)
|
||||
* Codebase reformatting (with astyle) and scripts to automatically check that new commits comply with formatting guidelines [\#919](https://github.com/uclouvain/openjpeg/pull/919)
|
||||
* Register OpenJPEG at Google OSS Fuzz initiative, so as to automatically have OpenJPEG tested against Google fuzzer [\#965](https://github.com/uclouvain/openjpeg/issues/965)
|
||||
|
||||
## OpenJPEG 2.1.2 (September 2016)
|
||||
|
||||
* Bug fixes (including security fixes)
|
||||
* No API/ABI break compared to v2.1.1
|
||||
|
||||
## OpenJPEG 2.1.1 (July 2016)
|
||||
|
||||
* Huge amount of critical bugfixes
|
||||
* Speed improvements
|
||||
* No API/ABI break compared to v2.1
|
||||
|
||||
## OpenJPEG 2.1.0 (April 2014)
|
||||
|
||||
### 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.
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
OPENJPEG LIBRARY and APPLICATIONS
|
||||
----------------------------------
|
||||
|
||||
Details on folders hierarchy:
|
||||
|
||||
* libopenjpeg: contains the sources of the openjpeg library
|
||||
* jpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* applications: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* codec: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
||||
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* 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 'http://openjpeg.googlecode.com/svn/data' folder.
|
||||
* CMake: cmake related files
|
||||
* m4: autotools related files
|
||||
|
||||
see LICENSE for license and copyright information.
|
||||
see INSTALL for installation procedures.
|
||||
see NEWS for user visible changes in successive releases.
|
||||
see CHANGES for per-revision changes.
|
83
README.md
|
@ -1,83 +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)
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* jp2: a basic codec
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* 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
|
||||
* scripts: scripts for developers
|
||||
|
||||
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.
|
||||
|
||||
## Deprecated components
|
||||
|
||||
The openjpwl, openjp3d and openmj2 components have been removed after the
|
||||
2.4.0 release. Their building and working state is unknown. People interested
|
||||
in them should start from the 2.4.0 tag.
|
||||
|
||||
## 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://github.com/uclouvain/openjpeg/actions/workflows/build.yml/badge.svg "Build Status"
|
||||
[link-build]: https://github.com/uclouvain/openjpeg/actions/workflows/build.yml "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"
|
|
@ -0,0 +1,33 @@
|
|||
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.
|
||||
|
||||
Mathieu Malaterre
|
||||
Winfried Szukalski
|
||||
Vincent Torri
|
||||
Bob Friesenhahn
|
||||
Callum Lerwick
|
||||
Dzonatas Sol
|
||||
Mickaël Savinaud
|
||||
Julien Malik
|
||||
Jerôme Fimes
|
||||
Herve Drolon
|
||||
Yannick Verschueren
|
||||
Sebastien Lugan
|
||||
Kaori Hagihara
|
||||
Peter Wimmer
|
||||
Francois-Olivier Devaux
|
||||
Antonin Descampe
|
||||
David Janssens
|
||||
Pr. Benoit Macq
|
||||
Luis Ibanez
|
||||
Ben Boeckel
|
||||
Vincent Nicolas
|
||||
Glenn Pearson
|
||||
Giuseppe Baruffa
|
||||
Arnaud Maye
|
||||
Rex Dieter
|
||||
David Burken
|
||||
Parvatha Elangovan
|
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
|
|
@ -1,9 +0,0 @@
|
|||
SET(CMAKE_SYSTEM_NAME Generic)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR ppc)
|
||||
SET(CMAKE_C_COMPILER /opt/ppc-amigaos/bin/ppc-amigaos-gcc)
|
||||
SET(CMAKE_CXX_COMPILER /opt/ppc-amigaos/bin/ppc-amigaos-g++)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES "*.a")
|
||||
SET(CMAKE_FIND_ROOT_PATH /opt/sdk)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -0,0 +1,22 @@
|
|||
# Build the each application if it needed
|
||||
|
||||
IF(BUILD_CODEC)
|
||||
ADD_SUBDIRECTORY(codec)
|
||||
ENDIF(BUILD_CODEC)
|
||||
|
||||
IF(BUILD_MJ2)
|
||||
ADD_SUBDIRECTORY(mj2)
|
||||
ENDIF(BUILD_MJ2)
|
||||
|
||||
# Client & Server:
|
||||
IF(BUILD_JPIP)
|
||||
ADD_SUBDIRECTORY(jpip)
|
||||
ENDIF(BUILD_JPIP)
|
||||
|
||||
IF(BUILD_VIEWER)
|
||||
ADD_SUBDIRECTORY(OPJViewer)
|
||||
ENDIF(BUILD_VIEWER)
|
||||
|
||||
IF(BUILD_JAVA)
|
||||
ADD_SUBDIRECTORY(JavaOpenJPEG)
|
||||
ENDIF(BUILD_JAVA)
|
|
@ -1,13 +1,18 @@
|
|||
#JavaOpenJPEG/CMakeLists.txt
|
||||
|
||||
# First thing define the common source:
|
||||
set(openjpegjni_SRCS
|
||||
SET(openjpegjni_SRCS
|
||||
JavaOpenJPEGDecoder.c
|
||||
JavaOpenJPEG.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
|
||||
index.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/codec/index.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
|
||||
#${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||
)
|
||||
if(NOT USE_SYSTEM_GETOPT)
|
||||
list(APPEND openjpegjni_SRCS
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||
)
|
||||
endif()
|
||||
|
||||
# JNI binding:
|
||||
find_package(JNI REQUIRED)
|
||||
|
@ -15,10 +20,9 @@ include_directories(${JNI_INCLUDE_DIRS})
|
|||
|
||||
# required header file:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common
|
||||
${OPENJPEG_SOURCE_DIR}/applications/codec
|
||||
)
|
||||
|
||||
add_library(openjpegjni MODULE
|
||||
|
@ -27,21 +31,27 @@ add_library(openjpegjni MODULE
|
|||
# Java module should not have a SONAME:
|
||||
set_property(TARGET openjpegjni PROPERTY NO_SONAME 1)
|
||||
|
||||
# FIXME (need to use old API):
|
||||
target_link_libraries(openjpegjni
|
||||
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${Z_LIBNAME}
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(openjpegjni ${OPENJPEG_LIBRARY_NAME})
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(openjpegjni m)
|
||||
endif()
|
||||
|
||||
install(TARGETS openjpegjni
|
||||
INSTALL(TARGETS openjpegjni
|
||||
EXPORT OpenJPEGTargets
|
||||
LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries
|
||||
)
|
||||
|
||||
# build jar:
|
||||
find_package(Java 1.6 REQUIRED) # javac, jar
|
||||
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
|
||||
|
||||
# User can override this:
|
||||
if(NOT DEFINED JAVA_SOURCE_VERSION)
|
||||
set(JAVA_SOURCE_VERSION 1.5)
|
||||
endif()
|
||||
if(NOT DEFINED JAVA_TARGET_VERSION)
|
||||
set(JAVA_TARGET_VERSION 1.5)
|
||||
endif()
|
||||
|
||||
# build dep list:
|
||||
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
||||
|
@ -49,9 +59,11 @@ file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
|||
# make sure target javac dir exists:
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
|
||||
# Build java
|
||||
add_custom_command(
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
||||
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
|
||||
-sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
|
||||
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
|
||||
COMMAND ${Java_JAR_EXECUTABLE} cvf ${LIBRARY_OUTPUT_PATH}/openjpeg.jar org
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes
|
||||
|
@ -60,11 +72,11 @@ add_custom_command(
|
|||
)
|
||||
|
||||
# name the target
|
||||
add_custom_target(OpenJPEGJavaJar ALL
|
||||
ADD_CUSTOM_TARGET(OpenJPEGJavaJar ALL
|
||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
COMMENT "building openjpeg.jar"
|
||||
)
|
||||
|
||||
install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} COMPONENT JavaModule
|
||||
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
||||
)
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2007, Patrick Piscaglia (Telemis)
|
||||
|
@ -38,7 +37,6 @@
|
|||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "opj_includes.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "dirent.h"
|
||||
|
@ -205,7 +203,7 @@ int get_file_format(char *filename) {
|
|||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||
int parse_cmdline_decoder(int argc, char * const argv[], opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||
/* parse the command line */
|
||||
int totlen;
|
||||
opj_option_t long_option[]={
|
||||
|
@ -340,7 +338,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
|
||||
if(img_fol->imgdirpath == NULL) return 1;
|
||||
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
|
@ -428,7 +429,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||
/* No check for possible errors before the -i and -o options are of course not mandatory*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
}/* parse_cmdline_decoder() */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -490,12 +491,13 @@ void info_callback(const char *msg, void *client_data) {
|
|||
(*env)->DeleteLocalRef(env, jbuffer);
|
||||
}
|
||||
|
||||
|
||||
#define FAILS -1
|
||||
#define OK 0
|
||||
/* --------------------------------------------------------------------------
|
||||
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
||||
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
||||
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
||||
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
||||
const char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
img_fol_t img_fol;
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
|
@ -510,7 +512,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
int w,h;
|
||||
long min_value, max_value;
|
||||
short tempS; unsigned char tempUC, tempUC1, tempUC2;
|
||||
/* ==> Access variables to the Java member variables*/
|
||||
/* ==> Access variables to the Java member variables */
|
||||
jsize arraySize;
|
||||
jclass cls;
|
||||
jobject object;
|
||||
|
@ -523,8 +525,9 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
jshort *jsBody, *ptrSBody;
|
||||
jint *jiBody, *ptrIBody;
|
||||
callback_variables_t msgErrorCallback_vars;
|
||||
/* <=== access variable to Java member variables */
|
||||
int *ptr, *ptr1, *ptr2; /* <== To transfer the decoded image to Java*/
|
||||
/* <=== access variable to Java member variables */
|
||||
int *ptr, *ptr1, *ptr2;/* <== To transfer the decoded image to Java */
|
||||
jint retval = FAILS;
|
||||
|
||||
/* configure the event callbacks */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
|
@ -532,24 +535,30 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
event_mgr.warning_handler = warning_callback;
|
||||
event_mgr.info_handler = info_callback;
|
||||
|
||||
/* JNI reference to the calling class*/
|
||||
/* JNI reference to the calling class */
|
||||
cls = (*env)->GetObjectClass(env, obj);
|
||||
|
||||
/* Pointers to be able to call a Java method for all the info and error messages*/
|
||||
/* Pointers to be able to call a Java method
|
||||
* for all the info and error messages
|
||||
*/
|
||||
msgErrorCallback_vars.env = env;
|
||||
msgErrorCallback_vars.jobj = &obj;
|
||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
|
||||
|
||||
/* Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.*/
|
||||
/* Get the String[] containing the parameters */
|
||||
|
||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||
argc = (int) arraySize +1;
|
||||
argv = opj_malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; /* The program name: useless*/
|
||||
argv = (const char **)malloc(argc*sizeof(char*));
|
||||
|
||||
if(argv == NULL) return FAILS;
|
||||
|
||||
argv[0] = "ProgramName.exe";/* The program name: useless */
|
||||
j=0;
|
||||
for (i=1; i<argc; i++) {
|
||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
}
|
||||
|
||||
/*printf("C: decoder params = ");
|
||||
|
@ -563,19 +572,18 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
parameters.decod_format = J2K_CFMT;
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||
/* Release the Java arguments array*/
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
return -1;
|
||||
}
|
||||
/* Release the Java arguments array*/
|
||||
j = parse_cmdline_decoder(argc, (char * const*)argv, ¶meters,&img_fol);
|
||||
|
||||
/* Release the Java arguments array */
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
(*env)->ReleaseStringUTFChars(env,
|
||||
(*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
|
||||
if(j == 1) goto fin; /* failure */
|
||||
|
||||
num_images=1;
|
||||
|
||||
/* Get additional information from the Java object variables*/
|
||||
/* Get additional information from the Java object variables */
|
||||
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
|
||||
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
|
||||
|
||||
|
@ -589,22 +597,25 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
Implemented for debug purpose. */
|
||||
/* -------------------------------------------------------------- */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
/*printf("C: opening [%s]\n", parameters.infile);*/
|
||||
/* printf("C: opening [%s]\n", parameters.infile); */
|
||||
fsrc = fopen(parameters.infile, "rb");
|
||||
if (!fsrc) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||
return 1;
|
||||
goto fin;
|
||||
}
|
||||
fseek(fsrc, 0, SEEK_END);
|
||||
file_length = ftell(fsrc);
|
||||
fseek(fsrc, 0, SEEK_SET);
|
||||
src = (unsigned char *) opj_malloc(file_length);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
|
||||
if(src == NULL) goto fin;
|
||||
|
||||
fread(src, 1, file_length, fsrc);
|
||||
fclose(fsrc);
|
||||
/*printf("C: %d bytes read from file\n",file_length);*/
|
||||
/* printf("C: %d bytes read from file\n",file_length); */
|
||||
} else {
|
||||
/* Preparing the transfer of the codestream from Java to C*/
|
||||
/*printf("C: before transferring codestream\n");*/
|
||||
/* Preparing the transfer of the codestream from Java to C */
|
||||
/* printf("C: before transferring codestream\n"); */
|
||||
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
||||
jba = (*env)->GetObjectField(env, obj, fid);
|
||||
file_length = (*env)->GetArrayLength(env, jba);
|
||||
|
@ -638,7 +649,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
goto fin;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
|
@ -668,7 +679,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
goto fin;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
|
@ -699,7 +710,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
goto fin;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
|
@ -714,7 +725,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
|
||||
/* free the memory containing the code-stream */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
opj_free(src);
|
||||
free(src);
|
||||
} else {
|
||||
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
|
||||
}
|
||||
|
@ -754,17 +765,21 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
|
||||
}
|
||||
|
||||
/* ========= Return the image to the Java structure ===============*/
|
||||
/* ========= Return the image to the Java structure =============== */
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
printf("C: checking thresholds\n");
|
||||
#endif
|
||||
/* First compute the real with and height, in function of the resolutions decoded.*/
|
||||
/*wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
|
||||
/*hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
|
||||
/* First compute the real with and height,
|
||||
* in function of the resolutions decoded.
|
||||
*/
|
||||
/*---
|
||||
wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
---*/
|
||||
w = image->comps[0].w;
|
||||
h = image->comps[0].h;
|
||||
|
||||
if (image->numcomps==3) { /* 3 components color image*/
|
||||
if (image->numcomps==3) { /* 3 components color image */
|
||||
ptr = image->comps[0].data;
|
||||
ptr1 = image->comps[1].data;
|
||||
ptr2 = image->comps[2].data;
|
||||
|
@ -777,7 +792,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
max_value = 255;
|
||||
}
|
||||
#endif
|
||||
/* Get the pointer to the Java structure where the data must be copied*/
|
||||
/* Get the pointer to the Java structure where the data must be copied */
|
||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
|
||||
jia = (*env)->GetObjectField(env, obj, fid);
|
||||
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
|
||||
|
@ -806,7 +821,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
}
|
||||
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
|
||||
|
||||
} else { /* 1 component 8 or 16 bpp image*/
|
||||
} else { /* 1 component 8 or 16 bpp image */
|
||||
ptr = image->comps[0].data;
|
||||
printf("C: before transferring a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
|
||||
if (image->comps[0].prec<=8) {
|
||||
|
@ -823,7 +838,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
max_value = 255;
|
||||
}
|
||||
#endif
|
||||
/*printf("C: transferring %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody);*/
|
||||
/* printf("C: transferring %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody); */
|
||||
for (i=0; i<w*h; i++) {
|
||||
tempUC = (unsigned char) (ptr[i]);
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
|
@ -835,7 +850,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
*(ptrBBody++) = tempUC;
|
||||
}
|
||||
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
|
||||
printf("C: image8 transferred to Java\n");
|
||||
printf("C: image8 transfered to Java\n");
|
||||
} else {
|
||||
fid = (*env)->GetFieldID(env, cls,"image16", "[S");
|
||||
jsa = (*env)->GetObjectField(env, obj, fid);
|
||||
|
@ -879,7 +894,12 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||
opj_image_destroy(image);
|
||||
|
||||
}
|
||||
return 1; /* OK */
|
||||
}
|
||||
/*end main*/
|
||||
retval = OK;
|
||||
|
||||
fin:
|
||||
free(argv);
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* end main MAIN */
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
|
||||
* All rights reserved.
|
||||
*
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
|
||||
* All rights reserved.
|
||||
*
|
|
@ -0,0 +1,19 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = codec
|
||||
|
||||
if WANT_MJ2
|
||||
SUBDIRS += mj2
|
||||
endif
|
||||
|
||||
if WANT_JPIP_CODE
|
||||
SUBDIRS += jpip
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
common/color.c \
|
||||
common/color.h \
|
||||
common/format_defs.h \
|
||||
common/opj_getopt.c \
|
||||
common/opj_getopt.h
|
|
@ -1,21 +1,17 @@
|
|||
project(viewer CXX)
|
||||
PROJECT(viewer CXX)
|
||||
|
||||
find_package(wxWidgets REQUIRED)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
FIND_PACKAGE(wxWidgets REQUIRED)
|
||||
INCLUDE(${wxWidgets_USE_FILE})
|
||||
|
||||
include_directories(
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
|
||||
)
|
||||
|
||||
# original flags:
|
||||
# -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS
|
||||
add_definitions(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0")
|
||||
set(OPJV_SRCS
|
||||
ADD_DEFINITIONS(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0")
|
||||
SET(OPJV_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/imagjpeg2000.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/wxj2kparser.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJViewer.cpp
|
||||
|
@ -23,7 +19,7 @@ set(OPJV_SRCS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJDialogs.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJThreads.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJAbout.cpp
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/index.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../codec/index.c
|
||||
)
|
||||
add_executable(opjviewer ${OPJV_SRCS})
|
||||
target_link_libraries(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
|
||||
ADD_EXECUTABLE(opjviewer ${OPJV_SRCS})
|
||||
TARGET_LINK_LIBRARIES(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
@ -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) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -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) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
|
@ -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) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -36,7 +31,7 @@
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
OPJEncoThread::OPJEncoThread(OPJCanvas *canvas)
|
||||
: wxThread()
|
||||
: wxThread()
|
||||
{
|
||||
m_count = 0;
|
||||
m_canvas = canvas;
|
||||
|
@ -49,14 +44,14 @@ void OPJEncoThread::WriteText(const wxString& text)
|
|||
// before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
|
||||
#ifndef __WXGTK__
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif // __WXGTK__
|
||||
|
||||
msg << text;
|
||||
m_canvas->WriteText(msg);
|
||||
|
||||
#ifndef __WXGTK__
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK__
|
||||
}
|
||||
|
@ -68,7 +63,8 @@ void OPJEncoThread::OnExit()
|
|||
wxArrayThread& ethreads = wxGetApp().m_enco_threads;
|
||||
ethreads.Remove(this);
|
||||
|
||||
if (ethreads.IsEmpty()) {
|
||||
if (ethreads.IsEmpty() )
|
||||
{
|
||||
// signal the main thread that there are no more threads left if it is
|
||||
// waiting for us
|
||||
if (wxGetApp().m_enco_waitingUntilAllDone) {
|
||||
|
@ -82,54 +78,50 @@ void *OPJEncoThread::Entry()
|
|||
{
|
||||
wxString text;
|
||||
|
||||
srand(GetId());
|
||||
//int m_countnum = rand() % 9;
|
||||
srand(GetId());
|
||||
//int m_countnum = rand() % 9;
|
||||
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
||||
// GetId(), GetPriority(), m_countnum);
|
||||
text.Printf(wxT("Enco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||
WriteText(text);
|
||||
|
||||
// set handler properties
|
||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(
|
||||
wxBITMAP_TYPE_JPEG2000);
|
||||
jpeg2000handler->m_subsampling = wxGetApp().m_subsampling;
|
||||
jpeg2000handler->m_origin = wxGetApp().m_origin;
|
||||
jpeg2000handler->m_rates = wxGetApp().m_rates;
|
||||
jpeg2000handler->m_quality = wxGetApp().m_quality;
|
||||
jpeg2000handler->m_enablequality = wxGetApp().m_enablequality;
|
||||
jpeg2000handler->m_multicomp = wxGetApp().m_multicomp;
|
||||
jpeg2000handler->m_irreversible = wxGetApp().m_irreversible;
|
||||
jpeg2000handler->m_resolutions = wxGetApp().m_resolutions;
|
||||
jpeg2000handler->m_progression = wxGetApp().m_progression;
|
||||
jpeg2000handler->m_cbsize = wxGetApp().m_cbsize;
|
||||
jpeg2000handler->m_prsize = wxGetApp().m_prsize;
|
||||
jpeg2000handler->m_tsize = wxGetApp().m_tsize;
|
||||
jpeg2000handler->m_torigin = wxGetApp().m_torigin;
|
||||
jpeg2000handler->m_enablesop = wxGetApp().m_enablesop;
|
||||
jpeg2000handler->m_enableeph = wxGetApp().m_enableeph;
|
||||
jpeg2000handler->m_enablebypass = wxGetApp().m_enablebypass;
|
||||
jpeg2000handler->m_enablerestart = wxGetApp().m_enablerestart;
|
||||
jpeg2000handler->m_enablereset = wxGetApp().m_enablereset;
|
||||
jpeg2000handler->m_enablesegmark = wxGetApp().m_enablesegmark;
|
||||
jpeg2000handler->m_enableerterm = wxGetApp().m_enableerterm;
|
||||
jpeg2000handler->m_enablevsc = wxGetApp().m_enablevsc;
|
||||
jpeg2000handler->m_enableidx = wxGetApp().m_enableidx;
|
||||
jpeg2000handler->m_index = m_canvas->m_savename.GetPath(
|
||||
wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxGetApp().m_index;
|
||||
jpeg2000handler->m_enablecomm = wxGetApp().m_enablecomm;
|
||||
jpeg2000handler->m_comment = wxGetApp().m_comment;
|
||||
jpeg2000handler->m_enablepoc = wxGetApp().m_enablepoc;
|
||||
jpeg2000handler->m_poc = wxGetApp().m_poc;
|
||||
// set handler properties
|
||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||
jpeg2000handler->m_subsampling = wxGetApp().m_subsampling;
|
||||
jpeg2000handler->m_origin = wxGetApp().m_origin;
|
||||
jpeg2000handler->m_rates = wxGetApp().m_rates;
|
||||
jpeg2000handler->m_quality = wxGetApp().m_quality;
|
||||
jpeg2000handler->m_enablequality = wxGetApp().m_enablequality;
|
||||
jpeg2000handler->m_multicomp = wxGetApp().m_multicomp;
|
||||
jpeg2000handler->m_irreversible = wxGetApp().m_irreversible;
|
||||
jpeg2000handler->m_resolutions = wxGetApp().m_resolutions;
|
||||
jpeg2000handler->m_progression = wxGetApp().m_progression;
|
||||
jpeg2000handler->m_cbsize = wxGetApp().m_cbsize;
|
||||
jpeg2000handler->m_prsize = wxGetApp().m_prsize;
|
||||
jpeg2000handler->m_tsize = wxGetApp().m_tsize;
|
||||
jpeg2000handler->m_torigin = wxGetApp().m_torigin;
|
||||
jpeg2000handler->m_enablesop = wxGetApp().m_enablesop;
|
||||
jpeg2000handler->m_enableeph = wxGetApp().m_enableeph;
|
||||
jpeg2000handler->m_enablebypass = wxGetApp().m_enablebypass;
|
||||
jpeg2000handler->m_enablerestart = wxGetApp().m_enablerestart;
|
||||
jpeg2000handler->m_enablereset = wxGetApp().m_enablereset;
|
||||
jpeg2000handler->m_enablesegmark = wxGetApp().m_enablesegmark;
|
||||
jpeg2000handler->m_enableerterm = wxGetApp().m_enableerterm;
|
||||
jpeg2000handler->m_enablevsc = wxGetApp().m_enablevsc;
|
||||
jpeg2000handler->m_enableidx = wxGetApp().m_enableidx;
|
||||
jpeg2000handler->m_index = m_canvas->m_savename.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxGetApp().m_index;
|
||||
jpeg2000handler->m_enablecomm = wxGetApp().m_enablecomm;
|
||||
jpeg2000handler->m_comment = wxGetApp().m_comment;
|
||||
jpeg2000handler->m_enablepoc = wxGetApp().m_enablepoc;
|
||||
jpeg2000handler->m_poc = wxGetApp().m_poc;
|
||||
|
||||
// save the file
|
||||
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(),
|
||||
(wxBitmapType) wxBITMAP_TYPE_JPEG2000)) {
|
||||
WriteText(wxT("Can't save image"));
|
||||
return NULL;
|
||||
}
|
||||
// save the file
|
||||
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), (wxBitmapType) wxBITMAP_TYPE_JPEG2000)) {
|
||||
WriteText(wxT("Can't save image"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
text.Printf(wxT("Enco thread %d finished"),
|
||||
m_canvas->m_childframe->m_winnumber);
|
||||
text.Printf(wxT("Enco thread %d finished"), m_canvas->m_childframe->m_winnumber);
|
||||
WriteText(text);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -139,7 +131,7 @@ void *OPJEncoThread::Entry()
|
|||
// Decoding thread class
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||
: wxThread()
|
||||
: wxThread()
|
||||
{
|
||||
m_count = 0;
|
||||
m_canvas = canvas;
|
||||
|
@ -148,29 +140,29 @@ OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
|||
void OPJDecoThread::WriteText(const wxString& text)
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
wxPostEvent(this->m_canvas->m_childframe->m_frame, event);
|
||||
|
||||
/*
|
||||
// before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
/*
|
||||
// before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif // __WXGTK__
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif // __WXGTK__
|
||||
|
||||
msg << text;
|
||||
m_canvas->WriteText(msg);
|
||||
msg << text;
|
||||
m_canvas->WriteText(msg);
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK__
|
||||
*/
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK__
|
||||
*/
|
||||
}
|
||||
|
||||
void OPJDecoThread::OnExit()
|
||||
|
@ -180,7 +172,8 @@ void OPJDecoThread::OnExit()
|
|||
wxArrayThread& dthreads = wxGetApp().m_deco_threads;
|
||||
dthreads.Remove(this);
|
||||
|
||||
if (dthreads.IsEmpty()) {
|
||||
if (dthreads.IsEmpty() )
|
||||
{
|
||||
// signal the main thread that there are no more threads left if it is
|
||||
// waiting for us
|
||||
if (wxGetApp().m_deco_waitingUntilAllDone) {
|
||||
|
@ -195,98 +188,95 @@ void *OPJDecoThread::Entry()
|
|||
|
||||
wxString text;
|
||||
|
||||
//srand(GetId());
|
||||
//int m_countnum = rand() % 9;
|
||||
//srand(GetId());
|
||||
//int m_countnum = rand() % 9;
|
||||
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
||||
// GetId(), GetPriority(), m_countnum);
|
||||
|
||||
// we have started
|
||||
// we have started
|
||||
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||
WriteText(text);
|
||||
|
||||
// prepare dummy wximage
|
||||
// prepare dummy wximage
|
||||
wxBitmap bitmap(100, 100);
|
||||
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
||||
image.Destroy();
|
||||
|
||||
// show image full name
|
||||
WriteText(m_canvas->m_fname.GetFullPath());
|
||||
// show image full name
|
||||
WriteText(m_canvas->m_fname.GetFullPath());
|
||||
|
||||
// set handler properties
|
||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(
|
||||
wxBITMAP_TYPE_JPEG2000);
|
||||
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
jpeg2000handler->m_components = wxGetApp().m_components;
|
||||
jpeg2000handler->m_framenum = wxGetApp().m_framenum;
|
||||
// set handler properties
|
||||
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
jpeg2000handler->m_components = wxGetApp().m_components;
|
||||
jpeg2000handler->m_framenum = wxGetApp().m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
jpeg2000handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
jpeg2000handler->m_expcomps = wxGetApp().m_expcomps;
|
||||
jpeg2000handler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
jpeg2000handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
jpeg2000handler->m_expcomps = wxGetApp().m_expcomps;
|
||||
jpeg2000handler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#ifdef USE_MXF
|
||||
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(
|
||||
wxBITMAP_TYPE_MXF);
|
||||
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
mxfffhandler->m_components = wxGetApp().m_components;
|
||||
mxfffhandler->m_framenum = wxGetApp().m_framenum;
|
||||
mxfffhandler->m_filename = m_canvas->m_fname;
|
||||
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(wxBITMAP_TYPE_MXF);
|
||||
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||
mxfffhandler->m_components = wxGetApp().m_components;
|
||||
mxfffhandler->m_framenum = wxGetApp().m_framenum;
|
||||
mxfffhandler->m_filename = m_canvas->m_fname;
|
||||
#ifdef USE_JPWL
|
||||
mxfffhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
mxfffhandler->m_expcomps = wxGetApp().m_expcomps;
|
||||
mxfffhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
mxfffhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||
mxfffhandler->m_expcomps = wxGetApp().m_expcomps;
|
||||
mxfffhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
#endif // USE_MXF
|
||||
|
||||
// if decoding is enabled...
|
||||
if (wxGetApp().m_enabledeco) {
|
||||
// if decoding is enabled...
|
||||
if (wxGetApp().m_enabledeco) {
|
||||
|
||||
// load the file
|
||||
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
||||
WriteText(wxT("Can't load image!"));
|
||||
return NULL;
|
||||
}
|
||||
// load the file
|
||||
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
||||
WriteText(wxT("Can't load image!"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
// display a warning
|
||||
if (!image.Create(300, 5, false)) {
|
||||
WriteText(wxT("Can't create image!"));
|
||||
return NULL;
|
||||
}
|
||||
// display a warning
|
||||
if (!image.Create(300, 5, false)) {
|
||||
WriteText(wxT("Can't create image!"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// assign 100% image
|
||||
// assign 100% image
|
||||
m_canvas->m_image100 = wxBitmap(image);
|
||||
|
||||
// signal the frame to refresh the canvas
|
||||
// signal the frame to refresh the canvas
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_VIEWFIT);
|
||||
event.SetString(wxT("Fit me"));
|
||||
event.SetInt(m_canvas->m_childframe->m_winnumber);
|
||||
event.SetString(wxT("Fit me"));
|
||||
event.SetInt(m_canvas->m_childframe->m_winnumber);
|
||||
wxPostEvent(m_canvas->m_childframe->m_frame, event);
|
||||
|
||||
// find a fit-to-width zoom
|
||||
/*int zooml, wzooml, hzooml;
|
||||
wxSize clientsize = m_canvas->GetClientSize();
|
||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||
// find a fit-to-width zoom
|
||||
/*int zooml, wzooml, hzooml;
|
||||
wxSize clientsize = m_canvas->GetClientSize();
|
||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
||||
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||
|
||||
// fit to width
|
||||
// fit to width
|
||||
#ifndef __WXGTK__
|
||||
//m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||
//m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||
#endif // __WXGTK__
|
||||
|
||||
//m_canvas->m_image = m_canvas->m_image100;
|
||||
//m_canvas->Refresh();
|
||||
//m_canvas->SetScrollbars(20, 20, (int)(0.5 + (double) image.GetWidth() / 20.0), (int)(0.5 + (double) image.GetHeight() / 20.0));
|
||||
//m_canvas->m_image = m_canvas->m_image100;
|
||||
//m_canvas->Refresh();
|
||||
//m_canvas->SetScrollbars(20, 20, (int)(0.5 + (double) image.GetWidth() / 20.0), (int)(0.5 + (double) image.GetHeight() / 20.0));
|
||||
|
||||
//text.Printf(wxT("Deco thread 0x%lx finished."), GetId());
|
||||
text.Printf(wxT("Deco thread %d finished"),
|
||||
m_canvas->m_childframe->m_winnumber);
|
||||
text.Printf(wxT("Deco thread %d finished"), m_canvas->m_childframe->m_winnumber);
|
||||
WriteText(text);
|
||||
return NULL;
|
||||
|
||||
|
@ -297,37 +287,37 @@ void *OPJDecoThread::Entry()
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
OPJParseThread::OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid)
|
||||
: wxThread()
|
||||
: wxThread()
|
||||
{
|
||||
m_count = 0;
|
||||
m_tree = tree;
|
||||
m_parentid = parentid;
|
||||
m_parentid = parentid;
|
||||
}
|
||||
|
||||
void OPJParseThread::WriteText(const wxString& text)
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
|
||||
// we use a fake event and post it for inter-thread gui communication
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
event.SetInt(-1);
|
||||
msg << text;
|
||||
event.SetString(msg);
|
||||
wxPostEvent(this->m_tree->m_childframe->m_frame, event);
|
||||
|
||||
/* // before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
/* // before doing any GUI calls we must ensure that this thread is the only
|
||||
// one doing it!
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif // __WXGTK
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif // __WXGTK
|
||||
|
||||
msg << text;
|
||||
m_tree->WriteText(msg);
|
||||
msg << text;
|
||||
m_tree->WriteText(msg);
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK*/
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif // __WXGTK*/
|
||||
}
|
||||
|
||||
void OPJParseThread::OnExit()
|
||||
|
@ -350,14 +340,14 @@ void OPJParseThread::OnExit()
|
|||
void *OPJParseThread::Entry()
|
||||
{
|
||||
|
||||
printf("Entering\n\n");
|
||||
printf("Entering\n\n");
|
||||
|
||||
wxString text;
|
||||
|
||||
srand(GetId());
|
||||
int m_countnum = rand() % 9;
|
||||
srand(GetId());
|
||||
int m_countnum = rand() % 9;
|
||||
text.Printf(wxT("Parse thread 0x%lx started (priority = %u, time = %d)."),
|
||||
GetId(), GetPriority(), m_countnum);
|
||||
GetId(), GetPriority(), m_countnum);
|
||||
WriteText(text);
|
||||
LoadFile(m_tree->m_fname);
|
||||
text.Printf(wxT("Parse thread 0x%lx finished."), GetId());
|
||||
|
@ -366,8 +356,8 @@ void *OPJParseThread::Entry()
|
|||
|
||||
//wxLogMessage(wxT("Entering\n")); //test wxLog thread safeness
|
||||
|
||||
//wxBusyCursor wait;
|
||||
//wxBusyInfo wait(wxT("Decoding image ..."));
|
||||
//wxBusyCursor wait;
|
||||
//wxBusyInfo wait(wxT("Decoding image ..."));
|
||||
|
||||
|
||||
/*for ( m_count = 0; m_count < m_countnum; m_count++ )
|
||||
|
@ -385,7 +375,7 @@ void *OPJParseThread::Entry()
|
|||
|
||||
// wxLogMessage(text); -- test wxLog thread safeness
|
||||
|
||||
printf("Exiting\n\n");
|
||||
printf("Exiting\n\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -398,7 +388,7 @@ void *OPJParseThread::Entry()
|
|||
#if USE_GENERIC_TREECTRL
|
||||
BEGIN_EVENT_TABLE(OPJMarkerTree, wxGenericTreeCtrl)
|
||||
#else
|
||||
BEGIN_EVENT_TABLE(OPJMarkerTree, wxTreeCtrl)
|
||||
BEGIN_EVENT_TABLE(OPJMarkerTree, wxTreeCtrl)
|
||||
#endif
|
||||
/*EVT_TREE_BEGIN_DRAG(TreeTest_Ctrl, OPJMarkerTree::OnBeginDrag)
|
||||
EVT_TREE_BEGIN_RDRAG(TreeTest_Ctrl, OPJMarkerTree::OnBeginRDrag)
|
||||
|
@ -420,7 +410,7 @@ BEGIN_EVENT_TABLE(OPJMarkerTree, wxGenericTreeCtrl)
|
|||
/*EVT_TREE_KEY_DOWN(TreeTest_Ctrl, OPJMarkerTree::OnTreeKeyDown)*/
|
||||
/*EVT_TREE_ITEM_ACTIVATED(TreeTest_Ctrl, OPJMarkerTree::OnItemActivated)*/
|
||||
|
||||
// so many different ways to handle right mouse button clicks...
|
||||
// so many differents ways to handle right mouse button clicks...
|
||||
/*EVT_CONTEXT_MENU(OPJMarkerTree::OnContextMenu)*/
|
||||
// EVT_TREE_ITEM_MENU is the preferred event for creating context menus
|
||||
// on a tree control, because it includes the point of the click or item,
|
||||
|
@ -440,16 +430,14 @@ IMPLEMENT_DYNAMIC_CLASS(OPJMarkerTree, wxGenericTreeCtrl)
|
|||
IMPLEMENT_DYNAMIC_CLASS(OPJMarkerTree, wxTreeCtrl)
|
||||
#endif
|
||||
|
||||
OPJMarkerTree::OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe,
|
||||
wxFileName fname, wxString name, const wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
OPJMarkerTree::OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
m_reverseSort = false;
|
||||
m_fname = fname;
|
||||
m_fname = fname;
|
||||
|
||||
m_peektextCtrl = ((OPJFrame *)(
|
||||
parent->GetParent()->GetParent()))->m_textCtrlbrowse;
|
||||
m_peektextCtrl = ((OPJFrame *) (parent->GetParent()->GetParent()))->m_textCtrlbrowse;
|
||||
CreateImageList();
|
||||
|
||||
// Add some items to the tree
|
||||
|
@ -460,13 +448,12 @@ OPJMarkerTree::OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe,
|
|||
new OPJMarkerData(name));
|
||||
|
||||
OPJParseThread *pthread = CreateParseThread(0x00, subframe);
|
||||
if (pthread->Run() != wxTHREAD_NO_ERROR) {
|
||||
if (pthread->Run() != wxTHREAD_NO_ERROR)
|
||||
wxLogMessage(wxT("Can't start parse thread!"));
|
||||
} else {
|
||||
wxLogMessage(wxT("New parse thread started."));
|
||||
}
|
||||
else
|
||||
wxLogMessage(wxT("New parse thread started."));
|
||||
|
||||
m_childframe = subframe;
|
||||
m_childframe = subframe;
|
||||
}
|
||||
|
||||
void OPJMarkerTree::CreateImageList(int size)
|
||||
|
@ -475,11 +462,10 @@ void OPJMarkerTree::CreateImageList(int size)
|
|||
SetImageList(NULL);
|
||||
return;
|
||||
}
|
||||
if (size == 0) {
|
||||
if (size == 0)
|
||||
size = m_imageSize;
|
||||
} else {
|
||||
else
|
||||
m_imageSize = size;
|
||||
}
|
||||
|
||||
// Make an image list containing small icons
|
||||
wxImageList *images = new wxImageList(size, size, true);
|
||||
|
@ -508,7 +494,7 @@ void OPJMarkerTree::CreateImageList(int size)
|
|||
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
|
||||
void OPJMarkerTree::CreateButtonsImageList(int size)
|
||||
{
|
||||
if (size == -1) {
|
||||
if ( size == -1 ) {
|
||||
SetButtonsImageList(NULL);
|
||||
return;
|
||||
}
|
||||
|
@ -524,9 +510,9 @@ void OPJMarkerTree::CreateButtonsImageList(int size)
|
|||
icons[2] = wxIcon(icon5_xpm); // open
|
||||
icons[3] = wxIcon(icon5_xpm); // open, selected
|
||||
|
||||
for (size_t i = 0; i < WXSIZEOF(icons); i++) {
|
||||
for ( size_t i = 0; i < WXSIZEOF(icons); i++ ) {
|
||||
int sizeOrig = icons[i].GetWidth();
|
||||
if (size == sizeOrig) {
|
||||
if ( size == sizeOrig ) {
|
||||
images->Add(icons[i]);
|
||||
} else {
|
||||
images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size)));
|
||||
|
@ -542,79 +528,77 @@ void OPJMarkerTree::CreateButtonsImageList(int WXUNUSED(size))
|
|||
|
||||
void OPJParseThread::LoadFile(wxFileName fname)
|
||||
{
|
||||
wxTreeItemId rootid;
|
||||
wxTreeItemId rootid;
|
||||
|
||||
// this is the root node
|
||||
int image = wxGetApp().ShowImages() ? m_tree->TreeCtrlIcon_Folder : -1;
|
||||
// this is the root node
|
||||
int image = wxGetApp().ShowImages() ? m_tree->TreeCtrlIcon_Folder : -1;
|
||||
|
||||
if (this->m_parentid) {
|
||||
// leaf of a tree
|
||||
rootid = m_parentid;
|
||||
m_tree->SetItemText(rootid, wxT("Parsing..."));
|
||||
if (this->m_parentid) {
|
||||
// leaf of a tree
|
||||
rootid = m_parentid;
|
||||
m_tree->SetItemText(rootid, wxT("Parsing..."));
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
// delete the existing tree hierarchy
|
||||
m_tree->DeleteAllItems();
|
||||
// delete the existing tree hierarchy
|
||||
m_tree->DeleteAllItems();
|
||||
|
||||
// new tree
|
||||
rootid = m_tree->AddRoot(wxT("Parsing..."),
|
||||
image,
|
||||
image,
|
||||
new OPJMarkerData(fname.GetFullPath())
|
||||
);
|
||||
//m_tree->SetItemFont(rootid, *wxITALIC_FONT);
|
||||
m_tree->SetItemBold(rootid);
|
||||
}
|
||||
// new tree
|
||||
rootid = m_tree->AddRoot(wxT("Parsing..."),
|
||||
image,
|
||||
image,
|
||||
new OPJMarkerData(fname.GetFullPath())
|
||||
);
|
||||
//m_tree->SetItemFont(rootid, *wxITALIC_FONT);
|
||||
m_tree->SetItemBold(rootid);
|
||||
}
|
||||
|
||||
// open the file
|
||||
wxFile m_file(fname.GetFullPath().c_str(), wxFile::read);
|
||||
// open the file
|
||||
wxFile m_file(fname.GetFullPath().c_str(), wxFile::read);
|
||||
|
||||
// parsing enabled?
|
||||
if (wxGetApp().m_enableparse) {
|
||||
// parsing enabled?
|
||||
if (wxGetApp().m_enableparse) {
|
||||
|
||||
// what is the extension?
|
||||
if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) {
|
||||
// what is the extension?
|
||||
if ((fname.GetExt() == wxT("j2k")) || (fname.GetExt() == wxT("j2c"))) {
|
||||
|
||||
// parse the file
|
||||
ParseJ2KFile(&m_file, 0, m_file.Length(), rootid);
|
||||
// parse the file
|
||||
ParseJ2KFile(&m_file, 0, m_file.Length(), rootid);
|
||||
|
||||
} else if ((fname.GetExt() == wxT("jp2")) || (fname.GetExt() == wxT("mj2"))) {
|
||||
} else if ((fname.GetExt() == wxT("jp2")) || (fname.GetExt() == wxT("mj2"))) {
|
||||
|
||||
// parse the file
|
||||
if (this->m_parentid) {
|
||||
//WriteText(wxT("Only a subsection of jp2"));
|
||||
OPJMarkerData *data = (OPJMarkerData *) m_tree->GetItemData(rootid);
|
||||
ParseJ2KFile(&m_file, data->m_start, data->m_length, rootid);
|
||||
m_tree->Expand(rootid);
|
||||
// parse the file
|
||||
if (this->m_parentid) {
|
||||
//WriteText(wxT("Only a subsection of jp2"));
|
||||
OPJMarkerData *data = (OPJMarkerData *) m_tree->GetItemData(rootid);
|
||||
ParseJ2KFile(&m_file, data->m_start, data->m_length, rootid);
|
||||
m_tree->Expand(rootid);
|
||||
|
||||
} else {
|
||||
// as usual
|
||||
ParseJP2File(&m_file, 0, m_file.Length(), rootid);
|
||||
}
|
||||
} else {
|
||||
// as usual
|
||||
ParseJP2File(&m_file, 0, m_file.Length(), rootid);
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
// unknown extension
|
||||
WriteText(wxT("Unknown file format!"));
|
||||
// unknown extension
|
||||
WriteText(wxT("Unknown file format!"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// this is the root node
|
||||
if (this->m_parentid) {
|
||||
m_tree->SetItemText(rootid, wxT("Codestream"));
|
||||
} else
|
||||
//m_tree->SetItemText(rootid, wxString::Format(wxT("%s (%d B)"), fname.GetFullName(), m_file.Length()));
|
||||
{
|
||||
m_tree->SetItemText(rootid, fname.GetFullName());
|
||||
}
|
||||
// this is the root node
|
||||
if (this->m_parentid)
|
||||
m_tree->SetItemText(rootid, wxT("Codestream"));
|
||||
else
|
||||
//m_tree->SetItemText(rootid, wxString::Format(wxT("%s (%d B)"), fname.GetFullName(), m_file.Length()));
|
||||
m_tree->SetItemText(rootid, fname.GetFullName());
|
||||
|
||||
// close the file
|
||||
m_file.Close();
|
||||
// close the file
|
||||
m_file.Close();
|
||||
|
||||
WriteText(wxT("Parsing finished!"));
|
||||
WriteText(wxT("Parsing finished!"));
|
||||
}
|
||||
|
||||
/*int OPJMarkerTree::OnCompareItems(const wxTreeItemId& item1,
|
||||
|
@ -749,22 +733,19 @@ void OPJMarkerTree::LogEvent(const wxChar *name, const wxTreeEvent& event)
|
|||
{
|
||||
wxTreeItemId item = event.GetItem();
|
||||
wxString text;
|
||||
if (item.IsOk()) {
|
||||
if ( item.IsOk() )
|
||||
text << wxT('"') << GetItemText(item).c_str() << wxT('"');
|
||||
} else {
|
||||
else
|
||||
text = wxT("invalid item");
|
||||
}
|
||||
wxLogMessage(wxT("%s(%s)"), name, text.c_str());
|
||||
}
|
||||
|
||||
OPJParseThread *OPJMarkerTree::CreateParseThread(wxTreeItemId parentid,
|
||||
OPJChildFrame *subframe)
|
||||
OPJParseThread *OPJMarkerTree::CreateParseThread(wxTreeItemId parentid, OPJChildFrame *subframe)
|
||||
{
|
||||
OPJParseThread *pthread = new OPJParseThread(this, parentid);
|
||||
|
||||
if (pthread->Create() != wxTHREAD_NO_ERROR) {
|
||||
wxLogError(wxT("Can't create parse thread!"));
|
||||
}
|
||||
if (pthread->Create() != wxTHREAD_NO_ERROR)
|
||||
wxLogError(wxT("Can't create parse thread!"));
|
||||
|
||||
wxCriticalSectionLocker enter(wxGetApp().m_parse_critsect);
|
||||
wxGetApp().m_parse_threads.Add(pthread);
|
||||
|
@ -796,122 +777,114 @@ TREE_EVENT_HANDLER(OnSelChanging)*/
|
|||
|
||||
void OPJMarkerTree::OnItemExpanding(wxTreeEvent& event)
|
||||
{
|
||||
wxTreeItemId item = event.GetItem();
|
||||
OPJMarkerData* data = (OPJMarkerData *) GetItemData(item);
|
||||
wxString text;
|
||||
wxTreeItemId item = event.GetItem();
|
||||
OPJMarkerData* data = (OPJMarkerData *) GetItemData(item);
|
||||
wxString text;
|
||||
|
||||
if (item.IsOk()) {
|
||||
text << wxT('"') << GetItemText(item).c_str() << wxT('"');
|
||||
} else {
|
||||
text = wxT("invalid item");
|
||||
}
|
||||
if (item.IsOk())
|
||||
text << wxT('"') << GetItemText(item).c_str() << wxT('"');
|
||||
else
|
||||
text = wxT("invalid item");
|
||||
|
||||
if (wxStrcmp(data->GetDesc1(), wxT("INFO-CSTREAM"))) {
|
||||
return;
|
||||
}
|
||||
if (wxStrcmp(data->GetDesc1(), wxT("INFO-CSTREAM")))
|
||||
return;
|
||||
|
||||
wxLogMessage(wxT("Expanding... (%s -> %s, %s, %d, %d)"),
|
||||
text.c_str(), data->GetDesc1(), data->GetDesc2(),
|
||||
data->m_start, data->m_length);
|
||||
wxLogMessage(wxT("Expanding... (%s -> %s, %s, %d, %d)"),
|
||||
text.c_str(), data->GetDesc1(), data->GetDesc2(),
|
||||
data->m_start, data->m_length);
|
||||
|
||||
// the codestream box is being asked for expansion
|
||||
wxTreeItemIdValue cookie;
|
||||
if (!GetFirstChild(item, cookie).IsOk()) {
|
||||
OPJParseThread *pthread = CreateParseThread(item);
|
||||
if (pthread->Run() != wxTHREAD_NO_ERROR) {
|
||||
wxLogMessage(wxT("Can't start parse thread!"));
|
||||
} else {
|
||||
wxLogMessage(wxT("New parse thread started."));
|
||||
}
|
||||
}
|
||||
// the codestream box is being asked for expansion
|
||||
wxTreeItemIdValue cookie;
|
||||
if (!GetFirstChild(item, cookie).IsOk()) {
|
||||
OPJParseThread *pthread = CreateParseThread(item);
|
||||
if (pthread->Run() != wxTHREAD_NO_ERROR)
|
||||
wxLogMessage(wxT("Can't start parse thread!"));
|
||||
else
|
||||
wxLogMessage(wxT("New parse thread started."));
|
||||
}
|
||||
}
|
||||
|
||||
void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
||||
{
|
||||
int bunch_linesize = 16;
|
||||
int bunch_numlines = 7;
|
||||
int bunch_linesize = 16;
|
||||
int bunch_numlines = 7;
|
||||
|
||||
wxTreeItemId item = event.GetItem();
|
||||
OPJMarkerData* data = (OPJMarkerData *) GetItemData(item);
|
||||
wxString text;
|
||||
int l, c, pos = 0, pre_pos;
|
||||
wxTreeItemId item = event.GetItem();
|
||||
OPJMarkerData* data = (OPJMarkerData *) GetItemData(item);
|
||||
wxString text;
|
||||
int l, c, pos = 0, pre_pos;
|
||||
|
||||
m_peektextCtrl->Clear();
|
||||
m_peektextCtrl->Clear();
|
||||
|
||||
/*text << wxString::Format(wxT("Selected... (%s -> %s, %s, %d, %d)"),
|
||||
text.c_str(), data->GetDesc1(), data->GetDesc2(),
|
||||
data->m_start, data->m_length) << wxT("\n");*/
|
||||
/*text << wxString::Format(wxT("Selected... (%s -> %s, %s, %d, %d)"),
|
||||
text.c_str(), data->GetDesc1(), data->GetDesc2(),
|
||||
data->m_start, data->m_length) << wxT("\n");*/
|
||||
|
||||
// open the file and browse a little
|
||||
wxFile *fp = new wxFile(m_fname.GetFullPath().c_str(), wxFile::read);
|
||||
// open the file and browse a little
|
||||
wxFile *fp = new wxFile(m_fname.GetFullPath().c_str(), wxFile::read);
|
||||
|
||||
// go to position claimed
|
||||
fp->Seek(data->m_start, wxFromStart);
|
||||
// go to position claimed
|
||||
fp->Seek(data->m_start, wxFromStart);
|
||||
|
||||
// read a bunch
|
||||
int max_read = wxMin(wxFileOffset(bunch_linesize * bunch_numlines),
|
||||
data->m_length - data->m_start + 1);
|
||||
if (data->m_desc == wxT("MARK (65380)")) {
|
||||
/*wxLogMessage(data->m_desc);*/
|
||||
max_read = data->m_length - data->m_start + 1;
|
||||
bunch_numlines = (int) ceil((float) max_read / (float) bunch_linesize);
|
||||
}
|
||||
unsigned char *buffer = new unsigned char[bunch_linesize * bunch_numlines];
|
||||
fp->Read(buffer, max_read);
|
||||
// read a bunch
|
||||
int max_read = wxMin(wxFileOffset(bunch_linesize * bunch_numlines), data->m_length - data->m_start + 1);
|
||||
if (data->m_desc == wxT("MARK (65380)")) {
|
||||
/*wxLogMessage(data->m_desc);*/
|
||||
max_read = data->m_length - data->m_start + 1;
|
||||
bunch_numlines = (int) ceil((float) max_read / (float) bunch_linesize);
|
||||
}
|
||||
unsigned char *buffer = new unsigned char[bunch_linesize * bunch_numlines];
|
||||
fp->Read(buffer, max_read);
|
||||
|
||||
// write the file data between start and stop
|
||||
pos = 0;
|
||||
for (l = 0; l < bunch_numlines; l++) {
|
||||
// write the file data between start and stop
|
||||
pos = 0;
|
||||
for (l = 0; l < bunch_numlines; l++) {
|
||||
|
||||
text << wxString::Format(wxT("%010d:"), data->m_start + pos);
|
||||
text << wxString::Format(wxT("%010d:"), data->m_start + pos);
|
||||
|
||||
pre_pos = pos;
|
||||
pre_pos = pos;
|
||||
|
||||
// add hex browsing text
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
// add hex browsing text
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
|
||||
if (!(c % 8)) {
|
||||
text << wxT(" ");
|
||||
}
|
||||
if (!(c % 8))
|
||||
text << wxT(" ");
|
||||
|
||||
if (pos < max_read) {
|
||||
text << wxString::Format(wxT("%02X "), buffer[pos]);
|
||||
} else {
|
||||
text << wxT(" ");
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
if (pos < max_read) {
|
||||
text << wxString::Format(wxT("%02X "), buffer[pos]);
|
||||
} else
|
||||
text << wxT(" ");
|
||||
pos++;
|
||||
}
|
||||
|
||||
text << wxT(" ");
|
||||
text << wxT(" ");
|
||||
|
||||
// add char browsing text
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
// add char browsing text
|
||||
for (c = 0; c < bunch_linesize; c++) {
|
||||
|
||||
if (pre_pos < max_read) {
|
||||
if ((buffer[pre_pos] == '\n') ||
|
||||
(buffer[pre_pos] == '\t') ||
|
||||
(buffer[pre_pos] == '\0') ||
|
||||
(buffer[pre_pos] == 0x0D) ||
|
||||
(buffer[pre_pos] == 0x0B)) {
|
||||
buffer[pre_pos] = ' ';
|
||||
}
|
||||
text << wxString::FromAscii((char) buffer[pre_pos]) << wxT(".");
|
||||
} else {
|
||||
text << wxT(" ");
|
||||
}
|
||||
pre_pos++;
|
||||
}
|
||||
if (pre_pos < max_read) {
|
||||
if ((buffer[pre_pos] == '\n') ||
|
||||
(buffer[pre_pos] == '\t') ||
|
||||
(buffer[pre_pos] == '\0') ||
|
||||
(buffer[pre_pos] == 0x0D) ||
|
||||
(buffer[pre_pos] == 0x0B))
|
||||
buffer[pre_pos] = ' ';
|
||||
text << wxString::FromAscii((char) buffer[pre_pos]) << wxT(".");
|
||||
} else
|
||||
text << wxT(" ");
|
||||
pre_pos++;
|
||||
}
|
||||
|
||||
text << wxT("\n");
|
||||
text << wxT("\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// close the file
|
||||
fp->Close();
|
||||
// close the file
|
||||
fp->Close();
|
||||
|
||||
m_peektextCtrl->WriteText(text);
|
||||
m_peektextCtrl->WriteText(text);
|
||||
|
||||
delete [] buffer;
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
|
@ -1170,7 +1143,7 @@ void OPJMarkerTree::OnItemMenu(wxTreeEvent& event)
|
|||
wxLogMessage(wxT("OnItemMenu for item \"%s\""), item ? item->GetDesc()
|
||||
: _T(""));*/
|
||||
|
||||
//wxLogMessage(wxT("EEEEEEEEEE"));
|
||||
//wxLogMessage(wxT("EEEEEEEEEE"));
|
||||
|
||||
//event.Skip();
|
||||
}
|
||||
|
@ -1291,3 +1264,5 @@ void OPJMarkerData::ShowInfo(wxTreeCtrl *tree)
|
|||
unsigned(tree->GetChildrenCount(GetId())),
|
||||
unsigned(tree->GetChildrenCount(GetId(), false)));
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
/*
|
||||
* 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) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -106,7 +101,7 @@
|
|||
#include "wx/toolbar.h"
|
||||
#include "wx/artprov.h"
|
||||
|
||||
#include "openjp2/openjpeg.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
//#include "imagj2k.h"
|
||||
//#include "imagjp2.h"
|
||||
|
@ -136,10 +131,10 @@ typedef unsigned long long int8byte;
|
|||
#endif
|
||||
|
||||
#define OPJ_APPLICATION wxT("OPJViewer")
|
||||
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
||||
#define OPJ_APPLICATION_VERSION wxT("0.4 beta")
|
||||
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
||||
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa")
|
||||
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
||||
#define OPJ_APPLICATION_VERSION wxT("0.4 beta")
|
||||
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
||||
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa")
|
||||
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
@ -180,86 +175,73 @@ class OPJChildFrame;
|
|||
//////////////////////////////////
|
||||
class OPJViewerApp: public wxApp
|
||||
{
|
||||
// public methods and variables
|
||||
public:
|
||||
// public methods and variables
|
||||
public:
|
||||
|
||||
// class constructor
|
||||
OPJViewerApp()
|
||||
{
|
||||
m_showImages = true;
|
||||
m_showButtons = false;
|
||||
}
|
||||
// class constructor
|
||||
OPJViewerApp() { m_showImages = true; m_showButtons = false; }
|
||||
|
||||
// other methods
|
||||
bool OnInit(void);
|
||||
int OnExit(void);
|
||||
void SetShowImages(bool show)
|
||||
{
|
||||
m_showImages = show;
|
||||
}
|
||||
bool ShowImages() const
|
||||
{
|
||||
return m_showImages;
|
||||
}
|
||||
void ShowCmdLine(const wxCmdLineParser& parser);
|
||||
// other methods
|
||||
bool OnInit(void);
|
||||
int OnExit(void);
|
||||
void SetShowImages(bool show) { m_showImages = show; }
|
||||
bool ShowImages() const { return m_showImages; }
|
||||
void ShowCmdLine(const wxCmdLineParser& parser);
|
||||
|
||||
// all the threads currently alive - as soon as the thread terminates, it's
|
||||
// removed from the array
|
||||
wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads;
|
||||
// all the threads currently alive - as soon as the thread terminates, it's
|
||||
// removed from the array
|
||||
wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads;
|
||||
|
||||
// crit section protects access to all of the arrays below
|
||||
wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect;
|
||||
// crit section protects access to all of the arrays below
|
||||
wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect;
|
||||
|
||||
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
|
||||
wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone;
|
||||
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
|
||||
wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone;
|
||||
|
||||
// the last exiting thread should post to m_semAllDone if this is true
|
||||
// (protected by the same m_critsect)
|
||||
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone,
|
||||
m_enco_waitingUntilAllDone;
|
||||
// the last exiting thread should post to m_semAllDone if this is true
|
||||
// (protected by the same m_critsect)
|
||||
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone, m_enco_waitingUntilAllDone;
|
||||
|
||||
// the list of all filenames written in the command line
|
||||
wxArrayString m_filelist;
|
||||
// the list of all filenames written in the command line
|
||||
wxArrayString m_filelist;
|
||||
|
||||
// displaying engine parameters
|
||||
int m_resizemethod;
|
||||
// displaying engine parameters
|
||||
int m_resizemethod;
|
||||
|
||||
// decoding engine parameters
|
||||
bool m_enabledeco, m_enableparse;
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
// decoding engine parameters
|
||||
bool m_enabledeco, m_enableparse;
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl, m_enablejpwle;
|
||||
int m_expcomps, m_maxtiles;
|
||||
bool m_enablejpwl, m_enablejpwle;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
int m_framewidth, m_frameheight;
|
||||
int m_framewidth, m_frameheight;
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
|
||||
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
|
||||
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop,
|
||||
m_enableeph;
|
||||
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc,
|
||||
m_enableerterm;
|
||||
bool m_enablesegmark, m_enablepoc;
|
||||
bool m_enablequality;
|
||||
int m_resolutions, m_progression;
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
|
||||
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
|
||||
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph;
|
||||
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm;
|
||||
bool m_enablesegmark, m_enablepoc;
|
||||
bool m_enablequality;
|
||||
int m_resolutions, m_progression;
|
||||
#ifdef USE_JPWL
|
||||
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
|
||||
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
|
||||
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
|
||||
#endif // USE_JPWL
|
||||
|
||||
// some layout settings
|
||||
bool m_showtoolbar, m_showbrowser, m_showpeeker;
|
||||
int m_browserwidth, m_peekerheight;
|
||||
// some layout settings
|
||||
bool m_showtoolbar, m_showbrowser, m_showpeeker;
|
||||
int m_browserwidth, m_peekerheight;
|
||||
|
||||
// application configuration
|
||||
wxConfig *OPJconfig;
|
||||
// application configuration
|
||||
wxConfig *OPJconfig;
|
||||
|
||||
// private methods and variables
|
||||
private:
|
||||
bool m_showImages, m_showButtons;
|
||||
// private methods and variables
|
||||
private:
|
||||
bool m_showImages, m_showButtons;
|
||||
|
||||
};
|
||||
|
||||
|
@ -270,39 +252,37 @@ DECLARE_APP(OPJViewerApp)
|
|||
///////////////////////////////////////////
|
||||
class OPJCanvas: public wxScrolledWindow
|
||||
{
|
||||
// public methods and variables
|
||||
public:
|
||||
// public methods and variables
|
||||
public:
|
||||
|
||||
// class constructor
|
||||
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos,
|
||||
const wxSize& size);
|
||||
// class constructor
|
||||
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||
|
||||
virtual void OnDraw(wxDC& dc);
|
||||
void OnEvent(wxMouseEvent& event);
|
||||
void WriteText(const wxString& text)
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
virtual void OnDraw(wxDC& dc);
|
||||
void OnEvent(wxMouseEvent& event);
|
||||
void WriteText(const wxString& text) {
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif //__WXGTK__
|
||||
wxLogMessage(text);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
wxLogMessage(text);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif //__WXGTK__
|
||||
}
|
||||
}
|
||||
|
||||
void OnThreadSignal(wxCommandEvent& event);
|
||||
void OnThreadSignal(wxCommandEvent& event);
|
||||
|
||||
OPJDecoThread *CreateDecoThread(void);
|
||||
OPJEncoThread *CreateEncoThread(void);
|
||||
OPJDecoThread *CreateDecoThread(void);
|
||||
OPJEncoThread *CreateEncoThread(void);
|
||||
|
||||
|
||||
OPJChildFrame *m_childframe;
|
||||
OPJChildFrame *m_childframe;
|
||||
|
||||
wxBitmap m_image, m_image100;
|
||||
wxFileName m_fname, m_savename;
|
||||
long m_zooml;
|
||||
wxBitmap m_image, m_image100;
|
||||
wxFileName m_fname, m_savename;
|
||||
long m_zooml;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
@ -310,40 +290,29 @@ public:
|
|||
///////////////////////////////////////////////////
|
||||
class OPJMarkerData : public wxTreeItemData
|
||||
{
|
||||
// public methods and variables
|
||||
public:
|
||||
// public methods and variables
|
||||
public:
|
||||
|
||||
// class constructor
|
||||
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""),
|
||||
wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc),
|
||||
m_filestring(fname)
|
||||
{
|
||||
m_start = start;
|
||||
m_length = length;
|
||||
}
|
||||
// class constructor
|
||||
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; }
|
||||
|
||||
void ShowInfo(wxTreeCtrl *tree);
|
||||
const wxChar *GetDesc1() const
|
||||
{
|
||||
return m_desc.c_str();
|
||||
}
|
||||
const wxChar *GetDesc2() const
|
||||
{
|
||||
return m_filestring.c_str();
|
||||
}
|
||||
wxFileOffset m_start, m_length;
|
||||
wxString m_desc;
|
||||
void ShowInfo(wxTreeCtrl *tree);
|
||||
const wxChar *GetDesc1() const { return m_desc.c_str(); }
|
||||
const wxChar *GetDesc2() const { return m_filestring.c_str(); }
|
||||
wxFileOffset m_start, m_length;
|
||||
wxString m_desc;
|
||||
|
||||
// private methods and variables
|
||||
private:
|
||||
wxString m_filestring;
|
||||
// private methods and variables
|
||||
private:
|
||||
wxString m_filestring;
|
||||
};
|
||||
|
||||
|
||||
class OPJMarkerTree : public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
TreeCtrlIcon_File,
|
||||
TreeCtrlIcon_FileSelected,
|
||||
TreeCtrlIcon_Folder,
|
||||
|
@ -352,23 +321,16 @@ public:
|
|||
};
|
||||
|
||||
OPJMarkerTree() { };
|
||||
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname,
|
||||
wxString name, const wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style);
|
||||
virtual ~OPJMarkerTree() {};
|
||||
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00,
|
||||
OPJChildFrame *subframe = NULL);
|
||||
void WriteText(const wxString& text)
|
||||
{
|
||||
wxMutexGuiEnter();
|
||||
wxLogMessage(text);
|
||||
wxMutexGuiLeave();
|
||||
}
|
||||
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style);
|
||||
virtual ~OPJMarkerTree(){};
|
||||
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL);
|
||||
void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); }
|
||||
|
||||
wxFileName m_fname;
|
||||
wxTextCtrl *m_peektextCtrl;
|
||||
OPJChildFrame *m_childframe;
|
||||
wxFileName m_fname;
|
||||
wxTextCtrl *m_peektextCtrl;
|
||||
OPJChildFrame *m_childframe;
|
||||
|
||||
/*void OnBeginDrag(wxTreeEvent& event);
|
||||
void OnBeginRDrag(wxTreeEvent& event);
|
||||
|
@ -405,15 +367,9 @@ public:
|
|||
/*void DoToggleIcon(const wxTreeItemId& item);*/
|
||||
/*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/
|
||||
|
||||
int ImageSize(void) const
|
||||
{
|
||||
return m_imageSize;
|
||||
}
|
||||
int ImageSize(void) const { return m_imageSize; }
|
||||
|
||||
void SetLastItem(wxTreeItemId id)
|
||||
{
|
||||
m_lastItem = id;
|
||||
}
|
||||
void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
|
||||
|
||||
protected:
|
||||
/*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/
|
||||
|
@ -447,23 +403,20 @@ private:
|
|||
};
|
||||
|
||||
// this hash map stores all the trees of currently opened images, with an integer key
|
||||
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual,
|
||||
OPJMarkerTreeHash);
|
||||
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash);
|
||||
|
||||
// this hash map stores all the children of currently opened images, with an integer key
|
||||
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual,
|
||||
OPJChildFrameHash);
|
||||
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash);
|
||||
|
||||
// Define a new frame
|
||||
class OPJFrame: public wxMDIParentFrame
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long style);
|
||||
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
|
||||
~OPJFrame(void);
|
||||
void OnSize(wxSizeEvent& WXUNUSED(event));
|
||||
void OnSize(wxSizeEvent& WXUNUSED(event));
|
||||
void OnAbout(wxCommandEvent& WXUNUSED(event));
|
||||
void OnFileOpen(wxCommandEvent& WXUNUSED(event));
|
||||
void OnFileSaveAs(wxCommandEvent& WXUNUSED(event));
|
||||
|
@ -471,43 +424,43 @@ public:
|
|||
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
||||
void OnClose(wxCommandEvent& WXUNUSED(event));
|
||||
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
||||
void OnFit(wxCommandEvent& event);
|
||||
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||
void OnReload(wxCommandEvent& event);
|
||||
void OnPrevFrame(wxCommandEvent& event);
|
||||
void OnHomeFrame(wxCommandEvent& event);
|
||||
void OnNextFrame(wxCommandEvent& event);
|
||||
void OnLessLayers(wxCommandEvent& event);
|
||||
void OnAllLayers(wxCommandEvent& event);
|
||||
void OnMoreLayers(wxCommandEvent& event);
|
||||
void OnLessRes(wxCommandEvent& event);
|
||||
void OnFullRes(wxCommandEvent& event);
|
||||
void OnMoreRes(wxCommandEvent& event);
|
||||
void OnPrevComp(wxCommandEvent& event);
|
||||
void OnAllComps(wxCommandEvent& event);
|
||||
void OnNextComp(wxCommandEvent& event);
|
||||
void OnSetsEnco(wxCommandEvent& event);
|
||||
void OnSetsDeco(wxCommandEvent& event);
|
||||
void OnSashDrag(wxSashEvent& event);
|
||||
void OpenFiles(wxArrayString paths, wxArrayString filenames);
|
||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||
void OnNotebook(wxNotebookEvent& event);
|
||||
void Rescale(int scale, OPJChildFrame *child);
|
||||
void OnThreadLogmsg(wxCommandEvent& event);
|
||||
void OnFit(wxCommandEvent& event);
|
||||
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||
void OnReload(wxCommandEvent& event);
|
||||
void OnPrevFrame(wxCommandEvent& event);
|
||||
void OnHomeFrame(wxCommandEvent& event);
|
||||
void OnNextFrame(wxCommandEvent& event);
|
||||
void OnLessLayers(wxCommandEvent& event);
|
||||
void OnAllLayers(wxCommandEvent& event);
|
||||
void OnMoreLayers(wxCommandEvent& event);
|
||||
void OnLessRes(wxCommandEvent& event);
|
||||
void OnFullRes(wxCommandEvent& event);
|
||||
void OnMoreRes(wxCommandEvent& event);
|
||||
void OnPrevComp(wxCommandEvent& event);
|
||||
void OnAllComps(wxCommandEvent& event);
|
||||
void OnNextComp(wxCommandEvent& event);
|
||||
void OnSetsEnco(wxCommandEvent& event);
|
||||
void OnSetsDeco(wxCommandEvent& event);
|
||||
void OnSashDrag(wxSashEvent& event);
|
||||
void OpenFiles(wxArrayString paths, wxArrayString filenames);
|
||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||
void OnNotebook(wxNotebookEvent& event);
|
||||
void Rescale(int scale, OPJChildFrame *child);
|
||||
void OnThreadLogmsg(wxCommandEvent& event);
|
||||
|
||||
OPJMarkerTreeHash m_treehash;
|
||||
OPJChildFrameHash m_childhash;
|
||||
OPJMarkerTreeHash m_treehash;
|
||||
OPJChildFrameHash m_childhash;
|
||||
wxSashLayoutWindow* markerTreeWindow;
|
||||
wxSashLayoutWindow* loggingWindow;
|
||||
wxToolBar* tool_bar;
|
||||
wxToolBar* tool_bar;
|
||||
void Resize(int number);
|
||||
wxNotebook *m_bookCtrl;
|
||||
wxNotebook *m_bookCtrlbottom;
|
||||
wxNotebook *m_bookCtrl;
|
||||
wxNotebook *m_bookCtrlbottom;
|
||||
wxTextCtrl *m_textCtrlbrowse;
|
||||
|
||||
private:
|
||||
private:
|
||||
void TogStyle(int id, long flag);
|
||||
|
||||
void DoSort(bool reverse = false);
|
||||
|
@ -521,71 +474,70 @@ protected:
|
|||
wxSashLayoutWindow* m_topWindow;
|
||||
wxSashLayoutWindow* m_leftWindow2;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class OPJChildFrame: public wxMDIChildFrame
|
||||
{
|
||||
public:
|
||||
public:
|
||||
OPJCanvas *m_canvas;
|
||||
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber,
|
||||
const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
const long style);
|
||||
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
~OPJChildFrame(void);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnGotFocus(wxFocusEvent& event);
|
||||
void OnLostFocus(wxFocusEvent& event);
|
||||
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnGotFocus(wxFocusEvent& event);
|
||||
void OnLostFocus(wxFocusEvent& event);
|
||||
OPJFrame *m_frame;
|
||||
wxFileName m_fname;
|
||||
int m_winnumber;
|
||||
wxFileName m_fname;
|
||||
int m_winnumber;
|
||||
|
||||
unsigned long m_twidth, m_theight, m_tx, m_ty;
|
||||
unsigned long m_twidth, m_theight, m_tx, m_ty;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// frame and main menu ids
|
||||
enum {
|
||||
OPJFRAME_FILEEXIT = wxID_EXIT,
|
||||
OPJFRAME_HELPABOUT = wxID_ABOUT,
|
||||
OPJFRAME_FILEOPEN,
|
||||
OPJFRAME_MEMORYOPEN,
|
||||
OPJFRAME_FILESAVEAS,
|
||||
OPJFRAME_FILETOGGLEB,
|
||||
OPJFRAME_FILETOGGLEP,
|
||||
OPJFRAME_FILETOGGLET,
|
||||
OPJFRAME_VIEWZOOM,
|
||||
OPJFRAME_VIEWFIT,
|
||||
OPJFRAME_VIEWRELOAD,
|
||||
OPJFRAME_VIEWPREVFRAME,
|
||||
OPJFRAME_VIEWHOMEFRAME,
|
||||
OPJFRAME_VIEWNEXTFRAME,
|
||||
OPJFRAME_VIEWLESSLAYERS,
|
||||
OPJFRAME_VIEWALLLAYERS,
|
||||
OPJFRAME_VIEWMORELAYERS,
|
||||
OPJFRAME_VIEWLESSRES,
|
||||
OPJFRAME_VIEWFULLRES,
|
||||
OPJFRAME_VIEWMORERES,
|
||||
OPJFRAME_VIEWPREVCOMP,
|
||||
OPJFRAME_VIEWALLCOMPS,
|
||||
OPJFRAME_VIEWNEXTCOMP,
|
||||
OPJFRAME_FILECLOSE,
|
||||
OPJFRAME_SETSENCO,
|
||||
OPJFRAME_SETSDECO,
|
||||
OPJFRAME_FILEEXIT = wxID_EXIT,
|
||||
OPJFRAME_HELPABOUT = wxID_ABOUT,
|
||||
OPJFRAME_FILEOPEN,
|
||||
OPJFRAME_MEMORYOPEN,
|
||||
OPJFRAME_FILESAVEAS,
|
||||
OPJFRAME_FILETOGGLEB,
|
||||
OPJFRAME_FILETOGGLEP,
|
||||
OPJFRAME_FILETOGGLET,
|
||||
OPJFRAME_VIEWZOOM,
|
||||
OPJFRAME_VIEWFIT,
|
||||
OPJFRAME_VIEWRELOAD,
|
||||
OPJFRAME_VIEWPREVFRAME,
|
||||
OPJFRAME_VIEWHOMEFRAME,
|
||||
OPJFRAME_VIEWNEXTFRAME,
|
||||
OPJFRAME_VIEWLESSLAYERS,
|
||||
OPJFRAME_VIEWALLLAYERS,
|
||||
OPJFRAME_VIEWMORELAYERS,
|
||||
OPJFRAME_VIEWLESSRES,
|
||||
OPJFRAME_VIEWFULLRES,
|
||||
OPJFRAME_VIEWMORERES,
|
||||
OPJFRAME_VIEWPREVCOMP,
|
||||
OPJFRAME_VIEWALLCOMPS,
|
||||
OPJFRAME_VIEWNEXTCOMP,
|
||||
OPJFRAME_FILECLOSE,
|
||||
OPJFRAME_SETSENCO,
|
||||
OPJFRAME_SETSDECO,
|
||||
|
||||
OPJFRAME_BROWSEWIN = 10000,
|
||||
OPJFRAME_LOGWIN,
|
||||
OPJFRAME_TOOLBAR,
|
||||
OPJFRAME_BROWSEWIN = 10000,
|
||||
OPJFRAME_LOGWIN,
|
||||
OPJFRAME_TOOLBAR,
|
||||
|
||||
OPJFRAME_THREADLOGMSG,
|
||||
OPJCANVAS_THREADSIGNAL
|
||||
OPJFRAME_THREADLOGMSG,
|
||||
OPJCANVAS_THREADSIGNAL
|
||||
};
|
||||
|
||||
|
||||
// menu and control ids
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
TreeTest_Quit = wxID_EXIT,
|
||||
TreeTest_About = wxID_ABOUT,
|
||||
TreeTest_TogButtons = wxID_HIGHEST,
|
||||
|
@ -630,8 +582,8 @@ enum {
|
|||
TreeTest_Unselect,
|
||||
TreeTest_SelectRoot,
|
||||
TreeTest_Ctrl = 1000,
|
||||
BOTTOM_NOTEBOOK_ID,
|
||||
LEFT_NOTEBOOK_ID
|
||||
BOTTOM_NOTEBOOK_ID,
|
||||
LEFT_NOTEBOOK_ID
|
||||
};
|
||||
|
||||
class OPJEncoThread : public wxThread
|
||||
|
@ -688,23 +640,19 @@ public:
|
|||
|
||||
// write something to the text control
|
||||
void WriteText(const wxString& text);
|
||||
void LoadFile(wxFileName fname);
|
||||
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length,
|
||||
wxTreeItemId parentid);
|
||||
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint,
|
||||
wxFileOffset filelimit, wxTreeItemId parentid);
|
||||
void LoadFile(wxFileName fname);
|
||||
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid);
|
||||
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid);
|
||||
|
||||
unsigned m_count;
|
||||
OPJMarkerTree *m_tree;
|
||||
wxTreeItemId m_parentid;
|
||||
wxTreeItemId m_parentid;
|
||||
|
||||
private:
|
||||
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint,
|
||||
wxFileOffset filelimit,
|
||||
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint,
|
||||
wxFileOffset filelimit,
|
||||
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||
|
||||
};
|
||||
|
||||
|
@ -713,10 +661,7 @@ private:
|
|||
class OPJDnDFile: public wxFileDropTarget
|
||||
{
|
||||
public:
|
||||
OPJDnDFile(OPJFrame *pOwner)
|
||||
{
|
||||
m_pOwner = pOwner;
|
||||
}
|
||||
OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; }
|
||||
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
|
||||
|
||||
private:
|
||||
|
@ -728,139 +673,137 @@ private:
|
|||
// Property sheet dialog: encoder
|
||||
class OPJEncoderDialog: public wxPropertySheetDialog
|
||||
{
|
||||
DECLARE_CLASS(OPJEncoderDialog)
|
||||
DECLARE_CLASS(OPJEncoderDialog)
|
||||
public:
|
||||
OPJEncoderDialog(wxWindow* parent, int dialogType);
|
||||
~OPJEncoderDialog();
|
||||
|
||||
wxBookCtrlBase* m_settingsNotebook;
|
||||
wxBookCtrlBase* m_settingsNotebook;
|
||||
|
||||
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
||||
wxPanel* CreatePart1_1SettingsPage(wxWindow* parent);
|
||||
wxPanel* CreatePart1_2SettingsPage(wxWindow* parent);
|
||||
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
|
||||
void OnEnableComm(wxCommandEvent& event);
|
||||
void OnEnableIdx(wxCommandEvent& event);
|
||||
void OnEnablePoc(wxCommandEvent& event);
|
||||
void OnRadioQualityRate(wxCommandEvent& event);
|
||||
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
|
||||
void OnEnableComm(wxCommandEvent& event);
|
||||
void OnEnableIdx(wxCommandEvent& event);
|
||||
void OnEnablePoc(wxCommandEvent& event);
|
||||
void OnRadioQualityRate(wxCommandEvent& event);
|
||||
#ifdef USE_JPWL
|
||||
void OnEnableJPWL(wxCommandEvent& event);
|
||||
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||
/*wxCheckBox *m_enablejpwlCheck;*/
|
||||
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
void OnHprotSelect(wxCommandEvent& event);
|
||||
void OnPprotSelect(wxCommandEvent& event);
|
||||
void OnSensiSelect(wxCommandEvent& event);
|
||||
void OnEnableJPWL(wxCommandEvent& event);
|
||||
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||
/*wxCheckBox *m_enablejpwlCheck;*/
|
||||
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
void OnHprotSelect(wxCommandEvent& event);
|
||||
void OnPprotSelect(wxCommandEvent& event);
|
||||
void OnSensiSelect(wxCommandEvent& event);
|
||||
#endif // USE_JPWL
|
||||
|
||||
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
|
||||
wxRadioButton *m_rateRadio, *m_qualityRadio;
|
||||
wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl,
|
||||
*m_pocCtrl;
|
||||
wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl;
|
||||
wxRadioBox *progressionBox;
|
||||
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
|
||||
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
|
||||
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck,
|
||||
*m_enablesegmarkCheck;
|
||||
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
|
||||
wxSpinCtrl *m_resolutionsCtrl;
|
||||
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
|
||||
wxRadioButton *m_rateRadio, *m_qualityRadio;
|
||||
wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, *m_pocCtrl;
|
||||
wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl;
|
||||
wxRadioBox *progressionBox;
|
||||
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
|
||||
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
|
||||
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck;
|
||||
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
|
||||
wxSpinCtrl *m_resolutionsCtrl;
|
||||
|
||||
protected:
|
||||
|
||||
enum {
|
||||
OPJENCO_ENABLEJPWL = 100,
|
||||
OPJENCO_RATEFACTOR,
|
||||
OPJENCO_RATERADIO,
|
||||
OPJENCO_QUALITYFACTOR,
|
||||
OPJENCO_QUALITYRADIO,
|
||||
OPJENCO_RESNUMBER,
|
||||
OPJENCO_CODEBLOCKSIZE,
|
||||
OPJENCO_PRECINCTSIZE,
|
||||
OPJENCO_TILESIZE,
|
||||
OPJENCO_PROGRESSION,
|
||||
OPJENCO_SUBSAMPLING,
|
||||
OPJENCO_ENABLESOP,
|
||||
OPJENCO_ENABLEEPH,
|
||||
OPJENCO_ENABLEBYPASS,
|
||||
OPJENCO_ENABLERESET,
|
||||
OPJENCO_ENABLERESTART,
|
||||
OPJENCO_ENABLEVSC,
|
||||
OPJENCO_ENABLEERTERM,
|
||||
OPJENCO_ENABLESEGMARK,
|
||||
OPJENCO_ENABLEPOC,
|
||||
OPJENCO_ROICOMP,
|
||||
OPJENCO_ROISHIFT,
|
||||
OPJENCO_IMORIG,
|
||||
OPJENCO_TILORIG,
|
||||
OPJENCO_ENABLEMCT,
|
||||
OPJENCO_ENABLEIRREV,
|
||||
OPJENCO_ENABLEINDEX,
|
||||
OPJENCO_INDEXNAME,
|
||||
OPJENCO_POCSPEC,
|
||||
OPJENCO_ENABLECOMM,
|
||||
OPJENCO_COMMENTTEXT,
|
||||
OPJENCO_HPROT,
|
||||
OPJENCO_HTILE,
|
||||
OPJENCO_PPROT,
|
||||
OPJENCO_PTILE,
|
||||
OPJENCO_PPACK,
|
||||
OPJENCO_SENSI,
|
||||
OPJENCO_STILE
|
||||
OPJENCO_ENABLEJPWL = 100,
|
||||
OPJENCO_RATEFACTOR,
|
||||
OPJENCO_RATERADIO,
|
||||
OPJENCO_QUALITYFACTOR,
|
||||
OPJENCO_QUALITYRADIO,
|
||||
OPJENCO_RESNUMBER,
|
||||
OPJENCO_CODEBLOCKSIZE,
|
||||
OPJENCO_PRECINCTSIZE,
|
||||
OPJENCO_TILESIZE,
|
||||
OPJENCO_PROGRESSION,
|
||||
OPJENCO_SUBSAMPLING,
|
||||
OPJENCO_ENABLESOP,
|
||||
OPJENCO_ENABLEEPH,
|
||||
OPJENCO_ENABLEBYPASS,
|
||||
OPJENCO_ENABLERESET,
|
||||
OPJENCO_ENABLERESTART,
|
||||
OPJENCO_ENABLEVSC,
|
||||
OPJENCO_ENABLEERTERM,
|
||||
OPJENCO_ENABLESEGMARK,
|
||||
OPJENCO_ENABLEPOC,
|
||||
OPJENCO_ROICOMP,
|
||||
OPJENCO_ROISHIFT,
|
||||
OPJENCO_IMORIG,
|
||||
OPJENCO_TILORIG,
|
||||
OPJENCO_ENABLEMCT,
|
||||
OPJENCO_ENABLEIRREV,
|
||||
OPJENCO_ENABLEINDEX,
|
||||
OPJENCO_INDEXNAME,
|
||||
OPJENCO_POCSPEC,
|
||||
OPJENCO_ENABLECOMM,
|
||||
OPJENCO_COMMENTTEXT,
|
||||
OPJENCO_HPROT,
|
||||
OPJENCO_HTILE,
|
||||
OPJENCO_PPROT,
|
||||
OPJENCO_PTILE,
|
||||
OPJENCO_PPACK,
|
||||
OPJENCO_SENSI,
|
||||
OPJENCO_STILE
|
||||
};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Property sheet dialog: decoder
|
||||
class OPJDecoderDialog: public wxPropertySheetDialog
|
||||
{
|
||||
DECLARE_CLASS(OPJDecoderDialog)
|
||||
DECLARE_CLASS(OPJDecoderDialog)
|
||||
public:
|
||||
OPJDecoderDialog(wxWindow* parent, int dialogType);
|
||||
~OPJDecoderDialog();
|
||||
|
||||
wxBookCtrlBase* m_settingsNotebook;
|
||||
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
|
||||
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
|
||||
wxRadioBox* m_resizeBox;
|
||||
wxBookCtrlBase* m_settingsNotebook;
|
||||
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
|
||||
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
|
||||
wxRadioBox* m_resizeBox;
|
||||
|
||||
void OnEnableDeco(wxCommandEvent& event);
|
||||
void OnEnableDeco(wxCommandEvent& event);
|
||||
|
||||
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
||||
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
|
||||
wxPanel* CreatePart3SettingsPage(wxWindow* parent);
|
||||
#ifdef USE_JPWL
|
||||
void OnEnableJPWL(wxCommandEvent& event);
|
||||
void OnEnableJPWL(wxCommandEvent& event);
|
||||
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||
wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl;
|
||||
wxCheckBox *m_enablejpwlCheck;
|
||||
wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl;
|
||||
wxCheckBox *m_enablejpwlCheck;
|
||||
#endif // USE_JPWL
|
||||
wxSpinCtrl *m_framenumCtrl;
|
||||
wxSpinCtrl *m_framenumCtrl;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
enum {
|
||||
OPJDECO_RESMETHOD = 100,
|
||||
OPJDECO_REDUCEFACTOR,
|
||||
OPJDECO_QUALITYLAYERS,
|
||||
OPJDECO_NUMCOMPS,
|
||||
OPJDECO_ENABLEDECO,
|
||||
OPJDECO_ENABLEPARSE,
|
||||
OPJDECO_ENABLEJPWL,
|
||||
OPJDECO_EXPCOMPS,
|
||||
OPJDECO_MAXTILES,
|
||||
OPJDECO_FRAMENUM
|
||||
OPJDECO_RESMETHOD = 100,
|
||||
OPJDECO_REDUCEFACTOR,
|
||||
OPJDECO_QUALITYLAYERS,
|
||||
OPJDECO_NUMCOMPS,
|
||||
OPJDECO_ENABLEDECO,
|
||||
OPJDECO_ENABLEPARSE,
|
||||
OPJDECO_ENABLEJPWL,
|
||||
OPJDECO_EXPCOMPS,
|
||||
OPJDECO_MAXTILES,
|
||||
OPJDECO_FRAMENUM
|
||||
};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif //__OPJ_VIEWER_H__
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,54 @@
|
|||
wxString htmlaboutpage = wxT(
|
||||
"<html>"
|
||||
"<body bgcolor=#FFFFFF>"
|
||||
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
||||
"<tr>"
|
||||
"<td rowspan=3 valign=top align=center width=70>"
|
||||
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
||||
"</td>"
|
||||
"<td align=center>"
|
||||
"<font size=+0 color=#000000><b>"
|
||||
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
||||
"</b></font><br>"
|
||||
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
|
||||
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
|
||||
"</td>"
|
||||
"</tr>"
|
||||
"<tr height=3 valign=center>"
|
||||
"<td valign=center bgcolor=#cc3300></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td align=justify>"
|
||||
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
|
||||
"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
|
||||
"In addition to the basic codec, various other features are under development.</font></p><br>"
|
||||
"<font size=-2 color=red>* Build: ")
|
||||
#include "build.h"
|
||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
||||
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
|
||||
#ifdef USE_JPWL
|
||||
wxT("<font size=-2 color=green>JPWL</font> ")
|
||||
#endif // USE_JPWL
|
||||
#ifdef USE_JPSEC
|
||||
wxT("<font size=-2 color=green>JPSEC</font> ")
|
||||
#endif // USE_JPSEC
|
||||
wxT(")</font><br>")
|
||||
#ifdef USE_MXF
|
||||
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
||||
#endif // USE_MXF
|
||||
wxT("</td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td colspan=2>"
|
||||
"<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
|
||||
"<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
|
||||
"</td>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
"</body>"
|
||||
"</html>"
|
||||
);
|
|
@ -0,0 +1 @@
|
|||
wxT("491")
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagalljpeg2000.h
|
||||
// Purpose: wxImage JPEG 2000 family file format handler
|
||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGJPEG2000_H_
|
||||
#define _WX_IMAGJPEG2000_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJPEG2000Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
#include "codec/index.h"
|
||||
|
||||
#define wxBITMAP_TYPE_JPEG2000 50
|
||||
|
||||
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxJPEG2000Handler()
|
||||
{
|
||||
m_name = wxT("JPEG 2000 family file format");
|
||||
m_extension = wxT("mj2");
|
||||
m_type = wxBITMAP_TYPE_JPEG2000;
|
||||
m_mime = wxT("image/mj2");
|
||||
|
||||
/* decoding */
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
|
||||
/* encoding */
|
||||
m_subsampling = wxT("1,1");
|
||||
m_origin = wxT("0,0");
|
||||
m_rates = wxT("20,10,5");
|
||||
m_quality = wxT("30,35,40");
|
||||
m_enablequality = false;
|
||||
m_multicomp = false;
|
||||
m_irreversible = false;
|
||||
m_resolutions = 6;
|
||||
m_progression = 0;
|
||||
m_cbsize = wxT("32,32");
|
||||
m_prsize = wxT("[128,128],[128,128]");
|
||||
m_tsize = wxT("");
|
||||
m_torigin = wxT("0,0");
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
m_enablesop = false;
|
||||
m_enableeph = false;
|
||||
m_enablereset = false;
|
||||
m_enablesegmark = false;
|
||||
m_enablevsc = false;
|
||||
m_enablerestart = false;
|
||||
m_enableerterm = false;
|
||||
m_enablebypass = false;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
m_enableidx = false;
|
||||
m_index = wxT("index.txt");
|
||||
m_enablepoc = false;
|
||||
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
||||
m_enablecomm = true;
|
||||
|
||||
#if defined __WXMSW__
|
||||
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
||||
#elif defined __WXGTK__
|
||||
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
||||
#else
|
||||
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling;
|
||||
wxString m_origin;
|
||||
wxString m_rates;
|
||||
wxString m_quality;
|
||||
bool m_enablequality;
|
||||
bool m_multicomp;
|
||||
bool m_irreversible;
|
||||
int m_resolutions;
|
||||
int m_progression;
|
||||
wxString m_cbsize;
|
||||
wxString m_prsize;
|
||||
wxString m_tsize;
|
||||
wxString m_torigin;
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
bool m_enablesop;
|
||||
bool m_enableeph;
|
||||
bool m_enablebypass;
|
||||
bool m_enableerterm;
|
||||
bool m_enablerestart;
|
||||
bool m_enablereset;
|
||||
bool m_enablesegmark;
|
||||
bool m_enablevsc;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
bool m_enableidx;
|
||||
wxString m_index;
|
||||
bool m_enablecomm;
|
||||
wxString m_comment;
|
||||
bool m_enablepoc;
|
||||
wxString m_poc;
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
|
||||
protected:
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif
|
||||
|
||||
private:
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]);
|
||||
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGJPEG2000_H_
|
||||
|
|
@ -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) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
|
@ -1,10 +1,5 @@
|
|||
/*
|
||||
* 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) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -54,7 +49,7 @@
|
|||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_MXF 51
|
||||
#define wxBITMAP_TYPE_MXF 51
|
||||
|
||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||
{
|
||||
|
@ -66,32 +61,30 @@ public:
|
|||
m_type = wxBITMAP_TYPE_MXF;
|
||||
m_mime = wxT("image/mxf");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
m_filename = wxT("");
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
m_filename = wxT("");
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
wxFileName m_filename;
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
wxFileName m_filename;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream,
|
||||
bool verbose = true, int index = -1);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
|
||||
bool verbose = true);
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
|
@ -1,5 +1,5 @@
|
|||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
|
@ -8,4 +8,4 @@ Anybody. As the OpenJPEG library is released under the BSD license, anybody can
|
|||
|
||||
Who is developing the library ?
|
||||
===============================
|
||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developed and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
|
@ -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) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
|
@ -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) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
|
@ -0,0 +1,120 @@
|
|||
# Build the demo app, small examples
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
convert.c
|
||||
converttif.c
|
||||
convertbmp.c
|
||||
convertpng.c
|
||||
index.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||
)
|
||||
if(NOT USE_SYSTEM_GETOPT)
|
||||
list(APPEND common_SRCS
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||
)
|
||||
endif()
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${LCMS_INCLUDE_DIRNAME}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common
|
||||
${Z_INCLUDE_DIRNAME}
|
||||
${PNG_INCLUDE_DIRNAME}
|
||||
${TIFF_INCLUDE_DIRNAME}
|
||||
)
|
||||
|
||||
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 j2k_to_image image_to_j2k j2k_dump)
|
||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}
|
||||
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
|
||||
)
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(${exe} z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
# 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 OpenJPEGTargets
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
ENDFOREACH(exe)
|
||||
|
||||
# Install man pages
|
||||
INSTALL(
|
||||
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/image_to_j2k.1
|
||||
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_dump.1
|
||||
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_to_image.1
|
||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
|
||||
#
|
||||
|
||||
IF(BUILD_JPWL)
|
||||
ADD_EXECUTABLE(JPWL_j2k_to_image
|
||||
j2k_to_image.c
|
||||
${common_SRCS}
|
||||
)
|
||||
|
||||
SET_PROPERTY(
|
||||
TARGET JPWL_j2k_to_image
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
|
||||
ENDIF(UNIX)
|
||||
|
||||
ADD_EXECUTABLE(JPWL_image_to_j2k
|
||||
image_to_j2k.c
|
||||
${common_SRCS}
|
||||
)
|
||||
|
||||
SET_PROPERTY(
|
||||
TARGET JPWL_image_to_j2k
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
|
||||
ENDIF(UNIX)
|
||||
|
||||
INSTALL(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
ENDIF(BUILD_JPWL)
|
|
@ -0,0 +1,118 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = j2k_to_image image_to_j2k j2k_dump
|
||||
|
||||
if WANT_JPWL
|
||||
bin_PROGRAMS += JPWL_j2k_to_image JPWL_image_to_j2k
|
||||
endif
|
||||
|
||||
j2k_to_image_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
@PNG_CFLAGS@ \
|
||||
@TIFF_CFLAGS@ \
|
||||
@LCMS1_CFLAGS@ \
|
||||
@LCMS2_CFLAGS@
|
||||
j2k_to_image_CFLAGS =
|
||||
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
j2k_to_image.c \
|
||||
../common/color.h
|
||||
|
||||
image_to_j2k_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
@PNG_CFLAGS@ \
|
||||
@TIFF_CFLAGS@
|
||||
image_to_j2k_CFLAGS =
|
||||
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
image_to_j2k_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
image_to_j2k.c \
|
||||
convert.h \
|
||||
../common/format_defs.h \
|
||||
index.h
|
||||
|
||||
j2k_dump_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg
|
||||
j2k_dump_CFLAGS =
|
||||
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||
j2k_dump_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
j2k_dump.c \
|
||||
../common/opj_getopt.h \
|
||||
index.h
|
||||
|
||||
JPWL_j2k_to_image_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
-DUSE_JPWL \
|
||||
@TIFF_CFLAGS@ \
|
||||
@PNG_CFLAGS@ \
|
||||
@LCMS1_CFLAGS@ \
|
||||
@LCMS2_CFLAGS@
|
||||
JPWL_j2k_to_image_CFLAGS =
|
||||
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
JPWL_j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
j2k_to_image.c
|
||||
|
||||
JPWL_image_to_j2k_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
-DUSE_JPWL \
|
||||
@TIFF_CFLAGS@ \
|
||||
@PNG_CFLAGS@
|
||||
JPWL_image_to_j2k_CFLAGS =
|
||||
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
|
||||
JPWL_image_to_j2k_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
image_to_j2k.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
windirent.h
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/j2k_dump$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
if WANT_JPWL
|
||||
@echo -e " (B)\t$(bindir)/JPWL_j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/JPWL_image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
endif
|
|
@ -0,0 +1,8 @@
|
|||
Simple codec compilation
|
||||
------------------------
|
||||
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and either use the provided Makefile or use one of the following commands to build an encoder and decoder respectively:
|
||||
|
||||
gcc index.c convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc index.c convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
You should add '-L..' to those lines if you did not use the 'install' target when building the library.
|
|
@ -1,15 +1,9 @@
|
|||
/*
|
||||
* 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) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -37,55 +31,37 @@
|
|||
#ifndef __J2K_CONVERT_H
|
||||
#define __J2K_CONVERT_H
|
||||
|
||||
/**@name RAW component encoding parameters */
|
||||
/*@{*/
|
||||
typedef struct raw_comp_cparameters {
|
||||
/** subsampling in X direction */
|
||||
int dx;
|
||||
/** subsampling in Y direction */
|
||||
int dy;
|
||||
/*@}*/
|
||||
} raw_comp_cparameters_t;
|
||||
|
||||
/**@name RAW image encoding parameters */
|
||||
/*@{*/
|
||||
typedef struct raw_cparameters {
|
||||
/** width of the raw image */
|
||||
int rawWidth;
|
||||
/** height of the raw image */
|
||||
int rawHeight;
|
||||
/** number of components of the raw image */
|
||||
int rawComp;
|
||||
/** bit depth of the raw image */
|
||||
int rawBitDepth;
|
||||
/** signed/unsigned raw image */
|
||||
OPJ_BOOL rawSigned;
|
||||
/** raw components parameters */
|
||||
raw_comp_cparameters_t *rawComps;
|
||||
/*@}*/
|
||||
/** width of the raw image */
|
||||
int rawWidth;
|
||||
/** height of the raw image */
|
||||
int rawHeight;
|
||||
/** components of the raw image */
|
||||
int rawComp;
|
||||
/** bit depth of the raw image */
|
||||
int rawBitDepth;
|
||||
/** signed/unsigned raw image */
|
||||
opj_bool rawSigned;
|
||||
/*@}*/
|
||||
} raw_cparameters_t;
|
||||
|
||||
/* Component precision clipping */
|
||||
void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
||||
/* Component precision scaling */
|
||||
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
||||
void clip_component(opj_image_comp_t* component, int precision);
|
||||
void scale_component(opj_image_comp_t* component, int precision);
|
||||
|
||||
/* planar / interleaved conversions */
|
||||
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst,
|
||||
OPJ_SIZE_T length);
|
||||
typedef void (* convert_32s_CXPX)(const int* pSrc, int* const* pDst, size_t length);
|
||||
extern const convert_32s_CXPX convert_32s_CXPX_LUT[5];
|
||||
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst,
|
||||
OPJ_SIZE_T length, OPJ_INT32 adjust);
|
||||
typedef void (* convert_32s_PXCX)(int const* const* pSrc, int* pDst, size_t length, int adjust);
|
||||
extern const convert_32s_PXCX convert_32s_PXCX_LUT[5];
|
||||
/* bit depth conversions */
|
||||
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst,
|
||||
OPJ_SIZE_T length);
|
||||
typedef void (* convert_XXx32s_C1R)(const unsigned char* pSrc, int* pDst, size_t length);
|
||||
extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */
|
||||
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst,
|
||||
OPJ_SIZE_T length);
|
||||
typedef void (* convert_32sXXx_C1R)(const int* pSrc, unsigned char* pDst, size_t length);
|
||||
extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */
|
||||
|
||||
|
||||
/* TGA conversion */
|
||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetotga(opj_image_t * image, const char *outfile);
|
||||
|
@ -95,8 +71,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters);
|
|||
int imagetobmp(opj_image_t *image, const char *outfile);
|
||||
|
||||
/* TIFF conversion*/
|
||||
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters,
|
||||
const unsigned int target_bitdepth);
|
||||
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetotif(opj_image_t *image, const char *outfile);
|
||||
/**
|
||||
Load a single image component encoded in PGX file format
|
||||
|
@ -108,20 +83,15 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters);
|
|||
int imagetopgx(opj_image_t *image, const char *outfile);
|
||||
|
||||
opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetopnm(opj_image_t *image, const char *outfile, int force_split);
|
||||
int imagetopnm(opj_image_t *image, const char *outfile);
|
||||
|
||||
/* RAW conversion */
|
||||
int imagetoraw(opj_image_t * image, const char *outfile);
|
||||
int imagetorawl(opj_image_t * image, const char *outfile);
|
||||
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters,
|
||||
raw_cparameters_t *raw_cp);
|
||||
opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters,
|
||||
raw_cparameters_t *raw_cp);
|
||||
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
|
||||
|
||||
/* PNG conversion*/
|
||||
extern int imagetopng(opj_image_t *image, const char *write_idf);
|
||||
extern opj_image_t* pngtoimage(const char *filename,
|
||||
opj_cparameters_t *parameters);
|
||||
extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
|
||||
#endif /* __J2K_CONVERT_H */
|
||||
|
|
@ -0,0 +1,995 @@
|
|||
/*
|
||||
* 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
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* 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_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#error unsupported platform
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint16_t bfType; /* 'BM' for Bitmap (19776) */
|
||||
uint32_t bfSize; /* Size of the file */
|
||||
uint16_t bfReserved1; /* Reserved : 0 */
|
||||
uint16_t bfReserved2; /* Reserved : 0 */
|
||||
uint32_t bfOffBits; /* Offset */
|
||||
} OPJ_BITMAPFILEHEADER;
|
||||
|
||||
typedef struct {
|
||||
uint32_t biSize; /* Size of the structure in bytes */
|
||||
uint32_t biWidth; /* Width of the image in pixels */
|
||||
uint32_t biHeight; /* Heigth of the image in pixels */
|
||||
uint16_t biPlanes; /* 1 */
|
||||
uint16_t biBitCount; /* Number of color bits by pixels */
|
||||
uint32_t biCompression; /* Type of encoding 0: none 1: RLE8 2: RLE4 */
|
||||
uint32_t biSizeImage; /* Size of the image in bytes */
|
||||
uint32_t biXpelsPerMeter; /* Horizontal (X) resolution in pixels/meter */
|
||||
uint32_t biYpelsPerMeter; /* Vertical (Y) resolution in pixels/meter */
|
||||
uint32_t biClrUsed; /* Number of color used in the image (0: ALL) */
|
||||
uint32_t biClrImportant; /* Number of important color (0: ALL) */
|
||||
uint32_t biRedMask; /* Red channel bit mask */
|
||||
uint32_t biGreenMask; /* Green channel bit mask */
|
||||
uint32_t biBlueMask; /* Blue channel bit mask */
|
||||
uint32_t biAlphaMask; /* Alpha channel bit mask */
|
||||
uint32_t biColorSpaceType; /* Color space type */
|
||||
uint8_t biColorSpaceEP[36]; /* Color space end points */
|
||||
uint32_t biRedGamma; /* Red channel gamma */
|
||||
uint32_t biGreenGamma; /* Green channel gamma */
|
||||
uint32_t biBlueGamma; /* Blue channel gamma */
|
||||
uint32_t biIntent; /* Intent */
|
||||
uint32_t biIccProfileData; /* ICC profile data */
|
||||
uint32_t biIccProfileSize; /* ICC profile size */
|
||||
uint32_t biReserved; /* Reserved */
|
||||
} OPJ_BITMAPINFOHEADER;
|
||||
|
||||
static void opj_applyLUT8u_8u32s_C1R(
|
||||
uint8_t const* pSrc, int32_t srcStride,
|
||||
int32_t* pDst, int32_t dstStride,
|
||||
uint8_t const* pLUT,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
uint32_t y;
|
||||
|
||||
for (y = height; y != 0U; --y) {
|
||||
uint32_t x;
|
||||
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
pDst[x] = (int32_t)pLUT[pSrc[x]];
|
||||
}
|
||||
pSrc += srcStride;
|
||||
pDst += dstStride;
|
||||
}
|
||||
}
|
||||
|
||||
static void opj_applyLUT8u_8u32s_C1P3R(
|
||||
uint8_t const* pSrc, int32_t srcStride,
|
||||
int32_t* const* pDst, int32_t const* pDstStride,
|
||||
uint8_t const* const* pLUT,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
uint32_t y;
|
||||
int32_t* pR = pDst[0];
|
||||
int32_t* pG = pDst[1];
|
||||
int32_t* pB = pDst[2];
|
||||
uint8_t const* pLUT_R = pLUT[0];
|
||||
uint8_t const* pLUT_G = pLUT[1];
|
||||
uint8_t const* pLUT_B = pLUT[2];
|
||||
|
||||
for (y = height; y != 0U; --y) {
|
||||
uint32_t x;
|
||||
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
uint8_t idx = pSrc[x];
|
||||
pR[x] = (int32_t)pLUT_R[idx];
|
||||
pG[x] = (int32_t)pLUT_G[idx];
|
||||
pB[x] = (int32_t)pLUT_B[idx];
|
||||
}
|
||||
pSrc += srcStride;
|
||||
pR += pDstStride[0];
|
||||
pG += pDstStride[1];
|
||||
pB += pDstStride[2];
|
||||
}
|
||||
}
|
||||
|
||||
static void bmp24toimage(const uint8_t* pData, uint32_t stride, opj_image_t* image)
|
||||
{
|
||||
int index;
|
||||
uint32_t width, height;
|
||||
uint32_t x, y;
|
||||
const uint8_t *pSrc = NULL;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
image->comps[0].data[index] = (int32_t)pSrc[3*x+2]; /* R */
|
||||
image->comps[1].data[index] = (int32_t)pSrc[3*x+1]; /* G */
|
||||
image->comps[2].data[index] = (int32_t)pSrc[3*x+0]; /* B */
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void bmp_mask_get_shift_and_prec(uint32_t mask, uint32_t* shift, uint32_t* prec)
|
||||
{
|
||||
uint32_t l_shift, l_prec;
|
||||
|
||||
l_shift = l_prec = 0U;
|
||||
|
||||
if (mask != 0U) {
|
||||
while ((mask & 1U) == 0U) {
|
||||
mask >>= 1;
|
||||
l_shift++;
|
||||
}
|
||||
while (mask & 1U) {
|
||||
mask >>= 1;
|
||||
l_prec++;
|
||||
}
|
||||
}
|
||||
*shift = l_shift; *prec = l_prec;
|
||||
}
|
||||
|
||||
static void bmpmask32toimage(const uint8_t* pData, uint32_t stride, opj_image_t* image, uint32_t redMask, uint32_t greenMask, uint32_t blueMask, uint32_t alphaMask)
|
||||
{
|
||||
int index;
|
||||
uint32_t width, height;
|
||||
uint32_t x, y;
|
||||
const uint8_t *pSrc = NULL;
|
||||
opj_bool hasAlpha = OPJ_FALSE;
|
||||
uint32_t redShift, redPrec;
|
||||
uint32_t greenShift, greenPrec;
|
||||
uint32_t blueShift, bluePrec;
|
||||
uint32_t alphaShift, alphaPrec;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
hasAlpha = image->numcomps > 3U;
|
||||
|
||||
bmp_mask_get_shift_and_prec(redMask, &redShift, &redPrec);
|
||||
bmp_mask_get_shift_and_prec(greenMask, &greenShift, &greenPrec);
|
||||
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
|
||||
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
|
||||
|
||||
image->comps[0].bpp = redPrec;
|
||||
image->comps[0].prec = redPrec;
|
||||
image->comps[1].bpp = greenPrec;
|
||||
image->comps[1].prec = greenPrec;
|
||||
image->comps[2].bpp = bluePrec;
|
||||
image->comps[2].prec = bluePrec;
|
||||
if (hasAlpha) {
|
||||
image->comps[3].bpp = alphaPrec;
|
||||
image->comps[3].prec = alphaPrec;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
uint32_t value = 0U;
|
||||
|
||||
value |= ((uint32_t)pSrc[4*x+0]) << 0;
|
||||
value |= ((uint32_t)pSrc[4*x+1]) << 8;
|
||||
value |= ((uint32_t)pSrc[4*x+2]) << 16;
|
||||
value |= ((uint32_t)pSrc[4*x+3]) << 24;
|
||||
|
||||
image->comps[0].data[index] = (int32_t)((value & redMask) >> redShift); /* R */
|
||||
image->comps[1].data[index] = (int32_t)((value & greenMask) >> greenShift); /* G */
|
||||
image->comps[2].data[index] = (int32_t)((value & blueMask) >> blueShift); /* B */
|
||||
if (hasAlpha) {
|
||||
image->comps[3].data[index] = (int32_t)((value & alphaMask) >> alphaShift); /* A */
|
||||
}
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void bmpmask16toimage(const uint8_t* pData, uint32_t stride, opj_image_t* image, uint32_t redMask, uint32_t greenMask, uint32_t blueMask, uint32_t alphaMask)
|
||||
{
|
||||
int index;
|
||||
uint32_t width, height;
|
||||
uint32_t x, y;
|
||||
const uint8_t *pSrc = NULL;
|
||||
opj_bool hasAlpha = OPJ_FALSE;
|
||||
uint32_t redShift, redPrec;
|
||||
uint32_t greenShift, greenPrec;
|
||||
uint32_t blueShift, bluePrec;
|
||||
uint32_t alphaShift, alphaPrec;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
hasAlpha = image->numcomps > 3U;
|
||||
|
||||
bmp_mask_get_shift_and_prec(redMask, &redShift, &redPrec);
|
||||
bmp_mask_get_shift_and_prec(greenMask, &greenShift, &greenPrec);
|
||||
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
|
||||
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
|
||||
|
||||
image->comps[0].bpp = redPrec;
|
||||
image->comps[0].prec = redPrec;
|
||||
image->comps[1].bpp = greenPrec;
|
||||
image->comps[1].prec = greenPrec;
|
||||
image->comps[2].bpp = bluePrec;
|
||||
image->comps[2].prec = bluePrec;
|
||||
if (hasAlpha) {
|
||||
image->comps[3].bpp = alphaPrec;
|
||||
image->comps[3].prec = alphaPrec;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
uint32_t value = 0U;
|
||||
|
||||
value |= ((uint32_t)pSrc[2*x+0]) << 0;
|
||||
value |= ((uint32_t)pSrc[2*x+1]) << 8;
|
||||
|
||||
image->comps[0].data[index] = (int32_t)((value & redMask) >> redShift); /* R */
|
||||
image->comps[1].data[index] = (int32_t)((value & greenMask) >> greenShift); /* G */
|
||||
image->comps[2].data[index] = (int32_t)((value & blueMask) >> blueShift); /* B */
|
||||
if (hasAlpha) {
|
||||
image->comps[3].data[index] = (int32_t)((value & alphaMask) >> alphaShift); /* A */
|
||||
}
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static opj_image_t* bmp8toimage(const uint8_t* pData, uint32_t stride, opj_image_t* image, uint8_t const* const* pLUT)
|
||||
{
|
||||
uint32_t width, height;
|
||||
const uint8_t *pSrc = NULL;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
if (image->numcomps == 1U) {
|
||||
opj_applyLUT8u_8u32s_C1R(pSrc, -(int32_t)stride, image->comps[0].data, (int32_t)width, pLUT[0], width, height);
|
||||
}
|
||||
else {
|
||||
int32_t* pDst[3];
|
||||
int32_t pDstStride[3];
|
||||
|
||||
pDst[0] = image->comps[0].data; pDst[1] = image->comps[1].data; pDst[2] = image->comps[2].data;
|
||||
pDstStride[0] = (int32_t)width; pDstStride[1] = (int32_t)width; pDstStride[2] = (int32_t)width;
|
||||
opj_applyLUT8u_8u32s_C1P3R(pSrc, -(int32_t)stride, pDst, pDstStride, pLUT, width, height);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
static opj_bool bmp_read_file_header(FILE* IN, OPJ_BITMAPFILEHEADER* header)
|
||||
{
|
||||
header->bfType = (uint16_t)getc(IN);
|
||||
header->bfType |= (uint16_t)((uint32_t)getc(IN) << 8);
|
||||
|
||||
if (header->bfType != 19778) {
|
||||
fprintf(stderr,"Error, not a BMP file!\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
header->bfSize = (uint32_t)getc(IN);
|
||||
header->bfSize |= (uint32_t)getc(IN) << 8;
|
||||
header->bfSize |= (uint32_t)getc(IN) << 16;
|
||||
header->bfSize |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->bfReserved1 = (uint16_t)getc(IN);
|
||||
header->bfReserved1 |= (uint16_t)((uint32_t)getc(IN) << 8);
|
||||
|
||||
header->bfReserved2 = (uint16_t)getc(IN);
|
||||
header->bfReserved2 |= (uint16_t)((uint32_t)getc(IN) << 8);
|
||||
|
||||
header->bfOffBits = (uint32_t)getc(IN);
|
||||
header->bfOffBits |= (uint32_t)getc(IN) << 8;
|
||||
header->bfOffBits |= (uint32_t)getc(IN) << 16;
|
||||
header->bfOffBits |= (uint32_t)getc(IN) << 24;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
static opj_bool bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
|
||||
{
|
||||
memset(header, 0, sizeof(*header));
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
header->biSize = (uint32_t)getc(IN);
|
||||
header->biSize |= (uint32_t)getc(IN) << 8;
|
||||
header->biSize |= (uint32_t)getc(IN) << 16;
|
||||
header->biSize |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
switch (header->biSize) {
|
||||
case 12U: /* BITMAPCOREHEADER */
|
||||
case 40U: /* BITMAPINFOHEADER */
|
||||
case 52U: /* BITMAPV2INFOHEADER */
|
||||
case 56U: /* BITMAPV3INFOHEADER */
|
||||
case 108U: /* BITMAPV4HEADER */
|
||||
case 124U: /* BITMAPV5HEADER */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Error, unknown BMP header size %d\n", header->biSize);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
header->biWidth = (uint32_t)getc(IN);
|
||||
header->biWidth |= (uint32_t)getc(IN) << 8;
|
||||
header->biWidth |= (uint32_t)getc(IN) << 16;
|
||||
header->biWidth |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biHeight = (uint32_t)getc(IN);
|
||||
header->biHeight |= (uint32_t)getc(IN) << 8;
|
||||
header->biHeight |= (uint32_t)getc(IN) << 16;
|
||||
header->biHeight |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biPlanes = (uint16_t)getc(IN);
|
||||
header->biPlanes |= (uint16_t)((uint32_t)getc(IN) << 8);
|
||||
|
||||
header->biBitCount = (uint16_t)getc(IN);
|
||||
header->biBitCount |= (uint16_t)((uint32_t)getc(IN) << 8);
|
||||
|
||||
if(header->biSize >= 40U) {
|
||||
header->biCompression = (uint32_t)getc(IN);
|
||||
header->biCompression |= (uint32_t)getc(IN) << 8;
|
||||
header->biCompression |= (uint32_t)getc(IN) << 16;
|
||||
header->biCompression |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biSizeImage = (uint32_t)getc(IN);
|
||||
header->biSizeImage |= (uint32_t)getc(IN) << 8;
|
||||
header->biSizeImage |= (uint32_t)getc(IN) << 16;
|
||||
header->biSizeImage |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biXpelsPerMeter = (uint32_t)getc(IN);
|
||||
header->biXpelsPerMeter |= (uint32_t)getc(IN) << 8;
|
||||
header->biXpelsPerMeter |= (uint32_t)getc(IN) << 16;
|
||||
header->biXpelsPerMeter |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biYpelsPerMeter = (uint32_t)getc(IN);
|
||||
header->biYpelsPerMeter |= (uint32_t)getc(IN) << 8;
|
||||
header->biYpelsPerMeter |= (uint32_t)getc(IN) << 16;
|
||||
header->biYpelsPerMeter |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biClrUsed = (uint32_t)getc(IN);
|
||||
header->biClrUsed |= (uint32_t)getc(IN) << 8;
|
||||
header->biClrUsed |= (uint32_t)getc(IN) << 16;
|
||||
header->biClrUsed |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biClrImportant = (uint32_t)getc(IN);
|
||||
header->biClrImportant |= (uint32_t)getc(IN) << 8;
|
||||
header->biClrImportant |= (uint32_t)getc(IN) << 16;
|
||||
header->biClrImportant |= (uint32_t)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 56U) {
|
||||
header->biRedMask = (uint32_t)getc(IN);
|
||||
header->biRedMask |= (uint32_t)getc(IN) << 8;
|
||||
header->biRedMask |= (uint32_t)getc(IN) << 16;
|
||||
header->biRedMask |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biGreenMask = (uint32_t)getc(IN);
|
||||
header->biGreenMask |= (uint32_t)getc(IN) << 8;
|
||||
header->biGreenMask |= (uint32_t)getc(IN) << 16;
|
||||
header->biGreenMask |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biBlueMask = (uint32_t)getc(IN);
|
||||
header->biBlueMask |= (uint32_t)getc(IN) << 8;
|
||||
header->biBlueMask |= (uint32_t)getc(IN) << 16;
|
||||
header->biBlueMask |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biAlphaMask = (uint32_t)getc(IN);
|
||||
header->biAlphaMask |= (uint32_t)getc(IN) << 8;
|
||||
header->biAlphaMask |= (uint32_t)getc(IN) << 16;
|
||||
header->biAlphaMask |= (uint32_t)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 108U) {
|
||||
header->biColorSpaceType = (uint32_t)getc(IN);
|
||||
header->biColorSpaceType |= (uint32_t)getc(IN) << 8;
|
||||
header->biColorSpaceType |= (uint32_t)getc(IN) << 16;
|
||||
header->biColorSpaceType |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
if (fread(&(header->biColorSpaceEP), 1U, sizeof(header->biColorSpaceEP), IN) != sizeof(header->biColorSpaceEP)) {
|
||||
fprintf(stderr,"Error, can't read BMP header\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
header->biRedGamma = (uint32_t)getc(IN);
|
||||
header->biRedGamma |= (uint32_t)getc(IN) << 8;
|
||||
header->biRedGamma |= (uint32_t)getc(IN) << 16;
|
||||
header->biRedGamma |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biGreenGamma = (uint32_t)getc(IN);
|
||||
header->biGreenGamma |= (uint32_t)getc(IN) << 8;
|
||||
header->biGreenGamma |= (uint32_t)getc(IN) << 16;
|
||||
header->biGreenGamma |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biBlueGamma = (uint32_t)getc(IN);
|
||||
header->biBlueGamma |= (uint32_t)getc(IN) << 8;
|
||||
header->biBlueGamma |= (uint32_t)getc(IN) << 16;
|
||||
header->biBlueGamma |= (uint32_t)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 124U) {
|
||||
header->biIntent = (uint32_t)getc(IN);
|
||||
header->biIntent |= (uint32_t)getc(IN) << 8;
|
||||
header->biIntent |= (uint32_t)getc(IN) << 16;
|
||||
header->biIntent |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biIccProfileData = (uint32_t)getc(IN);
|
||||
header->biIccProfileData |= (uint32_t)getc(IN) << 8;
|
||||
header->biIccProfileData |= (uint32_t)getc(IN) << 16;
|
||||
header->biIccProfileData |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biIccProfileSize = (uint32_t)getc(IN);
|
||||
header->biIccProfileSize |= (uint32_t)getc(IN) << 8;
|
||||
header->biIccProfileSize |= (uint32_t)getc(IN) << 16;
|
||||
header->biIccProfileSize |= (uint32_t)getc(IN) << 24;
|
||||
|
||||
header->biReserved = (uint32_t)getc(IN);
|
||||
header->biReserved |= (uint32_t)getc(IN) << 8;
|
||||
header->biReserved |= (uint32_t)getc(IN) << 16;
|
||||
header->biReserved |= (uint32_t)getc(IN) << 24;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static opj_bool bmp_read_raw_data(FILE* IN, uint8_t* pData, uint32_t stride, uint32_t width, uint32_t height)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(width);
|
||||
|
||||
if ( fread(pData, sizeof(uint8_t), stride * height, IN) != (stride * height) )
|
||||
{
|
||||
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static opj_bool bmp_read_rle8_data(FILE* IN, uint8_t* pData, uint32_t stride, uint32_t width, uint32_t height)
|
||||
{
|
||||
uint32_t x, y;
|
||||
uint8_t *pix;
|
||||
const uint8_t *beyond;
|
||||
|
||||
beyond = pData + stride * height;
|
||||
pix = pData;
|
||||
|
||||
x = y = 0U;
|
||||
while (y < height)
|
||||
{
|
||||
int c = getc(IN);
|
||||
|
||||
if (c) {
|
||||
int j;
|
||||
uint8_t c1 = (uint8_t)getc(IN);
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((size_t)pix < (size_t)beyond); j++, x++, pix++) {
|
||||
*pix = c1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
c = getc(IN);
|
||||
if (c == 0x00) { /* EOL */
|
||||
x = 0;
|
||||
++y;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else if (c == 0x01) { /* EOP */
|
||||
break;
|
||||
}
|
||||
else if (c == 0x02) { /* MOVE by dxdy */
|
||||
c = getc(IN);
|
||||
x += (uint32_t)c;
|
||||
c = getc(IN);
|
||||
y += (uint32_t)c;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else /* 03 .. 255 */
|
||||
{
|
||||
int j;
|
||||
for (j = 0; (j < c) && (x < width) && ((size_t)pix < (size_t)beyond); j++, x++, pix++)
|
||||
{
|
||||
uint8_t c1 = (uint8_t)getc(IN);
|
||||
*pix = c1;
|
||||
}
|
||||
if ((uint32_t)c & 1U) { /* skip padding byte */
|
||||
getc(IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}/* while() */
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static opj_bool bmp_read_rle4_data(FILE* IN, uint8_t* pData, uint32_t stride, uint32_t width, uint32_t height)
|
||||
{
|
||||
uint32_t x, y;
|
||||
uint8_t *pix;
|
||||
const uint8_t *beyond;
|
||||
|
||||
beyond = pData + stride * height;
|
||||
pix = pData;
|
||||
x = y = 0U;
|
||||
while(y < height)
|
||||
{
|
||||
int c = getc(IN);
|
||||
if(c == EOF) break;
|
||||
|
||||
if(c) {/* encoded mode */
|
||||
int j;
|
||||
uint8_t c1 = (uint8_t)getc(IN);
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((size_t)pix < (size_t)beyond); j++, x++, pix++) {
|
||||
*pix = (uint8_t)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
|
||||
}
|
||||
}
|
||||
else { /* absolute mode */
|
||||
c = getc(IN);
|
||||
if(c == EOF) break;
|
||||
|
||||
if(c == 0x00) { /* EOL */
|
||||
x = 0; y++; pix = pData + y * stride;
|
||||
}
|
||||
else if(c == 0x01) { /* EOP */
|
||||
break;
|
||||
}
|
||||
else if(c == 0x02) { /* MOVE by dxdy */
|
||||
c = getc(IN); x += (uint32_t)c;
|
||||
c = getc(IN); y += (uint32_t)c;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else { /* 03 .. 255 : absolute mode */
|
||||
int j;
|
||||
uint8_t c1 = 0U;
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((size_t)pix < (size_t)beyond); j++, x++, pix++) {
|
||||
if((j&1) == 0) {
|
||||
c1 = (uint8_t)getc(IN);
|
||||
}
|
||||
*pix = (uint8_t)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
|
||||
}
|
||||
if(((c&3) == 1) || ((c&3) == 2)) { /* skip padding byte */
|
||||
getc(IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* while(y < height) */
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
{
|
||||
opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
|
||||
uint8_t lut_R[256], lut_G[256], lut_B[256];
|
||||
uint8_t const* pLUT[3];
|
||||
opj_image_t * image = NULL;
|
||||
FILE *IN;
|
||||
OPJ_BITMAPFILEHEADER File_h;
|
||||
OPJ_BITMAPINFOHEADER Info_h;
|
||||
uint32_t i, palette_len, numcmpts = 1U;
|
||||
opj_bool l_result = OPJ_FALSE;
|
||||
uint8_t* pData = NULL;
|
||||
uint32_t stride;
|
||||
|
||||
pLUT[0] = lut_R; pLUT[1] = lut_G; pLUT[2] = lut_B;
|
||||
|
||||
IN = fopen(filename, "rb");
|
||||
if (!IN)
|
||||
{
|
||||
fprintf(stderr, "Failed to open %s for reading !!\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!bmp_read_file_header(IN, &File_h)) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
if (!bmp_read_info_header(IN, &Info_h)) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Load palette */
|
||||
if (Info_h.biBitCount <= 8U)
|
||||
{
|
||||
memset(&lut_R[0], 0, sizeof(lut_R));
|
||||
memset(&lut_G[0], 0, sizeof(lut_G));
|
||||
memset(&lut_B[0], 0, sizeof(lut_B));
|
||||
|
||||
palette_len = Info_h.biClrUsed;
|
||||
if((palette_len == 0U) && (Info_h.biBitCount <= 8U)) {
|
||||
palette_len = (1U << Info_h.biBitCount);
|
||||
}
|
||||
if (palette_len > 256U) {
|
||||
palette_len = 256U;
|
||||
}
|
||||
if (palette_len > 0U) {
|
||||
uint8_t has_color = 0U;
|
||||
for (i = 0U; i < palette_len; i++) {
|
||||
lut_B[i] = (uint8_t)getc(IN);
|
||||
lut_G[i] = (uint8_t)getc(IN);
|
||||
lut_R[i] = (uint8_t)getc(IN);
|
||||
(void)getc(IN); /* padding */
|
||||
has_color |= (lut_B[i] ^ lut_G[i]) | (lut_G[i] ^ lut_R[i]);
|
||||
}
|
||||
if(has_color) {
|
||||
numcmpts = 3U;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
numcmpts = 3U;
|
||||
if ((Info_h.biCompression == 3) && (Info_h.biAlphaMask != 0U)) {
|
||||
numcmpts++;
|
||||
}
|
||||
}
|
||||
|
||||
stride = ((Info_h.biWidth * Info_h.biBitCount + 31U) / 32U) * 4U; /* rows are aligned on 32bits */
|
||||
if (Info_h.biBitCount == 4 && Info_h.biCompression == 2) { /* RLE 4 gets decoded as 8 bits data for now... */
|
||||
stride = ((Info_h.biWidth * 8U + 31U) / 32U) * 4U;
|
||||
}
|
||||
pData = (uint8_t *) calloc(1, stride * Info_h.biHeight * sizeof(uint8_t));
|
||||
if (pData == NULL) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
/* Place the cursor at the beginning of the image information */
|
||||
fseek(IN, 0, SEEK_SET);
|
||||
fseek(IN, (long)File_h.bfOffBits, SEEK_SET);
|
||||
|
||||
switch (Info_h.biCompression) {
|
||||
case 0:
|
||||
case 3:
|
||||
/* read raw data */
|
||||
l_result = bmp_read_raw_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
case 1:
|
||||
/* read rle8 data */
|
||||
l_result = bmp_read_rle8_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
case 2:
|
||||
/* read rle4 data */
|
||||
l_result = bmp_read_rle4_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unsupported BMP compression\n");
|
||||
l_result = OPJ_FALSE;
|
||||
break;
|
||||
}
|
||||
if (!l_result) {
|
||||
free(pData);
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create the image */
|
||||
memset(&cmptparm[0], 0, sizeof(cmptparm));
|
||||
for(i = 0; i < 4U; i++)
|
||||
{
|
||||
cmptparm[i].prec = 8;
|
||||
cmptparm[i].bpp = 8;
|
||||
cmptparm[i].sgnd = 0;
|
||||
cmptparm[i].dx = parameters->subsampling_dx;
|
||||
cmptparm[i].dy = parameters->subsampling_dy;
|
||||
cmptparm[i].w = Info_h.biWidth;
|
||||
cmptparm[i].h = Info_h.biHeight;
|
||||
}
|
||||
|
||||
image = opj_image_create(numcmpts, &cmptparm[0], (numcmpts == 1U) ? CLRSPC_GRAY : CLRSPC_SRGB);
|
||||
if(!image) {
|
||||
fclose(IN);
|
||||
free(pData);
|
||||
return NULL;
|
||||
}
|
||||
/* if (numcmpts == 4U) {
|
||||
image->comps[3].alpha = 1;
|
||||
} */
|
||||
|
||||
/* set image offset and reference grid */
|
||||
image->x0 = (uint32_t)parameters->image_offset_x0;
|
||||
image->y0 = (uint32_t)parameters->image_offset_y0;
|
||||
image->x1 = image->x0 + (Info_h.biWidth - 1U) * (uint32_t)parameters->subsampling_dx + 1U;
|
||||
image->y1 = image->y0 + (Info_h.biHeight - 1U) * (uint32_t)parameters->subsampling_dy + 1U;
|
||||
|
||||
/* Read the data */
|
||||
if (Info_h.biBitCount == 24 && Info_h.biCompression == 0) { /*RGB */
|
||||
bmp24toimage(pData, stride, image);
|
||||
}
|
||||
else if (Info_h.biBitCount == 8 && Info_h.biCompression == 0) { /* RGB 8bpp Indexed */
|
||||
bmp8toimage(pData, stride, image, pLUT);
|
||||
}
|
||||
else if (Info_h.biBitCount == 8 && Info_h.biCompression == 1) { /*RLE8*/
|
||||
bmp8toimage(pData, stride, image, pLUT);
|
||||
}
|
||||
else if (Info_h.biBitCount == 4 && Info_h.biCompression == 2) { /*RLE4*/
|
||||
bmp8toimage(pData, stride, image, pLUT); /* RLE 4 gets decoded as 8 bits data for now */
|
||||
}
|
||||
else if (Info_h.biBitCount == 32 && Info_h.biCompression == 0) { /* RGBX */
|
||||
bmpmask32toimage(pData, stride, image, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, 0x00000000U);
|
||||
}
|
||||
else if (Info_h.biBitCount == 32 && Info_h.biCompression == 3) { /* bitmask */
|
||||
bmpmask32toimage(pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
|
||||
}
|
||||
else if (Info_h.biBitCount == 16 && Info_h.biCompression == 0) { /* RGBX */
|
||||
bmpmask16toimage(pData, stride, image, 0x7C00U, 0x03E0U, 0x001FU, 0x0000U);
|
||||
}
|
||||
else if (Info_h.biBitCount == 16 && Info_h.biCompression == 3) { /* bitmask */
|
||||
if ((Info_h.biRedMask == 0U) && (Info_h.biGreenMask == 0U) && (Info_h.biBlueMask == 0U)) {
|
||||
Info_h.biRedMask = 0xF800U;
|
||||
Info_h.biGreenMask = 0x07E0U;
|
||||
Info_h.biBlueMask = 0x001FU;
|
||||
}
|
||||
bmpmask16toimage(pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
|
||||
}
|
||||
else {
|
||||
opj_image_destroy(image);
|
||||
image = NULL;
|
||||
fprintf(stderr, "Other system than 24 bits/pixels or 8 bits (no RLE coding) is not yet implemented [%d]\n", Info_h.biBitCount);
|
||||
}
|
||||
free(pData);
|
||||
fclose(IN);
|
||||
return image;
|
||||
}
|
||||
|
||||
int imagetobmp(opj_image_t * image, const char *outfile) {
|
||||
int w, h;
|
||||
int i, pad;
|
||||
FILE *fdest = NULL;
|
||||
int adjustR, adjustG, adjustB;
|
||||
|
||||
if (image->comps[0].prec < 8) {
|
||||
fprintf(stderr, "Unsupported number of components: %d\n", image->comps[0].prec);
|
||||
return 1;
|
||||
}
|
||||
if (image->numcomps >= 3 && image->comps[0].dx == image->comps[1].dx
|
||||
&& image->comps[1].dx == image->comps[2].dx
|
||||
&& image->comps[0].dy == image->comps[1].dy
|
||||
&& image->comps[1].dy == image->comps[2].dy
|
||||
&& image->comps[0].prec == image->comps[1].prec
|
||||
&& image->comps[1].prec == image->comps[2].prec) {
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
24 bits color
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
fdest = fopen(outfile, "wb");
|
||||
if (!fdest) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
w = (int)image->comps[0].w;
|
||||
h = (int)image->comps[0].h;
|
||||
|
||||
fprintf(fdest, "BM");
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c",
|
||||
(uint8_t) (h * w * 3 + 3 * h * (w % 2) + 54) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 8) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 16) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (54) & 0xff, ((54) >> 8) & 0xff,((54) >> 16) & 0xff, ((54) >> 24) & 0xff);
|
||||
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) ((w) & 0xff),
|
||||
(uint8_t) ((w) >> 8) & 0xff,
|
||||
(uint8_t) ((w) >> 16) & 0xff,
|
||||
(uint8_t) ((w) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) ((h) & 0xff),
|
||||
(uint8_t) ((h) >> 8) & 0xff,
|
||||
(uint8_t) ((h) >> 16) & 0xff,
|
||||
(uint8_t) ((h) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c", (24) & 0xff, ((24) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) (3 * h * w + 3 * h * (w % 2)) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2)) >> 8) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2)) >> 16) & 0xff,
|
||||
(uint8_t) ((h * w * 3 + 3 * h * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
|
||||
if (image->comps[0].prec > 8) {
|
||||
adjustR = (int)image->comps[0].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
||||
}
|
||||
else
|
||||
adjustR = 0;
|
||||
if (image->comps[1].prec > 8) {
|
||||
adjustG = (int)image->comps[1].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 1 from %d bits to 8 bits\n", image->comps[1].prec);
|
||||
}
|
||||
else
|
||||
adjustG = 0;
|
||||
if (image->comps[2].prec > 8) {
|
||||
adjustB = (int)image->comps[2].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 2 from %d bits to 8 bits\n", image->comps[2].prec);
|
||||
}
|
||||
else
|
||||
adjustB = 0;
|
||||
|
||||
for (i = 0; i < w * h; i++) {
|
||||
uint8_t rc, gc, bc;
|
||||
int r, g, b;
|
||||
|
||||
r = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
r = ((r >> adjustR)+((r >> (adjustR-1))%2));
|
||||
if(r > 255) r = 255; else if(r < 0) r = 0;
|
||||
rc = (uint8_t)r;
|
||||
|
||||
g = image->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||
g = ((g >> adjustG)+((g >> (adjustG-1))%2));
|
||||
if(g > 255) g = 255; else if(g < 0) g = 0;
|
||||
gc = (uint8_t)g;
|
||||
|
||||
b = image->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
|
||||
b = ((b >> adjustB)+((b >> (adjustB-1))%2));
|
||||
if(b > 255) b = 255; else if(b < 0) b = 0;
|
||||
bc = (uint8_t)b;
|
||||
|
||||
fprintf(fdest, "%c%c%c", bc, gc, rc);
|
||||
|
||||
if ((i + 1) % w == 0) {
|
||||
for (pad = (3 * w) % 4 ? 4 - (3 * w) % 4 : 0; pad > 0; pad--) /* ADD */
|
||||
fprintf(fdest, "%c", 0);
|
||||
}
|
||||
}
|
||||
fclose(fdest);
|
||||
} else { /* Gray-scale */
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
8 bits non code (Gray scale)
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
fdest = fopen(outfile, "wb");
|
||||
if (!fdest) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile);
|
||||
return 1;
|
||||
}
|
||||
w = (int)image->comps[0].w;
|
||||
h = (int)image->comps[0].h;
|
||||
|
||||
fprintf(fdest, "BM");
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) (h * w + 54 + 1024 + h * (w % 2)) & 0xff,
|
||||
(uint8_t) ((h * w + 54 + 1024 + h * (w % 2)) >> 8) & 0xff,
|
||||
(uint8_t) ((h * w + 54 + 1024 + h * (w % 2)) >> 16) & 0xff,
|
||||
(uint8_t) ((h * w + 54 + 1024 + w * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (54 + 1024) & 0xff, ((54 + 1024) >> 8) & 0xff,
|
||||
((54 + 1024) >> 16) & 0xff,
|
||||
((54 + 1024) >> 24) & 0xff);
|
||||
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) ((w) & 0xff),
|
||||
(uint8_t) ((w) >> 8) & 0xff,
|
||||
(uint8_t) ((w) >> 16) & 0xff,
|
||||
(uint8_t) ((w) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) ((h) & 0xff),
|
||||
(uint8_t) ((h) >> 8) & 0xff,
|
||||
(uint8_t) ((h) >> 16) & 0xff,
|
||||
(uint8_t) ((h) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c", (8) & 0xff, ((8) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (uint8_t) (h * w + h * (w % 2)) & 0xff,
|
||||
(uint8_t) ((h * w + h * (w % 2)) >> 8) & 0xff,
|
||||
(uint8_t) ((h * w + h * (w % 2)) >> 16) & 0xff,
|
||||
(uint8_t) ((h * w + h * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
|
||||
|
||||
if (image->comps[0].prec > 8) {
|
||||
adjustR = (int)image->comps[0].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
||||
}else
|
||||
adjustR = 0;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
fprintf(fdest, "%c%c%c%c", i, i, i, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < w * h; i++) {
|
||||
int r;
|
||||
|
||||
r = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
r = ((r >> adjustR)+((r >> (adjustR-1))%2));
|
||||
if(r > 255) r = 255; else if(r < 0) r = 0;
|
||||
|
||||
fprintf(fdest, "%c", (uint8_t)r);
|
||||
|
||||
if ((i + 1) % w == 0) {
|
||||
for (pad = w % 4 ? 4 - w % 4 : 0; pad > 0; pad--) /* ADD */
|
||||
fprintf(fdest, "%c", 0);
|
||||
}
|
||||
}
|
||||
fclose(fdest);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,496 @@
|
|||
/*
|
||||
* 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
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2015, Matthieu Darbois
|
||||
* 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_config.h"
|
||||
|
||||
#ifndef HAVE_LIBPNG
|
||||
# error HAVE_LIBPNG_NOT_DEFINED
|
||||
#endif /* HAVE_LIBPNG */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <zlib.h>
|
||||
#include <png.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
|
||||
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
|
||||
#define MAGIC_SIZE 8
|
||||
/* PNG allows bits per sample: 1, 2, 4, 8, 16 */
|
||||
|
||||
|
||||
static void convert_16u32s_C1R(const png_byte* pSrc, png_int_32* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < length; i++) {
|
||||
png_int_32 val0 = *pSrc++;
|
||||
png_int_32 val1 = *pSrc++;
|
||||
pDst[i] = val0 << 8 | val1;
|
||||
}
|
||||
}
|
||||
|
||||
opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
|
||||
{
|
||||
png_structp png = NULL;
|
||||
png_infop info = NULL;
|
||||
double gamma;
|
||||
int bit_depth, interlace_type,compression_type, filter_type;
|
||||
png_uint_32 i;
|
||||
png_uint_32 width, height = 0U;
|
||||
int color_type;
|
||||
FILE *reader = NULL;
|
||||
png_byte** rows = NULL;
|
||||
png_int_32* row32s = NULL;
|
||||
/* j2k: */
|
||||
opj_image_t *image = NULL;
|
||||
opj_image_cmptparm_t cmptparm[4];
|
||||
png_uint_32 nr_comp;
|
||||
png_byte sigbuf[8];
|
||||
convert_XXx32s_C1R cvtXXTo32s = NULL;
|
||||
convert_32s_CXPX cvtCxToPx = NULL;
|
||||
png_int_32* planes[4];
|
||||
|
||||
if((reader = fopen(read_idf, "rb")) == NULL)
|
||||
{
|
||||
fprintf(stderr,"pngtoimage: can not open %s\n",read_idf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(fread(sigbuf, 1, MAGIC_SIZE, reader) != MAGIC_SIZE
|
||||
|| memcmp(sigbuf, PNG_MAGIC, MAGIC_SIZE) != 0)
|
||||
{
|
||||
fprintf(stderr,"pngtoimage: %s is no valid PNG file\n",read_idf);
|
||||
goto fin;
|
||||
}
|
||||
|
||||
if((png = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL)) == NULL)
|
||||
goto fin;
|
||||
if((info = png_create_info_struct(png)) == NULL)
|
||||
goto fin;
|
||||
|
||||
if(setjmp(png_jmpbuf(png)))
|
||||
goto fin;
|
||||
|
||||
png_init_io(png, reader);
|
||||
png_set_sig_bytes(png, MAGIC_SIZE);
|
||||
|
||||
png_read_info(png, info);
|
||||
|
||||
if(png_get_IHDR(png, info, &width, &height,
|
||||
&bit_depth, &color_type, &interlace_type,
|
||||
&compression_type, &filter_type) == 0)
|
||||
goto fin;
|
||||
|
||||
/* png_set_expand():
|
||||
* expand paletted images to RGB, expand grayscale images of
|
||||
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
|
||||
* to alpha channels.
|
||||
*/
|
||||
if(color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
png_set_expand(png);
|
||||
}
|
||||
|
||||
if(png_get_valid(png, info, PNG_INFO_tRNS)) {
|
||||
png_set_expand(png);
|
||||
}
|
||||
/* We might wan't to expand background */
|
||||
/*
|
||||
if(png_get_valid(png, info, PNG_INFO_bKGD)) {
|
||||
png_color_16p bgnd;
|
||||
png_get_bKGD(png, info, &bgnd);
|
||||
png_set_background(png, bgnd, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||
}
|
||||
*/
|
||||
|
||||
if( !png_get_gAMA(png, info, &gamma))
|
||||
gamma = 1.0;
|
||||
|
||||
/* we're not displaying but converting, screen gamma == 1.0 */
|
||||
png_set_gamma(png, 1.0, gamma);
|
||||
|
||||
png_read_update_info(png, info);
|
||||
|
||||
color_type = png_get_color_type(png, info);
|
||||
|
||||
switch (color_type) {
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
nr_comp = 1;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
nr_comp = 2;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
nr_comp = 3;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
nr_comp = 4;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"pngtoimage: colortype %d is not supported\n", color_type);
|
||||
goto fin;
|
||||
}
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[nr_comp];
|
||||
bit_depth = png_get_bit_depth(png, info);
|
||||
|
||||
switch (bit_depth) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
cvtXXTo32s = convert_XXu32s_C1R_LUT[bit_depth];
|
||||
break;
|
||||
case 16: /* 16 bpp is specific to PNG */
|
||||
cvtXXTo32s = convert_16u32s_C1R;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"pngtoimage: bit depth %d is not supported\n", bit_depth);
|
||||
goto fin;
|
||||
}
|
||||
|
||||
|
||||
rows = (png_byte**)calloc(height+1, sizeof(png_byte*));
|
||||
for(i = 0; i < height; ++i)
|
||||
rows[i] = (png_byte*)malloc(png_get_rowbytes(png,info));
|
||||
|
||||
png_read_image(png, rows);
|
||||
|
||||
/* Create image */
|
||||
memset(cmptparm, 0, sizeof(cmptparm));
|
||||
for(i = 0; i < nr_comp; ++i)
|
||||
{
|
||||
cmptparm[i].prec = (png_uint_32)bit_depth;
|
||||
/* bits_per_pixel: 8 or 16 */
|
||||
cmptparm[i].bpp = (png_uint_32)bit_depth;
|
||||
cmptparm[i].sgnd = 0;
|
||||
cmptparm[i].dx = (png_uint_32)params->subsampling_dx;
|
||||
cmptparm[i].dy = (png_uint_32)params->subsampling_dy;
|
||||
cmptparm[i].w = (png_uint_32)width;
|
||||
cmptparm[i].h = (png_uint_32)height;
|
||||
}
|
||||
|
||||
image = opj_image_create(nr_comp, &cmptparm[0], (nr_comp > 2U) ? CLRSPC_SRGB : CLRSPC_GRAY);
|
||||
if(image == NULL) goto fin;
|
||||
image->x0 = (png_uint_32)params->image_offset_x0;
|
||||
image->y0 = (png_uint_32)params->image_offset_y0;
|
||||
image->x1 = (png_uint_32)(image->x0 + (width - 1) * (png_uint_32)params->subsampling_dx + 1 + image->x0);
|
||||
image->y1 = (png_uint_32)(image->y0 + (height - 1) * (png_uint_32)params->subsampling_dy + 1 + image->y0);
|
||||
|
||||
row32s = (png_int_32 *)malloc((size_t)width * nr_comp * sizeof(png_int_32));
|
||||
if(row32s == NULL) goto fin;
|
||||
|
||||
/* Set alpha channel */
|
||||
/* image->comps[nr_comp-1U].alpha = 1U - (nr_comp & 1U); */
|
||||
|
||||
for(i = 0; i < nr_comp; i++)
|
||||
{
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
|
||||
for(i = 0; i < height; ++i)
|
||||
{
|
||||
cvtXXTo32s(rows[i], row32s, (size_t)width * nr_comp);
|
||||
cvtCxToPx(row32s, planes, width);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
fin:
|
||||
if(rows)
|
||||
{
|
||||
for(i = 0; i < height; ++i)
|
||||
free(rows[i]);
|
||||
free(rows);
|
||||
}
|
||||
if (row32s) {
|
||||
free(row32s);
|
||||
}
|
||||
if(png)
|
||||
png_destroy_read_struct(&png, &info, NULL);
|
||||
|
||||
fclose(reader);
|
||||
|
||||
return image;
|
||||
|
||||
}/* pngtoimage() */
|
||||
|
||||
|
||||
static void convert_32s16u_C1R(const png_int_32* pSrc, png_byte* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < length; i++) {
|
||||
png_uint_32 val = (png_uint_32)pSrc[i];
|
||||
*pDst++ = (png_byte)(val >> 8);
|
||||
*pDst++ = (png_byte)val;
|
||||
}
|
||||
}
|
||||
int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
{
|
||||
FILE * volatile writer = NULL;
|
||||
png_structp png = NULL;
|
||||
png_infop info = NULL;
|
||||
png_bytep volatile row_buf = NULL;
|
||||
int nr_comp, color_type;
|
||||
volatile int prec;
|
||||
png_color_8 sig_bit;
|
||||
png_int_32 const* planes[4];
|
||||
int i;
|
||||
png_int_32* volatile buffer32s = NULL;
|
||||
|
||||
volatile int fails = 1;
|
||||
|
||||
memset(&sig_bit, 0, sizeof(sig_bit));
|
||||
prec = (int)image->comps[0].prec;
|
||||
planes[0] = image->comps[0].data;
|
||||
nr_comp = (int)image->numcomps;
|
||||
|
||||
if (nr_comp > 4) {
|
||||
nr_comp = 4;
|
||||
}
|
||||
for (i = 1; i < nr_comp; ++i) {
|
||||
if (image->comps[0].dx != image->comps[i].dx) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].dy != image->comps[i].dy) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].prec != image->comps[i].prec) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].sgnd != image->comps[i].sgnd) {
|
||||
break;
|
||||
}
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
if (i != nr_comp) {
|
||||
fprintf(stderr,"imagetopng: All components shall have the same subsampling, same bit depth, same sign.\n");
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
clip_component(&(image->comps[i]), image->comps[0].prec);
|
||||
}
|
||||
if(prec > 8 && prec < 16)
|
||||
{
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 16);
|
||||
}
|
||||
prec = 16;
|
||||
}
|
||||
else if(prec < 8 && nr_comp > 1)/* GRAY_ALPHA, RGB, RGB_ALPHA */
|
||||
{
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 8);
|
||||
}
|
||||
prec = 8;
|
||||
} else if((prec > 1) && (prec < 8) && ((prec == 6) || ((prec & 1)==1))) { /* GRAY with non native precision */
|
||||
if ((prec == 5) || (prec == 6)) {
|
||||
prec = 8;
|
||||
} else {
|
||||
prec++;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), (png_uint_32)prec);
|
||||
}
|
||||
}
|
||||
|
||||
if(prec != 1 && prec != 2 && prec != 4 && prec != 8 && prec != 16)
|
||||
{
|
||||
fprintf(stderr,"imagetopng: can not create %s\n\twrong bit_depth %d\n", write_idf, prec);
|
||||
return fails;
|
||||
}
|
||||
|
||||
writer = fopen(write_idf, "wb");
|
||||
|
||||
if(writer == NULL) return fails;
|
||||
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
* functions. If you want to use the default stderr and longjump method,
|
||||
* you can supply NULL for the last three parameters. We also check that
|
||||
* the library version is compatible with the one used at compile time,
|
||||
* in case we are using dynamically linked libraries. REQUIRED.
|
||||
*/
|
||||
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL);
|
||||
/*png_voidp user_error_ptr, user_error_fn, user_warning_fn); */
|
||||
|
||||
if(png == NULL) goto fin;
|
||||
|
||||
/* Allocate/initialize the image information data. REQUIRED
|
||||
*/
|
||||
info = png_create_info_struct(png);
|
||||
|
||||
if(info == NULL) goto fin;
|
||||
|
||||
/* Set error handling. REQUIRED if you are not supplying your own
|
||||
* error handling functions in the png_create_write_struct() call.
|
||||
*/
|
||||
if(setjmp(png_jmpbuf(png))) goto fin;
|
||||
|
||||
/* I/O initialization functions is REQUIRED
|
||||
*/
|
||||
png_init_io(png, writer);
|
||||
|
||||
/* Set the image information here. Width and height are up to 2^31,
|
||||
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
||||
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
||||
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
||||
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
|
||||
* REQUIRED
|
||||
*
|
||||
* ERRORS:
|
||||
*
|
||||
* color_type == PNG_COLOR_TYPE_PALETTE && bit_depth > 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8
|
||||
*
|
||||
*/
|
||||
png_set_compression_level(png, Z_BEST_COMPRESSION);
|
||||
|
||||
if(nr_comp >= 3) /* RGB(A) */
|
||||
{
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
sig_bit.red = sig_bit.green = sig_bit.blue = (png_byte)prec;
|
||||
}
|
||||
else /* GRAY(A) */
|
||||
{
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
sig_bit.gray = (png_byte)prec;
|
||||
}
|
||||
if((nr_comp & 1) == 0) /* ALPHA */
|
||||
{
|
||||
color_type |= PNG_COLOR_MASK_ALPHA;
|
||||
sig_bit.alpha = (png_byte)prec;
|
||||
}
|
||||
|
||||
png_set_IHDR(png, info, image->comps[0].w, image->comps[0].h, prec, color_type,
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
png_set_sBIT(png, info, &sig_bit);
|
||||
/* png_set_gamma(png, 2.2, 1./2.2); */
|
||||
/* png_set_sRGB(png, info, PNG_sRGB_INTENT_PERCEPTUAL); */
|
||||
png_write_info(png, info);
|
||||
|
||||
/* setup conversion */
|
||||
{
|
||||
size_t rowStride;
|
||||
png_size_t png_row_size;
|
||||
|
||||
png_row_size = png_get_rowbytes(png, info);
|
||||
rowStride = ((size_t)image->comps[0].w * (size_t)nr_comp * (size_t)prec + 7U) / 8U;
|
||||
if (rowStride != (size_t)png_row_size) {
|
||||
fprintf(stderr, "Invalid PNG row size\n");
|
||||
goto fin;
|
||||
}
|
||||
row_buf = (png_bytep)malloc(png_row_size);
|
||||
if (row_buf == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for PNG row\n");
|
||||
goto fin;
|
||||
}
|
||||
buffer32s = (png_int_32*)malloc((size_t)image->comps[0].w * (size_t)nr_comp * sizeof(png_int_32));
|
||||
if (buffer32s == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for interleaved 32s row\n");
|
||||
goto fin;
|
||||
}
|
||||
}
|
||||
|
||||
/* convert */
|
||||
{
|
||||
size_t width= image->comps[0].w;
|
||||
int y;
|
||||
convert_32s_PXCX cvtPxToCx = convert_32s_PXCX_LUT[nr_comp];
|
||||
convert_32sXXx_C1R cvt32sToPack = NULL;
|
||||
png_int_32 adjust = image->comps[0].sgnd ? 1 << (prec - 1) : 0;
|
||||
png_bytep row_buf_cpy = row_buf;
|
||||
png_int_32* buffer32s_cpy = buffer32s;
|
||||
|
||||
switch (prec) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
cvt32sToPack = convert_32sXXu_C1R_LUT[prec];
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToPack = convert_32s16u_C1R;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
|
||||
for(y = 0; y < image->comps[0].h; ++y)
|
||||
{
|
||||
cvtPxToCx(planes, buffer32s_cpy, width, adjust);
|
||||
cvt32sToPack(buffer32s_cpy, row_buf_cpy, width * (size_t)nr_comp);
|
||||
png_write_row(png, row_buf_cpy);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
}
|
||||
|
||||
png_write_end(png, info);
|
||||
|
||||
fails = 0;
|
||||
|
||||
fin:
|
||||
if(png) {
|
||||
png_destroy_write_struct(&png, &info);
|
||||
}
|
||||
if(row_buf) {
|
||||
free(row_buf);
|
||||
}
|
||||
if(buffer32s) {
|
||||
free(buffer32s);
|
||||
}
|
||||
fclose(writer);
|
||||
|
||||
if(fails) (void)remove(write_idf); /* ignore return value */
|
||||
|
||||
return fails;
|
||||
}/* imagetopng() */
|
|
@ -0,0 +1,633 @@
|
|||
/*
|
||||
* 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
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2015, Matthieu Darbois
|
||||
* 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_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef HAVE_LIBTIFF
|
||||
# error HAVE_LIBTIFF_NOT_DEFINED
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
|
||||
#include <tiffio.h>
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
|
||||
TIFF IMAGE FORMAT
|
||||
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
static void tif_32sto10u(const int32* pSrc, uint8* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)3U); i+=4U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
uint32 src1 = (uint32)pSrc[i+1];
|
||||
uint32 src2 = (uint32)pSrc[i+2];
|
||||
uint32 src3 = (uint32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (uint8)(src0 >> 2);
|
||||
*pDst++ = (uint8)(((src0 & 0x3U) << 6) | (src1 >> 4));
|
||||
*pDst++ = (uint8)(((src1 & 0xFU) << 4) | (src2 >> 6));
|
||||
*pDst++ = (uint8)(((src2 & 0x3FU) << 2) | (src3 >> 8));
|
||||
*pDst++ = (uint8)(src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
uint32 src1 = 0U;
|
||||
uint32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (uint32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (uint32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (uint8)(src0 >> 2);
|
||||
*pDst++ = (uint8)(((src0 & 0x3U) << 6) | (src1 >> 4));
|
||||
if (length > 1U) {
|
||||
*pDst++ = (uint8)(((src1 & 0xFU) << 4) | (src2 >> 6));
|
||||
if (length > 2U) {
|
||||
*pDst++ = (uint8)(((src2 & 0x3FU) << 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void tif_32sto12u(const int32* pSrc, uint8* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)1U); i+=2U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
uint32 src1 = (uint32)pSrc[i+1];
|
||||
|
||||
*pDst++ = (uint8)(src0 >> 4);
|
||||
*pDst++ = (uint8)(((src0 & 0xFU) << 4) | (src1 >> 8));
|
||||
*pDst++ = (uint8)(src1);
|
||||
}
|
||||
|
||||
if (length & 1U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
*pDst++ = (uint8)(src0 >> 4);
|
||||
*pDst++ = (uint8)(((src0 & 0xFU) << 4));
|
||||
}
|
||||
}
|
||||
static void tif_32sto14u(const int32* pSrc, uint8* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)3U); i+=4U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
uint32 src1 = (uint32)pSrc[i+1];
|
||||
uint32 src2 = (uint32)pSrc[i+2];
|
||||
uint32 src3 = (uint32)pSrc[i+3];
|
||||
|
||||
*pDst++ = (uint8)(src0 >> 6);
|
||||
*pDst++ = (uint8)(((src0 & 0x3FU) << 2) | (src1 >> 12));
|
||||
*pDst++ = (uint8)(src1 >> 4);
|
||||
*pDst++ = (uint8)(((src1 & 0xFU) << 4) | (src2 >> 10));
|
||||
*pDst++ = (uint8)(src2 >> 2);
|
||||
*pDst++ = (uint8)(((src2 & 0x3U) << 6) | (src3 >> 8));
|
||||
*pDst++ = (uint8)(src3);
|
||||
}
|
||||
|
||||
if (length & 3U) {
|
||||
uint32 src0 = (uint32)pSrc[i+0];
|
||||
uint32 src1 = 0U;
|
||||
uint32 src2 = 0U;
|
||||
length = length & 3U;
|
||||
|
||||
if (length > 1U) {
|
||||
src1 = (uint32)pSrc[i+1];
|
||||
if (length > 2U) {
|
||||
src2 = (uint32)pSrc[i+2];
|
||||
}
|
||||
}
|
||||
*pDst++ = (uint8)(src0 >> 6);
|
||||
*pDst++ = (uint8)(((src0 & 0x3FU) << 2) | (src1 >> 12));
|
||||
if (length > 1U) {
|
||||
*pDst++ = (uint8)(src1 >> 4);
|
||||
*pDst++ = (uint8)(((src1 & 0xFU) << 4) | (src2 >> 10));
|
||||
if (length > 2U) {
|
||||
*pDst++ = (uint8)(src2 >> 2);
|
||||
*pDst++ = (uint8)(((src2 & 0x3U) << 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void tif_32sto16u(const int32* pSrc, uint16* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
pDst[i] = (uint16)pSrc[i];
|
||||
}
|
||||
}
|
||||
|
||||
int imagetotif(opj_image_t * image, const char *outfile)
|
||||
{
|
||||
int width, height;
|
||||
int bps,adjust, sgnd;
|
||||
int tiPhoto;
|
||||
TIFF *tif;
|
||||
tdata_t buf;
|
||||
tsize_t strip_size;
|
||||
int32 i, numcomps;
|
||||
size_t rowStride;
|
||||
int32* buffer32s = NULL;
|
||||
int32 const* planes[4];
|
||||
convert_32s_PXCX cvtPxToCx = NULL;
|
||||
convert_32sXXx_C1R cvt32sToTif = NULL;
|
||||
|
||||
bps = image->comps[0].prec;
|
||||
planes[0] = image->comps[0].data;
|
||||
|
||||
numcomps = image->numcomps;
|
||||
|
||||
if (numcomps > 2) {
|
||||
tiPhoto = PHOTOMETRIC_RGB;
|
||||
if (numcomps > 4) {
|
||||
numcomps = 4;
|
||||
}
|
||||
} else {
|
||||
tiPhoto = PHOTOMETRIC_MINISBLACK;
|
||||
}
|
||||
for (i = 1; i < numcomps; ++i) {
|
||||
if (image->comps[0].dx != image->comps[i].dx) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].dy != image->comps[i].dy) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].prec != image->comps[i].prec) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].sgnd != image->comps[i].sgnd) {
|
||||
break;
|
||||
}
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
if (i != numcomps) {
|
||||
fprintf(stderr,"imagetotif: All components shall have the same subsampling, same bit depth.\n");
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((bps > 16) || ((bps != 1) && (bps & 1))) bps = 0;
|
||||
if(bps == 0)
|
||||
{
|
||||
fprintf(stderr,"imagetotif: Bits=%d, Only 1, 2, 4, 6, 8, 10, 12, 14 and 16 bits implemented\n",bps);
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
tif = TIFFOpen(outfile, "wb");
|
||||
if (!tif)
|
||||
{
|
||||
fprintf(stderr, "imagetotif:failed to open %s for writing\n", outfile);
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < numcomps; ++i) {
|
||||
clip_component(&(image->comps[i]), image->comps[0].prec);
|
||||
}
|
||||
cvtPxToCx = convert_32s_PXCX_LUT[numcomps];
|
||||
switch (bps) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
cvt32sToTif = convert_32sXXu_C1R_LUT[bps];
|
||||
break;
|
||||
case 10:
|
||||
cvt32sToTif = tif_32sto10u;
|
||||
break;
|
||||
case 12:
|
||||
cvt32sToTif = tif_32sto12u;
|
||||
break;
|
||||
case 14:
|
||||
cvt32sToTif = tif_32sto14u;
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToTif = (convert_32sXXx_C1R)tif_32sto16u;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
sgnd = (int)image->comps[0].sgnd;
|
||||
adjust = sgnd ? 1 << (image->comps[0].prec - 1) : 0;
|
||||
width = (int)image->comps[0].w;
|
||||
height = (int)image->comps[0].h;
|
||||
|
||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
|
||||
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
|
||||
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, numcomps);
|
||||
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
|
||||
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, tiPhoto);
|
||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
|
||||
|
||||
strip_size = TIFFStripSize(tif);
|
||||
rowStride = ((size_t)width * numcomps * (size_t)bps + 7U) / 8U;
|
||||
if (rowStride != (size_t)strip_size) {
|
||||
fprintf(stderr, "Invalid TIFF strip size\n");
|
||||
TIFFClose(tif);
|
||||
return 1;
|
||||
}
|
||||
buf = _TIFFmalloc(strip_size);
|
||||
if (buf == NULL) {
|
||||
TIFFClose(tif);
|
||||
return 1;
|
||||
}
|
||||
buffer32s = (int32 *)malloc((size_t)width * numcomps * sizeof(int32));
|
||||
if (buffer32s == NULL) {
|
||||
_TIFFfree(buf);
|
||||
TIFFClose(tif);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < image->comps[0].h; ++i) {
|
||||
cvtPxToCx(planes, buffer32s, (size_t)width, adjust);
|
||||
cvt32sToTif(buffer32s, (uint8 *)buf, (size_t)width * numcomps);
|
||||
(void)TIFFWriteEncodedStrip(tif, i, (void*)buf, strip_size);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
_TIFFfree((void*)buf);
|
||||
TIFFClose(tif);
|
||||
free(buffer32s);
|
||||
|
||||
return 0;
|
||||
}/* imagetotif() */
|
||||
|
||||
static void tif_10uto32s(const uint8* pSrc, int32* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)3U); i+=4U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
uint32 val2 = *pSrc++;
|
||||
uint32 val3 = *pSrc++;
|
||||
uint32 val4 = *pSrc++;
|
||||
|
||||
pDst[i+0] = (int32)((val0 << 2) | (val1 >> 6));
|
||||
pDst[i+1] = (int32)(((val1 & 0x3FU) << 4) | (val2 >> 4));
|
||||
pDst[i+2] = (int32)(((val2 & 0xFU) << 6) | (val3 >> 2));
|
||||
pDst[i+3] = (int32)(((val3 & 0x3U) << 8) | val4);
|
||||
|
||||
}
|
||||
if (length & 3U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
length = length & 3U;
|
||||
pDst[i+0] = (int32)((val0 << 2) | (val1 >> 6));
|
||||
|
||||
if (length > 1U) {
|
||||
uint32 val2 = *pSrc++;
|
||||
pDst[i+1] = (int32)(((val1 & 0x3FU) << 4) | (val2 >> 4));
|
||||
if (length > 2U) {
|
||||
uint32 val3 = *pSrc++;
|
||||
pDst[i+2] = (int32)(((val2 & 0xFU) << 6) | (val3 >> 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static void tif_12uto32s(const uint8* pSrc, int32* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)1U); i+=2U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
uint32 val2 = *pSrc++;
|
||||
|
||||
pDst[i+0] = (int32)((val0 << 4) | (val1 >> 4));
|
||||
pDst[i+1] = (int32)(((val1 & 0xFU) << 8) | val2);
|
||||
}
|
||||
if (length & 1U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
pDst[i+0] = (int32)((val0 << 4) | (val1 >> 4));
|
||||
}
|
||||
}
|
||||
static void tif_14uto32s(const uint8* pSrc, int32* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < (length & ~(size_t)3U); i+=4U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
uint32 val2 = *pSrc++;
|
||||
uint32 val3 = *pSrc++;
|
||||
uint32 val4 = *pSrc++;
|
||||
uint32 val5 = *pSrc++;
|
||||
uint32 val6 = *pSrc++;
|
||||
|
||||
pDst[i+0] = (int32)((val0 << 6) | (val1 >> 2));
|
||||
pDst[i+1] = (int32)(((val1 & 0x3U) << 12) | (val2 << 4) | (val3 >> 4));
|
||||
pDst[i+2] = (int32)(((val3 & 0xFU) << 10) | (val4 << 2) | (val5 >> 6));
|
||||
pDst[i+3] = (int32)(((val5 & 0x3FU) << 8) | val6);
|
||||
|
||||
}
|
||||
if (length & 3U) {
|
||||
uint32 val0 = *pSrc++;
|
||||
uint32 val1 = *pSrc++;
|
||||
length = length & 3U;
|
||||
pDst[i+0] = (int32)((val0 << 6) | (val1 >> 2));
|
||||
|
||||
if (length > 1U) {
|
||||
uint32 val2 = *pSrc++;
|
||||
uint32 val3 = *pSrc++;
|
||||
pDst[i+1] = (int32)(((val1 & 0x3U) << 12) | (val2 << 4) | (val3 >> 4));
|
||||
if (length > 2U) {
|
||||
uint32 val4 = *pSrc++;
|
||||
uint32 val5 = *pSrc++;
|
||||
pDst[i+2] = (int32)(((val3 & 0xFU) << 10) | (val4 << 2) | (val5 >> 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* seems that libtiff decodes this to machine endianness */
|
||||
static void tif_16uto32s(const uint16* pSrc, int32* pDst, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < length; i++) {
|
||||
pDst[i] = pSrc[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* libtiff/tif_getimage.c : 1,2,4,8,16 bitspersample accepted
|
||||
* CINEMA : 12 bit precision
|
||||
*/
|
||||
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
{
|
||||
int subsampling_dx = parameters->subsampling_dx;
|
||||
int subsampling_dy = parameters->subsampling_dy;
|
||||
TIFF *tif;
|
||||
tdata_t buf;
|
||||
tstrip_t strip;
|
||||
tsize_t strip_size;
|
||||
int j, currentPlane, numcomps = 0, w, h;
|
||||
OPJ_COLOR_SPACE color_space = CLRSPC_UNKNOWN;
|
||||
opj_image_cmptparm_t cmptparm[4]; /* RGBA */
|
||||
opj_image_t *image = NULL;
|
||||
int has_alpha = 0;
|
||||
unsigned short tiBps, tiPhoto, tiSf, tiSpp, tiPC;
|
||||
unsigned int tiWidth, tiHeight;
|
||||
opj_bool is_cinema = (parameters->cp_cinema != OFF) ? OPJ_TRUE : OPJ_FALSE;
|
||||
convert_XXx32s_C1R cvtTifTo32s = NULL;
|
||||
convert_32s_CXPX cvtCxToPx = NULL;
|
||||
int32* buffer32s = NULL;
|
||||
int32* planes[4];
|
||||
size_t rowStride;
|
||||
|
||||
tif = TIFFOpen(filename, "r");
|
||||
|
||||
if(!tif)
|
||||
{
|
||||
fprintf(stderr, "tiftoimage:Failed to open %s for reading\n", filename);
|
||||
return 0;
|
||||
}
|
||||
tiBps = tiPhoto = tiSf = tiSpp = tiPC = 0;
|
||||
tiWidth = tiHeight = 0;
|
||||
|
||||
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &tiWidth);
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &tiHeight);
|
||||
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &tiBps);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &tiSf);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &tiSpp);
|
||||
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &tiPhoto);
|
||||
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &tiPC);
|
||||
w= (int)tiWidth;
|
||||
h= (int)tiHeight;
|
||||
|
||||
if((tiBps > 16U) || ((tiBps != 1U) && (tiBps & 1U))) {
|
||||
fprintf(stderr,"tiftoimage: Bits=%d, Only 1, 2, 4, 6, 8, 10, 12, 14 and 16 bits implemented\n",tiBps);
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
TIFFClose(tif);
|
||||
return NULL;
|
||||
}
|
||||
if(tiPhoto != PHOTOMETRIC_MINISBLACK && tiPhoto != PHOTOMETRIC_RGB) {
|
||||
fprintf(stderr,"tiftoimage: Bad color format %d.\n\tOnly RGB(A) and GRAY(A) has been implemented\n",(int) tiPhoto);
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
TIFFClose(tif);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (tiBps) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
cvtTifTo32s = convert_XXu32s_C1R_LUT[tiBps];
|
||||
break;
|
||||
/* others are specific to TIFF */
|
||||
case 10:
|
||||
cvtTifTo32s = tif_10uto32s;
|
||||
break;
|
||||
case 12:
|
||||
cvtTifTo32s = tif_12uto32s;
|
||||
break;
|
||||
case 14:
|
||||
cvtTifTo32s = tif_14uto32s;
|
||||
break;
|
||||
case 16:
|
||||
cvtTifTo32s = (convert_XXx32s_C1R)tif_16uto32s;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
|
||||
{/* From: tiff-4.0.x/libtiff/tif_getimage.c : */
|
||||
uint16* sampleinfo;
|
||||
uint16 extrasamples;
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
|
||||
&extrasamples, &sampleinfo);
|
||||
|
||||
if(extrasamples >= 1)
|
||||
{
|
||||
switch(sampleinfo[0])
|
||||
{
|
||||
case EXTRASAMPLE_UNSPECIFIED:
|
||||
/* Workaround for some images without correct info about alpha channel
|
||||
*/
|
||||
if(tiSpp > 3)
|
||||
has_alpha = 1;
|
||||
break;
|
||||
|
||||
case EXTRASAMPLE_ASSOCALPHA: /* data pre-multiplied */
|
||||
case EXTRASAMPLE_UNASSALPHA: /* data not pre-multiplied */
|
||||
has_alpha = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else /* extrasamples == 0 */
|
||||
if(tiSpp == 4 || tiSpp == 2) has_alpha = 1;
|
||||
}
|
||||
|
||||
/* initialize image components */
|
||||
memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
|
||||
|
||||
if ((tiPhoto == PHOTOMETRIC_RGB) && (is_cinema) && (tiBps != 12U)) {
|
||||
fprintf(stdout,"WARNING:\n"
|
||||
"Input image bitdepth is %d bits\n"
|
||||
"TIF conversion has automatically rescaled to 12-bits\n"
|
||||
"to comply with cinema profiles.\n",
|
||||
tiBps);
|
||||
} else {
|
||||
is_cinema = 0U;
|
||||
}
|
||||
|
||||
if(tiPhoto == PHOTOMETRIC_RGB) /* RGB(A) */
|
||||
{
|
||||
numcomps = 3 + has_alpha;
|
||||
color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else if (tiPhoto == PHOTOMETRIC_MINISBLACK) /* GRAY(A) */
|
||||
{
|
||||
numcomps = 1 + has_alpha;
|
||||
color_space = CLRSPC_GRAY;
|
||||
}
|
||||
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[numcomps];
|
||||
if (tiPC == PLANARCONFIG_SEPARATE) {
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[1]; /* override */
|
||||
tiSpp = 1U; /* consider only one sample per plane */
|
||||
}
|
||||
|
||||
for(j = 0; j < numcomps; j++)
|
||||
{
|
||||
cmptparm[j].prec = tiBps;
|
||||
cmptparm[j].bpp = tiBps;
|
||||
cmptparm[j].dx = (uint32)subsampling_dx;
|
||||
cmptparm[j].dy = (uint32)subsampling_dy;
|
||||
cmptparm[j].w = (uint32)w;
|
||||
cmptparm[j].h = (uint32)h;
|
||||
}
|
||||
|
||||
image = opj_image_create((uint32)numcomps, &cmptparm[0], color_space);
|
||||
if(!image)
|
||||
{
|
||||
TIFFClose(tif);
|
||||
return NULL;
|
||||
}
|
||||
/* set image offset and reference grid */
|
||||
image->x0 = (uint32)parameters->image_offset_x0;
|
||||
image->y0 = (uint32)parameters->image_offset_y0;
|
||||
image->x1 = !image->x0 ? (uint32)(w - 1) * (uint32)subsampling_dx + 1 :
|
||||
image->x0 + (uint32)(w - 1) * (uint32)subsampling_dx + 1;
|
||||
image->y1 = !image->y0 ? (uint32)(h - 1) * (uint32)subsampling_dy + 1 :
|
||||
image->y0 + (uint32)(h - 1) * (uint32)subsampling_dy + 1;
|
||||
|
||||
for(j = 0; j < numcomps; j++)
|
||||
{
|
||||
planes[j] = image->comps[j].data;
|
||||
}
|
||||
/* image->comps[numcomps - 1].alpha = (uint16)(1 - (numcomps & 1)); */
|
||||
|
||||
strip_size = TIFFStripSize(tif);
|
||||
|
||||
buf = _TIFFmalloc(strip_size);
|
||||
if (buf == NULL) {
|
||||
TIFFClose(tif);
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
rowStride = ((size_t)w * tiSpp * tiBps + 7U) / 8U;
|
||||
buffer32s = (int32 *)malloc((size_t)w * tiSpp * sizeof(int32));
|
||||
if (buffer32s == NULL) {
|
||||
_TIFFfree(buf);
|
||||
TIFFClose(tif);
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strip = 0;
|
||||
currentPlane = 0;
|
||||
do
|
||||
{
|
||||
planes[0] = image->comps[currentPlane].data; /* to manage planar data */
|
||||
h= (int)tiHeight;
|
||||
/* Read the Image components */
|
||||
for(; (h > 0) && (strip < TIFFNumberOfStrips(tif)); strip++)
|
||||
{
|
||||
const uint8 *dat8;
|
||||
size_t ssize;
|
||||
|
||||
ssize = (size_t)TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
||||
dat8 = (const uint8*)buf;
|
||||
|
||||
while (ssize >= rowStride) {
|
||||
cvtTifTo32s(dat8, buffer32s, (size_t)w * tiSpp);
|
||||
cvtCxToPx(buffer32s, planes, (size_t)w);
|
||||
planes[0] += w;
|
||||
planes[1] += w;
|
||||
planes[2] += w;
|
||||
planes[3] += w;
|
||||
dat8 += rowStride;
|
||||
ssize -= rowStride;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
currentPlane++;
|
||||
} while ((tiPC == PLANARCONFIG_SEPARATE) && (currentPlane < numcomps));
|
||||
|
||||
free(buffer32s);
|
||||
_TIFFfree(buf);
|
||||
TIFFClose(tif);
|
||||
|
||||
if (is_cinema) {
|
||||
for (j=0; j < numcomps; ++j) {
|
||||
scale_component(&(image->comps[j]), 12);
|
||||
}
|
||||
|
||||
}
|
||||
return image;
|
||||
|
||||
}/* tiftoimage() */
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
|
@ -0,0 +1,691 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Mathieu Malaterre, GDCM
|
||||
* 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>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "windirent.h"
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#define _stricmp strcasecmp
|
||||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "j2k.h"
|
||||
#include "jp2.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
#include "format_defs.h"
|
||||
|
||||
typedef struct dircnt{
|
||||
/** Buffer for holding images read from Directory*/
|
||||
char *filename_buf;
|
||||
/** Pointer to the buffer*/
|
||||
char **filename;
|
||||
}dircnt_t;
|
||||
|
||||
|
||||
typedef struct img_folder{
|
||||
/** The directory path of the folder containing input images*/
|
||||
char *imgdirpath;
|
||||
/** Output format*/
|
||||
const char *out_format;
|
||||
/** Enable option*/
|
||||
char set_imgdir;
|
||||
/** Enable Cod Format for output*/
|
||||
char set_out_format;
|
||||
|
||||
}img_fol_t;
|
||||
|
||||
void decode_help_display(void) {
|
||||
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
|
||||
/* UniPG>> */
|
||||
fprintf(stdout,"List of parameters for the JPEG 2000 "
|
||||
#ifdef USE_JPWL
|
||||
"+ JPWL "
|
||||
#endif /* USE_JPWL */
|
||||
"decoder:\n");
|
||||
/* <<UniPG */
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout," -ImgDir \n");
|
||||
fprintf(stdout," Image file Directory path \n");
|
||||
fprintf(stdout," -i <compressed file>\n");
|
||||
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
||||
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
||||
fprintf(stdout," is identified based on its suffix.\n");
|
||||
fprintf(stdout," -o <output file>\n");
|
||||
fprintf(stdout," OPTIONAL\n");
|
||||
fprintf(stdout," Output file where file info will be dump.\n");
|
||||
fprintf(stdout," By default it will be in the stdout.\n");
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static void j2k_dump_image(FILE *fd, opj_image_t * img);
|
||||
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp);
|
||||
|
||||
int get_num_images(char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int num_images = 0;
|
||||
|
||||
/*Reading the input images from given input directory*/
|
||||
|
||||
dir= opendir(imgdirpath);
|
||||
if(!dir){
|
||||
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while((content=readdir(dir))!=NULL){
|
||||
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||
continue;
|
||||
num_images++;
|
||||
}
|
||||
closedir(dir);
|
||||
return num_images;
|
||||
}
|
||||
|
||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int i = 0;
|
||||
|
||||
/*Reading the input images from given input directory*/
|
||||
|
||||
dir= opendir(imgdirpath);
|
||||
if(!dir){
|
||||
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||
return 1;
|
||||
}else {
|
||||
fprintf(stderr,"Folder opened successfully\n");
|
||||
}
|
||||
|
||||
while((content=readdir(dir))!=NULL){
|
||||
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||
continue;
|
||||
|
||||
strcpy(dirptr->filename[i],content->d_name);
|
||||
i++;
|
||||
}
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_file_format(char *filename) {
|
||||
unsigned int i;
|
||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
|
||||
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
|
||||
char * ext = strrchr(filename, '.');
|
||||
if (ext == NULL)
|
||||
return -1;
|
||||
ext++;
|
||||
if(ext) {
|
||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||
if(_strnicmp(ext, extension[i], 3) == 0) {
|
||||
return format[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||
|
||||
strcpy(image_filename,dirptr->filename[imageno]);
|
||||
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
|
||||
parameters->decod_format = get_file_format(image_filename);
|
||||
if (parameters->decod_format == -1)
|
||||
return 1;
|
||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||
|
||||
/*Set output file*/
|
||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||
while((temp_p = strtok(NULL,".")) != NULL){
|
||||
strcat(temp_ofname,temp1);
|
||||
sprintf(temp1,".%s",temp_p);
|
||||
}
|
||||
if(img_fol->set_out_format==1){
|
||||
sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);
|
||||
strncpy(parameters->outfile, outfilename, sizeof(outfilename));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||
/* parse the command line */
|
||||
int totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
#ifdef USE_SYSTEM_GETOPT
|
||||
{0,0,0,0} /* GNU getopt_long requirement */
|
||||
#endif
|
||||
};
|
||||
const char optlist[] = "i:o:h";
|
||||
|
||||
OPJ_ARG_NOT_USED(indexfilename);
|
||||
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
do {
|
||||
#ifdef USE_SYSTEM_GETOPT
|
||||
c = opj_getopt_long(argc, argv,optlist,long_option,0);
|
||||
#else
|
||||
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
#endif
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
case JP2_CFMT:
|
||||
case JPT_CFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
}
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = opj_optarg;
|
||||
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
case 'h': /* display an help description */
|
||||
decode_help_display();
|
||||
return 1;
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"[WARNING] An invalid option has been ignored\n");
|
||||
break;
|
||||
}
|
||||
}while(c != -1);
|
||||
|
||||
/* check for possible errors */
|
||||
if(img_fol->set_imgdir==1){
|
||||
if(!(parameters->infile[0]==0)){
|
||||
fprintf(stderr, "Error: options -ImgDir and -i cannot be used together !!\n");
|
||||
return 1;
|
||||
}
|
||||
if(img_fol->set_out_format == 0){
|
||||
fprintf(stderr, "Error: When -ImgDir is used, -OutFor <FORMAT> must be used !!\n");
|
||||
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
|
||||
return 1;
|
||||
}
|
||||
if(!(parameters->outfile[0] == 0)){
|
||||
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if( parameters->infile[0] == 0 ) {
|
||||
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
|
||||
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
sample error callback expecting a FILE* client object
|
||||
*/
|
||||
void error_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[ERROR] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample warning callback expecting a FILE* client object
|
||||
*/
|
||||
void warning_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[WARNING] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample debug callback expecting no client object
|
||||
*/
|
||||
void info_callback(const char *msg, void *client_data) {
|
||||
(void)client_data;
|
||||
fprintf(stdout, "[INFO] %s", msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
img_fol_t img_fol;
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *image = NULL;
|
||||
FILE *fsrc = NULL, *fout = NULL;
|
||||
unsigned char *src = NULL;
|
||||
int file_length;
|
||||
int num_images;
|
||||
int i,imageno;
|
||||
dircnt_t *dirptr = NULL;
|
||||
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||
opj_cio_t *cio = NULL;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = error_callback;
|
||||
event_mgr.warning_handler = warning_callback;
|
||||
event_mgr.info_handler = info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* Initialize indexfilename and img_fol */
|
||||
*indexfilename = 0;
|
||||
memset(&img_fol,0,sizeof(img_fol_t));
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol, indexfilename) == 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* j2k_dump focuses on j2k codestream and skips JP2 boxes */
|
||||
parameters.flags = 1;
|
||||
/* j2k_dump shall not actually decode packets (parsing codestream is enough). */
|
||||
parameters.cp_limit_decoding = DECODE_ALL_BUT_PACKETS;
|
||||
|
||||
/* Initialize reading of directory */
|
||||
if(img_fol.set_imgdir==1){
|
||||
num_images=get_num_images(img_fol.imgdirpath);
|
||||
|
||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||
if(dirptr){
|
||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return 1;
|
||||
}
|
||||
for(i=0;i<num_images;i++){
|
||||
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
|
||||
}
|
||||
}
|
||||
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||
return 1;
|
||||
}
|
||||
if (num_images==0){
|
||||
fprintf(stdout,"Folder is empty\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
num_images=1;
|
||||
}
|
||||
|
||||
/* */
|
||||
if (parameters.outfile[0] != 0)
|
||||
{
|
||||
fout = fopen(parameters.outfile,"w");
|
||||
if (!fout)
|
||||
{
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.outfile);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
fout = stdout;
|
||||
|
||||
/*Encoding image one by one*/
|
||||
for(imageno = 0; imageno < num_images ; imageno++)
|
||||
{
|
||||
image = NULL;
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if(img_fol.set_imgdir==1){
|
||||
if (get_next_file(imageno, dirptr,&img_fol, ¶meters)) {
|
||||
fprintf(stderr,"skipping file...\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* read the input file and put it in memory */
|
||||
/* ---------------------------------------- */
|
||||
fsrc = fopen(parameters.infile, "rb");
|
||||
if (!fsrc) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||
return 1;
|
||||
}
|
||||
fseek(fsrc, 0, SEEK_END);
|
||||
file_length = ftell(fsrc);
|
||||
fseek(fsrc, 0, SEEK_SET);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
|
||||
{
|
||||
free(src);
|
||||
fclose(fsrc);
|
||||
fclose(fout);
|
||||
fprintf(stderr, "\nERROR: fread return a number of element different from the expected.\n");
|
||||
return 1;
|
||||
}
|
||||
fclose(fsrc);
|
||||
|
||||
/* decode the code-stream */
|
||||
/* ---------------------- */
|
||||
|
||||
switch(parameters.decod_format) {
|
||||
case J2K_CFMT:
|
||||
{
|
||||
/* JPEG-2000 codestream */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_J2K);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
/* dump image */
|
||||
j2k_dump_image(fout, image);
|
||||
|
||||
/* dump cp */
|
||||
j2k_dump_cp(fout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JP2_CFMT:
|
||||
{
|
||||
/* JPEG 2000 compressed image data */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JP2);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using the current image and user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
/* dump image */
|
||||
if(image->icc_profile_buf)
|
||||
{
|
||||
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
||||
}
|
||||
j2k_dump_image(fout, image);
|
||||
|
||||
/* dump cp */
|
||||
j2k_dump_cp(fout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JPT_CFMT:
|
||||
{
|
||||
/* JPEG 2000, JPIP */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JPT);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* free the memory containing the code-stream */
|
||||
free(src);
|
||||
src = NULL;
|
||||
|
||||
/* free remaining structures */
|
||||
if(dinfo) {
|
||||
opj_destroy_decompress(dinfo);
|
||||
}
|
||||
/* free codestream information structure */
|
||||
if (*indexfilename)
|
||||
opj_destroy_cstr_info(&cstr_info);
|
||||
/* free image data structure */
|
||||
opj_image_destroy(image);
|
||||
|
||||
}
|
||||
|
||||
fclose(fout);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void j2k_dump_image(FILE *fd, opj_image_t * img) {
|
||||
int compno;
|
||||
fprintf(fd, "image {\n");
|
||||
fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
|
||||
fprintf(fd, " numcomps=%d\n", img->numcomps);
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_image_comp_t *comp = &img->comps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
||||
fprintf(fd, " prec=%d\n", comp->prec);
|
||||
/*fprintf(fd, " bpp=%d\n", comp->bpp);*/
|
||||
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
||||
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
|
||||
int tileno, compno, layno, bandno, resno, numbands;
|
||||
fprintf(fd, "coding parameters {\n");
|
||||
fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
|
||||
fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
|
||||
fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
|
||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
||||
opj_tcp_t *tcp = &cp->tcps[tileno];
|
||||
fprintf(fd, " tile %d {\n", tileno);
|
||||
fprintf(fd, " csty=%x\n", tcp->csty);
|
||||
fprintf(fd, " prg=%d\n", tcp->prg);
|
||||
fprintf(fd, " numlayers=%d\n", tcp->numlayers);
|
||||
fprintf(fd, " mct=%d\n", tcp->mct);
|
||||
fprintf(fd, " rates=");
|
||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
||||
fprintf(fd, "%.1f ", tcp->rates[layno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_tccp_t *tccp = &tcp->tccps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " csty=%x\n", tccp->csty);
|
||||
fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
|
||||
fprintf(fd, " cblkw=%d\n", tccp->cblkw);
|
||||
fprintf(fd, " cblkh=%d\n", tccp->cblkh);
|
||||
fprintf(fd, " cblksty=%x\n", tccp->cblksty);
|
||||
fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
|
||||
fprintf(fd, " qntsty=%d\n", tccp->qntsty);
|
||||
fprintf(fd, " numgbits=%d\n", tccp->numgbits);
|
||||
fprintf(fd, " roishift=%d\n", tccp->roishift);
|
||||
fprintf(fd, " stepsizes=");
|
||||
numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
|
||||
for (bandno = 0; bandno < numbands; bandno++) {
|
||||
fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
|
||||
tccp->stepsizes[bandno].expn);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
|
||||
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
||||
fprintf(fd, " prcw=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prcw[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
fprintf(fd, " prch=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prch[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/*
|
||||
* uce-dirent.h - operating system independent dirent implementation
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1998-2002 Toni Ronkko
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* ``Software''), to deal in the Software without restriction, including
|
||||
|
@ -11,10 +11,10 @@
|
|||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
|
@ -22,8 +22,8 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
|
||||
*
|
||||
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
|
||||
|
@ -59,7 +59,7 @@
|
|||
* Revision 1.1 1998/07/04 16:27:51 tr
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*
|
||||
* MSVC 1.0 scans automatic dependencies incorrectly when your project
|
||||
* contains this very header. The problem is that MSVC cannot handle
|
||||
* include directives inside #if..#endif block those are never entered.
|
||||
|
@ -69,7 +69,7 @@
|
|||
* handle inclusion of sys/dir.h in a part that is compiled only in Apollo
|
||||
* operating system. To fix the problem you need to insert DIR.H into
|
||||
* SYSINCL.DAT located in MSVC\BIN directory and restart visual C++.
|
||||
* Consult manuals for more information about the problem.
|
||||
* Consult manuals for more informaton about the problem.
|
||||
*
|
||||
* Since many UNIX systems have dirent.h we assume to have one also.
|
||||
* However, if your UNIX system does not have dirent.h you can download one
|
||||
|
@ -102,18 +102,18 @@
|
|||
|
||||
/*
|
||||
* See what kind of dirent interface we have unless autoconf has already
|
||||
* determined that.
|
||||
* determinated that.
|
||||
*/
|
||||
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
|
||||
# if defined(_MSC_VER) /* Microsoft C/C++ */
|
||||
/* no dirent.h */
|
||||
/* no dirent.h */
|
||||
# elif defined(__MINGW32__) /* MinGW */
|
||||
/* no dirent.h */
|
||||
/* no dirent.h */
|
||||
# elif defined(__BORLANDC__) /* Borland C/C++ */
|
||||
# define HAVE_DIRENT_H
|
||||
# define VOID_CLOSEDIR
|
||||
# elif defined(__TURBOC__) /* Borland Turbo C */
|
||||
/* no dirent.h */
|
||||
/* no dirent.h */
|
||||
# elif defined(__WATCOMC__) /* Watcom C/C++ */
|
||||
# define HAVE_DIRECT_H
|
||||
# elif defined(__apollo) /* Apollo */
|
||||
|
@ -172,7 +172,7 @@
|
|||
|
||||
#elif defined(MSDOS) || defined(WIN32)
|
||||
|
||||
/* figure out type of underlying directory interface to be used */
|
||||
/* figure out type of underlaying directory interface to be used */
|
||||
# if defined(WIN32)
|
||||
# define DIRENT_WIN32_INTERFACE
|
||||
# elif defined(MSDOS)
|
||||
|
@ -181,7 +181,7 @@
|
|||
# error "missing native dirent interface"
|
||||
# endif
|
||||
|
||||
/*** WIN32 specifics ***/
|
||||
/*** WIN32 specifics ***/
|
||||
# if defined(DIRENT_WIN32_INTERFACE)
|
||||
# include <windows.h>
|
||||
# if !defined(DIRENT_MAXNAMLEN)
|
||||
|
@ -189,11 +189,11 @@
|
|||
# endif
|
||||
|
||||
|
||||
/*** MS-DOS specifics ***/
|
||||
/*** MS-DOS specifics ***/
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||
# include <dos.h>
|
||||
|
||||
/* Borland defines file length macros in dir.h */
|
||||
/* Borland defines file length macros in dir.h */
|
||||
# if defined(__BORLANDC__)
|
||||
# include <dir.h>
|
||||
# if !defined(DIRENT_MAXNAMLEN)
|
||||
|
@ -203,7 +203,7 @@
|
|||
# define _find_t find_t
|
||||
# endif
|
||||
|
||||
/* Turbo C defines ffblk structure in dir.h */
|
||||
/* Turbo C defines ffblk structure in dir.h */
|
||||
# elif defined(__TURBOC__)
|
||||
# include <dir.h>
|
||||
# if !defined(DIRENT_MAXNAMLEN)
|
||||
|
@ -211,13 +211,13 @@
|
|||
# endif
|
||||
# define DIRENT_USE_FFBLK
|
||||
|
||||
/* MSVC */
|
||||
/* MSVC */
|
||||
# elif defined(_MSC_VER)
|
||||
# if !defined(DIRENT_MAXNAMLEN)
|
||||
# define DIRENT_MAXNAMLEN (12)
|
||||
# endif
|
||||
|
||||
/* Watcom */
|
||||
/* Watcom */
|
||||
# elif defined(__WATCOMC__)
|
||||
# if !defined(DIRENT_MAXNAMLEN)
|
||||
# if defined(__OS2__) || defined(__NT__)
|
||||
|
@ -230,7 +230,7 @@
|
|||
# endif
|
||||
# endif
|
||||
|
||||
/*** generic MS-DOS and MS-Windows stuff ***/
|
||||
/*** generic MS-DOS and MS-Windows stuff ***/
|
||||
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
|
||||
# define NAME_MAX DIRENT_MAXNAMLEN
|
||||
# endif
|
||||
|
@ -239,55 +239,53 @@
|
|||
# endif
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
typedef struct dirent {
|
||||
/*
|
||||
* 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 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.
|
||||
*/
|
||||
typedef struct dirent {
|
||||
char d_name[NAME_MAX + 1];
|
||||
|
||||
/*** Operating system specific part ***/
|
||||
# if defined(DIRENT_WIN32_INTERFACE) /*WIN32*/
|
||||
WIN32_FIND_DATA data;
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE) /*MS-DOS*/
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE) /*MSDOS*/
|
||||
# if defined(DIRENT_USE_FFBLK)
|
||||
struct ffblk data;
|
||||
# else
|
||||
struct _find_t data;
|
||||
# endif
|
||||
# endif
|
||||
} dirent;
|
||||
} dirent;
|
||||
|
||||
/* DIR substitute structure containing directory name. The name is
|
||||
* essential for the operation of ``rewinndir'' function. */
|
||||
typedef struct DIR {
|
||||
/* DIR substitute structure containing directory name. The name is
|
||||
* essential for the operation of ``rewinndir'' function. */
|
||||
typedef struct DIR {
|
||||
char *dirname; /* directory being scanned */
|
||||
dirent current; /* current entry */
|
||||
int dirent_filled; /* is current un-processed? */
|
||||
|
||||
/*** Operating system specific part ***/
|
||||
/*** Operating system specific part ***/
|
||||
# if defined(DIRENT_WIN32_INTERFACE)
|
||||
HANDLE search_handle;
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||
# endif
|
||||
} DIR;
|
||||
} DIR;
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* supply prototypes for dirent functions */
|
||||
static DIR *opendir(const char *dirname);
|
||||
static struct dirent *readdir(DIR *dirp);
|
||||
static int closedir(DIR *dirp);
|
||||
#ifdef unused
|
||||
static void rewinddir(DIR *dirp);
|
||||
#endif
|
||||
static DIR *opendir (const char *dirname);
|
||||
static struct dirent *readdir (DIR *dirp);
|
||||
static int closedir (DIR *dirp);
|
||||
static void rewinddir (DIR *dirp);
|
||||
|
||||
/*
|
||||
* Implement dirent interface as static functions so that the user does not
|
||||
|
@ -314,9 +312,9 @@ static void rewinddir(DIR *dirp);
|
|||
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
|
||||
#endif
|
||||
|
||||
static int _initdir(DIR *p);
|
||||
static const char *_getdirname(const struct dirent *dp);
|
||||
static void _setdirname(struct DIR *dirp);
|
||||
static int _initdir (DIR *p);
|
||||
static const char *_getdirname (const struct dirent *dp);
|
||||
static void _setdirname (struct DIR *dirp);
|
||||
|
||||
/*
|
||||
* <function name="opendir">
|
||||
|
@ -327,7 +325,7 @@ static void _setdirname(struct DIR *dirp);
|
|||
* internal working area that is used for retrieving individual directory
|
||||
* entries. The internal working area has no fields of your interest.
|
||||
*
|
||||
* <ret>Returns a pointer to the internal working area or NULL in case the
|
||||
* <ret>Returns a pointer to the internal working area or NULL in case the
|
||||
* directory stream could not be opened. Global `errno' variable will set
|
||||
* in case of error as follows:
|
||||
*
|
||||
|
@ -346,45 +344,46 @@ static void _setdirname(struct DIR *dirp);
|
|||
*/
|
||||
static DIR *opendir(const char *dirname)
|
||||
{
|
||||
DIR *dirp;
|
||||
assert(dirname != NULL);
|
||||
|
||||
dirp = (DIR*)malloc(sizeof(struct DIR));
|
||||
if (dirp != NULL) {
|
||||
char *p;
|
||||
|
||||
/* allocate room for directory name */
|
||||
dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*"));
|
||||
if (dirp->dirname == NULL) {
|
||||
/* failed to duplicate directory name. errno set by malloc() */
|
||||
free(dirp);
|
||||
return NULL;
|
||||
}
|
||||
/* Copy directory name while appending directory separator and "*.*".
|
||||
* Directory separator is not appended if the name already ends with
|
||||
* drive or directory separator. Directory separator is assumed to be
|
||||
* '/' or '\' and drive separator is assumed to be ':'. */
|
||||
strcpy(dirp->dirname, dirname);
|
||||
p = strchr(dirp->dirname, '\0');
|
||||
if (dirp->dirname < p &&
|
||||
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') {
|
||||
strcpy(p++, "\\");
|
||||
}
|
||||
DIR *dirp;
|
||||
assert (dirname != NULL);
|
||||
|
||||
dirp = (DIR*)malloc (sizeof (struct DIR));
|
||||
if (dirp != NULL) {
|
||||
char *p;
|
||||
|
||||
/* allocate room for directory name */
|
||||
dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
|
||||
if (dirp->dirname == NULL) {
|
||||
/* failed to duplicate directory name. errno set by malloc() */
|
||||
free (dirp);
|
||||
return NULL;
|
||||
}
|
||||
/* Copy directory name while appending directory separator and "*.*".
|
||||
* Directory separator is not appended if the name already ends with
|
||||
* drive or directory separator. Directory separator is assumed to be
|
||||
* '/' or '\' and drive separator is assumed to be ':'. */
|
||||
strcpy (dirp->dirname, dirname);
|
||||
p = strchr (dirp->dirname, '\0');
|
||||
if (dirp->dirname < p &&
|
||||
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
|
||||
{
|
||||
strcpy (p++, "\\");
|
||||
}
|
||||
# ifdef DIRENT_WIN32_INTERFACE
|
||||
strcpy(p, "*"); /*scan files with and without extension in win32*/
|
||||
strcpy (p, "*"); /*scan files with and without extension in win32*/
|
||||
# else
|
||||
strcpy(p, "*.*"); /*scan files with and without extension in DOS*/
|
||||
strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
|
||||
# endif
|
||||
|
||||
/* open stream */
|
||||
if (_initdir(dirp) == 0) {
|
||||
/* initialization failed */
|
||||
free(dirp->dirname);
|
||||
free(dirp);
|
||||
return NULL;
|
||||
}
|
||||
/* open stream */
|
||||
if (_initdir (dirp) == 0) {
|
||||
/* initialization failed */
|
||||
free (dirp->dirname);
|
||||
free (dirp);
|
||||
return NULL;
|
||||
}
|
||||
return dirp;
|
||||
}
|
||||
return dirp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,7 +411,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
|
||||
|
@ -435,57 +434,57 @@ static DIR *opendir(const char *dirname)
|
|||
* </function>
|
||||
*/
|
||||
static struct dirent *
|
||||
readdir(DIR *dirp)
|
||||
readdir (DIR *dirp)
|
||||
{
|
||||
assert(dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
assert(dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
/* directory stream was opened/rewound incorrectly or it ended normally */
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
/* directory stream was opened/rewound incorrectly or it ended normally */
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dirp->dirent_filled != 0) {
|
||||
/*
|
||||
* Directory entry has already been retrieved and there is no need to
|
||||
* retrieve a new one. Directory entry will be retrieved in advance
|
||||
* when the user calls readdir function for the first time. This is so
|
||||
* because real dirent has separate functions for opening and reading
|
||||
* the stream whereas Win32 and DOS dirents open the stream
|
||||
* automatically when we retrieve the first file. Therefore, we have to
|
||||
* save the first file when opening the stream and later we have to
|
||||
* return the saved entry when the user tries to read the first entry.
|
||||
*/
|
||||
dirp->dirent_filled = 0;
|
||||
} else {
|
||||
/* fill in entry and return that */
|
||||
if (dirp->dirent_filled != 0) {
|
||||
/*
|
||||
* Directory entry has already been retrieved and there is no need to
|
||||
* retrieve a new one. Directory entry will be retrieved in advance
|
||||
* when the user calls readdir function for the first time. This is so
|
||||
* because real dirent has separate functions for opening and reading
|
||||
* the stream whereas Win32 and DOS dirents open the stream
|
||||
* automatically when we retrieve the first file. Therefore, we have to
|
||||
* save the first file when opening the stream and later we have to
|
||||
* return the saved entry when the user tries to read the first entry.
|
||||
*/
|
||||
dirp->dirent_filled = 0;
|
||||
} else {
|
||||
/* 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 */
|
||||
FindClose(dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* Last file has been processed or an error occured */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||
if (_dos_findnext(&dirp->current.data) != 0) {
|
||||
/* _dos_findnext and findnext will set errno to ENOENT when no
|
||||
* more entries could be retrieved. */
|
||||
return NULL;
|
||||
}
|
||||
if (_dos_findnext (&dirp->current.data) != 0) {
|
||||
/* _dos_findnext and findnext will set errno to ENOENT when no
|
||||
* more entries could be retrieved. */
|
||||
return NULL;
|
||||
}
|
||||
# endif
|
||||
|
||||
_setdirname(dirp);
|
||||
assert(dirp->dirent_filled == 0);
|
||||
}
|
||||
return &dirp->current;
|
||||
_setdirname (dirp);
|
||||
assert (dirp->dirent_filled == 0);
|
||||
}
|
||||
return &dirp->current;
|
||||
}
|
||||
|
||||
|
||||
|
@ -509,44 +508,41 @@ readdir(DIR *dirp)
|
|||
* </function>
|
||||
*/
|
||||
static int
|
||||
closedir(DIR *dirp)
|
||||
{
|
||||
int retcode = 0;
|
||||
closedir (DIR *dirp)
|
||||
{
|
||||
int retcode = 0;
|
||||
|
||||
/* make sure that dirp points to legal structure */
|
||||
assert(dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* free directory name and search handles */
|
||||
if (dirp->dirname != NULL) {
|
||||
free(dirp->dirname);
|
||||
}
|
||||
/* make sure that dirp points to legal structure */
|
||||
assert (dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* free directory name and search handles */
|
||||
if (dirp->dirname != NULL) free (dirp->dirname);
|
||||
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||
if (FindClose(dirp->search_handle) == FALSE) {
|
||||
/* Unknown error */
|
||||
retcode = -1;
|
||||
errno = EBADF;
|
||||
}
|
||||
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||
if (FindClose (dirp->search_handle) == FALSE) {
|
||||
/* Unknown error */
|
||||
retcode = -1;
|
||||
errno = EBADF;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* clear dirp structure to make sure that it cannot be used anymore*/
|
||||
memset(dirp, 0, sizeof(*dirp));
|
||||
/* clear dirp structure to make sure that it cannot be used anymore*/
|
||||
memset (dirp, 0, sizeof (*dirp));
|
||||
# if defined(DIRENT_WIN32_INTERFACE)
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
# endif
|
||||
|
||||
free(dirp);
|
||||
return retcode;
|
||||
free (dirp);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
||||
#ifdef unused
|
||||
/*
|
||||
* <function name="rewinddir">
|
||||
* <intro>rewind directory stream to the beginning
|
||||
|
@ -569,71 +565,72 @@ closedir(DIR *dirp)
|
|||
* notice it later when you try to retrieve the first directory entry.
|
||||
*/
|
||||
static void
|
||||
rewinddir(DIR *dirp)
|
||||
{
|
||||
/* make sure that dirp is legal */
|
||||
assert(dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return;
|
||||
}
|
||||
assert(dirp->dirname != NULL);
|
||||
|
||||
/* close previous stream */
|
||||
rewinddir (DIR *dirp)
|
||||
{
|
||||
/* make sure that dirp is legal */
|
||||
assert (dirp != NULL);
|
||||
if (dirp == NULL) {
|
||||
errno = EBADF;
|
||||
return;
|
||||
}
|
||||
assert (dirp->dirname != NULL);
|
||||
|
||||
/* close previous stream */
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||
if (FindClose(dirp->search_handle) == FALSE) {
|
||||
/* Unknown error */
|
||||
errno = EBADF;
|
||||
}
|
||||
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||
if (FindClose (dirp->search_handle) == FALSE) {
|
||||
/* Unknown error */
|
||||
errno = EBADF;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* re-open previous stream */
|
||||
if (_initdir(dirp) == 0) {
|
||||
/* initialization failed but we cannot deal with error. User will notice
|
||||
* error later when she tries to retrieve first directory entry. */
|
||||
/*EMPTY*/;
|
||||
}
|
||||
/* re-open previous stream */
|
||||
if (_initdir (dirp) == 0) {
|
||||
/* initialization failed but we cannot deal with error. User will notice
|
||||
* error later when she tries to retrieve first directory enty. */
|
||||
/*EMPTY*/;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Open native directory stream object and retrieve first file.
|
||||
* Be sure to close previous stream before opening new one.
|
||||
*/
|
||||
static int
|
||||
_initdir(DIR *dirp)
|
||||
{
|
||||
assert(dirp != NULL);
|
||||
assert(dirp->dirname != NULL);
|
||||
dirp->dirent_filled = 0;
|
||||
_initdir (DIR *dirp)
|
||||
{
|
||||
assert (dirp != NULL);
|
||||
assert (dirp->dirname != NULL);
|
||||
dirp->dirent_filled = 0;
|
||||
|
||||
# if defined(DIRENT_WIN32_INTERFACE)
|
||||
/* Open stream and retrieve first file */
|
||||
dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data);
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
/* something went wrong but we don't know what. GetLastError() could
|
||||
* give us more information about the error, but then we should map
|
||||
* the error code into errno. */
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
/* Open stream and retrieve first file */
|
||||
dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
/* something went wrong but we don't know what. GetLastError() could
|
||||
* give us more information about the error, but then we should map
|
||||
* the error code into errno. */
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||
if (_dos_findfirst(dirp->dirname,
|
||||
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
|
||||
&dirp->current.data) != 0) {
|
||||
/* _dos_findfirst and findfirst will set errno to ENOENT when no
|
||||
* more entries could be retrieved. */
|
||||
return 0;
|
||||
}
|
||||
if (_dos_findfirst (dirp->dirname,
|
||||
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
|
||||
&dirp->current.data) != 0)
|
||||
{
|
||||
/* _dos_findfirst and findfirst will set errno to ENOENT when no
|
||||
* more entries could be retrieved. */
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* initialize DIR and it's first entry */
|
||||
_setdirname(dirp);
|
||||
dirp->dirent_filled = 1;
|
||||
return 1;
|
||||
/* initialize DIR and it's first entry */
|
||||
_setdirname (dirp);
|
||||
dirp->dirent_filled = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -641,17 +638,17 @@ _initdir(DIR *dirp)
|
|||
* Return implementation dependent name of the current directory entry.
|
||||
*/
|
||||
static const char *
|
||||
_getdirname(const struct dirent *dp)
|
||||
_getdirname (const struct dirent *dp)
|
||||
{
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
return dp->data.cFileName;
|
||||
|
||||
return dp->data.cFileName;
|
||||
|
||||
#elif defined(DIRENT_USE_FFBLK)
|
||||
return dp->data.ff_name;
|
||||
|
||||
return dp->data.ff_name;
|
||||
|
||||
#else
|
||||
return dp->data.name;
|
||||
#endif
|
||||
return dp->data.name;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -659,17 +656,16 @@ _getdirname(const struct dirent *dp)
|
|||
* Copy name of implementation dependent directory entry to the d_name field.
|
||||
*/
|
||||
static void
|
||||
_setdirname(struct DIR *dirp)
|
||||
{
|
||||
/* make sure that d_name is long enough */
|
||||
assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX);
|
||||
|
||||
strncpy(dirp->current.d_name,
|
||||
_getdirname(&dirp->current),
|
||||
NAME_MAX);
|
||||
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
|
||||
_setdirname (struct DIR *dirp) {
|
||||
/* make sure that d_name is long enough */
|
||||
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
|
||||
|
||||
strncpy (dirp->current.d_name,
|
||||
_getdirname (&dirp->current),
|
||||
NAME_MAX);
|
||||
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
|
||||
}
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
|
@ -0,0 +1,537 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* 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 "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "color.h"
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#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;
|
||||
unsigned int maxw, maxh, max, i;
|
||||
int offset, upb;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)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) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
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;
|
||||
|
||||
}/* sycc444_to_rgb() */
|
||||
|
||||
static void sycc422_to_rgb(opj_image_t *img)
|
||||
{
|
||||
int *d0, *d1, *d2, *r, *g, *b;
|
||||
const int *y, *cb, *cr;
|
||||
unsigned int maxw, maxh, max;
|
||||
int offset, upb;
|
||||
unsigned int i, j;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)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) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0U; i < maxh; ++i)
|
||||
{
|
||||
for(j=0U; j < (maxw & ~(unsigned int)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);
|
||||
++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 = maxw; img->comps[1].h = maxh;
|
||||
img->comps[2].w = maxw; img->comps[2].h = maxh;
|
||||
img->comps[1].dx = img->comps[0].dx;
|
||||
img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[0].dy;
|
||||
img->comps[2].dy = img->comps[0].dy;
|
||||
}/* 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;
|
||||
unsigned int maxw, maxh, max;
|
||||
int offset, upb;
|
||||
unsigned int i, j;
|
||||
|
||||
upb = (int)img->comps[0].prec;
|
||||
offset = 1<<(upb - 1); upb = (1<<upb)-1;
|
||||
|
||||
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)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) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0U; i < (maxh & ~(unsigned int)1U); i += 2U)
|
||||
{
|
||||
ny = y + maxw;
|
||||
nr = r + maxw; ng = g + maxw; nb = b + maxw;
|
||||
|
||||
for(j=0; j < (maxw & ~(unsigned int)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 < maxw)
|
||||
{
|
||||
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 < maxh)
|
||||
{
|
||||
for(j=0U; j < (maxw & ~(unsigned int)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 = maxw; img->comps[1].h = maxh;
|
||||
img->comps[2].w = maxw; img->comps[2].h = maxh;
|
||||
img->comps[1].dx = img->comps[0].dx;
|
||||
img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[0].dy;
|
||||
img->comps[2].dy = img->comps[0].dy;
|
||||
|
||||
}/* sycc420_to_rgb() */
|
||||
|
||||
void color_sycc_to_rgb(opj_image_t *img)
|
||||
{
|
||||
if(img->numcomps < 3)
|
||||
{
|
||||
img->color_space = 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;
|
||||
}
|
||||
img->color_space = CLRSPC_SRGB;
|
||||
|
||||
}/* color_sycc_to_rgb() */
|
||||
|
||||
#if defined(HAVE_LIBLCMS2) || defined(HAVE_LIBLCMS1)
|
||||
#ifdef 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 /* HAVE_LIBLCMS1 */
|
||||
|
||||
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, nr_samples;
|
||||
int *r, *g, *b;
|
||||
int prec, i, max, max_w, max_h;
|
||||
OPJ_COLOR_SPACE oldspace;
|
||||
|
||||
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 = (int)image->comps[0].w;
|
||||
max_h = (int)image->comps[0].h;
|
||||
prec = (int)image->comps[0].prec;
|
||||
oldspace = image->color_space;
|
||||
|
||||
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();
|
||||
image->color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else if(out_space == cmsSigGrayData) /* enumCS 17 */
|
||||
{
|
||||
in_type = TYPE_GRAY_8;
|
||||
out_type = TYPE_RGB_8;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
||||
{
|
||||
in_type = TYPE_YCbCr_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = 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
|
||||
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 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
|
||||
image->color_space = oldspace;
|
||||
#ifdef 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 = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned char);
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; 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 = 0; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++;
|
||||
*g++ = (int)*out++;
|
||||
*b++ = (int)*out++;
|
||||
}
|
||||
free(inbuf); free(outbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short *inbuf, *outbuf, *in, *out;
|
||||
max = max_w * max_h;
|
||||
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned short);
|
||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; 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++;
|
||||
}
|
||||
free(inbuf); free(outbuf);
|
||||
}
|
||||
}
|
||||
else /* GRAY, GRAYA */
|
||||
{
|
||||
unsigned char *in, *inbuf, *out, *outbuf;
|
||||
max = max_w * max_h;
|
||||
nr_samples = (cmsUInt32Number)max * 3 * sizeof(unsigned char);
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
|
||||
image->comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
|
||||
|
||||
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 = (int*)calloc((size_t)max, sizeof(int));
|
||||
image->comps[2].data = (int*)calloc((size_t)max, sizeof(int));
|
||||
|
||||
image->numcomps += 2;
|
||||
|
||||
r = image->comps[0].data;
|
||||
|
||||
for(i = 0; 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 = 0; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
|
||||
}
|
||||
free(inbuf); free(outbuf);
|
||||
|
||||
}/* if(image->numcomps */
|
||||
|
||||
cmsDeleteTransform(transform);
|
||||
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
}/* color_apply_icc_profile() */
|
||||
|
||||
#endif /* HAVE_LIBLCMS2 || HAVE_LIBLCMS1 */
|
||||
|
|
@ -1,15 +1,9 @@
|
|||
/*
|
||||
* 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) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -40,8 +34,5 @@
|
|||
|
||||
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,15 +1,9 @@
|
|||
/*
|
||||
* 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) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -47,9 +41,8 @@
|
|||
#define BMP_DFMT 12
|
||||
#define YUV_DFMT 13
|
||||
#define TIF_DFMT 14
|
||||
#define RAW_DFMT 15 /* MSB / Big Endian */
|
||||
#define RAW_DFMT 15
|
||||
#define TGA_DFMT 16
|
||||
#define PNG_DFMT 17
|
||||
#define RAWL_DFMT 18 /* LSB / Little Endian */
|
||||
|
||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
|
@ -0,0 +1,254 @@
|
|||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* last review : october 29th, 2002 */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)opj_getopt.c 8.3 (Berkeley) 4/27/95";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "opj_getopt.h"
|
||||
|
||||
#ifdef USE_SYSTEM_GETOPT
|
||||
#error
|
||||
#endif
|
||||
|
||||
int opj_opterr = 1, /* if error message should be printed */
|
||||
opj_optind = 1, /* index into parent argv vector */
|
||||
opj_optopt, /* character checked for validity */
|
||||
opj_optreset; /* reset getopt */
|
||||
char *opj_optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
static char EMSG[]={""};
|
||||
|
||||
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
||||
void reset_options_reading(void) {
|
||||
opj_opterr = 1;
|
||||
opj_optind = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||
# define __progname nargv[0]
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli = NULL; /* option letter list index */
|
||||
|
||||
if (opj_optreset || !*place) { /* update scanning pointer */
|
||||
opj_optreset = 0;
|
||||
if (opj_optind >= nargc || *(place = nargv[opj_optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++opj_optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((opj_optopt = (int) *place++) == (int) ':' ||
|
||||
!(oli = strchr(ostr, opj_optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (opj_optopt == (int) '-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++opj_optind;
|
||||
if (opj_opterr && *ostr != ':') {
|
||||
fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname, opj_optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
opj_optarg = NULL;
|
||||
if (!*place)
|
||||
++opj_optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
opj_optarg = place;
|
||||
else if (nargc <= ++opj_optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
__progname, opj_optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
} else /* white space */
|
||||
opj_optarg = nargv[opj_optind];
|
||||
place = EMSG;
|
||||
++opj_optind;
|
||||
}
|
||||
return (opj_optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
|
||||
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen) {
|
||||
static int lastidx,lastofs;
|
||||
char *tmp;
|
||||
int i,len;
|
||||
char param = 1;
|
||||
|
||||
again:
|
||||
if (opj_optind >= argc || !argv[opj_optind] || *argv[opj_optind]!='-')
|
||||
return -1;
|
||||
|
||||
if (argv[opj_optind][0]=='-' && argv[opj_optind][1]==0) {
|
||||
if(opj_optind >= (argc - 1)){ /* no more input parameters */
|
||||
param = 0;
|
||||
}
|
||||
else{ /* more input parameters */
|
||||
if(argv[opj_optind + 1][0] == '-'){
|
||||
param = 0; /* Missing parameter after '-' */
|
||||
}
|
||||
else{
|
||||
param = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (param == 0) {
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}
|
||||
|
||||
if (argv[opj_optind][0]=='-') { /* long option */
|
||||
char* arg=argv[opj_optind]+1;
|
||||
const opj_option_t* o;
|
||||
o=longopts;
|
||||
len=sizeof(longopts[0]);
|
||||
|
||||
if (param > 1){
|
||||
arg = argv[opj_optind+1];
|
||||
opj_optind++;
|
||||
}
|
||||
else
|
||||
arg = argv[opj_optind]+1;
|
||||
|
||||
if(strlen(arg)>1){
|
||||
for (i=0;i<totlen;i=i+len,o++) {
|
||||
if (!strcmp(o->name,arg)) { /* match */
|
||||
if (o->has_arg == 0) {
|
||||
if ((argv[opj_optind+1])&&(!(argv[opj_optind+1][0]=='-'))){
|
||||
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[opj_optind+1]);
|
||||
++opj_optind;
|
||||
}
|
||||
}else{
|
||||
opj_optarg=argv[opj_optind+1];
|
||||
if(opj_optarg){
|
||||
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!opj_optarg && o->has_arg==1) { /* no argument there */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument \n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
++opj_optind;
|
||||
}
|
||||
++opj_optind;
|
||||
if (o->flag)
|
||||
*(o->flag)=o->val;
|
||||
else
|
||||
return o->val;
|
||||
return 0;
|
||||
}
|
||||
}/*(end for)String not found in the list*/
|
||||
fprintf(stderr,"Invalid option %s\n",arg);
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}else{ /*Single character input parameter*/
|
||||
if (*optstring==':') return ':';
|
||||
if (lastidx!=opj_optind) {
|
||||
lastidx=opj_optind; lastofs=0;
|
||||
}
|
||||
opj_optopt=argv[opj_optind][lastofs+1];
|
||||
if ((tmp=strchr(optstring,opj_optopt))) {/*Found input parameter in list*/
|
||||
if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
|
||||
++opj_optind;
|
||||
goto again;
|
||||
}
|
||||
if (tmp[1]==':') { /* argument expected */
|
||||
if (tmp[2]==':' || argv[opj_optind][lastofs+2]) { /* "-foo", return "oo" as opj_optarg */
|
||||
if (!*(opj_optarg=argv[opj_optind]+lastofs+2)) opj_optarg=0;
|
||||
goto found;
|
||||
}
|
||||
opj_optarg=argv[opj_optind+1];
|
||||
if(opj_optarg){
|
||||
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!opj_optarg) { /* missing argument */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
++opj_optind;
|
||||
}else {/*Argument not expected*/
|
||||
++lastofs;
|
||||
return opj_optopt;
|
||||
}
|
||||
found:
|
||||
++opj_optind;
|
||||
return opj_optopt;
|
||||
} else { /* not found */
|
||||
fprintf(stderr,"Invalid option %s\n",arg);
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}/*end of not found*/
|
||||
|
||||
}/* end of single character*/
|
||||
}/*end '-'*/
|
||||
fprintf(stderr,"Invalid option\n");
|
||||
++opj_optind;
|
||||
return (BADCH);;
|
||||
}/*end function*/
|
|
@ -0,0 +1,51 @@
|
|||
/* last review : october 29th, 2002 */
|
||||
|
||||
#include "opj_config.h"
|
||||
|
||||
#ifdef USE_SYSTEM_GETOPT
|
||||
#include <getopt.h>
|
||||
|
||||
#define opj_opterr opterr
|
||||
#define opj_optind optind
|
||||
#define opj_optopt optopt
|
||||
#define opj_optreset optreset
|
||||
#define opj_optarg optarg
|
||||
|
||||
typedef struct option opj_option_t;
|
||||
|
||||
#define NO_ARG no_argument
|
||||
#define REQ_ARG required_argument
|
||||
#define OPT_ARG optional_argument
|
||||
|
||||
#define opj_getopt getopt
|
||||
#define opj_getopt_long getopt_long
|
||||
|
||||
#else
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
typedef struct opj_option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
} opj_option_t;
|
||||
|
||||
#define NO_ARG 0
|
||||
#define REQ_ARG 1
|
||||
#define OPT_ARG 2
|
||||
|
||||
extern int opj_opterr;
|
||||
extern int opj_optind;
|
||||
extern int opj_optopt;
|
||||
extern int opj_optreset;
|
||||
extern char *opj_optarg;
|
||||
|
||||
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
|
||||
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen);
|
||||
extern void reset_options_reading(void);
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
||||
#endif /* USE_SYSTEM_GETOPT */
|
|
@ -0,0 +1,127 @@
|
|||
What's New for OpenJPIP
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
Feburary 28, 2012
|
||||
+ [kaori] enabled the opj_server to reply the first query consisting with len request from kakadu client
|
||||
|
||||
February 9, 2012
|
||||
* [kaori] fixed Doxygen configuration file to document the utilities
|
||||
+ [kaori] added execution argument to set port number for opj_dec_server, opj_viewer*
|
||||
|
||||
January 26, 2012
|
||||
! [kaori] unapplied auxtrans_manager to the local mode
|
||||
|
||||
December 24, 2011
|
||||
* [kaori] additional modification for the warning
|
||||
|
||||
December 22, 2011
|
||||
* [kaori] fixed auxtrans_manager to enable MAC
|
||||
* [kaori] warnings due to disregarding return value are removed
|
||||
|
||||
November 30, 2011
|
||||
+ [kaori] TCP return (http-tcp) implemented
|
||||
|
||||
November 16, 2011
|
||||
* [kaori] fixed Region of Interest option, and memory leak of opj_dec_server
|
||||
+ [kaori] new feature to target JP2 files from www (libcurl required)
|
||||
* [kaori] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed
|
||||
|
||||
November 8, 2011
|
||||
! [kaori] updated main page of doxygen
|
||||
|
||||
November 3, 2011
|
||||
* [kaori] solved memory leak of opj_server
|
||||
! [kaori] removed redundant defines
|
||||
|
||||
November 2, 2011
|
||||
* [antonin] additional patches for autotools and cmake
|
||||
|
||||
October 26, 2011
|
||||
* [kaori] additional patches for autotool are applied
|
||||
|
||||
October 25, 2011
|
||||
* [kaori] patches for cmake and autotool are applied
|
||||
* [kaori] fixed client viewer to be compatible with server response header both Content-type and Content-Type
|
||||
|
||||
October 20, 2011
|
||||
+ [added] API style in openJPIP library
|
||||
! [kaori] rearranged directories, applications are all under util/ directory, currently only 'make -f Makefile.nix' works
|
||||
|
||||
October 18, 2011
|
||||
! [kaori] rearranged opj_server, opj_dec_server directory
|
||||
|
||||
October 14, 2011
|
||||
+ [kaori] enable all progression orders
|
||||
|
||||
October 12, 2011
|
||||
+ [kaori] enable layers requests; restricting the number of codesream quality layers
|
||||
|
||||
October 11, 2011
|
||||
+ [antonin] enable JPT-stream request from client viewer option (credit to kaori)
|
||||
|
||||
October 10, 2011
|
||||
- [antonin] removed obsolete indexer utility (credit to kaori)
|
||||
+ [antonin] enabled JPP-stream (credit to kaori)
|
||||
|
||||
September 16, 2011
|
||||
+ [kaori] enabled stateless requests from the opj_viewers
|
||||
|
||||
Septempber 1, 2011
|
||||
* [kaori] changed terminating status of opj_server in debug/non-server mode
|
||||
|
||||
August 27, 2011
|
||||
* [antonin] fixed missing include directory in opj_client/opj_dec_server/CMakeLists.txt
|
||||
|
||||
August 26, 2011
|
||||
* [antonin] fixed cmake and autotools files to reflect recent indexer changes in JPIP
|
||||
! [kaori] indexer using the latest openjpeg library
|
||||
* [antonin] fixed cmake and autotools files to reflect recent changes in JPIP
|
||||
! [kaori] fixed Makefile.nix to load openjpeg library from this archive
|
||||
|
||||
August 25, 2011
|
||||
+ [kaori] added tid request support to JPIP client
|
||||
+ [kaori] added quit JPIP server request
|
||||
|
||||
August 24, 2011
|
||||
+ [kaori] added cachemodel_manager, which had been managed in target_manager previously
|
||||
+ [kaori] added tid request support to JPIP server
|
||||
|
||||
August 16, 2011
|
||||
* [antonin] fixed cmake support for openjpip
|
||||
|
||||
August 12, 2011
|
||||
+ [antonin] added cmake support to openjpip
|
||||
|
||||
July 6, 2011
|
||||
* [antonin] JPIP : fixed autotools to work with recent name changes
|
||||
|
||||
July 5, 2011
|
||||
! [kaori] changed parameter, file names, message names regarding JPT-stream to JPIP-stream, which handles also JPP-stream
|
||||
|
||||
May 26, 2011
|
||||
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
|
||||
|
||||
May 23, 2011
|
||||
+ [antonin] added autotools for the 'tools' directory
|
||||
+ [antonin] added autotools as a build method for jpip (credit to Vincent Torri)
|
||||
|
||||
May 10, 2011
|
||||
! [kaori] opj_viewer removed the xml functions (for users without Xersus2)
|
||||
+ [kaori] renamed opj_viewer to opj_viewer_xerces ( needs Xersus2)
|
||||
! [kaori] Modification of opj_dec_server to be portable to windows
|
||||
|
||||
May 9, 2011
|
||||
* [kaori] Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h
|
||||
|
||||
May 9, 2011
|
||||
* [antonin] OpenJPIP: small bug fixes to compile on win platform
|
||||
|
||||
May 8, 2011
|
||||
* [antonin] OpenJPIP: fixed several bugs in opj_server (removal of strsep function, duplication of query string) + some changes to compile opj_server under windows (replacement of strcasecmp(), bzero()).
|
||||
|
||||
April 14, 2011
|
||||
+ [antonin] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details)
|
|
@ -0,0 +1,16 @@
|
|||
# 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(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
ENDIF(BUILD_JPIP_SERVER)
|
||||
|
||||
# JPIP library:
|
||||
ADD_SUBDIRECTORY(libopenjpip)
|
||||
|
||||
# JPIP binaries:
|
||||
ADD_SUBDIRECTORY(util)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = libopenjpip util
|
|
@ -92,7 +92,7 @@ Server:
|
|||
For shutting down JPIP server:
|
||||
%GET http://hostname/myFCGI?quitJPIP
|
||||
Notice, http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting)
|
||||
Request message "quitJPIP" can be changed in Makefile, modify -DQUIT_SIGNAL=\"quitJPIP\"
|
||||
Requst message "quitJPIP" can be changed in Makfile, modify -DQUIT_SIGNAL=\"quitJPIP\"
|
||||
|
||||
Client:
|
||||
1. Launch image decoding server, and keep it alive as long as image viewers are open
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |