Compare commits
582 Commits
version.2.
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7113c4e3bb | ||
![]() |
b8197de716 | ||
![]() |
b079198838 | ||
![]() |
110d31891b | ||
![]() |
cc0c71c30b | ||
![]() |
5695ac15ff | ||
![]() |
df5e8628f2 | ||
![]() |
b0c0f0ff04 | ||
![]() |
9afc1699f0 | ||
![]() |
34dae137a9 | ||
![]() |
4d5c5e7c48 | ||
![]() |
fac916f72a | ||
![]() |
8715ce2749 | ||
![]() |
045aa4d9f2 | ||
![]() |
da94042481 | ||
![]() |
31d44f0280 | ||
![]() |
3aaeea7ce8 | ||
![]() |
6e7616c83c | ||
![]() |
9a07ccb3d0 | ||
![]() |
f88c9974e2 | ||
![]() |
0954bc11e3 | ||
![]() |
1e69940955 | ||
![]() |
f66e120452 | ||
![]() |
d6d0f070e1 | ||
![]() |
f1f7c53308 | ||
![]() |
893143c8e1 | ||
![]() |
805972f4c8 | ||
![]() |
45ed017b1b | ||
![]() |
b21a8317e5 | ||
![]() |
5fb81d986e | ||
![]() |
48c16b2c19 | ||
![]() |
ab22c5bad5 | ||
![]() |
ef01f18dfc | ||
![]() |
e078172b1c | ||
![]() |
8750e183c6 | ||
![]() |
6c83f1468c | ||
![]() |
acfb307df4 | ||
![]() |
275aad4df8 | ||
![]() |
734d57d5f7 | ||
![]() |
c16bc057ba | ||
![]() |
ea320dab8b | ||
![]() |
d7e6b7de8a | ||
![]() |
ccd9ced49e | ||
![]() |
9f24b078c7 | ||
![]() |
51155950eb | ||
![]() |
23cee22286 | ||
![]() |
4f9abb9a45 | ||
![]() |
4a2a8693e5 | ||
![]() |
1509ccc51f | ||
![]() |
5bb919a30e | ||
![]() |
54874194a8 | ||
![]() |
d2d35bf6c2 | ||
![]() |
b8bd1b0e07 | ||
![]() |
e40c28c2e8 | ||
![]() |
18da6155b2 | ||
![]() |
b3c422654f | ||
![]() |
9db62b2011 | ||
![]() |
7948d83340 | ||
![]() |
132c4a248b | ||
![]() |
ed294598ea | ||
![]() |
fef144283f | ||
![]() |
4c5a1cc825 | ||
![]() |
bd96ed8353 | ||
![]() |
f4a708ba0f | ||
![]() |
2372cb78a0 | ||
![]() |
9d5002f8fd | ||
![]() |
e4c74f5364 | ||
![]() |
cb72c08472 | ||
![]() |
898ca6f522 | ||
![]() |
86698be6e9 | ||
![]() |
cdcb77e796 | ||
![]() |
954dad66de | ||
![]() |
48744a1342 | ||
![]() |
7d3c7a345f | ||
![]() |
69497d35c0 | ||
![]() |
d67cd2220a | ||
![]() |
e3eb0a206d | ||
![]() |
57b216bb58 | ||
![]() |
5fbb8b2645 | ||
![]() |
d4b7f03cfa | ||
![]() |
54179fe1d5 | ||
![]() |
7092f7ea11 | ||
![]() |
107eb31531 | ||
![]() |
8371491a99 | ||
![]() |
956c31d5a6 | ||
![]() |
93f7f90711 | ||
![]() |
1da397e94a | ||
![]() |
31882ad7f4 | ||
![]() |
ba1edf6cd4 | ||
![]() |
23a01dfdef | ||
![]() |
d8fef96f23 | ||
![]() |
c539808d09 | ||
![]() |
426bf8d337 | ||
![]() |
d0babeb6f6 | ||
![]() |
d1ca2b4f29 | ||
![]() |
8ba0de3e45 | ||
![]() |
2e0779e250 | ||
![]() |
e55130d3c5 | ||
![]() |
4d2b6a671a | ||
![]() |
aae066debc | ||
![]() |
6609719b40 | ||
![]() |
1a8318f6c2 | ||
![]() |
162f6199c0 | ||
![]() |
8f9cc62b3f | ||
![]() |
44a499f2ac | ||
![]() |
94cfb1b008 | ||
![]() |
17a0a8a195 | ||
![]() |
ba0cf122f6 | ||
![]() |
da56086e01 | ||
![]() |
04b8cbd27a | ||
![]() |
e1e018a8dc | ||
![]() |
b51d088267 | ||
![]() |
4f11e89c80 | ||
![]() |
9a20f8e8d1 | ||
![]() |
72deb588cb | ||
![]() |
cd77b6003b | ||
![]() |
f40a2ff2ad | ||
![]() |
be42e72d22 | ||
![]() |
15f081c896 | ||
![]() |
ad593c9e06 | ||
![]() |
319fc971fe | ||
![]() |
e166e4a209 | ||
![]() |
29313eb5f1 | ||
![]() |
e982d03966 | ||
![]() |
66fd497765 | ||
![]() |
20789fed4e | ||
![]() |
5947e10ff7 | ||
![]() |
e6881e7527 | ||
![]() |
2296dc9e68 | ||
![]() |
6f2ac3ee36 | ||
![]() |
c559c62853 | ||
![]() |
a9feb9addd | ||
![]() |
74e814358c | ||
![]() |
54393d9e38 | ||
![]() |
06e8dc9edd | ||
![]() |
f5446fdcfb | ||
![]() |
8611d127db | ||
![]() |
889bf16791 | ||
![]() |
6ea2ff0b06 | ||
![]() |
3436c4e9ba | ||
![]() |
e1a93d9e59 | ||
![]() |
a1c0ee9a86 | ||
![]() |
40b5a53d2f | ||
![]() |
e7797b97a1 | ||
![]() |
5e5f6999a8 | ||
![]() |
0069a2bd2f | ||
![]() |
e3100f714c | ||
![]() |
5c5ae1d51a | ||
![]() |
3767af52de | ||
![]() |
1b86fb6f48 | ||
![]() |
a42d03df79 | ||
![]() |
cb33ff43bb | ||
![]() |
6a1974d40d | ||
![]() |
87c0d7dc1e | ||
![]() |
0dd44e7dba | ||
![]() |
9cad6bc1f6 | ||
![]() |
79b1c4cc85 | ||
![]() |
c00ee8bff7 | ||
![]() |
a205f70328 | ||
![]() |
9c5b30005e | ||
![]() |
83e5e2703e | ||
![]() |
3a0253f4e2 | ||
![]() |
99c4f621bd | ||
![]() |
2e4fadf330 | ||
![]() |
8f9905936c | ||
![]() |
a834ab305f | ||
![]() |
51efe91971 | ||
![]() |
4ddc2627dd | ||
![]() |
5d56fb3115 | ||
![]() |
51cbcd5748 | ||
![]() |
f51d52f85a | ||
![]() |
c414d9c238 | ||
![]() |
e5ca873ab1 | ||
![]() |
601aa38c30 | ||
![]() |
fb4be3894e | ||
![]() |
c37d69b25e | ||
![]() |
a77717583e | ||
![]() |
968085190c | ||
![]() |
93a61459cd | ||
![]() |
38ffbbe42e | ||
![]() |
ce26e523dd | ||
![]() |
7dfcbf9d7b | ||
![]() |
4ac509182a | ||
![]() |
0ae66e891a | ||
![]() |
9f78c68953 | ||
![]() |
f080ab8ce0 | ||
![]() |
e975ca2832 | ||
![]() |
b06bed7b7b | ||
![]() |
b7a162348d | ||
![]() |
540aa58f6c | ||
![]() |
d48be27f5a | ||
![]() |
eaf55b677c | ||
![]() |
0967d64854 | ||
![]() |
5799672237 | ||
![]() |
a1fc83cc25 | ||
![]() |
ad7eb5630e | ||
![]() |
4831badeb4 | ||
![]() |
80be580d50 | ||
![]() |
05b3afd28f | ||
![]() |
e1122a8f50 | ||
![]() |
f9d47e28b9 | ||
![]() |
8034ffde8b | ||
![]() |
b3a15954f6 | ||
![]() |
83249c318f | ||
![]() |
b1a8e1adcb | ||
![]() |
ee04854e1a | ||
![]() |
b3c581760f | ||
![]() |
bd3959dc77 | ||
![]() |
fd424cfb66 | ||
![]() |
e734f0522a | ||
![]() |
9729405a8f | ||
![]() |
65f78eaa73 | ||
![]() |
08238dbed6 | ||
![]() |
c8d03fea9b | ||
![]() |
6721f8a53f | ||
![]() |
54a5860ee2 | ||
![]() |
372fead0d7 | ||
![]() |
98324bbd6b | ||
![]() |
522d13af2a | ||
![]() |
26dcb7c125 | ||
![]() |
51a67a9cbf | ||
![]() |
dd81b5892d | ||
![]() |
0cd240e2e3 | ||
![]() |
dac03fd168 | ||
![]() |
d02bf257a6 | ||
![]() |
0f1b1c63b4 | ||
![]() |
11a27e6d20 | ||
![]() |
ab8929262a | ||
![]() |
813121e688 | ||
![]() |
7a7901cd6d | ||
![]() |
c5a8732b0e | ||
![]() |
101a0034e2 | ||
![]() |
2c8ba10cc9 | ||
![]() |
30a0180d84 | ||
![]() |
99c4376aed | ||
![]() |
c3493063b9 | ||
![]() |
4042210416 | ||
![]() |
dc869c2985 | ||
![]() |
caeb91121a | ||
![]() |
891e7c298a | ||
![]() |
d60937922f | ||
![]() |
229d9cdb9c | ||
![]() |
f0a980ec16 | ||
![]() |
cc9bf1d557 | ||
![]() |
a01f7cdee0 | ||
![]() |
d753441028 | ||
![]() |
53d7f70c15 | ||
![]() |
70a16d80d9 | ||
![]() |
4560d270e0 | ||
![]() |
f33f50126c | ||
![]() |
8d2019ae73 | ||
![]() |
cf6db1641a | ||
![]() |
9df5546838 | ||
![]() |
b816ac185b | ||
![]() |
d92c2b2117 | ||
![]() |
d035952c52 | ||
![]() |
1ed6ede703 | ||
![]() |
d03c4770cb | ||
![]() |
50b561e911 | ||
![]() |
2d410fc74b | ||
![]() |
d5c460fc5f | ||
![]() |
62006e2b26 | ||
![]() |
d05b19072d | ||
![]() |
32ac092dec | ||
![]() |
27102f0b06 | ||
![]() |
87d44603a0 | ||
![]() |
74f71ec923 | ||
![]() |
5c3632b00e | ||
![]() |
a4eade843f | ||
![]() |
cba89a62a1 | ||
![]() |
4123c0ba86 | ||
![]() |
1a9cb9aef7 | ||
![]() |
0dc4914b4e | ||
![]() |
e224dee4b8 | ||
![]() |
d2ddf006a6 | ||
![]() |
a7ae153a46 | ||
![]() |
de0a9ed103 | ||
![]() |
553714a87a | ||
![]() |
1b2ebfc69a | ||
![]() |
3259fe2ff8 | ||
![]() |
bbef2a9da3 | ||
![]() |
5b6ff103bd | ||
![]() |
c86827952f | ||
![]() |
9b437b0c6a | ||
![]() |
c8ae3c5225 | ||
![]() |
07f65540b5 | ||
![]() |
8414870ca7 | ||
![]() |
2dab5fed59 | ||
![]() |
26b2728c49 | ||
![]() |
e526d435cc | ||
![]() |
f8c8222660 | ||
![]() |
d6b51b7041 | ||
![]() |
987f96004f | ||
![]() |
0b6a592372 | ||
![]() |
83c9e0b1f2 | ||
![]() |
db23831d57 | ||
![]() |
0cfe2ca4a9 | ||
![]() |
cf352af089 | ||
![]() |
c59f464a3f | ||
![]() |
05235963d9 | ||
![]() |
99fc1ab306 | ||
![]() |
f7dbcf1512 | ||
![]() |
838dfb8058 | ||
![]() |
4da7e9617f | ||
![]() |
b9ca882749 | ||
![]() |
f9df8ba19a | ||
![]() |
09c35dcb84 | ||
![]() |
f82d7f3a63 | ||
![]() |
faf63fddad | ||
![]() |
281537851b | ||
![]() |
55dbf8acff | ||
![]() |
c16c91797f | ||
![]() |
a4e93c3b0a | ||
![]() |
4bb5e24d23 | ||
![]() |
6cb56b36f6 | ||
![]() |
9c911c0e1e | ||
![]() |
3ea4486bed | ||
![]() |
6e11b55441 | ||
![]() |
c6b2fdf572 | ||
![]() |
700f8cb4f8 | ||
![]() |
7d32f11a6f | ||
![]() |
b4e8a425ae | ||
![]() |
c8a3117659 | ||
![]() |
49cbc11a19 | ||
![]() |
3d295431e6 | ||
![]() |
c08bd89739 | ||
![]() |
1621df453d | ||
![]() |
0b611c5250 | ||
![]() |
b8ba5a8357 | ||
![]() |
9add0fe298 | ||
![]() |
ecb00ea4e4 | ||
![]() |
cde7423958 | ||
![]() |
6c157b60f2 | ||
![]() |
fc131a1339 | ||
![]() |
4f157f3cf0 | ||
![]() |
41730e8cc6 | ||
![]() |
82c238f504 | ||
![]() |
52c36b4955 | ||
![]() |
b7069ce2b2 | ||
![]() |
cc2ae75450 | ||
![]() |
b97aadcf3e | ||
![]() |
1e2dcaf7b3 | ||
![]() |
175eceb020 | ||
![]() |
7981908754 | ||
![]() |
9258f8f6a7 | ||
![]() |
41a96aee5a | ||
![]() |
897d2c0b75 | ||
![]() |
e3579b6c1d | ||
![]() |
8d46ac19ff | ||
![]() |
4b02d246a4 | ||
![]() |
47b7b2787b | ||
![]() |
c31a28fcd1 | ||
![]() |
cd10f46572 | ||
![]() |
29ce132df4 | ||
![]() |
5d953558de | ||
![]() |
bac2c9e0a3 | ||
![]() |
ee0f313848 | ||
![]() |
ccdce606f1 | ||
![]() |
d7d9f84707 | ||
![]() |
4cde646cd7 | ||
![]() |
5f02757eef | ||
![]() |
4f5ec07c31 | ||
![]() |
0a27667878 | ||
![]() |
66d890bf22 | ||
![]() |
dd00120e96 | ||
![]() |
e71247bb90 | ||
![]() |
a024980007 | ||
![]() |
dc46d267f0 | ||
![]() |
c32809d464 | ||
![]() |
5be56d582c | ||
![]() |
bd291ae5a8 | ||
![]() |
f1ba09f690 | ||
![]() |
4eabbc8661 | ||
![]() |
e4be47279d | ||
![]() |
29c644ec49 | ||
![]() |
940100c28a | ||
![]() |
c31fb68ccc | ||
![]() |
15d07f33d1 | ||
![]() |
c5dd6035c9 | ||
![]() |
2eb97a851d | ||
![]() |
8a95efcd3f | ||
![]() |
38770403d4 | ||
![]() |
589cc547b9 | ||
![]() |
a521472427 | ||
![]() |
d4ac2f613d | ||
![]() |
fa9142b7e4 | ||
![]() |
f98df1c715 | ||
![]() |
3109759fd7 | ||
![]() |
0a4ac0852a | ||
![]() |
dc34a6cc8c | ||
![]() |
238f4419ab | ||
![]() |
60301842c7 | ||
![]() |
acbb297a0a | ||
![]() |
4fc1073809 | ||
![]() |
7c688c3453 | ||
![]() |
372c887aad | ||
![]() |
0df90afdf7 | ||
![]() |
75a33de3bc | ||
![]() |
f026c0541e | ||
![]() |
e4735c703d | ||
![]() |
ae7953849b | ||
![]() |
1947323329 | ||
![]() |
c3d9719cd4 | ||
![]() |
2263b6bacc | ||
![]() |
5b66156be4 | ||
![]() |
b0035538af | ||
![]() |
45ccf501f0 | ||
![]() |
15e4168ee2 | ||
![]() |
2452bb7c45 | ||
![]() |
85904a3291 | ||
![]() |
012f22958a | ||
![]() |
f3dad25c77 | ||
![]() |
e6cf1744d4 | ||
![]() |
db9b3400e5 | ||
![]() |
c423cc84e7 | ||
![]() |
d87de3a88d | ||
![]() |
6007ac5c56 | ||
![]() |
335e972554 | ||
![]() |
8c4afeff40 | ||
![]() |
ffd9db9700 | ||
![]() |
b190a91ab5 | ||
![]() |
f6843d5511 | ||
![]() |
a56819eaab | ||
![]() |
d6f2d26430 | ||
![]() |
9ac3a1572e | ||
![]() |
0905cab40a | ||
![]() |
2fc9d4956a | ||
![]() |
28c6f54798 | ||
![]() |
2c7dab7655 | ||
![]() |
96ae1b8dfc | ||
![]() |
1bbb607069 | ||
![]() |
fd1f7cf297 | ||
![]() |
5bb074611a | ||
![]() |
46c1dd22fc | ||
![]() |
06f6911d7b | ||
![]() |
ae4799ad07 | ||
![]() |
b88025b38f | ||
![]() |
b59085db0c | ||
![]() |
8048bbc7a2 | ||
![]() |
d1591be3d7 | ||
![]() |
6b7ad74e26 | ||
![]() |
635a358962 | ||
![]() |
8f798864a9 | ||
![]() |
ac9fb5a302 | ||
![]() |
775ee87776 | ||
![]() |
0b1f8eb6f7 | ||
![]() |
c887df12a3 | ||
![]() |
d1b053afe2 | ||
![]() |
5e1474cc92 | ||
![]() |
dc43ebf96c | ||
![]() |
a7060dae1c | ||
![]() |
ba05549b0f | ||
![]() |
fb0e397330 | ||
![]() |
35ddb3abc7 | ||
![]() |
237ddd72f1 | ||
![]() |
c999b6c0f0 | ||
![]() |
4e0de649bd | ||
![]() |
6b0a8e3a0f | ||
![]() |
eadfad7a50 | ||
![]() |
14361eee24 | ||
![]() |
c9e231508b | ||
![]() |
6347686385 | ||
![]() |
1a8f929111 | ||
![]() |
56d3f5af6e | ||
![]() |
c665e81a39 | ||
![]() |
c6c49865fe | ||
![]() |
52d27be5c2 | ||
![]() |
6e0118231a | ||
![]() |
da3786d2d1 | ||
![]() |
8d770ece9a | ||
![]() |
0a0cb190da | ||
![]() |
79b079bdc0 | ||
![]() |
dbb67194b2 | ||
![]() |
c255e0140c | ||
![]() |
2bd6aa54d6 | ||
![]() |
c7535d084e | ||
![]() |
c0d7afe15c | ||
![]() |
6def7e38b4 | ||
![]() |
73881d0e52 | ||
![]() |
e3291c4e1f | ||
![]() |
0fa5a17c98 | ||
![]() |
757f9394bf | ||
![]() |
daed8cc919 | ||
![]() |
d1a941ea50 | ||
![]() |
00a47c1e06 | ||
![]() |
1fb24aba4b | ||
![]() |
2d24b6000d | ||
![]() |
8b5e2a5143 | ||
![]() |
3ed5858902 | ||
![]() |
7a8cdc4bb0 | ||
![]() |
4c0ed02806 | ||
![]() |
5d00b719f4 | ||
![]() |
42132ed6b5 | ||
![]() |
31f5efe453 | ||
![]() |
78a7762e3f | ||
![]() |
33f52fb611 | ||
![]() |
81abe5b3bb | ||
![]() |
4a09296771 | ||
![]() |
6922124c4c | ||
![]() |
59b844347c | ||
![]() |
bde5ba6ae8 | ||
![]() |
16240e21f9 | ||
![]() |
33a0e66eb1 | ||
![]() |
f7ff08de5a | ||
![]() |
f1bae45c76 | ||
![]() |
65c07b42e3 | ||
![]() |
3888daac6a | ||
![]() |
e966fef3eb | ||
![]() |
a504edf724 | ||
![]() |
dde788b59e | ||
![]() |
58fc86452d | ||
![]() |
c0cb119c0e | ||
![]() |
9a21e1eef0 | ||
![]() |
a0688a9874 | ||
![]() |
d0ce2ced53 | ||
![]() |
e05d2901ec | ||
![]() |
c0710f557c | ||
![]() |
f095027329 | ||
![]() |
8d320bbdf8 | ||
![]() |
776b83ddbc | ||
![]() |
04ace2a558 | ||
![]() |
46afb746f0 | ||
![]() |
570dd13f55 | ||
![]() |
63f877769c | ||
![]() |
04c6bb4a72 | ||
![]() |
131cc98491 | ||
![]() |
13bcb63b73 | ||
![]() |
0ba5d15b58 | ||
![]() |
7e38446075 | ||
![]() |
548aff34f4 | ||
![]() |
8397eac382 | ||
![]() |
a2c2d86d3d | ||
![]() |
3bc360fc9d | ||
![]() |
ae1da37558 | ||
![]() |
f57f59b10d | ||
![]() |
b65e3ebdb6 | ||
![]() |
50acc339c5 | ||
![]() |
f123ce8f8a | ||
![]() |
c3629e37a2 | ||
![]() |
cf5153c518 | ||
![]() |
3b7dced8e6 | ||
![]() |
03a410e03d | ||
![]() |
0a6eaaa605 | ||
![]() |
7f8f284ee5 | ||
![]() |
09fb8b6989 | ||
![]() |
9e6c62199a | ||
![]() |
d47f7a249d | ||
![]() |
7280263988 | ||
![]() |
3e1fad2da4 | ||
![]() |
d72940c56b | ||
![]() |
ad4fad0965 | ||
![]() |
aff9cb39ed | ||
![]() |
0a3f234df7 | ||
![]() |
efb70af001 | ||
![]() |
e65303b903 | ||
![]() |
413de4fbfa | ||
![]() |
984351f86f | ||
![]() |
f8796711e8 | ||
![]() |
0b540067b1 | ||
![]() |
3df347eded | ||
![]() |
eb7c6d295a | ||
![]() |
f126eb0d41 | ||
![]() |
7256e43c48 | ||
![]() |
a0a3af1dee | ||
![]() |
48832d944f | ||
![]() |
06bd61b571 | ||
![]() |
a1c754c737 | ||
![]() |
fef1276901 | ||
![]() |
45f33cdbd6 | ||
![]() |
1acfa211ae | ||
![]() |
2f3fd1194e | ||
![]() |
f08af3ed82 | ||
![]() |
2720a1a405 | ||
![]() |
31fd8d3fe8 | ||
![]() |
6868ee373e | ||
![]() |
b9a247b559 | ||
![]() |
50a205d20f | ||
![]() |
b0072bf658 | ||
![]() |
2c810567dd | ||
![]() |
0a1a29a7fe | ||
![]() |
7d21871ed8 | ||
![]() |
a38b97fae0 |
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Ignore files and directories made by `cmake .`.
|
||||
CMakeFiles/
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
/CMakeCache.txt
|
||||
/CPackConfig.cmake
|
||||
/CPackSourceConfig.cmake
|
||||
/CTestCustom.cmake
|
||||
/LICENSE.txt
|
||||
/OpenJPEGConfig.cmake
|
||||
/libopenjp2.pc
|
||||
/src/bin/common/opj_apps_config.h
|
||||
/src/lib/openjp2/opj_config.h
|
||||
/src/lib/openjp2/opj_config_private.h
|
||||
|
||||
# Ignore directories made by `make`.
|
||||
/bin/
|
93
.travis.yml
Normal file
93
.travis.yml
Normal file
@ -0,0 +1,93 @@
|
||||
language: c
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
|
||||
- os: linux
|
||||
compiler: clang-3.8
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-precise-3.8
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-3.8
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-x86-64
|
||||
- gcc-mingw-w64-x86-64
|
||||
- gcc-mingw-w64
|
||||
- os: linux
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-mingw-w64-base
|
||||
- binutils-mingw-w64-i686
|
||||
- gcc-mingw-w64-i686
|
||||
- gcc-mingw-w64
|
||||
- os: linux
|
||||
compiler: gcc-4.8
|
||||
env: OPJ_CI_ABI_CHECK=1
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- libelf-dev
|
||||
- elfutils
|
||||
- texinfo
|
||||
- exuberant-ctags
|
||||
|
||||
install:
|
||||
- ./tools/travis-ci/install.sh
|
||||
|
||||
script:
|
||||
- ./tools/travis-ci/run.sh
|
||||
- ./tools/travis-ci/abi-check.sh
|
||||
|
||||
before_deploy:
|
||||
- export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*)
|
||||
- echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases"
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: Npi13uOffALCVNwea4p4q8v85Lo/WsRqaeZQcWrAkt8MxRnfvWQtmnuwmHnVB6Cig+T1lVUHrklOaJIApIb6nkGq3CS/9bD8+SCS2NEdAAP/QYWnBi0ubWXVMRyDLypmwRpzLNSZ0xLYGFUl2PjieZYKRcz1dd/J7S+FnXhPtdjXweq0FS63zTcMe7ggjfmzSOWUCEFmMjZPaM0Be+3PweieCO1dxlHuy7ugCkx2S7d+5hNsicIhQmTADjqtJAkHoMhYqu6/yLFxhjO/+f938PATFULdODTvjCsUwdN/ySWi1Oj4uPAntfytZP7H6YrzLh8dS73QCsdkhhDJIgJskHIBSbRyyEVUnOvQgD9VaBVGHtc1KtZQTwc41OUO3BGPHl97s3oX6bqWqo/L53dB3TPHGx+1+2HL/F0zaDZuHhAKMkPwe8LFPMPB/ur65zXMHjnWb2ZTVVdoIvkbQ7nu8ApI60ejxocYBsEyAuC2CPXU2ki4jdEhm0E1hIziWNE9/LTuM17ziQuJ6WpXOSMrfP4o5aVDmLp5ZGBSocrspOksgyI9XogHaO/r+Y6N3exy+giObFfMHkZVUpsKrKmtOJ7TC1Vg5HsYGlWW8RN8dkJV47bUXm9K4sMos9eYMUt/czykPAs+132cogpII3QxXpFZQqZg6SEPVfOiyqQzTUI=
|
||||
file_glob: true
|
||||
file: "${OPJ_RELEASE_PKG_FILE}"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: uclouvain/openjpeg
|
||||
tags: true
|
||||
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"
|
||||
|
@ -1,12 +1,18 @@
|
||||
Authors of OpenJPEG
|
||||
See also the files THANKS and CHANGES
|
||||
# Authors of OpenJPEG
|
||||
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
|
||||
|
||||
David Janssens designed and implemented the first version of OpenJPEG.
|
||||
|
||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
|
||||
|
||||
Giuseppe Baruffa added the JPWL functionalities.
|
||||
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
|
||||
|
||||
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
|
||||
|
||||
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
|
||||
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
446
CHANGELOG.md
Normal file
446
CHANGELOG.md
Normal file
@ -0,0 +1,446 @@
|
||||
# Changelog
|
||||
|
||||
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
|
||||
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
|
||||
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
|
||||
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
|
||||
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
|
||||
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
|
||||
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
|
||||
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
|
||||
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
|
||||
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
|
||||
- Please make a new release [\#782](https://github.com/uclouvain/openjpeg/issues/782)
|
||||
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
|
||||
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
|
||||
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
|
||||
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
|
||||
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
|
||||
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
|
||||
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
|
||||
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
|
||||
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
|
||||
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
|
||||
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
|
||||
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
|
||||
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
|
||||
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
|
||||
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
|
||||
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
|
||||
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
|
||||
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
|
||||
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
|
||||
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
|
||||
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
|
||||
|
||||
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
|
||||
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
|
||||
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
|
||||
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
|
||||
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
|
||||
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
|
||||
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
|
||||
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
|
||||
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
|
||||
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
|
||||
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
|
||||
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
|
||||
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
|
||||
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
|
||||
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
|
||||
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
|
||||
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
|
||||
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
|
||||
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
|
||||
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
|
||||
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
|
||||
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
|
||||
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
|
||||
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
|
||||
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
|
||||
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
|
||||
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
|
||||
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
|
||||
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
|
||||
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
|
||||
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
|
||||
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
|
||||
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
|
||||
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
|
||||
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
|
||||
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
|
||||
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
|
||||
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
|
||||
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
|
||||
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
|
||||
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
|
||||
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
|
||||
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
|
||||
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
|
||||
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
|
||||
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
|
||||
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
|
||||
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
|
||||
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
|
||||
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
|
||||
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
|
||||
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
|
||||
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
|
||||
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
|
||||
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
|
||||
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
|
||||
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
|
||||
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
|
||||
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
|
||||
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
|
||||
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
|
||||
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
|
||||
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
|
||||
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
|
||||
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
|
||||
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
|
||||
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
|
||||
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
|
||||
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
|
||||
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
|
||||
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
|
||||
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
|
||||
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
|
||||
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
|
||||
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
|
||||
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
|
||||
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
|
||||
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
|
||||
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
|
||||
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
|
||||
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
|
||||
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
|
||||
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
|
||||
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
|
||||
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
|
||||
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
|
||||
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
|
||||
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
|
||||
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
|
||||
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
|
||||
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
|
||||
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
|
||||
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
|
||||
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
|
||||
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
|
||||
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
|
||||
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
|
||||
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
|
||||
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
|
||||
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
|
||||
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
|
||||
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
|
||||
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
|
||||
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
|
||||
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
|
||||
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
|
||||
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
|
||||
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
|
||||
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
|
||||
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
|
||||
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
|
||||
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
|
||||
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
|
||||
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
|
||||
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
|
||||
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
|
||||
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
|
||||
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
|
||||
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
|
||||
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
|
||||
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
|
||||
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
|
||||
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
|
||||
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
|
||||
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
|
||||
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
|
||||
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
|
||||
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
|
||||
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
|
||||
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
|
||||
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
|
||||
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
|
||||
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
|
||||
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
|
||||
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
|
||||
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
|
||||
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
|
||||
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
|
||||
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
|
||||
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
|
||||
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
|
||||
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
|
||||
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
|
||||
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
|
||||
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
|
||||
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
|
||||
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
|
||||
- openjpeg@googlegroups.com has disappeard [\#153](https://github.com/uclouvain/openjpeg/issues/153)
|
||||
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
|
||||
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
|
||||
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
|
||||
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
|
||||
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
|
||||
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
|
||||
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
|
||||
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
|
||||
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
|
||||
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
|
||||
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
|
||||
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
|
||||
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
|
||||
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
|
||||
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
|
||||
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
|
||||
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
|
||||
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
|
||||
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
|
||||
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
|
||||
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
|
||||
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
|
||||
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
|
||||
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
|
||||
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
|
||||
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
|
||||
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
|
||||
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
|
||||
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
|
||||
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
|
||||
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
|
||||
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
|
||||
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
|
||||
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
|
||||
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
|
||||
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
|
||||
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
|
||||
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
|
||||
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
|
||||
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
|
||||
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
|
||||
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
|
||||
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
|
||||
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
|
||||
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
|
||||
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
|
||||
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
|
||||
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
|
||||
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
|
||||
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
|
||||
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
|
||||
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
|
||||
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
|
||||
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
|
||||
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
|
||||
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
|
||||
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
|
||||
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
|
||||
- lossy encoding a 16 bit TIF file : severe artifiacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
|
||||
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
|
||||
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
|
||||
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
|
||||
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
|
||||
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
|
||||
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
|
||||
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
|
||||
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
|
||||
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
|
||||
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
|
||||
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
|
||||
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
|
||||
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
|
||||
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
|
||||
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
|
||||
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
|
||||
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
|
||||
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
|
||||
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
|
||||
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
|
||||
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
|
||||
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
|
||||
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
|
||||
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
|
||||
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
|
||||
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
|
||||
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
|
||||
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
|
||||
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
|
||||
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
|
||||
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
|
||||
- Use lowercase for cmake commands consistenly [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
|
||||
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
|
||||
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
|
||||
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
|
||||
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
|
||||
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
|
||||
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
|
||||
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
|
||||
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
|
||||
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
|
||||
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
|
||||
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
|
||||
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
|
||||
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
|
||||
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
|
||||
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
|
||||
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
|
||||
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
|
||||
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
|
||||
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
|
||||
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
|
||||
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
|
||||
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
|
||||
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
|
||||
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
|
||||
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
|
||||
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
|
||||
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
|
||||
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
|
||||
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
|
||||
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
|
||||
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
|
||||
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
|
||||
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
|
||||
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
|
||||
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
|
||||
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
|
||||
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
|
||||
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
|
||||
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
|
||||
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
|
||||
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
|
||||
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
|
||||
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
|
||||
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
|
||||
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
|
||||
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
|
||||
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
|
||||
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
|
||||
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
|
||||
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
|
||||
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
|
||||
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
|
||||
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
|
||||
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
|
||||
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
|
||||
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
|
||||
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
|
||||
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
|
||||
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
|
||||
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
|
||||
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
|
||||
|
||||
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
|
||||
|
||||
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
|
||||
|
||||
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
|
||||
|
||||
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
|
||||
|
||||
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
|
||||
|
||||
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
|
||||
|
||||
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
|
||||
|
||||
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
|
||||
|
||||
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
|
||||
|
||||
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
@ -11,6 +11,9 @@ cmake_minimum_required(VERSION 2.8.2)
|
||||
|
||||
if(COMMAND CMAKE_POLICY)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_NAMESPACE)
|
||||
@ -29,7 +32,7 @@ include_regular_expression("^.*$")
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
set(OPENJPEG_VERSION_MAJOR 2)
|
||||
set(OPENJPEG_VERSION_MINOR 1)
|
||||
set(OPENJPEG_VERSION_MINOR 2)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
@ -49,11 +52,14 @@ set(PACKAGE_VERSION
|
||||
# 2.0 | 6
|
||||
# 2.0.1 | 6
|
||||
# 2.1 | 7
|
||||
# 2.1.1 | 7
|
||||
# 2.1.2 | 7
|
||||
# 2.2.0 | 8
|
||||
# above is the recommendation by the OPJ team. If you really need to override this default,
|
||||
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
|
||||
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
|
||||
if(NOT OPENJPEG_SOVERSION)
|
||||
SET(OPENJPEG_SOVERSION 7)
|
||||
set(OPENJPEG_SOVERSION 7)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
@ -63,7 +69,7 @@ set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/cmake
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@ -146,6 +152,11 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}")
|
||||
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Big endian test:
|
||||
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
@ -154,8 +165,8 @@ TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
||||
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/CTestCustom.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
@ -182,7 +193,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
set(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@ -217,6 +228,18 @@ CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
include(TestLargeFiles)
|
||||
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||
|
||||
# Allocating Aligned Memory Blocks
|
||||
include(CheckIncludeFiles)
|
||||
check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
|
||||
include(CheckSymbolExists)
|
||||
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
|
||||
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
|
||||
# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
|
||||
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
# memalign (obsolete)
|
||||
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Library
|
||||
if(BUILD_JPIP_SERVER)
|
||||
@ -228,6 +251,7 @@ if(BUILD_JPIP_SERVER)
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src/lib)
|
||||
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
@ -261,7 +285,7 @@ configure_file(
|
||||
${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
|
||||
@ -283,8 +307,8 @@ if(BUILD_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)
|
||||
# They could be found via git on the OpenJPEG GitHub code project
|
||||
# git clone https://github.com/uclouvain/openjpeg-data.git
|
||||
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||
@ -301,8 +325,8 @@ endif()
|
||||
#-----------------------------------------------------------------------------
|
||||
# install all targets referenced as OPENJPEGTargets
|
||||
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
configure_file( ${OPENJPEG_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
|
69
INSTALL
69
INSTALL
@ -1,69 +0,0 @@
|
||||
|
||||
How to build and install openjpeg binaries
|
||||
==========================================
|
||||
|
||||
UNIX/LINUX/MacOSX/Windows systems
|
||||
--------------------------
|
||||
|
||||
Using cmake (see www.cmake.org)
|
||||
|
||||
Type:
|
||||
cmake .
|
||||
make
|
||||
|
||||
If you are root:
|
||||
make install
|
||||
|
||||
else if you have sudo power:
|
||||
sudo make install
|
||||
|
||||
else
|
||||
DESTDIR=$HOME/local make install
|
||||
|
||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
(A 'html' directory is generated in the 'doc' directory)
|
||||
make doc
|
||||
|
||||
Binaries are located in the 'bin' directory.
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path', or use DESTDIR env variable (see above)
|
||||
* To build the shared libraries and links the executables against it: '-DBUILD_SHARED_LIBS:bool=on' (default: 'ON')
|
||||
Note: when using this option, static libraries are not built and executables are dynamically linked.
|
||||
* To build the CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON')
|
||||
* To build the 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 -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
|
||||
make
|
||||
make Experimental
|
||||
Note : JPEG2000 test files are available with 'svn checkout http://openjpeg.googlecode.com/svn/data' (about 70 Mo).
|
||||
If '-DOPJ_DATA_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE_SOURCE_DIR}/../data',
|
||||
corresponding to the location of the data directory when compiling from the trunk (and assuming the data directory has
|
||||
been checked out of course).
|
||||
|
||||
MACOSX
|
||||
------
|
||||
|
||||
The same building procedures as above work for MACOSX.
|
||||
The xcode project file can also be used.
|
||||
|
||||
If it does not work, try adding the following flag to the cmake command :
|
||||
'-DCMAKE_OSX_ARCHITECTURES:STRING=i386'
|
||||
|
||||
WINDOWS
|
||||
-------
|
||||
|
||||
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'
|
75
INSTALL.md
Normal file
75
INSTALL.md
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
# OpenJPEG installation
|
||||
|
||||
The build method maintained by OpenJPEG is [CMake](https://cmake.org/).
|
||||
|
||||
## UNIX/LINUX - MacOS (terminal) - WINDOWS (cygwin, MinGW)
|
||||
|
||||
To build the library, type from source tree directory:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
Binaries are then located in the 'bin' directory.
|
||||
|
||||
To install the library, type with root privileges:
|
||||
```
|
||||
make install
|
||||
make clean
|
||||
```
|
||||
|
||||
To build the html documentation, you need doxygen to be installed on your system.
|
||||
It will create an "html" directory in TOP\_LEVEL/build/doc)
|
||||
```
|
||||
make doc
|
||||
```
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
|
||||
* To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
|
||||
> Note: when using this option, static libraries are not built and executables are dynamically linked.
|
||||
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
|
||||
* [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPWL executables and JPWL library: '-DBUILD\_JPWL:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPIP client (java compiler recommended) library and executables: '-DBUILD\_JPIP:bool=on' (default: 'OFF')
|
||||
* [OBSOLETE] To build the JPIP server (need fcgi) library and executables: '-DBUILD\_JPIP\_SERVER:bool=on' (default: 'OFF')
|
||||
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
|
||||
```
|
||||
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory' -DBUILDNAME:STRING='name_of_the_build'
|
||||
make
|
||||
make Experimental
|
||||
```
|
||||
Note : test data is available on the following github repo: https://github.com/uclouvain/openjpeg-data
|
||||
|
||||
If '-DOPJ\_DATA\_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE\_SOURCE\_DIR}/../data'.
|
||||
|
||||
Note 2 : to execute the encoding test suite, kakadu binaries are needed to decode encoded image and compare it to the baseline. Kakadu binaries are freely available for non-commercial purposes at http://www.kakadusoftware.com. kdu\_expand will need to be in your PATH for cmake to find it.
|
||||
|
||||
Note 3 : OpenJPEG encoder and decoder (not the library itself !) depends on several libraries: png, tiff, lcms, z. If these libraries are not found on the system, they are automatically built from the versions available in the source tree. You can force the use of these embedded version with BUILD\_THIRDPARTY:BOOL=ON. On a Debian-like system you can also simply install these libraries with:
|
||||
```
|
||||
sudo apt-get install liblcms2-dev libtiff-dev libpng-dev libz-dev
|
||||
```
|
||||
|
||||
Note 4 : On MacOS, if it does not work, try adding the following flag to the cmake command :
|
||||
```
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING=i386
|
||||
```
|
||||
|
||||
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
|
||||
|
||||
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
|
||||
Type 'cmake --help' for available generators on your platform.
|
||||
|
||||
# Using OpenJPEG
|
||||
|
||||
To use openjpeg exported cmake file, simply create your application doing:
|
||||
|
||||
```
|
||||
$ cat CMakeLists.txt
|
||||
find_package(OpenJPEG REQUIRED)
|
||||
include_directories(${OPENJPEG_INCLUDE_DIRS})
|
||||
add_executable(myapp myapp.c)
|
||||
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
|
||||
```
|
61
NEWS
61
NEWS
@ -1,61 +0,0 @@
|
||||
|
||||
OpenJPEG NEWS - user visible changes
|
||||
====================================
|
||||
|
||||
Changes from OpenJPEG 2.0.0 to OpenJPEG 2.1.0
|
||||
----------------------------------------------
|
||||
|
||||
New Features:
|
||||
|
||||
* Digital Cinema profiles have been fixed and updated
|
||||
* New option to disable MCT if needed
|
||||
* extended RAW support: it is now possible to input raw images
|
||||
with subsampled color components (422, 420, etc)
|
||||
* New way to deal with profiles
|
||||
|
||||
API/ABI modifications: (see abi_compat_report in dev-utils/scripts)
|
||||
|
||||
* Removed deprecated functions
|
||||
- opj_stream_create_default_file_stream(FILE*,...)
|
||||
- opj_stream_create_file_stream(FILE*,...)
|
||||
- opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
|
||||
* Added
|
||||
- opj_stream_create_default_file_stream(char*,...)
|
||||
- opj_stream_create_file_stream(char*,...)
|
||||
- opj_stream_destroy(opj_stream_t*)
|
||||
- opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
|
||||
... opj_stream_free_user_data_fn p_function)
|
||||
- JPEG 2000 profiles and Part-2 extensions defined through '#define'
|
||||
* Changed
|
||||
- 'alpha' field added to 'opj_image_comp' structure
|
||||
- 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
|
||||
- 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
|
||||
- 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
|
||||
(not yet used in use)
|
||||
- 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
|
||||
|
||||
Misc:
|
||||
|
||||
* OpenJPEG is now 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.
|
72
NEWS.md
Normal file
72
NEWS.md
Normal file
@ -0,0 +1,72 @@
|
||||
# OpenJPEG NEWS
|
||||
|
||||
More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
|
||||
|
||||
## OpenJPEG 2.1.2
|
||||
|
||||
* Bug fixes (including security fixes)
|
||||
* No API/ABI break compared to v2.1.1
|
||||
|
||||
## OpenJPEG 2.1.1
|
||||
|
||||
* Huge amount of critical bugfixes
|
||||
* Speed improvements
|
||||
* No API/ABI break compared to v2.1
|
||||
|
||||
## OpenJPEG 2.1.0
|
||||
|
||||
### New Features
|
||||
|
||||
* Digital Cinema profiles have been fixed and updated
|
||||
* New option to disable MCT if needed
|
||||
* extended RAW support: it is now possible to input raw images
|
||||
with subsampled color components (422, 420, etc)
|
||||
* New way to deal with profiles
|
||||
|
||||
### API/ABI modifications
|
||||
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
|
||||
|
||||
* Removed deprecated functions
|
||||
* opj_stream_create_default_file_stream(FILE*,...)
|
||||
* opj_stream_create_file_stream(FILE*,...)
|
||||
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
|
||||
* Added
|
||||
* opj_stream_create_default_file_stream(char*,...)
|
||||
* opj_stream_create_file_stream(char*,...)
|
||||
* opj_stream_destroy(opj_stream_t*)
|
||||
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
|
||||
... opj_stream_free_user_data_fn p_function)
|
||||
* JPEG 2000 profiles and Part-2 extensions defined through '#define'
|
||||
* Changed
|
||||
* 'alpha' field added to 'opj_image_comp' structure
|
||||
* 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
|
||||
* 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
|
||||
* 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
|
||||
(not yet used in use)
|
||||
* 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
|
||||
|
||||
### Misc
|
||||
|
||||
* OpenJPEG is now officially conformant with JPEG 2000 Part-1
|
||||
and will soon become official reference software at the
|
||||
JPEG committee.
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
|
||||
|
||||
## OpenJPEG 2.0.0
|
||||
|
||||
### New Features
|
||||
|
||||
* streaming capabilities
|
||||
* merge JP3D
|
||||
|
||||
### API modifications
|
||||
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
|
||||
|
||||
* Use a 64bits capable API
|
||||
|
||||
### Misc
|
||||
|
||||
* removed autotools build system
|
||||
* folders hierarchies reorganisation
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
47
README
47
README
@ -1,47 +0,0 @@
|
||||
|
||||
OPENJPEG LIBRARY and APPLICATIONS
|
||||
----------------------------------
|
||||
|
||||
Details on folders hierarchy:
|
||||
|
||||
* src
|
||||
* lib
|
||||
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* openjp3d: JP3D implementation
|
||||
* openmj2: MJ2 implementation
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* jp2: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* jp3d: JP3D applications
|
||||
* tcltk: a test tool for JP3D
|
||||
* wx
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* wrapping
|
||||
* java: java jni to use openjpeg in a java program
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* doc: doxygen documentation setup file and man pages
|
||||
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
|
||||
* cmake: cmake related files
|
||||
|
||||
see LICENSE for license and copyright information.
|
||||
see INSTALL for installation procedures.
|
||||
see NEWS for user visible changes in successive releases.
|
||||
see CHANGES for per-revision changes.
|
||||
|
||||
----------------
|
||||
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.
|
82
README.md
Normal file
82
README.md
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
# OPENJPEG Library and Applications
|
||||
|
||||
## What is OpenJPEG ?
|
||||
|
||||
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
|
||||
|
||||
## Who can use the code ?
|
||||
[![badge-license]][link-license]
|
||||
|
||||
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
|
||||
|
||||
## How to install and use OpenJPEG ?
|
||||
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
|
||||
|
||||
## Current Status
|
||||
[![badge-build]][link-build]
|
||||
|
||||
[![badge-msvc-build]][link-msvc-build]
|
||||
|
||||
[![badge-coverity]][link-coverity]
|
||||
|
||||
## Who are the developers ?
|
||||
|
||||
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
|
||||
|
||||
## Details on folders hierarchy
|
||||
|
||||
* src
|
||||
* lib
|
||||
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* openjp3d: JP3D implementation
|
||||
* openmj2: MJ2 implementation
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* jp2: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* jp3d: JP3D applications
|
||||
* tcltk: a test tool for JP3D
|
||||
* wx
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* wrapping
|
||||
* java: java jni to use openjpeg in a java program
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* doc: doxygen documentation setup file and man pages
|
||||
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
|
||||
* cmake: cmake related files
|
||||
|
||||
See [LICENSE][link-license] for license and copyright information.
|
||||
|
||||
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
|
||||
|
||||
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
|
||||
|
||||
## API/ABI
|
||||
|
||||
An API/ABI timeline is automatically updated [here][link-api-timeline].
|
||||
|
||||
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
|
||||
only exposes a limited subset of its functions. It uses a mechanism of
|
||||
exporting/hiding functions. If you are unsure which functions you can use in
|
||||
your applications, you should compile OpenJPEG using something similar to gcc:
|
||||
`-fvisibility=hidden` compilation flag.
|
||||
See also: http://gcc.gnu.org/wiki/Visibility
|
||||
|
||||
On windows, MSVC directly supports export/hiding function and as such the only
|
||||
API available is the one supported by OpenJPEG.
|
||||
|
||||
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
|
||||
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause "Simplified" License"
|
||||
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause "Simplified" License"
|
||||
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
|
||||
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
|
||||
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
|
||||
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
|
||||
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
|
||||
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
|
||||
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"
|
33
THANKS
33
THANKS
@ -1,33 +0,0 @@
|
||||
OpenJPEG THANKS file
|
||||
|
||||
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
|
||||
or submitting actual code. Here is a list of these people. Help me keep
|
||||
it complete and exempt of errors.
|
||||
|
||||
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
|
39
THANKS.md
Normal file
39
THANKS.md
Normal file
@ -0,0 +1,39 @@
|
||||
# OpenJPEG THANKS file
|
||||
|
||||
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
|
||||
or submitting actual code. Here is a list of these people. Help me keep
|
||||
it complete and exempt of errors.
|
||||
|
||||
* Giuseppe Baruffa
|
||||
* Ben Boeckel
|
||||
* Aaron Boxer
|
||||
* David Burken
|
||||
* Matthieu Darbois
|
||||
* Rex Dieter
|
||||
* Herve Drolon
|
||||
* Antonin Descampe
|
||||
* Francois-Olivier Devaux
|
||||
* Parvatha Elangovan
|
||||
* Jerôme Fimes
|
||||
* Bob Friesenhahn
|
||||
* Kaori Hagihara
|
||||
* Luc Hermitte
|
||||
* Luis Ibanez
|
||||
* David Janssens
|
||||
* Hans Johnson
|
||||
* Callum Lerwick
|
||||
* Ke Liu (Tencent's Xuanwu LAB)
|
||||
* Sebastien Lugan
|
||||
* Benoit Macq
|
||||
* Mathieu Malaterre
|
||||
* Julien Malik
|
||||
* Arnaud Maye
|
||||
* Vincent Nicolas
|
||||
* Aleksander Nikolic (Cisco Talos)
|
||||
* Glenn Pearson
|
||||
* Even Rouault
|
||||
* Dzonatas Sol
|
||||
* Winfried Szukalski
|
||||
* Vincent Torri
|
||||
* Yannick Verschueren
|
||||
* Peter Wimmer
|
38
appveyor.yml
Normal file
38
appveyor.yml
Normal file
@ -0,0 +1,38 @@
|
||||
version: 2.1.1.{build}
|
||||
branches:
|
||||
except:
|
||||
- coverity_scan
|
||||
skip_tags: false
|
||||
clone_depth: 50
|
||||
environment:
|
||||
matrix:
|
||||
- OPJ_CI_ARCH: x86
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- OPJ_CI_ARCH: x64
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
||||
- OPJ_CI_ARCH: x86
|
||||
OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS)
|
||||
install:
|
||||
- cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh
|
||||
build_script:
|
||||
- cmd: >-
|
||||
"%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH%
|
||||
|
||||
bash ./tools/travis-ci/run.sh
|
||||
test: off
|
||||
#before_deploy:
|
||||
#- cmd: c:\cygwin\bin\bash ./tools/travis-ci/before_deploy.sh
|
||||
deploy:
|
||||
#release: openjpeg-$(appveyor_repo_tag_name)
|
||||
description: 'OpenJPEG $(appveyor_repo_tag_name) has been released. More info [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/NEWS) and a detailed view [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/CHANGES).'
|
||||
provider: GitHub
|
||||
auth_token:
|
||||
secure: Huk03f1heCD/HMyA+4ZeVmICdmKn9rPxK5p8/KxzgL+FtJDHlqcllcCrtN9bDxRH # your encrypted token from GitHub
|
||||
artifact: /.*\.zip/ # upload all zip packages to release assets
|
||||
draft: false
|
||||
prerelease: false
|
||||
on:
|
||||
appveyor_repo_tag: true # deploy on tag push only
|
||||
OPJ_CI_INCLUDE_IF_DEPLOY: 1
|
@ -25,12 +25,15 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||
|
||||
# Ignore clang's summary warning, assuming prior text has matched some
|
||||
# other warning expression:
|
||||
"[0-9,]+ warnings? generated."
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
# java also warns about deprecated API
|
||||
".*java.*deprecation"
|
||||
".*deprecation.*"
|
||||
# supress warnings caused by 3rd party libs:
|
||||
# suppress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
"libpng.*has no symbols"
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Ensure that an include file is provided by the system
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# provided by cmake
|
||||
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
@ -23,4 +23,4 @@ if (NOT ${${VARIABLE_NAME}})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
endmacro()
|
||||
|
12
cmake/FindJPYLYZER.cmake
Normal file
12
cmake/FindJPYLYZER.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
#
|
||||
# this module looks for JPYLYZER
|
||||
# http://jpylyzer.openpreservation.org
|
||||
#
|
||||
|
||||
find_program(JPYLYZER_EXECUTABLE
|
||||
jpylyzer
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
JPYLYZER_EXECUTABLE
|
||||
)
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
macro(OPJ_TEST_LARGE_FILES VARIABLE)
|
||||
if("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
||||
if(NOT DEFINED ${VARIABLE})
|
||||
|
||||
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
|
||||
# and then separately fseeko. However, in the future we might have 128-bit filesystems
|
||||
|
@ -145,7 +145,7 @@ HTML_STYLESHEET =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
GENERATE_DOCSET = NO
|
||||
|
@ -36,21 +36,21 @@
|
||||
*
|
||||
* \section home Home page
|
||||
*
|
||||
* The Home Page of the OpenJPEG library can be found at:
|
||||
*
|
||||
* http://code.google.com/p/openjpeg/
|
||||
*
|
||||
* More information about the OpenJPEG library is available here:
|
||||
* The Home Page of the OpenJPEG project can be found at:
|
||||
*
|
||||
* http://www.openjpeg.org/
|
||||
*
|
||||
* The source code repository is available here:
|
||||
*
|
||||
* http://github.com/uclouvain/openjpeg
|
||||
*
|
||||
* The OpenJPEG mailing list is located here:
|
||||
*
|
||||
* http://groups.google.com/group/openjpeg
|
||||
*
|
||||
* All the source code is online and can be retrieved using svn from here:
|
||||
* The test files repository is available here:
|
||||
*
|
||||
* http://openjpeg.googlecode.com/svn/
|
||||
* http://github.com/uclouvain/openjpeg-data
|
||||
*
|
||||
* \section license License
|
||||
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
|
||||
|
@ -29,10 +29,10 @@
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_compress 1 "Version 1.4.0" "opj_compress" "converts to jpeg2000 files"
|
||||
.TH opj_compress 1 "Version 2.1.1" "opj_compress" "converts to jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_compress -
|
||||
opj_compress \-
|
||||
This program reads in an image of a certain type and converts it to a
|
||||
jpeg2000 file. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
@ -43,20 +43,20 @@ Valid output image extensions are
|
||||
.B .j2k, .jp2
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_compress -i \fRinfile.bmp \fB-o \fRoutfile.j2k
|
||||
.B opj_compress \-i \fRinfile.bmp \fB-o \fRoutfile.j2k
|
||||
.P
|
||||
.B opj_compress -ImgDir \fRdirectory_name \fB-OutFor \fRjp2
|
||||
.B opj_compress \-ImgDir \fRdirectory_name \fB-OutFor \fRjp2
|
||||
.P
|
||||
.B opj_compress -h \fRPrint a help message and exit.
|
||||
.B opj_compress \-h \fRPrint a help message and exit.
|
||||
.P
|
||||
.R See JPWL OPTIONS for special options
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-\^b " n,n"
|
||||
(Size of code block (e.g. -b 32,32). Default: 64 x 64)
|
||||
(Size of code block (e.g. \-b 32,32). Default: 64 x 64)
|
||||
.TP
|
||||
.B \-\^c " n"
|
||||
(Size of precinct (e.g. -c 128,128). Default: 2^15 x 2^15)
|
||||
(Size of precinct (e.g. \-c 128,128). Default: 2^15 x 2^15)
|
||||
.TP
|
||||
.B \-\^cinema2K " fps"
|
||||
Digital Cinema 2K profile compliant codestream. Valid \fBfps\fR values are 24 or 48.
|
||||
@ -65,7 +65,7 @@ Digital Cinema 2K profile compliant codestream. Valid \fBfps\fR values are 24 or
|
||||
Digital Cinema 4K profile compliant codestream. Does not need an fps: default is 24 fps.
|
||||
.TP
|
||||
.B \-\^d " X,Y"
|
||||
(Offset of image origin (e.g. -d 150,300))
|
||||
(Offset of image origin (e.g. \-d 150,300))
|
||||
.TP
|
||||
.B \-\^h
|
||||
Print a help message and exit.
|
||||
@ -85,20 +85,20 @@ Progression order. \fBname\fR can be one out of:LRCP, RLCP, RPCL, PCRL, CPRL. De
|
||||
.B \-\^q " n"
|
||||
different psnr for successive layers
|
||||
.br
|
||||
.B Note: \fR(options -r and -q cannot be used together)
|
||||
.B Note: \fR(options \-r and \-q cannot be used together)
|
||||
.TP
|
||||
.B \-\^r " n"
|
||||
different compression ratio(s) for successive layers. The rate specified for each quality level is the desired compression factor.
|
||||
.br
|
||||
.B Note: \fR(options -r and -q cannot be used together)
|
||||
.B Note: \fR(options \-r and \-q cannot be used together)
|
||||
.TP
|
||||
.B \-\^s " X,Y"
|
||||
sub-sampling factor (e.g. -s 2,2). Default: No sub-sampling in x or y direction.
|
||||
sub-sampling factor (e.g. \-s 2,2). Default: No sub-sampling in x or y direction.
|
||||
.br
|
||||
.B Remark: \fRsub-sampling bigger than 2 can produce errors.
|
||||
.TP
|
||||
.B \-\^t " W,H"
|
||||
(Size of tile (e.g. -t 512,512) )
|
||||
(Size of tile (e.g. \-t 512,512) )
|
||||
.TP
|
||||
.B \-\^x " name"
|
||||
(Create index file and fill it. Default: no index file)
|
||||
@ -132,7 +132,7 @@ ERTERM(16)
|
||||
.br
|
||||
SEGMARK(32)
|
||||
.br
|
||||
Values can be added: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38
|
||||
Values can be added: RESTART(4) + RESET(2) + SEGMARK(32) = \-M 38
|
||||
.TP
|
||||
.B \-\^OutFor "ext"
|
||||
(extension for output files)
|
||||
@ -149,7 +149,7 @@ e.g. \fB-ROI c=0,U=25\fR
|
||||
(Write SOP marker before each packet. Default: No SOP marker in the codestream.)
|
||||
.TP
|
||||
.B \-\^T "X,Y"
|
||||
(Offset of the origin of the tiles (e.g. -T 100,75) )
|
||||
(Offset of the origin of the tiles (e.g. \-T 100,75) )
|
||||
.TP
|
||||
.B \-\^W
|
||||
(see JPWL OPTIONS)
|
||||
@ -157,7 +157,7 @@ e.g. \fB-ROI c=0,U=25\fR
|
||||
.SH JPWL OPTIONS
|
||||
Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
||||
.P
|
||||
.B -W h<tilepart><=type>, s<tilepart><=method>, a=<addr>, z=<size>, g=<range>, p<tilepart:pack><=type>
|
||||
.B \-W h<tilepart><=type>, s<tilepart><=method>, a=<addr>, z=<size>, g=<range>, p<tilepart:pack><=type>
|
||||
.P
|
||||
.B h\fR selects the header error protection (EPB): \fBtype\fR can be
|
||||
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
|
||||
@ -176,7 +176,7 @@ Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
||||
(max. 16 specs)
|
||||
.P
|
||||
.B s \fRenables sensitivity data insertion (ESD): \fBmethod\fR can be
|
||||
[-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR
|
||||
[\-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR
|
||||
4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED]
|
||||
if \fBtilepart\fR is absent, it is for main header only
|
||||
if \fBtilepart\fR is present, it applies from that tile
|
||||
@ -194,13 +194,13 @@ Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
||||
.P
|
||||
.SH EXAMPLES
|
||||
.P
|
||||
.B opj_compress -i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
|
||||
.B opj_compress \-i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
|
||||
.P
|
||||
.B opj_compress -i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
|
||||
.B opj_compress \-i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
|
||||
.P
|
||||
.B opj_compress -i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
|
||||
.B opj_compress \-i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
|
||||
.P
|
||||
.B opj_compress -i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
||||
.B opj_compress \-i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
||||
.P
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
|
@ -29,10 +29,10 @@
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_decompress 1 "Version 1.4.0" "opj_decompress" "converts jpeg2000 files"
|
||||
.TH opj_decompress 1 "Version 2.1.1" "opj_decompress" "converts jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_decompress -
|
||||
opj_decompress \-
|
||||
This program reads in a jpeg2000 image and converts it to another
|
||||
image type. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
@ -43,11 +43,11 @@ Valid output image extensions are
|
||||
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_decompress -i \fRinfile.j2k \fB-o \fRoutfile.png
|
||||
.B opj_decompress \-i \fRinfile.j2k \fB-o \fRoutfile.png
|
||||
.P
|
||||
.B opj_decompress -ImgDir \fRimages/ \fB-OutFor \fRbmp
|
||||
.B opj_decompress \-ImgDir \fRimages/ \fB-OutFor \fRbmp
|
||||
.P
|
||||
.B opj_decompress -h \fRPrint help message and exit
|
||||
.B opj_decompress \-h \fRPrint help message and exit
|
||||
.P
|
||||
.R See JPWL OPTIONS for special options
|
||||
.SH OPTIONS
|
||||
@ -73,9 +73,19 @@ n is the maximum number of quality layers to decode. See LAYERS below)
|
||||
.B \-\^OutFor "ext"
|
||||
(extension for output files)
|
||||
.P
|
||||
.SH JPIP OPTIONS
|
||||
Options usable only if the library has been compiled with
|
||||
.B BUILD_JPIP
|
||||
.TP
|
||||
.B -jpip
|
||||
Embed index table box into the output JP2 file (compulsory for JPIP)
|
||||
.TP
|
||||
.B -TP R
|
||||
Partition a tile into tile parts of different resolution levels (compulsory for JPT-stream)
|
||||
.P
|
||||
.SH JPWL OPTIONS
|
||||
Options usable only if the library has been compiled with
|
||||
.B -DUSE_JPWL
|
||||
.B BUILD_JPWL
|
||||
.TP
|
||||
.B -W c\fR[=Nc] (Nc is the number of expected components in the codestream; default:3)
|
||||
.TP
|
||||
|
@ -29,10 +29,10 @@
|
||||
.SP
|
||||
.fi
|
||||
..
|
||||
.TH opj_dump 1 "Version 1.4.0" "opj_dump" "dumps jpeg2000 files"
|
||||
.TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files"
|
||||
.P
|
||||
.SH NAME
|
||||
opj_dump -
|
||||
opj_dump \-
|
||||
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
|
||||
.SP
|
||||
Valid input image extensions are
|
||||
@ -40,11 +40,11 @@ Valid input image extensions are
|
||||
.SP
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
.B opj_dump -i \fRinfile.j2k
|
||||
.B opj_dump \-i \fRinfile.j2k
|
||||
.P
|
||||
.B opj_dump -ImgDir \fRimages/ \fRDump all files in images/
|
||||
.B opj_dump \-ImgDir \fRimages/ \fRDump all files in images/
|
||||
.P
|
||||
.B opj_dump -h \fRPrint help message and exit
|
||||
.B opj_dump \-h \fRPrint help message and exit
|
||||
.P
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
|
@ -64,7 +64,7 @@
|
||||
*
|
||||
*
|
||||
* \section sysarchtect System Architecture
|
||||
* JPIP protocol is implimented between the JPIP server program (opj_server) and the JPIP client java program (opj_viewer).\n
|
||||
* JPIP protocol is implemented between the JPIP server program (opj_server) and the JPIP client java program (opj_viewer).\n
|
||||
* Figure below represents the overview of our system architecture.\n
|
||||
* The JPIP server parses JPIP query and sends corresponding JPT/JPP-stream.
|
||||
* The JPIP client viewer is an image viewer with GUI to publish JPIP requests and receive JPT/JPP-stream.\n
|
||||
|
@ -1,7 +1,7 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_apps_config.h generation
|
||||
# opj_apps_config.h generation
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
|
||||
@ONLY
|
||||
)
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,5 +40,8 @@
|
||||
|
||||
extern void color_sycc_to_rgb(opj_image_t *img);
|
||||
extern void color_apply_icc_profile(opj_image_t *image);
|
||||
extern void color_cielab_to_rgb(opj_image_t *image);
|
||||
|
||||
extern void color_cmyk_to_rgb(opj_image_t *image);
|
||||
extern void color_esycc_to_rgb(opj_image_t *image);
|
||||
#endif /* _OPJ_COLOR_H_ */
|
||||
|
@ -54,7 +54,7 @@ int opj_opterr = 1, /* if error message should be printed */
|
||||
static char EMSG[]={""};
|
||||
|
||||
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
||||
void reset_options_reading(void) {
|
||||
void opj_reset_options_reading(void) {
|
||||
opj_opterr = 1;
|
||||
opj_optind = 1;
|
||||
}
|
||||
@ -66,7 +66,7 @@ void reset_options_reading(void) {
|
||||
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||
# define __progname nargv[0]
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli = NULL; /* option letter list index */
|
||||
const char *oli = NULL; /* option letter list index */
|
||||
|
||||
if (opj_optreset || !*place) { /* update scanning pointer */
|
||||
opj_optreset = 0;
|
||||
@ -125,7 +125,7 @@ int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen) {
|
||||
static int lastidx,lastofs;
|
||||
char *tmp;
|
||||
const char *tmp;
|
||||
int i,len;
|
||||
char param = 1;
|
||||
|
||||
|
@ -24,6 +24,6 @@ extern char *opj_optarg;
|
||||
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
|
||||
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen);
|
||||
extern void reset_options_reading(void);
|
||||
extern void opj_reset_options_reading(void);
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
||||
|
72
src/bin/common/opj_string.h
Normal file
72
src/bin/common/opj_string.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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) 2015, Matthieu Darbois
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPJ_STRING_H
|
||||
#define OPJ_STRING_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* strnlen is not standard, strlen_s is C11... */
|
||||
/* keep in mind there still is a buffer read overflow possible */
|
||||
static size_t opj_strnlen_s(const char *src, size_t max_len)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (src == NULL) {
|
||||
return 0U;
|
||||
}
|
||||
for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
|
||||
return len;
|
||||
}
|
||||
|
||||
/* should be equivalent to C11 function except for the handler */
|
||||
/* keep in mind there still is a buffer read overflow possible */
|
||||
static int opj_strcpy_s(char* dst, size_t dst_size, const char* src)
|
||||
{
|
||||
size_t src_len = 0U;
|
||||
if ((dst == NULL) || (dst_size == 0U)) {
|
||||
return EINVAL;
|
||||
}
|
||||
if (src == NULL) {
|
||||
dst[0] = '\0';
|
||||
return EINVAL;
|
||||
}
|
||||
src_len = opj_strnlen_s(src, dst_size);
|
||||
if (src_len >= dst_size) {
|
||||
return ERANGE;
|
||||
}
|
||||
memcpy(dst, src, src_len);
|
||||
dst[src_len] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* OPJ_STRING_H */
|
@ -3,11 +3,24 @@
|
||||
# First thing define the common source:
|
||||
set(common_SRCS
|
||||
convert.c
|
||||
convert.h
|
||||
convertbmp.c
|
||||
index.c
|
||||
index.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_string.h
|
||||
)
|
||||
|
||||
if(OPJ_HAVE_LIBTIFF)
|
||||
list(APPEND common_SRCS converttif.c)
|
||||
endif()
|
||||
if(OPJ_HAVE_LIBPNG)
|
||||
list(APPEND common_SRCS convertpng.c)
|
||||
endif()
|
||||
|
||||
# Headers file are located here:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
@ -44,12 +57,21 @@ foreach(exe opj_decompress opj_compress opj_dump)
|
||||
# On unix you need to link to the math library:
|
||||
if(UNIX)
|
||||
target_link_libraries(${exe} m)
|
||||
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
target_link_libraries(${exe} rt)
|
||||
endif()
|
||||
endif()
|
||||
# Install exe
|
||||
install(TARGETS ${exe}
|
||||
EXPORT OpenJPEGTargets
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
if(OPJ_USE_DSYMUTIL)
|
||||
add_custom_command(TARGET ${exe} POST_BUILD
|
||||
COMMAND "dsymutil" "$<TARGET_FILE:${exe}>"
|
||||
COMMENT "dsymutil $<TARGET_FILE:${exe}>"
|
||||
DEPENDS ${exe})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(BUILD_DOC)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,23 @@ typedef struct raw_cparameters {
|
||||
/*@}*/
|
||||
} raw_cparameters_t;
|
||||
|
||||
/* Component precision clipping */
|
||||
void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
||||
/* Component precision scaling */
|
||||
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision);
|
||||
|
||||
/* planar / interleaved conversions */
|
||||
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length);
|
||||
extern const convert_32s_CXPX convert_32s_CXPX_LUT[5];
|
||||
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust);
|
||||
extern const convert_32s_PXCX convert_32s_PXCX_LUT[5];
|
||||
/* bit depth conversions */
|
||||
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length);
|
||||
extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */
|
||||
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length);
|
||||
extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */
|
||||
|
||||
|
||||
/* TGA conversion */
|
||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetotga(opj_image_t * image, const char *outfile);
|
||||
@ -86,7 +103,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetopgx(opj_image_t *image, const char *outfile);
|
||||
|
||||
opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetopnm(opj_image_t *image, const char *outfile);
|
||||
int imagetopnm(opj_image_t *image, const char *outfile, int force_split);
|
||||
|
||||
/* RAW conversion */
|
||||
int imagetoraw(opj_image_t * image, const char *outfile);
|
||||
|
996
src/bin/jp2/convertbmp.c
Normal file
996
src/bin/jp2/convertbmp.c
Normal file
@ -0,0 +1,996 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_apps_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
|
||||
typedef struct {
|
||||
OPJ_UINT16 bfType; /* 'BM' for Bitmap (19776) */
|
||||
OPJ_UINT32 bfSize; /* Size of the file */
|
||||
OPJ_UINT16 bfReserved1; /* Reserved : 0 */
|
||||
OPJ_UINT16 bfReserved2; /* Reserved : 0 */
|
||||
OPJ_UINT32 bfOffBits; /* Offset */
|
||||
} OPJ_BITMAPFILEHEADER;
|
||||
|
||||
typedef struct {
|
||||
OPJ_UINT32 biSize; /* Size of the structure in bytes */
|
||||
OPJ_UINT32 biWidth; /* Width of the image in pixels */
|
||||
OPJ_UINT32 biHeight; /* Heigth of the image in pixels */
|
||||
OPJ_UINT16 biPlanes; /* 1 */
|
||||
OPJ_UINT16 biBitCount; /* Number of color bits by pixels */
|
||||
OPJ_UINT32 biCompression; /* Type of encoding 0: none 1: RLE8 2: RLE4 */
|
||||
OPJ_UINT32 biSizeImage; /* Size of the image in bytes */
|
||||
OPJ_UINT32 biXpelsPerMeter; /* Horizontal (X) resolution in pixels/meter */
|
||||
OPJ_UINT32 biYpelsPerMeter; /* Vertical (Y) resolution in pixels/meter */
|
||||
OPJ_UINT32 biClrUsed; /* Number of color used in the image (0: ALL) */
|
||||
OPJ_UINT32 biClrImportant; /* Number of important color (0: ALL) */
|
||||
OPJ_UINT32 biRedMask; /* Red channel bit mask */
|
||||
OPJ_UINT32 biGreenMask; /* Green channel bit mask */
|
||||
OPJ_UINT32 biBlueMask; /* Blue channel bit mask */
|
||||
OPJ_UINT32 biAlphaMask; /* Alpha channel bit mask */
|
||||
OPJ_UINT32 biColorSpaceType; /* Color space type */
|
||||
OPJ_UINT8 biColorSpaceEP[36]; /* Color space end points */
|
||||
OPJ_UINT32 biRedGamma; /* Red channel gamma */
|
||||
OPJ_UINT32 biGreenGamma; /* Green channel gamma */
|
||||
OPJ_UINT32 biBlueGamma; /* Blue channel gamma */
|
||||
OPJ_UINT32 biIntent; /* Intent */
|
||||
OPJ_UINT32 biIccProfileData; /* ICC profile data */
|
||||
OPJ_UINT32 biIccProfileSize; /* ICC profile size */
|
||||
OPJ_UINT32 biReserved; /* Reserved */
|
||||
} OPJ_BITMAPINFOHEADER;
|
||||
|
||||
static void opj_applyLUT8u_8u32s_C1R(
|
||||
OPJ_UINT8 const* pSrc, OPJ_INT32 srcStride,
|
||||
OPJ_INT32* pDst, OPJ_INT32 dstStride,
|
||||
OPJ_UINT8 const* pLUT,
|
||||
OPJ_UINT32 width, OPJ_UINT32 height)
|
||||
{
|
||||
OPJ_UINT32 y;
|
||||
|
||||
for (y = height; y != 0U; --y) {
|
||||
OPJ_UINT32 x;
|
||||
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
pDst[x] = (OPJ_INT32)pLUT[pSrc[x]];
|
||||
}
|
||||
pSrc += srcStride;
|
||||
pDst += dstStride;
|
||||
}
|
||||
}
|
||||
|
||||
static void opj_applyLUT8u_8u32s_C1P3R(
|
||||
OPJ_UINT8 const* pSrc, OPJ_INT32 srcStride,
|
||||
OPJ_INT32* const* pDst, OPJ_INT32 const* pDstStride,
|
||||
OPJ_UINT8 const* const* pLUT,
|
||||
OPJ_UINT32 width, OPJ_UINT32 height)
|
||||
{
|
||||
OPJ_UINT32 y;
|
||||
OPJ_INT32* pR = pDst[0];
|
||||
OPJ_INT32* pG = pDst[1];
|
||||
OPJ_INT32* pB = pDst[2];
|
||||
OPJ_UINT8 const* pLUT_R = pLUT[0];
|
||||
OPJ_UINT8 const* pLUT_G = pLUT[1];
|
||||
OPJ_UINT8 const* pLUT_B = pLUT[2];
|
||||
|
||||
for (y = height; y != 0U; --y) {
|
||||
OPJ_UINT32 x;
|
||||
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
OPJ_UINT8 idx = pSrc[x];
|
||||
pR[x] = (OPJ_INT32)pLUT_R[idx];
|
||||
pG[x] = (OPJ_INT32)pLUT_G[idx];
|
||||
pB[x] = (OPJ_INT32)pLUT_B[idx];
|
||||
}
|
||||
pSrc += srcStride;
|
||||
pR += pDstStride[0];
|
||||
pG += pDstStride[1];
|
||||
pB += pDstStride[2];
|
||||
}
|
||||
}
|
||||
|
||||
static void bmp24toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image)
|
||||
{
|
||||
int index;
|
||||
OPJ_UINT32 width, height;
|
||||
OPJ_UINT32 x, y;
|
||||
const OPJ_UINT8 *pSrc = NULL;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
image->comps[0].data[index] = (OPJ_INT32)pSrc[3*x+2]; /* R */
|
||||
image->comps[1].data[index] = (OPJ_INT32)pSrc[3*x+1]; /* G */
|
||||
image->comps[2].data[index] = (OPJ_INT32)pSrc[3*x+0]; /* B */
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void bmp_mask_get_shift_and_prec(OPJ_UINT32 mask, OPJ_UINT32* shift, OPJ_UINT32* prec)
|
||||
{
|
||||
OPJ_UINT32 l_shift, l_prec;
|
||||
|
||||
l_shift = l_prec = 0U;
|
||||
|
||||
if (mask != 0U) {
|
||||
while ((mask & 1U) == 0U) {
|
||||
mask >>= 1;
|
||||
l_shift++;
|
||||
}
|
||||
while (mask & 1U) {
|
||||
mask >>= 1;
|
||||
l_prec++;
|
||||
}
|
||||
}
|
||||
*shift = l_shift; *prec = l_prec;
|
||||
}
|
||||
|
||||
static void bmpmask32toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image, OPJ_UINT32 redMask, OPJ_UINT32 greenMask, OPJ_UINT32 blueMask, OPJ_UINT32 alphaMask)
|
||||
{
|
||||
int index;
|
||||
OPJ_UINT32 width, height;
|
||||
OPJ_UINT32 x, y;
|
||||
const OPJ_UINT8 *pSrc = NULL;
|
||||
OPJ_BOOL hasAlpha;
|
||||
OPJ_UINT32 redShift, redPrec;
|
||||
OPJ_UINT32 greenShift, greenPrec;
|
||||
OPJ_UINT32 blueShift, bluePrec;
|
||||
OPJ_UINT32 alphaShift, alphaPrec;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
hasAlpha = image->numcomps > 3U;
|
||||
|
||||
bmp_mask_get_shift_and_prec(redMask, &redShift, &redPrec);
|
||||
bmp_mask_get_shift_and_prec(greenMask, &greenShift, &greenPrec);
|
||||
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
|
||||
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
|
||||
|
||||
image->comps[0].bpp = redPrec;
|
||||
image->comps[0].prec = redPrec;
|
||||
image->comps[1].bpp = greenPrec;
|
||||
image->comps[1].prec = greenPrec;
|
||||
image->comps[2].bpp = bluePrec;
|
||||
image->comps[2].prec = bluePrec;
|
||||
if (hasAlpha) {
|
||||
image->comps[3].bpp = alphaPrec;
|
||||
image->comps[3].prec = alphaPrec;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
OPJ_UINT32 value = 0U;
|
||||
|
||||
value |= ((OPJ_UINT32)pSrc[4*x+0]) << 0;
|
||||
value |= ((OPJ_UINT32)pSrc[4*x+1]) << 8;
|
||||
value |= ((OPJ_UINT32)pSrc[4*x+2]) << 16;
|
||||
value |= ((OPJ_UINT32)pSrc[4*x+3]) << 24;
|
||||
|
||||
image->comps[0].data[index] = (OPJ_INT32)((value & redMask) >> redShift); /* R */
|
||||
image->comps[1].data[index] = (OPJ_INT32)((value & greenMask) >> greenShift); /* G */
|
||||
image->comps[2].data[index] = (OPJ_INT32)((value & blueMask) >> blueShift); /* B */
|
||||
if (hasAlpha) {
|
||||
image->comps[3].data[index] = (OPJ_INT32)((value & alphaMask) >> alphaShift); /* A */
|
||||
}
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void bmpmask16toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image, OPJ_UINT32 redMask, OPJ_UINT32 greenMask, OPJ_UINT32 blueMask, OPJ_UINT32 alphaMask)
|
||||
{
|
||||
int index;
|
||||
OPJ_UINT32 width, height;
|
||||
OPJ_UINT32 x, y;
|
||||
const OPJ_UINT8 *pSrc = NULL;
|
||||
OPJ_BOOL hasAlpha;
|
||||
OPJ_UINT32 redShift, redPrec;
|
||||
OPJ_UINT32 greenShift, greenPrec;
|
||||
OPJ_UINT32 blueShift, bluePrec;
|
||||
OPJ_UINT32 alphaShift, alphaPrec;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
hasAlpha = image->numcomps > 3U;
|
||||
|
||||
bmp_mask_get_shift_and_prec(redMask, &redShift, &redPrec);
|
||||
bmp_mask_get_shift_and_prec(greenMask, &greenShift, &greenPrec);
|
||||
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
|
||||
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
|
||||
|
||||
image->comps[0].bpp = redPrec;
|
||||
image->comps[0].prec = redPrec;
|
||||
image->comps[1].bpp = greenPrec;
|
||||
image->comps[1].prec = greenPrec;
|
||||
image->comps[2].bpp = bluePrec;
|
||||
image->comps[2].prec = bluePrec;
|
||||
if (hasAlpha) {
|
||||
image->comps[3].bpp = alphaPrec;
|
||||
image->comps[3].prec = alphaPrec;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
for(x = 0; x < width; x++)
|
||||
{
|
||||
OPJ_UINT32 value = 0U;
|
||||
|
||||
value |= ((OPJ_UINT32)pSrc[2*x+0]) << 0;
|
||||
value |= ((OPJ_UINT32)pSrc[2*x+1]) << 8;
|
||||
|
||||
image->comps[0].data[index] = (OPJ_INT32)((value & redMask) >> redShift); /* R */
|
||||
image->comps[1].data[index] = (OPJ_INT32)((value & greenMask) >> greenShift); /* G */
|
||||
image->comps[2].data[index] = (OPJ_INT32)((value & blueMask) >> blueShift); /* B */
|
||||
if (hasAlpha) {
|
||||
image->comps[3].data[index] = (OPJ_INT32)((value & alphaMask) >> alphaShift); /* A */
|
||||
}
|
||||
index++;
|
||||
}
|
||||
pSrc -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
static opj_image_t* bmp8toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image, OPJ_UINT8 const* const* pLUT)
|
||||
{
|
||||
OPJ_UINT32 width, height;
|
||||
const OPJ_UINT8 *pSrc = NULL;
|
||||
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
|
||||
pSrc = pData + (height - 1U) * stride;
|
||||
if (image->numcomps == 1U) {
|
||||
opj_applyLUT8u_8u32s_C1R(pSrc, -(OPJ_INT32)stride, image->comps[0].data, (OPJ_INT32)width, pLUT[0], width, height);
|
||||
}
|
||||
else {
|
||||
OPJ_INT32* pDst[3];
|
||||
OPJ_INT32 pDstStride[3];
|
||||
|
||||
pDst[0] = image->comps[0].data; pDst[1] = image->comps[1].data; pDst[2] = image->comps[2].data;
|
||||
pDstStride[0] = (OPJ_INT32)width; pDstStride[1] = (OPJ_INT32)width; pDstStride[2] = (OPJ_INT32)width;
|
||||
opj_applyLUT8u_8u32s_C1P3R(pSrc, -(OPJ_INT32)stride, pDst, pDstStride, pLUT, width, height);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
static OPJ_BOOL bmp_read_file_header(FILE* IN, OPJ_BITMAPFILEHEADER* header)
|
||||
{
|
||||
header->bfType = (OPJ_UINT16)getc(IN);
|
||||
header->bfType |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
|
||||
|
||||
if (header->bfType != 19778) {
|
||||
fprintf(stderr,"Error, not a BMP file!\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
header->bfSize = (OPJ_UINT32)getc(IN);
|
||||
header->bfSize |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->bfSize |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->bfSize |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->bfReserved1 = (OPJ_UINT16)getc(IN);
|
||||
header->bfReserved1 |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
|
||||
|
||||
header->bfReserved2 = (OPJ_UINT16)getc(IN);
|
||||
header->bfReserved2 |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
|
||||
|
||||
header->bfOffBits = (OPJ_UINT32)getc(IN);
|
||||
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->bfOffBits |= (OPJ_UINT32)getc(IN) << 24;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header)
|
||||
{
|
||||
memset(header, 0, sizeof(*header));
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
header->biSize = (OPJ_UINT32)getc(IN);
|
||||
header->biSize |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biSize |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biSize |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
switch (header->biSize) {
|
||||
case 12U: /* BITMAPCOREHEADER */
|
||||
case 40U: /* BITMAPINFOHEADER */
|
||||
case 52U: /* BITMAPV2INFOHEADER */
|
||||
case 56U: /* BITMAPV3INFOHEADER */
|
||||
case 108U: /* BITMAPV4HEADER */
|
||||
case 124U: /* BITMAPV5HEADER */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Error, unknown BMP header size %d\n", header->biSize);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
header->biWidth = (OPJ_UINT32)getc(IN);
|
||||
header->biWidth |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biWidth |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biWidth |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biHeight = (OPJ_UINT32)getc(IN);
|
||||
header->biHeight |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biHeight |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biHeight |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biPlanes = (OPJ_UINT16)getc(IN);
|
||||
header->biPlanes |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
|
||||
|
||||
header->biBitCount = (OPJ_UINT16)getc(IN);
|
||||
header->biBitCount |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8);
|
||||
|
||||
if(header->biSize >= 40U) {
|
||||
header->biCompression = (OPJ_UINT32)getc(IN);
|
||||
header->biCompression |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biCompression |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biCompression |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biSizeImage = (OPJ_UINT32)getc(IN);
|
||||
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biSizeImage |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biXpelsPerMeter = (OPJ_UINT32)getc(IN);
|
||||
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biXpelsPerMeter |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biYpelsPerMeter = (OPJ_UINT32)getc(IN);
|
||||
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biYpelsPerMeter |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biClrUsed = (OPJ_UINT32)getc(IN);
|
||||
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biClrUsed |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biClrImportant = (OPJ_UINT32)getc(IN);
|
||||
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biClrImportant |= (OPJ_UINT32)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 56U) {
|
||||
header->biRedMask = (OPJ_UINT32)getc(IN);
|
||||
header->biRedMask |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biRedMask |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biRedMask |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biGreenMask = (OPJ_UINT32)getc(IN);
|
||||
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biGreenMask |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biBlueMask = (OPJ_UINT32)getc(IN);
|
||||
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biBlueMask |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biAlphaMask = (OPJ_UINT32)getc(IN);
|
||||
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biAlphaMask |= (OPJ_UINT32)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 108U) {
|
||||
header->biColorSpaceType = (OPJ_UINT32)getc(IN);
|
||||
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biColorSpaceType |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
if (fread(&(header->biColorSpaceEP), 1U, sizeof(header->biColorSpaceEP), IN) != sizeof(header->biColorSpaceEP)) {
|
||||
fprintf(stderr,"Error, can't read BMP header\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
header->biRedGamma = (OPJ_UINT32)getc(IN);
|
||||
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biRedGamma |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biGreenGamma = (OPJ_UINT32)getc(IN);
|
||||
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biGreenGamma |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biBlueGamma = (OPJ_UINT32)getc(IN);
|
||||
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biBlueGamma |= (OPJ_UINT32)getc(IN) << 24;
|
||||
}
|
||||
|
||||
if(header->biSize >= 124U) {
|
||||
header->biIntent = (OPJ_UINT32)getc(IN);
|
||||
header->biIntent |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biIntent |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biIntent |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biIccProfileData = (OPJ_UINT32)getc(IN);
|
||||
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biIccProfileData |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biIccProfileSize = (OPJ_UINT32)getc(IN);
|
||||
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biIccProfileSize |= (OPJ_UINT32)getc(IN) << 24;
|
||||
|
||||
header->biReserved = (OPJ_UINT32)getc(IN);
|
||||
header->biReserved |= (OPJ_UINT32)getc(IN) << 8;
|
||||
header->biReserved |= (OPJ_UINT32)getc(IN) << 16;
|
||||
header->biReserved |= (OPJ_UINT32)getc(IN) << 24;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL bmp_read_raw_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(width);
|
||||
|
||||
if ( fread(pData, sizeof(OPJ_UINT8), stride * height, IN) != (stride * height) )
|
||||
{
|
||||
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)
|
||||
{
|
||||
OPJ_UINT32 x, y;
|
||||
OPJ_UINT8 *pix;
|
||||
const OPJ_UINT8 *beyond;
|
||||
|
||||
beyond = pData + stride * height;
|
||||
pix = pData;
|
||||
|
||||
x = y = 0U;
|
||||
while (y < height)
|
||||
{
|
||||
int c = getc(IN);
|
||||
|
||||
if (c) {
|
||||
int j;
|
||||
OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN);
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
|
||||
*pix = c1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
c = getc(IN);
|
||||
if (c == 0x00) { /* EOL */
|
||||
x = 0;
|
||||
++y;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else if (c == 0x01) { /* EOP */
|
||||
break;
|
||||
}
|
||||
else if (c == 0x02) { /* MOVE by dxdy */
|
||||
c = getc(IN);
|
||||
x += (OPJ_UINT32)c;
|
||||
c = getc(IN);
|
||||
y += (OPJ_UINT32)c;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else /* 03 .. 255 */
|
||||
{
|
||||
int j;
|
||||
for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++)
|
||||
{
|
||||
OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN);
|
||||
*pix = c1;
|
||||
}
|
||||
if ((OPJ_UINT32)c & 1U) { /* skip padding byte */
|
||||
getc(IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}/* while() */
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)
|
||||
{
|
||||
OPJ_UINT32 x, y;
|
||||
OPJ_UINT8 *pix;
|
||||
const OPJ_UINT8 *beyond;
|
||||
|
||||
beyond = pData + stride * height;
|
||||
pix = pData;
|
||||
x = y = 0U;
|
||||
while(y < height)
|
||||
{
|
||||
int c = getc(IN);
|
||||
if(c == EOF) break;
|
||||
|
||||
if(c) {/* encoded mode */
|
||||
int j;
|
||||
OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN);
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
|
||||
*pix = (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
|
||||
}
|
||||
}
|
||||
else { /* absolute mode */
|
||||
c = getc(IN);
|
||||
if(c == EOF) break;
|
||||
|
||||
if(c == 0x00) { /* EOL */
|
||||
x = 0; y++; pix = pData + y * stride;
|
||||
}
|
||||
else if(c == 0x01) { /* EOP */
|
||||
break;
|
||||
}
|
||||
else if(c == 0x02) { /* MOVE by dxdy */
|
||||
c = getc(IN); x += (OPJ_UINT32)c;
|
||||
c = getc(IN); y += (OPJ_UINT32)c;
|
||||
pix = pData + y * stride + x;
|
||||
}
|
||||
else { /* 03 .. 255 : absolute mode */
|
||||
int j;
|
||||
OPJ_UINT8 c1 = 0U;
|
||||
|
||||
for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
|
||||
if((j&1) == 0) {
|
||||
c1 = (OPJ_UINT8)getc(IN);
|
||||
}
|
||||
*pix = (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
|
||||
}
|
||||
if(((c&3) == 1) || ((c&3) == 2)) { /* skip padding byte */
|
||||
getc(IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* while(y < height) */
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
{
|
||||
opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
|
||||
OPJ_UINT8 lut_R[256], lut_G[256], lut_B[256];
|
||||
OPJ_UINT8 const* pLUT[3];
|
||||
opj_image_t * image = NULL;
|
||||
FILE *IN;
|
||||
OPJ_BITMAPFILEHEADER File_h;
|
||||
OPJ_BITMAPINFOHEADER Info_h;
|
||||
OPJ_UINT32 i, palette_len, numcmpts = 1U;
|
||||
OPJ_BOOL l_result = OPJ_FALSE;
|
||||
OPJ_UINT8* pData = NULL;
|
||||
OPJ_UINT32 stride;
|
||||
|
||||
pLUT[0] = lut_R; pLUT[1] = lut_G; pLUT[2] = lut_B;
|
||||
|
||||
IN = fopen(filename, "rb");
|
||||
if (!IN)
|
||||
{
|
||||
fprintf(stderr, "Failed to open %s for reading !!\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!bmp_read_file_header(IN, &File_h)) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
if (!bmp_read_info_header(IN, &Info_h)) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Load palette */
|
||||
if (Info_h.biBitCount <= 8U)
|
||||
{
|
||||
memset(&lut_R[0], 0, sizeof(lut_R));
|
||||
memset(&lut_G[0], 0, sizeof(lut_G));
|
||||
memset(&lut_B[0], 0, sizeof(lut_B));
|
||||
|
||||
palette_len = Info_h.biClrUsed;
|
||||
if((palette_len == 0U) && (Info_h.biBitCount <= 8U)) {
|
||||
palette_len = (1U << Info_h.biBitCount);
|
||||
}
|
||||
if (palette_len > 256U) {
|
||||
palette_len = 256U;
|
||||
}
|
||||
if (palette_len > 0U) {
|
||||
OPJ_UINT8 has_color = 0U;
|
||||
for (i = 0U; i < palette_len; i++) {
|
||||
lut_B[i] = (OPJ_UINT8)getc(IN);
|
||||
lut_G[i] = (OPJ_UINT8)getc(IN);
|
||||
lut_R[i] = (OPJ_UINT8)getc(IN);
|
||||
(void)getc(IN); /* padding */
|
||||
has_color |= (lut_B[i] ^ lut_G[i]) | (lut_G[i] ^ lut_R[i]);
|
||||
}
|
||||
if(has_color) {
|
||||
numcmpts = 3U;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
numcmpts = 3U;
|
||||
if ((Info_h.biCompression == 3) && (Info_h.biAlphaMask != 0U)) {
|
||||
numcmpts++;
|
||||
}
|
||||
}
|
||||
|
||||
if (Info_h.biWidth == 0 || Info_h.biHeight == 0) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (Info_h.biBitCount > (((OPJ_UINT32)-1) - 31) / Info_h.biWidth) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
stride = ((Info_h.biWidth * Info_h.biBitCount + 31U) / 32U) * 4U; /* rows are aligned on 32bits */
|
||||
if (Info_h.biBitCount == 4 && Info_h.biCompression == 2) { /* RLE 4 gets decoded as 8 bits data for now... */
|
||||
if (8 > (((OPJ_UINT32)-1) - 31) / Info_h.biWidth) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
stride = ((Info_h.biWidth * 8U + 31U) / 32U) * 4U;
|
||||
}
|
||||
|
||||
if (stride > ((OPJ_UINT32)-1) / sizeof(OPJ_UINT8) / Info_h.biHeight) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
pData = (OPJ_UINT8 *) calloc(1, stride * Info_h.biHeight * sizeof(OPJ_UINT8));
|
||||
if (pData == NULL) {
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
/* Place the cursor at the beginning of the image information */
|
||||
fseek(IN, 0, SEEK_SET);
|
||||
fseek(IN, (long)File_h.bfOffBits, SEEK_SET);
|
||||
|
||||
switch (Info_h.biCompression) {
|
||||
case 0:
|
||||
case 3:
|
||||
/* read raw data */
|
||||
l_result = bmp_read_raw_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
case 1:
|
||||
/* read rle8 data */
|
||||
l_result = bmp_read_rle8_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
case 2:
|
||||
/* read rle4 data */
|
||||
l_result = bmp_read_rle4_data(IN, pData, stride, Info_h.biWidth, Info_h.biHeight);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unsupported BMP compression\n");
|
||||
l_result = OPJ_FALSE;
|
||||
break;
|
||||
}
|
||||
if (!l_result) {
|
||||
free(pData);
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create the image */
|
||||
memset(&cmptparm[0], 0, sizeof(cmptparm));
|
||||
for(i = 0; i < 4U; i++)
|
||||
{
|
||||
cmptparm[i].prec = 8;
|
||||
cmptparm[i].bpp = 8;
|
||||
cmptparm[i].sgnd = 0;
|
||||
cmptparm[i].dx = (OPJ_UINT32)parameters->subsampling_dx;
|
||||
cmptparm[i].dy = (OPJ_UINT32)parameters->subsampling_dy;
|
||||
cmptparm[i].w = Info_h.biWidth;
|
||||
cmptparm[i].h = Info_h.biHeight;
|
||||
}
|
||||
|
||||
image = opj_image_create(numcmpts, &cmptparm[0], (numcmpts == 1U) ? OPJ_CLRSPC_GRAY : OPJ_CLRSPC_SRGB);
|
||||
if(!image) {
|
||||
fclose(IN);
|
||||
free(pData);
|
||||
return NULL;
|
||||
}
|
||||
if (numcmpts == 4U) {
|
||||
image->comps[3].alpha = 1;
|
||||
}
|
||||
|
||||
/* set image offset and reference grid */
|
||||
image->x0 = (OPJ_UINT32)parameters->image_offset_x0;
|
||||
image->y0 = (OPJ_UINT32)parameters->image_offset_y0;
|
||||
image->x1 = image->x0 + (Info_h.biWidth - 1U) * (OPJ_UINT32)parameters->subsampling_dx + 1U;
|
||||
image->y1 = image->y0 + (Info_h.biHeight - 1U) * (OPJ_UINT32)parameters->subsampling_dy + 1U;
|
||||
|
||||
/* Read the data */
|
||||
if (Info_h.biBitCount == 24 && Info_h.biCompression == 0) { /*RGB */
|
||||
bmp24toimage(pData, stride, image);
|
||||
}
|
||||
else if (Info_h.biBitCount == 8 && Info_h.biCompression == 0) { /* RGB 8bpp Indexed */
|
||||
bmp8toimage(pData, stride, image, pLUT);
|
||||
}
|
||||
else if (Info_h.biBitCount == 8 && Info_h.biCompression == 1) { /*RLE8*/
|
||||
bmp8toimage(pData, stride, image, pLUT);
|
||||
}
|
||||
else if (Info_h.biBitCount == 4 && Info_h.biCompression == 2) { /*RLE4*/
|
||||
bmp8toimage(pData, stride, image, pLUT); /* RLE 4 gets decoded as 8 bits data for now */
|
||||
}
|
||||
else if (Info_h.biBitCount == 32 && Info_h.biCompression == 0) { /* RGBX */
|
||||
bmpmask32toimage(pData, stride, image, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, 0x00000000U);
|
||||
}
|
||||
else if (Info_h.biBitCount == 32 && Info_h.biCompression == 3) { /* bitmask */
|
||||
bmpmask32toimage(pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
|
||||
}
|
||||
else if (Info_h.biBitCount == 16 && Info_h.biCompression == 0) { /* RGBX */
|
||||
bmpmask16toimage(pData, stride, image, 0x7C00U, 0x03E0U, 0x001FU, 0x0000U);
|
||||
}
|
||||
else if (Info_h.biBitCount == 16 && Info_h.biCompression == 3) { /* bitmask */
|
||||
if ((Info_h.biRedMask == 0U) && (Info_h.biGreenMask == 0U) && (Info_h.biBlueMask == 0U)) {
|
||||
Info_h.biRedMask = 0xF800U;
|
||||
Info_h.biGreenMask = 0x07E0U;
|
||||
Info_h.biBlueMask = 0x001FU;
|
||||
}
|
||||
bmpmask16toimage(pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
|
||||
}
|
||||
else {
|
||||
opj_image_destroy(image);
|
||||
image = NULL;
|
||||
fprintf(stderr, "Other system than 24 bits/pixels or 8 bits (no RLE coding) is not yet implemented [%d]\n", Info_h.biBitCount);
|
||||
}
|
||||
free(pData);
|
||||
fclose(IN);
|
||||
return image;
|
||||
}
|
||||
|
||||
int imagetobmp(opj_image_t * image, const char *outfile) {
|
||||
int w, h;
|
||||
int i, pad;
|
||||
FILE *fdest = NULL;
|
||||
int adjustR, adjustG, adjustB;
|
||||
|
||||
if (image->comps[0].prec < 8) {
|
||||
fprintf(stderr, "Unsupported number of components: %d\n", image->comps[0].prec);
|
||||
return 1;
|
||||
}
|
||||
if (image->numcomps >= 3 && image->comps[0].dx == image->comps[1].dx
|
||||
&& image->comps[1].dx == image->comps[2].dx
|
||||
&& image->comps[0].dy == image->comps[1].dy
|
||||
&& image->comps[1].dy == image->comps[2].dy
|
||||
&& image->comps[0].prec == image->comps[1].prec
|
||||
&& image->comps[1].prec == image->comps[2].prec) {
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
24 bits color
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
fdest = fopen(outfile, "wb");
|
||||
if (!fdest) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
w = (int)image->comps[0].w;
|
||||
h = (int)image->comps[0].h;
|
||||
|
||||
fprintf(fdest, "BM");
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c",
|
||||
(OPJ_UINT8) (h * w * 3 + 3 * h * (w % 2) + 54) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (54) & 0xff, ((54) >> 8) & 0xff,((54) >> 16) & 0xff, ((54) >> 24) & 0xff);
|
||||
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) ((w) & 0xff),
|
||||
(OPJ_UINT8) ((w) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((w) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((w) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) ((h) & 0xff),
|
||||
(OPJ_UINT8) ((h) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c", (24) & 0xff, ((24) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) (3 * h * w + 3 * h * (w % 2)) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2)) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2)) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h * w * 3 + 3 * h * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
|
||||
if (image->comps[0].prec > 8) {
|
||||
adjustR = (int)image->comps[0].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
||||
}
|
||||
else
|
||||
adjustR = 0;
|
||||
if (image->comps[1].prec > 8) {
|
||||
adjustG = (int)image->comps[1].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 1 from %d bits to 8 bits\n", image->comps[1].prec);
|
||||
}
|
||||
else
|
||||
adjustG = 0;
|
||||
if (image->comps[2].prec > 8) {
|
||||
adjustB = (int)image->comps[2].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 2 from %d bits to 8 bits\n", image->comps[2].prec);
|
||||
}
|
||||
else
|
||||
adjustB = 0;
|
||||
|
||||
for (i = 0; i < w * h; i++) {
|
||||
OPJ_UINT8 rc, gc, bc;
|
||||
int r, g, b;
|
||||
|
||||
r = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
r = ((r >> adjustR)+((r >> (adjustR-1))%2));
|
||||
if(r > 255) r = 255; else if(r < 0) r = 0;
|
||||
rc = (OPJ_UINT8)r;
|
||||
|
||||
g = image->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||
g = ((g >> adjustG)+((g >> (adjustG-1))%2));
|
||||
if(g > 255) g = 255; else if(g < 0) g = 0;
|
||||
gc = (OPJ_UINT8)g;
|
||||
|
||||
b = image->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
|
||||
b = ((b >> adjustB)+((b >> (adjustB-1))%2));
|
||||
if(b > 255) b = 255; else if(b < 0) b = 0;
|
||||
bc = (OPJ_UINT8)b;
|
||||
|
||||
fprintf(fdest, "%c%c%c", bc, gc, rc);
|
||||
|
||||
if ((i + 1) % w == 0) {
|
||||
for (pad = ((3 * w) % 4) ? (4 - (3 * w) % 4) : 0; pad > 0; pad--) /* ADD */
|
||||
fprintf(fdest, "%c", 0);
|
||||
}
|
||||
}
|
||||
fclose(fdest);
|
||||
} else { /* Gray-scale */
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
8 bits non code (Gray scale)
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
fdest = fopen(outfile, "wb");
|
||||
if (!fdest) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile);
|
||||
return 1;
|
||||
}
|
||||
w = (int)image->comps[0].w;
|
||||
h = (int)image->comps[0].h;
|
||||
|
||||
fprintf(fdest, "BM");
|
||||
|
||||
/* FILE HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) (h * w + 54 + 1024 + h * (w % 2)) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + 54 + 1024 + h * (w % 2)) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + 54 + 1024 + h * (w % 2)) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + 54 + 1024 + w * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (54 + 1024) & 0xff, ((54 + 1024) >> 8) & 0xff,
|
||||
((54 + 1024) >> 16) & 0xff,
|
||||
((54 + 1024) >> 24) & 0xff);
|
||||
|
||||
/* INFO HEADER */
|
||||
/* ------------- */
|
||||
fprintf(fdest, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) ((w) & 0xff),
|
||||
(OPJ_UINT8) ((w) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((w) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((w) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) ((h) & 0xff),
|
||||
(OPJ_UINT8) ((h) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c", (8) & 0xff, ((8) >> 8) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (OPJ_UINT8) (h * w + h * (w % 2)) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + h * (w % 2)) >> 8) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + h * (w % 2)) >> 16) & 0xff,
|
||||
(OPJ_UINT8) ((h * w + h * (w % 2)) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
|
||||
fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
|
||||
|
||||
if (image->comps[0].prec > 8) {
|
||||
adjustR = (int)image->comps[0].prec - 8;
|
||||
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
||||
}else
|
||||
adjustR = 0;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
fprintf(fdest, "%c%c%c%c", i, i, i, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < w * h; i++) {
|
||||
int r;
|
||||
|
||||
r = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
|
||||
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
r = ((r >> adjustR)+((r >> (adjustR-1))%2));
|
||||
if(r > 255) r = 255; else if(r < 0) r = 0;
|
||||
|
||||
fprintf(fdest, "%c", (OPJ_UINT8)r);
|
||||
|
||||
if ((i + 1) % w == 0) {
|
||||
for (pad = (w % 4) ? (4 - w % 4) : 0; pad > 0; pad--) /* ADD */
|
||||
fprintf(fdest, "%c", 0);
|
||||
}
|
||||
}
|
||||
fclose(fdest);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
500
src/bin/jp2/convertpng.c
Normal file
500
src/bin/jp2/convertpng.c
Normal file
@ -0,0 +1,500 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2015, Matthieu Darbois
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_apps_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <zlib.h>
|
||||
#include <png.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
|
||||
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
|
||||
#define MAGIC_SIZE 8
|
||||
/* PNG allows bits per sample: 1, 2, 4, 8, 16 */
|
||||
|
||||
|
||||
static void convert_16u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < length; i++) {
|
||||
OPJ_INT32 val0 = *pSrc++;
|
||||
OPJ_INT32 val1 = *pSrc++;
|
||||
pDst[i] = val0 << 8 | val1;
|
||||
}
|
||||
}
|
||||
|
||||
opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
|
||||
{
|
||||
png_structp png = NULL;
|
||||
png_infop info = NULL;
|
||||
double gamma;
|
||||
int bit_depth, interlace_type,compression_type, filter_type;
|
||||
OPJ_UINT32 i;
|
||||
png_uint_32 width, height = 0U;
|
||||
int color_type;
|
||||
FILE *reader = NULL;
|
||||
OPJ_BYTE** rows = NULL;
|
||||
OPJ_INT32* row32s = NULL;
|
||||
/* j2k: */
|
||||
opj_image_t *image = NULL;
|
||||
opj_image_cmptparm_t cmptparm[4];
|
||||
OPJ_UINT32 nr_comp;
|
||||
OPJ_BYTE sigbuf[8];
|
||||
convert_XXx32s_C1R cvtXXTo32s = NULL;
|
||||
convert_32s_CXPX cvtCxToPx = NULL;
|
||||
OPJ_INT32* planes[4];
|
||||
|
||||
if((reader = fopen(read_idf, "rb")) == NULL)
|
||||
{
|
||||
fprintf(stderr,"pngtoimage: can not open %s\n",read_idf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(fread(sigbuf, 1, MAGIC_SIZE, reader) != MAGIC_SIZE
|
||||
|| memcmp(sigbuf, PNG_MAGIC, MAGIC_SIZE) != 0)
|
||||
{
|
||||
fprintf(stderr,"pngtoimage: %s is no valid PNG file\n",read_idf);
|
||||
goto fin;
|
||||
}
|
||||
|
||||
if((png = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL)) == NULL)
|
||||
goto fin;
|
||||
if((info = png_create_info_struct(png)) == NULL)
|
||||
goto fin;
|
||||
|
||||
if(setjmp(png_jmpbuf(png)))
|
||||
goto fin;
|
||||
|
||||
png_init_io(png, reader);
|
||||
png_set_sig_bytes(png, MAGIC_SIZE);
|
||||
|
||||
png_read_info(png, info);
|
||||
|
||||
if(png_get_IHDR(png, info, &width, &height,
|
||||
&bit_depth, &color_type, &interlace_type,
|
||||
&compression_type, &filter_type) == 0)
|
||||
goto fin;
|
||||
|
||||
/* png_set_expand():
|
||||
* expand paletted images to RGB, expand grayscale images of
|
||||
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
|
||||
* to alpha channels.
|
||||
*/
|
||||
if(color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
png_set_expand(png);
|
||||
}
|
||||
|
||||
if(png_get_valid(png, info, PNG_INFO_tRNS)) {
|
||||
png_set_expand(png);
|
||||
}
|
||||
/* We might wan't to expand background */
|
||||
/*
|
||||
if(png_get_valid(png, info, PNG_INFO_bKGD)) {
|
||||
png_color_16p bgnd;
|
||||
png_get_bKGD(png, info, &bgnd);
|
||||
png_set_background(png, bgnd, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||
}
|
||||
*/
|
||||
|
||||
if( !png_get_gAMA(png, info, &gamma))
|
||||
gamma = 1.0;
|
||||
|
||||
/* we're not displaying but converting, screen gamma == 1.0 */
|
||||
png_set_gamma(png, 1.0, gamma);
|
||||
|
||||
png_read_update_info(png, info);
|
||||
|
||||
color_type = png_get_color_type(png, info);
|
||||
|
||||
switch (color_type) {
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
nr_comp = 1;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
nr_comp = 2;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
nr_comp = 3;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
nr_comp = 4;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"pngtoimage: colortype %d is not supported\n", color_type);
|
||||
goto fin;
|
||||
}
|
||||
cvtCxToPx = convert_32s_CXPX_LUT[nr_comp];
|
||||
bit_depth = png_get_bit_depth(png, info);
|
||||
|
||||
switch (bit_depth) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
cvtXXTo32s = convert_XXu32s_C1R_LUT[bit_depth];
|
||||
break;
|
||||
case 16: /* 16 bpp is specific to PNG */
|
||||
cvtXXTo32s = convert_16u32s_C1R;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"pngtoimage: bit depth %d is not supported\n", bit_depth);
|
||||
goto fin;
|
||||
}
|
||||
|
||||
|
||||
rows = (OPJ_BYTE**)calloc(height+1, sizeof(OPJ_BYTE*));
|
||||
if(rows == NULL){
|
||||
fprintf(stderr, "pngtoimage: memory out\n");
|
||||
goto fin;
|
||||
}
|
||||
for(i = 0; i < height; ++i){
|
||||
rows[i] = (OPJ_BYTE*)malloc(png_get_rowbytes(png,info));
|
||||
if(rows[i] == NULL){
|
||||
fprintf(stderr,"pngtoimage: memory out\n");
|
||||
goto fin;
|
||||
}
|
||||
}
|
||||
png_read_image(png, rows);
|
||||
|
||||
/* Create image */
|
||||
memset(cmptparm, 0, sizeof(cmptparm));
|
||||
for(i = 0; i < nr_comp; ++i)
|
||||
{
|
||||
cmptparm[i].prec = (OPJ_UINT32)bit_depth;
|
||||
/* bits_per_pixel: 8 or 16 */
|
||||
cmptparm[i].bpp = (OPJ_UINT32)bit_depth;
|
||||
cmptparm[i].sgnd = 0;
|
||||
cmptparm[i].dx = (OPJ_UINT32)params->subsampling_dx;
|
||||
cmptparm[i].dy = (OPJ_UINT32)params->subsampling_dy;
|
||||
cmptparm[i].w = (OPJ_UINT32)width;
|
||||
cmptparm[i].h = (OPJ_UINT32)height;
|
||||
}
|
||||
|
||||
image = opj_image_create(nr_comp, &cmptparm[0], (nr_comp > 2U) ? OPJ_CLRSPC_SRGB : OPJ_CLRSPC_GRAY);
|
||||
if(image == NULL) goto fin;
|
||||
image->x0 = (OPJ_UINT32)params->image_offset_x0;
|
||||
image->y0 = (OPJ_UINT32)params->image_offset_y0;
|
||||
image->x1 = (OPJ_UINT32)(image->x0 + (width - 1) * (OPJ_UINT32)params->subsampling_dx + 1 + image->x0);
|
||||
image->y1 = (OPJ_UINT32)(image->y0 + (height - 1) * (OPJ_UINT32)params->subsampling_dy + 1 + image->y0);
|
||||
|
||||
row32s = (OPJ_INT32 *)malloc((size_t)width * nr_comp * sizeof(OPJ_INT32));
|
||||
if(row32s == NULL) goto fin;
|
||||
|
||||
/* Set alpha channel */
|
||||
image->comps[nr_comp-1U].alpha = 1U - (nr_comp & 1U);
|
||||
|
||||
for(i = 0; i < nr_comp; i++)
|
||||
{
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
|
||||
for(i = 0; i < height; ++i)
|
||||
{
|
||||
cvtXXTo32s(rows[i], row32s, (OPJ_SIZE_T)width * nr_comp);
|
||||
cvtCxToPx(row32s, planes, width);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
fin:
|
||||
if(rows)
|
||||
{
|
||||
for(i = 0; i < height; ++i)
|
||||
if(rows[i]) free(rows[i]);
|
||||
free(rows);
|
||||
}
|
||||
if (row32s) {
|
||||
free(row32s);
|
||||
}
|
||||
if(png)
|
||||
png_destroy_read_struct(&png, &info, NULL);
|
||||
|
||||
fclose(reader);
|
||||
|
||||
return image;
|
||||
|
||||
}/* pngtoimage() */
|
||||
|
||||
|
||||
static void convert_32s16u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
for (i = 0; i < length; i++) {
|
||||
OPJ_UINT32 val = (OPJ_UINT32)pSrc[i];
|
||||
*pDst++ = (OPJ_BYTE)(val >> 8);
|
||||
*pDst++ = (OPJ_BYTE)val;
|
||||
}
|
||||
}
|
||||
int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
{
|
||||
FILE * volatile writer = NULL;
|
||||
png_structp png = NULL;
|
||||
png_infop info = NULL;
|
||||
png_bytep volatile row_buf = NULL;
|
||||
int nr_comp, color_type;
|
||||
volatile int prec;
|
||||
png_color_8 sig_bit;
|
||||
OPJ_INT32 const* planes[4];
|
||||
int i;
|
||||
OPJ_INT32* volatile buffer32s = NULL;
|
||||
|
||||
volatile int fails = 1;
|
||||
|
||||
memset(&sig_bit, 0, sizeof(sig_bit));
|
||||
prec = (int)image->comps[0].prec;
|
||||
planes[0] = image->comps[0].data;
|
||||
nr_comp = (int)image->numcomps;
|
||||
|
||||
if (nr_comp > 4) {
|
||||
nr_comp = 4;
|
||||
}
|
||||
for (i = 1; i < nr_comp; ++i) {
|
||||
if (image->comps[0].dx != image->comps[i].dx) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].dy != image->comps[i].dy) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].prec != image->comps[i].prec) {
|
||||
break;
|
||||
}
|
||||
if (image->comps[0].sgnd != image->comps[i].sgnd) {
|
||||
break;
|
||||
}
|
||||
planes[i] = image->comps[i].data;
|
||||
}
|
||||
if (i != nr_comp) {
|
||||
fprintf(stderr,"imagetopng: All components shall have the same subsampling, same bit depth, same sign.\n");
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
clip_component(&(image->comps[i]), image->comps[0].prec);
|
||||
}
|
||||
if(prec > 8 && prec < 16)
|
||||
{
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 16);
|
||||
}
|
||||
prec = 16;
|
||||
}
|
||||
else if(prec < 8 && nr_comp > 1)/* GRAY_ALPHA, RGB, RGB_ALPHA */
|
||||
{
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), 8);
|
||||
}
|
||||
prec = 8;
|
||||
} else if((prec > 1) && (prec < 8) && ((prec == 6) || ((prec & 1)==1))) { /* GRAY with non native precision */
|
||||
if ((prec == 5) || (prec == 6)) {
|
||||
prec = 8;
|
||||
} else {
|
||||
prec++;
|
||||
}
|
||||
for (i = 0; i < nr_comp; ++i) {
|
||||
scale_component(&(image->comps[i]), (OPJ_UINT32)prec);
|
||||
}
|
||||
}
|
||||
|
||||
if(prec != 1 && prec != 2 && prec != 4 && prec != 8 && prec != 16)
|
||||
{
|
||||
fprintf(stderr,"imagetopng: can not create %s\n\twrong bit_depth %d\n", write_idf, prec);
|
||||
return fails;
|
||||
}
|
||||
|
||||
writer = fopen(write_idf, "wb");
|
||||
|
||||
if(writer == NULL) return fails;
|
||||
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
* functions. If you want to use the default stderr and longjump method,
|
||||
* you can supply NULL for the last three parameters. We also check that
|
||||
* the library version is compatible with the one used at compile time,
|
||||
* in case we are using dynamically linked libraries. REQUIRED.
|
||||
*/
|
||||
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL);
|
||||
/*png_voidp user_error_ptr, user_error_fn, user_warning_fn); */
|
||||
|
||||
if(png == NULL) goto fin;
|
||||
|
||||
/* Allocate/initialize the image information data. REQUIRED
|
||||
*/
|
||||
info = png_create_info_struct(png);
|
||||
|
||||
if(info == NULL) goto fin;
|
||||
|
||||
/* Set error handling. REQUIRED if you are not supplying your own
|
||||
* error handling functions in the png_create_write_struct() call.
|
||||
*/
|
||||
if(setjmp(png_jmpbuf(png))) goto fin;
|
||||
|
||||
/* I/O initialization functions is REQUIRED
|
||||
*/
|
||||
png_init_io(png, writer);
|
||||
|
||||
/* Set the image information here. Width and height are up to 2^31,
|
||||
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
||||
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
||||
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
||||
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
|
||||
* REQUIRED
|
||||
*
|
||||
* ERRORS:
|
||||
*
|
||||
* color_type == PNG_COLOR_TYPE_PALETTE && bit_depth > 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8
|
||||
*
|
||||
*/
|
||||
png_set_compression_level(png, Z_BEST_COMPRESSION);
|
||||
|
||||
if(nr_comp >= 3) /* RGB(A) */
|
||||
{
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
sig_bit.red = sig_bit.green = sig_bit.blue = (png_byte)prec;
|
||||
}
|
||||
else /* GRAY(A) */
|
||||
{
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
sig_bit.gray = (png_byte)prec;
|
||||
}
|
||||
if((nr_comp & 1) == 0) /* ALPHA */
|
||||
{
|
||||
color_type |= PNG_COLOR_MASK_ALPHA;
|
||||
sig_bit.alpha = (png_byte)prec;
|
||||
}
|
||||
|
||||
png_set_IHDR(png, info, image->comps[0].w, image->comps[0].h, prec, color_type,
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
png_set_sBIT(png, info, &sig_bit);
|
||||
/* png_set_gamma(png, 2.2, 1./2.2); */
|
||||
/* png_set_sRGB(png, info, PNG_sRGB_INTENT_PERCEPTUAL); */
|
||||
png_write_info(png, info);
|
||||
|
||||
/* setup conversion */
|
||||
{
|
||||
OPJ_SIZE_T rowStride;
|
||||
png_size_t png_row_size;
|
||||
|
||||
png_row_size = png_get_rowbytes(png, info);
|
||||
rowStride = ((OPJ_SIZE_T)image->comps[0].w * (OPJ_SIZE_T)nr_comp * (OPJ_SIZE_T)prec + 7U) / 8U;
|
||||
if (rowStride != (OPJ_SIZE_T)png_row_size) {
|
||||
fprintf(stderr, "Invalid PNG row size\n");
|
||||
goto fin;
|
||||
}
|
||||
row_buf = (png_bytep)malloc(png_row_size);
|
||||
if (row_buf == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for PNG row\n");
|
||||
goto fin;
|
||||
}
|
||||
buffer32s = (OPJ_INT32*)malloc((OPJ_SIZE_T)image->comps[0].w * (OPJ_SIZE_T)nr_comp * sizeof(OPJ_INT32));
|
||||
if (buffer32s == NULL) {
|
||||
fprintf(stderr, "Can't allocate memory for interleaved 32s row\n");
|
||||
goto fin;
|
||||
}
|
||||
}
|
||||
|
||||
/* convert */
|
||||
{
|
||||
OPJ_SIZE_T width= image->comps[0].w;
|
||||
OPJ_UINT32 y;
|
||||
convert_32s_PXCX cvtPxToCx = convert_32s_PXCX_LUT[nr_comp];
|
||||
convert_32sXXx_C1R cvt32sToPack = NULL;
|
||||
OPJ_INT32 adjust = image->comps[0].sgnd ? 1 << (prec - 1) : 0;
|
||||
png_bytep row_buf_cpy = row_buf;
|
||||
OPJ_INT32* buffer32s_cpy = buffer32s;
|
||||
|
||||
switch (prec) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8:
|
||||
cvt32sToPack = convert_32sXXu_C1R_LUT[prec];
|
||||
break;
|
||||
case 16:
|
||||
cvt32sToPack = convert_32s16u_C1R;
|
||||
break;
|
||||
default:
|
||||
/* never here */
|
||||
break;
|
||||
}
|
||||
|
||||
for(y = 0; y < image->comps[0].h; ++y)
|
||||
{
|
||||
cvtPxToCx(planes, buffer32s_cpy, width, adjust);
|
||||
cvt32sToPack(buffer32s_cpy, row_buf_cpy, width * (OPJ_SIZE_T)nr_comp);
|
||||
png_write_row(png, row_buf_cpy);
|
||||
planes[0] += width;
|
||||
planes[1] += width;
|
||||
planes[2] += width;
|
||||
planes[3] += width;
|
||||
}
|
||||
}
|
||||
|
||||
png_write_end(png, info);
|
||||
|
||||
fails = 0;
|
||||
|
||||
fin:
|
||||
if(png) {
|
||||
png_destroy_write_struct(&png, &info);
|
||||
}
|
||||
if(row_buf) {
|
||||
free(row_buf);
|
||||
}
|
||||
if(buffer32s) {
|
||||
free(buffer32s);
|
||||
}
|
||||
fclose(writer);
|
||||
|
||||
if(fails) (void)remove(write_idf); /* ignore return value */
|
||||
|
||||
return fails;
|
||||
}/* imagetopng() */
|
1457
src/bin/jp2/converttif.c
Normal file
1457
src/bin/jp2/converttif.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -69,7 +69,7 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cstr_info->tile[0].distotile)
|
||||
if (cstr_info->tile[0].distotile > 0.0)
|
||||
disto_on = 1;
|
||||
else
|
||||
disto_on = 0;
|
||||
|
@ -57,6 +57,9 @@
|
||||
#define strncasecmp _strnicmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/times.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_apps_config.h"
|
||||
@ -66,6 +69,7 @@
|
||||
#include "index.h"
|
||||
|
||||
#include "format_defs.h"
|
||||
#include "opj_string.h"
|
||||
|
||||
typedef struct dircnt{
|
||||
/** Buffer for holding images read from Directory*/
|
||||
@ -232,7 +236,7 @@ static void encode_help_display(void) {
|
||||
fprintf(stdout,"-I\n");
|
||||
fprintf(stdout," Use the irreversible DWT 9-7.\n");
|
||||
fprintf(stdout,"-mct <0|1|2>\n");
|
||||
fprintf(stdout," Explicitely specifies if a Multiple Component Transform has to be used.\n");
|
||||
fprintf(stdout," Explicitly specifies if a Multiple Component Transform has to be used.\n");
|
||||
fprintf(stdout," 0: no MCT ; 1: RGB->YCC conversion ; 2: custom MCT.\n");
|
||||
fprintf(stdout," If custom MCT, \"-m\" option has to be used (see hereunder).\n");
|
||||
fprintf(stdout," By default, RGB->YCC conversion is used if there are 3 components or more,\n");
|
||||
@ -388,6 +392,7 @@ static unsigned int get_num_images(char *imgdirpath){
|
||||
continue;
|
||||
num_images++;
|
||||
}
|
||||
closedir(dir);
|
||||
return num_images;
|
||||
}
|
||||
|
||||
@ -413,6 +418,7 @@ static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
strcpy(dirptr->filename[i],content->d_name);
|
||||
i++;
|
||||
}
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -451,8 +457,10 @@ static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_c
|
||||
if (parameters->decod_format == -1)
|
||||
return 1;
|
||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||
|
||||
if (opj_strcpy_s(parameters->infile, sizeof(parameters->infile), infilename) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*Set output file*/
|
||||
strcpy(temp_ofname,get_file_name(image_filename));
|
||||
while((temp_p = strtok(NULL,".")) != NULL){
|
||||
@ -461,7 +469,9 @@ static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_c
|
||||
}
|
||||
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));
|
||||
if (opj_strcpy_s(parameters->outfile, sizeof(parameters->outfile), outfilename) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -469,7 +479,7 @@ static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_c
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
|
||||
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
|
||||
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename, size_t indexfilename_size) {
|
||||
OPJ_UINT32 i, j;
|
||||
int totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
@ -523,7 +533,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
if (opj_strcpy_s(parameters->infile, sizeof(parameters->infile), infile) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -541,7 +553,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
fprintf(stderr, "Unknown output format image %s [only *.j2k, *.j2c or *.jp2]!! \n", outfile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||
if (opj_strcpy_s(parameters->outfile, sizeof(parameters->outfile), outfile) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -598,7 +612,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
char signo;
|
||||
int width,height,bitdepth,ncomp;
|
||||
OPJ_UINT32 len;
|
||||
OPJ_BOOL raw_signed;
|
||||
OPJ_BOOL raw_signed = OPJ_FALSE;
|
||||
substr2 = strchr(opj_optarg,'@');
|
||||
if (substr2 == NULL) {
|
||||
len = (OPJ_UINT32) strlen(opj_optarg);
|
||||
@ -607,6 +621,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
substr2++; /* skip '@' character */
|
||||
}
|
||||
substr1 = (char*) malloc((len+1)*sizeof(char));
|
||||
if (substr1 == NULL) {
|
||||
return 1;
|
||||
}
|
||||
memcpy(substr1,opj_optarg,len);
|
||||
substr1[len] = '\0';
|
||||
if (sscanf(substr1, "%d,%d,%d,%d,%c", &width, &height, &ncomp, &bitdepth, &signo) == 5) {
|
||||
@ -621,7 +638,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
wrong = OPJ_TRUE;
|
||||
}
|
||||
if (!wrong) {
|
||||
int i;
|
||||
int compno;
|
||||
int lastdx = 1;
|
||||
int lastdy = 1;
|
||||
raw_cp->rawWidth = width;
|
||||
@ -630,10 +647,14 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
raw_cp->rawBitDepth = bitdepth;
|
||||
raw_cp->rawSigned = raw_signed;
|
||||
raw_cp->rawComps = (raw_comp_cparameters_t*) malloc(((OPJ_UINT32)(ncomp))*sizeof(raw_comp_cparameters_t));
|
||||
for (i = 0; i < ncomp && !wrong; i++) {
|
||||
if(raw_cp->rawComps == NULL){
|
||||
free(substr1);
|
||||
return 1;
|
||||
}
|
||||
for (compno = 0; compno < ncomp && !wrong; compno++) {
|
||||
if (substr2 == NULL) {
|
||||
raw_cp->rawComps[i].dx = lastdx;
|
||||
raw_cp->rawComps[i].dy = lastdy;
|
||||
raw_cp->rawComps[compno].dx = lastdx;
|
||||
raw_cp->rawComps[compno].dy = lastdy;
|
||||
} else {
|
||||
int dx,dy;
|
||||
sep = strchr(substr2,':');
|
||||
@ -641,16 +662,16 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
if (sscanf(substr2, "%dx%d", &dx, &dy) == 2) {
|
||||
lastdx = dx;
|
||||
lastdy = dy;
|
||||
raw_cp->rawComps[i].dx = dx;
|
||||
raw_cp->rawComps[i].dy = dy;
|
||||
raw_cp->rawComps[compno].dx = dx;
|
||||
raw_cp->rawComps[compno].dy = dy;
|
||||
substr2 = NULL;
|
||||
} else {
|
||||
wrong = OPJ_TRUE;
|
||||
}
|
||||
} else {
|
||||
if (sscanf(substr2, "%dx%d:%s", &dx, &dy, substr2) == 3) {
|
||||
raw_cp->rawComps[i].dx = dx;
|
||||
raw_cp->rawComps[i].dy = dy;
|
||||
raw_cp->rawComps[compno].dx = dx;
|
||||
raw_cp->rawComps[compno].dy = dy;
|
||||
} else {
|
||||
wrong = OPJ_TRUE;
|
||||
}
|
||||
@ -658,7 +679,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
}
|
||||
}
|
||||
}
|
||||
if (substr1) free(substr1);
|
||||
free(substr1);
|
||||
if (wrong) {
|
||||
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
||||
fprintf(stderr,"Please use the Format option -F:\n");
|
||||
@ -699,7 +720,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
OPJ_UINT32 numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||
|
||||
char *s = opj_optarg;
|
||||
sscanf(s, "%ud", &numlayers);
|
||||
sscanf(s, "%u", &numlayers);
|
||||
s++;
|
||||
if (numlayers > 9)
|
||||
s++;
|
||||
@ -708,6 +729,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
numresolution = (OPJ_UINT32)parameters->numresolution;
|
||||
matrix_width = numresolution * 3;
|
||||
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
|
||||
if(parameters->cp_matrice == NULL){
|
||||
return 1;
|
||||
}
|
||||
s = s + 2;
|
||||
|
||||
for (i = 0; i < numlayers; i++) {
|
||||
@ -804,8 +828,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
case 'x': /* creation of index file */
|
||||
{
|
||||
char *index = opj_optarg;
|
||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||
if (opj_strcpy_s(indexfilename, indexfilename_size, opj_optarg) != 0) {
|
||||
return 1;
|
||||
}
|
||||
/* FIXME ADE INDEX >> */
|
||||
fprintf(stderr,
|
||||
"[WARNING] Index file generation is currently broken.\n"
|
||||
@ -871,7 +896,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
char *s = opj_optarg;
|
||||
POC = parameters->POC;
|
||||
|
||||
while (sscanf(s, "T%ud=%ud,%ud,%ud,%ud,%ud,%4s", &POC[numpocs].tile,
|
||||
while (sscanf(s, "T%u=%u,%u,%u,%u,%u,%4s", &POC[numpocs].tile,
|
||||
&POC[numpocs].resno0, &POC[numpocs].compno0,
|
||||
&POC[numpocs].layno1, &POC[numpocs].resno1,
|
||||
&POC[numpocs].compno1, POC[numpocs].progorder) == 7) {
|
||||
@ -977,6 +1002,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
case 'z': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(img_fol->imgdirpath == NULL){
|
||||
return 1;
|
||||
}
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
@ -1001,7 +1029,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
return 1;
|
||||
}
|
||||
fprintf(stdout,"CINEMA 2K profile activated\n"
|
||||
"Other options specified could be overriden\n");
|
||||
"Other options specified could be overridden\n");
|
||||
|
||||
}
|
||||
break;
|
||||
@ -1012,7 +1040,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
{
|
||||
parameters->rsiz = OPJ_PROFILE_CINEMA_4K;
|
||||
fprintf(stdout,"CINEMA 4K profile activated\n"
|
||||
"Other options specified could be overriden\n");
|
||||
"Other options specified could be overridden\n");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1055,9 +1083,16 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
lStrLen = (size_t)ftell(lFile);
|
||||
fseek(lFile,0,SEEK_SET);
|
||||
lMatrix = (char *) malloc(lStrLen + 1);
|
||||
if (lMatrix == NULL) {
|
||||
fclose(lFile);
|
||||
return 1;
|
||||
}
|
||||
lStrFread = fread(lMatrix, 1, lStrLen, lFile);
|
||||
fclose(lFile);
|
||||
if( lStrLen != lStrFread ) return 1;
|
||||
if( lStrLen != lStrFread ) {
|
||||
free(lMatrix);
|
||||
return 1;
|
||||
}
|
||||
|
||||
lMatrix[lStrLen] = 0;
|
||||
lCurrentPtr = lMatrix;
|
||||
@ -1077,6 +1112,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
lMctComp = lNbComp * lNbComp;
|
||||
lTotalComp = lMctComp + lNbComp;
|
||||
lSpace = (float *) malloc((size_t)lTotalComp * sizeof(float));
|
||||
if(lSpace == NULL) {
|
||||
free(lMatrix);
|
||||
return 1;
|
||||
}
|
||||
lCurrentDoublePtr = lSpace;
|
||||
for (i2=0;i2<lMctComp;++i2) {
|
||||
lStrLen = strlen(lCurrentPtr) + 1;
|
||||
@ -1114,7 +1153,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
/* we need to enable indexing */
|
||||
if (!indexfilename || !*indexfilename) {
|
||||
strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
||||
if (opj_strcpy_s(indexfilename, indexfilename_size, JPWL_PRIVATEINDEX_NAME) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* search for different protection methods */
|
||||
@ -1456,7 +1497,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
}else{
|
||||
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||
fprintf(stderr, "[ERROR] Required parameters are missing\n"
|
||||
"Example: %s -i image.j2k -o image.pgm\n",argv[0]);
|
||||
"Example: %s -i image.pgm -o image.j2k\n",argv[0]);
|
||||
fprintf(stderr, " Help: %s -h\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
@ -1500,7 +1541,16 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
}
|
||||
}
|
||||
|
||||
/* If subsampled image is provided, automatically disable MCT */
|
||||
if ( ((parameters->decod_format == RAW_DFMT) || (parameters->decod_format == RAWL_DFMT))
|
||||
&& ( ((raw_cp->rawComp > 1 ) && ((raw_cp->rawComps[1].dx > 1) || (raw_cp->rawComps[1].dy > 1)))
|
||||
|| ((raw_cp->rawComp > 2 ) && ((raw_cp->rawComps[2].dx > 1) || (raw_cp->rawComps[2].dy > 1)))
|
||||
)) {
|
||||
parameters->tcp_mct = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -1527,6 +1577,31 @@ static void info_callback(const char *msg, void *client_data) {
|
||||
fprintf(stdout, "[INFO] %s", msg);
|
||||
}
|
||||
|
||||
OPJ_FLOAT64 opj_clock(void) {
|
||||
#ifdef _WIN32
|
||||
/* _WIN32: use QueryPerformance (very accurate) */
|
||||
LARGE_INTEGER freq , t ;
|
||||
/* freq is the clock speed of the CPU */
|
||||
QueryPerformanceFrequency(&freq) ;
|
||||
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
||||
/* t is the high resolution performance counter (see MSDN) */
|
||||
QueryPerformanceCounter ( & t ) ;
|
||||
return freq.QuadPart ? ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) : 0 ;
|
||||
#else
|
||||
/* Unix or Linux: use resource usage */
|
||||
struct rusage t;
|
||||
OPJ_FLOAT64 procTime;
|
||||
/* (1) Get the rusage data structure at this moment (man getrusage) */
|
||||
getrusage(0,&t);
|
||||
/* (2) What is the elapsed time ? - CPU time = User time + System time */
|
||||
/* (2a) Get the seconds */
|
||||
procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec);
|
||||
/* (2b) More precisely! Get the microseconds part ! */
|
||||
return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/**
|
||||
* OPJ_COMPRESS MAIN
|
||||
@ -1540,6 +1615,7 @@ int main(int argc, char **argv) {
|
||||
opj_codec_t* l_codec = 00;
|
||||
opj_image_t *image = NULL;
|
||||
raw_cparameters_t raw_cp;
|
||||
OPJ_SIZE_T num_compressed_files = 0;
|
||||
|
||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||
|
||||
@ -1550,6 +1626,7 @@ int main(int argc, char **argv) {
|
||||
OPJ_BOOL bSuccess;
|
||||
OPJ_BOOL bUseTiles = OPJ_FALSE; /* OPJ_TRUE */
|
||||
OPJ_UINT32 l_nb_tiles = 4;
|
||||
OPJ_FLOAT64 t = opj_clock();
|
||||
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
@ -1568,24 +1645,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
parameters.tcp_mct = (char) 255; /* This will be set later according to the input image or the provided option */
|
||||
if(parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, &raw_cp, indexfilename) == 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Create comment for codestream */
|
||||
if(parameters.cp_comment == NULL) {
|
||||
const char comment[] = "Created by OpenJPEG version ";
|
||||
const size_t clen = strlen(comment);
|
||||
const char *version = opj_version();
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+11);
|
||||
sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version);
|
||||
#else
|
||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+1);
|
||||
sprintf(parameters.cp_comment,"%s%s", comment, version);
|
||||
#endif
|
||||
/* <<UniPG */
|
||||
if(parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, &raw_cp, indexfilename, sizeof(indexfilename)) == 1) {
|
||||
goto fails;
|
||||
}
|
||||
|
||||
/* Read directory if necessary */
|
||||
@ -1776,7 +1837,12 @@ int main(int argc, char **argv) {
|
||||
parameters.cp_tdx = 512;
|
||||
parameters.cp_tdy = 512;
|
||||
}
|
||||
opj_setup_encoder(l_codec, ¶meters, image);
|
||||
if (! opj_setup_encoder(l_codec, ¶meters, image)) {
|
||||
fprintf(stderr, "failed to encode image: opj_setup_encoder\n");
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* open a byte stream for writing and allocate memory for all tiles */
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.outfile,OPJ_FALSE);
|
||||
@ -1792,9 +1858,10 @@ int main(int argc, char **argv) {
|
||||
if( bSuccess && bUseTiles ) {
|
||||
OPJ_BYTE *l_data;
|
||||
OPJ_UINT32 l_data_size = 512*512*3;
|
||||
l_data = (OPJ_BYTE*) malloc( l_data_size * sizeof(OPJ_BYTE));
|
||||
memset(l_data, 0, l_data_size );
|
||||
assert( l_data );
|
||||
l_data = (OPJ_BYTE*) calloc( 1,l_data_size);
|
||||
if(l_data == NULL){
|
||||
goto fails;
|
||||
}
|
||||
for (i=0;i<l_nb_tiles;++i) {
|
||||
if (! opj_write_tile(l_codec,i,l_data,l_data_size,l_stream)) {
|
||||
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %d!\n",i);
|
||||
@ -1826,6 +1893,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
num_compressed_files++;
|
||||
fprintf(stdout,"[INFO] Generated outfile %s\n",parameters.outfile);
|
||||
/* close and free the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
@ -1842,6 +1910,23 @@ int main(int argc, char **argv) {
|
||||
if(parameters.cp_comment) free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
||||
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
||||
|
||||
t = opj_clock() - t;
|
||||
if (num_compressed_files) {
|
||||
fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000.0)/(OPJ_FLOAT64)num_compressed_files));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fails:
|
||||
if(parameters.cp_comment) free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
||||
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
||||
if(img_fol.imgdirpath) free(img_fol.imgdirpath);
|
||||
if(dirptr){
|
||||
if(dirptr->filename_buf) free(dirptr->filename_buf);
|
||||
if(dirptr->filename) free(dirptr->filename);
|
||||
free(dirptr);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,7 @@
|
||||
#include "index.h"
|
||||
|
||||
#include "format_defs.h"
|
||||
#include "opj_string.h"
|
||||
|
||||
typedef struct dircnt{
|
||||
/** Buffer for holding images read from Directory*/
|
||||
@ -134,6 +135,7 @@ static int get_num_images(char *imgdirpath){
|
||||
continue;
|
||||
num_images++;
|
||||
}
|
||||
closedir(dir);
|
||||
return num_images;
|
||||
}
|
||||
|
||||
@ -160,6 +162,7 @@ static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
strcpy(dirptr->filename[i],content->d_name);
|
||||
i++;
|
||||
}
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -168,7 +171,7 @@ static int get_file_format(const char *filename) {
|
||||
unsigned int i;
|
||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
|
||||
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
|
||||
char * ext = strrchr(filename, '.');
|
||||
const char *ext = strrchr(filename, '.');
|
||||
if (ext == NULL)
|
||||
return -1;
|
||||
ext++;
|
||||
@ -194,7 +197,9 @@ static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_d
|
||||
if (parameters->decod_format == -1)
|
||||
return 1;
|
||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||
if (opj_strcpy_s(parameters->infile, sizeof(parameters->infile), infilename) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*Set output file*/
|
||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||
@ -204,7 +209,9 @@ static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_d
|
||||
}
|
||||
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));
|
||||
if (opj_strcpy_s(parameters->outfile, sizeof(parameters->outfile), outfilename) != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -301,7 +308,10 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
if (opj_strcpy_s(parameters->infile, sizeof(parameters->infile), infile) != 0) {
|
||||
fprintf(stderr, "[ERROR] Path is too long\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -309,8 +319,10 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = opj_optarg;
|
||||
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||
if (opj_strcpy_s(parameters->outfile, sizeof(parameters->outfile), opj_optarg) != 0) {
|
||||
fprintf(stderr, "[ERROR] Path is too long\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -329,6 +341,9 @@ static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *param
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(img_fol->imgdirpath == NULL){
|
||||
return 1;
|
||||
}
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
@ -421,12 +436,6 @@ int main(int argc, char *argv[])
|
||||
img_fol_t img_fol;
|
||||
dircnt_t *dirptr = NULL;
|
||||
|
||||
#ifdef MSD
|
||||
OPJ_BOOL l_go_on = OPJ_TRUE;
|
||||
OPJ_UINT32 l_max_data_size = 1000;
|
||||
OPJ_BYTE * l_data = (OPJ_BYTE *) malloc(1000);
|
||||
#endif
|
||||
|
||||
/* Set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
@ -436,6 +445,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||
if(img_fol.imgdirpath) free(img_fol.imgdirpath);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@ -445,25 +456,31 @@ int main(int argc, char *argv[])
|
||||
num_images=get_num_images(img_fol.imgdirpath);
|
||||
|
||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||
if(dirptr){
|
||||
dirptr->filename_buf = (char*)malloc((size_t)num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
dirptr->filename = (char**) malloc((size_t)num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
for(it_image=0;it_image<num_images;it_image++){
|
||||
dirptr->filename[it_image] = dirptr->filename_buf + it_image*OPJ_PATH_LEN;
|
||||
}
|
||||
}
|
||||
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||
if(!dirptr){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
dirptr->filename_buf = (char*)malloc((size_t)num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
if(!dirptr->filename_buf){
|
||||
free(dirptr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
dirptr->filename = (char**) malloc((size_t)num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename){
|
||||
goto fails;
|
||||
}
|
||||
|
||||
for(it_image=0;it_image<num_images;it_image++){
|
||||
dirptr->filename[it_image] = dirptr->filename_buf + it_image*OPJ_PATH_LEN;
|
||||
}
|
||||
|
||||
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||
goto fails;
|
||||
}
|
||||
|
||||
if (num_images==0){
|
||||
fprintf(stdout,"Folder is empty\n");
|
||||
return EXIT_FAILURE;
|
||||
goto fails;
|
||||
}
|
||||
}else{
|
||||
num_images=1;
|
||||
@ -474,7 +491,7 @@ int main(int argc, char *argv[])
|
||||
fout = fopen(parameters.outfile,"w");
|
||||
if (!fout){
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", parameters.outfile);
|
||||
return EXIT_FAILURE;
|
||||
goto fails;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -498,7 +515,7 @@ int main(int argc, char *argv[])
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.infile,1);
|
||||
if (!l_stream){
|
||||
fprintf(stderr, "ERROR -> failed to create the stream from the file %s\n",parameters.infile);
|
||||
return EXIT_FAILURE;
|
||||
goto fails;
|
||||
}
|
||||
|
||||
/* Read the JPEG2000 stream */
|
||||
@ -540,7 +557,7 @@ int main(int argc, char *argv[])
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
fclose(fout);
|
||||
return EXIT_FAILURE;
|
||||
goto fails;
|
||||
}
|
||||
|
||||
/* Read the main header of the codestream and if necessary the JP2 boxes*/
|
||||
@ -550,7 +567,7 @@ int main(int argc, char *argv[])
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
fclose(fout);
|
||||
return EXIT_FAILURE;
|
||||
goto fails;
|
||||
}
|
||||
|
||||
opj_dump_codec(l_codec, img_fol.flag, fout );
|
||||
@ -582,4 +599,12 @@ int main(int argc, char *argv[])
|
||||
fclose(fout);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
fails:
|
||||
if(dirptr){
|
||||
if(dirptr->filename) free(dirptr->filename);
|
||||
if(dirptr->filename_buf) free(dirptr->filename_buf);
|
||||
free(dirptr);
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@
|
||||
* Substitute for real dirent structure. Note that `d_name' field is a
|
||||
* true character array although we have it copied in the implementation
|
||||
* dependent data. We could save some memory if we had declared `d_name'
|
||||
* as a pointer refering the name within implementation dependent data.
|
||||
* as a pointer referring the name within implementation dependent data.
|
||||
* We have not done that since some code may rely on sizeof(d_name) to be
|
||||
* something other than four. Besides, directory entries are typically so
|
||||
* small that it takes virtually no time to copy them from place to place.
|
||||
@ -411,7 +411,7 @@ static DIR *opendir(const char *dirname)
|
||||
* capacity of d_name with different macros and some systems do not define
|
||||
* capacity at all (besides actual declaration of the field). If you really
|
||||
* need to find out storage capacity of d_name then you might want to try
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard although
|
||||
* there are many MS-DOS and MS-Windows implementations those do not define
|
||||
* it. There are also systems that declare d_name as "char d_name[1]" and
|
||||
* then allocate suitable amount of memory at run-time. Thanks to Alain
|
||||
@ -466,7 +466,7 @@ readdir (DIR *dirp)
|
||||
/* fill in entry and return that */
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* Last file has been processed or an error occured */
|
||||
/* Last file has been processed or an error occurred */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Build the demo app, small examples
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
set(common_SRCS
|
||||
convert.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||
)
|
||||
@ -26,15 +26,15 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# Loop over all executables:
|
||||
FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
|
||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||
TARGET_LINK_LIBRARIES(${exe} openjp3d)
|
||||
foreach(exe opj_jp3d_compress opj_jp3d_decompress)
|
||||
add_executable(${exe} ${exe}.c ${common_SRCS})
|
||||
target_link_libraries(${exe} openjp3d)
|
||||
# On unix you need to link to the math library:
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${exe} m)
|
||||
ENDIF(UNIX)
|
||||
if(UNIX)
|
||||
target_link_libraries(${exe} m)
|
||||
endif(UNIX)
|
||||
# Install exe
|
||||
INSTALL(TARGETS ${exe}
|
||||
install(TARGETS ${exe}
|
||||
EXPORT OpenJP3DTargets
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
|
@ -242,7 +242,7 @@
|
||||
* Substitute for real dirent structure. Note that `d_name' field is a
|
||||
* true character array although we have it copied in the implementation
|
||||
* dependent data. We could save some memory if we had declared `d_name'
|
||||
* as a pointer refering the name within implementation dependent data.
|
||||
* as a pointer referring the name within implementation dependent data.
|
||||
* We have not done that since some code may rely on sizeof(d_name) to be
|
||||
* something other than four. Besides, directory entries are typically so
|
||||
* small that it takes virtually no time to copy them from place to place.
|
||||
@ -410,7 +410,7 @@ static DIR *opendir(const char *dirname)
|
||||
* capacity of d_name with different macros and some systems do not define
|
||||
* capacity at all (besides actual declaration of the field). If you really
|
||||
* need to find out storage capacity of d_name then you might want to try
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard although
|
||||
* there are many MS-DOS and MS-Windows implementations those do not define
|
||||
* it. There are also systems that declare d_name as "char d_name[1]" and
|
||||
* then allocate suitable amount of memory at run-time. Thanks to Alain
|
||||
@ -465,7 +465,7 @@ readdir (DIR *dirp)
|
||||
/* fill in entry and return that */
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* Last file has been processed or an error occured */
|
||||
/* Last file has been processed or an error occurred */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
||||
|
@ -60,7 +60,7 @@ endforeach()
|
||||
find_package(Java 1.5 COMPONENTS Development) # javac, jar
|
||||
|
||||
# User can override this:
|
||||
if(NOT DEFINED JAVA_SOURCE_VERSION)
|
||||
if(NOT DEFINED JAVA_SOURCE_VERSION)
|
||||
set(JAVA_SOURCE_VERSION 1.5)
|
||||
endif()
|
||||
if(NOT DEFINED JAVA_TARGET_VERSION)
|
||||
|
@ -187,10 +187,9 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
|
||||
#ifdef OPJ_BIG_ENDIAN
|
||||
|
||||
static inline int16_t swap16(int16_t x)
|
||||
static inline uint16_t swap16(uint16_t x)
|
||||
{
|
||||
return((((u_int16_t)x & 0x00ffU) << 8) |
|
||||
(((u_int16_t)x & 0xff00U) >> 8));
|
||||
return(((x & 0x00ffU) << 8) | ((x & 0xff00U) >> 8));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1436,7 +1435,7 @@ int imagetopgx(opj_image_t * image, const char *outfile) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for writing\n", name);
|
||||
return 1;
|
||||
}
|
||||
/* dont need name anymore */
|
||||
/* don't need name anymore */
|
||||
if( total > 256 ) {
|
||||
free(name);
|
||||
}
|
||||
@ -2858,6 +2857,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
||||
for (i = 0; i < w * h; i++) {
|
||||
if (!fread(&value, 1, 1, f)) {
|
||||
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
image->comps[compno].data[i] = raw_cp->rawSigned?(char)value:value;
|
||||
@ -2872,11 +2872,13 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
||||
unsigned char temp;
|
||||
if (!fread(&temp, 1, 1, f)) {
|
||||
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
value = temp << 8;
|
||||
if (!fread(&temp, 1, 1, f)) {
|
||||
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
value += temp;
|
||||
@ -2886,6 +2888,7 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"OpenJPEG cannot encode raw components with bit depth higher than 16 bits.\n");
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ static void encode_help_display(void) {
|
||||
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
||||
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"-TP : devide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
|
||||
fprintf(stdout,"-TP : divide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
||||
fprintf(stdout,"\n");
|
||||
|
@ -243,7 +243,7 @@
|
||||
* Substitute for real dirent structure. Note that `d_name' field is a
|
||||
* true character array although we have it copied in the implementation
|
||||
* dependent data. We could save some memory if we had declared `d_name'
|
||||
* as a pointer refering the name within implementation dependent data.
|
||||
* as a pointer referring the name within implementation dependent data.
|
||||
* We have not done that since some code may rely on sizeof(d_name) to be
|
||||
* something other than four. Besides, directory entries are typically so
|
||||
* small that it takes virtually no time to copy them from place to place.
|
||||
@ -411,7 +411,7 @@ static DIR *opendir(const char *dirname)
|
||||
* capacity of d_name with different macros and some systems do not define
|
||||
* capacity at all (besides actual declaration of the field). If you really
|
||||
* need to find out storage capacity of d_name then you might want to try
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
|
||||
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard although
|
||||
* there are many MS-DOS and MS-Windows implementations those do not define
|
||||
* it. There are also systems that declare d_name as "char d_name[1]" and
|
||||
* then allocate suitable amount of memory at run-time. Thanks to Alain
|
||||
@ -466,7 +466,7 @@ readdir (DIR *dirp)
|
||||
/* fill in entry and return that */
|
||||
#if defined(DIRENT_WIN32_INTERFACE)
|
||||
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* Last file has been processed or an error occured */
|
||||
/* Last file has been processed or an error occurred */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
errno = ENOENT;
|
||||
|
@ -37,11 +37,11 @@ foreach(exe
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_MJ2
|
||||
)
|
||||
target_link_libraries(${exe} ${LCMS_LIBNAME} openmj2)
|
||||
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(${exe} m)
|
||||
endif()
|
||||
|
||||
|
||||
install(TARGETS ${exe}
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR})
|
||||
endforeach()
|
||||
|
@ -375,7 +375,7 @@ void xml_write_free_and_skip(FILE* xmlout, opj_mj2_t * movie) {
|
||||
}
|
||||
|
||||
void xml_write_uuid(FILE* xmlout, opj_mj2_t * movie) {
|
||||
/* Univeral Unique IDs of 16 bytes. */
|
||||
/* Universal Unique IDs of 16 bytes. */
|
||||
#ifdef NOTYET
|
||||
/* NO-OP so far. There can be zero or more instances of private uuid boxes in a file.
|
||||
This function supports the top level of the file, but uuid may be elsewhere [not yet supported].
|
||||
@ -962,7 +962,7 @@ int xml_out_frame(FILE* file, FILE* xmlout, mj2_sample_t *sample, unsigned int s
|
||||
fprintf(xmlout, " <JP2_Frame Num=\"%d\">\n", snum+1);
|
||||
fprintf(xmlout, " <MainHeader>\n");
|
||||
/* There can be multiple codestreams; a particular image is entirely within a single codestream */
|
||||
/* TO DO: A frame can be represented by two I-guess-contigious codestreams if its interleaved. */
|
||||
/* TO DO: A frame can be represented by two I-guess-contiguous codestreams if its interleaved. */
|
||||
fprintf(xmlout, " <StartOfCodestream Marker=\"SOC\" />\n");
|
||||
/* "cp" stands for "coding parameter"; "tcp" is tile coding parameters, "tccp" is tile-component coding parameters */
|
||||
xml_out_frame_siz(xmlout, img, cp); /* reqd in main */
|
||||
|
@ -64,7 +64,7 @@ void help_display()
|
||||
fprintf(stdout,"----------\n");
|
||||
fprintf(stdout,"The metadata includes the jp2 image and tile headers of the first frame.\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"Metadata values are shown in 'raw' form (e.g., hexidecimal) as stored in the\n");
|
||||
fprintf(stdout,"Metadata values are shown in 'raw' form (e.g., hexadecimal) as stored in the\n");
|
||||
fprintf(stdout,"file, and, if apt, in a 'derived' form that is more quickly grasped.\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"Notes explaining the XML are embedded as terse comments. These include\n");
|
||||
|
@ -356,7 +356,7 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
|
||||
movie->tk[0].jp2_struct.enumcs = 18; /* YUV */
|
||||
|
||||
else
|
||||
movie->tk[0].jp2_struct.enumcs = 0; /* Unkown profile */
|
||||
movie->tk[0].jp2_struct.enumcs = 0; /* Unknown profile */
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
@ -889,7 +889,7 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
|
||||
|
||||
m_peektextCtrl->WriteText(text);
|
||||
|
||||
delete buffer;
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
|
@ -8,4 +8,4 @@ Anybody. As the OpenJPEG library is released under the BSD license, anybody can
|
||||
|
||||
Who is developing the library ?
|
||||
===============================
|
||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developed and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
||||
|
@ -5,42 +5,82 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h
|
||||
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers)
|
||||
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
|
||||
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
|
||||
)
|
||||
# Defines the source code for the library
|
||||
set(OPENJPEG_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bio.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cio.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dwt.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/event.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/event.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/invert.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/invert.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/j2k.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jp2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mct.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mct.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mqc.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mqc_inl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pi.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pi.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/raw.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/raw.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t1.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t1.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tcd.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tgt.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/function_list.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_codec.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_includes.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_intmath.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_stdint.h
|
||||
)
|
||||
if(BUILD_JPIP)
|
||||
add_definitions(-DUSE_JPIP)
|
||||
set(OPENJPEG_SRCS
|
||||
${OPENJPEG_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indexbox_manager.h
|
||||
)
|
||||
endif()
|
||||
|
||||
option(OPJ_DISABLE_TPSOT_FIX "Disable TPsot==TNsot fix. See https://github.com/uclouvain/openjpeg/issues/254." OFF)
|
||||
if(OPJ_DISABLE_TPSOT_FIX)
|
||||
add_definitions(-DOPJ_DISABLE_TPSOT_FIX)
|
||||
endif()
|
||||
|
||||
# Special case for old i586-mingw32msvc-gcc cross compiler
|
||||
if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER MATCHES ".*mingw32msvc.*" )
|
||||
set(WIN32 YES)
|
||||
endif()
|
||||
|
||||
# Build the library
|
||||
if(WIN32)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
@ -54,6 +94,9 @@ if(UNIX)
|
||||
target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
|
||||
endif()
|
||||
set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
|
||||
target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
endif()
|
||||
|
||||
# Install library
|
||||
install(TARGETS ${OPENJPEG_LIBRARY_NAME}
|
||||
@ -75,16 +118,18 @@ install(
|
||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
|
||||
endif()
|
||||
|
||||
# internal utilities to generate t1_luts.h (part of the jp2 lib)
|
||||
if(BUILD_LUTS_GENERATOR)
|
||||
# internal utility to generate t1_luts.h (part of the jp2 lib)
|
||||
# no need to install:
|
||||
add_executable(t1_generate_luts t1_generate_luts.c)
|
||||
if(UNIX)
|
||||
target_link_libraries(t1_generate_luts m)
|
||||
add_executable(t1_generate_luts t1_generate_luts.c)
|
||||
if(UNIX)
|
||||
target_link_libraries(t1_generate_luts m)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Experimental option; let's how cppcheck performs
|
||||
# Implementation details:
|
||||
# I could not figure out how to easily upload a file to CDash. Instead simply
|
||||
# I could not figure out how to easily upload a file to CDash. Instead simply
|
||||
# pretend cppcheck is part of the Build step. Technically cppcheck can even
|
||||
# output gcc formatted error/warning report
|
||||
# Another implementation detail: I could not redirect error to the error
|
||||
@ -98,3 +143,45 @@ if(OPENJPEG_CPPCHECK)
|
||||
COMMAND ${CPPCHECK_EXECUTABLE} -DWIN32 ${f})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(OPJ_USE_DSYMUTIL)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} POST_BUILD
|
||||
COMMAND "dsymutil" "$<TARGET_SONAME_FILE:${OPENJPEG_LIBRARY_NAME}>"
|
||||
COMMENT "dsymutil $<TARGET_SONAME_FILE:${OPENJPEG_LIBRARY_NAME}>"
|
||||
DEPENDS ${OPENJPEG_LIBRARY_NAME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#################################################################################
|
||||
# threading configuration
|
||||
#################################################################################
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
|
||||
option(OPJ_USE_THREAD "Build with thread/mutex support " ON)
|
||||
if(NOT OPJ_USE_THREAD)
|
||||
add_definitions( -DMUTEX_stub)
|
||||
endif(NOT OPJ_USE_THREAD)
|
||||
|
||||
find_package(Threads QUIET)
|
||||
|
||||
if(OPJ_USE_THREAD AND WIN32 AND NOT Threads_FOUND )
|
||||
add_definitions( -DMUTEX_win32)
|
||||
set(Threads_FOUND YES)
|
||||
endif()
|
||||
|
||||
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT )
|
||||
add_definitions( -DMUTEX_win32)
|
||||
endif(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT )
|
||||
|
||||
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT )
|
||||
add_definitions( -DMUTEX_pthread)
|
||||
endif(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT )
|
||||
|
||||
if(OPJ_USE_THREAD AND NOT Threads_FOUND)
|
||||
message(FATAL_ERROR "No thread library found and thread/mutex support is required by OPJ_USE_THREAD option")
|
||||
endif(OPJ_USE_THREAD AND NOT Threads_FOUND)
|
||||
|
||||
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
|
||||
TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
|
||||
|
@ -78,27 +78,27 @@ static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio);
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
|
||||
static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
*bio->bp++ = (OPJ_BYTE)(bio->buf >> 8);
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
|
||||
static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if (bio->bp >= bio->end) {
|
||||
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
bio->buf |= *bio->bp++;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
|
||||
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
|
||||
if (bio->ct == 0) {
|
||||
opj_bio_byteout(bio); /* MSD: why not check the return value of this function ? */
|
||||
}
|
||||
@ -106,7 +106,7 @@ void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
|
||||
bio->buf |= b << bio->ct;
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
|
||||
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
|
||||
if (bio->ct == 0) {
|
||||
opj_bio_bytein(bio); /* MSD: why not check the return value of this function ? */
|
||||
}
|
||||
@ -151,30 +151,40 @@ void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len) {
|
||||
bio->ct = 0;
|
||||
}
|
||||
|
||||
OPJ_NOSANITIZE("unsigned-integer-overflow")
|
||||
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n) {
|
||||
OPJ_UINT32 i;
|
||||
for (i = n - 1; i < n; i--) {
|
||||
|
||||
assert((n > 0U) && (n <= 32U));
|
||||
for (i = n - 1; i < n; i--) { /* overflow used for end-loop condition */
|
||||
opj_bio_putbit(bio, (v >> i) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_NOSANITIZE("unsigned-integer-overflow")
|
||||
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n) {
|
||||
OPJ_UINT32 i;
|
||||
OPJ_UINT32 v;
|
||||
v = 0;
|
||||
for (i = n - 1; i < n; i--) {
|
||||
v += opj_bio_getbit(bio) << i;
|
||||
OPJ_UINT32 v;
|
||||
|
||||
assert((n > 0U) /* && (n <= 32U)*/);
|
||||
#ifdef OPJ_UBSAN_BUILD
|
||||
/* This assert fails for some corrupted images which are gracefully rejected */
|
||||
/* Add this assert only for ubsan build. */
|
||||
/* This is the condition for overflow not to occur below which is needed because of OPJ_NOSANITIZE */
|
||||
assert(n <= 32U);
|
||||
#endif
|
||||
v = 0U;
|
||||
for (i = n - 1; i < n; i--) { /* overflow used for end-loop condition */
|
||||
v |= opj_bio_getbit(bio) << i; /* can't overflow, opj_bio_getbit returns 0 or 1 */
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_bio_flush(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if (! opj_bio_byteout(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (bio->ct == 7) {
|
||||
bio->ct = 0;
|
||||
if (! opj_bio_byteout(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
@ -183,12 +193,11 @@ OPJ_BOOL opj_bio_flush(opj_bio_t *bio) {
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_bio_inalign(opj_bio_t *bio) {
|
||||
bio->ct = 0;
|
||||
if ((bio->buf & 0xff) == 0xff) {
|
||||
if (! opj_bio_bytein(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
bio->ct = 0;
|
||||
}
|
||||
bio->ct = 0;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
@ -60,7 +60,9 @@ int opj_write_cidx( int offset, opj_stream_private_t *cio, opj_codestream_info_t
|
||||
|
||||
lenp = -1;
|
||||
box = (opj_jp2_box_t *)opj_calloc( 32, sizeof(opj_jp2_box_t));
|
||||
|
||||
if(box == NULL){
|
||||
return 0;
|
||||
}
|
||||
for (i=0;i<2;i++){
|
||||
|
||||
if(i)
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
|
||||
{
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes;
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value)+sizeof(OPJ_UINT32)-p_nb_bytes;
|
||||
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
@ -72,7 +72,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
*p_value = 0;
|
||||
memcpy(l_data_ptr+4-p_nb_bytes,p_buffer,p_nb_bytes);
|
||||
memcpy(l_data_ptr+sizeof(OPJ_UINT32)-p_nb_bytes,p_buffer,p_nb_bytes);
|
||||
}
|
||||
|
||||
void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
|
||||
@ -151,12 +151,11 @@ void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value)
|
||||
opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size,OPJ_BOOL l_is_input)
|
||||
{
|
||||
opj_stream_private_t * l_stream = 00;
|
||||
l_stream = (opj_stream_private_t*) opj_malloc(sizeof(opj_stream_private_t));
|
||||
l_stream = (opj_stream_private_t*) opj_calloc(1,sizeof(opj_stream_private_t));
|
||||
if (! l_stream) {
|
||||
return 00;
|
||||
}
|
||||
|
||||
memset(l_stream,0,sizeof(opj_stream_private_t));
|
||||
l_stream->m_buffer_size = p_buffer_size;
|
||||
l_stream->m_stored_data = (OPJ_BYTE *) opj_malloc(p_buffer_size);
|
||||
if (! l_stream->m_stored_data) {
|
||||
@ -167,12 +166,12 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size,OPJ_BOOL l
|
||||
l_stream->m_current_data = l_stream->m_stored_data;
|
||||
|
||||
if (l_is_input) {
|
||||
l_stream->m_status |= opj_stream_e_input;
|
||||
l_stream->m_status |= OPJ_STREAM_STATUS_INPUT;
|
||||
l_stream->m_opj_skip = opj_stream_read_skip;
|
||||
l_stream->m_opj_seek = opj_stream_read_seek;
|
||||
}
|
||||
else {
|
||||
l_stream->m_status |= opj_stream_e_output;
|
||||
l_stream->m_status |= OPJ_STREAM_STATUS_OUTPUT;
|
||||
l_stream->m_opj_skip = opj_stream_write_skip;
|
||||
l_stream->m_opj_seek = opj_stream_write_seek;
|
||||
}
|
||||
@ -208,7 +207,7 @@ void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_strea
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if ((!l_stream) || (! (l_stream->m_status & opj_stream_e_input))) {
|
||||
if ((!l_stream) || (! (l_stream->m_status & OPJ_STREAM_STATUS_INPUT))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -229,7 +228,7 @@ void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stre
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if ((!l_stream )|| (! (l_stream->m_status & opj_stream_e_output))) {
|
||||
if ((!l_stream )|| (! (l_stream->m_status & OPJ_STREAM_STATUS_OUTPUT))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -277,7 +276,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
|
||||
}
|
||||
|
||||
/* we are now in the case when the remaining data if not sufficient */
|
||||
if (p_stream->m_status & opj_stream_e_end) {
|
||||
if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
|
||||
l_read_nb_bytes += p_stream->m_bytes_in_buffer;
|
||||
memcpy(p_buffer,p_stream->m_current_data,p_stream->m_bytes_in_buffer);
|
||||
p_stream->m_current_data += p_stream->m_bytes_in_buffer;
|
||||
@ -303,7 +302,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
}
|
||||
|
||||
while(1){
|
||||
for (;;) {
|
||||
/* we should read less than a chunk -> read a chunk */
|
||||
if (p_size < p_stream->m_buffer_size) {
|
||||
/* we should do an actual read on the media */
|
||||
@ -314,7 +313,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
|
||||
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
p_stream->m_status |= opj_stream_e_end;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_END;
|
||||
/* end of stream */
|
||||
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T)-1;
|
||||
}
|
||||
@ -346,7 +345,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
|
||||
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
p_stream->m_status |= opj_stream_e_end;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_END;
|
||||
/* end of stream */
|
||||
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T)-1;
|
||||
}
|
||||
@ -379,11 +378,11 @@ OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,
|
||||
OPJ_SIZE_T l_remaining_bytes = 0;
|
||||
OPJ_SIZE_T l_write_nb_bytes = 0;
|
||||
|
||||
if (p_stream->m_status & opj_stream_e_error) {
|
||||
if (p_stream->m_status & OPJ_STREAM_STATUS_ERROR) {
|
||||
return (OPJ_SIZE_T)-1;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
for (;;) {
|
||||
l_remaining_bytes = p_stream->m_buffer_size - p_stream->m_bytes_in_buffer;
|
||||
|
||||
/* we have more memory than required */
|
||||
@ -433,7 +432,7 @@ OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_
|
||||
p_stream->m_user_data);
|
||||
|
||||
if (l_current_write_nb_bytes == (OPJ_SIZE_T)-1) {
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Error on writing stream!\n");
|
||||
|
||||
return OPJ_FALSE;
|
||||
@ -466,7 +465,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
|
||||
}
|
||||
|
||||
/* we are now in the case when the remaining data if not sufficient */
|
||||
if (p_stream->m_status & opj_stream_e_end) {
|
||||
if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
|
||||
l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_current_data += p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
@ -488,7 +487,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
|
||||
if (l_current_skip_nb_bytes == (OPJ_OFF_T) -1) {
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
|
||||
|
||||
p_stream->m_status |= opj_stream_e_end;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_END;
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
/* end if stream */
|
||||
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) -1;
|
||||
@ -508,14 +507,14 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
|
||||
OPJ_OFF_T l_current_skip_nb_bytes = 0;
|
||||
OPJ_OFF_T l_skip_nb_bytes = 0;
|
||||
|
||||
if (p_stream->m_status & opj_stream_e_error) {
|
||||
if (p_stream->m_status & OPJ_STREAM_STATUS_ERROR) {
|
||||
return (OPJ_OFF_T) -1;
|
||||
}
|
||||
|
||||
/* we should flush data */
|
||||
l_is_written = opj_stream_flush (p_stream, p_event_mgr);
|
||||
if (! l_is_written) {
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
return (OPJ_OFF_T) -1;
|
||||
}
|
||||
@ -528,7 +527,7 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
|
||||
if (l_current_skip_nb_bytes == (OPJ_OFF_T)-1) {
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Stream error!\n");
|
||||
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
/* end if stream */
|
||||
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T)-1;
|
||||
@ -569,12 +568,12 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
|
||||
if( !(p_stream->m_seek_fn(p_size,p_stream->m_user_data)) ) {
|
||||
p_stream->m_status |= opj_stream_e_end;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_END;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else {
|
||||
/* reset stream status */
|
||||
p_stream->m_status &= (~opj_stream_e_end);
|
||||
p_stream->m_status &= (~OPJ_STREAM_STATUS_END);
|
||||
p_stream->m_byte_offset = p_size;
|
||||
|
||||
}
|
||||
@ -585,7 +584,7 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
|
||||
OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
if (! opj_stream_flush(p_stream,p_event_mgr)) {
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -593,7 +592,7 @@ OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
|
||||
if (! p_stream->m_seek_fn(p_size,p_stream->m_user_data)) {
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else {
|
||||
|
@ -70,16 +70,10 @@ The functions in CIO.C have for goal to realize a byte input / output process.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
opj_signed_sentinel = -1, /* do not use in code */
|
||||
opj_stream_e_output = 0x1,
|
||||
opj_stream_e_input = 0x2,
|
||||
opj_stream_e_end = 0x4,
|
||||
opj_stream_e_error = 0x8
|
||||
}
|
||||
opj_stream_flag ;
|
||||
#define OPJ_STREAM_STATUS_OUTPUT 0x1U
|
||||
#define OPJ_STREAM_STATUS_INPUT 0x2U
|
||||
#define OPJ_STREAM_STATUS_END 0x4U
|
||||
#define OPJ_STREAM_STATUS_ERROR 0x8U
|
||||
|
||||
/**
|
||||
Byte input-output stream.
|
||||
@ -162,8 +156,9 @@ typedef struct opj_stream_private
|
||||
|
||||
/**
|
||||
* Flags to tell the status of the stream.
|
||||
* Used with OPJ_STREAM_STATUS_* defines.
|
||||
*/
|
||||
opj_stream_flag m_status;
|
||||
OPJ_UINT32 m_status;
|
||||
|
||||
}
|
||||
opj_stream_private_t;
|
||||
@ -184,7 +179,7 @@ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
* @param p_nb_bytes the nb bytes to read.
|
||||
* @return the number of bytes read or -1 if an error occured.
|
||||
* @return the number of bytes read or -1 if an error occurred.
|
||||
*/
|
||||
void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
@ -193,7 +188,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
|
||||
* @param p_buffer pointer the data buffer to write data to.
|
||||
* @param p_value the value to write
|
||||
* @param p_nb_bytes the number of bytes to write
|
||||
* @return the number of bytes written or -1 if an error occured
|
||||
* @return the number of bytes written or -1 if an error occurred
|
||||
*/
|
||||
void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
@ -202,7 +197,7 @@ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
* @param p_nb_bytes the nb bytes to read.
|
||||
* @return the number of bytes read or -1 if an error occured.
|
||||
* @return the number of bytes read or -1 if an error occurred.
|
||||
*/
|
||||
void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
@ -269,7 +264,7 @@ void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
|
||||
* @param p_buffer pointer to the data buffer that will receive the data.
|
||||
* @param p_size number of bytes to read.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes read, or -1 if an error occured or if the stream is at the end.
|
||||
* @return the number of bytes read, or -1 if an error occurred or if the stream is at the end.
|
||||
*/
|
||||
OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -279,7 +274,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
|
||||
* @param p_buffer pointer to the data buffer holds the data to be writtent.
|
||||
* @param p_size number of bytes to write.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes writtent, or -1 if an error occured.
|
||||
* @return the number of bytes writtent, or -1 if an error occurred.
|
||||
*/
|
||||
OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -296,7 +291,7 @@ OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr
|
||||
* @param p_stream the stream to skip data from.
|
||||
* @param p_size the number of bytes to skip.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes skipped, or -1 if an error occured.
|
||||
* @return the number of bytes skipped, or -1 if an error occurred.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -324,7 +319,7 @@ OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream
|
||||
* @param p_stream the stream to skip data from.
|
||||
* @param p_size the number of bytes to skip.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes skipped, or -1 if an error occured.
|
||||
* @return the number of bytes skipped, or -1 if an error occurred.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -333,7 +328,7 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
|
||||
* @param p_stream the stream to skip data from.
|
||||
* @param p_size the number of bytes to skip.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes skipped, or -1 if an error occured.
|
||||
* @return the number of bytes skipped, or -1 if an error occurred.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -342,7 +337,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
|
||||
* @param p_stream the stream to skip data from.
|
||||
* @param p_size the number of bytes to skip.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return OPJ_TRUE if success, or OPJ_FALSE if an error occured.
|
||||
* @return OPJ_TRUE if success, or OPJ_FALSE if an error occurred.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
@ -351,7 +346,7 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
|
||||
* @param p_stream the stream to skip data from.
|
||||
* @param p_size the number of bytes to skip.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return the number of bytes skipped, or -1 if an error occured.
|
||||
* @return the number of bytes skipped, or -1 if an error occurred.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
|
@ -124,21 +124,21 @@ static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_st
|
||||
/**
|
||||
Inverse wavelet transform in 2-D.
|
||||
*/
|
||||
static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn);
|
||||
static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn);
|
||||
|
||||
static OPJ_BOOL opj_dwt_encode_procedure( opj_tcd_tilecomp_t * tilec,
|
||||
void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) );
|
||||
|
||||
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i);
|
||||
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* OPJ_RESTRICT r, OPJ_UINT32 i);
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse 9-7 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
static void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt);
|
||||
static void opj_v4dwt_decode(opj_v4dwt_t* OPJ_RESTRICT dwt);
|
||||
|
||||
static void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size);
|
||||
static void opj_v4dwt_interleave_h(opj_v4dwt_t* OPJ_RESTRICT w, OPJ_FLOAT32* OPJ_RESTRICT a, OPJ_INT32 x, OPJ_INT32 size);
|
||||
|
||||
static void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read);
|
||||
static void opj_v4dwt_interleave_v(opj_v4dwt_t* OPJ_RESTRICT v , OPJ_FLOAT32* OPJ_RESTRICT a , OPJ_INT32 x, OPJ_INT32 nb_elts_read);
|
||||
|
||||
#ifdef __SSE__
|
||||
static void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c);
|
||||
@ -193,7 +193,7 @@ static const OPJ_FLOAT64 opj_dwt_norms_real[4][10] = {
|
||||
/* <summary> */
|
||||
/* Forward lazy transform (horizontal). */
|
||||
/* </summary> */
|
||||
void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
static void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
OPJ_INT32 i;
|
||||
OPJ_INT32 * l_dest = b;
|
||||
OPJ_INT32 * l_src = a+cas;
|
||||
@ -215,7 +215,7 @@ void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
|
||||
/* <summary> */
|
||||
/* Forward lazy transform (vertical). */
|
||||
/* </summary> */
|
||||
void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
|
||||
static void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
|
||||
OPJ_INT32 i = sn;
|
||||
OPJ_INT32 * l_dest = b;
|
||||
OPJ_INT32 * l_src = a+cas;
|
||||
@ -240,7 +240,7 @@ void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
|
||||
/* <summary> */
|
||||
/* Inverse lazy transform (horizontal). */
|
||||
/* </summary> */
|
||||
void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
|
||||
static void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
|
||||
OPJ_INT32 *ai = a;
|
||||
OPJ_INT32 *bi = h->mem + h->cas;
|
||||
OPJ_INT32 i = h->sn;
|
||||
@ -260,7 +260,7 @@ void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
|
||||
/* <summary> */
|
||||
/* Inverse lazy transform (vertical). */
|
||||
/* </summary> */
|
||||
void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
|
||||
static void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
|
||||
OPJ_INT32 *ai = a;
|
||||
OPJ_INT32 *bi = v->mem + v->cas;
|
||||
OPJ_INT32 i = v->sn;
|
||||
@ -283,7 +283,7 @@ void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
|
||||
/* <summary> */
|
||||
/* Forward 5-3 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
OPJ_INT32 i;
|
||||
|
||||
if (!cas) {
|
||||
@ -304,7 +304,7 @@ void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
OPJ_INT32 i;
|
||||
|
||||
if (!cas) {
|
||||
@ -325,14 +325,14 @@ void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
void opj_dwt_decode_1(opj_dwt_t *v) {
|
||||
static void opj_dwt_decode_1(opj_dwt_t *v) {
|
||||
opj_dwt_decode_1_(v->mem, v->dn, v->sn, v->cas);
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 9-7 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
static void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
|
||||
OPJ_INT32 i;
|
||||
if (!cas) {
|
||||
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
|
||||
@ -367,7 +367,7 @@ void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 c
|
||||
}
|
||||
}
|
||||
|
||||
void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
|
||||
static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
|
||||
OPJ_INT32 p, n;
|
||||
p = opj_int_floorlog2(stepsize) - 13;
|
||||
n = 11 - opj_int_floorlog2(stepsize);
|
||||
@ -385,7 +385,7 @@ void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_
|
||||
/* <summary> */
|
||||
/* Forward 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
|
||||
static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
|
||||
{
|
||||
OPJ_INT32 i, j, k;
|
||||
OPJ_INT32 *a = 00;
|
||||
@ -395,7 +395,7 @@ INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_fun
|
||||
|
||||
OPJ_INT32 rw; /* width of the resolution level computed */
|
||||
OPJ_INT32 rh; /* height of the resolution level computed */
|
||||
OPJ_UINT32 l_data_size;
|
||||
size_t l_data_size;
|
||||
|
||||
opj_tcd_resolution_t * l_cur_res = 0;
|
||||
opj_tcd_resolution_t * l_last_res = 0;
|
||||
@ -407,9 +407,17 @@ INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_fun
|
||||
l_cur_res = tilec->resolutions + l;
|
||||
l_last_res = l_cur_res - 1;
|
||||
|
||||
l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
|
||||
bj = (OPJ_INT32*)opj_malloc((size_t)l_data_size);
|
||||
if (! bj) {
|
||||
l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions);
|
||||
/* overflow check */
|
||||
if (l_data_size > (SIZE_MAX / sizeof(OPJ_INT32))) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_data_size *= sizeof(OPJ_INT32);
|
||||
bj = (OPJ_INT32*)opj_malloc(l_data_size);
|
||||
/* l_data_size is equal to 0 when numresolutions == 1 but bj is not used */
|
||||
/* in that case, so do not error out */
|
||||
if (l_data_size != 0 && ! bj) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
i = l;
|
||||
@ -471,8 +479,8 @@ OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec)
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) {
|
||||
return opj_dwt_decode_tile(tilec, numres, &opj_dwt_decode_1);
|
||||
OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) {
|
||||
return opj_dwt_decode_tile(tp, tilec, numres, &opj_dwt_decode_1);
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +549,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
|
||||
/* <summary> */
|
||||
/* Determine maximum computed resolution level for inverse wavelet transform */
|
||||
/* </summary> */
|
||||
OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
|
||||
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* OPJ_RESTRICT r, OPJ_UINT32 i) {
|
||||
OPJ_UINT32 mr = 0;
|
||||
OPJ_UINT32 w;
|
||||
while( --i ) {
|
||||
@ -554,10 +562,73 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i
|
||||
return mr ;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
opj_dwt_t h;
|
||||
DWT1DFN dwt_1D;
|
||||
OPJ_UINT32 rw;
|
||||
OPJ_UINT32 w;
|
||||
OPJ_INT32 * OPJ_RESTRICT tiledp;
|
||||
OPJ_UINT32 min_j;
|
||||
OPJ_UINT32 max_j;
|
||||
} opj_dwd_decode_h_job_t;
|
||||
|
||||
static void opj_dwt_decode_h_func(void* user_data, opj_tls_t* tls)
|
||||
{
|
||||
OPJ_UINT32 j;
|
||||
opj_dwd_decode_h_job_t* job;
|
||||
(void)tls;
|
||||
|
||||
job = (opj_dwd_decode_h_job_t*)user_data;
|
||||
for( j = job->min_j; j < job->max_j; j++ )
|
||||
{
|
||||
opj_dwt_interleave_h(&job->h, &job->tiledp[j*job->w]);
|
||||
(job->dwt_1D)(&job->h);
|
||||
memcpy(&job->tiledp[j*job->w], job->h.mem, job->rw * sizeof(OPJ_INT32));
|
||||
}
|
||||
|
||||
opj_aligned_free(job->h.mem);
|
||||
opj_free(job);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
opj_dwt_t v;
|
||||
DWT1DFN dwt_1D;
|
||||
OPJ_UINT32 rh;
|
||||
OPJ_UINT32 w;
|
||||
OPJ_INT32 * OPJ_RESTRICT tiledp;
|
||||
OPJ_UINT32 min_j;
|
||||
OPJ_UINT32 max_j;
|
||||
} opj_dwd_decode_v_job_t;
|
||||
|
||||
static void opj_dwt_decode_v_func(void* user_data, opj_tls_t* tls)
|
||||
{
|
||||
OPJ_UINT32 j;
|
||||
opj_dwd_decode_v_job_t* job;
|
||||
(void)tls;
|
||||
|
||||
job = (opj_dwd_decode_v_job_t*)user_data;
|
||||
for( j = job->min_j; j < job->max_j; j++ )
|
||||
{
|
||||
OPJ_UINT32 k;
|
||||
opj_dwt_interleave_v(&job->v, &job->tiledp[j], (OPJ_INT32)job->w);
|
||||
(job->dwt_1D)(&job->v);
|
||||
for(k = 0; k < job->rh; ++k) {
|
||||
job->tiledp[k * job->w + j] = job->v.mem[k];
|
||||
}
|
||||
}
|
||||
|
||||
opj_aligned_free(job->v.mem);
|
||||
opj_free(job);
|
||||
}
|
||||
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse wavelet transform in 2-D. */
|
||||
/* Inverse wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
|
||||
static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D)
|
||||
{
|
||||
opj_dwt_t h;
|
||||
opj_dwt_t v;
|
||||
|
||||
@ -567,17 +638,30 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
|
||||
OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0); /* height of the resolution level computed */
|
||||
|
||||
OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
|
||||
|
||||
h.mem = (OPJ_INT32*)
|
||||
opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
|
||||
size_t h_mem_size;
|
||||
int num_threads;
|
||||
|
||||
if (numres == 1U) {
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
num_threads = opj_thread_pool_get_thread_count(tp);
|
||||
h_mem_size = opj_dwt_max_resolution(tr, numres);
|
||||
/* overflow check */
|
||||
if (h_mem_size > (SIZE_MAX / sizeof(OPJ_INT32))) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
h_mem_size *= sizeof(OPJ_INT32);
|
||||
h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size);
|
||||
if (! h.mem){
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
v.mem = h.mem;
|
||||
|
||||
while( --numres) {
|
||||
OPJ_INT32 * restrict tiledp = tilec->data;
|
||||
OPJ_INT32 * OPJ_RESTRICT tiledp = tilec->data;
|
||||
OPJ_UINT32 j;
|
||||
|
||||
++tr;
|
||||
@ -590,30 +674,134 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
|
||||
h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
|
||||
h.cas = tr->x0 % 2;
|
||||
|
||||
for(j = 0; j < rh; ++j) {
|
||||
opj_dwt_interleave_h(&h, &tiledp[j*w]);
|
||||
(dwt_1D)(&h);
|
||||
memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32));
|
||||
if( num_threads <= 1 || rh <= 1 )
|
||||
{
|
||||
for(j = 0; j < rh; ++j) {
|
||||
opj_dwt_interleave_h(&h, &tiledp[j*w]);
|
||||
(dwt_1D)(&h);
|
||||
memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
|
||||
OPJ_UINT32 step_j;
|
||||
|
||||
if( rh < num_jobs ) {
|
||||
num_jobs = rh;
|
||||
}
|
||||
step_j = (rh / num_jobs);
|
||||
|
||||
for(j = 0; j < num_jobs; j++)
|
||||
{
|
||||
opj_dwd_decode_h_job_t* job;
|
||||
|
||||
job = (opj_dwd_decode_h_job_t*) opj_malloc(sizeof(opj_dwd_decode_h_job_t));
|
||||
if( !job )
|
||||
{
|
||||
/* It would be nice to fallback to single thread case, but */
|
||||
/* unfortunately some jobs may be launched and have modified */
|
||||
/* tiledp, so it is not practical to recover from that error */
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_aligned_free(h.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
job->h = h;
|
||||
job->dwt_1D = dwt_1D;
|
||||
job->rw = rw;
|
||||
job->w = w;
|
||||
job->tiledp = tiledp;
|
||||
job->min_j = j * step_j;
|
||||
job->max_j = (j + 1U) * step_j; /* this can overflow */
|
||||
if( j == (num_jobs - 1U) ) { /* this will take care of the overflow */
|
||||
job->max_j = rh;
|
||||
}
|
||||
job->h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size);
|
||||
if (!job->h.mem)
|
||||
{
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_free(job);
|
||||
opj_aligned_free(h.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
opj_thread_pool_submit_job( tp, opj_dwt_decode_h_func, job );
|
||||
}
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
}
|
||||
|
||||
v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
|
||||
v.cas = tr->y0 % 2;
|
||||
|
||||
for(j = 0; j < rw; ++j){
|
||||
OPJ_UINT32 k;
|
||||
opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w);
|
||||
(dwt_1D)(&v);
|
||||
for(k = 0; k < rh; ++k) {
|
||||
tiledp[k * w + j] = v.mem[k];
|
||||
if( num_threads <= 1 || rw <= 1 )
|
||||
{
|
||||
for(j = 0; j < rw; ++j){
|
||||
OPJ_UINT32 k;
|
||||
|
||||
opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w);
|
||||
(dwt_1D)(&v);
|
||||
for(k = 0; k < rh; ++k) {
|
||||
tiledp[k * w + j] = v.mem[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
|
||||
OPJ_UINT32 step_j;
|
||||
|
||||
if( rw < num_jobs ) {
|
||||
num_jobs = rw;
|
||||
}
|
||||
step_j = (rw / num_jobs);
|
||||
|
||||
for( j = 0; j < num_jobs; j++ )
|
||||
{
|
||||
opj_dwd_decode_v_job_t* job;
|
||||
|
||||
job = (opj_dwd_decode_v_job_t*) opj_malloc(sizeof(opj_dwd_decode_v_job_t));
|
||||
if( !job )
|
||||
{
|
||||
/* It would be nice to fallback to single thread case, but */
|
||||
/* unfortunately some jobs may be launched and have modified */
|
||||
/* tiledp, so it is not practical to recover from that error */
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_aligned_free(v.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
job->v = v;
|
||||
job->dwt_1D = dwt_1D;
|
||||
job->rh = rh;
|
||||
job->w = w;
|
||||
job->tiledp = tiledp;
|
||||
job->min_j = j * step_j;
|
||||
job->max_j = (j + 1U) * step_j; /* this can overflow */
|
||||
if( j == (num_jobs - 1U) ) { /* this will take care of the overflow */
|
||||
job->max_j = rw;
|
||||
}
|
||||
job->v.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size);
|
||||
if (!job->v.mem)
|
||||
{
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_free(job);
|
||||
opj_aligned_free(v.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
opj_thread_pool_submit_job( tp, opj_dwt_decode_v_func, job );
|
||||
}
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
}
|
||||
}
|
||||
opj_aligned_free(h.mem);
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size){
|
||||
OPJ_FLOAT32* restrict bi = (OPJ_FLOAT32*) (w->wavelet + w->cas);
|
||||
static void opj_v4dwt_interleave_h(opj_v4dwt_t* OPJ_RESTRICT w, OPJ_FLOAT32* OPJ_RESTRICT a, OPJ_INT32 x, OPJ_INT32 size)
|
||||
{
|
||||
OPJ_FLOAT32* OPJ_RESTRICT bi = (OPJ_FLOAT32*) (w->wavelet + w->cas);
|
||||
OPJ_INT32 count = w->sn;
|
||||
OPJ_INT32 i, k;
|
||||
|
||||
@ -655,8 +843,8 @@ void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OP
|
||||
}
|
||||
}
|
||||
|
||||
void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){
|
||||
opj_v4_t* restrict bi = v->wavelet + v->cas;
|
||||
static void opj_v4dwt_interleave_v(opj_v4dwt_t* OPJ_RESTRICT v , OPJ_FLOAT32* OPJ_RESTRICT a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){
|
||||
opj_v4_t* OPJ_RESTRICT bi = v->wavelet + v->cas;
|
||||
OPJ_INT32 i;
|
||||
|
||||
for(i = 0; i < v->sn; ++i){
|
||||
@ -673,8 +861,8 @@ void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a ,
|
||||
|
||||
#ifdef __SSE__
|
||||
|
||||
void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
|
||||
__m128* restrict vw = (__m128*) w;
|
||||
static void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
|
||||
__m128* OPJ_RESTRICT vw = (__m128*) w;
|
||||
OPJ_INT32 i;
|
||||
/* 4x unrolled loop */
|
||||
for(i = 0; i < count >> 2; ++i){
|
||||
@ -695,8 +883,8 @@ void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
|
||||
}
|
||||
|
||||
void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, __m128 c){
|
||||
__m128* restrict vl = (__m128*) l;
|
||||
__m128* restrict vw = (__m128*) w;
|
||||
__m128* OPJ_RESTRICT vl = (__m128*) l;
|
||||
__m128* OPJ_RESTRICT vw = (__m128*) w;
|
||||
OPJ_INT32 i;
|
||||
__m128 tmp1, tmp2, tmp3;
|
||||
tmp1 = vl[0];
|
||||
@ -722,9 +910,9 @@ void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32
|
||||
|
||||
#else
|
||||
|
||||
void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
|
||||
static void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
|
||||
{
|
||||
OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;
|
||||
OPJ_FLOAT32* OPJ_RESTRICT fw = (OPJ_FLOAT32*) w;
|
||||
OPJ_INT32 i;
|
||||
for(i = 0; i < count; ++i){
|
||||
OPJ_FLOAT32 tmp1 = fw[i*8 ];
|
||||
@ -738,10 +926,10 @@ void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c)
|
||||
}
|
||||
}
|
||||
|
||||
void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)
|
||||
static void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c)
|
||||
{
|
||||
OPJ_FLOAT32* restrict fl = (OPJ_FLOAT32*) l;
|
||||
OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;
|
||||
OPJ_FLOAT32* fl = (OPJ_FLOAT32*) l;
|
||||
OPJ_FLOAT32* fw = (OPJ_FLOAT32*) w;
|
||||
OPJ_INT32 i;
|
||||
for(i = 0; i < m; ++i){
|
||||
OPJ_FLOAT32 tmp1_1 = fl[0];
|
||||
@ -792,7 +980,7 @@ void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m,
|
||||
/* <summary> */
|
||||
/* Inverse 9-7 wavelet transform in 1-D. */
|
||||
/* </summary> */
|
||||
void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt)
|
||||
static void opj_v4dwt_decode(opj_v4dwt_t* OPJ_RESTRICT dwt)
|
||||
{
|
||||
OPJ_INT32 a, b;
|
||||
if(dwt->cas == 0) {
|
||||
@ -829,7 +1017,7 @@ void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt)
|
||||
/* <summary> */
|
||||
/* Inverse 9-7 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numres)
|
||||
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec, OPJ_UINT32 numres)
|
||||
{
|
||||
opj_v4dwt_t h;
|
||||
opj_v4dwt_t v;
|
||||
@ -841,11 +1029,29 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numr
|
||||
|
||||
OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
|
||||
|
||||
h.wavelet = (opj_v4_t*) opj_aligned_malloc((opj_dwt_max_resolution(res, numres)+5) * sizeof(opj_v4_t));
|
||||
size_t l_data_size;
|
||||
|
||||
l_data_size = opj_dwt_max_resolution(res, numres);
|
||||
/* overflow check */
|
||||
if (l_data_size > (SIZE_MAX - 5U)) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_data_size += 5U;
|
||||
/* overflow check */
|
||||
if (l_data_size > (SIZE_MAX / sizeof(opj_v4_t))) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
h.wavelet = (opj_v4_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v4_t));
|
||||
if (!h.wavelet) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
v.wavelet = h.wavelet;
|
||||
|
||||
while( --numres) {
|
||||
OPJ_FLOAT32 * restrict aj = (OPJ_FLOAT32*) tilec->data;
|
||||
OPJ_FLOAT32 * OPJ_RESTRICT aj = (OPJ_FLOAT32*) tilec->data;
|
||||
OPJ_UINT32 bufsize = (OPJ_UINT32)((tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0));
|
||||
OPJ_INT32 j;
|
||||
|
||||
|
@ -54,19 +54,20 @@ DWT.C are used by some function in TCD.C.
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Forward 5-3 wavelet tranform in 2-D.
|
||||
Forward 5-3 wavelet transform in 2-D.
|
||||
Apply a reversible DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec);
|
||||
|
||||
/**
|
||||
Inverse 5-3 wavelet tranform in 2-D.
|
||||
Inverse 5-3 wavelet transform in 2-D.
|
||||
Apply a reversible inverse DWT transform to a component of an image.
|
||||
@param tp Thread pool
|
||||
@param tilec Tile component information (current tile)
|
||||
@param numres Number of resolution levels to decode
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
|
||||
OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
|
||||
|
||||
/**
|
||||
Get the gain of a subband for the reversible 5-3 DWT.
|
||||
@ -93,7 +94,7 @@ Apply an irreversible inverse DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param numres Number of resolution levels to decode
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numres);
|
||||
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec, OPJ_UINT32 numres);
|
||||
|
||||
/**
|
||||
Get the gain of a subband for the irreversible 9-7 DWT.
|
||||
|
@ -95,6 +95,12 @@ OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type, const c
|
||||
*/
|
||||
void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
|
||||
|
||||
/*
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC poison printf fprintf
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
@ -39,22 +39,19 @@
|
||||
opj_procedure_list_t * opj_procedure_list_create()
|
||||
{
|
||||
/* memory allocation */
|
||||
opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_malloc(sizeof(opj_procedure_list_t));
|
||||
opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_calloc(1,sizeof(opj_procedure_list_t));
|
||||
if (! l_validation)
|
||||
{
|
||||
return 00;
|
||||
}
|
||||
/* initialization */
|
||||
memset(l_validation,0,sizeof(opj_procedure_list_t));
|
||||
l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE;
|
||||
l_validation->m_procedures = (opj_procedure*)opj_malloc(
|
||||
OPJ_VALIDATION_SIZE * sizeof(opj_procedure));
|
||||
l_validation->m_procedures = (opj_procedure*)opj_calloc(OPJ_VALIDATION_SIZE, sizeof(opj_procedure));
|
||||
if (! l_validation->m_procedures)
|
||||
{
|
||||
opj_free(l_validation);
|
||||
return 00;
|
||||
}
|
||||
memset(l_validation->m_procedures,0,OPJ_VALIDATION_SIZE * sizeof(opj_procedure));
|
||||
return l_validation;
|
||||
}
|
||||
|
||||
@ -72,8 +69,11 @@ void opj_procedure_list_destroy(opj_procedure_list_t * p_list)
|
||||
opj_free(p_list);
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager )
|
||||
{
|
||||
|
||||
assert(p_manager != NULL);
|
||||
|
||||
if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures)
|
||||
{
|
||||
opj_procedure * new_procedures;
|
||||
@ -87,9 +87,7 @@ OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_l
|
||||
opj_free(p_validation_list->m_procedures);
|
||||
p_validation_list->m_nb_max_procedures = 0;
|
||||
p_validation_list->m_nb_procedures = 0;
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add a new validation procedure\n"); */
|
||||
fprintf(stderr, "Not enough memory to add a new validation procedure\n");
|
||||
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add a new validation procedure\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -95,7 +95,7 @@ void opj_procedure_list_destroy(opj_procedure_list_t * p_list);
|
||||
*
|
||||
* @return OPJ_TRUE if the procedure could be added.
|
||||
*/
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager);
|
||||
|
||||
/**
|
||||
* Gets the number of validation procedures.
|
||||
|
@ -47,7 +47,8 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
|
||||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(1,image->numcomps * sizeof(opj_image_comp_t));
|
||||
if(!image->comps) {
|
||||
fprintf(stderr,"Unable to allocate memory for image.\n");
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
@ -65,7 +66,8 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
|
||||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
comp->data = (OPJ_INT32*) opj_calloc(comp->w * comp->h, sizeof(OPJ_INT32));
|
||||
if(!comp->data) {
|
||||
fprintf(stderr,"Unable to allocate memory for image.\n");
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
@ -107,27 +109,29 @@ void OPJ_CALLCONV opj_image_destroy(opj_image_t *image) {
|
||||
void opj_image_comp_header_update(opj_image_t * p_image_header, const struct opj_cp * p_cp)
|
||||
{
|
||||
OPJ_UINT32 i, l_width, l_height;
|
||||
OPJ_INT32 l_x0, l_y0, l_x1, l_y1;
|
||||
OPJ_INT32 l_comp_x0, l_comp_y0, l_comp_x1, l_comp_y1;
|
||||
OPJ_UINT32 l_x0, l_y0, l_x1, l_y1;
|
||||
OPJ_UINT32 l_comp_x0, l_comp_y0, l_comp_x1, l_comp_y1;
|
||||
opj_image_comp_t* l_img_comp = NULL;
|
||||
|
||||
l_x0 = opj_int_max((OPJ_INT32)p_cp->tx0 , (OPJ_INT32)p_image_header->x0);
|
||||
l_y0 = opj_int_max((OPJ_INT32)p_cp->ty0 , (OPJ_INT32)p_image_header->y0);
|
||||
l_x1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + p_cp->tw * p_cp->tdx), (OPJ_INT32)p_image_header->x1);
|
||||
l_y1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + p_cp->th * p_cp->tdy), (OPJ_INT32)p_image_header->y1);
|
||||
l_x0 = opj_uint_max(p_cp->tx0 , p_image_header->x0);
|
||||
l_y0 = opj_uint_max(p_cp->ty0 , p_image_header->y0);
|
||||
l_x1 = p_cp->tx0 + (p_cp->tw - 1U) * p_cp->tdx; /* validity of p_cp members used here checked in opj_j2k_read_siz. Can't overflow. */
|
||||
l_y1 = p_cp->ty0 + (p_cp->th - 1U) * p_cp->tdy; /* can't overflow */
|
||||
l_x1 = opj_uint_min(opj_uint_adds(l_x1, p_cp->tdx), p_image_header->x1); /* use add saturated to prevent overflow */
|
||||
l_y1 = opj_uint_min(opj_uint_adds(l_y1, p_cp->tdy), p_image_header->y1); /* use add saturated to prevent overflow */
|
||||
|
||||
l_img_comp = p_image_header->comps;
|
||||
for (i = 0; i < p_image_header->numcomps; ++i) {
|
||||
l_comp_x0 = opj_int_ceildiv(l_x0, (OPJ_INT32)l_img_comp->dx);
|
||||
l_comp_y0 = opj_int_ceildiv(l_y0, (OPJ_INT32)l_img_comp->dy);
|
||||
l_comp_x1 = opj_int_ceildiv(l_x1, (OPJ_INT32)l_img_comp->dx);
|
||||
l_comp_y1 = opj_int_ceildiv(l_y1, (OPJ_INT32)l_img_comp->dy);
|
||||
l_width = (OPJ_UINT32)opj_int_ceildivpow2(l_comp_x1 - l_comp_x0, (OPJ_INT32)l_img_comp->factor);
|
||||
l_height = (OPJ_UINT32)opj_int_ceildivpow2(l_comp_y1 - l_comp_y0, (OPJ_INT32)l_img_comp->factor);
|
||||
l_comp_x0 = opj_uint_ceildiv(l_x0, l_img_comp->dx);
|
||||
l_comp_y0 = opj_uint_ceildiv(l_y0, l_img_comp->dy);
|
||||
l_comp_x1 = opj_uint_ceildiv(l_x1, l_img_comp->dx);
|
||||
l_comp_y1 = opj_uint_ceildiv(l_y1, l_img_comp->dy);
|
||||
l_width = opj_uint_ceildivpow2(l_comp_x1 - l_comp_x0, l_img_comp->factor);
|
||||
l_height = opj_uint_ceildivpow2(l_comp_y1 - l_comp_y0, l_img_comp->factor);
|
||||
l_img_comp->w = l_width;
|
||||
l_img_comp->h = l_height;
|
||||
l_img_comp->x0 = (OPJ_UINT32)l_comp_x0/*l_x0*/;
|
||||
l_img_comp->y0 = (OPJ_UINT32)l_comp_y0/*l_y0*/;
|
||||
l_img_comp->x0 = l_comp_x0;
|
||||
l_img_comp->y0 = l_comp_y0;
|
||||
++l_img_comp;
|
||||
}
|
||||
}
|
||||
@ -205,21 +209,19 @@ opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_c
|
||||
OPJ_UINT32 compno;
|
||||
opj_image_t *image = 00;
|
||||
|
||||
image = (opj_image_t*) opj_malloc(sizeof(opj_image_t));
|
||||
image = (opj_image_t*) opj_calloc(1,sizeof(opj_image_t));
|
||||
if (image)
|
||||
{
|
||||
memset(image,0,sizeof(opj_image_t));
|
||||
|
||||
image->color_space = clrspc;
|
||||
image->numcomps = numcmpts;
|
||||
|
||||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t));
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(image->numcomps, sizeof(opj_image_comp_t));
|
||||
if (!image->comps) {
|
||||
opj_image_destroy(image);
|
||||
return 00;
|
||||
}
|
||||
memset(image->comps,0,image->numcomps * sizeof(opj_image_comp_t));
|
||||
|
||||
/* create the individual image components */
|
||||
for(compno = 0; compno < numcmpts; compno++) {
|
||||
|
@ -108,7 +108,7 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
|
||||
opj_event_mgr_t * p_manager );
|
||||
|
||||
/*
|
||||
* Wriet manifest box (box)
|
||||
* Write manifest box (box)
|
||||
*
|
||||
* @param[in] second number to be visited
|
||||
* @param[in] v number of boxes
|
||||
|
@ -103,7 +103,7 @@ OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
|
||||
Local functions
|
||||
==========================================================
|
||||
*/
|
||||
OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
OPJ_FLOAT32 * p_swap_area,
|
||||
OPJ_UINT32 nb_compo)
|
||||
{
|
||||
@ -125,7 +125,7 @@ OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
{
|
||||
*tmpPermutations++ = i;
|
||||
}
|
||||
/* now make a pivot with colum switch */
|
||||
/* now make a pivot with column switch */
|
||||
tmpPermutations = permutations;
|
||||
for (k = 0; k < lLastColum; ++k) {
|
||||
p = 0.0;
|
||||
@ -204,7 +204,7 @@ OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
static void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
OPJ_FLOAT32 * pMatrix,
|
||||
OPJ_FLOAT32 * pVector,
|
||||
OPJ_UINT32* pPermutations,
|
||||
@ -266,7 +266,7 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
}
|
||||
|
||||
|
||||
void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
|
||||
static void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_FLOAT32 * pDestMatrix,
|
||||
OPJ_UINT32 nb_compo,
|
||||
OPJ_UINT32 * pPermutations,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -228,10 +228,16 @@ typedef struct opj_simple_mcc_decorrelation_data
|
||||
OPJ_UINT32 m_nb_comps;
|
||||
opj_mct_data_t * m_decorrelation_array;
|
||||
opj_mct_data_t * m_offset_array;
|
||||
OPJ_UINT32 m_is_irreversible : 1;
|
||||
OPJ_BITFIELD m_is_irreversible : 1;
|
||||
}
|
||||
opj_simple_mcc_decorrelation_data_t;
|
||||
|
||||
typedef struct opj_ppx_struct
|
||||
{
|
||||
OPJ_BYTE* m_data; /* m_data == NULL => Zppx not read yet */
|
||||
OPJ_UINT32 m_data_size;
|
||||
} opj_ppx;
|
||||
|
||||
/**
|
||||
Tile coding parameters :
|
||||
this structure is used to store coding/decoding parameters common to all
|
||||
@ -254,7 +260,13 @@ typedef struct opj_tcp
|
||||
OPJ_UINT32 numpocs;
|
||||
/** progression order changes */
|
||||
opj_poc_t pocs[32];
|
||||
/** packet header store there for futur use in t2_decode_packet */
|
||||
|
||||
/** number of ppt markers (reserved size) */
|
||||
OPJ_UINT32 ppt_markers_count;
|
||||
/** ppt markers data (table indexed by Zppt) */
|
||||
opj_ppx* ppt_markers;
|
||||
|
||||
/** packet header store there for future use in t2_decode_packet */
|
||||
OPJ_BYTE *ppt_data;
|
||||
/** used to keep a track of the allocated memory */
|
||||
OPJ_BYTE *ppt_buffer;
|
||||
@ -293,10 +305,12 @@ typedef struct opj_tcp
|
||||
|
||||
|
||||
/***** FLAGS *******/
|
||||
/** If cod == 1 --> there was a COD marker for the present tile */
|
||||
OPJ_BITFIELD cod : 1;
|
||||
/** If ppt == 1 --> there was a PPT marker for the present tile */
|
||||
OPJ_UINT32 ppt : 1;
|
||||
OPJ_BITFIELD ppt : 1;
|
||||
/** indicates if a POC marker has been used O:NO, 1:YES */
|
||||
OPJ_UINT32 POC : 1;
|
||||
OPJ_BITFIELD POC : 1;
|
||||
} opj_tcp_t;
|
||||
|
||||
|
||||
@ -313,13 +327,13 @@ typedef struct opj_encoding_param
|
||||
/** Flag determining tile part generation*/
|
||||
OPJ_BYTE m_tp_flag;
|
||||
/** allocation by rate/distortion */
|
||||
OPJ_UINT32 m_disto_alloc : 1;
|
||||
OPJ_BITFIELD m_disto_alloc : 1;
|
||||
/** allocation by fixed layer */
|
||||
OPJ_UINT32 m_fixed_alloc : 1;
|
||||
OPJ_BITFIELD m_fixed_alloc : 1;
|
||||
/** add fixed_quality */
|
||||
OPJ_UINT32 m_fixed_quality : 1;
|
||||
OPJ_BITFIELD m_fixed_quality : 1;
|
||||
/** Enabling Tile part generation*/
|
||||
OPJ_UINT32 m_tp_on : 1;
|
||||
OPJ_BITFIELD m_tp_on : 1;
|
||||
}
|
||||
opj_encoding_param_t;
|
||||
|
||||
@ -357,7 +371,12 @@ typedef struct opj_cp
|
||||
/** number of tiles in heigth */
|
||||
OPJ_UINT32 th;
|
||||
|
||||
/** packet header store there for futur use in t2_decode_packet */
|
||||
/** number of ppm markers (reserved size) */
|
||||
OPJ_UINT32 ppm_markers_count;
|
||||
/** ppm markers data (table indexed by Zppm) */
|
||||
opj_ppx* ppm_markers;
|
||||
|
||||
/** packet header store there for future use in t2_decode_packet */
|
||||
OPJ_BYTE *ppm_data;
|
||||
/** size of the ppm_data*/
|
||||
OPJ_UINT32 ppm_len;
|
||||
@ -434,9 +453,9 @@ typedef struct opj_cp
|
||||
|
||||
/******** FLAGS *********/
|
||||
/** if ppm == 1 --> there was a PPM marker*/
|
||||
OPJ_UINT32 ppm : 1;
|
||||
OPJ_BITFIELD ppm : 1;
|
||||
/** tells if the parameter is a coding or decoding one */
|
||||
OPJ_UINT32 m_is_decoder : 1;
|
||||
OPJ_BITFIELD m_is_decoder : 1;
|
||||
/* <<UniPG */
|
||||
} opj_cp_t;
|
||||
|
||||
@ -478,9 +497,12 @@ typedef struct opj_j2k_dec
|
||||
*/
|
||||
OPJ_BOOL m_last_tile_part;
|
||||
/** to tell that a tile can be decoded. */
|
||||
OPJ_UINT32 m_can_decode : 1;
|
||||
OPJ_UINT32 m_discard_tiles : 1;
|
||||
OPJ_UINT32 m_skip_data : 1;
|
||||
OPJ_BITFIELD m_can_decode : 1;
|
||||
OPJ_BITFIELD m_discard_tiles : 1;
|
||||
OPJ_BITFIELD m_skip_data : 1;
|
||||
/** TNsot correction : see issue 254 **/
|
||||
OPJ_BITFIELD m_nb_tile_parts_correction_checked : 1;
|
||||
OPJ_BITFIELD m_nb_tile_parts_correction : 1;
|
||||
|
||||
} opj_j2k_dec_t;
|
||||
|
||||
@ -568,6 +590,11 @@ typedef struct opj_j2k
|
||||
/** the current tile coder/decoder **/
|
||||
struct opj_tcd * m_tcd;
|
||||
|
||||
/** Number of threads to use */
|
||||
int m_num_threads;
|
||||
|
||||
/** Thread pool */
|
||||
opj_thread_pool_t* m_tp;
|
||||
}
|
||||
opj_j2k_t;
|
||||
|
||||
@ -586,6 +613,8 @@ Decoding parameters are returned in j2k->cp.
|
||||
*/
|
||||
void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters);
|
||||
|
||||
OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads);
|
||||
|
||||
/**
|
||||
* Creates a J2K compression structure
|
||||
*
|
||||
@ -594,7 +623,7 @@ void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters);
|
||||
opj_j2k_t* opj_j2k_create_compress(void);
|
||||
|
||||
|
||||
void opj_j2k_setup_encoder( opj_j2k_t *p_j2k,
|
||||
OPJ_BOOL opj_j2k_setup_encoder( opj_j2k_t *p_j2k,
|
||||
opj_cparameters_t *parameters,
|
||||
opj_image_t *image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -90,7 +90,7 @@ typedef enum
|
||||
JP2_IMG_STATE;
|
||||
|
||||
/**
|
||||
Channel description: channel index, type, assocation
|
||||
Channel description: channel index, type, association
|
||||
*/
|
||||
typedef struct opj_jp2_cdef_info
|
||||
{
|
||||
@ -235,19 +235,6 @@ opj_jp2_img_header_writer_handler_t;
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Writes the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).
|
||||
*
|
||||
* @param jp2 the jpeg2000 file codec.
|
||||
* @param stream the stream to write data to.
|
||||
* @param p_manager user event manager.
|
||||
*
|
||||
* @return true if writing was successful.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_write_jp2h(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *stream,
|
||||
opj_event_mgr_t * p_manager );
|
||||
|
||||
/**
|
||||
Setup the decoder decoding parameters using user parameters.
|
||||
Decoding parameters are returned in jp2->j2k->cp.
|
||||
@ -256,6 +243,8 @@ Decoding parameters are returned in jp2->j2k->cp.
|
||||
*/
|
||||
void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
|
||||
|
||||
OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads);
|
||||
|
||||
/**
|
||||
* Decode an image from a JPEG-2000 file stream
|
||||
* @param jp2 JP2 decompressor handle
|
||||
@ -278,8 +267,9 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||
* @param parameters compression parameters
|
||||
* @param image input filled image
|
||||
* @param p_manager FIXME DOC
|
||||
* @return OPJ_TRUE if successful, OPJ_FALSE otherwise
|
||||
*/
|
||||
void opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||
OPJ_BOOL opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||
opj_cparameters_t *parameters,
|
||||
opj_image_t *image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
@ -40,6 +40,12 @@
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#ifdef __SSE2__
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
#ifdef __SSE4_1__
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
@ -64,16 +70,39 @@ const OPJ_FLOAT64 * opj_mct_get_mct_norms_real ()
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Foward reversible MCT. */
|
||||
/* Forward reversible MCT. */
|
||||
/* </summary> */
|
||||
#ifdef __SSE2__
|
||||
void opj_mct_encode(
|
||||
OPJ_INT32* restrict c0,
|
||||
OPJ_INT32* restrict c1,
|
||||
OPJ_INT32* restrict c2,
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
for(i = 0; i < n; ++i) {
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_SIZE_T len = n;
|
||||
/* buffer are aligned on 16 bytes */
|
||||
assert( ((size_t)c0 & 0xf) == 0 );
|
||||
assert( ((size_t)c1 & 0xf) == 0 );
|
||||
assert( ((size_t)c2 & 0xf) == 0 );
|
||||
|
||||
for(i = 0; i < (len & ~3U); i += 4) {
|
||||
__m128i y, u, v;
|
||||
__m128i r = _mm_load_si128((const __m128i *)&(c0[i]));
|
||||
__m128i g = _mm_load_si128((const __m128i *)&(c1[i]));
|
||||
__m128i b = _mm_load_si128((const __m128i *)&(c2[i]));
|
||||
y = _mm_add_epi32(g, g);
|
||||
y = _mm_add_epi32(y, b);
|
||||
y = _mm_add_epi32(y, r);
|
||||
y = _mm_srai_epi32(y, 2);
|
||||
u = _mm_sub_epi32(b, g);
|
||||
v = _mm_sub_epi32(r, g);
|
||||
_mm_store_si128((__m128i *)&(c0[i]), y);
|
||||
_mm_store_si128((__m128i *)&(c1[i]), u);
|
||||
_mm_store_si128((__m128i *)&(c2[i]), v);
|
||||
}
|
||||
|
||||
for(; i < len; ++i) {
|
||||
OPJ_INT32 r = c0[i];
|
||||
OPJ_INT32 g = c1[i];
|
||||
OPJ_INT32 b = c2[i];
|
||||
@ -85,14 +114,73 @@ void opj_mct_encode(
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void opj_mct_encode(
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_SIZE_T len = n;
|
||||
|
||||
for(i = 0; i < len; ++i) {
|
||||
OPJ_INT32 r = c0[i];
|
||||
OPJ_INT32 g = c1[i];
|
||||
OPJ_INT32 b = c2[i];
|
||||
OPJ_INT32 y = (r + (g * 2) + b) >> 2;
|
||||
OPJ_INT32 u = b - g;
|
||||
OPJ_INT32 v = r - g;
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse reversible MCT. */
|
||||
/* </summary> */
|
||||
#ifdef __SSE2__
|
||||
void opj_mct_decode(
|
||||
OPJ_INT32* restrict c0,
|
||||
OPJ_INT32* restrict c1,
|
||||
OPJ_INT32* restrict c2,
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_SIZE_T len = n;
|
||||
|
||||
for(i = 0; i < (len & ~3U); i += 4) {
|
||||
__m128i r, g, b;
|
||||
__m128i y = _mm_load_si128((const __m128i *)&(c0[i]));
|
||||
__m128i u = _mm_load_si128((const __m128i *)&(c1[i]));
|
||||
__m128i v = _mm_load_si128((const __m128i *)&(c2[i]));
|
||||
g = y;
|
||||
g = _mm_sub_epi32(g, _mm_srai_epi32(_mm_add_epi32(u, v), 2));
|
||||
r = _mm_add_epi32(v, g);
|
||||
b = _mm_add_epi32(u, g);
|
||||
_mm_store_si128((__m128i *)&(c0[i]), r);
|
||||
_mm_store_si128((__m128i *)&(c1[i]), g);
|
||||
_mm_store_si128((__m128i *)&(c2[i]), b);
|
||||
}
|
||||
for (; i < len; ++i) {
|
||||
OPJ_INT32 y = c0[i];
|
||||
OPJ_INT32 u = c1[i];
|
||||
OPJ_INT32 v = c2[i];
|
||||
OPJ_INT32 g = y - ((u + v) >> 2);
|
||||
OPJ_INT32 r = v + g;
|
||||
OPJ_INT32 b = u + g;
|
||||
c0[i] = r;
|
||||
c1[i] = g;
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void opj_mct_decode(
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
@ -108,6 +196,7 @@ void opj_mct_decode(
|
||||
c2[i] = b;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <summary> */
|
||||
/* Get norm of basis function of reversible MCT. */
|
||||
@ -117,12 +206,154 @@ OPJ_FLOAT64 opj_mct_getnorm(OPJ_UINT32 compno) {
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Foward irreversible MCT. */
|
||||
/* Forward irreversible MCT. */
|
||||
/* </summary> */
|
||||
#ifdef __SSE4_1__
|
||||
void opj_mct_encode_real(
|
||||
OPJ_INT32* restrict c0,
|
||||
OPJ_INT32* restrict c1,
|
||||
OPJ_INT32* restrict c2,
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_SIZE_T i;
|
||||
const OPJ_SIZE_T len = n;
|
||||
|
||||
const __m128i ry = _mm_set1_epi32(2449);
|
||||
const __m128i gy = _mm_set1_epi32(4809);
|
||||
const __m128i by = _mm_set1_epi32(934);
|
||||
const __m128i ru = _mm_set1_epi32(1382);
|
||||
const __m128i gu = _mm_set1_epi32(2714);
|
||||
/* const __m128i bu = _mm_set1_epi32(4096); */
|
||||
/* const __m128i rv = _mm_set1_epi32(4096); */
|
||||
const __m128i gv = _mm_set1_epi32(3430);
|
||||
const __m128i bv = _mm_set1_epi32(666);
|
||||
const __m128i mulround = _mm_shuffle_epi32(_mm_cvtsi32_si128(4096), _MM_SHUFFLE(1, 0, 1, 0));
|
||||
|
||||
for(i = 0; i < (len & ~3U); i += 4) {
|
||||
__m128i lo, hi;
|
||||
__m128i y, u, v;
|
||||
__m128i r = _mm_load_si128((const __m128i *)&(c0[i]));
|
||||
__m128i g = _mm_load_si128((const __m128i *)&(c1[i]));
|
||||
__m128i b = _mm_load_si128((const __m128i *)&(c2[i]));
|
||||
|
||||
lo = r;
|
||||
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, ry);
|
||||
hi = _mm_mul_epi32(hi, ry);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
y = _mm_blend_epi16(lo, hi, 0xCC);
|
||||
|
||||
lo = g;
|
||||
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, gy);
|
||||
hi = _mm_mul_epi32(hi, gy);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
y = _mm_add_epi32(y, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
|
||||
lo = b;
|
||||
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, by);
|
||||
hi = _mm_mul_epi32(hi, by);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
y = _mm_add_epi32(y, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
_mm_store_si128((__m128i *)&(c0[i]), y);
|
||||
|
||||
/*lo = b;
|
||||
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, mulround);
|
||||
hi = _mm_mul_epi32(hi, mulround);*/
|
||||
lo = _mm_cvtepi32_epi64(_mm_shuffle_epi32(b, _MM_SHUFFLE(3, 2, 2, 0)));
|
||||
hi = _mm_cvtepi32_epi64(_mm_shuffle_epi32(b, _MM_SHUFFLE(3, 2, 3, 1)));
|
||||
lo = _mm_slli_epi64(lo, 12);
|
||||
hi = _mm_slli_epi64(hi, 12);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
u = _mm_blend_epi16(lo, hi, 0xCC);
|
||||
|
||||
lo = r;
|
||||
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, ru);
|
||||
hi = _mm_mul_epi32(hi, ru);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
u = _mm_sub_epi32(u, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
|
||||
lo = g;
|
||||
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, gu);
|
||||
hi = _mm_mul_epi32(hi, gu);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
u = _mm_sub_epi32(u, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
_mm_store_si128((__m128i *)&(c1[i]), u);
|
||||
|
||||
/*lo = r;
|
||||
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, mulround);
|
||||
hi = _mm_mul_epi32(hi, mulround);*/
|
||||
lo = _mm_cvtepi32_epi64(_mm_shuffle_epi32(r, _MM_SHUFFLE(3, 2, 2, 0)));
|
||||
hi = _mm_cvtepi32_epi64(_mm_shuffle_epi32(r, _MM_SHUFFLE(3, 2, 3, 1)));
|
||||
lo = _mm_slli_epi64(lo, 12);
|
||||
hi = _mm_slli_epi64(hi, 12);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
v = _mm_blend_epi16(lo, hi, 0xCC);
|
||||
|
||||
lo = g;
|
||||
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, gv);
|
||||
hi = _mm_mul_epi32(hi, gv);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
v = _mm_sub_epi32(v, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
|
||||
lo = b;
|
||||
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
|
||||
lo = _mm_mul_epi32(lo, bv);
|
||||
hi = _mm_mul_epi32(hi, bv);
|
||||
lo = _mm_add_epi64(lo, mulround);
|
||||
hi = _mm_add_epi64(hi, mulround);
|
||||
lo = _mm_srli_epi64(lo, 13);
|
||||
hi = _mm_slli_epi64(hi, 32-13);
|
||||
v = _mm_sub_epi32(v, _mm_blend_epi16(lo, hi, 0xCC));
|
||||
_mm_store_si128((__m128i *)&(c2[i]), v);
|
||||
}
|
||||
for(; i < len; ++i) {
|
||||
OPJ_INT32 r = c0[i];
|
||||
OPJ_INT32 g = c1[i];
|
||||
OPJ_INT32 b = c2[i];
|
||||
OPJ_INT32 y = opj_int_fix_mul(r, 2449) + opj_int_fix_mul(g, 4809) + opj_int_fix_mul(b, 934);
|
||||
OPJ_INT32 u = -opj_int_fix_mul(r, 1382) - opj_int_fix_mul(g, 2714) + opj_int_fix_mul(b, 4096);
|
||||
OPJ_INT32 v = opj_int_fix_mul(r, 4096) - opj_int_fix_mul(g, 3430) - opj_int_fix_mul(b, 666);
|
||||
c0[i] = y;
|
||||
c1[i] = u;
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void opj_mct_encode_real(
|
||||
OPJ_INT32* OPJ_RESTRICT c0,
|
||||
OPJ_INT32* OPJ_RESTRICT c1,
|
||||
OPJ_INT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
@ -138,14 +369,15 @@ void opj_mct_encode_real(
|
||||
c2[i] = v;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse irreversible MCT. */
|
||||
/* </summary> */
|
||||
void opj_mct_decode_real(
|
||||
OPJ_FLOAT32* restrict c0,
|
||||
OPJ_FLOAT32* restrict c1,
|
||||
OPJ_FLOAT32* restrict c2,
|
||||
OPJ_FLOAT32* OPJ_RESTRICT c0,
|
||||
OPJ_FLOAT32* OPJ_RESTRICT c1,
|
||||
OPJ_FLOAT32* OPJ_RESTRICT c2,
|
||||
OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
|
@ -60,7 +60,7 @@ Apply a reversible multi-component transform to an image
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void opj_mct_encode(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
|
||||
void opj_mct_encode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
|
||||
/**
|
||||
Apply a reversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@ -68,7 +68,7 @@ Apply a reversible multi-component inverse transform to an image
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void opj_mct_decode(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
|
||||
void opj_mct_decode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
|
||||
/**
|
||||
Get norm of the basis function used for the reversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
@ -83,7 +83,7 @@ Apply an irreversible multi-component transform to an image
|
||||
@param c2 Samples blue component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void opj_mct_encode_real(OPJ_INT32 *c0, OPJ_INT32 *c1, OPJ_INT32 *c2, OPJ_UINT32 n);
|
||||
void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
|
||||
/**
|
||||
Apply an irreversible multi-component inverse transform to an image
|
||||
@param c0 Samples for luminance component
|
||||
@ -91,7 +91,7 @@ Apply an irreversible multi-component inverse transform to an image
|
||||
@param c2 Samples for blue chrominance component
|
||||
@param n Number of samples for each component
|
||||
*/
|
||||
void opj_mct_decode_real(OPJ_FLOAT32* c0, OPJ_FLOAT32* c1, OPJ_FLOAT32* c2, OPJ_UINT32 n);
|
||||
void opj_mct_decode_real(OPJ_FLOAT32* OPJ_RESTRICT c0, OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
|
||||
/**
|
||||
Get norm of the basis function used for the irreversible multi-component transform
|
||||
@param compno Number of the component (0->Y, 1->U, 2->V)
|
||||
|
@ -70,28 +70,6 @@ Fill mqc->c with 1's for flushing
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
static void opj_mqc_setbits(opj_mqc_t *mqc);
|
||||
/**
|
||||
FIXME DOC
|
||||
@param mqc MQC handle
|
||||
@return
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc);
|
||||
/**
|
||||
FIXME DOC
|
||||
@param mqc MQC handle
|
||||
@return
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc);
|
||||
/**
|
||||
Input a byte
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc);
|
||||
/**
|
||||
Renormalize mqc->a and mqc->c while decoding
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc);
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
@ -202,14 +180,21 @@ static opj_mqc_state_t mqc_states[47 * 2] = {
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
void opj_mqc_byteout(opj_mqc_t *mqc) {
|
||||
if (*mqc->bp == 0xff) {
|
||||
static void opj_mqc_byteout(opj_mqc_t *mqc) {
|
||||
/* avoid accessing uninitialized memory*/
|
||||
if (mqc->bp == mqc->start-1) {
|
||||
mqc->bp++;
|
||||
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
|
||||
mqc->c &= 0x7ffff;
|
||||
mqc->ct = 8;
|
||||
}
|
||||
else if (*mqc->bp == 0xff) {
|
||||
mqc->bp++;
|
||||
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
|
||||
mqc->c &= 0xfffff;
|
||||
mqc->ct = 7;
|
||||
} else {
|
||||
if ((mqc->c & 0x8000000) == 0) { /* ((mqc->c&0x8000000)==0) CHANGE */
|
||||
if ((mqc->c & 0x8000000) == 0) {
|
||||
mqc->bp++;
|
||||
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
|
||||
mqc->c &= 0x7ffff;
|
||||
@ -232,7 +217,7 @@ void opj_mqc_byteout(opj_mqc_t *mqc) {
|
||||
}
|
||||
}
|
||||
|
||||
void opj_mqc_renorme(opj_mqc_t *mqc) {
|
||||
static void opj_mqc_renorme(opj_mqc_t *mqc) {
|
||||
do {
|
||||
mqc->a <<= 1;
|
||||
mqc->c <<= 1;
|
||||
@ -243,7 +228,7 @@ void opj_mqc_renorme(opj_mqc_t *mqc) {
|
||||
} while ((mqc->a & 0x8000) == 0);
|
||||
}
|
||||
|
||||
void opj_mqc_codemps(opj_mqc_t *mqc) {
|
||||
static void opj_mqc_codemps(opj_mqc_t *mqc) {
|
||||
mqc->a -= (*mqc->curctx)->qeval;
|
||||
if ((mqc->a & 0x8000) == 0) {
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
@ -258,7 +243,7 @@ void opj_mqc_codemps(opj_mqc_t *mqc) {
|
||||
}
|
||||
}
|
||||
|
||||
void opj_mqc_codelps(opj_mqc_t *mqc) {
|
||||
static void opj_mqc_codelps(opj_mqc_t *mqc) {
|
||||
mqc->a -= (*mqc->curctx)->qeval;
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
mqc->c += (*mqc->curctx)->qeval;
|
||||
@ -269,7 +254,7 @@ void opj_mqc_codelps(opj_mqc_t *mqc) {
|
||||
opj_mqc_renorme(mqc);
|
||||
}
|
||||
|
||||
void opj_mqc_setbits(opj_mqc_t *mqc) {
|
||||
static void opj_mqc_setbits(opj_mqc_t *mqc) {
|
||||
OPJ_UINT32 tempc = mqc->c + mqc->a;
|
||||
mqc->c |= 0xffff;
|
||||
if (mqc->c >= tempc) {
|
||||
@ -277,82 +262,6 @@ void opj_mqc_setbits(opj_mqc_t *mqc) {
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
|
||||
*mqc->curctx = (*mqc->curctx)->nlps;
|
||||
} else {
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
*mqc->curctx = (*mqc->curctx)->nmps;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
mqc->a = (*mqc->curctx)->qeval;
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
*mqc->curctx = (*mqc->curctx)->nmps;
|
||||
} else {
|
||||
mqc->a = (*mqc->curctx)->qeval;
|
||||
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
|
||||
*mqc->curctx = (*mqc->curctx)->nlps;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
#ifdef MQC_PERF_OPT
|
||||
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
|
||||
unsigned int i = *((unsigned int *) mqc->bp);
|
||||
mqc->c += i & 0xffff00;
|
||||
mqc->ct = i & 0x0f;
|
||||
mqc->bp += (i >> 2) & 0x04;
|
||||
}
|
||||
#else
|
||||
static void opj_mqc_bytein(opj_mqc_t *const mqc) {
|
||||
if (mqc->bp != mqc->end) {
|
||||
OPJ_UINT32 c;
|
||||
if (mqc->bp + 1 != mqc->end) {
|
||||
c = *(mqc->bp + 1);
|
||||
} else {
|
||||
c = 0xff;
|
||||
}
|
||||
if (*mqc->bp == 0xff) {
|
||||
if (c > 0x8f) {
|
||||
mqc->c += 0xff00;
|
||||
mqc->ct = 8;
|
||||
} else {
|
||||
mqc->bp++;
|
||||
mqc->c += c << 9;
|
||||
mqc->ct = 7;
|
||||
}
|
||||
} else {
|
||||
mqc->bp++;
|
||||
mqc->c += c << 8;
|
||||
mqc->ct = 8;
|
||||
}
|
||||
} else {
|
||||
mqc->c += 0xff00;
|
||||
mqc->ct = 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) {
|
||||
do {
|
||||
if (mqc->ct == 0) {
|
||||
opj_mqc_bytein(mqc);
|
||||
}
|
||||
mqc->a <<= 1;
|
||||
mqc->c <<= 1;
|
||||
mqc->ct--;
|
||||
} while (mqc->a < 0x8000);
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
MQ-Coder interface
|
||||
@ -362,7 +271,9 @@ static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) {
|
||||
opj_mqc_t* opj_mqc_create(void) {
|
||||
opj_mqc_t *mqc = (opj_mqc_t*)opj_malloc(sizeof(opj_mqc_t));
|
||||
#ifdef MQC_PERF_OPT
|
||||
mqc->buffer = NULL;
|
||||
if (mqc) {
|
||||
mqc->buffer = NULL;
|
||||
}
|
||||
#endif
|
||||
return mqc;
|
||||
}
|
||||
@ -370,7 +281,9 @@ opj_mqc_t* opj_mqc_create(void) {
|
||||
void opj_mqc_destroy(opj_mqc_t *mqc) {
|
||||
if(mqc) {
|
||||
#ifdef MQC_PERF_OPT
|
||||
opj_free(mqc->buffer);
|
||||
if (mqc->buffer) {
|
||||
opj_free(mqc->buffer);
|
||||
}
|
||||
#endif
|
||||
opj_free(mqc);
|
||||
}
|
||||
@ -391,9 +304,6 @@ void opj_mqc_init_enc(opj_mqc_t *mqc, OPJ_BYTE *bp) {
|
||||
mqc->c = 0;
|
||||
mqc->bp = bp - 1;
|
||||
mqc->ct = 12;
|
||||
if (*mqc->bp == 0xff) {
|
||||
mqc->ct = 13;
|
||||
}
|
||||
mqc->start = bp;
|
||||
}
|
||||
|
||||
@ -577,25 +487,6 @@ OPJ_BOOL opj_mqc_init_dec(opj_mqc_t *mqc, OPJ_BYTE *bp, OPJ_UINT32 len) {
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
mqc->a -= (*mqc->curctx)->qeval;
|
||||
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
|
||||
d = opj_mqc_lpsexchange(mqc);
|
||||
opj_mqc_renormd(mqc);
|
||||
} else {
|
||||
mqc->c -= (*mqc->curctx)->qeval << 16;
|
||||
if ((mqc->a & 0x8000) == 0) {
|
||||
d = opj_mqc_mpsexchange(mqc);
|
||||
opj_mqc_renormd(mqc);
|
||||
} else {
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void opj_mqc_resetstates(opj_mqc_t *mqc) {
|
||||
OPJ_UINT32 i;
|
||||
for (i = 0; i < MQC_NUMCTXS; i++) {
|
||||
|
@ -77,11 +77,14 @@ typedef struct opj_mqc {
|
||||
OPJ_BYTE *end;
|
||||
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
|
||||
opj_mqc_state_t **curctx;
|
||||
const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */
|
||||
#ifdef MQC_PERF_OPT
|
||||
unsigned char *buffer;
|
||||
#endif
|
||||
} opj_mqc_t;
|
||||
|
||||
#include "mqc_inl.h"
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
@ -198,7 +201,7 @@ Decode a symbol
|
||||
@param mqc MQC handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc);
|
||||
static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
159
src/lib/openjp2/mqc_inl.h
Normal file
159
src/lib/openjp2/mqc_inl.h
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __MQC_INL_H
|
||||
#define __MQC_INL_H
|
||||
/**
|
||||
FIXME DOC
|
||||
@param mqc MQC handle
|
||||
@return
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
|
||||
*mqc->curctx = (*mqc->curctx)->nlps;
|
||||
} else {
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
*mqc->curctx = (*mqc->curctx)->nmps;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
FIXME DOC
|
||||
@param mqc MQC handle
|
||||
@return
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
if (mqc->a < (*mqc->curctx)->qeval) {
|
||||
mqc->a = (*mqc->curctx)->qeval;
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
*mqc->curctx = (*mqc->curctx)->nmps;
|
||||
} else {
|
||||
mqc->a = (*mqc->curctx)->qeval;
|
||||
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
|
||||
*mqc->curctx = (*mqc->curctx)->nlps;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
Input a byte
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
#ifdef MQC_PERF_OPT
|
||||
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
|
||||
unsigned int i = *((unsigned int *) mqc->bp);
|
||||
mqc->c += i & 0xffff00;
|
||||
mqc->ct = i & 0x0f;
|
||||
mqc->bp += (i >> 2) & 0x04;
|
||||
}
|
||||
#else
|
||||
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
|
||||
if (mqc->bp != mqc->end) {
|
||||
OPJ_UINT32 c;
|
||||
if (mqc->bp + 1 != mqc->end) {
|
||||
c = *(mqc->bp + 1);
|
||||
} else {
|
||||
c = 0xff;
|
||||
}
|
||||
if (*mqc->bp == 0xff) {
|
||||
if (c > 0x8f) {
|
||||
mqc->c += 0xff00;
|
||||
mqc->ct = 8;
|
||||
} else {
|
||||
mqc->bp++;
|
||||
mqc->c += c << 9;
|
||||
mqc->ct = 7;
|
||||
}
|
||||
} else {
|
||||
mqc->bp++;
|
||||
mqc->c += c << 8;
|
||||
mqc->ct = 8;
|
||||
}
|
||||
} else {
|
||||
mqc->c += 0xff00;
|
||||
mqc->ct = 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Renormalize mqc->a and mqc->c while decoding
|
||||
@param mqc MQC handle
|
||||
*/
|
||||
static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) {
|
||||
do {
|
||||
if (mqc->ct == 0) {
|
||||
opj_mqc_bytein(mqc);
|
||||
}
|
||||
mqc->a <<= 1;
|
||||
mqc->c <<= 1;
|
||||
mqc->ct--;
|
||||
} while (mqc->a < 0x8000);
|
||||
}
|
||||
|
||||
/**
|
||||
Decode a symbol
|
||||
@param mqc MQC handle
|
||||
@return Returns the decoded symbol (0 or 1)
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) {
|
||||
OPJ_INT32 d;
|
||||
mqc->a -= (*mqc->curctx)->qeval;
|
||||
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
|
||||
d = opj_mqc_lpsexchange(mqc);
|
||||
opj_mqc_renormd(mqc);
|
||||
} else {
|
||||
mqc->c -= (*mqc->curctx)->qeval << 16;
|
||||
if ((mqc->a & 0x8000) == 0) {
|
||||
d = opj_mqc_mpsexchange(mqc);
|
||||
opj_mqc_renormd(mqc);
|
||||
} else {
|
||||
d = (OPJ_INT32)(*mqc->curctx)->mps;
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
#endif /* __MQC_INL_H */
|
@ -132,7 +132,7 @@ static OPJ_BOOL opj_seek_from_file (OPJ_OFF_T p_nb_bytes, FILE * p_user_data)
|
||||
#ifdef _WIN32
|
||||
#ifndef OPJ_STATIC
|
||||
BOOL APIENTRY
|
||||
DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
|
||||
OPJ_ARG_NOT_USED(lpReserved);
|
||||
OPJ_ARG_NOT_USED(hModule);
|
||||
@ -169,7 +169,6 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
|
||||
if (!l_codec){
|
||||
return 00;
|
||||
}
|
||||
memset(l_codec, 0, sizeof(opj_codec_private_t));
|
||||
|
||||
l_codec->is_decompressor = 1;
|
||||
|
||||
@ -240,6 +239,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
|
||||
OPJ_UINT32 res_factor,
|
||||
struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor;
|
||||
|
||||
l_codec->opj_set_threads =
|
||||
(OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_j2k_set_threads;
|
||||
|
||||
l_codec->m_codec = opj_j2k_create_decompress();
|
||||
|
||||
if (! l_codec->m_codec) {
|
||||
@ -316,6 +318,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
|
||||
OPJ_UINT32 res_factor,
|
||||
opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor;
|
||||
|
||||
l_codec->opj_set_threads =
|
||||
(OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_jp2_set_threads;
|
||||
|
||||
l_codec->m_codec = opj_jp2_create(OPJ_TRUE);
|
||||
|
||||
if (! l_codec->m_codec) {
|
||||
@ -355,6 +360,18 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec,
|
||||
int num_threads)
|
||||
{
|
||||
if (p_codec && (num_threads >= 0)) {
|
||||
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
|
||||
|
||||
return l_codec->opj_set_threads(l_codec->m_codec, (OPJ_UINT32)num_threads);
|
||||
}
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
|
||||
opj_dparameters_t *parameters
|
||||
)
|
||||
@ -525,14 +542,12 @@ OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec,
|
||||
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
|
||||
|
||||
if ( !l_codec ){
|
||||
fprintf(stderr, "[ERROR] Input parameters of the setup_decoder function are incorrect.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor(l_codec->m_codec,
|
||||
return l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor(l_codec->m_codec,
|
||||
res_factor,
|
||||
&(l_codec->m_event_mgr) );
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -546,7 +561,6 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
|
||||
if (!l_codec) {
|
||||
return 00;
|
||||
}
|
||||
memset(l_codec, 0, sizeof(opj_codec_private_t));
|
||||
|
||||
l_codec->is_decompressor = 0;
|
||||
|
||||
@ -574,7 +588,7 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
|
||||
|
||||
l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_j2k_destroy;
|
||||
|
||||
l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) ( void *,
|
||||
l_codec->m_codec_data.m_compression.opj_setup_encoder = (OPJ_BOOL (*) ( void *,
|
||||
opj_cparameters_t *,
|
||||
struct opj_image *,
|
||||
struct opj_event_mgr * )) opj_j2k_setup_encoder;
|
||||
@ -611,7 +625,7 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
|
||||
|
||||
l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_jp2_destroy;
|
||||
|
||||
l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) ( void *,
|
||||
l_codec->m_codec_data.m_compression.opj_setup_encoder = (OPJ_BOOL (*) ( void *,
|
||||
opj_cparameters_t *,
|
||||
struct opj_image *,
|
||||
struct opj_event_mgr * )) opj_jp2_setup_encoder;
|
||||
@ -702,11 +716,10 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec,
|
||||
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
|
||||
|
||||
if (! l_codec->is_decompressor) {
|
||||
l_codec->m_codec_data.m_compression.opj_setup_encoder( l_codec->m_codec,
|
||||
return l_codec->m_codec_data.m_compression.opj_setup_encoder( l_codec->m_codec,
|
||||
parameters,
|
||||
p_image,
|
||||
&(l_codec->m_event_mgr) );
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -871,7 +884,8 @@ void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec,
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "[ERROR] Input parameter of the dump_codec function are incorrect.\n");
|
||||
/* TODO return error */
|
||||
/* fprintf(stderr, "[ERROR] Input parameter of the dump_codec function are incorrect.\n"); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,29 +78,33 @@ Most compilers implement their own version of this keyword ...
|
||||
|
||||
#if defined(OPJ_STATIC) || !defined(_WIN32)
|
||||
/* http://gcc.gnu.org/wiki/Visibility */
|
||||
#if __GNUC__ >= 4
|
||||
#define OPJ_API __attribute__ ((visibility ("default")))
|
||||
#define OPJ_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
# if __GNUC__ >= 4
|
||||
# if defined(OPJ_STATIC) /* static library uses "hidden" */
|
||||
# define OPJ_API __attribute__ ((visibility ("hidden")))
|
||||
# else
|
||||
# define OPJ_API __attribute__ ((visibility ("default")))
|
||||
# endif
|
||||
# define OPJ_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
# else
|
||||
# define OPJ_API
|
||||
# define OPJ_LOCAL
|
||||
# endif
|
||||
# define OPJ_CALLCONV
|
||||
#else
|
||||
#define OPJ_API
|
||||
#define OPJ_LOCAL
|
||||
#endif
|
||||
#define OPJ_CALLCONV
|
||||
#else
|
||||
#define OPJ_CALLCONV __stdcall
|
||||
# define OPJ_CALLCONV __stdcall
|
||||
/*
|
||||
The following ifdef block is the standard way of creating macros which make exporting
|
||||
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
|
||||
symbol defined on the command line. this symbol should not be defined on any project
|
||||
that uses this DLL. This way any other project whose source files include this file see
|
||||
OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
OPJ_API functions as being imported from a DLL, whereas this DLL sees symbols
|
||||
defined with this macro as being exported.
|
||||
*/
|
||||
#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
|
||||
#define OPJ_API __declspec(dllexport)
|
||||
#else
|
||||
#define OPJ_API __declspec(dllimport)
|
||||
#endif /* OPJ_EXPORTS */
|
||||
# if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
|
||||
# define OPJ_API __declspec(dllexport)
|
||||
# else
|
||||
# define OPJ_API __declspec(dllimport)
|
||||
# endif /* OPJ_EXPORTS */
|
||||
#endif /* !OPJ_STATIC || !_WIN32 */
|
||||
|
||||
typedef int OPJ_BOOL;
|
||||
@ -846,7 +850,7 @@ typedef struct opj_codestream_info {
|
||||
} opj_codestream_info_t;
|
||||
|
||||
/* <----------------------------------------------------------- */
|
||||
/* new output managment of the codestream information and index */
|
||||
/* new output management of the codestream information and index */
|
||||
|
||||
/**
|
||||
* Tile-component coding parameters information
|
||||
@ -1258,6 +1262,25 @@ OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *
|
||||
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
|
||||
opj_dparameters_t *parameters );
|
||||
|
||||
/**
|
||||
* Allocates worker threads for the compressor/decompressor.
|
||||
*
|
||||
* By default, only the main thread is used. If this function is not used,
|
||||
* but the OPJ_NUM_THREADS environment variable is set, its value will be
|
||||
* used to initialize the number of threads. The value can be either an integer
|
||||
* number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called,
|
||||
* this function will override the behaviour of the environment variable.
|
||||
*
|
||||
* Note: currently only has effect on the decompressor.
|
||||
*
|
||||
* @param p_codec decompressor handler
|
||||
* @param num_threads number of threads.
|
||||
*
|
||||
* @return OPJ_TRUE if the decoder is correctly set
|
||||
*/
|
||||
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec,
|
||||
int num_threads);
|
||||
|
||||
/**
|
||||
* Decodes an image header.
|
||||
*
|
||||
@ -1343,7 +1366,7 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec,
|
||||
opj_stream_t *p_stream );
|
||||
|
||||
/**
|
||||
* Reads a tile header. This function is compulsory and allows one to know the size of the tile thta will be decoded.
|
||||
* Reads a tile header. This function is compulsory and allows one to know the size of the tile that will be decoded.
|
||||
* The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.
|
||||
*
|
||||
* @param p_codec the jpeg2000 codec.
|
||||
@ -1550,6 +1573,19 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT( opj_cparameters_t *parameters,
|
||||
OPJ_INT32 * p_dc_shift,
|
||||
OPJ_UINT32 pNbComp);
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Thread functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
/** Returns if the library is built with thread support.
|
||||
* OPJ_TRUE if mutex, condition, thread, thread pool are available.
|
||||
*/
|
||||
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void);
|
||||
|
||||
/** Return the number of virtual CPUs */
|
||||
OPJ_API int OPJ_CALLCONV opj_get_num_cpus(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,6 +29,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
@ -36,7 +38,6 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/times.h>
|
||||
#endif /* _WIN32 */
|
||||
#include "opj_includes.h"
|
||||
|
||||
OPJ_FLOAT64 opj_clock(void) {
|
||||
#ifdef _WIN32
|
||||
|
@ -113,6 +113,7 @@ typedef struct opj_codec_private
|
||||
OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec,
|
||||
OPJ_UINT32 res_factor,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
} m_decompression;
|
||||
|
||||
/**
|
||||
@ -142,10 +143,10 @@ typedef struct opj_codec_private
|
||||
|
||||
void (* opj_destroy) (void * p_codec);
|
||||
|
||||
void (* opj_setup_encoder) ( void * p_codec,
|
||||
opj_cparameters_t * p_param,
|
||||
struct opj_image * p_image,
|
||||
struct opj_event_mgr * p_manager);
|
||||
OPJ_BOOL (* opj_setup_encoder) ( void * p_codec,
|
||||
opj_cparameters_t * p_param,
|
||||
struct opj_image * p_image,
|
||||
struct opj_event_mgr * p_manager);
|
||||
} m_compression;
|
||||
} m_codec_data;
|
||||
/** FIXME DOC*/
|
||||
@ -157,6 +158,9 @@ typedef struct opj_codec_private
|
||||
void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
|
||||
opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec);
|
||||
opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec);
|
||||
|
||||
/** Set number of threads */
|
||||
OPJ_BOOL (*opj_set_threads) ( void * p_codec, OPJ_UINT32 num_threads );
|
||||
}
|
||||
opj_codec_private_t;
|
||||
|
||||
|
@ -17,6 +17,24 @@
|
||||
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
||||
#cmakedefine OPJ_HAVE_FSEEKO @OPJ_HAVE_FSEEKO@
|
||||
|
||||
/* find whether or not have <malloc.h> */
|
||||
#cmakedefine OPJ_HAVE_MALLOC_H
|
||||
/* check if function `aligned_alloc` exists */
|
||||
#cmakedefine OPJ_HAVE_ALIGNED_ALLOC
|
||||
/* check if function `_aligned_malloc` exists */
|
||||
#cmakedefine OPJ_HAVE__ALIGNED_MALLOC
|
||||
/* check if function `memalign` exists */
|
||||
#cmakedefine OPJ_HAVE_MEMALIGN
|
||||
/* check if function `posix_memalign` exists */
|
||||
#cmakedefine OPJ_HAVE_POSIX_MEMALIGN
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE)
|
||||
#if defined(OPJ_HAVE_FSEEKO) || defined(OPJ_HAVE_POSIX_MEMALIGN)
|
||||
/* Get declarations of fseeko, ftello, posix_memalign. */
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Byte order. */
|
||||
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
|
||||
__LITTLE_ENDIAN__ to match the endianness of the architecture being
|
||||
@ -28,4 +46,4 @@ On other platforms we use the result of the TRY_RUN. */
|
||||
#cmakedefine OPJ_BIG_ENDIAN
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
# define OPJ_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
Use fseeko() and ftello() if they are available since they use
|
||||
@ -102,48 +103,101 @@
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
/* Ignore GCC attributes if this is not GCC */
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) /* __attribute__(x) */
|
||||
#endif
|
||||
|
||||
|
||||
/* Are restricted pointers available? (C99) */
|
||||
#if (__STDC_VERSION__ != 199901L)
|
||||
#if (__STDC_VERSION__ >= 199901L)
|
||||
#define OPJ_RESTRICT restrict
|
||||
#else
|
||||
/* Not a C99 compiler */
|
||||
#ifdef __GNUC__
|
||||
#define restrict __restrict__
|
||||
#if defined(__GNUC__)
|
||||
#define OPJ_RESTRICT __restrict__
|
||||
|
||||
/*
|
||||
vc14 (2015) outputs wrong results.
|
||||
Need to check OPJ_RESTRICT usage (or a bug in vc14)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define OPJ_RESTRICT __restrict
|
||||
*/
|
||||
#else
|
||||
#define restrict /* restrict */
|
||||
#define OPJ_RESTRICT /* restrict */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __has_attribute
|
||||
#if __has_attribute(no_sanitize)
|
||||
#define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPJ_NOSANITIZE
|
||||
#define OPJ_NOSANITIZE(kind)
|
||||
#endif
|
||||
|
||||
|
||||
/* MSVC before 2013 and Borland C do not have lrintf */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800) || defined(__BORLANDC__)
|
||||
static INLINE long lrintf(float f){
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
static INLINE long opj_lrintf(float f){
|
||||
#ifdef _M_X64
|
||||
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||
#else
|
||||
return _mm_cvt_ss2si(_mm_load_ss(&f));
|
||||
|
||||
/* commented out line breaks many tests */
|
||||
/* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
|
||||
#elif defined(_M_IX86)
|
||||
int i;
|
||||
|
||||
_asm{
|
||||
_asm{
|
||||
fld f
|
||||
fistp i
|
||||
};
|
||||
|
||||
return i;
|
||||
#else
|
||||
return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
|
||||
#endif
|
||||
}
|
||||
#elif defined(__BORLANDC__)
|
||||
static INLINE long opj_lrintf(float f) {
|
||||
#ifdef _M_X64
|
||||
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||
#else
|
||||
int i;
|
||||
|
||||
_asm {
|
||||
fld f
|
||||
fistp i
|
||||
};
|
||||
|
||||
return i;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static INLINE long opj_lrintf(float f) {
|
||||
return lrintf(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
/* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrinsic. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(__emul)
|
||||
#endif
|
||||
|
||||
/* Type to use for bit-fields in internal headers */
|
||||
typedef unsigned int OPJ_BITFIELD;
|
||||
|
||||
#include "opj_inttypes.h"
|
||||
#include "opj_clock.h"
|
||||
#include "opj_malloc.h"
|
||||
#include "function_list.h"
|
||||
#include "event.h"
|
||||
#include "function_list.h"
|
||||
#include "bio.h"
|
||||
#include "cio.h"
|
||||
|
||||
#include "thread.h"
|
||||
#include "tls_keys.h"
|
||||
|
||||
#include "image.h"
|
||||
#include "invert.h"
|
||||
#include "j2k.h"
|
||||
|
@ -81,6 +81,15 @@ static INLINE OPJ_UINT32 opj_uint_max(OPJ_UINT32 a, OPJ_UINT32 b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the saturated sum of two unsigned integers
|
||||
@return Returns saturated sum of a+b
|
||||
*/
|
||||
static INLINE OPJ_UINT32 opj_uint_adds(OPJ_UINT32 a, OPJ_UINT32 b) {
|
||||
OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
|
||||
return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
|
||||
}
|
||||
|
||||
/**
|
||||
Clamp an integer inside an interval
|
||||
@return
|
||||
@ -108,7 +117,7 @@ Divide an integer and round upwards
|
||||
@return Returns a divided by b
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
|
||||
assert(b);
|
||||
assert(b);
|
||||
return (a + b - 1) / b;
|
||||
}
|
||||
|
||||
@ -117,6 +126,7 @@ Divide an integer and round upwards
|
||||
@return Returns a divided by b
|
||||
*/
|
||||
static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b) {
|
||||
assert(b);
|
||||
return (a + b - 1) / b;
|
||||
}
|
||||
|
||||
@ -125,8 +135,25 @@ Divide an integer by a power of 2 and round upwards
|
||||
@return Returns a divided by 2^b
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
|
||||
return (OPJ_INT32)((a + (OPJ_INT64)(1 << b) - 1) >> b);
|
||||
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
|
||||
}
|
||||
|
||||
/**
|
||||
Divide a 64bits integer by a power of 2 and round upwards
|
||||
@return Returns a divided by 2^b
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b) {
|
||||
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
|
||||
}
|
||||
|
||||
/**
|
||||
Divide an integer by a power of 2 and round upwards
|
||||
@return Returns a divided by 2^b
|
||||
*/
|
||||
static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b) {
|
||||
return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
|
||||
}
|
||||
|
||||
/**
|
||||
Divide an integer by a power of 2 and round downwards
|
||||
@return Returns a divided by 2^b
|
||||
@ -165,9 +192,27 @@ Multiply two fixed-precision rational numbers.
|
||||
@return Returns a * b
|
||||
*/
|
||||
static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
|
||||
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
|
||||
temp += temp & 4096;
|
||||
return (OPJ_INT32) (temp >> 13) ;
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
|
||||
OPJ_INT64 temp = __emul(a, b);
|
||||
#else
|
||||
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
|
||||
#endif
|
||||
temp += 4096;
|
||||
assert((temp >> 13) <= (OPJ_INT64)0x7FFFFFFF);
|
||||
assert((temp >> 13) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1));
|
||||
return (OPJ_INT32) (temp >> 13);
|
||||
}
|
||||
|
||||
static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b) {
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
|
||||
OPJ_INT64 temp = __emul(a, b);
|
||||
#else
|
||||
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
|
||||
#endif
|
||||
temp += 4096;
|
||||
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) <= (OPJ_INT64)0x7FFFFFFF);
|
||||
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1));
|
||||
return (OPJ_INT32) (temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) ;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
239
src/lib/openjp2/opj_malloc.c
Normal file
239
src/lib/openjp2/opj_malloc.c
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
* 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) 2015, Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
* Copyright (c) 2015, Matthieu Darbois
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define OPJ_SKIP_POISON
|
||||
#include "opj_includes.h"
|
||||
|
||||
#if defined(OPJ_HAVE_MALLOC_H) && defined(OPJ_HAVE_MEMALIGN)
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
|
||||
static INLINE void *opj_aligned_alloc_n(size_t alignment, size_t size)
|
||||
{
|
||||
void* ptr;
|
||||
|
||||
/* alignment shall be power of 2 */
|
||||
assert( (alignment != 0U) && ((alignment & (alignment - 1U)) == 0U));
|
||||
/* alignment shall be at least sizeof(void*) */
|
||||
assert( alignment >= sizeof(void*));
|
||||
|
||||
if (size == 0U) { /* prevent implementation defined behavior of realloc */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(OPJ_HAVE_POSIX_MEMALIGN)
|
||||
/* aligned_alloc requires c11, restrict to posix_memalign for now. Quote:
|
||||
* This function was introduced in POSIX 1003.1d. Although this function is
|
||||
* superseded by aligned_alloc, it is more portable to older POSIX systems
|
||||
* that do not support ISO C11. */
|
||||
if (posix_memalign (&ptr, alignment, size))
|
||||
{
|
||||
ptr = NULL;
|
||||
}
|
||||
/* older linux */
|
||||
#elif defined(OPJ_HAVE_MEMALIGN)
|
||||
ptr = memalign( alignment, size );
|
||||
/* _MSC_VER */
|
||||
#elif defined(OPJ_HAVE__ALIGNED_MALLOC)
|
||||
ptr = _aligned_malloc(size, alignment);
|
||||
#else
|
||||
/*
|
||||
* Generic aligned malloc implementation.
|
||||
* Uses size_t offset for the integer manipulation of the pointer,
|
||||
* as uintptr_t is not available in C89 to do
|
||||
* bitwise operations on the pointer itself.
|
||||
*/
|
||||
alignment--;
|
||||
{
|
||||
size_t offset;
|
||||
OPJ_UINT8 *mem;
|
||||
|
||||
/* Room for padding and extra pointer stored in front of allocated area */
|
||||
size_t overhead = alignment + sizeof(void *);
|
||||
|
||||
/* let's be extra careful */
|
||||
assert(alignment <= (SIZE_MAX - sizeof(void *)));
|
||||
|
||||
/* Avoid integer overflow */
|
||||
if (size > (SIZE_MAX - overhead)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mem = (OPJ_UINT8*)malloc(size + overhead);
|
||||
if (mem == NULL) {
|
||||
return mem;
|
||||
}
|
||||
/* offset = ((alignment + 1U) - ((size_t)(mem + sizeof(void*)) & alignment)) & alignment; */
|
||||
/* Use the fact that alignment + 1U is a power of 2 */
|
||||
offset = ((alignment ^ ((size_t)(mem + sizeof(void*)) & alignment)) + 1U) & alignment;
|
||||
ptr = (void *)(mem + sizeof(void*) + offset);
|
||||
((void**) ptr)[-1] = mem;
|
||||
}
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
static INLINE void *opj_aligned_realloc_n(void *ptr, size_t alignment, size_t new_size)
|
||||
{
|
||||
void *r_ptr;
|
||||
|
||||
/* alignment shall be power of 2 */
|
||||
assert( (alignment != 0U) && ((alignment & (alignment - 1U)) == 0U));
|
||||
/* alignment shall be at least sizeof(void*) */
|
||||
assert( alignment >= sizeof(void*));
|
||||
|
||||
if (new_size == 0U) { /* prevent implementation defined behavior of realloc */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* no portable aligned realloc */
|
||||
#if defined(OPJ_HAVE_POSIX_MEMALIGN) || defined(OPJ_HAVE_MEMALIGN)
|
||||
/* glibc doc states one can mix aligned malloc with realloc */
|
||||
r_ptr = realloc( ptr, new_size ); /* fast path */
|
||||
/* we simply use `size_t` to cast, since we are only interest in binary AND
|
||||
* operator */
|
||||
if( ((size_t)r_ptr & (alignment - 1U)) != 0U ) {
|
||||
/* this is non-trivial to implement a portable aligned realloc, so use a
|
||||
* simple approach where we do not need a function that return the size of an
|
||||
* allocated array (eg. _msize on Windows, malloc_size on MacOS,
|
||||
* malloc_usable_size on systems with glibc) */
|
||||
void *a_ptr = opj_aligned_alloc_n(alignment, new_size);
|
||||
if (a_ptr != NULL) {
|
||||
memcpy(a_ptr, r_ptr, new_size);
|
||||
}
|
||||
free( r_ptr );
|
||||
r_ptr = a_ptr;
|
||||
}
|
||||
/* _MSC_VER */
|
||||
#elif defined(OPJ_HAVE__ALIGNED_MALLOC)
|
||||
r_ptr = _aligned_realloc( ptr, new_size, alignment );
|
||||
#else
|
||||
if (ptr == NULL) {
|
||||
return opj_aligned_alloc_n(alignment, new_size);
|
||||
}
|
||||
alignment--;
|
||||
{
|
||||
void *oldmem;
|
||||
OPJ_UINT8 *newmem;
|
||||
size_t overhead = alignment + sizeof(void *);
|
||||
|
||||
/* let's be extra careful */
|
||||
assert(alignment <= (SIZE_MAX - sizeof(void *)));
|
||||
|
||||
/* Avoid integer overflow */
|
||||
if (new_size > SIZE_MAX - overhead) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
oldmem = ((void**) ptr)[-1];
|
||||
newmem = (OPJ_UINT8*)realloc(oldmem, new_size + overhead);
|
||||
if (newmem == NULL) {
|
||||
return newmem;
|
||||
}
|
||||
|
||||
if (newmem == oldmem) {
|
||||
r_ptr = ptr;
|
||||
}
|
||||
else {
|
||||
size_t old_offset;
|
||||
size_t new_offset;
|
||||
|
||||
/* realloc created a new copy, realign the copied memory block */
|
||||
old_offset = (size_t)((OPJ_UINT8*)ptr - (OPJ_UINT8*)oldmem);
|
||||
|
||||
/* offset = ((alignment + 1U) - ((size_t)(mem + sizeof(void*)) & alignment)) & alignment; */
|
||||
/* Use the fact that alignment + 1U is a power of 2 */
|
||||
new_offset = ((alignment ^ ((size_t)(newmem + sizeof(void*)) & alignment)) + 1U) & alignment;
|
||||
new_offset += sizeof(void*);
|
||||
r_ptr = (void *)(newmem + new_offset);
|
||||
|
||||
if (new_offset != old_offset) {
|
||||
memmove(newmem + new_offset, newmem + old_offset, new_size);
|
||||
}
|
||||
((void**) r_ptr)[-1] = newmem;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return r_ptr;
|
||||
}
|
||||
void * opj_malloc(size_t size)
|
||||
{
|
||||
if (size == 0U) { /* prevent implementation defined behavior of realloc */
|
||||
return NULL;
|
||||
}
|
||||
return malloc(size);
|
||||
}
|
||||
void * opj_calloc(size_t num, size_t size)
|
||||
{
|
||||
if (num == 0 || size == 0) {
|
||||
/* prevent implementation defined behavior of realloc */
|
||||
return NULL;
|
||||
}
|
||||
return calloc(num, size);
|
||||
}
|
||||
|
||||
void *opj_aligned_malloc(size_t size)
|
||||
{
|
||||
return opj_aligned_alloc_n(16U, size);
|
||||
}
|
||||
void * opj_aligned_realloc(void *ptr, size_t size)
|
||||
{
|
||||
return opj_aligned_realloc_n(ptr, 16U, size);
|
||||
}
|
||||
|
||||
void opj_aligned_free(void* ptr)
|
||||
{
|
||||
#if defined(OPJ_HAVE_POSIX_MEMALIGN) || defined(OPJ_HAVE_MEMALIGN)
|
||||
free( ptr );
|
||||
#elif defined(OPJ_HAVE__ALIGNED_MALLOC)
|
||||
_aligned_free( ptr );
|
||||
#else
|
||||
/* Generic implementation has malloced pointer stored in front of used area */
|
||||
if (ptr != NULL) {
|
||||
free(((void**) ptr)[-1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void * opj_realloc(void *ptr, size_t new_size)
|
||||
{
|
||||
if (new_size == 0U) { /* prevent implementation defined behavior of realloc */
|
||||
return NULL;
|
||||
}
|
||||
return realloc(ptr, new_size);
|
||||
}
|
||||
void opj_free(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
@ -31,6 +31,8 @@
|
||||
*/
|
||||
#ifndef __OPJ_MALLOC_H
|
||||
#define __OPJ_MALLOC_H
|
||||
|
||||
#include <stddef.h>
|
||||
/**
|
||||
@file opj_malloc.h
|
||||
@brief Internal functions
|
||||
@ -50,16 +52,7 @@ Allocate an uninitialized memory block
|
||||
@param size Bytes to allocate
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void * OPJ_CALLCONV opj_malloc(size_t size);
|
||||
#else
|
||||
/* prevent assertion on overflow for MSVC */
|
||||
#ifdef _MSC_VER
|
||||
#define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size))
|
||||
#else
|
||||
#define opj_malloc(size) malloc(size)
|
||||
#endif
|
||||
#endif
|
||||
void * opj_malloc(size_t size);
|
||||
|
||||
/**
|
||||
Allocate a memory block with elements initialized to 0
|
||||
@ -67,83 +60,16 @@ Allocate a memory block with elements initialized to 0
|
||||
@param size Bytes per block to allocate
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void * OPJ_CALLCONV opj_calloc(size_t _NumOfElements, size_t _SizeOfElements);
|
||||
#else
|
||||
/* prevent assertion on overflow for MSVC */
|
||||
#ifdef _MSC_VER
|
||||
#define opj_calloc(num, size) ((size_t)(num) != 0 && (size_t)(num) >= (size_t)-0x100 / (size_t)(size) ? NULL : calloc(num, size))
|
||||
#else
|
||||
#define opj_calloc(num, size) calloc(num, size)
|
||||
#endif
|
||||
#endif
|
||||
void * opj_calloc(size_t numOfElements, size_t sizeOfElements);
|
||||
|
||||
/**
|
||||
Allocate memory aligned to a 16 byte boundry
|
||||
Allocate memory aligned to a 16 byte boundary
|
||||
@param size Bytes to allocate
|
||||
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
|
||||
*/
|
||||
/* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */
|
||||
#ifdef _WIN32
|
||||
/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */
|
||||
#ifdef __GNUC__
|
||||
#include <mm_malloc.h>
|
||||
#define HAVE_MM_MALLOC
|
||||
#else /* MSVC, Intel C++ */
|
||||
#include <malloc.h>
|
||||
#ifdef _mm_malloc
|
||||
#define HAVE_MM_MALLOC
|
||||
#endif
|
||||
#endif
|
||||
#else /* Not _WIN32 */
|
||||
#if defined(__sun)
|
||||
#define HAVE_MEMALIGN
|
||||
#elif defined(__FreeBSD__)
|
||||
#define HAVE_POSIX_MEMALIGN
|
||||
/* Linux x86_64 and OSX always align allocations to 16 bytes */
|
||||
#elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX)
|
||||
#define HAVE_MEMALIGN
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define opj_aligned_malloc(size) malloc(size)
|
||||
#define opj_aligned_free(m) free(m)
|
||||
|
||||
#ifdef HAVE_MM_MALLOC
|
||||
#undef opj_aligned_malloc
|
||||
#define opj_aligned_malloc(size) _mm_malloc(size, 16)
|
||||
#undef opj_aligned_free
|
||||
#define opj_aligned_free(m) _mm_free(m)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMALIGN
|
||||
extern void* memalign(size_t, size_t);
|
||||
#undef opj_aligned_malloc
|
||||
#define opj_aligned_malloc(size) memalign(16, (size))
|
||||
#undef opj_aligned_free
|
||||
#define opj_aligned_free(m) free(m)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
#undef opj_aligned_malloc
|
||||
extern int posix_memalign(void**, size_t, size_t);
|
||||
|
||||
static INLINE void* __attribute__ ((malloc)) opj_aligned_malloc(size_t size){
|
||||
void* mem = NULL;
|
||||
posix_memalign(&mem, 16, size);
|
||||
return mem;
|
||||
}
|
||||
#undef opj_aligned_free
|
||||
#define opj_aligned_free(m) free(m)
|
||||
#endif
|
||||
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
#undef opj_aligned_malloc
|
||||
#define opj_aligned_malloc(size) opj_malloc(size)
|
||||
#undef opj_aligned_free
|
||||
#define opj_aligned_free(m) opj_free(m)
|
||||
#endif
|
||||
void * opj_aligned_malloc(size_t size);
|
||||
void * opj_aligned_realloc(void *ptr, size_t size);
|
||||
void opj_aligned_free(void* ptr);
|
||||
|
||||
/**
|
||||
Reallocate memory blocks.
|
||||
@ -151,28 +77,15 @@ Reallocate memory blocks.
|
||||
@param s New size in bytes
|
||||
@return Returns a void pointer to the reallocated (and possibly moved) memory block
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void * OPJ_CALLCONV opj_realloc(void * m, size_t s);
|
||||
#else
|
||||
/* prevent assertion on overflow for MSVC */
|
||||
#ifdef _MSC_VER
|
||||
#define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s))
|
||||
#else
|
||||
#define opj_realloc(m, s) realloc(m, s)
|
||||
#endif
|
||||
#endif
|
||||
void * opj_realloc(void * m, size_t s);
|
||||
|
||||
/**
|
||||
Deallocates or frees a memory block.
|
||||
@param m Previously allocated memory block to be freed
|
||||
*/
|
||||
#ifdef ALLOC_PERF_OPT
|
||||
void OPJ_CALLCONV opj_free(void * m);
|
||||
#else
|
||||
#define opj_free(m) free(m)
|
||||
#endif
|
||||
void opj_free(void * m);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(OPJ_SKIP_POISON)
|
||||
#pragma GCC poison malloc calloc realloc free
|
||||
#endif
|
||||
|
||||
|
@ -57,7 +57,9 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
|
||||
OPJ_OFF_T lenp = 0;
|
||||
|
||||
box = (opj_jp2_box_t *)opj_calloc( (size_t)cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||
|
||||
if(box == NULL){
|
||||
return 0;
|
||||
}
|
||||
for( i=0;i<2;i++){
|
||||
if (i)
|
||||
opj_stream_seek( cio, lenp, p_manager);
|
||||
|
@ -136,10 +136,10 @@ static void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
|
||||
* @param p_tx1 pointer that will hold the X1 parameter for the tile
|
||||
* @param p_ty0 pointer that will hold the Y0 parameter for the tile
|
||||
* @param p_ty1 pointer that will hold the Y1 parameter for the tile
|
||||
* @param p_max_prec pointer that will hold the the maximum precision for all the bands of the tile
|
||||
* @param p_max_res pointer that will hold the the maximum number of resolutions for all the poc inside the tile.
|
||||
* @param p_dx_min pointer that will hold the the minimum dx of all the components of all the resolutions for the tile.
|
||||
* @param p_dy_min pointer that will hold the the minimum dy of all the components of all the resolutions for the tile.
|
||||
* @param p_max_prec pointer that will hold the maximum precision for all the bands of the tile
|
||||
* @param p_max_res pointer that will hold the maximum number of resolutions for all the poc inside the tile.
|
||||
* @param p_dx_min pointer that will hold the minimum dx of all the components of all the resolutions for the tile.
|
||||
* @param p_dy_min pointer that will hold the minimum dy of all the components of all the resolutions for the tile.
|
||||
*/
|
||||
static void opj_get_encoding_parameters(const opj_image_t *p_image,
|
||||
const opj_cp_t *p_cp,
|
||||
@ -167,10 +167,10 @@ static void opj_get_encoding_parameters(const opj_image_t *p_image,
|
||||
* @param p_tx1 pointer that will hold the X1 parameter for the tile
|
||||
* @param p_ty0 pointer that will hold the Y0 parameter for the tile
|
||||
* @param p_ty1 pointer that will hold the Y1 parameter for the tile
|
||||
* @param p_max_prec pointer that will hold the the maximum precision for all the bands of the tile
|
||||
* @param p_max_res pointer that will hold the the maximum number of resolutions for all the poc inside the tile.
|
||||
* @param p_dx_min pointer that will hold the the minimum dx of all the components of all the resolutions for the tile.
|
||||
* @param p_dy_min pointer that will hold the the minimum dy of all the components of all the resolutions for the tile.
|
||||
* @param p_max_prec pointer that will hold the maximum precision for all the bands of the tile
|
||||
* @param p_max_res pointer that will hold the maximum number of resolutions for all the poc inside the tile.
|
||||
* @param p_dx_min pointer that will hold the minimum dx of all the components of all the resolutions for the tile.
|
||||
* @param p_dy_min pointer that will hold the minimum dy of all the components of all the resolutions for the tile.
|
||||
* @param p_resolutions pointer to an area corresponding to the one described above.
|
||||
*/
|
||||
static void opj_get_all_encoding_parameters(const opj_image_t *p_image,
|
||||
@ -214,7 +214,7 @@ static void opj_pi_update_decode_poc ( opj_pi_iterator_t * p_pi,
|
||||
/**
|
||||
* FIXME DOC
|
||||
*/
|
||||
OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
static OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
opj_cp_t *cp,
|
||||
OPJ_UINT32 tileno,
|
||||
OPJ_UINT32 pino,
|
||||
@ -230,7 +230,7 @@ OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
OPJ_BOOL opj_pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||
static OPJ_BOOL opj_pi_next_lrcp(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
OPJ_UINT32 index = 0;
|
||||
@ -270,7 +270,7 @@ LABEL_SKIP:;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||
static OPJ_BOOL opj_pi_next_rlcp(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
OPJ_UINT32 index = 0;
|
||||
@ -309,7 +309,7 @@ LABEL_SKIP:;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi) {
|
||||
static OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
OPJ_UINT32 index = 0;
|
||||
@ -392,7 +392,7 @@ LABEL_SKIP:;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||
static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
OPJ_UINT32 index = 0;
|
||||
@ -473,7 +473,7 @@ LABEL_SKIP:;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||
static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
|
||||
opj_pi_comp_t *comp = NULL;
|
||||
opj_pi_resolution_t *res = NULL;
|
||||
OPJ_UINT32 index = 0;
|
||||
@ -552,7 +552,7 @@ LABEL_SKIP:;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
void opj_get_encoding_parameters( const opj_image_t *p_image,
|
||||
static void opj_get_encoding_parameters( const opj_image_t *p_image,
|
||||
const opj_cp_t *p_cp,
|
||||
OPJ_UINT32 p_tileno,
|
||||
OPJ_INT32 * p_tx0,
|
||||
@ -666,7 +666,7 @@ void opj_get_encoding_parameters( const opj_image_t *p_image,
|
||||
}
|
||||
|
||||
|
||||
void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
static void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
const opj_cp_t *p_cp,
|
||||
OPJ_UINT32 tileno,
|
||||
OPJ_INT32 * p_tx0,
|
||||
@ -693,6 +693,9 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
/* position in x and y of tile*/
|
||||
OPJ_UINT32 p, q;
|
||||
|
||||
/* non-corrected (in regard to image offset) tile offset */
|
||||
OPJ_UINT32 l_tx0, l_ty0;
|
||||
|
||||
/* preconditions in debug*/
|
||||
assert(p_cp != 00);
|
||||
assert(p_image != 00);
|
||||
@ -708,10 +711,12 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
q = tileno / p_cp->tw;
|
||||
|
||||
/* here calculation of tx0, tx1, ty0, ty1, maxprec, l_dx and l_dy */
|
||||
*p_tx0 = opj_int_max((OPJ_INT32)(p_cp->tx0 + p * p_cp->tdx), (OPJ_INT32)p_image->x0);
|
||||
*p_tx1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + (p + 1) * p_cp->tdx), (OPJ_INT32)p_image->x1);
|
||||
*p_ty0 = opj_int_max((OPJ_INT32)(p_cp->ty0 + q * p_cp->tdy), (OPJ_INT32)p_image->y0);
|
||||
*p_ty1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + (q + 1) * p_cp->tdy), (OPJ_INT32)p_image->y1);
|
||||
l_tx0 = p_cp->tx0 + p * p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */
|
||||
*p_tx0 = (OPJ_INT32)opj_uint_max(l_tx0, p_image->x0);
|
||||
*p_tx1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1);
|
||||
l_ty0 = p_cp->ty0 + q * p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */
|
||||
*p_ty0 = (OPJ_INT32)opj_uint_max(l_ty0, p_image->y0);
|
||||
*p_ty1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, p_cp->tdy), p_image->y1);
|
||||
|
||||
/* max precision and resolution is 0 (can only grow)*/
|
||||
*p_max_prec = 0;
|
||||
@ -742,10 +747,12 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
}
|
||||
|
||||
/* use custom size for precincts*/
|
||||
l_level_no = l_tccp->numresolutions - 1;
|
||||
l_level_no = l_tccp->numresolutions;
|
||||
for (resno = 0; resno < l_tccp->numresolutions; ++resno) {
|
||||
OPJ_UINT32 l_dx, l_dy;
|
||||
|
||||
--l_level_no;
|
||||
|
||||
/* precinct width and height*/
|
||||
l_pdx = l_tccp->prcw[resno];
|
||||
l_pdy = l_tccp->prch[resno];
|
||||
@ -777,14 +784,13 @@ void opj_get_all_encoding_parameters( const opj_image_t *p_image,
|
||||
*p_max_prec = l_product;
|
||||
}
|
||||
|
||||
--l_level_no;
|
||||
}
|
||||
++l_tccp;
|
||||
++l_img_comp;
|
||||
}
|
||||
}
|
||||
|
||||
opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
|
||||
static opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
|
||||
const opj_cp_t *cp,
|
||||
OPJ_UINT32 tileno )
|
||||
{
|
||||
@ -815,7 +821,6 @@ opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
|
||||
if (!l_pi) {
|
||||
return NULL;
|
||||
}
|
||||
memset(l_pi,0,l_poc_bound * sizeof(opj_pi_iterator_t));
|
||||
|
||||
l_current_pi = l_pi;
|
||||
for (pino = 0; pino < l_poc_bound ; ++pino) {
|
||||
@ -827,28 +832,26 @@ opj_pi_iterator_t * opj_pi_create( const opj_image_t *image,
|
||||
}
|
||||
|
||||
l_current_pi->numcomps = image->numcomps;
|
||||
memset(l_current_pi->comps,0,image->numcomps * sizeof(opj_pi_comp_t));
|
||||
|
||||
for (compno = 0; compno < image->numcomps; ++compno) {
|
||||
opj_pi_comp_t *comp = &l_current_pi->comps[compno];
|
||||
|
||||
tccp = &tcp->tccps[compno];
|
||||
|
||||
comp->resolutions = (opj_pi_resolution_t*) opj_malloc(tccp->numresolutions * sizeof(opj_pi_resolution_t));
|
||||
comp->resolutions = (opj_pi_resolution_t*) opj_calloc(tccp->numresolutions, sizeof(opj_pi_resolution_t));
|
||||
if (!comp->resolutions) {
|
||||
opj_pi_destroy(l_pi, l_poc_bound);
|
||||
return 00;
|
||||
}
|
||||
|
||||
comp->numresolutions = tccp->numresolutions;
|
||||
memset(comp->resolutions,0,tccp->numresolutions * sizeof(opj_pi_resolution_t));
|
||||
}
|
||||
++l_current_pi;
|
||||
}
|
||||
return l_pi;
|
||||
}
|
||||
|
||||
void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
|
||||
static void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
|
||||
OPJ_UINT32 p_tileno,
|
||||
OPJ_INT32 p_tx0,
|
||||
OPJ_INT32 p_tx1,
|
||||
@ -926,7 +929,7 @@ void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp,
|
||||
}
|
||||
}
|
||||
|
||||
void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
|
||||
static void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
|
||||
OPJ_UINT32 p_num_comps,
|
||||
OPJ_UINT32 p_tileno,
|
||||
OPJ_INT32 p_tx0,
|
||||
@ -981,7 +984,7 @@ void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
|
||||
}
|
||||
}
|
||||
|
||||
void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
|
||||
static void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
|
||||
opj_tcp_t * p_tcp,
|
||||
OPJ_UINT32 p_max_precision,
|
||||
OPJ_UINT32 p_max_res)
|
||||
@ -1023,7 +1026,7 @@ void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi,
|
||||
}
|
||||
}
|
||||
|
||||
void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
|
||||
static void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
|
||||
opj_tcp_t * p_tcp,
|
||||
OPJ_UINT32 p_max_precision,
|
||||
OPJ_UINT32 p_max_res)
|
||||
@ -1060,7 +1063,7 @@ void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
|
||||
|
||||
|
||||
|
||||
OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
static OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
opj_cp_t *cp,
|
||||
OPJ_UINT32 tileno,
|
||||
OPJ_UINT32 pino,
|
||||
@ -1108,7 +1111,8 @@ OPJ_BOOL opj_pi_check_next_level( OPJ_INT32 pos,
|
||||
break;
|
||||
case 'P':
|
||||
switch(tcp->prg){
|
||||
case OPJ_LRCP||OPJ_RLCP:
|
||||
case OPJ_LRCP: /* fall through */
|
||||
case OPJ_RLCP:
|
||||
if(tcp->prc_t == tcp->prcE){
|
||||
if(opj_pi_check_next_level(i-1,cp,tileno,pino,prog)){
|
||||
return OPJ_TRUE;
|
||||
@ -1233,16 +1237,21 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
|
||||
l_current_pi = l_pi;
|
||||
|
||||
/* memory allocation for include */
|
||||
l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
|
||||
if
|
||||
(!l_current_pi->include)
|
||||
/* prevent an integer overflow issue */
|
||||
/* 0 < l_tcp->numlayers < 65536 c.f. opj_j2k_read_cod in j2k.c */
|
||||
l_current_pi->include = 00;
|
||||
if (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))
|
||||
{
|
||||
l_current_pi->include = (OPJ_INT16*) opj_calloc((size_t)(l_tcp->numlayers + 1U) * l_step_l, sizeof(OPJ_INT16));
|
||||
}
|
||||
|
||||
if (!l_current_pi->include)
|
||||
{
|
||||
opj_free(l_tmp_data);
|
||||
opj_free(l_tmp_ptr);
|
||||
opj_pi_destroy(l_pi, l_bound);
|
||||
return 00;
|
||||
}
|
||||
memset(l_current_pi->include,0, (l_tcp->numlayers + 1) * l_step_l* sizeof(OPJ_INT16));
|
||||
|
||||
/* special treatment for the first packet iterator */
|
||||
l_current_comp = l_current_pi->comps;
|
||||
@ -1428,7 +1437,7 @@ opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
|
||||
l_step_l = l_max_res * l_step_r;
|
||||
|
||||
/* set values for first packet iterator*/
|
||||
l_pi->tp_on = p_cp->m_specific_param.m_enc.m_tp_on;
|
||||
l_pi->tp_on = (OPJ_BYTE)p_cp->m_specific_param.m_enc.m_tp_on;
|
||||
l_current_pi = l_pi;
|
||||
|
||||
/* memory allocation for include*/
|
||||
@ -1439,7 +1448,6 @@ opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
|
||||
opj_pi_destroy(l_pi, l_bound);
|
||||
return 00;
|
||||
}
|
||||
memset(l_current_pi->include,0,l_tcp->numlayers * l_step_l* sizeof(OPJ_INT16));
|
||||
|
||||
/* special treatment for the first packet iterator*/
|
||||
l_current_comp = l_current_pi->comps;
|
||||
|
@ -73,7 +73,7 @@ Packet iterator
|
||||
typedef struct opj_pi_iterator {
|
||||
/** Enabling Tile part generation*/
|
||||
OPJ_BYTE tp_on;
|
||||
/** precise if the packet has been already used (usefull for progression order change) */
|
||||
/** precise if the packet has been already used (useful for progression order change) */
|
||||
OPJ_INT16 *include;
|
||||
/** layer step used to localize the packet in the include vector */
|
||||
OPJ_UINT32 step_l;
|
||||
|
@ -61,7 +61,9 @@ int opj_write_ppix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
|
||||
|
||||
lenp = -1;
|
||||
box = (opj_jp2_box_t *)opj_calloc( (size_t)cstr_info.numcomps, sizeof(opj_jp2_box_t));
|
||||
|
||||
if(box == NULL){
|
||||
return 0;
|
||||
}
|
||||
for (i=0;i<2;i++){
|
||||
if (i)
|
||||
|
||||
|
@ -88,7 +88,7 @@ OPJ_UINT32 opj_raw_decode(opj_raw_t *raw) {
|
||||
}
|
||||
}
|
||||
raw->ct--;
|
||||
d = (raw->c >> raw->ct) & 0x01;
|
||||
d = ((OPJ_UINT32)raw->c >> raw->ct) & 0x01U;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
1654
src/lib/openjp2/t1.c
1654
src/lib/openjp2/t1.c
File diff suppressed because it is too large
Load Diff
@ -50,48 +50,74 @@ in T1.C are used by some function in TCD.C.
|
||||
/* ----------------------------------------------------------------------- */
|
||||
#define T1_NMSEDEC_BITS 7
|
||||
|
||||
#define T1_SIG_NE 0x0001 /**< Context orientation : North-East direction */
|
||||
#define T1_SIG_SE 0x0002 /**< Context orientation : South-East direction */
|
||||
#define T1_SIG_SW 0x0004 /**< Context orientation : South-West direction */
|
||||
#define T1_SIG_NW 0x0008 /**< Context orientation : North-West direction */
|
||||
#define T1_SIG_N 0x0010 /**< Context orientation : North direction */
|
||||
#define T1_SIG_E 0x0020 /**< Context orientation : East direction */
|
||||
#define T1_SIG_S 0x0040 /**< Context orientation : South direction */
|
||||
#define T1_SIG_W 0x0080 /**< Context orientation : West direction */
|
||||
/* CAUTION: the value of those constants must not be changed, otherwise the */
|
||||
/* optimization of opj_t1_updateflags() will break! */
|
||||
/* BEGINNING of flags that apply to opj_flag_t */
|
||||
#define T1_SIG_NE 0x0001U /**< Context orientation : North-East direction */
|
||||
#define T1_SIG_SE 0x0002U /**< Context orientation : South-East direction */
|
||||
#define T1_SIG_SW 0x0004U /**< Context orientation : South-West direction */
|
||||
#define T1_SIG_NW 0x0008U /**< Context orientation : North-West direction */
|
||||
#define T1_SIG_N 0x0010U /**< Context orientation : North direction */
|
||||
#define T1_SIG_E 0x0020U /**< Context orientation : East direction */
|
||||
#define T1_SIG_S 0x0040U /**< Context orientation : South direction */
|
||||
#define T1_SIG_W 0x0080U /**< Context orientation : West direction */
|
||||
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
|
||||
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
|
||||
|
||||
#define T1_SGN_N 0x0100
|
||||
#define T1_SGN_E 0x0200
|
||||
#define T1_SGN_S 0x0400
|
||||
#define T1_SGN_W 0x0800
|
||||
#define T1_SGN_N 0x0100U
|
||||
#define T1_SGN_E 0x0200U
|
||||
#define T1_SGN_S 0x0400U
|
||||
#define T1_SGN_W 0x0800U
|
||||
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
|
||||
|
||||
#define T1_SIG 0x1000
|
||||
#define T1_REFINE 0x2000
|
||||
#define T1_VISIT 0x4000
|
||||
#define T1_SIG 0x1000U /**< No longer used by decoder */
|
||||
#define T1_REFINE 0x2000U /**< No longer used by decoder */
|
||||
#define T1_VISIT 0x4000U /**< No longer used by decoder */
|
||||
/* END of flags that apply to opj_flag_t */
|
||||
|
||||
#define T1_NUMCTXS_ZC 9
|
||||
#define T1_NUMCTXS_SC 5
|
||||
#define T1_NUMCTXS_ZC 9
|
||||
#define T1_NUMCTXS_SC 5
|
||||
#define T1_NUMCTXS_MAG 3
|
||||
#define T1_NUMCTXS_AGG 1
|
||||
#define T1_NUMCTXS_UNI 1
|
||||
|
||||
#define T1_CTXNO_ZC 0
|
||||
#define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
|
||||
#define T1_CTXNO_ZC 0
|
||||
#define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
|
||||
#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
|
||||
#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
|
||||
#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
|
||||
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
|
||||
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
|
||||
|
||||
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
|
||||
|
||||
#define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */
|
||||
#define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
|
||||
|
||||
/* Those flags are used by opj_colflag_t */
|
||||
#define T1_COLFLAG_RBS 4U /* RBS = Row Bit Shift */
|
||||
#define T1_COLFLAG_SIG_OTHER_ROW_0 (1U << 0U) /**< This sample has at least one significant neighbour */
|
||||
#define T1_COLFLAG_SIG_ROW_0 (1U << 1U) /**< This sample is significant */
|
||||
#define T1_COLFLAG_VISIT_ROW_0 (1U << 2U) /**< This sample has been visited */
|
||||
#define T1_COLFLAG_REFINE_ROW_0 (1U << 3U) /**< This sample has been refined */
|
||||
#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << (1U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << (1U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << (1U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << (1U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3U * T1_COLFLAG_RBS))
|
||||
#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3U * T1_COLFLAG_RBS))
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
typedef OPJ_INT16 opj_flag_t;
|
||||
typedef OPJ_UINT16 opj_flag_t;
|
||||
|
||||
/** Flags for 4 consecutive rows of a column */
|
||||
typedef OPJ_UINT16 opj_colflag_t;
|
||||
|
||||
/**
|
||||
Tier-1 coding (coding of code-block coefficients)
|
||||
@ -103,13 +129,21 @@ typedef struct opj_t1 {
|
||||
/** RAW component */
|
||||
opj_raw_t *raw;
|
||||
|
||||
OPJ_INT32 *data;
|
||||
OPJ_INT32 *data;
|
||||
opj_flag_t *flags;
|
||||
/** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3,
|
||||
colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ...
|
||||
This array avoids too much cache trashing when processing by 4 vertical samples
|
||||
as done in the various decoding steps. */
|
||||
opj_colflag_t* colflags;
|
||||
OPJ_UINT32 w;
|
||||
OPJ_UINT32 h;
|
||||
OPJ_UINT32 datasize;
|
||||
OPJ_UINT32 flagssize;
|
||||
OPJ_UINT32 flags_stride;
|
||||
OPJ_UINT32 colflags_size;
|
||||
OPJ_UINT32 data_stride;
|
||||
OPJ_BOOL encoder;
|
||||
} opj_t1_t;
|
||||
|
||||
#define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
|
||||
@ -124,11 +158,13 @@ Encode the code-blocks of a tile
|
||||
@param tile The tile to encode
|
||||
@param tcp Tile coding parameters
|
||||
@param mct_norms FIXME DOC
|
||||
@param mct_numcomps Number of components used for MCT
|
||||
*/
|
||||
OPJ_BOOL opj_t1_encode_cblks( opj_t1_t *t1,
|
||||
opj_tcd_tile_t *tile,
|
||||
opj_tcp_t *tcp,
|
||||
const OPJ_FLOAT64 * mct_norms);
|
||||
const OPJ_FLOAT64 * mct_norms,
|
||||
OPJ_UINT32 mct_numcomps);
|
||||
|
||||
/**
|
||||
Decode the code-blocks of a tile
|
||||
@ -136,7 +172,8 @@ Decode the code-blocks of a tile
|
||||
@param tilec The tile to decode
|
||||
@param tccp Tile coding parameters
|
||||
*/
|
||||
OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1,
|
||||
void opj_t1_decode_cblks( opj_thread_pool_t* tp,
|
||||
volatile OPJ_BOOL* pret,
|
||||
opj_tcd_tilecomp_t* tilec,
|
||||
opj_tccp_t* tccp);
|
||||
|
||||
@ -147,7 +184,7 @@ OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1,
|
||||
* and initializes the look-up tables of the Tier-1 coder/decoder
|
||||
* @return a new T1 handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_t1_t* opj_t1_create(void);
|
||||
opj_t1_t* opj_t1_create(OPJ_BOOL isEncoder);
|
||||
|
||||
/**
|
||||
* Destroys a previously created T1 handle
|
||||
|
@ -38,18 +38,21 @@
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
static int t1_init_ctxno_zc(int f, int orient) {
|
||||
static int t1_init_ctxno_zc(unsigned int f, unsigned int orient) {
|
||||
int h, v, d, n, t, hv;
|
||||
n = 0;
|
||||
h = ((f & T1_SIG_W) != 0) + ((f & T1_SIG_E) != 0);
|
||||
v = ((f & T1_SIG_N) != 0) + ((f & T1_SIG_S) != 0);
|
||||
d = ((f & T1_SIG_NW) != 0) + ((f & T1_SIG_NE) != 0) + ((f & T1_SIG_SE) != 0) + ((f & T1_SIG_SW) != 0);
|
||||
n = 0;
|
||||
t = 0;
|
||||
hv = 0;
|
||||
|
||||
switch (orient) {
|
||||
case 2:
|
||||
t = h;
|
||||
h = v;
|
||||
v = t;
|
||||
/* fall through */
|
||||
case 0:
|
||||
case 1:
|
||||
if (!h) {
|
||||
@ -110,7 +113,7 @@ static int t1_init_ctxno_zc(int f, int orient) {
|
||||
return (T1_CTXNO_ZC + n);
|
||||
}
|
||||
|
||||
static int t1_init_ctxno_sc(int f) {
|
||||
static int t1_init_ctxno_sc(unsigned int f) {
|
||||
int hc, vc, n;
|
||||
n = 0;
|
||||
|
||||
@ -151,7 +154,7 @@ static int t1_init_ctxno_sc(int f) {
|
||||
return (T1_CTXNO_SC + n);
|
||||
}
|
||||
|
||||
static int t1_init_spb(int f) {
|
||||
static int t1_init_spb(unsigned int f) {
|
||||
int hc, vc, n;
|
||||
|
||||
hc = opj_int_min(((f & (T1_SIG_E | T1_SGN_E)) ==
|
||||
@ -189,7 +192,7 @@ static void dump_array16(int array[],int size){
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
double u, v, t;
|
||||
|
||||
int lut_ctxno_zc[1024];
|
||||
@ -202,47 +205,47 @@ int main(int argc, char **argv)
|
||||
printf("/* This file was automatically generated by t1_generate_luts.c */\n\n");
|
||||
|
||||
/* lut_ctxno_zc */
|
||||
for (j = 0; j < 4; ++j) {
|
||||
for (i = 0; i < 256; ++i) {
|
||||
int orient = j;
|
||||
if (orient == 2) {
|
||||
orient = 1;
|
||||
} else if (orient == 1) {
|
||||
orient = 2;
|
||||
for (j = 0U; j < 4U; ++j) {
|
||||
for (i = 0U; i < 256U; ++i) {
|
||||
unsigned int orient = j;
|
||||
if (orient == 2U) {
|
||||
orient = 1U;
|
||||
} else if (orient == 1U) {
|
||||
orient = 2U;
|
||||
}
|
||||
lut_ctxno_zc[(orient << 8) | i] = t1_init_ctxno_zc(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
printf("static OPJ_BYTE lut_ctxno_zc[1024] = {\n ");
|
||||
for (i = 0; i < 1023; ++i) {
|
||||
printf("static const OPJ_BYTE lut_ctxno_zc[1024] = {\n ");
|
||||
for (i = 0U; i < 1023U; ++i) {
|
||||
printf("%i, ", lut_ctxno_zc[i]);
|
||||
if(!((i+1)&0x1f))
|
||||
if(!((i+1U)&0x1fU))
|
||||
printf("\n ");
|
||||
}
|
||||
printf("%i\n};\n\n", lut_ctxno_zc[1023]);
|
||||
|
||||
/* lut_ctxno_sc */
|
||||
printf("static OPJ_BYTE lut_ctxno_sc[256] = {\n ");
|
||||
for (i = 0; i < 255; ++i) {
|
||||
printf("static const OPJ_BYTE lut_ctxno_sc[256] = {\n ");
|
||||
for (i = 0U; i < 255U; ++i) {
|
||||
printf("0x%x, ", t1_init_ctxno_sc(i << 4));
|
||||
if(!((i+1)&0xf))
|
||||
if(!((i+1U)&0xfU))
|
||||
printf("\n ");
|
||||
}
|
||||
printf("0x%x\n};\n\n", t1_init_ctxno_sc(255 << 4));
|
||||
printf("0x%x\n};\n\n", t1_init_ctxno_sc(255U << 4));
|
||||
|
||||
/* lut_spb */
|
||||
printf("static OPJ_BYTE lut_spb[256] = {\n ");
|
||||
for (i = 0; i < 255; ++i) {
|
||||
printf("static const OPJ_BYTE lut_spb[256] = {\n ");
|
||||
for (i = 0U; i < 255U; ++i) {
|
||||
printf("%i, ", t1_init_spb(i << 4));
|
||||
if(!((i+1)&0x1f))
|
||||
if(!((i+1U)&0x1fU))
|
||||
printf("\n ");
|
||||
}
|
||||
printf("%i\n};\n\n", t1_init_spb(255 << 4));
|
||||
printf("%i\n};\n\n", t1_init_spb(255U << 4));
|
||||
|
||||
/* FIXME FIXME FIXME */
|
||||
/* fprintf(stdout,"nmsedec luts:\n"); */
|
||||
for (i = 0; i < (1 << T1_NMSEDEC_BITS); ++i) {
|
||||
for (i = 0U; i < (1U << T1_NMSEDEC_BITS); ++i) {
|
||||
t = i / pow(2, T1_NMSEDEC_FRACBITS);
|
||||
u = t;
|
||||
v = t - 1.5;
|
||||
@ -266,17 +269,17 @@ int main(int argc, char **argv)
|
||||
(int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
|
||||
}
|
||||
|
||||
printf("static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_sig, 1 << T1_NMSEDEC_BITS);
|
||||
printf("static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_sig, 1U << T1_NMSEDEC_BITS);
|
||||
|
||||
printf("static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_sig0, 1 << T1_NMSEDEC_BITS);
|
||||
printf("static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_sig0, 1U << T1_NMSEDEC_BITS);
|
||||
|
||||
printf("static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_ref, 1 << T1_NMSEDEC_BITS);
|
||||
printf("static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_ref, 1U << T1_NMSEDEC_BITS);
|
||||
|
||||
printf("static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_ref0, 1 << T1_NMSEDEC_BITS);
|
||||
printf("static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = {\n ");
|
||||
dump_array16(lut_nmsedec_ref0, 1U << T1_NMSEDEC_BITS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* This file was automatically generated by t1_generate_luts.c */
|
||||
|
||||
static OPJ_BYTE lut_ctxno_zc[1024] = {
|
||||
static const OPJ_BYTE lut_ctxno_zc[1024] = {
|
||||
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
@ -35,7 +35,7 @@ static OPJ_BYTE lut_ctxno_zc[1024] = {
|
||||
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8
|
||||
};
|
||||
|
||||
static OPJ_BYTE lut_ctxno_sc[256] = {
|
||||
static const OPJ_BYTE lut_ctxno_sc[256] = {
|
||||
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd,
|
||||
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc,
|
||||
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa,
|
||||
@ -54,7 +54,7 @@ static OPJ_BYTE lut_ctxno_sc[256] = {
|
||||
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd
|
||||
};
|
||||
|
||||
static OPJ_BYTE lut_spb[256] = {
|
||||
static const OPJ_BYTE lut_spb[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -65,7 +65,7 @@ static OPJ_BYTE lut_spb[256] = {
|
||||
0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
|
||||
static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {
|
||||
static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = {
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
@ -84,7 +84,7 @@ static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {
|
||||
0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680
|
||||
};
|
||||
|
||||
static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {
|
||||
static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = {
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
|
||||
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
|
||||
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
|
||||
@ -103,7 +103,7 @@ static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {
|
||||
0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00
|
||||
};
|
||||
|
||||
static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {
|
||||
static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = {
|
||||
0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480,
|
||||
0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080,
|
||||
0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80,
|
||||
@ -122,7 +122,7 @@ static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {
|
||||
0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780
|
||||
};
|
||||
|
||||
static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {
|
||||
static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = {
|
||||
0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980,
|
||||
0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300,
|
||||
0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00,
|
||||
|
@ -97,7 +97,8 @@ static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* t2,
|
||||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 * data_read,
|
||||
OPJ_UINT32 max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
@ -106,7 +107,8 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info);
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
@ -116,7 +118,8 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info);
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
@ -124,14 +127,16 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
/**
|
||||
@param cblk
|
||||
@ -158,7 +163,7 @@ static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n) {
|
||||
opj_bio_write(bio, 0, 1);
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
|
||||
static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
|
||||
{
|
||||
OPJ_UINT32 n = 0;
|
||||
while (opj_bio_read(bio, 1)) {
|
||||
@ -167,7 +172,7 @@ OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
|
||||
return n;
|
||||
}
|
||||
|
||||
void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
|
||||
static void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
|
||||
if (n == 1) {
|
||||
opj_bio_write(bio, 0, 1);
|
||||
} else if (n == 2) {
|
||||
@ -181,7 +186,7 @@ void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
|
||||
static OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
|
||||
OPJ_UINT32 n;
|
||||
if (!opj_bio_read(bio, 1))
|
||||
return 1;
|
||||
@ -242,6 +247,11 @@ OPJ_BOOL opj_t2_encode_packets( opj_t2_t* p_t2,
|
||||
/* TODO MSD : check why this function cannot fail (cf. v1) */
|
||||
opj_pi_create_encode(l_pi, l_cp,p_tile_no,poc,l_tp_num,p_tp_pos,p_t2_mode);
|
||||
|
||||
if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
|
||||
/* TODO ADE : add an error */
|
||||
opj_pi_destroy(l_pi, l_nb_pocs);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
while (opj_pi_next(l_current_pi)) {
|
||||
if (l_current_pi->layno < p_maxlayers) {
|
||||
l_nb_bytes = 0;
|
||||
@ -274,7 +284,11 @@ OPJ_BOOL opj_t2_encode_packets( opj_t2_t* p_t2,
|
||||
opj_pi_create_encode(l_pi, l_cp,p_tile_no,p_pino,p_tp_num,p_tp_pos,p_t2_mode);
|
||||
|
||||
l_current_pi = &l_pi[p_pino];
|
||||
|
||||
if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
|
||||
/* TODO ADE : add an error */
|
||||
opj_pi_destroy(l_pi, l_nb_pocs);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
while (opj_pi_next(l_current_pi)) {
|
||||
if (l_current_pi->layno < p_maxlayers) {
|
||||
l_nb_bytes=0;
|
||||
@ -336,7 +350,8 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
||||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_len,
|
||||
opj_codestream_index_t *p_cstr_index)
|
||||
opj_codestream_index_t *p_cstr_index,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BYTE *l_current_data = p_src;
|
||||
opj_pi_iterator_t *l_pi = 00;
|
||||
@ -378,7 +393,15 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
||||
* l_current_pi->resno is always >= p_tile->comps[l_current_pi->compno].minimum_num_resolutions
|
||||
* and no l_img_comp->resno_decoded are computed
|
||||
*/
|
||||
OPJ_BOOL* first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->numcomps * sizeof(OPJ_BOOL));
|
||||
OPJ_BOOL* first_pass_failed = NULL;
|
||||
|
||||
if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
|
||||
/* TODO ADE : add an error */
|
||||
opj_pi_destroy(l_pi, l_nb_pocs);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->numcomps * sizeof(OPJ_BOOL));
|
||||
if (!first_pass_failed)
|
||||
{
|
||||
opj_pi_destroy(l_pi,l_nb_pocs);
|
||||
@ -396,7 +419,7 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
||||
|
||||
first_pass_failed[l_current_pi->compno] = OPJ_FALSE;
|
||||
|
||||
if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) {
|
||||
if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
|
||||
opj_pi_destroy(l_pi,l_nb_pocs);
|
||||
opj_free(first_pass_failed);
|
||||
return OPJ_FALSE;
|
||||
@ -407,7 +430,7 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
||||
}
|
||||
else {
|
||||
l_nb_bytes_read = 0;
|
||||
if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) {
|
||||
if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
|
||||
opj_pi_destroy(l_pi,l_nb_pocs);
|
||||
opj_free(first_pass_failed);
|
||||
return OPJ_FALSE;
|
||||
@ -477,11 +500,10 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
||||
opj_t2_t* opj_t2_create(opj_image_t *p_image, opj_cp_t *p_cp)
|
||||
{
|
||||
/* create the t2 structure */
|
||||
opj_t2_t *l_t2 = (opj_t2_t*)opj_malloc(sizeof(opj_t2_t));
|
||||
opj_t2_t *l_t2 = (opj_t2_t*)opj_calloc(1,sizeof(opj_t2_t));
|
||||
if (!l_t2) {
|
||||
return NULL;
|
||||
}
|
||||
memset(l_t2,0,sizeof(opj_t2_t));
|
||||
|
||||
l_t2->image = p_image;
|
||||
l_t2->cp = p_cp;
|
||||
@ -495,14 +517,15 @@ void opj_t2_destroy(opj_t2_t *t2) {
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
||||
static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_tcp_t *p_tcp,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BOOL l_read_data;
|
||||
OPJ_UINT32 l_nb_bytes_read = 0;
|
||||
@ -510,7 +533,7 @@ OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
||||
|
||||
*p_data_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -522,7 +545,7 @@ OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
||||
if (l_read_data) {
|
||||
l_nb_bytes_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -534,7 +557,7 @@ OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||
static OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||
opj_tcd_tile_t * tile,
|
||||
opj_tcp_t * tcp,
|
||||
opj_pi_iterator_t *pi,
|
||||
@ -599,6 +622,10 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||
}
|
||||
|
||||
bio = opj_bio_create();
|
||||
if (!bio) {
|
||||
/* FIXME event manager error callback */
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
opj_bio_init_enc(bio, c, length);
|
||||
opj_bio_write(bio, 1, 1); /* Empty header bit */
|
||||
|
||||
@ -773,7 +800,8 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BOOL l_read_data;
|
||||
OPJ_UINT32 l_nb_bytes_read = 0;
|
||||
@ -781,7 +809,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
|
||||
*p_data_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -793,7 +821,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
if (l_read_data) {
|
||||
l_nb_bytes_read = 0;
|
||||
|
||||
if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -805,7 +833,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
}
|
||||
|
||||
|
||||
OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_tcp_t *p_tcp,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
@ -813,7 +841,8 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
|
||||
{
|
||||
/* loop */
|
||||
@ -839,9 +868,14 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
|
||||
/* reset tagtrees */
|
||||
for (bandno = 0; bandno < l_res->numbands; ++bandno) {
|
||||
opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
|
||||
|
||||
if ( ! ((l_band->x1-l_band->x0 == 0)||(l_band->y1-l_band->y0 == 0)) ) {
|
||||
opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
|
||||
if (!(p_pi->precno < (l_band->precincts_data_size / sizeof(opj_tcd_precinct_t)))) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid precinct\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
||||
opj_tgt_reset(l_prc->incltree);
|
||||
opj_tgt_reset(l_prc->imsbtree);
|
||||
l_cblk = l_prc->cblks.dec;
|
||||
@ -862,12 +896,9 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
|
||||
if (p_tcp->csty & J2K_CP_CSTY_SOP) {
|
||||
if (p_max_length < 6) {
|
||||
/* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNING, "Not enough space for expected SOP marker\n"); */
|
||||
printf("Not enough space for expected SOP marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected SOP marker\n");
|
||||
} else if ((*l_current_data) != 0xff || (*(l_current_data + 1) != 0x91)) {
|
||||
/* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNING, "Expected SOP marker\n"); */
|
||||
printf("Expected SOP marker\n");
|
||||
fprintf(stderr, "Error : expected SOP marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected SOP marker\n");
|
||||
} else {
|
||||
l_current_data += 6;
|
||||
}
|
||||
@ -917,10 +948,10 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
|
||||
/* EPH markers */
|
||||
if (p_tcp->csty & J2K_CP_CSTY_EPH) {
|
||||
if (p_max_length < 2) {
|
||||
fprintf(stderr, "Not enough space for expected EPH marker\n");
|
||||
if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) {
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected EPH marker\n");
|
||||
} else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
|
||||
fprintf(stderr, "Error : expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
|
||||
} else {
|
||||
l_header_data += 2;
|
||||
}
|
||||
@ -971,7 +1002,7 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
if (!l_included) {
|
||||
l_cblk->numnewpasses = 0;
|
||||
++l_cblk;
|
||||
JAS_FPRINTF(stderr, "included=%d \n", l_included);
|
||||
JAS_FPRINTF(stderr, "included=%d \n", l_included);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1045,11 +1076,10 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
|
||||
/* EPH markers */
|
||||
if (p_tcp->csty & J2K_CP_CSTY_EPH) {
|
||||
if (p_max_length < 2) {
|
||||
fprintf(stderr, "Not enough space for expected EPH marker\n");
|
||||
if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) {
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected EPH marker\n");
|
||||
} else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
|
||||
/* TODO opj_event_msg(t2->cinfo->event_mgr, EVT_ERROR, "Expected EPH marker\n"); */
|
||||
fprintf(stderr, "Error : expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
|
||||
} else {
|
||||
l_header_data += 2;
|
||||
}
|
||||
@ -1075,13 +1105,14 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
||||
static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info)
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t* p_manager)
|
||||
{
|
||||
OPJ_UINT32 bandno, cblkno;
|
||||
OPJ_UINT32 l_nb_code_blocks;
|
||||
@ -1129,9 +1160,10 @@ OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
||||
}
|
||||
|
||||
do {
|
||||
if (l_current_data + l_seg->newlen > p_src_data + p_max_length) {
|
||||
fprintf(stderr, "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
/* Check possible overflow (on l_current_data only, assumes input args already checked) then size */
|
||||
if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l_seg->newlen) < (OPJ_SIZE_T)l_current_data) || (l_current_data + l_seg->newlen > p_src_data + p_max_length)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
@ -1141,24 +1173,31 @@ OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
||||
|
||||
/* let's check that we are not exceeding */
|
||||
if ((l_cblk->len + l_seg->newlen) > 8192) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING,
|
||||
opj_event_msg(p_manager, EVT_WARNING,
|
||||
"JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
if (!JPWL_ASSUME) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_ERROR, "JPWL: giving up\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_seg->newlen = 8192 - l_cblk->len;
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
break;
|
||||
};
|
||||
|
||||
#endif /* USE_JPWL */
|
||||
/* Check possible overflow on size */
|
||||
if ((l_cblk->data_current_size + l_seg->newlen) < l_cblk->data_current_size) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "read: segment too long (%d) with current size (%d > %d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, l_cblk->data_current_size, 0xFFFFFFFF - l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* Check if the cblk->data have allocated enough memory */
|
||||
if ((l_cblk->data_current_size + l_seg->newlen) > l_cblk->data_max_size) {
|
||||
OPJ_BYTE* new_cblk_data = (OPJ_BYTE*) opj_realloc(l_cblk->data, l_cblk->data_current_size + l_seg->newlen);
|
||||
if(! new_cblk_data) {
|
||||
opj_free(l_cblk->data);
|
||||
l_cblk->data = NULL;
|
||||
l_cblk->data_max_size = 0;
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to realloc code block cata!\n"); */
|
||||
return OPJ_FALSE;
|
||||
@ -1197,15 +1236,17 @@ OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
||||
|
||||
*(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
|
||||
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
||||
static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info)
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_UINT32 bandno, cblkno;
|
||||
OPJ_UINT32 l_nb_code_blocks;
|
||||
@ -1254,8 +1295,9 @@ OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
||||
}
|
||||
|
||||
do {
|
||||
if (* p_data_read + l_seg->newlen > p_max_length) {
|
||||
fprintf(stderr, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
/* Check possible overflow then size */
|
||||
if (((*p_data_read + l_seg->newlen) < (*p_data_read)) || ((*p_data_read + l_seg->newlen) > p_max_length)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
@ -1266,15 +1308,15 @@ OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
||||
|
||||
/* let's check that we are not exceeding */
|
||||
if ((l_cblk->len + l_seg->newlen) > 8192) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING,
|
||||
opj_event_msg(p_manager, EVT_WARNING,
|
||||
"JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
if (!JPWL_ASSUME) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_ERROR, "JPWL: giving up\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
|
||||
return -999;
|
||||
}
|
||||
l_seg->newlen = 8192 - l_cblk->len;
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
break;
|
||||
};
|
||||
|
||||
@ -1301,7 +1343,7 @@ OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
||||
}
|
||||
|
||||
|
||||
OPJ_BOOL opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk,
|
||||
static OPJ_BOOL opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk,
|
||||
OPJ_UINT32 index,
|
||||
OPJ_UINT32 cblksty,
|
||||
OPJ_UINT32 first)
|
||||
|
@ -108,7 +108,8 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *t2,
|
||||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 len,
|
||||
opj_codestream_index_t *cstr_info);
|
||||
opj_codestream_index_t *cstr_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
/**
|
||||
* Creates a Tier 2 handle
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@ typedef struct opj_tcd_pass {
|
||||
OPJ_UINT32 rate;
|
||||
OPJ_FLOAT64 distortiondec;
|
||||
OPJ_UINT32 len;
|
||||
OPJ_UINT32 term : 1;
|
||||
OPJ_BITFIELD term : 1;
|
||||
} opj_tcd_pass_t;
|
||||
|
||||
/**
|
||||
@ -87,15 +87,16 @@ typedef struct opj_tcd_layer {
|
||||
FIXME DOC
|
||||
*/
|
||||
typedef struct opj_tcd_cblk_enc {
|
||||
OPJ_BYTE* data; /* Data */
|
||||
opj_tcd_layer_t* layers; /* layer information */
|
||||
opj_tcd_pass_t* passes; /* information about the passes */
|
||||
OPJ_INT32 x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
|
||||
OPJ_BYTE* data; /* Data */
|
||||
opj_tcd_layer_t* layers; /* layer information */
|
||||
opj_tcd_pass_t* passes; /* information about the passes */
|
||||
OPJ_INT32 x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
|
||||
OPJ_UINT32 numbps;
|
||||
OPJ_UINT32 numlenbits;
|
||||
OPJ_UINT32 numpasses; /* number of pass already done for the code-blocks */
|
||||
OPJ_UINT32 numpassesinlayers; /* number of passes in the layer */
|
||||
OPJ_UINT32 totalpasses; /* total number of passes */
|
||||
OPJ_UINT32 data_size; /* Size of allocated data buffer */
|
||||
OPJ_UINT32 numpasses; /* number of pass already done for the code-blocks */
|
||||
OPJ_UINT32 numpassesinlayers; /* number of passes in the layer */
|
||||
OPJ_UINT32 totalpasses; /* total number of passes */
|
||||
} opj_tcd_cblk_enc_t;
|
||||
|
||||
|
||||
@ -105,7 +106,7 @@ typedef struct opj_tcd_cblk_dec {
|
||||
OPJ_INT32 x0, y0, x1, y1; /* position of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
|
||||
OPJ_UINT32 numbps;
|
||||
OPJ_UINT32 numlenbits;
|
||||
OPJ_UINT32 data_max_size; /* Size of allocated data buffer */
|
||||
OPJ_UINT32 data_max_size; /* Size of allocated data buffer */
|
||||
OPJ_UINT32 data_current_size; /* Size of used data buffer */
|
||||
OPJ_UINT32 numnewpasses; /* number of pass added to the code-blocks */
|
||||
OPJ_UINT32 numsegs; /* number of segments */
|
||||
@ -122,6 +123,7 @@ typedef struct opj_tcd_precinct {
|
||||
union{ /* code-blocks information */
|
||||
opj_tcd_cblk_enc_t* enc;
|
||||
opj_tcd_cblk_dec_t* dec;
|
||||
void* blocks;
|
||||
} cblks;
|
||||
OPJ_UINT32 block_size; /* size taken by cblks (in bytes) */
|
||||
opj_tgt_tree_t *incltree; /* inclusion tree */
|
||||
@ -155,14 +157,16 @@ FIXME DOC
|
||||
*/
|
||||
typedef struct opj_tcd_tilecomp
|
||||
{
|
||||
OPJ_INT32 x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
|
||||
OPJ_UINT32 numresolutions; /* number of resolutions level */
|
||||
OPJ_UINT32 minimum_num_resolutions; /* number of resolutions level to decode (at max)*/
|
||||
opj_tcd_resolution_t *resolutions; /* resolutions information */
|
||||
OPJ_UINT32 resolutions_size; /* size of data for resolutions (in bytes) */
|
||||
OPJ_INT32 *data; /* data of the component */
|
||||
OPJ_UINT32 data_size; /* size of the data of the component */
|
||||
OPJ_INT32 numpix; /* add fixed_quality */
|
||||
OPJ_INT32 x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
|
||||
OPJ_UINT32 numresolutions; /* number of resolutions level */
|
||||
OPJ_UINT32 minimum_num_resolutions; /* number of resolutions level to decode (at max)*/
|
||||
opj_tcd_resolution_t *resolutions; /* resolutions information */
|
||||
OPJ_UINT32 resolutions_size; /* size of data for resolutions (in bytes) */
|
||||
OPJ_INT32 *data; /* data of the component */
|
||||
OPJ_BOOL ownsData; /* if true, then need to free after usage, otherwise do not free */
|
||||
OPJ_UINT32 data_size_needed; /* we may either need to allocate this amount of data, or re-use image data and ignore this value */
|
||||
OPJ_UINT32 data_size; /* size of the data of the component */
|
||||
OPJ_INT32 numpix; /* add fixed_quality */
|
||||
} opj_tcd_tilecomp_t;
|
||||
|
||||
|
||||
@ -215,7 +219,9 @@ typedef struct opj_tcd
|
||||
/** current encoded/decoded tile */
|
||||
OPJ_UINT32 tcd_tileno;
|
||||
/** tell if the tcd is a decoder. */
|
||||
OPJ_UINT32 m_is_decoder : 1;
|
||||
OPJ_BITFIELD m_is_decoder : 1;
|
||||
/** Thread pool */
|
||||
opj_thread_pool_t* thread_pool;
|
||||
} opj_tcd_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
@ -245,12 +251,14 @@ void opj_tcd_destroy(opj_tcd_t *tcd);
|
||||
* @param p_tcd TCD handle.
|
||||
* @param p_image raw image.
|
||||
* @param p_cp coding parameters.
|
||||
* @param p_tp thread pool
|
||||
*
|
||||
* @return true if the encoding values could be set (false otherwise).
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd,
|
||||
opj_image_t * p_image,
|
||||
opj_cp_t * p_cp );
|
||||
opj_cp_t * p_cp,
|
||||
opj_thread_pool_t* p_tp);
|
||||
|
||||
/**
|
||||
* Allocates memory for decoding a specific tile.
|
||||
@ -258,10 +266,11 @@ OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd,
|
||||
* @param p_tcd the tile decoder.
|
||||
* @param p_tile_no the index of the tile received in sequence. This not necessarily lead to the
|
||||
* tile at index p_tile_no.
|
||||
* @param p_manager the event manager.
|
||||
*
|
||||
* @return true if the remaining data is sufficient.
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no);
|
||||
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager);
|
||||
|
||||
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final);
|
||||
|
||||
@ -291,7 +300,7 @@ OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_t *p_tcd );
|
||||
* @param p_data_written pointer to an int that is incremented by the number of bytes really written on p_dest
|
||||
* @param p_len Maximum length of the destination buffer
|
||||
* @param p_cstr_info Codestream information structure
|
||||
* @return true if the coding is successfull.
|
||||
* @return true if the coding is successful.
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_encode_tile( opj_tcd_t *p_tcd,
|
||||
OPJ_UINT32 p_tile_no,
|
||||
@ -308,12 +317,14 @@ Decode a tile from a buffer into a raw image
|
||||
@param len Length of source buffer
|
||||
@param tileno Number that identifies one of the tiles to be decoded
|
||||
@param cstr_info FIXME DOC
|
||||
@param manager the event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *tcd,
|
||||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 len,
|
||||
OPJ_UINT32 tileno,
|
||||
opj_codestream_index_t *cstr_info);
|
||||
opj_codestream_index_t *cstr_info,
|
||||
opj_event_mgr_t *manager);
|
||||
|
||||
|
||||
/**
|
||||
@ -333,11 +344,12 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd );
|
||||
*
|
||||
* @param p_tcd TCD handle.
|
||||
* @param p_tile_no current tile index to encode.
|
||||
* @param p_manager the event manager.
|
||||
*
|
||||
* @return true if the encoding values could be set (false otherwise).
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_init_encode_tile ( opj_tcd_t *p_tcd,
|
||||
OPJ_UINT32 p_tile_no );
|
||||
OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager );
|
||||
|
||||
/**
|
||||
* Copies tile data from the given memory block onto the system.
|
||||
@ -346,6 +358,13 @@ OPJ_BOOL opj_tcd_copy_tile_data (opj_tcd_t *p_tcd,
|
||||
OPJ_BYTE * p_src,
|
||||
OPJ_UINT32 p_src_length );
|
||||
|
||||
/**
|
||||
* Allocates tile component data
|
||||
*
|
||||
*
|
||||
*/
|
||||
OPJ_BOOL opj_alloc_tile_component_data(opj_tcd_tilecomp_t *l_tilec);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *manager) {
|
||||
OPJ_INT32 nplh[32];
|
||||
OPJ_INT32 nplv[32];
|
||||
opj_tgt_node_t *node = 00;
|
||||
@ -57,12 +57,11 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
||||
OPJ_UINT32 numlvls;
|
||||
OPJ_UINT32 n;
|
||||
|
||||
tree = (opj_tgt_tree_t *) opj_malloc(sizeof(opj_tgt_tree_t));
|
||||
tree = (opj_tgt_tree_t *) opj_calloc(1,sizeof(opj_tgt_tree_t));
|
||||
if(!tree) {
|
||||
fprintf(stderr, "ERROR in tgt_create while allocating tree\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory to create Tag-tree\n");
|
||||
return 00;
|
||||
}
|
||||
memset(tree,0,sizeof(opj_tgt_tree_t));
|
||||
|
||||
tree->numleafsh = numleafsh;
|
||||
tree->numleafsv = numleafsv;
|
||||
@ -82,17 +81,16 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
||||
/* ADD */
|
||||
if (tree->numnodes == 0) {
|
||||
opj_free(tree);
|
||||
fprintf(stderr, "WARNING in tgt_create tree->numnodes == 0, no tree created.\n");
|
||||
opj_event_msg(manager, EVT_WARNING, "tgt_create tree->numnodes == 0, no tree created.\n");
|
||||
return 00;
|
||||
}
|
||||
|
||||
tree->nodes = (opj_tgt_node_t*) opj_calloc(tree->numnodes, sizeof(opj_tgt_node_t));
|
||||
if(!tree->nodes) {
|
||||
fprintf(stderr, "ERROR in tgt_create while allocating node of the tree\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory to create Tag-tree nodes\n");
|
||||
opj_free(tree);
|
||||
return 00;
|
||||
}
|
||||
memset(tree->nodes,0,tree->numnodes * sizeof(opj_tgt_node_t));
|
||||
tree->nodes_size = tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
|
||||
|
||||
node = tree->nodes;
|
||||
@ -132,7 +130,7 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
||||
* @param p_num_leafs_v the height of the array of leafs of the tree
|
||||
* @return a new tag-tree if successful, NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, OPJ_UINT32 p_num_leafs_v)
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_INT32 l_nplh[32];
|
||||
OPJ_INT32 l_nplv[32];
|
||||
@ -177,7 +175,7 @@ opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, O
|
||||
if (l_node_size > p_tree->nodes_size) {
|
||||
opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes, l_node_size);
|
||||
if (! new_nodes) {
|
||||
fprintf(stderr, "ERROR Not enough memory to reinitialize the tag tree\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to reinitialize the tag tree\n");
|
||||
opj_tgt_destroy(p_tree);
|
||||
return 00;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ Create a tag-tree
|
||||
@param numleafsv Height of the array of leafs of the tree
|
||||
@return Returns a new tag-tree if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv);
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *manager);
|
||||
|
||||
/**
|
||||
* Reinitialises a tag-tree from an exixting one.
|
||||
@ -91,11 +91,12 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv);
|
||||
* @param p_tree the tree to reinitialize.
|
||||
* @param p_num_leafs_h the width of the array of leafs of the tree
|
||||
* @param p_num_leafs_v the height of the array of leafs of the tree
|
||||
* @param p_manager the event manager
|
||||
* @return a new tag-tree if successful, NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,
|
||||
OPJ_UINT32 p_num_leafs_h,
|
||||
OPJ_UINT32 p_num_leafs_v);
|
||||
OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager);
|
||||
/**
|
||||
Destroy a tag-tree, liberating memory
|
||||
@param tree Tag-tree to destroy
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user