Compare commits
695 Commits
version.1.
...
version.2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb6fc485c8 | ||
|
|
d84bc9718d | ||
|
|
3a38d58139 | ||
|
|
ebb9e62a4f | ||
|
|
4e737ec12f | ||
|
|
14ab311d2f | ||
|
|
02ab4363b6 | ||
|
|
e1f7c73324 | ||
|
|
3042fc2a29 | ||
|
|
a622c1c2fe | ||
|
|
b3e467dcba | ||
|
|
c0259255b0 | ||
|
|
9398bc1764 | ||
|
|
fcf9fa3651 | ||
|
|
583df79be9 | ||
|
|
0e0b892493 | ||
|
|
78a8d64a92 | ||
|
|
5433e4dab8 | ||
|
|
c3c59b010b | ||
|
|
8eb481b6c6 | ||
|
|
d5efeb7df5 | ||
|
|
f663042893 | ||
|
|
f07c1a11a0 | ||
|
|
ce297bfa9e | ||
|
|
ba1682c120 | ||
|
|
e212154d8d | ||
|
|
ec0fe09138 | ||
|
|
8562ed3018 | ||
|
|
21b0ccf859 | ||
|
|
84c93c2fea | ||
|
|
e3c2305ff4 | ||
|
|
0e3c467a5b | ||
|
|
94880d8f36 | ||
|
|
7307bb6e9a | ||
|
|
4263410fe8 | ||
|
|
cb0eb855ca | ||
|
|
569d0ec7cc | ||
|
|
1021e87522 | ||
|
|
dc34cf362f | ||
|
|
e71749428c | ||
|
|
8f58b776b0 | ||
|
|
fb0a11636f | ||
|
|
7bf09734d7 | ||
|
|
853bcb3c64 | ||
|
|
4d32395fe1 | ||
|
|
a6a141d326 | ||
|
|
e0161e03db | ||
|
|
82d29d4c2a | ||
|
|
1a5791750b | ||
|
|
482d9b58b3 | ||
|
|
5903dd7d82 | ||
|
|
301b1ffbc7 | ||
|
|
759be64115 | ||
|
|
ece2a2d6c2 | ||
|
|
f31957c502 | ||
|
|
fb69541cfa | ||
|
|
e189679ebc | ||
|
|
18e7fcc37f | ||
|
|
1c8a657044 | ||
|
|
cdea5c8eef | ||
|
|
bcc386e3bb | ||
|
|
a2bd3bb75b | ||
|
|
b63d618e48 | ||
|
|
8864c2d59b | ||
|
|
c75073fbf4 | ||
|
|
cf4529d058 | ||
|
|
9b6900b058 | ||
|
|
7f7ef068fc | ||
|
|
a41790ce8a | ||
|
|
06615a556d | ||
|
|
94a69c2b31 | ||
|
|
425ff2f81d | ||
|
|
2257166e61 | ||
|
|
56cf5f4f67 | ||
|
|
668484ba8f | ||
|
|
f824078c14 | ||
|
|
3250833a62 | ||
|
|
8bc24912d1 | ||
|
|
52f6f7e0c7 | ||
|
|
ee8ee69c30 | ||
|
|
4941ebcc91 | ||
|
|
9adbea785b | ||
|
|
fd19413196 | ||
|
|
6300a8a0a2 | ||
|
|
66c1228c95 | ||
|
|
4585b23552 | ||
|
|
23a624f73a | ||
|
|
f3d7d2f7b1 | ||
|
|
0358983ee6 | ||
|
|
a0977266b4 | ||
|
|
76947f0074 | ||
|
|
f649754018 | ||
|
|
b1c5ce2517 | ||
|
|
f2db5ec4fb | ||
|
|
db08494776 | ||
|
|
9166d595e6 | ||
|
|
f1061c8763 | ||
|
|
fca9803bee | ||
|
|
0d841b5e05 | ||
|
|
216791c3fb | ||
|
|
12c4e68058 | ||
|
|
b4b451863d | ||
|
|
f2808de855 | ||
|
|
9b2897ccd9 | ||
|
|
3c4698435c | ||
|
|
98682e1073 | ||
|
|
d6bcb8b7e0 | ||
|
|
a501237ae3 | ||
|
|
f6622c2fbb | ||
|
|
b08b90d71c | ||
|
|
b46ed8c7a3 | ||
|
|
45869ce843 | ||
|
|
dff377a741 | ||
|
|
b24cf8d157 | ||
|
|
2ad90b7c41 | ||
|
|
a40fc41988 | ||
|
|
3416c6d91b | ||
|
|
54c2bcb60f | ||
|
|
44a5108e1d | ||
|
|
d8715871fa | ||
|
|
772fcc963c | ||
|
|
75b7104724 | ||
|
|
fe3c1f9061 | ||
|
|
e30818ce39 | ||
|
|
2e30886a0d | ||
|
|
b18ffbd08a | ||
|
|
16d2dc662f | ||
|
|
9832c911b3 | ||
|
|
23f5eeec20 | ||
|
|
16106b2978 | ||
|
|
c66e6be4a4 | ||
|
|
eda4c26d24 | ||
|
|
4b140e060b | ||
|
|
1fefa03329 | ||
|
|
37ff9b029c | ||
|
|
e798fe37e1 | ||
|
|
f4a8f7165c | ||
|
|
2d52e409c2 | ||
|
|
1b5e677d0c | ||
|
|
c508923f04 | ||
|
|
6c4024796e | ||
|
|
bd2c6cfa55 | ||
|
|
bd74db932e | ||
|
|
439337fb1b | ||
|
|
5ffe6f5acf | ||
|
|
f281f8cb75 | ||
|
|
3a46e2d86b | ||
|
|
6a84a1788b | ||
|
|
df870e5241 | ||
|
|
82afd3a891 | ||
|
|
514fc72050 | ||
|
|
4dba9aed22 | ||
|
|
a46dbe6941 | ||
|
|
394db7b738 | ||
|
|
3ad58ee1f5 | ||
|
|
00aa77f2d9 | ||
|
|
60fc79c717 | ||
|
|
f501186b18 | ||
|
|
fe6d9ed9ba | ||
|
|
c450d418ef | ||
|
|
c3b1af023b | ||
|
|
bf37be46b8 | ||
|
|
4466c31fc2 | ||
|
|
b2bebcf5ce | ||
|
|
de33ba029b | ||
|
|
465db44499 | ||
|
|
abdb8ee3f7 | ||
|
|
aa6b4b4970 | ||
|
|
25cbfcf34a | ||
|
|
cffc33a51c | ||
|
|
5db7b01fa2 | ||
|
|
1ca5ca8392 | ||
|
|
93761d9ab5 | ||
|
|
bb16d8816c | ||
|
|
e1cd500ac5 | ||
|
|
2d09cbfd21 | ||
|
|
d84b16caf9 | ||
|
|
95f06f0591 | ||
|
|
3bf4d635f2 | ||
|
|
a4fa18e92d | ||
|
|
f71af2a2ef | ||
|
|
3e62f8d9b7 | ||
|
|
028720c9ec | ||
|
|
d518970039 | ||
|
|
8363a6ab1e | ||
|
|
a540dcd2e2 | ||
|
|
58b2c6c4a5 | ||
|
|
34ffde6799 | ||
|
|
e7cd945000 | ||
|
|
ccf0f05e98 | ||
|
|
36672ad50e | ||
|
|
8bee3d89c5 | ||
|
|
cf212e55ac | ||
|
|
a00f61bd5d | ||
|
|
dca76de872 | ||
|
|
70540f9563 | ||
|
|
a545cb7cff | ||
|
|
9a86a3bd23 | ||
|
|
69673635ef | ||
|
|
77e6971bbb | ||
|
|
a9a1336502 | ||
|
|
9103674950 | ||
|
|
2af39ac017 | ||
|
|
d47b8fef18 | ||
|
|
f8fc214b11 | ||
|
|
7861bfa45e | ||
|
|
02734264a1 | ||
|
|
4a845f3d04 | ||
|
|
0452ebdfcd | ||
|
|
c8b8c4cf30 | ||
|
|
1ff1401ff1 | ||
|
|
3991bbe595 | ||
|
|
20beb093a1 | ||
|
|
3135642ff5 | ||
|
|
d5bb3b0039 | ||
|
|
f16216e270 | ||
|
|
de9e1a0693 | ||
|
|
47b18d89f6 | ||
|
|
3f5b474b16 | ||
|
|
b103fec939 | ||
|
|
728be68bfe | ||
|
|
5820e97abe | ||
|
|
4e81ea2a8a | ||
|
|
7bfdb31c77 | ||
|
|
44cec04294 | ||
|
|
c60a84b6f5 | ||
|
|
3b953cc763 | ||
|
|
859ce39666 | ||
|
|
7c6ea4ed00 | ||
|
|
3dab3be859 | ||
|
|
062ed99894 | ||
|
|
d275fc90cf | ||
|
|
dbc4c47b15 | ||
|
|
e6d97ce928 | ||
|
|
b7473285ec | ||
|
|
8b7107b81f | ||
|
|
d1251b2850 | ||
|
|
e972589554 | ||
|
|
0f19c958da | ||
|
|
2935fbc089 | ||
|
|
f47fc4f111 | ||
|
|
01c95cb07e | ||
|
|
1f94541732 | ||
|
|
ff43b4dca0 | ||
|
|
5d494e940f | ||
|
|
30de580afe | ||
|
|
0c13350ea4 | ||
|
|
83a661c360 | ||
|
|
38ec1325c4 | ||
|
|
2ca2e83ce5 | ||
|
|
a9908ba7bd | ||
|
|
9f874c00aa | ||
|
|
b52cdf6a95 | ||
|
|
40e637d9e1 | ||
|
|
21c76d97bb | ||
|
|
4b3147ede7 | ||
|
|
a037a66ea4 | ||
|
|
c071819c26 | ||
|
|
28e018de8a | ||
|
|
65102c0ba5 | ||
|
|
ff8e97310d | ||
|
|
2546661aeb | ||
|
|
fdeed49637 | ||
|
|
fab7693da5 | ||
|
|
582323d63c | ||
|
|
a6522d3706 | ||
|
|
28a0028762 | ||
|
|
ec19c32b63 | ||
|
|
ec9aceb96f | ||
|
|
0e1c2e3378 | ||
|
|
094b952d70 | ||
|
|
3821a4e054 | ||
|
|
d24404ca9a | ||
|
|
fb2d6e8870 | ||
|
|
e421cbac2a | ||
|
|
a71310f58b | ||
|
|
43c392626b | ||
|
|
d286573958 | ||
|
|
ff889c40da | ||
|
|
0ecdbe8614 | ||
|
|
8b3500a2a9 | ||
|
|
c5fd56606d | ||
|
|
dd86b85664 | ||
|
|
3ec9f5fa0b | ||
|
|
3bf3ce06f7 | ||
|
|
cc1d601722 | ||
|
|
e8c1b849b7 | ||
|
|
de44b71b12 | ||
|
|
df70c7136d | ||
|
|
bf2b9ea539 | ||
|
|
b0b46c331e | ||
|
|
b3269581ea | ||
|
|
699edd4393 | ||
|
|
9128c6c17b | ||
|
|
f121223ed8 | ||
|
|
3c0e360df1 | ||
|
|
1de6f5fcf6 | ||
|
|
5bf4b718d4 | ||
|
|
f912007fe8 | ||
|
|
377809a35b | ||
|
|
f0f981b80d | ||
|
|
2b9302632c | ||
|
|
a59a1552ad | ||
|
|
4a80e821df | ||
|
|
6822291f91 | ||
|
|
863aacaee3 | ||
|
|
00a2bf7120 | ||
|
|
6ac5acf765 | ||
|
|
ce7583f173 | ||
|
|
24b10ac585 | ||
|
|
706371e24f | ||
|
|
5de8639685 | ||
|
|
d42e26d59c | ||
|
|
6ea06e87bb | ||
|
|
5eb8a44317 | ||
|
|
c89fb0b828 | ||
|
|
52e111dbb7 | ||
|
|
36b5109387 | ||
|
|
c07b085c81 | ||
|
|
065c442141 | ||
|
|
83b570d981 | ||
|
|
2afdee9c7d | ||
|
|
a7e809e1f7 | ||
|
|
deb7cb708f | ||
|
|
fcd7db6cd1 | ||
|
|
68adbd2e05 | ||
|
|
b6258d612b | ||
|
|
93cb76a292 | ||
|
|
6191f69f0c | ||
|
|
d416e6c854 | ||
|
|
3a63d978dd | ||
|
|
d2a78c33df | ||
|
|
679f91482e | ||
|
|
d380a8554d | ||
|
|
4f36ad0cc1 | ||
|
|
90ba7fbf1f | ||
|
|
76658477af | ||
|
|
ffb6a9c74b | ||
|
|
21d334389f | ||
|
|
94a5e081e5 | ||
|
|
5e78d72ef2 | ||
|
|
5c303e2bb5 | ||
|
|
4c1cb388af | ||
|
|
144bd4a878 | ||
|
|
91737aff68 | ||
|
|
2391b40f47 | ||
|
|
6a8aff5a74 | ||
|
|
c0ec5d404b | ||
|
|
10e9a6b6cd | ||
|
|
a51aed7ce2 | ||
|
|
71e0106846 | ||
|
|
3ce9af7fce | ||
|
|
05e8aae95e | ||
|
|
381de6b7cb | ||
|
|
c077645f77 | ||
|
|
ebc3263987 | ||
|
|
cf6e5bf01f | ||
|
|
958c615a83 | ||
|
|
8e5070f469 | ||
|
|
4397b675cb | ||
|
|
9ed88f6a8d | ||
|
|
f12fde9132 | ||
|
|
1c4ea6d246 | ||
|
|
a6d76b3c48 | ||
|
|
5d0ace0577 | ||
|
|
7b88544d46 | ||
|
|
6767ea2456 | ||
|
|
459db3d64b | ||
|
|
d009cf618a | ||
|
|
9a9897a9de | ||
|
|
3f9fb13df6 | ||
|
|
52f414669a | ||
|
|
b34215906c | ||
|
|
fb768ac792 | ||
|
|
35289bffe2 | ||
|
|
ef00fdf472 | ||
|
|
3de7e8358f | ||
|
|
28ac2f49dc | ||
|
|
c38b5d5eb9 | ||
|
|
180d06613a | ||
|
|
c3ee4212f0 | ||
|
|
efafbe9a5c | ||
|
|
e38680a4df | ||
|
|
f28fc6f2e1 | ||
|
|
5ba8d36687 | ||
|
|
178236cc5f | ||
|
|
79a0533c69 | ||
|
|
64363995be | ||
|
|
426ad6e3a3 | ||
|
|
0d0e7a1008 | ||
|
|
806545df34 | ||
|
|
b8cc257ac5 | ||
|
|
bdb4d96678 | ||
|
|
0c5fb4a81b | ||
|
|
3ff48f27cf | ||
|
|
f0c732452f | ||
|
|
a4d1b1ba21 | ||
|
|
0447ea94c1 | ||
|
|
38fd7a84c7 | ||
|
|
ee17910ec5 | ||
|
|
717a7dbfde | ||
|
|
0fb6576511 | ||
|
|
383495c863 | ||
|
|
b55abf5730 | ||
|
|
3e1aa456b9 | ||
|
|
00558adda8 | ||
|
|
1c3273aab2 | ||
|
|
589b247926 | ||
|
|
6965e3e03c | ||
|
|
202d5ab754 | ||
|
|
1023be33fb | ||
|
|
595c00f55c | ||
|
|
5aaa5eab70 | ||
|
|
70b24b021a | ||
|
|
af96c721c4 | ||
|
|
a9b653db26 | ||
|
|
80c23d4519 | ||
|
|
821d7a8941 | ||
|
|
e7c8a22c67 | ||
|
|
5652ccc780 | ||
|
|
055d429ae1 | ||
|
|
8231897b26 | ||
|
|
df7e656034 | ||
|
|
d045409b9f | ||
|
|
7f3f4cfdd0 | ||
|
|
ef044d9f17 | ||
|
|
9642c7f990 | ||
|
|
0c5193c588 | ||
|
|
f2c2b3fc7a | ||
|
|
1228e0e925 | ||
|
|
3a3820bedc | ||
|
|
91ee6ed60f | ||
|
|
7e28fdc176 | ||
|
|
569bc02649 | ||
|
|
178309be47 | ||
|
|
2fb7ac9a58 | ||
|
|
2e493cb89a | ||
|
|
cdf0d77b20 | ||
|
|
ccdfaa9115 | ||
|
|
34af05ec30 | ||
|
|
6bd41e47ac | ||
|
|
45d11c53f0 | ||
|
|
50a68d7d59 | ||
|
|
cc47b5a78c | ||
|
|
34b4ec3624 | ||
|
|
86ed364dc0 | ||
|
|
438cde4e70 | ||
|
|
3b268d1656 | ||
|
|
0a97782339 | ||
|
|
1cf1d6146c | ||
|
|
f3217ac170 | ||
|
|
c8125f8710 | ||
|
|
1e3bc7c069 | ||
|
|
34df9f3dbf | ||
|
|
72bb159a7e | ||
|
|
afe4e345d2 | ||
|
|
855b5b513d | ||
|
|
b9d271c1a8 | ||
|
|
b3931741ef | ||
|
|
ede48e285f | ||
|
|
8890539f47 | ||
|
|
ff72dd8d2c | ||
|
|
e07b265009 | ||
|
|
8d0e5899b9 | ||
|
|
e6f8b59010 | ||
|
|
8e65846f32 | ||
|
|
96d4d3f3be | ||
|
|
811c01cc2e | ||
|
|
e24127771e | ||
|
|
b3f00d05a8 | ||
|
|
652d34b0a8 | ||
|
|
7539577b46 | ||
|
|
41ee6006c4 | ||
|
|
813ba42cfc | ||
|
|
80076276e1 | ||
|
|
3a78e8010d | ||
|
|
d9940f416b | ||
|
|
dd998e7fd3 | ||
|
|
747db4d940 | ||
|
|
ecd5c523dc | ||
|
|
3de14fc63e | ||
|
|
7f166eaee7 | ||
|
|
ab7b5e48c4 | ||
|
|
345b5cfc5c | ||
|
|
1ac93c3a72 | ||
|
|
4b8c29a708 | ||
|
|
04b057d22c | ||
|
|
fcfb8dd2ed | ||
|
|
4a2673772a | ||
|
|
b9e216ac6f | ||
|
|
e78e2885fe | ||
|
|
777f2e7547 | ||
|
|
27e494d25c | ||
|
|
d88156d998 | ||
|
|
44a3af51f0 | ||
|
|
79f090d92b | ||
|
|
54c65fdad0 | ||
|
|
e917802316 | ||
|
|
6a19a31171 | ||
|
|
a06b7f2ae0 | ||
|
|
405b1067e2 | ||
|
|
10cb93283a | ||
|
|
d28e8f537a | ||
|
|
24d7f54662 | ||
|
|
687a43e199 | ||
|
|
07ef7d750b | ||
|
|
ea2b1d36aa | ||
|
|
c7540fba94 | ||
|
|
3d9198592b | ||
|
|
d6357bacdd | ||
|
|
647551b8e4 | ||
|
|
b158c25dc3 | ||
|
|
bc8a3c5b6f | ||
|
|
c149db2205 | ||
|
|
b5495ec972 | ||
|
|
472c390e75 | ||
|
|
3d9a41e4b4 | ||
|
|
9f77b065d3 | ||
|
|
7abbe1e8d8 | ||
|
|
004b6ed60f | ||
|
|
d12f30f90c | ||
|
|
c433c2f2e2 | ||
|
|
9e52c330ae | ||
|
|
564deec2c4 | ||
|
|
6fd0ffccbf | ||
|
|
ee957a4285 | ||
|
|
c63331a303 | ||
|
|
4d2c44ca87 | ||
|
|
596b5cd732 | ||
|
|
8ff1ba325d | ||
|
|
a19d7e3680 | ||
|
|
90eeb25770 | ||
|
|
bfe8b81d18 | ||
|
|
ec71c19be7 | ||
|
|
cce1fc9c65 | ||
|
|
79fee501af | ||
|
|
12dfaa2d74 | ||
|
|
d4e5366fe6 | ||
|
|
d7388d7e80 | ||
|
|
5c363b76ee | ||
|
|
440adddcde | ||
|
|
af9ad1580a | ||
|
|
d569430cc6 | ||
|
|
c39bea2017 | ||
|
|
a361f618a1 | ||
|
|
8c2d8bc85f | ||
|
|
563b56e09c | ||
|
|
455f675806 | ||
|
|
3932e860ca | ||
|
|
b3368a85da | ||
|
|
defe0b25dd | ||
|
|
b68ed904b1 | ||
|
|
2eba4fb96b | ||
|
|
27ba604ad7 | ||
|
|
769982d058 | ||
|
|
674d702257 | ||
|
|
c974cb1b8e | ||
|
|
20c05a3add | ||
|
|
c27322ff04 | ||
|
|
6e624946d2 | ||
|
|
ab9a63bbea | ||
|
|
3a8438e1f8 | ||
|
|
0e49c6affd | ||
|
|
8bcf78cd78 | ||
|
|
ffc944976b | ||
|
|
1b52be6246 | ||
|
|
e7e1ec6e84 | ||
|
|
ff3c441023 | ||
|
|
aaf6e84373 | ||
|
|
380a357b08 | ||
|
|
8026d0b2e7 | ||
|
|
b41cad58cb | ||
|
|
39e12244cc | ||
|
|
c4c01b61e6 | ||
|
|
eb3cd22aa3 | ||
|
|
5b35f5fb69 | ||
|
|
11d875d043 | ||
|
|
ac946a4602 | ||
|
|
815e2f3d03 | ||
|
|
bd8bca87b2 | ||
|
|
9110aa09a4 | ||
|
|
fe085a631d | ||
|
|
c7489af844 | ||
|
|
32a653e67e | ||
|
|
d16c93aa08 | ||
|
|
46367a7a7b | ||
|
|
83a25c06ef | ||
|
|
db7db67851 | ||
|
|
8d7073abf6 | ||
|
|
f1c8dd887b | ||
|
|
08bc3b0386 | ||
|
|
2808de6084 | ||
|
|
028088f5f0 | ||
|
|
21178c3571 | ||
|
|
b8214e260c | ||
|
|
45d813b62c | ||
|
|
73b3e0e50e | ||
|
|
255fcbc3a5 | ||
|
|
47d93279ff | ||
|
|
5b93ae8628 | ||
|
|
436318a8c8 | ||
|
|
57a328c7a9 | ||
|
|
2cd3f046e5 | ||
|
|
5c88c1376c | ||
|
|
2d39e5d7a5 | ||
|
|
27e255fa75 | ||
|
|
195190b612 | ||
|
|
aeabfaf417 | ||
|
|
f62201ba9d | ||
|
|
5cf331d881 | ||
|
|
28c90cce6c | ||
|
|
ca5b10938a | ||
|
|
acd4cc6f5c | ||
|
|
7ac3a36229 | ||
|
|
a6178c1de6 | ||
|
|
990dd18474 | ||
|
|
c4642d4fda | ||
|
|
c7d3b83164 | ||
|
|
7c87bb35c4 | ||
|
|
f20530dce2 | ||
|
|
5d5adf7c7e | ||
|
|
fc01873d60 | ||
|
|
81b9e78565 | ||
|
|
cee4505172 | ||
|
|
4d4b29ea94 | ||
|
|
efd780f82a | ||
|
|
cc0ff6b0bf | ||
|
|
35e13cf5e8 | ||
|
|
238652b36c | ||
|
|
e4b728ccb9 | ||
|
|
68967aef72 | ||
|
|
fd67d46be7 | ||
|
|
ee0e8a3aad | ||
|
|
f4734d6b4d | ||
|
|
656628e69b | ||
|
|
6b1bca80ee | ||
|
|
537a50214a | ||
|
|
67d04dd9ba | ||
|
|
b8efd02c7f | ||
|
|
a600d8f4e2 | ||
|
|
de7793e918 | ||
|
|
a5e442d490 | ||
|
|
51513c4e6b | ||
|
|
5d0b813cec | ||
|
|
ba0c271774 | ||
|
|
7062c01b68 | ||
|
|
c0bad42eb1 | ||
|
|
af7ebd96a0 | ||
|
|
ac59fd1476 | ||
|
|
6561d70664 | ||
|
|
1a5c59326a | ||
|
|
d44375aece | ||
|
|
cf37058d7c | ||
|
|
dcb3fcbfa7 | ||
|
|
6ece3f6792 | ||
|
|
3b30e42551 | ||
|
|
b0ef524b9e | ||
|
|
b138aaae08 | ||
|
|
3953661078 | ||
|
|
b551844cc2 | ||
|
|
93f3e2b007 | ||
|
|
0a42a8bc46 | ||
|
|
8097b07661 | ||
|
|
1475cabfa0 | ||
|
|
6a1573c228 | ||
|
|
d26e1d783f | ||
|
|
fa720c1858 | ||
|
|
bc7c3e44d5 | ||
|
|
480ca88b68 | ||
|
|
aba0e602ed | ||
|
|
22a2f98ced | ||
|
|
aaa47850c3 | ||
|
|
7c2feb78d2 | ||
|
|
0c65d2cc0c | ||
|
|
13c5f806c6 | ||
|
|
84d3b4de46 | ||
|
|
925a772dce | ||
|
|
95015f1104 | ||
|
|
dcbc727813 | ||
|
|
3b9d4c8d50 | ||
|
|
40fe9e6d67 | ||
|
|
4da816e459 | ||
|
|
9c475467d5 | ||
|
|
0310cbad0a | ||
|
|
ef258914b2 | ||
|
|
c025f363f5 | ||
|
|
51187d06b3 | ||
|
|
8210b3c873 | ||
|
|
883e0826e2 | ||
|
|
003f9f7953 | ||
|
|
2880a679f0 | ||
|
|
4d6cff7eb8 | ||
|
|
d8806649ab | ||
|
|
dc9a65923a | ||
|
|
751d2a0fe7 |
2
AUTHORS
2
AUTHORS
@@ -5,6 +5,8 @@ David Janssens designed and implemented the first version of OpenJPEG.
|
|||||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||||
Jerome Fimes implemented the alpha version of OpenJPEG v2.
|
Jerome Fimes implemented the alpha version of OpenJPEG v2.
|
||||||
Giuseppe Baruffa added the JPWL functionalities.
|
Giuseppe Baruffa added the JPWL functionalities.
|
||||||
|
Micka<EFBFBD>l Savinaud implemented the final OpenJPEG v2 version based on a big merge between 1.5 version and alpha version of v2.
|
||||||
|
Mathieu Malaterre participate to the OpenJPEG v2 version and release the OpenJPEG 1.5 and 1.5.1 version.
|
||||||
Yannick Verschueren,
|
Yannick Verschueren,
|
||||||
Herve Drolon,
|
Herve Drolon,
|
||||||
Francois-Olivier Devaux,
|
Francois-Olivier Devaux,
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# Look for the header file.
|
|
||||||
FIND_PATH(FCGI_INCLUDE_DIR NAMES fastcgi.h)
|
|
||||||
|
|
||||||
# Look for the library.
|
|
||||||
FIND_LIBRARY(FCGI_LIBRARY NAMES fcgi)
|
|
||||||
|
|
||||||
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# Copy the results to the output variables.
|
|
||||||
IF(FCGI_FOUND)
|
|
||||||
SET(FCGI_LIBRARIES ${FCGI_LIBRARY})
|
|
||||||
SET(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
|
|
||||||
ELSE(FCGI_FOUND)
|
|
||||||
SET(FCGI_LIBRARIES)
|
|
||||||
SET(FCGI_INCLUDE_DIRS)
|
|
||||||
ENDIF(FCGI_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(FCGI_INCLUDE_DIRS FCGI_LIBRARIES)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Look for the header file.
|
|
||||||
FIND_PATH(PTHREAD_INCLUDE_DIR NAMES pthread.h)
|
|
||||||
|
|
||||||
# Look for the library.
|
|
||||||
FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
|
|
||||||
|
|
||||||
# Handle the QUIETLY and REQUIRED arguments and set PTHREAD_FOUND to TRUE if all listed variables are TRUE.
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PTHREAD DEFAULT_MSG PTHREAD_LIBRARY PTHREAD_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# Copy the results to the output variables.
|
|
||||||
IF(PTHREAD_FOUND)
|
|
||||||
SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
|
|
||||||
SET(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
|
|
||||||
ELSE(PTHREAD_FOUND)
|
|
||||||
SET(PTHREAD_LIBRARIES)
|
|
||||||
SET(PTHREAD_INCLUDE_DIRS)
|
|
||||||
ENDIF(PTHREAD_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(PTHREAD_INCLUDE_DIRS PTHREAD_LIBRARIES)
|
|
||||||
283
CMakeLists.txt
283
CMakeLists.txt
@@ -6,54 +6,73 @@
|
|||||||
# you will eventually like to prefix the library to avoid linking confusion
|
# you will eventually like to prefix the library to avoid linking confusion
|
||||||
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||||
# e.g.:
|
# e.g.:
|
||||||
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.8.2)
|
||||||
|
|
||||||
IF(COMMAND CMAKE_POLICY)
|
if(COMMAND CMAKE_POLICY)
|
||||||
CMAKE_POLICY(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
ENDIF(COMMAND CMAKE_POLICY)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_NAMESPACE)
|
if(NOT OPENJPEG_NAMESPACE)
|
||||||
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
set(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||||
SET(OPENJPEG_STANDALONE 1)
|
set(OPENJPEG_STANDALONE 1)
|
||||||
ENDIF(NOT OPENJPEG_NAMESPACE)
|
endif()
|
||||||
# In all cases:
|
# In all cases:
|
||||||
STRING(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||||
|
set(OPENJPEG_LIBRARY_NAME openjp2)
|
||||||
|
|
||||||
PROJECT(${OPENJPEG_NAMESPACE} C)
|
project(${OPENJPEG_NAMESPACE} C)
|
||||||
|
|
||||||
# Do full dependency headers.
|
# Do full dependency headers.
|
||||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
include_regular_expression("^.*$")
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
set(OPENJPEG_VERSION_MAJOR 2)
|
||||||
SET(OPENJPEG_VERSION_MINOR 5)
|
set(OPENJPEG_VERSION_MINOR 0)
|
||||||
SET(OPENJPEG_VERSION_BUILD 0)
|
set(OPENJPEG_VERSION_BUILD 0)
|
||||||
SET(OPENJPEG_VERSION
|
set(OPENJPEG_VERSION
|
||||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||||
SET(PACKAGE_VERSION
|
set(PACKAGE_VERSION
|
||||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||||
SET(OPENJPEG_LIBRARY_PROPERTIES
|
|
||||||
|
# Because autotools does not support X.Y notation for SOVERSION, we have to use
|
||||||
|
# two numbering, one for the openjpeg version and one for openjpeg soversion
|
||||||
|
# version | soversion
|
||||||
|
# 1.0 | 0
|
||||||
|
# 1.1 | 1
|
||||||
|
# 1.2 | 2
|
||||||
|
# 1.3 | 3
|
||||||
|
# 1.4 | 4
|
||||||
|
# 1.5 | 5
|
||||||
|
# 1.5.1 | 5
|
||||||
|
# 2.0 | 6
|
||||||
|
# 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 6)
|
||||||
|
endif(NOT OPENJPEG_SOVERSION)
|
||||||
|
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||||
SOVERSION "${OPENJPEG_VERSION_MAJOR}"
|
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Path to additional CMake modules
|
# Path to additional CMake modules
|
||||||
SET(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH
|
||||||
${CMAKE_SOURCE_DIR}/CMake
|
${CMAKE_SOURCE_DIR}/cmake
|
||||||
${CMAKE_MODULE_PATH})
|
${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||||
# warnings
|
# warnings
|
||||||
IF(WIN32)
|
if(WIN32)
|
||||||
IF(NOT BORLAND)
|
if(NOT BORLAND)
|
||||||
IF(NOT CYGWIN)
|
if(NOT CYGWIN)
|
||||||
IF(NOT MINGW)
|
if(NOT MINGW)
|
||||||
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||||
ADD_DEFINITIONS(
|
add_definitions(
|
||||||
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||||
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||||
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||||
@@ -65,105 +84,104 @@ IF(WIN32)
|
|||||||
-D_CRT_VCCLRIT_NO_DEPRECATE
|
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||||
-D_SCL_SECURE_NO_DEPRECATE
|
-D_SCL_SECURE_NO_DEPRECATE
|
||||||
)
|
)
|
||||||
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
endif()
|
||||||
ENDIF(NOT MINGW)
|
endif()
|
||||||
ENDIF(NOT CYGWIN)
|
endif()
|
||||||
ENDIF(NOT BORLAND)
|
endif()
|
||||||
ENDIF(WIN32)
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Install directories
|
# Install directories
|
||||||
|
|
||||||
STRING(TOLOWER ${PROJECT_NAME} projectname)
|
string(TOLOWER ${PROJECT_NAME} projectname)
|
||||||
SET(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
if(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||||
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
|
set(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
if(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||||
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
set(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||||
SET(OPENJPEG_INSTALL_SHARE_DIR "share")
|
set(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
if(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||||
SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||||
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/")
|
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
if(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||||
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
if(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||||
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||||
SET(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
if(WIN32)
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
|
||||||
|
else()
|
||||||
|
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
|
# We could install *.cmake files in share/ however those files contains
|
||||||
|
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
|
||||||
|
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
|
||||||
|
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Big endian test:
|
# Big endian test:
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||||
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Setup file for setting custom ctest vars
|
# Setup file for setting custom ctest vars
|
||||||
CONFIGURE_FILE(
|
configure_file(
|
||||||
${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
|
${CMAKE_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||||
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# OpenJPEG build configuration options.
|
# OpenJPEG build configuration options.
|
||||||
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
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 (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.")
|
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)
|
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# configure name mangling to allow multiple libraries to coexist
|
# configure name mangling to allow multiple libraries to coexist
|
||||||
# peacefully
|
# peacefully
|
||||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||||
@ONLY)
|
@ONLY)
|
||||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# pkgconfig support
|
|
||||||
IF(UNIX)
|
|
||||||
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_SHARE_DIR}/pkgconfig )
|
|
||||||
INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
|
||||||
\"libopenjpeg1.pc\"
|
|
||||||
\"\$ENV{DESTDIR}${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")")
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Compiler specific flags:
|
# Compiler specific flags:
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
# For all builds, make sure openjpeg is std99 compliant:
|
# 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:
|
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
set(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# opj_config.h generation (1/2)
|
# opj_config.h generation (1/2)
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||||
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||||
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||||
@@ -173,90 +191,99 @@ CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
|||||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||||
|
# ssize_t
|
||||||
|
include(CheckTypeSize)
|
||||||
|
CHECK_TYPE_SIZE(ssize_t SSIZE_T)
|
||||||
|
|
||||||
|
# Enable Large file support
|
||||||
|
include(TestLargeFiles)
|
||||||
|
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build Library
|
# Build Library
|
||||||
INCLUDE_DIRECTORIES(BEFORE ${OPENJPEG_BINARY_DIR})
|
add_subdirectory(src)
|
||||||
ADD_SUBDIRECTORY(libopenjpeg)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build Applications
|
# Build Applications
|
||||||
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
option(BUILD_CODEC "Build the CODEC executables" ON)
|
||||||
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||||
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||||
OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||||
IF(BUILD_JPIP)
|
if(BUILD_JPIP)
|
||||||
OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||||
ENDIF(BUILD_JPIP)
|
endif()
|
||||||
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||||
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||||
MARK_AS_ADVANCED(BUILD_VIEWER)
|
option(BUILD_JP3D "Build the JP3D comp" OFF)
|
||||||
MARK_AS_ADVANCED(BUILD_JAVA)
|
mark_as_advanced(BUILD_VIEWER)
|
||||||
|
mark_as_advanced(BUILD_JAVA)
|
||||||
|
mark_as_advanced(BUILD_JP3D)
|
||||||
|
|
||||||
IF(BUILD_CODEC OR BUILD_MJ2)
|
if(BUILD_CODEC OR BUILD_MJ2)
|
||||||
# OFF: It will only build 3rd party libs if they are not found on the system
|
# 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
|
# ON: 3rd party libs will ALWAYS be build, and used
|
||||||
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||||
ADD_SUBDIRECTORY(thirdparty)
|
add_subdirectory(thirdparty)
|
||||||
ADD_SUBDIRECTORY(applications)
|
add_subdirectory(src/bin)
|
||||||
ENDIF (BUILD_CODEC OR BUILD_MJ2)
|
endif ()
|
||||||
|
add_subdirectory(wrapping)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# opj_config.h generation (2/2)
|
# opj_config.h generation (2/2)
|
||||||
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
|
configure_file(
|
||||||
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||||
OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||||
IF(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
ADD_SUBDIRECTORY(doc)
|
add_subdirectory(doc)
|
||||||
ENDIF(BUILD_DOC)
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Buld Testing
|
# Buld Testing
|
||||||
OPTION(BUILD_TESTING "Build the tests." OFF)
|
option(BUILD_TESTING "Build the tests." OFF)
|
||||||
IF(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
IF(BUILD_CODEC)
|
if(BUILD_CODEC)
|
||||||
ENABLE_TESTING()
|
enable_testing()
|
||||||
INCLUDE(CTest)
|
include(CTest)
|
||||||
|
|
||||||
# Search openjpeg data needed for the tests
|
# Search openjpeg data needed for the tests
|
||||||
# They could be found via svn on the OpenJPEG google code project
|
# They could be found via svn on the OpenJPEG google code project
|
||||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{OPJ_DATA_ROOT}
|
$ENV{OPJ_DATA_ROOT}
|
||||||
${CMAKE_SOURCE_DIR}/../data
|
${CMAKE_SOURCE_DIR}/../data
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add repository where to find tests
|
# Add repository where to find tests
|
||||||
ADD_SUBDIRECTORY(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
ELSE(BUILD_CODEC)
|
else()
|
||||||
message(FATAL_ERROR "You need build codec to run the tests")
|
message(FATAL_ERROR "You need build codec to run the tests")
|
||||||
ENDIF(BUILD_CODEC)
|
endif()
|
||||||
ENDIF(BUILD_TESTING)
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# install all targets referenced as OPENJPEGTargets
|
# install all targets referenced as OPENJPEGTargets
|
||||||
INSTALL(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||||
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
|
configure_file( ${OPENJPEG_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||||
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# install CHANGES and LICENSE
|
# install CHANGES and LICENSE
|
||||||
INSTALL(
|
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||||
FILES CHANGES
|
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||||
LICENSE
|
endif()
|
||||||
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||||
|
|
||||||
INCLUDE (CMake/OpenJPEGCPack.cmake)
|
include (cmake/OpenJPEGCPack.cmake)
|
||||||
|
|||||||
82
INSTALL
82
INSTALL
@@ -2,63 +2,10 @@
|
|||||||
How to build and install openjpeg binaries
|
How to build and install openjpeg binaries
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
UNIX/LINUX similar systems
|
UNIX/LINUX/MacOSX/Windows systems
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
1) Using autotools
|
Using cmake (see www.cmake.org)
|
||||||
|
|
||||||
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:
|
Type:
|
||||||
cmake .
|
cmake .
|
||||||
@@ -66,11 +13,12 @@ Type:
|
|||||||
|
|
||||||
If you are root:
|
If you are root:
|
||||||
make install
|
make install
|
||||||
make clean
|
|
||||||
|
|
||||||
else:
|
else if you have sudo power:
|
||||||
sudo make install
|
sudo make install
|
||||||
make clean
|
|
||||||
|
else
|
||||||
|
DESTDIR=$HOME/local make install
|
||||||
|
|
||||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||||
(A 'html' directory is generated in the 'doc' directory)
|
(A 'html' directory is generated in the 'doc' directory)
|
||||||
@@ -79,13 +27,19 @@ To build the Doxygen documentation (Doxygen needs to be found on the system):
|
|||||||
Binaries are located in the 'bin' directory.
|
Binaries are located in the 'bin' directory.
|
||||||
|
|
||||||
Main available cmake flags:
|
Main available cmake flags:
|
||||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path'
|
* 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')
|
* 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.
|
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 CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON')
|
||||||
|
* To build the documentation: '-DBUILD_DOC:bool=on' (default: 'OFF')
|
||||||
* To build the MJ2 executables: '-DBUILD_MJ2:bool=on' (default: 'OFF')
|
* 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 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 build the JPIP library and utilities: '-DBUILD_JPIP:bool=on' (default: 'OFF')
|
||||||
|
** To build the JPIP server: '-DBUILD_JPIP_SERVER:bool=on' (default: 'OFF')
|
||||||
|
* To build the JP3D library and utilities: '-DBUILD_JP3D:bool=on' (default: 'OFF') (experimental)
|
||||||
|
* To build the Java binding: '-DBUILD_JAVA:bool=on' (default: 'OFF') (experimental).
|
||||||
|
** to choose which java implementation, you can set your JAVA_HOME env var.
|
||||||
|
* To build the wxWidgets/C++ viewer: 'BUILD_VIEWER:BOOL=ON' (default OFF) (experimental)
|
||||||
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
|
* 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'
|
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
|
||||||
make
|
make
|
||||||
@@ -98,7 +52,7 @@ Main available cmake flags:
|
|||||||
MACOSX
|
MACOSX
|
||||||
------
|
------
|
||||||
|
|
||||||
The same building procedures as above (autotools and cmake) work for MACOSX.
|
The same building procedures as above work for MACOSX.
|
||||||
The xcode project file can also be used.
|
The xcode project file can also be used.
|
||||||
|
|
||||||
If it does not work, try adding the following flag to the cmake command :
|
If it does not work, try adding the following flag to the cmake command :
|
||||||
@@ -107,7 +61,9 @@ If it does not work, try adding the following flag to the cmake command :
|
|||||||
WINDOWS
|
WINDOWS
|
||||||
-------
|
-------
|
||||||
|
|
||||||
If you're using cygwin or MinGW+MSYS, the same procedures as for Unix can be used.
|
You can use cmake to generate project files for the IDE you are using (VS2010, NMake, etc).
|
||||||
|
|
||||||
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.
|
Type 'cmake --help' for available generators on your platform.
|
||||||
|
|
||||||
|
Make sure to build the third party libs (png, zlib ...):
|
||||||
|
|
||||||
|
'-DBUILD_THIRDPARTY:BOOL=ON'
|
||||||
|
|||||||
3
LICENSE
3
LICENSE
@@ -6,6 +6,9 @@
|
|||||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
* Copyright (c) 2001-2003, David Janssens
|
* 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.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
75
Makefile.am
75
Makefile.am
@@ -1,75 +0,0 @@
|
|||||||
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
|
|
||||||
25
NEWS
25
NEWS
@@ -2,33 +2,20 @@
|
|||||||
OpenJPEG NEWS - user visible changes
|
OpenJPEG NEWS - user visible changes
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
Changes from OpenJPEG 1.4.0 to OpenJPEG 1.5.0
|
Changes from OpenJPEG 1.5.x to OpenJPEG 2.0.0
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
New Features:
|
New Features:
|
||||||
|
|
||||||
* openjpip:
|
* streaming capabilities
|
||||||
- complete client-server architecture for remote browsing of jpeg 2000 images.
|
* merge JP3D
|
||||||
- located in 'applications/jpip'.
|
|
||||||
- see corresponding README for more details.
|
|
||||||
|
|
||||||
API modifications:
|
API modifications:
|
||||||
|
|
||||||
* 'bool' type has been replaced by 'opj_bool' type. 'stdbool.h' is no more required.
|
* Use a 64bits capable API
|
||||||
|
|
||||||
Misc:
|
Misc:
|
||||||
|
|
||||||
* added this NEWS file.
|
* removed autotools build system
|
||||||
* improved cmake and autotools build methods.
|
* folders hierarchies reorganisation
|
||||||
* removed manual makefiles, VS project files and XCode project files.
|
|
||||||
* added a 'thirdparty' directory to contain all dependencies.
|
|
||||||
- These libraries will be build only if there are not found on the system.
|
|
||||||
- Note that libopenjpeg itself does not have any dependency.
|
|
||||||
* changed the directory hierarchy of the whole project. See README files for details.
|
|
||||||
* tests : a complete test suite has been setup.
|
|
||||||
- both JPEG 2000 conformance tests and non-regressions tests are configured.
|
|
||||||
- results are submitted to the OpenJPEG dashboard (http://my.cdash.org/index.php?project=OPENJPEG)
|
|
||||||
- images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
|
|
||||||
- configuration files and utilities are located in 'tests' folder.
|
|
||||||
* OPJViewer re-activated (need wxWidgets)
|
|
||||||
* Huge amount of bug fixes. See CHANGES for details.
|
* Huge amount of bug fixes. See CHANGES for details.
|
||||||
|
|||||||
38
README
38
README
@@ -4,22 +4,44 @@ OPENJPEG LIBRARY and APPLICATIONS
|
|||||||
|
|
||||||
Details on folders hierarchy:
|
Details on folders hierarchy:
|
||||||
|
|
||||||
* libopenjpeg: contains the sources of the openjpeg library
|
* src
|
||||||
* jpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
* lib
|
||||||
* applications: contains all applications that use the openjpeg library
|
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||||
|
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||||
|
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||||
|
* openjp3d: JP3D implementation
|
||||||
|
* openmj2: MJ2 implementation
|
||||||
|
* bin: contains all applications that use the openjpeg library
|
||||||
* common: common files to all applications
|
* common: common files to all applications
|
||||||
* codec: a basic codec
|
* jp2: a basic codec
|
||||||
* mj2: motion jpeg 2000 executables
|
* mj2: motion jpeg 2000 executables
|
||||||
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
* jpip: OpenJPIP applications (server and dec server)
|
||||||
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
* java: a Java client viewer for JPIP
|
||||||
|
* jp3d: JP3D applications
|
||||||
|
* tcltk: a test tool for JP3D
|
||||||
|
* wx
|
||||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
* 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.
|
* 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
|
* 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.
|
* 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
|
* cmake: cmake related files
|
||||||
* m4: autotools related files
|
|
||||||
|
|
||||||
see LICENSE for license and copyright information.
|
see LICENSE for license and copyright information.
|
||||||
see INSTALL for installation procedures.
|
see INSTALL for installation procedures.
|
||||||
see NEWS for user visible changes in successive releases.
|
see NEWS for user visible changes in successive releases.
|
||||||
see CHANGES for per-revision changes.
|
see CHANGES for per-revision changes.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
API/ABI
|
||||||
|
|
||||||
|
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 mecanism 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/hidding function and as such the only
|
||||||
|
API available is the one supported by OpenJPEG.
|
||||||
|
|||||||
4
THANKS
4
THANKS
@@ -4,13 +4,11 @@ Many people have contributed to OpenJPEG by reporting problems, suggesting vario
|
|||||||
or submitting actual code. Here is a list of these people. Help me keep
|
or submitting actual code. Here is a list of these people. Help me keep
|
||||||
it complete and exempt of errors.
|
it complete and exempt of errors.
|
||||||
|
|
||||||
Mathieu Malaterre
|
|
||||||
Winfried Szukalski
|
Winfried Szukalski
|
||||||
Vincent Torri
|
Vincent Torri
|
||||||
Bob Friesenhahn
|
Bob Friesenhahn
|
||||||
Callum Lerwick
|
Callum Lerwick
|
||||||
Dzonatas Sol
|
Dzonatas Sol
|
||||||
Mickaël Savinaud
|
|
||||||
Julien Malik
|
Julien Malik
|
||||||
Jerôme Fimes
|
Jerôme Fimes
|
||||||
Herve Drolon
|
Herve Drolon
|
||||||
@@ -31,3 +29,5 @@ Arnaud Maye
|
|||||||
Rex Dieter
|
Rex Dieter
|
||||||
David Burken
|
David Burken
|
||||||
Parvatha Elangovan
|
Parvatha Elangovan
|
||||||
|
Hans Johnson
|
||||||
|
Luc Hermitte
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# 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,19 +0,0 @@
|
|||||||
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,113 +0,0 @@
|
|||||||
# Build the demo app, small examples
|
|
||||||
|
|
||||||
# First thing define the common source:
|
|
||||||
SET(common_SRCS
|
|
||||||
convert.c
|
|
||||||
index.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
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@
|
|
||||||
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@
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
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,677 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 20010, 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++;
|
|
||||||
}
|
|
||||||
return num_images;
|
|
||||||
}
|
|
||||||
|
|
||||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent* content;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
/*Reading the input images from given input directory*/
|
|
||||||
|
|
||||||
dir= opendir(imgdirpath);
|
|
||||||
if(!dir){
|
|
||||||
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
|
||||||
return 1;
|
|
||||||
}else {
|
|
||||||
fprintf(stderr,"Folder opened successfully\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
while((content=readdir(dir))!=NULL){
|
|
||||||
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
strcpy(dirptr->filename[i],content->d_name);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_file_format(char *filename) {
|
|
||||||
unsigned int i;
|
|
||||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "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'},
|
|
||||||
};
|
|
||||||
const char optlist[] = "i:o:h";
|
|
||||||
|
|
||||||
OPJ_ARG_NOT_USED(indexfilename);
|
|
||||||
|
|
||||||
totlen=sizeof(long_option);
|
|
||||||
img_fol->set_out_format = 0;
|
|
||||||
do {
|
|
||||||
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
|
||||||
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 -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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,120 +0,0 @@
|
|||||||
What's New for OpenJPIP
|
|
||||||
|
|
||||||
* : fixed
|
|
||||||
- : removed
|
|
||||||
! : changed
|
|
||||||
+ : added
|
|
||||||
|
|
||||||
January 26, 2011
|
|
||||||
! [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)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# required dep for server:
|
|
||||||
IF(BUILD_JPIP_SERVER)
|
|
||||||
FIND_PACKAGE(CURL REQUIRED)
|
|
||||||
FIND_PACKAGE(FCGI REQUIRED)
|
|
||||||
FIND_PACKAGE(PTHREAD REQUIRED)
|
|
||||||
ENDIF(BUILD_JPIP_SERVER)
|
|
||||||
|
|
||||||
# JPIP library:
|
|
||||||
ADD_SUBDIRECTORY(libopenjpip)
|
|
||||||
|
|
||||||
# JPIP binaries:
|
|
||||||
ADD_SUBDIRECTORY(util)
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
SUBDIRS = libopenjpip util
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,151 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
|
||||||
includes_HEADERS =
|
|
||||||
|
|
||||||
lib_LTLIBRARIES =
|
|
||||||
|
|
||||||
if WANT_JPIP
|
|
||||||
lib_LTLIBRARIES += libopenjpip_local.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WANT_JPIP_SERVER
|
|
||||||
lib_LTLIBRARIES += libopenjpip_server.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
JPIP_SRC = \
|
|
||||||
openjpip.c \
|
|
||||||
query_parser.c \
|
|
||||||
channel_manager.c \
|
|
||||||
session_manager.c \
|
|
||||||
jpip_parser.c \
|
|
||||||
boxheader_manager.c \
|
|
||||||
codestream_manager.c \
|
|
||||||
imgreg_manager.c \
|
|
||||||
marker_manager.c \
|
|
||||||
msgqueue_manager.c \
|
|
||||||
box_manager.c \
|
|
||||||
faixbox_manager.c \
|
|
||||||
index_manager.c \
|
|
||||||
metadata_manager.c \
|
|
||||||
placeholder_manager.c \
|
|
||||||
byte_manager.c \
|
|
||||||
ihdrbox_manager.c \
|
|
||||||
manfbox_manager.c \
|
|
||||||
mhixbox_manager.c \
|
|
||||||
target_manager.c \
|
|
||||||
cachemodel_manager.c \
|
|
||||||
j2kheader_manager.c \
|
|
||||||
jp2k_encoder.c \
|
|
||||||
sock_manager.c \
|
|
||||||
openjpip.h \
|
|
||||||
bool.h \
|
|
||||||
boxheader_manager.h \
|
|
||||||
box_manager.h \
|
|
||||||
byte_manager.h \
|
|
||||||
codestream_manager.h \
|
|
||||||
faixbox_manager.h \
|
|
||||||
ihdrbox_manager.h \
|
|
||||||
imgreg_manager.h \
|
|
||||||
index_manager.h \
|
|
||||||
manfbox_manager.h \
|
|
||||||
marker_manager.h \
|
|
||||||
metadata_manager.h \
|
|
||||||
mhixbox_manager.h \
|
|
||||||
msgqueue_manager.h \
|
|
||||||
placeholder_manager.h \
|
|
||||||
target_manager.h \
|
|
||||||
cachemodel_manager.h \
|
|
||||||
j2kheader_manager.h \
|
|
||||||
jp2k_encoder.h \
|
|
||||||
query_parser.h \
|
|
||||||
channel_manager.h \
|
|
||||||
session_manager.h \
|
|
||||||
jpip_parser.h \
|
|
||||||
jp2k_decoder.h \
|
|
||||||
sock_manager.h
|
|
||||||
|
|
||||||
SERVER_SRC = auxtrans_manager.c \
|
|
||||||
auxtrans_manager.h
|
|
||||||
|
|
||||||
LOCAL_SRC = jp2k_decoder.c \
|
|
||||||
imgsock_manager.c \
|
|
||||||
jpipstream_manager.c \
|
|
||||||
cache_manager.c \
|
|
||||||
dec_clientmsg_handler.c \
|
|
||||||
imgsock_manager.h \
|
|
||||||
jpipstream_manager.h \
|
|
||||||
cache_manager.h \
|
|
||||||
dec_clientmsg_handler.h
|
|
||||||
|
|
||||||
libopenjpip_server_la_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
|
||||||
@FCGI_CFLAGS@ \
|
|
||||||
@LIBCURL_CFLAGS@ \
|
|
||||||
-DSERVER
|
|
||||||
libopenjpip_server_la_CFLAGS = @THREAD_CFLAGS@
|
|
||||||
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @THREAD_LIBS@ -lm
|
|
||||||
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
|
||||||
libopenjpip_server_la_SOURCES = $(JPIP_SRC) $(SERVER_SRC)
|
|
||||||
|
|
||||||
libopenjpip_local_la_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
|
||||||
@LIBCURL_CFLAGS@
|
|
||||||
libopenjpip_local_la_CFLAGS =
|
|
||||||
libopenjpip_local_la_LIBADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
|
||||||
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
|
||||||
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
|
|
||||||
|
|
||||||
install-data-hook:
|
|
||||||
if WANT_JPIP_SERVER
|
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
|
|
||||||
if BUILD_SHARED
|
|
||||||
@( $(call solist_s) ) >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
if BUILD_STATIC
|
|
||||||
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if WANT_JPIP
|
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
|
|
||||||
if BUILD_SHARED
|
|
||||||
@( $(call solist_c) ) >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
if BUILD_STATIC
|
|
||||||
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
|
|
||||||
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)
|
|
||||||
base_s = $(call get_tok_s,libdir)
|
|
||||||
so_s = $(call get_tok_s,library_names)
|
|
||||||
a_s = $(call get_tok_s,old_library)
|
|
||||||
|
|
||||||
solist_c = $(foreach f, $(dll_c) $(so_c), echo -e ' $(SO_PREFIX)\t$(base_c)/$(f)' ;)
|
|
||||||
get_tok_c = $(shell grep -E "^$(1)=" libopenjpip_local.la | cut -d "'" -f 2)
|
|
||||||
base_c = $(call get_tok_c,libdir)
|
|
||||||
so_c = $(call get_tok_c,library_names)
|
|
||||||
a_c = $(call get_tok_c,old_library)
|
|
||||||
|
|
||||||
if HAVE_WIN32
|
|
||||||
SO_PREFIX = (DLL)
|
|
||||||
dll_s = $(call get_tok_s,dlname)
|
|
||||||
dll_c = $(call get_tok_c,dlname)
|
|
||||||
else
|
|
||||||
if HAVE_DARWIN
|
|
||||||
SO_PREFIX = (DY)
|
|
||||||
dll_s =
|
|
||||||
dll_c =
|
|
||||||
else
|
|
||||||
SO_PREFIX = (SO)
|
|
||||||
dll_s =
|
|
||||||
dll_c =
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
ifdef jpipserver
|
|
||||||
CFLAGS = -O3 -Wall -m32 -DSERVER
|
|
||||||
LIBNAME = libopenjpip_server.a
|
|
||||||
else
|
|
||||||
J2KINCDIR = ../../../libopenjpeg
|
|
||||||
CFLAGS = -O3 -Wall -I$(J2KINCDIR)
|
|
||||||
LIBNAME = libopenjpip_local.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(LIBNAME)
|
|
||||||
|
|
||||||
ifdef jpipserver
|
|
||||||
$(LIBNAME): openjpip.o target_manager.o byte_manager.o box_manager.o boxheader_manager.o manfbox_manager.o \
|
|
||||||
mhixbox_manager.o marker_manager.o codestream_manager.o faixbox_manager.o index_manager.o \
|
|
||||||
msgqueue_manager.o metadata_manager.o placeholder_manager.o ihdrbox_manager.o imgreg_manager.o \
|
|
||||||
cachemodel_manager.o j2kheader_manager.o jp2k_encoder.o query_parser.o channel_manager.o \
|
|
||||||
session_manager.o jpip_parser.o sock_manager.o auxtrans_manager.o
|
|
||||||
ar r $@ $^
|
|
||||||
else
|
|
||||||
$(LIBNAME): openjpip.o target_manager.o byte_manager.o box_manager.o boxheader_manager.o manfbox_manager.o \
|
|
||||||
mhixbox_manager.o marker_manager.o codestream_manager.o faixbox_manager.o index_manager.o \
|
|
||||||
msgqueue_manager.o metadata_manager.o placeholder_manager.o ihdrbox_manager.o imgreg_manager.o \
|
|
||||||
cachemodel_manager.o j2kheader_manager.o jp2k_encoder.o query_parser.o channel_manager.o \
|
|
||||||
session_manager.o jpip_parser.o jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o \
|
|
||||||
dec_clientmsg_handler.o sock_manager.o
|
|
||||||
ar r $@ $^
|
|
||||||
endif
|
|
||||||
clean:
|
|
||||||
rm -f $(LIBNAME) *.o *~
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
# Headers file are located here:
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
|
|
||||||
${FCGI_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
IF(BUILD_JPIP_SERVER)
|
|
||||||
|
|
||||||
SET(OPJ_SERVER_SRCS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build executable
|
|
||||||
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
|
|
||||||
TARGET_LINK_LIBRARIES(opj_server openjpip_server)
|
|
||||||
SET_PROPERTY(
|
|
||||||
TARGET opj_server
|
|
||||||
APPEND PROPERTY
|
|
||||||
COMPILE_DEFINITIONS SERVER QUIT_SIGNAL="quitJPIP"
|
|
||||||
)
|
|
||||||
|
|
||||||
# On unix you need to link to the math library:
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(opj_server m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
# Install exe
|
|
||||||
INSTALL(TARGETS opj_server
|
|
||||||
EXPORT OpenJPEGTargets
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
||||||
)
|
|
||||||
ENDIF(BUILD_JPIP_SERVER)
|
|
||||||
|
|
||||||
SET(EXES
|
|
||||||
opj_dec_server
|
|
||||||
jpip_to_jp2
|
|
||||||
jpip_to_j2k
|
|
||||||
test_index
|
|
||||||
)
|
|
||||||
FOREACH(exe ${EXES})
|
|
||||||
ADD_EXECUTABLE(${exe} ${exe}.c)
|
|
||||||
TARGET_LINK_LIBRARIES(${exe} openjpip_local)
|
|
||||||
INSTALL(TARGETS ${exe}
|
|
||||||
EXPORT OpenJPEGTargets
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
||||||
)
|
|
||||||
ENDFOREACH(exe)
|
|
||||||
|
|
||||||
# Build the two java clients:
|
|
||||||
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
|
|
||||||
|
|
||||||
# 1. opj_viewer
|
|
||||||
# build dep list:
|
|
||||||
file(GLOB java1_srcs "opj_viewer/src/*.java")
|
|
||||||
|
|
||||||
# make sure target javac dir exists:
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
|
|
||||||
# Build java
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
||||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
|
||||||
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
|
|
||||||
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt -C
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/classes1 .
|
|
||||||
DEPENDS ${java1_srcs}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt
|
|
||||||
COMMENT "javac *.java; jar cvf -> opj_viewer.jar"
|
|
||||||
)
|
|
||||||
|
|
||||||
# name the target
|
|
||||||
ADD_CUSTOM_TARGET(OPJViewerJar ALL
|
|
||||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
||||||
COMMENT "building opj_viewer.jar"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 2. opj_viewer_xerces
|
|
||||||
# search for package org.apache.xerces.parsers
|
|
||||||
find_file(APACHE_XERCES_JAR
|
|
||||||
NAMES xerces-j2.jar xercesImpl.jar
|
|
||||||
PATHS /usr/share/java/
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
mark_as_advanced(APACHE_XERCES_JAR)
|
|
||||||
|
|
||||||
if(EXISTS ${APACHE_XERCES_JAR})
|
|
||||||
configure_file(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
# build dep list:
|
|
||||||
file(GLOB java2_srcs "opj_viewer_xerces/src/*.java")
|
|
||||||
|
|
||||||
# Need some common files:
|
|
||||||
list(APPEND java2_srcs
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ImageManager.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ImgdecClient.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/JPIPHttpClient.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/MML.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/PnmImage.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/RegimViewer.java
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ResizeListener.java
|
|
||||||
)
|
|
||||||
|
|
||||||
# make sure target javac dir exists:
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes2)
|
|
||||||
# Build java
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
||||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
|
||||||
-classpath ${APACHE_XERCES_JAR}
|
|
||||||
${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2
|
|
||||||
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
|
|
||||||
-C ${CMAKE_CURRENT_BINARY_DIR}/classes2 .
|
|
||||||
DEPENDS ${java2_srcs}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
|
|
||||||
COMMENT "javac *.java; jar cvf -> opj_viewer_xerces.jar"
|
|
||||||
)
|
|
||||||
|
|
||||||
# name the target
|
|
||||||
ADD_CUSTOM_TARGET(OPJViewerXercesJar ALL
|
|
||||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
||||||
COMMENT "building opj_viewer_xerces.jar"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
bin_PROGRAMS =
|
|
||||||
|
|
||||||
if WANT_JPIP
|
|
||||||
bin_PROGRAMS += opj_dec_server test_index jpip_to_j2k jpip_to_jp2
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WANT_JPIP_SERVER
|
|
||||||
bin_PROGRAMS += opj_server
|
|
||||||
endif
|
|
||||||
|
|
||||||
opj_server_CPPFLAGS = \
|
|
||||||
@FCGI_CFLAGS@ \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
|
||||||
-DSERVER \
|
|
||||||
-DQUIT_SIGNAL=\"quitJPIP\"
|
|
||||||
#
|
|
||||||
opj_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la @FCGI_LIBS@ -lm
|
|
||||||
#
|
|
||||||
opj_server_SOURCES = opj_server.c
|
|
||||||
|
|
||||||
#-------------
|
|
||||||
opj_dec_server_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
|
||||||
#
|
|
||||||
opj_dec_server_CFLAGS =
|
|
||||||
opj_dec_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
|
||||||
opj_dec_server_SOURCES = opj_dec_server.c
|
|
||||||
|
|
||||||
#-------------
|
|
||||||
jpip_to_jp2_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
|
||||||
#
|
|
||||||
jpip_to_jp2_CFLAGS =
|
|
||||||
jpip_to_jp2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
|
||||||
jpip_to_jp2_SOURCES = jpip_to_jp2.c
|
|
||||||
|
|
||||||
#-------------
|
|
||||||
jpip_to_j2k_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
|
||||||
#
|
|
||||||
jpip_to_j2k_CFLAGS =
|
|
||||||
jpip_to_j2k_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
|
||||||
jpip_to_j2k_SOURCES = jpip_to_j2k.c
|
|
||||||
|
|
||||||
#-------------
|
|
||||||
test_index_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
|
||||||
#
|
|
||||||
test_index_CFLAGS =
|
|
||||||
test_index_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
|
||||||
test_index_SOURCES = test_index.c
|
|
||||||
|
|
||||||
#-------------
|
|
||||||
install-data-hook:
|
|
||||||
if WANT_JPIP_SERVER
|
|
||||||
@echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
if WANT_JPIP
|
|
||||||
@echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/jpip_to_jp2$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/jpip_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/test_index$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
# Makefile for the MJ2 codecs of the OpenJPEG library: frames_to_mj2, mj2_to_frames, extract_j2k_from_mj2 and wrap_j2k_in_mj2
|
|
||||||
|
|
||||||
SET(common_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
|
||||||
|
|
||||||
# While mj2 executables do not use the API correctly, we do not link with the library but rather compile the sources files.
|
|
||||||
SET(OPJ_SRCS
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/bio.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/cio.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/dwt.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/event.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/image.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/j2k.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/j2k_lib.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/jp2.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/jpt.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/mct.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/mqc.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/openjpeg.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/pi.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/raw.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/t1.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/t2.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/tcd.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/tgt.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/cidx_manager.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/phix_manager.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/ppix_manager.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/thix_manager.c
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg/tpix_manager.c
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(MJ2_SRCS mj2.c mj2_convert.c)
|
|
||||||
|
|
||||||
IF(WIN32)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
|
|
||||||
# Headers file are located here:
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common
|
|
||||||
${LCMS_INCLUDE_DIRNAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(frames_to_mj2
|
|
||||||
frames_to_mj2.c
|
|
||||||
${common_SRCS}
|
|
||||||
${OPJ_SRCS}
|
|
||||||
${MJ2_SRCS}
|
|
||||||
)
|
|
||||||
TARGET_LINK_LIBRARIES(frames_to_mj2 ${LCMS_LIBNAME})
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(frames_to_mj2 m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(mj2_to_frames
|
|
||||||
mj2_to_frames.c
|
|
||||||
${common_SRCS}
|
|
||||||
${OPJ_SRCS}
|
|
||||||
${MJ2_SRCS}
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
|
||||||
)
|
|
||||||
TARGET_LINK_LIBRARIES(mj2_to_frames ${LCMS_LIBNAME})
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(mj2_to_frames m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(extract_j2k_from_mj2
|
|
||||||
extract_j2k_from_mj2.c
|
|
||||||
${OPJ_SRCS}
|
|
||||||
${MJ2_SRCS}
|
|
||||||
)
|
|
||||||
TARGET_LINK_LIBRARIES(extract_j2k_from_mj2 ${LCMS_LIBNAME})
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(extract_j2k_from_mj2 m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(wrap_j2k_in_mj2
|
|
||||||
wrap_j2k_in_mj2.c
|
|
||||||
${OPJ_SRCS}
|
|
||||||
${MJ2_SRCS}
|
|
||||||
)
|
|
||||||
TARGET_LINK_LIBRARIES(wrap_j2k_in_mj2 ${LCMS_LIBNAME})
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(wrap_j2k_in_mj2 m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
INSTALL(TARGETS frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR})
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
OPJ_SRC = \
|
|
||||||
../../libopenjpeg/bio.c \
|
|
||||||
../../libopenjpeg/cio.c \
|
|
||||||
../../libopenjpeg/dwt.c \
|
|
||||||
../../libopenjpeg/event.c \
|
|
||||||
../../libopenjpeg/image.c \
|
|
||||||
../../libopenjpeg/j2k.c \
|
|
||||||
../../libopenjpeg/j2k_lib.c \
|
|
||||||
../../libopenjpeg/jp2.c \
|
|
||||||
../../libopenjpeg/jpt.c \
|
|
||||||
../../libopenjpeg/mct.c \
|
|
||||||
../../libopenjpeg/mqc.c \
|
|
||||||
../../libopenjpeg/openjpeg.c \
|
|
||||||
../../libopenjpeg/pi.c \
|
|
||||||
../../libopenjpeg/raw.c \
|
|
||||||
../../libopenjpeg/t1.c \
|
|
||||||
../../libopenjpeg/t2.c \
|
|
||||||
../../libopenjpeg/tcd.c \
|
|
||||||
../../libopenjpeg/tgt.c \
|
|
||||||
../../libopenjpeg/cidx_manager.c \
|
|
||||||
../../libopenjpeg/phix_manager.c \
|
|
||||||
../../libopenjpeg/ppix_manager.c \
|
|
||||||
../../libopenjpeg/thix_manager.c \
|
|
||||||
../../libopenjpeg/tpix_manager.c
|
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
|
||||||
frames_to_mj2 \
|
|
||||||
mj2_to_frames \
|
|
||||||
extract_j2k_from_mj2 \
|
|
||||||
wrap_j2k_in_mj2
|
|
||||||
|
|
||||||
frames_to_mj2_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/common \
|
|
||||||
-I$(top_builddir)/applications/common \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
-DOPJ_STATIC
|
|
||||||
frames_to_mj2_CFLAGS =
|
|
||||||
frames_to_mj2_LDADD = -lm
|
|
||||||
frames_to_mj2_SOURCES = \
|
|
||||||
$(OPJ_SRC) \
|
|
||||||
../common/opj_getopt.c \
|
|
||||||
mj2_convert.c \
|
|
||||||
mj2.c \
|
|
||||||
frames_to_mj2.c \
|
|
||||||
mj2.h \
|
|
||||||
mj2_convert.h
|
|
||||||
|
|
||||||
mj2_to_frames_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/common \
|
|
||||||
-I$(top_builddir)/applications/common \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
@LCMS2_CFLAGS@ \
|
|
||||||
@LCMS1_CFLAGS@ \
|
|
||||||
-DOPJ_STATIC
|
|
||||||
mj2_to_frames_CFLAGS =
|
|
||||||
mj2_to_frames_LDADD = @LCMS2_LIBS@ @LCMS1_LIBS@ -lm
|
|
||||||
mj2_to_frames_SOURCES = \
|
|
||||||
$(OPJ_SRC) \
|
|
||||||
../common/color.c \
|
|
||||||
../common/opj_getopt.c \
|
|
||||||
mj2_convert.c \
|
|
||||||
mj2.c \
|
|
||||||
mj2_to_frames.c \
|
|
||||||
mj2.h \
|
|
||||||
mj2_convert.h
|
|
||||||
|
|
||||||
extract_j2k_from_mj2_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/common \
|
|
||||||
-I$(top_builddir)/applications/common \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
-DOPJ_STATIC
|
|
||||||
extract_j2k_from_mj2_CFLAGS =
|
|
||||||
extract_j2k_from_mj2_LDADD = -lm
|
|
||||||
extract_j2k_from_mj2_SOURCES = \
|
|
||||||
$(OPJ_SRC) \
|
|
||||||
mj2.c \
|
|
||||||
extract_j2k_from_mj2.c \
|
|
||||||
mj2.h
|
|
||||||
|
|
||||||
wrap_j2k_in_mj2_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/applications/common \
|
|
||||||
-I$(top_builddir)/applications/common \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
-DOPJ_STATIC
|
|
||||||
wrap_j2k_in_mj2_CFLAGS =
|
|
||||||
wrap_j2k_in_mj2_LDADD = -lm
|
|
||||||
wrap_j2k_in_mj2_SOURCES = \
|
|
||||||
$(OPJ_SRC) \
|
|
||||||
mj2.c \
|
|
||||||
wrap_j2k_in_mj2.c \
|
|
||||||
mj2.h
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
CMakeLists.txt
|
|
||||||
|
|
||||||
install-data-hook:
|
|
||||||
@echo -e " (B)\t$(bindir)/frames_to_mj2$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/mj2_to_frames$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/extract_j2k_from_mj2$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (B)\t$(bindir)/wrap_j2k_in_mj2$(EXEEXT)" >> $(top_builddir)/report.txt
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
autoreconf --install --force
|
|
||||||
|
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
#
|
#
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||||
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||||
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||||
|
|
||||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||||
|
|
||||||
# Exclude files from the Testing directories
|
# Exclude files from the Testing directories
|
||||||
@@ -22,11 +22,13 @@ SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
|||||||
".*/thirdparty/.*"
|
".*/thirdparty/.*"
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||||
|
|
||||||
# Suppress warning caused by intentional messages about deprecation
|
# Suppress warning caused by intentional messages about deprecation
|
||||||
".*warning,.* is deprecated"
|
".*warning,.* is deprecated"
|
||||||
# supress warnings caused by 3rd party libs:
|
# supress warnings caused by 3rd party libs:
|
||||||
".*/thirdparty/.*"
|
".*thirdparty.*"
|
||||||
|
"libtiff.*has no symbols"
|
||||||
|
"libpng.*has no symbols"
|
||||||
)
|
)
|
||||||
16
cmake/FindCPPCHECK.cmake
Normal file
16
cmake/FindCPPCHECK.cmake
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# cppcheck
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
find_program(CPPCHECK_EXECUTABLE
|
||||||
|
cppcheck
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
CPPCHECK_EXECUTABLE
|
||||||
|
)
|
||||||
20
cmake/FindFCGI.cmake
Normal file
20
cmake/FindFCGI.cmake
Normal file
@@ -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()
|
||||||
|
set(FCGI_LIBRARIES)
|
||||||
|
set(FCGI_INCLUDE_DIRS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY)
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
#
|
#
|
||||||
|
|
||||||
FIND_PROGRAM(KDU_EXPAND_EXECUTABLE
|
find_program(KDU_EXPAND_EXECUTABLE
|
||||||
kdu_expand
|
kdu_expand
|
||||||
)
|
)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
mark_as_advanced(
|
||||||
KDU_EXPAND_EXECUTABLE
|
KDU_EXPAND_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
|
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(LCMS_FOUND)
|
if(LCMS_FOUND)
|
||||||
SET( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||||
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||||
ENDIF(LCMS_FOUND)
|
endif()
|
||||||
@@ -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
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(LCMS2_FOUND)
|
if(LCMS2_FOUND)
|
||||||
SET( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||||
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||||
ENDIF(LCMS2_FOUND)
|
endif()
|
||||||
@@ -7,7 +7,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
|||||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||||
endif()
|
endif()
|
||||||
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||||
endif(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
endif()
|
||||||
|
|
||||||
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
||||||
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
||||||
@@ -28,43 +28,45 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
|||||||
|
|
||||||
# Make this explicit here, rather than accepting the CPack default value,
|
# Make this explicit here, rather than accepting the CPack default value,
|
||||||
# so we can refer to it:
|
# 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
|
# make sure package is not Cygwin-unknown, for Cygwin just
|
||||||
# cygwin is good for the system name
|
# cygwin is good for the system name
|
||||||
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||||
SET(CPACK_SYSTEM_NAME Cygwin)
|
set(CPACK_SYSTEM_NAME Cygwin)
|
||||||
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
else()
|
||||||
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||||
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
endif()
|
||||||
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
|
endif()
|
||||||
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||||
IF(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
SET(CPACK_SYSTEM_NAME win64-x64)
|
set(CPACK_SYSTEM_NAME win64-x64)
|
||||||
ELSE(CMAKE_CL_64)
|
else()
|
||||||
SET(CPACK_SYSTEM_NAME win32-x86)
|
set(CPACK_SYSTEM_NAME win32-x86)
|
||||||
ENDIF(CMAKE_CL_64)
|
endif()
|
||||||
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
endif()
|
||||||
|
|
||||||
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
|
# 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
|
# needed
|
||||||
IF(CYGWIN)
|
if(CYGWIN)
|
||||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||||
ELSE(CYGWIN)
|
else()
|
||||||
SET(CPACK_PACKAGE_FILE_NAME
|
set(CPACK_PACKAGE_FILE_NAME
|
||||||
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
||||||
ENDIF(CYGWIN)
|
endif()
|
||||||
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
endif()
|
||||||
|
|
||||||
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||||
|
if(APPLE)
|
||||||
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||||
SET(CPACK_BUNDLE_PLIST
|
set(CPACK_BUNDLE_PLIST
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||||
#include(BundleUtilities)
|
#include(BundleUtilities)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||||
@@ -6,21 +6,21 @@
|
|||||||
# module to load OPENJPEG's settings for an external project.
|
# module to load OPENJPEG's settings for an external project.
|
||||||
@OPENJPEG_CONFIG_INSTALL_ONLY@
|
@OPENJPEG_CONFIG_INSTALL_ONLY@
|
||||||
# The OPENJPEG version number.
|
# The OPENJPEG version number.
|
||||||
SET(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
|
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
|
||||||
SET(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
||||||
SET(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
||||||
|
|
||||||
# The libraries.
|
# The libraries.
|
||||||
SET(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARIES@")
|
set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
|
||||||
|
|
||||||
# The CMake macros dir.
|
# The CMake macros dir.
|
||||||
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_CMAKE_DIR_CONFIG@")
|
set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
|
||||||
|
|
||||||
# The configuration options.
|
# The configuration options.
|
||||||
SET(OPENJPEG_BUILD_SHARED_LIBS "@OPENJPEG_BUILD_SHARED_LIBS@")
|
set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||||
|
|
||||||
# The "use" file.
|
# The "use" file.
|
||||||
SET(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
||||||
|
|
||||||
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
@@ -29,20 +29,20 @@ if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
|||||||
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
||||||
|
|
||||||
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
else()
|
||||||
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||||
# This is a build tree
|
# This is a build tree
|
||||||
SET( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
||||||
|
|
||||||
include(${SELF_DIR}/OpenJPEGExports.cmake)
|
include(${SELF_DIR}/OpenJPEGExports.cmake)
|
||||||
|
|
||||||
else(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
else()
|
||||||
message(FATAL_ERROR "ooops")
|
message(FATAL_ERROR "ooops")
|
||||||
endif(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
endif()
|
||||||
endif(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
endif()
|
||||||
|
|
||||||
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
|
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
|
||||||
|
|
||||||
# Backward compatible part:
|
# Backward compatible part:
|
||||||
SET(OPENJPEG_FOUND TRUE)
|
set(OPENJPEG_FOUND TRUE)
|
||||||
|
|
||||||
10
cmake/TestFileOffsetBits.c
Normal file
10
cmake/TestFileOffsetBits.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
/* Cause a compile-time error if off_t is smaller than 64 bits */
|
||||||
|
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||||
|
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
23
cmake/TestLargeFiles.c.cmake.in
Normal file
23
cmake/TestLargeFiles.c.cmake.in
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#cmakedefine _LARGEFILE_SOURCE
|
||||||
|
#cmakedefine _LARGE_FILES
|
||||||
|
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
/* Cause a compile-time error if off_t is smaller than 64 bits,
|
||||||
|
* and make sure we have ftello / fseeko.
|
||||||
|
*/
|
||||||
|
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||||
|
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||||
|
FILE *fp = fopen(argv[0],"r");
|
||||||
|
off_t offset = ftello( fp );
|
||||||
|
|
||||||
|
fseeko( fp, offset, SEEK_CUR );
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
134
cmake/TestLargeFiles.cmake
Normal file
134
cmake/TestLargeFiles.cmake
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
# - Define macro to check large file support
|
||||||
|
#
|
||||||
|
# OPJ_TEST_LARGE_FILES(VARIABLE)
|
||||||
|
#
|
||||||
|
# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
|
||||||
|
# This macro will also defines the necessary variable enable large file support, for instance
|
||||||
|
# _LARGE_FILES
|
||||||
|
# _LARGEFILE_SOURCE
|
||||||
|
# _FILE_OFFSET_BITS 64
|
||||||
|
# HAVE_FSEEKO
|
||||||
|
#
|
||||||
|
# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
|
||||||
|
# end up in a config.h file that is included in your source if necessary!
|
||||||
|
#
|
||||||
|
# Adapted from Gromacs project (http://www.gromacs.org/)
|
||||||
|
# by Julien Malik
|
||||||
|
#
|
||||||
|
|
||||||
|
macro(OPJ_TEST_LARGE_FILES VARIABLE)
|
||||||
|
if("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
||||||
|
|
||||||
|
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
|
||||||
|
# and then separately fseeko. However, in the future we might have 128-bit filesystems
|
||||||
|
# (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
|
||||||
|
|
||||||
|
message(STATUS "Checking for 64-bit off_t")
|
||||||
|
|
||||||
|
# First check without any special flags
|
||||||
|
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c")
|
||||||
|
if(FILE64_OK)
|
||||||
|
message(STATUS "Checking for 64-bit off_t - present")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FILE64_OK)
|
||||||
|
# Test with _FILE_OFFSET_BITS=64
|
||||||
|
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||||
|
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
|
||||||
|
if(FILE64_OK)
|
||||||
|
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
|
||||||
|
set(_FILE_OFFSET_BITS 64)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FILE64_OK)
|
||||||
|
# Test with _LARGE_FILES
|
||||||
|
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||||
|
COMPILE_DEFINITIONS "-D_LARGE_FILES" )
|
||||||
|
if(FILE64_OK)
|
||||||
|
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
|
||||||
|
set(_LARGE_FILES 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FILE64_OK)
|
||||||
|
# Test with _LARGEFILE_SOURCE
|
||||||
|
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
|
||||||
|
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
|
||||||
|
if(FILE64_OK)
|
||||||
|
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
|
||||||
|
set(_LARGEFILE_SOURCE 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
#if(NOT FILE64_OK)
|
||||||
|
# # now check for Windows stuff
|
||||||
|
# try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
|
||||||
|
# "${PROJECT_SOURCE_DIR}/cmake/TestWindowsFSeek.c")
|
||||||
|
# if(FILE64_OK)
|
||||||
|
# message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
|
||||||
|
# set(HAVE__FSEEKI64 1)
|
||||||
|
# endif()
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
if(NOT FILE64_OK)
|
||||||
|
message(STATUS "Checking for 64-bit off_t - not present")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} CACHE INTERNAL "Result of test for needed _FILE_OFFSET_BITS=64")
|
||||||
|
set(_LARGE_FILES ${_LARGE_FILES} CACHE INTERNAL "Result of test for needed _LARGE_FILES")
|
||||||
|
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
|
||||||
|
|
||||||
|
# Set the flags we might have determined to be required above
|
||||||
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/TestLargeFiles.c.cmake.in"
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||||
|
|
||||||
|
message(STATUS "Checking for fseeko/ftello")
|
||||||
|
|
||||||
|
# Test if ftello/fseeko are available
|
||||||
|
try_compile(FSEEKO_COMPILE_OK
|
||||||
|
"${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||||
|
|
||||||
|
if(FSEEKO_COMPILE_OK)
|
||||||
|
message(STATUS "Checking for fseeko/ftello - present")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FSEEKO_COMPILE_OK)
|
||||||
|
# glibc 2.2 needs _LARGEFILE_SOURCE for fseeko (but not for 64-bit off_t...)
|
||||||
|
try_compile(FSEEKO_COMPILE_OK
|
||||||
|
"${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
|
||||||
|
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
|
||||||
|
|
||||||
|
if(FSEEKO_COMPILE_OK)
|
||||||
|
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
|
||||||
|
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FSEEKO_COMPILE_OK)
|
||||||
|
set(HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||||
|
else()
|
||||||
|
message(STATUS "Checking for fseeko/ftello - not found")
|
||||||
|
set(HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FILE64_OK AND FSEEKO_COMPILE_OK)
|
||||||
|
message(STATUS "Large File support - found")
|
||||||
|
set(${VARIABLE} ON CACHE INTERNAL "Result of test for large file support")
|
||||||
|
else()
|
||||||
|
message(STATUS "Large File support - not found")
|
||||||
|
set(${VARIABLE} OFF CACHE INTERNAL "Result of test for large file support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
cmake/TestWindowsFSeek.c
Normal file
11
cmake/TestWindowsFSeek.c
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
__int64 off=0;
|
||||||
|
|
||||||
|
_fseeki64(NULL, off, SEEK_SET);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
39
cmake/openjpeg_valgrind.supp
Normal file
39
cmake/openjpeg_valgrind.supp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:deflate
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
fun:png_write_row
|
||||||
|
fun:imagetopng
|
||||||
|
fun:main
|
||||||
|
}
|
||||||
|
{
|
||||||
|
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||||
|
Memcheck:Value8
|
||||||
|
fun:crc32
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
fun:png_write_chunk
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
obj:/lib/libpng12.so.0.42.0
|
||||||
|
fun:png_write_row
|
||||||
|
fun:imagetopng
|
||||||
|
fun:main
|
||||||
|
}
|
||||||
|
{
|
||||||
|
<Appears with libpng uses with Ubuntu10.04 (hulk)>
|
||||||
|
Memcheck:Param
|
||||||
|
write(buf)
|
||||||
|
fun:__write_nocancel
|
||||||
|
fun:_IO_file_write@@GLIBC_2.2.5
|
||||||
|
fun:_IO_do_write@@GLIBC_2.2.5
|
||||||
|
fun:_IO_file_close_it@@GLIBC_2.2.5
|
||||||
|
fun:fclose@@GLIBC_2.2.5
|
||||||
|
fun:imagetopng
|
||||||
|
fun:main
|
||||||
|
}
|
||||||
540
configure.ac
540
configure.ac
@@ -1,540 +0,0 @@
|
|||||||
|
|
||||||
# According to http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info :
|
|
||||||
#
|
|
||||||
# 1) when bugs are fixed or internal code is changed: increase MICRO
|
|
||||||
# 2) if API is added, increase MINOR and set MICRO to 0
|
|
||||||
# 3) if API or ABI is broken (this case should (must) never happen as it's very bad for a library), or a new designed library, increase MAJOR and set MINOR and MICRO to 0
|
|
||||||
|
|
||||||
m4_define([OPJ_MAJOR], [1])
|
|
||||||
m4_define([OPJ_MINOR], [5])
|
|
||||||
m4_define([OPJ_MICRO], [0])
|
|
||||||
|
|
||||||
m4_define([lt_cur], m4_eval(OPJ_MAJOR + OPJ_MINOR))
|
|
||||||
m4_define([lt_rev], OPJ_MICRO)
|
|
||||||
m4_define([lt_age], OPJ_MINOR)
|
|
||||||
|
|
||||||
AC_PREREQ([2.62])
|
|
||||||
AC_INIT([OpenJPEG],
|
|
||||||
[OPJ_MAJOR.OPJ_MINOR.OPJ_MICRO],
|
|
||||||
[openjpeg@googlegroups.com],
|
|
||||||
[openjpeg],
|
|
||||||
[http://www.openjpeg.org])
|
|
||||||
AC_CONFIG_SRCDIR([configure.ac])
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
|
||||||
AC_CONFIG_HEADERS([opj_config.h])
|
|
||||||
|
|
||||||
AC_CANONICAL_SYSTEM
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2 dist-xz dist-zip])
|
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
||||||
|
|
||||||
MAJOR_NR=OPJ_MAJOR
|
|
||||||
MINOR_NR=OPJ_MINOR
|
|
||||||
MICRO_NR=OPJ_MICRO
|
|
||||||
AC_SUBST([MAJOR_NR])
|
|
||||||
AC_SUBST([MINOR_NR])
|
|
||||||
AC_SUBST([MICRO_NR])
|
|
||||||
|
|
||||||
LT_PREREQ([2.0])
|
|
||||||
LT_INIT([win32-dll])
|
|
||||||
|
|
||||||
lt_version=lt_cur:lt_rev:lt_age
|
|
||||||
AC_SUBST([lt_version])
|
|
||||||
|
|
||||||
|
|
||||||
### Needed information
|
|
||||||
|
|
||||||
have_win32=no
|
|
||||||
have_darwin="no"
|
|
||||||
case "$host_os" in
|
|
||||||
mingw*)
|
|
||||||
have_win32="yes"
|
|
||||||
;;
|
|
||||||
darwin*)
|
|
||||||
have_darwin="yes"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
|
|
||||||
AM_CONDITIONAL([HAVE_DARWIN], [test "x${have_darwin}" = "xyes"])
|
|
||||||
|
|
||||||
|
|
||||||
### Additional options to configure
|
|
||||||
|
|
||||||
# debug
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([debug],
|
|
||||||
[AC_HELP_STRING([--enable-debug], [build with debug symbols @<:@default=disabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_debug="yes"
|
|
||||||
else
|
|
||||||
want_debug="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_debug="no"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build in debug mode])
|
|
||||||
AC_MSG_RESULT([${want_debug}])
|
|
||||||
|
|
||||||
# MJ2
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([mj2],
|
|
||||||
[AC_HELP_STRING([--enable-mj2], [build mj2 binaries @<:@default=disabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_mj2="yes"
|
|
||||||
else
|
|
||||||
want_mj2="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_mj2="no"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build the MJ2 binaries])
|
|
||||||
AC_MSG_RESULT([${want_mj2}])
|
|
||||||
|
|
||||||
if test "x${want_mj2}" = "xyes" ; then
|
|
||||||
AC_DEFINE(USE_MJ2, [1], [define to 1 if you use mj2])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WANT_MJ2], [test "x${want_mj2}" = "xyes"])
|
|
||||||
|
|
||||||
# JPWL
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([jpwl],
|
|
||||||
[AC_HELP_STRING([--enable-jpwl], [build JPWL library @<:@default=disabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_jpwl="yes"
|
|
||||||
else
|
|
||||||
want_jpwl="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_jpwl="no"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build the JPWL library])
|
|
||||||
AC_MSG_RESULT([${want_jpwl}])
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WANT_JPWL], [test "x${want_jpwl}" = "xyes"])
|
|
||||||
|
|
||||||
# JPIP
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([jpip],
|
|
||||||
[AC_HELP_STRING([--enable-jpip], [build jpip library @<:@default=disabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_jpip="yes"
|
|
||||||
else
|
|
||||||
want_jpip="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_jpip="no"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build the JPIP library])
|
|
||||||
AC_MSG_RESULT([${want_jpip}])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([jpip-server],
|
|
||||||
[AC_HELP_STRING([--enable-jpip-server], [build jpip server @<:@default=disabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_jpip_server="yes"
|
|
||||||
else
|
|
||||||
want_jpip_server="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_jpip_server="no"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build the JPIP server])
|
|
||||||
AC_MSG_RESULT([${want_jpip_server}])
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for programs
|
|
||||||
|
|
||||||
AC_PROG_CC
|
|
||||||
|
|
||||||
# pkg-config
|
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG
|
|
||||||
|
|
||||||
# Check whether pkg-config supports Requires.private
|
|
||||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.22 ; then
|
|
||||||
pkgconfig_requires_private="Requires.private"
|
|
||||||
else
|
|
||||||
pkgconfig_requires_private="Requires"
|
|
||||||
fi
|
|
||||||
AC_SUBST([pkgconfig_requires_private])
|
|
||||||
AC_SUBST([requirements])
|
|
||||||
|
|
||||||
# doxygen
|
|
||||||
|
|
||||||
OPJ_CHECK_DOXYGEN
|
|
||||||
|
|
||||||
# ln -s
|
|
||||||
|
|
||||||
AC_PROG_LN_S
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for libraries
|
|
||||||
|
|
||||||
# libpng
|
|
||||||
|
|
||||||
have_libpng="no"
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([png],
|
|
||||||
[AC_HELP_STRING([--disable-png], [disable PNG support @<:@default=enabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_png="yes"
|
|
||||||
else
|
|
||||||
want_png="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_png="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build with PNG support])
|
|
||||||
AC_MSG_RESULT([${want_png}])
|
|
||||||
|
|
||||||
if test "x${want_png}" = "xyes" ; then
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([PNG], [libpng15 zlib],
|
|
||||||
[have_libpng="yes"],
|
|
||||||
[
|
|
||||||
PKG_CHECK_MODULES([PNG], [libpng14 zlib],
|
|
||||||
[have_libpng="yes"],
|
|
||||||
[
|
|
||||||
PKG_CHECK_MODULES([PNG], [libpng12 zlib],
|
|
||||||
[have_libpng="yes"],
|
|
||||||
[
|
|
||||||
PKG_CHECK_MODULES([PNG], [libpng zlib],
|
|
||||||
[have_libpng="yes"],
|
|
||||||
[have_libpng="no"])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
if ! test "x${have_libpng}" = "xyes" ; then
|
|
||||||
|
|
||||||
OPJ_CHECK_LIB([zlib.h],
|
|
||||||
[z],
|
|
||||||
[zlibVersion],
|
|
||||||
[
|
|
||||||
OPJ_CHECK_LIB([png.h],
|
|
||||||
[png],
|
|
||||||
[png_access_version_number],
|
|
||||||
[
|
|
||||||
have_libpng="yes"
|
|
||||||
PNG_CFLAGS="${PNG_CFLAGS} ${Z_CFLAGS}"
|
|
||||||
PNG_LIBS="${PNG_LIBS} ${Z_LIBS}"
|
|
||||||
],
|
|
||||||
[have_libpng="no"])
|
|
||||||
],
|
|
||||||
[have_libpng="no"])
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x${have_libpng}" = "xno" ; then
|
|
||||||
AC_MSG_WARN([Can not find a usuable PNG library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether PNG is available])
|
|
||||||
AC_MSG_RESULT([${have_libpng}])
|
|
||||||
|
|
||||||
if test "x${have_libpng}" = "xyes" ; then
|
|
||||||
AC_DEFINE(HAVE_LIBPNG, [1], [define to 1 if you have libpng])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([with_libpng], [test x${have_libpng} = "xyes"])
|
|
||||||
|
|
||||||
# libtiff
|
|
||||||
|
|
||||||
have_libtiff="no"
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([tiff],
|
|
||||||
[AC_HELP_STRING([--disable-tiff], [disable TIFF support @<:@default=enabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_tiff="yes"
|
|
||||||
else
|
|
||||||
want_tiff="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_tiff="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build with TIFF support])
|
|
||||||
AC_MSG_RESULT([${want_tiff}])
|
|
||||||
|
|
||||||
if test "x${want_tiff}" = "xyes" ; then
|
|
||||||
|
|
||||||
OPJ_CHECK_LIB(
|
|
||||||
[tiff.h],
|
|
||||||
[tiff],
|
|
||||||
[TIFFOpen],
|
|
||||||
[have_libtiff="yes"],
|
|
||||||
[have_libtiff="no"])
|
|
||||||
|
|
||||||
if test "x${have_libtiff}" = "xno" ; then
|
|
||||||
AC_MSG_WARN([Can not find a usuable TIFF library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether TIFF is available])
|
|
||||||
AC_MSG_RESULT([${have_libtiff}])
|
|
||||||
|
|
||||||
if test "x${have_libtiff}" = "xyes" ; then
|
|
||||||
AC_DEFINE(HAVE_LIBTIFF, [1], [define to 1 if you have libtiff])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([with_libtiff], [test "x${have_libtiff}" = "xyes"])
|
|
||||||
|
|
||||||
# libcms2
|
|
||||||
|
|
||||||
lcms_output="no"
|
|
||||||
have_lcms2="no"
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([lcms2],
|
|
||||||
[AC_HELP_STRING([--disable-lcms2], [disable LCMS-2 support @<:@default=enabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_lcms2="yes"
|
|
||||||
else
|
|
||||||
want_lcms2="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_lcms2="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build with LCMS-2 support])
|
|
||||||
AC_MSG_RESULT([${want_lcms2}])
|
|
||||||
|
|
||||||
if test "x${want_lcms2}" = "xyes" ; then
|
|
||||||
PKG_CHECK_MODULES([LCMS2], [lcms2],
|
|
||||||
[have_lcms2="yes"],
|
|
||||||
[have_lcms2="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether LCMS-2 is available])
|
|
||||||
AC_MSG_RESULT([${have_lcms2}])
|
|
||||||
|
|
||||||
if test "x${have_lcms2}" = "xyes" ; then
|
|
||||||
AC_DEFINE(HAVE_LIBLCMS2, [1], [define to 1 if you have lcms version 2.x])
|
|
||||||
lcms_output="lcms version 2.x"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# libcms1
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([lcms1],
|
|
||||||
[AC_HELP_STRING([--disable-lcms1], [disable LCMS-1 support @<:@default=enabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
want_lcms1="yes"
|
|
||||||
else
|
|
||||||
want_lcms1="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_lcms1="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build with LCMS-1 support])
|
|
||||||
AC_MSG_RESULT([${want_lcms1}])
|
|
||||||
|
|
||||||
if test "x${have_lcms2}" = "xno" ; then
|
|
||||||
|
|
||||||
if test "x${want_lcms1}" = "xyes" ; then
|
|
||||||
PKG_CHECK_MODULES([LCMS1], [lcms1],
|
|
||||||
[have_lcms1="yes"],
|
|
||||||
[PKG_CHECK_MODULES([LCMS1], [lcms],
|
|
||||||
[have_lcms1="yes"],
|
|
||||||
[have_lcms1="no"])])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether LCMS-1 is available])
|
|
||||||
AC_MSG_RESULT([${have_lcms1}])
|
|
||||||
|
|
||||||
if test "x${have_lcms1}" = "xyes" ; then
|
|
||||||
AC_DEFINE(HAVE_LIBLCMS1, [1], [define to 1 if you have lcms version 1.x])
|
|
||||||
lcms_output="lcms version 1.x"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# threads
|
|
||||||
|
|
||||||
if test "x${want_jpip_server}" = "xyes" ; then
|
|
||||||
|
|
||||||
if test "x${have_win32}" = "xno" ; then
|
|
||||||
|
|
||||||
SAVE_CFLAGS=${CFLAGS}
|
|
||||||
CFLAGS="${CFLAGS} -pthread"
|
|
||||||
SAVE_LIBS=${LIBS}
|
|
||||||
LIBS="${LIBS} -pthread"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([[
|
|
||||||
#include <pthread.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
pthread_t id;
|
|
||||||
id = pthread_self();
|
|
||||||
]])],
|
|
||||||
[have_pthread="yes"],
|
|
||||||
[have_pthread="no"])
|
|
||||||
CFLAGS=${SAVE_CFLAGS}
|
|
||||||
LIBS=${SAVE_LIBS}
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether Pthread library is available])
|
|
||||||
AC_MSG_RESULT([${have_pthread}])
|
|
||||||
|
|
||||||
if ! test "x${have_pthread}" = "xyes" ; then
|
|
||||||
AC_MSG_WARN([Pthread library not found. OpenJPIP server will not be compiled.])
|
|
||||||
want_jpip_server="no"
|
|
||||||
else
|
|
||||||
THREAD_CFLAGS="-pthread"
|
|
||||||
THREAD_LIBS="-pthread"
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
THREAD_LIBS="-lws2_32"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_VAR([THREAD_CFLAGS], [compiler flag for the thread library])
|
|
||||||
AC_SUBST([THREAD_CFLAGS])
|
|
||||||
AC_ARG_VAR([THREAD_LIBS], [linker flags for thread library])
|
|
||||||
AC_SUBST([THREAD_LIBS])
|
|
||||||
|
|
||||||
# libfcgi
|
|
||||||
|
|
||||||
if test "x${want_jpip_server}" = "xyes" ; then
|
|
||||||
|
|
||||||
have_fcgi="no"
|
|
||||||
OPJ_CHECK_LIB(
|
|
||||||
[fcgi_stdio.h],
|
|
||||||
[fcgi],
|
|
||||||
[FCGI_Accept],
|
|
||||||
[have_fcgi="yes"],
|
|
||||||
[have_fcgi="no"])
|
|
||||||
|
|
||||||
if ! test "x${have_fcgi}" = "xyes" ; then
|
|
||||||
AC_MSG_WARN([FastCGI library not found. OpenJPIP server will not be compiled.])
|
|
||||||
want_jpip_server="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# libcurl
|
|
||||||
|
|
||||||
if test "x${want_jpip_server}" = "xyes" ; then
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([LIBCURL], [libcurl],
|
|
||||||
[have_libcurl="yes"],
|
|
||||||
[have_libcurl="no"])
|
|
||||||
|
|
||||||
if ! test "x${have_libcurl}" = "xyes" ; then
|
|
||||||
AC_MSG_WARN([libcurl library not found. OpenJPIP server will not be compiled.])
|
|
||||||
want_jpip_server="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x${want_jpip}" = "xyes" ; then
|
|
||||||
AC_DEFINE(USE_JPIP, [1], [define to 1 if you use jpip])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WANT_JPIP], [test "x${want_jpip}" = "xyes"])
|
|
||||||
|
|
||||||
if test "x${want_jpip_server}" = "xyes" ; then
|
|
||||||
AC_DEFINE(USE_JPIP_SERVER, [1], [define to 1 if you use jpip server])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WANT_JPIP_SERVER], [test "x${want_jpip_server}" = "xyes"])
|
|
||||||
|
|
||||||
AM_CONDITIONAL([WANT_JPIP_CODE], [test "x${want_jpip}" = "xyes" || test "x${want_jpip_server}" = "xyes"])
|
|
||||||
|
|
||||||
### Checks for header files
|
|
||||||
|
|
||||||
## FIXME: declarations must be fixed in source code. See autoconf manual
|
|
||||||
AC_HEADER_DIRENT
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for types
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for structures
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for compiler characteristics
|
|
||||||
|
|
||||||
AM_PROG_CC_C_O
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
|
|
||||||
#OPJ_COMPILER_FLAG([-Wall])
|
|
||||||
#OPJ_COMPILER_FLAG([-Wextra])
|
|
||||||
#OPJ_COMPILER_FLAG([-Wshadow])
|
|
||||||
#OPJ_COMPILER_FLAG([-Wpointer-arith])
|
|
||||||
OPJ_COMPILER_FLAG([-Wno-unused-result])
|
|
||||||
|
|
||||||
if test "x${want_debug}" = "xyes" ; then
|
|
||||||
OPJ_COMPILER_FLAG([-g])
|
|
||||||
OPJ_COMPILER_FLAG([-O0])
|
|
||||||
else
|
|
||||||
OPJ_COMPILER_FLAG([-O3])
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for linker characteristics
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for library functions
|
|
||||||
|
|
||||||
|
|
||||||
### Post configuration
|
|
||||||
|
|
||||||
AM_CONDITIONAL([BUILD_SHARED], [test "x${enable_shared}" = "xyes"])
|
|
||||||
AM_CONDITIONAL([BUILD_STATIC], [test "x${enable_static}" = "xyes"])
|
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
Makefile
|
|
||||||
libopenjpeg1.pc
|
|
||||||
libopenjpeg-jpwl.pc
|
|
||||||
libopenjpeg/Makefile
|
|
||||||
libopenjpeg/jpwl/Makefile
|
|
||||||
applications/Makefile
|
|
||||||
applications/codec/Makefile
|
|
||||||
applications/mj2/Makefile
|
|
||||||
applications/jpip/Makefile
|
|
||||||
applications/jpip/libopenjpip/Makefile
|
|
||||||
applications/jpip/util/Makefile
|
|
||||||
doc/Makefile
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|
||||||
### Summary
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "------------------------------------------------------------------------"
|
|
||||||
echo "$PACKAGE $VERSION"
|
|
||||||
echo "------------------------------------------------------------------------"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "Configuration Options Summary:"
|
|
||||||
echo
|
|
||||||
echo " Debug...............: ${want_debug}"
|
|
||||||
echo
|
|
||||||
echo " Optional support:"
|
|
||||||
echo " libpng............: ${have_libpng}"
|
|
||||||
echo " libtiff...........: ${have_libtiff}"
|
|
||||||
echo " libcms............: ${lcms_output}"
|
|
||||||
echo
|
|
||||||
echo " Documentation.......: ${opj_have_doxygen}"
|
|
||||||
echo " Build.............: make doc"
|
|
||||||
echo
|
|
||||||
echo " mj2.................: ${want_mj2}"
|
|
||||||
echo " jpwl................: ${want_jpwl}"
|
|
||||||
echo " jpip................: ${want_jpip}"
|
|
||||||
echo " jpip server.........: ${want_jpip_server}"
|
|
||||||
echo
|
|
||||||
@@ -3,19 +3,50 @@
|
|||||||
# to generate the html documentation in the doc/html repository of the build folder.
|
# to generate the html documentation in the doc/html repository of the build folder.
|
||||||
|
|
||||||
# Try to find the doxygen tool
|
# Try to find the doxygen tool
|
||||||
FIND_PACKAGE(Doxygen)
|
find_package(Doxygen)
|
||||||
|
|
||||||
IF(DOXYGEN_FOUND)
|
if(DOXYGEN_FOUND)
|
||||||
# Configure the doxygen config file with variable from CMake and move it
|
# Configure the doxygen config file with variable from CMake and move it
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
|
||||||
${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
|
${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
|
||||||
|
|
||||||
|
# Configure the html mainpage file of the doxygen documentation with variable
|
||||||
|
# from CMake and move it
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in
|
||||||
|
${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in
|
||||||
|
${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY)
|
||||||
|
# copy png file to make local (binary tree) documentation valid:
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png
|
||||||
|
${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png
|
||||||
|
${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY)
|
||||||
|
|
||||||
|
file(GLOB headers
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c
|
||||||
|
)
|
||||||
# Generate new target to build the html documentation
|
# Generate new target to build the html documentation
|
||||||
ADD_CUSTOM_TARGET(doc ALL
|
add_custom_command(
|
||||||
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox)
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
|
||||||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
|
||||||
|
DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
|
||||||
|
${CMAKE_BINARY_DIR}/doc/mainpage.dox
|
||||||
|
${CMAKE_BINARY_DIR}/doc/openjpip.dox
|
||||||
|
${headers}
|
||||||
|
)
|
||||||
|
add_custom_target(doc ALL
|
||||||
|
DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
|
||||||
|
COMMENT "Building doxygen documentation"
|
||||||
|
)
|
||||||
|
|
||||||
ELSE(DOXYGEN_FOUND)
|
# install HTML documentation (install png files too):
|
||||||
|
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
|
||||||
MESSAGE(STATUS "Doxygen not found, we cannot generate the documentation")
|
DESTINATION share/doc
|
||||||
|
PATTERN ".svn" EXCLUDE
|
||||||
ENDIF(DOXYGEN_FOUND)
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "Doxygen not found, we cannot generate the documentation")
|
||||||
|
endif()
|
||||||
|
|||||||
290
doc/Doxyfile.dox
290
doc/Doxyfile.dox
@@ -1,290 +0,0 @@
|
|||||||
# Doxyfile 1.7.3
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Project related configuration options
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
DOXYFILE_ENCODING = UTF-8
|
|
||||||
PROJECT_NAME = OpenJPEG
|
|
||||||
PROJECT_NUMBER =
|
|
||||||
PROJECT_BRIEF =
|
|
||||||
PROJECT_LOGO =
|
|
||||||
OUTPUT_DIRECTORY = .
|
|
||||||
CREATE_SUBDIRS = NO
|
|
||||||
OUTPUT_LANGUAGE = English
|
|
||||||
BRIEF_MEMBER_DESC = YES
|
|
||||||
REPEAT_BRIEF = YES
|
|
||||||
ABBREVIATE_BRIEF = "The $name class" \
|
|
||||||
"The $name widget" \
|
|
||||||
"The $name file" \
|
|
||||||
is \
|
|
||||||
provides \
|
|
||||||
specifies \
|
|
||||||
contains \
|
|
||||||
represents \
|
|
||||||
a \
|
|
||||||
an \
|
|
||||||
the
|
|
||||||
ALWAYS_DETAILED_SEC = NO
|
|
||||||
INLINE_INHERITED_MEMB = NO
|
|
||||||
FULL_PATH_NAMES = NO
|
|
||||||
STRIP_FROM_PATH = C://
|
|
||||||
STRIP_FROM_INC_PATH =
|
|
||||||
SHORT_NAMES = NO
|
|
||||||
JAVADOC_AUTOBRIEF = YES
|
|
||||||
QT_AUTOBRIEF = NO
|
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
|
||||||
INHERIT_DOCS = YES
|
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
|
||||||
TAB_SIZE = 8
|
|
||||||
ALIASES =
|
|
||||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
|
||||||
OPTIMIZE_OUTPUT_JAVA = NO
|
|
||||||
OPTIMIZE_FOR_FORTRAN = NO
|
|
||||||
OPTIMIZE_OUTPUT_VHDL = NO
|
|
||||||
EXTENSION_MAPPING =
|
|
||||||
BUILTIN_STL_SUPPORT = NO
|
|
||||||
CPP_CLI_SUPPORT = NO
|
|
||||||
SIP_SUPPORT = NO
|
|
||||||
IDL_PROPERTY_SUPPORT = YES
|
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
|
||||||
SUBGROUPING = YES
|
|
||||||
TYPEDEF_HIDES_STRUCT = NO
|
|
||||||
SYMBOL_CACHE_SIZE = 0
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Build related configuration options
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
EXTRACT_ALL = YES
|
|
||||||
EXTRACT_PRIVATE = YES
|
|
||||||
EXTRACT_STATIC = YES
|
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
|
||||||
EXTRACT_LOCAL_METHODS = NO
|
|
||||||
EXTRACT_ANON_NSPACES = NO
|
|
||||||
HIDE_UNDOC_MEMBERS = NO
|
|
||||||
HIDE_UNDOC_CLASSES = NO
|
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
|
||||||
HIDE_IN_BODY_DOCS = NO
|
|
||||||
INTERNAL_DOCS = NO
|
|
||||||
CASE_SENSE_NAMES = NO
|
|
||||||
HIDE_SCOPE_NAMES = NO
|
|
||||||
SHOW_INCLUDE_FILES = YES
|
|
||||||
FORCE_LOCAL_INCLUDES = NO
|
|
||||||
INLINE_INFO = YES
|
|
||||||
SORT_MEMBER_DOCS = YES
|
|
||||||
SORT_BRIEF_DOCS = NO
|
|
||||||
SORT_MEMBERS_CTORS_1ST = NO
|
|
||||||
SORT_GROUP_NAMES = NO
|
|
||||||
SORT_BY_SCOPE_NAME = NO
|
|
||||||
STRICT_PROTO_MATCHING = NO
|
|
||||||
GENERATE_TODOLIST = YES
|
|
||||||
GENERATE_TESTLIST = YES
|
|
||||||
GENERATE_BUGLIST = YES
|
|
||||||
GENERATE_DEPRECATEDLIST= YES
|
|
||||||
ENABLED_SECTIONS =
|
|
||||||
MAX_INITIALIZER_LINES = 30
|
|
||||||
SHOW_USED_FILES = YES
|
|
||||||
SHOW_DIRECTORIES = NO
|
|
||||||
SHOW_FILES = YES
|
|
||||||
SHOW_NAMESPACES = YES
|
|
||||||
FILE_VERSION_FILTER =
|
|
||||||
LAYOUT_FILE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to warning and progress messages
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
QUIET = NO
|
|
||||||
WARNINGS = YES
|
|
||||||
WARN_IF_UNDOCUMENTED = YES
|
|
||||||
WARN_IF_DOC_ERROR = YES
|
|
||||||
WARN_NO_PARAMDOC = NO
|
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
|
||||||
WARN_LOGFILE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the input files
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
INPUT = ../libopenjpeg \
|
|
||||||
../libopenjpeg/jpwl
|
|
||||||
INPUT_ENCODING = UTF-8
|
|
||||||
FILE_PATTERNS = *.h \
|
|
||||||
*.c
|
|
||||||
RECURSIVE = NO
|
|
||||||
EXCLUDE =
|
|
||||||
EXCLUDE_SYMLINKS = NO
|
|
||||||
EXCLUDE_PATTERNS =
|
|
||||||
EXCLUDE_SYMBOLS =
|
|
||||||
EXAMPLE_PATH =
|
|
||||||
EXAMPLE_PATTERNS = *
|
|
||||||
EXAMPLE_RECURSIVE = NO
|
|
||||||
IMAGE_PATH =
|
|
||||||
INPUT_FILTER =
|
|
||||||
FILTER_PATTERNS =
|
|
||||||
FILTER_SOURCE_FILES = NO
|
|
||||||
FILTER_SOURCE_PATTERNS =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to source browsing
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
SOURCE_BROWSER = NO
|
|
||||||
INLINE_SOURCES = NO
|
|
||||||
STRIP_CODE_COMMENTS = YES
|
|
||||||
REFERENCED_BY_RELATION = YES
|
|
||||||
REFERENCES_RELATION = YES
|
|
||||||
REFERENCES_LINK_SOURCE = YES
|
|
||||||
USE_HTAGS = NO
|
|
||||||
VERBATIM_HEADERS = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the alphabetical class index
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
ALPHABETICAL_INDEX = NO
|
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
|
||||||
IGNORE_PREFIX =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the HTML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_HTML = YES
|
|
||||||
HTML_OUTPUT = ./html
|
|
||||||
HTML_FILE_EXTENSION = .html
|
|
||||||
HTML_HEADER =
|
|
||||||
HTML_FOOTER =
|
|
||||||
HTML_STYLESHEET =
|
|
||||||
HTML_COLORSTYLE_HUE = 220
|
|
||||||
HTML_COLORSTYLE_SAT = 100
|
|
||||||
HTML_COLORSTYLE_GAMMA = 80
|
|
||||||
HTML_TIMESTAMP = YES
|
|
||||||
HTML_ALIGN_MEMBERS = YES
|
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
|
||||||
GENERATE_DOCSET = NO
|
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
|
||||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
|
||||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
|
||||||
DOCSET_PUBLISHER_NAME = Publisher
|
|
||||||
GENERATE_HTMLHELP = NO
|
|
||||||
CHM_FILE =
|
|
||||||
HHC_LOCATION =
|
|
||||||
GENERATE_CHI = NO
|
|
||||||
CHM_INDEX_ENCODING =
|
|
||||||
BINARY_TOC = NO
|
|
||||||
TOC_EXPAND = NO
|
|
||||||
GENERATE_QHP = NO
|
|
||||||
QCH_FILE =
|
|
||||||
QHP_NAMESPACE = org.doxygen.Project
|
|
||||||
QHP_VIRTUAL_FOLDER = doc
|
|
||||||
QHP_CUST_FILTER_NAME =
|
|
||||||
QHP_CUST_FILTER_ATTRS =
|
|
||||||
QHP_SECT_FILTER_ATTRS =
|
|
||||||
QHG_LOCATION =
|
|
||||||
GENERATE_ECLIPSEHELP = NO
|
|
||||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
|
||||||
DISABLE_INDEX = NO
|
|
||||||
ENUM_VALUES_PER_LINE = 4
|
|
||||||
GENERATE_TREEVIEW = NO
|
|
||||||
USE_INLINE_TREES = NO
|
|
||||||
TREEVIEW_WIDTH = 250
|
|
||||||
EXT_LINKS_IN_WINDOW = NO
|
|
||||||
FORMULA_FONTSIZE = 10
|
|
||||||
FORMULA_TRANSPARENT = YES
|
|
||||||
USE_MATHJAX = NO
|
|
||||||
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
|
||||||
SEARCHENGINE = NO
|
|
||||||
SERVER_BASED_SEARCH = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the LaTeX output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_LATEX = NO
|
|
||||||
LATEX_OUTPUT = latex
|
|
||||||
LATEX_CMD_NAME = latex
|
|
||||||
MAKEINDEX_CMD_NAME = makeindex
|
|
||||||
COMPACT_LATEX = NO
|
|
||||||
PAPER_TYPE = a4wide
|
|
||||||
EXTRA_PACKAGES =
|
|
||||||
LATEX_HEADER =
|
|
||||||
PDF_HYPERLINKS = NO
|
|
||||||
USE_PDFLATEX = NO
|
|
||||||
LATEX_BATCHMODE = NO
|
|
||||||
LATEX_HIDE_INDICES = NO
|
|
||||||
LATEX_SOURCE_CODE = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the RTF output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_RTF = NO
|
|
||||||
RTF_OUTPUT = rtf
|
|
||||||
COMPACT_RTF = NO
|
|
||||||
RTF_HYPERLINKS = NO
|
|
||||||
RTF_STYLESHEET_FILE =
|
|
||||||
RTF_EXTENSIONS_FILE =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the man page output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_MAN = NO
|
|
||||||
MAN_OUTPUT = man
|
|
||||||
MAN_EXTENSION = .3
|
|
||||||
MAN_LINKS = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the XML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_XML = NO
|
|
||||||
XML_OUTPUT = xml
|
|
||||||
XML_SCHEMA =
|
|
||||||
XML_DTD =
|
|
||||||
XML_PROGRAMLISTING = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options for the AutoGen Definitions output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_AUTOGEN_DEF = NO
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the Perl module output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
GENERATE_PERLMOD = NO
|
|
||||||
PERLMOD_LATEX = NO
|
|
||||||
PERLMOD_PRETTY = YES
|
|
||||||
PERLMOD_MAKEVAR_PREFIX =
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the preprocessor
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
ENABLE_PREPROCESSING = YES
|
|
||||||
MACRO_EXPANSION = NO
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
|
||||||
SEARCH_INCLUDES = YES
|
|
||||||
INCLUDE_PATH =
|
|
||||||
INCLUDE_FILE_PATTERNS =
|
|
||||||
PREDEFINED = USE_JPWL \
|
|
||||||
USE_JPSEC
|
|
||||||
EXPAND_AS_DEFINED =
|
|
||||||
SKIP_FUNCTION_MACROS = YES
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration::additions related to external references
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
TAGFILES =
|
|
||||||
GENERATE_TAGFILE =
|
|
||||||
ALLEXTERNALS = NO
|
|
||||||
EXTERNAL_GROUPS = YES
|
|
||||||
PERL_PATH = /usr/bin/perl
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the dot tool
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
CLASS_DIAGRAMS = YES
|
|
||||||
MSCGEN_PATH =
|
|
||||||
HIDE_UNDOC_RELATIONS = YES
|
|
||||||
HAVE_DOT = NO
|
|
||||||
DOT_NUM_THREADS = 0
|
|
||||||
DOT_FONTNAME = Helvetica
|
|
||||||
DOT_FONTSIZE = 10
|
|
||||||
DOT_FONTPATH =
|
|
||||||
CLASS_GRAPH = YES
|
|
||||||
COLLABORATION_GRAPH = YES
|
|
||||||
GROUP_GRAPHS = YES
|
|
||||||
UML_LOOK = NO
|
|
||||||
TEMPLATE_RELATIONS = NO
|
|
||||||
INCLUDE_GRAPH = YES
|
|
||||||
INCLUDED_BY_GRAPH = YES
|
|
||||||
CALL_GRAPH = NO
|
|
||||||
CALLER_GRAPH = NO
|
|
||||||
GRAPHICAL_HIERARCHY = YES
|
|
||||||
DIRECTORY_GRAPH = YES
|
|
||||||
DOT_IMAGE_FORMAT = png
|
|
||||||
DOT_PATH =
|
|
||||||
DOTFILE_DIRS =
|
|
||||||
MSCFILE_DIRS =
|
|
||||||
DOT_GRAPH_MAX_NODES = 50
|
|
||||||
MAX_DOT_GRAPH_DEPTH = 1000
|
|
||||||
DOT_TRANSPARENT = NO
|
|
||||||
DOT_MULTI_TARGETS = NO
|
|
||||||
GENERATE_LEGEND = YES
|
|
||||||
DOT_CLEANUP = YES
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.7.3
|
# Doxyfile 1.7.1
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = OpenJPEG
|
PROJECT_NAME = OpenJPEG
|
||||||
PROJECT_NUMBER = @OPENJPEG_VERSION@
|
PROJECT_NUMBER = @OPENJPEG_VERSION@
|
||||||
PROJECT_BRIEF =
|
|
||||||
PROJECT_LOGO =
|
|
||||||
OUTPUT_DIRECTORY = @OPENJPEG_BINARY_DIR@/doc
|
OUTPUT_DIRECTORY = @OPENJPEG_BINARY_DIR@/doc
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
@@ -74,7 +72,6 @@ SORT_BRIEF_DOCS = NO
|
|||||||
SORT_MEMBERS_CTORS_1ST = NO
|
SORT_MEMBERS_CTORS_1ST = NO
|
||||||
SORT_GROUP_NAMES = NO
|
SORT_GROUP_NAMES = NO
|
||||||
SORT_BY_SCOPE_NAME = NO
|
SORT_BY_SCOPE_NAME = NO
|
||||||
STRICT_PROTO_MATCHING = NO
|
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = YES
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
GENERATE_BUGLIST = YES
|
GENERATE_BUGLIST = YES
|
||||||
@@ -100,24 +97,25 @@ WARN_LOGFILE =
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the input files
|
# configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
INPUT = @OPENJPEG_SOURCE_DIR@/libopenjpeg \
|
INPUT = @OPENJPEG_SOURCE_DIR@/src/lib/openjp2 \
|
||||||
@OPENJPEG_SOURCE_DIR@/libopenjpeg/jpwl
|
@OPENJPEG_SOURCE_DIR@/src/lib/openjpip \
|
||||||
|
@OPENJPEG_BINARY_DIR@/doc
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS = *.h \
|
FILE_PATTERNS = *.h \
|
||||||
*.c
|
*.c \
|
||||||
RECURSIVE = NO
|
*.dox
|
||||||
|
RECURSIVE = YES
|
||||||
EXCLUDE =
|
EXCLUDE =
|
||||||
EXCLUDE_SYMLINKS = NO
|
EXCLUDE_SYMLINKS = NO
|
||||||
EXCLUDE_PATTERNS =
|
EXCLUDE_PATTERNS = */.svn/*
|
||||||
EXCLUDE_SYMBOLS =
|
EXCLUDE_SYMBOLS =
|
||||||
EXAMPLE_PATH =
|
EXAMPLE_PATH =
|
||||||
EXAMPLE_PATTERNS = *
|
EXAMPLE_PATTERNS = *
|
||||||
EXAMPLE_RECURSIVE = NO
|
EXAMPLE_RECURSIVE = NO
|
||||||
IMAGE_PATH =
|
IMAGE_PATH = @OPENJPEG_SOURCE_DIR@/doc
|
||||||
INPUT_FILTER =
|
INPUT_FILTER =
|
||||||
FILTER_PATTERNS =
|
FILTER_PATTERNS =
|
||||||
FILTER_SOURCE_FILES = NO
|
FILTER_SOURCE_FILES = NO
|
||||||
FILTER_SOURCE_PATTERNS =
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to source browsing
|
# configuration options related to source browsing
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -180,8 +178,6 @@ TREEVIEW_WIDTH = 250
|
|||||||
EXT_LINKS_IN_WINDOW = NO
|
EXT_LINKS_IN_WINDOW = NO
|
||||||
FORMULA_FONTSIZE = 10
|
FORMULA_FONTSIZE = 10
|
||||||
FORMULA_TRANSPARENT = YES
|
FORMULA_TRANSPARENT = YES
|
||||||
USE_MATHJAX = NO
|
|
||||||
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
|
||||||
SEARCHENGINE = NO
|
SEARCHENGINE = NO
|
||||||
SERVER_BASED_SEARCH = NO
|
SERVER_BASED_SEARCH = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -281,7 +277,6 @@ DIRECTORY_GRAPH = YES
|
|||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
DOT_PATH =
|
DOT_PATH =
|
||||||
DOTFILE_DIRS =
|
DOTFILE_DIRS =
|
||||||
MSCFILE_DIRS =
|
|
||||||
DOT_GRAPH_MAX_NODES = 50
|
DOT_GRAPH_MAX_NODES = 50
|
||||||
MAX_DOT_GRAPH_DEPTH = 1000
|
MAX_DOT_GRAPH_DEPTH = 1000
|
||||||
DOT_TRANSPARENT = NO
|
DOT_TRANSPARENT = NO
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
.PHONY: doc
|
|
||||||
|
|
||||||
PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc
|
|
||||||
|
|
||||||
if OPJ_BUILD_DOC
|
|
||||||
|
|
||||||
doc-clean:
|
|
||||||
rm -rf $(top_srcdir)/doc/html/ $(top_srcdir)/doc/$(PACKAGE_DOCNAME).tar*
|
|
||||||
|
|
||||||
doc: all
|
|
||||||
cd $(top_srcdir)/doc && \
|
|
||||||
$(opj_doxygen) Doxyfile.dox
|
|
||||||
rm -rf $(PACKAGE_DOCNAME).tar*
|
|
||||||
rm -rf $(top_srcdir)/doc/$(PACKAGE_DOCNAME).tar*
|
|
||||||
mkdir -p $(PACKAGE_DOCNAME)/doc
|
|
||||||
cp -R $(top_srcdir)/doc/html/ $(PACKAGE_DOCNAME)/doc
|
|
||||||
tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/
|
|
||||||
bzip2 -9 $(PACKAGE_DOCNAME).tar
|
|
||||||
rm -rf $(PACKAGE_DOCNAME)/
|
|
||||||
if ! test -f $(top_srcdir)/doc/$(PACKAGE_DOCNAME).tar.bz2 ; then \
|
|
||||||
mv $(PACKAGE_DOCNAME).tar.bz2 $(top_srcdir)/doc; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
clean-local: doc-clean
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
doc:
|
|
||||||
@echo "Documentation not built. Run ./configure --help"
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
docsdir = $(docdir)-$(MAJOR_NR).$(MINOR_NR)
|
|
||||||
docs_DATA = $(top_builddir)/LICENSE $(top_builddir)/CHANGES
|
|
||||||
|
|
||||||
dist_man1_MANS = \
|
|
||||||
man/man1/image_to_j2k.1 \
|
|
||||||
man/man1/j2k_dump.1 \
|
|
||||||
man/man1/j2k_to_image.1
|
|
||||||
|
|
||||||
dist_man3_MANS = \
|
|
||||||
man/man3/libopenjpeg.3
|
|
||||||
|
|
||||||
install-data-hook:
|
|
||||||
cd $(DESTDIR)$(man1dir) && \
|
|
||||||
rm -f jpwl_image_to_j2k.1 && \
|
|
||||||
$(LN_S) image_to_j2k.1 jpwl_image_to_j2k.1
|
|
||||||
cd $(DESTDIR)$(man1dir) && \
|
|
||||||
rm -f jpwl_j2k_to_image.1 && \
|
|
||||||
$(LN_S) j2k_to_image.1 jpwl_j2k_to_image.1
|
|
||||||
cd $(DESTDIR)$(man3dir) && \
|
|
||||||
rm -f jpwl_libopenjpeg.3 && \
|
|
||||||
$(LN_S) libopenjpeg.3 jpwl_libopenjpeg.3
|
|
||||||
@echo -e " (MAN)\t$(man1dir)/image_to_j2k.1" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (LN)\t$(man1dir)/jpwl_image_to_j2k.1" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (MAN)\t$(man1dir)/j2k_dump.1" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (MAN)\t$(man1dir)/j2k_to_image.1" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (LN)\t$(man1dir)//jpwl_j2k_to_image.1" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (MAN)\t$(man3dir)/libopenjpeg.3" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (LN)\t$(man3dir)/jpwl_libopenjpeg.3" >> $(top_builddir)/report.txt
|
|
||||||
|
|
||||||
uninstall-hook:
|
|
||||||
rm -f $(DESTDIR)$(man1dir)/jpwl_image_to_j2k.1
|
|
||||||
rm -f $(DESTDIR)$(man1dir)/jpwl_j2k_to_image.1
|
|
||||||
rm -f $(DESTDIR)$(man3dir)/jpwl_libopenjpeg.3
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
CMakeLists.txt \
|
|
||||||
Doxyfile.dox
|
|
||||||
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
62
doc/mainpage.dox.in
Normal file
62
doc/mainpage.dox.in
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \mainpage OpenJPEG v@OPENJPEG_VERSION@ Documentation
|
||||||
|
*
|
||||||
|
* \section intro Introduction
|
||||||
|
* This manual documents the low-level OpenJPEG C API.\n
|
||||||
|
* The OpenJPEG library is an open-source JPEG 2000 library developed in order to promote the use of JPEG 2000.\n
|
||||||
|
* This documents is focused on the main part of the library which try to implement Part 1 and Part 2 of the JPEG2000 norm.\n
|
||||||
|
*
|
||||||
|
* \section home Home page
|
||||||
|
*
|
||||||
|
* The Home Page of the OpenJPEG library can be found at:
|
||||||
|
*
|
||||||
|
* http://code.google.com/p/openjpeg/
|
||||||
|
*
|
||||||
|
* More information about the OpenJPEG library is available here:
|
||||||
|
*
|
||||||
|
* http://www.openjpeg.org/
|
||||||
|
*
|
||||||
|
* The OpenJPEG mailing list is located here:
|
||||||
|
*
|
||||||
|
* http://groups.google.com/group/openjpeg
|
||||||
|
*
|
||||||
|
* All the source code is online and can be retrieved using svn from here:
|
||||||
|
*
|
||||||
|
* http://openjpeg.googlecode.com/svn/
|
||||||
|
*
|
||||||
|
* \section license License
|
||||||
|
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
||||||
|
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
|
||||||
|
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
|
||||||
|
*
|
||||||
|
* \author OpenJPEG Team
|
||||||
|
*
|
||||||
|
*/
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
.SP
|
.SP
|
||||||
.fi
|
.fi
|
||||||
..
|
..
|
||||||
.TH image_to_j2k 1 "Version 1.4.0" "image_to_j2k" "converts to jpeg2000 files"
|
.TH opj_compress 1 "Version 1.4.0" "opj_compress" "converts to jpeg2000 files"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
image_to_j2k -
|
opj_compress -
|
||||||
This program reads in an image of a certain type and converts it to a
|
This program reads in an image of a certain type and converts it to a
|
||||||
jpeg2000 file. It is part of the OpenJPEG library.
|
jpeg2000 file. It is part of the OpenJPEG library.
|
||||||
.SP
|
.SP
|
||||||
@@ -43,11 +43,11 @@ Valid output image extensions are
|
|||||||
.B .j2k, .jp2
|
.B .j2k, .jp2
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -i \fRinfile.bmp \fB-o \fRoutfile.j2k
|
.B opj_compress -i \fRinfile.bmp \fB-o \fRoutfile.j2k
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -ImgDir \fRdirectory_name \fB-OutFor \fRjp2
|
.B opj_compress -ImgDir \fRdirectory_name \fB-OutFor \fRjp2
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -h \fRPrint a help message and exit.
|
.B opj_compress -h \fRPrint a help message and exit.
|
||||||
.P
|
.P
|
||||||
.R See JPWL OPTIONS for special options
|
.R See JPWL OPTIONS for special options
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
@@ -194,13 +194,13 @@ Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
|||||||
.P
|
.P
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
|
.B opj_compress -i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
|
.B opj_compress -i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
|
.B opj_compress -i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
|
||||||
.P
|
.P
|
||||||
.B image_to_j2k -i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
.B opj_compress -i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
||||||
.P
|
.P
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
@@ -218,5 +218,5 @@ Copyright (c) 2005, Herve Drolon, FreeImage Team
|
|||||||
Copyright (c) 2006-2007, Parvatha Elangovan
|
Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
.P
|
.P
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
j2k_to_image(1) j2k_dump(1)
|
opj_decompress(1) opj_dump(1)
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
.SP
|
.SP
|
||||||
.fi
|
.fi
|
||||||
..
|
..
|
||||||
.TH j2k_to_image 1 "Version 1.4.0" "j2k_to_image" "converts jpeg2000 files"
|
.TH opj_decompress 1 "Version 1.4.0" "opj_decompress" "converts jpeg2000 files"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
j2k_to_image -
|
opj_decompress -
|
||||||
This program reads in a jpeg2000 image and converts it to another
|
This program reads in a jpeg2000 image and converts it to another
|
||||||
image type. It is part of the OpenJPEG library.
|
image type. It is part of the OpenJPEG library.
|
||||||
.SP
|
.SP
|
||||||
@@ -43,11 +43,11 @@ Valid output image extensions are
|
|||||||
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
|
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
.B j2k_to_image -i \fRinfile.j2k \fB-o \fRoutfile.png
|
.B opj_decompress -i \fRinfile.j2k \fB-o \fRoutfile.png
|
||||||
.P
|
.P
|
||||||
.B j2k_to_image -ImgDir \fRimages/ \fB-OutFor \fRbmp
|
.B opj_decompress -ImgDir \fRimages/ \fB-OutFor \fRbmp
|
||||||
.P
|
.P
|
||||||
.B j2k_to_image -h \fRPrint help message and exit
|
.B opj_decompress -h \fRPrint help message and exit
|
||||||
.P
|
.P
|
||||||
.R See JPWL OPTIONS for special options
|
.R See JPWL OPTIONS for special options
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
@@ -106,4 +106,4 @@ Copyright (c) 2005, Herve Drolon, FreeImage Team
|
|||||||
Copyright (c) 2006-2007, Parvatha Elangovan
|
Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
.P
|
.P
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
image_to_j2k(1) j2k_dump(1)
|
opj_compress(1) opj_dump(1)
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
.SP
|
.SP
|
||||||
.fi
|
.fi
|
||||||
..
|
..
|
||||||
.TH j2k_dump 1 "Version 1.4.0" "j2k_dump" "dumps jpeg2000 files"
|
.TH opj_dump 1 "Version 1.4.0" "opj_dump" "dumps jpeg2000 files"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
j2k_dump -
|
opj_dump -
|
||||||
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
|
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
|
||||||
.SP
|
.SP
|
||||||
Valid input image extensions are
|
Valid input image extensions are
|
||||||
@@ -40,11 +40,11 @@ Valid input image extensions are
|
|||||||
.SP
|
.SP
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
.B j2k_dump -i \fRinfile.j2k
|
.B opj_dump -i \fRinfile.j2k
|
||||||
.P
|
.P
|
||||||
.B j2k_dump -ImgDir \fRimages/ \fRDump all files in images/
|
.B opj_dump -ImgDir \fRimages/ \fRDump all files in images/
|
||||||
.P
|
.P
|
||||||
.B j2k_dump -h \fRPrint help message and exit
|
.B opj_dump -h \fRPrint help message and exit
|
||||||
.P
|
.P
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
@@ -56,7 +56,7 @@ Valid input image extensions are
|
|||||||
.P
|
.P
|
||||||
'\".SH BUGS
|
'\".SH BUGS
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Copyright (c) 20010, Mathieu Malaterre
|
Copyright (c) 2010, Mathieu Malaterre
|
||||||
.P
|
.P
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
image_to_j2k(1) j2k_to_image(1)
|
opj_compress(1) opj_decompress(1)
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
.SP
|
.SP
|
||||||
.fi
|
.fi
|
||||||
..
|
..
|
||||||
.TH libopenjpeg 3 "Oct 2010" "Version 1.4.0" "Oct 2010"
|
.TH libopenjp2 3 "Oct 2010" "Version 1.4.0" "Oct 2010"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libopenjpeg -
|
libopenjp2 -
|
||||||
a library for reading and writing JPEG2000 image files.
|
a library for reading and writing JPEG2000 image files.
|
||||||
.SP
|
.SP
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: mainpage.h 47 2011-02-17 16:57:49Z kaori $
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \mainpage OpenJPIP v2.1 Documentation
|
/*! \page openjpippage OpenJPIP v@OPENJPEG_VERSION@ Documentation
|
||||||
*
|
*
|
||||||
* \section intro Introduction
|
* \section intro Introduction
|
||||||
* This manual documents the low-level OpenJPIP C API.\n
|
* This manual documents the low-level OpenJPIP C API.\n
|
||||||
@@ -38,10 +38,9 @@
|
|||||||
* This whole documents covers the following six programs.\n
|
* This whole documents covers the following six programs.\n
|
||||||
* - opj_server.c JPIP server supporting HTTP connection and JPT/JPP-stream
|
* - opj_server.c JPIP server supporting HTTP connection and JPT/JPP-stream
|
||||||
* - opj_dec_server.c Server to decode JPT/JPP-stream and communicate locally with JPIP client, which is coded in java
|
* - opj_dec_server.c Server to decode JPT/JPP-stream and communicate locally with JPIP client, which is coded in java
|
||||||
* - addXMLinJP2.c To Embed metadata into JP2 file
|
* - opj_jpip_addxml.c To Embed metadata into JP2 file
|
||||||
* - jpip_to_jp2.c To Convert JPT/JPP-stream to JP2
|
* - opj_jpip_transcode.c To Convert JPT/JPP-stream to JP2 or J2K
|
||||||
* - jpip_to_j2k.c To Convert JPT/JPP-stream to J2K
|
* - opj_jpip_test.c To test index code format of a JP2 file
|
||||||
* - test_index.c To test index code format of a JP2 file
|
|
||||||
*
|
*
|
||||||
* \section license License
|
* \section license License
|
||||||
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: openjpeg
|
|
||||||
Description: JPEG2000 Wireless (Part 11 - JPWL) library
|
|
||||||
URL: http://www.openjpeg.org/
|
|
||||||
Version: @VERSION@
|
|
||||||
@pkgconfig_requires_private@: @requirements@
|
|
||||||
Libs: -L${libdir} -lopenjpeg_JPWL
|
|
||||||
Libs.private: -lm
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
|
||||||
# Defines the source code for the library
|
|
||||||
SET(OPENJPEG_SRCS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/bio.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cio.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/event.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/image.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/j2k_lib.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/jpt.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mct.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/pi.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/raw.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/t1.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build the library
|
|
||||||
IF(WIN32)
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
|
||||||
ELSE(BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} m)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
|
||||||
|
|
||||||
# Build the JPWL library ?
|
|
||||||
IF(BUILD_JPWL)
|
|
||||||
ADD_SUBDIRECTORY(jpwl)
|
|
||||||
ENDIF(BUILD_JPWL)
|
|
||||||
|
|
||||||
# Install library
|
|
||||||
INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}
|
|
||||||
EXPORT OpenJPEGTargets
|
|
||||||
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
||||||
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
|
||||||
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install includes files
|
|
||||||
INSTALL(FILES openjpeg.h
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers
|
|
||||||
)
|
|
||||||
|
|
||||||
# install man page of the library
|
|
||||||
INSTALL(
|
|
||||||
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjpeg.3
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
SUBDIRS = .
|
|
||||||
|
|
||||||
if WANT_JPWL
|
|
||||||
SUBDIRS += jpwl
|
|
||||||
endif
|
|
||||||
|
|
||||||
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
|
||||||
includes_HEADERS = openjpeg.h
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libopenjpeg.la
|
|
||||||
|
|
||||||
libopenjpeg_la_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg
|
|
||||||
libopenjpeg_la_CFLAGS =
|
|
||||||
libopenjpeg_la_LIBADD = -lm
|
|
||||||
libopenjpeg_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
|
||||||
|
|
||||||
libopenjpeg_la_SOURCES = \
|
|
||||||
bio.c \
|
|
||||||
cio.c \
|
|
||||||
dwt.c \
|
|
||||||
event.c \
|
|
||||||
image.c \
|
|
||||||
j2k.c \
|
|
||||||
j2k_lib.c \
|
|
||||||
jp2.c \
|
|
||||||
jpt.c \
|
|
||||||
mct.c \
|
|
||||||
mqc.c \
|
|
||||||
openjpeg.c \
|
|
||||||
pi.c \
|
|
||||||
raw.c \
|
|
||||||
t1.c \
|
|
||||||
t1_generate_luts.c \
|
|
||||||
t2.c \
|
|
||||||
tcd.c \
|
|
||||||
tgt.c \
|
|
||||||
cidx_manager.c \
|
|
||||||
phix_manager.c \
|
|
||||||
ppix_manager.c \
|
|
||||||
thix_manager.c \
|
|
||||||
tpix_manager.c \
|
|
||||||
bio.h \
|
|
||||||
cio.h \
|
|
||||||
dwt.h \
|
|
||||||
event.h \
|
|
||||||
fix.h \
|
|
||||||
image.h \
|
|
||||||
indexbox_manager.h \
|
|
||||||
int.h \
|
|
||||||
j2k.h \
|
|
||||||
j2k_lib.h \
|
|
||||||
jp2.h \
|
|
||||||
jpt.h \
|
|
||||||
mct.h \
|
|
||||||
mqc.h \
|
|
||||||
opj_includes.h \
|
|
||||||
opj_malloc.h \
|
|
||||||
pi.h \
|
|
||||||
raw.h \
|
|
||||||
t1.h \
|
|
||||||
t1_luts.h \
|
|
||||||
t2.h \
|
|
||||||
tcd.h \
|
|
||||||
tgt.h \
|
|
||||||
cidx_manager.h
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
CMakeLists.txt
|
|
||||||
|
|
||||||
install-data-hook:
|
|
||||||
cd $(DESTDIR)$(includedir) && \
|
|
||||||
rm -f openjpeg.h && \
|
|
||||||
$(LN_S) openjpeg-$(MAJOR_NR).$(MINOR_NR)/openjpeg.h \
|
|
||||||
openjpeg.h
|
|
||||||
@rm -rf $(top_builddir)/report.txt
|
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpeg.la" >> $(top_builddir)/report.txt
|
|
||||||
if BUILD_SHARED
|
|
||||||
@( $(call solist) ) >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
if BUILD_STATIC
|
|
||||||
@echo -e " (A)\t$(base)/$(a)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
@echo -e " (H)\t$(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)/openjpeg.h" >> $(top_builddir)/report.txt
|
|
||||||
@echo -e " (LN)\t$(includedir)/openjpeg.h" >> $(top_builddir)/report.txt
|
|
||||||
|
|
||||||
uninstall-hook:
|
|
||||||
rm -f $(DESTDIR)$(includedir)/openjpeg.h
|
|
||||||
|
|
||||||
solist = $(foreach f, $(dll) $(so), echo -e ' $(SO_PREFIX)\t$(base)/$(f)' ;)
|
|
||||||
get_tok = $(shell grep -E "^$(1)=" $(lib_LTLIBRARIES) | cut -d "'" -f 2)
|
|
||||||
base = $(call get_tok,libdir)
|
|
||||||
so = $(call get_tok,library_names)
|
|
||||||
a = $(call get_tok,old_library)
|
|
||||||
|
|
||||||
if HAVE_WIN32
|
|
||||||
SO_PREFIX = (DLL)
|
|
||||||
dll = $(call get_tok,dlname)
|
|
||||||
else
|
|
||||||
if HAVE_DARWIN
|
|
||||||
SO_PREFIX = (DY)
|
|
||||||
dll =
|
|
||||||
else
|
|
||||||
SO_PREFIX = (SO)
|
|
||||||
dll =
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: cidx_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
|
||||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
|
||||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
|
||||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "opj_includes.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write CPTR Codestream finder box
|
|
||||||
*
|
|
||||||
* @param[in] coff offset of j2k codestream
|
|
||||||
* @param[in] clen length of j2k codestream
|
|
||||||
* @param[in] cio file output handle
|
|
||||||
*/
|
|
||||||
void write_cptr(int coff, int clen, opj_cio_t *cio);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write main header index table (box)
|
|
||||||
*
|
|
||||||
* @param[in] coff offset of j2k codestream
|
|
||||||
* @param[in] cstr_info codestream information
|
|
||||||
* @param[in] cio file output handle
|
|
||||||
* @return length of mainmhix box
|
|
||||||
*/
|
|
||||||
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if EPH option is used
|
|
||||||
*
|
|
||||||
* @param[in] coff offset of j2k codestream
|
|
||||||
* @param[in] markers marker information
|
|
||||||
* @param[in] marknum number of markers
|
|
||||||
* @param[in] cio file output handle
|
|
||||||
* @return true if EPH is used
|
|
||||||
*/
|
|
||||||
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio);
|
|
||||||
|
|
||||||
|
|
||||||
int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen)
|
|
||||||
{
|
|
||||||
int len, i, lenp;
|
|
||||||
opj_jp2_box_t *box;
|
|
||||||
int num_box = 0;
|
|
||||||
opj_bool EPHused;
|
|
||||||
(void)image; /* unused ? */
|
|
||||||
|
|
||||||
lenp = -1;
|
|
||||||
box = (opj_jp2_box_t *)opj_calloc( 32, sizeof(opj_jp2_box_t));
|
|
||||||
|
|
||||||
for (i=0;i<2;i++){
|
|
||||||
|
|
||||||
if(i)
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_CIDX, 4); /* CIDX */
|
|
||||||
write_cptr( offset, cstr_info.codestream_size, cio);
|
|
||||||
|
|
||||||
write_manf( i, num_box, box, cio);
|
|
||||||
|
|
||||||
num_box = 0;
|
|
||||||
box[num_box].length = write_mainmhix( offset, cstr_info, cio);
|
|
||||||
box[num_box].type = JPIP_MHIX;
|
|
||||||
num_box++;
|
|
||||||
|
|
||||||
box[num_box].length = write_tpix( offset, cstr_info, j2klen, cio);
|
|
||||||
box[num_box].type = JPIP_TPIX;
|
|
||||||
num_box++;
|
|
||||||
|
|
||||||
box[num_box].length = write_thix( offset, cstr_info, cio);
|
|
||||||
box[num_box].type = JPIP_THIX;
|
|
||||||
num_box++;
|
|
||||||
|
|
||||||
EPHused = check_EPHuse( offset, cstr_info.marker, cstr_info.marknum, cio);
|
|
||||||
|
|
||||||
box[num_box].length = write_ppix( offset, cstr_info, EPHused, j2klen, cio);
|
|
||||||
box[num_box].type = JPIP_PPIX;
|
|
||||||
num_box++;
|
|
||||||
|
|
||||||
box[num_box].length = write_phix( offset, cstr_info, EPHused, j2klen, cio);
|
|
||||||
box[num_box].type = JPIP_PHIX;
|
|
||||||
num_box++;
|
|
||||||
|
|
||||||
len = cio_tell( cio)-lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
}
|
|
||||||
|
|
||||||
opj_free( box);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_cptr(int coff, int clen, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
int len, lenp;
|
|
||||||
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_CPTR, 4); /* T */
|
|
||||||
cio_write( cio, 0, 2); /* DR A PRECISER !! */
|
|
||||||
cio_write( cio, 0, 2); /* CONT */
|
|
||||||
cio_write( cio, coff, 8); /* COFF A PRECISER !! */
|
|
||||||
cio_write( cio, clen, 8); /* CLEN */
|
|
||||||
len = cio_tell( cio) - lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
int len, lenp, i;
|
|
||||||
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_MANF,4); /* T */
|
|
||||||
|
|
||||||
if (second){ /* Write only during the second pass */
|
|
||||||
for( i=0; i<v; i++){
|
|
||||||
cio_write( cio, box[i].length, 4); /* Box length */
|
|
||||||
cio_write( cio, box[i].type, 4); /* Box type */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cio_tell( cio) - lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int len, lenp;
|
|
||||||
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_MHIX, 4); /* MHIX */
|
|
||||||
|
|
||||||
cio_write( cio, cstr_info.main_head_end-cstr_info.main_head_start+1, 8); /* TLEN */
|
|
||||||
|
|
||||||
for(i = 1; i < cstr_info.marknum; i++){ /* Marker restricted to 1 apparition, skip SOC marker */
|
|
||||||
cio_write( cio, cstr_info.marker[i].type, 2);
|
|
||||||
cio_write( cio, 0, 2);
|
|
||||||
cio_write( cio, cstr_info.marker[i].pos-coff, 8);
|
|
||||||
cio_write( cio, cstr_info.marker[i].len, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cio_tell( cio) - lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
opj_bool check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
opj_bool EPHused = OPJ_FALSE;
|
|
||||||
int i=0;
|
|
||||||
int org_pos;
|
|
||||||
unsigned int Scod;
|
|
||||||
|
|
||||||
for(i = 0; i < marknum; i++){
|
|
||||||
if( markers[i].type == J2K_MS_COD){
|
|
||||||
org_pos = cio_tell( cio);
|
|
||||||
cio_seek( cio, coff+markers[i].pos+2);
|
|
||||||
|
|
||||||
Scod = cio_read( cio, 1);
|
|
||||||
if( ((Scod >> 2) & 1))
|
|
||||||
EPHused = OPJ_TRUE;
|
|
||||||
cio_seek( cio, org_pos);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EPHused;
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DUSE_JPWL)
|
|
||||||
|
|
||||||
SET(JPWL_SRCS crc.c jpwl.c jpwl_lib.c rs.c)
|
|
||||||
IF(APPLE)
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(
|
|
||||||
rs.c
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_FLAGS -fno-common)
|
|
||||||
ENDIF(APPLE)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build the library
|
|
||||||
IF(WIN32)
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
|
||||||
ELSE(BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME}_JPWL ${JPWL_SRCS} ${OPENJPEG_SRCS})
|
|
||||||
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JPWL
|
|
||||||
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
|
||||||
|
|
||||||
# Install library
|
|
||||||
INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}_JPWL
|
|
||||||
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
|
||||||
)
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libopenjpeg_JPWL.la
|
|
||||||
|
|
||||||
OPJ_SRC = \
|
|
||||||
../bio.c \
|
|
||||||
../cio.c \
|
|
||||||
../dwt.c \
|
|
||||||
../event.c \
|
|
||||||
../image.c \
|
|
||||||
../j2k.c \
|
|
||||||
../j2k_lib.c \
|
|
||||||
../jp2.c \
|
|
||||||
../jpt.c \
|
|
||||||
../mct.c \
|
|
||||||
../mqc.c \
|
|
||||||
../openjpeg.c \
|
|
||||||
../pi.c \
|
|
||||||
../raw.c \
|
|
||||||
../t1.c \
|
|
||||||
../t1_generate_luts.c \
|
|
||||||
../t2.c \
|
|
||||||
../tcd.c \
|
|
||||||
../tgt.c \
|
|
||||||
../cidx_manager.c \
|
|
||||||
../phix_manager.c \
|
|
||||||
../ppix_manager.c \
|
|
||||||
../thix_manager.c \
|
|
||||||
../tpix_manager.c
|
|
||||||
|
|
||||||
libopenjpeg_JPWL_la_CPPFLAGS = \
|
|
||||||
-I. \
|
|
||||||
-I$(top_srcdir)/libopenjpeg \
|
|
||||||
-I$(top_builddir)/libopenjpeg \
|
|
||||||
-I$(top_srcdir)/libopenjpeg/jpwl \
|
|
||||||
-I$(top_builddir)/libopenjpeg/jpwl \
|
|
||||||
-DUSE_JPWL
|
|
||||||
libopenjpeg_JPWL_la_CFLAGS =
|
|
||||||
libopenjpeg_JPWL_la_LIBADD = -lm
|
|
||||||
libopenjpeg_JPWL_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
|
||||||
libopenjpeg_JPWL_la_SOURCES = \
|
|
||||||
$(OPJ_SRC) \
|
|
||||||
crc.c \
|
|
||||||
jpwl.c \
|
|
||||||
jpwl_lib.c \
|
|
||||||
rs.c \
|
|
||||||
crc.h \
|
|
||||||
jpwl.h \
|
|
||||||
rs.h
|
|
||||||
|
|
||||||
install-data-hook:
|
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpeg_JPWL.la" >> $(top_builddir)/report.txt
|
|
||||||
if BUILD_SHARED
|
|
||||||
@( $(call solist) ) >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
if BUILD_STATIC
|
|
||||||
@echo -e " (A)\t$(base)/$(a)" >> $(top_builddir)/report.txt
|
|
||||||
endif
|
|
||||||
|
|
||||||
solist = $(foreach f, $(dll) $(so), echo -e ' $(SO_PREFIX)\t$(base)/$(f)' ;)
|
|
||||||
get_tok = $(shell grep -E "^$(1)=" $(lib_LTLIBRARIES) | cut -d "'" -f 2)
|
|
||||||
base = $(call get_tok,libdir)
|
|
||||||
so = $(call get_tok,library_names)
|
|
||||||
a = $(call get_tok,old_library)
|
|
||||||
|
|
||||||
if HAVE_WIN32
|
|
||||||
SO_PREFIX = (DLL)
|
|
||||||
dll = $(call get_tok,dlname)
|
|
||||||
else
|
|
||||||
if HAVE_DARWIN
|
|
||||||
SO_PREFIX = (DY)
|
|
||||||
dll =
|
|
||||||
else
|
|
||||||
SO_PREFIX = (SO)
|
|
||||||
dll =
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,153 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id: tpix_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
|
||||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
|
||||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
|
||||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \file
|
|
||||||
* \brief Modification of jpip.c from 2KAN indexer
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include "opj_includes.h"
|
|
||||||
|
|
||||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write faix box of tpix
|
|
||||||
*
|
|
||||||
* @param[in] coff offset of j2k codestream
|
|
||||||
* @param[in] compno component number
|
|
||||||
* @param[in] cstr_info codestream information
|
|
||||||
* @param[in] j2klen length of j2k codestream
|
|
||||||
* @param[in] cio file output handle
|
|
||||||
* @return length of faix box
|
|
||||||
*/
|
|
||||||
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio);
|
|
||||||
|
|
||||||
|
|
||||||
int write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
int len, lenp;
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_TPIX, 4); /* TPIX */
|
|
||||||
|
|
||||||
write_tpixfaix( coff, 0, cstr_info, j2klen, cio);
|
|
||||||
|
|
||||||
len = cio_tell( cio)-lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get number of maximum tile parts per tile
|
|
||||||
*
|
|
||||||
* @param[in] cstr_info codestream information
|
|
||||||
* @return number of maximum tile parts per tile
|
|
||||||
*/
|
|
||||||
int get_num_max_tile_parts( opj_codestream_info_t cstr_info);
|
|
||||||
|
|
||||||
int write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
|
|
||||||
{
|
|
||||||
int len, lenp;
|
|
||||||
int i, j;
|
|
||||||
int Aux;
|
|
||||||
int num_max_tile_parts;
|
|
||||||
int size_of_coding; /* 4 or 8 */
|
|
||||||
opj_tp_info_t tp;
|
|
||||||
int version;
|
|
||||||
|
|
||||||
num_max_tile_parts = get_num_max_tile_parts( cstr_info);
|
|
||||||
|
|
||||||
if( j2klen > pow( 2, 32)){
|
|
||||||
size_of_coding = 8;
|
|
||||||
version = num_max_tile_parts == 1 ? 1:3;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
size_of_coding = 4;
|
|
||||||
version = num_max_tile_parts == 1 ? 0:2;
|
|
||||||
}
|
|
||||||
|
|
||||||
lenp = cio_tell( cio);
|
|
||||||
cio_skip( cio, 4); /* L [at the end] */
|
|
||||||
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
|
|
||||||
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
|
|
||||||
|
|
||||||
cio_write( cio, num_max_tile_parts, size_of_coding); /* NMAX */
|
|
||||||
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
|
|
||||||
for (i = 0; i < cstr_info.tw*cstr_info.th; i++){
|
|
||||||
for (j = 0; j < cstr_info.tile[i].num_tps; j++){
|
|
||||||
tp = cstr_info.tile[i].tp[j];
|
|
||||||
cio_write( cio, tp.tp_start_pos-coff, size_of_coding); /* start position */
|
|
||||||
cio_write( cio, tp.tp_end_pos-tp.tp_start_pos+1, size_of_coding); /* length */
|
|
||||||
if (version & 0x02){
|
|
||||||
if( cstr_info.tile[i].num_tps == 1 && cstr_info.numdecompos[compno] > 1)
|
|
||||||
Aux = cstr_info.numdecompos[compno] + 1;
|
|
||||||
else
|
|
||||||
Aux = j + 1;
|
|
||||||
|
|
||||||
cio_write( cio, Aux,4);
|
|
||||||
/*cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4);*/ /* Aux_i,j : Auxiliary value */
|
|
||||||
/* fprintf(stderr,"AUX value %d\n",Aux);*/
|
|
||||||
}
|
|
||||||
/*cio_write(0,4);*/
|
|
||||||
}
|
|
||||||
/* PADDING */
|
|
||||||
while (j < num_max_tile_parts){
|
|
||||||
cio_write( cio, 0, size_of_coding); /* start position */
|
|
||||||
cio_write( cio, 0, size_of_coding); /* length */
|
|
||||||
if (version & 0x02)
|
|
||||||
cio_write( cio, 0,4); /* Aux_i,j : Auxiliary value */
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cio_tell( cio)-lenp;
|
|
||||||
cio_seek( cio, lenp);
|
|
||||||
cio_write( cio, len, 4); /* L */
|
|
||||||
cio_seek( cio, lenp+len);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_num_max_tile_parts( opj_codestream_info_t cstr_info)
|
|
||||||
{
|
|
||||||
int num_max_tp = 0, i;
|
|
||||||
|
|
||||||
for( i=0; i<cstr_info.tw*cstr_info.th; i++)
|
|
||||||
num_max_tp = MAX( cstr_info.tile[i].num_tps, num_max_tp);
|
|
||||||
|
|
||||||
return num_max_tp;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
|
||||||
bindir=@OPENJPEG_INSTALL_BIN_DIR@
|
|
||||||
datadir=@OPENJPEG_INSTALL_DATA_DIR@
|
|
||||||
libdir=@OPENJPEG_INSTALL_LIB_DIR@
|
|
||||||
includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@
|
|
||||||
|
|
||||||
Name: openjpeg
|
|
||||||
Description: JPEG2000 files library
|
|
||||||
URL: http://www.openjpeg.org/
|
|
||||||
Version: @OPENJPEG_VERSION@
|
|
||||||
Libs: -L${libdir} -lopenjpeg
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: openjpeg
|
|
||||||
Description: JPEG2000 library
|
|
||||||
URL: http://www.openjpeg.org/
|
|
||||||
Version: @VERSION@
|
|
||||||
@pkgconfig_requires_private@: @requirements@
|
|
||||||
Libs: -L${libdir} -lopenjpeg
|
|
||||||
Libs.private: -lm
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
dnl Copyright (C) 2011 Vincent Torri <vtorri at univ-evry dot fr>
|
|
||||||
dnl That code is public domain and can be freely used or copied.
|
|
||||||
|
|
||||||
dnl Macro that check if a library is in a specified directory.
|
|
||||||
|
|
||||||
dnl Usage: OPJ_CHECK_LIB_WITH_PREFIX(prefix, header, lib, func [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
|
||||||
dnl Call AC_SUBST(THELIB_CFLAGS)
|
|
||||||
dnl Call AC_SUBST(THELIB_LIBS)
|
|
||||||
dnl where THELIB is the uppercase value of 'lib'
|
|
||||||
|
|
||||||
AC_DEFUN([OPJ_CHECK_LIB_WITH_PREFIX],
|
|
||||||
[
|
|
||||||
|
|
||||||
m4_pushdef([UP], m4_toupper([$3]))
|
|
||||||
m4_pushdef([DOWN], m4_tolower([$3]))
|
|
||||||
|
|
||||||
__opj_prefix=$1
|
|
||||||
__opj_header=$2
|
|
||||||
__opj_lib=$3
|
|
||||||
__opj_func=$4
|
|
||||||
__opj_have_dep="no"
|
|
||||||
|
|
||||||
save_CPPFLAGS=${CPPFLAGS}
|
|
||||||
save_LDFLAGS=${LDFLAGS}
|
|
||||||
save_LIBS=${LIBS}
|
|
||||||
|
|
||||||
if test "x${__opj_prefix}" = "x" ; then
|
|
||||||
CPPFLAGS="${CPPFLAGS} $UP[_CFLAGS]"
|
|
||||||
LDFLAGS="${LDFLAGS} $UP[_LIBS]"
|
|
||||||
else
|
|
||||||
CPPFLAGS="${CPPFLAGS} -I${__opj_prefix}/include"
|
|
||||||
LDFLAGS="${LDFLAGS} -L${__opj_prefix}/lib"
|
|
||||||
LIBS="${LIBS} -l${__opj_lib}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#include <${__opj_header}>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
${__opj_func}();
|
|
||||||
]])],
|
|
||||||
[__opj_have_dep="yes"],
|
|
||||||
[__opj_have_dep="no"])
|
|
||||||
|
|
||||||
CPPFLAGS=${save_CPPFLAGS}
|
|
||||||
LDFLAGS=${save_LDFLAGS}
|
|
||||||
LIBS=${save_LIBS}
|
|
||||||
|
|
||||||
if test "x${__opj_prefix}" = "x" ; then
|
|
||||||
AC_MSG_CHECKING([whether ]UP[ library is available in standard or predefined directories])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([whether ]UP[ library is available in ${__opj_prefix}])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([${__opj_have_dep}])
|
|
||||||
|
|
||||||
if test "x${__opj_have_dep}" = "xyes" && ! test "x${__opj_prefix}" = "x"; then
|
|
||||||
if test "x${UP[]_CFLAGS}" = "x" ; then
|
|
||||||
UP[]_CFLAGS="-I${__opj_prefix}/include"
|
|
||||||
fi
|
|
||||||
if test "x${UP[]_LIBS}" = "x" ; then
|
|
||||||
UP[]_LIBS="-L${__opj_prefix}/lib -l${__opj_lib}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AS_IF([test "x${__opj_have_dep}" = "xyes"], [$5], [$6])
|
|
||||||
|
|
||||||
m4_popdef([UP])
|
|
||||||
m4_popdef([DOWN])
|
|
||||||
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Macro that check if a library is in a set of directories.
|
|
||||||
|
|
||||||
dnl Usage: OPJ_CHECK_LIB(header, lib, func [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
|
||||||
|
|
||||||
AC_DEFUN([OPJ_CHECK_LIB],
|
|
||||||
[
|
|
||||||
|
|
||||||
m4_pushdef([UP], m4_toupper([$2]))
|
|
||||||
|
|
||||||
__opj_have_dep="no"
|
|
||||||
|
|
||||||
OPJ_CHECK_LIB_WITH_PREFIX([],
|
|
||||||
[$1],
|
|
||||||
[$2],
|
|
||||||
[$3],
|
|
||||||
[__opj_have_dep="yes"],
|
|
||||||
[__opj_have_dep="no"])
|
|
||||||
|
|
||||||
if ! test "x${__opj_have_dep}" = "xyes" ; then
|
|
||||||
OPJ_CHECK_LIB_WITH_PREFIX([/usr],
|
|
||||||
[$1],
|
|
||||||
[$2],
|
|
||||||
[$3],
|
|
||||||
[__opj_have_dep="yes"],
|
|
||||||
[__opj_have_dep="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test "x${__opj_have_dep}" = "xyes" ; then
|
|
||||||
OPJ_CHECK_LIB_WITH_PREFIX([/usr/local],
|
|
||||||
[$1],
|
|
||||||
[$2],
|
|
||||||
[$3],
|
|
||||||
[__opj_have_dep="yes"],
|
|
||||||
[__opj_have_dep="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test "x${__opj_have_dep}" = "xyes" ; then
|
|
||||||
OPJ_CHECK_LIB_WITH_PREFIX([/opt/local],
|
|
||||||
[$1],
|
|
||||||
[$2],
|
|
||||||
[$3],
|
|
||||||
[__opj_have_dep="yes"],
|
|
||||||
[__opj_have_dep="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_VAR(UP[_CFLAGS], [preprocessor flags for lib$2])
|
|
||||||
AC_SUBST(UP[_CFLAGS])
|
|
||||||
AC_ARG_VAR(UP[_LIBS], [linker flags for lib$2])
|
|
||||||
AC_SUBST(UP[_LIBS])
|
|
||||||
|
|
||||||
AS_IF([test "x${__opj_have_dep}" = "xyes"], [$4], [$5])
|
|
||||||
|
|
||||||
m4_popdef([UP])
|
|
||||||
|
|
||||||
])
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
|
|
||||||
dnl and Albin Tonnerre <albin dot tonnerre at gmail dot com>
|
|
||||||
dnl That code is public domain and can be freely used or copied.
|
|
||||||
|
|
||||||
dnl Macro that checks if a compiler flag is supported by the compiler.
|
|
||||||
|
|
||||||
dnl Usage: OPJ_COMPILER_FLAG(flag)
|
|
||||||
dnl flag is added to CFLAGS if supported.
|
|
||||||
|
|
||||||
AC_DEFUN([OPJ_COMPILER_FLAG],
|
|
||||||
[
|
|
||||||
|
|
||||||
CFLAGS_save="${CFLAGS}"
|
|
||||||
CFLAGS="${CFLAGS} $1"
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
|
||||||
AC_MSG_CHECKING([whether the compiler supports $1])
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([[]])],
|
|
||||||
[have_flag="yes"],
|
|
||||||
[have_flag="no"])
|
|
||||||
AC_MSG_RESULT([${have_flag}])
|
|
||||||
|
|
||||||
if test "x${have_flag}" = "xno" ; then
|
|
||||||
CFLAGS="${CFLAGS_save}"
|
|
||||||
fi
|
|
||||||
AC_LANG_POP([C])
|
|
||||||
|
|
||||||
])
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
|
|
||||||
dnl That code is public domain and can be freely used or copied.
|
|
||||||
|
|
||||||
dnl Macro that check if doxygen is available or not.
|
|
||||||
|
|
||||||
dnl OPJ_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
|
||||||
dnl Test for the doxygen program
|
|
||||||
dnl Defines opj_doxygen
|
|
||||||
dnl Defines the automake conditionnal OPJ_BUILD_DOC
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([OPJ_CHECK_DOXYGEN],
|
|
||||||
[
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Disable the build of the documentation
|
|
||||||
dnl
|
|
||||||
AC_ARG_ENABLE([doc],
|
|
||||||
[AC_HELP_STRING(
|
|
||||||
[--disable-doc],
|
|
||||||
[Disable documentation build @<:@default=enabled@:>@])],
|
|
||||||
[
|
|
||||||
if test "x${enableval}" = "xyes" ; then
|
|
||||||
opj_enable_doc="yes"
|
|
||||||
else
|
|
||||||
opj_enable_doc="no"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[opj_enable_doc="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build documentation])
|
|
||||||
AC_MSG_RESULT([${opj_enable_doc}])
|
|
||||||
|
|
||||||
if test "x${opj_enable_doc}" = "xyes" ; then
|
|
||||||
|
|
||||||
dnl Specify the file name, without path
|
|
||||||
|
|
||||||
opj_doxygen="doxygen"
|
|
||||||
|
|
||||||
AC_ARG_WITH([doxygen],
|
|
||||||
[AC_HELP_STRING(
|
|
||||||
[--with-doxygen=FILE],
|
|
||||||
[doxygen program to use @<:@default=doxygen@:>@])],
|
|
||||||
|
|
||||||
dnl Check the given doxygen program.
|
|
||||||
|
|
||||||
[opj_doxygen=${withval}
|
|
||||||
AC_CHECK_PROG([opj_have_doxygen],
|
|
||||||
[${opj_doxygen}],
|
|
||||||
[yes],
|
|
||||||
[no])
|
|
||||||
if test "x${opj_have_doxygen}" = "xno" ; then
|
|
||||||
echo "WARNING:"
|
|
||||||
echo "The doxygen program you specified:"
|
|
||||||
echo "${opj_doxygen}"
|
|
||||||
echo "was not found. Please check the path and make sure "
|
|
||||||
echo "the program exists and is executable."
|
|
||||||
AC_MSG_WARN([no doxygen detected. Documentation will not be built])
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[AC_CHECK_PROG([opj_have_doxygen],
|
|
||||||
[${opj_doxygen}],
|
|
||||||
[yes],
|
|
||||||
[no])
|
|
||||||
if test "x${opj_have_doxygen}" = "xno" ; then
|
|
||||||
echo "WARNING:"
|
|
||||||
echo "The doxygen program was not found in your execute path."
|
|
||||||
echo "You may have doxygen installed somewhere not covered by your path."
|
|
||||||
echo ""
|
|
||||||
echo "If this is the case make sure you have the packages installed, AND"
|
|
||||||
echo "that the doxygen program is in your execute path (see your"
|
|
||||||
echo "shell manual page on setting the \$PATH environment variable), OR"
|
|
||||||
echo "alternatively, specify the program to use with --with-doxygen."
|
|
||||||
AC_MSG_WARN([no doxygen detected. Documentation will not be built])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
else
|
|
||||||
opj_have_doxygen="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Substitution
|
|
||||||
dnl
|
|
||||||
AC_SUBST([opj_doxygen])
|
|
||||||
|
|
||||||
if ! test "x${opj_have_doxygen}" = "xyes" ; then
|
|
||||||
opj_enable_doc="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL(OPJ_BUILD_DOC, test "x${opj_have_doxygen}" = "xyes")
|
|
||||||
|
|
||||||
AS_IF([test "x${opj_have_doxygen}" = "xyes"], [$1], [$2])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl End of opj_doxygen.m4
|
|
||||||
157
m4/pkg.m4
157
m4/pkg.m4
@@ -1,157 +0,0 @@
|
|||||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
|
||||||
# serial 1 (pkg-config-0.24)
|
|
||||||
#
|
|
||||||
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
|
||||||
# distribute this file as part of a program that contains a
|
|
||||||
# configuration script generated by Autoconf, you may include it under
|
|
||||||
# the same distribution terms that you use for the rest of that program.
|
|
||||||
|
|
||||||
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
|
||||||
# ----------------------------------
|
|
||||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
|
||||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
|
||||||
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
|
||||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
|
||||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
|
||||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
|
||||||
|
|
||||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
||||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
|
||||||
fi
|
|
||||||
if test -n "$PKG_CONFIG"; then
|
|
||||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
|
||||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
|
||||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
PKG_CONFIG=""
|
|
||||||
fi
|
|
||||||
fi[]dnl
|
|
||||||
])# PKG_PROG_PKG_CONFIG
|
|
||||||
|
|
||||||
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
||||||
#
|
|
||||||
# Check to see whether a particular set of modules exists. Similar
|
|
||||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
||||||
#
|
|
||||||
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
||||||
# only at the first occurence in configure.ac, so if the first place
|
|
||||||
# it's called might be skipped (such as if it is within an "if", you
|
|
||||||
# have to call PKG_CHECK_EXISTS manually
|
|
||||||
# --------------------------------------------------------------
|
|
||||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
|
||||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
||||||
if test -n "$PKG_CONFIG" && \
|
|
||||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
|
||||||
m4_default([$2], [:])
|
|
||||||
m4_ifvaln([$3], [else
|
|
||||||
$3])dnl
|
|
||||||
fi])
|
|
||||||
|
|
||||||
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
|
||||||
# ---------------------------------------------
|
|
||||||
m4_define([_PKG_CONFIG],
|
|
||||||
[if test -n "$$1"; then
|
|
||||||
pkg_cv_[]$1="$$1"
|
|
||||||
elif test -n "$PKG_CONFIG"; then
|
|
||||||
PKG_CHECK_EXISTS([$3],
|
|
||||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
|
||||||
[pkg_failed=yes])
|
|
||||||
else
|
|
||||||
pkg_failed=untried
|
|
||||||
fi[]dnl
|
|
||||||
])# _PKG_CONFIG
|
|
||||||
|
|
||||||
# _PKG_SHORT_ERRORS_SUPPORTED
|
|
||||||
# -----------------------------
|
|
||||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
|
||||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
||||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
||||||
_pkg_short_errors_supported=yes
|
|
||||||
else
|
|
||||||
_pkg_short_errors_supported=no
|
|
||||||
fi[]dnl
|
|
||||||
])# _PKG_SHORT_ERRORS_SUPPORTED
|
|
||||||
|
|
||||||
|
|
||||||
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
||||||
# [ACTION-IF-NOT-FOUND])
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Note that if there is a possibility the first call to
|
|
||||||
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
||||||
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------
|
|
||||||
AC_DEFUN([PKG_CHECK_MODULES],
|
|
||||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
||||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
|
||||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
|
||||||
|
|
||||||
pkg_failed=no
|
|
||||||
AC_MSG_CHECKING([for $1])
|
|
||||||
|
|
||||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
|
||||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
|
||||||
|
|
||||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
|
||||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
|
||||||
See the pkg-config man page for more details.])
|
|
||||||
|
|
||||||
if test $pkg_failed = yes; then
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
_PKG_SHORT_ERRORS_SUPPORTED
|
|
||||||
if test $_pkg_short_errors_supported = yes; then
|
|
||||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
|
|
||||||
else
|
|
||||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
|
|
||||||
fi
|
|
||||||
# Put the nasty error message in config.log where it belongs
|
|
||||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
|
||||||
|
|
||||||
m4_default([$4], [AC_MSG_ERROR(
|
|
||||||
[Package requirements ($2) were not met:
|
|
||||||
|
|
||||||
$$1_PKG_ERRORS
|
|
||||||
|
|
||||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
|
||||||
installed software in a non-standard prefix.
|
|
||||||
|
|
||||||
_PKG_TEXT])dnl
|
|
||||||
])
|
|
||||||
elif test $pkg_failed = untried; then
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
m4_default([$4], [AC_MSG_FAILURE(
|
|
||||||
[The pkg-config script could not be found or is too old. Make sure it
|
|
||||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
|
||||||
path to pkg-config.
|
|
||||||
|
|
||||||
_PKG_TEXT
|
|
||||||
|
|
||||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
|
|
||||||
])
|
|
||||||
else
|
|
||||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
|
||||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
$3
|
|
||||||
fi[]dnl
|
|
||||||
])# PKG_CHECK_MODULES
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/* create config.h for CMake */
|
|
||||||
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
|
||||||
|
|
||||||
#cmakedefine HAVE_INTTYPES_H
|
|
||||||
#cmakedefine HAVE_MEMORY_H
|
|
||||||
#cmakedefine HAVE_STDINT_H
|
|
||||||
#cmakedefine HAVE_STDLIB_H
|
|
||||||
#cmakedefine HAVE_STRINGS_H
|
|
||||||
#cmakedefine HAVE_STRING_H
|
|
||||||
#cmakedefine HAVE_SYS_STAT_H
|
|
||||||
#cmakedefine HAVE_SYS_TYPES_H
|
|
||||||
#cmakedefine HAVE_UNISTD_H
|
|
||||||
#cmakedefine HAVE_LIBPNG
|
|
||||||
#cmakedefine HAVE_PNG_H
|
|
||||||
#cmakedefine HAVE_LIBTIFF
|
|
||||||
#cmakedefine HAVE_TIFF_H
|
|
||||||
|
|
||||||
#cmakedefine HAVE_LIBLCMS1
|
|
||||||
#cmakedefine HAVE_LIBLCMS2
|
|
||||||
#cmakedefine HAVE_LCMS1_H
|
|
||||||
#cmakedefine HAVE_LCMS2_H
|
|
||||||
|
|
||||||
/* Byte order. */
|
|
||||||
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
|
|
||||||
__LITTLE_ENDIAN__ to match the endianness of the architecture being
|
|
||||||
compiled for. This is not necessarily the same as the architecture of the
|
|
||||||
machine doing the building. In order to support Universal Binaries on
|
|
||||||
Mac OS X, we prefer those defines to decide the endianness.
|
|
||||||
On other platforms we use the result of the TRY_RUN. */
|
|
||||||
#if !defined(__APPLE__)
|
|
||||||
#cmakedefine OPJ_BIG_ENDIAN
|
|
||||||
#elif defined(__BIG_ENDIAN__)
|
|
||||||
# define OPJ_BIG_ENDIAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
12
src/CMakeLists.txt
Normal file
12
src/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# required dep for server:
|
||||||
|
if(BUILD_JPIP_SERVER)
|
||||||
|
find_package(CURL REQUIRED)
|
||||||
|
find_package(FCGI REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||||
|
message(FATAL_ERROR "Only pthread are supported")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(lib)
|
||||||
|
#add_subdirectory(bin)
|
||||||
21
src/bin/CMakeLists.txt
Normal file
21
src/bin/CMakeLists.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# source code for openjpeg apps:
|
||||||
|
add_subdirectory(common)
|
||||||
|
# Part 1 & 2:
|
||||||
|
add_subdirectory(jp2)
|
||||||
|
|
||||||
|
# optionals components:
|
||||||
|
if(BUILD_JPWL)
|
||||||
|
add_subdirectory(jpwl)
|
||||||
|
endif()
|
||||||
|
if(BUILD_MJ2)
|
||||||
|
add_subdirectory(mj2)
|
||||||
|
endif()
|
||||||
|
if(BUILD_JPIP)
|
||||||
|
add_subdirectory(jpip)
|
||||||
|
endif()
|
||||||
|
if(BUILD_JP3D)
|
||||||
|
add_subdirectory(jp3d)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# wx apps:
|
||||||
|
add_subdirectory(wx)
|
||||||
0
src/bin/common/CMakeLists.txt
Normal file
0
src/bin/common/CMakeLists.txt
Normal file
@@ -45,8 +45,13 @@
|
|||||||
#include <lcms.h>
|
#include <lcms.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPJ_USE_LEGACY
|
||||||
|
#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
|
||||||
|
#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
|
||||||
|
#endif
|
||||||
|
|
||||||
/*--------------------------------------------------------
|
/*--------------------------------------------------------
|
||||||
Matrix für sYCC, Amendment 1 to IEC 61966-2-1
|
Matrix for sYCC, Amendment 1 to IEC 61966-2-1
|
||||||
|
|
||||||
Y : 0.299 0.587 0.114 :R
|
Y : 0.299 0.587 0.114 :R
|
||||||
Cb: -0.1687 -0.3312 0.5 :G
|
Cb: -0.1687 -0.3312 0.5 :G
|
||||||
@@ -217,7 +222,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
|||||||
{
|
{
|
||||||
if(img->numcomps < 3)
|
if(img->numcomps < 3)
|
||||||
{
|
{
|
||||||
img->color_space = CLRSPC_GRAY;
|
img->color_space = OPJ_CLRSPC_GRAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +261,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
|||||||
__FILE__,__LINE__);
|
__FILE__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
img->color_space = CLRSPC_SRGB;
|
img->color_space = OPJ_CLRSPC_SRGB;
|
||||||
|
|
||||||
}/* color_sycc_to_rgb() */
|
}/* color_sycc_to_rgb() */
|
||||||
|
|
||||||
@@ -306,7 +311,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
in_type = TYPE_RGB_16;
|
in_type = TYPE_RGB_16;
|
||||||
out_type = TYPE_RGB_16;
|
out_type = TYPE_RGB_16;
|
||||||
out_prof = cmsCreate_sRGBProfile();
|
out_prof = cmsCreate_sRGBProfile();
|
||||||
image->color_space = CLRSPC_SRGB;
|
image->color_space = OPJ_CLRSPC_SRGB;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(out_space == cmsSigGrayData) /* enumCS 17 */
|
if(out_space == cmsSigGrayData) /* enumCS 17 */
|
||||||
@@ -314,7 +319,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
in_type = TYPE_GRAY_8;
|
in_type = TYPE_GRAY_8;
|
||||||
out_type = TYPE_RGB_8;
|
out_type = TYPE_RGB_8;
|
||||||
out_prof = cmsCreate_sRGBProfile();
|
out_prof = cmsCreate_sRGBProfile();
|
||||||
image->color_space = CLRSPC_SRGB;
|
image->color_space = OPJ_CLRSPC_SRGB;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
||||||
@@ -322,7 +327,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
in_type = TYPE_YCbCr_16;
|
in_type = TYPE_YCbCr_16;
|
||||||
out_type = TYPE_RGB_16;
|
out_type = TYPE_RGB_16;
|
||||||
out_prof = cmsCreate_sRGBProfile();
|
out_prof = cmsCreate_sRGBProfile();
|
||||||
image->color_space = CLRSPC_SRGB;
|
image->color_space = OPJ_CLRSPC_SRGB;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -44,5 +44,6 @@
|
|||||||
#define RAW_DFMT 15
|
#define RAW_DFMT 15
|
||||||
#define TGA_DFMT 16
|
#define TGA_DFMT 16
|
||||||
#define PNG_DFMT 17
|
#define PNG_DFMT 17
|
||||||
|
#define RAWL_DFMT 18
|
||||||
|
|
||||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
||||||
60
src/bin/jp2/CMakeLists.txt
Normal file
60
src/bin/jp2/CMakeLists.txt
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# Build the demo app, small examples
|
||||||
|
|
||||||
|
# First thing define the common source:
|
||||||
|
set(common_SRCS
|
||||||
|
convert.c
|
||||||
|
index.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Headers file are located here:
|
||||||
|
include_directories(
|
||||||
|
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||||
|
${LCMS_INCLUDE_DIRNAME}
|
||||||
|
${Z_INCLUDE_DIRNAME}
|
||||||
|
${PNG_INCLUDE_DIRNAME}
|
||||||
|
${TIFF_INCLUDE_DIRNAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
add_definitions(-DOPJ_EXPORTS)
|
||||||
|
else()
|
||||||
|
add_definitions(-DOPJ_STATIC)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Loop over all executables:
|
||||||
|
foreach(exe opj_decompress opj_compress opj_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()
|
||||||
|
|
||||||
|
# On unix you need to link to the math library:
|
||||||
|
if(UNIX)
|
||||||
|
target_link_libraries(${exe} m)
|
||||||
|
endif()
|
||||||
|
# Install exe
|
||||||
|
install(TARGETS ${exe}
|
||||||
|
EXPORT OpenJPEGTargets
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Install man pages
|
||||||
|
install(
|
||||||
|
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1
|
||||||
|
${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_decompress.1
|
||||||
|
${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
|
||||||
|
#
|
||||||
3621
src/bin/jp2/convert.c
Normal file
3621
src/bin/jp2/convert.c
Normal file
File diff suppressed because it is too large
Load Diff
84
src/bin/jp2/convert.h
Normal file
84
src/bin/jp2/convert.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef __J2K_CONVERT_H
|
||||||
|
#define __J2K_CONVERT_H
|
||||||
|
|
||||||
|
/**@name RAW image encoding parameters */
|
||||||
|
/*@{*/
|
||||||
|
typedef struct raw_cparameters {
|
||||||
|
/** 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;
|
||||||
|
|
||||||
|
/* TGA conversion */
|
||||||
|
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
int imagetotga(opj_image_t * image, const char *outfile);
|
||||||
|
|
||||||
|
/* BMP conversion */
|
||||||
|
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);
|
||||||
|
int imagetotif(opj_image_t *image, const char *outfile);
|
||||||
|
/**
|
||||||
|
Load a single image component encoded in PGX file format
|
||||||
|
@param filename Name of the PGX file to load
|
||||||
|
@param parameters *List ?*
|
||||||
|
@return Returns a greyscale image if successful, returns NULL otherwise
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
#endif /* __J2K_CONVERT_H */
|
||||||
|
|
||||||
392
src/bin/jp2/index.c
Normal file
392
src/bin/jp2/index.c
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "openjpeg.h"
|
||||||
|
#include "index.h"
|
||||||
|
#include "opj_inttypes.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Write a structured index to a file
|
||||||
|
@param cstr_info Codestream information
|
||||||
|
@param index Index filename
|
||||||
|
@return Returns 0 if successful, returns 1 otherwise
|
||||||
|
*/
|
||||||
|
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
|
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||||
|
FILE *stream = NULL;
|
||||||
|
double total_disto = 0;
|
||||||
|
/* UniPG>> */
|
||||||
|
int tilepartno;
|
||||||
|
char disto_on, numpix_on;
|
||||||
|
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
||||||
|
return 0;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
|
||||||
|
if (!cstr_info)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
stream = fopen(index, "w");
|
||||||
|
if (!stream) {
|
||||||
|
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cstr_info->tile[0].distotile)
|
||||||
|
disto_on = 1;
|
||||||
|
else
|
||||||
|
disto_on = 0;
|
||||||
|
|
||||||
|
if (cstr_info->tile[0].numpix)
|
||||||
|
numpix_on = 1;
|
||||||
|
else
|
||||||
|
numpix_on = 0;
|
||||||
|
|
||||||
|
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||||
|
fprintf(stream, "%d\n", cstr_info->prog);
|
||||||
|
fprintf(stream, "%d %d\n", cstr_info->tile_x, cstr_info->tile_y);
|
||||||
|
fprintf(stream, "%d %d\n", cstr_info->tw, cstr_info->th);
|
||||||
|
fprintf(stream, "%d\n", cstr_info->numcomps);
|
||||||
|
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||||
|
fprintf(stream, "%d\n", cstr_info->numdecompos[0]); /* based on component 0 */
|
||||||
|
|
||||||
|
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||||
|
fprintf(stream, "[%d,%d] ",
|
||||||
|
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
/* UniPG>> */
|
||||||
|
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||||
|
/* <<UniPG */
|
||||||
|
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
||||||
|
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
||||||
|
|
||||||
|
fprintf(stream, "\nINFO ON TILES\n");
|
||||||
|
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream," disto");
|
||||||
|
if (numpix_on)
|
||||||
|
fprintf(stream," nbpix");
|
||||||
|
if (disto_on && numpix_on)
|
||||||
|
fprintf(stream," disto/nbpix");
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
|
||||||
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
|
fprintf(stream, "%4d %9d %9d %9d %9d",
|
||||||
|
cstr_info->tile[tileno].tileno,
|
||||||
|
cstr_info->tile[tileno].start_pos,
|
||||||
|
cstr_info->tile[tileno].end_header,
|
||||||
|
cstr_info->tile[tileno].end_pos,
|
||||||
|
cstr_info->tile[tileno].num_tps);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
||||||
|
if (numpix_on)
|
||||||
|
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
||||||
|
if (disto_on && numpix_on)
|
||||||
|
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
|
OPJ_OFF_T start_pos, end_ph_pos, end_pos;
|
||||||
|
double disto = 0;
|
||||||
|
int max_numdecompos = 0;
|
||||||
|
pack_nb = 0;
|
||||||
|
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||||
|
max_numdecompos = cstr_info->numdecompos[compno];
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||||
|
fprintf(stream, "part_nb tileno start_pack num_packs start_pos end_tph_pos end_pos\n");
|
||||||
|
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
||||||
|
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
||||||
|
tilepartno, tileno,
|
||||||
|
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
||||||
|
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
||||||
|
cstr_info->tile[tileno].tp[tilepartno].tp_start_pos,
|
||||||
|
cstr_info->tile[tileno].tp[tilepartno].tp_end_header,
|
||||||
|
cstr_info->tile[tileno].tp[tilepartno].tp_end_pos
|
||||||
|
);
|
||||||
|
|
||||||
|
if (cstr_info->prog == OPJ_LRCP) { /* LRCP */
|
||||||
|
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " disto");
|
||||||
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
|
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6" PRId64 " %6" PRId64 " %7" PRId64,
|
||||||
|
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " %8e", disto);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
total_disto += disto;
|
||||||
|
pack_nb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* LRCP */
|
||||||
|
|
||||||
|
else if (cstr_info->prog == OPJ_RLCP) { /* RLCP */
|
||||||
|
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " disto");
|
||||||
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
int prec_max;
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
|
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9" PRId64 " %9" PRId64 " %7" PRId64,
|
||||||
|
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " %8e", disto);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
total_disto += disto;
|
||||||
|
pack_nb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* RLCP */
|
||||||
|
|
||||||
|
else if (cstr_info->prog == OPJ_RPCL) { /* RPCL */
|
||||||
|
|
||||||
|
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " disto");
|
||||||
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
for (precno = 0; precno < numprec; precno++) {
|
||||||
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
|
break;
|
||||||
|
for(y = y0; y < y1; y++) {
|
||||||
|
if (precno_y*pcy == y ) {
|
||||||
|
for (x = x0; x < x1; x++) {
|
||||||
|
if (precno_x*pcx == x ) {
|
||||||
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
|
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9" PRId64 " %9" PRId64 " %7" PRId64,
|
||||||
|
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " %8e", disto);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
total_disto += disto;
|
||||||
|
pack_nb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}/* x = x0..x1 */
|
||||||
|
}
|
||||||
|
} /* y = y0..y1 */
|
||||||
|
} /* precno */
|
||||||
|
} /* compno */
|
||||||
|
} /* resno */
|
||||||
|
} /* RPCL */
|
||||||
|
|
||||||
|
else if (cstr_info->prog == OPJ_PCRL) { /* PCRL */
|
||||||
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
|
/* Count the maximum number of precincts */
|
||||||
|
int max_numprec = 0;
|
||||||
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
if (numprec > max_numprec)
|
||||||
|
max_numprec = numprec;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " disto");
|
||||||
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
|
for (precno = 0; precno < max_numprec; precno++) {
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
|
if (precno >= numprec)
|
||||||
|
continue;
|
||||||
|
for(y = y0; y < y1; y++) {
|
||||||
|
if (precno_y*pcy == y ) {
|
||||||
|
for (x = x0; x < x1; x++) {
|
||||||
|
if (precno_x*pcx == x ) {
|
||||||
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
|
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9" PRId64 " %9" PRId64 " %7" PRId64,
|
||||||
|
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " %8e", disto);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
total_disto += disto;
|
||||||
|
pack_nb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}/* x = x0..x1 */
|
||||||
|
}
|
||||||
|
} /* y = y0..y1 */
|
||||||
|
} /* resno */
|
||||||
|
} /* compno */
|
||||||
|
} /* precno */
|
||||||
|
} /* PCRL */
|
||||||
|
|
||||||
|
else { /* CPRL */
|
||||||
|
/* Count the maximum number of precincts */
|
||||||
|
int max_numprec = 0;
|
||||||
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
if (numprec > max_numprec)
|
||||||
|
max_numprec = numprec;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " disto");
|
||||||
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
|
for (precno = 0; precno < max_numprec; precno++) {
|
||||||
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
|
if (precno >= numprec)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for(y = y0; y < y1; y++) {
|
||||||
|
if (precno_y*pcy == y ) {
|
||||||
|
for (x = x0; x < x1; x++) {
|
||||||
|
if (precno_x*pcx == x ) {
|
||||||
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
|
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9" PRId64 " %9" PRId64 " %7" PRId64,
|
||||||
|
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
|
if (disto_on)
|
||||||
|
fprintf(stream, " %8e", disto);
|
||||||
|
fprintf(stream, "\n");
|
||||||
|
total_disto += disto;
|
||||||
|
pack_nb++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}/* x = x0..x1 */
|
||||||
|
}
|
||||||
|
} /* y = y0..y1 */
|
||||||
|
} /* resno */
|
||||||
|
} /* precno */
|
||||||
|
} /* compno */
|
||||||
|
} /* CPRL */
|
||||||
|
} /* tileno */
|
||||||
|
|
||||||
|
if (disto_on) {
|
||||||
|
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
||||||
|
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
||||||
|
}
|
||||||
|
/* UniPG>> */
|
||||||
|
/* print the markers' list */
|
||||||
|
if (cstr_info->marknum) {
|
||||||
|
fprintf(stream, "\nMARKER LIST\n");
|
||||||
|
fprintf(stream, "%d\n", cstr_info->marknum);
|
||||||
|
fprintf(stream, "type\tstart_pos length\n");
|
||||||
|
for (x = 0; x < cstr_info->marknum; x++)
|
||||||
|
fprintf(stream, "%X\t%9" PRId64 " %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);
|
||||||
|
}
|
||||||
|
/* <<UniPG */
|
||||||
|
fclose(stream);
|
||||||
|
|
||||||
|
fprintf(stderr,"Generated index file %s\n", index);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1903
src/bin/jp2/opj_compress.c
Normal file
1903
src/bin/jp2/opj_compress.c
Normal file
File diff suppressed because it is too large
Load Diff
977
src/bin/jp2/opj_decompress.c
Normal file
977
src/bin/jp2/opj_decompress.c
Normal file
@@ -0,0 +1,977 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
|
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||||
|
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include "opj_config.h"
|
||||||
|
|
||||||
|
#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>
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#define strncasecmp _strnicmp
|
||||||
|
#else
|
||||||
|
#include <strings.h>
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
#include "openjpeg.h"
|
||||||
|
#include "opj_getopt.h"
|
||||||
|
#include "convert.h"
|
||||||
|
#include "index.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLCMS2
|
||||||
|
#include <lcms2.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBLCMS1
|
||||||
|
#include <lcms.h>
|
||||||
|
#endif
|
||||||
|
#include "color.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;
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* Declarations */
|
||||||
|
int get_num_images(char *imgdirpath);
|
||||||
|
int load_images(dircnt_t *dirptr, char *imgdirpath);
|
||||||
|
int get_file_format(const char *filename);
|
||||||
|
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters);
|
||||||
|
static int infile_format(const char *fname);
|
||||||
|
|
||||||
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename);
|
||||||
|
int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsigned int *DA_x1, unsigned int *DA_y1);
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
static void decode_help_display(void) {
|
||||||
|
fprintf(stdout,"HELP for opj_decompress\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," -OutFor \n");
|
||||||
|
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
||||||
|
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
||||||
|
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA formats\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 <decompressed file>\n");
|
||||||
|
fprintf(stdout," REQUIRED\n");
|
||||||
|
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA files\n");
|
||||||
|
fprintf(stdout," Binary data is written to the file (not ascii). If a PGX\n");
|
||||||
|
fprintf(stdout," filename is given, there will be as many output files as there are\n");
|
||||||
|
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
|
||||||
|
fprintf(stdout," output filename, just before the \"pgx\" extension. If a PGM filename\n");
|
||||||
|
fprintf(stdout," is given and there are more than one component, only the first component\n");
|
||||||
|
fprintf(stdout," will be written to the file.\n");
|
||||||
|
fprintf(stdout," -r <reduce factor>\n");
|
||||||
|
fprintf(stdout," Set the number of highest resolution levels to be discarded. The\n");
|
||||||
|
fprintf(stdout," image resolution is effectively divided by 2 to the power of the\n");
|
||||||
|
fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n");
|
||||||
|
fprintf(stdout," smallest total number of decomposition levels among tiles.\n");
|
||||||
|
fprintf(stdout," -l <number of quality layers to decode>\n");
|
||||||
|
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
|
||||||
|
fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
|
||||||
|
fprintf(stdout," are decoded.\n");
|
||||||
|
fprintf(stdout," -x \n");
|
||||||
|
fprintf(stdout," Create an index file *.Idx (-x index_name.Idx) \n");
|
||||||
|
fprintf(stdout," -d <x0,y0,x1,y1>\n");
|
||||||
|
fprintf(stdout," OPTIONAL\n");
|
||||||
|
fprintf(stdout," Decoding area\n");
|
||||||
|
fprintf(stdout," By default all the image is decoded.\n");
|
||||||
|
fprintf(stdout," -t <tile_number>\n");
|
||||||
|
fprintf(stdout," OPTIONAL\n");
|
||||||
|
fprintf(stdout," Set the tile number of the decoded tile. Follow the JPEG2000 convention from left-up to bottom-up\n");
|
||||||
|
fprintf(stdout," By default all tiles are decoded.\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
/* UniPG>> */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
fprintf(stdout," -W <options>\n");
|
||||||
|
fprintf(stdout," Activates the JPWL correction capability, if the codestream complies.\n");
|
||||||
|
fprintf(stdout," Options can be a comma separated list of <param=val> tokens:\n");
|
||||||
|
fprintf(stdout," c, c=numcomps\n");
|
||||||
|
fprintf(stdout," numcomps is the number of expected components in the codestream\n");
|
||||||
|
fprintf(stdout," (search of first EPB rely upon this, default is %d)\n", JPWL_EXPECTED_COMPONENTS);
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
return num_images;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent* content;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
/*Reading the input images from given input directory*/
|
||||||
|
|
||||||
|
dir= opendir(imgdirpath);
|
||||||
|
if(!dir){
|
||||||
|
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||||
|
return 1;
|
||||||
|
}else {
|
||||||
|
fprintf(stderr,"Folder opened successfully\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
while((content=readdir(dir))!=NULL){
|
||||||
|
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int get_file_format(const char *filename) {
|
||||||
|
unsigned int i;
|
||||||
|
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "rawl", "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, RAWL_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(strcasecmp(ext, extension[i]) == 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 = infile_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
#define JP2_RFC3745_MAGIC "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
|
||||||
|
#define JP2_MAGIC "\x0d\x0a\x87\x0a"
|
||||||
|
/* position 45: "\xff\x52" */
|
||||||
|
#define J2K_CODESTREAM_MAGIC "\xff\x4f\xff\x51"
|
||||||
|
|
||||||
|
static int infile_format(const char *fname)
|
||||||
|
{
|
||||||
|
FILE *reader;
|
||||||
|
const char *s, *magic_s;
|
||||||
|
int ext_format, magic_format;
|
||||||
|
unsigned char buf[12];
|
||||||
|
unsigned int l_nb_read;
|
||||||
|
|
||||||
|
reader = fopen(fname, "rb");
|
||||||
|
|
||||||
|
if (reader == NULL)
|
||||||
|
return -2;
|
||||||
|
|
||||||
|
memset(buf, 0, 12);
|
||||||
|
l_nb_read = fread(buf, 1, 12, reader);
|
||||||
|
fclose(reader);
|
||||||
|
if (l_nb_read != 12)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ext_format = get_file_format(fname);
|
||||||
|
|
||||||
|
if (ext_format == JPT_CFMT)
|
||||||
|
return JPT_CFMT;
|
||||||
|
|
||||||
|
if (memcmp(buf, JP2_RFC3745_MAGIC, 12) == 0 || memcmp(buf, JP2_MAGIC, 4) == 0) {
|
||||||
|
magic_format = JP2_CFMT;
|
||||||
|
magic_s = ".jp2";
|
||||||
|
}
|
||||||
|
else if (memcmp(buf, J2K_CODESTREAM_MAGIC, 4) == 0) {
|
||||||
|
magic_format = J2K_CFMT;
|
||||||
|
magic_s = ".j2k or .jpc or .j2c";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (magic_format == ext_format)
|
||||||
|
return ext_format;
|
||||||
|
|
||||||
|
s = fname + strlen(fname) - 4;
|
||||||
|
|
||||||
|
fputs("\n===========================================\n", stderr);
|
||||||
|
fprintf(stderr, "The extension of this file is incorrect.\n"
|
||||||
|
"FOUND %s. SHOULD BE %s\n", s, magic_s);
|
||||||
|
fputs("===========================================\n", stderr);
|
||||||
|
|
||||||
|
return magic_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* Parse the command line
|
||||||
|
*/
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
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'},
|
||||||
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
|
};
|
||||||
|
|
||||||
|
const char optlist[] = "i:o:r:l:x:d:t:"
|
||||||
|
|
||||||
|
/* UniPG>> */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
"W:"
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
"h" ;
|
||||||
|
totlen=sizeof(long_option);
|
||||||
|
img_fol->set_out_format = 0;
|
||||||
|
do {
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'i': /* input file */
|
||||||
|
{
|
||||||
|
char *infile = opj_optarg;
|
||||||
|
parameters->decod_format = infile_format(infile);
|
||||||
|
switch(parameters->decod_format) {
|
||||||
|
case J2K_CFMT:
|
||||||
|
break;
|
||||||
|
case JP2_CFMT:
|
||||||
|
break;
|
||||||
|
case JPT_CFMT:
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
fprintf(stderr,
|
||||||
|
"!! infile cannot be read: %s !!\n\n",
|
||||||
|
infile);
|
||||||
|
return 1;
|
||||||
|
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;
|
||||||
|
parameters->cod_format = get_file_format(outfile);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
break;
|
||||||
|
case PXM_DFMT:
|
||||||
|
break;
|
||||||
|
case BMP_DFMT:
|
||||||
|
break;
|
||||||
|
case TIF_DFMT:
|
||||||
|
break;
|
||||||
|
case RAW_DFMT:
|
||||||
|
break;
|
||||||
|
case RAWL_DFMT:
|
||||||
|
break;
|
||||||
|
case TGA_DFMT:
|
||||||
|
break;
|
||||||
|
case PNG_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'O': /* output format */
|
||||||
|
{
|
||||||
|
char outformat[50];
|
||||||
|
char *of = opj_optarg;
|
||||||
|
sprintf(outformat,".%s",of);
|
||||||
|
img_fol->set_out_format = 1;
|
||||||
|
parameters->cod_format = get_file_format(outformat);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
img_fol->out_format = "pgx";
|
||||||
|
break;
|
||||||
|
case PXM_DFMT:
|
||||||
|
img_fol->out_format = "ppm";
|
||||||
|
break;
|
||||||
|
case BMP_DFMT:
|
||||||
|
img_fol->out_format = "bmp";
|
||||||
|
break;
|
||||||
|
case TIF_DFMT:
|
||||||
|
img_fol->out_format = "tif";
|
||||||
|
break;
|
||||||
|
case RAW_DFMT:
|
||||||
|
img_fol->out_format = "raw";
|
||||||
|
break;
|
||||||
|
case RAWL_DFMT:
|
||||||
|
img_fol->out_format = "rawl";
|
||||||
|
break;
|
||||||
|
case TGA_DFMT:
|
||||||
|
img_fol->out_format = "raw";
|
||||||
|
break;
|
||||||
|
case PNG_DFMT:
|
||||||
|
img_fol->out_format = "png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
case 'r': /* reduce option */
|
||||||
|
{
|
||||||
|
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
case 'l': /* layering option */
|
||||||
|
{
|
||||||
|
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'h': /* display an help description */
|
||||||
|
decode_help_display();
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'y': /* Image Directory path */
|
||||||
|
{
|
||||||
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
|
img_fol->set_imgdir=1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'd': /* Input decode ROI */
|
||||||
|
{
|
||||||
|
int size_optarg = (int)strlen(opj_optarg) + 1;
|
||||||
|
char *ROI_values = (char*) malloc(size_optarg);
|
||||||
|
ROI_values[0] = '\0';
|
||||||
|
strncpy(ROI_values, opj_optarg, strlen(opj_optarg));
|
||||||
|
ROI_values[strlen(opj_optarg)] = '\0';
|
||||||
|
/*printf("ROI_values = %s [%d / %d]\n", ROI_values, strlen(ROI_values), size_optarg ); */
|
||||||
|
parse_DA_values( ROI_values, ¶meters->DA_x0, ¶meters->DA_y0, ¶meters->DA_x1, ¶meters->DA_y1);
|
||||||
|
|
||||||
|
free(ROI_values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 't': /* Input tile index */
|
||||||
|
{
|
||||||
|
sscanf(opj_optarg, "%d", ¶meters->tile_index);
|
||||||
|
parameters->nb_tile_to_decode = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'x': /* Creation of index file */
|
||||||
|
{
|
||||||
|
char *index = opj_optarg;
|
||||||
|
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
/* UniPG>> */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
|
||||||
|
case 'W': /* activate JPWL correction */
|
||||||
|
{
|
||||||
|
char *token = NULL;
|
||||||
|
|
||||||
|
token = strtok(opj_optarg, ",");
|
||||||
|
while(token != NULL) {
|
||||||
|
|
||||||
|
/* search expected number of components */
|
||||||
|
if (*token == 'c') {
|
||||||
|
|
||||||
|
static int compno;
|
||||||
|
|
||||||
|
compno = JPWL_EXPECTED_COMPONENTS; /* predefined no. of components */
|
||||||
|
|
||||||
|
if(sscanf(token, "c=%d", &compno) == 1) {
|
||||||
|
/* Specified */
|
||||||
|
if ((compno < 1) || (compno > 256)) {
|
||||||
|
fprintf(stderr, "ERROR -> invalid number of components c = %d\n", compno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->jpwl_exp_comps = compno;
|
||||||
|
|
||||||
|
} else if (!strcmp(token, "c")) {
|
||||||
|
/* default */
|
||||||
|
parameters->jpwl_exp_comps = compno; /* auto for default size */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "ERROR -> invalid components specified = %s\n", token);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* search maximum number of tiles */
|
||||||
|
if (*token == 't') {
|
||||||
|
|
||||||
|
static int tileno;
|
||||||
|
|
||||||
|
tileno = JPWL_MAXIMUM_TILES; /* maximum no. of tiles */
|
||||||
|
|
||||||
|
if(sscanf(token, "t=%d", &tileno) == 1) {
|
||||||
|
/* Specified */
|
||||||
|
if ((tileno < 1) || (tileno > JPWL_MAXIMUM_TILES)) {
|
||||||
|
fprintf(stderr, "ERROR -> invalid number of tiles t = %d\n", tileno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->jpwl_max_tiles = tileno;
|
||||||
|
|
||||||
|
} else if (!strcmp(token, "t")) {
|
||||||
|
/* default */
|
||||||
|
parameters->jpwl_max_tiles = tileno; /* auto for default size */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "ERROR -> invalid tiles specified = %s\n", token);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* next token or bust */
|
||||||
|
token = strtok(NULL, ",");
|
||||||
|
};
|
||||||
|
parameters->jpwl_correct = OPJ_TRUE;
|
||||||
|
fprintf(stdout, "JPWL correction capability activated\n");
|
||||||
|
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
|
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) || (parameters->outfile[0] == 0)) {
|
||||||
|
fprintf(stderr, "Example: %s -i image.j2k -o image.pgm\n",argv[0]);
|
||||||
|
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* Parse decoding area input values
|
||||||
|
* separator = ","
|
||||||
|
*/
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsigned int *DA_x1, unsigned int *DA_y1)
|
||||||
|
{
|
||||||
|
int it = 0;
|
||||||
|
int values[4];
|
||||||
|
char delims[] = ",";
|
||||||
|
char *result = NULL;
|
||||||
|
result = strtok( inArg, delims );
|
||||||
|
|
||||||
|
while( (result != NULL) && (it < 4 ) ) {
|
||||||
|
values[it] = atoi(result);
|
||||||
|
result = strtok( NULL, delims );
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it != 4) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
*DA_x0 = values[0]; *DA_y0 = values[1];
|
||||||
|
*DA_x1 = values[2]; *DA_y1 = values[3];
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
sample error callback expecting a FILE* client object
|
||||||
|
*/
|
||||||
|
static void error_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[ERROR] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample warning callback expecting a FILE* client object
|
||||||
|
*/
|
||||||
|
static void warning_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[WARNING] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample debug callback expecting no client object
|
||||||
|
*/
|
||||||
|
static void info_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* OPJ_DECOMPRESS MAIN
|
||||||
|
*/
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
FILE *fsrc = NULL;
|
||||||
|
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
opj_image_t* image = NULL;
|
||||||
|
opj_stream_t *l_stream = NULL; /* Stream */
|
||||||
|
opj_codec_t* l_codec = NULL; /* Handle to a decompressor */
|
||||||
|
opj_codestream_index_t* cstr_index = NULL;
|
||||||
|
|
||||||
|
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||||
|
|
||||||
|
OPJ_INT32 num_images, imageno;
|
||||||
|
img_fol_t img_fol;
|
||||||
|
dircnt_t *dirptr = NULL;
|
||||||
|
|
||||||
|
/* set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* FIXME Initialize indexfilename and img_fol */
|
||||||
|
*indexfilename = 0;
|
||||||
|
|
||||||
|
/* Initialize img_fol */
|
||||||
|
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 EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize reading of directory */
|
||||||
|
if(img_fol.set_imgdir==1){
|
||||||
|
int it_image;
|
||||||
|
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 EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
for(it_image=0;it_image<num_images;it_image++){
|
||||||
|
dirptr->filename[it_image] = dirptr->filename_buf + it_image*OPJ_PATH_LEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
if (num_images==0){
|
||||||
|
fprintf(stdout,"Folder is empty\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
num_images=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Decoding image one by one*/
|
||||||
|
for(imageno = 0; imageno < num_images ; imageno++) {
|
||||||
|
|
||||||
|
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 EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
l_stream = opj_stream_create_default_file_stream(fsrc,1);
|
||||||
|
if (!l_stream){
|
||||||
|
fclose(fsrc);
|
||||||
|
fprintf(stderr, "ERROR -> failed to create the stream from the file\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode the JPEG2000 stream */
|
||||||
|
/* ---------------------- */
|
||||||
|
|
||||||
|
switch(parameters.decod_format) {
|
||||||
|
case J2K_CFMT: /* JPEG-2000 codestream */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_J2K);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case JP2_CFMT: /* JPEG 2000 compressed image data */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_JP2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case JPT_CFMT: /* JPEG 2000, JPIP */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_JPT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "skipping file..\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_info_handler(l_codec, info_callback,00);
|
||||||
|
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||||
|
opj_set_error_handler(l_codec, error_callback,00);
|
||||||
|
|
||||||
|
/* Setup the decoder decoding parameters using user parameters */
|
||||||
|
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||||
|
fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||||
|
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||||
|
fprintf(stderr, "ERROR -> opj_decompress: failed to read the header\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!parameters.nb_tile_to_decode) {
|
||||||
|
/* Optional if you want decode the entire image */
|
||||||
|
if (!opj_set_decode_area(l_codec, image, parameters.DA_x0,
|
||||||
|
parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)){
|
||||||
|
fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
fclose(fsrc);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the decoded image */
|
||||||
|
if (!(opj_decode(l_codec, l_stream, image) && opj_end_decompress(l_codec, l_stream))) {
|
||||||
|
fprintf(stderr,"ERROR -> opj_decompress: failed to decode image!\n");
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
fclose(fsrc);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
/* It is just here to illustrate how to use the resolution after set parameters */
|
||||||
|
/*if (!opj_set_decoded_resolution_factor(l_codec, 5)) {
|
||||||
|
fprintf(stderr, "ERROR -> opj_decompress: failed to set the resolution factor tile!\n");
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
fclose(fsrc);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (!opj_get_decoded_tile(l_codec, l_stream, image, parameters.tile_index)) {
|
||||||
|
fprintf(stderr, "ERROR -> opj_decompress: failed to decode tile!\n");
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
fclose(fsrc);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
fprintf(stdout, "tile %d is decoded!\n\n", parameters.tile_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the byte stream */
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
|
||||||
|
if(image->color_space == OPJ_CLRSPC_SYCC){
|
||||||
|
color_sycc_to_rgb(image); /* FIXME */
|
||||||
|
}
|
||||||
|
|
||||||
|
if(image->icc_profile_buf) {
|
||||||
|
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
|
||||||
|
color_apply_icc_profile(image); /* FIXME */
|
||||||
|
#endif
|
||||||
|
free(image->icc_profile_buf);
|
||||||
|
image->icc_profile_buf = NULL; image->icc_profile_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create output image */
|
||||||
|
/* ------------------- */
|
||||||
|
switch (parameters.cod_format) {
|
||||||
|
case PXM_DFMT: /* PNM PGM PPM */
|
||||||
|
if (imagetopnm(image, parameters.outfile)) {
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PGX_DFMT: /* PGX */
|
||||||
|
if(imagetopgx(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMP_DFMT: /* BMP */
|
||||||
|
if(imagetobmp(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#ifdef HAVE_LIBTIFF
|
||||||
|
case TIF_DFMT: /* TIFF */
|
||||||
|
if(imagetotif(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* HAVE_LIBTIFF */
|
||||||
|
case RAW_DFMT: /* RAW */
|
||||||
|
if(imagetoraw(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RAWL_DFMT: /* RAWL */
|
||||||
|
if(imagetorawl(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Error generating rawl file. Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGA_DFMT: /* TGA */
|
||||||
|
if(imagetotga(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Error generating tga file. Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
case PNG_DFMT: /* PNG */
|
||||||
|
if(imagetopng(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* HAVE_LIBPNG */
|
||||||
|
/* Can happen if output file is TIFF or PNG
|
||||||
|
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free remaining structures */
|
||||||
|
if (l_codec) {
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* free image data structure */
|
||||||
|
opj_image_destroy(image);
|
||||||
|
|
||||||
|
/* destroy the codestream index */
|
||||||
|
opj_destroy_cstr_index(&cstr_index);
|
||||||
|
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
/*end main*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
586
src/bin/jp2/opj_dump.c
Normal file
586
src/bin/jp2/opj_dump.c
Normal file
@@ -0,0 +1,586 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Mathieu Malaterre, GDCM
|
||||||
|
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||||
|
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include "opj_config.h"
|
||||||
|
|
||||||
|
#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 "openjpeg.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;
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* Declarations */
|
||||||
|
int get_num_images(char *imgdirpath);
|
||||||
|
int load_images(dircnt_t *dirptr, char *imgdirpath);
|
||||||
|
int get_file_format(const char *filename);
|
||||||
|
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters);
|
||||||
|
static int infile_format(const char *fname);
|
||||||
|
|
||||||
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol);
|
||||||
|
int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsigned int *DA_x1, unsigned int *DA_y1);
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
static void decode_help_display(void) {
|
||||||
|
fprintf(stdout,"HELP for opj_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," -v "); /* FIXME WIP_MSD */
|
||||||
|
fprintf(stdout," OPTIONAL\n");
|
||||||
|
fprintf(stdout," Activate or not the verbose mode (display info and warning message)\n");
|
||||||
|
fprintf(stdout," By default verbose mode is off.\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
return num_images;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent* content;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
/*Reading the input images from given input directory*/
|
||||||
|
|
||||||
|
dir= opendir(imgdirpath);
|
||||||
|
if(!dir){
|
||||||
|
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||||
|
return 1;
|
||||||
|
}else {
|
||||||
|
fprintf(stderr,"Folder opened successfully\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
while((content=readdir(dir))!=NULL){
|
||||||
|
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int get_file_format(const 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
#define JP2_RFC3745_MAGIC "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
|
||||||
|
#define JP2_MAGIC "\x0d\x0a\x87\x0a"
|
||||||
|
/* position 45: "\xff\x52" */
|
||||||
|
#define J2K_CODESTREAM_MAGIC "\xff\x4f\xff\x51"
|
||||||
|
|
||||||
|
static int infile_format(const char *fname)
|
||||||
|
{
|
||||||
|
FILE *reader;
|
||||||
|
const char *s, *magic_s;
|
||||||
|
int ext_format, magic_format;
|
||||||
|
unsigned char buf[12];
|
||||||
|
unsigned int l_nb_read;
|
||||||
|
|
||||||
|
reader = fopen(fname, "rb");
|
||||||
|
|
||||||
|
if (reader == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
memset(buf, 0, 12);
|
||||||
|
l_nb_read = fread(buf, 1, 12, reader);
|
||||||
|
fclose(reader);
|
||||||
|
if (l_nb_read != 12)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ext_format = get_file_format(fname);
|
||||||
|
|
||||||
|
if (ext_format == JPT_CFMT)
|
||||||
|
return JPT_CFMT;
|
||||||
|
|
||||||
|
if (memcmp(buf, JP2_RFC3745_MAGIC, 12) == 0 || memcmp(buf, JP2_MAGIC, 4) == 0) {
|
||||||
|
magic_format = JP2_CFMT;
|
||||||
|
magic_s = ".jp2";
|
||||||
|
}
|
||||||
|
else if (memcmp(buf, J2K_CODESTREAM_MAGIC, 4) == 0) {
|
||||||
|
magic_format = J2K_CFMT;
|
||||||
|
magic_s = ".j2k or .jpc or .j2c";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (magic_format == ext_format)
|
||||||
|
return ext_format;
|
||||||
|
|
||||||
|
s = fname + strlen(fname) - 4;
|
||||||
|
|
||||||
|
fputs("\n===========================================\n", stderr);
|
||||||
|
fprintf(stderr, "The extension of this file is incorrect.\n"
|
||||||
|
"FOUND %s. SHOULD BE %s\n", s, magic_s);
|
||||||
|
fputs("===========================================\n", stderr);
|
||||||
|
|
||||||
|
return magic_format;
|
||||||
|
}
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* Parse the command line
|
||||||
|
*/
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||||
|
int totlen, c;
|
||||||
|
opj_option_t long_option[]={
|
||||||
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
|
};
|
||||||
|
const char optlist[] = "i:o:hv";
|
||||||
|
|
||||||
|
totlen=sizeof(long_option);
|
||||||
|
img_fol->set_out_format = 0;
|
||||||
|
do {
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'i': /* input file */
|
||||||
|
{
|
||||||
|
char *infile = opj_optarg;
|
||||||
|
parameters->decod_format = infile_format(infile);
|
||||||
|
switch(parameters->decod_format) {
|
||||||
|
case J2K_CFMT:
|
||||||
|
break;
|
||||||
|
case JP2_CFMT:
|
||||||
|
break;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'v': /* Verbose mode */
|
||||||
|
{
|
||||||
|
parameters->m_verbose = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
|
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 debug callback expecting no client object
|
||||||
|
*/
|
||||||
|
static void error_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[ERROR] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample warning debug callback expecting no client object
|
||||||
|
*/
|
||||||
|
static void warning_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[WARNING] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample debug callback expecting no client object
|
||||||
|
*/
|
||||||
|
static void info_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* OPJ_DUMP MAIN
|
||||||
|
*/
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FILE *fsrc = NULL, *fout = NULL;
|
||||||
|
|
||||||
|
opj_dparameters_t parameters; /* Decompression parameters */
|
||||||
|
opj_image_t* image = NULL; /* Image structure */
|
||||||
|
opj_codec_t* l_codec = NULL; /* Handle to a decompressor */
|
||||||
|
opj_stream_t *l_stream = NULL; /* Stream */
|
||||||
|
opj_codestream_info_v2_t* cstr_info = NULL;
|
||||||
|
opj_codestream_index_t* cstr_index = NULL;
|
||||||
|
|
||||||
|
OPJ_INT32 num_images, imageno;
|
||||||
|
img_fol_t img_fol;
|
||||||
|
dircnt_t *dirptr = NULL;
|
||||||
|
|
||||||
|
#ifdef MSD
|
||||||
|
OPJ_BOOL l_go_on = OPJ_TRUE;
|
||||||
|
OPJ_UINT32 l_max_data_size = 1000;
|
||||||
|
OPJ_BYTE * l_data = (OPJ_BYTE *) malloc(1000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* Initialize img_fol */
|
||||||
|
memset(&img_fol,0,sizeof(img_fol_t));
|
||||||
|
|
||||||
|
/* Parse input and get user encoding parameters */
|
||||||
|
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize reading of directory */
|
||||||
|
if(img_fol.set_imgdir==1){
|
||||||
|
int it_image;
|
||||||
|
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 EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(it_image=0;it_image<num_images;it_image++){
|
||||||
|
dirptr->filename[it_image] = dirptr->filename_buf + it_image*OPJ_PATH_LEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_images==0){
|
||||||
|
fprintf(stdout,"Folder is empty\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
num_images=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to open for writing the output file if necessary */
|
||||||
|
if (parameters.outfile[0] != 0){
|
||||||
|
fout = fopen(parameters.outfile,"w");
|
||||||
|
if (!fout){
|
||||||
|
fprintf(stderr, "ERROR -> failed to open %s for writing\n", parameters.outfile);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fout = stdout;
|
||||||
|
|
||||||
|
/* Read the header of each image one by one */
|
||||||
|
for(imageno = 0; imageno < num_images ; imageno++){
|
||||||
|
|
||||||
|
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 EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
l_stream = opj_stream_create_default_file_stream(fsrc,1);
|
||||||
|
if (!l_stream){
|
||||||
|
fclose(fsrc);
|
||||||
|
fprintf(stderr, "ERROR -> failed to create the stream from the file\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the JPEG2000 stream */
|
||||||
|
/* ------------------------ */
|
||||||
|
|
||||||
|
switch(parameters.decod_format) {
|
||||||
|
case J2K_CFMT: /* JPEG-2000 codestream */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_J2K);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case JP2_CFMT: /* JPEG 2000 compressed image data */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_JP2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case JPT_CFMT: /* JPEG 2000, JPIP */
|
||||||
|
{
|
||||||
|
/* Get a decoder handle */
|
||||||
|
l_codec = opj_create_decompress(OPJ_CODEC_JPT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "skipping file..\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_info_handler(l_codec, info_callback,00);
|
||||||
|
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||||
|
opj_set_error_handler(l_codec, error_callback,00);
|
||||||
|
|
||||||
|
/* Setup the decoder decoding parameters using user parameters */
|
||||||
|
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||||
|
fprintf(stderr, "ERROR -> opj_dump: failed to setup the decoder\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
fclose(fout);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||||
|
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||||
|
fprintf(stderr, "ERROR -> opj_dump: failed to read the header\n");
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
opj_image_destroy(image);
|
||||||
|
fclose(fout);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
opj_dump_codec(l_codec, OPJ_IMG_INFO | OPJ_J2K_MH_INFO | OPJ_J2K_MH_IND, fout );
|
||||||
|
|
||||||
|
cstr_info = opj_get_cstr_info(l_codec);
|
||||||
|
|
||||||
|
cstr_index = opj_get_cstr_index(l_codec);
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_stream_destroy(l_stream);
|
||||||
|
fclose(fsrc);
|
||||||
|
|
||||||
|
/* free remaining structures */
|
||||||
|
if (l_codec) {
|
||||||
|
opj_destroy_codec(l_codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* destroy the image header */
|
||||||
|
opj_image_destroy(image);
|
||||||
|
|
||||||
|
/* destroy the codestream index */
|
||||||
|
opj_destroy_cstr_index(&cstr_index);
|
||||||
|
|
||||||
|
/* destroy the codestream info */
|
||||||
|
opj_destroy_cstr_info(&cstr_info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the output file */
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
41
src/bin/jp3d/CMakeLists.txt
Normal file
41
src/bin/jp3d/CMakeLists.txt
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Build the demo app, small examples
|
||||||
|
|
||||||
|
# First thing define the common source:
|
||||||
|
SET(common_SRCS
|
||||||
|
convert.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Headers file are located here:
|
||||||
|
include_directories(
|
||||||
|
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/lib/openjp3d
|
||||||
|
${LCMS_INCLUDE_DIRNAME}
|
||||||
|
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||||
|
${Z_INCLUDE_DIRNAME}
|
||||||
|
${PNG_INCLUDE_DIRNAME}
|
||||||
|
${TIFF_INCLUDE_DIRNAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
add_definitions(-DOPJ_EXPORTS)
|
||||||
|
else()
|
||||||
|
add_definitions(-DOPJ_STATIC)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Loop over all executables:
|
||||||
|
FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
|
||||||
|
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} openjp3d)
|
||||||
|
# On unix you need to link to the math library:
|
||||||
|
IF(UNIX)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} m)
|
||||||
|
ENDIF(UNIX)
|
||||||
|
# Install exe
|
||||||
|
INSTALL(TARGETS ${exe}
|
||||||
|
EXPORT OpenJP3DTargets
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
997
src/bin/jp3d/convert.c
Executable file
997
src/bin/jp3d/convert.c
Executable file
@@ -0,0 +1,997 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* Copyright (c) 2006, M<>nica D<>ez Garc<72>a, Image Processing Laboratory, University of Valladolid, Spain
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "openjp3d.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "windirent.h"
|
||||||
|
#else
|
||||||
|
#include <dirent.h>
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void dump_volume(FILE *fd, opj_volume_t * vol) {
|
||||||
|
int compno;
|
||||||
|
fprintf(fd, "volume {\n");
|
||||||
|
fprintf(fd, " x0=%d, y0=%d, z0=%d, x1=%d, y1=%d, z1=%d\n", vol->x0, vol->y0, vol->z0,vol->x1, vol->y1, vol->z1);
|
||||||
|
fprintf(fd, " numcomps=%d\n", vol->numcomps);
|
||||||
|
for (compno = 0; compno < vol->numcomps; compno++) {
|
||||||
|
opj_volume_comp_t *comp = &vol->comps[compno];
|
||||||
|
fprintf(fd, " comp %d {\n", compno);
|
||||||
|
fprintf(fd, " dx=%d, dy=%d, dz=%d\n", comp->dx, comp->dy, comp->dz);
|
||||||
|
fprintf(fd, " prec=%d\n", comp->prec);
|
||||||
|
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
||||||
|
fprintf(fd, " }\n");
|
||||||
|
}
|
||||||
|
fprintf(fd, "}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get logarithm of an integer and round downwards.
|
||||||
|
*
|
||||||
|
* log2(a)
|
||||||
|
*/
|
||||||
|
static int int_floorlog2(int a) {
|
||||||
|
int l;
|
||||||
|
for (l = 0; a > 1; l++) {
|
||||||
|
a >>= 1;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Divide an integer by a power of 2 and round upwards.
|
||||||
|
*
|
||||||
|
* a divided by 2^b
|
||||||
|
*/
|
||||||
|
static int int_ceildivpow2(int a, int b) {
|
||||||
|
return (a + (1 << b) - 1) >> b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Divide an integer and round upwards.
|
||||||
|
*
|
||||||
|
* a divided by b
|
||||||
|
*/
|
||||||
|
static int int_ceildiv(int a, int b) {
|
||||||
|
return (a + b - 1) / b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -->> -->> -->> -->>
|
||||||
|
|
||||||
|
PGX IMAGE FORMAT
|
||||||
|
|
||||||
|
<<-- <<-- <<-- <<-- */
|
||||||
|
|
||||||
|
|
||||||
|
unsigned char readuchar(FILE * f)
|
||||||
|
{
|
||||||
|
unsigned char c1;
|
||||||
|
fread(&c1, 1, 1, f);
|
||||||
|
return c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short readushort(FILE * f, int bigendian)
|
||||||
|
{
|
||||||
|
unsigned char c1, c2;
|
||||||
|
fread(&c1, 1, 1, f);
|
||||||
|
fread(&c2, 1, 1, f);
|
||||||
|
if (bigendian)
|
||||||
|
return (c1 << 8) + c2;
|
||||||
|
else
|
||||||
|
return (c2 << 8) + c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int readuint(FILE * f, int bigendian)
|
||||||
|
{
|
||||||
|
unsigned char c1, c2, c3, c4;
|
||||||
|
fread(&c1, 1, 1, f);
|
||||||
|
fread(&c2, 1, 1, f);
|
||||||
|
fread(&c3, 1, 1, f);
|
||||||
|
fread(&c4, 1, 1, f);
|
||||||
|
if (bigendian)
|
||||||
|
return (c1 << 24) + (c2 << 16) + (c3 << 8) + c4;
|
||||||
|
else
|
||||||
|
return (c4 << 24) + (c3 << 16) + (c2 << 8) + c1;
|
||||||
|
}
|
||||||
|
/*****************************************/
|
||||||
|
static unsigned short ShortSwap(unsigned short v)
|
||||||
|
{
|
||||||
|
unsigned char c1, c2;
|
||||||
|
c1 = v & 0xff;
|
||||||
|
c2 = (v >> 8) & 0xff;
|
||||||
|
return (c1 << 8) + c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int LongSwap (unsigned int i)
|
||||||
|
{
|
||||||
|
unsigned char b1, b2, b3, b4;
|
||||||
|
b1 = i & 255;
|
||||||
|
b2 = ( i >> 8 ) & 255;
|
||||||
|
b3 = ( i>>16 ) & 255;
|
||||||
|
b4 = ( i>>24 ) & 255;
|
||||||
|
return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
|
||||||
|
}
|
||||||
|
/*****************************************/
|
||||||
|
|
||||||
|
opj_volume_t* pgxtovolume(char *relpath, opj_cparameters_t *parameters) {
|
||||||
|
|
||||||
|
FILE *f = NULL;
|
||||||
|
int w, h, prec;
|
||||||
|
unsigned long offset;
|
||||||
|
int i, s, numcomps, maxvalue, sliceno, slicepos, maxslice = 0;
|
||||||
|
|
||||||
|
OPJ_COLOR_SPACE color_space;
|
||||||
|
opj_volume_cmptparm_t cmptparm; /* maximum of 1 component */
|
||||||
|
opj_volume_t * volume = NULL;
|
||||||
|
|
||||||
|
char endian1,endian2,sign;
|
||||||
|
char signtmp[32];
|
||||||
|
char temp[32];
|
||||||
|
opj_volume_comp_t *comp = NULL;
|
||||||
|
|
||||||
|
DIR *dirp;
|
||||||
|
struct dirent *direntp;
|
||||||
|
|
||||||
|
char *tmp = NULL, *tmp2 = NULL,
|
||||||
|
*point = NULL, *pgx = NULL;
|
||||||
|
char tmpdirpath[MAX_PATH];
|
||||||
|
char dirpath[MAX_PATH];
|
||||||
|
char pattern[MAX_PATH];
|
||||||
|
char pgxfiles[MAX_SLICES][MAX_PATH];
|
||||||
|
int pgxslicepos[MAX_SLICES];
|
||||||
|
char tmpno[3];
|
||||||
|
|
||||||
|
numcomps = 1;
|
||||||
|
color_space = CLRSPC_GRAY;
|
||||||
|
sliceno = 0;
|
||||||
|
maxvalue = 0;
|
||||||
|
memset(pgxfiles, 0, MAX_SLICES * MAX_PATH * sizeof(char));
|
||||||
|
memset(&cmptparm, 0, sizeof(opj_volume_cmptparm_t));
|
||||||
|
|
||||||
|
/* Separaci<63>n del caso de un <20>nico slice frente al de muchos */
|
||||||
|
if ((tmp = strrchr(relpath,'-')) == NULL){
|
||||||
|
/*fprintf(stdout,"[INFO] A volume of only one slice....\n");*/
|
||||||
|
sliceno = 1;
|
||||||
|
maxslice = 1;
|
||||||
|
strcpy(pgxfiles[0],relpath);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/*Fetch only the path */
|
||||||
|
strcpy(tmpdirpath,relpath);
|
||||||
|
if ((tmp = strrchr(tmpdirpath,'/')) != NULL){
|
||||||
|
tmp++; *tmp='\0';
|
||||||
|
strcpy(dirpath,tmpdirpath);
|
||||||
|
} else {
|
||||||
|
strcpy(dirpath,"./");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Fetch the pattern of the volume slices*/
|
||||||
|
if ((tmp = strrchr (relpath,'/')) != NULL)
|
||||||
|
tmp++;
|
||||||
|
else
|
||||||
|
tmp = relpath;
|
||||||
|
if ((tmp2 = strrchr(tmp,'-')) != NULL)
|
||||||
|
*tmp2='\0';
|
||||||
|
else{
|
||||||
|
fprintf(stdout, "[ERROR] tmp2 ha dado null. no ha encontrado el * %s %s",tmp,relpath);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
strcpy(pattern,tmp);
|
||||||
|
|
||||||
|
dirp = opendir( dirpath );
|
||||||
|
if (dirp == NULL){
|
||||||
|
fprintf(stdout, "[ERROR] Infile must be a .pgx file or a directory that contain pgx files");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Read all .pgx files of directory */
|
||||||
|
while ( (direntp = readdir( dirp )) != NULL )
|
||||||
|
{
|
||||||
|
/* Found a directory, but ignore . and .. */
|
||||||
|
if(strcmp(".",direntp->d_name) == 0 || strcmp("..",direntp->d_name) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( ((pgx = strstr(direntp->d_name,pattern)) != NULL) && ((tmp2 = strstr(direntp->d_name,".pgx")) != NULL) ){
|
||||||
|
|
||||||
|
strcpy(tmp,dirpath);
|
||||||
|
tmp = strcat(tmp,direntp->d_name);
|
||||||
|
|
||||||
|
/*Obtenemos el index de la secuencia de slices*/
|
||||||
|
if ((tmp2 = strpbrk (direntp->d_name, "0123456789")) == NULL)
|
||||||
|
continue;
|
||||||
|
i = 0;
|
||||||
|
while (tmp2 != NULL) {
|
||||||
|
tmpno[i++] = *tmp2;
|
||||||
|
point = tmp2;
|
||||||
|
tmp2 = strpbrk (tmp2+1,"0123456789");
|
||||||
|
}tmpno[i]='\0';
|
||||||
|
|
||||||
|
/*Comprobamos que no estamos leyendo algo raro como pattern.jp3d*/
|
||||||
|
if ((point = strpbrk (point,".")) == NULL){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*Slicepos --> index de slice; Sliceno --> no de slices hasta el momento*/
|
||||||
|
slicepos = atoi(tmpno);
|
||||||
|
pgxslicepos[sliceno] = slicepos - 1;
|
||||||
|
sliceno++;
|
||||||
|
if (slicepos>maxslice)
|
||||||
|
maxslice = slicepos;
|
||||||
|
|
||||||
|
/*Colocamos el slices en su posicion correspondiente*/
|
||||||
|
strcpy(pgxfiles[slicepos-1],tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}/* else if pattern*.pgx */
|
||||||
|
|
||||||
|
if (!sliceno) {
|
||||||
|
fprintf(stdout,"[ERROR] No slices with this pattern founded !! Please check input volume name\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/*if ( maxslice != sliceno) {
|
||||||
|
fprintf(stdout,"[ERROR] Slices are not sequentially numbered !! Please rename them accordingly\n");
|
||||||
|
return NULL;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (s=0;s<sliceno;s++)
|
||||||
|
{
|
||||||
|
int pos = maxslice == sliceno ? s: pgxslicepos[s];
|
||||||
|
f = fopen(pgxfiles[pos], "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for reading !\n", pgxfiles[s]);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
fprintf(stdout, "[INFO] Loading %s \n",pgxfiles[pos]);
|
||||||
|
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d",temp,&endian1,&endian2,signtmp,&prec,temp,&w,temp,&h);
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
sign='+';
|
||||||
|
while (signtmp[i]!='\0') {
|
||||||
|
if (signtmp[i]=='-') sign='-';
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fgetc(f);
|
||||||
|
if (endian1=='M' && endian2=='L') {
|
||||||
|
cmptparm.bigendian = 1;
|
||||||
|
} else if (endian2=='M' && endian1=='L') {
|
||||||
|
cmptparm.bigendian = 0;
|
||||||
|
} else {
|
||||||
|
fprintf(stdout, "[ERROR] Bad pgx header, please check input file\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s==0){
|
||||||
|
/* initialize volume component */
|
||||||
|
|
||||||
|
cmptparm.x0 = parameters->volume_offset_x0;
|
||||||
|
cmptparm.y0 = parameters->volume_offset_y0;
|
||||||
|
cmptparm.z0 = parameters->volume_offset_z0;
|
||||||
|
cmptparm.w = !cmptparm.x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm.x0 + (w - 1) * parameters->subsampling_dx + 1;
|
||||||
|
cmptparm.h = !cmptparm.y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm.y0 + (h - 1) * parameters->subsampling_dy + 1;
|
||||||
|
cmptparm.l = !cmptparm.z0 ? (sliceno - 1) * parameters->subsampling_dz + 1 : cmptparm.z0 + (sliceno - 1) * parameters->subsampling_dz + 1;
|
||||||
|
|
||||||
|
if (sign == '-') {
|
||||||
|
cmptparm.sgnd = 1;
|
||||||
|
} else {
|
||||||
|
cmptparm.sgnd = 0;
|
||||||
|
}
|
||||||
|
cmptparm.prec = prec;
|
||||||
|
cmptparm.bpp = prec;
|
||||||
|
cmptparm.dcoffset = parameters->dcoffset;
|
||||||
|
cmptparm.dx = parameters->subsampling_dx;
|
||||||
|
cmptparm.dy = parameters->subsampling_dy;
|
||||||
|
cmptparm.dz = parameters->subsampling_dz;
|
||||||
|
|
||||||
|
/* create the volume */
|
||||||
|
volume = opj_volume_create(numcomps, &cmptparm, color_space);
|
||||||
|
if(!volume) {
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* set volume offset and reference grid */
|
||||||
|
volume->x0 = cmptparm.x0;
|
||||||
|
volume->y0 = cmptparm.y0;
|
||||||
|
volume->z0 = cmptparm.z0;
|
||||||
|
volume->x1 = cmptparm.w;
|
||||||
|
volume->y1 = cmptparm.h;
|
||||||
|
volume->z1 = cmptparm.l;
|
||||||
|
|
||||||
|
/* set volume data :only one component, that is a volume*/
|
||||||
|
comp = &volume->comps[0];
|
||||||
|
|
||||||
|
}/*if sliceno==1*/
|
||||||
|
|
||||||
|
offset = w * h * s;
|
||||||
|
|
||||||
|
for (i = 0; i < w * h; i++) {
|
||||||
|
int v;
|
||||||
|
if (comp->prec <= 8) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuchar(f);
|
||||||
|
} else {
|
||||||
|
v = (char) readuchar(f);
|
||||||
|
}
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readushort(f, cmptparm.bigendian);
|
||||||
|
} else {
|
||||||
|
v = (short) readushort(f, cmptparm.bigendian);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuint(f, cmptparm.bigendian);
|
||||||
|
} else {
|
||||||
|
v = (int) readuint(f, cmptparm.bigendian);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v > maxvalue)
|
||||||
|
maxvalue = v;
|
||||||
|
comp->data[i + offset] = v;
|
||||||
|
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
} /* for s --> sliceno*/
|
||||||
|
comp->bpp = int_floorlog2(maxvalue) + 1;
|
||||||
|
if (sliceno != 1)
|
||||||
|
closedir( dirp );
|
||||||
|
/*dump_volume(stdout, volume);*/
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int volumetopgx(opj_volume_t * volume, char *outfile) {
|
||||||
|
int w, wr, wrr, h, hr, hrr, l, lr, lrr;
|
||||||
|
int i, j, compno, offset, sliceno;
|
||||||
|
FILE *fdest = NULL;
|
||||||
|
|
||||||
|
for (compno = 0; compno < volume->numcomps; compno++) {
|
||||||
|
opj_volume_comp_t *comp = &volume->comps[compno];
|
||||||
|
char name[256];
|
||||||
|
int nbytes = 0;
|
||||||
|
char *tmp = outfile;
|
||||||
|
while (*tmp) {
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
while (*tmp!='.') {
|
||||||
|
tmp--;
|
||||||
|
}
|
||||||
|
*tmp='\0';
|
||||||
|
for(sliceno = 0; sliceno < volume->z1 - volume->z0; sliceno++) {
|
||||||
|
|
||||||
|
if (volume->numcomps > 1) {
|
||||||
|
sprintf(name, "%s%d-%d.pgx", outfile, sliceno+1, compno);
|
||||||
|
} else if ((volume->z1 - volume->z0) > 1) {
|
||||||
|
sprintf(name, "%s%d.pgx", outfile, sliceno+1);
|
||||||
|
} else {
|
||||||
|
sprintf(name, "%s.pgx", outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
fdest = fopen(name, "wb");
|
||||||
|
if (!fdest) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for writing \n", name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stdout,"[INFO] Writing in %s (%s)\n",name,volume->comps[0].bigendian ? "Bigendian" : "Little-endian");
|
||||||
|
|
||||||
|
w = int_ceildiv(volume->x1 - volume->x0, volume->comps[compno].dx);
|
||||||
|
wr = volume->comps[compno].w;
|
||||||
|
wrr = int_ceildivpow2(volume->comps[compno].w, volume->comps[compno].factor[0]);
|
||||||
|
|
||||||
|
h = int_ceildiv(volume->y1 - volume->y0, volume->comps[compno].dy);
|
||||||
|
hr = volume->comps[compno].h;
|
||||||
|
hrr = int_ceildivpow2(volume->comps[compno].h, volume->comps[compno].factor[1]);
|
||||||
|
|
||||||
|
l = int_ceildiv(volume->z1 - volume->z0, volume->comps[compno].dz);
|
||||||
|
lr = volume->comps[compno].l;
|
||||||
|
lrr = int_ceildivpow2(volume->comps[compno].l, volume->comps[compno].factor[2]);
|
||||||
|
|
||||||
|
fprintf(fdest, "PG %c%c %c%d %d %d\n", comp->bigendian ? 'M':'L', comp->bigendian ? 'L':'M',comp->sgnd ? '-' : '+', comp->prec, wr, hr);
|
||||||
|
if (comp->prec <= 8) {
|
||||||
|
nbytes = 1;
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
nbytes = 2;
|
||||||
|
} else {
|
||||||
|
nbytes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = (sliceno / lrr * l) + (sliceno % lrr);
|
||||||
|
offset = wrr * hrr * offset;
|
||||||
|
/*fprintf(stdout,"%d %d %d %d\n",offset,wrr*hrr,wrr,w);*/
|
||||||
|
for (i = 0; i < wrr * hrr; i++) {
|
||||||
|
int v = volume->comps[0].data[(i / wrr * w) + (i % wrr) + offset];
|
||||||
|
if (volume->comps[0].bigendian) {
|
||||||
|
for (j = nbytes - 1; j >= 0; j--) {
|
||||||
|
char byte = (char) ((v >> (j * 8)) & 0xff);
|
||||||
|
fwrite(&byte, 1, 1, fdest);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (j = 0; j <= nbytes - 1; j++) {
|
||||||
|
char byte = (char) ((v >> (j * 8)) & 0xff);
|
||||||
|
fwrite(&byte, 1, 1, fdest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fdest);
|
||||||
|
}/*for sliceno*/
|
||||||
|
}/*for compno*/
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -->> -->> -->> -->>
|
||||||
|
|
||||||
|
BIN IMAGE FORMAT
|
||||||
|
|
||||||
|
<<-- <<-- <<-- <<-- */
|
||||||
|
|
||||||
|
opj_volume_t* bintovolume(char *filename, char *fileimg, opj_cparameters_t *parameters) {
|
||||||
|
int subsampling_dx = parameters->subsampling_dx;
|
||||||
|
int subsampling_dy = parameters->subsampling_dy;
|
||||||
|
int subsampling_dz = parameters->subsampling_dz;
|
||||||
|
|
||||||
|
int i, compno, w, h, l, numcomps = 1;
|
||||||
|
int prec, max = 0;
|
||||||
|
|
||||||
|
/* char temp[32];*/
|
||||||
|
char line[100];
|
||||||
|
int bigendian;
|
||||||
|
|
||||||
|
FILE *f = NULL;
|
||||||
|
FILE *fimg = NULL;
|
||||||
|
OPJ_COLOR_SPACE color_space;
|
||||||
|
opj_volume_cmptparm_t cmptparm; /* maximum of 1 component */
|
||||||
|
opj_volume_t * volume = NULL;
|
||||||
|
opj_volume_comp_t *comp = NULL;
|
||||||
|
|
||||||
|
bigendian = 0;
|
||||||
|
color_space = CLRSPC_GRAY;
|
||||||
|
|
||||||
|
fimg = fopen(fileimg,"r");
|
||||||
|
if (!fimg) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for reading !!\n", fileimg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(fimg, 0, SEEK_SET);
|
||||||
|
while (!feof(fimg)) {
|
||||||
|
fgets(line,100,fimg);
|
||||||
|
/*fprintf(stdout,"%s %d \n",line,feof(fimg));*/
|
||||||
|
if (strncmp(line,"Bpp",3) == 0){
|
||||||
|
sscanf(line,"%*s%*[ \t]%d",&prec);
|
||||||
|
} else if (strncmp(line,"Color",5) == 0){
|
||||||
|
sscanf(line, "%*s%*[ \t]%d",&color_space);
|
||||||
|
} else if (strncmp(line,"Dim",3) == 0){
|
||||||
|
sscanf(line, "%*s%*[ \t]%d%*[ \t]%d%*[ \t]%d",&w,&h,&l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*fscanf(fimg, "Bpp%[ \t]%d%[ \t\n]",temp,&prec,temp);*/
|
||||||
|
/*fscanf(fimg, "Color Map%[ \t]%d%[ \n\t]Dimensions%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&color_space,temp,temp,&w,temp,&h,temp,&l,temp);*/
|
||||||
|
/*fscanf(fimg, "Resolution(mm)%[ \t]%d%[ \t]%d%[ \t]%d%[ \n\t]",temp,&subsampling_dx,temp,&subsampling_dy,temp,&subsampling_dz,temp);*/
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
fprintf(stdout, "[INFO] %d \t %d %d %d \t %3.2f %2.2f %2.2f \t %d \n",color_space,w,h,l,subsampling_dx,subsampling_dy,subsampling_dz,prec);
|
||||||
|
#endif
|
||||||
|
fclose(fimg);
|
||||||
|
|
||||||
|
/* initialize volume components */
|
||||||
|
memset(&cmptparm, 0, sizeof(opj_volume_cmptparm_t));
|
||||||
|
|
||||||
|
cmptparm.prec = prec;
|
||||||
|
cmptparm.bpp = prec;
|
||||||
|
cmptparm.sgnd = 0;
|
||||||
|
cmptparm.bigendian = bigendian;
|
||||||
|
cmptparm.dcoffset = parameters->dcoffset;
|
||||||
|
cmptparm.dx = subsampling_dx;
|
||||||
|
cmptparm.dy = subsampling_dy;
|
||||||
|
cmptparm.dz = subsampling_dz;
|
||||||
|
cmptparm.w = w;
|
||||||
|
cmptparm.h = h;
|
||||||
|
cmptparm.l = l;
|
||||||
|
|
||||||
|
/* create the volume */
|
||||||
|
volume = opj_volume_create(numcomps, &cmptparm, color_space);
|
||||||
|
if(!volume) {
|
||||||
|
fprintf(stdout,"[ERROR] Unable to create volume");
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set volume offset and reference grid */
|
||||||
|
volume->x0 = parameters->volume_offset_x0;
|
||||||
|
volume->y0 = parameters->volume_offset_y0;
|
||||||
|
volume->z0 = parameters->volume_offset_z0;
|
||||||
|
volume->x1 = parameters->volume_offset_x0 + (w - 1) * subsampling_dx + 1;
|
||||||
|
volume->y1 = parameters->volume_offset_y0 + (h - 1) * subsampling_dy + 1;
|
||||||
|
volume->z1 = parameters->volume_offset_z0 + (l - 1) * subsampling_dz + 1;
|
||||||
|
|
||||||
|
/* set volume data */
|
||||||
|
f = fopen(filename, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for reading !!\n", filename);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BINARY */
|
||||||
|
for (compno = 0; compno < volume->numcomps; compno++) {
|
||||||
|
int whl = w * h * l;
|
||||||
|
/* set volume data */
|
||||||
|
comp = &volume->comps[compno];
|
||||||
|
|
||||||
|
/*if (comp->prec <= 8) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned char *data = (unsigned char *) malloc(whl * sizeof(unsigned char));
|
||||||
|
fread(data, 1, whl, f);
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
char *data = (char *) malloc(whl);
|
||||||
|
fread(data, 1, whl, f);
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned short *data = (unsigned short *) malloc(whl * sizeof(unsigned short));
|
||||||
|
int leido = fread(data, 2, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (bigendian) //(c1 << 8) + c2;
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
else{ //(c2 << 8) + c1;
|
||||||
|
comp->data[i] = ShortSwap(data[i]);
|
||||||
|
}
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
short *data = (short *) malloc(whl);
|
||||||
|
int leido = fread(data, 2, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (bigendian){ //(c1 << 8) + c2;
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
}else{ //(c2 << 8) + c1;
|
||||||
|
comp->data[i] = (short) ShortSwap((unsigned short) data[i]);
|
||||||
|
}
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned int *data = (unsigned int *) malloc(whl * sizeof(unsigned int));
|
||||||
|
int leido = fread(data, 4, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
} for (i = 0; i < whl; i++) {
|
||||||
|
if (!bigendian)
|
||||||
|
comp->data[i] = LongSwap(data[i]);
|
||||||
|
else
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
int leido = fread(comp->data, 4, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (!bigendian)
|
||||||
|
comp->data[i] = (int) LongSwap((unsigned int) comp->data[i]);
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
int v;
|
||||||
|
if (comp->prec <= 8) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuchar(f);
|
||||||
|
} else {
|
||||||
|
v = (char) readuchar(f);
|
||||||
|
}
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readushort(f, bigendian);
|
||||||
|
} else {
|
||||||
|
v = (short) readushort(f, bigendian);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuint(f, bigendian);
|
||||||
|
} else {
|
||||||
|
v = (int) readuint(f, bigendian);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v > max)
|
||||||
|
max = v;
|
||||||
|
comp->data[i] = v;
|
||||||
|
}
|
||||||
|
comp->bpp = int_floorlog2(max) + 1;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
int volumetobin(opj_volume_t * volume, char *outfile) {
|
||||||
|
int w, wr, wrr, h, hr, hrr, l, lr, lrr, max;
|
||||||
|
int i,j, compno, nbytes;
|
||||||
|
int offset, sliceno;
|
||||||
|
FILE *fdest = NULL;
|
||||||
|
FILE *fimgdest = NULL;
|
||||||
|
/* char *imgtemp;*/
|
||||||
|
char name[256];
|
||||||
|
|
||||||
|
for (compno = 0; compno < 1; compno++) { /*Only one component*/
|
||||||
|
|
||||||
|
fdest = fopen(outfile, "wb");
|
||||||
|
if (!fdest) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fprintf(stdout,"[INFO] Writing outfile %s (%s) \n",outfile, volume->comps[0].bigendian ? "Bigendian" : "Little-endian");
|
||||||
|
|
||||||
|
w = int_ceildiv(volume->x1 - volume->x0, volume->comps[compno].dx);
|
||||||
|
wr = volume->comps[compno].w;
|
||||||
|
wrr = int_ceildivpow2(volume->comps[compno].w, volume->comps[compno].factor[0]);
|
||||||
|
|
||||||
|
h = int_ceildiv(volume->y1 - volume->y0, volume->comps[compno].dy);
|
||||||
|
hr = volume->comps[compno].h;
|
||||||
|
hrr = int_ceildivpow2(volume->comps[compno].h, volume->comps[compno].factor[1]);
|
||||||
|
|
||||||
|
l = int_ceildiv(volume->z1 - volume->z0, volume->comps[compno].dz);
|
||||||
|
lr = volume->comps[compno].l;
|
||||||
|
lrr = int_ceildivpow2(volume->comps[compno].l, volume->comps[compno].factor[2]);
|
||||||
|
|
||||||
|
max = (volume->comps[compno].prec <= 8) ? 255 : (1 << volume->comps[compno].prec) - 1;
|
||||||
|
|
||||||
|
volume->comps[compno].x0 = int_ceildivpow2(volume->comps[compno].x0 - int_ceildiv(volume->x0, volume->comps[compno].dx), volume->comps[compno].factor[0]);
|
||||||
|
volume->comps[compno].y0 = int_ceildivpow2(volume->comps[compno].y0 - int_ceildiv(volume->y0, volume->comps[compno].dy), volume->comps[compno].factor[1]);
|
||||||
|
volume->comps[compno].z0 = int_ceildivpow2(volume->comps[compno].z0 - int_ceildiv(volume->z0, volume->comps[compno].dz), volume->comps[compno].factor[2]);
|
||||||
|
|
||||||
|
if (volume->comps[0].prec <= 8) {
|
||||||
|
nbytes = 1;
|
||||||
|
} else if (volume->comps[0].prec <= 16) {
|
||||||
|
nbytes = 2;
|
||||||
|
} else {
|
||||||
|
nbytes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*fprintf(stdout,"w %d wr %d wrr %d h %d hr %d hrr %d l %d lr %d lrr %d max %d nbytes %d\n Factor %d %d %d",w,wr,wrr,h,hr,hrr,l,lr,lrr,max,nbytes,volume->comps[compno].factor[0],volume->comps[compno].factor[1],volume->comps[compno].factor[2]);*/
|
||||||
|
|
||||||
|
for(sliceno = 0; sliceno < lrr; sliceno++) {
|
||||||
|
offset = (sliceno / lrr * l) + (sliceno % lrr);
|
||||||
|
offset = wrr * hrr * offset;
|
||||||
|
for (i = 0; i < wrr * hrr; i++) {
|
||||||
|
int v = volume->comps[0].data[(i / wrr * w) + (i % wrr) + offset];
|
||||||
|
if (volume->comps[0].bigendian) {
|
||||||
|
for (j = nbytes - 1; j >= 0; j--) {
|
||||||
|
char byte = (char) ((v >> (j * 8)) & 0xff);
|
||||||
|
fwrite(&byte, 1, 1, fdest);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (j = 0; j <= nbytes - 1; j++) {
|
||||||
|
char byte = (char) ((v >> (j * 8)) & 0xff);
|
||||||
|
fwrite(&byte, 1, 1, fdest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fdest);
|
||||||
|
|
||||||
|
sprintf(name,"%s.img",outfile);
|
||||||
|
fimgdest = fopen(name, "w");
|
||||||
|
if (!fimgdest) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fprintf(fimgdest, "Bpp\t%d\nColor Map\t2\nDimensions\t%d\t%d\t%d\nResolution(mm)\t%d\t%d\t%d\t\n",
|
||||||
|
volume->comps[0].prec,wrr,hrr,lrr,volume->comps[0].dx,volume->comps[0].dy,volume->comps[0].dz);
|
||||||
|
|
||||||
|
fclose(fimgdest);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* -->> -->> -->> -->>
|
||||||
|
|
||||||
|
IMG IMAGE FORMAT
|
||||||
|
|
||||||
|
<<-- <<-- <<-- <<-- */
|
||||||
|
opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters) {
|
||||||
|
int subsampling_dx = parameters->subsampling_dx;
|
||||||
|
int subsampling_dy = parameters->subsampling_dy;
|
||||||
|
int subsampling_dz = parameters->subsampling_dz;
|
||||||
|
|
||||||
|
int i, compno, w, h, l, numcomps = 1;
|
||||||
|
int prec, max = 0, min = 0;
|
||||||
|
float dx, dy, dz;
|
||||||
|
char filename[100], tmpdirpath[100], dirpath[100], *tmp;
|
||||||
|
char line[100], datatype[100];
|
||||||
|
int bigendian;
|
||||||
|
|
||||||
|
FILE *f = NULL;
|
||||||
|
FILE *fimg = NULL;
|
||||||
|
OPJ_COLOR_SPACE color_space;
|
||||||
|
opj_volume_cmptparm_t cmptparm; /* maximum of 1 component */
|
||||||
|
opj_volume_t * volume = NULL;
|
||||||
|
opj_volume_comp_t *comp = NULL;
|
||||||
|
|
||||||
|
bigendian = 0;
|
||||||
|
color_space = CLRSPC_GRAY;
|
||||||
|
|
||||||
|
fimg = fopen(fileimg,"r");
|
||||||
|
if (!fimg) {
|
||||||
|
fprintf(stderr, "[ERROR] Failed to open %s for reading !!\n", fileimg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Fetch only the path */
|
||||||
|
strcpy(tmpdirpath,fileimg);
|
||||||
|
if ((tmp = strrchr(tmpdirpath,'/')) != NULL){
|
||||||
|
tmp++; *tmp='\0';
|
||||||
|
strcpy(dirpath,tmpdirpath);
|
||||||
|
} else {
|
||||||
|
strcpy(dirpath,"./");
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(fimg, 0, SEEK_SET);
|
||||||
|
while (!feof(fimg)) {
|
||||||
|
fgets(line,100,fimg);
|
||||||
|
/*fprintf(stdout,"%s %d \n",line,feof(fimg));*/
|
||||||
|
if (strncmp(line,"Image",5) == 0){
|
||||||
|
sscanf(line,"%*s%*[ \t]%s",datatype);
|
||||||
|
} else if (strncmp(line,"File",4) == 0){
|
||||||
|
sscanf(line,"%*s %*s%*[ \t]%s",filename);
|
||||||
|
strcat(dirpath, filename);
|
||||||
|
strcpy(filename,dirpath);
|
||||||
|
} else if (strncmp(line,"Min",3) == 0){
|
||||||
|
sscanf(line,"%*s %*s%*[ \t]%d%*[ \t]%d",&min,&max);
|
||||||
|
prec = int_floorlog2(max - min + 1);
|
||||||
|
} else if (strncmp(line,"Bpp",3) == 0){
|
||||||
|
sscanf(line,"%*s%*[ \t]%d",&prec);
|
||||||
|
} else if (strncmp(line,"Color",5) == 0){
|
||||||
|
sscanf(line, "%*s %*s%*[ \t]%d",&color_space);
|
||||||
|
} else if (strncmp(line,"Dim",3) == 0){
|
||||||
|
sscanf(line, "%*s%*[ \t]%d%*[ \t]%d%*[ \t]%d",&w,&h,&l);
|
||||||
|
} else if (strncmp(line,"Res",3) == 0){
|
||||||
|
sscanf(line,"%*s%*[ \t]%f%*[ \t]%f%*[ \t]%f",&dx,&dy,&dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
fprintf(stdout, "[INFO] %s %d \t %d %d %d \t %f %f %f \t %d %d %d \n",filename,color_space,w,h,l,dx,dy,dz,max,min,prec);
|
||||||
|
#endif
|
||||||
|
fclose(fimg);
|
||||||
|
|
||||||
|
/* error control */
|
||||||
|
if ( !prec || !w || !h || !l ){
|
||||||
|
fprintf(stderr,"[ERROR] Unable to read IMG file correctly. Found some null values.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize volume components */
|
||||||
|
memset(&cmptparm, 0, sizeof(opj_volume_cmptparm_t));
|
||||||
|
|
||||||
|
cmptparm.prec = prec;
|
||||||
|
cmptparm.bpp = prec;
|
||||||
|
cmptparm.sgnd = 0;
|
||||||
|
cmptparm.bigendian = bigendian;
|
||||||
|
cmptparm.dcoffset = parameters->dcoffset;
|
||||||
|
cmptparm.dx = subsampling_dx;
|
||||||
|
cmptparm.dy = subsampling_dy;
|
||||||
|
cmptparm.dz = subsampling_dz;
|
||||||
|
cmptparm.w = w;
|
||||||
|
cmptparm.h = h;
|
||||||
|
cmptparm.l = l;
|
||||||
|
|
||||||
|
/* create the volume */
|
||||||
|
volume = opj_volume_create(numcomps, &cmptparm, color_space);
|
||||||
|
if(!volume) {
|
||||||
|
fprintf(stdout,"[ERROR] Unable to create volume");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set volume offset and reference grid */
|
||||||
|
volume->x0 = parameters->volume_offset_x0;
|
||||||
|
volume->y0 = parameters->volume_offset_y0;
|
||||||
|
volume->z0 = parameters->volume_offset_z0;
|
||||||
|
volume->x1 = parameters->volume_offset_x0 + (w - 1) * subsampling_dx + 1;
|
||||||
|
volume->y1 = parameters->volume_offset_y0 + (h - 1) * subsampling_dy + 1;
|
||||||
|
volume->z1 = parameters->volume_offset_z0 + (l - 1) * subsampling_dz + 1;
|
||||||
|
|
||||||
|
max = 0;
|
||||||
|
/* set volume data */
|
||||||
|
f = fopen(filename, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "[ERROR] Failed to open %s for reading !!\n", filename);
|
||||||
|
fclose(f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BINARY */
|
||||||
|
for (compno = 0; compno < volume->numcomps; compno++) {
|
||||||
|
int whl = w * h * l;
|
||||||
|
/* set volume data */
|
||||||
|
comp = &volume->comps[compno];
|
||||||
|
|
||||||
|
/*if (comp->prec <= 8) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned char *data = (unsigned char *) malloc(whl * sizeof(unsigned char));
|
||||||
|
fread(data, 1, whl, f);
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
char *data = (char *) malloc(whl);
|
||||||
|
fread(data, 1, whl, f);
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned short *data = (unsigned short *) malloc(whl * sizeof(unsigned short));
|
||||||
|
int leido = fread(data, 2, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (bigendian) //(c1 << 8) + c2;
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
else{ //(c2 << 8) + c1;
|
||||||
|
comp->data[i] = ShortSwap(data[i]);
|
||||||
|
}
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
short *data = (short *) malloc(whl);
|
||||||
|
int leido = fread(data, 2, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (bigendian){ //(c1 << 8) + c2;
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
}else{ //(c2 << 8) + c1;
|
||||||
|
comp->data[i] = (short) ShortSwap((unsigned short) data[i]);
|
||||||
|
}
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
unsigned int *data = (unsigned int *) malloc(whl * sizeof(unsigned int));
|
||||||
|
int leido = fread(data, 4, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
free(data); fclose(f);
|
||||||
|
return NULL;
|
||||||
|
} for (i = 0; i < whl; i++) {
|
||||||
|
if (!bigendian)
|
||||||
|
comp->data[i] = LongSwap(data[i]);
|
||||||
|
else
|
||||||
|
comp->data[i] = data[i];
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
} else {
|
||||||
|
int leido = fread(comp->data, 4, whl, f);
|
||||||
|
if (!leido) {
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
if (!bigendian)
|
||||||
|
comp->data[i] = (int) LongSwap((unsigned int) comp->data[i]);
|
||||||
|
if (comp->data[i] > max)
|
||||||
|
max = comp->data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (i = 0; i < whl; i++) {
|
||||||
|
int v;
|
||||||
|
if (comp->prec <= 8) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuchar(f);
|
||||||
|
} else {
|
||||||
|
v = (char) readuchar(f);
|
||||||
|
}
|
||||||
|
} else if (comp->prec <= 16) {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readushort(f, bigendian);
|
||||||
|
} else {
|
||||||
|
v = (short) readushort(f, bigendian);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!comp->sgnd) {
|
||||||
|
v = readuint(f, bigendian);
|
||||||
|
} else {
|
||||||
|
v = (int) readuint(f, bigendian);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v > max)
|
||||||
|
max = v;
|
||||||
|
comp->data[i] = v;
|
||||||
|
}
|
||||||
|
comp->bpp = int_floorlog2(max) + 1;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
51
src/bin/jp3d/convert.h
Executable file
51
src/bin/jp3d/convert.h
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* Copyright (c) 2006, M<>nica D<>ez Garc<72>a, Image Processing Laboratory, University of Valladolid, Spain
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#ifndef __JP3D_CONVERT_H
|
||||||
|
#define __JP3D_CONVERT_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
Load a single volume component encoded in PGX file format
|
||||||
|
@param filename Name of the PGX file to load
|
||||||
|
@param parameters *List ?*
|
||||||
|
@return Returns a greyscale volume if successful, returns NULL otherwise
|
||||||
|
*/
|
||||||
|
opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
int volumetopgx(opj_volume_t *volume, char *outfile);
|
||||||
|
|
||||||
|
opj_volume_t* bintovolume(char *filename,char *fileimg, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
int volumetobin(opj_volume_t *volume, char *outfile);
|
||||||
|
|
||||||
|
opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
#endif /* __J2K_CONVERT_H */
|
||||||
|
|
||||||
109
src/bin/jp3d/getopt.c
Executable file
109
src/bin/jp3d/getopt.c
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1987, 1993, 1994
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* last review : october 29th, 2002 */
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||||
|
|
||||||
|
# define __progname nargv[0] /* program name */
|
||||||
|
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
} /* option letter okay? */
|
||||||
|
|
||||||
|
if ((optopt = (int) *place++) == (int) ':' || !(oli = strchr(ostr, optopt))) {
|
||||||
|
/* if the user didn't specify '-' as an option, assume it means -1. */
|
||||||
|
if (optopt == (int) '-')
|
||||||
|
return (-1);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *ostr != ':')
|
||||||
|
(void) fprintf(stdout,"[ERROR] %s: illegal option -- %c\n", __progname, optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*++oli != ':') { /* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
} else { /* need an argument */
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (*ostr == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr)
|
||||||
|
(void) fprintf(stdout, "[ERROR] %s: option requires an argument -- %c\n", __progname, optopt);
|
||||||
|
return (BADCH);
|
||||||
|
} else /* white space */
|
||||||
|
optarg = nargv[optind];
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* dump back option letter */
|
||||||
|
}
|
||||||
14
src/bin/jp3d/getopt.h
Executable file
14
src/bin/jp3d/getopt.h
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
/* last review : october 29th, 2002 */
|
||||||
|
|
||||||
|
#ifndef _GETOPT_H_
|
||||||
|
#define _GETOPT_H_
|
||||||
|
|
||||||
|
extern int opterr;
|
||||||
|
extern int optind;
|
||||||
|
extern int optopt;
|
||||||
|
extern int optreset;
|
||||||
|
extern char *optarg;
|
||||||
|
|
||||||
|
extern int getopt(int nargc, char *const *nargv, const char *ostr);
|
||||||
|
|
||||||
|
#endif /* _GETOPT_H_ */
|
||||||
907
src/bin/jp3d/opj_jp3d_compress.c
Executable file
907
src/bin/jp3d/opj_jp3d_compress.c
Executable file
@@ -0,0 +1,907 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* Copyright (c) 2006, M<>nica D<>ez Garc<72>a, Image Processing Laboratory, University of Valladolid, Spain
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "opj_config.h"
|
||||||
|
#include "openjp3d.h"
|
||||||
|
#include "opj_getopt.h"
|
||||||
|
#include "convert.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define strnicmp strncasecmp
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void encode_help_display() {
|
||||||
|
fprintf(stdout,"List of parameters for the JPEG2000 Part 10 encoder:\n");
|
||||||
|
fprintf(stdout,"------------\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"Required Parameters (except with -h):\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-i : source file (-i source.bin or source*.pgx) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-m : source characteristics file (-m imgfile.img) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-o : destination file (-o dest.jp3d) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"Optional Parameters:\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-h : display the help information \n ");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-n : number of resolutions (-n 3,3,3) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-I : use the irreversible transforms: ICT + DWT 9-7 (-I) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-C : coding algorithm (-C 2EB) [2EB, 3EB] \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-r : different compression ratios for successive layers (-r 20,10,5)\n ");
|
||||||
|
fprintf(stdout," - The rate specified for each quality level is the desired compression factor.\n");
|
||||||
|
fprintf(stdout," - Rate 1 means lossless compression\n");
|
||||||
|
fprintf(stdout," (options -r and -q cannot be used together)\n ");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-q : different psnr for successive layers (-q 30,40,50) \n ");
|
||||||
|
fprintf(stdout," (options -r and -q cannot be used together)\n ");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-b : size of code block (-b 32,32,32) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-c : size of precinct (-c 128,128,128) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-t : size of tile (-t 512,512,512) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-p : progression order (-p LRCP) [LRCP, RLCP, RPCL, PCRL, CPRL] \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-s : subsampling factor (-s 2,2,2) [-s X,Y,Z] \n");
|
||||||
|
fprintf(stdout," - Remark: subsampling bigger than 2 can produce error\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-SOP : write SOP marker before each packet \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-EPH : write EPH marker after each header packet \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-M : code-block style (-M 0) [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL)\n");
|
||||||
|
fprintf(stdout," 8=VSC 16=PTERM 32=SEGSYM 64=3DCTXT] \n");
|
||||||
|
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
||||||
|
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-D : define DC offset (-D 12) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n");
|
||||||
|
fprintf(stdout," for component c=%%d [%%d = 0,1,2]\n");
|
||||||
|
fprintf(stdout," with a value of U=%%d [0 <= %%d <= 37] (i.e. -ROI:c=0,U=25) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-d : offset of the origin of the volume (-d 150,300,100) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-l : offset of the origin of the tiles (-l 100,75,25) \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"DEFAULT CODING:\n");
|
||||||
|
fprintf(stdout,"------------\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout," * Lossless\n");
|
||||||
|
fprintf(stdout," * 1 tile\n");
|
||||||
|
fprintf(stdout," * Size of precinct : 2^15 x 2^15 x 2^15 (means 1 precinct)\n");
|
||||||
|
fprintf(stdout," * Size of code-block : 64 x 64 x 64\n");
|
||||||
|
fprintf(stdout," * Number of resolutions in x, y and z axis: 3\n");
|
||||||
|
fprintf(stdout," * No SOP marker in the codestream\n");
|
||||||
|
fprintf(stdout," * No EPH marker in the codestream\n");
|
||||||
|
fprintf(stdout," * No sub-sampling in x, y or z direction\n");
|
||||||
|
fprintf(stdout," * No mode switch activated\n");
|
||||||
|
fprintf(stdout," * Progression order: LRCP\n");
|
||||||
|
fprintf(stdout," * No index file\n");
|
||||||
|
fprintf(stdout," * No ROI upshifted\n");
|
||||||
|
fprintf(stdout," * No offset of the origin of the volume\n");
|
||||||
|
fprintf(stdout," * No offset of the origin of the tiles\n");
|
||||||
|
fprintf(stdout," * Reversible DWT 5-3 on each 2D slice\n");
|
||||||
|
fprintf(stdout," * Coding algorithm: 2D-EBCOT \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"REMARKS:\n");
|
||||||
|
fprintf(stdout,"---------\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"- The markers written to the main_header are : SOC SIZ COD QCD COM.\n");
|
||||||
|
fprintf(stdout,"- COD and QCD markers will never appear in the tile_header.\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"- You need enough disk space memory (twice the original) to encode \n");
|
||||||
|
fprintf(stdout,"the volume,i.e. for a 1.5 GB volume you need a minimum of 3GB of disk memory)\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"- When loading *.pgx files, a relative path to directory is needed for input argument \n");
|
||||||
|
fprintf(stdout," followed by the common prefix of the slices and a '*' character representing sequential numeration.\n");
|
||||||
|
fprintf(stdout,"( -i relativepath/slices*.pgx )\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout," - The index file has the structure below:\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"\t Image_height Image_width Image_depth\n");
|
||||||
|
fprintf(stdout,"\t Progression order: 0 (LRCP)\n");
|
||||||
|
fprintf(stdout,"\t Tiles_size_X Tiles_size_Y Tiles_size_Z\n");
|
||||||
|
fprintf(stdout,"\t Components_nb\n");
|
||||||
|
fprintf(stdout,"\t Layers_nb\n");
|
||||||
|
fprintf(stdout,"\t Decomposition_levels\n");
|
||||||
|
fprintf(stdout,"\t [Precincts_size_X_res_Nr Precincts_size_Y_res_Nr Precincts_size_Z_res_Nr]\n\t ...\n");
|
||||||
|
fprintf(stdout,"\t [Precincts_size_X_res_0 Precincts_size_Y_res_0 Precincts_size_Z_res_0]\n");
|
||||||
|
fprintf(stdout,"\t Main_header_end_position\n");
|
||||||
|
fprintf(stdout,"\t Codestream_size\n");
|
||||||
|
fprintf(stdout,"\t Tile_0 [start_pos end_header end_pos TotalDisto NumPix MaxMSE]\n");
|
||||||
|
fprintf(stdout,"\t ...\n");
|
||||||
|
fprintf(stdout,"\t Tile_Nt [ '' '' '' '' '' '' ]\n");
|
||||||
|
fprintf(stdout,"\t Tpacket_0 [Tile layer res. comp. prec. start_pos end_pos disto]\n");
|
||||||
|
fprintf(stdout,"\t ...\n");
|
||||||
|
fprintf(stdout,"\t Tpacket_Np ['' '' '' '' '' '' '' '' ]\n");
|
||||||
|
fprintf(stdout,"\t MaxDisto\n");
|
||||||
|
fprintf(stdout,"\t TotalDisto\n\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OPJ_PROG_ORDER give_progression(char progression[4]) {
|
||||||
|
if(strncmp(progression, "LRCP", 4) == 0) {
|
||||||
|
return LRCP;
|
||||||
|
}
|
||||||
|
if(strncmp(progression, "RLCP", 4) == 0) {
|
||||||
|
return RLCP;
|
||||||
|
}
|
||||||
|
if(strncmp(progression, "RPCL", 4) == 0) {
|
||||||
|
return RPCL;
|
||||||
|
}
|
||||||
|
if(strncmp(progression, "PCRL", 4) == 0) {
|
||||||
|
return PCRL;
|
||||||
|
}
|
||||||
|
if(strncmp(progression, "CPRL", 4) == 0) {
|
||||||
|
return CPRL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PROG_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
OPJ_TRANSFORM give_transform(char transform[4]) {
|
||||||
|
if(strncmp(transform, "2DWT", 4) == 0) {
|
||||||
|
return TRF_2D_DWT;
|
||||||
|
}
|
||||||
|
if(strncmp(transform, "3DWT", 4) == 0) {
|
||||||
|
return TRF_3D_DWT;
|
||||||
|
}
|
||||||
|
return TRF_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
OPJ_ENTROPY_CODING give_coding(char coding[3]) {
|
||||||
|
|
||||||
|
if(strncmp(coding, "2EB", 3) == 0) {
|
||||||
|
return ENCOD_2EB;
|
||||||
|
}
|
||||||
|
if(strncmp(coding, "3EB", 3) == 0) {
|
||||||
|
return ENCOD_3EB;
|
||||||
|
}
|
||||||
|
/*if(strncmp(coding, "2GR", 3) == 0) {
|
||||||
|
return ENCOD_2GR;
|
||||||
|
}
|
||||||
|
if(strncmp(coding, "3GR", 3) == 0) {
|
||||||
|
return ENCOD_3GR;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return ENCOD_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_file_format(char *filename) {
|
||||||
|
int i;
|
||||||
|
static const char *extension[] = {"pgx", "bin", "img", "j3d", "jp3d", "j2k"};
|
||||||
|
static const int format[] = { PGX_DFMT, BIN_DFMT, IMG_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT};
|
||||||
|
char * ext = strrchr(filename, '.');
|
||||||
|
if (ext) {
|
||||||
|
ext++;
|
||||||
|
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||||
|
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||||
|
return format[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters) {
|
||||||
|
int i, value;
|
||||||
|
|
||||||
|
/* parse the command line */
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
int c = opj_getopt(argc, argv, "i:m:o:r:q:f:t:n:c:b:x:p:s:d:hP:S:E:M:D:R:l:T:C:A:I");
|
||||||
|
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 PGX_DFMT:
|
||||||
|
case BIN_DFMT:
|
||||||
|
case IMG_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized format for infile : %s [accept only *.pgx or *.bin] !!\n\n", infile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->infile, infile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Infile: %s \n", parameters->infile);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
case 'm': /* input IMG file */
|
||||||
|
{
|
||||||
|
char *imgfile = opj_optarg;
|
||||||
|
int imgformat = get_file_format(imgfile);
|
||||||
|
switch(imgformat) {
|
||||||
|
case IMG_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized format for imgfile : %s [accept only *.img] !!\n\n", imgfile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->imgfile, imgfile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Imgfile: %s Format: %d\n", parameters->imgfile, imgformat);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
case 'o': /* output file */
|
||||||
|
{
|
||||||
|
char *outfile = opj_optarg;
|
||||||
|
parameters->cod_format = get_file_format(outfile);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case J3D_CFMT:
|
||||||
|
case J2K_CFMT:
|
||||||
|
case LSE_CFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unknown output format volume %s [only *.j2k, *.lse3d or *.jp3d]!! \n", outfile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->outfile, outfile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Outfile: %s \n", parameters->outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'r': /* define compression rates for each layer */
|
||||||
|
{
|
||||||
|
char *s = opj_optarg;
|
||||||
|
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||||
|
parameters->tcp_numlayers++;
|
||||||
|
while (*s && *s != ',') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (!*s)
|
||||||
|
break;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
parameters->cp_disto_alloc = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'q': /* define distorsion (PSNR) for each layer */
|
||||||
|
{
|
||||||
|
char *s = opj_optarg;
|
||||||
|
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||||
|
parameters->tcp_numlayers++;
|
||||||
|
while (*s && *s != ',') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (!*s)
|
||||||
|
break;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
parameters->cp_fixed_quality = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
{
|
||||||
|
fprintf(stdout, "/---------------------------------------------------\\\n");
|
||||||
|
fprintf(stdout, "| Fixed layer allocation option not implemented !! |\n");
|
||||||
|
fprintf(stdout, "\\---------------------------------------------------/\n");
|
||||||
|
/*int *row = NULL, *col = NULL;
|
||||||
|
int numlayers = 0, matrix_width = 0;
|
||||||
|
|
||||||
|
char *s = opj_optarg;
|
||||||
|
sscanf(s, "%d", &numlayers);
|
||||||
|
s++;
|
||||||
|
if (numlayers > 9)
|
||||||
|
s++;
|
||||||
|
|
||||||
|
parameters->tcp_numlayers = numlayers;
|
||||||
|
matrix_width = parameters->numresolution[0] + parameters->numresolution[1] + parameters->numresolution[2];
|
||||||
|
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
|
||||||
|
s = s + 2;
|
||||||
|
|
||||||
|
for (i = 0; i < numlayers; i++) {
|
||||||
|
row = ¶meters->cp_matrice[i * matrix_width];
|
||||||
|
col = row;
|
||||||
|
parameters->tcp_rates[i] = 1;
|
||||||
|
sscanf(s, "%d,", &col[0]);
|
||||||
|
s += 2;
|
||||||
|
if (col[0] > 9)
|
||||||
|
s++;
|
||||||
|
col[1] = 0;
|
||||||
|
col[2] = 0;
|
||||||
|
for (j = 1; j < matrix_width; j++) {
|
||||||
|
col += 3; j+=2;
|
||||||
|
sscanf(s, "%d,%d,%d", &col[0], &col[1], &col[2]);
|
||||||
|
s += 6;
|
||||||
|
if (col[0] > 9)
|
||||||
|
s++;
|
||||||
|
if (col[1] > 9)
|
||||||
|
s++;
|
||||||
|
if (col[2] > 9)
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (i < numlayers - 1)
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
parameters->cp_fixed_alloc = 1; */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 't': /* tiles */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy, ¶meters->cp_tdz) !=3) {
|
||||||
|
fprintf(stdout, "[ERROR] '-t' 'dimensions of tiles' argument error ! [-t tdx,tdy,tdz]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->tile_size_on = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'n': /* resolution */
|
||||||
|
{
|
||||||
|
int aux;
|
||||||
|
aux = sscanf(opj_optarg, "%d,%d,%d", ¶meters->numresolution[0], ¶meters->numresolution[1], ¶meters->numresolution[2]);
|
||||||
|
if (aux == 2)
|
||||||
|
parameters->numresolution[2] = 1;
|
||||||
|
else if (aux == 1) {
|
||||||
|
parameters->numresolution[1] = parameters->numresolution[0];
|
||||||
|
parameters->numresolution[2] = 1;
|
||||||
|
}else if (aux == 0){
|
||||||
|
parameters->numresolution[0] = 1;
|
||||||
|
parameters->numresolution[1] = 1;
|
||||||
|
parameters->numresolution[2] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
case 'c': /* precinct dimension */
|
||||||
|
{
|
||||||
|
char sep;
|
||||||
|
int res_spec = 0;
|
||||||
|
int aux;
|
||||||
|
char *s = opj_optarg;
|
||||||
|
do {
|
||||||
|
sep = 0;
|
||||||
|
aux = sscanf(s, "[%d,%d,%d]%c", ¶meters->prct_init[0][res_spec], ¶meters->prct_init[1][res_spec], ¶meters->prct_init[2][res_spec], &sep);
|
||||||
|
if (sep == ',' && aux != 4) {
|
||||||
|
fprintf(stdout, "[ERROR] '-c' 'dimensions of precincts' argument error ! [-c [prcx_res0,prcy_res0,prcz_res0],...,[prcx_resN,prcy_resN,prcz_resN]]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->csty |= 0x01;
|
||||||
|
res_spec++;
|
||||||
|
s = strpbrk(s, "]") + 2;
|
||||||
|
}
|
||||||
|
while (sep == ',');
|
||||||
|
parameters->res_spec = res_spec; /* number of precinct size specifications */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'b': /* code-block dimension */
|
||||||
|
{
|
||||||
|
int cblockw_init = 0, cblockh_init = 0, cblockl_init = 0;
|
||||||
|
if (sscanf(opj_optarg, "%d,%d,%d", &cblockw_init, &cblockh_init, &cblockl_init) != 3) {
|
||||||
|
fprintf(stdout, "[ERROR] '-b' 'dimensions of codeblocks' argument error ! [-b cblkx,cblky,cblkz]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (cblockw_init * cblockh_init * cblockl_init > (1<<18) || cblockw_init > 1024 || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4 || cblockl_init > 1024 || cblockl_init < 4) {
|
||||||
|
fprintf(stdout,"[ERROR] Size of code_block error (option -b) !!\n\nRestriction :\n * width*height*length<=4096\n * 4<=width,height,length<= 1024\n\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->cblock_init[0] = cblockw_init;
|
||||||
|
parameters->cblock_init[1] = cblockh_init;
|
||||||
|
parameters->cblock_init[2] = cblockl_init;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'x': /* creation of index file */
|
||||||
|
{
|
||||||
|
char *index = opj_optarg;
|
||||||
|
strncpy(parameters->index, index, MAX_PATH);
|
||||||
|
parameters->index_on = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'p': /* progression order */
|
||||||
|
{
|
||||||
|
char progression[4];
|
||||||
|
|
||||||
|
strncpy(progression, opj_optarg, 4);
|
||||||
|
parameters->prog_order = give_progression(progression);
|
||||||
|
if (parameters->prog_order == -1) {
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized progression order [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 's': /* subsampling factor */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->subsampling_dx, ¶meters->subsampling_dy, ¶meters->subsampling_dz) != 2) {
|
||||||
|
fprintf(stdout, "[ERROR] '-s' sub-sampling argument error ! [-s dx,dy,dz]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'd': /* coordonnate of the reference grid */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->volume_offset_x0, ¶meters->volume_offset_y0, ¶meters->volume_offset_z0) != 3) {
|
||||||
|
fprintf(stdout, "[ERROR] -d 'coordonnate of the reference grid' argument error !! [-d x0,y0,z0]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'h': /* display an help description */
|
||||||
|
{
|
||||||
|
encode_help_display();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'P': /* POC */
|
||||||
|
{
|
||||||
|
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||||
|
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||||
|
|
||||||
|
char *s = opj_optarg;
|
||||||
|
POC = parameters->POC;
|
||||||
|
|
||||||
|
fprintf(stdout, "/----------------------------------\\\n");
|
||||||
|
fprintf(stdout, "| POC option not fully tested !! |\n");
|
||||||
|
fprintf(stdout, "\\----------------------------------/\n");
|
||||||
|
|
||||||
|
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%s", &POC[numpocs].tile,
|
||||||
|
&POC[numpocs].resno0, &POC[numpocs].compno0,
|
||||||
|
&POC[numpocs].layno1, &POC[numpocs].resno1,
|
||||||
|
&POC[numpocs].compno1, POC[numpocs].progorder) == 7) {
|
||||||
|
POC[numpocs].prg = give_progression(POC[numpocs].progorder);
|
||||||
|
/* POC[numpocs].tile; */
|
||||||
|
numpocs++;
|
||||||
|
while (*s && *s != '/') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (!*s) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
parameters->numpocs = numpocs;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'S': /* SOP marker */
|
||||||
|
{
|
||||||
|
parameters->csty |= 0x02;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'E': /* EPH marker */
|
||||||
|
{
|
||||||
|
parameters->csty |= 0x04;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'M': /* Codification mode switch */
|
||||||
|
{
|
||||||
|
fprintf(stdout, "[INFO] Mode switch option not fully tested !!\n");
|
||||||
|
value = 0;
|
||||||
|
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||||
|
for (i = 0; i <= 6; i++) {
|
||||||
|
int cache = value & (1 << i);
|
||||||
|
if (cache)
|
||||||
|
parameters->mode |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'D': /* DCO */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "%d", ¶meters->dcoffset) != 1) {
|
||||||
|
fprintf(stdout, "[ERROR] DC offset error !! [-D %d]\n",parameters->dcoffset);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'R': /* ROI */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "OI:c=%d,U=%d", ¶meters->roi_compno, ¶meters->roi_shift) != 2) {
|
||||||
|
fprintf(stdout, "[ERROR] ROI error !! [-ROI:c='compno',U='shift']\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'l': /* Tile offset */
|
||||||
|
{
|
||||||
|
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0, ¶meters->cp_tz0) != 3) {
|
||||||
|
fprintf(stdout, "[ERROR] -l 'tile offset' argument error !! [-l X0,Y0,Z0]");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------
|
||||||
|
|
||||||
|
case 'T': // Tranformation of original data (2D-DWT/3D-DWT/3D-RLS/2D-DWT+1D-RLS)
|
||||||
|
{
|
||||||
|
char transform[4];
|
||||||
|
|
||||||
|
strncpy(transform, opj_optarg, 4);
|
||||||
|
parameters->transform_format = give_transform(transform);
|
||||||
|
if (parameters->transform_format == -1) {
|
||||||
|
fprintf(stdout, "[ERROR] -T 'Transform domain' argument error !! [-T 2DWT, 3DWT, 3RLS or 3LSE only]");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'C': /* Coding of transformed data */
|
||||||
|
{
|
||||||
|
char coding[3];
|
||||||
|
|
||||||
|
strncpy(coding, opj_optarg, 3);
|
||||||
|
parameters->encoding_format = give_coding(coding);
|
||||||
|
if (parameters->encoding_format == -1) {
|
||||||
|
fprintf(stdout, "[ERROR] -C 'Coding algorithm' argument error !! [-C 2EB, 3EB, 2GR, 3GR or GRI only]");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'I': /* reversible or not */
|
||||||
|
{
|
||||||
|
parameters->irreversible = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] This option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for possible errors */
|
||||||
|
|
||||||
|
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||||
|
fprintf(stdout, "usage: jp3d_vm_enc -i volume-file -o jp3d-file (+ options)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parameters->decod_format == BIN_DFMT) && (parameters->imgfile[0] == 0)) {
|
||||||
|
fprintf(stdout, "usage: jp3d_vm_enc -i bin-volume-file -m img-file -o jp3d-file (+ options)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parameters->decod_format != BIN_DFMT) && (parameters->decod_format != PGX_DFMT) && (parameters->decod_format != IMG_DFMT)) {
|
||||||
|
fprintf(stdout, "usage: jp3d_vm_enc -i input-volume-file [*.bin,*.pgx,*.img] -o jp3d-file [*.jp3d,*.j2k] (+ options)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if((parameters->cod_format != J3D_CFMT) && (parameters->cod_format != J2K_CFMT)) {
|
||||||
|
fprintf(stdout, "usage: jp3d_vm_enc -i input-volume-file [*.bin,*.pgx,*.img] -o jp3d-file [*.jp3d,*.j2k] (+ options)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parameters->encoding_format == ENCOD_2GR || parameters->encoding_format == ENCOD_3GR) && parameters->transform_format != TRF_3D_LSE && parameters->transform_format != TRF_3D_RLS) {
|
||||||
|
fprintf(stdout, "[ERROR] Entropy coding options -C [2GR,3GR] are only compatible with predictive-based transform algorithms: -T [3RLS,3LSE].\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (parameters->encoding_format == ENCOD_3EB)
|
||||||
|
parameters->mode |= (1 << 6);
|
||||||
|
|
||||||
|
if ((parameters->mode >> 6) & 1) {
|
||||||
|
parameters->encoding_format = ENCOD_3EB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parameters->numresolution[2] == 0 || (parameters->numresolution[1] == 0) || (parameters->numresolution[0] == 0))) {
|
||||||
|
fprintf(stdout, "[ERROR] -n 'resolution levels' argument error ! Resolutions must be greater than 1 in order to perform DWT.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (parameters->numresolution[1] != parameters->numresolution[0]) {
|
||||||
|
fprintf(stdout, "[ERROR] -n 'resolution levels' argument error ! Resolutions in X and Y axis must be the same in this implementation.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters->numresolution[2] > parameters->numresolution[0]) {
|
||||||
|
fprintf(stdout, "[ERROR] -n 'resolution levels' argument error ! Resolutions in Z axis must be lower than in X-Y axis.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters->dcoffset >= 128 && parameters->dcoffset <= -128) {
|
||||||
|
fprintf(stdout, "[ERROR] -D 'DC offset' argument error ! Value must be -128<=DCO<=128.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(parameters->numresolution[2] != 1) {
|
||||||
|
parameters->transform_format = TRF_3D_DWT;
|
||||||
|
/*fprintf(stdout, "[Warning] Resolution level in axial dim > 1 : 3D-DWT will be performed... \n");*/
|
||||||
|
} else if (parameters->numresolution[2] == 1) {
|
||||||
|
parameters->transform_format = TRF_2D_DWT;
|
||||||
|
/*fprintf(stdout, "[Warning] Resolution level in axial dim == 1 : 2D-DWT will be performed... \n");*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parameters->cod_format == J2K_CFMT) && (parameters->transform_format != TRF_2D_DWT || parameters->encoding_format != ENCOD_2EB)) {
|
||||||
|
fprintf(stdout, "[WARNING] Incompatible options -o *.j2k and defined transform or encoding algorithm. Latter will be ignored\n");
|
||||||
|
parameters->transform_format = TRF_2D_DWT;
|
||||||
|
parameters->encoding_format = ENCOD_2EB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parameters->cp_disto_alloc || parameters->cp_fixed_alloc || parameters->cp_fixed_quality) && (!(parameters->cp_disto_alloc ^ parameters->cp_fixed_quality))) {
|
||||||
|
fprintf(stdout, "[ERROR] Options -r and -q cannot be used together !!\n");
|
||||||
|
return 1;
|
||||||
|
} /* mod fixed_quality */
|
||||||
|
|
||||||
|
/* if no rate entered, lossless by default */
|
||||||
|
if (parameters->tcp_numlayers == 0) {
|
||||||
|
parameters->tcp_rates[0] = 0.0; /* MOD antonin : losslessbug */
|
||||||
|
parameters->tcp_numlayers++;
|
||||||
|
parameters->cp_disto_alloc = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parameters->cp_tx0 > parameters->volume_offset_x0) || (parameters->cp_ty0 > parameters->volume_offset_y0) || (parameters->cp_tz0 > parameters->volume_offset_z0)) {
|
||||||
|
fprintf(stdout, "[ERROR] Tile offset dimension is unnappropriate --> TX0(%d)<=IMG_X0(%d) TYO(%d)<=IMG_Y0(%d) TZO(%d)<=IMG_Z0(%d)\n",
|
||||||
|
parameters->cp_tx0, parameters->volume_offset_x0, parameters->cp_ty0, parameters->volume_offset_y0,
|
||||||
|
parameters->cp_tz0, parameters->volume_offset_z0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < parameters->numpocs; i++) {
|
||||||
|
if (parameters->POC[i].prg == -1) {
|
||||||
|
fprintf(stdout,"[ERROR] Unrecognized progression order in option -P (POC n %d) [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n",i + 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 a FILE* client object
|
||||||
|
*/
|
||||||
|
void info_callback(const char *msg, void *client_data) {
|
||||||
|
FILE *stream = (FILE*)client_data;
|
||||||
|
fprintf(stream, "[INFO] %s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
bool bSuccess;
|
||||||
|
bool delete_comment = true;
|
||||||
|
opj_cparameters_t parameters; /* compression parameters */
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_volume_t *volume = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
configure the event callbacks (not required)
|
||||||
|
setting of each callback is optionnal
|
||||||
|
*/
|
||||||
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
|
event_mgr.error_handler = error_callback;
|
||||||
|
event_mgr.warning_handler = warning_callback;
|
||||||
|
event_mgr.info_handler = info_callback;
|
||||||
|
|
||||||
|
/* set encoding parameters to default values */
|
||||||
|
opj_set_default_encoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* parse input and get user encoding parameters */
|
||||||
|
if(parse_cmdline_encoder(argc, argv, ¶meters) == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(parameters.cp_comment == NULL) {
|
||||||
|
parameters.cp_comment = "Created by OpenJPEG version JP3D";
|
||||||
|
/* no need to delete parameters.cp_comment on exit */
|
||||||
|
delete_comment = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode the destination volume */
|
||||||
|
/* ---------------------------- */
|
||||||
|
if (parameters.cod_format == J3D_CFMT || parameters.cod_format == J2K_CFMT) {
|
||||||
|
int codestream_length, pixels, bitsin;
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
FILE *f = NULL;
|
||||||
|
opj_cinfo_t* cinfo = NULL;
|
||||||
|
|
||||||
|
/* decode the source volume */
|
||||||
|
/* ----------------------- */
|
||||||
|
switch (parameters.decod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
fprintf(stdout, "[INFO] Loading pgx file(s)\n");
|
||||||
|
volume = pgxtovolume(parameters.infile, ¶meters);
|
||||||
|
if (!volume) {
|
||||||
|
fprintf(stdout, "[ERROR] Unable to load pgx files\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BIN_DFMT:
|
||||||
|
fprintf(stdout, "[INFO] Loading bin file\n");
|
||||||
|
volume = bintovolume(parameters.infile, parameters.imgfile, ¶meters);
|
||||||
|
if (!volume) {
|
||||||
|
fprintf(stdout, "[ERROR] Unable to load bin file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IMG_DFMT:
|
||||||
|
fprintf(stdout, "[INFO] Loading img file\n");
|
||||||
|
volume = imgtovolume(parameters.infile, ¶meters);
|
||||||
|
if (!volume) {
|
||||||
|
fprintf(stderr, "[ERROR] Unable to load img file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get a JP3D or J2K compressor handle */
|
||||||
|
if (parameters.cod_format == J3D_CFMT)
|
||||||
|
cinfo = opj_create_compress(CODEC_J3D);
|
||||||
|
else if (parameters.cod_format == J2K_CFMT)
|
||||||
|
cinfo = opj_create_compress(CODEC_J2K);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stdout);
|
||||||
|
|
||||||
|
/* setup the encoder parameters using the current volume and using user parameters */
|
||||||
|
opj_setup_encoder(cinfo, ¶meters, volume);
|
||||||
|
|
||||||
|
/* open a byte stream for writing */
|
||||||
|
/* allocate memory for all tiles */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||||
|
|
||||||
|
/* encode the volume */
|
||||||
|
/*fprintf(stdout, "[INFO] Encode the volume\n");*/
|
||||||
|
bSuccess = opj_encode(cinfo, cio, volume, parameters.index);
|
||||||
|
if (!bSuccess) {
|
||||||
|
opj_cio_close(cio);
|
||||||
|
fprintf(stdout, "[ERROR] Failed to encode volume\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
codestream_length = cio_tell(cio);
|
||||||
|
pixels =(volume->x1 - volume->x0) * (volume->y1 - volume->y0) * (volume->z1 - volume->z0);
|
||||||
|
bitsin = pixels * volume->comps[0].prec;
|
||||||
|
fprintf(stdout, "[RESULT] Volume: %d x %d x %d (x %d bpv)\n Codestream: %d B, Ratio: %5.3f bpv, (%5.3f : 1) \n",
|
||||||
|
(volume->x1 - volume->x0),(volume->y1 - volume->y0),(volume->z1 - volume->z0),volume->comps[0].prec,
|
||||||
|
codestream_length, ((double)codestream_length * 8.0/(double)pixels), ((double)bitsin/(8.0*(double)codestream_length)));
|
||||||
|
|
||||||
|
/* write the buffer to disk */
|
||||||
|
f = fopen(parameters.outfile, "wb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for writing\n", parameters.outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fwrite(cio->buffer, 1, codestream_length, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
/* close and free the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* free remaining compression structures */
|
||||||
|
opj_destroy_compress(cinfo);
|
||||||
|
} else {
|
||||||
|
fprintf(stdout, "[ERROR] Cod_format != JP3d !!! \n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free user parameters structure */
|
||||||
|
if(delete_comment) {
|
||||||
|
if(parameters.cp_comment) free(parameters.cp_comment);
|
||||||
|
}
|
||||||
|
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
||||||
|
|
||||||
|
/* free volume data */
|
||||||
|
opj_volume_destroy(volume);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
541
src/bin/jp3d/opj_jp3d_decompress.c
Executable file
541
src/bin/jp3d/opj_jp3d_decompress.c
Executable file
@@ -0,0 +1,541 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* Copyright (c) 2006, M<>nica D<>ez Garc<72>a, Image Processing Laboratory, University of Valladolid, Spain
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "opj_config.h"
|
||||||
|
#include "openjp3d.h"
|
||||||
|
#include "opj_getopt.h"
|
||||||
|
#include "convert.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define strnicmp strncasecmp
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
static double calc_PSNR(opj_volume_t *original, opj_volume_t *decoded)
|
||||||
|
{
|
||||||
|
int max, i, k, compno = 0, size;
|
||||||
|
double sum, total = 0;
|
||||||
|
int global = 1;
|
||||||
|
|
||||||
|
max = (original->comps[compno].prec <= 8) ? 255 : (1 << original->comps[compno].prec) - 1;
|
||||||
|
if (global) {
|
||||||
|
size = (original->x1 - original->x0) * (original->y1 - original->y0) * (original->z1 - original->z0);
|
||||||
|
|
||||||
|
for (compno = 0; compno < original->numcomps; compno++) {
|
||||||
|
for(sum = 0, i = 0; i < size; ++i) {
|
||||||
|
if ((decoded->comps[compno].data[i] < 0) || (decoded->comps[compno].data[i] > max))
|
||||||
|
fprintf(stdout,"[WARNING] Data out of range during PSNR computing...\n");
|
||||||
|
else
|
||||||
|
sum += (original->comps[compno].data[i] - decoded->comps[compno].data[i]) * (original->comps[compno].data[i] - decoded->comps[compno].data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum /= size;
|
||||||
|
total = ((sum==0.0) ? 0.0 : 10 * log10(max * max / sum));
|
||||||
|
} else {
|
||||||
|
size = (original->x1 - original->x0) * (original->y1 - original->y0);
|
||||||
|
|
||||||
|
for (k = 0; k < original->z1 - original->z0; k++) {
|
||||||
|
int offset = k * size;
|
||||||
|
for (sum = 0, compno = 0; compno < original->numcomps; compno++) {
|
||||||
|
for(i = 0; i < size; ++i) {
|
||||||
|
if ((decoded->comps[compno].data[i + offset] < 0) || (decoded->comps[compno].data[i + offset] > max))
|
||||||
|
fprintf(stdout,"[WARNING] Data out of range during PSNR computing...\n");
|
||||||
|
else
|
||||||
|
sum += (original->comps[compno].data[i + offset] - decoded->comps[compno].data[i + offset]) * (original->comps[compno].data[i + offset] - decoded->comps[compno].data[i + offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum /= size;
|
||||||
|
total = total + ((sum==0.0) ? 0.0 : 10 * log10(max * max / sum));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(total == 0) /* perfect reconstruction, PSNR should return infinity */
|
||||||
|
return -1.0;
|
||||||
|
|
||||||
|
return total;
|
||||||
|
/*return 20 * log10((max - 1) / sqrt(sum));*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static double calc_SSIM(opj_volume_t *original, opj_volume_t *decoded)
|
||||||
|
{
|
||||||
|
int max, i, compno = 0, size, sizeM;
|
||||||
|
double sum;
|
||||||
|
double mux = 0.0, muy = 0.0, sigmax = 0.0, sigmay = 0.0,
|
||||||
|
sigmaxy = 0.0/*, structx = 0.0, structy = 0.0*/;
|
||||||
|
double lcomp,ccomp,scomp;
|
||||||
|
double C1,C2,C3;
|
||||||
|
|
||||||
|
max = (original->comps[compno].prec <= 8) ? 255 : (1 << original->comps[compno].prec) - 1;
|
||||||
|
size = (original->x1 - original->x0) * (original->y1 - original->y0) * (original->z1 - original->z0);
|
||||||
|
|
||||||
|
/*MSSIM*/
|
||||||
|
|
||||||
|
/* sizeM = size / (original->z1 - original->z0);*/
|
||||||
|
|
||||||
|
sizeM = size;
|
||||||
|
for(sum = 0, i = 0; i < sizeM; ++i) {
|
||||||
|
/* First, the luminance of each signal is compared.*/
|
||||||
|
mux += original->comps[compno].data[i];
|
||||||
|
muy += decoded->comps[compno].data[i];
|
||||||
|
}
|
||||||
|
mux /= sizeM;
|
||||||
|
muy /= sizeM;
|
||||||
|
|
||||||
|
/*We use the standard deviation (the square root of variance) as an estimate of the signal contrast.*/
|
||||||
|
for(sum = 0, i = 0; i < sizeM; ++i) {
|
||||||
|
/* First, the luminance of each signal is compared.*/
|
||||||
|
sigmax += (original->comps[compno].data[i] - mux) * (original->comps[compno].data[i] - mux);
|
||||||
|
sigmay += (decoded->comps[compno].data[i] - muy) * (decoded->comps[compno].data[i] - muy);
|
||||||
|
sigmaxy += (original->comps[compno].data[i] - mux) * (decoded->comps[compno].data[i] - muy);
|
||||||
|
}
|
||||||
|
sigmax /= sizeM - 1;
|
||||||
|
sigmay /= sizeM - 1;
|
||||||
|
sigmaxy /= sizeM - 1;
|
||||||
|
|
||||||
|
sigmax = sqrt(sigmax);
|
||||||
|
sigmay = sqrt(sigmay);
|
||||||
|
sigmaxy = sqrt(sigmaxy);
|
||||||
|
|
||||||
|
/*Third, the signal is normalized (divided) by its own standard deviation, */
|
||||||
|
/*so that the two signals being compared have unit standard deviation.*/
|
||||||
|
|
||||||
|
/*Luminance comparison*/
|
||||||
|
C1 = (0.01 * max) * (0.01 * max);
|
||||||
|
lcomp = ((2 * mux * muy) + C1)/((mux*mux) + (muy*mux) + C1);
|
||||||
|
/*Constrast comparison*/
|
||||||
|
C2 = (0.03 * max) * (0.03 * max);
|
||||||
|
ccomp = ((2 * sigmax * sigmay) + C2)/((sigmax*sigmax) + (sigmay*sigmay) + C2);
|
||||||
|
/*Structure comparison*/
|
||||||
|
C3 = C2 / 2;
|
||||||
|
scomp = (sigmaxy + C3) / (sigmax * sigmay + C3);
|
||||||
|
/*Similarity measure*/
|
||||||
|
|
||||||
|
sum = lcomp * ccomp * scomp;
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void decode_help_display() {
|
||||||
|
fprintf(stdout,"HELP\n----\n\n");
|
||||||
|
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||||
|
|
||||||
|
fprintf(stdout,"List of parameters for the JPEG 2000 encoder:\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout," Required arguments \n");
|
||||||
|
fprintf(stdout," ---------------------------- \n");
|
||||||
|
fprintf(stdout," -i <compressed file> ( *.jp3d, *.j3d )\n");
|
||||||
|
fprintf(stdout," Currently accepts J3D-files. The file type is identified based on its suffix.\n");
|
||||||
|
fprintf(stdout," -o <decompressed file> ( *.pgx, *.bin )\n");
|
||||||
|
fprintf(stdout," Currently accepts PGX-files and BIN-files. Binary data is written to the file (not ascii). \n");
|
||||||
|
fprintf(stdout," If a PGX filename is given, there will be as many output files as slices; \n");
|
||||||
|
fprintf(stdout," an indice starting from 0 will then be appended to the output filename,\n");
|
||||||
|
fprintf(stdout," just before the \"pgx\" extension.\n");
|
||||||
|
fprintf(stdout," -m <characteristics file> ( *.img ) \n");
|
||||||
|
fprintf(stdout," Required only for BIN-files. Ascii data of volume characteristics is written. \n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout," Optional \n");
|
||||||
|
fprintf(stdout," ---------------------------- \n");
|
||||||
|
fprintf(stdout," -h \n ");
|
||||||
|
fprintf(stdout," Display the help information\n");
|
||||||
|
fprintf(stdout," -r <RFx,RFy,RFz>\n");
|
||||||
|
fprintf(stdout," Set the number of highest resolution levels to be discarded on each dimension. \n");
|
||||||
|
fprintf(stdout," The volume resolution is effectively divided by 2 to the power of the\n");
|
||||||
|
fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n");
|
||||||
|
fprintf(stdout," smallest total number of decomposition levels among tiles.\n");
|
||||||
|
fprintf(stdout," -l <number of quality layers to decode>\n");
|
||||||
|
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
|
||||||
|
fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
|
||||||
|
fprintf(stdout," are decoded. \n");
|
||||||
|
fprintf(stdout," -O original-file \n");
|
||||||
|
fprintf(stdout," This option offers the possibility to compute some quality results \n");
|
||||||
|
fprintf(stdout," for the decompressed volume, like the PSNR value achieved or the global SSIM value. \n");
|
||||||
|
fprintf(stdout," Needs the original file in order to compare with the new one.\n");
|
||||||
|
fprintf(stdout," NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions) \n");
|
||||||
|
fprintf(stdout," NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option. \n");
|
||||||
|
fprintf(stdout," (i.e. -O original-BIN-file -m original-IMG-file) \n");
|
||||||
|
fprintf(stdout," -BE \n");
|
||||||
|
fprintf(stdout," Define that the recovered volume data will be saved with big endian byte order.\n");
|
||||||
|
fprintf(stdout," By default, little endian byte order is used.\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int get_file_format(char *filename) {
|
||||||
|
int i;
|
||||||
|
static const char *extension[] = {"pgx", "bin", "j3d", "jp3d", "j2k", "img"};
|
||||||
|
static const int format[] = { PGX_DFMT, BIN_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT, IMG_DFMT};
|
||||||
|
char * ext = strrchr(filename, '.');
|
||||||
|
if(ext) {
|
||||||
|
ext++;
|
||||||
|
for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {
|
||||||
|
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||||
|
return format[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters) {
|
||||||
|
/* parse the command line */
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
int c = opj_getopt(argc, argv, "i:o:O:r:l:B:m:h");
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'i': /* input file */
|
||||||
|
{
|
||||||
|
char *infile = opj_optarg;
|
||||||
|
parameters->decod_format = get_file_format(infile);
|
||||||
|
switch(parameters->decod_format) {
|
||||||
|
case J3D_CFMT:
|
||||||
|
case J2K_CFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unknown format for infile %s [only *.j3d]!! \n", infile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->infile, infile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Infile: %s \n", parameters->infile);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm': /* img file */
|
||||||
|
{
|
||||||
|
char *imgfile = opj_optarg;
|
||||||
|
int imgformat = get_file_format(imgfile);
|
||||||
|
switch(imgformat) {
|
||||||
|
case IMG_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized format for imgfile : %s [accept only *.img] !!\n\n", imgfile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->imgfile, imgfile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Imgfile: %s Format: %d\n", parameters->imgfile, imgformat);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'o': /* output file */
|
||||||
|
{
|
||||||
|
char *outfile = opj_optarg;
|
||||||
|
parameters->cod_format = get_file_format(outfile);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
case BIN_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized format for outfile : %s [accept only *.pgx or *.bin] !!\n\n", outfile);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->outfile, outfile, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Outfile: %s \n", parameters->outfile);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'O': /* Original image for PSNR computing */
|
||||||
|
{
|
||||||
|
char *original = opj_optarg;
|
||||||
|
parameters->orig_format = get_file_format(original);
|
||||||
|
switch(parameters->orig_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
case BIN_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stdout, "[ERROR] Unrecognized format for original file : %s [accept only *.pgx or *.bin] !!\n\n", original);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(parameters->original, original, MAX_PATH);
|
||||||
|
fprintf(stdout, "[INFO] Original file: %s \n", parameters->original);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'r': /* reduce option */
|
||||||
|
{
|
||||||
|
/*sscanf(opj_optarg, "%d, %d, %d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);*/
|
||||||
|
int aux;
|
||||||
|
aux = sscanf(opj_optarg, "%d,%d,%d", ¶meters->cp_reduce[0], ¶meters->cp_reduce[1], ¶meters->cp_reduce[2]);
|
||||||
|
if (aux == 2)
|
||||||
|
parameters->cp_reduce[2] = 0;
|
||||||
|
else if (aux == 1) {
|
||||||
|
parameters->cp_reduce[1] = parameters->cp_reduce[0];
|
||||||
|
parameters->cp_reduce[2] = 0;
|
||||||
|
}else if (aux == 0){
|
||||||
|
parameters->cp_reduce[0] = 0;
|
||||||
|
parameters->cp_reduce[1] = 0;
|
||||||
|
parameters->cp_reduce[2] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'l': /* layering option */
|
||||||
|
{
|
||||||
|
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'B': /* BIGENDIAN vs. LITTLEENDIAN */
|
||||||
|
{
|
||||||
|
parameters->bigendian = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'L': /* BIGENDIAN vs. LITTLEENDIAN */
|
||||||
|
{
|
||||||
|
parameters->decod_format = LSE_CFMT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'h': /* display an help description */
|
||||||
|
{
|
||||||
|
decode_help_display();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stdout,"[WARNING] This option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for possible errors */
|
||||||
|
|
||||||
|
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||||
|
fprintf(stdout,"[ERROR] At least one required argument is missing\n Check jp3d_to_volume -help for usage information\n");
|
||||||
|
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) {
|
||||||
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_volume_t *volume = NULL;
|
||||||
|
|
||||||
|
opj_volume_t *original = NULL;
|
||||||
|
opj_cparameters_t cparameters; /* original parameters */
|
||||||
|
|
||||||
|
FILE *fsrc = NULL;
|
||||||
|
unsigned char *src = NULL;
|
||||||
|
int file_length;
|
||||||
|
int decodeok;
|
||||||
|
double psnr, ssim;
|
||||||
|
|
||||||
|
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
|
/* parse input and get user decoding parameters */
|
||||||
|
strcpy(parameters.original,"NULL");
|
||||||
|
strcpy(parameters.imgfile,"NULL");
|
||||||
|
if(parse_cmdline_decoder(argc, argv, ¶meters) == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read the input file and put it in memory */
|
||||||
|
/* ---------------------------------------- */
|
||||||
|
fprintf(stdout, "[INFO] Loading %s file \n",parameters.decod_format==J3D_CFMT ? ".jp3d" : ".j2k");
|
||||||
|
fsrc = fopen(parameters.infile, "rb");
|
||||||
|
if (!fsrc) {
|
||||||
|
fprintf(stdout, "[ERROR] Failed to open %s for reading\n", parameters.infile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fseek(fsrc, 0, SEEK_END);
|
||||||
|
file_length = ftell(fsrc);
|
||||||
|
fseek(fsrc, 0, SEEK_SET);
|
||||||
|
src = (unsigned char *) malloc(file_length);
|
||||||
|
fread(src, 1, file_length, fsrc);
|
||||||
|
fclose(fsrc);
|
||||||
|
|
||||||
|
/* decode the code-stream */
|
||||||
|
/* ---------------------- */
|
||||||
|
if (parameters.decod_format == J3D_CFMT || parameters.decod_format == J2K_CFMT) {
|
||||||
|
/* get a JP3D or J2K decoder handle */
|
||||||
|
if (parameters.decod_format == J3D_CFMT)
|
||||||
|
dinfo = opj_create_decompress(CODEC_J3D);
|
||||||
|
else if (parameters.decod_format == J2K_CFMT)
|
||||||
|
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 volume structure */
|
||||||
|
volume = opj_decode(dinfo, cio);
|
||||||
|
if(!volume) {
|
||||||
|
fprintf(stdout, "[ERROR] jp3d_to_volume: failed to decode volume!\n");
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free the memory containing the code-stream */
|
||||||
|
free(src);
|
||||||
|
src = NULL;
|
||||||
|
|
||||||
|
/* create output volume */
|
||||||
|
/* ------------------- */
|
||||||
|
|
||||||
|
switch (parameters.cod_format) {
|
||||||
|
case PGX_DFMT: /* PGX */
|
||||||
|
decodeok = volumetopgx(volume, parameters.outfile);
|
||||||
|
if (decodeok)
|
||||||
|
fprintf(stdout,"[ERROR] Unable to write decoded volume into pgx files\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BIN_DFMT: /* BMP */
|
||||||
|
decodeok = volumetobin(volume, parameters.outfile);
|
||||||
|
if (decodeok)
|
||||||
|
fprintf(stdout,"[ERROR] Unable to write decoded volume into pgx files\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (parameters.orig_format) {
|
||||||
|
case PGX_DFMT: /* PGX */
|
||||||
|
if (strcmp("NULL",parameters.original) != 0){
|
||||||
|
fprintf(stdout,"Loading original file %s \n",parameters.original);
|
||||||
|
cparameters.subsampling_dx = 1; cparameters.subsampling_dy = 1; cparameters.subsampling_dz = 1;
|
||||||
|
cparameters.volume_offset_x0 = 0;cparameters.volume_offset_y0 = 0;cparameters.volume_offset_z0 = 0;
|
||||||
|
original = pgxtovolume(parameters.original,&cparameters);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BIN_DFMT: /* BMP */
|
||||||
|
if (strcmp("NULL",parameters.original) != 0 && strcmp("NULL",parameters.imgfile) != 0){
|
||||||
|
fprintf(stdout,"Loading original file %s %s\n",parameters.original,parameters.imgfile);
|
||||||
|
cparameters.subsampling_dx = 1; cparameters.subsampling_dy = 1; cparameters.subsampling_dz = 1;
|
||||||
|
cparameters.volume_offset_x0 = 0;cparameters.volume_offset_y0 = 0;cparameters.volume_offset_z0 = 0;
|
||||||
|
original = bintovolume(parameters.original,parameters.imgfile,&cparameters);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stdout, "[RESULT] Volume: %d x %d x %d (x %d bpv)\n ",
|
||||||
|
(volume->comps[0].w >> volume->comps[0].factor[0]),
|
||||||
|
(volume->comps[0].h >> volume->comps[0].factor[1]),
|
||||||
|
(volume->comps[0].l >> volume->comps[0].factor[2]),volume->comps[0].prec);
|
||||||
|
|
||||||
|
if(original){
|
||||||
|
psnr = calc_PSNR(original,volume);
|
||||||
|
ssim = calc_SSIM(original,volume);
|
||||||
|
if (psnr < 0.0)
|
||||||
|
fprintf(stdout, " PSNR: Inf , SSMI %f -- Perfect reconstruction!\n",ssim);
|
||||||
|
else
|
||||||
|
fprintf(stdout, " PSNR: %f , SSIM %f \n",psnr,ssim);
|
||||||
|
}
|
||||||
|
/* free remaining structures */
|
||||||
|
if(dinfo) {
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free volume data structure */
|
||||||
|
opj_volume_destroy(volume);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
115
src/bin/jp3d/tcltk/LPI_JP3D_VM.tcl
Executable file
115
src/bin/jp3d/tcltk/LPI_JP3D_VM.tcl
Executable file
@@ -0,0 +1,115 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# The next line is executed by /bin/sh, but not tcl \
|
||||||
|
exec wish "$0" ${1+"$@"}
|
||||||
|
lappend auto_path /usr/share/tcltk/bwidget1.9.2
|
||||||
|
|
||||||
|
namespace eval jp3dVM {
|
||||||
|
|
||||||
|
variable _progress 0
|
||||||
|
variable _afterid ""
|
||||||
|
variable _status "Compute in progress..."
|
||||||
|
variable notebook
|
||||||
|
variable mainframe
|
||||||
|
variable dataout "Process execution information"
|
||||||
|
variable status
|
||||||
|
variable prgtext
|
||||||
|
variable prgindic
|
||||||
|
|
||||||
|
set pwd [pwd]
|
||||||
|
cd [file dirname [info script]]
|
||||||
|
variable VMDIR [pwd]
|
||||||
|
cd $pwd
|
||||||
|
|
||||||
|
foreach script {encoder.tcl decoder.tcl} {
|
||||||
|
namespace inscope :: source $VMDIR/$script
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc jp3dVM::create { } {
|
||||||
|
variable notebook
|
||||||
|
variable mainframe
|
||||||
|
variable dataout
|
||||||
|
|
||||||
|
bind all <F12> { catch {console show} }
|
||||||
|
|
||||||
|
# Menu description
|
||||||
|
set descmenu {
|
||||||
|
"&File" {} {} 0 {
|
||||||
|
{command "E&xit" {} "Exit BWidget jp3dVM" {} -command exit}
|
||||||
|
}
|
||||||
|
"&Options" {} {} 0 {
|
||||||
|
{command "&Encode" {} "Show encoder" {}
|
||||||
|
-command {$jp3dVM::notebook raise [$jp3dVM::notebook page 0]}
|
||||||
|
}
|
||||||
|
{command "&Decode" {} "Show decoder" {}
|
||||||
|
-command {$jp3dVM::notebook raise [$jp3dVM::notebook page 1]}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"&Help" {} {} 0 {
|
||||||
|
{command "&About authors..." {} "Show info about authors" {}
|
||||||
|
-command {MessageDlg .msgdlg -parent . -title "About authors" -message " Copyright @ LPI-UVA 2006 " -type ok -icon info}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set mainframe [MainFrame .mainframe \
|
||||||
|
-menu $descmenu \
|
||||||
|
-textvariable jp3dVM::status \
|
||||||
|
-progressvar jp3dVM::prgindic]
|
||||||
|
|
||||||
|
$mainframe addindicator -text "JP3D Verification Model 1.0.0"
|
||||||
|
|
||||||
|
# NoteBook creation
|
||||||
|
set frame [$mainframe getframe]
|
||||||
|
set notebook [NoteBook $frame.nb]
|
||||||
|
|
||||||
|
set logo [frame $frame.logo]
|
||||||
|
#creo imagen logo
|
||||||
|
image create photo LPIimg -file logoLPI.gif
|
||||||
|
set logoimg [Label $logo.logoimg -image LPIimg]
|
||||||
|
|
||||||
|
set f0 [VMEncoder::create $notebook]
|
||||||
|
set f1 [VMDecoder::create $notebook]
|
||||||
|
|
||||||
|
set tfinfo [TitleFrame $frame.codinfo -text "Program Execution"]
|
||||||
|
set codinfo [$tfinfo getframe]
|
||||||
|
set sw [ScrolledWindow $codinfo.sw -relief sunken -borderwidth 2 -scrollbar both]
|
||||||
|
set sf [ScrollableFrame $codinfo.sf ]
|
||||||
|
$sw setwidget $sf
|
||||||
|
set subf [$sf getframe]
|
||||||
|
set labinfo [label $subf.labinfo -textvariable jp3dVM::dataout -justify left]
|
||||||
|
|
||||||
|
pack $labinfo -side left
|
||||||
|
pack $sw
|
||||||
|
|
||||||
|
$notebook compute_size
|
||||||
|
$notebook raise [$notebook page 0]
|
||||||
|
|
||||||
|
pack $logoimg -side left -fill x -expand yes
|
||||||
|
pack $notebook -expand yes
|
||||||
|
pack $logo $tfinfo -side left -expand yes
|
||||||
|
pack $mainframe -fill both -expand yes
|
||||||
|
update idletasks
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc jp3dVM::main {} {
|
||||||
|
variable VMDIR
|
||||||
|
|
||||||
|
lappend ::auto_path [file dirname $VMDIR]
|
||||||
|
namespace inscope :: package require BWidget
|
||||||
|
|
||||||
|
option add *TitleFrame.l.font {helvetica 11 bold italic}
|
||||||
|
|
||||||
|
wm withdraw .
|
||||||
|
wm title . "JP3D Verification Model @ LPI"
|
||||||
|
|
||||||
|
jp3dVM::create
|
||||||
|
BWidget::place . 0 0 center
|
||||||
|
wm deiconify .
|
||||||
|
raise .
|
||||||
|
focus -force .
|
||||||
|
}
|
||||||
|
|
||||||
|
jp3dVM::main
|
||||||
|
wm geom . [wm geom .]
|
||||||
13
src/bin/jp3d/tcltk/README
Normal file
13
src/bin/jp3d/tcltk/README
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
HOWTO USE THE TCL/TK APP IN 'jp3d/tcltk'
|
||||||
|
----------------------------------------
|
||||||
|
1. Download the 'BWidget-1.9.2'
|
||||||
|
http://www.sourceforge.net/projects/tcllib/
|
||||||
|
|
||||||
|
2. Install it e.g. in '/usr/local/BWidget-1.9.2/'
|
||||||
|
3. Add the lappend command in line 4
|
||||||
|
to jp3d/tcltk/LPI_JP3D_VM.tcl:
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
# The next line is executed by /bin/sh, but not tcl \
|
||||||
|
exec wish "$0" ${1+"$@"}
|
||||||
|
lappend auto_path /usr/local/BWidget-1.9.2
|
||||||
BIN
src/bin/jp3d/tcltk/Thumbs.db
Executable file
BIN
src/bin/jp3d/tcltk/Thumbs.db
Executable file
Binary file not shown.
272
src/bin/jp3d/tcltk/decoder.tcl
Executable file
272
src/bin/jp3d/tcltk/decoder.tcl
Executable file
@@ -0,0 +1,272 @@
|
|||||||
|
|
||||||
|
namespace eval VMDecoder {
|
||||||
|
variable var
|
||||||
|
variable JP3Ddecoder "../bin/jp3d_to_volume.exe"
|
||||||
|
#variable JP3Ddecoder "jp3d_to_volume.exe"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc VMDecoder::create { nb } {
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set frameD [$nb insert end VMDecoder -text "Decoder"]
|
||||||
|
set topfD [frame $frameD.topfD]
|
||||||
|
set medfD [frame $frameD.medfD]
|
||||||
|
set bottomfD [frame $frameD.bottomfD]
|
||||||
|
set srcfD [TitleFrame $topfD.srcfD -text "Source"]
|
||||||
|
set dstfD [TitleFrame $topfD.dstfD -text "Destination"]
|
||||||
|
set paramfD [TitleFrame $medfD.paramfD -text "Decoding parameters"]
|
||||||
|
set infofD [TitleFrame $medfD.infofD -text "Distortion measures"]
|
||||||
|
|
||||||
|
set frame1 [$srcfD getframe]
|
||||||
|
_sourceD $frame1
|
||||||
|
set frame2 [$dstfD getframe]
|
||||||
|
_destinationD $frame2
|
||||||
|
set frame3 [$infofD getframe]
|
||||||
|
_originalD $frame3
|
||||||
|
set frame4 [$paramfD getframe]
|
||||||
|
_paramsD $frame4
|
||||||
|
|
||||||
|
set butD [Button $bottomfD.butD -text "Decode!" \
|
||||||
|
-command "VMDecoder::_decode $frame1 $frame2 $frame3" \
|
||||||
|
-helptext "Decoding trigger button"]
|
||||||
|
set butR [Button $bottomfD.butR -text "Save info" \
|
||||||
|
-command "VMDecoder::_save $frame3" \
|
||||||
|
-helptext "Save information"]
|
||||||
|
|
||||||
|
pack $srcfD $dstfD -side left -fill both -padx 10 -ipadx 5 -expand yes
|
||||||
|
pack $topfD -pady 4 -fill x
|
||||||
|
|
||||||
|
pack $paramfD $infofD -side left -fill both -padx 10 -pady 2 -ipadx 5 -expand yes
|
||||||
|
pack $medfD -pady 4 -fill x
|
||||||
|
|
||||||
|
pack $butD $butR -side left -padx 4 -pady 5 -expand yes
|
||||||
|
pack $bottomfD -pady 4 -fill x
|
||||||
|
|
||||||
|
return $frameD
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc fileDialogD {w ent operation} {
|
||||||
|
|
||||||
|
variable file
|
||||||
|
|
||||||
|
if {$operation == "open"} {
|
||||||
|
#-----Type names---------Extension(s)---
|
||||||
|
set types {
|
||||||
|
{"JP3D Files" {.jp3d} }
|
||||||
|
{"All files" *}
|
||||||
|
}
|
||||||
|
set file [tk_getOpenFile -filetypes $types -parent $w ]
|
||||||
|
} elseif {$operation == "original"} {
|
||||||
|
#-----Type names---------Extension(s)---
|
||||||
|
set types {
|
||||||
|
{"BIN Raw Image Files" {.bin} }
|
||||||
|
{"PGX Raw Image Files" {.pgx} }
|
||||||
|
{"All files" *}
|
||||||
|
}
|
||||||
|
set file [tk_getOpenFile -filetypes $types -parent $w ]
|
||||||
|
} else {
|
||||||
|
#-----Type names---------Extension(s)---
|
||||||
|
set types {
|
||||||
|
{"BIN Raw Image Files" {.bin} }
|
||||||
|
{"PGX Raw Image Files" {.pgx} }
|
||||||
|
{"All files" *}
|
||||||
|
}
|
||||||
|
set file [tk_getSaveFile -filetypes $types -parent $w -initialfile Untitled -defaultextension "*.bin"]
|
||||||
|
}
|
||||||
|
if {[string compare $file ""]} {
|
||||||
|
$ent delete 0 end
|
||||||
|
$ent insert end $file
|
||||||
|
$ent xview moveto 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMDecoder::_sourceD { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set labsrcD [LabelFrame $parent.labsrcD -text "Select compressed file: " -side top \
|
||||||
|
-anchor w -relief flat -borderwidth 0]
|
||||||
|
set subsrcD [$labsrcD getframe]
|
||||||
|
set listD [entry $subsrcD.entrysrcD -width 40 -textvariable VMDecoder::var(sourceD)]
|
||||||
|
|
||||||
|
set labbrw [LabelFrame $parent.labbrw -side top -anchor w -relief flat -borderwidth 0]
|
||||||
|
set subbrw [$labbrw getframe]
|
||||||
|
set butbrw [button $subbrw.butbrw -image [Bitmap::get open] \
|
||||||
|
-relief raised -borderwidth 1 -padx 1 -pady 1 \
|
||||||
|
-command "fileDialogD . $subsrcD.entrysrcD open"]
|
||||||
|
|
||||||
|
pack $listD -side top
|
||||||
|
pack $butbrw -side top
|
||||||
|
pack $labsrcD $labbrw -side left -fill both -expand yes
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMDecoder::_destinationD { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set labdstD [LabelFrame $parent.labdstD -text "Save decompressed volume file(s) as: " -side top \
|
||||||
|
-anchor w -relief flat -borderwidth 0]
|
||||||
|
set subdstD [$labdstD getframe]
|
||||||
|
set listD [entry $subdstD.entrydstD -width 40 -textvariable VMDecoder::var(destinationD)]
|
||||||
|
|
||||||
|
set labbrw [LabelFrame $parent.labbrw -side top -anchor w -relief flat -borderwidth 0]
|
||||||
|
set subbrw [$labbrw getframe]
|
||||||
|
set butbrw [button $subbrw.butbrw -image [Bitmap::get save] \
|
||||||
|
-relief raised -borderwidth 1 -padx 1 -pady 1 \
|
||||||
|
-command "fileDialogD . $subdstD.entrydstD save"]
|
||||||
|
|
||||||
|
pack $listD -side top
|
||||||
|
pack $butbrw -side top
|
||||||
|
pack $labdstD $labbrw -side left -fill both -expand yes
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMDecoder::_originalD { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set laborgD [LabelFrame $parent.laborgD -text "Select original file: " -side top \
|
||||||
|
-anchor w -relief flat -borderwidth 0]
|
||||||
|
set suborgD [$laborgD getframe]
|
||||||
|
set listorgD [entry $suborgD.entryorgD -width 30 -textvariable VMDecoder::var(originalD)]
|
||||||
|
|
||||||
|
set labbrw2 [LabelFrame $parent.labbrw2 -side top -anchor w -relief flat -borderwidth 0]
|
||||||
|
set subbrw2 [$labbrw2 getframe]
|
||||||
|
set butbrw2 [button $subbrw2.butbrw2 -image [Bitmap::get open] \
|
||||||
|
-relief raised -borderwidth 1 -padx 1 -pady 1 \
|
||||||
|
-command "fileDialogD . $suborgD.entryorgD original"]
|
||||||
|
|
||||||
|
set infoD [Label $parent.infoD -relief sunken -textvariable VMDecoder::var(decodinfo) -justify left]
|
||||||
|
|
||||||
|
pack $listorgD -side left -anchor n
|
||||||
|
pack $butbrw2 -side left -anchor n
|
||||||
|
pack $infoD -side bottom -anchor nw -pady 4 -ipadx 150 -ipady 20 -expand yes
|
||||||
|
pack $laborgD $labbrw2 -side left -fill both
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMDecoder::_paramsD { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
########### DECODING #############
|
||||||
|
set labcod [LabelFrame $parent.labcod -side top -anchor w -relief sunken -borderwidth 1]
|
||||||
|
set subcod [$labcod getframe]
|
||||||
|
|
||||||
|
set frameres [frame $subcod.frameres -borderwidth 1]
|
||||||
|
set labres [LabelEntry $frameres.labres -label "Resolutions to discard: " -labelwidth 20 -labelanchor w \
|
||||||
|
-textvariable VMDecoder::var(resdiscard) -editable 1 \
|
||||||
|
-helptext "Number of highest resolution levels to be discarded on each dimension" ]
|
||||||
|
set VMDecoder::var(resdiscard) "0,0,0"
|
||||||
|
|
||||||
|
set framelayer [frame $subcod.framelayer -borderwidth 1]
|
||||||
|
set lablayer [LabelEntry $framelayer.lablayer -label "Layers to decode: " -labelwidth 20 -labelanchor w \
|
||||||
|
-textvariable VMDecoder::var(layer) -editable 1 \
|
||||||
|
-helptext "Maximum number of quality layers to decode" ]
|
||||||
|
set VMDecoder::var(layer) "All"
|
||||||
|
|
||||||
|
set framebe [frame $subcod.framebe -borderwidth 1]
|
||||||
|
set chkbe [checkbutton $framebe.chkbe -text "Write decoded file with BigEndian byte order" \
|
||||||
|
-variable VMDecoder::var(be) -onvalue 1 -offvalue 0 ]
|
||||||
|
|
||||||
|
pack $labres -side left -padx 2 -anchor n
|
||||||
|
pack $lablayer -side left -padx 2 -anchor n
|
||||||
|
pack $chkbe -side left -padx 2 -anchor w
|
||||||
|
pack $frameres $framelayer $framebe -side top -anchor w
|
||||||
|
|
||||||
|
pack $subcod -anchor n
|
||||||
|
pack $labcod -side left -fill both -padx 4 -expand yes
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc VMDecoder::_decode { framesrc framedst frameinfo} {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set sourceD [$framesrc.labsrcD.f.entrysrcD get ]
|
||||||
|
set destinationD [$framedst.labdstD.f.entrydstD get ]
|
||||||
|
set originD [$frameinfo.laborgD.f.entryorgD get ]
|
||||||
|
set cond1 [string match *.pgx [string tolower $destinationD]]
|
||||||
|
set cond2 [string match *\**.pgx [string tolower $destinationD]]
|
||||||
|
set cond3 [string match *.bin [string tolower $destinationD]]
|
||||||
|
|
||||||
|
#comprobamos datos son correctos
|
||||||
|
if {($cond1 == 1) && ($cond2 == 0)} {
|
||||||
|
set pgx "*.pgx"
|
||||||
|
set pattern [string range $destinationD 0 [expr [string length $destinationD]-5]]
|
||||||
|
set destinationD $pattern$img
|
||||||
|
} elseif {$sourceD == ""} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : Source file is not defined !" -type ok -icon error
|
||||||
|
} elseif {$destinationD == ""} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : Destination file is not defined !" -type ok -icon error
|
||||||
|
} else {
|
||||||
|
|
||||||
|
#creamos datain a partir de los parametros de entrada
|
||||||
|
#set dirJP3Ddecoder [mk_relativepath $VMDecoder::JP3Ddecoder]
|
||||||
|
set dirJP3Ddecoder $VMDecoder::JP3Ddecoder
|
||||||
|
set datain [concat " $dirJP3Ddecoder -i [mk_relativepath $sourceD] "]
|
||||||
|
set datain [concat " $datain -o [mk_relativepath $destinationD] "]
|
||||||
|
if {$originD != ""} {
|
||||||
|
set datain [concat " $datain -O [mk_relativepath $originD] "]
|
||||||
|
if {$cond3 == 1} {
|
||||||
|
set img ".img"
|
||||||
|
set pattern [string range $originD 0 [expr [string length $originD]-5]]
|
||||||
|
set pattern $pattern$img
|
||||||
|
if {[file exists $pattern]} {
|
||||||
|
set datain [concat " $datain -m [mk_relativepath $pattern] "]
|
||||||
|
} else {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : IMG file associated to original BIN volume file not found in same directory !" -type ok -icon info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {$VMDecoder::var(resdiscard) != "0,0,0"} {
|
||||||
|
set datain [concat " $datain -r $VMDecoder::var(resdiscard) "]
|
||||||
|
}
|
||||||
|
if {$VMDecoder::var(layer) != "All" && $VMDecoder::var(layer) > 0} {
|
||||||
|
set datain [concat " $datain -l $VMDecoder::var(layer) "]
|
||||||
|
}
|
||||||
|
if {$VMDecoder::var(be) == 1} {
|
||||||
|
set datain [concat " $datain -BE"]
|
||||||
|
}
|
||||||
|
|
||||||
|
set VMDecoder::var(progval) 10
|
||||||
|
ProgressDlg .progress -parent . -title "Wait..." \
|
||||||
|
-type infinite \
|
||||||
|
-width 20 \
|
||||||
|
-textvariable "Compute in progress..."\
|
||||||
|
-variable VMDecoder::progval \
|
||||||
|
-stop "Stop" \
|
||||||
|
-command {destroy .progress}
|
||||||
|
|
||||||
|
after 200 set VMDecoder::var(progval) 2
|
||||||
|
|
||||||
|
set fp [open "| $datain " r+]
|
||||||
|
fconfigure $fp -buffering line
|
||||||
|
set jp3dVM::dataout [concat "EXECUTED PROGRAM:\n\t$datain"]
|
||||||
|
while {-1 != [gets $fp tmp]} {
|
||||||
|
set jp3dVM::dataout [concat "$jp3dVM::dataout\n$tmp"]
|
||||||
|
}
|
||||||
|
close $fp
|
||||||
|
destroy .progress
|
||||||
|
set cond [string first "ERROR" $jp3dVM::dataout]
|
||||||
|
set cond2 [string first "PSNR" $jp3dVM::dataout]
|
||||||
|
set cond3 [string first "RESULT" $jp3dVM::dataout]
|
||||||
|
if {$cond != -1} {
|
||||||
|
MessageDlg .msgdlg -parent . -message [string range $jp3dVM::dataout [expr $cond-1] end] -type ok -icon error
|
||||||
|
} elseif {$cond3 != -1} {
|
||||||
|
if {$cond2 != -1} {
|
||||||
|
set VMDecoder::var(decodinfo) [string range $jp3dVM::dataout [expr $cond2-1] end]
|
||||||
|
}
|
||||||
|
MessageDlg .msgdlg -parent . -message [string range $jp3dVM::dataout [expr $cond3-1] end] -type ok -icon info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMDecoder::_save { frameinfo } {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
470
src/bin/jp3d/tcltk/encoder.tcl
Executable file
470
src/bin/jp3d/tcltk/encoder.tcl
Executable file
@@ -0,0 +1,470 @@
|
|||||||
|
|
||||||
|
namespace eval VMEncoder {
|
||||||
|
variable var
|
||||||
|
variable JP3Dencoder "../bin/bin/volume_to_jp3d"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::create { nb } {
|
||||||
|
|
||||||
|
set frame [$nb insert end VMEncoder -text "Encoder"]
|
||||||
|
set topf [frame $frame.topf]
|
||||||
|
set midf [frame $frame.midf]
|
||||||
|
set bottomf [frame $frame.bottomf]
|
||||||
|
set srcf [TitleFrame $topf.srcf -text "Source"]
|
||||||
|
set dstf [TitleFrame $topf.dstf -text "Destination"]
|
||||||
|
set Tparf [TitleFrame $midf.parfT -text "Transform Parameters"]
|
||||||
|
set Cparf [TitleFrame $midf.parfC -text "Coding Parameters"]
|
||||||
|
|
||||||
|
set frame1 [$srcf getframe]
|
||||||
|
VMEncoder::_sourceE $frame1
|
||||||
|
|
||||||
|
set frame2 [$dstf getframe]
|
||||||
|
VMEncoder::_destinationE $frame2
|
||||||
|
|
||||||
|
set frame3 [$Tparf getframe]
|
||||||
|
VMEncoder::_transformE $frame3
|
||||||
|
|
||||||
|
set frame4 [$Cparf getframe]
|
||||||
|
VMEncoder::_codingE $frame4
|
||||||
|
|
||||||
|
set butE [Button $bottomf.butE -text "Encode!" \
|
||||||
|
-command "VMEncoder::_encode $frame1 $frame2" \
|
||||||
|
-helptext "Encoding trigger button"]
|
||||||
|
set butR [Button $bottomf.butR -text "Restore defaults" \
|
||||||
|
-command "VMEncoder::_reset $frame1 $frame2 $frame3 $frame4" \
|
||||||
|
-helptext "Reset to default values"]
|
||||||
|
|
||||||
|
pack $srcf $dstf -side left -fill y -padx 4 -expand yes
|
||||||
|
pack $topf -pady 2 -fill x
|
||||||
|
|
||||||
|
pack $Tparf $Cparf -side left -fill both -padx 4 -expand yes
|
||||||
|
pack $midf -pady 2 -fill x
|
||||||
|
|
||||||
|
pack $butE $butR -side left -padx 40 -pady 5 -fill y -expand yes
|
||||||
|
pack $bottomf -pady 2 -fill x
|
||||||
|
|
||||||
|
return $frame
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::_sourceE { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set labsrc [LabelFrame $parent.labsrc -text "Select volume file to encode: " -side top \
|
||||||
|
-anchor w -relief flat -borderwidth 0]
|
||||||
|
set subsrc [$labsrc getframe]
|
||||||
|
set list [entry $subsrc.entrysrc -width 30 -textvariable VMDecoder::var(source)]
|
||||||
|
|
||||||
|
set labbrw [LabelFrame $parent.labbrw -side top -anchor w -relief flat -borderwidth 0]
|
||||||
|
set subbrw [$labbrw getframe]
|
||||||
|
set butbrw [button $subbrw.butbrw -image [Bitmap::get open] \
|
||||||
|
-relief raised -borderwidth 1 -padx 1 -pady 1 \
|
||||||
|
-command "fileDialogE . $subsrc.entrysrc open"]
|
||||||
|
|
||||||
|
pack $list -side top
|
||||||
|
pack $butbrw -side top
|
||||||
|
pack $labsrc $labbrw -side left -fill both -expand yes
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::_destinationE { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set labdst [LabelFrame $parent.labdst -text "Save compressed volume as: " -side top \
|
||||||
|
-anchor w -relief flat -borderwidth 0]
|
||||||
|
set subdst [$labdst getframe]
|
||||||
|
set list [entry $subdst.entrydst -width 30 -textvariable VMDecoder::var(destination)]
|
||||||
|
|
||||||
|
set labbrw [LabelFrame $parent.labbrw -side top -anchor w -relief flat -borderwidth 0]
|
||||||
|
set subbrw [$labbrw getframe]
|
||||||
|
set butbrw [button $subbrw.butbrw -image [Bitmap::get save] \
|
||||||
|
-relief raised -borderwidth 1 -padx 1 -pady 1 \
|
||||||
|
-command "fileDialogE . $subdst.entrydst save"]
|
||||||
|
|
||||||
|
pack $list -side top
|
||||||
|
pack $butbrw -side top
|
||||||
|
pack $labdst $labbrw -side left -fill both -expand yes
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::_codingE { parent } {
|
||||||
|
|
||||||
|
|
||||||
|
########### CODING #############
|
||||||
|
set labcod [LabelFrame $parent.labcod -side top -anchor w -relief sunken -borderwidth 1]
|
||||||
|
set subcod [$labcod getframe]
|
||||||
|
|
||||||
|
set framerate [frame $subcod.framerate -borderwidth 1]
|
||||||
|
set labrate [LabelEntry $framerate.labrate -label "Rates: " -labelwidth 9 -labelanchor w \
|
||||||
|
-textvariable VMEncoder::var(rate) -editable 1 \
|
||||||
|
-helptext "Compression ratios for different layers (R1, R2, R3,...). If R=1, lossless coding" ]
|
||||||
|
set VMEncoder::var(rate) "1"
|
||||||
|
|
||||||
|
set framecblk [frame $subcod.framecblk -borderwidth 1]
|
||||||
|
set labcblk [LabelEntry $framecblk.labcblk -label "Codeblock: " -labelwidth 9 -labelanchor w \
|
||||||
|
-textvariable VMEncoder::var(cblksize) -editable 1 \
|
||||||
|
-helptext "Codeblock size (X, Y, Z)" ]
|
||||||
|
set VMEncoder::var(cblksize) "64,64,64"
|
||||||
|
|
||||||
|
set frametile [frame $subcod.frametile -borderwidth 1]
|
||||||
|
set labtile [LabelEntry $frametile.labtile -label "Tile size: " -labelwidth 9 -labelanchor w \
|
||||||
|
-textvariable VMEncoder::var(tilesize) -editable 1 \
|
||||||
|
-helptext "Tile size (X, Y, Z)" ]
|
||||||
|
set VMEncoder::var(tilesize) "512,512,512"
|
||||||
|
|
||||||
|
set framesop [frame $subcod.framesop -borderwidth 1]
|
||||||
|
set chksop [checkbutton $framesop.chksop -text "Write SOP marker" \
|
||||||
|
-variable VMEncoder::var(sop) -onvalue 1 -offvalue 0 ]
|
||||||
|
set frameeph [frame $subcod.frameeph -borderwidth 1]
|
||||||
|
set chkeph [checkbutton $frameeph.chkeph -text "Write EPH marker" \
|
||||||
|
-variable VMEncoder::var(eph) -onvalue 1 -offvalue 0 ]
|
||||||
|
|
||||||
|
set framepoc [frame $subcod.framepoc -borderwidth 1]
|
||||||
|
set labpoc [label $framepoc.labpoc -text "Progression order: " ]
|
||||||
|
set progorder [ComboBox $framepoc.progorder \
|
||||||
|
-text {Choose a progression order} \
|
||||||
|
-width 10 \
|
||||||
|
-textvariable VMEncoder::var(progorder) \
|
||||||
|
-values {"LRCP" "RLCP" "RPCL" "PCRL" "CPRL"} \
|
||||||
|
-helptext "Progression order"]
|
||||||
|
set VMEncoder::var(progorder) "LRCP"
|
||||||
|
|
||||||
|
pack $labrate -side left -padx 2 -anchor n
|
||||||
|
pack $labcblk -side left -padx 2 -anchor n
|
||||||
|
pack $labpoc $progorder -side left -padx 2 -anchor w
|
||||||
|
#pack $labtile -side left -padx 2 -anchor n
|
||||||
|
pack $chksop -side left -padx 2 -anchor w
|
||||||
|
pack $chkeph -side left -padx 2 -anchor w
|
||||||
|
########### ENTROPY CODING #############
|
||||||
|
set labent [LabelFrame $parent.labent -text "Entropy Coding" -side top -anchor w -relief sunken -borderwidth 1]
|
||||||
|
set subent [$labent getframe]
|
||||||
|
foreach entval {2EB 3EB} entropy {2D_EBCOT 3D_EBCOT} {
|
||||||
|
set rad [radiobutton $subent.$entval \
|
||||||
|
-text $entropy \
|
||||||
|
-variable VMEncoder::var(encoding) \
|
||||||
|
-command "disableGR $entval $labcblk $progorder $labrate $chksop $chkeph" \
|
||||||
|
-value $entval ]
|
||||||
|
pack $rad -anchor w
|
||||||
|
}
|
||||||
|
$subent.2EB select
|
||||||
|
|
||||||
|
pack $subent -padx 2 -anchor n
|
||||||
|
|
||||||
|
pack $framerate $framecblk $framepoc $framesop $frameeph -side top -anchor w
|
||||||
|
pack $subcod -anchor n
|
||||||
|
|
||||||
|
pack $labent $labcod -side left -fill both -padx 4 -expand yes
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::_transformE { parent } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
########### TRANSFORM #############
|
||||||
|
set labtrf [LabelFrame $parent.labtrf -text "Transform" -side top -anchor w -relief sunken -borderwidth 1]
|
||||||
|
set subtrf [$labtrf getframe]
|
||||||
|
set labres [LabelFrame $parent.labres -side top -anchor w -relief sunken -borderwidth 1]
|
||||||
|
set subres [$labres getframe]
|
||||||
|
|
||||||
|
########### ATK #############
|
||||||
|
set frameatk [frame $subres.frameatk -borderwidth 1]
|
||||||
|
set labatk [label $frameatk.labatk -text "Wavelet kernel: " -anchor w]
|
||||||
|
set atk [ComboBox $frameatk.atk \
|
||||||
|
-textvariable VMEncoder::var(atk) \
|
||||||
|
-width 20 \
|
||||||
|
-text {Choose a wavelet kernel} \
|
||||||
|
-editable false \
|
||||||
|
-values {"R5.3" "I9.7"} ]
|
||||||
|
set VMEncoder::var(atk) "R5.3"
|
||||||
|
pack $labatk $atk -side left -anchor w
|
||||||
|
########### RESOLUTIONS #############
|
||||||
|
set frameres1 [frame $subres.frameres1 -borderwidth 1]
|
||||||
|
set labresolution [label $frameres1.labresol -text "Resolutions: " -anchor w ]
|
||||||
|
set frameres2 [frame $subres.frameres2 -borderwidth 1]
|
||||||
|
set labresX [label $frameres2.labresX -text " X" -anchor w ]
|
||||||
|
set labresY [label $frameres2.labresY -text " Y" -anchor w ]
|
||||||
|
set labresZ [label $frameres2.labresZ -text " Z" -anchor w ]
|
||||||
|
|
||||||
|
|
||||||
|
set resX [SpinBox $frameres2.spinresX \
|
||||||
|
-range {1 6 1} -textvariable VMEncoder::var(resX) \
|
||||||
|
-helptext "Number of resolutions in X" \
|
||||||
|
-width 3 \
|
||||||
|
-editable false ]
|
||||||
|
set resY [SpinBox $frameres2.spinresY \
|
||||||
|
-range {1 6 1} -textvariable VMEncoder::var(resY) \
|
||||||
|
-helptext "Number of resolutions in Y" \
|
||||||
|
-width 3 \
|
||||||
|
-editable false ]
|
||||||
|
set resZ [SpinBox $frameres2.spinresZ \
|
||||||
|
-range {1 6 1} -textvariable VMEncoder::var(resZ) \
|
||||||
|
-helptext "Number of resolutions in Z" \
|
||||||
|
-width 3 \
|
||||||
|
-editable false \
|
||||||
|
-state disabled ]
|
||||||
|
set VMEncoder::var(resX) 3
|
||||||
|
set VMEncoder::var(resY) 3
|
||||||
|
set VMEncoder::var(resZ) 3
|
||||||
|
|
||||||
|
########### TRF #############
|
||||||
|
foreach trfval {2DWT 3DWT} trf {2D-DWT 3D-DWT} {
|
||||||
|
set rad [radiobutton $subtrf.$trfval -text $trf \
|
||||||
|
-variable VMEncoder::var(transform) \
|
||||||
|
-command "disable3RLS $trfval $atk $resX $resY $resZ"\
|
||||||
|
-value $trfval ]
|
||||||
|
pack $rad -anchor w
|
||||||
|
}
|
||||||
|
$subtrf.2DWT select
|
||||||
|
|
||||||
|
pack $subtrf -side left -padx 2 -pady 4
|
||||||
|
|
||||||
|
pack $labresolution -padx 2 -side left -anchor w
|
||||||
|
pack $labresX $resX -padx 2 -side left -anchor w
|
||||||
|
pack $labresY $resY -padx 2 -side left -anchor w
|
||||||
|
pack $labresZ $resZ -padx 2 -side left -anchor w
|
||||||
|
|
||||||
|
pack $frameres1 -side top -fill x
|
||||||
|
pack $frameres2 $frameatk -side top -padx 2 -pady 4 -anchor n
|
||||||
|
|
||||||
|
pack $subres -side left -padx 2 -pady 4
|
||||||
|
pack $labtrf $labres -side left -fill both -padx 4 -expand yes
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc VMEncoder::_encode { framesrc framedst } {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
set source [$framesrc.labsrc.f.entrysrc get ]
|
||||||
|
set destination [$framedst.labdst.f.entrydst get ]
|
||||||
|
set cond1 [string match *.pgx [string tolower $source]]
|
||||||
|
set cond2 [string match *-*.pgx [string tolower $source]]
|
||||||
|
set cond3 [string match *.bin [string tolower $source]]
|
||||||
|
|
||||||
|
set img ".img"
|
||||||
|
set pattern [string range $source 0 [expr [string length $source]-5]]
|
||||||
|
set pattern $pattern$img
|
||||||
|
set exist [file exists $pattern]
|
||||||
|
|
||||||
|
#comprobamos datos son correctos
|
||||||
|
if {($cond1 == 1) && ($cond2 == 0)} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Info : Really want to encode an slice instead of a volume?.\n For a group of .pgx slices, name must contain a - denoting a sequential index!" -type ok -icon info
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$source == ""} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : Source file is not defined !" -type ok -icon error
|
||||||
|
} elseif {$destination == ""} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : Destination file is not defined !" -type ok -icon error
|
||||||
|
} elseif { ($VMEncoder::var(transform) != "3RLS") && ($VMEncoder::var(atk) == "Choose a wavelet transformation kernel") } {
|
||||||
|
MessageDlg .msgdlg -parent . -title "Info" -message "Please choose a wavelet transformation kernel"\
|
||||||
|
-type ok -icon warning
|
||||||
|
} elseif {($exist == 0) && ($cond1 == 0) && ($cond3 == 1)} {
|
||||||
|
MessageDlg .msgdlg -parent . -message "Error : IMG file associated to BIN volume file not found in same directory !" -type ok -icon info
|
||||||
|
} else {
|
||||||
|
|
||||||
|
#creamos datain a partir de los parametros de entrada
|
||||||
|
# set dirJP3Dencoder [mk_relativepath $VMEncoder::JP3Dencoder]
|
||||||
|
set dirJP3Dencoder $VMEncoder::JP3Dencoder
|
||||||
|
set datain [concat " $dirJP3Dencoder -i [mk_relativepath $source] "]
|
||||||
|
if {$cond3 == 1} {
|
||||||
|
set datain [concat " $datain -m [mk_relativepath $pattern] "]
|
||||||
|
}
|
||||||
|
set datain [concat " $datain -o [mk_relativepath $destination] "]
|
||||||
|
if {$VMEncoder::var(encoding) != "2EB"} {
|
||||||
|
set datain [concat " $datain -C $VMEncoder::var(encoding) "]
|
||||||
|
}
|
||||||
|
if {$VMEncoder::var(transform) == "2DWT"} {
|
||||||
|
set datain [concat " $datain -n $VMEncoder::var(resX),$VMEncoder::var(resY) "]
|
||||||
|
} elseif {$VMEncoder::var(transform) == "3DWT"} {
|
||||||
|
set datain [concat " $datain -n $VMEncoder::var(resX),$VMEncoder::var(resY),$VMEncoder::var(resZ) "]
|
||||||
|
}
|
||||||
|
|
||||||
|
set datain [concat " $datain -r $VMEncoder::var(rate) "]
|
||||||
|
|
||||||
|
if {$VMEncoder::var(atk) == "I9.7"} {
|
||||||
|
set datain [concat " $datain -I "]
|
||||||
|
}
|
||||||
|
if {$VMEncoder::var(sop) == 1} {
|
||||||
|
set datain [concat " $datain -SOP "]
|
||||||
|
}
|
||||||
|
if {$VMEncoder::var(eph) == 1} {
|
||||||
|
set datain [concat " $datain -EPH "]
|
||||||
|
}
|
||||||
|
if {$VMEncoder::var(progorder) != "LRCP"} {
|
||||||
|
set datain [concat " $datain -p $VMEncoder::var(progorder) "]
|
||||||
|
}
|
||||||
|
if {$VMEncoder::var(cblksize) != "64,64,64"} {
|
||||||
|
set datain [concat " $datain -b $VMEncoder::var(cblksize) "]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#Making this work would be great !!!
|
||||||
|
set VMEncoder::var(progval) 10
|
||||||
|
ProgressDlg .progress -parent . -title "Wait..." \
|
||||||
|
-type infinite \
|
||||||
|
-width 20 \
|
||||||
|
-textvariable "Compute in progress..."\
|
||||||
|
-variable VMEncoder::progval \
|
||||||
|
-stop "Stop" \
|
||||||
|
-command {destroy .progress}
|
||||||
|
after 200 set VMEncoder::var(progval) 2
|
||||||
|
set fp [open "| $datain " r+]
|
||||||
|
fconfigure $fp -buffering line
|
||||||
|
set jp3dVM::dataout [concat "EXECUTED PROGRAM:\n\t$datain"]
|
||||||
|
while {-1 != [gets $fp tmp]} {
|
||||||
|
set jp3dVM::dataout [concat "$jp3dVM::dataout\n$tmp"]
|
||||||
|
}
|
||||||
|
destroy .progress
|
||||||
|
set cond [string first "ERROR" $jp3dVM::dataout]
|
||||||
|
set cond2 [string first "RESULT" $jp3dVM::dataout]
|
||||||
|
if {$cond != -1} {
|
||||||
|
MessageDlg .msgdlg -parent . -message [string range $jp3dVM::dataout [expr $cond-1] end] -type ok -icon error
|
||||||
|
} elseif {$cond2 != -1} {
|
||||||
|
MessageDlg .msgdlg -parent . -message [string range $jp3dVM::dataout [expr $cond2+7] end] -type ok -icon info
|
||||||
|
close $fp
|
||||||
|
} else {
|
||||||
|
#Must do something with this !!! [pid $fp]
|
||||||
|
close $fp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VMEncoder::_reset { framesrc framedst frametrf framecod} {
|
||||||
|
|
||||||
|
variable var
|
||||||
|
|
||||||
|
#Restore defaults values
|
||||||
|
set VMEncoder::var(transform) 2DWT
|
||||||
|
set VMEncoder::var(encoding) 2EB
|
||||||
|
set VMEncoder::var(atk) "R5.3"
|
||||||
|
set VMEncoder::var(progorder) "LRCP"
|
||||||
|
set atk $frametrf.labres.f.frameatk.atk
|
||||||
|
set resX $frametrf.labres.f.frameres2.spinresX
|
||||||
|
set resY $frametrf.labres.f.frameres2.spinresY
|
||||||
|
set resZ $frametrf.labres.f.frameres2.spinresZ
|
||||||
|
disable3RLS 2DWT $atk $resX $resY $resZ
|
||||||
|
set labcblk $framecod.labcod.f.framecblk.labcblk
|
||||||
|
set progorder $framecod.labcod.f.framepoc.progorder
|
||||||
|
set labrate $framecod.labcod.f.framerate.labrate
|
||||||
|
set chksop $framecod.labcod.f.framesop.chksop
|
||||||
|
set chkeph $framecod.labcod.f.frameeph.chkeph
|
||||||
|
disableGR 3EB $labcblk $progorder $labrate $chksop $chkeph
|
||||||
|
|
||||||
|
$framesrc.labsrc.f.entrysrc delete 0 end
|
||||||
|
$framedst.labdst.f.entrydst delete 0 end
|
||||||
|
}
|
||||||
|
|
||||||
|
proc fileDialogE {w ent operation} {
|
||||||
|
|
||||||
|
variable file
|
||||||
|
variable i j
|
||||||
|
|
||||||
|
if {$operation == "open"} {
|
||||||
|
set types {
|
||||||
|
{"Source Image Files" {.pgx .bin} }
|
||||||
|
{"All files" *}
|
||||||
|
}
|
||||||
|
set file [tk_getOpenFile -filetypes $types -parent $w]
|
||||||
|
if {[string compare $file ""]} {
|
||||||
|
$ent delete 0 end
|
||||||
|
$ent insert end $file
|
||||||
|
$ent xview moveto 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set types {
|
||||||
|
{"JP3D Files" {.jp3d} }
|
||||||
|
{"JPEG2000 Files" {.j2k} }
|
||||||
|
{"All files" *}
|
||||||
|
}
|
||||||
|
set file [tk_getSaveFile -filetypes $types -parent $w \
|
||||||
|
-initialfile Untitled -defaultextension .jp3d]
|
||||||
|
if {[string compare $file ""]} {
|
||||||
|
$ent delete 0 end
|
||||||
|
$ent insert end $file
|
||||||
|
$ent xview moveto 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc mk_relativepath {abspath} {
|
||||||
|
|
||||||
|
set mydir [split [string trimleft [pwd] {/}] {/}]
|
||||||
|
set abspathcomps [split [string trimleft $abspath {/}] {/}]
|
||||||
|
|
||||||
|
set i 0
|
||||||
|
while {$i<[llength $mydir]} {
|
||||||
|
if {![string compare [lindex $abspathcomps $i] [lindex $mydir $i]]} {
|
||||||
|
incr i
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set h [expr [llength $mydir]-$i]
|
||||||
|
set j [expr [llength $abspathcomps]-$i]
|
||||||
|
|
||||||
|
if {!$h} {
|
||||||
|
set relpath "./"
|
||||||
|
} else {
|
||||||
|
set relpath ""
|
||||||
|
while { $h > 0 } {
|
||||||
|
set relpath "../$relpath"
|
||||||
|
incr h -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set h [llength $abspathcomps]
|
||||||
|
while { $h > $i } {
|
||||||
|
set relpath [concat $relpath[lindex $abspathcomps [expr [llength $abspathcomps]-$j]]/]
|
||||||
|
incr h -1
|
||||||
|
incr j -1
|
||||||
|
}
|
||||||
|
return [string trim $relpath {/}]
|
||||||
|
}
|
||||||
|
|
||||||
|
proc disable3RLS {flag atk resX resY resZ} {
|
||||||
|
|
||||||
|
if {$flag == "3RLS"} {
|
||||||
|
$atk configure -state disabled
|
||||||
|
$resX configure -state disabled
|
||||||
|
$resY configure -state disabled
|
||||||
|
$resZ configure -state disabled
|
||||||
|
} elseif {$flag == "2DWT"} {
|
||||||
|
$atk configure -state normal
|
||||||
|
$resX configure -state normal
|
||||||
|
$resY configure -state normal
|
||||||
|
$resZ configure -state disabled
|
||||||
|
} elseif {$flag == "3DWT"} {
|
||||||
|
$atk configure -state normal
|
||||||
|
$resX configure -state normal
|
||||||
|
$resY configure -state normal
|
||||||
|
$resZ configure -state normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc disableGR {flag labcblk progorder labrate chksop chkeph} {
|
||||||
|
|
||||||
|
if {$flag == "2EB"} {
|
||||||
|
$labcblk configure -state normal
|
||||||
|
$progorder configure -state normal
|
||||||
|
$labrate configure -state normal
|
||||||
|
$chksop configure -state normal
|
||||||
|
$chkeph configure -state normal
|
||||||
|
set VMEncoder::var(cblksize) "64,64,64"
|
||||||
|
set VMEncoder::var(tilesize) "512,512,512"
|
||||||
|
} elseif {$flag == "3EB"} {
|
||||||
|
$labcblk configure -state normal
|
||||||
|
$progorder configure -state normal
|
||||||
|
$labrate configure -state normal
|
||||||
|
$chksop configure -state normal
|
||||||
|
$chkeph configure -state normal
|
||||||
|
set VMEncoder::var(cblksize) "64,64,64"
|
||||||
|
set VMEncoder::var(tilesize) "512,512,512"
|
||||||
|
} else {
|
||||||
|
$labcblk configure -state disabled
|
||||||
|
$progorder configure -state disabled
|
||||||
|
$labrate configure -state disabled
|
||||||
|
$chksop configure -state disabled
|
||||||
|
$chkeph configure -state disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/bin/jp3d/tcltk/logoLPI.gif
Executable file
BIN
src/bin/jp3d/tcltk/logoLPI.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user