Compare commits
1044 Commits
version.1.
...
openjpeg-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c2a08edd7 | ||
|
|
d7c5c8518f | ||
|
|
f776cffbc6 | ||
|
|
666f71b2a1 | ||
|
|
2b7d5b18f3 | ||
|
|
18d5d25cb6 | ||
|
|
492d8ab7d9 | ||
|
|
2b93727bea | ||
|
|
18c5be69e9 | ||
|
|
5a70e97f51 | ||
|
|
f4707da97a | ||
|
|
51ab074d50 | ||
|
|
6d9e8a5a63 | ||
|
|
008de86533 | ||
|
|
ae49fd1aa9 | ||
|
|
79d18f7fd0 | ||
|
|
99d1859a44 | ||
|
|
866cd28ad4 | ||
|
|
71a9f498b5 | ||
|
|
b607da8ae9 | ||
|
|
a43d206b93 | ||
|
|
15863e7170 | ||
|
|
5e91877636 | ||
|
|
7e1d012161 | ||
|
|
de74605777 | ||
|
|
e8abf1fb25 | ||
|
|
b7fe7d25e1 | ||
|
|
138a65d6c1 | ||
|
|
9d0bdf69e5 | ||
|
|
9194dfb94b | ||
|
|
b7ebf54a29 | ||
|
|
3a80b72ac8 | ||
|
|
3e33012bd9 | ||
|
|
fd3f7ca2bb | ||
|
|
6e22c4f68a | ||
|
|
565ef29ae3 | ||
|
|
68398b2a5a | ||
|
|
5624e4a25f | ||
|
|
92e07f3b74 | ||
|
|
8447f0a323 | ||
|
|
f0a2fdd508 | ||
|
|
320784659d | ||
|
|
51ab8cd67d | ||
|
|
237253d83b | ||
|
|
fe100fb490 | ||
|
|
c7b646e23a | ||
|
|
41add6882b | ||
|
|
dd0d2c2f0a | ||
|
|
d38e32c036 | ||
|
|
73315c2edc | ||
|
|
6b51d11d08 | ||
|
|
59270c39a7 | ||
|
|
db82cf7778 | ||
|
|
ddb1d57766 | ||
|
|
5dd770746b | ||
|
|
fa436eb368 | ||
|
|
fcc658f106 | ||
|
|
2e7b8fb9a1 | ||
|
|
1778e2576e | ||
|
|
73c9e85642 | ||
|
|
76557d2eb3 | ||
|
|
9095c7361e | ||
|
|
c02c1432e8 | ||
|
|
8411ed4f80 | ||
|
|
4de95f320f | ||
|
|
aea18173d1 | ||
|
|
856fc0652f | ||
|
|
b01c1240cf | ||
|
|
836ec05920 | ||
|
|
9a52b30c3d | ||
|
|
76af73bc72 | ||
|
|
f7bc0b49cb | ||
|
|
9155e98911 | ||
|
|
7aee50de97 | ||
|
|
24966ffbda | ||
|
|
666ef53fd2 | ||
|
|
e02ba05034 | ||
|
|
b478912910 | ||
|
|
2001932c56 | ||
|
|
f54de95802 | ||
|
|
fa1c2454e6 | ||
|
|
6b94237679 | ||
|
|
aedff8a000 | ||
|
|
a0aa8dd851 | ||
|
|
440ef4873b | ||
|
|
ffad2fbe55 | ||
|
|
cc1354ebfa | ||
|
|
581d2ba8b4 | ||
|
|
61348b20b4 | ||
|
|
e619e06078 | ||
|
|
4f84d1693a | ||
|
|
71d244a5b6 | ||
|
|
f9a0f869e3 | ||
|
|
33c472d734 | ||
|
|
a8eb122c1f | ||
|
|
956b1a7697 | ||
|
|
472ce19183 | ||
|
|
740924fa61 | ||
|
|
01b4bb5447 | ||
|
|
ee3b02932a | ||
|
|
2a07d3d26b | ||
|
|
e238148d42 | ||
|
|
9d21695476 | ||
|
|
22d11a9ccb | ||
|
|
fc9248ea2b | ||
|
|
c302979738 | ||
|
|
e4d077bc98 | ||
|
|
76cd9b7f72 | ||
|
|
e71431ec78 | ||
|
|
7b335eb635 | ||
|
|
c0c086388b | ||
|
|
048c8302fe | ||
|
|
a7b051b172 | ||
|
|
5f7ad58f48 | ||
|
|
016b9fc052 | ||
|
|
99b40e8257 | ||
|
|
a734e447b5 | ||
|
|
37128c34a9 | ||
|
|
f5630ab88e | ||
|
|
6790587db8 | ||
|
|
445f696dc6 | ||
|
|
dd5c3a9c8e | ||
|
|
0f45e38b52 | ||
|
|
93bc3cb628 | ||
|
|
79faedfb9b | ||
|
|
17d9caae83 | ||
|
|
eea18e856e | ||
|
|
7e64eb5414 | ||
|
|
8a959bb1f4 | ||
|
|
8d3ef0729c | ||
|
|
275680bdb7 | ||
|
|
4d5d1f0f66 | ||
|
|
1ef677f264 | ||
|
|
07193e2a34 | ||
|
|
f7da94610d | ||
|
|
872368d25c | ||
|
|
36320b4bf4 | ||
|
|
7185faa857 | ||
|
|
0c80fcff2a | ||
|
|
51caff5dcf | ||
|
|
d643ff5dbc | ||
|
|
44ca89eff7 | ||
|
|
7afad19c77 | ||
|
|
765c4ab4f4 | ||
|
|
24eca792ff | ||
|
|
b1b17ee264 | ||
|
|
74600cfb14 | ||
|
|
171ec1583d | ||
|
|
80c5106015 | ||
|
|
e92fe4c1a4 | ||
|
|
11f402b44a | ||
|
|
18049fe3e0 | ||
|
|
b330c10492 | ||
|
|
25255c4ed1 | ||
|
|
16febebd28 | ||
|
|
339952c2af | ||
|
|
75715635e8 | ||
|
|
9863d8d1d2 | ||
|
|
3ecccb7410 | ||
|
|
3c7a7a1675 | ||
|
|
d14c475de7 | ||
|
|
a68a3feb60 | ||
|
|
43382a9b9c | ||
|
|
a149502c01 | ||
|
|
decace60da | ||
|
|
2c876b6765 | ||
|
|
6d0785a78f | ||
|
|
ec593a2549 | ||
|
|
978de6fb97 | ||
|
|
c53e2960a0 | ||
|
|
cf91ebf278 | ||
|
|
fd5f21af00 | ||
|
|
1b93cb8c0a | ||
|
|
a9e6268766 | ||
|
|
fc855084a0 | ||
|
|
b7bccf86c3 | ||
|
|
6ee2a51edc | ||
|
|
d2dc1597fe | ||
|
|
82647e79c7 | ||
|
|
ecbebe2847 | ||
|
|
816db977fd | ||
|
|
cbe77e2412 | ||
|
|
1eb67ca49d | ||
|
|
7a89d731f7 | ||
|
|
65503dad73 | ||
|
|
a347262468 | ||
|
|
6a6fa7027a | ||
|
|
86cdc91180 | ||
|
|
094465a710 | ||
|
|
6ae56f302e | ||
|
|
ad895fadb1 | ||
|
|
7c120281c7 | ||
|
|
8a4095b405 | ||
|
|
a7cc5b6a5d | ||
|
|
ac1dfd4662 | ||
|
|
abf2f7f05e | ||
|
|
1c209d711e | ||
|
|
91f521ef92 | ||
|
|
9ac3ae1270 | ||
|
|
d74579aa38 | ||
|
|
6deb1a83b5 | ||
|
|
6f3a7ef3c8 | ||
|
|
9f3687f917 | ||
|
|
5e77c4e936 | ||
|
|
97c376e06d | ||
|
|
8f4d674442 | ||
|
|
7f277fea94 | ||
|
|
52440cc2e6 | ||
|
|
3fe9243e1c | ||
|
|
05dae25a22 | ||
|
|
23ea270881 | ||
|
|
7247543da3 | ||
|
|
37a8d2acc1 | ||
|
|
4a7ba87d99 | ||
|
|
51e3764519 | ||
|
|
533d92aa8e | ||
|
|
19887b7b8c | ||
|
|
005e75bdc3 | ||
|
|
5f3470fcd0 | ||
|
|
adb237cfa8 | ||
|
|
29a29d6210 | ||
|
|
3a155ceda6 | ||
|
|
7195a23a9d | ||
|
|
0ae6ff8018 | ||
|
|
241769dc2f | ||
|
|
4a39ee9bbc | ||
|
|
1dedf7f0cd | ||
|
|
70ede09310 | ||
|
|
3da30304fc | ||
|
|
820c04c679 | ||
|
|
9d848e3f5e | ||
|
|
d5f71c2e1d | ||
|
|
36a7d23273 | ||
|
|
c4317177f3 | ||
|
|
e231a84b2f | ||
|
|
b56fb96b1b | ||
|
|
163c7e3460 | ||
|
|
4c1023dac6 | ||
|
|
563d238fa0 | ||
|
|
9021776963 | ||
|
|
18771f1b6a | ||
|
|
ed2af11102 | ||
|
|
7dd65e84e6 | ||
|
|
e260ec6e9d | ||
|
|
7ce3f3c1a6 | ||
|
|
a466755bbb | ||
|
|
901c9d8ae0 | ||
|
|
6145c82804 | ||
|
|
876c02206d | ||
|
|
3ca312033f | ||
|
|
1378475573 | ||
|
|
00b049866b | ||
|
|
d847e477f0 | ||
|
|
c55e164e87 | ||
|
|
531cd5dd14 | ||
|
|
ff0a9f763e | ||
|
|
228e0a3d79 | ||
|
|
f38e29d00a | ||
|
|
963283d7d0 | ||
|
|
c91044a4a7 | ||
|
|
f42c26adbd | ||
|
|
9efad43509 | ||
|
|
33d8f08964 | ||
|
|
e826e9281e | ||
|
|
780120c9a2 | ||
|
|
d6c0c85125 | ||
|
|
c81fb397bb | ||
|
|
caf4e46e06 | ||
|
|
ff1a30d80a | ||
|
|
d143f49a66 | ||
|
|
58698b789a | ||
|
|
ee3f2ffa19 | ||
|
|
c59124dfe2 | ||
|
|
7b14cf8558 | ||
|
|
05f796d2fa | ||
|
|
bd8c91b37d | ||
|
|
7294cdef3e | ||
|
|
f52bb0e7a6 | ||
|
|
4d7b6374c8 | ||
|
|
5855da5a15 | ||
|
|
34fd493512 | ||
|
|
da4bd9b110 | ||
|
|
7fbf6df09e | ||
|
|
68415d040f | ||
|
|
8ee74f6bff | ||
|
|
bf0fa4089f | ||
|
|
07ae149955 | ||
|
|
ecb93d97a5 | ||
|
|
f769d5e27f | ||
|
|
1e414c8f37 | ||
|
|
07e6994be1 | ||
|
|
0abf4f8fbb | ||
|
|
a13e4a77e0 | ||
|
|
6de2271e2a | ||
|
|
021e255282 | ||
|
|
92b1e038c1 | ||
|
|
a8c33ae219 | ||
|
|
e7bc30b409 | ||
|
|
efaefa21fc | ||
|
|
42bd417acf | ||
|
|
af58e8e8f9 | ||
|
|
4bf4a7668e | ||
|
|
c03ca9c73c | ||
|
|
d5884afcf3 | ||
|
|
a2aeafe85b | ||
|
|
f4ce9882d2 | ||
|
|
0109b39f58 | ||
|
|
d0a18510d5 | ||
|
|
eaf1f4429b | ||
|
|
752e978d56 | ||
|
|
8b36a11f2b | ||
|
|
10a994bbf8 | ||
|
|
981fad220f | ||
|
|
62b6625a2f | ||
|
|
1c35a9ec95 | ||
|
|
06be854c32 | ||
|
|
969044ab60 | ||
|
|
69a8bc8960 | ||
|
|
55146418d5 | ||
|
|
a59a48e7bb | ||
|
|
521754caf5 | ||
|
|
a1bbdf0d0f | ||
|
|
7920f9d54f | ||
|
|
ccd448d626 | ||
|
|
44fb38949b | ||
|
|
ad1532ed57 | ||
|
|
caaec3bb05 | ||
|
|
df47fae287 | ||
|
|
b65bf48369 | ||
|
|
4c02acb728 | ||
|
|
8c9151c86b | ||
|
|
1ef1a4a213 | ||
|
|
c075742bc8 | ||
|
|
b42cf317d6 | ||
|
|
f5429e4ce8 | ||
|
|
82dad8e629 | ||
|
|
59aa37fe2b | ||
|
|
0adb43f06e | ||
|
|
87e09a09da | ||
|
|
ba630816bc | ||
|
|
863fdafcd5 | ||
|
|
be5e6941bf | ||
|
|
7980115412 | ||
|
|
cab86a0deb | ||
|
|
be3a1da14a | ||
|
|
650c587875 | ||
|
|
d29c5760bd | ||
|
|
ee9d777d69 | ||
|
|
59582bafa3 | ||
|
|
1ad85ac9ee | ||
|
|
999a84c77a | ||
|
|
48e0d167aa | ||
|
|
f14da66ce5 | ||
|
|
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 |
15
AUTHORS
Normal file
15
AUTHORS
Normal file
@@ -0,0 +1,15 @@
|
||||
Authors of OpenJPEG
|
||||
See also the files THANKS and CHANGES
|
||||
|
||||
David Janssens designed and implemented the first version of OpenJPEG.
|
||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
|
||||
Giuseppe Baruffa added the JPWL functionalities.
|
||||
Micka<EFBFBD>l Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
|
||||
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
Antonin Descampe
|
||||
improved the libraries and utilities.
|
||||
|
||||
990
CHANGES
990
CHANGES
@@ -1,990 +0,0 @@
|
||||
What's New for OpenJPEG
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
August 11, 2011
|
||||
* [mickael] fixed wrong patch with the return value of fgets into convert.c file
|
||||
* [mickael] fixed build error with position of variable declaration after patch 856
|
||||
|
||||
August 10, 2011
|
||||
! [mickael] removed unused parameters warnings with the solution proposed by myself and Bob Friesenhahn.
|
||||
! [mickael] add copyright header into new test functions.
|
||||
* [mickael] fixed glibc error with broken2 and broken4 images.
|
||||
* [mickael] fixed segfault with 123.j2c and bug.j2c images (thanks to Tim Mattox for his improvement).
|
||||
! [mickael] moved the definition of OPJ_ARG_NOT_USED from opj_includes.h to openjpeg.h
|
||||
* [mickael] fixed error with the return value of fgets into convert.c file
|
||||
|
||||
August 9, 2011
|
||||
- [antonin] removed xcode project files (cmake and autotools are now the only supported build methods)
|
||||
|
||||
July 29, 2011
|
||||
! [mickael] solve some obvious warnings for WIN platform, increase number of warning reported on the dashboard, correct last warnings with gcc 4.4 (-Wall)
|
||||
! [mickael] increase number of warning reported on the dashboard (forgot the file in the last commit)
|
||||
! [mickael] update MJ2 CMakeLists regards to the new thirdparty strategy
|
||||
|
||||
July 27, 2011
|
||||
! [mickael] added new decoding/dump tests based on data found in input/nonregresion repository (remove JPEG2000_CONFORMANCE_DATA_ROOT variable, add REF_DECODER_BIN_PATH variable for the encoder test suite). Remove definitively old tests.
|
||||
! [mickael] correct some warnings detected under unix platform
|
||||
|
||||
July 26, 2011
|
||||
! [mickael] delete double semi-colon at end of line which generate crash on win platform
|
||||
! [mickael] use ansi c function fgets instead of GNU function getline to avoid build error with win platform
|
||||
! [mickael] correct CRLF problem between unix baseline and win platform test file generated by j2k_dump
|
||||
|
||||
July 25, 2011
|
||||
* [mickael] fixed issue 74 for trunk
|
||||
! [mickael] modify j2k_dump to support output file, needed for non-regression tests
|
||||
+! [mickael] added non-regression tests for j2k_dump function and conformance data
|
||||
|
||||
July 22, 2011
|
||||
! [mickael] correct some troubles about thirdparty when they are used
|
||||
|
||||
July 21, 2011
|
||||
! [mickael] correct a compil error linked to getopt with win platform
|
||||
!+ [mickael] add new decode tests based on conformance data and tolerance. Non regression is also added on the decoder output. Deactivate old tests.
|
||||
! [mickael] to follow last version of conformance data about component separator for pgx file, we changed - to _ separator even if nb component = 1
|
||||
! [mickael] removed unused warning configuration message
|
||||
|
||||
July 18, 2011
|
||||
! [mickael] correct build error (mislocated declaration) with convert to tiff function when HAVE_LIBTIFF is defined
|
||||
|
||||
July 13, 2011
|
||||
! [mickael] improved some CMakeLists files linked to the build of applications which used thirdparty
|
||||
|
||||
_______ R812 : 'openjpeg-1.5' branch created ______________________________
|
||||
|
||||
July 10, 2011
|
||||
! [antonin] improved encoding speed in t1_encode_cblks (credit to Giuseppe Baruffa)
|
||||
|
||||
July 3, 2011
|
||||
* [antonin] fixed bmptoimage (see http://groups.google.com/group/openjpeg/browse_thread/thread/33a24c5896bf6391)
|
||||
* [antonin] fixed handling of "jp2->meth" value (Restricted ICC profile handling currently not implemented)
|
||||
|
||||
June 30, 2011
|
||||
! [antonin] fixed CTest configuration files
|
||||
|
||||
June 3, 2011
|
||||
+ [malaterre] adding partno and numpart info as part of the warning message (issue #69)
|
||||
+ [malaterre] make sure that cmake build system works on debian
|
||||
|
||||
May 23, 2011
|
||||
* [antonin] fixed a bug in autotools that prevented "make distcheck" to work properly (credit to Vincent Torri)
|
||||
+ [antonin] added autotools as a build method for jpip (credit to Vincent Torri)
|
||||
* [antonin] fixed autotools (broken since the new directory structure) (credit to Vincent Torri)
|
||||
|
||||
May 18, 2011
|
||||
! [antonin] defined new type "opj_bool", and new constants OPJ_FALSE and OPJ_TRUE, to avoid having to deal with "stdbool.h" (patch from Winfried)
|
||||
|
||||
May 16, 2011
|
||||
* [antonin] fixed another bug related to the number of packets in a tile-part, not correctly taken into acccount when generating an index file during decoding.
|
||||
* [antonin] fixed part of issue 69, when tile-part index is inconsistent with the total number of tile-parts
|
||||
|
||||
May 12, 2011
|
||||
* [antonin] xcode project file updated (now integrates openjpip)
|
||||
|
||||
April 16, 2011
|
||||
* [antonin] fixed a bug in mqc.c (see https://groups.google.com/d/topic/openjpeg/kQ1PbZUd19k/discussion, credit to Peter Wimmer)
|
||||
* [antonin] fixed wrong path in Doxyfile.dox
|
||||
|
||||
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, see 'applications/jpip/CHANGES' for subsequent jpip-related commits)
|
||||
* [antonin] fixed applications/codec/CMakeLists.txt that prevented JPWL executables to be built with JPWL functionalities.
|
||||
! [antonin] changed make all behaviour : DOC target removed from ALL.
|
||||
|
||||
April 13, 2011
|
||||
! [antonin] changed the directory hierarchy of the whole project. See README files for details.
|
||||
! [antonin] moved "openjpeg3d" directory from the trunk to the branches directory.
|
||||
! [antonin] renamed and reorganized "jp3d" directory to "openjpeg3d". Is now a standalone directory, with independent cmake files. Done as it uses its own version of the openjpeg library and does not depend on the one currently developped. Will be removed from the trunk and stored in a branch.
|
||||
|
||||
April 12, 2011
|
||||
* [antonin] Fixed internal function names conflict with Jasper (http://code.google.com/p/openjpeg/issues/detail?id=30)
|
||||
* [antonin] convert.c: ENDIAN condition removed, tiftoimage and imagetotif updated (ALPHA added for RGB and GRAY, correct handling of 12-bit precision), small bugfixes (credit to Winfried)
|
||||
* [antonin] small fix in configure.ac (credit to Vincent Torri)
|
||||
|
||||
March 21, 2011
|
||||
+ [antonin] added two files FindLCMS.cmake and FindLCMS2.cmake as they are not shipped by default with other cmake modules.
|
||||
|
||||
March 20, 2011
|
||||
+ [antonin] added a 'thirdparty' directory to include main source files of libtiff, libpng, libz and liblcms to enable support of these formats in the codec executables. CMake will try to statically build these libraries if they are not found on the system. Note that these third party libraries are not required to build libopenjpeg (which has no dependencies).
|
||||
- [antonin] removed the 'libs' directory containing win32 compiled versions of libpng, libtiff and liblcms.
|
||||
|
||||
March 10, 2011
|
||||
* [antonin] fixed lt_version in configure.ac
|
||||
|
||||
March 5, 2011
|
||||
! [antonin] cosmetic change for status report of ./configure
|
||||
|
||||
March 4, 2011
|
||||
* [antonin] now assume MinGW does not have dirent.h (actually have it but without opendir function). Fixed also a WIN32 check in jp3d/libjp3dvm/openjpeg3d.h.
|
||||
! [antonin] updated autotools files to improve build and install procedures (credit to Vincent Torri).
|
||||
|
||||
February 17, 2011
|
||||
* [antonin] replaced 'long' by 'size_t' in dwt.c to be sure to cast to a pointer size.
|
||||
* [antonin] now allows 16-bit precision for mj2 encoding and decoding (solves Issue 49 and Issue 63). Credit to Winfried.
|
||||
|
||||
February 9, 2011
|
||||
! [antonin] renamed "java sources" to "java-sources" to avoid blank space
|
||||
- [antonin] removed opj_config.h.in from svn, as it is automaticaly generated by autoheader when calling ./bootstrap.sh
|
||||
|
||||
February 6, 2011
|
||||
* [antonin] cmake : fixed installed links to openjpeg.h and openjpeg3d.h.
|
||||
|
||||
January 30, 2011
|
||||
* [antonin] fixed warnings in jp2.c (signed compared to unsigned) and dwt.c (bad cast)
|
||||
- [antonin] removed depcomp file from trunk (automatically copied by automake in main folder)
|
||||
|
||||
January 29, 2011
|
||||
* [antonin] removed 'é' in license header to prevent warning C4819 (see Issue 57).
|
||||
|
||||
January 24, 2011
|
||||
- [antonin] remove more obsolete VS files. Left only mj2_to_metadata VS files, as this is the only executable not yet handled by CMake.
|
||||
|
||||
January 23, 2011
|
||||
- [antonin] removed obsolete VS files
|
||||
! [antonin] MJ2 module:
|
||||
- Add two components to mj2.h: meth, enumcs.
|
||||
- Define or reset all components of mj2_cparameters_t before its usage.
|
||||
- Add argument '-D prec' to frames_to_mj2.c and use the precision in mj2_convert.c (solves Issue 49).
|
||||
* [antonin] move 'KK' definition from rs.h to rs.c to prevent duplicate symbol error when building jpwl with autotools.
|
||||
|
||||
January 18, 2011
|
||||
! [rdieter] cmake: SOVERSION change to 1 (from 1.4) to match auto-tools
|
||||
|
||||
January 17, 2011
|
||||
- [rdieter] remove generated files (Issue 52)
|
||||
|
||||
January 16, 2011
|
||||
* [antonin] convert.c: inclusion of endian.h has to be different on APPLE platforms
|
||||
|
||||
January 13, 2011
|
||||
+ [rdieter] add pkg-config support to cmake
|
||||
! [rdieter] adjust autotools pkg-config support to match
|
||||
* [rdieter] fix symlink creation (cmake)
|
||||
|
||||
January 9, 2011
|
||||
- [antonin] removed forgotten debug info in imagetopnm().
|
||||
|
||||
January 9, 2011
|
||||
! [antonin] imagetopnm() has been rewritten to allow 16-bits precision, and PAM (P7) support. See Netpbm for more info. (patch from szukw000).
|
||||
|
||||
January 7, 2011
|
||||
! [szukw000] changed report code in Makefile.am
|
||||
|
||||
January 3, 2011
|
||||
- [antonin] removed badly written tests from CTest in 'codec/CMakeLists.txt'
|
||||
|
||||
_______ R697 : OPENJPEG 1.4 RELEASED ______________________________
|
||||
|
||||
January 2, 2011
|
||||
* [antonin] bug fixes to enable cmake compilation on WIN32 platform
|
||||
- fixed getopt bug in jpwl/CMakeLists.txt
|
||||
- added png, zlib and lcms win32 libraries to libs directory
|
||||
- updated libs/libtiff library
|
||||
- moved j2k_dump_{image,cp} to j2k_dump.c to remain consistent with API interface
|
||||
- changed mj2 cmake compilation method: as long as mj2 binaries do not strictly use the API interface, libopenjpeg source files are directly included in mj2 executables compilation.
|
||||
! [antonin] small update to xcode project
|
||||
|
||||
December 14, 2010
|
||||
! [szukw000] adapted Makefile.am/Makefile.nix to build
|
||||
choice: shared xor static
|
||||
|
||||
December 11, 2010
|
||||
* [antonin] fixed flags when building jp3d with MinGW
|
||||
|
||||
December 10, 2010
|
||||
! [szukw000] changed build choice in configure.ac/Makefile.am/Makefile.nix:
|
||||
shared xor static
|
||||
|
||||
December 9, 2010
|
||||
! [antonin] removed LCMS dependency in jp3d/libjp3dvm/CMakeLists.txt
|
||||
! [antonin] updated xcode project
|
||||
! [antonin] renamed jp3d/libjp3dvm/openjpeg.h => jp3d/libjp3dvm/openjpeg3d.h
|
||||
- [antonin] removed "codec/compat/" directory
|
||||
* [szukw000] updated Makefile.in
|
||||
! [szukw000] removed LCMS dependencies from Makefile.am/Makefile.nix
|
||||
|
||||
December 8, 2010
|
||||
(thanks to Winfried for his help)
|
||||
* [antonin] changed remaining "WIN32" to "_WIN32"
|
||||
! [antonin] libopenjpeg has no more dependency on LCMS lib. Everything concerning color (icc profile, conversion to rgb, etc) has been put outside libopenjpeg and is used in j2k_to_image.c and mj2_to_frames.c.
|
||||
- [antonin] removed 'opj_convert{.c,.h}'
|
||||
+ [antonin] added a directory 'common/' that contains 'getopt{.c,.h}' (previously in 'codec/compat').
|
||||
+ [antonin] added files 'color{.c,.h}' in 'common/' that define the code for icc profile management and sycc_to_rgb conversion
|
||||
+ [antonin] added 'common/format_defs.h' that contains common definitions used in image_to_j2k, j2k_to_image, j2k_dump.
|
||||
|
||||
December 5, 2010
|
||||
! [antonin] revert to previous behaviour for cmake: builds (and links) dynamically by default. Static build only if -DBUILD_SHARED_LIBS is set to OFF.
|
||||
* [antonin] added a definition in getopt.h and an initial value in convert.c
|
||||
|
||||
December 3, 2010
|
||||
* [antonin] workaround for name clash when building static and dynamic on WIN32 (see http://www.vtk.org/Bug/view.php?id=10190 for description)
|
||||
|
||||
November 28, 2010
|
||||
* [antonin] fixed a bug in codec/convert.c that prevented to build executables with WIN32 compiler (thanks winfried)
|
||||
! [antonin] changed cmake behaviour: executables are now always statically linked. When -DBUIL_SHARED_LIBS option is ON (the default), the shared versions of the libraries are also built (but executables remain linked against the static libraries).
|
||||
|
||||
November 25, 2010
|
||||
* [antonin] fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode)
|
||||
|
||||
November 22, 2010
|
||||
! [antonin] xcode : changed to native architecture build by default
|
||||
* [antonin] reverted 'include "../opj_config.h"' to 'include "opj_config.h"'
|
||||
|
||||
November 17, 2010
|
||||
! [antonin] install man pages by default. install CHANGES and LICENSE
|
||||
! [antonin] minor changes in cmake files (from winfried)
|
||||
|
||||
November 16, 2010
|
||||
! [antonin] minor changes in cmake flags
|
||||
|
||||
November 15, 2010
|
||||
! [antonin] xcode project rewrite.
|
||||
! [antonin] changed imagetopng() function to correctly deal with non-standard bit-depths. Add png support for win32. (from winfried)
|
||||
* [antonin] minor changes in header inclusions
|
||||
* [antonin] complete rewrite of opj_convert.c with correct values (from winfried)
|
||||
|
||||
November 11, 2010
|
||||
- [antonin] removed call to dirent.h in jp3d;
|
||||
|
||||
October 28, 2010
|
||||
* [ben.boeckel] Set the soname and soversion on the jpwl library with CMake
|
||||
+ [ben.boeckel] Install jpwl binaries with CMake
|
||||
|
||||
October 26, 2010
|
||||
* [ben.boeckel] Install symlinks to versioned directory headers when using CMake
|
||||
+ [ben.boeckel] Set the library version on jp3d when using CMake
|
||||
|
||||
October 25, 2010
|
||||
* [ben.boeckel] Fix jp3d version
|
||||
|
||||
October 24, 2010
|
||||
* [antonin] Fixed doxygen data inside source code (from winfried)
|
||||
|
||||
October 22, 2010
|
||||
* [ben.boeckel] Don't install jp3d and libopenjpeg headers to the same place
|
||||
|
||||
October 22, 2010
|
||||
* [ben.boeckel] Install man pages when using CMake
|
||||
|
||||
October 22, 2010
|
||||
! [ben.boeckel] Default to building shared libraries
|
||||
|
||||
October 22, 2010
|
||||
* [antonin] Patch to support the MSVC Win 64 builds (from szekerest)
|
||||
|
||||
October 22, 2010
|
||||
* [antonin] Currently the Visual Studio builds are broken in the SVN. Attached a patch to fix this issue (from szekerest)
|
||||
|
||||
October 22, 2010
|
||||
* [szukw000] replaced 'cp -d' with 'cp -P' for MacOSX
|
||||
|
||||
October 22, 2010
|
||||
* [szukw000] 'jpwl/Makefile.am': added CFLAGS for bin_PROGRAMS
|
||||
|
||||
October 22, 2010
|
||||
+ [szukw000] added 'libopenjpeg.pc.in'
|
||||
! [szukw000] changed 'configure.ac' to create 'libopenjpeg.pc'
|
||||
! [szukw000] changed 'Makefile.am' to [un]install 'libopenjpeg.pc'
|
||||
! [szukw000] changed 'doc/Makefile.am' : 'uninstall-hook' added
|
||||
|
||||
October 20, 2010
|
||||
* [antonin] fixed help display (patch from winfried)
|
||||
|
||||
October 20, 2010
|
||||
* [antonin]
|
||||
fixed paths to png and tiff in CMakeLists.txt (patch from winfried)
|
||||
fixed link to lcms library (patch from winfried)
|
||||
|
||||
October 18, 2010
|
||||
* [antonin] fixed options and help display (patch from winfried)
|
||||
|
||||
October 18, 2010
|
||||
! [szukw000]
|
||||
doc/Makefile.am
|
||||
doc/Makefile.nix
|
||||
jp3d/Makefile.nix
|
||||
jpwl/Makefile.nix
|
||||
Makefile.nix
|
||||
config.nix
|
||||
|
||||
October 17, 2010
|
||||
! [szukw000]
|
||||
configure.ac : 'enable_shared' YES by default
|
||||
doc/Makefile.am :
|
||||
'all-local' and 'install-data-hook' added
|
||||
'with_doxygen' conditional added
|
||||
Makefile.am : 'doc' directory no longer substituted in SUBDIRS
|
||||
|
||||
to link binaries statically: '-static' added to:
|
||||
codec/Makefile.am
|
||||
mj2/Makefile.am
|
||||
jpwl/Makefile.am
|
||||
jp3d/codec/Makefile.am
|
||||
|
||||
mj2/Makefile.am : 'with_libjpwl' removed
|
||||
mj2/Makefile.nix : 'with_libjpwl' removed
|
||||
|
||||
config.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||
doc/Makefile.nix : 'clean', 'install', 'uninstall' added
|
||||
Makefile.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||
|
||||
INSTALL : topic 3) changed regarding the changes in 'config.nix'
|
||||
|
||||
October 13, 2010
|
||||
! [szukw000]
|
||||
configure.ac
|
||||
bootstrap.sh
|
||||
|
||||
'with_libjpwl' removed from:
|
||||
libopenjpeg/Makefile.am
|
||||
codec/Makefile.am
|
||||
codec/Makefile.nix
|
||||
Makefile.nix
|
||||
|
||||
October 10, 2010
|
||||
* [antonin] Patch from winfried
|
||||
|
||||
1. The jp3d/libjp3dvm/Makefile.am has been changed:
|
||||
|
||||
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/
|
||||
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
PREFIX/include:
|
||||
|
||||
23 openjpeg.h -> openjpeg-1.4/openjpeg.h
|
||||
27 openjpeg3d.h -> openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
28773 openjpeg-1.4/openjpeg.h
|
||||
22158 openjpeg3d-1.3/openjpeg3d.h
|
||||
|
||||
2. The jp3d/Makefile.nix has been changed respectivly.
|
||||
|
||||
3. The mj2/Makefile.nix contained a wrong path to 'compat/'
|
||||
|
||||
4. opj_config.h.in.user contained a comment within a comment.
|
||||
|
||||
5. 'autoreconf' reported that AC_PROG_RANLIB is no longer
|
||||
necessary in 'configure.ac'.
|
||||
|
||||
October 08, 2010
|
||||
* [antonin] fixed a bug in mj2.c that prevented extract_j2k_from_mj2 to build properly. Patch from winfried.
|
||||
|
||||
October 04, 2010
|
||||
+ [antonin] Added files to let people build openjpeg with 'configure' tools
|
||||
+ [antonin] Added makefiles to let people manually build openjpeg on *nix platforms
|
||||
- [antonin] Removed obsolete Makefiles
|
||||
! [antonin] Renamed dirent.h to windirent.h
|
||||
! [antonin] Made optional the PNG, TIFF, and LCMS support in CMake files
|
||||
+ [antonin] Added opj_config* files to configure openjpeg before building it (opj_config.h generated by 'configure', cmake, or manually by the user)
|
||||
! [antonin] Renamed this file from ChangeLog to CHANGES
|
||||
! [antonin] Renamed 'License.txt' to 'LICENSE'
|
||||
! [antonin] Updated README files
|
||||
+ [antonin] Added INSTALL and LICENSE files
|
||||
+ [antonin] Added man pages
|
||||
|
||||
June 22, 2010
|
||||
+ [MM] Apply patch from w. szukalski (sent to list)
|
||||
+ [MM] Also dump the image info as well as cp info.
|
||||
|
||||
June 21, 2010
|
||||
+ [MM] Added a j2k_dump to simply dump the parameter of a J2K file
|
||||
|
||||
May 26, 2010
|
||||
+ [antonin] Added CTestConfig.cmake to the root directory to incorporate the testing dashboard.
|
||||
+ [antonin] MACOSX : Added a "build all" target to the XCode project file.
|
||||
|
||||
April 16, 2010
|
||||
* [antonin] MACOSX : Fixed the XCode project file to link with the PNG library. Library and header should be located in /usr/local/lib/ and /usr/local/include/, respectively. Check http://ethan.tira-thompson.org/Mac_OS_X_Ports.html if it is not the case on your mac.
|
||||
|
||||
April 8, 2010
|
||||
* [FOD] Fixed issue 6 on google code. Variable "pi" not freed or pointed-to in function "pi_create_encode". Thanks to Kent Mein for reporting this.
|
||||
* [FOD] Fixed problem with Borland C++ Builder (Borland C do not have lrintf). Thanks Marek Mauder for this fix.
|
||||
* [FOD] Fixed pi.c bug (issue 15 on google code). Thanks to Anton Lionel for catching this.
|
||||
* [FOD] Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches
|
||||
* [FOD] Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
|
||||
! [FOD] Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter)
|
||||
|
||||
March 26, 2010
|
||||
+ [FOD] Added support for "jpc" codestreams which are equivalent to "j2c" codestreams. Thanks to Winfried for this patch
|
||||
* [FOD] Added support for PNG image format [Not yet functional under WIN32]. Thanks to Winfried for this patch. See details here http://code.google.com/p/openjpeg/issues/detail?id=16
|
||||
|
||||
March 24, 2010
|
||||
* [FOD] Code improvements using 'g++-4.4.0' to trace the code. Thanks to Winfried for this patch.
|
||||
|
||||
March 7, 2010
|
||||
* [FOD] Fixed small compatibility issues with win32 in codec (moved include <strings.h>)
|
||||
|
||||
March 5, 2010
|
||||
! [FOD] Updated makefiles for v1.4 and v2.0
|
||||
+ [FOD] First import of OPJ_Validate tool
|
||||
|
||||
February 18, 2010
|
||||
* [FOD] JP3D Module. Fixed issue when computing the number of elements in an array that leads to crash (thanks Kristof). Updated JP3D makefiles.
|
||||
|
||||
January 20, 2010
|
||||
! [FOD] Created a new constant in openjpeg.h to differentiate the case when the colorspace is not supported by the library and when it is not specified in the codestream. Suggested by Matteo Italia.
|
||||
|
||||
November 5, 2009
|
||||
* [antonin] fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info.
|
||||
|
||||
November 5, 2009
|
||||
* [antonin] fixed "tiffio" header inclusion to use user version on Win32 system only (otherwise assume its existence in system headers).
|
||||
|
||||
September 10, 2009
|
||||
* [antonin] fixed minor bugs which were triggering warnings at compilation (different signedness, wrong pointer type, etc)
|
||||
|
||||
September 8, 2009
|
||||
* [antonin] openjpeg.c : fixed initialization of parameters->cp_disto_alloc/fixed_quality/fixed_alloc/tcp_numlayers because they were preventing to use the -q and -f options.
|
||||
|
||||
August 31, 2009
|
||||
* [antonin] JavaOpenJpegDecoder.c : fixed a signed/unsigned behaviour when returning form C to JAVA
|
||||
|
||||
August 21, 2008
|
||||
* [antonin] found a bug in tcd.c that was preventing to find the correct threshold in tcd_rateallocate.c for high-precision images. Applied a temporary patch but a better solution should be found.
|
||||
|
||||
August 21, 2008
|
||||
* [antonin] fixed a bug in image_to_j2k.c that was preventing the 'r' option to work properly (everything was compressed lossless regardless of the specified rate).
|
||||
|
||||
August 8, 2008
|
||||
! [FOD] Modified the way raw images with more that 8bpp are read and written
|
||||
|
||||
July 9, 2008
|
||||
+ [Parvatha] Added the default lossless parameter to opj_set_default_encoder_parameters in openjpeg.c.
|
||||
|
||||
June 12, 2008
|
||||
* [antonin] fixed a bug in dirent.h that prevented codec on Linux Alpha Systems to compile correctly. Thanks to RobinC.
|
||||
|
||||
May 22, 2008
|
||||
* [antonin] fixed a bug in j2k.c (j2k_write_sod) that allowed to get negative rates, thanks zhong1985624 for pointing this.
|
||||
|
||||
May 22, 2008
|
||||
* [antonin] additional test to avoid crash due to invalid image size, patch by Christopher Layne
|
||||
|
||||
May 20, 2008
|
||||
* [antonin] memory leak fixed in openjpeg.c (opj_destroy_cstr_info()), patch by Carsten Juttner
|
||||
|
||||
March 12, 2008
|
||||
+ [GB] help line for the -F option in j2k_to_image
|
||||
|
||||
March 4, 2008
|
||||
! [FOD] Changed Java files copyright in JavaOpenJPEG module
|
||||
|
||||
February 28, 2008
|
||||
* [FOD] Fixed openjpeg.c for proper initialization of codec context structures (dinfo in opj_create_compress()
|
||||
and opj_create_decompress(). Bug fix suggested by Andrey V. Kiselev
|
||||
* [FOD] Clean up of opj_aligned_malloc(), to just forgo the use of posix_memalign(),
|
||||
as apparently memalign() is what is working better for everyone. Patch by Callum.
|
||||
|
||||
February 28, 2008
|
||||
- [FOD] Removed the J2KViewer module, which has been replaced by OPJViewer
|
||||
* [FOD] Fixed the error handling of j2k_decode in jp2.c, thanks to Robin Cornelius
|
||||
|
||||
February 11, 2008
|
||||
* [GB] Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified
|
||||
! [GB] Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
|
||||
|
||||
February 5, 2008
|
||||
! [Parvatha] In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in
|
||||
tcd_init_encode(). Thanks to Jeremy Furtek and Jérôme Fimes.
|
||||
|
||||
January 31, 2008
|
||||
! [GB] In opjviewer, unification of JPEG 2000 family handlers (*.jp2, *.mj2, *.j2k) in a single file
|
||||
|
||||
January 22, 2008
|
||||
! [FOD] In image.c, changed the opj_image_create0() memory allocation from malloc() to calloc() in order
|
||||
to avoid segfaults when freeing the memory allocated for the coding of bad images.
|
||||
Thanks to Christopher Layne for this improvement.
|
||||
|
||||
January 17, 2008
|
||||
+ [antonin] Initial commit of Xcode project directory (XCode 2.5 for macosx)
|
||||
available targets : libopenjpeg (stat and dyn), image_to_j2k, j2k_to_image
|
||||
|
||||
January 16, 2008
|
||||
* [antonin] fixed opj_malloc.h for macosx (bugfix provided by janpeder, thanks)
|
||||
|
||||
January 11, 2008
|
||||
+ [FOD] Added missing files to JavaOpenJPEG project (files from Patrick Piscaglia)
|
||||
|
||||
January 4, 2008
|
||||
* [Parvatha] Patch by Callum Lerwick. Fixed bug during encoding using tile option in tcd.c
|
||||
|
||||
----------------------
|
||||
December 21, 2007
|
||||
VERSION 1.3.0 RELEASED
|
||||
----------------------
|
||||
|
||||
December 21, 2007
|
||||
* [FOD] Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h
|
||||
! [FOD] Possible errors in pi_create_encode handled
|
||||
|
||||
December 19, 2007
|
||||
* [Antonin] changed variables names alpha, beta, gamma, delta in dwt.c to avoid re-declarations on Macosx
|
||||
! [Parvatha] In pi.c, removed the Recursive function pi_check_next_level() and modified the code.
|
||||
* [FOD] Fixed allocation problem in pi.c
|
||||
|
||||
December 19, 2007
|
||||
+ [FOD] In mqc.h, changed MQC_NUMCTXS from 32 to 19 as there are only 19 possible contexts
|
||||
|
||||
December 10, 2007
|
||||
+ [FOD] First import of JAVAOpenJPEG, a Java wrapper of OpenJPEG, developed by Patrick Piscaglia of Telemis (www.telemis.com).
|
||||
Thank you Patrick for this new module !
|
||||
|
||||
November 29, 2007
|
||||
! [GB] Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files.
|
||||
|
||||
November 14, 2007
|
||||
+ [FOD] Created the file index.c in the codec directory. This file handles the creation of index files,
|
||||
at encoding and decoding.
|
||||
* [FOD] Fixed bugs during the creation of the index (PCRL progression order)
|
||||
* [FOD] Fixed the maximum number of resolutions a user can discard while decoding.
|
||||
Added an error state in J2K_STATE (j2k.c)
|
||||
|
||||
November 14, 2007
|
||||
! [FOD] - First Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c
|
||||
- Second Patch by Callum Lerwick. This patch rearranges the largest memory allocations so they're allocated as
|
||||
late as possible, and freed as soon as possible. This cuts memory usage by about half on two large test images.
|
||||
- Third Patch by Callum Lerwick. The opj_tcd_cblk array is one of the largest allocations, because it
|
||||
contains a bunch of static buffers. This also makes it a major source of cache thrashing. This patch allocates
|
||||
the buffers from the heap, and dynamically sizes them in the decoder. I have not yet managed to dynamically size
|
||||
them in the encoder, getting the decoder to do it was tricky enough... I also split opj_tcd_cblk_t into separate
|
||||
encode and decode versions. A lot of fields were not used by both, so this cuts its size even further.
|
||||
|
||||
* [FOD] Avoided ABI breakage
|
||||
|
||||
November 13, 2007
|
||||
! [FOD] Patch by Dzonatas and Callum Lerwick.
|
||||
Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point,
|
||||
eliminating a few rounds of int/fp conversion, resulting in a vast performance improvement,
|
||||
and an increase in accuracy.
|
||||
|
||||
November 8, 2007
|
||||
! [FOD] In t1.c, small change to avoid calling twice t1_getwmsedec()
|
||||
Patches from Callum Lewick:
|
||||
- Basic gcc optimization flags in cmake and makefile match.
|
||||
- Fixed some spelling errors in dwt.c.
|
||||
|
||||
November 5, 2007
|
||||
*+ [GB] Fixed a bug which prevented JPWL from working on multi-tiled images; added some more fields in the interface info structures
|
||||
(keep a list of markers, save start packet number for each tile)
|
||||
|
||||
October 23, 2007
|
||||
* [GB] Improved success for the linux build; OPJViewer shows all the COM contents
|
||||
|
||||
October 18, 2007
|
||||
* [FOD] Changed the ROI parameter in the image_to_j2k codec to make it correspond to the documentation (i.e. -ROI c=0,U=25)
|
||||
* [FOD] Patch from Callum Lewick. Memset patch.
|
||||
The main idea of the patch is that currently opj_malloc clears all allocations, which unnecessarily
|
||||
dirties up the cache and eats bandwidth. This patch makes it no longer do so, and I've painstakingly determined which allocations actually need
|
||||
to be cleared and changed them to use opj_calloc() instead. I previously tried to just get rid of the opj_*alloc wrappers but that
|
||||
idea was nixed, so this time I'm trying it with macros. I also put in a gcc pragma that helps enforce their use. Which got messy. :) It caught a
|
||||
few places they weren't used but it also revealed that the mj2 tools are not very cleanly separated from the library. It includes all the
|
||||
internal headers, but it wasn't using the malloc wrappers. I figured the binaries should be "external" and have minimal knowledge of the
|
||||
internals of the library. I patched them to not include opj_includes.h, and include only the internal headers they actually need. However,
|
||||
they're using the opj_clock() function, which is in with the malloc wrappers. So I decided to move the malloc wrappers to their own header.
|
||||
But mj2.c seems to want to be "internal", so I patched it to use the wrappers. Note that this patch changes the semantics of opj_malloc, it no longer
|
||||
clears the memory it allocates. If you need it to be cleared, you must use opj_calloc instead, or memset it yourself. It is also somewhat
|
||||
invasive, please test it extensively. I've been pounding on it all summer with my test suite, Second Life, and valgrind, and it checks out clean.
|
||||
|
||||
October 12, 2007
|
||||
* [FOD] Changed the way the image structure is allocated when the decoding parameters include some resolutions to discard.
|
||||
This should have a significant impact for the decoding of huge images when some resolutions are discarder (-r parameter)
|
||||
Warning: The output image size is now reduced when discarding resolutions !
|
||||
|
||||
October 10, 2007
|
||||
* [FOD] Patch from Callum Lewick. Clean up of j2klib.h for the aligned malloc stuff.
|
||||
It makes it work right with mingw, as _mm_malloc() isn't a macro, attempts to pave the way to using cmake
|
||||
to check for this stuff and combines a patch from Dana Fagerstrom at Sun that makes it use memalign() on Solaris
|
||||
convert.c: Changed some error comments for TIFF images
|
||||
|
||||
September 27, 2007
|
||||
* [FOD] Patch from Callum Lewick. Fixed dwt.c where an alignment in buffer was problematic under x86_64.
|
||||
|
||||
September 25, 2007
|
||||
* [Mathieu Malaterre] BUG: Fix previous patch from Callum Lerwick. I have no
|
||||
clue what CMAKE_INSTALL_LIBDIR refers too. Bump up cmake 2.2 restriction to
|
||||
cmake 2.4 because of previous patch (not backward compatible). Properly set the SOVERSION in a cross plateform way (yes WIN32 is a platform)
|
||||
|
||||
September 19, 2007
|
||||
* [Parvatha] Fixed issues with generation of SOP marker.
|
||||
|
||||
September 18, 2007
|
||||
* [Parvatha] Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
|
||||
* [Parvatha] Fixed issues relating to using user specified rates for CINEMA option for multiple images.
|
||||
|
||||
September 17, 2007
|
||||
* [FOD] Fixed issues with cstr_info when codestream has components with different number of resolutions.
|
||||
! [FOD] OpenJPEG library interface modified to retain compatibility with version 1.2
|
||||
|
||||
September 12, 2007
|
||||
* [FOD] Patch from Callum Lerwick.
|
||||
Fixed the library linking so it links with the soversion properly set.
|
||||
Fixes up the install targets so that it interacts properly with RPM.
|
||||
Install target for MJ2. Sets some necessary and useful CFLAGS if gcc is in use.
|
||||
* [FOD] Updated the MJ2 codec to be compatible with the recent changes in the OpenJPEG library
|
||||
|
||||
September 11, 2007
|
||||
* [GB] JPWL encoding is finalized correctly into the JP2 file format; added an additional structure in opj_codestream_info, to keep a record of the written markers
|
||||
|
||||
September 8, 2007
|
||||
* [GB] Adapted the JPWL and OPJViewer code to new interface; fixed a samll bug in JPWL which created large EPBs even when null protection was specified
|
||||
|
||||
September 7, 2007
|
||||
+ [FOD] Indexes can now be generated when decoding J2K codestreams.
|
||||
* [Mathieu Malaterre] Upon failure, properly return error code (!=0).
|
||||
* [Mathieu Malaterre] CMake: Add cmake code to do testing if user has properly setup a testimages directory
|
||||
|
||||
September 6, 2007
|
||||
+ [Mathieu Malaterre] CMake: start compiling mj2, jpwl and jp3d
|
||||
+ [Mathieu Malaterre] CMake: output all executable/libs into one single directory
|
||||
+ [Mathieu Malaterre] CMake: start compiling index_create
|
||||
+ [Mathieu Malaterre] OpenJPEG.rc update copyright year
|
||||
+ [Mathieu Malaterre] CMake: add Java j2kviewer but do not compile it using cmake since cmake has too poor support for Java. Should create a custom command running ant instead.
|
||||
+ [Mathieu Malaterre] CMake: Add doxygen output
|
||||
+ [GB] One more field in the codestream_info struct for recording the number of packets per tile part; JPWL now distributes the EPBs in all the tile part headers
|
||||
+ [Mathieu Malaterre] CMake: Add very simple tests (simply run command line with no option)
|
||||
* [Mathieu Malaterre] Fix unitialized read in img_fol (we may need a smarter initialize than memset)
|
||||
|
||||
September 4, 2007
|
||||
+ [GB] Added some fields in the codestream_info structure: they are used to record the position of single tile parts.
|
||||
Changed also the write_index function in the codec, to reflect the presence of this new information.
|
||||
|
||||
September 3, 2007
|
||||
+ [GB] Added the knowledge of JPSEC SEC and INSEC markers (you have to compile the JPWL project). Management of these markers is limited to skipping them without crashing:
|
||||
no real security function at this stage. Deprecated USE_JPSEC will be removed next
|
||||
|
||||
August 31, 2007
|
||||
* [GB] Fixed save capabilities in OPJViewer due to recent code upgrade
|
||||
|
||||
August 30, 2007
|
||||
* [FOD] Changed the OpenJPEG library interface to enable users to access information regarding the codestream (also called codestream index).
|
||||
This index is usefull for all applications requiring to have a scalable acces to the codestream (like JPIP applications, ...)
|
||||
Currently, this information is only available when encoding an image.
|
||||
+ [FOD] Added the information regarding the end of packet position in the index
|
||||
|
||||
August 28, 2007
|
||||
* [FOD] Fixed wrong destructors called in openjpeg.c
|
||||
* [FOD] Fixed bug in j2k_decode_jpt_stream
|
||||
|
||||
August 24, 2007
|
||||
* [Parvatha] The end of main header is calculated after TLM and POC marker for Dcinema.
|
||||
|
||||
August 21, 2007
|
||||
+ [FOD] Added support for Visual Studio 2005
|
||||
* [FOD] Robustified MJ2 codecs
|
||||
* [Parvatha] Solved problems with codec reading from image file directory when filename had more than one "." in name
|
||||
* [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler
|
||||
* [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code
|
||||
* [Callum Lerwick] Memory leaks fixed
|
||||
* [Callum Lerwick] Reworks of t1_updateflags to get rid of the shift operation
|
||||
* [Callum Lerwick] mqc_setcurctx moved to the header to allow it to be inlined into the t1.
|
||||
* [Callum Lerwick] Consolidated some calls to mqc_setcurctx.
|
||||
* [Callum Lerwick] Cleaned up t1_generate_luts to output the proper types.
|
||||
* [Callum Lerwick] Replaced the large ctxno_mag lookup table with a small bit of inline-able branchless code
|
||||
* [Callum Lerwick] Moved the orient flipping into the ctxno_zc table.
|
||||
|
||||
August 20, 2007
|
||||
+ [FOD] Added support for the TGA file format in the codec
|
||||
|
||||
August 08, 2007
|
||||
* [Parvatha] Fixed the DCinema filesize allocation. It now includes the SOT marker size
|
||||
|
||||
August 02, 2007
|
||||
+ [GB] Added a basic saving capability to OPJViewer
|
||||
|
||||
July 18, 2007
|
||||
! [FOD] Updated libtiff library version to 3.8.2 (for WIN32)
|
||||
* [FOD] Updated BMP and PxM truncation when decoding J2K files with more than 8 bits
|
||||
|
||||
July 17, 2007
|
||||
* [FOD] Fixed raw option for images with more than three components
|
||||
|
||||
July 17, 2007
|
||||
+ [FOD] Added support for RAW images. This module has been developped by the University of Perugia team. Thanks to them ! [image_to_j2k.c j2k_to_image.c convert.c convert.h]
|
||||
|
||||
July 13, 2007
|
||||
! [FOD] Modified the memory allocation for codestreams containing multiple tiles. The memory is now allocated for each tile indenpendently,
|
||||
leading to an important decrease of the virtual memory needed. [j2k.c tcd.h tcd.c]
|
||||
! [FOD] Modified old comments about the ability to decode mega-images and comments about the disk size necessary to do this. [image_to_j2k.c and frames_to_mj2.c]
|
||||
* [FOD] Added 2000 bytes for the memory allocation in cio.c for the minimum size of headers (useful in case of very small images) [cio.c]
|
||||
|
||||
July 12, 2007
|
||||
* [GB] fixed a bug in JPWL module, which prevented to exploit the full error correction capability of RS codes (e.g. it gave up at 5 errors,
|
||||
even if 6 were correctable); defined a JPWL_MAXIMUM_EPB_ROOM for better customization of the maximum dimension of EPBs (the dimension
|
||||
is pre-calculated on an hypothesis, if it goes beyond 65535 there will be problems, thus we give a little less than the max, let's say 65450)
|
||||
|
||||
July 8, 2007
|
||||
* [ANTONIN] fixed the size of the memory allocation in cio.c (confusion between bits and bytes)
|
||||
|
||||
June 21, 2007
|
||||
* [FOD] Output image color space set when decoding a JP2 file in jp2.c
|
||||
+ [GB] Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer
|
||||
|
||||
June 18, 2007
|
||||
* [GB] Reload image doesn't crash in OPJViewer; more settings saved to registry
|
||||
|
||||
June 16, 2007
|
||||
+ [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry
|
||||
|
||||
June 15, 2007
|
||||
* [FOD] Fixed the generation of index files
|
||||
|
||||
|
||||
----------------------
|
||||
MAY 4, 2007
|
||||
VERSION 1.2.0 RELEASED
|
||||
----------------------
|
||||
|
||||
May 4, 2007
|
||||
* [FOD] Bugs corrected in decoding of command line (getopt.c), in the handling of 16 bit files (t1.c and tcd.c) and the calculation of elapsed time for multiple tiles parts (tcd.c and tdc.h).
|
||||
|
||||
June 2, 2007
|
||||
+ [GB] OPJViewer opens now BMP, PNG, GIF, PNM, TIFF (with wxWidgets internals); added an encoder settings tab, for future integration with "save file as..." in JPEG 2000 format
|
||||
|
||||
May 31, 2007
|
||||
* [FOD] Fixed the handling of 16bit TIFF files for cinema compression. Modified "convert.c"
|
||||
* [FOD] Fixed the parameters used for cinema compression (9-7 transform used instead of 5-3). Modified "image_to_j2k.c"
|
||||
|
||||
May 24, 2007
|
||||
* [FOD] Bug fixed by Sylvain Munaut. Change in the reading of the POC marker. Since COD/COC can be anywhere in the header, the decoder cannot always know while decoding the POC marker
|
||||
the value of numlayers and numresolution.
|
||||
|
||||
May 23, 2007
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This makes the t1 data arrays dynamic, which greatly reduces cache thrashing. Also, some minor cleanup to prevent unnecessary casts"
|
||||
|
||||
May 22, 2007
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "Some formatting cleanups,
|
||||
so that the long function definitions and calls fit on screen. Use of prefix increment which is theoretically faster, in practice any sane compiler can optimize a postfix
|
||||
increment but its best not to count on such things. Consolidation of some redundant calculations in the inner loops, which becomes very useful in the future autovectorize patch."
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This changes the flag code in t1 to use a flag_t type, which can then be changed to reduce RAM usage. It is now typedef to a short."
|
||||
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This patch makes the t1 LUTs static. I actually intend this as a prelude to possibly eliminating some or all of the LUTs entirely."
|
||||
|
||||
May 11, 2007
|
||||
- [FOD] JP3D library Binaries removed from SVN.
|
||||
! [FOD] MJ2 codec updated from LibOpenJPEG version 0.97 to LibOpenJPEG version 1. Hence, the MJ2 codec will now take advantage of all the improvements and optimizations done on the LibOpenJPEG library.
|
||||
! [FOD] Possibility to choose to apply MCT (multiple component transform) enabled, and new decoding_limit: DECODE_ALL_BUT_PACKETS (openjpeg.h)
|
||||
|
||||
April 26, 2007
|
||||
+ [gdcm] Add basic steps on how to use CMake for building examples (README.cmake)
|
||||
|
||||
April 25, 2007
|
||||
+ [FOD] Modification of the openjpeg.h file to avoid and ABI break with v1.1, removed the dangerous #IFDEF JPWL and added tcp_mct in cparameters.
|
||||
|
||||
April 23, 2007
|
||||
+ [GB] Enable/disable image decoding in OPJViewer
|
||||
|
||||
April 12,2007
|
||||
* [Parvatha] Fixed Error in tiftoimage(). Modification in convert.c.
|
||||
|
||||
April 10,2007
|
||||
+ [Parvatha] Accepting "j2c" as format for Encoding and Decoding. Modification in image_to_j2k.c.
|
||||
* [Parvatha] Modified imagetotif() to read images with signed data. Modification in convert.c.
|
||||
|
||||
April 5, 2007
|
||||
! [FOD] fix.h optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||
! [FOD] dwt.c optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||
! [FOD] t1.c optimized. Thanks a lot to Callum Lerwick <seg at haxxed.com> !
|
||||
|
||||
April 4,2007
|
||||
+ [Parvatha] Digital cinema compliance for 4K chosen by "-cinema4K" option. Modification in image_to_j2k.c.
|
||||
+ [Parvatha] Bit rate limitation for each color component. Modification in image_to_j2k.c, t2.c.
|
||||
* [Parvatha] Modified and tested Progression order change "-POC" option. Modification in image_to_j2k.c, j2k.c, pi.c.
|
||||
+ [Parvatha] Function j2k_check_poc_val() to check for possible loss of packets in case of wrong POC declaration. Modification in j2k.c.
|
||||
+ [Parvatha] Structure T2_MODE. This tells if the t2_encode_packets() is called during Threshold calculation or in Final pass. Modification in j2k.h, tcd.c
|
||||
|
||||
March 30, 2007
|
||||
* [GB] OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit.
|
||||
|
||||
March 29, 2007
|
||||
* [Parvatha] Enable accepting file names with `-´ symbol .Modification getopt.c
|
||||
* [Parvatha] Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
|
||||
! [Parvatha] renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
|
||||
* [Parvatha] Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
|
||||
! [Parvatha] j2k_setup_encoder to set bit rate limitation for digital cinema compliance with quality option. Modification in j2k.c
|
||||
* [Parvatha] Equation to check multiple tile precincts. Modification pi.c
|
||||
! [Parvatha] array size generation of pi->include in pi_initialise_encode().Modification in pi.c
|
||||
* [Parvatha] modification in pi_create_encode for tile part generation.Modification in pi.c
|
||||
+ [Parvatha] In tcd_rateallocate a variable stable_threshold which holds the valid threshold value.
|
||||
This is used to avoid error in case of a wrong threshold value in the last iteration. Modification in tcd.c.
|
||||
|
||||
March 28, 2007
|
||||
* [FOD] Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha !
|
||||
|
||||
March 27, 2007
|
||||
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits;
|
||||
can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
|
||||
* [GB] Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c,
|
||||
have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)
|
||||
+ [GB] Added linking to TIFF library in the JPWL VC6 workspaces
|
||||
|
||||
March 23, 2007
|
||||
* [antonin] Fixed Makefile.osx and changed Readme.osx accordingly
|
||||
|
||||
March 21, 2007
|
||||
* [Parvatha] Fixed j2k_prog_order_list[]. Modifications in j2k.c.
|
||||
* [Parvatha] Fixed t1_decode_cblks. Modifications in t1.c.
|
||||
|
||||
March 20, 2007
|
||||
+ [Parvatha] Added feature for generation of tile parts. Modifications in image_to_j2k.c, openjpeg.c, j2k.c, pi.c
|
||||
+ [Parvatha] Added function j2k_write_tlm(),to generate TLM marker for a Digital cinema compliant codestream. Modifications in j2k.c.
|
||||
|
||||
March 14, 2007
|
||||
* [FOD] Fixed linux makefile, with help from David Fries and Guido
|
||||
|
||||
March 7, 2007
|
||||
+ [Parvatha] Added option for Digital cinema profile compliant codestream. This can be chosen by "-cinema2K" or "-cinema4K" for a 2K and 4K compliance respectively. The feature for tileparts has not been implemented in this version. Modification in image_to_j2k.c
|
||||
+ [Parvatha] Added the Digital Cinema profiles (CINEMA2K and CINEMA4K) to the list of profiles recognized in the codestream SIZ marker segment. Modification in openjpeg.h,j2k.c
|
||||
+ [Parvatha] Added feature for constant quality within bitrate defined in Digital cinema standards. Modification in tcd.c
|
||||
! [Parvatha] Modified the method of generation of buffer length. Modification in cio.c
|
||||
|
||||
|
||||
March 1, 2007
|
||||
* [FOD] Modified codec projects (*.dsp) and makefile to include the tiff library (modified codec/image_to_j2k.dsp codec/j2k_to_image.dsp and codec/makefile)
|
||||
+ [GB] Zoom capability and decoder settings dialog in OPJViewer; modified JPWL library .dsp project in order to create a library with embedded JPWL functions
|
||||
|
||||
February 28, 2007
|
||||
+ [Parvatha] Enabled compression of TIF image format to j2k by tifftoimage() and decompression of codestream to TIF image format using imagetotif(). Modifications in image_to_j2k.c, j2k_to_image.c, convert.c, convert.h
|
||||
* [antonin] fixed a bug in context numerotation that prevented the RESET switch to work correctly : mqc_reset_enc in mqc.c
|
||||
* [Fod] Corrected codec Makefile by adding the compilation of "compat/getopt.c"
|
||||
|
||||
February 27, 2007
|
||||
* [Parvatha] Made get_file_format function more robust. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
|
||||
February 26, 2007
|
||||
+ [Parvatha] Option to read images from a Folder whose path is specified in the Input parameters by "-ImgDir" along with output decod format specified by "-OutFor" . Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
+ [Parvatha] Enabling use of multi character input parameters in the codec. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||
|
||||
----------------------
|
||||
February 23, 2007
|
||||
VERSION 1.1.1 RELEASED
|
||||
----------------------
|
||||
|
||||
February 23, 2007
|
||||
* [GB] Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c.
|
||||
As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib
|
||||
+ [GB] Linux makefile for the JPWL module; newlines at end of JPWL files
|
||||
|
||||
February 22, 2007
|
||||
+ [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia
|
||||
|
||||
February 21, 2007
|
||||
+ [FOD] Algorithmic optimizations in t1.c, thanks to Guido J. !
|
||||
|
||||
February 19, 2007
|
||||
+ [FOD] Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header (modified openjpeg.c, openjpeg.h, j2k.c and j2k.h)
|
||||
|
||||
February 13, 2007
|
||||
! [FOD] David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
|
||||
! [FOD] David Fries suggestions. Makefile modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
|
||||
|
||||
January 31, 2007
|
||||
! [FOD] Extra tokens at the end of #endif directive corrected in openjpeg.c, j2k.c and image_to_j2k.c -> no more warnings in linux compilation
|
||||
! [FOD] Linux Makefile added for the codec
|
||||
|
||||
January 30, 2007
|
||||
! [FOD] Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c
|
||||
! [FOD] Correction of the syntax usage in MJ2_codec/mj2_to_frames.c
|
||||
|
||||
January 23, 2007
|
||||
! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h
|
||||
|
||||
December 07, 2006
|
||||
+ [Giuseppe Baruffa] Antonin verified that the MacOS build suffered from a missing definition of the "min" macro; I've added this definition (properly #ifndef'ed) into both jpwl.h and rs.h
|
||||
|
||||
December 05, 2006
|
||||
* [Giuseppe Baruffa] Better fix of the TPH EPBs bug in JPWL module
|
||||
* [GB] Fixed the UEP bug in JPWL module; now, during a UEP specification, RS protection or CRC check can be switched off for selected range of packets, and consequently reswitched on without confusing the decoder
|
||||
+ [GB] Added some lines in the help of JPWL_image_to_j2k, specifying that when using error protection on data packets, this must be paired with header protection, i.e. there cannot be packet protection without header protection
|
||||
|
||||
December 04, 2006
|
||||
|
||||
+ [Francois-Olivier Devaux] New tag: version1.0 (includes codec and libopenjpeg directories)
|
||||
Total update of JPWL module
|
||||
- [FOD] removed directories jpwl/decoder, jpwl/encoder, jpwl/decoder_02, jpwl/encoder_02
|
||||
+ [FOD] added in JPWL directory crc.h, jpwl.h, rs.h, crc.c, jpwl.c, jpwl_lib.c, rs.c, JPWL_image_to_j2k.dsp, JPWL_j2k_to_image.dsp, LibOpenJPEG_JPWL.dsp, JPWL_image_to_j2k.dsw, JPWL_j2k_to_image.dsw
|
||||
! [FOD] Modifications of libopenjpeg to integrate JPWL module (in libopenjpeg directory): j2k.c, j2k.h, openjpeg.c, openjpeg.h, opj_includes.g, t2.c
|
||||
! [FOD] Modification of codec to integrate JPWL module (in codec directory): image_to_j2k.c, j2k_to_image.c
|
||||
* [FOD] Corrected incorrect fprintf() formatting in codec/convert.c
|
||||
* [FOD] Code optimization usinq vsprintf() command in libopenjpeg/event.c
|
||||
* [Giuseppe Baruffa] Fixed a bug in TPH EPBs parameters: now, "last in current header" information is correctly signaled
|
||||
|
||||
October 31, 2006
|
||||
* [Antonin] fixed a bug in the computation of the mantissa (mu)
|
||||
+ [Antonin] added the ability to specify the rate as "float" (before : integer)
|
||||
|
||||
August 18, 2006
|
||||
* [Antonin] fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly.
|
||||
|
||||
August 4, 2006
|
||||
* [Antonin] fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level.
|
||||
|
||||
July 28, 2006
|
||||
+ [Antonin Descampe] added a readme in /mj2 to warn people that it only works with opj0.97
|
||||
|
||||
July 21, 2006
|
||||
* [Mathieu Malaterre] Install exe and lib and include correctly
|
||||
* [Mathieu Malaterre] Fixed mem leaks and greyscale bmp
|
||||
* [Mathieu Malaterre] Fix pgx name length + random memory access
|
||||
! [Mathieu Malaterre] API is now const
|
||||
|
||||
March 19, 2006
|
||||
* [Antonin] fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug)
|
||||
|
||||
February 12, 2006
|
||||
- [Herve Drolon] removed unneeded working variables in opj_tcd_t
|
||||
|
||||
February 04, 2006
|
||||
* [galt] fixed a bug in codec/convert.c::imagetobmp
|
||||
|
||||
February 01, 2006
|
||||
! [Herve Drolon] changed function definitions of INT and FIX modules to 'inline'
|
||||
+ [Herve Drolon] added a VERSION resource to the DLL version of OpenJPEG
|
||||
|
||||
January 31, 2006
|
||||
* [Mathieu Malaterre] Fix compilation using default openjpeg.dsw
|
||||
* [Herve Drolon] fixed various minor warnings occuring under icc9 and bcc32
|
||||
- [Mathieu Malaterre] Remove all references to OPJ_EXPORT, no declspec in header file anymore
|
||||
+ [Mathieu Malaterre] Add a def.in file which is a template for Module Definition
|
||||
+ [Herve Drolon] added MSVC project and compiler directives to build a 'standard' WIN32 DLL
|
||||
! [Mathieu Malaterre] Update CMake to match the new shared lib system (no more def file)
|
||||
|
||||
January 27, 2006
|
||||
* [Antonin Descampe] fixed a two initialization problems in t1.c and tcd.c
|
||||
|
||||
January 26, 2006
|
||||
* [Herve Drolon] fixed various minor warnings occuring under gcc
|
||||
* [__david__] fixed a segfault in codec/image_to_j2k.c & codec/j2k_to_image.c
|
||||
* [__david__] fixed help option in codec/j2k_to_image & codec/image_to_j2k
|
||||
|
||||
January 25, 2006
|
||||
! [Mathieu Malaterre] Sync with ITK repository, also add ref to doxygen
|
||||
! [Mathieu Malaterre] Add a lot of comments on the CMake build system
|
||||
! [Mathieu Malaterre] Fix MINGW32 and BORLAND compilation problems.
|
||||
|
||||
January 25, 2006
|
||||
* [Antonin Descampe] fixed a problem in convert.c when multiple comments
|
||||
+ [Antonin Descampe] added cmake files to the project
|
||||
! [Antonin Descampe] fix.c : replaced "WIN32" by "_MSC_VER" for int64
|
||||
+ [Antonin Descampe] added "OPJ_EXPORT" in openjpeg.h to generate shared lib with win32
|
||||
! [Antonin Descampe] removed all CtrlM from files
|
||||
|
||||
January 24, 2006
|
||||
! [Antonin Descampe] event.c : replaced "WIN32" by "_MSC_VER" for i2a
|
||||
|
||||
January 20, 2006
|
||||
* [Antonin Descampe] fixed various minor warnings with gdcm patches
|
||||
|
||||
January 19, 2006
|
||||
* [Herve Drolon] fixed a bug in jp2_read_ihdr (need to allocate jp2->comps)
|
||||
|
||||
January 18, 2006
|
||||
* [Herve Drolon] changed the name of j2k_realloc to opj_realloc
|
||||
* [Herve Drolon] fixed a bug in opj_cio_open when saving 48-bit images (wrong buffer size calculation)
|
||||
|
||||
December 8, 2005
|
||||
* [Antonin Descampe] fixed a bug when specifying a rate '-r' => no distortion info was available in the index
|
||||
* [Antonin Descampe] fixed a bug in t1_getwmsedec (stepsize was divided by 8192)
|
||||
|
||||
December 5, 2005 - 1.1.0
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# Note that the ITK/CMakeLists.txt file configures this file
|
||||
#
|
||||
# CMake/CTestCustom.cmake.in
|
||||
#
|
||||
# to this file
|
||||
#
|
||||
# ${ITK_BINARY_DIR}/CTestCustom.cmake
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# For further details regarding this file,
|
||||
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||
#
|
||||
# and
|
||||
# http://www.kitware.com/blog/home/post/27
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||
|
||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
|
||||
# Exclude files from the Testing directories
|
||||
".*/tests/.*"
|
||||
".*/Testing/.*"
|
||||
)
|
||||
|
||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
# Check if getopt is present:
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
SET(DONT_HAVE_GETOPT 1)
|
||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||
# Seems like we need the contrary:
|
||||
IF(CMAKE_HAVE_GETOPT_H)
|
||||
SET(DONT_HAVE_GETOPT 0)
|
||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
417
CMakeLists.txt
417
CMakeLists.txt
@@ -6,53 +6,74 @@
|
||||
# you will eventually like to prefix the library to avoid linking confusion
|
||||
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||
# e.g.:
|
||||
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
if(COMMAND CMAKE_POLICY)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_NAMESPACE)
|
||||
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
SET(OPENJPEG_STANDALONE 1)
|
||||
ENDIF(NOT OPENJPEG_NAMESPACE)
|
||||
if(NOT OPENJPEG_NAMESPACE)
|
||||
set(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
set(OPENJPEG_STANDALONE 1)
|
||||
endif()
|
||||
# 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.
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
include_regular_expression("^.*$")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
||||
SET(OPENJPEG_VERSION_MINOR 4)
|
||||
SET(OPENJPEG_VERSION_BUILD 0)
|
||||
SET(OPENJPEG_VERSION
|
||||
set(OPENJPEG_VERSION_MAJOR 2)
|
||||
set(OPENJPEG_VERSION_MINOR 0)
|
||||
set(OPENJPEG_VERSION_BUILD 1)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
SET(PACKAGE_VERSION
|
||||
set(PACKAGE_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
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
|
||||
# 2.0.1 | 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 7)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_VERSION_MAJOR}"
|
||||
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
SET(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/CMake
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/cmake
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||
# warnings
|
||||
IF(WIN32)
|
||||
IF(NOT BORLAND)
|
||||
IF(NOT CYGWIN)
|
||||
IF(NOT MINGW)
|
||||
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ADD_DEFINITIONS(
|
||||
if(WIN32)
|
||||
if(NOT BORLAND)
|
||||
if(NOT CYGWIN)
|
||||
if(NOT MINGW)
|
||||
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
add_definitions(
|
||||
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||
@@ -64,215 +85,267 @@ IF(WIN32)
|
||||
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
)
|
||||
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ENDIF(NOT MINGW)
|
||||
ENDIF(NOT CYGWIN)
|
||||
ENDIF(NOT BORLAND)
|
||||
ENDIF(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Install directories
|
||||
|
||||
STRING(TOLOWER ${PROJECT_NAME} projectname)
|
||||
SET(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
string(TOLOWER ${PROJECT_NAME} projectname)
|
||||
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
set(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
set(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
SET(OPENJPEG_INSTALL_DATA_DIR "share/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
set(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
endif()
|
||||
|
||||
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
SET(OPENJPEG_INSTALL_PACKAGE_DIR ${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}
|
||||
CACHE INTERNAL "")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
if(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||
if(WIN32)
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
|
||||
else()
|
||||
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
# We could install *.cmake files in share/ however those files contains
|
||||
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
|
||||
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
|
||||
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test for some required system information.
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test for getopt being available in this system
|
||||
INCLUDE (${OPENJPEG_SOURCE_DIR}/CMake/CheckHaveGetopt.cmake )
|
||||
# Big endian test:
|
||||
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
SET (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# configure name mangling to allow multiple libraries to coexist
|
||||
# peacefully
|
||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||
@ONLY IMMEDIATE)
|
||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
INSTALL( CODE
|
||||
"EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink \"libopenjpeg1.pc\" \"\$ENV{DESTDIR}${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")")
|
||||
@ONLY)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
# SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (1/2)
|
||||
FIND_FILE(HAVE_STRINGS_H_FOUND strings.h)
|
||||
IF(NOT HAVE_STRINGS_H_FOUND STREQUAL "HAVE_STRINGS_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STRINGS_H strings.h)
|
||||
SET(HAS_STRINGS_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_INTTYPES_H_FOUND inttypes.h)
|
||||
IF(NOT HAVE_INTTYPES_H_FOUND STREQUAL "HAVE_INTTYPES_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_INTTYPES_H inttypes.h)
|
||||
SET(HAS_INTTYPES_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_MEMORY_H_FOUND memory.h)
|
||||
IF(NOT HAVE_MEMORY_H_FOUND STREQUAL "HAVE_MEMORY_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_MEMORY_H memory.h)
|
||||
SET(HAS_MEMORY_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STDINT_H_FOUND stdint.h)
|
||||
IF(NOT HAVE_STDINT_H_FOUND STREQUAL "HAVE_STDINT_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STDINT_H stdint.h)
|
||||
SET(HAS_STDINT_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STDLIB_H_FOUND stdlib.h)
|
||||
IF(NOT HAVE_STDLIB_H_FOUND STREQUAL "HAVE_STDLIB_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STDLIB_H stdlib.h)
|
||||
SET(HAS_STDLIB_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_STRING_H_FOUND string.h)
|
||||
IF(NOT HAVE_STRING_H_FOUND STREQUAL "HAVE_STRING_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_STRING_H string.h)
|
||||
SET(HAS_STRING_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_SYS_STAT_H_FOUND sys/stat.h)
|
||||
IF(NOT HAVE_SYS_STAT_H_FOUND STREQUAL "HAVE_SYS_STAT_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_SYS_STAT_H sys/stat.h)
|
||||
SET(HAS_SYS_STAT_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_SYS_TYPES_H_FOUND sys/types.h)
|
||||
IF(NOT HAVE_SYS_TYPES_H_FOUND STREQUAL "HAVE_SYS_TYPES_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_SYS_TYPES_H sys/types.h)
|
||||
SET(HAS_SYS_TYPES_H 1)
|
||||
ENDIF()
|
||||
FIND_FILE(HAVE_UNISTD_H_FOUND unistd.h)
|
||||
IF(NOT HAVE_UNISTD_H_FOUND STREQUAL "HAVE_UNISTD_H_FOUND-NOTFOUND")
|
||||
FIND_FILE(HAVE_UNISTD_H unistd.h)
|
||||
SET(HAS_UNISTD_H 1)
|
||||
ENDIF()
|
||||
|
||||
# Check if some include files are provided by the system
|
||||
include(EnsureFileInclude)
|
||||
# These files are mandatory
|
||||
ensure_file_include("string.h" HAVE_STRING_H YES)
|
||||
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
|
||||
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
|
||||
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
|
||||
ensure_file_include("math.h" HAVE_MATH_H YES)
|
||||
ensure_file_include("float.h" HAVE_FLOAT_H YES)
|
||||
ensure_file_include("time.h" HAVE_TIME_H YES)
|
||||
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
|
||||
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
|
||||
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
|
||||
|
||||
# For the following files, we provide an alternative, they are not mandatory
|
||||
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
|
||||
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
|
||||
|
||||
# why check this one ? for openjpip ?
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
|
||||
# Enable Large file support
|
||||
include(TestLargeFiles)
|
||||
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Library
|
||||
INCLUDE_DIRECTORIES(BEFORE ${OPENJPEG_BINARY_DIR})
|
||||
ADD_SUBDIRECTORY(libopenjpeg)
|
||||
if(BUILD_JPIP_SERVER)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(FCGI REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
message(FATAL_ERROR "Only pthread are supported")
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src/lib)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||
option(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||
if(BUILD_JPIP)
|
||||
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||
endif()
|
||||
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||
option(BUILD_JP3D "Build the JP3D comp" OFF)
|
||||
mark_as_advanced(BUILD_VIEWER)
|
||||
mark_as_advanced(BUILD_JAVA)
|
||||
mark_as_advanced(BUILD_JP3D)
|
||||
|
||||
IF(BUILD_CODEC OR BUILD_MJ2)
|
||||
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
ADD_SUBDIRECTORY(thirdparty)
|
||||
ADD_SUBDIRECTORY(applications)
|
||||
ENDIF (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
|
||||
# ON: 3rd party libs will ALWAYS be build, and used
|
||||
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
add_subdirectory(thirdparty)
|
||||
add_subdirectory(src/bin)
|
||||
endif ()
|
||||
add_subdirectory(wrapping)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (2/2)
|
||||
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_configh.cmake.in"
|
||||
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build JPWL-flavoured library and executables
|
||||
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Buld Testing
|
||||
OPTION(BUILD_TESTING "Build the tests." OFF)
|
||||
IF(BUILD_TESTING)
|
||||
IF(BUILD_CODEC)
|
||||
ENABLE_TESTING()
|
||||
INCLUDE(CTest)
|
||||
|
||||
# Add repository where to find tests
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
||||
option(BUILD_TESTING "Build the tests." OFF)
|
||||
if(BUILD_TESTING)
|
||||
if(BUILD_CODEC)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
# Search openjpeg data needed for the tests
|
||||
# They could be found via svn on the OpenJPEG google code project
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../opj-data)
|
||||
|
||||
SET (REF_DECODER_BIN_PATH "NOT-FOUND" CACHE PATH "Single directory where find the reference encoder binaries to enable encoding test suite.")
|
||||
MARK_AS_ADVANCED(REF_DECODER_BIN_PATH)
|
||||
|
||||
ELSE(BUILD_CODEC)
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../../data
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
# Add repository where to find tests
|
||||
add_subdirectory(tests)
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "You need build codec to run the tests")
|
||||
ENDIF(BUILD_CODEC)
|
||||
ENDIF(BUILD_TESTING)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install all targets referenced as OPENJPEGTargets
|
||||
INSTALL(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
|
||||
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
configure_file( ${OPENJPEG_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install CHANGES and LICENSE
|
||||
INSTALL(
|
||||
FILES CHANGES
|
||||
LICENSE
|
||||
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
|
||||
include (cmake/OpenJPEGCPack.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
if(UNIX)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
#
|
||||
if(BUILD_JPWL)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpwl/libopenjpwl.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JPIP)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JP3D)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp3d/libopenjp3d.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
87
INSTALL
87
INSTALL
@@ -2,45 +2,10 @@
|
||||
How to build and install openjpeg binaries
|
||||
==========================================
|
||||
|
||||
UNIX/LINUX similar systems
|
||||
UNIX/LINUX/MacOSX/Windows systems
|
||||
--------------------------
|
||||
|
||||
1) Using configure tools
|
||||
|
||||
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'
|
||||
'--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
|
||||
|
||||
|
||||
2) Using cmake (see www.cmake.org)
|
||||
Using cmake (see www.cmake.org)
|
||||
|
||||
Type:
|
||||
cmake .
|
||||
@@ -48,12 +13,13 @@ Type:
|
||||
|
||||
If you are root:
|
||||
make install
|
||||
make clean
|
||||
|
||||
else:
|
||||
else if you have sudo power:
|
||||
sudo make install
|
||||
make clean
|
||||
|
||||
|
||||
else
|
||||
DESTDIR=$HOME/local make install
|
||||
|
||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
(A 'html' directory is generated in the 'doc' directory)
|
||||
make doc
|
||||
@@ -61,35 +27,32 @@ To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
Binaries are located in the 'bin' directory.
|
||||
|
||||
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')
|
||||
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 documentation: '-DBUILD_DOC: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 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):
|
||||
cmake . -DBUILD_TESTING:BOOL=ON -DJPEG2000_CONFORMANCE_DATA_ROOT:PATH=/path/to/your/JPEG2000/test/files
|
||||
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
|
||||
make
|
||||
make Experimental
|
||||
Note : JPEG2000 test files are available here : http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
||||
|
||||
3) Manually using Makefile.nix:
|
||||
- Manually edit the config.nix file
|
||||
- Manually create an opj_config.h file from opj_config.h.in.user
|
||||
and edit this opj_config.h
|
||||
- Then : (if 'WITH_JPWL' is defined in config.nix)
|
||||
make -f Makefile.nix all
|
||||
make -f Makefile.nix install
|
||||
make -f Makefile.nix clean
|
||||
make -f Makefile.nix uninstall
|
||||
- If 'WITH_JPWL' is not defined in config.nix
|
||||
and you want to clean/compile/install/uninstall JPWL:
|
||||
call the respective target in the respective directory.
|
||||
Note : JPEG2000 test files are available with 'svn checkout http://openjpeg.googlecode.com/svn/data' (about 70 Mo).
|
||||
If '-DOPJ_DATA_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE_SOURCE_DIR}/../data',
|
||||
corresponding to the location of the data directory when compiling from the trunk (and assuming the data directory has
|
||||
been checked out of course).
|
||||
|
||||
MACOSX
|
||||
------
|
||||
|
||||
The same building procedures as above (autotools and cmake) work for MACOSX.
|
||||
The same building procedures as above work for MACOSX.
|
||||
The xcode project file can also be used.
|
||||
|
||||
If it does not work, try adding the following flag to the cmake command :
|
||||
@@ -98,7 +61,9 @@ If it does not work, try adding the following flag to the cmake command :
|
||||
WINDOWS
|
||||
-------
|
||||
|
||||
If you're using cygwin or MinGW, the same procedures as for Unix can be used.
|
||||
|
||||
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
|
||||
You can use cmake to generate project files for the IDE you are using (VS2010, NMake, etc).
|
||||
Type 'cmake --help' for available generators on your platform.
|
||||
|
||||
Make sure to build the third party libs (png, zlib ...):
|
||||
|
||||
'-DBUILD_THIRDPARTY:BOOL=ON'
|
||||
|
||||
21
LICENSE
21
LICENSE
@@ -1,10 +1,19 @@
|
||||
/*
|
||||
* 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
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2009, Francois-Olivier Devaux
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -27,4 +36,4 @@
|
||||
* 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.
|
||||
*/
|
||||
*/
|
||||
|
||||
59
Makefile.am
59
Makefile.am
@@ -1,59 +0,0 @@
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpwl=yes --enable-mj2=yes
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = libopenjpeg applications doc
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libopenjpeg1.pc
|
||||
|
||||
|
||||
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/CheckHaveGetopt.cmake \
|
||||
CMake/OpenJPEGConfig.cmake.in \
|
||||
testing/CTestCustom.cmake.in \
|
||||
testing/CTestConfig.cmake \
|
||||
CMakeLists.txt \
|
||||
LICENSE \
|
||||
CHANGES \
|
||||
README \
|
||||
INSTALL \
|
||||
bootstrap.sh \
|
||||
libopenjpeg1.pc.cmake \
|
||||
libopenjpeg1.pc.in \
|
||||
opj_configh.cmake.in \
|
||||
opj_config.h.in.user \
|
||||
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:
|
||||
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
|
||||
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
|
||||
@cat $(top_builddir)/report.txt
|
||||
@rm $(top_builddir)/report.txt
|
||||
|
||||
uninstall-hook:
|
||||
rm -f $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
183
Makefile.nix
183
Makefile.nix
@@ -1,183 +0,0 @@
|
||||
#top Makefile.nix
|
||||
include config.nix
|
||||
|
||||
TARGET = openjpeg
|
||||
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
|
||||
|
||||
INCLUDE = -I. -Ilibopenjpeg
|
||||
LIBRARIES = -lstdc++
|
||||
|
||||
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c \
|
||||
./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c \
|
||||
./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c \
|
||||
./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c \
|
||||
./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c \
|
||||
./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c \
|
||||
|
||||
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h \
|
||||
./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h \
|
||||
./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h \
|
||||
./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h \
|
||||
./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h \
|
||||
./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h \
|
||||
./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h \
|
||||
./libopenjpeg/opj_includes.h
|
||||
|
||||
INSTALL_LIBDIR = $(prefix)/lib
|
||||
headerdir = openjpeg-$(MAJOR).$(MINOR)
|
||||
INSTALL_INCLUDE = $(prefix)/include/$(headerdir)
|
||||
|
||||
# Converts cr/lf to just lf
|
||||
DOS2UNIX = dos2unix
|
||||
|
||||
MODULES = $(SRCS:.c=.o)
|
||||
|
||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||
|
||||
LIBNAME = lib$(TARGET)
|
||||
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
SHAREDLIB = $(LIBNAME).so.$(MAJOR).$(MINOR).$(BUILD)
|
||||
else
|
||||
STATICLIB = $(LIBNAME).a
|
||||
endif
|
||||
|
||||
default: all
|
||||
|
||||
all: OpenJPEG
|
||||
make -C codec -f Makefile.nix all
|
||||
make -C mj2 -f Makefile.nix all
|
||||
ifeq ($(WITH_JPWL),yes)
|
||||
make -C jpwl -f Makefile.nix all
|
||||
endif
|
||||
ifeq ($(WITH_JP3D),yes)
|
||||
make -C jp3d -f Makefile.nix all
|
||||
endif
|
||||
|
||||
dos2unix:
|
||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||
|
||||
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||
install -d bin
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
install -m 755 $(SHAREDLIB) bin
|
||||
(cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR))
|
||||
(cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so)
|
||||
else
|
||||
install -m 644 $(STATICLIB) bin
|
||||
endif
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
$(SHAREDLIB): $(MODULES)
|
||||
$(CC) -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||
else
|
||||
$(STATICLIB): $(MODULES)
|
||||
rm -f $(STATICLIB)
|
||||
$(AR) r $@ $(MODULES)
|
||||
endif
|
||||
|
||||
install: OpenJPEG
|
||||
install -d $(DESTDIR)$(INSTALL_LIBDIR)
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
install -m 755 -o root -g root $(SHAREDLIB) $(DESTDIR)$(INSTALL_LIBDIR)
|
||||
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||
ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR) )
|
||||
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||
ln -sf $(SHAREDLIB) $(LIBNAME).so )
|
||||
else
|
||||
install -m 644 -o root -g root $(STATICLIB) $(DESTDIR)$(INSTALL_LIBDIR)
|
||||
(cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB) )
|
||||
endif
|
||||
install -d $(DESTDIR)$(INSTALL_INCLUDE)
|
||||
install -m 644 -o root -g root libopenjpeg/openjpeg.h \
|
||||
$(DESTDIR)$(INSTALL_INCLUDE)
|
||||
(cd $(DESTDIR)$(prefix)/include && \
|
||||
ln -sf $(headerdir)/openjpeg.h openjpeg.h)
|
||||
make -C codec -f Makefile.nix install
|
||||
make -C mj2 -f Makefile.nix install
|
||||
ifeq ($(WITH_JPWL),yes)
|
||||
make -C jpwl -f Makefile.nix install
|
||||
endif
|
||||
ifeq ($(WITH_JP3D),yes)
|
||||
make -C jp3d -f Makefile.nix install
|
||||
endif
|
||||
$(LDCONFIG)
|
||||
make -C doc -f Makefile.nix install
|
||||
|
||||
ifeq ($(WITH_JPWL),yes)
|
||||
jpwl-all:
|
||||
make -C jpwl -f Makefile.nix all
|
||||
|
||||
jpwl-install: jpwl-all
|
||||
make -C jpwl -f Makefile.nix install
|
||||
$(LDCONFIG)
|
||||
|
||||
jpwl-clean:
|
||||
make -C jpwl -f Makefile.nix clean
|
||||
|
||||
jpwl-uninstall:
|
||||
make -C jpwl -f Makefile.nix uninstall
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_JP3D),yes)
|
||||
jp3d-all:
|
||||
make -C jp3d -f Makefile.nix all
|
||||
|
||||
jp3d-install: jp3d-all
|
||||
make -C jp3d -f Makefile.nix install
|
||||
$(LDCONFIG)
|
||||
|
||||
jp3d-clean:
|
||||
make -C jp3d -f Makefile.nix clean
|
||||
|
||||
jp3d-uninstall:
|
||||
make -C jp3d -f Makefile.nix uninstall
|
||||
endif
|
||||
|
||||
doc-all:
|
||||
make -C doc -f Makefile.nix all
|
||||
|
||||
doc-install: doc-all
|
||||
make -C doc -f Makefile.nix install
|
||||
|
||||
clean:
|
||||
rm -rf bin
|
||||
rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB)
|
||||
make -C codec -f Makefile.nix clean
|
||||
make -C mj2 -f Makefile.nix clean
|
||||
make -C doc -f Makefile.nix clean
|
||||
ifeq ($(WITH_JPWL),yes)
|
||||
make -C jpwl -f Makefile.nix clean
|
||||
endif
|
||||
ifeq ($(WITH_JP3D),yes)
|
||||
make -C jp3d -f Makefile.nix clean
|
||||
endif
|
||||
|
||||
doc-clean:
|
||||
make -C doc -f Makefile.nix clean
|
||||
|
||||
uninstall:
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||
rm -f $(LIBNAME).so $(LIBNAME).so.$(MAJOR).$(MINOR) $(SHAREDLIB) )
|
||||
else
|
||||
rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
|
||||
endif
|
||||
$(LDCONFIG)
|
||||
rm -f $(DESTDIR)$(prefix)/include/openjpeg.h
|
||||
rm -rf $(DESTDIR)$(INSTALL_INCLUDE)
|
||||
make -C codec -f Makefile.nix uninstall
|
||||
make -C mj2 -f Makefile.nix uninstall
|
||||
make -C doc -f Makefile.nix uninstall
|
||||
ifeq ($(WITH_JPWL),yes)
|
||||
make -C jpwl -f Makefile.nix uninstall
|
||||
endif
|
||||
ifeq ($(WITH_JP3D),yes)
|
||||
make -C jp3d -f Makefile.nix uninstall
|
||||
endif
|
||||
|
||||
distclean: clean
|
||||
rm -rf bin
|
||||
43
NEWS
Normal file
43
NEWS
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
OpenJPEG NEWS - user visible changes
|
||||
====================================
|
||||
|
||||
Changes from OpenJPEG 2.0.0 to OpenJPEG 2.0.1
|
||||
----------------------------------------------
|
||||
|
||||
New Features:
|
||||
|
||||
* Digital Cinema profiles have been fixed and updated
|
||||
* New option to disable MCT if needed
|
||||
* extended RAW support: it is now possible to input raw images
|
||||
with subsampled color components (422, 420, etc)
|
||||
|
||||
API/ABI modifications: (see abi_compat_report_2.0.1.html in dev-utils/scripts)
|
||||
|
||||
* No changes, API/ABI fully compatible with 2.0.0
|
||||
|
||||
Misc:
|
||||
|
||||
* OpenJPEG is now officialy conformant with JPEG 2000 Part-1
|
||||
and will soon become official reference software at the
|
||||
JPEG committee.
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
|
||||
|
||||
Changes from OpenJPEG 1.5.x to OpenJPEG 2.0.0
|
||||
----------------------------------------------
|
||||
|
||||
New Features:
|
||||
|
||||
* streaming capabilities
|
||||
* merge JP3D
|
||||
|
||||
API modifications:
|
||||
|
||||
* Use a 64bits capable API
|
||||
|
||||
Misc:
|
||||
|
||||
* removed autotools build system
|
||||
* folders hierarchies reorganisation
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
50
README
50
README
@@ -4,20 +4,44 @@ OPENJPEG LIBRARY and APPLICATIONS
|
||||
|
||||
Details on folders hierarchy:
|
||||
|
||||
* libopenjpeg: contains the sources of the openjpeg library
|
||||
* jpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* applications: contains all applications that use the openjpeg library
|
||||
* src
|
||||
* lib
|
||||
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* openjp3d: JP3D implementation
|
||||
* openmj2: MJ2 implementation
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* codec: a basic codec
|
||||
* jp2: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
||||
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be build only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* jp3d: JP3D applications
|
||||
* tcltk: a test tool for JP3D
|
||||
* wx
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* wrapping
|
||||
* java: java jni to use openjpeg in a java program
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* doc: doxygen documentation setup file and man pages
|
||||
* testing: all files required to test the library and executables (obsolete)
|
||||
* CMake: cmake related files
|
||||
* m4: autotools related files
|
||||
* 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
|
||||
|
||||
see LICENSE for license and copyright information
|
||||
see INSTALL for installation procedures.
|
||||
see LICENSE for license and copyright information.
|
||||
see INSTALL for installation procedures.
|
||||
see NEWS for user visible changes in successive releases.
|
||||
see CHANGES for per-revision changes.
|
||||
|
||||
----------------
|
||||
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.
|
||||
|
||||
33
THANKS
Normal file
33
THANKS
Normal file
@@ -0,0 +1,33 @@
|
||||
OpenJPEG THANKS file
|
||||
|
||||
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
|
||||
or submitting actual code. Here is a list of these people. Help me keep
|
||||
it complete and exempt of errors.
|
||||
|
||||
Winfried Szukalski
|
||||
Vincent Torri
|
||||
Bob Friesenhahn
|
||||
Callum Lerwick
|
||||
Dzonatas Sol
|
||||
Julien Malik
|
||||
Jerôme Fimes
|
||||
Herve Drolon
|
||||
Yannick Verschueren
|
||||
Sebastien Lugan
|
||||
Kaori Hagihara
|
||||
Peter Wimmer
|
||||
Francois-Olivier Devaux
|
||||
Antonin Descampe
|
||||
David Janssens
|
||||
Pr. Benoit Macq
|
||||
Luis Ibanez
|
||||
Ben Boeckel
|
||||
Vincent Nicolas
|
||||
Glenn Pearson
|
||||
Giuseppe Baruffa
|
||||
Arnaud Maye
|
||||
Rex Dieter
|
||||
David Burken
|
||||
Parvatha Elangovan
|
||||
Hans Johnson
|
||||
Luc Hermitte
|
||||
@@ -1,9 +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)
|
||||
@@ -1,40 +0,0 @@
|
||||
#JavaOpenJPEG/CMakeLists.txt
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
../codec/convert.c
|
||||
../codec/index.c
|
||||
)
|
||||
|
||||
# If not getopt was found then add it to the lib:
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS
|
||||
${common_SRCS}
|
||||
../common/getopt.c
|
||||
)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${LCMS_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIR}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${TIFF_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# Loop over all executables:
|
||||
FOREACH(exe j2k_to_image image_to_j2k)
|
||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES}
|
||||
${PNG_LIBRARIES} ${ZLIB_LIBRARY} ${LCMS_LIB})
|
||||
# On unix you need to link to the math library:
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${exe} -lm)
|
||||
ENDIF(UNIX)
|
||||
# Install exe
|
||||
INSTALL_TARGETS(/bin/ ${exe})
|
||||
ENDFOREACH(exe)
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k
|
||||
|
||||
CFLAGS = -O3 -lstdc++ # -g -p -pg
|
||||
|
||||
all: j2k_to_image image_to_j2k
|
||||
|
||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) ../common/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) ../common/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
clean:
|
||||
rm -f j2k_to_image image_to_j2k
|
||||
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* @(#)jawt.h 1.10 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_H_
|
||||
#define _JAVASOFT_JAWT_H_
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AWT native interface (new in JDK 1.3)
|
||||
*
|
||||
* The AWT native interface allows a native C or C++ application a means
|
||||
* by which to access native structures in AWT. This is to facilitate moving
|
||||
* legacy C and C++ applications to Java and to target the needs of the
|
||||
* community who, at present, wish to do their own native rendering to canvases
|
||||
* for performance reasons. Standard extensions such as Java3D also require a
|
||||
* means to access the underlying native data structures of AWT.
|
||||
*
|
||||
* There may be future extensions to this API depending on demand.
|
||||
*
|
||||
* A VM does not have to implement this API in order to pass the JCK.
|
||||
* It is recommended, however, that this API is implemented on VMs that support
|
||||
* standard extensions, such as Java3D.
|
||||
*
|
||||
* Since this is a native API, any program which uses it cannot be considered
|
||||
* 100% pure java.
|
||||
*/
|
||||
|
||||
/*
|
||||
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||
*
|
||||
* For each platform, there is a native drawing surface structure. This
|
||||
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||
* that additional platforms follow the same model. It is also recommended
|
||||
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||
*
|
||||
*******************
|
||||
* EXAMPLE OF USAGE:
|
||||
*******************
|
||||
*
|
||||
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||
* native rendering into it. The programmer has declared the paint() method
|
||||
* for their canvas subclass to be native:
|
||||
*
|
||||
*
|
||||
* MyCanvas.java:
|
||||
*
|
||||
* import java.awt.*;
|
||||
*
|
||||
* public class MyCanvas extends Canvas {
|
||||
*
|
||||
* static {
|
||||
* System.loadLibrary("mylib");
|
||||
* }
|
||||
*
|
||||
* public native void paint(Graphics g);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* myfile.c:
|
||||
*
|
||||
* #include "jawt_md.h"
|
||||
* #include <assert.h>
|
||||
*
|
||||
* JNIEXPORT void JNICALL
|
||||
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||
* {
|
||||
* JAWT awt;
|
||||
* JAWT_DrawingSurface* ds;
|
||||
* JAWT_DrawingSurfaceInfo* dsi;
|
||||
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||
* jboolean result;
|
||||
* jint lock;
|
||||
*
|
||||
* // Get the AWT
|
||||
* awt.version = JAWT_VERSION_1_3;
|
||||
* result = JAWT_GetAWT(env, &awt);
|
||||
* assert(result != JNI_FALSE);
|
||||
*
|
||||
* // Get the drawing surface
|
||||
* ds = awt.GetDrawingSurface(env, canvas);
|
||||
* assert(ds != NULL);
|
||||
*
|
||||
* // Lock the drawing surface
|
||||
* lock = ds->Lock(ds);
|
||||
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||
*
|
||||
* // Get the drawing surface info
|
||||
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
*
|
||||
* // Get the platform-specific drawing info
|
||||
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||
*
|
||||
* //////////////////////////////
|
||||
* // !!! DO PAINTING HERE !!! //
|
||||
* //////////////////////////////
|
||||
*
|
||||
* // Free the drawing surface info
|
||||
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||
*
|
||||
* // Unlock the drawing surface
|
||||
* ds->Unlock(ds);
|
||||
*
|
||||
* // Free the drawing surface
|
||||
* awt.FreeDrawingSurface(ds);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* JAWT_Rectangle
|
||||
* Structure for a native rectangle.
|
||||
*/
|
||||
typedef struct jawt_Rectangle {
|
||||
jint x;
|
||||
jint y;
|
||||
jint width;
|
||||
jint height;
|
||||
} JAWT_Rectangle;
|
||||
|
||||
struct jawt_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurfaceInfo
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurfaceInfo {
|
||||
/*
|
||||
* Pointer to the platform-specific information. This can be safely
|
||||
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||
* JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details.
|
||||
*/
|
||||
void* platformInfo;
|
||||
/* Cached pointer to the underlying drawing surface */
|
||||
struct jawt_DrawingSurface* ds;
|
||||
/* Bounding rectangle of the drawing surface */
|
||||
JAWT_Rectangle bounds;
|
||||
/* Number of rectangles in the clip */
|
||||
jint clipSize;
|
||||
/* Clip rectangle array */
|
||||
JAWT_Rectangle* clip;
|
||||
} JAWT_DrawingSurfaceInfo;
|
||||
|
||||
#define JAWT_LOCK_ERROR 0x00000001
|
||||
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurface
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||
* thread as the call to GetDrawingSurface.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurface {
|
||||
/*
|
||||
* Cached reference to the Java environment of the calling thread.
|
||||
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||
* this data member should be set before calling those functions.
|
||||
*/
|
||||
JNIEnv* env;
|
||||
/* Cached reference to the target object */
|
||||
jobject target;
|
||||
/*
|
||||
* Lock the surface of the target component for native rendering.
|
||||
* When finished drawing, the surface must be unlocked with
|
||||
* Unlock(). This function returns a bitmask with one or more of the
|
||||
* following values:
|
||||
*
|
||||
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||
* be locked.
|
||||
*
|
||||
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||
*
|
||||
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||
*
|
||||
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||
*/
|
||||
jint (JNICALL *Lock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Get the drawing surface info.
|
||||
* The value returned may be cached, but the values may change if
|
||||
* additional calls to Lock() or Unlock() are made.
|
||||
* Lock() must be called before this can return a valid value.
|
||||
* Returns NULL if an error has occurred.
|
||||
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||
* called.
|
||||
*/
|
||||
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Free the drawing surface info.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||
(JAWT_DrawingSurfaceInfo* dsi);
|
||||
/*
|
||||
* Unlock the drawing surface of the target component for native rendering.
|
||||
*/
|
||||
void (JNICALL *Unlock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
} JAWT_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT
|
||||
* Structure for containing native AWT functions.
|
||||
*/
|
||||
typedef struct jawt {
|
||||
/*
|
||||
* Version of this structure. This must always be set before
|
||||
* calling JAWT_GetAWT()
|
||||
*/
|
||||
jint version;
|
||||
/*
|
||||
* Return a drawing surface from a target jobject. This value
|
||||
* may be cached.
|
||||
* Returns NULL if an error has occurred.
|
||||
* Target must be a java.awt.Component (should be a Canvas
|
||||
* or Window for native rendering).
|
||||
* FreeDrawingSurface() must be called when finished with the
|
||||
* returned JAWT_DrawingSurface.
|
||||
*/
|
||||
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||
(JNIEnv* env, jobject target);
|
||||
/*
|
||||
* Free the drawing surface allocated in GetDrawingSurface.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurface)
|
||||
(JAWT_DrawingSurface* ds);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Locks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Lock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Unlocks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Unlock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Returns a reference to a java.awt.Component from a native
|
||||
* platform handle. On Windows, this corresponds to an HWND;
|
||||
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||
* see the appropriate machine-dependent header file for a description.
|
||||
* The reference returned by this function is a local
|
||||
* reference that is only valid in this environment.
|
||||
* This function returns a NULL reference if no component could be
|
||||
* found with matching platform information.
|
||||
*/
|
||||
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||
|
||||
} JAWT;
|
||||
|
||||
/*
|
||||
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||
* an error occurs.
|
||||
*/
|
||||
_JNI_IMPORT_OR_EXPORT_
|
||||
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||
|
||||
#define JAWT_VERSION_1_3 0x00010003
|
||||
#define JAWT_VERSION_1_4 0x00010004
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_H_ */
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
* @(#)jdwpTransport.h 1.7 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||
*/
|
||||
|
||||
#ifndef JDWPTRANSPORT_H
|
||||
#define JDWPTRANSPORT_H
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
enum {
|
||||
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct jdwpTransportNativeInterface_;
|
||||
|
||||
struct _jdwpTransportEnv;
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||
#else
|
||||
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||
* values the same.
|
||||
*/
|
||||
typedef enum {
|
||||
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||
} jdwpTransportError;
|
||||
|
||||
|
||||
/*
|
||||
* Structure to define capabilities
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int can_timeout_attach :1;
|
||||
unsigned int can_timeout_accept :1;
|
||||
unsigned int can_timeout_handshake :1;
|
||||
unsigned int reserved3 :1;
|
||||
unsigned int reserved4 :1;
|
||||
unsigned int reserved5 :1;
|
||||
unsigned int reserved6 :1;
|
||||
unsigned int reserved7 :1;
|
||||
unsigned int reserved8 :1;
|
||||
unsigned int reserved9 :1;
|
||||
unsigned int reserved10 :1;
|
||||
unsigned int reserved11 :1;
|
||||
unsigned int reserved12 :1;
|
||||
unsigned int reserved13 :1;
|
||||
unsigned int reserved14 :1;
|
||||
unsigned int reserved15 :1;
|
||||
} JDWPTransportCapabilities;
|
||||
|
||||
|
||||
/*
|
||||
* Structures to define packet layout.
|
||||
*
|
||||
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||
*/
|
||||
|
||||
enum {
|
||||
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jbyte cmdSet;
|
||||
jbyte cmd;
|
||||
jbyte *data;
|
||||
} jdwpCmdPacket;
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jshort errorCode;
|
||||
jbyte *data;
|
||||
} jdwpReplyPacket;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
jdwpCmdPacket cmd;
|
||||
jdwpReplyPacket reply;
|
||||
} type;
|
||||
} jdwpPacket;
|
||||
|
||||
/*
|
||||
* JDWP functions called by the transport.
|
||||
*/
|
||||
typedef struct jdwpTransportCallback {
|
||||
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||
} jdwpTransportCallback;
|
||||
|
||||
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||
jdwpTransportCallback *callback,
|
||||
jint version,
|
||||
jdwpTransportEnv** env);
|
||||
|
||||
|
||||
|
||||
/* Function Interface */
|
||||
|
||||
struct jdwpTransportNativeInterface_ {
|
||||
/* 1 : RESERVED */
|
||||
void *reserved1;
|
||||
|
||||
/* 2 : Get Capabilities */
|
||||
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||
JDWPTransportCapabilities *capabilities_ptr);
|
||||
|
||||
/* 3 : Attach */
|
||||
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
jlong attach_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 4: StartListening */
|
||||
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
char** actual_address);
|
||||
|
||||
/* 5: StopListening */
|
||||
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||
|
||||
/* 6: Accept */
|
||||
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||
jlong accept_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 7: IsOpen */
|
||||
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||
|
||||
/* 8: Close */
|
||||
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||
|
||||
/* 9: ReadPacket */
|
||||
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||
jdwpPacket *pkt);
|
||||
|
||||
/* 10: Write Packet */
|
||||
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||
const jdwpPacket* pkt);
|
||||
|
||||
/* 11: GetLastError */
|
||||
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||
char** error);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Use inlined functions so that C++ code can use syntax such as
|
||||
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||
*
|
||||
* rather than using C's :-
|
||||
*
|
||||
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||
*/
|
||||
struct _jdwpTransportEnv {
|
||||
const struct jdwpTransportNativeInterface_ *functions;
|
||||
#ifdef __cplusplus
|
||||
|
||||
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||
return functions->GetCapabilities(this, capabilities_ptr);
|
||||
}
|
||||
|
||||
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||
jlong handshake_timeout) {
|
||||
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jdwpTransportError StartListening(const char* address,
|
||||
char** actual_address) {
|
||||
return functions->StartListening(this, address, actual_address);
|
||||
}
|
||||
|
||||
jdwpTransportError StopListening(void) {
|
||||
return functions->StopListening(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jboolean IsOpen(void) {
|
||||
return functions->IsOpen(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Close(void) {
|
||||
return functions->Close(this);
|
||||
}
|
||||
|
||||
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||
return functions->ReadPacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||
return functions->WritePacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError GetLastError(char** error) {
|
||||
return functions->GetLastError(this, error);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __cplusplus */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* JDWPTRANSPORT_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,642 +0,0 @@
|
||||
/*
|
||||
* @(#)jvmpi.h 1.28 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JVMPI_H_
|
||||
#define _JAVASOFT_JVMPI_H_
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
#define JVMPI_VERSION_1 ((jint)0x10000001) /* implied 0 for minor version */
|
||||
#define JVMPI_VERSION_1_1 ((jint)0x10000002)
|
||||
#define JVMPI_VERSION_1_2 ((jint)0x10000003)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void (*jvmpi_void_function_of_void)(void *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************
|
||||
* Profiler interface data structures.
|
||||
****************************************************************/
|
||||
/* identifier types. */
|
||||
struct _jobjectID;
|
||||
typedef struct _jobjectID * jobjectID; /* type of object ids */
|
||||
|
||||
/* raw monitors */
|
||||
struct _JVMPI_RawMonitor;
|
||||
typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor;
|
||||
|
||||
/* call frame */
|
||||
typedef struct {
|
||||
jint lineno; /* line number in the source file */
|
||||
jmethodID method_id; /* method executed in this frame */
|
||||
} JVMPI_CallFrame;
|
||||
|
||||
/* call trace */
|
||||
typedef struct {
|
||||
JNIEnv *env_id; /* Env where trace was recorded */
|
||||
jint num_frames; /* number of frames in this trace */
|
||||
JVMPI_CallFrame *frames; /* frames */
|
||||
} JVMPI_CallTrace;
|
||||
|
||||
/* method */
|
||||
typedef struct {
|
||||
char *method_name; /* name of method */
|
||||
char *method_signature; /* signature of method */
|
||||
jint start_lineno; /* -1 if native, abstract .. */
|
||||
jint end_lineno; /* -1 if native, abstract .. */
|
||||
jmethodID method_id; /* id assigned to this method */
|
||||
} JVMPI_Method;
|
||||
|
||||
/* Field */
|
||||
typedef struct {
|
||||
char *field_name; /* name of field */
|
||||
char *field_signature; /* signature of field */
|
||||
} JVMPI_Field;
|
||||
|
||||
/* line number info for a compiled method */
|
||||
typedef struct {
|
||||
jint offset; /* offset from beginning of method */
|
||||
jint lineno; /* lineno from beginning of src file */
|
||||
} JVMPI_Lineno;
|
||||
|
||||
/* event */
|
||||
typedef struct {
|
||||
jint event_type; /* event_type */
|
||||
JNIEnv *env_id; /* env where this event occured */
|
||||
|
||||
union {
|
||||
struct {
|
||||
const char *class_name; /* class name */
|
||||
char *source_name; /* name of source file */
|
||||
jint num_interfaces; /* number of interfaces implemented */
|
||||
jint num_methods; /* number of methods in the class */
|
||||
JVMPI_Method *methods; /* methods */
|
||||
jint num_static_fields; /* number of static fields */
|
||||
JVMPI_Field *statics; /* static fields */
|
||||
jint num_instance_fields; /* number of instance fields */
|
||||
JVMPI_Field *instances; /* instance fields */
|
||||
jobjectID class_id; /* id of the class object */
|
||||
} class_load;
|
||||
|
||||
struct {
|
||||
jobjectID class_id; /* id of the class object */
|
||||
} class_unload;
|
||||
|
||||
struct {
|
||||
unsigned char *class_data; /* content of class file */
|
||||
jint class_data_len; /* class file length */
|
||||
unsigned char *new_class_data; /* instrumented class file */
|
||||
jint new_class_data_len; /* new class file length */
|
||||
void * (*malloc_f)(unsigned int); /* memory allocation function */
|
||||
} class_load_hook;
|
||||
|
||||
struct {
|
||||
jint arena_id;
|
||||
jobjectID class_id; /* id of object class */
|
||||
jint is_array; /* JVMPI_NORMAL_OBJECT, ... */
|
||||
jint size; /* size in number of bytes */
|
||||
jobjectID obj_id; /* id assigned to this object */
|
||||
} obj_alloc;
|
||||
|
||||
struct {
|
||||
jobjectID obj_id; /* id of the object */
|
||||
} obj_free;
|
||||
|
||||
struct {
|
||||
jint arena_id; /* cur arena id */
|
||||
jobjectID obj_id; /* cur object id */
|
||||
jint new_arena_id; /* new arena id */
|
||||
jobjectID new_obj_id; /* new object id */
|
||||
} obj_move;
|
||||
|
||||
struct {
|
||||
jint arena_id; /* id of arena */
|
||||
const char *arena_name; /* name of arena */
|
||||
} new_arena;
|
||||
|
||||
struct {
|
||||
jint arena_id; /* id of arena */
|
||||
} delete_arena;
|
||||
|
||||
struct {
|
||||
char *thread_name; /* name of thread */
|
||||
char *group_name; /* name of group */
|
||||
char *parent_name; /* name of parent */
|
||||
jobjectID thread_id; /* id of the thread object */
|
||||
JNIEnv *thread_env_id;
|
||||
} thread_start;
|
||||
|
||||
struct {
|
||||
int dump_level; /* level of the heap dump info */
|
||||
char *begin; /* where all the root records begin,
|
||||
please see the heap dump buffer
|
||||
format described below */
|
||||
char *end; /* where the object records end. */
|
||||
jint num_traces; /* number of thread traces,
|
||||
0 if dump level = JVMPI_DUMP_LEVEL_0 */
|
||||
JVMPI_CallTrace *traces; /* thread traces collected during
|
||||
heap dump */
|
||||
} heap_dump;
|
||||
|
||||
struct {
|
||||
jobjectID obj_id; /* object id */
|
||||
jobject ref_id; /* id assigned to the globalref */
|
||||
} jni_globalref_alloc;
|
||||
|
||||
struct {
|
||||
jobject ref_id; /* id of the global ref */
|
||||
} jni_globalref_free;
|
||||
|
||||
struct {
|
||||
jmethodID method_id; /* method */
|
||||
} method;
|
||||
|
||||
struct {
|
||||
jmethodID method_id; /* id of method */
|
||||
jobjectID obj_id; /* id of target object */
|
||||
} method_entry2;
|
||||
|
||||
struct {
|
||||
jmethodID method_id; /* id of compiled method */
|
||||
void *code_addr; /* code start addr. in memory */
|
||||
jint code_size; /* code size */
|
||||
jint lineno_table_size; /* size of lineno table */
|
||||
JVMPI_Lineno *lineno_table; /* lineno info */
|
||||
} compiled_method_load;
|
||||
|
||||
struct {
|
||||
jmethodID method_id; /* id of unloaded compiled method */
|
||||
} compiled_method_unload;
|
||||
|
||||
struct {
|
||||
jmethodID method_id; /* id of the method the instruction belongs to */
|
||||
jint offset; /* instruction offset in the method's bytecode */
|
||||
union {
|
||||
struct {
|
||||
jboolean is_true; /* whether true or false branch is taken */
|
||||
} if_info;
|
||||
struct {
|
||||
jint key; /* top stack value used as an index */
|
||||
jint low; /* min value of the index */
|
||||
jint hi; /* max value of the index */
|
||||
} tableswitch_info;
|
||||
struct {
|
||||
jint chosen_pair_index; /* actually chosen pair index (0-based)
|
||||
* if chosen_pair_index == pairs_total then
|
||||
* the 'default' branch is taken
|
||||
*/
|
||||
jint pairs_total; /* total number of lookupswitch pairs */
|
||||
} lookupswitch_info;
|
||||
} u;
|
||||
} instruction;
|
||||
|
||||
struct {
|
||||
char *begin; /* beginning of dump buffer,
|
||||
see below for format */
|
||||
char *end; /* end of dump buffer */
|
||||
jint num_traces; /* number of traces */
|
||||
JVMPI_CallTrace *traces; /* traces of all threads */
|
||||
jint *threads_status; /* status of all threads */
|
||||
} monitor_dump;
|
||||
|
||||
struct {
|
||||
const char *name; /* name of raw monitor */
|
||||
JVMPI_RawMonitor id; /* id */
|
||||
} raw_monitor;
|
||||
|
||||
struct {
|
||||
jobjectID object; /* Java object */
|
||||
} monitor;
|
||||
|
||||
struct {
|
||||
jobjectID object; /* Java object */
|
||||
jlong timeout; /* timeout period */
|
||||
} monitor_wait;
|
||||
|
||||
struct {
|
||||
jlong used_objects;
|
||||
jlong used_object_space;
|
||||
jlong total_object_space;
|
||||
} gc_info;
|
||||
|
||||
struct {
|
||||
jint data_len;
|
||||
char *data;
|
||||
} object_dump;
|
||||
} u;
|
||||
} JVMPI_Event;
|
||||
|
||||
/* interface functions */
|
||||
typedef struct {
|
||||
jint version; /* JVMPI version */
|
||||
|
||||
/* ------interface implemented by the profiler------ */
|
||||
|
||||
/**
|
||||
* Function called by the JVM to notify an event.
|
||||
*/
|
||||
void (*NotifyEvent)(JVMPI_Event *event);
|
||||
|
||||
/* ------interface implemented by the JVM------ */
|
||||
|
||||
/**
|
||||
* Function called by the profiler to enable/disable/send notification
|
||||
* for a particular event type.
|
||||
*
|
||||
* event_type - event_type
|
||||
* arg - event specific arg
|
||||
*
|
||||
* return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL
|
||||
*/
|
||||
jint (*EnableEvent)(jint event_type, void *arg);
|
||||
jint (*DisableEvent)(jint event_type, void *arg);
|
||||
jint (*RequestEvent)(jint event_type, void *arg);
|
||||
|
||||
/**
|
||||
* Function called by the profiler to get a stack
|
||||
* trace from the JVM.
|
||||
*
|
||||
* trace - trace data structure to be filled
|
||||
* depth - maximum depth of the trace.
|
||||
*/
|
||||
void (*GetCallTrace)(JVMPI_CallTrace *trace, jint depth);
|
||||
|
||||
/**
|
||||
* Function called by profiler when it wants to exit/stop.
|
||||
*/
|
||||
void (*ProfilerExit)(jint);
|
||||
|
||||
/**
|
||||
* Utility functions provided by the JVM.
|
||||
*/
|
||||
JVMPI_RawMonitor (*RawMonitorCreate)(char *lock_name);
|
||||
void (*RawMonitorEnter)(JVMPI_RawMonitor lock_id);
|
||||
void (*RawMonitorExit)(JVMPI_RawMonitor lock_id);
|
||||
void (*RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms);
|
||||
void (*RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id);
|
||||
void (*RawMonitorDestroy)(JVMPI_RawMonitor lock_id);
|
||||
|
||||
/**
|
||||
* Function called by the profiler to get the current thread's CPU time.
|
||||
*
|
||||
* return time in nanoseconds;
|
||||
*/
|
||||
jlong (*GetCurrentThreadCpuTime)(void);
|
||||
|
||||
void (*SuspendThread)(JNIEnv *env);
|
||||
void (*ResumeThread)(JNIEnv *env);
|
||||
jint (*GetThreadStatus)(JNIEnv *env);
|
||||
jboolean (*ThreadHasRun)(JNIEnv *env);
|
||||
|
||||
/* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE
|
||||
notification by the JVM. */
|
||||
jint (*CreateSystemThread)(char *name, jint priority, void (*f)(void *));
|
||||
|
||||
/* thread local storage access functions to avoid locking in time
|
||||
critical functions */
|
||||
void (*SetThreadLocalStorage)(JNIEnv *env_id, void *ptr);
|
||||
void * (*GetThreadLocalStorage)(JNIEnv *env_id);
|
||||
|
||||
/* control GC */
|
||||
void (*DisableGC)(void);
|
||||
void (*EnableGC)(void);
|
||||
void (*RunGC)(void);
|
||||
|
||||
jobjectID (*GetThreadObject)(JNIEnv *env);
|
||||
jobjectID (*GetMethodClass)(jmethodID mid);
|
||||
|
||||
/* JNI <-> jobject conversions */
|
||||
jobject (*jobjectID2jobject)(jobjectID jid);
|
||||
jobjectID (*jobject2jobjectID)(jobject jobj);
|
||||
|
||||
void (*SuspendThreadList)
|
||||
(jint reqCount, JNIEnv **reqList, jint *results);
|
||||
void (*ResumeThreadList)
|
||||
(jint reqCount, JNIEnv **reqList, jint *results);
|
||||
} JVMPI_Interface;
|
||||
|
||||
/* type of argument passed to RequestEvent for heap dumps */
|
||||
typedef struct {
|
||||
jint heap_dump_level;
|
||||
} JVMPI_HeapDumpArg;
|
||||
|
||||
/**********************************************************************
|
||||
* Constants and formats used in JVM Profiler Interface.
|
||||
**********************************************************************/
|
||||
/*
|
||||
* Event type constants.
|
||||
*/
|
||||
#define JVMPI_EVENT_METHOD_ENTRY ((jint)1)
|
||||
#define JVMPI_EVENT_METHOD_ENTRY2 ((jint)2)
|
||||
#define JVMPI_EVENT_METHOD_EXIT ((jint)3)
|
||||
|
||||
#define JVMPI_EVENT_OBJECT_ALLOC ((jint)4)
|
||||
#define JVMPI_EVENT_OBJECT_FREE ((jint)5)
|
||||
#define JVMPI_EVENT_OBJECT_MOVE ((jint)6)
|
||||
|
||||
#define JVMPI_EVENT_COMPILED_METHOD_LOAD ((jint)7)
|
||||
#define JVMPI_EVENT_COMPILED_METHOD_UNLOAD ((jint)8)
|
||||
|
||||
#define JVMPI_EVENT_INSTRUCTION_START ((jint)9)
|
||||
|
||||
#define JVMPI_EVENT_THREAD_START ((jint)33)
|
||||
#define JVMPI_EVENT_THREAD_END ((jint)34)
|
||||
|
||||
#define JVMPI_EVENT_CLASS_LOAD_HOOK ((jint)35)
|
||||
|
||||
#define JVMPI_EVENT_HEAP_DUMP ((jint)37)
|
||||
#define JVMPI_EVENT_JNI_GLOBALREF_ALLOC ((jint)38)
|
||||
#define JVMPI_EVENT_JNI_GLOBALREF_FREE ((jint)39)
|
||||
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC ((jint)40)
|
||||
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE ((jint)41)
|
||||
#define JVMPI_EVENT_CLASS_LOAD ((jint)42)
|
||||
#define JVMPI_EVENT_CLASS_UNLOAD ((jint)43)
|
||||
#define JVMPI_EVENT_DATA_DUMP_REQUEST ((jint)44)
|
||||
#define JVMPI_EVENT_DATA_RESET_REQUEST ((jint)45)
|
||||
|
||||
#define JVMPI_EVENT_JVM_INIT_DONE ((jint)46)
|
||||
#define JVMPI_EVENT_JVM_SHUT_DOWN ((jint)47)
|
||||
|
||||
#define JVMPI_EVENT_ARENA_NEW ((jint)48)
|
||||
#define JVMPI_EVENT_ARENA_DELETE ((jint)49)
|
||||
|
||||
#define JVMPI_EVENT_OBJECT_DUMP ((jint)50)
|
||||
|
||||
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER ((jint)51)
|
||||
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52)
|
||||
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT ((jint)53)
|
||||
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTER ((jint)54)
|
||||
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED ((jint)55)
|
||||
#define JVMPI_EVENT_MONITOR_CONTENDED_EXIT ((jint)56)
|
||||
#define JVMPI_EVENT_MONITOR_WAIT ((jint)57)
|
||||
#define JVMPI_EVENT_MONITOR_WAITED ((jint)58)
|
||||
#define JVMPI_EVENT_MONITOR_DUMP ((jint)59)
|
||||
|
||||
#define JVMPI_EVENT_GC_START ((jint)60)
|
||||
#define JVMPI_EVENT_GC_FINISH ((jint)61)
|
||||
|
||||
#define JVMPI_MAX_EVENT_TYPE_VAL ((jint)61)
|
||||
|
||||
/* old definitions, to be removed */
|
||||
#define JVMPI_EVENT_LOAD_COMPILED_METHOD ((jint)7)
|
||||
#define JVMPI_EVENT_UNLOAD_COMPILED_METHOD ((jint)8)
|
||||
#define JVMPI_EVENT_NEW_ARENA ((jint)48)
|
||||
#define JVMPI_EVENT_DELETE_ARENA ((jint)49)
|
||||
#define JVMPI_EVENT_DUMP_DATA_REQUEST ((jint)44)
|
||||
#define JVMPI_EVENT_RESET_DATA_REQUEST ((jint)45)
|
||||
#define JVMPI_EVENT_OBJ_ALLOC ((jint)4)
|
||||
#define JVMPI_EVENT_OBJ_FREE ((jint)5)
|
||||
#define JVMPI_EVENT_OBJ_MOVE ((jint)6)
|
||||
|
||||
#define JVMPI_REQUESTED_EVENT ((jint)0x10000000)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* enabling/disabling event notification.
|
||||
*/
|
||||
/* results */
|
||||
#define JVMPI_SUCCESS ((jint)0)
|
||||
#define JVMPI_NOT_AVAILABLE ((jint)1)
|
||||
#define JVMPI_FAIL ((jint)-1)
|
||||
|
||||
/*
|
||||
* Thread status
|
||||
*/
|
||||
enum {
|
||||
JVMPI_THREAD_RUNNABLE = 1,
|
||||
JVMPI_THREAD_MONITOR_WAIT,
|
||||
JVMPI_THREAD_CONDVAR_WAIT
|
||||
};
|
||||
|
||||
#define JVMPI_THREAD_SUSPENDED 0x8000
|
||||
#define JVMPI_THREAD_INTERRUPTED 0x4000
|
||||
|
||||
/*
|
||||
* Thread priority
|
||||
*/
|
||||
#define JVMPI_MINIMUM_PRIORITY 1
|
||||
#define JVMPI_MAXIMUM_PRIORITY 10
|
||||
#define JVMPI_NORMAL_PRIORITY 5
|
||||
|
||||
/*
|
||||
* Object type constants.
|
||||
*/
|
||||
#define JVMPI_NORMAL_OBJECT ((jint)0)
|
||||
#define JVMPI_CLASS ((jint)2)
|
||||
#define JVMPI_BOOLEAN ((jint)4)
|
||||
#define JVMPI_CHAR ((jint)5)
|
||||
#define JVMPI_FLOAT ((jint)6)
|
||||
#define JVMPI_DOUBLE ((jint)7)
|
||||
#define JVMPI_BYTE ((jint)8)
|
||||
#define JVMPI_SHORT ((jint)9)
|
||||
#define JVMPI_INT ((jint)10)
|
||||
#define JVMPI_LONG ((jint)11)
|
||||
|
||||
/*
|
||||
* Monitor dump constants.
|
||||
*/
|
||||
|
||||
#define JVMPI_MONITOR_JAVA 0x01
|
||||
#define JVMPI_MONITOR_RAW 0x02
|
||||
|
||||
/*
|
||||
* Heap dump constants.
|
||||
*/
|
||||
#define JVMPI_GC_ROOT_UNKNOWN 0xff
|
||||
#define JVMPI_GC_ROOT_JNI_GLOBAL 0x01
|
||||
#define JVMPI_GC_ROOT_JNI_LOCAL 0x02
|
||||
#define JVMPI_GC_ROOT_JAVA_FRAME 0x03
|
||||
#define JVMPI_GC_ROOT_NATIVE_STACK 0x04
|
||||
#define JVMPI_GC_ROOT_STICKY_CLASS 0x05
|
||||
#define JVMPI_GC_ROOT_THREAD_BLOCK 0x06
|
||||
#define JVMPI_GC_ROOT_MONITOR_USED 0x07
|
||||
#define JVMPI_GC_ROOT_THREAD_OBJ 0x08
|
||||
|
||||
#define JVMPI_GC_CLASS_DUMP 0x20
|
||||
#define JVMPI_GC_INSTANCE_DUMP 0x21
|
||||
#define JVMPI_GC_OBJ_ARRAY_DUMP 0x22
|
||||
#define JVMPI_GC_PRIM_ARRAY_DUMP 0x23
|
||||
|
||||
/*
|
||||
* Dump levels
|
||||
*/
|
||||
#define JVMPI_DUMP_LEVEL_0 ((jint)0)
|
||||
#define JVMPI_DUMP_LEVEL_1 ((jint)1)
|
||||
#define JVMPI_DUMP_LEVEL_2 ((jint)2)
|
||||
|
||||
/* Types used in dumps -
|
||||
*
|
||||
* u1: 1 byte
|
||||
* u2: 2 bytes
|
||||
* u4: 4 bytes
|
||||
* u8: 8 bytes
|
||||
*
|
||||
* ty: u1 where:
|
||||
* JVMPI_CLASS: object
|
||||
* JVMPI_BOOLEAN: boolean
|
||||
* JVMPI_CHAR: char
|
||||
* JVMPI_FLOAT: float
|
||||
* JVMPI_DOUBLE: double
|
||||
* JVMPI_BYTE: byte
|
||||
* JVMPI_SHORT: short
|
||||
* JVMPI_INT: int
|
||||
* JVMPI_LONG: long
|
||||
*
|
||||
* vl: values, exact type depends on the type of the value:
|
||||
* JVMPI_BOOLEAN & JVMPI_BYTE: u1
|
||||
* JVMPI_SHORT & JVMPI_CHAR: u2
|
||||
* JVMPI_INT & JVMPI_FLOAT: u4
|
||||
* JVMPI_LONG & JVMPI_DOUBLE: u8
|
||||
* JVMPI_CLASS: jobjectID
|
||||
*/
|
||||
|
||||
/* Format of the monitor dump buffer:
|
||||
*
|
||||
* u1 monitor type
|
||||
*
|
||||
* JVMPI_MONITOR_JAVA Java monitor
|
||||
*
|
||||
* jobjectID object
|
||||
* JNIEnv * owner thread
|
||||
* u4 entry count
|
||||
* u4 # of threads waiting to enter
|
||||
* [JNIEnv *]* threads waiting to enter
|
||||
* u4 # of threads waiting to be notified
|
||||
* [JNIEnv *]* threads waiting to be notified
|
||||
*
|
||||
* JVMPI_MONITOR_RAW raw monitor
|
||||
*
|
||||
* char * name
|
||||
* JVMPI_RawMonitor raw monitor
|
||||
* JNIEnv * owner thread
|
||||
* u4 entry count
|
||||
* u4 # of threads waiting to enter
|
||||
* [JNIEnv *]* threads waiting to enter
|
||||
* u4 # of threads waiting to be notified
|
||||
* [JNIEnv *]* threads waiting to be notified
|
||||
*/
|
||||
|
||||
/* Format of the heap dump buffer depends on the dump level
|
||||
* specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg.
|
||||
* The default is JVMPI_DUMP_LEVEL_2.
|
||||
*
|
||||
* JVMPI_DUMP_LEVEL_0:
|
||||
*
|
||||
* u1 object type (JVMPI_CLASS ...)
|
||||
* jobjectID object
|
||||
*
|
||||
* JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format:
|
||||
* In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object
|
||||
* instance dumps , the values of primitive statics in class dumps and the
|
||||
* values of primitive arrays are excluded. JVMPI_DUMP_LEVEL_2 includes the
|
||||
* primitive values.
|
||||
*
|
||||
* u1 record type
|
||||
*
|
||||
* JVMPI_GC_ROOT_UNKNOWN unknown root
|
||||
*
|
||||
* jobjectID object
|
||||
*
|
||||
* JVMPI_GC_ROOT_JNI_GLOBAL JNI global ref root
|
||||
*
|
||||
* jobjectID object
|
||||
* jobject JNI global reference
|
||||
*
|
||||
* JVMPI_GC_ROOT_JNI_LOCAL JNI local ref
|
||||
*
|
||||
* jobjectID object
|
||||
* JNIEnv * thread
|
||||
* u4 frame # in stack trace (-1 for empty)
|
||||
*
|
||||
* JVMPI_GC_ROOT_JAVA_FRAME Java stack frame
|
||||
*
|
||||
* jobjectID object
|
||||
* JNIEnv * thread
|
||||
* u4 frame # in stack trace (-1 for empty)
|
||||
*
|
||||
* JVMPI_GC_ROOT_NATIVE_STACK Native stack
|
||||
*
|
||||
* jobjectID object
|
||||
* JNIEnv * thread
|
||||
*
|
||||
* JVMPI_GC_ROOT_STICKY_CLASS System class
|
||||
*
|
||||
* jobjectID class object
|
||||
*
|
||||
* JVMPI_GC_ROOT_THREAD_BLOCK Reference from thread block
|
||||
*
|
||||
* jobjectID thread object
|
||||
* JNIEnv * thread
|
||||
*
|
||||
* JVMPI_GC_ROOT_MONITOR_USED Busy monitor
|
||||
*
|
||||
* jobjectID object
|
||||
*
|
||||
* JVMPI_GC_CLASS_DUMP dump of a class object
|
||||
*
|
||||
* jobjectID class
|
||||
* jobjectID super
|
||||
* jobjectID class loader
|
||||
* jobjectID signers
|
||||
* jobjectID protection domain
|
||||
* jobjectID class name
|
||||
* void * reserved
|
||||
*
|
||||
* u4 instance size (in bytes)
|
||||
*
|
||||
* [jobjectID]* interfaces
|
||||
*
|
||||
* u2 size of constant pool
|
||||
* [u2, constant pool index,
|
||||
* ty, type,
|
||||
* vl]* value
|
||||
*
|
||||
* [vl]* static field values
|
||||
*
|
||||
* JVMPI_GC_INSTANCE_DUMP dump of a normal object
|
||||
*
|
||||
* jobjectID object
|
||||
* jobjectID class
|
||||
* u4 number of bytes that follow
|
||||
* [vl]* instance field values (class, followed
|
||||
* by super, super's super ...)
|
||||
*
|
||||
* JVMPI_GC_OBJ_ARRAY_DUMP dump of an object array
|
||||
*
|
||||
* jobjectID array object
|
||||
* u4 number of elements
|
||||
* jobjectID element class
|
||||
* [jobjectID]* elements
|
||||
*
|
||||
* JVMPI_GC_PRIM_ARRAY_DUMP dump of a primitive array
|
||||
*
|
||||
* jobjectID array object
|
||||
* u4 number of elements
|
||||
* ty element type
|
||||
* [vl]* elements
|
||||
*
|
||||
*/
|
||||
|
||||
/* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP:
|
||||
* All the records have JVMPI_DUMP_LEVEL_2 information.
|
||||
*
|
||||
* u1 record type
|
||||
*
|
||||
* followed by a:
|
||||
*
|
||||
* JVMPI_GC_CLASS_DUMP,
|
||||
* JVMPI_GC_INSTANCE_DUMP,
|
||||
* JVMPI_GC_OBJ_ARRAY_DUMP, or
|
||||
* JVMPI_GC_PRIM_ARRAY_DUMP record.
|
||||
*/
|
||||
|
||||
#endif /* !_JAVASOFT_JVMPI_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* @(#)jawt_md.h 1.7 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||
#define _JAVASOFT_JAWT_MD_H_
|
||||
|
||||
#include <windows.h>
|
||||
#include "jawt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Win32-specific declarations for AWT native interface.
|
||||
* See notes in jawt.h for an example of use.
|
||||
*/
|
||||
typedef struct jawt_Win32DrawingSurfaceInfo {
|
||||
/* Native window, DDB, or DIB handle */
|
||||
union {
|
||||
HWND hwnd;
|
||||
HBITMAP hbitmap;
|
||||
void* pbits;
|
||||
};
|
||||
/*
|
||||
* This HDC should always be used instead of the HDC returned from
|
||||
* BeginPaint() or any calls to GetDC().
|
||||
*/
|
||||
HDC hdc;
|
||||
HPALETTE hpalette;
|
||||
} JAWT_Win32DrawingSurfaceInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* @(#)jni_md.h 1.14 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JNI_MD_H_
|
||||
#define _JAVASOFT_JNI_MD_H_
|
||||
|
||||
#define JNIEXPORT __declspec(dllexport)
|
||||
#define JNIIMPORT __declspec(dllimport)
|
||||
#define JNICALL __stdcall
|
||||
|
||||
typedef long jint;
|
||||
typedef __int64 jlong;
|
||||
typedef signed char jbyte;
|
||||
|
||||
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
||||
Binary file not shown.
@@ -1,19 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = codec
|
||||
|
||||
if WANT_MJ2
|
||||
SUBDIRS += mj2
|
||||
endif
|
||||
|
||||
if WANT_JPIP
|
||||
SUBDIRS += jpip
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
common/color.c \
|
||||
common/color.h \
|
||||
common/format_defs.h \
|
||||
common/getopt.c \
|
||||
common/getopt.h
|
||||
@@ -1,41 +0,0 @@
|
||||
# Makefile for OPJViewer
|
||||
|
||||
# General configuration variables:
|
||||
CC = $(shell wx-config-2.8 --cxx)
|
||||
AR = ar
|
||||
|
||||
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
|
||||
|
||||
OPJV_SRCS = source/imagjpeg2000.cpp source/wxj2kparser.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJDialogs.cpp source/OPJThreads.cpp source/OPJAbout.cpp ../codec/index.c
|
||||
|
||||
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||
|
||||
all: opjviewer lib
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
lib:
|
||||
cd ../jpwl; make
|
||||
|
||||
opjviewer: $(OPJV_SRCS) lib
|
||||
$(CC) $(CFLAGS) -I .. -I ../codec -I ../libopenjpeg $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f OPJViewer *.o *.a
|
||||
cd ../libopenjpeg; rm -f *.o
|
||||
|
||||
|
||||
|
||||
|
||||
#.cpp.o :
|
||||
# $(CXX) -g -c `wx-config-2.8 --cxxflags` -I ../.. -D wxUSE_LIBOPENJPEG -D wxHACK_BOOLEAN -o $@ $<
|
||||
|
||||
#all: $(PROGRAM)
|
||||
|
||||
#$(PROGRAM): $(OBJECTS)
|
||||
# $(CXX) -o $(PROGRAM) $(OBJECTS) -lopenjpeg -L ../.. `wx-config-2.8 --libs`
|
||||
|
||||
#clean:
|
||||
# rm -f *.o $(PROGRAM)
|
||||
@@ -1,290 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="OPJViewer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=OPJVIEWER - WIN32 RELEASE
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OPJViewer.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OPJViewer.mak" CFG="OPJVIEWER - WIN32 RELEASE"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OPJViewer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "OPJViewer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "OPJViewer - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /Zm200 /c
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "$(WXWIN28)\include" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib mxflib.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Release" /libpath:"$(MXFLIB)\build\msvc\Release" /IGNORE:4089
|
||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Update build number
|
||||
PostBuild_Cmds=buildupdate.bat
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "OPJViewer___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "OPJViewer___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "$(WXWIN28)\INCLUDE" /I "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /D "OPJ_INICONFIG" /D "OPJ_MANYFORMATS" /D "USE_JPSEC" /FR /FD /GZ /Zm200 /c
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x410 /i "$(WXWIN28)\include" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib mxflib.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Debug" /libpath:"$(MXFLIB)\build\msvc\Debug"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "OPJViewer - Win32 Release"
|
||||
# Name "OPJViewer - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\imagjpeg2000.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\imagmxf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\codec\index.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJAbout.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJDialogs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJThreads.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wxj2kparser.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wxjp2parser.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\about_htm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\build.h
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\imagjpeg2000.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\imagmxf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\codec\index.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\blank.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\bullseye.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\cdrom.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\computer.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\cross.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\drive.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\file1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\floppy.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\folder1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\folder2.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\hand.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon1.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon2.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon3.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon4.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon5.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\magnif1.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\opj_logo.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJChild.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJChild16.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer16.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pbrush.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pencil.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pntleft.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pntright.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\removble.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\rightarr.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\roller.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\std.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,56 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LibOpenJPEG_JPWL"=..\jpwl\LibOpenJPEG_JPWL.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "OPJViewer"=.\OPJViewer.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name LibOpenJPEG_JPWL
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "mxflib"="..\..\..\..\mxflib-1.0.0\build\msvc\mxflib.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
::== buildupdate.bat
|
||||
@echo off
|
||||
setLocal EnableDelayedExpansion
|
||||
|
||||
for /f "tokens=2,* delims=^(^) " %%a in ('find /v "" ^< .\source\build.h') do (
|
||||
rem echo %%a
|
||||
set /A M = %%a + 1
|
||||
echo Build %%a done^!
|
||||
echo wxT^("!M!"^) > buildtemp283746825t347
|
||||
)
|
||||
|
||||
if exist buildtemp283746825t347 move /Y buildtemp283746825t347 .\source\build.h
|
||||
if exist buildtemp283746825t347 del /F /Q buildtemp283746825t347
|
||||
|
||||
::==
|
||||
@@ -1,99 +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
|
||||
)
|
||||
|
||||
# If not getopt was found then add it to the lib:
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS
|
||||
${common_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
||||
)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
# 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}
|
||||
${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} )
|
||||
|
||||
# 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} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
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} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
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/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/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/getopt.c \
|
||||
index.c \
|
||||
j2k_dump.c \
|
||||
../common/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/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/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,68 +0,0 @@
|
||||
#codec Makefile
|
||||
include ../config.nix
|
||||
|
||||
CFLAGS = -Wall
|
||||
|
||||
INSTALL_BIN = $(prefix)/bin
|
||||
|
||||
INCLUDE = -I.. -I. -I../libopenjpeg -I../common
|
||||
USERLIBS = -lm
|
||||
|
||||
ifeq ($(WITH_TIFF),yes)
|
||||
INCLUDE += $(TIFF_INCLUDE)
|
||||
USERLIBS += $(TIFF_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_PNG),yes)
|
||||
INCLUDE += $(PNG_INCLUDE)
|
||||
USERLIBS += $(PNG_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_LCMS2),yes)
|
||||
INCLUDE += $(LCMS2_INCLUDE)
|
||||
USERLIBS += $(LCMS2_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_LCMS1),yes)
|
||||
INCLUDE += $(LCMS1_INCLUDE)
|
||||
USERLIBS += $(LCMS1_LIB)
|
||||
endif
|
||||
|
||||
CFLAGS += $(INCLUDE) -lstdc++ # -g -p -pg
|
||||
|
||||
all: j2k_to_image image_to_j2k j2k_dump
|
||||
install -d ../bin
|
||||
install j2k_to_image image_to_j2k j2k_dump ../bin
|
||||
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
ELIB = ../libopenjpeg.so.$(MAJOR).$(MINOR).$(BUILD)
|
||||
else
|
||||
ELIB = ../libopenjpeg.a
|
||||
endif
|
||||
|
||||
j2k_to_image: j2k_to_image.c $(ELIB)
|
||||
$(CC) $(CFLAGS) ../common/getopt.c index.c convert.c \
|
||||
../common/color.c j2k_to_image.c \
|
||||
-o j2k_to_image $(ELIB) $(USERLIBS)
|
||||
|
||||
image_to_j2k: image_to_j2k.c $(ELIB)
|
||||
$(CC) $(CFLAGS) ../common/getopt.c index.c convert.c image_to_j2k.c \
|
||||
-o image_to_j2k $(ELIB) $(USERLIBS)
|
||||
|
||||
j2k_dump: j2k_dump.c $(ELIB)
|
||||
$(CC) $(CFLAGS) ../common/getopt.c index.c j2k_dump.c \
|
||||
-o j2k_dump $(ELIB) $(USERLIBS)
|
||||
|
||||
clean:
|
||||
rm -f j2k_to_image image_to_j2k j2k_dump
|
||||
|
||||
install: all
|
||||
install -d $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root j2k_to_image $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root image_to_j2k $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root j2k_dump $(DESTDIR)$(INSTALL_BIN)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/j2k_to_image
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/image_to_j2k
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/j2k_dump
|
||||
@@ -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,670 +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 "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;
|
||||
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 = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
case JP2_CFMT:
|
||||
case JPT_CFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
}
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
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(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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,29 +0,0 @@
|
||||
/* last review : october 29th, 2002 */
|
||||
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
typedef struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
}option_t;
|
||||
|
||||
#define NO_ARG 0
|
||||
#define REQ_ARG 1
|
||||
#define OPT_ARG 2
|
||||
|
||||
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);
|
||||
extern int getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const struct option *longopts, int totlen);
|
||||
extern void reset_options_reading(void);
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
||||
@@ -1,36 +0,0 @@
|
||||
What's New for OpenJPIP
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
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,3 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = libopenjpip opj_server opj_client tools
|
||||
@@ -1,19 +0,0 @@
|
||||
default: t_libopenjpip t_opj_server t_opj_dec_server t_tools
|
||||
|
||||
t_libopenjpip:
|
||||
make -C libopenjpip -f Makefile.nix
|
||||
|
||||
t_opj_server:
|
||||
make -C opj_server -f Makefile.nix
|
||||
|
||||
t_opj_dec_server:
|
||||
make -C opj_client/opj_dec_server -f Makefile.nix
|
||||
|
||||
t_tools:
|
||||
make -C tools -f Makefile.nix
|
||||
|
||||
clean:
|
||||
make clean -C libopenjpip -f Makefile.nix
|
||||
make clean -C opj_server -f Makefile.nix
|
||||
make clean -C opj_client/opj_dec_server -f Makefile.nix
|
||||
make clean -C tools -f Makefile.nix
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB |
@@ -1,95 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
||||
includes_HEADERS =
|
||||
|
||||
lib_LTLIBRARIES = libopenjpip_server.la libopenjpip_local.la
|
||||
|
||||
JPIP_SRC = \
|
||||
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 \
|
||||
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
|
||||
|
||||
libopenjpip_server_la_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
@FCGI_CFLAGS@ \
|
||||
-DSERVER
|
||||
libopenjpip_server_la_CFLAGS =
|
||||
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ -lm
|
||||
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||
libopenjpip_server_la_SOURCES = $(JPIP_SRC)
|
||||
|
||||
libopenjpip_local_la_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
||||
libopenjpip_local_la_CFLAGS =
|
||||
libopenjpip_local_la_LIBADD = -lm
|
||||
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||
libopenjpip_local_la_SOURCES = $(JPIP_SRC)
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
|
||||
@( $(call solist_s) ) >> $(top_builddir)/report.txt
|
||||
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
|
||||
@( $(call solist_c) ) >> $(top_builddir)/report.txt
|
||||
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
|
||||
|
||||
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,10 +0,0 @@
|
||||
default: local server
|
||||
|
||||
local:
|
||||
make -f comMakefile.mk
|
||||
|
||||
server:
|
||||
rm *.o && make jpipserver=yes -f comMakefile.mk
|
||||
|
||||
clean:
|
||||
rm -f *.a *.o *~
|
||||
@@ -1,17 +0,0 @@
|
||||
ifdef jpipserver
|
||||
CFLAGS = -O3 -Wall -m32 -DSERVER
|
||||
LIBNAME = libopenjpip_server.a
|
||||
else
|
||||
CFLAGS = -O3 -Wall
|
||||
LIBNAME = libopenjpip_local.a
|
||||
endif
|
||||
|
||||
all: $(LIBNAME)
|
||||
|
||||
$(LIBNAME): 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
|
||||
ar r $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(LIBNAME) *.o *~
|
||||
@@ -1,528 +0,0 @@
|
||||
/*
|
||||
* $Id: index_manager.c 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "index_manager.h"
|
||||
#include "box_manager.h"
|
||||
#include "manfbox_manager.h"
|
||||
#include "mhixbox_manager.h"
|
||||
#include "codestream_manager.h"
|
||||
#include "marker_manager.h"
|
||||
#include "faixbox_manager.h"
|
||||
#include "boxheader_manager.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
/**
|
||||
* chekc JP2 box indexing
|
||||
*
|
||||
* @param[in] toplev_boxlist top level box list
|
||||
* @return if correct (true) or wrong (false)
|
||||
*/
|
||||
bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
|
||||
|
||||
/**
|
||||
* set code index parameters (parse cidx box)
|
||||
* Annex I
|
||||
*
|
||||
* @param[in] cidx_box pointer to the reference cidx_box
|
||||
* @param[out] codeidx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_cidxdata( box_param_t *cidx_box, index_param_t *codeidx);
|
||||
|
||||
index_param_t * parse_jp2file( int fd)
|
||||
{
|
||||
index_param_t *jp2idx;
|
||||
box_param_t *cidx;
|
||||
metadatalist_param_t *metadatalist;
|
||||
boxlist_param_t *toplev_boxlist;
|
||||
struct stat sb;
|
||||
|
||||
if( fstat( fd, &sb) == -1){
|
||||
fprintf( FCGI_stdout, "Reason: Target broken (fstat error)\r\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !(toplev_boxlist = get_boxstructure( fd, 0, sb.st_size))){
|
||||
fprintf( FCGI_stderr, "Error: Not correctl JP2 format\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !check_JP2boxidx( toplev_boxlist)){
|
||||
fprintf( FCGI_stderr, "Index format not supported\n");
|
||||
delete_boxlist( &toplev_boxlist);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !(cidx = search_box( "cidx", toplev_boxlist))){
|
||||
fprintf( FCGI_stderr, "Box cidx not found\n");
|
||||
delete_boxlist( &toplev_boxlist);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jp2idx = (index_param_t *)malloc( sizeof(index_param_t));
|
||||
|
||||
if( !set_cidxdata( cidx, jp2idx)){
|
||||
fprintf( FCGI_stderr, "Error: Not correctl format in cidx box\n");
|
||||
free(jp2idx);
|
||||
delete_boxlist( &toplev_boxlist);
|
||||
return NULL;
|
||||
}
|
||||
delete_boxlist( &toplev_boxlist);
|
||||
|
||||
metadatalist = const_metadatalist( fd);
|
||||
jp2idx->metadatalist = metadatalist;
|
||||
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: code index created\n");
|
||||
#endif
|
||||
|
||||
return jp2idx;
|
||||
}
|
||||
|
||||
void print_index( index_param_t index)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf( logstream, "index info:\n");
|
||||
fprintf( logstream, "\tCodestream Offset: %#llx\n", index.offset);
|
||||
fprintf( logstream, "\t Length: %#llx\n", index.length);
|
||||
fprintf( logstream, "\tMain header Length: %#llx\n", index.mhead_length);
|
||||
fprintf( logstream, "\t Rsiz: %#x\n", index.Rsiz);
|
||||
fprintf( logstream, "\t Xsiz, Ysiz: (%d,%d) = (%#x, %#x)\n", index.Xsiz, index.Ysiz, index.Xsiz, index.Ysiz);
|
||||
fprintf( logstream, "\t XOsiz, YOsiz: (%d,%d) = (%#x, %#x)\n", index.XOsiz, index.YOsiz, index.XOsiz, index.YOsiz);
|
||||
fprintf( logstream, "\t XTsiz, YTsiz: (%d,%d) = (%#x, %#x)\n", index.XTsiz, index.YTsiz, index.XTsiz, index.YTsiz);
|
||||
fprintf( logstream, "\t XTOsiz, YTOsiz: (%d,%d) = (%#x, %#x)\n", index.XTOsiz, index.YTOsiz, index.XTOsiz, index.YTOsiz);
|
||||
fprintf( logstream, "\t XTnum, YTnum: (%d,%d)\n", index.XTnum, index.YTnum);
|
||||
fprintf( logstream, "\t Num of Components: %d\n", index.Csiz);
|
||||
|
||||
for( i=0; i<index.Csiz; i++)
|
||||
fprintf( logstream, "\t[%d] (Ssiz, XRsiz, YRsiz): (%d, %d, %d) = (%#x, %#x, %#x)\n", i, index.Ssiz[i], index.XRsiz[i], index.YRsiz[i], index.Ssiz[i], index.XRsiz[i], index.YRsiz[i]);
|
||||
|
||||
print_faixbox( index.tilepart);
|
||||
|
||||
print_allmetadata( index.metadatalist);
|
||||
}
|
||||
|
||||
void print_cachemodel( index_param_t index)
|
||||
{
|
||||
Byte8_t TPnum; // num of tile parts in each tile
|
||||
int i, j, k, n;
|
||||
|
||||
TPnum = get_nmax( index.tilepart);
|
||||
|
||||
fprintf( logstream, "\t main header model: %d\n", index.mhead_model);
|
||||
|
||||
fprintf( logstream, "\t tile part model:\n");
|
||||
for( i=0, n=0; i<index.YTnum; i++){
|
||||
for( j=0; j<index.XTnum; j++){
|
||||
for( k=0; k<TPnum; k++)
|
||||
fprintf( logstream, "%d", index.tp_model[n++]);
|
||||
fprintf( logstream, " ");
|
||||
}
|
||||
fprintf( logstream, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void delete_index( index_param_t **index)
|
||||
{
|
||||
delete_metadatalist( &((*index)->metadatalist));
|
||||
delete_faixbox( &((*index)->tilepart));
|
||||
free( (*index)->tp_model);
|
||||
free(*index);
|
||||
}
|
||||
|
||||
bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
|
||||
{
|
||||
box_param_t *iptr, *fidx, *prxy;
|
||||
box_param_t *cidx, *jp2c;
|
||||
|
||||
iptr = search_box( "iptr", toplev_boxlist);
|
||||
fidx = search_box( "fidx", toplev_boxlist);
|
||||
cidx = search_box( "cidx", toplev_boxlist);
|
||||
jp2c = search_box( "jp2c", toplev_boxlist);
|
||||
prxy = gene_childboxbyType( fidx, 0, "prxy");
|
||||
|
||||
Byte8_t off = fetch_DBox8bytebigendian( iptr, 0);
|
||||
if( off != fidx->offset)
|
||||
fprintf( FCGI_stderr, "Reference File Index box offset in Index Finder box not correct\n");
|
||||
|
||||
Byte8_t len = fetch_DBox8bytebigendian( iptr, 8);
|
||||
if( len != fidx->length)
|
||||
fprintf( FCGI_stderr, "Reference File Index box length in Index Finder box not correct\n");
|
||||
|
||||
|
||||
int pos = 0;
|
||||
Byte8_t ooff = fetch_DBox8bytebigendian( prxy, pos);
|
||||
if( ooff != jp2c->offset)
|
||||
fprintf( FCGI_stderr, "Reference jp2c offset in prxy box not correct\n");
|
||||
pos += 8;
|
||||
|
||||
boxheader_param_t *obh = gene_childboxheader( prxy, pos);
|
||||
if( obh->length != jp2c->length || strncmp( obh->type, "jp2c",4)!=0)
|
||||
fprintf( FCGI_stderr, "Reference jp2c header in prxy box not correct\n");
|
||||
pos += obh->headlen;
|
||||
free(obh);
|
||||
|
||||
Byte_t ni = fetch_DBox1byte( prxy, pos);
|
||||
if( ni != 1){
|
||||
fprintf( FCGI_stderr, "Multiple indexes not supported\n");
|
||||
return false;
|
||||
}
|
||||
pos += 1;
|
||||
|
||||
Byte8_t ioff = fetch_DBox8bytebigendian( prxy, pos);
|
||||
if( ioff != cidx->offset)
|
||||
fprintf( FCGI_stderr, "Reference cidx offset in prxy box not correct\n");
|
||||
pos += 8;
|
||||
|
||||
boxheader_param_t *ibh = gene_childboxheader( prxy, pos);
|
||||
if( ibh->length != cidx->length || strncmp( ibh->type, "cidx",4)!=0)
|
||||
fprintf( FCGI_stderr, "Reference cidx header in prxy box not correct\n");
|
||||
pos += ibh->headlen;
|
||||
free(ibh);
|
||||
|
||||
free(prxy);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* set code index parameters from cptr box
|
||||
* I.3.2.2 Codestream Finder box
|
||||
*
|
||||
* @param[in] cidx_box pointer to the reference cidx_box
|
||||
* @param[out] jp2idx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
|
||||
|
||||
/**
|
||||
* set code index parameters from mhix box for main header
|
||||
* I.3.2.4.3 Header Index Table box
|
||||
*
|
||||
* @param[in] cidx_box pointer to the reference cidx_box
|
||||
* @param[in] codestream codestream parameters
|
||||
* @param[out] jp2idx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx);
|
||||
|
||||
/**
|
||||
* set code index parameters from tpix box
|
||||
* I.3.2.4.4 Tile-part Index Table box
|
||||
*
|
||||
* @param[in] cidx_box pointer to the reference cidx_box
|
||||
* @param[out] jp2idx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
|
||||
|
||||
/**
|
||||
* set code index parameters from thix box
|
||||
* I.3.2.4.5 Tile Header Index Table box
|
||||
*
|
||||
* @param[in] cidx_box pointer to the reference cidx_box
|
||||
* @param[out] jp2idx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
|
||||
|
||||
bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
|
||||
{
|
||||
box_param_t *manf_box;
|
||||
manfbox_param_t *manf;
|
||||
codestream_param_t codestream;
|
||||
|
||||
set_cptrdata( cidx_box, jp2idx);
|
||||
|
||||
codestream = set_codestream( cidx_box->fd, jp2idx->offset, jp2idx->length);
|
||||
|
||||
manf_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "manf");
|
||||
manf = gene_manfbox( manf_box);
|
||||
|
||||
if( !search_boxheader( "mhix", manf)){
|
||||
fprintf( FCGI_stderr, "Error: mhix box not present in manfbox\n");
|
||||
free(jp2idx);
|
||||
return false;
|
||||
}
|
||||
set_mainmhixdata( cidx_box, codestream, jp2idx);
|
||||
|
||||
if( !search_boxheader( "tpix", manf)){
|
||||
fprintf( FCGI_stderr, "Error: tpix box not present in manfbox\n");
|
||||
free(jp2idx);
|
||||
return false;
|
||||
}
|
||||
set_tpixdata( cidx_box, jp2idx);
|
||||
|
||||
#ifdef NO_NEED_YET
|
||||
if( !search_boxheader( "thix", manf)){
|
||||
fprintf( FCGI_stderr, "Error: thix box not present in manfbox\n");
|
||||
return false;
|
||||
}
|
||||
set_thixdata( cidx_box, jp2idx);
|
||||
#endif
|
||||
|
||||
delete_manfbox( &manf);
|
||||
free( manf_box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
|
||||
{
|
||||
box_param_t *box; //!< cptr box
|
||||
Byte2_t dr, cont;
|
||||
|
||||
if( !(box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "cptr")))
|
||||
return false;
|
||||
|
||||
// DR: Data Reference.
|
||||
// If 0, the codestream or its Fragment Table box exists in the current file
|
||||
if(( dr = fetch_DBox2bytebigendian( box, 0))){
|
||||
fprintf( FCGI_stderr, "Error: Codestream not present in current file\n");
|
||||
free( box);
|
||||
return false;
|
||||
}
|
||||
|
||||
// CONT: Container Type
|
||||
// If 0, the entire codestream appears as a contiguous range of
|
||||
// bytes within its file or resource.
|
||||
if(( cont = fetch_DBox2bytebigendian( box, 2))){
|
||||
fprintf( FCGI_stderr, "Error: Can't cope with fragmented codestreams yet\n");
|
||||
free( box);
|
||||
return false;
|
||||
}
|
||||
|
||||
jp2idx->offset = fetch_DBox8bytebigendian( box, 4);
|
||||
jp2idx->length = fetch_DBox8bytebigendian( box, 12);
|
||||
|
||||
free( box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set code index parameters from SIZ marker in codestream
|
||||
* A.5 Fixed information marker segment
|
||||
* A.5.1 Image and tile size (SIZ)
|
||||
*
|
||||
* @param[in] sizmkidx pointer to SIZ marker index in mhix box
|
||||
* @param[in] codestream codestream parameters
|
||||
* @param[out] jp2idx pointer to index parameters
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, index_param_t *jp2idx);
|
||||
|
||||
bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
|
||||
{
|
||||
box_param_t *mhix_box;
|
||||
mhixbox_param_t *mhix;
|
||||
markeridx_param_t *sizmkidx;
|
||||
|
||||
if( !(mhix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "mhix")))
|
||||
return false;
|
||||
|
||||
jp2idx->mhead_model = 0;
|
||||
jp2idx->mhead_length = fetch_DBox8bytebigendian( mhix_box, 0);
|
||||
|
||||
mhix = gene_mhixbox( mhix_box);
|
||||
free( mhix_box);
|
||||
|
||||
sizmkidx = search_markeridx( 0xff51, mhix);
|
||||
set_SIZmkrdata( sizmkidx, codestream, jp2idx);
|
||||
|
||||
delete_mhixbox( &mhix);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
|
||||
{
|
||||
box_param_t *tpix_box; //!< tpix box
|
||||
box_param_t *faix_box; //!< faix box
|
||||
faixbox_param_t *faix; //!< faix
|
||||
size_t numOfelem;
|
||||
|
||||
if( !(tpix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "tpix")))
|
||||
return false;
|
||||
|
||||
if( !(faix_box = gene_boxbyType( tpix_box->fd, get_DBoxoff( tpix_box), get_DBoxlen( tpix_box), "faix")))
|
||||
return false;
|
||||
|
||||
faix = gene_faixbox( faix_box);
|
||||
jp2idx->tilepart = faix;
|
||||
numOfelem = get_nmax( faix)*get_m( faix);
|
||||
|
||||
jp2idx->tp_model = (bool *)malloc( numOfelem*sizeof(bool));
|
||||
memset( jp2idx->tp_model, 0, numOfelem*sizeof(bool));
|
||||
|
||||
//delete_faixbox( &faix); // currently the jp2idx element
|
||||
free( tpix_box);
|
||||
free( faix_box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
|
||||
{
|
||||
box_param_t *thix_box, *manf_box, *mhix_box;
|
||||
manfbox_param_t *manf;
|
||||
boxheader_param_t *ptr;
|
||||
mhixbox_param_t *mhix;
|
||||
Byte8_t pos, mhixseqoff;
|
||||
|
||||
if( !(thix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "thix")))
|
||||
return false;
|
||||
|
||||
if( !(manf_box = gene_boxbyType( thix_box->fd, get_DBoxoff( thix_box), get_DBoxlen( thix_box), "manf"))){
|
||||
free( thix_box);
|
||||
return false;
|
||||
}
|
||||
|
||||
manf = gene_manfbox( manf_box);
|
||||
ptr = manf->first;
|
||||
mhixseqoff = manf_box->offset+manf_box->length;
|
||||
pos = 0;
|
||||
|
||||
while( ptr){
|
||||
mhix_box = gene_boxbyType( thix_box->fd, mhixseqoff+pos, get_DBoxlen( thix_box)-manf_box->length-pos, "mhix");
|
||||
mhix = gene_mhixbox( mhix_box);
|
||||
|
||||
pos += mhix_box->length;
|
||||
ptr = ptr->next;
|
||||
|
||||
free( mhix_box);
|
||||
delete_mhixbox( &mhix);
|
||||
}
|
||||
|
||||
delete_manfbox( &manf);
|
||||
free( manf_box);
|
||||
free( thix_box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, index_param_t *jp2idx)
|
||||
{
|
||||
marker_param_t sizmkr;
|
||||
int i;
|
||||
|
||||
sizmkr = set_marker( codestream, sizmkidx->code, sizmkidx->offset, sizmkidx->length);
|
||||
|
||||
if( sizmkidx->length != fetch_marker2bytebigendian( sizmkr, 0)){
|
||||
fprintf( FCGI_stderr, "Error: marker %#x index is not correct\n", sizmkidx->code);
|
||||
return false;
|
||||
}
|
||||
|
||||
jp2idx->Rsiz = fetch_marker2bytebigendian( sizmkr, 2);
|
||||
jp2idx->Xsiz = fetch_marker4bytebigendian( sizmkr, 4);
|
||||
jp2idx->Ysiz = fetch_marker4bytebigendian( sizmkr, 8);
|
||||
jp2idx->XOsiz = fetch_marker4bytebigendian( sizmkr, 12);
|
||||
jp2idx->YOsiz = fetch_marker4bytebigendian( sizmkr, 16);
|
||||
jp2idx->XTsiz = fetch_marker4bytebigendian( sizmkr, 20);
|
||||
jp2idx->YTsiz = fetch_marker4bytebigendian( sizmkr, 24);
|
||||
jp2idx->XTOsiz = fetch_marker4bytebigendian( sizmkr, 28);
|
||||
jp2idx->YTOsiz = fetch_marker4bytebigendian( sizmkr, 32);
|
||||
jp2idx->Csiz = fetch_marker2bytebigendian( sizmkr, 36);
|
||||
|
||||
jp2idx->XTnum = ( jp2idx->Xsiz-jp2idx->XTOsiz+jp2idx->XTsiz-1)/jp2idx->XTsiz;
|
||||
jp2idx->YTnum = ( jp2idx->Ysiz-jp2idx->YTOsiz+jp2idx->YTsiz-1)/jp2idx->YTsiz;
|
||||
|
||||
for( i=0; i<(int)jp2idx->Csiz; i++){
|
||||
jp2idx->Ssiz[i] = fetch_marker1byte( sizmkr, 38+i*3);
|
||||
jp2idx->XRsiz[i] = fetch_marker1byte( sizmkr, 39+i*3);
|
||||
jp2idx->YRsiz[i] = fetch_marker1byte( sizmkr, 40+i*3);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Byte4_t max( Byte4_t n1, Byte4_t n2);
|
||||
Byte4_t min( Byte4_t n1, Byte4_t n2);
|
||||
|
||||
range_param_t get_tile_range( Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_id, int level);
|
||||
|
||||
range_param_t get_tile_Xrange( index_param_t index, Byte4_t tile_xid, int level)
|
||||
{
|
||||
return get_tile_range( index.XOsiz, index.Xsiz, index.XTOsiz, index.XTsiz, tile_xid, level);
|
||||
}
|
||||
|
||||
range_param_t get_tile_Yrange( index_param_t index, Byte4_t tile_yid, int level)
|
||||
{
|
||||
return get_tile_range( index.YOsiz, index.Ysiz, index.YTOsiz, index.YTsiz, tile_yid, level);
|
||||
}
|
||||
|
||||
range_param_t get_tile_range( Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_id, int level)
|
||||
{
|
||||
range_param_t range;
|
||||
int n;
|
||||
|
||||
range.minvalue = max( Osiz, TOsiz+tile_id*Tsiz);
|
||||
range.maxvalue = min( siz, TOsiz+(tile_id+1)*Tsiz);
|
||||
|
||||
for( n=0; n<level; n++){
|
||||
range.minvalue = ceil(range.minvalue/2.0);
|
||||
range.maxvalue = ceil(range.maxvalue/2.0);
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
Byte4_t max( Byte4_t n1, Byte4_t n2)
|
||||
{
|
||||
if( n1 < n2)
|
||||
return n2;
|
||||
else
|
||||
return n1;
|
||||
}
|
||||
|
||||
Byte4_t min( Byte4_t n1, Byte4_t n2)
|
||||
{
|
||||
if( n1 < n2)
|
||||
return n1;
|
||||
else
|
||||
return n2;
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* $Id: index_manager.h 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef INDEX_MANAGER_H_
|
||||
# define INDEX_MANAGER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bool.h"
|
||||
#include "byte_manager.h"
|
||||
#include "faixbox_manager.h"
|
||||
#include "metadata_manager.h"
|
||||
|
||||
//! index parameters
|
||||
typedef struct index_param{
|
||||
metadatalist_param_t *metadatalist; //!< metadata-bin list
|
||||
Byte8_t offset; //!< codestream offset
|
||||
Byte8_t length; //!< codestream length
|
||||
Byte8_t mhead_length; //!< main header length
|
||||
//! A.5.1 Image and tile size (SIZ)
|
||||
Byte2_t Rsiz; //!< capabilities that a decoder needs
|
||||
Byte4_t Xsiz; //!< width of the reference grid
|
||||
Byte4_t Ysiz; //!< height of the reference grid
|
||||
Byte4_t XOsiz; //!< horizontal offset from the origin of
|
||||
//!the reference grid to the left side of the image area
|
||||
Byte4_t YOsiz; //!< vertical offset from the origin of
|
||||
//!the reference grid to the top side of the image area
|
||||
Byte4_t XTsiz; //!< width of one reference tile with
|
||||
//!respect to the reference grid
|
||||
Byte4_t YTsiz; //!< height of one reference tile with
|
||||
//!respect to the reference grid
|
||||
Byte4_t XTOsiz; //!< horizontal offset from the origin of
|
||||
//!the reference grid to the left side of the first tile
|
||||
Byte4_t YTOsiz; //!< vertical offset from the origin of
|
||||
//!the reference grid to the top side of
|
||||
//!the first tile
|
||||
Byte4_t XTnum; //!< number of tiles in horizontal direction
|
||||
Byte4_t YTnum; //!< number of tiles in vertical
|
||||
//!direction
|
||||
Byte2_t Csiz; //!< number of the components in the image
|
||||
|
||||
Byte_t Ssiz[3]; //!< precision (depth) in bits and sign
|
||||
//!of the component samples
|
||||
Byte_t XRsiz[3]; //!< horizontal separation of a sample of
|
||||
//!component with respect to the reference grid
|
||||
Byte_t YRsiz[3]; //!< vertical separation of a sample of
|
||||
//!component with respect to the reference grid
|
||||
faixbox_param_t *tilepart; //!< tile part information from tpix box
|
||||
bool mhead_model; //!< main header model, if sent, 1, else 0
|
||||
bool *tp_model; //!< dynamic array pointer of tile part
|
||||
//!model, if sent, 1, else 0
|
||||
} index_param_t;
|
||||
|
||||
|
||||
/**
|
||||
* parse JP2 file
|
||||
* AnnexI: Indexing JPEG2000 files for JPIP
|
||||
*
|
||||
* @param[in] fd file descriptor of the JP2 file
|
||||
* @return pointer to the generated structure of index parameters
|
||||
*/
|
||||
index_param_t * parse_jp2file( int fd);
|
||||
|
||||
/**
|
||||
* print index parameters
|
||||
*
|
||||
* @param[in] index index parameters
|
||||
*/
|
||||
void print_index( index_param_t index);
|
||||
|
||||
/**
|
||||
* print cache model
|
||||
*
|
||||
* @param[in] index index parameters
|
||||
*/
|
||||
void print_cachemodel( index_param_t index);
|
||||
|
||||
|
||||
/**
|
||||
* delete index
|
||||
*
|
||||
* @param[in,out] index addressof the index pointer
|
||||
*/
|
||||
void delete_index( index_param_t **index);
|
||||
|
||||
//! 1-dimensional range parameters
|
||||
typedef struct range_param{
|
||||
Byte4_t minvalue; //!< minimal value
|
||||
Byte4_t maxvalue; //!< maximal value
|
||||
} range_param_t;
|
||||
|
||||
/**
|
||||
* get horizontal range of the tile in reference grid
|
||||
*
|
||||
* @param[in] index index parameters
|
||||
* @param[in] tile_xid tile id in x-direction (0<= <XTnum)
|
||||
* @param[in] level decomposition level
|
||||
* @return structured range parameter
|
||||
*/
|
||||
range_param_t get_tile_Xrange( index_param_t index, Byte4_t tile_xid, int level);
|
||||
|
||||
/**
|
||||
* get vertical range of the tile in reference grid
|
||||
*
|
||||
* @param[in] index index parameters
|
||||
* @param[in] tile_yid tile id in y-direction (0<= <YTnum)
|
||||
* @param[in] level decomposition level
|
||||
* @return structured range parameter
|
||||
*/
|
||||
range_param_t get_tile_Yrange( index_param_t index, Byte4_t tile_yid, int level);
|
||||
|
||||
|
||||
#endif /* !INDEX_MANAGER_H_ */
|
||||
@@ -1,964 +0,0 @@
|
||||
/*
|
||||
* $Id: msgqueue_manager.c 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "msgqueue_manager.h"
|
||||
#include "metadata_manager.h"
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
#define PRECINCT_MSG 0
|
||||
#define EXT_PRECINCT_MSG 1
|
||||
#define TILE_HEADER_MSG 2
|
||||
#define TILE_MSG 4
|
||||
#define EXT_TILE_MSG 5
|
||||
#define MAINHEADER_MSG 6
|
||||
#define METADATA_MSG 8
|
||||
|
||||
msgqueue_param_t * gene_msgqueue( bool stateless, target_param_t *target)
|
||||
{
|
||||
msgqueue_param_t *msgqueue;
|
||||
|
||||
msgqueue = (msgqueue_param_t *)malloc( sizeof(msgqueue_param_t));
|
||||
|
||||
msgqueue->first = NULL;
|
||||
msgqueue->last = NULL;
|
||||
|
||||
msgqueue->stateless = stateless;
|
||||
msgqueue->target = target;
|
||||
|
||||
return msgqueue;
|
||||
}
|
||||
|
||||
void delete_msgqueue( msgqueue_param_t **msgqueue)
|
||||
{
|
||||
message_param_t *ptr, *next;
|
||||
|
||||
if( !(*msgqueue))
|
||||
return;
|
||||
|
||||
ptr = (*msgqueue)->first;
|
||||
|
||||
while( ptr){
|
||||
next = ptr->next;
|
||||
free( ptr);
|
||||
ptr = next;
|
||||
}
|
||||
if( (*msgqueue)->stateless && (*msgqueue)->target)
|
||||
delete_target( &((*msgqueue)->target));
|
||||
|
||||
free(*msgqueue);
|
||||
}
|
||||
|
||||
void print_msgqueue( msgqueue_param_t *msgqueue)
|
||||
{
|
||||
message_param_t *ptr;
|
||||
|
||||
if( !msgqueue)
|
||||
return;
|
||||
|
||||
fprintf( logstream, "message queue:\n");
|
||||
ptr = msgqueue->first;
|
||||
|
||||
while( ptr){
|
||||
fprintf( logstream, "\t class_id: %lld\n", ptr->class_id );
|
||||
fprintf( logstream, "\t in_class_id: %lld\n", ptr->in_class_id );
|
||||
fprintf( logstream, "\t csn: %lld\n", ptr->csn );
|
||||
fprintf( logstream, "\t bin_offset: %#llx\n", ptr->bin_offset );
|
||||
fprintf( logstream, "\t length: %#llx\n", ptr->length );
|
||||
fprintf( logstream, "\t aux: %lld\n", ptr->aux );
|
||||
fprintf( logstream, "\t last_byte: %d\n", ptr->last_byte );
|
||||
if( ptr->phld)
|
||||
print_placeholder( ptr->phld);
|
||||
else
|
||||
fprintf( logstream, "\t res_offset: %#llx\n", ptr->res_offset );
|
||||
fprintf( logstream, "\n");
|
||||
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue_message( message_param_t *msg, msgqueue_param_t *msgqueue);
|
||||
|
||||
void enqueue_mainheader( msgqueue_param_t *msgqueue)
|
||||
{
|
||||
target_param_t *target;
|
||||
message_param_t *msg;
|
||||
|
||||
target = msgqueue->target;
|
||||
|
||||
msg = (message_param_t *)malloc( sizeof(message_param_t));
|
||||
|
||||
msg->last_byte = true;
|
||||
msg->in_class_id = 0;
|
||||
msg->class_id = MAINHEADER_MSG;
|
||||
msg->csn = target->csn;
|
||||
msg->bin_offset = 0;
|
||||
msg->length = target->codeidx->mhead_length;
|
||||
msg->aux = 0; // non exist
|
||||
msg->res_offset = target->codeidx->offset;
|
||||
msg->phld = NULL;
|
||||
msg->next = NULL;
|
||||
|
||||
enqueue_message( msg, msgqueue);
|
||||
|
||||
target->codeidx->mhead_model = true;
|
||||
}
|
||||
|
||||
void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
target_param_t *target;
|
||||
bool *tp_model;
|
||||
Byte8_t numOftparts; // num of tile parts par tile
|
||||
Byte8_t numOftiles;
|
||||
index_param_t *codeidx;
|
||||
faixbox_param_t *tilepart;
|
||||
message_param_t *msg;
|
||||
Byte8_t binOffset, binLength;
|
||||
int i;
|
||||
|
||||
target = msgqueue->target;
|
||||
codeidx = target->codeidx;
|
||||
tilepart = codeidx->tilepart;
|
||||
|
||||
numOftparts = get_nmax( tilepart);
|
||||
numOftiles = get_m( tilepart);
|
||||
|
||||
if( tile_id < 0 || numOftiles <= tile_id){
|
||||
fprintf( FCGI_stderr, "Error, Invalid tile-id %d\n", tile_id);
|
||||
return;
|
||||
}
|
||||
|
||||
tp_model = &codeidx->tp_model[ tile_id*numOftparts];
|
||||
|
||||
binOffset=0;
|
||||
for( i=0; i<numOftparts-level; i++){
|
||||
binLength = get_elemLen( tilepart, i, tile_id);
|
||||
|
||||
if( !tp_model[i]){
|
||||
msg = (message_param_t *)malloc( sizeof(message_param_t));
|
||||
|
||||
msg->last_byte = i==numOftparts-1? true : false;
|
||||
msg->in_class_id = tile_id;
|
||||
#if 0
|
||||
msg->class_id = TILE_MSG;
|
||||
#else
|
||||
msg->class_id = EXT_TILE_MSG;
|
||||
#endif
|
||||
msg->csn = target->csn;
|
||||
msg->bin_offset = binOffset;
|
||||
msg->length = binLength;
|
||||
msg->aux = numOftparts-i;
|
||||
msg->res_offset = codeidx->offset+get_elemOff( tilepart, i, tile_id)/*-1*/;
|
||||
msg->phld = NULL;
|
||||
msg->next = NULL;
|
||||
|
||||
enqueue_message( msg, msgqueue);
|
||||
|
||||
tp_model[i] = true;
|
||||
}
|
||||
binOffset += binLength;
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue_box( int meta_id, boxlist_param_t *boxlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset);
|
||||
void enqueue_phld( int meta_id, placeholderlist_param_t *phldlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset);
|
||||
void enqueue_boxcontents( int meta_id, boxcontents_param_t *boxcontents, msgqueue_param_t *msgqueue, Byte8_t *binOffset);
|
||||
|
||||
void enqueue_metadata( int meta_id, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
metadatalist_param_t *metadatalist;
|
||||
metadata_param_t *metadata;
|
||||
Byte8_t binOffset;
|
||||
|
||||
metadatalist = msgqueue->target->codeidx->metadatalist;
|
||||
metadata = search_metadata( meta_id, metadatalist);
|
||||
|
||||
if( !metadata){
|
||||
fprintf( FCGI_stderr, "Error: metadata-bin %d not found\n", meta_id);
|
||||
return;
|
||||
}
|
||||
binOffset = 0;
|
||||
|
||||
if( metadata->boxlist)
|
||||
enqueue_box( meta_id, metadata->boxlist, msgqueue, &binOffset);
|
||||
|
||||
if( metadata->placeholderlist)
|
||||
enqueue_phld( meta_id, metadata->placeholderlist, msgqueue, &binOffset);
|
||||
|
||||
if( metadata->boxcontents)
|
||||
enqueue_boxcontents( meta_id, metadata->boxcontents, msgqueue, &binOffset);
|
||||
|
||||
msgqueue->last->last_byte = true;
|
||||
}
|
||||
|
||||
message_param_t * gene_metamsg( int meta_id, Byte8_t binoffset, Byte8_t length, Byte8_t res_offset, placeholder_param_t *phld, Byte8_t csn);
|
||||
|
||||
void enqueue_box( int meta_id, boxlist_param_t *boxlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
|
||||
{
|
||||
box_param_t *box;
|
||||
message_param_t *msg;
|
||||
|
||||
box = boxlist->first;
|
||||
while( box){
|
||||
msg = gene_metamsg( meta_id, *binOffset, box->length, box->offset, NULL, msgqueue->target->csn);
|
||||
enqueue_message( msg, msgqueue);
|
||||
|
||||
*binOffset += box->length;
|
||||
box = box->next;
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue_phld( int meta_id, placeholderlist_param_t *phldlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
|
||||
{
|
||||
placeholder_param_t *phld;
|
||||
message_param_t *msg;
|
||||
|
||||
phld = phldlist->first;
|
||||
while( phld){
|
||||
msg = gene_metamsg( meta_id, *binOffset, phld->LBox, 0, phld, msgqueue->target->csn);
|
||||
enqueue_message( msg, msgqueue);
|
||||
|
||||
*binOffset += phld->LBox;
|
||||
phld = phld->next;
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue_boxcontents( int meta_id, boxcontents_param_t *boxcontents, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
|
||||
{
|
||||
message_param_t *msg;
|
||||
|
||||
msg = gene_metamsg( meta_id, *binOffset, boxcontents->length, boxcontents->offset, NULL, msgqueue->target->csn);
|
||||
enqueue_message( msg, msgqueue);
|
||||
|
||||
*binOffset += boxcontents->length;
|
||||
}
|
||||
|
||||
message_param_t * gene_metamsg( int meta_id, Byte8_t binOffset, Byte8_t length, Byte8_t res_offset, placeholder_param_t *phld, Byte8_t csn)
|
||||
{
|
||||
message_param_t *msg;
|
||||
|
||||
msg = (message_param_t *)malloc( sizeof(message_param_t));
|
||||
|
||||
msg->last_byte = false;
|
||||
msg->in_class_id = meta_id;
|
||||
msg->class_id = METADATA_MSG;
|
||||
msg->csn = csn;
|
||||
msg->bin_offset = binOffset;
|
||||
msg->length = length;
|
||||
msg->aux = 0; // non exist
|
||||
msg->res_offset = res_offset;
|
||||
msg->phld = phld;
|
||||
msg->next = NULL;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
void enqueue_message( message_param_t *msg, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
if( msgqueue->first)
|
||||
msgqueue->last->next = msg;
|
||||
else
|
||||
msgqueue->first = msg;
|
||||
|
||||
msgqueue->last = msg;
|
||||
}
|
||||
|
||||
|
||||
void emit_bin_id_vbas( Byte_t bb, Byte_t c, Byte8_t in_class_id);
|
||||
void emit_vbas( Byte8_t code);
|
||||
void emit_body( message_param_t *msg, int fd);
|
||||
void emit_placeholder( placeholder_param_t *phld);
|
||||
|
||||
void emit_stream_from_msgqueue( msgqueue_param_t *msgqueue)
|
||||
{
|
||||
message_param_t *msg;
|
||||
Byte8_t class_id, csn;
|
||||
Byte_t bb, c;
|
||||
|
||||
if( !(msgqueue))
|
||||
return;
|
||||
|
||||
msg = msgqueue->first;
|
||||
class_id = 0;
|
||||
csn = 0;
|
||||
while( msg){
|
||||
if( msg->csn == csn){
|
||||
if( msg->class_id == class_id)
|
||||
bb = 1;
|
||||
else{
|
||||
bb = 2;
|
||||
class_id = msg->class_id;
|
||||
}
|
||||
}
|
||||
else{
|
||||
bb = 3;
|
||||
class_id = msg->class_id;
|
||||
csn = msg->csn;
|
||||
}
|
||||
|
||||
c = msg->last_byte ? 1 : 0;
|
||||
|
||||
emit_bin_id_vbas( bb, c, msg->in_class_id);
|
||||
|
||||
if( bb >= 2)
|
||||
emit_vbas( class_id);
|
||||
if (bb == 3)
|
||||
emit_vbas( csn);
|
||||
|
||||
emit_vbas( msg->bin_offset);
|
||||
emit_vbas (msg->length);
|
||||
|
||||
if( msg->class_id%2) // Aux is present only if the id is odd
|
||||
emit_vbas( msg->aux);
|
||||
|
||||
if( msg->phld)
|
||||
emit_placeholder( msg->phld);
|
||||
else
|
||||
emit_body( msg, msgqueue->target->fd);
|
||||
|
||||
msg = msg->next;
|
||||
}
|
||||
}
|
||||
|
||||
void emit_vbas_with_bytelen( Byte8_t code, int bytelength);
|
||||
void print_binarycode( Byte8_t n, int segmentlen);
|
||||
|
||||
void emit_bin_id_vbas( Byte_t bb, Byte_t c, Byte8_t in_class_id)
|
||||
{
|
||||
int bytelength;
|
||||
Byte8_t tmp;
|
||||
|
||||
// A.2.3 In-class identifiers
|
||||
// 7k-3bits, where k is the number of bytes in the VBAS
|
||||
bytelength = 1;
|
||||
tmp = in_class_id >> 4;
|
||||
while( tmp){
|
||||
bytelength ++;
|
||||
tmp >>= 7;
|
||||
}
|
||||
|
||||
in_class_id |= (((bb & 3) << 5) | (c & 1) << 4) << ((bytelength-1)*7);
|
||||
|
||||
emit_vbas_with_bytelen( in_class_id, bytelength);
|
||||
}
|
||||
|
||||
void emit_vbas( Byte8_t code)
|
||||
{
|
||||
int bytelength;
|
||||
Byte8_t tmp;
|
||||
|
||||
bytelength = 1;
|
||||
tmp = code;
|
||||
while( tmp >>= 7)
|
||||
bytelength ++;
|
||||
|
||||
emit_vbas_with_bytelen( code, bytelength);
|
||||
}
|
||||
|
||||
void emit_vbas_with_bytelen( Byte8_t code, int bytelength)
|
||||
{
|
||||
int n;
|
||||
Byte8_t seg;
|
||||
|
||||
n = bytelength - 1;
|
||||
while( n >= 0) {
|
||||
seg = ( code >> (n*7)) & 0x7f;
|
||||
if( n)
|
||||
seg |= 0x80;
|
||||
fputc(( Byte4_t)seg, FCGI_stdout);
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
void emit_body( message_param_t *msg, int fd)
|
||||
{
|
||||
Byte_t *data;
|
||||
|
||||
if( lseek( fd, msg->res_offset, SEEK_SET)==-1){
|
||||
fprintf( FCGI_stderr, "Error: fseek in emit_body()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
data = (Byte_t *)malloc( msg->length);
|
||||
if( read( fd, data, msg->length) != msg->length){
|
||||
free( data);
|
||||
fprintf( FCGI_stderr, "Error: fread in emit_body()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if( fwrite( data, msg->length, 1, FCGI_stdout) < 1){
|
||||
free( data);
|
||||
fprintf( FCGI_stderr, "Error: fwrite in emit_body()\n");
|
||||
return;
|
||||
}
|
||||
free(data);
|
||||
}
|
||||
|
||||
void emit_bigendian_bytes( Byte8_t code, int bytelength);
|
||||
|
||||
void emit_placeholder( placeholder_param_t *phld)
|
||||
{
|
||||
emit_bigendian_bytes( phld->LBox, 4);
|
||||
if( fwrite( phld->TBox, 4, 1, FCGI_stdout) < 1){
|
||||
fprintf( FCGI_stderr, "Error: fwrite in emit_placeholder()\n");
|
||||
return;
|
||||
}
|
||||
emit_bigendian_bytes( phld->Flags, 4);
|
||||
emit_bigendian_bytes( phld->OrigID, 8);
|
||||
|
||||
if( fwrite( phld->OrigBH, phld->OrigBHlen, 1, FCGI_stdout) < 1){
|
||||
fprintf( FCGI_stderr, "Error: fwrite in emit_placeholder()\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void emit_bigendian_bytes( Byte8_t code, int bytelength)
|
||||
{
|
||||
int n;
|
||||
Byte8_t seg;
|
||||
|
||||
n = bytelength - 1;
|
||||
while( n >= 0) {
|
||||
seg = ( code >> (n*8)) & 0xff;
|
||||
fputc(( Byte4_t)seg, FCGI_stdout);
|
||||
n--;
|
||||
}
|
||||
}
|
||||
void print_binarycode( Byte8_t n, int segmentlen)
|
||||
{
|
||||
char buf[256];
|
||||
int i=0, j, k;
|
||||
|
||||
do{
|
||||
buf[i++] = n%2 ? '1' : '0';
|
||||
}while((n=n/2));
|
||||
|
||||
for( j=segmentlen-1; j>=i; j--)
|
||||
putchar('0');
|
||||
|
||||
for( j=i-1, k=0; j>=0; j--, k++){
|
||||
putchar( buf[j]);
|
||||
if( !((k+1)%segmentlen))
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
Byte_t * parse_bin_id_vbas( Byte_t *streamptr, Byte_t *bb, Byte_t *c, Byte8_t *in_class_id);
|
||||
Byte_t * parse_vbas( Byte_t *streamptr, Byte8_t *elem);
|
||||
|
||||
void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, Byte8_t offset, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
Byte_t *ptr; // stream pointer
|
||||
message_param_t *msg;
|
||||
Byte_t bb, c;
|
||||
Byte8_t class_id, csn;
|
||||
|
||||
class_id = -1; // dummy
|
||||
csn = 0;
|
||||
ptr = JPIPstream;
|
||||
while( ptr-JPIPstream < streamlen){
|
||||
msg = (message_param_t *)malloc( sizeof(message_param_t));
|
||||
|
||||
ptr = parse_bin_id_vbas( ptr, &bb, &c, &msg->in_class_id);
|
||||
|
||||
msg->last_byte = c == 1 ? true : false;
|
||||
|
||||
if( bb >= 2){
|
||||
ptr = parse_vbas( ptr, &class_id);
|
||||
// fprintf( stdout, "class_id: %lld\n", class_id);
|
||||
}
|
||||
msg->class_id = class_id;
|
||||
|
||||
if (bb == 3)
|
||||
ptr = parse_vbas( ptr, &csn);
|
||||
msg->csn = csn;
|
||||
|
||||
ptr = parse_vbas( ptr, &msg->bin_offset);
|
||||
ptr = parse_vbas( ptr, &msg->length);
|
||||
|
||||
if( msg->class_id%2) // Aux is present only if the id is odd
|
||||
ptr = parse_vbas( ptr, &msg->aux);
|
||||
else
|
||||
msg->aux = 0;
|
||||
|
||||
msg->res_offset = ptr-JPIPstream+offset;
|
||||
msg->phld = NULL;
|
||||
msg->next = NULL;
|
||||
|
||||
if(msgqueue->first)
|
||||
msgqueue->last->next = msg;
|
||||
else
|
||||
msgqueue->first = msg;
|
||||
msgqueue->last = msg;
|
||||
|
||||
ptr += msg->length;
|
||||
}
|
||||
}
|
||||
|
||||
void parse_metadata( metadata_param_t *metadata, message_param_t *msg, Byte_t *stream);
|
||||
|
||||
void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist)
|
||||
{
|
||||
message_param_t *msg;
|
||||
|
||||
if( metadatalist == NULL)
|
||||
return;
|
||||
|
||||
msg = msgqueue->first;
|
||||
while( msg){
|
||||
if( msg->class_id == METADATA_MSG){
|
||||
metadata_param_t *metadata = gene_metadata( msg->in_class_id, NULL, NULL, NULL);
|
||||
insert_metadata_into_list( metadata, metadatalist);
|
||||
parse_metadata( metadata, msg, stream+msg->res_offset);
|
||||
}
|
||||
msg = msg->next;
|
||||
}
|
||||
}
|
||||
|
||||
placeholder_param_t * parse_phld( Byte_t *datastream, Byte8_t metalength);
|
||||
|
||||
void parse_metadata( metadata_param_t *metadata, message_param_t *msg, Byte_t *datastream)
|
||||
{
|
||||
char *boxtype = (char *)(datastream+4);
|
||||
|
||||
msg->phld = NULL;
|
||||
|
||||
if( strncmp( boxtype, "phld", 4) == 0){
|
||||
if( !metadata->placeholderlist)
|
||||
metadata->placeholderlist = gene_placeholderlist();
|
||||
|
||||
placeholder_param_t *phld = parse_phld( datastream, msg->length);
|
||||
msg->phld = phld;
|
||||
insert_placeholder_into_list( phld, metadata->placeholderlist);
|
||||
}
|
||||
else if( isalpha(boxtype[0]) && isalpha(boxtype[1]) &&
|
||||
(isalnum(boxtype[2])||isblank(boxtype[2])) &&
|
||||
(isalpha(boxtype[3])||isblank(boxtype[3]))){
|
||||
if( !metadata->boxlist)
|
||||
metadata->boxlist = gene_boxlist();
|
||||
|
||||
box_param_t *box = gene_boxbyOffinStream( datastream, msg->res_offset);
|
||||
insert_box_into_list( box, metadata->boxlist);
|
||||
}
|
||||
else
|
||||
metadata->boxcontents = gene_boxcontents( msg->res_offset, msg->length);
|
||||
}
|
||||
|
||||
placeholder_param_t * parse_phld( Byte_t *datastream, Byte8_t metalength)
|
||||
{
|
||||
placeholder_param_t *phld;
|
||||
|
||||
phld = (placeholder_param_t *)malloc( sizeof(placeholder_param_t));
|
||||
|
||||
phld->LBox = big4( datastream);
|
||||
strcpy( phld->TBox, "phld");
|
||||
phld->Flags = big4( datastream+8);
|
||||
phld->OrigID = big8( datastream+12);
|
||||
phld->OrigBHlen = metalength - 20;
|
||||
phld->OrigBH = (Byte_t *)malloc(phld->OrigBHlen);
|
||||
memcpy( phld->OrigBH, datastream+20, phld->OrigBHlen);
|
||||
phld->next = NULL;
|
||||
|
||||
return phld;
|
||||
}
|
||||
|
||||
Byte_t * parse_bin_id_vbas( Byte_t *streamptr, Byte_t *bb, Byte_t *c, Byte8_t *in_class_id)
|
||||
{
|
||||
Byte_t code;
|
||||
Byte_t *ptr;
|
||||
|
||||
ptr = streamptr;
|
||||
code = *(ptr++);
|
||||
|
||||
*bb = (code >> 5) & 3;
|
||||
*c = (code >> 4) & 1;
|
||||
|
||||
*in_class_id = code & 15;
|
||||
|
||||
while(code >> 7){
|
||||
code = *(ptr++);
|
||||
*in_class_id = (*in_class_id << 7) | (code & 0x7f);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Byte_t * parse_vbas( Byte_t *streamptr, Byte8_t *elem)
|
||||
{
|
||||
Byte_t code;
|
||||
Byte_t *ptr;
|
||||
|
||||
*elem = 0;
|
||||
ptr = streamptr;
|
||||
do{
|
||||
code = *(ptr++);
|
||||
*elem = (*elem << 7) | (code & 0x7f);
|
||||
}while(code >> 7);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* search a message by class_id
|
||||
*
|
||||
* @param[in] class_id class identifiers
|
||||
* @param[in] in_class_id in-class identifiers, -1 means any
|
||||
* @param[in] csn codestream number
|
||||
* @param[in] msg first message pointer of the searching list
|
||||
* @return found message pointer
|
||||
*/
|
||||
message_param_t * search_message( Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg);
|
||||
|
||||
|
||||
/**
|
||||
* delete a message in msgqueue
|
||||
*
|
||||
* @param[in] message address of the deleting message pointer
|
||||
* @param[in] msgqueue message queue pointer
|
||||
*/
|
||||
void delete_message_in_msgqueue( message_param_t **message, msgqueue_param_t *msgqueue);
|
||||
|
||||
/**
|
||||
* reconstruct j2k codestream from JPT- (in future, JPP-) stream
|
||||
*
|
||||
* @param[in] msgqueue message queue pointer
|
||||
* @param[in] jpipstream original JPT- JPP- stream
|
||||
* @param[in] csn codestream number
|
||||
* @param[in] minlev minimum decomposition level
|
||||
* @param[out] codelen codestream length
|
||||
* @return generated reconstructed j2k codestream
|
||||
*/
|
||||
Byte_t * recons_codestream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int minlev, Byte8_t *codelen);
|
||||
|
||||
Byte_t * recons_j2k( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int minlev, Byte8_t *j2klen)
|
||||
{
|
||||
Byte_t *j2kstream = NULL;
|
||||
|
||||
if( !msgqueue)
|
||||
return NULL;
|
||||
|
||||
j2kstream = recons_codestream( msgqueue, jpipstream, csn, minlev, j2klen);
|
||||
|
||||
return j2kstream;
|
||||
}
|
||||
|
||||
Byte_t * add_emptyboxstream( placeholder_param_t *phld, Byte_t *jp2stream, Byte8_t *jp2len);
|
||||
Byte_t * add_msgstream( message_param_t *message, Byte_t *origstream, Byte_t *j2kstream, Byte8_t *j2klen);
|
||||
|
||||
Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len)
|
||||
{
|
||||
message_param_t *ptr;
|
||||
Byte_t *jp2stream = NULL;
|
||||
Byte_t *codestream = NULL;
|
||||
Byte8_t codelen;
|
||||
Byte8_t jp2cDBoxOffset = 0, jp2cDBoxlen = 0;
|
||||
|
||||
*jp2len = 0;
|
||||
|
||||
if( !msgqueue)
|
||||
return NULL;
|
||||
|
||||
ptr = msgqueue->first;
|
||||
while(( ptr = search_message( METADATA_MSG, -1, csn, ptr))!=NULL){
|
||||
if( ptr->phld){
|
||||
if( strncmp( (char *)ptr->phld->OrigBH+4, "jp2c", 4) == 0){
|
||||
jp2cDBoxOffset = *jp2len + ptr->phld->OrigBHlen;
|
||||
jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); // header only
|
||||
jp2cDBoxlen = *jp2len - jp2cDBoxOffset;
|
||||
}
|
||||
else
|
||||
jp2stream = add_emptyboxstream( ptr->phld, jp2stream, jp2len); // header only
|
||||
}
|
||||
jp2stream = add_msgstream( ptr, jpipstream, jp2stream, jp2len);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
|
||||
codestream = recons_codestream( msgqueue, jpipstream, csn, 0, &codelen);
|
||||
|
||||
if( jp2cDBoxOffset != 0 && codelen <= jp2cDBoxlen)
|
||||
memcpy( jp2stream+jp2cDBoxOffset, codestream, codelen);
|
||||
|
||||
free( codestream);
|
||||
|
||||
return jp2stream;
|
||||
}
|
||||
|
||||
int get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn);
|
||||
Byte_t * add_emptytilestream( const int tileID, Byte_t *j2kstream, Byte8_t *j2klen);
|
||||
Byte_t * add_EOC( Byte_t *j2kstream, Byte8_t *j2klen);
|
||||
|
||||
// usable only to JPT-stream messages
|
||||
// PRECINCT_MSG, EXT_PRECINCT_MSG, TILE_HEADER_MSG need to be handled
|
||||
Byte_t * recons_codestream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int minlev, Byte8_t *codelen)
|
||||
{
|
||||
message_param_t *ptr;
|
||||
Byte_t *codestream = NULL;
|
||||
int last_tileID;
|
||||
int tileID;
|
||||
|
||||
*codelen = 0;
|
||||
|
||||
// main header first
|
||||
ptr = msgqueue->first;
|
||||
while(( ptr = search_message( MAINHEADER_MSG, -1, csn, ptr))!=NULL){
|
||||
codestream = add_msgstream( ptr, jpipstream, codestream, codelen);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
|
||||
last_tileID = get_last_tileID( msgqueue, csn);
|
||||
|
||||
for( tileID=0; tileID <= last_tileID; tileID++){
|
||||
bool found = false;
|
||||
ptr = msgqueue->first;
|
||||
while(( ptr = search_message( TILE_MSG, tileID, csn, ptr))!=NULL){
|
||||
found = true;
|
||||
codestream = add_msgstream( ptr, jpipstream, codestream, codelen);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
ptr = msgqueue->first;
|
||||
while(( ptr = search_message( EXT_TILE_MSG, tileID, csn, ptr))!=NULL){
|
||||
if( ptr->aux >= minlev){
|
||||
found = true;
|
||||
codestream = add_msgstream( ptr, jpipstream, codestream, codelen);
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
if(!found)
|
||||
codestream = add_emptytilestream( tileID, codestream, codelen);
|
||||
}
|
||||
codestream = add_EOC( codestream, codelen);
|
||||
|
||||
return codestream;
|
||||
}
|
||||
|
||||
int get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn)
|
||||
{
|
||||
int last_tileID = 0;
|
||||
message_param_t *msg;
|
||||
|
||||
msg = msgqueue->first;
|
||||
while( msg){
|
||||
if((msg->class_id == TILE_MSG || msg->class_id == EXT_TILE_MSG) && msg->csn == csn && last_tileID < msg->in_class_id)
|
||||
last_tileID = msg->in_class_id;
|
||||
msg = msg->next;
|
||||
}
|
||||
return last_tileID;
|
||||
}
|
||||
|
||||
message_param_t * search_message( Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg)
|
||||
{
|
||||
while( msg != NULL){
|
||||
if( in_class_id == -1){
|
||||
if( msg->class_id == class_id && msg->csn == csn)
|
||||
return msg;
|
||||
}
|
||||
else{
|
||||
if( msg->class_id == class_id && msg->in_class_id == in_class_id && msg->csn == csn)
|
||||
return msg;
|
||||
}
|
||||
msg = msg->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void delete_message_in_msgqueue( message_param_t **msg, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
message_param_t *ptr;
|
||||
|
||||
if( !(*msg))
|
||||
return;
|
||||
|
||||
if( *msg == msgqueue->first)
|
||||
msgqueue->first = (*msg)->next;
|
||||
else{
|
||||
ptr = msgqueue->first;
|
||||
while( ptr->next != *msg){
|
||||
ptr=ptr->next;
|
||||
}
|
||||
|
||||
ptr->next = (*msg)->next;
|
||||
|
||||
if( *msg == msgqueue->last)
|
||||
msgqueue->last = ptr;
|
||||
}
|
||||
free( *msg);
|
||||
}
|
||||
|
||||
Byte_t * gene_msgstream( message_param_t *message, Byte_t *stream, Byte8_t *length);
|
||||
Byte_t * gene_emptytilestream( const int tileID, Byte8_t *length);
|
||||
|
||||
|
||||
Byte_t * add_msgstream( message_param_t *message, Byte_t *origstream, Byte_t *j2kstream, Byte8_t *j2klen)
|
||||
{
|
||||
Byte_t *newstream;
|
||||
Byte8_t newlen;
|
||||
Byte_t *buf;
|
||||
|
||||
if( !message)
|
||||
return NULL;
|
||||
|
||||
newstream = gene_msgstream( message, origstream, &newlen);
|
||||
|
||||
buf = (Byte_t *)malloc(( *j2klen)+newlen);
|
||||
|
||||
memcpy( buf, j2kstream, *j2klen);
|
||||
memcpy( buf+(*j2klen), newstream, newlen);
|
||||
|
||||
*j2klen += newlen;
|
||||
|
||||
free( newstream);
|
||||
if(j2kstream) free(j2kstream);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Byte_t * add_emptyboxstream( placeholder_param_t *phld, Byte_t *jp2stream, Byte8_t *jp2len)
|
||||
{
|
||||
Byte_t *newstream;
|
||||
Byte8_t newlen;
|
||||
Byte_t *buf;
|
||||
|
||||
if( phld->OrigBHlen == 8)
|
||||
newlen = big4(phld->OrigBH);
|
||||
else
|
||||
newlen = big8(phld->OrigBH+8);
|
||||
|
||||
newstream = (Byte_t *)malloc( newlen);
|
||||
memset( newstream, 0, newlen);
|
||||
memcpy( newstream, phld->OrigBH, phld->OrigBHlen);
|
||||
|
||||
buf = (Byte_t *)malloc(( *jp2len)+newlen);
|
||||
|
||||
memcpy( buf, jp2stream, *jp2len);
|
||||
memcpy( buf+(*jp2len), newstream, newlen);
|
||||
|
||||
*jp2len += newlen;
|
||||
|
||||
free( newstream);
|
||||
if(jp2stream) free(jp2stream);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Byte_t * add_emptytilestream( const int tileID, Byte_t *j2kstream, Byte8_t *j2klen)
|
||||
{
|
||||
Byte_t *newstream;
|
||||
Byte8_t newlen;
|
||||
Byte_t *buf;
|
||||
|
||||
newstream = gene_emptytilestream( tileID, &newlen);
|
||||
|
||||
buf = (Byte_t *)malloc(( *j2klen)+newlen);
|
||||
|
||||
memcpy( buf, j2kstream, *j2klen);
|
||||
memcpy( buf+(*j2klen), newstream, newlen);
|
||||
|
||||
*j2klen += newlen;
|
||||
|
||||
free( newstream);
|
||||
if(j2kstream) free(j2kstream);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Byte_t * add_EOC( Byte_t *j2kstream, Byte8_t *j2klen)
|
||||
{
|
||||
Byte2_t EOC = 0xd9ff;
|
||||
|
||||
Byte_t *buf;
|
||||
|
||||
buf = (Byte_t *)malloc(( *j2klen)+2);
|
||||
|
||||
memcpy( buf, j2kstream, *j2klen);
|
||||
memcpy( buf+(*j2klen), &EOC, 2);
|
||||
|
||||
*j2klen += 2;
|
||||
|
||||
if(j2kstream) free(j2kstream);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Byte_t * gene_msgstream( message_param_t *message, Byte_t *stream, Byte8_t *length)
|
||||
{
|
||||
Byte_t *buf;
|
||||
|
||||
if( !message)
|
||||
return NULL;
|
||||
|
||||
*length = message->length;
|
||||
buf = (Byte_t *)malloc( *length);
|
||||
memcpy( buf, stream+message->res_offset, *length);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Byte_t * gene_emptytilestream( const int tileID, Byte8_t *length)
|
||||
{
|
||||
Byte_t *buf;
|
||||
const Byte2_t SOT = 0x90ff;
|
||||
const Byte2_t Lsot = 0xa << 8;
|
||||
Byte2_t Isot;
|
||||
const Byte4_t Psot = 0xe << 24;
|
||||
const Byte_t TPsot = 0, TNsot = 0;
|
||||
const Byte2_t SOD = 0x93ff;
|
||||
|
||||
*length = 14;
|
||||
buf = (Byte_t *)malloc(*length);
|
||||
|
||||
Isot = tileID << 8;
|
||||
|
||||
memcpy( buf, &SOT, 2);
|
||||
memcpy( buf+2, &Lsot, 2);
|
||||
memcpy( buf+4, &Isot, 2);
|
||||
memcpy( buf+6, &Psot, 4);
|
||||
memcpy( buf+10, &TPsot, 1);
|
||||
memcpy( buf+11, &TNsot, 1);
|
||||
memcpy( buf+12, &SOD, 2);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* $Id: msgqueue_manager.h 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef MSGQUEUE_MANAGER_H_
|
||||
# define MSGQUEUE_MANAGER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bool.h"
|
||||
#include "byte_manager.h"
|
||||
#include "target_manager.h"
|
||||
#include "placeholder_manager.h"
|
||||
|
||||
//! message parameters
|
||||
typedef struct message_param{
|
||||
bool last_byte; //!< if message contains the last byte of the data-bin
|
||||
Byte8_t in_class_id; //!< in-class identifier A.2.3
|
||||
Byte8_t class_id; //!< class identifiers
|
||||
Byte8_t csn; //!< index of the codestream
|
||||
Byte8_t bin_offset; //!< offset of the data in this message from the start of the data-bin
|
||||
Byte8_t length; //!< message byte length
|
||||
Byte8_t aux; //!<
|
||||
Byte8_t res_offset; //!< offset in the resource
|
||||
placeholder_param_t *phld; //!< placeholder pointer in index
|
||||
struct message_param *next; //!< pointer to the next message
|
||||
} message_param_t;
|
||||
|
||||
//! message queue parameters
|
||||
typedef struct msgqueue_param{
|
||||
message_param_t *first; //!< first message pointer of the list
|
||||
message_param_t *last; //!< last message pointer of the list
|
||||
bool stateless; //!< if this is a stateless message queue
|
||||
target_param_t *target; //!< reference target pointer
|
||||
} msgqueue_param_t;
|
||||
|
||||
/**
|
||||
* generate message queue
|
||||
*
|
||||
* @param[in] stateless if this is a stateless message queue
|
||||
* @param[in] target reference target pointer
|
||||
* @return generated message queue pointer
|
||||
*/
|
||||
msgqueue_param_t * gene_msgqueue( bool stateless, target_param_t *target);
|
||||
|
||||
/**
|
||||
* delete message queue
|
||||
*
|
||||
* @param[in] msgqueue address of the message queue pointer
|
||||
*/
|
||||
void delete_msgqueue( msgqueue_param_t **msgqueue);
|
||||
|
||||
/**
|
||||
* print message queue
|
||||
*
|
||||
* @param[in] msgqueue message queue pointer
|
||||
*/
|
||||
void print_msgqueue( msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* enqueue main header data-bin into message queue
|
||||
*
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void enqueue_mainheader( msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* enqueue tile data-bin into message queue
|
||||
*
|
||||
* @param[in] tile_id tile id starting from 0
|
||||
* @param[in] level decomposition level
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* enqueue Metadata-bin into message queue
|
||||
*
|
||||
* @param[in] meta_id metadata-bin id
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void enqueue_metadata( int meta_id, msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* emit stream from message queue
|
||||
*
|
||||
* @param[in] msgqueue message queue pointer
|
||||
*/
|
||||
void emit_stream_from_msgqueue( msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* parse JPT- JPP- stream to message queue
|
||||
*
|
||||
* @param[in] JPIPstream JPT- JPP- stream data pointer
|
||||
* @param[in] streamlen JPIPstream length
|
||||
* @param[in] offset offset of the stream from the whole beginning
|
||||
* @param[in,out] msgqueue adding message queue pointer
|
||||
*/
|
||||
void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, Byte8_t offset, msgqueue_param_t *msgqueue);
|
||||
|
||||
/**
|
||||
* parse JPT- JPP- stream to message queue
|
||||
*
|
||||
* @param[in] msgqueue reference message queue pointer
|
||||
* @param[in] stream stream data pointer
|
||||
* @param[in] streamlen stream length
|
||||
* @param[in] metadatalist adding metadata list pointer
|
||||
*/
|
||||
void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist);
|
||||
|
||||
|
||||
/**
|
||||
* reconstruct j2k codestream from message queue
|
||||
*
|
||||
* @param[in] msgqueue message queue pointer
|
||||
* @param[in] jpipstream original jpt- jpp- stream
|
||||
* @param[in] csn codestream number
|
||||
* @param[in] minlev minimum decomposition level
|
||||
* @param[out] j2klen pointer to the j2k codestream length
|
||||
* @return generated reconstructed j2k codestream
|
||||
*/
|
||||
Byte_t * recons_j2k( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int minlev, Byte8_t *j2klen);
|
||||
|
||||
|
||||
/**
|
||||
* reconstruct jp2 file codestream from message queue
|
||||
*
|
||||
* @param[in] msgqueue message queue pointer
|
||||
* @param[in] jpipstream original jpt- jpp- stream
|
||||
* @param[in] csn codestream number
|
||||
* @param[out] jp2len pointer to the jp2 codestream length
|
||||
* @return generated reconstructed jp2 codestream
|
||||
*/
|
||||
Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len);
|
||||
|
||||
|
||||
#endif /* !MSGQUEUE_MANAGER_H_ */
|
||||
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* $Id: target_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "target_manager.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
|
||||
targetlist_param_t * gene_targetlist()
|
||||
{
|
||||
targetlist_param_t *targetlist;
|
||||
|
||||
targetlist = (targetlist_param_t *)malloc( sizeof(targetlist_param_t));
|
||||
|
||||
targetlist->first = NULL;
|
||||
targetlist->last = NULL;
|
||||
|
||||
return targetlist;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open jp2 format image file
|
||||
*
|
||||
* @param[in] filename file name (.jp2)
|
||||
* @return file descriptor
|
||||
*/
|
||||
int open_jp2file( char filename[]);
|
||||
|
||||
target_param_t * gene_target( char *targetname)
|
||||
{
|
||||
target_param_t *target;
|
||||
int fd;
|
||||
index_param_t *jp2idx;
|
||||
static int last_csn = 0;
|
||||
|
||||
|
||||
if( targetname[0]=='\0'){
|
||||
fprintf( FCGI_stderr, "Error: exception, no targetname in gene_target()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((fd = open_jp2file( targetname)) == -1){
|
||||
fprintf( FCGI_stdout, "Status: 404\r\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !(jp2idx = parse_jp2file( fd))){
|
||||
fprintf( FCGI_stdout, "Status: 501\r\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
target = (target_param_t *)malloc( sizeof(target_param_t));
|
||||
strcpy( target->filename, targetname);
|
||||
target->fd = fd;
|
||||
target->csn = last_csn++;
|
||||
target->codeidx = jp2idx;
|
||||
|
||||
target->next=NULL;
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
void delete_target( target_param_t **target)
|
||||
{
|
||||
close( (*target)->fd);
|
||||
delete_index ( &(*target)->codeidx);
|
||||
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: target: %s deleted\n", (*target)->filename);
|
||||
#endif
|
||||
free(*target);
|
||||
}
|
||||
|
||||
void delete_target_in_list( target_param_t **target, targetlist_param_t *targetlist)
|
||||
{
|
||||
target_param_t *ptr;
|
||||
|
||||
if( *target == targetlist->first)
|
||||
targetlist->first = (*target)->next;
|
||||
else{
|
||||
ptr = targetlist->first;
|
||||
while( ptr->next != *target){
|
||||
ptr=ptr->next;
|
||||
}
|
||||
|
||||
ptr->next = (*target)->next;
|
||||
|
||||
if( *target == targetlist->last)
|
||||
targetlist->last = ptr;
|
||||
}
|
||||
delete_target( target);
|
||||
}
|
||||
|
||||
void delete_targetlist(targetlist_param_t **targetlist)
|
||||
{
|
||||
target_param_t *targetPtr, *targetNext;
|
||||
|
||||
targetPtr = (*targetlist)->first;
|
||||
while( targetPtr != NULL){
|
||||
targetNext=targetPtr->next;
|
||||
delete_target( &targetPtr);
|
||||
targetPtr=targetNext;
|
||||
}
|
||||
free( *targetlist);
|
||||
}
|
||||
|
||||
void print_alltarget( targetlist_param_t *targetlist)
|
||||
{
|
||||
target_param_t *ptr;
|
||||
|
||||
ptr = targetlist->first;
|
||||
while( ptr != NULL){
|
||||
fprintf( logstream,"csn=%d\n", ptr->csn);
|
||||
fprintf( logstream,"target=%s\n", ptr->filename);
|
||||
ptr=ptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
target_param_t * search_target( char targetname[], targetlist_param_t *targetlist)
|
||||
{
|
||||
target_param_t *foundtarget;
|
||||
|
||||
foundtarget = targetlist->first;
|
||||
|
||||
while( foundtarget != NULL){
|
||||
|
||||
if( strcmp( targetname, foundtarget->filename) == 0)
|
||||
return foundtarget;
|
||||
|
||||
foundtarget = foundtarget->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int open_jp2file( char filename[])
|
||||
{
|
||||
int fd;
|
||||
char *data;
|
||||
|
||||
if( (fd = open( filename, O_RDONLY)) == -1){
|
||||
fprintf( FCGI_stdout, "Reason: Target %s not found\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
// Check resource is a JP family file.
|
||||
if( lseek( fd, 0, SEEK_SET)==-1){
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: Target %s broken (lseek error)\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = (char *)malloc( 12); // size of header
|
||||
if( read( fd, data, 12) != 12){
|
||||
free( data);
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: Target %s broken (read error)\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( *data || *(data + 1) || *(data + 2) ||
|
||||
*(data + 3) != 12 || strncmp (data + 4, "jP \r\n\x87\n", 8)){
|
||||
free( data);
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: No JPEG 2000 Signature box in target %s\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
free( data);
|
||||
return fd;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = opj_dec_server
|
||||
@@ -1,28 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = opj_dec_server
|
||||
|
||||
opj_dec_server_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/opj_server \
|
||||
-I$(top_builddir)/applications/jpip/opj_server \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
@FCGI_CFLAGS@ \
|
||||
-DSERVER
|
||||
opj_dec_server_CFLAGS =
|
||||
opj_dec_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la $(top_builddir)/libopenjpeg/libopenjpeg.la @FCGI_LIBS@ -lm
|
||||
opj_dec_server_SOURCES = \
|
||||
cache_manager.c \
|
||||
cache_manager.h \
|
||||
imgsock_manager.c \
|
||||
imgsock_manager.h \
|
||||
jp2k_decoder.c \
|
||||
jp2k_decoder.h \
|
||||
jpipstream_manager.c \
|
||||
jpipstream_manager.h \
|
||||
opj_dec_server.c
|
||||
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@@ -1,14 +0,0 @@
|
||||
LIBDIR = ../../libopenjpip
|
||||
LIBFNAME = $(LIBDIR)/libopenjpip_local.a
|
||||
CFLAGS = -O3 -Wall -I$(LIBDIR)
|
||||
LDFLAGS = -L$(LIBDIR) -lm -lopenjpeg -lopenjpip_local
|
||||
#-lws2_32
|
||||
|
||||
ALL = opj_dec_server
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
opj_dec_server: opj_dec_server.o jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o $(LIBFNAME)
|
||||
$(CC) $(CFLAGS) $< jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o $(LDFLAGS) -o $@
|
||||
clean:
|
||||
rm -f $(ALL) *.o *~
|
||||
@@ -1,270 +0,0 @@
|
||||
/*
|
||||
* $Id: imgsock_manager.c 54 2011-05-10 13:22:47Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "imgsock_manager.h"
|
||||
|
||||
#define BUF_LEN 256
|
||||
|
||||
SOCKET open_listeningsocket()
|
||||
{
|
||||
SOCKET listening_socket;
|
||||
struct sockaddr_in sin;
|
||||
int sock_optval = 1;
|
||||
int port = 5000;
|
||||
|
||||
listening_socket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if ( listening_socket == -1 ){
|
||||
perror("socket");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( setsockopt(listening_socket, SOL_SOCKET, SO_REUSEADDR,
|
||||
&sock_optval, sizeof(sock_optval)) == -1 ){
|
||||
perror("setsockopt");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(port);
|
||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if ( bind(listening_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0 ){
|
||||
perror("bind");
|
||||
closesocket(listening_socket);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( listen(listening_socket, SOMAXCONN) == -1){
|
||||
perror("listen");
|
||||
closesocket(listening_socket);
|
||||
exit(1);
|
||||
}
|
||||
printf("port %d is listened\n", port);
|
||||
|
||||
return listening_socket;
|
||||
}
|
||||
|
||||
msgtype_t identify_clientmsg( SOCKET connected_socket)
|
||||
{
|
||||
int receive_size;
|
||||
char buf[BUF_LEN];
|
||||
char *magicid[] = { "JPIP-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"};
|
||||
int i;
|
||||
|
||||
receive_size = receive_line( connected_socket, buf);
|
||||
|
||||
if( receive_size == 0){
|
||||
fprintf( stderr, "Error to receive the header of client message\n");
|
||||
return MSGERROR;
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_OF_MSGTYPES; i++){
|
||||
if( strncasecmp( magicid[i], buf, strlen(magicid[i])) == 0){
|
||||
printf("Client message: %s\n", magicid[i]);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stderr, "Cannot identify client message type %s\n", buf);
|
||||
return MSGERROR;
|
||||
}
|
||||
|
||||
Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen)
|
||||
{
|
||||
Byte_t *jpipstream=NULL, *ptr;
|
||||
char buf[BUF_LEN], versionstring[] = "version 1.1";
|
||||
int linelen, redlen, remlen;
|
||||
|
||||
target[0] = 0;
|
||||
cid[0] = 0;
|
||||
|
||||
if((linelen = receive_line( connected_socket, buf)) == 0)
|
||||
return NULL;
|
||||
if( strncmp( versionstring, buf, strlen(versionstring))!=0){
|
||||
fprintf( stderr, "Wrong format\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((linelen = receive_line( connected_socket, buf)) == 0)
|
||||
return NULL;
|
||||
|
||||
if( strstr( buf, "jp2")){
|
||||
// register cid option
|
||||
strcpy( target, buf);
|
||||
|
||||
if((linelen = receive_line( connected_socket, buf)) == 0)
|
||||
return NULL;
|
||||
strcpy( cid, buf);
|
||||
|
||||
if((linelen = receive_line( connected_socket, buf)) == 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*streamlen = atoi( buf);
|
||||
fprintf( stderr, "Receiveing Data length: %d\n", *streamlen);
|
||||
|
||||
|
||||
jpipstream = (unsigned char *)malloc( (*streamlen));
|
||||
ptr = jpipstream;
|
||||
remlen = (*streamlen);
|
||||
while( remlen > 0){
|
||||
redlen = recv( connected_socket, ptr, remlen, 0);
|
||||
if( redlen == -1){
|
||||
fprintf( stderr, "receive JPT- JPP- stream error\n");
|
||||
break;
|
||||
}
|
||||
remlen -= redlen;
|
||||
ptr = ptr + redlen;
|
||||
}
|
||||
fprintf( stderr, " done\n");
|
||||
|
||||
return jpipstream;
|
||||
}
|
||||
|
||||
void send_stream( SOCKET connected_socket, void *stream, int length);
|
||||
|
||||
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, int length)
|
||||
{
|
||||
Byte_t header[5];
|
||||
|
||||
header[0] = 'X';
|
||||
header[1] = 'M';
|
||||
header[2] = 'L';
|
||||
header[3] = (length >> 8) & 0xff;
|
||||
header[4] = length & 0xff;
|
||||
|
||||
send_stream( connected_socket, header, 5);
|
||||
send_stream( connected_socket, xmlstream, length);
|
||||
}
|
||||
|
||||
void send_CIDstream( SOCKET connected_socket, char *cid, int cidlen)
|
||||
{
|
||||
Byte_t header[4];
|
||||
|
||||
header[0] = 'C';
|
||||
header[1] = 'I';
|
||||
header[2] = 'D';
|
||||
header[3] = cidlen & 0xff;
|
||||
|
||||
send_stream( connected_socket, header, 4);
|
||||
send_stream( connected_socket, cid, cidlen);
|
||||
}
|
||||
|
||||
void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval)
|
||||
{
|
||||
int pnmlen = 0;
|
||||
Byte_t header[7];
|
||||
|
||||
pnmlen = width*height*numofcomp;
|
||||
|
||||
header[0] = 'P';
|
||||
header[1] = numofcomp==3 ? 6:5;
|
||||
header[2] = (width >> 8) & 0xff;
|
||||
header[3] = width & 0xff;
|
||||
header[4] = (height >> 8) & 0xff;
|
||||
header[5] = height & 0xff;
|
||||
header[6] = maxval;
|
||||
|
||||
send_stream( connected_socket, header, 7);
|
||||
send_stream( connected_socket, pnmstream, pnmlen);
|
||||
}
|
||||
|
||||
void send_stream( SOCKET connected_socket, void *stream, int length)
|
||||
{
|
||||
void *ptr = stream;
|
||||
int remlen = length;
|
||||
|
||||
while( remlen > 0){
|
||||
int sentlen = send( connected_socket, ptr, remlen, 0);
|
||||
if( sentlen == -1){
|
||||
fprintf( stderr, "sending stream error\n");
|
||||
break;
|
||||
}
|
||||
remlen = remlen - sentlen;
|
||||
ptr = ptr + sentlen;
|
||||
}
|
||||
}
|
||||
|
||||
int receive_line(SOCKET connected_socket, char *p)
|
||||
{
|
||||
int len = 0;
|
||||
while (1){
|
||||
int ret;
|
||||
ret = recv( connected_socket, p, 1, 0);
|
||||
if ( ret == -1 ){
|
||||
perror("receive");
|
||||
exit(1);
|
||||
} else if ( ret == 0 ){
|
||||
break;
|
||||
}
|
||||
if ( *p == '\n' )
|
||||
break;
|
||||
p++;
|
||||
len++;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
if( len == 0)
|
||||
fprintf( stderr, "Header receive error\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void response_signal( SOCKET connected_socket, bool succeed)
|
||||
{
|
||||
Byte_t code;
|
||||
|
||||
if( succeed)
|
||||
code = 1;
|
||||
else
|
||||
code = 0;
|
||||
|
||||
if( send( connected_socket, &code, 1, 0) != 1)
|
||||
fprintf( stderr, "Response signalling error\n");
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
/*
|
||||
* $Id: opj_dec_server.c 54 2011-05-10 13:22:47Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief opj_dec_server is a server to decode JPT-stream and communicate locally with JPIP client, which is coded in java.
|
||||
*
|
||||
* \section impinst Implementing instructions
|
||||
* Launch opj_dec_server from a terminal in the same machine as JPIP client image viewers. \n
|
||||
* % ./opj_dec_server \n
|
||||
* Keep it alive as long as image viewers are open.\n
|
||||
*
|
||||
* To quite the opj_dec_server, send a message "quit" through the telnet.\n
|
||||
* % telnet localhost 5000\n
|
||||
* quit\n
|
||||
* Be sure all image viewers are closed.\n
|
||||
* Cache file in JPT format is stored in the working directly before it quites.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "byte_manager.h"
|
||||
#include "msgqueue_manager.h"
|
||||
#include "ihdrbox_manager.h"
|
||||
#include "imgsock_manager.h"
|
||||
#include "jpipstream_manager.h"
|
||||
#include "cache_manager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA initialisation_win32;
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#endif //_WIN32
|
||||
|
||||
//! maximum length of target name
|
||||
#define MAX_LENOFTARGET 128
|
||||
|
||||
//! maximum length of channel identifier
|
||||
#define MAX_LENOFCID 30
|
||||
|
||||
/**
|
||||
* handle JPT- JPP- stream message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in] cachelist cache list pointer
|
||||
* @param[in,out] jpipstream address of JPT- JPP- stream pointer
|
||||
* @param[in,out] streamlen address of stream length
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist, Byte_t **jpipstream, int *streamlen, msgqueue_param_t *msgqueue);
|
||||
|
||||
/**
|
||||
* handle PNM request message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in] jpipstream jpipstream pointer
|
||||
* @param[in] msgqueue message queue pointer
|
||||
* @param[in] cachelist cache list pointer
|
||||
*/
|
||||
void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
|
||||
|
||||
/**
|
||||
* handle XML request message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in] jpipstream address of caching jpipstream pointer
|
||||
* @param[in] cachelist cache list pointer
|
||||
*/
|
||||
void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_param_t *cachelist);
|
||||
|
||||
/**
|
||||
* handle ChannelID request message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in] cachelist cache list pointer
|
||||
*/
|
||||
void handle_CIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
|
||||
|
||||
/**
|
||||
* handle distroy ChannelID message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in,out] cachelist cache list pointer
|
||||
*/
|
||||
void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
|
||||
|
||||
/**
|
||||
* handle saving JP2 file request message
|
||||
*
|
||||
* @param[in] connected_socket socket descriptor
|
||||
* @param[in] cachelist cache list pointer
|
||||
* @param[in] msgqueue message queue pointer
|
||||
* @param[in] jpipstream address of caching jpipstream pointer
|
||||
*/
|
||||
void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jpipstream);
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
SOCKET connected_socket;
|
||||
struct sockaddr_in peer_sin;
|
||||
Byte_t *jpipstream = NULL;
|
||||
int jpipstreamlen = 0;
|
||||
msgqueue_param_t *msgqueue = gene_msgqueue( true, NULL);
|
||||
bool quit = false;
|
||||
|
||||
#ifdef _WIN32
|
||||
int erreur = WSAStartup(MAKEWORD(2,2),&initialisation_win32);
|
||||
if( erreur!=0)
|
||||
fprintf( stderr, "Erreur initialisation Winsock error : %d %d\n",erreur,WSAGetLastError());
|
||||
else
|
||||
printf( "Initialisation Winsock\n");
|
||||
#endif //_WIN32
|
||||
|
||||
int listening_socket = open_listeningsocket();
|
||||
|
||||
unsigned int addrlen = sizeof(peer_sin);
|
||||
|
||||
cachelist_param_t *cachelist = gene_cachelist();
|
||||
|
||||
while(( connected_socket = accept(listening_socket, (struct sockaddr *)&peer_sin, &addrlen))!=-1 ){
|
||||
msgtype_t msgtype = identify_clientmsg( connected_socket);
|
||||
|
||||
switch( msgtype){
|
||||
case JPIPSTREAM:
|
||||
handle_JPIPstreamMSG( connected_socket, cachelist, &jpipstream, &jpipstreamlen, msgqueue);
|
||||
break;
|
||||
|
||||
case PNMREQ:
|
||||
handle_PNMreqMSG( connected_socket, jpipstream, msgqueue, cachelist);
|
||||
break;
|
||||
|
||||
case XMLREQ:
|
||||
handle_XMLreqMSG( connected_socket, jpipstream, cachelist);
|
||||
break;
|
||||
|
||||
case CIDREQ:
|
||||
handle_CIDreqMSG( connected_socket, cachelist);
|
||||
break;
|
||||
|
||||
case CIDDST:
|
||||
handle_dstCIDreqMSG( connected_socket, cachelist);
|
||||
break;
|
||||
|
||||
case JP2SAVE:
|
||||
handle_JP2saveMSG( connected_socket, cachelist, msgqueue, jpipstream);
|
||||
break;
|
||||
|
||||
case QUIT:
|
||||
quit = true;
|
||||
break;
|
||||
case MSGERROR:
|
||||
break;
|
||||
}
|
||||
|
||||
printf("cut the connection. listening to port\n");
|
||||
if( closesocket(connected_socket) != 0){
|
||||
perror("close");
|
||||
return -1;
|
||||
}
|
||||
if( quit)
|
||||
break;
|
||||
}
|
||||
if( closesocket(listening_socket) != 0){
|
||||
perror("close");
|
||||
return -1;
|
||||
}
|
||||
|
||||
delete_cachelist( &cachelist);
|
||||
|
||||
if( msgqueue)
|
||||
delete_msgqueue( &msgqueue);
|
||||
|
||||
// save_codestream( jpipstream, jpipstreamlen, "jpt");
|
||||
free( jpipstream);
|
||||
|
||||
#ifdef _WIN32
|
||||
if( WSACleanup() != 0){
|
||||
printf("\nError in WSACleanup : %d %d",erreur,WSAGetLastError());
|
||||
}else{
|
||||
printf("\nWSACleanup OK\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist,
|
||||
Byte_t **jpipstream, int *streamlen, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
Byte_t *newjpipstream;
|
||||
int newstreamlen = 0;
|
||||
cache_param_t *cache;
|
||||
char target[MAX_LENOFTARGET], cid[MAX_LENOFCID];
|
||||
metadatalist_param_t *metadatalist;
|
||||
|
||||
newjpipstream = receive_JPIPstream( connected_socket, target, cid, &newstreamlen);
|
||||
|
||||
parse_JPIPstream( newjpipstream, newstreamlen, *streamlen, msgqueue);
|
||||
|
||||
*jpipstream = update_JPIPstream( newjpipstream, newstreamlen, *jpipstream, streamlen);
|
||||
free( newjpipstream);
|
||||
|
||||
metadatalist = gene_metadatalist();
|
||||
parse_metamsg( msgqueue, *jpipstream, *streamlen, metadatalist);
|
||||
|
||||
// cid registration
|
||||
if( target[0] != 0 && cid[0] != 0){
|
||||
if((cache = search_cache( target, cachelist)))
|
||||
add_cachecid( cid, cache);
|
||||
else{
|
||||
cache = gene_cache( target, msgqueue->last->csn, cid);
|
||||
insert_cache_into_list( cache, cachelist);
|
||||
}
|
||||
}
|
||||
else
|
||||
cache = search_cacheBycsn( msgqueue->last->csn, cachelist);
|
||||
|
||||
if( cache->metadatalist)
|
||||
delete_metadatalist( &cache->metadatalist);
|
||||
cache->metadatalist = metadatalist;
|
||||
|
||||
response_signal( connected_socket, true);
|
||||
}
|
||||
|
||||
void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist)
|
||||
{
|
||||
Byte_t *pnmstream;
|
||||
ihdrbox_param_t *ihdrbox;
|
||||
char cid[MAX_LENOFCID], tmp[10];
|
||||
cache_param_t *cache;
|
||||
int fw, fh;
|
||||
|
||||
receive_line( connected_socket, cid);
|
||||
if(!(cache = search_cacheBycid( cid, cachelist)))
|
||||
return;
|
||||
|
||||
receive_line( connected_socket, tmp);
|
||||
fw = atoi( tmp);
|
||||
|
||||
receive_line( connected_socket, tmp);
|
||||
fh = atoi( tmp);
|
||||
|
||||
pnmstream = jpipstream_to_pnm( jpipstream, msgqueue, cache->csn, fw, fh, &cache->ihdrbox);
|
||||
ihdrbox = cache->ihdrbox;
|
||||
send_PNMstream( connected_socket, pnmstream, ihdrbox->width, ihdrbox->height, ihdrbox->nc, ihdrbox->bpc > 8 ? 255 : (1 << ihdrbox->bpc) - 1);
|
||||
|
||||
free( pnmstream);
|
||||
}
|
||||
|
||||
void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_param_t *cachelist)
|
||||
{
|
||||
char cid[MAX_LENOFCID];
|
||||
cache_param_t *cache;
|
||||
|
||||
receive_line( connected_socket, cid);
|
||||
if(!(cache = search_cacheBycid( cid, cachelist)))
|
||||
return;
|
||||
|
||||
boxcontents_param_t *boxcontents = cache->metadatalist->last->boxcontents;
|
||||
Byte_t *xmlstream = (Byte_t *)malloc( boxcontents->length);
|
||||
memcpy( xmlstream, jpipstream+boxcontents->offset, boxcontents->length);
|
||||
send_XMLstream( connected_socket, xmlstream, boxcontents->length);
|
||||
free( xmlstream);
|
||||
}
|
||||
|
||||
void handle_CIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
|
||||
{
|
||||
char target[MAX_LENOFTARGET], *cid = NULL;
|
||||
cache_param_t *cache;
|
||||
int cidlen = 0;
|
||||
|
||||
receive_line( connected_socket, target);
|
||||
cache = search_cache( target, cachelist);
|
||||
|
||||
if( cache){
|
||||
if( cache->numOfcid > 0){
|
||||
cid = cache->cid[ cache->numOfcid-1];
|
||||
cidlen = strlen(cid);
|
||||
}
|
||||
}
|
||||
send_CIDstream( connected_socket, cid, cidlen);
|
||||
}
|
||||
|
||||
void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
|
||||
{
|
||||
char cid[MAX_LENOFCID];
|
||||
|
||||
receive_line( connected_socket, cid);
|
||||
remove_cachecid( cid, cachelist);
|
||||
response_signal( connected_socket, true);
|
||||
}
|
||||
|
||||
void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jpipstream)
|
||||
{
|
||||
char cid[MAX_LENOFCID];
|
||||
cache_param_t *cache;
|
||||
Byte_t *jp2stream;
|
||||
Byte8_t jp2len;
|
||||
|
||||
receive_line( connected_socket, cid);
|
||||
if(!(cache = search_cacheBycid( cid, cachelist)))
|
||||
return;
|
||||
|
||||
jp2stream = recons_jp2( msgqueue, jpipstream, cache->csn, &jp2len);
|
||||
|
||||
if( jp2stream){
|
||||
save_codestream( jp2stream, jp2len, "jp2");
|
||||
free( jp2stream);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<project name="opj_viewer" default="dist" basedir=".">
|
||||
<description>OpenJPIP client image viewer</description>
|
||||
<property name="src" location="src" />
|
||||
<property name="build" location="build"/>
|
||||
<property name="dist" location="dist" />
|
||||
|
||||
<target name="init">
|
||||
<tstamp/>
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src}" destdir="${build}"/>
|
||||
</target>
|
||||
<target name="dist" depends="compile">
|
||||
<mkdir dir="${dist}"/>
|
||||
<jar jarfile="${dist}/opj_viewer-${DSTAMP}.jar"
|
||||
basedir="${build}" manifest="${dist}/manifest.txt"/>
|
||||
<exec dir="${dist}" executable="ln">
|
||||
<arg line="-sf opj_viewer-${DSTAMP}.jar opj_viewer.jar"/>
|
||||
</exec>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${build}"/>
|
||||
<delete dir="${dist}"/>
|
||||
</target>
|
||||
<target name="test" depends="dist">
|
||||
<exec executable="appletviewer"><arg line="dist.html"/></exec>
|
||||
</target>
|
||||
<target name="build_test" depends="compile">
|
||||
<exec executable="appletviewer"><arg line="compile.html"/></exec>
|
||||
</target>
|
||||
<target name="build_testj" depends="compile">
|
||||
<exec executable="java"><arg line="-classpath build ImageWindow girl"/></exec>
|
||||
</target>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
opj_viewer-20110711.jar
|
||||
@@ -1,304 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class JPIPHttpClient
|
||||
{
|
||||
private String comURL;
|
||||
protected int fw, fh;
|
||||
protected int rx, ry;
|
||||
protected int rw, rh;
|
||||
protected String cid;
|
||||
|
||||
public JPIPHttpClient( String URI)
|
||||
{
|
||||
comURL = URI + "?";
|
||||
fw = fh = -1;
|
||||
rx = ry = -1;
|
||||
rw = rh = -1;
|
||||
cid = null;
|
||||
}
|
||||
|
||||
public int getFw(){ return fw;}
|
||||
public int getFh(){ return fh;}
|
||||
public int getRx(){ return rx;}
|
||||
public int getRy(){ return ry;}
|
||||
public int getRw(){ return rw;}
|
||||
public int getRh(){ return rh;}
|
||||
|
||||
public byte[] requestViewWindow( int reqfw, int reqfh)
|
||||
{
|
||||
if( cid != null)
|
||||
return requestViewWindow( reqfw, reqfh, cid);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( int reqfw, int reqfh, int reqrx, int reqry, int reqrw, int reqrh)
|
||||
{
|
||||
if( cid != null)
|
||||
return requestViewWindow( reqfw, reqfh, reqrx, reqry, reqrw, reqrh, cid);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( int reqfw, int reqfh, String reqcid)
|
||||
{
|
||||
return requestViewWindow( null, reqfw, reqfh, -1, -1, -1, -1, reqcid, false);
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( int reqfw, int reqfh, int reqrx, int reqry, int reqrw, int reqrh, String reqcid)
|
||||
{
|
||||
return requestViewWindow( null, reqfw, reqfh, reqrx, reqry, reqrw, reqrh, reqcid, false);
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( String target, int reqfw, int reqfh)
|
||||
{
|
||||
return requestViewWindow( target, reqfw, reqfh, -1, -1, -1, -1, null, false);
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( String target, int reqfw, int reqfh, boolean reqcnew)
|
||||
{
|
||||
if( cid == null) // 1 channel allocation only
|
||||
return requestViewWindow( target, reqfw, reqfh, -1, -1, -1, -1, null, reqcnew);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( String target, int reqfw, int reqfh, int reqrx, int reqry, int reqrw, int reqrh)
|
||||
{
|
||||
return requestViewWindow( target, reqfw, reqfh, reqrx, reqry, reqrw, reqrh, null, false);
|
||||
}
|
||||
|
||||
|
||||
public byte[] requestViewWindow( int reqfw, int reqfh, String reqcid, boolean reqcnew)
|
||||
{
|
||||
return requestViewWindow( null, reqfw, reqfh, -1, -1, -1, -1, reqcid, reqcnew);
|
||||
}
|
||||
|
||||
public byte[] requestViewWindow( String target,
|
||||
int reqfw, int reqfh,
|
||||
int reqrx, int reqry,
|
||||
int reqrw, int reqrh,
|
||||
String reqcid, boolean reqcnew)
|
||||
{
|
||||
String urlstring = const_urlstring( target, reqfw, reqfh, reqrx, reqry, reqrw, reqrh, reqcid, reqcnew);
|
||||
return GETrequest( urlstring);
|
||||
}
|
||||
|
||||
public byte[] requestXML()
|
||||
{
|
||||
String urlstring = comURL;
|
||||
|
||||
if( cid == null)
|
||||
return null;
|
||||
|
||||
urlstring = urlstring.concat( "cid=" + cid);
|
||||
urlstring = urlstring.concat( "&metareq=[xml_]");
|
||||
|
||||
return GETrequest( urlstring);
|
||||
}
|
||||
|
||||
private byte[] GETrequest( String urlstring)
|
||||
{
|
||||
int buflen = 0;
|
||||
URL url = null;
|
||||
HttpURLConnection urlconn = null;
|
||||
byte[] jpipstream = null;
|
||||
|
||||
try{
|
||||
url = new URL( urlstring);
|
||||
|
||||
System.err.println("Requesting: " + url);
|
||||
|
||||
urlconn = (HttpURLConnection)url.openConnection();
|
||||
urlconn.setRequestMethod("GET");
|
||||
urlconn.setInstanceFollowRedirects(false);
|
||||
urlconn.connect();
|
||||
|
||||
Map<String,java.util.List<String>> headers = urlconn.getHeaderFields();
|
||||
java.util.List<String> hvaluelist;
|
||||
|
||||
if(( hvaluelist = headers.get("JPIP-fsiz")) != null){
|
||||
String hvalueline = hvaluelist.get(0);
|
||||
fw = Integer.valueOf( hvalueline.substring( 0, hvalueline.indexOf(','))).intValue();
|
||||
fh = Integer.valueOf( hvalueline.substring( hvalueline.indexOf(',')+1 )).intValue();
|
||||
|
||||
System.err.println("fw,fh: " + fw + "," + fh);
|
||||
}
|
||||
|
||||
if(( hvaluelist = headers.get("JPIP-roff")) != null){
|
||||
String hvalueline = hvaluelist.get(0);
|
||||
rx = Integer.valueOf( hvalueline.substring( 0, hvalueline.indexOf(','))).intValue();
|
||||
ry = Integer.valueOf( hvalueline.substring( hvalueline.indexOf(',')+1 )).intValue();
|
||||
System.err.println("rx,ry: " + rx + "," + ry);
|
||||
}
|
||||
|
||||
if(( hvaluelist = headers.get("JPIP-rsiz")) != null){
|
||||
String hvalueline = hvaluelist.get(0);
|
||||
rw = Integer.valueOf( hvalueline.substring( 0, hvalueline.indexOf(','))).intValue();
|
||||
rh = Integer.valueOf( hvalueline.substring( hvalueline.indexOf(',')+1 )).intValue();
|
||||
System.err.println("rw,rh: " + rw + "," + rh);
|
||||
}
|
||||
|
||||
if(( hvaluelist = headers.get("JPIP-cnew")) != null){
|
||||
String hvalueline = hvaluelist.get(0);
|
||||
cid = hvalueline.substring( hvalueline.indexOf('=')+1, hvalueline.indexOf(','));
|
||||
System.err.println("cid: " + cid);
|
||||
}
|
||||
|
||||
InputStream input = urlconn.getInputStream();
|
||||
buflen = input.available();
|
||||
|
||||
if( buflen > 0){
|
||||
ByteArrayOutputStream tmpstream = new ByteArrayOutputStream();
|
||||
byte[] buf = new byte[ 1024];
|
||||
|
||||
System.err.println("reading jpipstream...");
|
||||
|
||||
int redlen;
|
||||
do{
|
||||
redlen = input.read( buf);
|
||||
|
||||
if( redlen == -1)
|
||||
break;
|
||||
tmpstream.write( buf, 0, redlen);
|
||||
}while( redlen > 0);
|
||||
|
||||
buflen = tmpstream.size();
|
||||
|
||||
jpipstream = tmpstream.toByteArray();
|
||||
|
||||
tmpstream = null;
|
||||
|
||||
System.err.println("jpiplen: " + buflen);
|
||||
System.err.println(" succeeded");
|
||||
}
|
||||
else{
|
||||
System.err.println("No new jpipstream");
|
||||
}
|
||||
input.close();
|
||||
}
|
||||
catch ( MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch ( ProtocolException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch( ClassCastException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch( NullPointerException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch( UnknownServiceException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch ( IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
urlconn.disconnect();
|
||||
|
||||
return jpipstream;
|
||||
}
|
||||
|
||||
private String const_urlstring( String target,
|
||||
int reqfw, int reqfh,
|
||||
int reqrx, int reqry,
|
||||
int reqrw, int reqrh,
|
||||
String reqcid, boolean reqcnew)
|
||||
{
|
||||
String urlstring = comURL;
|
||||
|
||||
// C.7.3 Image Return Type
|
||||
// add type=jpp-stream(;ptype=ext) or type=jpt-stream;ttype=ext
|
||||
|
||||
if( target != null){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "target=" + target);
|
||||
}
|
||||
if( reqfw != -1 && reqfh != -1){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "fsiz=" + reqfw + "," + reqfh);
|
||||
}
|
||||
if( reqrx != -1 && reqry != -1){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "roff=" + reqrx + "," + reqry);
|
||||
}
|
||||
if( reqrw != -1 && reqrh != -1){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "rsiz=" + reqrw + "," + reqrh);
|
||||
}
|
||||
if( reqcid != null){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "cid=" + reqcid);
|
||||
}
|
||||
if( reqcnew){
|
||||
if( !urlstring.endsWith("?"))
|
||||
urlstring = urlstring.concat( "&");
|
||||
urlstring = urlstring.concat( "cnew=http");
|
||||
}
|
||||
return urlstring;
|
||||
}
|
||||
|
||||
public void closeChannel()
|
||||
{
|
||||
if( cid == null)
|
||||
return;
|
||||
|
||||
try{
|
||||
URL url = new URL( comURL + "cclose=" + cid);
|
||||
System.err.println( "closing cid: " + cid);
|
||||
|
||||
HttpURLConnection urlconn = (HttpURLConnection)url.openConnection();
|
||||
urlconn.setRequestMethod("GET");
|
||||
urlconn.setInstanceFollowRedirects(false);
|
||||
urlconn.connect();
|
||||
|
||||
Map headers = urlconn.getHeaderFields();
|
||||
|
||||
urlconn.disconnect();
|
||||
} catch ( MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
} catch ( IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<project name="opj_viewer_xerces" default="dist" basedir=".">
|
||||
<description>OpenJPIP client image viewer</description>
|
||||
<property name="src" location="src" />
|
||||
<property name="build" location="build"/>
|
||||
<property name="dist" location="dist" />
|
||||
|
||||
<target name="init">
|
||||
<tstamp/>
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src}" destdir="${build}"/>
|
||||
</target>
|
||||
<target name="dist" depends="compile">
|
||||
<mkdir dir="${dist}"/>
|
||||
<jar jarfile="${dist}/opj_viewer_xerces-${DSTAMP}.jar"
|
||||
basedir="${build}" manifest="${dist}/manifest.txt"/>
|
||||
<exec dir="${dist}" executable="ln">
|
||||
<arg line="-sf opj_viewer_xerces-${DSTAMP}.jar opj_viewer_xerces.jar"/>
|
||||
</exec>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${build}"/>
|
||||
<delete dir="${dist}"/>
|
||||
</target>
|
||||
<target name="test" depends="dist">
|
||||
<exec executable="appletviewer"><arg line="dist.html"/></exec>
|
||||
</target>
|
||||
<target name="build_test" depends="compile">
|
||||
<exec executable="appletviewer"><arg line="compile.html"/></exec>
|
||||
</target>
|
||||
<target name="build_testj" depends="compile">
|
||||
<exec executable="java"><arg line="-classpath build ImageWindow girl"/></exec>
|
||||
</target>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
opj_viewer_xerces-20110711.jar
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/ImageManager.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/ImgdecClient.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/JPIPHttpClient.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/MML.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/PnmImage.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/RegimViewer.java
|
||||
@@ -1 +0,0 @@
|
||||
../../opj_viewer/src/ResizeListener.java
|
||||
@@ -1,25 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = opj_server
|
||||
|
||||
opj_server_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/opj_server \
|
||||
-I$(top_builddir)/applications/jpip/opj_server \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
@FCGI_CFLAGS@ \
|
||||
-DSERVER
|
||||
opj_server_CFLAGS =
|
||||
opj_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la @FCGI_LIBS@ -lm
|
||||
opj_server_SOURCES = \
|
||||
channel_manager.c \
|
||||
opj_server.c \
|
||||
query_parser.c \
|
||||
session_manager.c \
|
||||
channel_manager.h \
|
||||
query_parser.h \
|
||||
session_manager.h
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@@ -1,14 +0,0 @@
|
||||
LIBDIR = ../libopenjpip
|
||||
LIBFNAME = $(LIBDIR)/libopenjpip_server.a
|
||||
CFLAGS = -O3 -Wall -m32 -DSERVER -I$(LIBDIR)
|
||||
LDFLAGS = -L$(LIBDIR) -lm -lfcgi -lopenjpip_server
|
||||
|
||||
ALL = opj_server
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
opj_server: opj_server.o query_parser.o channel_manager.o session_manager.o $(LIBFNAME)
|
||||
$(CC) $(CFLAGS) $< query_parser.o channel_manager.o session_manager.o $(LDFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) *.o *~
|
||||
@@ -1,432 +0,0 @@
|
||||
/*
|
||||
* $Id: opj_server.c 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief opj_server is a JPIP server program, which supports HTTP connection, JPT-stream, session, channels, and cache model managements.
|
||||
*
|
||||
* \section req Requirements
|
||||
* FastCGI development kit (http://www.fastcgi.com).
|
||||
*
|
||||
* \section impinst Implementing instructions
|
||||
* Launch opj_server from the server terminal:\n
|
||||
* % spawn-fcgi -f ./opj_server -p 3000 -n
|
||||
*
|
||||
* Note: JP2 files are stored in the working directory of opj_server\n
|
||||
* Check README for the JP2 Encoding\n
|
||||
*
|
||||
* We tested this software with a virtual server running on the same Linux machine as the clients.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "query_parser.h"
|
||||
#include "channel_manager.h"
|
||||
#include "session_manager.h"
|
||||
#include "target_manager.h"
|
||||
#include "imgreg_manager.h"
|
||||
#include "msgqueue_manager.h"
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
/**
|
||||
* parse JPIP request
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] sessionlist session list pointer
|
||||
* @param[in,out] msgqueue address of the message queue pointer
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool parse_JPIPrequest( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
msgqueue_param_t **msgqueue);
|
||||
|
||||
|
||||
/**
|
||||
* REQUEST: channel association
|
||||
* this must be processed before any process
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] sessionlist session list pointer
|
||||
* @param[out] cursession address of the associated session pointer
|
||||
* @param[out] curchannel address of the associated channel pointer
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool associate_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel);
|
||||
/**
|
||||
* REQUEST: new channel (cnew) assignment
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] sessionlist session list pointer
|
||||
* @param[in,out] cursession address of the associated/opened session pointer
|
||||
* @param[in,out] curchannel address of the associated/opened channel pointer
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool open_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel);
|
||||
|
||||
/**
|
||||
* REQUEST: channel close (cclose)
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] sessionlist session list pointer
|
||||
* @param[in,out] cursession address of the session pointer of deleting channel
|
||||
* @param[in,out] curchannel address of the deleting channel pointer
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool close_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel);
|
||||
|
||||
/**
|
||||
* REQUEST: view-window (fsiz)
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in,out] cursession associated session pointer
|
||||
* @param[in,out] curchannel associated channel pointer
|
||||
* @param[in,out] msgqueue address of the message queue pointer
|
||||
* @return if succeeded (true) or failed (false)
|
||||
*/
|
||||
bool gene_JPTstream( query_param_t query_param,
|
||||
session_param_t *cursession,
|
||||
channel_param_t *curchannel,
|
||||
msgqueue_param_t **msgqueue);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
sessionlist_param_t *sessionlist;
|
||||
bool parse_status;
|
||||
|
||||
sessionlist = gene_sessionlist();
|
||||
|
||||
#ifdef SERVER
|
||||
|
||||
char *query_string;
|
||||
while(FCGI_Accept() >= 0)
|
||||
#else
|
||||
|
||||
char query_string[128];
|
||||
while((fgets( query_string, 128, stdin))[0] != '\n' )
|
||||
#endif
|
||||
{
|
||||
|
||||
#ifdef SERVER
|
||||
query_string = getenv("QUERY_STRING");
|
||||
#endif //SERVER
|
||||
|
||||
fprintf( FCGI_stdout, "Content-type: image/jpt-stream\r\n");
|
||||
|
||||
query_param_t query_param;
|
||||
msgqueue_param_t *msgqueue;
|
||||
|
||||
parse_query( query_string, &query_param);
|
||||
|
||||
#ifndef SERVER
|
||||
print_queryparam( query_param);
|
||||
#endif
|
||||
|
||||
msgqueue = NULL;
|
||||
parse_status = parse_JPIPrequest( query_param, sessionlist, &msgqueue);
|
||||
|
||||
|
||||
fprintf( FCGI_stdout, "\r\n");
|
||||
|
||||
#ifndef SERVER
|
||||
// if( parse_status)
|
||||
// print_allsession( sessionlist);
|
||||
print_msgqueue( msgqueue);
|
||||
#endif
|
||||
emit_stream_from_msgqueue( msgqueue);
|
||||
|
||||
delete_msgqueue( &msgqueue);
|
||||
}
|
||||
delete_sessionlist( &sessionlist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool parse_JPIPrequest( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
msgqueue_param_t **msgqueue)
|
||||
{
|
||||
session_param_t *cursession = NULL;
|
||||
channel_param_t *curchannel = NULL;
|
||||
|
||||
if( query_param.cid[0] != '\0')
|
||||
if( !associate_channel( query_param, sessionlist, &cursession, &curchannel))
|
||||
return false;
|
||||
|
||||
if( query_param.cnew){
|
||||
if( !open_channel( query_param, sessionlist, &cursession, &curchannel))
|
||||
return false;
|
||||
}
|
||||
if( query_param.cclose[0][0] != '\0')
|
||||
if( !close_channel( query_param, sessionlist, &cursession, &curchannel))
|
||||
return false;
|
||||
|
||||
if( (query_param.fx > 0 && query_param.fy > 0) || query_param.box_type[0][0] != 0)
|
||||
if( !gene_JPTstream( query_param, cursession, curchannel, msgqueue))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool associate_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel)
|
||||
{
|
||||
if( search_session_and_channel( query_param.cid, sessionlist, cursession, curchannel)){
|
||||
|
||||
if( !query_param.cnew)
|
||||
set_channel_variable_param( query_param, *curchannel);
|
||||
}
|
||||
else{
|
||||
fprintf( FCGI_stderr, "Error: process canceled\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool open_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel)
|
||||
{
|
||||
target_param_t *target=NULL;
|
||||
|
||||
if( query_param.target[0] !='\0'){ // target query specified
|
||||
if( *cursession){
|
||||
if( !( target = search_target( query_param.target, (*cursession)->targetlist))){
|
||||
if((target = gene_target( query_param.target)))
|
||||
insert_target_into_session( *cursession, target);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if((target = gene_target( query_param.target))){
|
||||
// new session
|
||||
*cursession = gene_session( sessionlist);
|
||||
insert_target_into_session( *cursession, target);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if( *cursession)
|
||||
target = (*curchannel)->target;
|
||||
}
|
||||
|
||||
*curchannel = gene_channel( query_param, target, (*cursession)->channellist);
|
||||
if( *curchannel == NULL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool close_channel( query_param_t query_param,
|
||||
sessionlist_param_t *sessionlist,
|
||||
session_param_t **cursession,
|
||||
channel_param_t **curchannel)
|
||||
{
|
||||
if( query_param.cclose[0][0] =='*'){
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: close all\n");
|
||||
#endif
|
||||
// all channels associatd with the session will be closed
|
||||
if( !delete_session( cursession, sessionlist))
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
// check if all entry belonging to the same session
|
||||
int i=0;
|
||||
while( query_param.cclose[i][0] !='\0'){
|
||||
|
||||
// In case of the first entry of close cid
|
||||
if( *cursession == NULL){
|
||||
if( !search_session_and_channel( query_param.cclose[i], sessionlist, cursession, curchannel))
|
||||
return false;
|
||||
}
|
||||
else // second or more entry of close cid
|
||||
if( !(*curchannel=search_channel( query_param.cclose[i], (*cursession)->channellist))){
|
||||
fprintf( FCGI_stdout, "Reason: Cclose id %s is from another session\r\n", query_param.cclose[i]);
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
// delete channels
|
||||
i=0;
|
||||
while( query_param.cclose[i][0] !='\0'){
|
||||
|
||||
*curchannel = search_channel( query_param.cclose[i], (*cursession)->channellist);
|
||||
delete_channel( curchannel, (*cursession)->channellist);
|
||||
i++;
|
||||
}
|
||||
|
||||
if( (*cursession)->channellist->first == NULL || (*cursession)->channellist->last == NULL)
|
||||
// In case of empty session
|
||||
delete_session( cursession, sessionlist);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* enqueue tiles into the message queue
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] codeidx pointer to index parameters
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void enqueue_tiles( query_param_t query_param, index_param_t *codeidx, msgqueue_param_t *msgqueue);
|
||||
|
||||
/**
|
||||
* enqueue metadata bins into the message queue
|
||||
*
|
||||
* @param[in] query_param structured query
|
||||
* @param[in] metadatalist pointer to metadata bin list
|
||||
* @param[in,out] msgqueue message queue pointer
|
||||
*/
|
||||
void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
|
||||
|
||||
|
||||
bool gene_JPTstream( query_param_t query_param,
|
||||
session_param_t *cursession,
|
||||
channel_param_t *curchannel,
|
||||
msgqueue_param_t **msgqueue)
|
||||
{
|
||||
target_param_t *target;
|
||||
index_param_t *codeidx;
|
||||
|
||||
if( !cursession || !curchannel){ // stateless
|
||||
if((target = gene_target( query_param.target)))
|
||||
*msgqueue = gene_msgqueue( true, target);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else{ // session
|
||||
target = curchannel->target;
|
||||
*msgqueue = gene_msgqueue( false, target);
|
||||
}
|
||||
|
||||
codeidx = target->codeidx;
|
||||
|
||||
//meta
|
||||
if( query_param.box_type[0][0] != 0)
|
||||
enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue);
|
||||
|
||||
// image code
|
||||
if( query_param.fx > 0 && query_param.fy > 0){
|
||||
if( !codeidx->mhead_model)
|
||||
enqueue_mainheader( *msgqueue);
|
||||
enqueue_tiles( query_param, codeidx, *msgqueue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void enqueue_tiles( query_param_t query_param, index_param_t *codeidx, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
imgreg_param_t imgreg;
|
||||
range_param_t tile_Xrange, tile_Yrange;
|
||||
int u, v, tile_id;
|
||||
|
||||
imgreg = map_viewin2imgreg( query_param.fx, query_param.fy,
|
||||
query_param.rx, query_param.ry, query_param.rw, query_param.rh,
|
||||
codeidx->XOsiz, codeidx->YOsiz, codeidx->Xsiz, codeidx->Ysiz,
|
||||
get_nmax( codeidx->tilepart));
|
||||
|
||||
|
||||
for( u=0, tile_id=0; u<codeidx->YTnum; u++){
|
||||
tile_Yrange = get_tile_Yrange( *codeidx, u, imgreg.level);
|
||||
|
||||
for( v=0; v<codeidx->XTnum; v++, tile_id++){
|
||||
tile_Xrange = get_tile_Xrange( *codeidx, v, imgreg.level);
|
||||
|
||||
if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){
|
||||
if( tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox ||
|
||||
tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox + imgreg.sx ||
|
||||
tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy ||
|
||||
tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy + imgreg.sy) {
|
||||
//printf("Tile completely excluded from view-window %d\n", tile_id);
|
||||
// Tile completely excluded from view-window
|
||||
}
|
||||
else if( tile_Xrange.minvalue >= imgreg.xosiz + imgreg.ox &&
|
||||
tile_Xrange.maxvalue <= imgreg.xosiz + imgreg.ox + imgreg.sx &&
|
||||
tile_Yrange.minvalue >= imgreg.yosiz + imgreg.oy &&
|
||||
tile_Yrange.maxvalue <= imgreg.yosiz + imgreg.oy + imgreg.sy) {
|
||||
// Tile completely contained within view-window
|
||||
// high priority
|
||||
//printf("Tile completely contained within view-window %d\n", tile_id);
|
||||
enqueue_tile( tile_id, imgreg.level, msgqueue);
|
||||
}
|
||||
else{
|
||||
// Tile partially overlaps view-window
|
||||
// low priority
|
||||
//printf("Tile partially overlaps view-window %d\n", tile_id);
|
||||
enqueue_tile( tile_id, imgreg.level, msgqueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
|
||||
{
|
||||
int i;
|
||||
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
|
||||
if( query_param.box_type[i][0] == '*'){
|
||||
// not implemented
|
||||
}
|
||||
else{
|
||||
int idx = search_metadataidx( query_param.box_type[i], metadatalist);
|
||||
|
||||
if( idx != -1)
|
||||
enqueue_metadata( idx, msgqueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
* $Id: query_parser.c 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "query_parser.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
|
||||
/**
|
||||
* initialize query parameters
|
||||
*
|
||||
* @param[in,out] query_param query parameters
|
||||
*/
|
||||
void init_queryparam( query_param_t *query_param);
|
||||
|
||||
/*
|
||||
* get a pair of field name and value from the string starting fieldname=fieldval&... format
|
||||
*
|
||||
* @param[in] stringptr pointer to the beginning of the parsing string
|
||||
* @param[out] fieldname string to copy the field name, if not found, NULL
|
||||
* @param[out] fieldval string to copy the field value, if not found, NULL
|
||||
* @return pointer to the next field string, if there is none, NULL
|
||||
*/
|
||||
char * get_fieldparam( char *stringptr, char *fieldname, char *fieldval);
|
||||
|
||||
/**
|
||||
* parse string to string array
|
||||
*
|
||||
* @param[in] src src string
|
||||
* @param[out] cclose parsed string array
|
||||
*/
|
||||
void str2cclose( char *src, char cclose[][MAX_LENOFCID]);
|
||||
|
||||
void parse_metareq( char *field, query_param_t *query_param);
|
||||
|
||||
//! maximum length of field name
|
||||
#define MAX_LENOFFIELDNAME 10
|
||||
|
||||
//! maximum length of field value
|
||||
#define MAX_LENOFFIELDVAL 128
|
||||
|
||||
void parse_query( char *query_string, query_param_t *query_param)
|
||||
{
|
||||
char *pquery, fieldname[MAX_LENOFFIELDNAME], fieldval[MAX_LENOFFIELDVAL];
|
||||
|
||||
init_queryparam( query_param);
|
||||
|
||||
pquery = query_string;
|
||||
|
||||
while( pquery!=NULL) {
|
||||
|
||||
pquery = get_fieldparam( pquery, fieldname, fieldval);
|
||||
|
||||
if( fieldname[0] != '\0'){
|
||||
if( strcasecmp( fieldname, "target") == 0)
|
||||
strcpy( query_param->target,fieldval);
|
||||
|
||||
else if( strcasecmp( fieldname, "fsiz") == 0)
|
||||
sscanf( fieldval, "%d,%d", &query_param->fx, &query_param->fy);
|
||||
|
||||
else if( strcasecmp( fieldname, "roff") == 0)
|
||||
sscanf( fieldval, "%d,%d", &query_param->rx, &query_param->ry);
|
||||
|
||||
else if( strcasecmp( fieldname, "rsiz") == 0)
|
||||
sscanf( fieldval, "%d,%d", &query_param->rw, &query_param->rh);
|
||||
|
||||
else if( strcasecmp( fieldname, "cid") == 0)
|
||||
strcpy( query_param->cid, fieldval);
|
||||
|
||||
else if( strcasecmp( fieldname, "cnew") == 0)
|
||||
query_param->cnew = true;
|
||||
|
||||
else if( strcasecmp( fieldname, "cclose") == 0)
|
||||
str2cclose( fieldval, query_param->cclose);
|
||||
|
||||
else if( strcasecmp( fieldname, "metareq") == 0)
|
||||
parse_metareq( fieldval, query_param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_queryparam( query_param_t *query_param)
|
||||
{
|
||||
int i;
|
||||
|
||||
query_param->target[0]='\0';
|
||||
query_param->fx=-1;
|
||||
query_param->fy=-1;
|
||||
query_param->rx=-1;
|
||||
query_param->ry=-1;
|
||||
query_param->rw=-1;
|
||||
query_param->rh=-1;
|
||||
query_param->cid[0]='\0';
|
||||
query_param->cnew=false;
|
||||
memset( query_param->cclose, 0, MAX_NUMOFCCLOSE*MAX_LENOFCID);
|
||||
memset( query_param->box_type, 0, MAX_NUMOFBOX*4);
|
||||
memset( query_param->limit, 0, MAX_NUMOFBOX*sizeof(int));
|
||||
for( i=0; i<MAX_NUMOFBOX; i++){
|
||||
query_param->w[i] = false;
|
||||
query_param->s[i] = false;
|
||||
query_param->g[i] = false;
|
||||
query_param->a[i] = false;
|
||||
query_param->priority[i] = false;
|
||||
}
|
||||
query_param->root_bin = 0;
|
||||
query_param->max_depth = -1;
|
||||
query_param->metadata_only = false;
|
||||
}
|
||||
|
||||
|
||||
char * get_fieldparam( char *stringptr, char *fieldname, char *fieldval)
|
||||
{
|
||||
char *eqp, *andp, *nexfieldptr;
|
||||
|
||||
if((eqp = strchr( stringptr, '='))==NULL){
|
||||
fprintf( stderr, "= not found\n");
|
||||
strcpy( fieldname, "");
|
||||
strcpy( fieldval, "");
|
||||
return NULL;
|
||||
}
|
||||
if((andp = strchr( stringptr, '&'))==NULL){
|
||||
andp = strchr( stringptr, '\0');
|
||||
nexfieldptr = NULL;
|
||||
}
|
||||
else
|
||||
nexfieldptr = andp+1;
|
||||
|
||||
strncpy( fieldname, stringptr, eqp-stringptr);
|
||||
fieldname[eqp-stringptr]='\0';
|
||||
strncpy( fieldval, eqp+1, andp-eqp-1);
|
||||
fieldval[andp-eqp-1]='\0';
|
||||
|
||||
return nexfieldptr;
|
||||
}
|
||||
|
||||
void print_queryparam( query_param_t query_param)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf( logstream, "query parameters:\n");
|
||||
fprintf( logstream, "\t target: %s\n", query_param.target);
|
||||
fprintf( logstream, "\t fx,fy: %d, %d\n", query_param.fx, query_param.fy);
|
||||
fprintf( logstream, "\t rx,ry: %d, %d \t rw,rh: %d, %d\n", query_param.rx, query_param.ry, query_param.rw, query_param.rh);
|
||||
fprintf( logstream, "\t cnew: %d\n", query_param.cnew);
|
||||
fprintf( logstream, "\t cid: %s\n", query_param.cid);
|
||||
|
||||
fprintf( logstream, "\t cclose: ");
|
||||
for( i=0; query_param.cclose[i][0]!=0 && i<MAX_NUMOFCCLOSE; i++)
|
||||
fprintf( logstream, "%s ", query_param.cclose[i]);
|
||||
fprintf(logstream, "\n");
|
||||
|
||||
fprintf( logstream, "\t req-box-prop\n");
|
||||
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
|
||||
fprintf( logstream, "\t\t box_type: %.4s limit: %d w:%d s:%d g:%d a:%d priority:%d\n", query_param.box_type[i], query_param.limit[i], query_param.w[i], query_param.s[i], query_param.g[i], query_param.a[i], query_param.priority[i]);
|
||||
}
|
||||
|
||||
fprintf( logstream, "\t root-bin: %d\n", query_param.root_bin);
|
||||
fprintf( logstream, "\t max-depth: %d\n", query_param.max_depth);
|
||||
fprintf( logstream, "\t metadata-only: %d\n", query_param.metadata_only);
|
||||
}
|
||||
|
||||
void str2cclose( char *src, char cclose[][MAX_LENOFCID])
|
||||
{
|
||||
int i, u, v;
|
||||
|
||||
size_t len = strlen( src);
|
||||
|
||||
for( i=0, u=0, v=0; i<len; i++){
|
||||
if( src[i]==','){
|
||||
u++;
|
||||
v=0;
|
||||
}
|
||||
else
|
||||
cclose[u][v++] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param);
|
||||
|
||||
void parse_metareq( char *field, query_param_t *query_param)
|
||||
{
|
||||
char req_box_prop[20];
|
||||
char *ptr, *src;
|
||||
int numofboxreq = 0;
|
||||
|
||||
memset( req_box_prop, 0, 20);
|
||||
|
||||
// req-box-prop
|
||||
ptr = strchr( field, '[');
|
||||
ptr++;
|
||||
src = ptr;
|
||||
while( *ptr != ']'){
|
||||
if( *ptr == ';'){
|
||||
strncpy( req_box_prop, src, ptr-src);
|
||||
parse_req_box_prop( req_box_prop, numofboxreq++, query_param);
|
||||
ptr++;
|
||||
src = ptr;
|
||||
memset( req_box_prop, 0, 20);
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
strncpy( req_box_prop, src, ptr-src);
|
||||
|
||||
parse_req_box_prop( req_box_prop, numofboxreq++, query_param);
|
||||
|
||||
if(( ptr = strchr( field, 'R')))
|
||||
sscanf( ptr+1, "%d", &(query_param->root_bin));
|
||||
|
||||
if(( ptr = strchr( field, 'D')))
|
||||
sscanf( ptr+1, "%d", &(query_param->max_depth));
|
||||
|
||||
if(( ptr = strstr( field, "!!")))
|
||||
query_param->metadata_only = true;
|
||||
}
|
||||
|
||||
void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
if( *req_box_prop == '*')
|
||||
query_param->box_type[idx][0]='*';
|
||||
else
|
||||
strncpy( query_param->box_type[idx], req_box_prop, 4);
|
||||
|
||||
if(( ptr = strchr( req_box_prop, ':'))){
|
||||
if( *(ptr+1)=='r')
|
||||
query_param->limit[idx] = -1;
|
||||
else
|
||||
sscanf( ptr+1, "%d", &(query_param->limit[idx]));
|
||||
}
|
||||
|
||||
if(( ptr = strchr( req_box_prop, '/'))){
|
||||
ptr++;
|
||||
while( *ptr=='w' || *ptr=='s' || *ptr=='g' || *ptr=='a'){
|
||||
switch( *ptr){
|
||||
case 'w': query_param->w[idx] = true; break;
|
||||
case 's': query_param->s[idx] = true; break;
|
||||
case 'g': query_param->g[idx] = true; break;
|
||||
case 'a': query_param->a[idx] = true; break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
query_param->g[idx] = true;
|
||||
query_param->s[idx] = true;
|
||||
query_param->w[idx] = true;
|
||||
}
|
||||
|
||||
if((ptr = strchr( req_box_prop, '!')))
|
||||
query_param->priority[idx] = true;
|
||||
|
||||
idx++;
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* $Id: query_parser.h 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef QUERY_PARSER_H_
|
||||
# define QUERY_PARSER_H_
|
||||
|
||||
#include "bool.h"
|
||||
|
||||
//! maximum length of target name
|
||||
#define MAX_LENOFTARGET 128
|
||||
|
||||
//! maximum length of channel identifier
|
||||
#define MAX_LENOFCID 30
|
||||
|
||||
//! maximum number of closing channel
|
||||
#define MAX_NUMOFCCLOSE 10
|
||||
|
||||
//! maximum number of meta request box
|
||||
#define MAX_NUMOFBOX 10
|
||||
|
||||
//! Query parameters
|
||||
typedef struct query_param{
|
||||
char target[MAX_LENOFTARGET]; //!< target name
|
||||
int fx, fy; //!< frame size (fx,fy)
|
||||
int rx, ry, rw, rh; //!< roi region
|
||||
char cid[MAX_LENOFCID]; //!< channel identifier
|
||||
bool cnew; //!< if there is new channel request(true) or not (false)
|
||||
char cclose[MAX_NUMOFCCLOSE][MAX_LENOFCID]; //!< closing channel identifiers
|
||||
char box_type[MAX_NUMOFBOX][4]; //!< interested box-types
|
||||
int limit[MAX_NUMOFBOX]; //!< limit value, -1: skeleton request "r", 0: entire contents
|
||||
bool w[MAX_NUMOFBOX]; //!< Metadata request qualifier flags
|
||||
bool s[MAX_NUMOFBOX];
|
||||
bool g[MAX_NUMOFBOX];
|
||||
bool a[MAX_NUMOFBOX];
|
||||
bool priority[MAX_NUMOFBOX]; //!< priority flag
|
||||
int root_bin; //!< root-bin
|
||||
int max_depth; //!< max-depth
|
||||
bool metadata_only; //!< metadata-only request
|
||||
} query_param_t;
|
||||
|
||||
|
||||
/**
|
||||
* parse query
|
||||
*
|
||||
* @param[in] query_string request query string
|
||||
* @param[out] query_param query parameters
|
||||
*/
|
||||
void parse_query( char *query_string, query_param_t *query_param);
|
||||
|
||||
/**
|
||||
* print query parameters
|
||||
*
|
||||
* @param[in] query_param query parameters
|
||||
*/
|
||||
void print_queryparam( query_param_t query_param);
|
||||
|
||||
#endif /* !QUERY_PARSER_H_ */
|
||||
@@ -1,49 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = indexer
|
||||
|
||||
bin_PROGRAMS = jpip_to_jp2 jpip_to_j2k test_index addXMLinJP2
|
||||
|
||||
jpip_to_jp2_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip/tools
|
||||
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 \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip/tools
|
||||
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 \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip/tools
|
||||
test_index_CFLAGS =
|
||||
test_index_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
||||
test_index_SOURCES = test_index.c
|
||||
|
||||
addXMLinJP2_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip/tools
|
||||
addXMLinJP2_CFLAGS =
|
||||
addXMLinJP2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
|
||||
addXMLinJP2_SOURCES = addXMLinJP2.c
|
||||
|
||||
install-data-hook:
|
||||
@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
|
||||
@echo -e " (B)\t$(bindir)/addXMLinJP2$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@@ -1,24 +0,0 @@
|
||||
LIBDIR = ../libopenjpip
|
||||
LIBFNAME = $(LIBDIR)/libopenjpip_local.a
|
||||
CFLAGS = -O3 -Wall -I$(LIBDIR)
|
||||
LDFLAGS = -L$(LIBDIR) -lm -lopenjpip_local
|
||||
|
||||
ALL = jpip_to_jp2 jpip_to_j2k test_index addXMLinJP2
|
||||
|
||||
all: t_indexer $(ALL)
|
||||
|
||||
t_indexer:
|
||||
make -C indexer -f Makefile.nix
|
||||
|
||||
jpip_to_jp2: jpip_to_jp2.o $(LIBFNAME)
|
||||
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
||||
|
||||
jpip_to_j2k: jpip_to_j2k.o $(LIBFNAME)
|
||||
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
||||
|
||||
test_index: test_index.o $(LIBFNAME)
|
||||
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) *.o *~
|
||||
make clean -C indexer -f Makefile.nix
|
||||
@@ -1,34 +0,0 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = index_create
|
||||
|
||||
index_create_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/libopenjpip/tools/indexer \
|
||||
-I$(top_builddir)/applications/libopenjpip/tools/indexer
|
||||
index_create_CFLAGS =
|
||||
index_create_LDADD = -lm
|
||||
index_create_SOURCES = \
|
||||
bio.c \
|
||||
bio.h \
|
||||
cio.c \
|
||||
cio.h \
|
||||
index_create.c \
|
||||
int.c \
|
||||
int.h \
|
||||
j2k.h \
|
||||
jp2.c \
|
||||
jp2.h \
|
||||
jpip.c \
|
||||
jpip.h \
|
||||
pi.c \
|
||||
pi.h \
|
||||
t2.c \
|
||||
t2.h \
|
||||
tcd.c \
|
||||
tcd.h \
|
||||
tgt.c \
|
||||
tgt.h
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/index_create$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@@ -1,23 +0,0 @@
|
||||
CC = gcc
|
||||
|
||||
LDFLAGS = -lm
|
||||
CFLAGS = -Wall
|
||||
|
||||
all: index_create
|
||||
|
||||
|
||||
bio.o : bio.c bio.h
|
||||
cio.o : cio.c cio.h
|
||||
int.o : int.c
|
||||
pi.o : pi.c pi.h int.h
|
||||
index_create.o : index_create.c j2k.h cio.h tcd.h int.h
|
||||
t2.o : t2.c t2.h tcd.h bio.h j2k.h pi.h tgt.h int.h cio.h
|
||||
tgt.o : tgt.c bio.h tgt.h
|
||||
tcd.o : tcd.c tcd.h t2.h int.h
|
||||
jpip.o : jpip.c j2k.h cio.h tcd.h int.h
|
||||
jp2.o : jp2.c j2k.h cio.h tcd.h int.h
|
||||
|
||||
index_create : bio.o cio.o int.o pi.o t2.o tgt.o tcd.o index_create.o jpip.o jp2.o
|
||||
|
||||
clean:
|
||||
rm -rf index_create *.o *.*~ *~ core.*
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "bio.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
static unsigned char *bio_start, *bio_end, *bio_bp;
|
||||
static unsigned int bio_buf;
|
||||
static int bio_ct;
|
||||
|
||||
extern jmp_buf j2k_error;
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes written.
|
||||
/// </summary>
|
||||
int bio_numbytes() {
|
||||
return bio_bp-bio_start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init decoder.
|
||||
/// </summary>
|
||||
/// <param name="bp">Input buffer</param>
|
||||
/// <param name="len">Input buffer length</param>
|
||||
void bio_init_dec(unsigned char *bp, int len) {
|
||||
bio_start=bp;
|
||||
bio_end=bp+len;
|
||||
bio_bp=bp;
|
||||
bio_buf=0;
|
||||
bio_ct=0;
|
||||
}
|
||||
|
||||
int bio_byteout()
|
||||
{
|
||||
bio_buf = (bio_buf << 8) & 0xffff;
|
||||
bio_ct = bio_buf == 0xff00 ? 7 : 8;
|
||||
if (bio_bp >= bio_end)
|
||||
return 1;
|
||||
*bio_bp++ = bio_buf >> 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read byte.
|
||||
/// </summary>
|
||||
int bio_bytein() {
|
||||
bio_buf=(bio_buf<<8)&0xffff;
|
||||
bio_ct=bio_buf==0xff00?7:8;
|
||||
if (bio_bp>=bio_end) return 1; //longjmp(j2k_error, 1);
|
||||
bio_buf|=*bio_bp++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read bit.
|
||||
/// </summary>
|
||||
int bio_getbit() {
|
||||
if (bio_ct==0) {
|
||||
bio_bytein();
|
||||
}
|
||||
bio_ct--;
|
||||
return (bio_buf>>bio_ct)&1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read bits.
|
||||
/// </summary>
|
||||
/// <param name="n">Number of bits to read</param>
|
||||
int bio_read(int n) {
|
||||
int i, v;
|
||||
v=0;
|
||||
for (i=n-1; i>=0; i--) {
|
||||
v+=bio_getbit()<<i;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flush bits.
|
||||
/// </summary>
|
||||
int bio_flush() {
|
||||
bio_ct=0;
|
||||
bio_byteout();
|
||||
if (bio_ct==7) {
|
||||
bio_ct=0;
|
||||
if ( bio_byteout()) return 1;;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
int bio_inalign() {
|
||||
bio_ct=0;
|
||||
if ((bio_buf&0xff)==0xff) {
|
||||
if( bio_bytein()) return 1;
|
||||
bio_ct=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "cio.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
static unsigned char *cio_start, *cio_end, *cio_bp;
|
||||
|
||||
extern jmp_buf j2k_error;
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes written.
|
||||
/// </summary>
|
||||
int cio_numbytes() {
|
||||
return cio_bp-cio_start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get position in byte stream.
|
||||
/// </summary>
|
||||
int cio_tell() {
|
||||
return cio_bp-cio_start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set position in byte stream.
|
||||
/// </summary>
|
||||
void cio_seek(int pos) {
|
||||
cio_bp=cio_start+pos;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes left before the end of the stream.
|
||||
/// </summary>
|
||||
int cio_numbytesleft() {
|
||||
return cio_end-cio_bp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get pointer to the current position in the stream.
|
||||
/// </summary>
|
||||
unsigned char *cio_getbp() {
|
||||
return cio_bp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize byte IO.
|
||||
/// </summary>
|
||||
void cio_init(unsigned char *bp, int len) {
|
||||
cio_start=bp;
|
||||
cio_end=bp+len;
|
||||
cio_bp=bp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a byte.
|
||||
/// </summary>
|
||||
void cio_byteout(unsigned char v) {
|
||||
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
|
||||
*cio_bp++=v;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a byte.
|
||||
/// </summary>
|
||||
unsigned char cio_bytein() {
|
||||
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
|
||||
return *cio_bp++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a byte.
|
||||
/// </summary>
|
||||
//void cio_write(unsigned int v, int n) {
|
||||
void cio_write(long long v, int n) {
|
||||
int i;
|
||||
for (i=n-1; i>=0; i--)
|
||||
{
|
||||
cio_byteout((unsigned char)((v>>(i<<3))&0xff));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read some bytes.
|
||||
/// </summary>
|
||||
/* unsigned int cio_read(int n) { */
|
||||
long long cio_read(int n) {
|
||||
int i;
|
||||
/*unsigned int v;*/
|
||||
long long v;
|
||||
v=0;
|
||||
for (i=n-1; i>=0; i--) {
|
||||
v+=cio_bytein()<<(i<<3);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write some bytes.
|
||||
/// </summary>
|
||||
void cio_skip(int n) {
|
||||
cio_bp+=n;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Get the minimum of two integers.
|
||||
/// </summary>
|
||||
int int_min(int a, int b) {
|
||||
return a<b?a:b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the maximum of two integers.
|
||||
/// </summary>
|
||||
int int_max(int a, int b) {
|
||||
return a>b?a:b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamp an integer inside an interval.
|
||||
/// </summary>
|
||||
int int_clamp(int a, int min, int max) {
|
||||
if (a<min) return min;
|
||||
if (a>max) return max;
|
||||
return a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get absolute value of integer.
|
||||
/// </summary>
|
||||
int int_abs(int a) {
|
||||
return a<0?-a:a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Divide an integer and round upwards.
|
||||
/// </summary>
|
||||
int int_ceildiv(int a, int b) {
|
||||
return (a+b-1)/b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Divide an integer by a power of 2 and round upwards.
|
||||
/// </summary>
|
||||
int int_ceildivpow2(int a, int b) {
|
||||
return (a+(1<<b)-1)>>b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Divide an integer by a power of 2 and round downwards.
|
||||
/// </summary>
|
||||
int int_floordivpow2(int a, int b) {
|
||||
return a>>b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get logarithm of an integer and round downwards.
|
||||
/// </summary>
|
||||
int int_floorlog2(int a) {
|
||||
int l;
|
||||
for (l=0; a>1; l++) {
|
||||
a>>=1;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __INT_H
|
||||
#define __INT_H
|
||||
|
||||
int int_min(int a, int b);
|
||||
int int_max(int a, int b);
|
||||
int int_clamp(int a, int min, int max);
|
||||
int int_abs(int a);
|
||||
int int_ceildiv(int a, int b);
|
||||
int int_ceildivpow2(int a, int b);
|
||||
int int_floordivpow2(int a, int b);
|
||||
int int_floorlog2(int a);
|
||||
|
||||
#endif
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define VERSION "0.0.8"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef LIBJ2K_EXPORTS
|
||||
#define LIBJ2K_API __declspec(dllexport)
|
||||
#else
|
||||
#define LIBJ2K_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define LIBJ2K_API
|
||||
#endif
|
||||
|
||||
#ifndef __J2K_H
|
||||
#define __J2K_H
|
||||
|
||||
#define J2K_MAXRLVLS 33
|
||||
#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1)
|
||||
|
||||
#define J2K_CP_CSTY_PRT 0x01
|
||||
#define J2K_CP_CSTY_SOP 0x02
|
||||
#define J2K_CP_CSTY_EPH 0x04
|
||||
#define J2K_CCP_CSTY_PRT 0x01
|
||||
#define J2K_CCP_CBLKSTY_LAZY 0x01
|
||||
#define J2K_CCP_CBLKSTY_RESET 0x02
|
||||
#define J2K_CCP_CBLKSTY_TERMALL 0x04
|
||||
#define J2K_CCP_CBLKSTY_VSC 0x08
|
||||
#define J2K_CCP_CBLKSTY_PTERM 0x10
|
||||
#define J2K_CCP_CBLKSTY_SEGSYM 0x20
|
||||
#define J2K_CCP_QNTSTY_NOQNT 0
|
||||
#define J2K_CCP_QNTSTY_SIQNT 1
|
||||
#define J2K_CCP_QNTSTY_SEQNT 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int dx, dy; /* XRsiz, YRsiz */
|
||||
int prec; /* precision */
|
||||
int bpp; /* deapth of image in bits */
|
||||
int sgnd; /* signed */
|
||||
int *data; /* image-component data */
|
||||
} j2k_comp_t;
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
int x0, y0; /* XOsiz, YOsiz */
|
||||
int x1, y1; /* Xsiz, Ysiz */
|
||||
int numcomps; /* number of components */
|
||||
int index_on; /* 0 = no index || 1 = index */
|
||||
j2k_comp_t *comps; /* image-components */
|
||||
} j2k_image_t;
|
||||
|
||||
typedef struct {
|
||||
int expn; /* exponent */
|
||||
int mant; /* mantissa */
|
||||
} j2k_stepsize_t;
|
||||
|
||||
typedef struct {
|
||||
int csty; /* coding style */
|
||||
int numresolutions; /* number of resolutions */
|
||||
int cblkw; /* width of code-blocks */
|
||||
int cblkh; /* height of code-blocks */
|
||||
int cblksty; /* code-block coding style */
|
||||
int qmfbid; /* discrete wavelet transform identifier */
|
||||
int qntsty; /* quantisation style */
|
||||
j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */
|
||||
int numgbits; /* number of guard bits */
|
||||
int roishift; /* Region of Interest shift */
|
||||
int prcw[J2K_MAXRLVLS]; /* Precinct width */
|
||||
int prch[J2K_MAXRLVLS]; /* Precinct height */
|
||||
} j2k_tccp_t;
|
||||
|
||||
typedef struct {
|
||||
int resno0, compno0;
|
||||
int layno1, resno1, compno1;
|
||||
int prg;
|
||||
int tile;
|
||||
char progorder[4];
|
||||
} j2k_poc_t;
|
||||
|
||||
typedef struct {
|
||||
//int first;
|
||||
int csty; /* coding style */
|
||||
int prg; /* progression order */
|
||||
int numlayers; /* number of layers */
|
||||
int mct; /* multi-component transform identifier */
|
||||
int rates[100]; /* rates of layers */
|
||||
int numpocs; /* number of progression order changes */
|
||||
int POC; /* Precise if a POC marker has been used O:NO, 1:YES */
|
||||
j2k_poc_t pocs[32]; /* progression order changes */
|
||||
unsigned char *ppt_data; /* packet header store there for futur use in t2_decode_packet */
|
||||
int ppt; /* If ppt == 1 --> there was a PPT marker for the present tile */
|
||||
int ppt_store; /* Use in case of multiple marker PPT (number of info already store) */
|
||||
j2k_tccp_t *tccps; /* tile-component coding parameters */
|
||||
} j2k_tcp_t;
|
||||
|
||||
typedef struct {
|
||||
int tx0, ty0; /* XTOsiz, YTOsiz */
|
||||
int tdx, tdy; /* XTsiz, YTsiz */
|
||||
int tw, th;
|
||||
unsigned char *ppm_data; /* packet header store there for futur use in t2_decode_packet */
|
||||
int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */
|
||||
int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */
|
||||
int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */
|
||||
j2k_tcp_t *tcps; /* tile coding parameters */
|
||||
} j2k_cp_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Packet information : Layer level */
|
||||
typedef struct {
|
||||
int len; /* Length of the body of the packet */
|
||||
int len_header; /* Length of the header of the packet */
|
||||
int offset; /* Offset of the body of the packet */
|
||||
int offset_header; /* Offset of the header of the packet */
|
||||
} info_layer_t;
|
||||
|
||||
|
||||
/* Access to packet information : precinct level */
|
||||
typedef struct {
|
||||
info_layer_t *layer;
|
||||
} info_prec_t;
|
||||
|
||||
|
||||
/* Access to packet information : resolution level */
|
||||
typedef struct {
|
||||
info_prec_t *prec;
|
||||
} info_reso_t;
|
||||
|
||||
|
||||
/* Access to packet information : component level */
|
||||
typedef struct {
|
||||
info_reso_t *reso;
|
||||
} info_compo_t;
|
||||
|
||||
|
||||
/* Information about the marker */
|
||||
typedef struct {
|
||||
int type; /* type of marker [SIZ, QCD, POC, PPM, CRG, COD] appearing only once */
|
||||
int start_pos; /* Start position of the marker */
|
||||
int len; /* Length of the marker */
|
||||
} info_marker_t;
|
||||
|
||||
|
||||
/* Multiple marker in tile header */
|
||||
typedef struct{
|
||||
info_marker_t *COC; /* COC markers */
|
||||
int num_COC; /* Number of COC marker */
|
||||
int CzCOC; /* Current size of the vector COC */
|
||||
|
||||
info_marker_t *RGN; /* RGN markers */
|
||||
int num_RGN; /* Number of RGN marker */
|
||||
int CzRGN; /* Current size of the vector RGN */
|
||||
|
||||
info_marker_t *QCC; /* QCC markers */
|
||||
int num_QCC; /* Number of QCC marker */
|
||||
int CzQCC; /* Current size of the vector QCC */
|
||||
|
||||
info_marker_t *PLT; /* PLT markers */
|
||||
int num_PLT; /* Number of PLT marker */
|
||||
int CzPLT; /* Current size of the vector PLT */
|
||||
|
||||
info_marker_t *PPT; /* PPT markers */
|
||||
int num_PPT; /* Number of PPT marker */
|
||||
int CzPPT; /* Current size of the vector PPT */
|
||||
|
||||
info_marker_t *COM; /* COM markers */
|
||||
int num_COM; /* Number of COM marker */
|
||||
int CzCOM; /* Current size of the vector COC */
|
||||
} info_marker_mul_tile_t;
|
||||
|
||||
|
||||
/* Information about each tile_part for a particulary tile */
|
||||
typedef struct{
|
||||
int start_pos; /* Start position of the tile_part */
|
||||
int length; /* Length of the tile_part header + body */
|
||||
int length_header; /* Length of the header */
|
||||
int end_pos; /* End position of the tile part */
|
||||
int end_header; /* End position of the tile part header */
|
||||
int num_reso_AUX; /* Number of resolution level completed */
|
||||
} info_tile_part_t;
|
||||
|
||||
|
||||
/* Information about each tile */
|
||||
typedef struct {
|
||||
int num_tile; /* Number of Tile */
|
||||
int pw, ph; /* number of precinct by tile */
|
||||
int num_packet; /* number of packet in the tile */
|
||||
info_compo_t *compo; /* component [packet] */
|
||||
|
||||
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
|
||||
info_marker_mul_tile_t marker_mul; /* information concerning markers inside image [multiple apparition] */
|
||||
int num_marker; /* number of marker */
|
||||
|
||||
int numparts; /* number of tile_part for this tile */
|
||||
info_tile_part_t *tile_parts; /* Information about each tile_part */
|
||||
int Cztile_parts; /* Current size of the tile_parts vector */
|
||||
} info_tile_t; /* index struct */
|
||||
|
||||
|
||||
/* Multiple marker in main header */
|
||||
typedef struct{
|
||||
info_marker_t *COC; /* COC markers */
|
||||
int num_COC; /* Number of COC marker */
|
||||
int CzCOC; /* Current size of the vector COC */
|
||||
|
||||
info_marker_t *RGN; /* RGN markers */
|
||||
int num_RGN; /* Number of RGN marker */
|
||||
int CzRGN; /* Current size of the vector RGN */
|
||||
|
||||
info_marker_t *QCC; /* QCC markers */
|
||||
int num_QCC; /* Number of QCC marker */
|
||||
int CzQCC; /* Current size of the vector QCC */
|
||||
|
||||
info_marker_t *TLM; /* TLM markers */
|
||||
int num_TLM; /* Number of TLM marker */
|
||||
int CzTLM; /* Current size of the vector TLM */
|
||||
|
||||
info_marker_t *PLM; /* PLM markers */
|
||||
int num_PLM; /* Number of PLM marker */
|
||||
int CzPLM; /* Current size of the vector PLM */
|
||||
|
||||
info_marker_t *PPM; /* PPM markers */
|
||||
int num_PPM; /* Number of PPM marker */
|
||||
int CzPPM; /* Current size of the vector PPM */
|
||||
|
||||
info_marker_t *COM; /* COM markers */
|
||||
int num_COM; /* Number of COM marker */
|
||||
int CzCOM; /* Current size of the vector COM */
|
||||
} info_marker_mul_t; /* index struct */
|
||||
|
||||
|
||||
/* Information about image */
|
||||
typedef struct {
|
||||
int Im_w, Im_h; /* Image width and Height */
|
||||
int Tile_x, Tile_y; /* Number of Tile in X and Y */
|
||||
int tw, th;
|
||||
int pw, ph; /* nombre precinct in X and Y */
|
||||
int pdx, pdy; /* size of precinct in X and Y */
|
||||
|
||||
int Prog; /* progression order */
|
||||
int Comp; /* Component numbers */
|
||||
int Layer; /* number of layer */
|
||||
int Decomposition; /* number of decomposition */
|
||||
|
||||
int Main_head_end; /* Main header position */
|
||||
int codestream_size; /* codestream's size */
|
||||
|
||||
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
|
||||
info_marker_mul_t marker_mul; /* information concerning markers inside image [multiple apparition] */
|
||||
int num_marker; /* number of marker */
|
||||
|
||||
int num_packet_max; /* Maximum number of packet */
|
||||
|
||||
int num_max_tile_parts; /* Maximum number of tile-part */
|
||||
info_tile_t *tile; /* information concerning tiles inside image */
|
||||
} info_image_t; /* index struct */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,301 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "j2k.h"
|
||||
#include "cio.h"
|
||||
#include "tcd.h"
|
||||
#include "int.h"
|
||||
|
||||
#define JPIP_JPIP 0x6a706970
|
||||
|
||||
#define JP2_JP 0x6a502020
|
||||
#define JP2_FTYP 0x66747970
|
||||
#define JP2_JP2H 0x6a703268
|
||||
#define JP2_IHDR 0x69686472
|
||||
#define JP2_COLR 0x636f6c72
|
||||
#define JP2_JP2C 0x6a703263
|
||||
#define JP2_URL 0x75726c20
|
||||
#define JP2_DBTL 0x6474626c
|
||||
#define JP2_BPCC 0x62706363
|
||||
#define JP2 0x6a703220
|
||||
|
||||
|
||||
void jp2_write_url(char *Idx_file)
|
||||
{
|
||||
int len, lenp, i;
|
||||
char str[256];
|
||||
|
||||
sprintf(str, "%s", Idx_file);
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_URL, 4); // DBTL
|
||||
cio_write(0,1); // VERS
|
||||
cio_write(0,3); // FLAG
|
||||
|
||||
for (i=0; i<strlen(str); i++) {
|
||||
cio_write(str[i], 1);
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
void jp2_write_dbtl(char *Idx_file)
|
||||
{
|
||||
int len, lenp;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_DBTL, 4); // DBTL
|
||||
cio_write(1,2); // NDR : Only 1
|
||||
|
||||
jp2_write_url(Idx_file); // URL Box
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
int jp2_write_ihdr(j2k_image_t *j2k_img)
|
||||
{
|
||||
int len, lenp,i;
|
||||
int depth_0,depth, sign, BPC_ok=1;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_IHDR, 4); // IHDR
|
||||
|
||||
cio_write(j2k_img->y1-j2k_img->x0,4); // HEIGHT
|
||||
cio_write(j2k_img->x1-j2k_img->x0,4); // WIDTH
|
||||
cio_write(j2k_img->numcomps,2); // NC
|
||||
|
||||
depth_0=j2k_img->comps[0].prec-1;
|
||||
sign=j2k_img->comps[0].sgnd;
|
||||
|
||||
for(i=1;i<j2k_img->numcomps;i++)
|
||||
{
|
||||
depth=j2k_img->comps[i].prec-1;
|
||||
sign=j2k_img->comps[i].sgnd;
|
||||
if(depth_0!=depth) BPC_ok=0;
|
||||
}
|
||||
|
||||
if (BPC_ok)
|
||||
cio_write(depth_0+(sign<<7),1);
|
||||
else
|
||||
cio_write(255,1);
|
||||
|
||||
cio_write(7,1); // C : Always 7
|
||||
cio_write(1,1); // UnkC, colorspace unknow
|
||||
cio_write(0,1); // IPR, no intellectual property
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
|
||||
return BPC_ok;
|
||||
}
|
||||
|
||||
void jp2_write_bpcc(j2k_image_t *j2k_img)
|
||||
{
|
||||
int len, lenp, i;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_BPCC, 4); // BPCC
|
||||
|
||||
for(i=0;i<j2k_img->numcomps;i++)
|
||||
cio_write(j2k_img->comps[i].prec-1+(j2k_img->comps[i].sgnd<<7),1);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
void jp2_write_colr(int BPC_ok, j2k_image_t *j2k_img)
|
||||
{
|
||||
int len, lenp, meth;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_COLR, 4); // COLR
|
||||
|
||||
if ((j2k_img->numcomps==1 || j2k_img->numcomps==3) && (BPC_ok && j2k_img->comps[0].prec==8))
|
||||
meth=1;
|
||||
else
|
||||
meth=2;
|
||||
|
||||
cio_write(meth,1); // METH
|
||||
cio_write(0,1); // PREC
|
||||
cio_write(0,1); // APPROX
|
||||
|
||||
if (meth==1)
|
||||
cio_write(j2k_img->numcomps>1?16:17,4); // EnumCS
|
||||
|
||||
if (meth==2)
|
||||
cio_write(0,1); // PROFILE (??)
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the JP2H box
|
||||
*
|
||||
* JP2 Header box
|
||||
*
|
||||
*/
|
||||
void jp2_write_jp2h(j2k_image_t *j2k_img)
|
||||
{
|
||||
int len, lenp, BPC_ok;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_JP2H, 4); /* JP2H */
|
||||
|
||||
BPC_ok=jp2_write_ihdr(j2k_img);
|
||||
|
||||
if (!BPC_ok)
|
||||
jp2_write_bpcc(j2k_img);
|
||||
jp2_write_colr(BPC_ok, j2k_img);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the FTYP box
|
||||
*
|
||||
* File type box
|
||||
*
|
||||
*/
|
||||
void jp2_write_ftyp()
|
||||
{
|
||||
int len, lenp;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_FTYP, 4); /* FTYP */
|
||||
|
||||
cio_write(JP2,4); /* BR */
|
||||
cio_write(0,4); /* MinV */
|
||||
cio_write(JP2,4); /* CL0 : JP2 */
|
||||
cio_write(JPIP_JPIP,4); /* CL1 : JPIP */
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the FTYP box
|
||||
*
|
||||
* File type box
|
||||
*
|
||||
*/
|
||||
void jp2_read_ftyp(int length)
|
||||
{
|
||||
int BR, MinV, type, i;
|
||||
|
||||
BR = cio_read(4); /* BR */
|
||||
MinV = cio_read(4); /* MinV */
|
||||
length-=8;
|
||||
|
||||
for (i=length/4;i>0;i--)
|
||||
type = cio_read(4); /* CLi : JP2, JPIP */
|
||||
}
|
||||
|
||||
int jp2_write_jp2c(char *J2K_file)
|
||||
{
|
||||
int len, lenp, totlen, i;
|
||||
FILE *src;
|
||||
char *j2kfile;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_JP2C, 4); // JP2C
|
||||
|
||||
src=fopen(J2K_file, "rb");
|
||||
fseek(src, 0, SEEK_END);
|
||||
totlen=ftell(src);
|
||||
fseek(src, 0, SEEK_SET);
|
||||
|
||||
j2kfile=(char*)malloc(totlen);
|
||||
fread(j2kfile, 1, totlen, src);
|
||||
fclose(src);
|
||||
|
||||
for (i=0;i<totlen;i++)
|
||||
cio_write(j2kfile[i],1);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
return lenp;
|
||||
}
|
||||
|
||||
void jp2_write_jp()
|
||||
{
|
||||
int len, lenp;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4);
|
||||
cio_write(JP2_JP, 4); // JP
|
||||
cio_write(0x0d0a870a,4);
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len,4); // L
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the JP box
|
||||
*
|
||||
* JPEG 2000 signature
|
||||
*
|
||||
* return 1 if error else 0
|
||||
*/
|
||||
int jp2_read_jp()
|
||||
{
|
||||
if (0x0d0a870a!=cio_read(4))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -1,778 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "j2k.h"
|
||||
#include "cio.h"
|
||||
#include "tcd.h"
|
||||
#include "int.h"
|
||||
|
||||
#define JPIP_CIDX 0x63696478 /* Codestream index */
|
||||
#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
|
||||
#define JPIP_MANF 0x6d616e66 /* Manifest Box */
|
||||
#define JPIP_FAIX 0x66616978 /* Fragment array Index box */
|
||||
#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
|
||||
#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
|
||||
#define JPIP_THIX 0x74686978 /* Tile header Index Table box */
|
||||
#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
|
||||
#define JPIP_PHIX 0x70686978 /* Packet Header index Table */
|
||||
#define JPIP_FIDX 0x66696478 /* File Index */
|
||||
#define JPIP_FPTR 0x66707472 /* File Finder */
|
||||
#define JPIP_PRXY 0x70727879 /* Proxy boxes */
|
||||
#define JPIP_IPTR 0x69707472 /* Index finder box */
|
||||
#define JPIP_PHLD 0x70686c64 /* Place holder */
|
||||
|
||||
#define JP2C 0x6a703263
|
||||
|
||||
//static info_marker_t marker_jpip[32], marker_local_jpip[32]; /* SIZE to precise ! */
|
||||
//static int num_marker_jpip, num_marker_local_jpip;
|
||||
|
||||
/*
|
||||
* Write the CPTR box
|
||||
*
|
||||
* Codestream finder box (box)
|
||||
*
|
||||
*/
|
||||
void jpip_write_cptr(int offset, info_image_t img)
|
||||
{
|
||||
int len, lenp;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_CPTR,4); /* T */
|
||||
cio_write(0,2); /* DR A PRECISER !! */
|
||||
cio_write(0,2); /* CONT */
|
||||
cio_write(offset,8); /* COFF A PRECISER !! */
|
||||
cio_write(img.codestream_size,8); /* CLEN */
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the CPTR box
|
||||
*
|
||||
* Codestream finder box (box)
|
||||
*
|
||||
*/
|
||||
void jpip_read_cptr()
|
||||
{
|
||||
int DR, CONT;
|
||||
long long Coff, codestream_size;
|
||||
|
||||
DR = cio_read(2); /* DR */
|
||||
CONT = cio_read(2); /* CONT */
|
||||
Coff = cio_read(8); /* COFF */
|
||||
codestream_size = cio_read(8); /* CLEN */
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the MANF box
|
||||
*
|
||||
* Manifest box (box)
|
||||
*
|
||||
*/
|
||||
void jpip_write_manf(int second, int v, info_marker_t *marker)
|
||||
{
|
||||
int len, lenp, i;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_MANF,4); /* T */
|
||||
|
||||
if (second) /* Write only during the second pass */
|
||||
{
|
||||
for(i=0;i<v;i++)
|
||||
{
|
||||
cio_write(marker[i].len,4); /* Marker length */
|
||||
cio_write(marker[i].type,4); /* Marker type */
|
||||
}
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the MANF box
|
||||
*
|
||||
* Manifest box (box)
|
||||
*
|
||||
*/
|
||||
void jpip_read_manf(int len)
|
||||
{
|
||||
int i, v, marker_len, marker_type;
|
||||
|
||||
v = (len - 8)/ 8;
|
||||
|
||||
for(i=0;i<v;i++)
|
||||
{
|
||||
marker_len = cio_read(4); /* Marker length */
|
||||
marker_type = cio_read(4); /* Marker type */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the MHIX box
|
||||
*
|
||||
* Main Header Index Table (box)
|
||||
*
|
||||
*/
|
||||
int jpip_write_mhix(info_image_t img, int status, int tileno)
|
||||
{
|
||||
int len, lenp, i;
|
||||
info_tile_t *tile;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_MHIX, 4); /* MHIX */
|
||||
|
||||
if (status==0) /* MAIN HEADER */
|
||||
{
|
||||
cio_write(img.Main_head_end,8); /* TLEN */
|
||||
|
||||
for(i = 0; i < img.num_marker; i++) /* Marker restricted to 1 apparition */
|
||||
{
|
||||
cio_write(img.marker[i].type, 2);
|
||||
cio_write(0, 2);
|
||||
cio_write(img.marker[i].start_pos, 8);
|
||||
cio_write(img.marker[i].len, 2);
|
||||
}
|
||||
|
||||
/* Marker NOT restricted to 1 apparition */
|
||||
for(i = img.marker_mul.num_COC - 1; i >= 0; i--) /* COC */
|
||||
{
|
||||
cio_write(img.marker_mul.COC[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.COC[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.COC[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
|
||||
{
|
||||
cio_write(img.marker_mul.RGN[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.RGN[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.RGN[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
|
||||
{
|
||||
cio_write(img.marker_mul.QCC[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.QCC[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.QCC[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_TLM - 1; i >= 0; i--) /* TLM */
|
||||
{
|
||||
cio_write(img.marker_mul.TLM[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.TLM[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.TLM[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_PLM - 1; i >= 0; i--) /* PLM */
|
||||
{
|
||||
cio_write(img.marker_mul.PLM[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.PLM[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.PLM[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_PPM - 1; i >= 0; i--) /* PPM */
|
||||
{
|
||||
cio_write(img.marker_mul.PPM[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.PPM[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.PPM[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = img.marker_mul.num_COM - 1; i >= 0; i--) /* COM */
|
||||
{
|
||||
cio_write(img.marker_mul.COM[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(img.marker_mul.COM[i].start_pos, 8);
|
||||
cio_write(img.marker_mul.COM[i].len, 2);
|
||||
}
|
||||
}
|
||||
else /* TILE HEADER */
|
||||
{
|
||||
tile = &img.tile[tileno];
|
||||
cio_write(tile->tile_parts[0].length_header, 8); /* TLEN */
|
||||
|
||||
for(i = 0; i < tile->num_marker; i++) /* Marker restricted to 1 apparition */
|
||||
{
|
||||
cio_write(tile->marker[i].type, 2);
|
||||
cio_write(0, 2);
|
||||
cio_write(tile->marker[i].start_pos, 8);
|
||||
cio_write(tile->marker[i].len, 2);
|
||||
}
|
||||
|
||||
/* Marker NOT restricted to 1 apparition */
|
||||
for(i = tile->marker_mul.num_COC - 1; i >= 0; i--) /* COC */
|
||||
{
|
||||
cio_write(tile->marker_mul.COC[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(tile->marker_mul.COC[i].start_pos, 8);
|
||||
cio_write(tile->marker_mul.COC[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = tile->marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
|
||||
{
|
||||
cio_write(tile->marker_mul.RGN[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(tile->marker_mul.RGN[i].start_pos, 8);
|
||||
cio_write(tile->marker_mul.RGN[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = tile->marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
|
||||
{
|
||||
cio_write(tile->marker_mul.QCC[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(tile->marker_mul.QCC[i].start_pos, 8);
|
||||
cio_write(tile->marker_mul.QCC[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = tile->marker_mul.num_PLT - 1; i >= 0; i--) /* PLT */
|
||||
{
|
||||
cio_write(tile->marker_mul.PLT[i].type,2);
|
||||
cio_write(i,2);
|
||||
cio_write(tile->marker_mul.PLT[i].start_pos,8);
|
||||
cio_write(tile->marker_mul.PLT[i].len,2);
|
||||
}
|
||||
|
||||
for(i = tile->marker_mul.num_PPT - 1; i >= 0; i--) /* PPT */
|
||||
{
|
||||
cio_write(tile->marker_mul.PPT[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(tile->marker_mul.PPT[i].start_pos, 8);
|
||||
cio_write(tile->marker_mul.PPT[i].len, 2);
|
||||
}
|
||||
|
||||
for(i = tile->marker_mul.num_COM - 1; i >= 0; i--) /* COM */
|
||||
{
|
||||
cio_write(tile->marker_mul.COM[i].type, 2);
|
||||
cio_write(i, 2);
|
||||
cio_write(tile->marker_mul.COM[i].start_pos, 8);
|
||||
cio_write(tile->marker_mul.COM[i].len, 2);
|
||||
}
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the MHIX box
|
||||
*
|
||||
* Main Header Index Table (box)
|
||||
*
|
||||
*/
|
||||
void jpip_read_mhix(int len)
|
||||
{
|
||||
int i, v, marker_type, marker_start_pos, marker_len, marker_remains;
|
||||
|
||||
v = (len - 8) / 14;
|
||||
|
||||
for (i=0; i<v ; i++)
|
||||
{
|
||||
marker_type = cio_read(2); /* Type of the marker */
|
||||
marker_remains = cio_read(2); /* Number of same markers following */
|
||||
marker_start_pos = cio_read(2); /* Start position of the marker */
|
||||
marker_len = cio_read(2); /* Length of the marker */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the FAIX box
|
||||
*
|
||||
* Fragment array Index box (box)
|
||||
*
|
||||
*/
|
||||
int jpip_write_faix(int v, int compno, info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||
{
|
||||
int len, lenp, i, j;
|
||||
int Aux;
|
||||
int tileno, resno, precno, layno, num_packet=0;
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_FAIX, 4); /* FAIX */
|
||||
cio_write(version,1); /* Version 0 = 4 bytes */
|
||||
|
||||
switch(v)
|
||||
{
|
||||
case 0: /* TPIX */
|
||||
cio_write(img.num_max_tile_parts,(version & 0x01)?8:4); /* NMAX */
|
||||
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||
for (i = 0; i < img.tw*img.th; i++)
|
||||
{
|
||||
for (j = 0; j < img.tile[i].numparts ; j++)
|
||||
{
|
||||
cio_write(img.tile[i].tile_parts[j].start_pos,(version & 0x01)?8:4); /* start position */
|
||||
cio_write(img.tile[i].tile_parts[j].length,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
{
|
||||
if (img.tile[i].numparts == 1 && img.Decomposition > 1)
|
||||
Aux = img.Decomposition + 1;
|
||||
else
|
||||
Aux = j + 1;
|
||||
|
||||
cio_write(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 < img.num_max_tile_parts)
|
||||
{
|
||||
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||
j++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* case 1: */ /* THIX */
|
||||
/* cio_write(1,(version & 0x01)?8:4); */ /* NMAX */
|
||||
/* cio_write(img.tw*img.th,(version & 0x01)?8:4); */ /* M */
|
||||
/* for (i=0;i<img.tw*img.th;i++) */
|
||||
/* { */
|
||||
/* cio_write(img.tile[i].start_pos,(version & 0x01)?8:4); */ /* start position */
|
||||
/* cio_write(img.tile[i].end_header-img.tile[i].start_pos,(version & 0x01)?8:4); */ /* length */
|
||||
/* if (version & 0x02)*/
|
||||
/* cio_write(0,4); */ /* Aux_i,j : Auxiliary value */
|
||||
/* } */
|
||||
/* break; */
|
||||
|
||||
case 2: /* PPIX NOT FINISHED !! */
|
||||
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
|
||||
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||
for(tileno=0;tileno<img.tw*img.th;tileno++)
|
||||
{
|
||||
info_tile_t *tile_Idx = &img.tile[tileno];
|
||||
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||
int correction;
|
||||
|
||||
num_packet=0;
|
||||
|
||||
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
|
||||
correction=3;
|
||||
else
|
||||
correction=1;
|
||||
for(resno=0;resno<img.Decomposition+1;resno++)
|
||||
{
|
||||
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
|
||||
{
|
||||
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||
for(layno=0;layno<img.Layer;layno++)
|
||||
{
|
||||
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||
cio_write(layer_Idx->offset,(version & 0x01)?8:4); /* start position */
|
||||
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* PADDING */
|
||||
while (num_packet < img.num_packet_max)
|
||||
{
|
||||
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: /* PHIX NOT FINISHED !! */
|
||||
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
|
||||
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||
for(tileno=0;tileno<img.tw*img.th;tileno++)
|
||||
{
|
||||
info_tile_t *tile_Idx = &img.tile[tileno];
|
||||
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||
int correction;
|
||||
|
||||
num_packet = 0;
|
||||
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
|
||||
correction=3;
|
||||
else
|
||||
correction=1;
|
||||
for(resno=0;resno<img.Decomposition+1;resno++)
|
||||
{
|
||||
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
|
||||
{
|
||||
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||
for(layno=0;layno<img.Layer;layno++)
|
||||
{
|
||||
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||
cio_write(layer_Idx->offset_header,(version & 0x01)?8:4); /* start position */
|
||||
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len_header,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* PADDING */
|
||||
while (num_packet<img.num_packet_max)
|
||||
{
|
||||
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||
if (version & 0x02)
|
||||
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||
num_packet++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the TPIX box
|
||||
*
|
||||
* Tile-part Index table box (superbox)
|
||||
*
|
||||
*/
|
||||
int jpip_write_tpix(info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||
{
|
||||
int len, lenp;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_TPIX, 4); /* TPIX */
|
||||
|
||||
jpip_write_faix(0,0,img, j2k_cp, version);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the THIX box
|
||||
*
|
||||
* Tile header Index table box (superbox)
|
||||
*
|
||||
*/
|
||||
//int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||
// {
|
||||
// int len, lenp;
|
||||
// lenp=cio_tell();
|
||||
// cio_skip(4); /* L [at the end] */
|
||||
// cio_write(JPIP_THIX, 4); /* THIX */
|
||||
|
||||
// jpip_write_faix(1,0,img, j2k_cp);
|
||||
|
||||
// len=cio_tell()-lenp;
|
||||
// cio_seek(lenp);
|
||||
// cio_write(len, 4); /* L */
|
||||
// cio_seek(lenp+len);
|
||||
|
||||
// return len;
|
||||
//}
|
||||
|
||||
int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||
{
|
||||
int len, lenp, i;
|
||||
int tileno;
|
||||
info_marker_t *marker;
|
||||
int num_marker_local_jpip;
|
||||
|
||||
marker = (info_marker_t*)calloc(sizeof(info_marker_t), j2k_cp->tw*j2k_cp->th);
|
||||
|
||||
for ( i = 0; i < 2 ; i++ )
|
||||
{
|
||||
if (i) cio_seek(lenp);
|
||||
|
||||
lenp = cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_THIX, 4); /* THIX */
|
||||
jpip_write_manf(i, j2k_cp->tw*j2k_cp->th, marker);
|
||||
num_marker_local_jpip=img.Comp;
|
||||
|
||||
for (tileno = 0; tileno < j2k_cp->tw*j2k_cp->th; tileno++)
|
||||
{
|
||||
marker[tileno].len = jpip_write_mhix(img, 1, tileno);
|
||||
marker[tileno].type = JPIP_MHIX;
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
free(marker);
|
||||
|
||||
return len;
|
||||
}
|
||||
/*
|
||||
* Write the PPIX box
|
||||
*
|
||||
* Precinct Packet Index table box (superbox)
|
||||
*
|
||||
*/
|
||||
int jpip_write_ppix(info_image_t img,j2k_cp_t *j2k_cp)
|
||||
{
|
||||
int len, lenp, compno, i;
|
||||
info_marker_t *marker;
|
||||
int num_marker_local_jpip;
|
||||
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
|
||||
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
if (i) cio_seek(lenp);
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_PPIX, 4); /* PPIX */
|
||||
jpip_write_manf(i,img.Comp,marker);
|
||||
num_marker_local_jpip=img.Comp;
|
||||
|
||||
for (compno=0; compno<img.Comp; compno++)
|
||||
{
|
||||
marker[compno].len=jpip_write_faix(2,compno,img, j2k_cp, 0);
|
||||
marker[compno].type=JPIP_FAIX;
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
free(marker);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the PHIX box
|
||||
*
|
||||
* Packet Header Index table box (superbox)
|
||||
*
|
||||
*/
|
||||
int jpip_write_phix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||
{
|
||||
int len, lenp=0, compno, i;
|
||||
info_marker_t *marker;
|
||||
|
||||
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
|
||||
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
if (i) cio_seek(lenp);
|
||||
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_PHIX, 4); /* PHIX */
|
||||
|
||||
jpip_write_manf(i,img.Comp,marker);
|
||||
|
||||
for (compno=0; compno<img.Comp; compno++)
|
||||
{
|
||||
marker[compno].len=jpip_write_faix(3,compno,img, j2k_cp, 0);
|
||||
marker[compno].type=JPIP_FAIX;
|
||||
}
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
free(marker);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the CIDX box
|
||||
*
|
||||
* Codestream Index box (superbox)
|
||||
*
|
||||
*/
|
||||
int jpip_write_cidx(int offset, info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||
{
|
||||
int len, lenp = 0, i;
|
||||
info_marker_t *marker_jpip;
|
||||
int num_marker_jpip = 0;
|
||||
|
||||
marker_jpip = (info_marker_t*)calloc(sizeof(info_marker_t), 32);
|
||||
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
if(i)
|
||||
cio_seek(lenp);
|
||||
|
||||
lenp=cio_tell();
|
||||
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_CIDX, 4); /* CIDX */
|
||||
jpip_write_cptr(offset, img);
|
||||
|
||||
jpip_write_manf(i,num_marker_jpip, marker_jpip);
|
||||
|
||||
num_marker_jpip=0;
|
||||
marker_jpip[num_marker_jpip].len=jpip_write_mhix(img, 0, 0);
|
||||
marker_jpip[num_marker_jpip].type=JPIP_MHIX;
|
||||
num_marker_jpip++;
|
||||
|
||||
marker_jpip[num_marker_jpip].len=jpip_write_tpix(img, j2k_cp, version);
|
||||
marker_jpip[num_marker_jpip].type=JPIP_TPIX;
|
||||
num_marker_jpip++;
|
||||
|
||||
marker_jpip[num_marker_jpip].len=jpip_write_thix(img, j2k_cp);
|
||||
marker_jpip[num_marker_jpip].type=JPIP_THIX;
|
||||
num_marker_jpip++;
|
||||
|
||||
marker_jpip[num_marker_jpip].len=jpip_write_ppix(img, j2k_cp);
|
||||
marker_jpip[num_marker_jpip].type=JPIP_PPIX;
|
||||
num_marker_jpip++;
|
||||
|
||||
marker_jpip[num_marker_jpip].len=jpip_write_phix(img, j2k_cp);
|
||||
marker_jpip[num_marker_jpip].type=JPIP_PHIX;
|
||||
num_marker_jpip++;
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
free(marker_jpip);
|
||||
|
||||
return len;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the IPTR box
|
||||
*
|
||||
* Index Finder box
|
||||
*
|
||||
*/
|
||||
void jpip_write_iptr(int offset, int length)
|
||||
{
|
||||
int len, lenp;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_IPTR, 4); /* IPTR */
|
||||
|
||||
cio_write(offset,8);
|
||||
cio_write(length,8);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the PRXY box
|
||||
*
|
||||
* proxy (box)
|
||||
*
|
||||
*/
|
||||
void jpip_write_prxy(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
|
||||
{
|
||||
int len, lenp;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_PRXY, 4); /* IPTR */
|
||||
|
||||
cio_write(offset_jp2c,8); /* OOFF */
|
||||
cio_write(length_jp2c,4); /* OBH part 1 */
|
||||
cio_write(JP2C,4); /* OBH part 2 */
|
||||
|
||||
cio_write(1,1); /* NI */
|
||||
|
||||
cio_write(offset_idx,8); /* IOFF */
|
||||
cio_write(length_idx,4); /* IBH part 1 */
|
||||
cio_write(JPIP_CIDX,4); /* IBH part 2 */
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write the FIDX box
|
||||
*
|
||||
* File Index (superbox)
|
||||
*
|
||||
*/
|
||||
int jpip_write_fidx(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
|
||||
{
|
||||
int len, lenp;
|
||||
lenp=cio_tell();
|
||||
cio_skip(4); /* L [at the end] */
|
||||
cio_write(JPIP_FIDX, 4); /* IPTR */
|
||||
|
||||
jpip_write_prxy(offset_jp2c, length_jp2c, offset_idx, offset_jp2c);
|
||||
|
||||
len=cio_tell()-lenp;
|
||||
cio_seek(lenp);
|
||||
cio_write(len, 4); /* L */
|
||||
cio_seek(lenp+len);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -1,465 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "pi.h"
|
||||
#include "int.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/* <summary> */
|
||||
/* Create a packet iterator. */
|
||||
/* </summary> */
|
||||
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno)
|
||||
{
|
||||
int p, q;
|
||||
int compno, resno, pino;
|
||||
int maxres = 0;
|
||||
pi_iterator_t *pi;
|
||||
j2k_tcp_t *tcp;
|
||||
j2k_tccp_t *tccp;
|
||||
|
||||
tcp = &cp->tcps[tileno];
|
||||
pi = (pi_iterator_t *) malloc((tcp->numpocs + 1) * sizeof(pi_iterator_t));
|
||||
|
||||
for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */
|
||||
p = tileno % cp->tw;
|
||||
q = tileno / cp->tw;
|
||||
|
||||
pi[pino].tx0 = int_max(cp->tx0 + p * cp->tdx, img->x0);
|
||||
pi[pino].ty0 = int_max(cp->ty0 + q * cp->tdy, img->y0);
|
||||
pi[pino].tx1 = int_min(cp->tx0 + (p + 1) * cp->tdx, img->x1);
|
||||
pi[pino].ty1 = int_min(cp->ty0 + (q + 1) * cp->tdy, img->y1);
|
||||
pi[pino].numcomps = img->numcomps;
|
||||
pi[pino].comps = (pi_comp_t *) malloc(img->numcomps * sizeof(pi_comp_t));
|
||||
|
||||
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||
int tcx0, tcy0, tcx1, tcy1;
|
||||
pi_comp_t *comp = &pi[pino].comps[compno];
|
||||
tccp = &tcp->tccps[compno];
|
||||
comp->dx = img->comps[compno].dx;
|
||||
comp->dy = img->comps[compno].dy;
|
||||
comp->numresolutions = tccp->numresolutions;
|
||||
comp->resolutions =
|
||||
(pi_resolution_t *) malloc(comp->numresolutions *
|
||||
sizeof(pi_resolution_t));
|
||||
tcx0 = int_ceildiv(pi->tx0, comp->dx);
|
||||
tcy0 = int_ceildiv(pi->ty0, comp->dy);
|
||||
tcx1 = int_ceildiv(pi->tx1, comp->dx);
|
||||
tcy1 = int_ceildiv(pi->ty1, comp->dy);
|
||||
if (comp->numresolutions > maxres) {
|
||||
maxres = comp->numresolutions;
|
||||
}
|
||||
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||
int levelno;
|
||||
int rx0, ry0, rx1, ry1;
|
||||
int px0, py0, px1, py1;
|
||||
pi_resolution_t *res = &comp->resolutions[resno];
|
||||
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
||||
res->pdx = tccp->prcw[resno];
|
||||
res->pdy = tccp->prch[resno];
|
||||
} else {
|
||||
res->pdx = 15;
|
||||
res->pdy = 15;
|
||||
}
|
||||
levelno = comp->numresolutions - 1 - resno;
|
||||
rx0 = int_ceildivpow2(tcx0, levelno);
|
||||
ry0 = int_ceildivpow2(tcy0, levelno);
|
||||
rx1 = int_ceildivpow2(tcx1, levelno);
|
||||
ry1 = int_ceildivpow2(tcy1, levelno);
|
||||
px0 = int_floordivpow2(rx0, res->pdx) << res->pdx;
|
||||
py0 = int_floordivpow2(ry0, res->pdy) << res->pdy;
|
||||
px1 = int_ceildivpow2(rx1, res->pdx) << res->pdx;
|
||||
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
|
||||
res->pw = (px1 - px0) >> res->pdx;
|
||||
res->ph = (py1 - py0) >> res->pdy;
|
||||
}
|
||||
}
|
||||
|
||||
tccp = &tcp->tccps[0];
|
||||
pi[pino].step_p=1;
|
||||
pi[pino].step_c=100*pi[pino].step_p;
|
||||
pi[pino].step_r=img->numcomps*pi[pino].step_c;
|
||||
pi[pino].step_l=maxres*pi[pino].step_r;
|
||||
|
||||
if (pino==0)
|
||||
pi[pino].include=(short int*)calloc(img->numcomps*maxres*tcp->numlayers*100,sizeof(short int));
|
||||
else
|
||||
pi[pino].include=pi[pino-1].include;
|
||||
|
||||
/*if (pino == tcp->numpocs) {*/
|
||||
if (tcp->POC == 0) {
|
||||
pi[pino].first = 1;
|
||||
pi[pino].poc.resno0 = 0;
|
||||
pi[pino].poc.compno0 = 0;
|
||||
pi[pino].poc.layno1 = tcp->numlayers;
|
||||
pi[pino].poc.resno1 = maxres;
|
||||
pi[pino].poc.compno1 = img->numcomps;
|
||||
pi[pino].poc.prg = tcp->prg;
|
||||
} else {
|
||||
pi[pino].first = 1;
|
||||
pi[pino].poc.resno0 = tcp->pocs[pino].resno0;
|
||||
pi[pino].poc.compno0 = tcp->pocs[pino].compno0;
|
||||
pi[pino].poc.layno1 = tcp->pocs[pino].layno1;
|
||||
pi[pino].poc.resno1 = tcp->pocs[pino].resno1;
|
||||
pi[pino].poc.compno1 = tcp->pocs[pino].compno1;
|
||||
pi[pino].poc.prg = tcp->pocs[pino].prg;
|
||||
}
|
||||
}
|
||||
return pi;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet in layer=resolution-component-precinct order. */
|
||||
/* </summary> */
|
||||
int pi_next_lrcp(pi_iterator_t * pi)
|
||||
{
|
||||
pi_comp_t *comp;
|
||||
pi_resolution_t *res;
|
||||
|
||||
if (!pi->first) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
res = &comp->resolutions[pi->resno];
|
||||
goto skip;
|
||||
} else {
|
||||
pi->first = 0;
|
||||
}
|
||||
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;
|
||||
pi->resno++) {
|
||||
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||
pi->compno++) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
if (pi->resno >= comp->numresolutions) {
|
||||
|
||||
continue;
|
||||
}
|
||||
res = &comp->resolutions[pi->resno];
|
||||
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
|
||||
if (!pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p]){
|
||||
pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p] = 1;
|
||||
return 1;
|
||||
}
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet in resolution-layer-component-precinct order. */
|
||||
/* </summary> */
|
||||
int pi_next_rlcp(pi_iterator_t * pi)
|
||||
{
|
||||
pi_comp_t *comp;
|
||||
pi_resolution_t *res;
|
||||
if (!pi->first) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
res = &comp->resolutions[pi->resno];
|
||||
goto skip;
|
||||
} else {
|
||||
pi->first = 0;
|
||||
}
|
||||
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
|
||||
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||
pi->compno++) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
if (pi->resno >= comp->numresolutions) {
|
||||
continue;
|
||||
}
|
||||
res = &comp->resolutions[pi->resno];
|
||||
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
|
||||
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||
return 1;
|
||||
}
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet in resolution-precinct-component-layer order. */
|
||||
/* </summary> */
|
||||
int pi_next_rpcl(pi_iterator_t * pi)
|
||||
{
|
||||
pi_comp_t *comp;
|
||||
pi_resolution_t *res;
|
||||
if (!pi->first) {
|
||||
goto skip;
|
||||
} else {
|
||||
int compno, resno;
|
||||
pi->first = 0;
|
||||
pi->dx = 0;
|
||||
pi->dy = 0;
|
||||
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||
comp = &pi->comps[compno];
|
||||
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||
int dx, dy;
|
||||
res = &comp->resolutions[resno];
|
||||
dx =
|
||||
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||
dy =
|
||||
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
|
||||
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||
pi->compno++) {
|
||||
int levelno;
|
||||
int trx0, try0;
|
||||
int rpx, rpy;
|
||||
int prci, prcj;
|
||||
comp = &pi->comps[pi->compno];
|
||||
if (pi->resno >= comp->numresolutions) {
|
||||
continue;
|
||||
}
|
||||
res = &comp->resolutions[pi->resno];
|
||||
levelno = comp->numresolutions - 1 - pi->resno;
|
||||
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||
rpx = res->pdx + levelno;
|
||||
rpy = res->pdy + levelno;
|
||||
if (!
|
||||
(pi->x % (comp->dx << rpx) == 0
|
||||
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
if (!
|
||||
(pi->y % (comp->dy << rpy) == 0
|
||||
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
prci =
|
||||
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||
prcj =
|
||||
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||
pi->precno = prci + prcj * res->pw;
|
||||
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||
return 1;
|
||||
}
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet in precinct-component-resolution-layer order. */
|
||||
/* </summary> */
|
||||
int pi_next_pcrl(pi_iterator_t * pi)
|
||||
{
|
||||
pi_comp_t *comp;
|
||||
pi_resolution_t *res;
|
||||
if (!pi->first) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
goto skip;
|
||||
} else {
|
||||
int compno, resno;
|
||||
pi->first = 0;
|
||||
pi->dx = 0;
|
||||
pi->dy = 0;
|
||||
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||
comp = &pi->comps[compno];
|
||||
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||
int dx, dy;
|
||||
res = &comp->resolutions[resno];
|
||||
dx =
|
||||
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||
dy =
|
||||
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||
pi->compno++) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
for (pi->resno = pi->poc.resno0;
|
||||
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
|
||||
pi->resno++) {
|
||||
int levelno;
|
||||
int trx0, try0;
|
||||
int rpx, rpy;
|
||||
int prci, prcj;
|
||||
res = &comp->resolutions[pi->resno];
|
||||
levelno = comp->numresolutions - 1 - pi->resno;
|
||||
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||
rpx = res->pdx + levelno;
|
||||
rpy = res->pdy + levelno;
|
||||
if (!
|
||||
(pi->x % (comp->dx << rpx) == 0
|
||||
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
if (!
|
||||
(pi->y % (comp->dy << rpy) == 0
|
||||
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
prci =
|
||||
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||
prcj =
|
||||
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||
pi->precno = prci + prcj * res->pw;
|
||||
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||
return 1;
|
||||
}
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet in component-precinct-resolution-layer order. */
|
||||
/* </summary> */
|
||||
int pi_next_cprl(pi_iterator_t * pi)
|
||||
{
|
||||
pi_comp_t *comp;
|
||||
pi_resolution_t *res;
|
||||
if (!pi->first) {
|
||||
comp = &pi->comps[pi->compno];
|
||||
goto skip;
|
||||
} else {
|
||||
pi->first = 0;
|
||||
}
|
||||
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||
pi->compno++) {
|
||||
int resno;
|
||||
comp = &pi->comps[pi->compno];
|
||||
pi->dx = 0;
|
||||
pi->dy = 0;
|
||||
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||
int dx, dy;
|
||||
res = &comp->resolutions[resno];
|
||||
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||
}
|
||||
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||
for (pi->resno = pi->poc.resno0;
|
||||
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
|
||||
pi->resno++) {
|
||||
int levelno;
|
||||
int trx0, try0;
|
||||
int rpx, rpy;
|
||||
int prci, prcj;
|
||||
res = &comp->resolutions[pi->resno];
|
||||
levelno = comp->numresolutions - 1 - pi->resno;
|
||||
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||
rpx = res->pdx + levelno;
|
||||
rpy = res->pdy + levelno;
|
||||
if (!
|
||||
(pi->x % (comp->dx << rpx) == 0
|
||||
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
if (!
|
||||
(pi->y % (comp->dy << rpy) == 0
|
||||
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||
continue;
|
||||
}
|
||||
prci =
|
||||
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||
prcj =
|
||||
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||
pi->precno = prci + prcj * res->pw;
|
||||
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||
return 1;
|
||||
}
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get next packet. */
|
||||
/* </summary> */
|
||||
int pi_next(pi_iterator_t * pi)
|
||||
{
|
||||
switch (pi->poc.prg) {
|
||||
case 0:
|
||||
return pi_next_lrcp(pi);
|
||||
case 1:
|
||||
return pi_next_rlcp(pi);
|
||||
case 2:
|
||||
return pi_next_rpcl(pi);
|
||||
case 3:
|
||||
return pi_next_pcrl(pi);
|
||||
case 4:
|
||||
return pi_next_cprl(pi);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __PI_H
|
||||
#define __PI_H
|
||||
|
||||
#include "j2k.h"
|
||||
#include "tcd.h"
|
||||
|
||||
typedef struct {
|
||||
int pdx, pdy;
|
||||
int pw, ph;
|
||||
} pi_resolution_t;
|
||||
|
||||
typedef struct {
|
||||
int dx, dy;
|
||||
int numresolutions;
|
||||
pi_resolution_t *resolutions;
|
||||
} pi_comp_t;
|
||||
|
||||
typedef struct {
|
||||
short int *include;
|
||||
int step_l, step_r, step_c, step_p;
|
||||
int compno, resno, precno, layno; /* component, resolution, precinct and layer that indentify the packet */
|
||||
int first;
|
||||
j2k_poc_t poc;
|
||||
int numcomps;
|
||||
pi_comp_t *comps;
|
||||
int tx0, ty0, tx1, ty1;
|
||||
int x, y, dx, dy;
|
||||
} pi_iterator_t; /* packet iterator */
|
||||
|
||||
/*
|
||||
* Create a packet iterator
|
||||
* img: raw image for which the packets will be listed
|
||||
* cp: coding paremeters
|
||||
* tileno: number that identifies the tile for which to list the packets
|
||||
* return value: returns a packet iterator that points to the first packet of the tile
|
||||
*/
|
||||
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno);
|
||||
|
||||
/*
|
||||
* Modify the packet iterator to point to the next packet
|
||||
* pi: packet iterator to modify
|
||||
* return value: returns 0 if pi pointed to the last packet or else returns 1
|
||||
*/
|
||||
int pi_next(pi_iterator_t * pi);
|
||||
|
||||
#endif
|
||||
@@ -1,389 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "t2.h"
|
||||
#include "tcd.h"
|
||||
#include "bio.h"
|
||||
#include "j2k.h"
|
||||
#include "pi.h"
|
||||
#include "tgt.h"
|
||||
#include "int.h"
|
||||
#include "cio.h"
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define RESTART 0x04
|
||||
|
||||
extern jmp_buf j2k_error;
|
||||
|
||||
int t2_getcommacode() {
|
||||
int n;
|
||||
for (n=0; bio_read(1); n++) {}
|
||||
return n;
|
||||
}
|
||||
|
||||
int t2_getnumpasses()
|
||||
{
|
||||
int n;
|
||||
if (!bio_read(1)) return 1;
|
||||
if (!bio_read(1)) return 2;
|
||||
if ((n=bio_read(2))!=3) return 3+n;
|
||||
if ((n=bio_read(5))!=31) return 6+n;
|
||||
return 37+bio_read(7);
|
||||
}
|
||||
|
||||
void t2_init_seg(tcd_seg_t *seg, int cblksty) {
|
||||
seg->numpasses=0;
|
||||
seg->len=0;
|
||||
seg->maxpasses=cblksty&J2K_CCP_CBLKSTY_TERMALL?1:100;
|
||||
}
|
||||
|
||||
int t2_decode_packet(unsigned char *src, int len, tcd_tile_t *tile, j2k_cp_t * cp, j2k_tcp_t *tcp, int compno, int resno, int precno, int layno, info_layer_t *layer_Idx) {
|
||||
int bandno, cblkno;
|
||||
tcd_tilecomp_t *tilec = &tile->comps[compno];
|
||||
tcd_resolution_t *res = &tilec->resolutions[resno];
|
||||
unsigned char *c = src;
|
||||
unsigned char *d = c;
|
||||
int e;
|
||||
int present;
|
||||
|
||||
if (layno == 0) {
|
||||
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||
tcd_band_t *band = &res->bands[bandno];
|
||||
tcd_precinct_t *prc = &band->precincts[precno];
|
||||
tgt_reset(prc->incltree);
|
||||
tgt_reset(prc->imsbtree);
|
||||
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
|
||||
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||
cblk->numsegs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* INDEX */
|
||||
layer_Idx->len_header = 0;
|
||||
|
||||
/* When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
|
||||
This part deal with this caracteristic
|
||||
step 1: Read packet header in the saved structure
|
||||
step 2: (futher) return to codestream for decoding */
|
||||
if (cp->ppm == 1) /* PPM */
|
||||
{
|
||||
c = cp->ppm_data;
|
||||
d = c;
|
||||
bio_init_dec(c, 1000);
|
||||
} else
|
||||
{
|
||||
if (tcp->ppt == 1) /* PPT */
|
||||
{
|
||||
c = tcp->ppt_data;
|
||||
d = c;
|
||||
bio_init_dec(c, 1000);
|
||||
} else /* Normal Case */
|
||||
{
|
||||
if (tcp->csty & J2K_CP_CSTY_SOP)
|
||||
{
|
||||
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [1]!!!\n");}
|
||||
c += 6;
|
||||
}
|
||||
bio_init_dec(c, src + len - c);
|
||||
layer_Idx->len_header = -6;
|
||||
}
|
||||
}
|
||||
|
||||
present = bio_read(1);
|
||||
|
||||
if (!present)
|
||||
{
|
||||
bio_inalign();
|
||||
/* Normal case */
|
||||
c += bio_numbytes();
|
||||
if (tcp->csty & J2K_CP_CSTY_EPH)
|
||||
{
|
||||
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [1]!!!\n");}
|
||||
c += 2;
|
||||
}
|
||||
/* INDEX */
|
||||
layer_Idx->len_header += (c-d);
|
||||
|
||||
/* PPT and PPM dealing */
|
||||
if (cp->ppm == 1) /* PPM */
|
||||
{
|
||||
cp->ppm_data = c;
|
||||
return 0;
|
||||
}
|
||||
if (tcp->ppt == 1) /* PPT */
|
||||
{
|
||||
tcp->ppt_data = c;
|
||||
return 0;
|
||||
}
|
||||
return c - src;
|
||||
}
|
||||
|
||||
for (bandno=0; bandno<res->numbands; bandno++) {
|
||||
tcd_band_t *band = &res->bands[bandno];
|
||||
tcd_precinct_t *prc = &band->precincts[precno];
|
||||
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
|
||||
int included, increment, n;
|
||||
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||
tcd_seg_t *seg;
|
||||
if (!cblk->numsegs) {
|
||||
included = tgt_decode(prc->incltree, cblkno, layno+1);
|
||||
} else {
|
||||
included = bio_read(1);
|
||||
}
|
||||
if (!included) {
|
||||
cblk->numnewpasses = 0;
|
||||
continue;
|
||||
}
|
||||
if (!cblk->numsegs) {
|
||||
int i, numimsbs;
|
||||
for (i = 0; !tgt_decode(prc->imsbtree, cblkno, i); i++) {}
|
||||
numimsbs = i-1;
|
||||
cblk->numbps = band->numbps - numimsbs;
|
||||
cblk->numlenbits = 3;
|
||||
}
|
||||
cblk->numnewpasses = t2_getnumpasses();
|
||||
increment = t2_getcommacode();
|
||||
cblk->numlenbits += increment;
|
||||
if (!cblk->numsegs) {
|
||||
seg = &cblk->segs[0];
|
||||
t2_init_seg(seg, tcp->tccps[compno].cblksty);
|
||||
} else {
|
||||
seg = &cblk->segs[cblk->numsegs - 1];
|
||||
if (seg->numpasses == seg->maxpasses) {
|
||||
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
|
||||
}
|
||||
}
|
||||
n = cblk->numnewpasses;
|
||||
do {
|
||||
seg->numnewpasses = int_min(seg->maxpasses-seg->numpasses, n);
|
||||
seg->newlen = bio_read(cblk->numlenbits + int_floorlog2(seg->numnewpasses));
|
||||
n -= seg->numnewpasses;
|
||||
if (n > 0) {
|
||||
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
|
||||
}
|
||||
} while (n > 0);
|
||||
}
|
||||
}
|
||||
if(bio_inalign()) return -999;
|
||||
c += bio_numbytes();
|
||||
|
||||
if (tcp->csty & J2K_CP_CSTY_EPH) { /* EPH marker */
|
||||
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [2]!!!\n"); }
|
||||
c += 2;
|
||||
}
|
||||
|
||||
/* INDEX */
|
||||
layer_Idx->len_header += (c-d);
|
||||
|
||||
/* PPT Step 2 : see above for details */
|
||||
if (cp->ppm == 1)
|
||||
{
|
||||
cp->ppm_data = c; /* Update pointer */
|
||||
|
||||
/* INDEX */
|
||||
layer_Idx->len_header = c-d;
|
||||
|
||||
c = src;
|
||||
d = c;
|
||||
if (tcp->csty & J2K_CP_CSTY_SOP)
|
||||
{
|
||||
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
|
||||
c += 6;
|
||||
}
|
||||
bio_init_dec(c, src + len - c);
|
||||
} else
|
||||
{
|
||||
if (tcp->ppt == 1)
|
||||
{
|
||||
tcp->ppt_data = c; /* Update pointer */
|
||||
/* INDEX */
|
||||
layer_Idx->len_header = c-d;
|
||||
|
||||
c = src;
|
||||
d = c;
|
||||
if (tcp->csty & J2K_CP_CSTY_SOP) /* SOP marker */
|
||||
{
|
||||
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
|
||||
c += 6;
|
||||
}
|
||||
bio_init_dec(c, src + len - c);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||
tcd_band_t *band = &res->bands[bandno];
|
||||
tcd_precinct_t *prc = &band->precincts[precno];
|
||||
for (cblkno = 0; cblkno < prc->cw*prc->ch; cblkno++) {
|
||||
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||
tcd_seg_t *seg;
|
||||
if (!cblk->numnewpasses) continue;
|
||||
if (!cblk->numsegs) {
|
||||
seg = &cblk->segs[cblk->numsegs++];
|
||||
cblk->len = 0;
|
||||
} else {
|
||||
seg = &cblk->segs[cblk->numsegs-1];
|
||||
if (seg->numpasses == seg->maxpasses) {
|
||||
seg++;
|
||||
cblk->numsegs++;
|
||||
}
|
||||
}
|
||||
do {
|
||||
if (c + seg->newlen > src + len) return -999;
|
||||
memcpy(cblk->data + cblk->len, c, seg->newlen);
|
||||
if (seg->numpasses == 0) {
|
||||
seg->data = cblk->data + cblk->len;
|
||||
}
|
||||
c += seg->newlen;
|
||||
cblk->len += seg->newlen;
|
||||
seg->len += seg->newlen;
|
||||
seg->numpasses += seg->numnewpasses;
|
||||
cblk->numnewpasses -= seg->numnewpasses;
|
||||
if (cblk->numnewpasses > 0) {
|
||||
seg++;
|
||||
cblk->numsegs++;
|
||||
}
|
||||
} while (cblk->numnewpasses > 0);
|
||||
}
|
||||
}
|
||||
/* <INDEX> */
|
||||
e = c-d;
|
||||
layer_Idx->len = e;
|
||||
/* </INDEX> */
|
||||
|
||||
return c-src;
|
||||
}
|
||||
|
||||
void t2_init_info_packets(info_image_t *img, j2k_cp_t *cp)
|
||||
{
|
||||
int compno, tileno, resno, precno, layno;
|
||||
|
||||
for(compno = 0; compno < img->Comp; compno++)
|
||||
{
|
||||
for(tileno = 0; tileno < img->tw*img->th; tileno++)
|
||||
{
|
||||
info_tile_t *tile_Idx = &img->tile[tileno];
|
||||
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||
for(resno = 0; resno < img->Decomposition + 1 ; resno++)
|
||||
{
|
||||
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||
for (precno = 0; precno < img->tile[tileno].pw * img->tile[tileno].ph; precno++)
|
||||
{
|
||||
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||
for(layno = 0; layno < img->Layer ; layno++)
|
||||
{
|
||||
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||
layer_Idx->offset = 0; /* start position */
|
||||
layer_Idx->len_header = 0; /* length */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int t2_decode_packets(unsigned char *src, int len, j2k_image_t *img, j2k_cp_t *cp, int tileno, tcd_tile_t *tile, info_image_t *imgg) {
|
||||
unsigned char *c = src;
|
||||
pi_iterator_t *pi;
|
||||
int pino, compno,e;
|
||||
int partno;
|
||||
info_tile_part_t *tile_part;
|
||||
int position;
|
||||
int length_read;
|
||||
info_tile_t *tile_Idx;
|
||||
info_compo_t *compo_Idx;
|
||||
info_reso_t *reso_Idx;
|
||||
info_prec_t *prec_Idx;
|
||||
info_layer_t *layer_Idx;
|
||||
|
||||
t2_init_info_packets(imgg, cp); /* Initialize the packets information : LEN and OFFSET to 0 */
|
||||
|
||||
tile_Idx = &imgg->tile[tileno];
|
||||
tile_Idx->num_packet = 0;
|
||||
pi = pi_create(img, cp, tileno);
|
||||
partno = 0;
|
||||
tile_part = &tile_Idx->tile_parts[partno];
|
||||
position = tile_part->end_header + 1;
|
||||
length_read = 0;
|
||||
|
||||
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++)
|
||||
{
|
||||
while (pi_next(&pi[pino]))
|
||||
{
|
||||
compo_Idx = &tile_Idx->compo[pi[pino].compno];
|
||||
reso_Idx = &compo_Idx->reso[pi[pino].resno];
|
||||
prec_Idx = &reso_Idx->prec[pi[pino].precno];
|
||||
layer_Idx = &prec_Idx->layer[pi[pino].layno];
|
||||
|
||||
layer_Idx->offset = position;
|
||||
layer_Idx->offset_header = position;
|
||||
|
||||
e = t2_decode_packet(c, src+len-c, tile, cp, &cp->tcps[tileno], pi[pino].compno, pi[pino].resno, pi[pino].precno, pi[pino].layno,layer_Idx);
|
||||
if (e == -999)
|
||||
{
|
||||
break;
|
||||
} else
|
||||
c += e;
|
||||
position += e;
|
||||
|
||||
/* Update position in case of multiple tile-parts for a tile >> */
|
||||
length_read += e;
|
||||
if (length_read >= (tile_part->end_pos - tile_part->end_header))
|
||||
{
|
||||
partno++;
|
||||
tile_part = &tile_Idx->tile_parts[partno];
|
||||
position = tile_part->end_header + 1;
|
||||
length_read = 0;
|
||||
}
|
||||
/* << end_update */
|
||||
|
||||
tile_Idx->num_packet++;
|
||||
}
|
||||
|
||||
// FREE space memory taken by pi
|
||||
for (compno = 0; compno < pi[pino].numcomps; compno++)
|
||||
{
|
||||
free(pi[pino].comps[compno].resolutions);
|
||||
}
|
||||
free(pi[pino].comps);
|
||||
}
|
||||
|
||||
free(pi[0].include);
|
||||
free(pi);
|
||||
|
||||
if (e==-999)
|
||||
return e;
|
||||
else
|
||||
{
|
||||
imgg->num_packet_max=int_max(imgg->num_packet_max,tile_Idx->num_packet);
|
||||
return c-src;
|
||||
}
|
||||
}
|
||||
@@ -1,285 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "tcd.h"
|
||||
#include "int.h"
|
||||
#include "t2.h"
|
||||
#include <setjmp.h>
|
||||
#include <float.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static tcd_image_t tcd_image;
|
||||
|
||||
static j2k_image_t *tcd_img;
|
||||
static j2k_cp_t *tcd_cp;
|
||||
|
||||
extern jmp_buf j2k_error;
|
||||
|
||||
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg) {
|
||||
int tileno, compno, resno, bandno, precno, cblkno;
|
||||
tcd_img=img;
|
||||
tcd_cp=cp;
|
||||
tcd_image.tw=cp->tw;
|
||||
tcd_image.th=cp->th;
|
||||
tcd_image.tiles=(tcd_tile_t*)malloc(cp->tw*cp->th*sizeof(tcd_tile_t));
|
||||
for (tileno=0; tileno<cp->tw*cp->th; tileno++) {
|
||||
j2k_tcp_t *tcp=&cp->tcps[tileno];
|
||||
tcd_tile_t *tile=&tcd_image.tiles[tileno];
|
||||
// cfr p59 ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
|
||||
int p=tileno%cp->tw; // si numerotation matricielle ..
|
||||
int q=tileno/cp->tw; // .. coordonnees de la tile (q,p) q pour ligne et p pour colonne
|
||||
info_tile_t *tile_Idx=&imgg->tile[tileno]; // INDEX
|
||||
|
||||
// 4 borders of the tile rescale on the image if necessary
|
||||
tile->x0=int_max(cp->tx0+p*cp->tdx, img->x0);
|
||||
tile->y0=int_max(cp->ty0+q*cp->tdy, img->y0);
|
||||
tile->x1=int_min(cp->tx0+(p+1)*cp->tdx, img->x1);
|
||||
tile->y1=int_min(cp->ty0+(q+1)*cp->tdy, img->y1);
|
||||
|
||||
tile->numcomps=img->numcomps;
|
||||
tile->comps=(tcd_tilecomp_t*)malloc(img->numcomps*sizeof(tcd_tilecomp_t));
|
||||
tile_Idx->compo=(info_compo_t*)malloc(img->numcomps*sizeof(info_compo_t)); // INDEX
|
||||
for (compno=0; compno<tile->numcomps; compno++) {
|
||||
j2k_tccp_t *tccp=&tcp->tccps[compno];
|
||||
tcd_tilecomp_t *tilec=&tile->comps[compno];
|
||||
info_compo_t *compo_Idx=&tile_Idx->compo[compno]; // INDEX
|
||||
|
||||
// border of each tile component (global)
|
||||
tilec->x0=int_ceildiv(tile->x0, img->comps[compno].dx);
|
||||
tilec->y0=int_ceildiv(tile->y0, img->comps[compno].dy);
|
||||
tilec->x1=int_ceildiv(tile->x1, img->comps[compno].dx);
|
||||
tilec->y1=int_ceildiv(tile->y1, img->comps[compno].dy);
|
||||
|
||||
tilec->data=(int*)malloc(sizeof(int)*(tilec->x1-tilec->x0)*(tilec->y1-tilec->y0));
|
||||
tilec->numresolutions=tccp->numresolutions;
|
||||
tilec->resolutions=(tcd_resolution_t*)malloc(tilec->numresolutions*sizeof(tcd_resolution_t));
|
||||
compo_Idx->reso=(info_reso_t*)malloc(tilec->numresolutions*sizeof(info_reso_t)); // INDEX
|
||||
for (resno=0; resno<tilec->numresolutions; resno++) {
|
||||
int pdx, pdy;
|
||||
int levelno=tilec->numresolutions-1-resno;
|
||||
int tlprcxstart, tlprcystart, brprcxend, brprcyend;
|
||||
int tlcbgxstart, tlcbgystart, brcbgxend, brcbgyend;
|
||||
int cbgwidthexpn, cbgheightexpn;
|
||||
int cblkwidthexpn, cblkheightexpn;
|
||||
tcd_resolution_t *res=&tilec->resolutions[resno];
|
||||
info_reso_t *res_Idx=&compo_Idx->reso[resno]; // INDEX
|
||||
int precno_Idx; // INDEX
|
||||
|
||||
// border for each resolution level (global)
|
||||
res->x0=int_ceildivpow2(tilec->x0, levelno);
|
||||
res->y0=int_ceildivpow2(tilec->y0, levelno);
|
||||
res->x1=int_ceildivpow2(tilec->x1, levelno);
|
||||
res->y1=int_ceildivpow2(tilec->y1, levelno);
|
||||
|
||||
res->numbands=resno==0?1:3;
|
||||
// p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000)
|
||||
if (tccp->csty&J2K_CCP_CSTY_PRT) {
|
||||
pdx=tccp->prcw[resno];
|
||||
pdy=tccp->prch[resno];
|
||||
} else {
|
||||
pdx=15;
|
||||
pdy=15;
|
||||
}
|
||||
// p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
|
||||
tlprcxstart=int_floordivpow2(res->x0, pdx)<<pdx;
|
||||
tlprcystart=int_floordivpow2(res->y0, pdy)<<pdy;
|
||||
brprcxend=int_ceildivpow2(res->x1, pdx)<<pdx;
|
||||
brprcyend=int_ceildivpow2(res->y1, pdy)<<pdy;
|
||||
res->pw=(brprcxend-tlprcxstart)>>pdx;
|
||||
res->ph=(brprcyend-tlprcystart)>>pdy;
|
||||
|
||||
// <INDEX>
|
||||
imgg->tile[tileno].pw=res->pw;
|
||||
imgg->tile[tileno].ph=res->ph;
|
||||
|
||||
res_Idx->prec=(info_prec_t*)malloc(res->pw*res->ph*sizeof(info_prec_t));
|
||||
for (precno_Idx=0;precno_Idx<res->pw*res->ph;precno_Idx++)
|
||||
{
|
||||
info_prec_t *prec_Idx = &res_Idx->prec[precno_Idx];
|
||||
prec_Idx->layer=(info_layer_t*)malloc(imgg->Layer*sizeof(info_layer_t));
|
||||
}
|
||||
|
||||
imgg->pw=res->pw; // old parser version
|
||||
imgg->ph=res->ph; // old parser version
|
||||
imgg->pdx=1<<pdx;
|
||||
imgg->pdy=1<<pdy;
|
||||
// </INDEX>
|
||||
|
||||
if (resno==0) {
|
||||
tlcbgxstart=tlprcxstart;
|
||||
tlcbgystart=tlprcystart;
|
||||
brcbgxend=brprcxend;
|
||||
brcbgyend=brprcyend;
|
||||
cbgwidthexpn=pdx;
|
||||
cbgheightexpn=pdy;
|
||||
} else {
|
||||
tlcbgxstart=int_ceildivpow2(tlprcxstart, 1);
|
||||
tlcbgystart=int_ceildivpow2(tlprcystart, 1);
|
||||
brcbgxend=int_ceildivpow2(brprcxend, 1);
|
||||
brcbgyend=int_ceildivpow2(brprcyend, 1);
|
||||
cbgwidthexpn=pdx-1;
|
||||
cbgheightexpn=pdy-1;
|
||||
}
|
||||
|
||||
cblkwidthexpn=int_min(tccp->cblkw, cbgwidthexpn);
|
||||
cblkheightexpn=int_min(tccp->cblkh, cbgheightexpn);
|
||||
|
||||
for (bandno=0; bandno<res->numbands; bandno++) {
|
||||
int x0b, y0b;
|
||||
tcd_band_t *band=&res->bands[bandno];
|
||||
band->bandno=resno==0?0:bandno+1;
|
||||
x0b=(band->bandno==1)||(band->bandno==3)?1:0;
|
||||
y0b=(band->bandno==2)||(band->bandno==3)?1:0;
|
||||
|
||||
if (band->bandno==0) {
|
||||
// band border (global)
|
||||
band->x0=int_ceildivpow2(tilec->x0, levelno);
|
||||
band->y0=int_ceildivpow2(tilec->y0, levelno);
|
||||
band->x1=int_ceildivpow2(tilec->x1, levelno);
|
||||
band->y1=int_ceildivpow2(tilec->y1, levelno);
|
||||
} else {
|
||||
// band border (global)
|
||||
band->x0=int_ceildivpow2(tilec->x0-(1<<levelno)*x0b, levelno+1);
|
||||
band->y0=int_ceildivpow2(tilec->y0-(1<<levelno)*y0b, levelno+1);
|
||||
band->x1=int_ceildivpow2(tilec->x1-(1<<levelno)*x0b, levelno+1);
|
||||
band->y1=int_ceildivpow2(tilec->y1-(1<<levelno)*y0b, levelno+1);
|
||||
}
|
||||
|
||||
band->precincts=(tcd_precinct_t*)malloc(res->pw*res->ph*sizeof(tcd_precinct_t));
|
||||
|
||||
for (precno=0; precno<res->pw*res->ph; precno++) {
|
||||
int tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend;
|
||||
int cbgxstart=tlcbgxstart+(precno%res->pw)*(1<<cbgwidthexpn);
|
||||
int cbgystart=tlcbgystart+(precno/res->pw)*(1<<cbgheightexpn);
|
||||
int cbgxend=cbgxstart+(1<<cbgwidthexpn);
|
||||
int cbgyend=cbgystart+(1<<cbgheightexpn);
|
||||
tcd_precinct_t *prc=&band->precincts[precno];
|
||||
// precinct size (global)
|
||||
prc->x0=int_max(cbgxstart, band->x0);
|
||||
prc->y0=int_max(cbgystart, band->y0);
|
||||
prc->x1=int_min(cbgxend, band->x1);
|
||||
prc->y1=int_min(cbgyend, band->y1);
|
||||
|
||||
tlcblkxstart=int_floordivpow2(prc->x0, cblkwidthexpn)<<cblkwidthexpn;
|
||||
tlcblkystart=int_floordivpow2(prc->y0, cblkheightexpn)<<cblkheightexpn;
|
||||
brcblkxend=int_ceildivpow2(prc->x1, cblkwidthexpn)<<cblkwidthexpn;
|
||||
brcblkyend=int_ceildivpow2(prc->y1, cblkheightexpn)<<cblkheightexpn;
|
||||
prc->cw=(brcblkxend-tlcblkxstart)>>cblkwidthexpn;
|
||||
prc->ch=(brcblkyend-tlcblkystart)>>cblkheightexpn;
|
||||
|
||||
prc->cblks=(tcd_cblk_t*)malloc(prc->cw*prc->ch*sizeof(tcd_cblk_t));
|
||||
|
||||
prc->incltree=tgt_create(prc->cw, prc->ch);
|
||||
prc->imsbtree=tgt_create(prc->cw, prc->ch);
|
||||
|
||||
for (cblkno=0; cblkno<prc->cw*prc->ch; cblkno++) {
|
||||
int cblkxstart=tlcblkxstart+(cblkno%prc->cw)*(1<<cblkwidthexpn);
|
||||
int cblkystart=tlcblkystart+(cblkno/prc->cw)*(1<<cblkheightexpn);
|
||||
int cblkxend=cblkxstart+(1<<cblkwidthexpn);
|
||||
int cblkyend=cblkystart+(1<<cblkheightexpn);
|
||||
tcd_cblk_t *cblk=&prc->cblks[cblkno];
|
||||
// code-block size (global)
|
||||
cblk->x0=int_max(cblkxstart, prc->x0);
|
||||
cblk->y0=int_max(cblkystart, prc->y0);
|
||||
cblk->x1=int_min(cblkxend, prc->x1);
|
||||
cblk->y1=int_min(cblkyend, prc->y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tcd_free(j2k_image_t *img, j2k_cp_t *cp) {
|
||||
int tileno, compno, resno, bandno, precno;
|
||||
tcd_img=img;
|
||||
tcd_cp=cp;
|
||||
tcd_image.tw=cp->tw;
|
||||
tcd_image.th=cp->th;
|
||||
for (tileno=0; tileno<tcd_image.tw*tcd_image.th; tileno++)
|
||||
{
|
||||
// j2k_tcp_t *tcp=&cp->tcps[curtileno];
|
||||
tcd_tile_t *tile=&tcd_image.tiles[tileno];
|
||||
for (compno=0; compno<tile->numcomps; compno++)
|
||||
{
|
||||
tcd_tilecomp_t *tilec=&tile->comps[compno];
|
||||
for (resno=0; resno<tilec->numresolutions; resno++)
|
||||
{
|
||||
tcd_resolution_t *res=&tilec->resolutions[resno];
|
||||
for (bandno=0; bandno<res->numbands; bandno++)
|
||||
{
|
||||
tcd_band_t *band=&res->bands[bandno];
|
||||
for (precno=0; precno<res->pw*res->ph; precno++)
|
||||
{
|
||||
tcd_precinct_t *prc=&band->precincts[precno];
|
||||
|
||||
if (prc->incltree!=NULL)
|
||||
tgt_destroy(prc->incltree);
|
||||
if (prc->imsbtree!=NULL)
|
||||
tgt_destroy(prc->imsbtree);
|
||||
free(prc->cblks);
|
||||
} // for (precno
|
||||
free(band->precincts);
|
||||
} // for (bandno
|
||||
} // for (resno
|
||||
free(tilec->resolutions);
|
||||
} // for (compno
|
||||
free(tile->comps);
|
||||
} // for (tileno
|
||||
free(tcd_image.tiles);
|
||||
}
|
||||
|
||||
|
||||
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg) {
|
||||
int l;
|
||||
int eof=0;
|
||||
tcd_tile_t *tile;
|
||||
|
||||
tile = &tcd_image.tiles[tileno];
|
||||
|
||||
l = t2_decode_packets(src, len, tcd_img, tcd_cp, tileno, tile, imgg);
|
||||
|
||||
if (l==-999)
|
||||
{
|
||||
eof=1;
|
||||
fprintf(stderr, "tcd_decode: incomplete bistream\n");
|
||||
}
|
||||
|
||||
if (eof) {
|
||||
longjmp(j2k_error, 1);
|
||||
}
|
||||
|
||||
l=1;
|
||||
return l;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TCD_H
|
||||
#define __TCD_H
|
||||
|
||||
#include "j2k.h"
|
||||
#include "tgt.h"
|
||||
|
||||
typedef struct {
|
||||
int numpasses;
|
||||
int len;
|
||||
unsigned char *data;
|
||||
int maxpasses;
|
||||
int numnewpasses;
|
||||
int newlen;
|
||||
} tcd_seg_t;
|
||||
|
||||
typedef struct {
|
||||
int rate;
|
||||
double distortiondec;
|
||||
} tcd_pass_t;
|
||||
|
||||
typedef struct {
|
||||
int numpasses;
|
||||
int len;
|
||||
unsigned char *data;
|
||||
} tcd_layer_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int numbps;
|
||||
int numlenbits;
|
||||
int len;
|
||||
int numpasses;
|
||||
int numnewpasses;
|
||||
int numsegs;
|
||||
tcd_seg_t segs[100];
|
||||
unsigned char data[8192];
|
||||
int numpassesinlayers;
|
||||
tcd_layer_t layers[100];
|
||||
int totalpasses;
|
||||
tcd_pass_t passes[100];
|
||||
} tcd_cblk_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int cw, ch;
|
||||
tcd_cblk_t *cblks;
|
||||
tgt_tree_t *incltree;
|
||||
tgt_tree_t *imsbtree;
|
||||
} tcd_precinct_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int bandno;
|
||||
tcd_precinct_t *precincts;
|
||||
int numbps;
|
||||
int stepsize;
|
||||
} tcd_band_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int previous_x0, previous_y0, previous_x1, previous_y1; // usefull for the DWT
|
||||
int cas_col, cas_row; // usefull for the DWT
|
||||
int pw, ph;
|
||||
int numbands;
|
||||
tcd_band_t bands[3];
|
||||
} tcd_resolution_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int previous_row, previous_col; // usefull for the DWT
|
||||
int numresolutions;
|
||||
tcd_resolution_t *resolutions;
|
||||
int *data;
|
||||
} tcd_tilecomp_t;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0, x1, y1;
|
||||
int numcomps;
|
||||
//int PPT;
|
||||
//int len_ppt;
|
||||
tcd_tilecomp_t *comps;
|
||||
} tcd_tile_t;
|
||||
|
||||
typedef struct {
|
||||
int tw, th;
|
||||
tcd_tile_t *tiles;
|
||||
} tcd_image_t;
|
||||
|
||||
/*
|
||||
* Initialize the tile coder/decoder
|
||||
* img: raw image
|
||||
* cp: coding parameters
|
||||
* imgg: creation of index file
|
||||
*/
|
||||
|
||||
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg);
|
||||
|
||||
void tcd_free(j2k_image_t *img, j2k_cp_t *cp);
|
||||
|
||||
/*
|
||||
* Decode a tile from a buffer into a raw image
|
||||
* src: source buffer
|
||||
* len: length of the source buffer
|
||||
* tileno: number that identifies the tile that will be decoded
|
||||
* imgg : Structure for index file
|
||||
*/
|
||||
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg);
|
||||
|
||||
#endif
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "tgt.h"
|
||||
#include "bio.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/// <summary>
|
||||
/// Reset tag-tree.
|
||||
/// </summary>
|
||||
void tgt_reset(tgt_tree_t *tree)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<tree->numnodes; i++) {
|
||||
tree->nodes[i].value=999;
|
||||
tree->nodes[i].low=0;
|
||||
tree->nodes[i].known=0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create tag-tree.
|
||||
/// </summary>
|
||||
tgt_tree_t *tgt_create(int numleafsh, int numleafsv)
|
||||
{
|
||||
int nplh[32];
|
||||
int nplv[32];
|
||||
tgt_node_t *node;
|
||||
tgt_node_t *parentnode;
|
||||
tgt_node_t *parentnode0;
|
||||
tgt_tree_t *tree;
|
||||
int i, j, k;
|
||||
int numlvls;
|
||||
int n;
|
||||
|
||||
tree=(tgt_tree_t*)malloc(sizeof(tgt_tree_t));
|
||||
tree->numleafsh=numleafsh;
|
||||
tree->numleafsv=numleafsv;
|
||||
|
||||
numlvls=0;
|
||||
nplh[0]=numleafsh;
|
||||
nplv[0]=numleafsv;
|
||||
tree->numnodes=0;
|
||||
do {
|
||||
n=nplh[numlvls]*nplv[numlvls];
|
||||
nplh[numlvls+1]=(nplh[numlvls]+1)/2;
|
||||
nplv[numlvls+1]=(nplv[numlvls]+1)/2;
|
||||
tree->numnodes+=n;
|
||||
++numlvls;
|
||||
} while (n>1);
|
||||
|
||||
tree->nodes=(tgt_node_t*)malloc(tree->numnodes*sizeof(tgt_node_t));
|
||||
|
||||
node=tree->nodes;
|
||||
parentnode=&tree->nodes[tree->numleafsh*tree->numleafsv];
|
||||
parentnode0=parentnode;
|
||||
|
||||
for (i=0; i<numlvls-1; ++i) {
|
||||
for (j=0; j<nplv[i]; ++j) {
|
||||
k=nplh[i];
|
||||
while (--k>=0) {
|
||||
node->parent=parentnode;
|
||||
++node;
|
||||
if (--k >= 0) {
|
||||
node->parent=parentnode;
|
||||
++node;
|
||||
}
|
||||
++parentnode;
|
||||
}
|
||||
if ((j&1)||j==nplv[i]-1) {
|
||||
parentnode0=parentnode;
|
||||
} else {
|
||||
parentnode=parentnode0;
|
||||
parentnode0+=nplh[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
node->parent=0;
|
||||
|
||||
tgt_reset(tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroy tag-tree.
|
||||
/// </summary>
|
||||
void tgt_destroy(tgt_tree_t *t) {
|
||||
free(t->nodes);
|
||||
free(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the value of a leaf of the tag-tree.
|
||||
/// </summary>
|
||||
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value) {
|
||||
tgt_node_t *node;
|
||||
node=&tree->nodes[leafno];
|
||||
while (node && node->value>value) {
|
||||
node->value=value;
|
||||
node=node->parent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode the value of a leaf of the tag-tree.
|
||||
/// </summary>
|
||||
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold)
|
||||
{
|
||||
tgt_node_t *stk[31];
|
||||
tgt_node_t **stkptr;
|
||||
tgt_node_t *node;
|
||||
int low;
|
||||
|
||||
stkptr=stk;
|
||||
node=&tree->nodes[leafno];
|
||||
while (node->parent) {
|
||||
*stkptr++=node;
|
||||
node=node->parent;
|
||||
}
|
||||
|
||||
low=0;
|
||||
for (;;) {
|
||||
if (low>node->low) {
|
||||
node->low=low;
|
||||
} else {
|
||||
low=node->low;
|
||||
}
|
||||
while (low<threshold && low<node->value) {
|
||||
if (bio_read(1)) {
|
||||
node->value=low;
|
||||
} else {
|
||||
++low;
|
||||
}
|
||||
}
|
||||
node->low=low;
|
||||
if (stkptr==stk) {
|
||||
break;
|
||||
}
|
||||
node=*--stkptr;
|
||||
}
|
||||
|
||||
return (node->value<threshold)?1:0;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2002, David Janssens
|
||||
* Copyright (c) 2003, Yannick Verschueren
|
||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TGT_H
|
||||
#define __TGT_H
|
||||
|
||||
typedef struct tgt_node {
|
||||
struct tgt_node *parent;
|
||||
int value;
|
||||
int low;
|
||||
int known;
|
||||
} tgt_node_t;
|
||||
|
||||
typedef struct {
|
||||
int numleafsh;
|
||||
int numleafsv;
|
||||
int numnodes;
|
||||
tgt_node_t *nodes;
|
||||
} tgt_tree_t;
|
||||
|
||||
/*
|
||||
* Create a tag-tree
|
||||
* numleafsh: width of the array of leafs of the tree
|
||||
* numleafsv: height of the array of leafs of the tree
|
||||
*/
|
||||
tgt_tree_t *tgt_create(int numleafsh, int numleafsv);
|
||||
|
||||
/*
|
||||
* Reset a tag-tree (set all leafs to 0)
|
||||
* tree: tag-tree to reset
|
||||
*/
|
||||
void tgt_reset(tgt_tree_t *tree);
|
||||
|
||||
/*
|
||||
* Destroy a tag-tree, liberating memory
|
||||
* tree: tag-tree to destroy
|
||||
*/
|
||||
void tgt_destroy(tgt_tree_t *tree);
|
||||
|
||||
/*
|
||||
* Set the value of a leaf of a tag-tree
|
||||
* tree: tag-tree to modify
|
||||
* leafno: number that identifies the leaf to modify
|
||||
* value: new value of the leaf
|
||||
*/
|
||||
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value);
|
||||
|
||||
/*
|
||||
* Decode the value of a leaf of the tag-tree up to a given threshold
|
||||
* leafno: number that identifies the leaf to decode
|
||||
* threshold: threshold to use when decoding value of the leaf
|
||||
*/
|
||||
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold);
|
||||
|
||||
#endif
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief jpip_to_jp2 is a program to convert JPT- JPP- stream to JP2 file
|
||||
*
|
||||
* \section impinst Implementing instructions
|
||||
* This program takes two arguments. \n
|
||||
* -# Input JPT or JPP file
|
||||
* -# Output JP2 file\n
|
||||
* % ./jpip_to_jp2 input.jpt output.jp2
|
||||
* or
|
||||
* % ./jpip_to_jp2 input.jpp output.jp2
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "msgqueue_manager.h"
|
||||
#include "byte_manager.h"
|
||||
#include "ihdrbox_manager.h"
|
||||
#include "metadata_manager.h"
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
msgqueue_param_t *msgqueue;
|
||||
int infd, outfd;
|
||||
Byte8_t jpiplen, jp2len;
|
||||
struct stat sb;
|
||||
Byte_t *jpipstream, *jp2stream;
|
||||
metadatalist_param_t *metadatalist;
|
||||
ihdrbox_param_t *ihdrbox;
|
||||
|
||||
if( argc < 3){
|
||||
fprintf( stderr, "Too few arguments:\n");
|
||||
fprintf( stderr, " - input jpt or jpp file\n");
|
||||
fprintf( stderr, " - output jp2 file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(( infd = open( argv[1], O_RDONLY)) == -1){
|
||||
fprintf( stderr, "file %s not exist\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( fstat( infd, &sb) == -1){
|
||||
fprintf( stderr, "input file stream is broken\n");
|
||||
return -1;
|
||||
}
|
||||
jpiplen = (Byte8_t)sb.st_size;
|
||||
|
||||
jpipstream = (Byte_t *)malloc( jpiplen);
|
||||
|
||||
if( read( infd, jpipstream, jpiplen) != jpiplen){
|
||||
fprintf( stderr, "file reading error\n");
|
||||
free( jpipstream);
|
||||
return -1;
|
||||
}
|
||||
close(infd);
|
||||
|
||||
metadatalist = gene_metadatalist();
|
||||
msgqueue = gene_msgqueue( true, NULL);
|
||||
parse_JPIPstream( jpipstream, jpiplen, 0, msgqueue);
|
||||
parse_metamsg( msgqueue, jpipstream, jpiplen, metadatalist);
|
||||
print_msgqueue( msgqueue);
|
||||
//print_allmetadata( metadatalist);
|
||||
|
||||
ihdrbox = get_ihdrbox( metadatalist, jpipstream);
|
||||
|
||||
printf("W*H: %d*%d\n", ihdrbox->height, ihdrbox->width);
|
||||
printf("NC: %d, bpc: %d\n", ihdrbox->nc, ihdrbox->bpc);
|
||||
|
||||
jp2stream = recons_jp2( msgqueue, jpipstream, msgqueue->first->csn, &jp2len);
|
||||
|
||||
if(( outfd = open( argv[2], O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){
|
||||
fprintf( stderr, "file %s open error\n", argv[2]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( write( outfd, jp2stream, jp2len) != jp2len)
|
||||
fprintf( stderr, "jp2 file write error\n");
|
||||
|
||||
//print_msgqueue( msgqueue);
|
||||
|
||||
free( ihdrbox);
|
||||
free( jp2stream);
|
||||
close(outfd);
|
||||
|
||||
delete_msgqueue( &msgqueue);
|
||||
delete_metadatalist( &metadatalist);
|
||||
|
||||
free( jpipstream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* $Id: test_index.c 46 2011-02-17 14:50:55Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief test_index is a program to test the index code format of a JP2 file
|
||||
*
|
||||
* \section impinst Implementing instructions
|
||||
* This program takes one argument, and print out text type index information to the terminal. \n
|
||||
* -# Input JP2 file\n
|
||||
* % ./test_index input.jp2\n
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "index_manager.h"
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
#define logstream FCGI_stdout
|
||||
#else
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif //SERVER
|
||||
|
||||
|
||||
/**
|
||||
* Open JP2 file with the check of JP2 header
|
||||
*
|
||||
* @param[in] filename file name string
|
||||
* @return file descriptor
|
||||
*/
|
||||
int myopen_jp2file( char filename[]);
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
index_param_t *jp2idx;
|
||||
|
||||
if((fd = myopen_jp2file( argv[1])) == -1){
|
||||
fprintf( stderr, "jp2 file open error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( !(jp2idx = parse_jp2file( fd))){
|
||||
fprintf( FCGI_stdout, "Status: 501\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
print_index( *jp2idx);
|
||||
|
||||
delete_index( &jp2idx);
|
||||
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
|
||||
|
||||
int myopen_jp2file( char filename[])
|
||||
{
|
||||
int fd;
|
||||
char *data;
|
||||
|
||||
if( (fd = open( filename, O_RDONLY)) == -1){
|
||||
fprintf( FCGI_stdout, "Reason: Target %s not found\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
// Check resource is a JP family file.
|
||||
if( lseek( fd, 0, SEEK_SET)==-1){
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: Target %s broken (lseek error)\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = (char *)malloc( 12); // size of header
|
||||
if( read( fd, data, 12) != 12){
|
||||
free( data);
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: Target %s broken (read error)\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( *data || *(data + 1) || *(data + 2) ||
|
||||
*(data + 3) != 12 || strncmp (data + 4, "jP \r\n\x87\n", 8)){
|
||||
free( data);
|
||||
close(fd);
|
||||
fprintf( FCGI_stdout, "Reason: No JPEG 2000 Signature box in target %s\r\n", filename);
|
||||
return -1;
|
||||
}
|
||||
free( data);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -1,91 +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 "")
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
# 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
|
||||
)
|
||||
|
||||
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,105 +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
|
||||
|
||||
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/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@
|
||||
mj2_to_frames_SOURCES = \
|
||||
$(OPJ_SRC) \
|
||||
../common/color.c \
|
||||
../common/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,64 +0,0 @@
|
||||
#mj2 Makefile.nix
|
||||
include ../config.nix
|
||||
|
||||
CFLAGS = -Wall
|
||||
|
||||
INSTALL_BIN = $(prefix)/bin
|
||||
USERLIBS = -lm
|
||||
INCLUDE = -I.. -I. -I../libopenjpeg -I../common
|
||||
|
||||
ifeq ($(WITH_LCMS2),yes)
|
||||
INCLUDE += $(LCMS2_INCLUDE)
|
||||
USERLIBS += $(LCMS2_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_LCMS1),yes)
|
||||
INCLUDE += $(LCMS1_INCLUDE)
|
||||
USERLIBS += $(LCMS1_LIB)
|
||||
endif
|
||||
|
||||
CFLAGS += $(INCLUDE) -lstdc++ # -g -p -pg
|
||||
|
||||
ifeq ($(ENABLE_SHARED),yes)
|
||||
ELIB = ../libopenjpeg.so.$(MAJOR).$(MINOR).$(BUILD)
|
||||
else
|
||||
ELIB = ../libopenjpeg.a
|
||||
endif
|
||||
|
||||
all: frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2
|
||||
install -d ../bin
|
||||
install frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 \
|
||||
wrap_j2k_in_mj2 ../bin
|
||||
|
||||
frames_to_mj2: frames_to_mj2.c $(ELIB)
|
||||
$(CC) $(CFLAGS) ../common/getopt.c mj2_convert.c mj2.c frames_to_mj2.c \
|
||||
-o frames_to_mj2 $(ELIB) $(USERLIBS)
|
||||
|
||||
mj2_to_frames: mj2_to_frames.c $(ELIB)
|
||||
$(CC) $(CFLAGS) ../common/getopt.c mj2_convert.c mj2.c \
|
||||
../common/color.c mj2_to_frames.c \
|
||||
-o mj2_to_frames $(ELIB) $(USERLIBS)
|
||||
|
||||
extract_j2k_from_mj2: extract_j2k_from_mj2.c $(ELIB)
|
||||
$(CC) $(CFLAGS) mj2.c extract_j2k_from_mj2.c \
|
||||
-o extract_j2k_from_mj2 $(ELIB) $(USERLIBS)
|
||||
|
||||
wrap_j2k_in_mj2: wrap_j2k_in_mj2.c $(ELIB)
|
||||
$(CC) $(CFLAGS) mj2.c wrap_j2k_in_mj2.c \
|
||||
-o wrap_j2k_in_mj2 $(ELIB) $(USERLIBS)
|
||||
|
||||
clean:
|
||||
rm -f frames_to_mj2 mj2_to_frames extract_j2k_from_mj2 wrap_j2k_in_mj2
|
||||
|
||||
install: all
|
||||
install -d $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root frames_to_mj2 $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root mj2_to_frames $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root extract_j2k_from_mj2 $(DESTDIR)$(INSTALL_BIN)
|
||||
install -m 755 -o root -g root wrap_j2k_in_mj2 $(DESTDIR)$(INSTALL_BIN)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/frames_to_mj2
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/mj2_to_frames
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/extract_j2k_from_mj2
|
||||
rm -f $(DESTDIR)$(INSTALL_BIN)/wrap_j2k_in_mj2
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
autoreconf --install --force
|
||||
|
||||
37
cmake/CTestCustom.cmake.in
Normal file
37
cmake/CTestCustom.cmake.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# For further details regarding this file,
|
||||
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||
#
|
||||
# and
|
||||
# http://www.kitware.com/blog/home/post/27
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||
|
||||
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
|
||||
# Exclude files from the Testing directories
|
||||
".*/tests/.*"
|
||||
|
||||
# Exclude files from the ThirdParty Utilities directories
|
||||
".*/thirdparty/.*"
|
||||
)
|
||||
|
||||
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
# java also warns about deprecated API
|
||||
".*java.*deprecation"
|
||||
".*deprecation.*"
|
||||
# supress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
"libpng.*has no symbols"
|
||||
)
|
||||
26
cmake/EnsureFileInclude.cmake
Normal file
26
cmake/EnsureFileInclude.cmake
Normal file
@@ -0,0 +1,26 @@
|
||||
# Ensure that an include file is provided by the system
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# provided by cmake
|
||||
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
|
||||
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
if (NOT ${${VARIABLE_NAME}})
|
||||
if (${MANDATORY_STATUS})
|
||||
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user